[Libreoffice-commits] .: 2 commits - svtools/inc svtools/Library_svt.mk svtools/Package_inc.mk svtools/source tools/inc tools/source
Thomas Arnhold
tarnhold at kemper.freedesktop.org
Thu Jul 21 06:43:16 PDT 2011
svtools/Library_svt.mk | 2
svtools/Package_inc.mk | 1
svtools/inc/svtools/svicnvw.hxx | 289 --
svtools/source/contnr/svicnvw.cxx | 813 -------
svtools/source/contnr/svimpicn.cxx | 4093 -------------------------------------
tools/inc/tools/fsys.hxx | 6
tools/source/fsys/dirent.cxx | 50
tools/source/fsys/tdir.cxx | 39
8 files changed, 5293 deletions(-)
New commits:
commit ee748b288e7c04e52fd5d9b1798149236adb99f5
Author: Thomas Arnhold <thomas at arnhold.org>
Date: Thu Jul 21 10:50:29 2011 +0200
callcatcher: clean up Dir and DirEntry
diff --git a/tools/inc/tools/fsys.hxx b/tools/inc/tools/fsys.hxx
index c379c05..bd76d57 100644
--- a/tools/inc/tools/fsys.hxx
+++ b/tools/inc/tools/fsys.hxx
@@ -290,7 +290,6 @@ public:
void SetExtension( const String& rExt, char cSep = '.' );
String GetExtension( char cSep = '.' ) const;
- String CutExtension( char cSep = '.' );
void SetName( const String& rName, FSysPathStyle eFormatter = FSYS_STYLE_HOST );
inline const String GetNameDirect() const { return String(aName, osl_getThreadTextEncoding()); }
String GetName( FSysPathStyle eFormatter = FSYS_STYLE_HOST ) const;
@@ -336,7 +335,6 @@ public:
sal_Bool operator !=( const DirEntry& rAnotherDir ) const
{ return !(DirEntry::operator==( rAnotherDir )); }
- StringCompare NameCompare( const DirEntry &rWith ) const;
inline StringCompare NameCompareDirect( const DirEntry &rWith ) const
{
#ifdef UNX
@@ -447,12 +445,8 @@ protected:
#endif
public:
- Dir();
Dir( const DirEntry& rDirEntry,
DirEntryKind nKind = FSYS_KIND_ALL );
- Dir( const DirEntry& rDirEntry,
- DirEntryKind nKind,
- FSysSort nSort, ... );
~Dir();
void Reset();
diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx
index 0e8f37e..ea3db76 100644
--- a/tools/source/fsys/dirent.cxx
+++ b/tools/source/fsys/dirent.cxx
@@ -1135,31 +1135,6 @@ String DirEntry::CutName( FSysPathStyle eStyle )
/*************************************************************************
|*
-|* DirEntry::NameCompare
-|*
-|* Beschreibung Vergleich nur die Namen (ohne Pfad, aber mit Gross/Klein)
-|*
-*************************************************************************/
-
-StringCompare DirEntry::NameCompare( const DirEntry &rWith ) const
-{
- ByteString aThisName;
- ByteString aParameterName;
-
-#ifdef UNX
- aThisName = aName;
- aParameterName = rWith.aName;
-#else
- aThisName = ByteString(aName).ToLowerAscii();
- aParameterName = ByteString(rWith.aName).ToLowerAscii();
-#endif
-
- return aThisName.CompareTo( aParameterName );
-}
-
-
-/*************************************************************************
-|*
|* DirEntry::operator==()
|*
*************************************************************************/
@@ -1375,31 +1350,6 @@ void DirEntry::SetExtension( const String& rExtension, char cSep )
/*************************************************************************
|*
-|* DirEntry::CutExtension()
-|*
-*************************************************************************/
-
-String DirEntry::CutExtension( char cSep )
-{
- DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
-
- const char *p0 = ( aName.GetBuffer() );
- const char *p1 = p0 + aName.Len() - 1;
- while ( p1 >= p0 && *p1 != cSep )
- p1--;
-
- if ( p1 >= p0 )
- {
- // es wurde ein cSep an der Position p1 gefunden
- aName.Erase( static_cast< xub_StrLen >(p1-p0) );
- return String(p1 + 1, osl_getThreadTextEncoding());
- }
-
- return String();
-}
-
-/*************************************************************************
-|*
|* DirEntry::SetName()
|*
*************************************************************************/
diff --git a/tools/source/fsys/tdir.cxx b/tools/source/fsys/tdir.cxx
index faedb70..f20a58e 100644
--- a/tools/source/fsys/tdir.cxx
+++ b/tools/source/fsys/tdir.cxx
@@ -386,27 +386,6 @@ sal_uInt16 Dir::Scan( sal_uInt16 nCount )
|*
*************************************************************************/
-Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags, FSysSort nSort, ... ):
- DirEntry( rDirEntry ),
- pReader( 0 )
-{
- DBG_CTOR( Dir, NULL );
-
- Construct( nKindFlags );
-
- std::va_list pArgs;
- va_start( pArgs, nSort );
- ImpSetSort( pArgs, nSort );
-
- Reset();
-}
-
-/*************************************************************************
-|*
-|* Dir::Dir()
-|*
-*************************************************************************/
-
Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags ):
DirEntry( rDirEntry ),
pReader( 0 )
@@ -419,24 +398,6 @@ Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags ):
/*************************************************************************
|*
-|* Dir::Dir()
-|*
-*************************************************************************/
-
-Dir::Dir():
- pReader( 0 )
-{
- DBG_CTOR( Dir, NULL );
-
- pLst = NULL;
- pSortLst = NULL;
- pStatLst = NULL;
- eAttrMask = FSYS_KIND_ALL;
- aNameMask = String("*", osl_getThreadTextEncoding());
-}
-
-/*************************************************************************
-|*
|* Dir::~Dir()
|*
*************************************************************************/
commit 4421325b6a2045043bc3e05deb9628d0ae4111ca
Author: Thomas Arnhold <thomas at arnhold.org>
Date: Thu Jul 21 10:36:32 2011 +0200
callcatcher: completely remove SvIconView
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index 2dee92a..c3dac5e 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -112,9 +112,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/contnr/imivctl1 \
svtools/source/contnr/imivctl2 \
svtools/source/contnr/ivctrl \
- svtools/source/contnr/svicnvw \
svtools/source/contnr/svimpbox \
- svtools/source/contnr/svimpicn \
svtools/source/contnr/svlbitm \
svtools/source/contnr/svlbox \
svtools/source/contnr/svtabbx \
diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk
index 39d2331..428dac1 100644
--- a/svtools/Package_inc.mk
+++ b/svtools/Package_inc.mk
@@ -133,7 +133,6 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/statusbarcontroller.hx
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/stdctrl.hxx,svtools/stdctrl.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/stdmenu.hxx,svtools/stdmenu.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/stringtransfer.hxx,svtools/stringtransfer.hxx))
-$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svicnvw.hxx,svtools/svicnvw.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svlbitm.hxx,svtools/svlbitm.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svlbox.hxx,svtools/svlbox.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/svmedit.hxx,svtools/svmedit.hxx))
diff --git a/svtools/inc/svtools/svicnvw.hxx b/svtools/inc/svtools/svicnvw.hxx
deleted file mode 100644
index 4ec2ffd..0000000
--- a/svtools/inc/svtools/svicnvw.hxx
+++ /dev/null
@@ -1,289 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SVICNVW_HXX
-#define _SVICNVW_HXX
-
-#include <vcl/image.hxx>
-#include <svtools/svlbox.hxx>
-
-class SvImpIconView;
-class SvLBoxEntry;
-class SvLBoxItem;
-class SvLBoxString;
-class SvLBoxContextBmp;
-class SvPtrarr;
-
-#define WB_ICON 0x0001
-#define WB_NAME 0x0002
-#define WB_TEXT 0x0004
-#define WB_FLOW 0x0008
-
-#define ICNVW_FLAG_POS_LOCKED 0x0001
-#define ICNVW_FLAG_USER1 0x1000
-#define ICNVW_FLAG_USER2 0x2000
-#define ICNVW_FLAG_USER3 0x4000
-#define ICNVW_FLAG_USER4 0x8000
-
-enum SvIconViewTextMode
-{
- ShowTextFull = 1,
- ShowTextShort,
- ShowTextSmart, // not implemented
- ShowTextDontKnow // only for entries (uses config? from the view)
-};
-
-class SvIcnVwDataEntry : public SvViewDataEntry
-{
-friend class SvImpIconView;
- sal_uInt16 nIcnVwFlags;
- SvIconViewTextMode eTextMode;
-public:
- Rectangle aRect; // Bounding-Rect of the Entry
- Rectangle aGridRect; // set in grid mode
- Size aTextSize; // set in grid mode only
- sal_uInt16 nX,nY; // for keyboard control
- SvIcnVwDataEntry();
- virtual ~SvIcnVwDataEntry();
-
- sal_Bool IsEntryPosLocked() const { return (sal_Bool)((nIcnVwFlags & ICNVW_FLAG_POS_LOCKED) !=0); }
- void ClearVwFlags( sal_uInt16 nMask ) { nIcnVwFlags &= (~nMask); }
- void SetVwFlags( sal_uInt16 nMask ) { nIcnVwFlags |= nMask; }
- sal_uInt16 GetVwFlags() const { return nIcnVwFlags; }
- SvIconViewTextMode GetTextMode() const { return eTextMode; }
-};
-
-#define SV_LISTBOX_ID_ICONVIEW 2
-
-class SvIconView : public SvLBox
-{
- friend class SvImpIconView;
-
- SvImpIconView* pImp;
- Image aCollapsedEntryBmp;
- Image aExpandedEntryBmp;
- sal_uInt16 nIcnVwFlags;
- void SetModel( SvLBoxTreeList* );
-
-protected:
-
- using SvLBox::CreateEntry;
- SvLBoxEntry* CreateEntry( const XubString&, const Image&, const Image&);
- void ViewDataInitialized( SvLBoxEntry* );
- virtual SvViewData* CreateViewData( SvListEntry* );
- virtual void InitViewData( SvViewData* pData, SvListEntry* pEntry );
-
- void EditingRequest(SvLBoxEntry*,SvLBoxItem*,const Point& );
- void EditedText( const XubString& );
- void EditItemText( SvLBoxEntry*,SvLBoxItem*,const Selection& );
- SvLBoxEntry* pCurEdEntry;
- SvLBoxItem* pCurEdItem;
-
- virtual void WriteDragServerInfo( const Point&, SvLBoxDDInfo* );
- virtual void ReadDragServerInfo( const Point&, SvLBoxDDInfo* );
- virtual void Command( const CommandEvent& rCEvt );
- virtual void PreparePaint( SvLBoxEntry* );
- virtual void StateChanged( StateChangedType nStateChange );
-
-public:
-
- SvIconView( Window* pParent,WinBits nWinStyle=0 );
- SvIconView( Window* pParent,const ResId& rResId );
- ~SvIconView();
-
- void DisconnectFromModel();
-
- SvLBoxEntry* InsertEntry( const XubString& rText, SvLBoxEntry* pParent = 0,
- sal_Bool bChildsOnDemand = sal_False,
- sal_uLong nPos=LIST_APPEND );
-
- SvLBoxEntry* InsertEntry( const XubString& rText,
- const Image& rExpandedEntryBmp,
- const Image& rCollapsedEntryBmp,
- SvLBoxEntry* pParent = 0,
- sal_Bool bChildsOnDemand = sal_False,
- sal_uLong nPos = LIST_APPEND );
-
- const Image& GetDefaultExpandedEntryBmp() const { return aExpandedEntryBmp;}
- const Image& GetDefaultCollapsedEntryBmp() const { return aCollapsedEntryBmp;}
- void SetDefaultExpandedEntryBmp( const Image& rBmp) { aExpandedEntryBmp=rBmp;}
- void SetDefaultCollapsedEntryBmp( const Image& rBmp ) { aCollapsedEntryBmp=rBmp;}
-
- void SetEntryText(SvLBoxEntry*, const XubString& );
- void SetExpandedEntryBmp(SvLBoxEntry*, const Image& );
- void SetCollapsedEntryBmp(SvLBoxEntry*, const Image& );
-
- XubString GetEntryText(SvLBoxEntry*) const;
- Image GetExpandedEntryBmp(SvLBoxEntry*) const;
- Image GetCollapsedEntryBmp(SvLBoxEntry*) const;
-
- virtual SvLBoxEntry* CloneEntry( SvLBoxEntry* pSource );
-
- virtual sal_uInt16 IsA();
-
- virtual void RequestingChilds( SvLBoxEntry* pParent );
-
- virtual void Paint( const Rectangle& rRect );
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void MouseButtonUp( const MouseEvent& rMEvt );
- virtual void MouseMove( const MouseEvent& rMEvt );
- virtual void KeyInput( const KeyEvent& rKEvt );
- virtual void Resize();
- virtual void GetFocus();
- virtual void LoseFocus();
- void SetUpdateMode( sal_Bool );
-
- using SvListView::SetModel;
- virtual void SetModel( SvLBoxTreeList*, SvLBoxEntry* pParent );
- virtual void ModelHasCleared();
- virtual void ModelHasInserted( SvListEntry* pEntry );
- virtual void ModelHasInsertedTree( SvListEntry* pEntry );
- virtual void ModelIsMoving(SvListEntry* pSource,
- SvListEntry* pTargetParent, sal_uLong nChildPos );
- virtual void ModelHasMoved(SvListEntry* pSource );
- virtual void ModelIsRemoving( SvListEntry* pEntry );
- virtual void ModelHasRemoved( SvListEntry* pEntry );
- virtual void ModelHasEntryInvalidated( SvListEntry* pEntry );
-
- virtual void ShowTargetEmphasis( SvLBoxEntry*, sal_Bool bShow );
- using Window::GetDropTarget;
- virtual SvLBoxEntry* GetDropTarget( const Point& );
- virtual Region GetDragRegion() const;
- // NotifyMoving/Copying is overloaded, since GetDropTarget
- // returns a "magic pointer" if the drop happens in/on an empty
- // area(?) of the IconView
- virtual sal_Bool NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos);
- virtual sal_Bool NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos);
-
- // returns TopLeft of the BoundingRect. Add MapMode.Origin to get the
- // position relative to the window
- Point GetEntryPosition( SvLBoxEntry* ) const;
- void SetEntryPosition( SvLBoxEntry*, const Point& rDocPos);
- void SetEntryPosition( SvLBoxEntry*, const Point& rDocPos,
- sal_Bool bAdjustAtGrid );
-
- void SetFont( const Font& rFont );
- void SetDefaultFont();
-
- using SvLBox::GetEntry;
- SvLBoxEntry* GetEntry( const Point& rPixPos, sal_Bool ) const;
- // returns the entry just above pCurEntry (z-wise)
- SvLBoxEntry* GetNextEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const;
- // returns the entry just below pCurEntry (z-wise)
- SvLBoxEntry* GetPrevEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const;
-
- SvLBoxEntry* GetEntryFromLogicPos( const Point& rDocPos ) const;
-
- virtual void PaintEntry( SvLBoxEntry* );
- virtual void PaintEntry( SvLBoxEntry*, const Point& rDocPos );
- Rectangle GetFocusRect( SvLBoxEntry* );
- void InvalidateEntry( SvLBoxEntry* );
- void MakeVisible( SvLBoxEntry* );
-
- void SetDragDropMode( DragDropMode );
- void SetSelectionMode( SelectionMode );
-
- using SvListView::Select;
- sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True );
- void SelectAll( sal_Bool bSelect, sal_Bool bPaint=sal_True );
- virtual void SetCurEntry( SvLBoxEntry* _pEntry );
- virtual SvLBoxEntry*
- GetCurEntry() const;
-
- // locigal coordinates
- void SelectRect(
- const Rectangle& rRect,
- sal_Bool bAdd = sal_False,
- // inverts the intersection with rRect
- // (ignored if bAdd == sal_False)
- SvPtrarr* pOtherRects = 0,
- short nBorderOffs = -5 );
- sal_uLong GetSelectionCount() const;
-
- virtual void Arrange();
- void SetSpaceBetweenEntries( long nHor, long Ver );
- long GetHorSpaceBetweenEntries();
- long GetVerSpaceBetweenEntries();
-
- void EnableInplaceEditing( sal_Bool bEnable );
- void EditEntry( SvLBoxEntry* pEntry = 0 );
- virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& );
- virtual sal_Bool EditedEntry( SvLBoxEntry*, const XubString& rNewText );
-
- void SetCurParent( SvLBoxEntry* pNewParent );
- SvLBoxEntry* GetCurParent() const;
-
- virtual void ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1,
- SvListEntry* pEntry2, sal_uLong nPos );
-
- // pass (0, 0) to switch off grid mode
- void SetGrid( long nDX, long nDY );
-
- // nDeltaY < 0 : View moves up relative to Doc
- // nDeltaY > 0 : View moves down relative to Doc
- // nDeltaX < 0 : View moves left relative to Doc
- // nDeltaX > 0 : View moves right relative to Doc
- using Window::Scroll;
- virtual void Scroll( long nDeltaX, long nDeltaY, sal_uInt16 nFlags = 0 );
-
- virtual void PrepareCommandEvent( const CommandEvent& );
- virtual void StartDrag( sal_Int8 nAction, const Point& );
- virtual void DragFinished( sal_Int8 );
- virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
- using SvLBox::ExecuteDrop;
- virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
-
- void ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos );
- void HideDDIcon();
- void HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos );
-
- // to scroll during Drag&Drop
- void CalcScrollOffsets(
- const Point& rRefPosPixel,
- long& rScrollX,
- long& rScrollY,
- sal_Bool bInDragDrop = sal_False,
- sal_uInt16 nBorderWidth = 10 );
-
- using Window::EndTracking;
- void EndTracking();
- void AdjustAtGrid( SvLBoxEntry* pEntry = 0 );
- void LockEntryPos( SvLBoxEntry* pEntry, sal_Bool bLock = sal_True );
- sal_Bool IsEntryPosLocked( const SvLBoxEntry* pEntry ) const;
-
- void SetTextMode( SvIconViewTextMode, SvLBoxEntry* pEntry = 0 );
- SvIconViewTextMode GetTextMode( const SvLBoxEntry* pEntry = 0 ) const;
-
- void ShowFocusRect( const SvLBoxEntry* pEntry );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/contnr/svicnvw.cxx b/svtools/source/contnr/svicnvw.cxx
deleted file mode 100644
index c8dca4a..0000000
--- a/svtools/source/contnr/svicnvw.cxx
+++ /dev/null
@@ -1,813 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include <svtools/svlbox.hxx>
-#include <svtools/svicnvw.hxx>
-#include <svimpicn.hxx>
-#include <svtools/svlbitm.hxx>
-
-#define ICNVW_BLOCK_ENTRYINS 0x0001
-
-SvIcnVwDataEntry::SvIcnVwDataEntry()
- : nIcnVwFlags(0),eTextMode(ShowTextDontKnow)
-{
-}
-
-SvIcnVwDataEntry::~SvIcnVwDataEntry()
-{
-}
-
-SvIconView::SvIconView( Window* pParent, WinBits nWinStyle ) :
- SvLBox( pParent, nWinStyle | WB_BORDER )
-{
- nIcnVwFlags = 0;
- pImp = new SvImpIconView( this, GetModel(), nWinStyle | WB_ICON );
- pImp->mpViewData = 0;
- SetSelectionMode( SINGLE_SELECTION );
- SetLineColor();
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) );
- SetDefaultFont();
-}
-
-SvIconView::SvIconView( Window* pParent , const ResId& rResId ) :
- SvLBox( pParent, rResId )
-{
- pImp = new SvImpIconView( this, GetModel(), WB_BORDER | WB_ICON );
- nIcnVwFlags = 0;
- pImp->mpViewData = 0;
- SetLineColor();
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- SetBackground( Wallpaper( rStyleSettings.GetFieldColor() ) );
- SetDefaultFont();
- pImp->SetSelectionMode( GetSelectionMode() );
-}
-
-SvIconView::~SvIconView()
-{
- delete pImp;
-}
-
-void SvIconView::SetDefaultFont()
-{
- SetFont( GetFont() );
-}
-
-SvLBoxEntry* SvIconView::CreateEntry( const XubString& rStr,
- const Image& rCollEntryBmp, const Image& rExpEntryBmp )
-{
- SvLBoxEntry* pEntry = new SvLBoxEntry;
-
- SvLBoxContextBmp* pContextBmp =
- new SvLBoxContextBmp( pEntry,0, rCollEntryBmp,rExpEntryBmp, 0xffff );
- pEntry->AddItem( pContextBmp );
-
- SvLBoxString* pString = new SvLBoxString( pEntry, 0, rStr );
- pEntry->AddItem( pString );
-
- return pEntry;
-}
-
-void SvIconView::DisconnectFromModel()
-{
- SvLBox::DisconnectFromModel();
- pImp->SetModel( GetModel(), 0 );
-}
-
-
-SvLBoxEntry* SvIconView::InsertEntry( const XubString& rText,
- SvLBoxEntry* pParent, sal_Bool bChildsOnDemand, sal_uLong nPos )
-{
- SvLBoxEntry* pEntry = CreateEntry(
- rText, aCollapsedEntryBmp, aExpandedEntryBmp );
- pEntry->EnableChildsOnDemand( bChildsOnDemand );
-
- if ( !pParent )
- SvLBox::Insert( pEntry, nPos );
- else
- SvLBox::Insert( pEntry, pParent, nPos );
- return pEntry;
-}
-
-SvLBoxEntry* SvIconView::InsertEntry( const XubString& rText,
- const Image& rExpEntryBmp,
- const Image& rCollEntryBmp,
- SvLBoxEntry* pParent, sal_Bool bChildsOnDemand, sal_uLong nPos)
-{
- SvLBoxEntry* pEntry = CreateEntry(
- rText, rCollEntryBmp, rExpEntryBmp );
-
- pEntry->EnableChildsOnDemand( bChildsOnDemand );
- if ( !pParent )
- SvLBox::Insert( pEntry, nPos );
- else
- SvLBox::Insert( pEntry, pParent, nPos );
- return pEntry;
-}
-
-
-void SvIconView::SetEntryText(SvLBoxEntry* pEntry, const XubString& rStr)
-{
- SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if ( pItem )
- {
- pItem->SetText( pEntry, rStr );
- GetModel()->InvalidateEntry( pEntry );
- }
-}
-
-void SvIconView::SetExpandedEntryBmp(SvLBoxEntry* pEntry, const Image& rBmp)
-{
- SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if ( pItem )
- {
- pItem->SetBitmap2( rBmp );
- GetModel()->InvalidateEntry( pEntry );
- }
-}
-
-void SvIconView::SetCollapsedEntryBmp(SvLBoxEntry* pEntry,
- const Image& rBmp )
-{
- SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if ( pItem )
- {
- pItem->SetBitmap1( rBmp );
- GetModel()->InvalidateEntry( pEntry );
- }
-}
-
-XubString SvIconView::GetEntryText(SvLBoxEntry* pEntry ) const
-{
- XubString aStr;
- SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if ( pItem )
- aStr = pItem->GetText();
- return aStr;
-}
-
-Image SvIconView::GetExpandedEntryBmp(SvLBoxEntry* pEntry) const
-{
- Image aBmp;
- SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if ( pItem )
- aBmp = pItem->GetBitmap2();
- return aBmp;
-}
-
-Image SvIconView::GetCollapsedEntryBmp(SvLBoxEntry* pEntry) const
-{
- Image aBmp;
- SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if ( pItem )
- aBmp = pItem->GetBitmap1();
- return aBmp;
-}
-
-
-SvLBoxEntry* SvIconView::CloneEntry( SvLBoxEntry* pSource )
-{
- XubString aStr;
- Image aCollEntryBmp;
- Image aExpEntryBmp;
-
- SvLBoxString* pStringItem = (SvLBoxString*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if ( pStringItem )
- aStr = pStringItem->GetText();
- SvLBoxContextBmp* pBmpItem =(SvLBoxContextBmp*)(pSource->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if ( pBmpItem )
- {
- aCollEntryBmp = pBmpItem->GetBitmap1();
- aExpEntryBmp = pBmpItem->GetBitmap2();
- }
- SvLBoxEntry* pEntry = CreateEntry( aStr, aCollEntryBmp, aExpEntryBmp );
- pEntry->SvListEntry::Clone( pSource );
- pEntry->EnableChildsOnDemand( pSource->HasChildsOnDemand() );
- pEntry->SetUserData( pSource->GetUserData() );
- return pEntry;
-}
-
-
-sal_uInt16 SvIconView::IsA()
-{
- return SV_LISTBOX_ID_ICONVIEW;
-}
-
-void SvIconView::RequestingChilds( SvLBoxEntry* pParent )
-{
- if ( !pParent->HasChilds() )
- InsertEntry( String::CreateFromAscii("<dummy>"), pParent, sal_False, LIST_APPEND );
-}
-
-void SvIconView::Paint( const Rectangle& rRect )
-{
- pImp->Paint( rRect );
-}
-
-void SvIconView::MouseButtonDown( const MouseEvent& rMEvt )
-{
- pImp->MouseButtonDown( rMEvt );
-}
-
-void SvIconView::MouseButtonUp( const MouseEvent& rMEvt )
-{
- pImp->MouseButtonUp( rMEvt );
-}
-
-void SvIconView::MouseMove( const MouseEvent& rMEvt )
-{
- pImp->MouseMove( rMEvt );
-}
-
-void SvIconView::KeyInput( const KeyEvent& rKEvt )
-{
- // unter OS/2 bekommen wir auch beim Editieren Key-Up/Down
- if( IsEditingActive() )
- return;
-
- nImpFlags |= SVLBOX_IS_TRAVELSELECT;
- sal_Bool bKeyUsed = pImp->KeyInput( rKEvt );
- if ( !bKeyUsed )
- SvLBox::KeyInput( rKEvt );
- nImpFlags &= ~SVLBOX_IS_TRAVELSELECT;
-}
-
-void SvIconView::Resize()
-{
- pImp->Resize();
- SvLBox::Resize();
-}
-
-void SvIconView::GetFocus()
-{
- pImp->GetFocus();
- SvLBox::GetFocus();
-}
-
-void SvIconView::LoseFocus()
-{
- pImp->LoseFocus();
- SvLBox::LoseFocus();
-}
-
-void SvIconView::SetUpdateMode( sal_Bool bUpdate )
-{
- Control::SetUpdateMode( bUpdate );
- if ( bUpdate )
- pImp->UpdateAll();
-}
-
-void SvIconView::SetModel( SvLBoxTreeList* )
-{
-}
-
-void SvIconView::SetModel( SvLBoxTreeList* pNewModel, SvLBoxEntry* pParent )
-{
- nIcnVwFlags |= ICNVW_BLOCK_ENTRYINS;
- SvLBox::SetModel( pNewModel );
- nIcnVwFlags &= (~ICNVW_BLOCK_ENTRYINS);
- if ( pParent && pParent->HasChildsOnDemand() )
- RequestingChilds( pParent );
- pImp->SetModel( pNewModel, pParent );
-}
-
-void SvIconView::ModelHasCleared()
-{
- SvLBox::ModelHasCleared();
- pImp->Clear();
-}
-
-void SvIconView::ModelHasInserted( SvListEntry* pEntry )
-{
- if( !(nIcnVwFlags & ICNVW_BLOCK_ENTRYINS ) )
- pImp->EntryInserted( (SvLBoxEntry*)pEntry );
-}
-
-void SvIconView::ModelHasInsertedTree( SvListEntry* pEntry )
-{
- pImp->TreeInserted( (SvLBoxEntry*)pEntry );
-}
-
-void SvIconView::ModelIsMoving(SvListEntry* pSource,
- SvListEntry* /* pTargetParent */ , sal_uLong /* nChildPos */ )
-{
- pImp->MovingEntry( (SvLBoxEntry*)pSource );
-}
-
-void SvIconView::ModelHasMoved(SvListEntry* pSource )
-{
- pImp->EntryMoved( (SvLBoxEntry*)pSource );
-}
-
-void SvIconView::ModelIsRemoving( SvListEntry* pEntry )
-{
- pImp->RemovingEntry( (SvLBoxEntry*)pEntry );
- NotifyRemoving( (SvLBoxEntry*)pEntry );
-}
-
-void SvIconView::ModelHasRemoved( SvListEntry* /* pEntry */ )
-{
- pImp->EntryRemoved();
-}
-
-void SvIconView::ModelHasEntryInvalidated( SvListEntry* pEntry )
-{
- // die einzelnen Items des Entries reinitialisieren
- SvLBox::ModelHasEntryInvalidated( pEntry );
- // painten
- pImp->ModelHasEntryInvalidated( pEntry );
-}
-
-void SvIconView::ShowTargetEmphasis( SvLBoxEntry* pEntry, sal_Bool bShow )
-{
- pImp->ShowTargetEmphasis( pEntry, bShow );
-}
-
-Point SvIconView::GetEntryPosition( SvLBoxEntry* pEntry ) const
-{
- return ((SvIconView*)this)->pImp->GetEntryPosition( pEntry );
-}
-
-void SvIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos)
-{
- pImp->SetEntryPosition( pEntry, rPos, sal_False, sal_True );
-}
-
-void SvIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos, sal_Bool bAdjustAtGrid )
-{
- pImp->SetEntryPosition( pEntry, rPos, bAdjustAtGrid );
-}
-
-void SvIconView::SetFont( const Font& rFont )
-{
- Font aTempFont( rFont );
- aTempFont.SetTransparent( sal_True );
- SvLBox::SetFont( aTempFont );
- RecalcViewData();
- pImp->ChangedFont();
-}
-
-void SvIconView::ViewDataInitialized( SvLBoxEntry* pEntry )
-{
- pImp->ViewDataInitialized( pEntry );
-}
-
-SvLBoxEntry* SvIconView::GetDropTarget( const Point& rPos )
-{
- return pImp->GetDropTarget( rPos );
-}
-
-SvLBoxEntry* SvIconView::GetEntry( const Point& rPixPos, sal_Bool ) const
-{
- Point aPos( rPixPos );
- aPos -= GetMapMode().GetOrigin();
- return ((SvIconView*)this)->pImp->GetEntry( aPos );
-}
-
-SvLBoxEntry* SvIconView::GetEntryFromLogicPos( const Point& rDocPos ) const
-{
- return ((SvIconView*)this)->pImp->GetEntry( rDocPos );
-}
-
-
-void SvIconView::StateChanged( StateChangedType i_nStateChange )
-{
- SvLBox::StateChanged( i_nStateChange );
- if ( i_nStateChange == STATE_CHANGE_STYLE )
- pImp->SetStyle( GetStyle() );
-}
-
-void SvIconView::PaintEntry( SvLBoxEntry* pEntry )
-{
- pImp->PaintEntry( pEntry );
-}
-
-
-void SvIconView::PaintEntry( SvLBoxEntry* pEntry, const Point& rPos )
-{
- pImp->PaintEntry( pEntry, rPos );
-}
-
-Rectangle SvIconView::GetFocusRect( SvLBoxEntry* pEntry )
-{
- return pImp->CalcFocusRect( pEntry );
-}
-
-void SvIconView::InvalidateEntry( SvLBoxEntry* pEntry )
-{
- pImp->InvalidateEntry( pEntry );
-}
-
-void SvIconView::SetDragDropMode( DragDropMode nDDMode )
-{
- SvLBox::SetDragDropMode( nDDMode );
- pImp->SetDragDropMode( nDDMode );
-}
-
-void SvIconView::SetSelectionMode( SelectionMode eSelectMode )
-{
- SvLBox::SetSelectionMode( eSelectMode );
- pImp->SetSelectionMode( eSelectMode );
-}
-
-sal_Bool SvIconView::Select( SvLBoxEntry* pEntry, sal_Bool bSelect )
-{
- EndEditing();
- sal_Bool bRetVal = SvListView::Select( pEntry, bSelect );
- if( bRetVal )
- {
- pImp->EntrySelected( pEntry, bSelect );
- pHdlEntry = pEntry;
- SelectHdl();
- }
- return bRetVal;
-}
-
-void SvIconView::SelectAll( sal_Bool bSelect, sal_Bool )
-{
- SvLBoxEntry* pEntry = pImp->GetCurParent();
- pEntry = FirstChild( pEntry );
- while( pEntry )
- {
- Select( pEntry, bSelect );
- pEntry = NextSibling( pEntry );
- }
-}
-
-void SvIconView::SetCurEntry( SvLBoxEntry* _pEntry )
-{
- pImp->SetCursor( _pEntry );
- OnCurrentEntryChanged();
-}
-
-SvLBoxEntry* SvIconView::GetCurEntry() const
-{
- return pImp->GetCurEntry();
-}
-
-void SvIconView::Arrange()
-{
-#ifdef DBG_UTIL
- sal_uInt16 n=1;
- if( n == 1 && n-1 == 0 )
- {
- pImp->Arrange();
- }
- else
- {
- pImp->AdjustAtGrid();
- }
-#else
- pImp->Arrange();
-#endif
-}
-
-
-void SvIconView::SetSpaceBetweenEntries( long nX, long nY )
-{
- pImp->SetSpaceBetweenEntries( nX, nY );
-}
-
-sal_Bool SvIconView::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos )
-{
- return pImp->NotifyMoving(pTarget,pEntry,rpNewParent,rNewChildPos);
-}
-
-sal_Bool SvIconView::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos )
-{
- return pImp->NotifyCopying(pTarget,pEntry,rpNewParent,rNewChildPos);
-}
-
-
-void SvIconView::EnableInplaceEditing( sal_Bool bEnable )
-{
- SvLBox::EnableInplaceEditing( bEnable );
-}
-
-void SvIconView::EditingRequest( SvLBoxEntry* pEntry, SvLBoxItem* pItem,
- const Point& )
-{
- if ( pItem->IsA() == SV_ITEM_ID_LBOXSTRING )
- {
- Selection aSel( SELECTION_MIN, SELECTION_MAX );
- if ( EditingEntry( pEntry, aSel ) )
- {
- SelectAll( sal_False );
- EditItemText( pEntry, (SvLBoxString*)pItem, aSel );
- }
- }
-}
-
-
-void SvIconView::EditItemText( SvLBoxEntry* pEntry, SvLBoxItem* pItem,
- const Selection& rSel )
-{
- DBG_ASSERT(pEntry&&pItem,"EditItemText:Params?");
- pCurEdEntry = pEntry;
- pCurEdItem = pItem;
- Rectangle aRect( pImp->CalcTextRect( pEntry, (SvLBoxString*)pItem,0,sal_True ));
-
- aRect.Bottom() += 4;
- pImp->MakeVisible( aRect ); // vor der Umrechnung in Pixel-Koord. rufen!
- aRect.Bottom() -= 4;
-
- Point aPos( aRect.TopLeft() );
- aPos += GetMapMode().GetOrigin(); // Dok-Koord. -> Window-Koord.
- aRect.SetPos( aPos );
-
- aRect.Bottom() += 2; // sieht huebscher aus
-
- EditText( ((SvLBoxString*)pItem)->GetText(), aRect, rSel, sal_True );
-}
-
-void SvIconView::EditEntry( SvLBoxEntry* pEntry )
-{
- if( !pEntry )
- pEntry = pImp->GetCurEntry();
- if( pEntry )
- {
- SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if( pItem )
- {
- Selection aSel( SELECTION_MIN, SELECTION_MAX );
- if( EditingEntry( pEntry, aSel ) )
- {
- SelectAll( sal_False );
- EditItemText( pEntry, pItem, aSel );
- }
- }
- }
-}
-
-void SvIconView::EditedText( const XubString& rStr )
-{
- XubString aRefStr( ((SvLBoxString*)pCurEdItem)->GetText() );
- if ( EditedEntry( pCurEdEntry, rStr ) )
- {
- ((SvLBoxString*)pCurEdItem)->SetText( pCurEdEntry, rStr );
- pModel->InvalidateEntry( pCurEdEntry );
- }
- if( GetSelectionMode()==SINGLE_SELECTION && !GetSelectionCount())
- Select( pCurEdEntry );
-}
-
-
-sal_Bool SvIconView::EditingEntry( SvLBoxEntry*, Selection& )
-{
- return sal_True;
-}
-
-sal_Bool SvIconView::EditedEntry( SvLBoxEntry*, const XubString& )
-{
- return sal_True;
-}
-
-
-void SvIconView::WriteDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo)
-{
- pImp->WriteDragServerInfo( rPos, pInfo );
-}
-
-void SvIconView::ReadDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo )
-{
- pImp->ReadDragServerInfo( rPos, pInfo );
-}
-
-void SvIconView::Command( const CommandEvent& rCEvt )
-{
- pImp->PrepareCommandEvent( rCEvt.GetMousePosPixel() );
-}
-
-void SvIconView::SetCurParent( SvLBoxEntry* pNewParent )
-{
- if ( pNewParent && pNewParent->HasChildsOnDemand() )
- RequestingChilds( pNewParent );
- pImp->SetCurParent( pNewParent );
-}
-
-SvLBoxEntry* SvIconView::GetCurParent() const
-{
- return pImp->GetCurParent();
-}
-
-SvViewData* SvIconView::CreateViewData( SvListEntry* )
-{
- SvIcnVwDataEntry* pEntryData = new SvIcnVwDataEntry;
- return (SvViewData*)pEntryData;
-}
-
-void SvIconView::InitViewData( SvViewData* pData, SvListEntry* pEntry )
-{
- SvLBox::InitViewData( pData, pEntry );
- pImp->InvalidateBoundingRect( ((SvIcnVwDataEntry*)pData)->aRect );
-}
-
-Region SvIconView::GetDragRegion() const
-{
- Rectangle aRect;
- SvLBoxEntry* pEntry = GetCurEntry();
- if( pEntry )
- aRect = pImp->GetBoundingRect( pEntry );
- Region aRegion( aRect );
- return aRegion;
-}
-
-sal_uLong SvIconView::GetSelectionCount() const
-{
- return (sal_uLong)(pImp->GetSelectionCount());
-}
-
-void SvIconView::SetGrid( long nDX, long nDY )
-{
- pImp->SetGrid( nDX, nDY );
-}
-
-void SvIconView::ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1,
- SvListEntry* pEntry2, sal_uLong nPos )
-{
- SvLBox::ModelNotification( nActionId, pEntry1, pEntry2, nPos );
- switch( nActionId )
- {
- case LISTACTION_RESORTING:
- SetUpdateMode( sal_False );
- break;
-
- case LISTACTION_RESORTED:
- SetUpdateMode( sal_True );
- Arrange();
- break;
-
- case LISTACTION_CLEARED:
- if( IsUpdateMode() )
- Update();
- break;
- }
-}
-
-
-void SvIconView::Scroll( long nDeltaX, long nDeltaY, sal_uInt16 )
-{
- pImp->Scroll( nDeltaX, nDeltaY, sal_False );
-}
-
-void SvIconView::PrepareCommandEvent( const CommandEvent& rCEvt )
-{
- pImp->PrepareCommandEvent( rCEvt.GetMousePosPixel() );
-}
-
-void SvIconView::StartDrag( sal_Int8 nAction, const Point& rPos )
-{
- pImp->SttDrag( rPos );
- SvLBoxEntry* pEntry = GetEntry( rPos, sal_True );
- pImp->mpViewData = pEntry;
- SvLBox::StartDrag( nAction, rPos );
-}
-
-void SvIconView::DragFinished( sal_Int8 )
-{
- pImp->EndDrag();
-}
-
-sal_Int8 SvIconView::AcceptDrop( const AcceptDropEvent& rEvt )
-{
- if( pImp->mpViewData )
- pImp->HideDDIcon();
- sal_Int8 nRet = SvLBox::AcceptDrop( rEvt );
- if( DND_ACTION_NONE != nRet )
- pImp->ShowDDIcon( pImp->mpViewData, rEvt.maPosPixel );
-
- return nRet;
-}
-
-sal_Int8 SvIconView::ExecuteDrop( const ExecuteDropEvent& rEvt )
-{
- if( pImp->mpViewData )
- {
- pImp->HideDDIcon();
- pImp->mpViewData = 0;
- }
- return SvLBox::ExecuteDrop( rEvt );
-}
-
-void SvIconView::ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos )
-{
- pImp->ShowDDIcon( pRefEntry, rPos );
-}
-
-void SvIconView::HideDDIcon()
-{
- pImp->HideDDIcon();
-}
-
-void SvIconView::HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos )
-{
- pImp->HideShowDDIcon( pRefEntry, rPos );
-}
-
-void SvIconView::SelectRect( const Rectangle& rRect, sal_Bool bAdd,
- SvPtrarr* pRects, short nOffs )
-{
- pImp->SelectRect( rRect, bAdd, pRects, nOffs );
-}
-
-void SvIconView::CalcScrollOffsets( const Point& rRefPosPixel, long& rX, long& rY,
- sal_Bool b, sal_uInt16 nBorderWidth )
-{
- pImp->CalcScrollOffsets( rRefPosPixel, rX, rY, b, nBorderWidth );
-}
-
-void SvIconView::EndTracking()
-{
- pImp->EndTracking();
-}
-
-void SvIconView::MakeVisible( SvLBoxEntry* pEntry )
-{
- pImp->MakeVisible( pEntry );
-}
-
-void SvIconView::PreparePaint( SvLBoxEntry* )
-{
-}
-
-void SvIconView::AdjustAtGrid( SvLBoxEntry* pEntry )
-{
- pImp->AdjustAtGrid( pEntry );
-}
-
-void SvIconView::LockEntryPos( SvLBoxEntry* pEntry, sal_Bool bLock )
-{
- SvIcnVwDataEntry* pViewData = (SvIcnVwDataEntry*)GetViewData( pEntry );
- if( bLock )
- pViewData->SetVwFlags( ICNVW_FLAG_POS_LOCKED );
- else
- pViewData->ClearVwFlags( ICNVW_FLAG_POS_LOCKED );
-}
-
-sal_Bool SvIconView::IsEntryPosLocked( const SvLBoxEntry* pEntry ) const
-{
- const SvIcnVwDataEntry* pViewData = (const SvIcnVwDataEntry*)GetViewData( (SvListEntry*)pEntry );
- return pViewData->IsEntryPosLocked();
-}
-
-void SvIconView::SetTextMode( SvIconViewTextMode eMode, SvLBoxEntry* pEntry )
-{
- pImp->SetTextMode( eMode, pEntry );
-}
-
-SvIconViewTextMode SvIconView::GetTextMode( const SvLBoxEntry* pEntry ) const
-{
- return pImp->GetTextMode( pEntry );
-}
-
-SvLBoxEntry* SvIconView::GetNextEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const
-{
- Point aPos( rPixPos );
- aPos -= GetMapMode().GetOrigin();
- return ((SvIconView*)this)->pImp->GetNextEntry( aPos, pCurEntry );
-}
-
-SvLBoxEntry* SvIconView::GetPrevEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const
-{
- Point aPos( rPixPos );
- aPos -= GetMapMode().GetOrigin();
- return ((SvIconView*)this)->pImp->GetPrevEntry( aPos, pCurEntry );
-}
-
-void SvIconView::ShowFocusRect( const SvLBoxEntry* pEntry )
-{
- pImp->ShowFocusRect( pEntry );
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx
deleted file mode 100644
index d573b18..0000000
--- a/svtools/source/contnr/svimpicn.cxx
+++ /dev/null
@@ -1,4093 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include <limits.h>
-#include <vcl/metric.hxx>
-#include <vcl/svapp.hxx>
-#ifdef DBG_UTIL
-#include <vcl/sound.hxx>
-#endif
-
-#include <svtools/svlbox.hxx>
-#include <svtools/svicnvw.hxx>
-#include <svimpicn.hxx>
-#include <svtools/svlbitm.hxx>
-#include <svl/svarray.hxx>
-
-
-
-#define VIEWMODE_ICON 0x0001 // Text unter Bitmap
-#define VIEWMODE_NAME 0x0002 // Text rechts neben Bitmap
-#define VIEWMODE_TEXT 0x0004 // Text ohne Bitmap
-
-#define DD_SCROLL_PIXEL 10
-
-// alle Angaben in Pixel
-
-#define ICONVIEW_OFFS_BMP_STRING 3
-
-// fuer das Bounding-Rectangle
-#define LROFFS_BOUND 2
-#define TBOFFS_BOUND 2
-
-// fuer das Focus-Rectangle um Icons
-#define LROFFS_ICON 2
-#define TBOFFS_ICON 2
-
-#define NAMEVIEW_OFFS_BMP_STRING 3
-
-// Abstaende von Fensterraendern
-#define LROFFS_WINBORDER 4
-#define TBOFFS_WINBORDER 4
-
-// Breitenoffset Highlight-Rect bei Text
-#define LROFFS_TEXT 2
-
-
-#define ICNVIEWDATA(xPtr) (SvIcnVwDataEntry*)(pView->GetViewDataEntry(xPtr))
-#define ICNVIEWDATA2(xPtr) (SvIcnVwDataEntry*)(pView->pView->GetViewDataEntry(xPtr))
-
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-// Hilfsfunktionen von Thomas Hosemann zur mehrzeiligen Ausgabe von
-// Strings. Die Funktionen werden spaeter in StarView integriert.
-// -------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-
-// keine doppelten Defines
-#ifdef TEXT_DRAW_CLIP
-#undef TEXT_DRAW_CLIP
-#endif
-#ifdef TEXT_DRAW_MULTILINE
-#undef TEXT_DRAW_MULTILINE
-#endif
-#ifdef TEXT_DRAW_WORDBREAK
-#undef TEXT_DRAW_WORDBREAK
-#endif
-
-// #define TEXT_DRAW_DISABLE ((sal_uInt16)0x0001)
-// #define TEXT_DRAW_3DLOOK ((sal_uInt16)0x0002)
-// #define TEXT_DRAW_MNEMONIC ((sal_uInt16)0x0004)
-#define TEXT_DRAW_LEFT ((sal_uInt16)0x0010)
-#define TEXT_DRAW_CENTER ((sal_uInt16)0x0020)
-#define TEXT_DRAW_RIGHT ((sal_uInt16)0x0040)
-#define TEXT_DRAW_TOP ((sal_uInt16)0x0080)
-#define TEXT_DRAW_VCENTER ((sal_uInt16)0x0100)
-#define TEXT_DRAW_BOTTOM ((sal_uInt16)0x0200)
-#define TEXT_DRAW_ENDELLIPSIS ((sal_uInt16)0x0400)
-#define TEXT_DRAW_PATHELLIPSIS ((sal_uInt16)0x0800)
-#define TEXT_DRAW_CLIP ((sal_uInt16)0x1000)
-#define TEXT_DRAW_MULTILINE ((sal_uInt16)0x2000)
-#define TEXT_DRAW_WORDBREAK ((sal_uInt16)0x4000)
-
-XubString GetEllipsisString( OutputDevice* pDev,
- const XubString& rStr, long nMaxWidth,
- sal_uInt16 nStyle = TEXT_DRAW_ENDELLIPSIS )
-{
- XubString aStr = rStr;
-
- if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
- {
- sal_uInt16 nIndex = pDev->GetTextBreak( rStr, nMaxWidth );
- if ( nIndex != STRING_LEN )
- {
- aStr.Erase( nIndex );
- if ( nIndex > 1 )
- {
- aStr.AppendAscii("...");
- while ( aStr.Len() &&
- (pDev->GetTextWidth( aStr ) > nMaxWidth) )
- {
- if ( (nIndex > 1) || (nIndex == aStr.Len()) )
- nIndex--;
- aStr.Erase( nIndex, 1 );
- }
- }
-
- if ( !aStr.Len() && (nStyle & TEXT_DRAW_CLIP) )
- aStr += rStr.GetChar( 0 );
- }
- }
-
- return aStr;
-}
-
-class TextLineInfo
-{
-private:
- long mnWidth;
- sal_uInt16 mnIndex;
- sal_uInt16 mnLen;
-
-public:
- TextLineInfo( long nWidth, sal_uInt16 nIndex, sal_uInt16 nLen )
- {
- mnWidth = nWidth;
- mnIndex = nIndex;
- mnLen = nLen;
- }
-
- long GetWidth() const { return mnWidth; }
- sal_uInt16 GetIndex() const { return mnIndex; }
- sal_uInt16 GetLen() const { return mnLen; }
-};
-
-#define MULTITEXTLINEINFO_RESIZE 16
-typedef TextLineInfo* PTextLineInfo;
-
-class MultiTextLineInfo
-{
-private:
- PTextLineInfo* mpLines;
- sal_uInt16 mnLines;
- sal_uInt16 mnSize;
-
-public:
- MultiTextLineInfo();
- ~MultiTextLineInfo();
-
- void AddLine( TextLineInfo* pLine );
- void Clear();
-
- TextLineInfo* GetLine( sal_uInt16 nLine ) const
- { return mpLines[nLine]; }
- sal_uInt16 Count() const { return mnLines; }
-
-private:
- MultiTextLineInfo( const MultiTextLineInfo& );
- MultiTextLineInfo& operator=( const MultiTextLineInfo& );
-};
-
-MultiTextLineInfo::MultiTextLineInfo()
-{
- mpLines = new PTextLineInfo[MULTITEXTLINEINFO_RESIZE];
- mnLines = 0;
- mnSize = MULTITEXTLINEINFO_RESIZE;
-}
-
-MultiTextLineInfo::~MultiTextLineInfo()
-{
- for ( sal_uInt16 i = 0; i < mnLines; i++ )
- delete mpLines[i];
- delete [] mpLines;
-}
-
-void MultiTextLineInfo::AddLine( TextLineInfo* pLine )
-{
- if ( mnSize == mnLines )
- {
- mnSize += MULTITEXTLINEINFO_RESIZE;
- PTextLineInfo* pNewLines = new PTextLineInfo[mnSize];
- memcpy( pNewLines, mpLines, mnLines*sizeof(PTextLineInfo) );
- mpLines = pNewLines;
- }
-
- mpLines[mnLines] = pLine;
- mnLines++;
-}
-
-void MultiTextLineInfo::Clear()
-{
- for ( sal_uInt16 i = 0; i < mnLines; i++ )
- delete mpLines[i];
- mnLines = 0;
-}
-
-// -----------------------------------------------------------------------
-
-long GetTextLines( OutputDevice* pDev, MultiTextLineInfo& rLineInfo,
- long nWidth, const XubString& rStr,
- sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK )
-{
- rLineInfo.Clear();
- if ( !rStr.Len() )
- return 0;
- if ( nWidth <= 0 )
- nWidth = 1;
-
- sal_uInt16 nStartPos = 0; // Start-Position der Zeile
- sal_uInt16 nLastLineLen = 0; // Zeilenlaenge bis zum vorherigen Wort
- sal_uInt16 nLastWordPos = 0; // Position des letzten Wortanfangs
- sal_uInt16 i = 0;
- sal_uInt16 nPos; // StartPositon der Zeile (nur Temp)
- sal_uInt16 nLen; // Laenge der Zeile (nur Temp)
- sal_uInt16 nStrLen = rStr.Len();
- long nMaxLineWidth = 0; // Maximale Zeilenlaenge
- long nLineWidth; // Aktuelle Zeilenlaenge
- long nLastLineWidth = 0; // Zeilenlaenge der letzten Zeile
- xub_Unicode c;
- xub_Unicode c2;
- const xub_Unicode* pStr = rStr.GetBuffer();
- sal_Bool bHardBreak = sal_False;
-
- do
- {
- c = pStr[i];
-
- // Auf Zeilenende ermitteln
- if ( (c == _CR) || (c == _LF) )
- bHardBreak = sal_True;
- else
- bHardBreak = sal_False;
-
- // Testen, ob ein Wortende erreicht ist
- if ( bHardBreak || (i == nStrLen) ||
- (((c == ' ') || (c == '-')) && (nStyle & TEXT_DRAW_WORDBREAK)) )
- {
- nLen = i-nStartPos;
- if ( c == '-' )
- nLen++;
- nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLen );
-
- // Findet ein Zeilenumbruch statt
- if ( bHardBreak || (i == nStrLen) ||
- ((nLineWidth >= nWidth) && (nStyle & TEXT_DRAW_WORDBREAK)) )
- {
- nPos = nStartPos;
-
- if ( (nLineWidth >= nWidth) && (nStyle & TEXT_DRAW_WORDBREAK) )
- {
- nLineWidth = nLastLineWidth;
- nLen = nLastLineLen;
- nStartPos = nLastWordPos;
- nLastLineLen = i-nStartPos;
- nLastWordPos = nStartPos+nLastLineLen+1;
- if ( c == '-' )
- nLastLineLen++;
- else if ( bHardBreak && (i > nStartPos) )
- i--;
- }
- else
- {
- nStartPos = i;
- // Zeilenende-Zeichen und '-' beruecksichtigen
- if ( bHardBreak )
- {
- nStartPos++;
- c2 = pStr[i+1];
- if ( (c != c2) && ((c2 == _CR) || (c2 == _LF)) )
- {
- nStartPos++;
- i++;
- }
- }
- else if ( c != '-' )
- nStartPos++;
- nLastWordPos = nStartPos;
- nLastLineLen = 0;
- }
-
- if ( nLineWidth > nMaxLineWidth )
- nMaxLineWidth = nLineWidth;
-
- if ( nLen || bHardBreak )
- rLineInfo.AddLine( new TextLineInfo( nLineWidth, nPos, nLen ) );
-
- // Testen, ob aktuelles Wort noch auf die Zeile passt,
- // denn ansonsten mueessen wir es auftrennen
- if ( nLastLineLen )
- {
- nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLastLineLen );
- if ( nLineWidth > nWidth )
- {
- // Wenn ein Wortumbruch in einem Wort stattfindet,
- // ist die maximale Zeilenlaenge die Laenge
- // des laengsten Wortes
- if ( nLineWidth > nMaxLineWidth )
- nMaxLineWidth = nLineWidth;
-
- // Solange Wort auftrennen, bis es auf eine Zeile passt
- do
- {
- nPos = pDev->GetTextBreak( rStr, nWidth, nStartPos, nLastLineLen );
- nLen = nPos-nStartPos;
- if ( !nLen )
- {
- nPos++;
- nLen++;
- }
- nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLen );
- rLineInfo.AddLine( new TextLineInfo( nLineWidth, nStartPos, nLen ) );
- nStartPos = nPos;
- nLastLineLen = nLastLineLen - nLen;
- nLineWidth = pDev->GetTextWidth( rStr, nStartPos, nLastLineLen );
- }
- while ( nLineWidth > nWidth );
- }
- nLastLineWidth = nLineWidth;
-
- // Bei Stringende muessen wir die letzte Zeile auch noch
- // dranhaengen
- if ( (i == nStrLen) && nLastLineLen )
- rLineInfo.AddLine( new TextLineInfo( nLastLineWidth, nStartPos, nLastLineLen ) );
- }
- else
- nLastLineWidth = 0;
- }
- else
- {
- nLastLineWidth = nLineWidth;
- nLastLineLen = nLen;
- nLastWordPos = nStartPos+nLastLineLen;
- if ( c != '-' )
- nLastWordPos++;
- }
- }
-
- i++;
- }
- while ( i <= nStrLen );
-
- return nMaxLineWidth;
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 GetTextLines( OutputDevice* pDev, const Rectangle& rRect,
- const XubString& rStr,
- sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK,
- long* pMaxWidth = NULL )
-{
- MultiTextLineInfo aMultiLineInfo;
- long nMaxWidth = GetTextLines( pDev, aMultiLineInfo,
- rRect.GetWidth(), rStr, nStyle );
- if ( pMaxWidth )
- *pMaxWidth = nMaxWidth;
- return aMultiLineInfo.Count();
-}
-
-// -----------------------------------------------------------------------
-
-Rectangle GetTextRect( OutputDevice* pDev, const Rectangle& rRect,
- const XubString& rStr,
- sal_uInt16 nStyle = TEXT_DRAW_WORDBREAK )
-{
- Rectangle aRect = rRect;
- sal_uInt16 nLines;
- long nWidth = rRect.GetWidth();
- long nMaxWidth;
- long nTextHeight;
-
- if ( nStyle & TEXT_DRAW_MULTILINE )
- {
- MultiTextLineInfo aMultiLineInfo;
- TextLineInfo* pLineInfo;
- sal_uInt16 nFormatLines;
-
- nMaxWidth = 0;
- GetTextLines( pDev, aMultiLineInfo, nWidth, rStr, nStyle );
- nFormatLines = aMultiLineInfo.Count();
- nTextHeight = pDev->GetTextHeight();
- nLines = (sal_uInt16)(aRect.GetHeight()/nTextHeight);
- if ( nFormatLines <= nLines )
- nLines = nFormatLines;
- else
- {
- if ( !(nStyle & TEXT_DRAW_ENDELLIPSIS) )
- nLines = nFormatLines;
- else
- nMaxWidth = nWidth;
- }
- for ( sal_uInt16 i = 0; i < nLines; i++ )
- {
- pLineInfo = aMultiLineInfo.GetLine( i );
- if ( pLineInfo->GetWidth() > nMaxWidth )
- nMaxWidth = pLineInfo->GetWidth();
- }
- }
- else
- {
- nLines = 1;
- nMaxWidth = pDev->GetTextWidth( rStr );
- nTextHeight = pDev->GetTextHeight();
- if ( (nMaxWidth > nWidth) && (nStyle & TEXT_DRAW_ENDELLIPSIS) )
- nMaxWidth = nWidth;
- }
-
- if ( nStyle & TEXT_DRAW_RIGHT )
- aRect.Left() = aRect.Right()-nMaxWidth+1;
- else if ( nStyle & TEXT_DRAW_CENTER )
- {
- aRect.Left() += (nWidth-nMaxWidth)/2;
- aRect.Right() = aRect.Left()+nMaxWidth-1;
- }
- else
- aRect.Right() = aRect.Left()+nMaxWidth-1;
-
- if ( nStyle & TEXT_DRAW_BOTTOM )
- aRect.Top() = aRect.Bottom()-(nTextHeight*nLines)+1;
- else if ( nStyle & TEXT_DRAW_VCENTER )
- {
- aRect.Top() += (aRect.GetHeight()-(nTextHeight*nLines))/2;
- aRect.Bottom() = aRect.Top()+(nTextHeight*nLines)-1;
- }
- else
- aRect.Bottom() = aRect.Top()+(nTextHeight*nLines)-1;
-
- return aRect;
-}
-
-// -----------------------------------------------------------------------
-
-void DrawText( OutputDevice* pDev, const Rectangle& rRect,
- const XubString& rStr, sal_uInt16 nStyle = 0 )
-{
- if ( !rStr.Len() || rRect.IsEmpty() )
- return;
-
- Point aPos = rRect.TopLeft();
- long nWidth = rRect.GetWidth();
- long nHeight = rRect.GetHeight();
- FontAlign eAlign = pDev->GetFont().GetAlign();
-
- if ( ((nWidth <= 0) || (nHeight <= 0)) && (nStyle & TEXT_DRAW_CLIP) )
- return;
-
- // Mehrzeiligen Text behandeln wir anders
- if ( nStyle & TEXT_DRAW_MULTILINE )
- {
- String aLastLine;
- Region aOldRegion;
- MultiTextLineInfo aMultiLineInfo;
- TextLineInfo* pLineInfo;
- long nTextHeight = pDev->GetTextHeight();
- long nMaxTextWidth;
- sal_uInt16 i;
- sal_uInt16 nLines = (sal_uInt16)(nHeight/nTextHeight);
- sal_uInt16 nFormatLines;
- sal_Bool bIsClipRegion = sal_False;
- nMaxTextWidth = GetTextLines( pDev, aMultiLineInfo, nWidth, rStr, nStyle );
-
- nFormatLines = aMultiLineInfo.Count();
- if ( nFormatLines > nLines )
- {
- if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
- {
- // Letzte Zeile zusammenbauen und kuerzen
- nFormatLines = nLines-1;
- pLineInfo = aMultiLineInfo.GetLine( nFormatLines );
- aLastLine = rStr.Copy( pLineInfo->GetIndex() );
- aLastLine.ConvertLineEnd( LINEEND_LF );
- aLastLine.SearchAndReplace( _LF, ' ' );
- aLastLine = GetEllipsisString( pDev, aLastLine, nWidth, nStyle );
- nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM);
- nStyle |= TEXT_DRAW_TOP;
- }
- }
- else
- {
- if ( nMaxTextWidth <= nWidth )
- nStyle &= ~TEXT_DRAW_CLIP;
- }
-
- // Clipping setzen
- if ( nStyle & TEXT_DRAW_CLIP )
- {
- bIsClipRegion = pDev->IsClipRegion();
- if ( bIsClipRegion )
- {
- aOldRegion = pDev->GetClipRegion();
- pDev->IntersectClipRegion( rRect );
- }
- else
- {
- Region aRegion( rRect );
- pDev->SetClipRegion( aRegion );
- }
- }
-
- // Vertikales Alignment
- if ( nStyle & TEXT_DRAW_BOTTOM )
- aPos.Y() += nHeight-(nFormatLines*nTextHeight);
- else if ( nStyle & TEXT_DRAW_VCENTER )
- aPos.Y() += (nHeight-(nFormatLines*nTextHeight))/2;
-
- // Font Alignment
- if ( eAlign == ALIGN_BOTTOM )
- aPos.Y() += nTextHeight;
- else if ( eAlign == ALIGN_BASELINE )
- aPos.Y() += pDev->GetFontMetric().GetAscent();
-
- // Alle Zeilen ausgeben, bis auf die letzte
- for ( i = 0; i < nFormatLines; i++ )
- {
- pLineInfo = aMultiLineInfo.GetLine( i );
- if ( nStyle & TEXT_DRAW_RIGHT )
- aPos.X() += nWidth-pLineInfo->GetWidth();
- else if ( nStyle & TEXT_DRAW_CENTER )
- aPos.X() += (nWidth-pLineInfo->GetWidth())/2;
- pDev->DrawText( aPos, rStr, pLineInfo->GetIndex(), pLineInfo->GetLen() );
- aPos.Y() += nTextHeight;
- aPos.X() = rRect.Left();
- }
-
- // Gibt es noch eine letzte Zeile, dann diese linksbuendig ausgeben,
- // da die Zeile gekuerzt wurde
- if ( aLastLine.Len() )
- pDev->DrawText( aPos, aLastLine );
-
- // Clipping zuruecksetzen
- if ( nStyle & TEXT_DRAW_CLIP )
- {
- if ( bIsClipRegion )
- pDev->SetClipRegion( aOldRegion );
- else
- pDev->SetClipRegion();
- }
- }
- else
- {
- XubString aStr = rStr;
- Size aTextSize(pDev->GetTextWidth( aStr ), pDev->GetTextHeight());
-
- // Evt. Text kuerzen
- if ( aTextSize.Width() > nWidth )
- {
- if ( nStyle & TEXT_DRAW_ENDELLIPSIS )
- {
- aStr = GetEllipsisString( pDev, rStr, nWidth, nStyle );
- nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT);
- nStyle |= TEXT_DRAW_LEFT;
- aTextSize.Width() = pDev->GetTextWidth(aStr);
- }
- }
- else
- {
- if ( aTextSize.Height() <= nHeight )
- nStyle &= ~TEXT_DRAW_CLIP;
- }
-
- // Vertikales Alignment
- if ( nStyle & TEXT_DRAW_RIGHT )
- aPos.X() += nWidth-aTextSize.Width();
- else if ( nStyle & TEXT_DRAW_CENTER )
- aPos.X() += (nWidth-aTextSize.Width())/2;
-
- // Font Alignment
- if ( eAlign == ALIGN_BOTTOM )
- aPos.Y() += aTextSize.Height();
- else if ( eAlign == ALIGN_BASELINE )
- aPos.Y() += pDev->GetFontMetric().GetAscent();
-
- if ( nStyle & TEXT_DRAW_BOTTOM )
- aPos.Y() += nHeight-aTextSize.Height();
- else if ( nStyle & TEXT_DRAW_VCENTER )
- aPos.Y() += (nHeight-aTextSize.Height())/2;
-
- if ( nStyle & TEXT_DRAW_CLIP )
- {
- sal_Bool bIsClipRegion = pDev->IsClipRegion();
- if ( bIsClipRegion )
- {
- Region aOldRegion = pDev->GetClipRegion();
- pDev->IntersectClipRegion( rRect );
- pDev->DrawText( aPos, aStr );
- pDev->SetClipRegion( aOldRegion );
- }
- else
- {
- Region aRegion( rRect );
- pDev->SetClipRegion( aRegion );
- pDev->DrawText( aPos, aStr );
- pDev->SetClipRegion();
- }
- }
- else
- pDev->DrawText( aPos, aStr );
- }
-}
-
-// -----------------------------------------------------------------------
-
-
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-
-
-#define DRAWTEXT_FLAGS (TEXT_DRAW_CENTER|TEXT_DRAW_TOP|TEXT_DRAW_ENDELLIPSIS|\
- TEXT_DRAW_CLIP|TEXT_DRAW_MULTILINE|TEXT_DRAW_WORDBREAK)
-
-
-class ImpIcnCursor
-{
- SvImpIconView* pView;
- SvPtrarr* pColumns;
- SvPtrarr* pRows;
- sal_Bool* pGridMap;
- long nGridDX, nGridDY;
- long nGridCols, nGridRows;
- long nCols;
- long nRows;
- short nDeltaWidth;
- short nDeltaHeight;
- SvLBoxEntry* pCurEntry;
- void SetDeltas();
- void ImplCreate();
- void Create() { if( !pColumns ) ImplCreate(); }
-
- sal_uInt16 GetSortListPos( SvPtrarr* pList, long nValue, int bVertical);
- SvLBoxEntry* SearchCol(sal_uInt16 nCol,sal_uInt16 nTop,sal_uInt16 nBottom,sal_uInt16 nPref,
- sal_Bool bDown, sal_Bool bSimple );
- SvLBoxEntry* SearchRow(sal_uInt16 nRow,sal_uInt16 nRight,sal_uInt16 nLeft,sal_uInt16 nPref,
- sal_Bool bRight, sal_Bool bSimple );
-
- void CreateGridMap();
- // Rueckgabe sal_False: Eintrag liegt nicht in der GridMap. rGridx,y werden
- // dann an nGridCols, nGridRows geclippt
- sal_Bool GetGrid( const Point& rDocPos, sal_uInt16& rGridX, sal_uInt16& rGridY ) const;
- void SetGridUsed( sal_uInt16 nDX, sal_uInt16 nDY, sal_Bool bUsed )
- {
- pGridMap[ (nDY * nGridCols) + nDX ] = bUsed;
- }
-public:
- ImpIcnCursor( SvImpIconView* pOwner );
- ~ImpIcnCursor();
- void Clear( sal_Bool bGridToo = sal_True );
-
- // fuer Cursortravelling usw.
- SvLBoxEntry* GoLeftRight( SvLBoxEntry*, sal_Bool bRight );
- SvLBoxEntry* GoUpDown( SvLBoxEntry*, sal_Bool bDown );
-
- // Rueckgaebe: sal_False == Das leere Rect steht hinter dem letzten
- // Eintrag; d.h. beim naechsten Einfuegen ergibt sich das naechste
- // leere Rechteck durch Addition. Hinweis: Das Rechteck kann dann
- // ausserhalb des View-Space liegen
- sal_Bool FindEmptyGridRect( Rectangle& rRect );
-
- // Erzeugt fuer jede Zeile (Hoehe=nGridDY) eine nach BoundRect.Left()
- // sortierte Liste der Eintraege, die in ihr stehen. Eine Liste kann
- // leer sein. Die Listen gehen in das Eigentum des Rufenden ueber und
- // muessen mit DestroyGridAdjustData geloescht werden
- void CreateGridAjustData( SvPtrarr& pLists, SvLBoxEntry* pRow=0);
- static void DestroyGridAdjustData( SvPtrarr& rLists );
- void SetGridUsed( const Rectangle&, sal_Bool bUsed = sal_True );
-};
-
-
-
-
-SvImpIconView::SvImpIconView( SvIconView* pCurView, SvLBoxTreeList* pTree,
- WinBits i_nWinStyle ) :
- aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ),
- aHorSBar( pCurView, WB_DRAG | WB_HSCROLL )
-{
- pView = pCurView;
- pModel = pTree;
- pCurParent = 0;
- pZOrderList = new SvPtrarr;
- SetStyle( i_nWinStyle );
- nHorDist = 0;
- nVerDist = 0;
- nFlags = 0;
- nCurUserEvent = 0;
- nMaxVirtWidth = 200;
- pDDRefEntry = 0;
- pDDDev = 0;
- pDDBufDev = 0;
- pDDTempDev = 0;
- eTextMode = ShowTextShort;
- pImpCursor = new ImpIcnCursor( this );
-
- aVerSBar.SetScrollHdl( LINK( this, SvImpIconView, ScrollUpDownHdl ) );
- aHorSBar.SetScrollHdl( LINK( this, SvImpIconView, ScrollLeftRightHdl ) );
- nHorSBarHeight = aHorSBar.GetSizePixel().Height();
- nVerSBarWidth = aVerSBar.GetSizePixel().Width();
-
- aMouseMoveTimer.SetTimeout( 20 );
- aMouseMoveTimer.SetTimeoutHdl(LINK(this,SvImpIconView,MouseMoveTimeoutHdl));
-
- aEditTimer.SetTimeout( 800 );
- aEditTimer.SetTimeoutHdl(LINK(this,SvImpIconView,EditTimeoutHdl));
-
- Clear( sal_True );
-}
-
-SvImpIconView::~SvImpIconView()
-{
- StopEditTimer();
- CancelUserEvent();
- delete pZOrderList;
- delete pImpCursor;
- delete pDDDev;
- delete pDDBufDev;
- delete pDDTempDev;
- ClearSelectedRectList();
-}
-
-void SvImpIconView::Clear( sal_Bool bInCtor )
-{
- StopEditTimer();
- CancelUserEvent();
- nMaxBmpWidth = 0;
- nMaxBmpHeight = 0;
- nMaxTextWidth = 0;
- bMustRecalcBoundingRects = sal_False;
- nMaxBoundHeight = 0;
-
- //XXX
- nFlags |= F_GRID_INSERT;
- nFlags &= ~F_PAINTED;
- SetNextEntryPos( Point( LROFFS_WINBORDER, TBOFFS_WINBORDER ) );
- pCursor = 0;
- if( !bInCtor )
- {
- pImpCursor->Clear();
- aVirtOutputSize.Width() = 0;
- aVirtOutputSize.Height() = 0;
- pZOrderList->Remove(0,pZOrderList->Count());
- MapMode aMapMode( pView->GetMapMode());
- aMapMode.SetOrigin( Point() );
- pView->SetMapMode( aMapMode );
- if( pView->IsUpdateMode() )
- pView->Invalidate();
- }
- AdjustScrollBars();
-}
-
-void SvImpIconView::SetStyle( const WinBits i_nWinStyle )
-{
- nViewMode = VIEWMODE_TEXT;
- if( i_nWinStyle & WB_NAME )
- nViewMode = VIEWMODE_NAME;
- if( i_nWinStyle & WB_ICON )
- nViewMode = VIEWMODE_ICON;
-}
-
-
-IMPL_LINK( SvImpIconView, ScrollUpDownHdl, ScrollBar *, pScrollBar )
-{
- pView->EndEditing( sal_True );
- // Pfeil hoch: delta=-1; Pfeil runter: delta=+1
- Scroll( 0, pScrollBar->GetDelta(), sal_True );
- return 0;
-}
-
-IMPL_LINK( SvImpIconView, ScrollLeftRightHdl, ScrollBar *, pScrollBar )
-{
- pView->EndEditing( sal_True );
- // Pfeil links: delta=-1; Pfeil rechts: delta=+1
- Scroll( pScrollBar->GetDelta(), 0, sal_True );
- return 0;
-}
-
-void SvImpIconView::ChangedFont()
-{
- StopEditTimer();
- ImpArrange();
-}
-
-
-void SvImpIconView::CheckAllSizes()
-{
- nMaxTextWidth = 0;
- nMaxBmpWidth = 0;
- nMaxBmpHeight = 0;
- SvLBoxEntry* pEntry = pModel->First();
- while( pEntry )
- {
- CheckSizes( pEntry );
- pEntry = pModel->Next( pEntry );
- }
-}
-
-void SvImpIconView::CheckSizes( SvLBoxEntry* pEntry,
- const SvIcnVwDataEntry* pViewData )
-{
- Size aSize;
-
- if( !pViewData )
- pViewData = ICNVIEWDATA(pEntry);
-
- SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if( pStringItem )
- {
- aSize = GetItemSize( pView, pEntry, pStringItem, pViewData );
- if( aSize.Width() > nMaxTextWidth )
- {
- nMaxTextWidth = aSize.Width();
- if( !(nFlags & F_GRIDMODE ) )
- bMustRecalcBoundingRects = sal_True;
- }
- }
- SvLBoxContextBmp* pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if( pBmpItem )
- {
- aSize = GetItemSize( pView, pEntry, pBmpItem, pViewData );
- if( aSize.Width() > nMaxBmpWidth )
- {
- nMaxBmpWidth = aSize.Width();
- nMaxBmpWidth += (2*LROFFS_ICON);
- if( !(nFlags & F_GRIDMODE ) )
- bMustRecalcBoundingRects = sal_True;
- }
- if( aSize.Height() > nMaxBmpHeight )
- {
- nMaxBmpHeight = aSize.Height();
- nMaxBmpHeight += (2*TBOFFS_ICON);;
- if( !(nFlags & F_GRIDMODE ) )
- bMustRecalcBoundingRects = sal_True;
- }
- }
-}
-
-void SvImpIconView::EntryInserted( SvLBoxEntry* pEntry )
-{
- if( pModel->GetParent(pEntry) == pCurParent )
- {
- StopEditTimer();
- DBG_ASSERT(pZOrderList->GetPos(pEntry)==0xffff,"EntryInserted:ZOrder?");
- pZOrderList->Insert( pEntry, pZOrderList->Count() );
- if( nFlags & F_GRIDMODE )
- pImpCursor->Clear( sal_False );
- else
- pImpCursor->Clear( sal_True );
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- CheckSizes( pEntry, pViewData );
- if( pView->IsUpdateMode() )
- {
- FindBoundingRect( pEntry, pViewData );
- PaintEntry( pEntry, pViewData );
- }
- else
- InvalidateBoundingRect( pViewData->aRect );
- }
-}
-
-void SvImpIconView::RemovingEntry( SvLBoxEntry* pEntry )
-{
- if( pModel->GetParent(pEntry) == pCurParent)
- {
- StopEditTimer();
- DBG_ASSERT(pZOrderList->GetPos(pEntry)!=0xffff,"RemovingEntry:ZOrder?");
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- if( IsBoundingRectValid( pViewData->aRect ) )
- {
- // bei gueltigem Bounding-Rect muss in EntryRemoved eine
- // Sonderbehandlung erfolgen
- nFlags |= F_ENTRY_REMOVED;
- pView->Invalidate( pViewData->aRect );
- }
- if( pEntry == pCursor )
- {
- SvLBoxEntry* pNewCursor = GetNewCursor();
- ShowCursor( sal_False );
- pCursor = 0; // damit er nicht deselektiert wird
- SetCursor( pNewCursor );
- }
- sal_uInt16 nPos = pZOrderList->GetPos( (void*)pEntry );
- pZOrderList->Remove( nPos, 1 );
- pImpCursor->Clear();
- }
-}
-
-void SvImpIconView::EntryRemoved()
-{
- if( (nFlags & (F_ENTRY_REMOVED | F_PAINTED)) == (F_ENTRY_REMOVED | F_PAINTED))
- {
- // Ein Eintrag mit gueltigem BoundRect wurde geloescht und wir
- // haben schon mal gepaintet. In diesem Fall muessen wir die
- // Position des naechsten Eintrags, der eingefuegt wird oder noch
- // kein gueltiges BoundRect hat, "suchen" d.h. ein "Loch" in
- // der View auffuellen.
- nFlags &= ~( F_ENTRY_REMOVED | F_GRID_INSERT );
- }
-}
-
-
-void SvImpIconView::MovingEntry( SvLBoxEntry* pEntry )
-{
- DBG_ASSERT(pEntry,"MovingEntry: 0!");
- pNextCursor = 0;
- StopEditTimer();
- if( pModel->GetParent(pEntry) == pCurParent )
- {
- DBG_ASSERT(pZOrderList->GetPos(pEntry)!=0xffff,"MovingEntry:ZOrder?");
- nFlags |= F_MOVING_SIBLING;
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- if( IsBoundingRectValid( pViewData->aRect ) )
- pView->Invalidate( pViewData->aRect );
- // falls Eintrag seinen Parent wechselt vorsichtshalber
- // die neue Cursorposition berechnen
- if( pEntry == pCursor )
- pNextCursor = GetNewCursor();
- pImpCursor->Clear();
- }
-}
-
-
-void SvImpIconView::EntryMoved( SvLBoxEntry* pEntry )
-{
- ShowCursor( sal_False );
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- if( pModel->GetParent(pEntry)==pCurParent )
- {
- if( nFlags & F_MOVING_SIBLING )
- {
- // die Neu-Positionierung eines Eintrags bei D&D innerhalb
- // einer IconView findet bereits in NotifyMoving statt
- // (MovingEntry/EntryMoved wird dann nicht mehr gerufen)
- ToTop( pEntry );
- }
- else
- {
- pImpCursor->Clear();
- pZOrderList->Insert( pEntry, pZOrderList->Count() );
- DBG_ASSERT(pZOrderList->Count()==pModel->GetChildCount(pCurParent),"EntryMoved:Bad zorder count");
- FindBoundingRect( pEntry, pViewData );
- }
- PaintEntry( pEntry, pViewData );
- }
- else
- {
- if( pEntry == pCursor )
- {
- DBG_ASSERT(pNextCursor,"EntryMoved: Next cursor bad");
- SetCursor( pNextCursor );
- }
- pImpCursor->Clear();
- sal_uInt16 nPos = pZOrderList->GetPos( (void*)pEntry );
- pZOrderList->Remove( nPos, 1 );
- pView->Select( pEntry, sal_False );
- // wenn er nochmal in dieser View auftaucht, muss sein
- // Bounding-Rect neu berechnet werden
- InvalidateBoundingRect( pViewData->aRect );
- }
- nFlags &= (~F_MOVING_SIBLING);
-}
-
-void SvImpIconView::TreeInserted( SvLBoxEntry* pEntry )
-{
- EntryMoved( pEntry ); // vorlaeufig
-}
-
-void SvImpIconView::EntryExpanded( SvLBoxEntry* )
-{
-}
-
-void SvImpIconView::EntryCollapsed( SvLBoxEntry*)
-{
-}
-
-void SvImpIconView::CollapsingEntry( SvLBoxEntry* )
-{
-}
-
-void SvImpIconView::EntrySelected( SvLBoxEntry* pEntry, sal_Bool bSelect )
-{
- if( pModel->GetParent(pEntry) != pCurParent )
- return;
-
- // bei SingleSelection dafuer sorgen, dass der Cursor immer
- // auf dem (einzigen) selektierten Eintrag steht
- if( bSelect && pCursor &&
- pView->GetSelectionMode() == SINGLE_SELECTION &&
- pEntry != pCursor )
- {
- SetCursor( pEntry );
- DBG_ASSERT(pView->GetSelectionCount()==1,"selection count?");
- }
- // bei Gummibandselektion ist uns das zu teuer
- if( !(nFlags & F_RUBBERING ))
- ToTop( pEntry );
- if( pView->IsUpdateMode() )
- {
- if( pEntry == pCursor )
- ShowCursor( sal_False );
- if( nFlags & F_RUBBERING )
- PaintEntry( pEntry );
- else
- pView->Invalidate( GetBoundingRect( pEntry ) );
- if( pEntry == pCursor )
- ShowCursor( sal_True );
- }
-}
-
-void SvImpIconView::SetNextEntryPos(const Point& rPos)
-{
- aPrevBoundRect.SetPos( rPos );
- aPrevBoundRect.Right() = LONG_MAX; // dont know
-}
-
-Point SvImpIconView::FindNextEntryPos( const Size& rBoundSize )
-{
- if( nFlags & F_GRIDMODE )
- {
- if( nFlags & F_GRID_INSERT )
- {
- if( aPrevBoundRect.Right() != LONG_MAX )
- {
- // passt der naechste Entry noch in die Zeile ?
- long nNextWidth = aPrevBoundRect.Right() + nGridDX + LROFFS_WINBORDER;
- if( nNextWidth > aVirtOutputSize.Width() )
- {
- // darf aVirtOutputSize verbreitert werden ?
- if( nNextWidth < nMaxVirtWidth )
- {
- // verbreitern & in Zeile aufnehmen
- aPrevBoundRect.Left() += nGridDX;
- }
- else
- {
- // erhoehen & neue Zeile beginnen
- aPrevBoundRect.Top() += nGridDY;
- aPrevBoundRect.Left() = LROFFS_WINBORDER;
- }
- }
- else
- {
- // in die Zeile aufnehmen
- aPrevBoundRect.Left() += nGridDX;
- }
- }
- aPrevBoundRect.SetSize( Size( nGridDX, nGridDY ) );
- }
- else
- {
- if( !pImpCursor->FindEmptyGridRect( aPrevBoundRect ) )
- {
- // mitten in den Entries gibts keine Loecher mehr,
- // wir koennen also wieder ins "Fast Insert" springen
- nFlags |= F_GRID_INSERT;
- }
- }
- }
- else
- {
- if( aPrevBoundRect.Right() != LONG_MAX )
- {
- // passt der naechste Entry noch in die Zeile ?
- long nNextWidth=aPrevBoundRect.Right()+rBoundSize.Width()+LROFFS_BOUND+nHorDist;
- if( nNextWidth > aVirtOutputSize.Width() )
- {
- // darf aVirtOutputSize verbreitert werden ?
- if( nNextWidth < nMaxVirtWidth )
- {
- // verbreitern & in Zeile aufnehmen
- aPrevBoundRect.SetPos( aPrevBoundRect.TopRight() );
- aPrevBoundRect.Left() += nHorDist;
- }
- else
- {
- // erhoehen & neue Zeile beginnen
- aPrevBoundRect.Top() += nMaxBoundHeight + nVerDist + TBOFFS_BOUND;
- aPrevBoundRect.Left() = LROFFS_WINBORDER;
- }
- }
- else
- {
- // in die Zeile aufnehmen
- aPrevBoundRect.SetPos( aPrevBoundRect.TopRight() );
- aPrevBoundRect.Left() += nHorDist;
- }
- }
- aPrevBoundRect.SetSize( rBoundSize );
- }
- return aPrevBoundRect.TopLeft();
-}
-
-void SvImpIconView::ResetVirtSize()
-{
- StopEditTimer();
- aVirtOutputSize.Width() = 0;
- aVirtOutputSize.Height() = 0;
- sal_Bool bLockedEntryFound = sal_False;
- nFlags &= (~F_GRID_INSERT);
- SvLBoxEntry* pCur = pModel->FirstChild( pCurParent );
- while( pCur )
- {
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pCur);
- if( pViewData->IsEntryPosLocked() )
- {
- // VirtSize u.a. anpassen
- if( !IsBoundingRectValid( pViewData->aRect ) )
- FindBoundingRect( pCur, pViewData );
- else
- AdjustVirtSize( pViewData->aRect );
- bLockedEntryFound = sal_True;
- }
- else
- InvalidateBoundingRect( pViewData->aRect );
-
- pCur = pModel->NextSibling( pCur );
- }
- if( !bLockedEntryFound )
- {
- //XXX
- nFlags |= F_GRID_INSERT;
- }
-
- SetNextEntryPos( Point( LROFFS_WINBORDER, TBOFFS_WINBORDER ) );
- pImpCursor->Clear();
-}
-
-
-void SvImpIconView::AdjustVirtSize( const Rectangle& rRect )
-{
- long nHeightOffs = 0;
- long nWidthOffs = 0;
-
- if( aVirtOutputSize.Width() < (rRect.Right()+LROFFS_WINBORDER) )
- nWidthOffs = (rRect.Right()+LROFFS_WINBORDER) - aVirtOutputSize.Width();
-
- if( aVirtOutputSize.Height() < (rRect.Bottom()+TBOFFS_WINBORDER) )
- nHeightOffs = (rRect.Bottom()+TBOFFS_WINBORDER) - aVirtOutputSize.Height();
-
- if( nWidthOffs || nHeightOffs )
- {
- Range aRange;
- aVirtOutputSize.Width() += nWidthOffs;
- aRange.Max() = aVirtOutputSize.Width();
- aHorSBar.SetRange( aRange );
-
- aVirtOutputSize.Height() += nHeightOffs;
- aRange.Max() = aVirtOutputSize.Height();
- aVerSBar.SetRange( aRange );
-
- pImpCursor->Clear();
- AdjustScrollBars();
- }
-}
-
-void SvImpIconView::Arrange()
-{
- nMaxVirtWidth = aOutputSize.Width();
- ImpArrange();
-}
-
-void SvImpIconView::ImpArrange()
-{
- StopEditTimer();
- ShowCursor( sal_False );
- ResetVirtSize();
- bMustRecalcBoundingRects = sal_False;
- MapMode aMapMode( pView->GetMapMode());
- aMapMode.SetOrigin( Point() );
- pView->SetMapMode( aMapMode );
- CheckAllSizes();
- RecalcAllBoundingRectsSmart();
- pView->Invalidate();
- ShowCursor( sal_True );
-}
-
-void SvImpIconView::Paint( const Rectangle& rRect )
-{
- if( !pView->IsUpdateMode() )
- return;
-
-#if defined(DBG_UTIL) && defined(OV_DRAWGRID)
- if( nFlags & F_GRIDMODE )
- {
- Color aOldColor = pView->GetLineColor();
- Color aNewColor( COL_BLACK );
- pView->SetLineColor( aNewColor );
- Point aOffs( pView->GetMapMode().GetOrigin());
- Size aXSize( pView->GetOutputSizePixel() );
- for( long nDX = nGridDX; nDX <= aXSize.Width(); nDX += nGridDX )
- {
- Point aStart( nDX+LROFFS_BOUND, 0 );
- Point aEnd( nDX+LROFFS_BOUND, aXSize.Height());
- aStart -= aOffs;
- aEnd -= aOffs;
- pView->DrawLine( aStart, aEnd );
- }
- for( long nDY = nGridDY; nDY <= aXSize.Height(); nDY += nGridDY )
- {
- Point aStart( 0, nDY+TBOFFS_BOUND );
- Point aEnd( aXSize.Width(), nDY+TBOFFS_BOUND );
- aStart -= aOffs;
- aEnd -= aOffs;
- pView->DrawLine( aStart, aEnd );
- }
- pView->SetLineColor( aOldColor );
- }
-#endif
- nFlags |= F_PAINTED;
-
- if( !(pModel->HasChilds( pCurParent ) ))
- return;
- if( !pCursor )
- pCursor = pModel->FirstChild( pCurParent );
-
- sal_uInt16 nCount = pZOrderList->Count();
- if( !nCount )
- return;
-
- SvPtrarr* pNewZOrderList = new SvPtrarr;
- SvPtrarr* pPaintedEntries = new SvPtrarr;
-
- sal_uInt16 nPos = 0;
- while( nCount )
- {
- SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nPos ));
- SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry);
- const Rectangle& rBoundRect = GetBoundingRect( pEntry, pViewData );
- if( rRect.IsOver( rBoundRect ) )
- {
- PaintEntry( pEntry, rBoundRect.TopLeft(), pViewData );
- // Eintraege, die neu gezeichnet werden, auf Top setzen
- pPaintedEntries->Insert( pEntry, pPaintedEntries->Count() );
- }
- else
- pNewZOrderList->Insert( pEntry, pNewZOrderList->Count() );
-
- nCount--;
- nPos++;
- }
- delete pZOrderList;
- pZOrderList = pNewZOrderList;
- nCount = pPaintedEntries->Count();
- if( nCount )
- {
- for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
- pZOrderList->Insert( pPaintedEntries->GetObject( nCur ),pZOrderList->Count());
- }
- delete pPaintedEntries;
-
- Rectangle aRect;
- if( GetResizeRect( aRect ))
- PaintResizeRect( aRect );
-}
-
-sal_Bool SvImpIconView::GetResizeRect( Rectangle& rRect )
-{
- if( aHorSBar.IsVisible() && aVerSBar.IsVisible() )
- {
- const MapMode& rMapMode = pView->GetMapMode();
- Point aOrigin( rMapMode.GetOrigin());
- aOrigin *= -1;
- aOrigin.X() += aOutputSize.Width();
- aOrigin.Y() += aOutputSize.Height();
- rRect.SetPos( aOrigin );
- rRect.SetSize( Size( nVerSBarWidth, nHorSBarHeight));
- return sal_True;
- }
- return sal_False;
-}
-
-void SvImpIconView::PaintResizeRect( const Rectangle& rRect )
-{
- const StyleSettings& rStyleSettings = pView->GetSettings().GetStyleSettings();
- Color aNewColor = rStyleSettings.GetFaceColor();
- Color aOldColor = pView->GetFillColor();
- pView->SetFillColor( aNewColor );
- pView->DrawRect( rRect );
- pView->SetFillColor( aOldColor );
-}
-
-void SvImpIconView::RepaintSelectionItems()
-{
- OSL_FAIL("RepaintSelectionItems");
- pView->Invalidate(); // vorlaeufig
-}
-
-SvLBoxItem* SvImpIconView::GetItem( SvLBoxEntry* pEntry,
- const Point& rAbsPos )
-{
- Rectangle aRect;
- SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- if( pStringItem )
- {
- aRect = CalcTextRect( pEntry, pStringItem );
- if( aRect.IsInside( rAbsPos ) )
- return pStringItem;
- }
- SvLBoxContextBmp* pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP));
- if( pBmpItem )
- {
- aRect = CalcBmpRect( pEntry );
- if( aRect.IsInside( rAbsPos ) )
- return pBmpItem;
- }
- return 0;
-}
-
-void SvImpIconView::CalcDocPos( Point& aMaeuschenPos )
-{
- aMaeuschenPos -= pView->GetMapMode().GetOrigin();
-}
-
-void SvImpIconView::MouseButtonDown( const MouseEvent& rMEvt)
-{
- StopEditTimer();
- pView->GrabFocus();
- Point aDocPos( rMEvt.GetPosPixel() );
- if(aDocPos.X()>=aOutputSize.Width() || aDocPos.Y()>=aOutputSize.Height())
- return;
- CalcDocPos( aDocPos );
- SvLBoxEntry* pEntry = GetEntry( aDocPos );
- if( !pEntry )
- {
- if( pView->GetSelectionMode() != SINGLE_SELECTION )
- {
- if( !rMEvt.IsMod1() ) // Ctrl
- {
- pView->SelectAll( sal_False );
- ClearSelectedRectList();
- }
- else
- nFlags |= F_ADD_MODE;
- nFlags |= F_RUBBERING;
- aCurSelectionRect.SetPos( aDocPos );
- pView->CaptureMouse();
- }
- return;
- }
-
- sal_Bool bSelected = pView->IsSelected( pEntry );
- sal_Bool bEditingEnabled = pView->IsInplaceEditingEnabled();
-
- if( rMEvt.GetClicks() == 2 )
- {
- DeselectAllBut( pEntry );
- pView->pHdlEntry = pEntry;
- pView->DoubleClickHdl();
- }
- else
- {
- // Inplace-Editing ?
- if( rMEvt.IsMod2() ) // Alt?
- {
- if( bEditingEnabled )
- {
- SvLBoxItem* pItem = GetItem(pEntry,aDocPos);
- if( pItem )
- pView->EditingRequest( pEntry, pItem, aDocPos);
- }
- }
- else if( pView->GetSelectionMode() == SINGLE_SELECTION )
- {
- DeselectAllBut( pEntry );
- SetCursor( pEntry );
- pView->Select( pEntry, sal_True );
- if( bEditingEnabled && bSelected && !rMEvt.GetModifier() &&
- rMEvt.IsLeft() && IsTextHit( pEntry, aDocPos ) )
- {
- nFlags |= F_START_EDITTIMER_IN_MOUSEUP;
- }
- }
- else
- {
- if( !rMEvt.GetModifier() )
- {
- if( !bSelected )
- {
- DeselectAllBut( pEntry );
- SetCursor( pEntry );
- pView->Select( pEntry, sal_True );
- }
- else
- {
- // erst im Up deselektieren, falls Move per D&D!
- nFlags |= F_DOWN_DESELECT;
- if( bEditingEnabled && IsTextHit( pEntry, aDocPos ) &&
- rMEvt.IsLeft())
- {
- nFlags |= F_START_EDITTIMER_IN_MOUSEUP;
- }
- }
- }
- else if( rMEvt.IsMod1() )
- nFlags |= F_DOWN_CTRL;
- }
- }
-}
-
-void SvImpIconView::MouseButtonUp( const MouseEvent& rMEvt )
-{
- aMouseMoveTimer.Stop();
- pView->ReleaseMouse();
- // HACK, da Einar noch nicht PrepareCommandEvent aufruft
- if( rMEvt.IsRight() && (nFlags & (F_DOWN_CTRL | F_DOWN_DESELECT) ))
- nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT);
-
- if( nFlags & F_RUBBERING )
- {
- aMouseMoveTimer.Stop();
- AddSelectedRect( aCurSelectionRect );
- HideSelectionRect();
- nFlags &= ~(F_RUBBERING | F_ADD_MODE);
- }
-
- SvLBoxEntry* pEntry = pView->GetEntry( rMEvt.GetPosPixel(), sal_True );
- if( pEntry )
- {
- if( nFlags & F_DOWN_CTRL )
- {
- // Ctrl & MultiSelection
- ToggleSelection( pEntry );
- SetCursor( pEntry );
- }
- else if( nFlags & F_DOWN_DESELECT )
- {
- DeselectAllBut( pEntry );
- SetCursor( pEntry );
- pView->Select( pEntry, sal_True );
- }
- }
-
- nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT);
- if( nFlags & F_START_EDITTIMER_IN_MOUSEUP )
- {
- StartEditTimer();
- nFlags &= ~F_START_EDITTIMER_IN_MOUSEUP;
- }
-}
-
-void SvImpIconView::MouseMove( const MouseEvent& rMEvt )
-{
- if( nFlags & F_RUBBERING )
- {
- const Point& rPosPixel = rMEvt.GetPosPixel();
- if( !aMouseMoveTimer.IsActive() )
- {
- aMouseMoveEvent = rMEvt;
- aMouseMoveTimer.Start();
- // ausserhalb des Fensters liegende Move-Events muessen
- // vom Timer kommen, damit die Scrollgeschwindigkeit
- // unabhaengig von Mausbewegungen ist.
- if( rPosPixel.X() < 0 || rPosPixel.Y() < 0 )
- return;
- const Size& rSize = pView->GetOutputSizePixel();
- if( rPosPixel.X() > rSize.Width() || rPosPixel.Y() > rSize.Height())
- return;
- }
-
- if( &rMEvt != &aMouseMoveEvent )
- aMouseMoveEvent = rMEvt;
-
- long nScrollDX, nScrollDY;
-
- CalcScrollOffsets(rMEvt.GetPosPixel(),nScrollDX,nScrollDY,sal_False );
- sal_Bool bSelRectHidden = sal_False;
- if( nScrollDX || nScrollDY )
- {
- HideSelectionRect();
- bSelRectHidden = sal_True;
- pView->Scroll( nScrollDX, nScrollDY );
- }
- Point aDocPos( rMEvt.GetPosPixel() );
- aDocPos = pView->PixelToLogic( aDocPos );
- Rectangle aRect( aCurSelectionRect.TopLeft(), aDocPos );
- if( aRect != aCurSelectionRect )
- {
- HideSelectionRect();
- bSelRectHidden = sal_True;
- sal_Bool bAdd = (nFlags & F_ADD_MODE) ? sal_True : sal_False;
- SelectRect( aRect, bAdd, &aSelectedRectList );
- }
- if( bSelRectHidden )
- DrawSelectionRect( aRect );
- }
-}
-
-sal_Bool SvImpIconView::KeyInput( const KeyEvent& rKEvt )
-{
- StopEditTimer();
- sal_Bool bKeyUsed = sal_True;
- sal_Bool bMod1 = rKEvt.GetKeyCode().IsMod1();
- sal_Bool bInAddMode = (sal_Bool)((nFlags & F_ADD_MODE) != 0);
- int bDeselAll = (pView->GetSelectionMode() != SINGLE_SELECTION) &&
- !bInAddMode;
- SvLBoxEntry* pNewCursor;
- sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
- switch( nCode )
- {
- case KEY_UP:
- if( pCursor )
- {
- MakeVisible( pCursor );
- pNewCursor = pImpCursor->GoUpDown(pCursor,sal_False);
- if( pNewCursor )
- {
- if( bDeselAll )
- pView->SelectAll( sal_False );
- ShowCursor( sal_False );
- MakeVisible( pNewCursor );
- SetCursor( pNewCursor );
- if( !bInAddMode )
- pView->Select( pCursor, sal_True );
- }
- else
- {
- Rectangle aRect( GetBoundingRect( pCursor ) );
- if( aRect.Top())
- {
- aRect.Bottom() -= aRect.Top();
- aRect.Top() = 0;
- MakeVisible( aRect );
- }
- }
- }
- break;
-
- case KEY_DOWN:
- if( pCursor )
- {
- pNewCursor=pImpCursor->GoUpDown( pCursor,sal_True );
- if( pNewCursor )
- {
- MakeVisible( pCursor );
- if( bDeselAll )
- pView->SelectAll( sal_False );
- ShowCursor( sal_False );
- MakeVisible( pNewCursor );
- SetCursor( pNewCursor );
- if( !bInAddMode )
- pView->Select( pCursor, sal_True );
- }
- }
- break;
-
- case KEY_RIGHT:
- if( pCursor )
- {
- pNewCursor=pImpCursor->GoLeftRight(pCursor,sal_True );
- if( pNewCursor )
- {
- MakeVisible( pCursor );
- if( bDeselAll )
- pView->SelectAll( sal_False );
- ShowCursor( sal_False );
- MakeVisible( pNewCursor );
- SetCursor( pNewCursor );
- if( !bInAddMode )
- pView->Select( pCursor, sal_True );
- }
- }
- break;
-
- case KEY_LEFT:
- if( pCursor )
- {
- MakeVisible( pCursor );
- pNewCursor = pImpCursor->GoLeftRight(pCursor,sal_False );
- if( pNewCursor )
- {
- if( bDeselAll )
- pView->SelectAll( sal_False );
- ShowCursor( sal_False );
- MakeVisible( pNewCursor );
- SetCursor( pNewCursor );
- if( !bInAddMode )
- pView->Select( pCursor, sal_True );
- }
- else
- {
- Rectangle aRect( GetBoundingRect(pCursor));
- if( aRect.Left() )
- {
- aRect.Right() -= aRect.Left();
- aRect.Left() = 0;
- MakeVisible( aRect );
- }
- }
- }
- break;
-
- case KEY_ESCAPE:
- if( nFlags & F_RUBBERING )
- {
- HideSelectionRect();
- pView->SelectAll( sal_False );
- nFlags &= ~F_RUBBERING;
- }
- break;
-
- case KEY_F8:
- if( rKEvt.GetKeyCode().IsShift() )
- {
- if( nFlags & F_ADD_MODE )
- nFlags &= (~F_ADD_MODE);
- else
- nFlags |= F_ADD_MODE;
- }
- break;
-
- case KEY_SPACE:
- if( pCursor )
- {
- ToggleSelection( pCursor );
- }
- break;
-
-
- case KEY_PAGEDOWN:
- break;
- case KEY_PAGEUP:
- break;
-
- case KEY_ADD:
- case KEY_DIVIDE :
- if( bMod1 )
- pView->SelectAll( sal_True );
- break;
-
- case KEY_SUBTRACT:
- case KEY_COMMA :
- if( bMod1 )
- pView->SelectAll( sal_False );
- break;
-
- case KEY_RETURN:
- if( bMod1 )
- {
- if( pCursor && pView->IsInplaceEditingEnabled() )
- pView->EditEntry( pCursor );
- }
- break;
-
- default:
- bKeyUsed = sal_False;
-
- }
- return bKeyUsed;
-}
-
-
-void SvImpIconView::PositionScrollBars( long nRealWidth, long nRealHeight )
-{
- // hor scrollbar
- Point aPos( 0, nRealHeight );
- aPos.Y() -= nHorSBarHeight;
-
- if( aHorSBar.GetPosPixel() != aPos )
- aHorSBar.SetPosPixel( aPos );
-
- // ver scrollbar
- aPos.X() = nRealWidth; aPos.Y() = 0;
- aPos.X() -= nVerSBarWidth;
-
-#if defined(WNT)
- aPos.X()++;
- aPos.Y()--;
-#endif
-
- if( aVerSBar.GetPosPixel() != aPos )
- aVerSBar.SetPosPixel( aPos );
-}
-
-
-
-void SvImpIconView::AdjustScrollBars()
-{
- long nVirtHeight = aVirtOutputSize.Height();
- long nVirtWidth = aVirtOutputSize.Width();
-
- Size aOSize( pView->Control::GetOutputSizePixel() );
- long nRealHeight = aOSize.Height();
- long nRealWidth = aOSize.Width();
-
- PositionScrollBars( nRealWidth, nRealHeight );
-
- const MapMode& rMapMode = pView->GetMapMode();
- Point aOrigin( rMapMode.GetOrigin() );
-
- long nVisibleWidth;
- if( nRealWidth > nVirtWidth )
- nVisibleWidth = nVirtWidth + aOrigin.X();
- else
- nVisibleWidth = nRealWidth;
-
- long nVisibleHeight;
- if( nRealHeight > nVirtHeight )
- nVisibleHeight = nVirtHeight + aOrigin.Y();
- else
- nVisibleHeight = nRealHeight;
-
- bool bVerSBar = (pView->GetStyle() & WB_VSCROLL) ? true : false;
- bool bHorSBar = (pView->GetStyle() & WB_HSCROLL) ? true : false;
-
- sal_uInt16 nResult = 0;
- if( nVirtHeight )
- {
- // activate ver scrollbar ?
- if( bVerSBar || ( nVirtHeight > nVisibleHeight) )
- {
- nResult = 0x0001;
- nRealWidth -= nVerSBarWidth;
-
- if( nRealWidth > nVirtWidth )
- nVisibleWidth = nVirtWidth + aOrigin.X();
- else
- nVisibleWidth = nRealWidth;
-
- nFlags |= F_HOR_SBARSIZE_WITH_VBAR;
- }
- // activate hor scrollbar ?
- if( bHorSBar || (nVirtWidth > nVisibleWidth) )
- {
- nResult |= 0x0002;
- nRealHeight -= nHorSBarHeight;
-
- if( nRealHeight > nVirtHeight )
- nVisibleHeight = nVirtHeight + aOrigin.Y();
- else
- nVisibleHeight = nRealHeight;
-
- // brauchen wir jetzt doch eine senkrechte Scrollbar ?
- if( !(nResult & 0x0001) && // nur wenn nicht schon da
- ( (nVirtHeight > nVisibleHeight) || bVerSBar) )
- {
- nResult = 3; // both are active
- nRealWidth -= nVerSBarWidth;
-
- if( nRealWidth > nVirtWidth )
- nVisibleWidth = nVirtWidth + aOrigin.X();
- else
- nVisibleWidth = nRealWidth;
-
- nFlags |= F_VER_SBARSIZE_WITH_HBAR;
- }
- }
- }
-
- // size ver scrollbar
- long nThumb = aVerSBar.GetThumbPos();
- Size aSize( nVerSBarWidth, nRealHeight );
-#if defined(WNT)
- aSize.Height() += 2;
-#endif
- if( aSize != aVerSBar.GetSizePixel() )
- aVerSBar.SetSizePixel( aSize );
- aVerSBar.SetVisibleSize( nVisibleHeight );
- aVerSBar.SetPageSize( (nVisibleHeight*75)/100 );
- if( nResult & 0x0001 )
- {
- aVerSBar.SetThumbPos( nThumb );
- aVerSBar.Show();
- }
- else
- {
- aVerSBar.SetThumbPos( 0 );
- aVerSBar.Hide();
- }
-
- // size hor scrollbar
- nThumb = aHorSBar.GetThumbPos();
- aSize.Width() = nRealWidth;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list