diff options
Diffstat (limited to 'svtools')
110 files changed, 1980 insertions, 7920 deletions
diff --git a/svtools/CppunitTest_svtools_filters_test.mk b/svtools/CppunitTest_svtools_filters_test.mk new file mode 100755 index 000000000000..d091ede3f2f9 --- /dev/null +++ b/svtools/CppunitTest_svtools_filters_test.mk @@ -0,0 +1,69 @@ +#************************************************************************* +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Initial Developer of the Original Code is +# Caolán McNamara, Red Hat, Inc. <caolanm@redhat.com> +# Portions created by the Initial Developer are Copyright (C) 2011 the +# Initial Developer. All Rights Reserved. +# +# Major Contributor(s): +# +# For minor contributions see the git repository. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. +#************************************************************************* + +$(eval $(call gb_CppunitTest_CppunitTest,svtools_filters_test)) + +$(eval $(call gb_CppunitTest_add_exception_objects,svtools_filters_test, \ + svtools/qa/cppunit/filters-test \ +)) + +$(eval $(call gb_CppunitTest_add_linked_libs,svtools_filters_test, \ + comphelper \ + cppu \ + cppuhelper \ + sal \ + svt \ + tl \ + vcl \ + $(gb_STDLIBS) \ +)) + +$(eval $(call gb_CppunitTest_set_include,svtools_filters_test,\ + $$(INCLUDE) \ + -I$(OUTDIR)/inc \ +)) + +$(eval $(call gb_CppunitTest_add_api,svtools_filters_test,\ + udkapi \ + offapi \ +)) + +$(eval $(call gb_CppunitTest_uses_ure,svtools_filters_test)) + +$(eval $(call gb_CppunitTest_add_type_rdbs,svtools_filters_test,\ + types \ +)) + +$(eval $(call gb_CppunitTest_set_args,svtools_filters_test,\ + --headless \ + --invisible \ + --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/svtools/Executable_bmp.mk b/svtools/Executable_bmp.mk index 3b2fd2a1203c..f05013df4170 100644 --- a/svtools/Executable_bmp.mk +++ b/svtools/Executable_bmp.mk @@ -36,7 +36,11 @@ $(eval $(call gb_Executable_set_include,bmp,\ -I$(realpath $(SRCDIR)/svtools/inc/svtools) \ -I$(realpath $(SRCDIR)/svtools/source/inc) \ -I$(realpath $(SRCDIR)/svtools/inc/pch) \ - -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Executable_add_api,bmp,\ + udkapi \ + offapi \ )) $(eval $(call gb_Executable_add_linked_libs,bmp,\ diff --git a/svtools/Executable_bmpsum.mk b/svtools/Executable_bmpsum.mk index 492dabeb58f8..1bef32c970de 100644 --- a/svtools/Executable_bmpsum.mk +++ b/svtools/Executable_bmpsum.mk @@ -30,12 +30,16 @@ $(eval $(call gb_Executable_Executable,bmpsum)) $(eval $(call gb_Executable_set_include,bmpsum,\ $$(INCLUDE) \ -I$(OUTDIR)/inc/ \ - -I$(OUTDIR)/inc/offuh/ \ -I$(realpath $(SRCDIR)/svtools/inc) \ -I$(realpath $(SRCDIR)/svtools/inc/pch) \ -I$(realpath $(SRCDIR)/svtools/inc/svtools) \ )) +$(eval $(call gb_Executable_add_api,bmpsum,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Executable_add_linked_libs,bmpsum,\ sal \ tl \ diff --git a/svtools/Executable_g2g.mk b/svtools/Executable_g2g.mk index c817cff43ccd..c41dae777dbd 100644 --- a/svtools/Executable_g2g.mk +++ b/svtools/Executable_g2g.mk @@ -30,12 +30,16 @@ $(eval $(call gb_Executable_Executable,g2g)) $(eval $(call gb_Executable_set_include,g2g,\ $$(INCLUDE) \ -I$(OUTDIR)/inc/ \ - -I$(OUTDIR)/inc/offuh/ \ -I$(realpath $(SRCDIR)/svtools/inc) \ -I$(realpath $(SRCDIR)/svtools/inc/pch) \ -I$(realpath $(SRCDIR)/svtools/inc/svtools) \ )) +$(eval $(call gb_Executable_add_api,g2g,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Executable_add_linked_libs,g2g,\ jvmfwk \ sal \ diff --git a/svtools/Library_hatchwindowfactory.mk b/svtools/Library_hatchwindowfactory.mk index 96e8f10c3306..91b92267ddd5 100644 --- a/svtools/Library_hatchwindowfactory.mk +++ b/svtools/Library_hatchwindowfactory.mk @@ -36,10 +36,14 @@ $(eval $(call gb_Library_set_include,hatchwindowfactory,\ -I$(realpath $(SRCDIR)/svtools/inc/pch) \ -I$(OUTDIR)/inc/ \ -I$(realpath $(SRCDIR)/svtools/inc) \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_Library_add_api,hatchwindowfactory,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,hatchwindowfactory,\ cppu \ cppuhelper \ diff --git a/svtools/Library_productregistration.mk b/svtools/Library_productregistration.mk index 726e5a3b664b..44867f4530e3 100644 --- a/svtools/Library_productregistration.mk +++ b/svtools/Library_productregistration.mk @@ -36,10 +36,14 @@ $(eval $(call gb_Library_set_include,productregistration,\ -I$(realpath $(SRCDIR)/svtools/inc/pch) \ -I$(OUTDIR)/inc/ \ -I$(realpath $(SRCDIR)/svtools/inc) \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_Library_add_api,productregistration,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,productregistration,\ cppu \ cppuhelper \ diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 98f112864ab6..ea6a568da171 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -33,17 +33,21 @@ $(eval $(call gb_Library_add_precompiled_header,svt,$(SRCDIR)/svtools/inc/pch/pr $(eval $(call gb_Library_set_componentfile,svt,svtools/util/svt)) +$(eval $(call gb_Library_add_api,svt,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_set_include,svt,\ -I$(OUTDIR)/inc/external/jpeg \ $$(INCLUDE) \ -I$(WORKDIR)/inc/svtools \ -I$(WORKDIR)/inc/ \ -I$(OUTDIR)/inc/ \ - -I$(realpath $(SRCDIR)/svtools/inc) \ -I$(realpath $(SRCDIR)/svtools/inc/svtools) \ -I$(realpath $(SRCDIR)/svtools/source/inc) \ -I$(realpath $(SRCDIR)/svtools/inc/pch) \ - -I$(OUTDIR)/inc/offuh \ + -I$(realpath $(SRCDIR)/svtools/inc) \ )) $(eval $(call gb_Library_add_defs,svt,\ @@ -101,9 +105,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/Module_svtools.mk b/svtools/Module_svtools.mk index 0b669d9dee1b..7adeaf80a64c 100644 --- a/svtools/Module_svtools.mk +++ b/svtools/Module_svtools.mk @@ -30,15 +30,24 @@ $(eval $(call gb_Module_Module,svtools)) $(eval $(call gb_Module_add_targets,svtools,\ AllLangResTarget_productregistration \ AllLangResTarget_svt \ - Executable_bmp \ - Executable_bmpsum \ - Executable_g2g \ Library_hatchwindowfactory \ Library_productregistration \ Library_svt \ Package_inc \ )) +ifneq ($(CROSS_COMPILING),YES) +$(eval $(call gb_Module_add_targets,svtools,\ + Executable_bmp \ + Executable_bmpsum \ + Executable_g2g \ +)) +endif + +$(eval $(call gb_Module_add_check_targets,svtools,\ + CppunitTest_svtools_filters_test \ +)) + $(eval $(call gb_Module_add_subsequentcheck_targets,svtools,\ JunitTest_svtools_unoapi \ )) diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk index 39d2331641fc..428dac1f414f 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/bmpmaker/bmp.cxx b/svtools/bmpmaker/bmp.cxx index dce36f039730..a66312f60710 100644 --- a/svtools/bmpmaker/bmp.cxx +++ b/svtools/bmpmaker/bmp.cxx @@ -40,7 +40,6 @@ using namespace std; #include <vcl/svapp.hxx> #include "svl/solar.hrc" -#include <svtools/filedlg.hxx> #include "bmpcore.hxx" #include "bmp.hrc" diff --git a/svtools/bmpmaker/bmpsum.cxx b/svtools/bmpmaker/bmpsum.cxx index 8d7d34240d94..215329aa41ff 100644 --- a/svtools/bmpmaker/bmpsum.cxx +++ b/svtools/bmpmaker/bmpsum.cxx @@ -411,7 +411,7 @@ void BmpSum::ProcessFileList( const String& rInFileList, // write new entries for( sal_uInt32 i = 0; i < aFileNameVector.size(); ++i ) { - ByteString aStr( ByteString::CreateFromInt64( aPair.first ) ); + ByteString aStr(rtl::OString::valueOf(static_cast<sal_Int64>(aPair.first))); ByteString aFileName( aFileNameVector[ i ] ); DirEntry aSrcFile( aFileName ); diff --git a/svtools/inc/svtools/brwbox.hxx b/svtools/inc/svtools/brwbox.hxx index edfacfa77e00..42bf18ff62db 100644 --- a/svtools/inc/svtools/brwbox.hxx +++ b/svtools/inc/svtools/brwbox.hxx @@ -409,9 +409,6 @@ protected: long CalcReverseZoom(long nVal); - HeaderBar* GetHeaderBar() const; - // header bar access for derived classes - inline const DataFlavorExVector& GetDataFlavors() const; @@ -493,20 +490,10 @@ public: // inserting, changing, removing and freezing of columns void InsertHandleColumn( sal_uLong nWidth ); - void InsertDataColumn( sal_uInt16 nItemId, const Image& rImage, - long nSize, HeaderBarItemBits nBits = HIB_STDSTYLE, - sal_uInt16 nPos = HEADERBAR_APPEND ); void InsertDataColumn( sal_uInt16 nItemId, const XubString& rText, long nSize, HeaderBarItemBits nBits = HIB_STDSTYLE, sal_uInt16 nPos = HEADERBAR_APPEND ); - void InsertDataColumn( sal_uInt16 nItemId, - const Image& rImage, const XubString& rText, - long nSize, HeaderBarItemBits nBits = HIB_STDSTYLE, - sal_uInt16 nPos = HEADERBAR_APPEND, - // Hilfstext bei leerem rText - const String* pHelpText = 0 ); void SetColumnTitle( sal_uInt16 nColumnId, const String &rTitle ); - void SetColumnMode( sal_uInt16 nColumnId, BrowserColumnMode nFlags ); void SetColumnWidth( sal_uInt16 nColumnId, sal_uLong nWidth ); void SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos ); void FreezeColumn( sal_uInt16 nColumnId, sal_Bool bFreeze = sal_True ); @@ -534,14 +521,12 @@ public: void ResetScroll(); long ScrollColumns( long nColumns ); long ScrollRows( long nRows ); - long ScrollPages( long nPagesY ); sal_Bool MakeFieldVisible( long nRow, sal_uInt16 nColId, sal_Bool bComplete = sal_False ); // access and movement of cursor long GetCurRow() const { return nCurRow; } sal_uInt16 GetCurColumnId() const { return nCurColId; } sal_Bool GoToRow( long nRow ); - sal_Bool GoToRowAndDoNotModifySelection( long nRow ); sal_Bool GoToColumnId( sal_uInt16 nColId ); sal_Bool GoToRowColumnId( long nRow, sal_uInt16 nColId ); @@ -557,23 +542,18 @@ public: sal_uInt16 GetSelectColumnCount() const; virtual bool IsRowSelected( long nRow ) const; bool IsColumnSelected( sal_uInt16 nColumnId ) const; - sal_Bool IsAllSelected() const; long FirstSelectedRow( sal_Bool bInverse = sal_False ); long LastSelectedRow(); - long PrevSelectedRow(); long NextSelectedRow(); const MultiSelection* GetColumnSelection() const { return pColSel; } const MultiSelection* GetSelection() const { return bMultiSelection ? uRow.pSel : 0; } - void SetSelection( const MultiSelection &rSelection ); long FirstSelectedColumn( ) const; - long NextSelectedColumn( ) const; sal_Bool IsResizing() const { return bResizing; } // access to positions of fields, column and rows - Window& GetEventWindow() const; Window& GetDataWindow() const { return *pDataWin; } Rectangle GetRowRectPixel( long nRow, sal_Bool bRelToBrowser = sal_True ) const; @@ -599,7 +579,6 @@ public: void Dispatch( sal_uInt16 nId ); void SetMode( BrowserMode nMode = 0 ); BrowserMode GetMode( ) const { return m_nCurrentMode; } - bool IsInCommandEvent() const; void SetCursorColor(const Color& _rCol); Color GetCursorColor() const { return m_aCursorColor; } diff --git a/svtools/inc/svtools/ctrlbox.hxx b/svtools/inc/svtools/ctrlbox.hxx index 56c69e0d078b..d346b3b6af85 100644 --- a/svtools/inc/svtools/ctrlbox.hxx +++ b/svtools/inc/svtools/ctrlbox.hxx @@ -190,7 +190,8 @@ public: sal_uInt16 nPos = LISTBOX_APPEND ); virtual sal_uInt16 InsertEntry( const Color& rColor, const XubString& rStr, sal_uInt16 nPos = LISTBOX_APPEND ); - void InsertAutomaticEntry(); + void InsertAutomaticEntryColor(const Color &rAutoColorValue); + bool IsAutomaticSelected() { return !GetSelectEntryPos(); } using ListBox::RemoveEntry; virtual void RemoveEntry( sal_uInt16 nPos ); virtual void Clear(); diff --git a/svtools/inc/svtools/filter.hxx b/svtools/inc/svtools/filter.hxx index 4ea0bce85ee0..da3a7cb036c8 100644 --- a/svtools/inc/svtools/filter.hxx +++ b/svtools/inc/svtools/filter.hxx @@ -376,7 +376,6 @@ public: // ------------------------------------ SVT_DLLPUBLIC sal_Bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF, FilterConfigItem* pConfigItem ); -SVT_DLLPUBLIC sal_Bool WriteWindowMetafile( SvStream& rStream, const GDIMetaFile& rMTF ); SVT_DLLPUBLIC sal_Bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF ); #endif //_FILTER_HXX diff --git a/svtools/inc/svtools/grfmgr.hxx b/svtools/inc/svtools/grfmgr.hxx index c99ea7a55bcd..f7560058c458 100644 --- a/svtools/inc/svtools/grfmgr.hxx +++ b/svtools/inc/svtools/grfmgr.hxx @@ -105,14 +105,14 @@ private: long mnTopCrop; long mnRightCrop; long mnBottomCrop; - sal_uInt16 mnRotate10; + sal_uInt16 mnRotate10; short mnContPercent; short mnLumPercent; short mnRPercent; short mnGPercent; short mnBPercent; - sal_Bool mbInvert; - sal_uInt8 mcTransparency; + sal_Bool mbInvert; + sal_uInt8 mcTransparency; GraphicDrawMode meDrawMode; void* mpDummy; @@ -122,14 +122,14 @@ public: GraphicAttr(); ~GraphicAttr(); - sal_Bool operator==( const GraphicAttr& rAttr ) const; - sal_Bool operator!=( const GraphicAttr& rAttr ) const { return !( *this == rAttr ); } + sal_Bool operator==( const GraphicAttr& rAttr ) const; + sal_Bool operator!=( const GraphicAttr& rAttr ) const { return !( *this == rAttr ); } void SetDrawMode( GraphicDrawMode eDrawMode ) { meDrawMode = eDrawMode; } GraphicDrawMode GetDrawMode() const { return meDrawMode; } void SetMirrorFlags( sal_uLong nMirrFlags ) { mnMirrFlags = nMirrFlags; } - sal_uLong GetMirrorFlags() const { return mnMirrFlags; } + sal_uLong GetMirrorFlags() const { return mnMirrFlags; } void SetCrop( long nLeft_100TH_MM, long nTop_100TH_MM, long nRight_100TH_MM, long nBottom_100TH_MM ) { @@ -142,7 +142,7 @@ public: long GetBottomCrop() const { return mnBottomCrop; } void SetRotation( sal_uInt16 nRotate10 ) { mnRotate10 = nRotate10; } - sal_uInt16 GetRotation() const { return mnRotate10; } + sal_uInt16 GetRotation() const { return mnRotate10; } void SetLuminance( short nLuminancePercent ) { mnLumPercent = nLuminancePercent; } short GetLuminance() const { return mnLumPercent; } @@ -163,21 +163,21 @@ public: double GetGamma() const { return mfGamma; } void SetInvert( sal_Bool bInvert ) { mbInvert = bInvert; } - sal_Bool IsInvert() const { return mbInvert; } + sal_Bool IsInvert() const { return mbInvert; } void SetTransparency( sal_uInt8 cTransparency ) { mcTransparency = cTransparency; } - sal_uInt8 GetTransparency() const { return mcTransparency; } + sal_uInt8 GetTransparency() const { return mcTransparency; } - sal_Bool IsSpecialDrawMode() const { return( meDrawMode != GRAPHICDRAWMODE_STANDARD ); } - sal_Bool IsMirrored() const { return( mnMirrFlags != 0UL ); } - sal_Bool IsCropped() const + sal_Bool IsSpecialDrawMode() const { return( meDrawMode != GRAPHICDRAWMODE_STANDARD ); } + sal_Bool IsMirrored() const { return( mnMirrFlags != 0UL ); } + sal_Bool IsCropped() const { return( mnLeftCrop != 0 || mnTopCrop != 0 || mnRightCrop != 0 || mnBottomCrop != 0 ); } - sal_Bool IsRotated() const { return( ( mnRotate10 % 3600 ) != 0 ); } - sal_Bool IsTransparent() const { return( mcTransparency > 0 ); } - sal_Bool IsAdjusted() const + sal_Bool IsRotated() const { return( ( mnRotate10 % 3600 ) != 0 ); } + sal_Bool IsTransparent() const { return( mcTransparency > 0 ); } + sal_Bool IsAdjusted() const { return( mnLumPercent != 0 || mnContPercent != 0 || mnRPercent != 0 || mnGPercent != 0 || mnBPercent != 0 || mfGamma != 1.0 || mbInvert ); @@ -203,7 +203,7 @@ private: GraphicAttr maAttr; Size maPrefSize; MapMode maPrefMapMode; - sal_uLong mnSizeBytes; + sal_uLong mnSizeBytes; GraphicType meType; GraphicManager* mpMgr; String* mpLink; @@ -211,7 +211,7 @@ private: String* mpUserData; Timer* mpSwapOutTimer; GrfSimpleCacheObj* mpSimpleCache; - sal_uLong mnAnimationLoopCount; + sal_uLong mnAnimationLoopCount; void* mpDummy1; void* mpDummy2; sal_Bool mbAutoSwapped : 1; @@ -227,13 +227,21 @@ private: void SVT_DLLPRIVATE ImplConstruct(); void SVT_DLLPRIVATE ImplAssignGraphicData(); - void SVT_DLLPRIVATE ImplSetGraphicManager( const GraphicManager* pMgr, - const ByteString* pID = NULL, - const GraphicObject* pCopyObj = NULL ); + void SVT_DLLPRIVATE ImplSetGraphicManager( + const GraphicManager* pMgr, + const ByteString* pID = NULL, + const GraphicObject* pCopyObj = NULL + ); void SVT_DLLPRIVATE ImplAutoSwapIn(); - sal_Bool SVT_DLLPRIVATE ImplIsAutoSwapped() const { return mbAutoSwapped; } - sal_Bool SVT_DLLPRIVATE ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& rSz, const GraphicAttr* pAttr, - PolyPolygon& rClipPolyPoly, sal_Bool& bRectClipRegion ) const; + sal_Bool SVT_DLLPRIVATE ImplIsAutoSwapped() const { return mbAutoSwapped; } + sal_Bool SVT_DLLPRIVATE ImplGetCropParams( + OutputDevice* pOut, + Point& rPt, + Size& rSz, + const GraphicAttr* pAttr, + PolyPolygon& rClipPolyPoly, + sal_Bool& bRectClipRegion + ) const; /** Render a given number of tiles in an optimized way @@ -276,33 +284,60 @@ private: @return true, if everything was successfully rendered. */ - bool SVT_DLLPRIVATE ImplRenderTempTile( VirtualDevice& rVDev, int nExponent, - int nNumTilesX, int nNumTilesY, - const Size& rTileSizePixel, - const GraphicAttr* pAttr, sal_uLong nFlags ); + bool SVT_DLLPRIVATE ImplRenderTempTile( + VirtualDevice& rVDev, + int nExponent, + int nNumTilesX, + int nNumTilesY, + const Size& rTileSizePixel, + const GraphicAttr* pAttr, + sal_uLong nFlags + ); /// internally called by ImplRenderTempTile() - bool SVT_DLLPRIVATE ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent, int nMSBFactor, - int nNumOrigTilesX, int nNumOrigTilesY, - int nRemainderTilesX, int nRemainderTilesY, - const Size& rTileSizePixel, const GraphicAttr* pAttr, - sal_uLong nFlags, ImplTileInfo& rTileInfo ); - - bool SVT_DLLPRIVATE ImplDrawTiled( OutputDevice* pOut, const Rectangle& rArea, const Size& rSizePixel, - const Size& rOffset, const GraphicAttr* pAttr, sal_uLong nFlags, int nTileCacheSize1D ); - - bool SVT_DLLPRIVATE ImplDrawTiled( OutputDevice& rOut, const Point& rPos, - int nNumTilesX, int nNumTilesY, - const Size& rTileSize, - const GraphicAttr* pAttr, sal_uLong nFlags ); - - void SVT_DLLPRIVATE ImplTransformBitmap( BitmapEx& rBmpEx, - const GraphicAttr& rAttr, - const Size& rCropLeftTop, - const Size& rCropRightBottom, - const Rectangle& rCropRect, - const Size& rDstSize, - sal_Bool bEnlarge ) const; + bool SVT_DLLPRIVATE ImplRenderTileRecursive( + VirtualDevice& rVDev, + int nExponent, + int nMSBFactor, + int nNumOrigTilesX, + int nNumOrigTilesY, + int nRemainderTilesX, + int nRemainderTilesY, + const Size& rTileSizePixel, + const GraphicAttr* pAttr, + sal_uLong nFlags, + ImplTileInfo& rTileInfo + ); + + bool SVT_DLLPRIVATE ImplDrawTiled( + OutputDevice* pOut, + const Rectangle& rArea, + const Size& rSizePixel, + const Size& rOffset, + const GraphicAttr* pAttr, + sal_uLong nFlags, + int nTileCacheSize1D + ); + + bool SVT_DLLPRIVATE ImplDrawTiled( + OutputDevice& rOut, + const Point& rPos, + int nNumTilesX, + int nNumTilesY, + const Size& rTileSize, + const GraphicAttr* pAttr, + sal_uLong nFlags + ); + + void SVT_DLLPRIVATE ImplTransformBitmap( + BitmapEx& rBmpEx, + const GraphicAttr& rAttr, + const Size& rCropLeftTop, + const Size& rCropRightBottom, + const Rectangle& rCropRect, + const Size& rDstSize, + sal_Bool bEnlarge + ) const; DECL_LINK( ImplAutoSwapOutHdl, void* ); @@ -312,7 +347,7 @@ protected: virtual SvStream* GetSwapStream() const; // !!! to be removed - virtual sal_uLong GetReleaseFromCache() const; + virtual sal_uLong GetReleaseFromCache() const; virtual void Load( SvStream& ); virtual void Save( SvStream& ); @@ -330,14 +365,14 @@ public: ~GraphicObject(); GraphicObject& operator=( const GraphicObject& rCacheObj ); - sal_Bool operator==( const GraphicObject& rCacheObj ) const; - sal_Bool operator!=( const GraphicObject& rCacheObj ) const { return !( *this == rCacheObj ); } + sal_Bool operator==( const GraphicObject& rCacheObj ) const; + sal_Bool operator!=( const GraphicObject& rCacheObj ) const { return !( *this == rCacheObj ); } - sal_Bool HasSwapStreamHdl() const { return( mpSwapStreamHdl != NULL && mpSwapStreamHdl->IsSet() ); } + sal_Bool HasSwapStreamHdl() const { return( mpSwapStreamHdl != NULL && mpSwapStreamHdl->IsSet() ); } void SetSwapStreamHdl(); void SetSwapStreamHdl( const Link& rHdl, const sal_uLong nSwapOutTimeout = 0UL ); Link GetSwapStreamHdl() const; - sal_uLong GetSwapOutTimeout() const { return( mpSwapOutTimer ? mpSwapOutTimer->GetTimeout() : 0 ); } + sal_uLong GetSwapOutTimeout() const { return( mpSwapOutTimer ? mpSwapOutTimer->GetTimeout() : 0 ); } void FireSwapInRequest(); void FireSwapOutRequest(); @@ -345,8 +380,13 @@ public: void SetGraphicManager( const GraphicManager& rMgr ); GraphicManager& GetGraphicManager() const { return *mpMgr; } - sal_Bool IsCached( OutputDevice* pOut, const Point& rPt, const Size& rSz, - const GraphicAttr* pAttr = NULL, sal_uLong nFlags = GRFMGR_DRAW_STANDARD) const; + sal_Bool IsCached( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + const GraphicAttr* pAttr = NULL, + sal_uLong nFlags = GRFMGR_DRAW_STANDARD + ) const; void ReleaseFromCache(); const Graphic& GetGraphic() const; @@ -378,18 +418,22 @@ public: @return the readily transformed Graphic */ - Graphic GetTransformedGraphic( const Size& rDestSize, const MapMode& rDestMap, const GraphicAttr& rAttr ) const; + Graphic GetTransformedGraphic( + const Size& rDestSize, + const MapMode& rDestMap, + const GraphicAttr& rAttr + ) const; Graphic GetTransformedGraphic( const GraphicAttr* pAttr = NULL ) const; // TODO: Change to Impl void SetAttr( const GraphicAttr& rAttr ); const GraphicAttr& GetAttr() const { return maAttr; } - sal_Bool HasLink() const { return( mpLink != NULL && mpLink->Len() > 0 ); } + sal_Bool HasLink() const { return( mpLink != NULL && mpLink->Len() > 0 ); } void SetLink(); void SetLink( const String& rLink ); String GetLink() const; - sal_Bool HasUserData() const { return( mpUserData != NULL && mpUserData->Len() > 0 ); } + sal_Bool HasUserData() const { return( mpUserData != NULL && mpUserData->Len() > 0 ); } void SetUserData(); void SetUserData( const String& rUserData ); String GetUserData() const; @@ -409,28 +453,35 @@ public: sal_Bool HasRenderGraphic() const { return mbHasRenderGraphic; } void ResetAnimationLoopCount(); - List* GetAnimationInfoList() const; Link GetAnimationNotifyHdl() const { return maGraphic.GetAnimationNotifyHdl(); } void SetAnimationNotifyHdl( const Link& rLink ); - sal_Bool SwapOut(); - sal_Bool SwapOut( SvStream* pOStm ); - sal_Bool SwapIn(); - sal_Bool SwapIn( SvStream* pIStm ); + sal_Bool SwapOut(); + sal_Bool SwapOut( SvStream* pOStm ); + sal_Bool SwapIn(); + sal_Bool SwapIn( SvStream* pIStm ); - sal_Bool IsInSwapIn() const { return mbIsInSwapIn; } - sal_Bool IsInSwapOut() const { return mbIsInSwapOut; } - sal_Bool IsInSwap() const { return( mbIsInSwapOut || mbIsInSwapOut ); } - sal_Bool IsSwappedOut() const { return( mbAutoSwapped || maGraphic.IsSwapOut() ); } + sal_Bool IsInSwapIn() const { return mbIsInSwapIn; } + sal_Bool IsInSwapOut() const { return mbIsInSwapOut; } + sal_Bool IsInSwap() const { return( mbIsInSwapOut || mbIsInSwapOut ); } + sal_Bool IsSwappedOut() const { return( mbAutoSwapped || maGraphic.IsSwapOut() ); } void SetSwapState(); - sal_Bool Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, - const GraphicAttr* pAttr = NULL, sal_uLong nFlags = GRFMGR_DRAW_STANDARD ); - - sal_Bool DrawWithPDFHandling( OutputDevice& rOutDev, - const Point& rPt, const Size& rSz, - const GraphicAttr* pGrfAttr = NULL, - const sal_uLong nFlags = GRFMGR_DRAW_STANDARD ); + sal_Bool Draw( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + const GraphicAttr* pAttr = NULL, + sal_uLong nFlags = GRFMGR_DRAW_STANDARD + ); + + sal_Bool DrawWithPDFHandling( + OutputDevice& rOutDev, + const Point& rPt, + const Size& rSz, + const GraphicAttr* pGrfAttr = NULL, + const sal_uLong nFlags = GRFMGR_DRAW_STANDARD + ); /** Draw the graphic repeatedly into the given output rectangle @@ -465,26 +516,40 @@ public: @return sal_True, if drawing completed successfully */ - sal_Bool DrawTiled( OutputDevice* pOut, const Rectangle& rArea, const Size& rSize, - const Size& rOffset, const GraphicAttr* pAttr = NULL, - sal_uLong nFlags = GRFMGR_DRAW_STANDARD, int nTileCacheSize1D=128 ); - - sal_Bool StartAnimation( OutputDevice* pOut, const Point& rPt, const Size& rSz, long nExtraData = 0L, - const GraphicAttr* pAttr = NULL, sal_uLong nFlags = GRFMGR_DRAW_STANDARD, - OutputDevice* pFirstFrameOutDev = NULL ); + sal_Bool DrawTiled( + OutputDevice* pOut, + const Rectangle& rArea, + const Size& rSize, + const Size& rOffset, + const GraphicAttr* pAttr = NULL, + sal_uLong nFlags = GRFMGR_DRAW_STANDARD, + int nTileCacheSize1D=128 + ); + + sal_Bool StartAnimation( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + long nExtraData = 0L, + const GraphicAttr* pAttr = NULL, + sal_uLong nFlags = GRFMGR_DRAW_STANDARD, + OutputDevice* pFirstFrameOutDev = NULL + ); void StopAnimation( OutputDevice* pOut = NULL, long nExtraData = 0L ); friend SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj ); friend SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj ); - static GraphicObject CreateGraphicObjectFromURL( const ::rtl::OUString &rURL ); + static GraphicObject CreateGraphicObjectFromURL( const ::rtl::OUString &rURL ); }; // ------------------ // - GraphicManager - // ------------------ +typedef ::std::vector< GraphicObject* > GraphicObjectList_impl; + class SVT_DLLPUBLIC GraphicManager { friend class GraphicObject; @@ -492,86 +557,158 @@ class SVT_DLLPUBLIC GraphicManager private: - List maObjList; - GraphicCache* mpCache; - - GraphicManager( const GraphicManager& ) {} - GraphicManager& operator=( const GraphicManager& ) { return *this; } - - sal_Bool SVT_DLLPRIVATE ImplDraw( OutputDevice* pOut, const Point& rPt, - const Size& rSz, GraphicObject& rObj, - const GraphicAttr& rAttr, - const sal_uLong nFlags, sal_Bool& rCached ); - - sal_Bool SVT_DLLPRIVATE ImplCreateOutput( OutputDevice* pOut, const Point& rPt, const Size& rSz, - const BitmapEx& rBmpEx, const GraphicAttr& rAttr, - const sal_uLong nFlags, BitmapEx* pBmpEx = NULL ); - sal_Bool SVT_DLLPRIVATE ImplCreateOutput( OutputDevice* pOut, - const Point& rPt, const Size& rSz, - const GDIMetaFile& rMtf, const GraphicAttr& rAttr, - const sal_uLong nFlags, GDIMetaFile& rOutMtf, BitmapEx& rOutBmpEx ); - - sal_Bool SVT_DLLPRIVATE ImplCreateScaled( const BitmapEx& rBmpEx, - long* pMapIX, long* pMapFX, long* pMapIY, long* pMapFY, - long nStartX, long nEndX, long nStartY, long nEndY, - BitmapEx& rOutBmpEx ); - - sal_Bool SVT_DLLPRIVATE ImplCreateRotatedScaled( const BitmapEx& rBmpEx, - sal_uInt16 nRot10, const Size& rOutSzPix, const Size& rUntSzPix, - long* pMapIX, long* pMapFX, long* pMapIY, long* pMapFY, - long nStartX, long nEndX, long nStartY, long nEndY, - BitmapEx& rOutBmpEx ); - - static void SVT_DLLPRIVATE ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, sal_uLong nAdjustmentFlags ); - static void SVT_DLLPRIVATE ImplAdjust( GDIMetaFile& rMtf, const GraphicAttr& rAttr, sal_uLong nAdjustmentFlags ); - static void SVT_DLLPRIVATE ImplAdjust( Animation& rAnimation, const GraphicAttr& rAttr, sal_uLong nAdjustmentFlags ); - - static void SVT_DLLPRIVATE ImplDraw( OutputDevice* pOut, const Point& rPt, const Size& rSz, - const GDIMetaFile& rMtf, const GraphicAttr& rAttr ); + GraphicObjectList_impl maObjList; + GraphicCache* mpCache; + + GraphicManager( const GraphicManager& ) {} + GraphicManager& operator=( const GraphicManager& ) { return *this; } + + sal_Bool SVT_DLLPRIVATE ImplDraw( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + GraphicObject& rObj, + const GraphicAttr& rAttr, + const sal_uLong nFlags, + sal_Bool& rCached + ); + + sal_Bool SVT_DLLPRIVATE ImplCreateOutput( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + const BitmapEx& rBmpEx, + const GraphicAttr& rAttr, + const sal_uLong nFlags, + BitmapEx* pBmpEx = NULL + ); + sal_Bool SVT_DLLPRIVATE ImplCreateOutput( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + const GDIMetaFile& rMtf, + const GraphicAttr& rAttr, + const sal_uLong nFlags, + GDIMetaFile& rOutMtf, + BitmapEx& rOutBmpEx + ); + + sal_Bool SVT_DLLPRIVATE ImplCreateScaled( + const BitmapEx& rBmpEx, + long* pMapIX, + long* pMapFX, + long* pMapIY, + long* pMapFY, + long nStartX, + long nEndX, + long nStartY, + long nEndY, + BitmapEx& rOutBmpEx + ); + + sal_Bool SVT_DLLPRIVATE ImplCreateRotatedScaled( + const BitmapEx& rBmpEx, + sal_uInt16 nRot10, + const Size& rOutSzPix, + const Size& rUntSzPix, + long* pMapIX, + long* pMapFX, + long* pMapIY, + long* pMapFY, + long nStartX, + long nEndX, + long nStartY, + long nEndY, + BitmapEx& rOutBmpEx + ); + + static void SVT_DLLPRIVATE ImplAdjust( + BitmapEx& rBmpEx, + const GraphicAttr& rAttr, + sal_uLong nAdjustmentFlags + ); + static void SVT_DLLPRIVATE ImplAdjust( + GDIMetaFile& rMtf, + const GraphicAttr& rAttr, + sal_uLong nAdjustmentFlags + ); + static void SVT_DLLPRIVATE ImplAdjust( + Animation& rAnimation, + const GraphicAttr& rAttr, + sal_uLong nAdjustmentFlags + ); + + static void SVT_DLLPRIVATE ImplDraw( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + const GDIMetaFile& rMtf, + const GraphicAttr& rAttr + ); // Only used by GraphicObject's Ctor's and Dtor's - void SVT_DLLPRIVATE ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute, - const ByteString* pID = NULL, - const GraphicObject* pCopyObj = NULL ); - void SVT_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj ); - inline sal_Bool SVT_DLLPRIVATE ImplHasObjects() const { return( maObjList.Count() > 0UL ); } + void SVT_DLLPRIVATE ImplRegisterObj( + const GraphicObject& rObj, + Graphic& rSubstitute, + const ByteString* pID = NULL, + const GraphicObject* pCopyObj = NULL + ); + void SVT_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj ); + inline sal_Bool SVT_DLLPRIVATE ImplHasObjects() const { return !maObjList.empty(); } // Only used in swap case by GraphicObject - void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj ); - sal_Bool SVT_DLLPRIVATE ImplFillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); - void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj ); + void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj ); + sal_Bool SVT_DLLPRIVATE ImplFillSwappedGraphicObject( + const GraphicObject& rObj, + Graphic& rSubstitute + ); + void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedIn( const GraphicObject& rObj ); - ByteString SVT_DLLPRIVATE ImplGetUniqueID( const GraphicObject& rObj ) const; + ByteString SVT_DLLPRIVATE ImplGetUniqueID( const GraphicObject& rObj ) const; public: - GraphicManager( sal_uLong nCacheSize = 10000000UL, sal_uLong nMaxObjCacheSize = 2400000UL ); - ~GraphicManager(); + GraphicManager( sal_uLong nCacheSize = 10000000UL, sal_uLong nMaxObjCacheSize = 2400000UL ); + ~GraphicManager(); - void SetMaxCacheSize( sal_uLong nNewCacheSize ); + void SetMaxCacheSize( sal_uLong nNewCacheSize ); sal_uLong GetMaxCacheSize() const; - void SetMaxObjCacheSize( sal_uLong nNewMaxObjSize, sal_Bool bDestroyGreaterCached = sal_False ); + void SetMaxObjCacheSize( + sal_uLong nNewMaxObjSize, + sal_Bool bDestroyGreaterCached = sal_False + ); sal_uLong GetMaxObjCacheSize() const; sal_uLong GetUsedCacheSize() const; sal_uLong GetFreeCacheSize() const; - void SetCacheTimeout( sal_uLong nTimeoutSeconds ); + void SetCacheTimeout( sal_uLong nTimeoutSeconds ); sal_uLong GetCacheTimeout() const; - void ClearCache(); - - void ReleaseFromCache( const GraphicObject& rObj ); - - sal_Bool IsInCache( OutputDevice* pOut, const Point& rPt, const Size& rSz, - const GraphicObject& rObj, const GraphicAttr& rAttr ) const; - - sal_Bool DrawObj( OutputDevice* pOut, const Point& rPt, const Size& rSz, - GraphicObject& rObj, const GraphicAttr& rAttr, - const sal_uLong nFlags, sal_Bool& rCached ); + void ClearCache(); + + void ReleaseFromCache( const GraphicObject& rObj ); + + sal_Bool IsInCache( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + const GraphicObject& rObj, + const GraphicAttr& rAttr + ) const; + + sal_Bool DrawObj( + OutputDevice* pOut, + const Point& rPt, + const Size& rSz, + GraphicObject& rObj, + const GraphicAttr& rAttr, + const sal_uLong nFlags, + sal_Bool& rCached + ); }; #endif // _GRFMGR_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/svtools/helpopt.hxx b/svtools/inc/svtools/helpopt.hxx index 5947b8d034b1..92a2ad3793c7 100644 --- a/svtools/inc/svtools/helpopt.hxx +++ b/svtools/inc/svtools/helpopt.hxx @@ -85,10 +85,6 @@ public: void SetWelcomeScreen( sal_Bool b ); sal_Bool IsWelcomeScreen() const; - IdList* GetPIStarterList(); - void AddToPIStarterList( sal_Int32 nId ); - void RemoveFromPIStarterList( sal_Int32 nId ); - String GetLocale() const; String GetSystem() const; }; diff --git a/svtools/inc/svtools/imap.hxx b/svtools/inc/svtools/imap.hxx index 7e0124f70d0c..1d89ca30a49a 100644 --- a/svtools/inc/svtools/imap.hxx +++ b/svtools/inc/svtools/imap.hxx @@ -32,6 +32,7 @@ #include "svtools/svtdllapi.h" #include <tools/string.hxx> #include <tools/stream.hxx> +#include <vector> class Point; class Rectangle; @@ -45,22 +46,26 @@ class IMapObject; |* \******************************************************************************/ +typedef ::std::vector< IMapObject* > IMapObjectList_impl; + class SVT_DLLPUBLIC ImageMap { - List maList; +private: + + IMapObjectList_impl maList; String aName; protected: // Binaer laden/speichern void ImpWriteImageMap( SvStream& rOStm, const String& ) const ; - void ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String& ); + void ImpReadImageMap( SvStream& rIStm, size_t nCount, const String& ); // Im-/Export void ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const; void ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const; - sal_uLong ImpReadCERN( SvStream& rOStm, const String& rBaseURL ); - sal_uLong ImpReadNCSA( SvStream& rOStm, const String& rBaseURL ); + sal_uLong ImpReadCERN( SvStream& rOStm, const String& rBaseURL ); + sal_uLong ImpReadNCSA( SvStream& rOStm, const String& rBaseURL ); void ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL ); Point ImpReadCERNCoords( const char** ppStr ); @@ -71,7 +76,7 @@ protected: String ImpReadNCSAURL( const char** ppStr, const String& rBaseURL ); Point ImpReadNCSACoords( const char** ppStr ); - sal_uLong ImpDetectFormat( SvStream& rIStm ); + sal_uLong ImpDetectFormat( SvStream& rIStm ); public: @@ -98,11 +103,10 @@ public: // Zugriff auf einzelne IMapObjekte; die Objekte // duerfen von aussen _nicht_ zerstoert werden - IMapObject* GetFirstIMapObject() { return (IMapObject*) maList.First(); } - IMapObject* GetNextIMapObject() { return (IMapObject*) maList.Next(); } - IMapObject* GetLastIMapObject() { return (IMapObject*) maList.Last(); } - IMapObject* GetPrevIMapObject() { return (IMapObject*) maList.Prev(); } - IMapObject* GetIMapObject( sal_uInt16 nPos ) const { return (IMapObject*) maList.GetObject( nPos ); } + IMapObject* GetIMapObject( size_t nPos ) const + { + return ( nPos < maList.size() ) ? maList[ nPos ] : NULL; + } // Gibt das Objekt zurueck, das zuerst getroffen wurde oder NULL; // Groessen- und Positionsangaben sind in 1/100mm; @@ -116,13 +120,13 @@ public: sal_uLong nFlags = 0 ); // Gibt die Gesamtanzahl der IMap-Objekte zurueck - sal_uInt16 GetIMapObjectCount() const { return (sal_uInt16) maList.Count(); } + size_t GetIMapObjectCount() const { return maList.size(); } // Loescht alle internen Objekte void ClearImageMap(); // liefert die aktuelle Versionsnummer - sal_uInt16 GetVersion() const; + sal_uInt16 GetVersion() const; // liefert / setzt den Namen der ImageMap const String& GetName() const { return aName; } diff --git a/svtools/inc/svtools/imapcirc.hxx b/svtools/inc/svtools/imapcirc.hxx index 1ae929374b4f..ea2168597e15 100644 --- a/svtools/inc/svtools/imapcirc.hxx +++ b/svtools/inc/svtools/imapcirc.hxx @@ -43,7 +43,7 @@ class Fraction; class SVT_DLLPUBLIC IMapCircleObject : public IMapObject { Point aCenter; - sal_uLong nRadius; + sal_Int32 nRadius; void ImpConstruct( const Point& rCenter, sal_uLong nRad, sal_Bool bPixel ); diff --git a/svtools/inc/svtools/imapobj.hxx b/svtools/inc/svtools/imapobj.hxx index fc907135fdaa..f97850c061de 100644 --- a/svtools/inc/svtools/imapobj.hxx +++ b/svtools/inc/svtools/imapobj.hxx @@ -32,6 +32,7 @@ #include "svtools/svtdllapi.h" #include <tools/string.hxx> #include <svl/macitem.hxx> +#include <rtl/strbuf.hxx> class Point; class Rectangle; @@ -77,7 +78,6 @@ class SVT_DLLPUBLIC IMapObject sal_Bool bActive; protected: - sal_uInt16 nReadVersion; // Binaer-Im-/Export @@ -85,10 +85,10 @@ protected: virtual void ReadIMapObject( SvStream& rIStm ) = 0; // Hilfsmethoden - void AppendCERNCoords( const Point& rPoint100, ByteString& rStr ) const; - void AppendCERNURL( ByteString& rStr, const String& rBaseURL ) const; - void AppendNCSACoords( const Point& rPoint100, ByteString& rStr ) const; - void AppendNCSAURL( ByteString& rStr, const String& rBaseURL ) const; + void AppendCERNCoords(rtl::OStringBuffer& rBuf, const Point& rPoint100) const; + void AppendCERNURL(rtl::OStringBuffer& rBuf, const String& rBaseURL) const; + void AppendNCSACoords(rtl::OStringBuffer& rBuf, const Point& rPoint100) const; + void AppendNCSAURL(rtl::OStringBuffer&rBuf, const String& rBaseURL) const; public: @@ -130,9 +130,6 @@ public: sal_Bool IsActive() const { return bActive; } void SetActive( sal_Bool bSetActive = sal_True ) { bActive = bSetActive; } - static Point GetPixelPoint( const Point& rLogPoint ); - static Point GetLogPoint( const Point& rPixelPoint ); - sal_Bool IsEqual( const IMapObject& rEqObj ); // IMap-Events diff --git a/svtools/inc/svtools/ivctrl.hxx b/svtools/inc/svtools/ivctrl.hxx index 13bf8bcdd24a..ba3daeed58f4 100644 --- a/svtools/inc/svtools/ivctrl.hxx +++ b/svtools/inc/svtools/ivctrl.hxx @@ -341,8 +341,6 @@ public: SvxIconChoiceCtrlEntry* GetEntry( const Point& rPosPixel, sal_Bool bHit = sal_False ) const; // Gibt den naechsten ueber pCurEntry liegenden Eintrag (ZOrder) SvxIconChoiceCtrlEntry* GetNextEntry( const Point& rPosPixel, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool ) const; - // Gibt den naechsten unter pCurEntry liegenden Eintrag (ZOrder) - SvxIconChoiceCtrlEntry* GetPrevEntry( const Point& rPosPixel, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool ) const; // in dem sal_uLong wird die Position in der Liste des gefunden Eintrags zurueckgegeben SvxIconChoiceCtrlEntry* GetSelectedEntry( sal_uLong& rPos ) const; diff --git a/svtools/inc/svtools/prnsetup.hxx b/svtools/inc/svtools/prnsetup.hxx index a7155032a238..4fc096c5a85e 100644 --- a/svtools/inc/svtools/prnsetup.hxx +++ b/svtools/inc/svtools/prnsetup.hxx @@ -90,7 +90,6 @@ public: virtual short Execute(); void SetOptionsHdl( const Link& rLink ); - const Link& GetOptionsHdl() const; }; // -------------------------------------- diff --git a/svtools/inc/svtools/svicnvw.hxx b/svtools/inc/svtools/svicnvw.hxx deleted file mode 100644 index 30773b101547..000000000000 --- 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/inc/svtools/svtreebx.hxx b/svtools/inc/svtools/svtreebx.hxx index 6edd32110317..96adfe73aea9 100644 --- a/svtools/inc/svtools/svtreebx.hxx +++ b/svtools/inc/svtools/svtreebx.hxx @@ -369,6 +369,8 @@ public: SvLBoxEntry* GetFirstEntryInView() const; SvLBoxEntry* GetNextEntryInView(SvLBoxEntry*) const; + SvLBoxEntry* GetLastEntryInView() const; + void ScrollToAbsPos( long nPos ); void ShowFocusRect( const SvLBoxEntry* pEntry ); void SetTabBar( TabBar* pTabBar ); diff --git a/svtools/inc/svtools/syntaxhighlight.hxx b/svtools/inc/svtools/syntaxhighlight.hxx index a9a0c5a2da58..f4bcca15a68d 100644 --- a/svtools/inc/svtools/syntaxhighlight.hxx +++ b/svtools/inc/svtools/syntaxhighlight.hxx @@ -129,14 +129,6 @@ class SimpleTokenizer_Impl sal_Bool getNextToken( /*out*/TokenTypes& reType, /*out*/const sal_Unicode*& rpStartPos, /*out*/const sal_Unicode*& rpEndPos ); - String getTokStr( /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ); - -#ifdef DBG_UTIL - // TEST: Token ausgeben - String getFullTokenStr( /*out*/TokenTypes eType, - /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ); -#endif - const char** ppListKeyWords; sal_uInt16 nKeyWordCount; diff --git a/svtools/inc/svtools/tabbar.hxx b/svtools/inc/svtools/tabbar.hxx index a8bdabdb6432..1478b0e690dd 100644 --- a/svtools/inc/svtools/tabbar.hxx +++ b/svtools/inc/svtools/tabbar.hxx @@ -450,7 +450,6 @@ public: void Clear(); - void EnablePage( sal_uInt16 nPageId, sal_Bool bEnable = sal_True ); sal_Bool IsPageEnabled( sal_uInt16 nPageId ) const; void SetPageBits( sal_uInt16 nPageId, TabBarPageBits nBits = 0 ); @@ -472,10 +471,6 @@ public: void MakeVisible( sal_uInt16 nPageId ); void SelectPage( sal_uInt16 nPageId, sal_Bool bSelect = sal_True ); - void SelectPageRange( sal_Bool bSelect = sal_False, - sal_uInt16 nStartPos = 0, - sal_uInt16 nEndPos = TabBar::APPEND ); - sal_uInt16 GetSelectPage( sal_uInt16 nSelIndex = 0 ) const; sal_uInt16 GetSelectPageCount() const; sal_Bool IsPageSelected( sal_uInt16 nPageId ) const; @@ -519,24 +514,17 @@ public: void EndSwitchPage(); sal_Bool IsInSwitching() { return mbInSwitching; } - void SetSelectColor(); - void SetSelectColor( const Color& rColor ); const Color& GetSelectColor() const { return maSelColor; } sal_Bool IsSelectColor() const { return mbSelColor; } - void SetSelectTextColor(); - void SetSelectTextColor( const Color& rColor ); const Color& GetSelectTextColor() const { return maSelTextColor; } sal_Bool IsSelectTextColor() const { return mbSelTextColor; } void SetPageText( sal_uInt16 nPageId, const XubString& rText ); XubString GetPageText( sal_uInt16 nPageId ) const; - void SetHelpText( sal_uInt16 nPageId, const XubString& rText ); XubString GetHelpText( sal_uInt16 nPageId ) const; - void SetHelpId( sal_uInt16 nPageId, const rtl::OString& nHelpId ); rtl::OString GetHelpId( sal_uInt16 nPageId ) const; long GetSplitSize() const { return mnSplitSize; } - long GetMinSize() const; void SetHelpText( const XubString& rText ) { Window::SetHelpText( rText ); } diff --git a/svtools/inc/svtools/taskbar.hxx b/svtools/inc/svtools/taskbar.hxx index 4fb126e5eefe..c29fe770f757 100644 --- a/svtools/inc/svtools/taskbar.hxx +++ b/svtools/inc/svtools/taskbar.hxx @@ -88,9 +88,7 @@ TaskStatusBar kann auch ein Notify-Object gesetzt werden, wenn man benachrichtigt werden will, wenn die Uhrzeit oder die TaskStatusBar angeklickt wird. Wenn der Notify fuer die Uhrzeit kommt, ist die Id TASKSTATUSBAR_CLOCKID, wenn er fuer die TaskStatusBar kommt, ist -die Id 0. Mit SetFieldFlags() kann am TaskStatusBar auch die Flags -hinterher umgesetzt werden, um zum Beispiel die Uhrzeit ein- und -auszuschalten. +die Id 0. TaskBar @@ -253,11 +251,6 @@ private: public: TaskStatusFieldItem(); TaskStatusFieldItem( const TaskStatusFieldItem& rItem ); - TaskStatusFieldItem( ITaskStatusNotify* pNotify, - const Image& rImage, - const XubString& rQuickHelpText, - const XubString& rHelpText, - sal_uInt16 nFlags ); ~TaskStatusFieldItem(); void SetNotifyObject( ITaskStatusNotify* pNotify ) { mpNotify = pNotify; } @@ -331,16 +324,9 @@ public: sal_uInt16 nFlags = TASKSTATUSFIELD_CLOCK ); void RemoveStatusField() { maTimer.Stop(); RemoveItem( TASKSTATUSBAR_STATUSFIELDID ); } - void SetFieldFlags( sal_uInt16 nFlags ); sal_uInt16 GetFieldFlags() const { return mnFieldFlags; } void SetNotifyObject( ITaskStatusNotify* pNotify ) { mpNotify = pNotify; } ITaskStatusNotify* GetNotifyObject() const { return mpNotify; } - - void AddStatusFieldItem( sal_uInt16 nItemId, const TaskStatusFieldItem& rItem, - sal_uInt16 nPos = 0xFFFF ); - void ModifyStatusFieldItem( sal_uInt16 nItemId, const TaskStatusFieldItem& rItem ); - void RemoveStatusFieldItem( sal_uInt16 nItemId ); - sal_Bool GetStatusFieldItem( sal_uInt16 nItemId, TaskStatusFieldItem& rItem ) const; }; // ----------- @@ -403,14 +389,9 @@ public: void Format(); - void SetLines( sal_uInt16 nLines ); sal_uInt16 GetLines() const { return mnLines; } - void EnableAutoHide( sal_Bool bAutoHide = sal_True ); sal_Bool IsAutoHideEnabled() const { return mbAutoHide; } - void ShowStatusText( const String& rText ); - void HideStatusText(); - void SetStatusSize( long nNewSize ) { mnStatusWidth=nNewSize; Resize(); } long GetStatusSize() const { return mnStatusWidth; } @@ -440,30 +421,39 @@ class ImplWindowArrangeList; // - class WindowArrange - // ----------------------- +typedef ::std::vector< Window* > WindowList_impl; + class SVT_DLLPUBLIC WindowArrange { private: - List* mpWinList; - void* mpDummy; - sal_uLong mnDummy; + WindowList_impl maWinList; #ifdef _TASKBAR_CXX - SVT_DLLPRIVATE void ImplTile( const Rectangle& rRect ); - SVT_DLLPRIVATE void ImplHorz( const Rectangle& rRect ); - SVT_DLLPRIVATE void ImplVert( const Rectangle& rRect ); - SVT_DLLPRIVATE void ImplCascade( const Rectangle& rRect ); + SVT_DLLPRIVATE void ImplTile( const Rectangle& rRect ); + SVT_DLLPRIVATE void ImplHorz( const Rectangle& rRect ); + SVT_DLLPRIVATE void ImplVert( const Rectangle& rRect ); + SVT_DLLPRIVATE void ImplCascade( const Rectangle& rRect ); #endif public: - WindowArrange(); - ~WindowArrange(); - - void AddWindow( Window* pWindow, sal_uLong nPos = LIST_APPEND ) - { mpWinList->Insert( (void*)pWindow, nPos ); } - void RemoveAllWindows() - { mpWinList->Clear(); } - - void Arrange( sal_uInt16 nType, const Rectangle& rRect ); + WindowArrange(); + ~WindowArrange(); + + void AddWindow( Window* pWindow, size_t nPos = size_t(-1) ) + { + if ( nPos < maWinList.size() ) { + maWinList.insert( maWinList.begin() + nPos, pWindow ); + } else { + maWinList.push_back( pWindow ); + } + } + + void RemoveAllWindows() + { + maWinList.clear(); + } + + void Arrange( sal_uInt16 nType, const Rectangle& rRect ); }; #endif // _TASKBAR_HXX diff --git a/svtools/inc/svtools/texteng.hxx b/svtools/inc/svtools/texteng.hxx index ba2c440f6d98..e9f0b6c51b06 100644 --- a/svtools/inc/svtools/texteng.hxx +++ b/svtools/inc/svtools/texteng.hxx @@ -196,7 +196,6 @@ protected: void FormatAndUpdate( TextView* pCurView = 0 ); sal_Bool IsFormatting() const { return mbIsFormatting; } void UpdateViews( TextView* pCurView = 0 ); - void SetUpdateMode( sal_Bool bUp, TextView* pCurView, sal_Bool bForceUpdate ); void ImpPaint( OutputDevice* pOut, const Point& rStartPos, Rectangle const* pPaintArea, TextSelection const* pPaintRange = 0, TextSelection const* pSelection = 0 ); @@ -245,7 +244,6 @@ public: void SetFont( const Font& rFont ); const Font& GetFont() const { return maFont; } - void SetDefTab( sal_uInt16 nDefTab ); sal_uInt16 GetDefTab() const; void SetLeftMargin( sal_uInt16 n ); @@ -325,7 +323,6 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > GetBreakIterator(); static sal_Bool DoesKeyChangeText( const KeyEvent& rKeyEvent ); - static sal_Bool DoesKeyMoveCursor( const KeyEvent& rKeyEvent ); static sal_Bool IsSimpleCharInput( const KeyEvent& rKeyEvent ); }; diff --git a/svtools/inc/svtools/textview.hxx b/svtools/inc/svtools/textview.hxx index de8da807a3dd..ebf7a4f6f2eb 100644 --- a/svtools/inc/svtools/textview.hxx +++ b/svtools/inc/svtools/textview.hxx @@ -156,7 +156,6 @@ public: void Redo(); sal_Bool Read( SvStream& rInput ); - sal_Bool Write( SvStream& rOutput ); void SetStartDocPos( const Point& rPos ); const Point& GetStartDocPos() const; @@ -168,7 +167,6 @@ public: sal_Bool IsInsertMode() const; void SetAutoIndentMode( sal_Bool bAutoIndent ); - sal_Bool IsAutoIndentMode() const; void SetReadOnly( sal_Bool bReadOnly ); sal_Bool IsReadOnly() const; @@ -180,10 +178,6 @@ public: sal_Bool IsSelectionAtPoint( const Point& rPointPixel ); void SetPaintSelection( sal_Bool bPaint); - sal_Bool IsPaintSelection() const; - - void SetHighlightSelection( sal_Bool bSelectByHighlight ); - sal_Bool IsHighlightSelection() const; void EraseVirtualDevice(); @@ -204,10 +198,6 @@ public: TextPaM CursorStartOfDoc(); TextPaM CursorEndOfDoc(); - // Old, remove! - TextPaM CursorLeft( const TextPaM& rPaM, sal_Bool bWordMode = sal_False ); - TextPaM CursorRight( const TextPaM& rPaM, sal_Bool bWordMode = sal_False ); - /** Drag and Drop, deleting and selection regards all text that has an attribute TEXTATTR_PROTECTED set as one entitity. Drag and dropped text is automatically diff --git a/svtools/inc/svtools/transfer.hxx b/svtools/inc/svtools/transfer.hxx index 397dccfc0fe6..3b0d961a3623 100644 --- a/svtools/inc/svtools/transfer.hxx +++ b/svtools/inc/svtools/transfer.hxx @@ -267,10 +267,7 @@ protected: sal_Bool SetTransferableObjectDescriptor( const TransferableObjectDescriptor& rDesc, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); sal_Bool SetINetBookmark( const INetBookmark& rBmk, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); sal_Bool SetINetImage( const INetImage& rINtImg, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); - sal_Bool SetFileList( const FileList& rFileList, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); sal_Bool SetObject( void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); - sal_Bool SetInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf, - const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); protected: @@ -398,7 +395,6 @@ public: sal_Bool GetInputStream( SotFormatStringId nFormat, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream ); sal_Bool GetInputStream( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xStream ); - sal_Bool GetInterface( SotFormatStringId nFormat, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf ); sal_Bool GetInterface( const ::com::sun::star::datatransfer::DataFlavor& rFlavor, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf ); public: @@ -565,8 +561,6 @@ public: TransferDataContainer(); ~TransferDataContainer(); - void ClearData(); - void CopyINetBookmark( const INetBookmark& rBkmk ); void CopyINetImage( const INetImage& rINtImg ); void CopyImageMap( const ImageMap& rImgMap ); diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx index 6c296d26ea44..63545ed30cc1 100644 --- a/svtools/inc/svtools/treelist.hxx +++ b/svtools/inc/svtools/treelist.hxx @@ -494,9 +494,15 @@ public: SvListEntry* LastSelected() const { return pModel->LastSelected(this); } + SvListEntry* GetEntryAtAbsPos( sal_uLong nAbsPos ) const + { return pModel->GetEntryAtAbsPos(nAbsPos); } + SvListEntry* GetEntryAtVisPos( sal_uLong nVisPos ) const { return pModel->GetEntryAtVisPos((SvListView*)this,nVisPos); } + sal_uLong GetAbsPos( SvListEntry* pEntry ) const + { return pModel->GetAbsPos(pEntry); } + sal_uLong GetVisiblePos( SvListEntry* pEntry ) const { return pModel->GetVisiblePos((SvListView*)this,pEntry); } diff --git a/svtools/inc/svtools/txtattr.hxx b/svtools/inc/svtools/txtattr.hxx index 982e9c20be5a..bf4c8e38b007 100644 --- a/svtools/inc/svtools/txtattr.hxx +++ b/svtools/inc/svtools/txtattr.hxx @@ -59,10 +59,10 @@ public: virtual ~TextAttrib(); - sal_uInt16 Which() const { return mnWhich; } - + sal_uInt16 Which() const { return mnWhich; } virtual void SetFont( Font& rFont ) const = 0; virtual TextAttrib* Clone() const = 0; + virtual int operator==( const TextAttrib& rAttr ) const = 0; int operator!=( const TextAttrib& rAttr ) const { return !(*this == rAttr ); } @@ -114,8 +114,6 @@ private: Color maColor; public: - TextAttribHyperLink( const XubString& rURL ); - TextAttribHyperLink( const XubString& rURL, const XubString& rDescription ); TextAttribHyperLink( const TextAttribHyperLink& rAttr ); ~TextAttribHyperLink(); diff --git a/svtools/inc/svtools/unitconv.hxx b/svtools/inc/svtools/unitconv.hxx index 51aa3aa61f30..d50c89dc7c19 100644 --- a/svtools/inc/svtools/unitconv.hxx +++ b/svtools/inc/svtools/unitconv.hxx @@ -51,10 +51,6 @@ SVT_DLLPUBLIC long ItemToControl( long nIn, SfxMapUnit eItem, SfxFieldUnit SVT_DLLPUBLIC long ControlToItem( long nIn, SfxFieldUnit eCtrl, SfxMapUnit eItem ); SVT_DLLPUBLIC FieldUnit MapToFieldUnit( const SfxMapUnit eUnit ); -SVT_DLLPUBLIC MapUnit FieldToMapUnit( const SfxFieldUnit eUnit ); - -SVT_DLLPUBLIC long ConvertValueToMap( long nVal, SfxMapUnit eUnit ); -SVT_DLLPUBLIC long ConvertValueToUnit( long nVal, SfxMapUnit eUnit ); SVT_DLLPUBLIC void SetMetricValue( MetricField& rField, long lCoreValue, SfxMapUnit eUnit ); SVT_DLLPUBLIC long GetCoreValue( const MetricField& rField, SfxMapUnit eUnit ); diff --git a/svtools/inc/svtools/wmf.hxx b/svtools/inc/svtools/wmf.hxx index 3c1f07774a45..a455f443e26e 100644 --- a/svtools/inc/svtools/wmf.hxx +++ b/svtools/inc/svtools/wmf.hxx @@ -63,8 +63,6 @@ SVT_DLLPUBLIC sal_Bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStre sal_Bool ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pConfigItem = NULL ); -SVT_DLLPUBLIC sal_Bool WriteWindowMetafile( SvStream& rStream, const GDIMetaFile& rMTF ); - SVT_DLLPUBLIC sal_Bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF ); #endif diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst index 7ac223ae1588..d18c9f9df2a2 100644 --- a/svtools/prj/build.lst +++ b/svtools/prj/build.lst @@ -1,2 +1,2 @@ -st svtools : TRANSLATIONS:translations svl offuh toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal salhelper sot jvmfwk LIBXSLT:libxslt NULL +st svtools : TRANSLATIONS:translations svl offapi toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal salhelper sot jvmfwk LIBXSLT:libxslt ure test NULL st svtools\prj nmake - all st_prj NULL diff --git a/svtools/qa/cppunit/data/emf/fail/.gitignore b/svtools/qa/cppunit/data/emf/fail/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/svtools/qa/cppunit/data/emf/fail/.gitignore diff --git a/svtools/qa/cppunit/data/emf/fail/CVE-2004-0209-1.emf b/svtools/qa/cppunit/data/emf/fail/CVE-2004-0209-1.emf Binary files differnew file mode 100644 index 000000000000..2f77fcda3b99 --- /dev/null +++ b/svtools/qa/cppunit/data/emf/fail/CVE-2004-0209-1.emf diff --git a/svtools/qa/cppunit/data/emf/fail/CVE-2008-1083-1.emf b/svtools/qa/cppunit/data/emf/fail/CVE-2008-1083-1.emf Binary files differnew file mode 100644 index 000000000000..0cbd952de2f6 --- /dev/null +++ b/svtools/qa/cppunit/data/emf/fail/CVE-2008-1083-1.emf diff --git a/svtools/qa/cppunit/data/emf/fail/CVE-2009-1217-1.emf b/svtools/qa/cppunit/data/emf/fail/CVE-2009-1217-1.emf Binary files differnew file mode 100644 index 000000000000..ee7db91e37fe --- /dev/null +++ b/svtools/qa/cppunit/data/emf/fail/CVE-2009-1217-1.emf diff --git a/svtools/qa/cppunit/data/emf/indeterminate/.gitignore b/svtools/qa/cppunit/data/emf/indeterminate/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/svtools/qa/cppunit/data/emf/indeterminate/.gitignore diff --git a/svtools/qa/cppunit/data/emf/pass/.gitignore b/svtools/qa/cppunit/data/emf/pass/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/svtools/qa/cppunit/data/emf/pass/.gitignore diff --git a/svtools/qa/cppunit/data/emf/pass/CVE-2008-1087-1.emf b/svtools/qa/cppunit/data/emf/pass/CVE-2008-1087-1.emf Binary files differnew file mode 100644 index 000000000000..9bc2a3f203fa --- /dev/null +++ b/svtools/qa/cppunit/data/emf/pass/CVE-2008-1087-1.emf diff --git a/svtools/qa/cppunit/data/wmf/fail/.gitignore b/svtools/qa/cppunit/data/wmf/fail/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/fail/.gitignore diff --git a/svtools/qa/cppunit/data/wmf/fail/CVE-2005-2124-1.wmf b/svtools/qa/cppunit/data/wmf/fail/CVE-2005-2124-1.wmf Binary files differnew file mode 100644 index 000000000000..5826a98277c2 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/fail/CVE-2005-2124-1.wmf diff --git a/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-1.wmf b/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-1.wmf Binary files differnew file mode 100644 index 000000000000..07db62c2a48c --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-1.wmf diff --git a/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-2.wmf b/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-2.wmf Binary files differnew file mode 100644 index 000000000000..5b99a4883ce8 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-2.wmf diff --git a/svtools/qa/cppunit/data/wmf/indeterminate/.gitignore b/svtools/qa/cppunit/data/wmf/indeterminate/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/indeterminate/.gitignore diff --git a/svtools/qa/cppunit/data/wmf/pass/.gitignore b/svtools/qa/cppunit/data/wmf/pass/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/pass/.gitignore diff --git a/svtools/qa/cppunit/data/wmf/pass/CVE-2005-2123-1.wmf b/svtools/qa/cppunit/data/wmf/pass/CVE-2005-2123-1.wmf Binary files differnew file mode 100644 index 000000000000..6af243b587c5 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/pass/CVE-2005-2123-1.wmf diff --git a/svtools/qa/cppunit/data/wmf/pass/CVE-2006-4071-1.wmf b/svtools/qa/cppunit/data/wmf/pass/CVE-2006-4071-1.wmf Binary files differnew file mode 100644 index 000000000000..794a7ef9af08 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/pass/CVE-2006-4071-1.wmf diff --git a/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1090-1.wmf b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1090-1.wmf Binary files differnew file mode 100644 index 000000000000..c050fa6e3b4d --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1090-1.wmf diff --git a/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1238-1.wmf b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1238-1.wmf Binary files differnew file mode 100644 index 000000000000..a01e310089b0 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1238-1.wmf diff --git a/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1245-1.wmf b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1245-1.wmf Binary files differnew file mode 100644 index 000000000000..a01e310089b0 --- /dev/null +++ b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1245-1.wmf diff --git a/svtools/qa/cppunit/filters-test.cxx b/svtools/qa/cppunit/filters-test.cxx new file mode 100644 index 000000000000..c5d43af4bb9b --- /dev/null +++ b/svtools/qa/cppunit/filters-test.cxx @@ -0,0 +1,214 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Caolán McNamara <caolanm@redhat.com> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Caolán McNamara <caolanm@redhat.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <sal/cppunit.h> +#include <sal/config.h> + +#include <osl/file.hxx> +#include <osl/process.h> + +#include <vcl/svapp.hxx> + +#include <comphelper/processfactory.hxx> + +#include <cppuhelper/bootstrap.hxx> + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <svtools/filter.hxx> + +const int indeterminate = 2; + +using namespace ::com::sun::star; + +/* Implementation of Filters test */ + +class FiltersTest : public CppUnit::TestFixture +{ +public: + FiltersTest(); + ~FiltersTest(); + + virtual void setUp(); + virtual void tearDown(); + + void recursiveScan(const rtl::OUString &rURL, int nExpected); + bool load(const rtl::OUString &rURL); + + /** + * Ensure CVEs remain unbroken + */ + void testCVEs(); + + CPPUNIT_TEST_SUITE(FiltersTest); + CPPUNIT_TEST(testCVEs); + CPPUNIT_TEST_SUITE_END(); + +private: + uno::Reference<uno::XComponentContext> m_xContext; + uno::Reference<lang::XMultiComponentFactory> m_xFactory; + ::rtl::OUString m_aSrcRoot; +}; + +bool FiltersTest::load(const rtl::OUString &rURL) +{ + GraphicFilter aGraphicFilter(false); + SvFileStream aFileStream(rURL, STREAM_READ); + Graphic aGraphic; + return aGraphicFilter.ImportGraphic(aGraphic, rURL, aFileStream) == 0; +} + +void FiltersTest::recursiveScan(const rtl::OUString &rURL, int nExpected) +{ + osl::Directory aDir(rURL); + + CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.open()); + osl::DirectoryItem aItem; + osl::FileStatus aFileStatus(osl_FileStatus_Mask_FileURL|osl_FileStatus_Mask_Type); + while (aDir.getNextItem(aItem) == osl::FileBase::E_None) + { + aItem.getFileStatus(aFileStatus); + rtl::OUString sURL = aFileStatus.getFileURL(); + if (aFileStatus.getFileType() == osl::FileStatus::Directory) + recursiveScan(sURL, nExpected); + else + { + sal_Int32 nLastSlash = sURL.lastIndexOf('/'); + + //ignore .files + if ( + (nLastSlash != -1) && (nLastSlash+1 < sURL.getLength()) && + (sURL.getStr()[nLastSlash+1] == '.') + ) + { + continue; + } + + rtl::OString aRes(rtl::OUStringToOString(sURL, + osl_getThreadTextEncoding())); + if (nExpected == indeterminate) + { + fprintf(stderr, "loading %s\n", aRes.getStr()); + } + sal_uInt32 nStartTime = osl_getGlobalTimer(); + bool bRes = load(sURL); + sal_uInt32 nEndTime = osl_getGlobalTimer(); + if (nExpected == indeterminate) + { + fprintf(stderr, "pass/fail was %d (%"SAL_PRIuUINT32" ms)\n", + bRes, nEndTime-nStartTime); + continue; + } + CPPUNIT_ASSERT_MESSAGE(aRes.getStr(), bRes == nExpected); + } + } + CPPUNIT_ASSERT(osl::FileBase::E_None == aDir.close()); +} + +void FiltersTest::testCVEs() +{ + recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/libs-gui/svtools/qa/cppunit/data/wmf/pass")), true); + recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/libs-gui/svtools/qa/cppunit/data/wmf/fail")), false); + recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/libs-gui/svtools/qa/cppunit/data/wmf/indeterminate")), 2); + + recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/libs-gui/svtools/qa/cppunit/data/emf/pass")), true); + recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/libs-gui/svtools/qa/cppunit/data/emf/fail")), false); + recursiveScan(m_aSrcRoot + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/clone/libs-gui/svtools/qa/cppunit/data/emf/indeterminate")), 2); +} + +FiltersTest::FiltersTest() + : m_aSrcRoot(RTL_CONSTASCII_USTRINGPARAM("file://")) +{ + m_xContext = cppu::defaultBootstrap_InitialComponentContext(); + m_xFactory = m_xContext->getServiceManager(); + + uno::Reference<lang::XMultiServiceFactory> xSM(m_xFactory, uno::UNO_QUERY_THROW); + + //Without this we're crashing because callees are using + //getProcessServiceFactory. In general those should be removed in favour + //of retaining references to the root ServiceFactory as its passed around + comphelper::setProcessServiceFactory(xSM); +#if 0 + // initialise UCB-Broker + uno::Sequence<uno::Any> aUcbInitSequence(2); + aUcbInitSequence[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local")); + aUcbInitSequence[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office")); + bool bInitUcb = ucbhelper::ContentBroker::initialize(xSM, aUcbInitSequence); + CPPUNIT_ASSERT_MESSAGE("Should be able to initialize UCB", bInitUcb); + + uno::Reference<ucb::XContentProviderManager> xUcb = + ucbhelper::ContentBroker::get()->getContentProviderManagerInterface(); + uno::Reference<ucb::XContentProvider> xFileProvider(xSM->createInstance( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.FileContentProvider"))), uno::UNO_QUERY); + xUcb->registerContentProvider(xFileProvider, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file")), sal_True); + + // force locale (and resource files loaded) to en-US + const LanguageType eLang=LANGUAGE_ENGLISH_US; + + rtl::OUString aLang, aCountry; + MsLangId::convertLanguageToIsoNames(eLang, aLang, aCountry); + lang::Locale aLocale(aLang, aCountry, rtl::OUString()); + ResMgr::SetDefaultLocale( aLocale ); + + SvtSysLocaleOptions aLocalOptions; + aLocalOptions.SetUILocaleConfigString( + MsLangId::convertLanguageToIsoString( eLang ) ); +#endif + + InitVCL(xSM); + + const char* pSrcRoot = getenv( "SRC_ROOT" ); + CPPUNIT_ASSERT_MESSAGE("SRC_ROOT env variable not set", pSrcRoot != NULL && pSrcRoot[0] != 0); + +#ifdef WNT + if (pSrcRoot[1] == ':') + m_aSrcRoot += rtl::OUString::createFromAscii( "/" ); +#endif + m_aSrcRoot += rtl::OUString::createFromAscii( pSrcRoot ); +} + +void FiltersTest::setUp() +{ +} + +FiltersTest::~FiltersTest() +{ + uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose(); +} + +void FiltersTest::tearDown() +{ +} + +CPPUNIT_TEST_SUITE_REGISTRATION(FiltersTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 31e4a187574f..3619355ce355 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -266,36 +266,6 @@ void BrowseBox::InsertHandleColumn( sal_uLong nWidth ) } //------------------------------------------------------------------- -void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const Image& rImage, - long nWidth, HeaderBarItemBits nBits, sal_uInt16 nPos ) -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - - if ( nPos < pCols->size() ) - { - BrowserColumns::iterator it = pCols->begin(); - ::std::advance( it, nPos ); - pCols->insert( it, new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ) ); - } - else - { - pCols->push_back( new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ) ); - } - if ( nCurColId == 0 ) - nCurColId = nItemId; - if ( getDataWindow()->pHeaderBar ) - { - // Handlecolumn nicht in der Headerbar - sal_uInt16 nHeaderPos = nPos; - if (nHeaderPos != HEADERBAR_APPEND && !GetColumnId(0)) - nHeaderPos--; - getDataWindow()->pHeaderBar->InsertItem( - nItemId, rImage, nWidth, nBits, nHeaderPos ); - } - ColumnInserted( nPos ); -} - -//------------------------------------------------------------------- void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const XubString& rText, long nWidth, HeaderBarItemBits nBits, sal_uInt16 nPos ) @@ -328,45 +298,6 @@ void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const XubString& rText, } //------------------------------------------------------------------- - -void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, - const Image& rImage, const XubString& rText, - long nWidth, HeaderBarItemBits nBits, sal_uInt16 nPos, - const String* pHelpText ) -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - - if ( nPos < pCols->size() ) - { - BrowserColumns::iterator it = pCols->begin(); - ::std::advance( it, nPos ); - pCols->insert( it, new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ) ); - } - else - { - pCols->push_back( new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ) ); - } - - if ( nCurColId == 0 ) - nCurColId = nItemId; - if ( getDataWindow()->pHeaderBar ) - { - // Handlecolumn nicht in der Headerbar - sal_uInt16 nHeaderPos = nPos; - if (nHeaderPos != HEADERBAR_APPEND && !GetColumnId(0)) - nHeaderPos--; - - getDataWindow()->pHeaderBar->InsertItem( - nItemId, rImage, rText, nWidth, nBits, nHeaderPos ); - if( pHelpText && !rText.Len() ) - { - getDataWindow()->pHeaderBar->SetHelpText( - nItemId, *pHelpText ); - } - } - ColumnInserted( nPos ); -} -//------------------------------------------------------------------- sal_uInt16 BrowseBox::ToggleSelectedColumn() { sal_uInt16 nSelectedColId = USHRT_MAX; @@ -594,35 +525,6 @@ void BrowseBox::SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos ) //------------------------------------------------------------------- -void BrowseBox::SetColumnMode( sal_uInt16 nColumnId, BrowserColumnMode nFlags ) -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - - // never set mode of the handle-column - if ( nColumnId == 0 ) - return; - - // get the position in the current array - size_t nColumnPos = GetColumnPos( nColumnId ); - if ( nColumnPos >= pCols->size() ) - // not available! - return; - - // does the state change? - BrowserColumn *pCol = (*pCols)[ nColumnPos ]; - if ( pCol->Flags() != nFlags ) - { - pCol->Flags() = sal::static_int_cast< HeaderBarItemBits >(nFlags); - - // redraw visible colums - if ( GetUpdateMode() && ( pCol->IsFrozen() || nColumnPos > nFirstCol ) ) - Invalidate( Rectangle( Point(0,0), - Size( GetOutputSizePixel().Width(), GetTitleHeight() ) ) ); - } -} - -//------------------------------------------------------------------- - void BrowseBox::SetColumnTitle( sal_uInt16 nItemId, const String& rTitle ) { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); @@ -1213,15 +1115,6 @@ long BrowseBox::ScrollRows( long nRows ) //------------------------------------------------------------------- -long BrowseBox::ScrollPages( long ) -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - - return ScrollRows( pDataWin->GetSizePixel().Height() / GetDataRowHeight() ); -} - -//------------------------------------------------------------------- - void BrowseBox::RowModified( long nRow, sal_uInt16 nColId ) { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); @@ -1589,12 +1482,6 @@ sal_Bool BrowseBox::GoToRow( long nRow) //------------------------------------------------------------------- -sal_Bool BrowseBox::GoToRowAndDoNotModifySelection( long nRow ) -{ - return GoToRow( nRow, sal_False, sal_True ); -} - -//------------------------------------------------------------------- sal_Bool BrowseBox::GoToRow( long nRow, sal_Bool bRowColMove, sal_Bool bKeepSelection ) { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); @@ -1808,43 +1695,6 @@ void BrowseBox::SetNoSelection() //------------------------------------------------------------------- -void BrowseBox::SetSelection( const MultiSelection &rSel ) -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - DBG_ASSERT( bMultiSelection, "SetSelection only allowed with Multi-Selection-Mode" ); - - // prepare inverted areas - OSL_TRACE( "BrowseBox: %p->HideCursor", this ); - ToggleSelection(); - - // assign Selection - *uRow.pSel = rSel; - - // only highlight painted areas - pDataWin->Update(); - - // notify derived class - if ( !bSelecting ) - Select(); - else - bSelect = sal_True; - - // restore screen - ToggleSelection(); - OSL_TRACE( "BrowseBox: %p->ShowCursor", this ); - - if ( isAccessibleAlive() ) - { - commitTableEvent( - SELECTION_CHANGED, - Any(), - Any() - ); - } -} - -//------------------------------------------------------------------- - void BrowseBox::SelectAll() { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); @@ -2078,12 +1928,6 @@ long BrowseBox::FirstSelectedColumn( ) const } //------------------------------------------------------------------- -long BrowseBox::NextSelectedColumn( ) const -{ - return pColSel ? pColSel->NextSelected() : BROWSER_ENDOFSELECTION; -} - -//------------------------------------------------------------------- long BrowseBox::FirstSelectedRow( sal_Bool bInverse ) { @@ -2103,15 +1947,6 @@ long BrowseBox::NextSelectedRow() //------------------------------------------------------------------- -long BrowseBox::PrevSelectedRow() -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - - return bMultiSelection ? uRow.pSel->PrevSelected() : BROWSER_ENDOFSELECTION; -} - -//------------------------------------------------------------------- - long BrowseBox::LastSelectedRow() { DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); @@ -2140,15 +1975,6 @@ bool BrowseBox::IsColumnSelected( sal_uInt16 nColumnId ) const //------------------------------------------------------------------- -sal_Bool BrowseBox::IsAllSelected() const -{ - DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants); - - return bMultiSelection && uRow.pSel->IsAllSelected(); -} - -//------------------------------------------------------------------- - sal_Bool BrowseBox::MakeFieldVisible ( long nRow, // Zeilen-Nr des Feldes (beginnend mit 0) @@ -2592,13 +2418,6 @@ long BrowseBox::GetDataRowHeight() const //------------------------------------------------------------------- -Window& BrowseBox::GetEventWindow() const -{ - return *getDataWindow()->pEventWin; -} - -//------------------------------------------------------------------- - BrowserHeader* BrowseBox::CreateHeaderBar( BrowseBox* pParent ) { BrowserHeader* pNewBar = new BrowserHeader( pParent ); @@ -2663,13 +2482,6 @@ long BrowseBox::CalcReverseZoom(long nVal) return nVal; } -//------------------------------------------------------------------- -HeaderBar* BrowseBox::GetHeaderBar() const -{ - return getDataWindow()->pHeaderBar; -} -//------------------------------------------------------------------- - void BrowseBox::CursorMoved() { // before implementing more here, please adjust the EditBrowseBox diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 9c9796baa90b..f62a95170c6a 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -149,13 +149,6 @@ void BrowseBox::Command( const CommandEvent& rEvt ) //=================================================================== -bool BrowseBox::IsInCommandEvent() const -{ - return getDataWindow()->bInCommand; -} - -//=================================================================== - void BrowseBox::StateChanged( StateChangedType nStateChange ) { Control::StateChanged( nStateChange ); diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx index 6e80db6fcf6c..f8cbbcc2b838 100644 --- a/svtools/source/config/helpopt.cxx +++ b/svtools/source/config/helpopt.cxx @@ -62,7 +62,6 @@ static sal_Int32 nRefCount = 0; class SvtHelpOptions_Impl : public utl::ConfigItem { - IdList* pList; sal_Int32 nHelpAgentTimeoutPeriod; sal_Int32 nHelpAgentRetryLimit; sal_Bool bExtendedHelp; @@ -105,9 +104,6 @@ public: void SetWelcomeScreen( sal_Bool b ) { bWelcomeScreen = b; SetModified(); } sal_Bool IsWelcomeScreen() const { return bWelcomeScreen; } - IdList* GetPIStarterList() { return pList; } - void AddToPIStarterList( sal_Int32 nId ); - void RemoveFromPIStarterList( sal_Int32 nId ); String GetLocale() const { return aLocale; } String GetSystem() const { return aSystem; } @@ -168,7 +164,6 @@ Sequence< OUString > SvtHelpOptions_Impl::GetPropertyNames() SvtHelpOptions_Impl::SvtHelpOptions_Impl() : ConfigItem( OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Help" )) ) - , pList( 0 ) , bExtendedHelp( sal_False ) , bHelpTips( sal_True ) , bHelpAgentEnabled( sal_False ) @@ -733,19 +728,6 @@ sal_Bool SvtHelpOptions::IsWelcomeScreen() const return pImp->IsWelcomeScreen(); } -IdList* SvtHelpOptions::GetPIStarterList() -{ - return pImp->GetPIStarterList(); -} - -void SvtHelpOptions::AddToPIStarterList( sal_Int32 ) -{ -} - -void SvtHelpOptions::RemoveFromPIStarterList( sal_Int32 ) -{ -} - String SvtHelpOptions::GetLocale() const { return pImp->GetLocale(); diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index 410c430810b2..957792d85166 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -388,13 +388,12 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nI miss some values of configuration keys!\n" ); - // Copy values from list in right order to ouer internal member. + // Copy values from list in right order to our internal member. sal_Int32 nPropertyCount = seqValues.getLength(); - sal_Int32 nProperty = 0; - - for( nProperty=0; nProperty<nPropertyCount; ++nProperty ) + for(sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty ) { - DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nInvalid property value for property detected!\n" ); + if (seqValues[nProperty].hasValue()==sal_False) + continue; switch( nProperty ) { diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 6a511bdb4e4b..e8f6f9cc5b60 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -496,15 +496,12 @@ class NameTranslator_Impl : public ::svt::IContentTitleTranslation private: NameTranslationList* mpActFolder; public: - NameTranslator_Impl( void ); NameTranslator_Impl( const INetURLObject& rActualFolder ); virtual ~NameTranslator_Impl(); // IContentTitleTranslation virtual sal_Bool GetTranslation( const OUString& rOriginalName, OUString& rTranslatedName ) const; - void UpdateTranslationTable(); // reads the translation file again - void SetActualFolder( const INetURLObject& rActualFolder ); const String* GetTransTableFileName() const; // returns the name for the file, which contains the translation strings @@ -1810,11 +1807,6 @@ void SvtFileView::StateChanged( StateChangedType nStateChange ) // class NameTranslator_Impl // ----------------------------------------------------------------------- -NameTranslator_Impl::NameTranslator_Impl( void ) : - mpActFolder( NULL ) -{ -} - NameTranslator_Impl::NameTranslator_Impl( const INetURLObject& rActualFolder ) { mpActFolder = new NameTranslationList( rActualFolder ); @@ -1826,12 +1818,6 @@ NameTranslator_Impl::~NameTranslator_Impl() delete mpActFolder; } -void NameTranslator_Impl::UpdateTranslationTable() -{ - if( mpActFolder ) - mpActFolder->Update(); -} - void NameTranslator_Impl::SetActualFolder( const INetURLObject& rActualFolder ) { HashedEntry aActFolder( rActualFolder ); diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index 517f0f6b66f1..18b34b780fde 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -83,8 +83,8 @@ class IcnGridMap_Impl; // Breitenoffset Highlight-Rect bei Text #define LROFFS_TEXT 2 -#define DEFAULT_MAX_VIRT_WIDTH 200 -#define DEFAULT_MAX_VIRT_HEIGHT 200 +#define DEFAULT_MAX_VIRT_WIDTH 200 +#define DEFAULT_MAX_VIRT_HEIGHT 200 #define VIEWMODE_MASK (WB_ICON | WB_SMALLICON | WB_DETAILS) @@ -105,7 +105,7 @@ enum IcnViewFieldType // struct LocalFocus { - sal_Bool bOn; + sal_Bool bOn; Rectangle aRect; Color aPenColor; @@ -116,32 +116,47 @@ struct LocalFocus // // Entry-List // -class EntryList_Impl : public List +typedef ::std::vector< SvxIconChoiceCtrlEntry* > SvxIconChoiceCtrlEntryList_impl; + +class EntryList_Impl { private: - - using List::Replace; - + SvxIconChoiceCtrlEntryList_impl maIconChoiceCtrlEntryList; SvxIconChoiceCtrl_Impl* _pOwner; void Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ); public: - EntryList_Impl( - SvxIconChoiceCtrl_Impl*, - sal_uInt16 _nInitSize = 1024, - sal_uInt16 _nReSize = 1024 ); - EntryList_Impl( - SvxIconChoiceCtrl_Impl*, - sal_uInt16 _nBlockSize, - sal_uInt16 _nInitSize, - sal_uInt16 _nReSize ); + EntryList_Impl( SvxIconChoiceCtrl_Impl* ); ~EntryList_Impl(); - void Clear(); - void Insert( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nPos ); - SvxIconChoiceCtrlEntry* Remove( sal_uLong nPos ); - void Remove( SvxIconChoiceCtrlEntry* pEntry ); + void clear(); + + SvxIconChoiceCtrlEntry* remove( size_t nPos ); + void remove( SvxIconChoiceCtrlEntry* pEntry ); + + size_t size() + { + return maIconChoiceCtrlEntryList.size(); + } + size_t size() const + { + return maIconChoiceCtrlEntryList.size(); + } + + SvxIconChoiceCtrlEntry* operator[]( size_t nPos ) + { + return ( nPos < maIconChoiceCtrlEntryList.size() ) + ? maIconChoiceCtrlEntryList[ nPos ] + : NULL; + } + SvxIconChoiceCtrlEntry* operator[]( size_t nPos ) const + { + return ( nPos < maIconChoiceCtrlEntryList.size() ) + ? maIconChoiceCtrlEntryList[ nPos ] + : NULL; + } + void insert( size_t nPos, SvxIconChoiceCtrlEntry* pEntry ); }; @@ -155,388 +170,448 @@ class SvxIconChoiceCtrl_Impl friend class EntryList_Impl; friend class IcnGridMap_Impl; - sal_Bool bChooseWithCursor; - EntryList_Impl aEntries; - ScrollBar aVerSBar; - ScrollBar aHorSBar; - ScrollBarBox aScrBarBox; - Rectangle aCurSelectionRect; - SvPtrarr aSelectedRectList; - Timer aEditTimer; // fuer Inplace-Editieren - Timer aAutoArrangeTimer; - Timer aDocRectChangedTimer; - Timer aVisRectChangedTimer; - Timer aCallSelectHdlTimer; - Size aVirtOutputSize; - Size aImageSize; - Size aDefaultTextSize; - Size aOutputSize; // Pixel - Point aDDLastEntryPos; - Point aDDLastRectPos; - Point aDDPaintOffs; - Point aDDStartPos; + sal_Bool bChooseWithCursor; + EntryList_Impl aEntries; + ScrollBar aVerSBar; + ScrollBar aHorSBar; + ScrollBarBox aScrBarBox; + Rectangle aCurSelectionRect; + SvPtrarr aSelectedRectList; + Timer aEditTimer; // fuer Inplace-Editieren + Timer aAutoArrangeTimer; + Timer aDocRectChangedTimer; + Timer aVisRectChangedTimer; + Timer aCallSelectHdlTimer; + Size aVirtOutputSize; + Size aImageSize; + Size aDefaultTextSize; + Size aOutputSize; // Pixel + Point aDDLastEntryPos; + Point aDDLastRectPos; + Point aDDPaintOffs; + Point aDDStartPos; SvtIconChoiceCtrl* pView; - IcnCursor_Impl* pImpCursor; - IcnGridMap_Impl* pGridMap; - long nMaxVirtWidth; // max. Breite aVirtOutputSize bei ALIGN_TOP - long nMaxVirtHeight; // max. Hoehe aVirtOutputSize bei ALIGN_LEFT - List* pZOrderList; - SvPtrarr* pColumns; - IcnViewEdit_Impl* pEdit; - WinBits nWinBits; - long nMaxBoundHeight; // Hoehe des hoechsten BoundRects - sal_uInt16 nFlags; - sal_uInt16 nCurTextDrawFlags; - sal_uLong nUserEventAdjustScrBars; - sal_uLong nUserEventShowCursor; + IcnCursor_Impl* pImpCursor; + IcnGridMap_Impl* pGridMap; + long nMaxVirtWidth; // max. Breite aVirtOutputSize bei ALIGN_TOP + long nMaxVirtHeight; // max. Hoehe aVirtOutputSize bei ALIGN_LEFT + SvxIconChoiceCtrlEntryList_impl* pZOrderList; + SvPtrarr* pColumns; + IcnViewEdit_Impl* pEdit; + WinBits nWinBits; + long nMaxBoundHeight; // Hoehe des hoechsten BoundRects + sal_uInt16 nFlags; + sal_uInt16 nCurTextDrawFlags; + sal_uLong nUserEventAdjustScrBars; + sal_uLong nUserEventShowCursor; SvxIconChoiceCtrlEntry* pCurHighlightFrame; - sal_Bool bHighlightFramePressed; + sal_Bool bHighlightFramePressed; SvxIconChoiceCtrlEntry* pHead; // Eintrag oben links SvxIconChoiceCtrlEntry* pCursor; SvxIconChoiceCtrlEntry* pPrevDropTarget; SvxIconChoiceCtrlEntry* pHdlEntry; SvxIconChoiceCtrlEntry* pDDRefEntry; - VirtualDevice* pDDDev; - VirtualDevice* pDDBufDev; - VirtualDevice* pDDTempDev; - VirtualDevice* pEntryPaintDev; + VirtualDevice* pDDDev; + VirtualDevice* pDDBufDev; + VirtualDevice* pDDTempDev; + VirtualDevice* pEntryPaintDev; SvxIconChoiceCtrlEntry* pAnchor; // fuer Selektion - LocalFocus aFocus; // Data for focusrect + LocalFocus aFocus; // Data for focusrect ::svt::AccessibleFactoryAccess aAccFactory; - List* pDraggedSelection; + List* pDraggedSelection; SvxIconChoiceCtrlEntry* pCurEditedEntry; SvxIconChoiceCtrlTextMode eTextMode; - SelectionMode eSelectionMode; - sal_uLong nSelectionCount; + SelectionMode eSelectionMode; + sal_uLong nSelectionCount; SvxIconChoiceCtrlPositionMode ePositionMode; - sal_Bool bBoundRectsDirty; - sal_Bool bUpdateMode; - sal_Bool bEntryEditingEnabled; - sal_Bool bInDragDrop; - - void ShowCursor( sal_Bool bShow ); - - void ImpArrange( sal_Bool bKeepPredecessors = sal_False ); - void AdjustVirtSize( const Rectangle& ); - void ResetVirtSize(); - void CheckScrollBars(); - - DECL_LINK( ScrollUpDownHdl, ScrollBar * ); - DECL_LINK( ScrollLeftRightHdl, ScrollBar * ); - DECL_LINK( EditTimeoutHdl, Timer* ); - DECL_LINK( UserEventHdl, void* ); - DECL_LINK( EndScrollHdl, void* ); - DECL_LINK( AutoArrangeHdl, void* ); - DECL_LINK( DocRectChangedHdl, void* ); - DECL_LINK( VisRectChangedHdl, void* ); - DECL_LINK( CallSelectHdlHdl, void* ); - - void AdjustScrollBars( sal_Bool bVirtSizeGrowedOnly = sal_False); - void PositionScrollBars( long nRealWidth, long nRealHeight ); - long GetScrollBarPageSize( long nVisibleRange ) const { return ((nVisibleRange*75)/100); } - long GetScrollBarLineSize() const { return nMaxBoundHeight / 2; } + sal_Bool bBoundRectsDirty; + sal_Bool bUpdateMode; + sal_Bool bEntryEditingEnabled; + sal_Bool bInDragDrop; + + void ShowCursor( sal_Bool bShow ); + + void ImpArrange( sal_Bool bKeepPredecessors = sal_False ); + void AdjustVirtSize( const Rectangle& ); + void ResetVirtSize(); + void CheckScrollBars(); + + DECL_LINK( ScrollUpDownHdl, ScrollBar * ); + DECL_LINK( ScrollLeftRightHdl, ScrollBar * ); + DECL_LINK( EditTimeoutHdl, Timer* ); + DECL_LINK( UserEventHdl, void* ); + DECL_LINK( EndScrollHdl, void* ); + DECL_LINK( AutoArrangeHdl, void* ); + DECL_LINK( DocRectChangedHdl, void* ); + DECL_LINK( VisRectChangedHdl, void* ); + DECL_LINK( CallSelectHdlHdl, void* ); + + void AdjustScrollBars( sal_Bool bVirtSizeGrowedOnly = sal_False); + void PositionScrollBars( long nRealWidth, long nRealHeight ); + long GetScrollBarPageSize( long nVisibleRange ) const + { + return ((nVisibleRange*75)/100); + } + long GetScrollBarLineSize() const + { + return nMaxBoundHeight / 2; + } sal_Bool HandleScrollCommand( const CommandEvent& rCmd ); - void ToDocPos( Point& rPosPixel ) { rPosPixel -= pView->GetMapMode().GetOrigin(); } - void InitScrollBarBox(); + void ToDocPos( Point& rPosPixel ) + { + rPosPixel -= pView->GetMapMode().GetOrigin(); + } + void InitScrollBarBox(); SvxIconChoiceCtrlEntry* FindNewCursor(); - void ToggleSelection( SvxIconChoiceCtrlEntry* ); - void DeselectAllBut( SvxIconChoiceCtrlEntry*, sal_Bool bPaintSync=sal_False ); - void Center( SvxIconChoiceCtrlEntry* pEntry ) const; - void StopEditTimer() { aEditTimer.Stop(); } - void StartEditTimer() { aEditTimer.Start(); } - void ImpHideDDIcon(); - void CallSelectHandler( SvxIconChoiceCtrlEntry* ); - void SelectRect( - SvxIconChoiceCtrlEntry* pEntry1, - SvxIconChoiceCtrlEntry* pEntry2, - sal_Bool bAdd = sal_True, - SvPtrarr* pOtherRects = 0 ); - - void SelectRange( - SvxIconChoiceCtrlEntry* pStart, - SvxIconChoiceCtrlEntry* pEnd, - sal_Bool bAdd = sal_True ); - - void AddSelectedRect( const Rectangle& ); - void AddSelectedRect( - SvxIconChoiceCtrlEntry* pEntry1, - SvxIconChoiceCtrlEntry* pEntry2 ); - - void ClearSelectedRectList(); - void ClearColumnList(); - Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const; - - void ClipAtVirtOutRect( Rectangle& rRect ) const; - void AdjustAtGrid( const SvPtrarr& rRow, SvxIconChoiceCtrlEntry* pStart=0 ); - Point AdjustAtGrid( - const Rectangle& rCenterRect, // "Schwerpunkt" des Objekts (typ. Bmp-Rect) - const Rectangle& rBoundRect ) const; + void ToggleSelection( SvxIconChoiceCtrlEntry* ); + void DeselectAllBut( SvxIconChoiceCtrlEntry*, sal_Bool bPaintSync=sal_False ); + void Center( SvxIconChoiceCtrlEntry* pEntry ) const; + void StopEditTimer() { aEditTimer.Stop(); } + void StartEditTimer() { aEditTimer.Start(); } + void ImpHideDDIcon(); + void CallSelectHandler( SvxIconChoiceCtrlEntry* ); + void SelectRect( + SvxIconChoiceCtrlEntry* pEntry1, + SvxIconChoiceCtrlEntry* pEntry2, + sal_Bool bAdd = sal_True, + SvPtrarr* pOtherRects = 0 + ); + + void SelectRange( + SvxIconChoiceCtrlEntry* pStart, + SvxIconChoiceCtrlEntry* pEnd, + sal_Bool bAdd = sal_True + ); + + void AddSelectedRect( const Rectangle& ); + void AddSelectedRect( + SvxIconChoiceCtrlEntry* pEntry1, + SvxIconChoiceCtrlEntry* pEntry2 + ); + + void ClearSelectedRectList(); + void ClearColumnList(); + Rectangle CalcMaxTextRect( const SvxIconChoiceCtrlEntry* pEntry ) const; + + void ClipAtVirtOutRect( Rectangle& rRect ) const; + void AdjustAtGrid( const SvPtrarr& rRow, SvxIconChoiceCtrlEntry* pStart=0 ); + Point AdjustAtGrid( + const Rectangle& rCenterRect, // "Schwerpunkt" des Objekts (typ. Bmp-Rect) + const Rectangle& rBoundRect + ) const; sal_uLong GetPredecessorGrid( const Point& rDocPos) const; - void InitPredecessors(); - void ClearPredecessors(); + void InitPredecessors(); + void ClearPredecessors(); sal_Bool CheckVerScrollBar(); sal_Bool CheckHorScrollBar(); - void CancelUserEvents(); - void EntrySelected( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bSelect, - sal_Bool bSyncPaint ); - void SaveSelection( List** ); - void RepaintEntries( sal_uInt16 nEntryFlagsMask ); - void SetListPositions(); - void SetDefaultTextSize(); - sal_Bool IsAutoArrange() const { - return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoArrange); } - sal_Bool IsAutoAdjust() const { - return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoAdjust); } - void DocRectChanged() { aDocRectChangedTimer.Start(); } - void VisRectChanged() { aVisRectChangedTimer.Start(); } - void SetOrigin( const Point&, sal_Bool bDoNotUpdateWallpaper = sal_False ); - - DECL_LINK( TextEditEndedHdl, IcnViewEdit_Impl* ); - - void ShowFocus ( Rectangle& rRect ); - void HideFocus (); - void DrawFocusRect ( OutputDevice* pOut ); + void CancelUserEvents(); + void EntrySelected( + SvxIconChoiceCtrlEntry* pEntry, + sal_Bool bSelect, + sal_Bool bSyncPaint + ); + void SaveSelection( List** ); + void RepaintEntries( sal_uInt16 nEntryFlagsMask ); + void SetListPositions(); + void SetDefaultTextSize(); + sal_Bool IsAutoArrange() const + { + return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoArrange); + } + sal_Bool IsAutoAdjust() const + { + return (sal_Bool)(ePositionMode == IcnViewPositionModeAutoAdjust); + } + void DocRectChanged() { aDocRectChangedTimer.Start(); } + void VisRectChanged() { aVisRectChangedTimer.Start(); } + void SetOrigin( const Point&, sal_Bool bDoNotUpdateWallpaper = sal_False ); + + DECL_LINK( TextEditEndedHdl, IcnViewEdit_Impl* ); + + void ShowFocus ( Rectangle& rRect ); + void HideFocus (); + void DrawFocusRect ( OutputDevice* pOut ); sal_Bool IsMnemonicChar( sal_Unicode cChar, sal_uLong& rPos ) const; public: - long nGridDX, - nGridDY; - long nHorSBarHeight, - nVerSBarWidth; + long nGridDX; + long nGridDY; + long nHorSBarHeight; + long nVerSBarWidth; - SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle ); - ~SvxIconChoiceCtrl_Impl(); + SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pView, WinBits nWinStyle ); + ~SvxIconChoiceCtrl_Impl(); sal_Bool SetChoiceWithCursor ( sal_Bool bDo = sal_True ) { sal_Bool bOld=bChooseWithCursor; bChooseWithCursor = bDo; return bOld; } - void Clear( sal_Bool bInCtor = sal_False ); - void SetStyle( WinBits nWinStyle ); - WinBits GetStyle() const { return nWinBits; } - void InsertEntry( SvxIconChoiceCtrlEntry*, sal_uLong nPos, const Point* pPos=0 ); - void CreateAutoMnemonics( MnemonicGenerator* _pGenerator = NULL ); - void RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ); - void FontModified(); - void SelectAll( sal_Bool bSelect = sal_True, sal_Bool bPaint = sal_True ); - void SelectEntry( - SvxIconChoiceCtrlEntry*, - sal_Bool bSelect, - sal_Bool bCallHdl = sal_True, - sal_Bool bAddToSelection = sal_False, - sal_Bool bSyncPaint = sal_False ); - void Paint( const Rectangle& rRect ); + void Clear( sal_Bool bInCtor = sal_False ); + void SetStyle( WinBits nWinStyle ); + WinBits GetStyle() const { return nWinBits; } + void InsertEntry( SvxIconChoiceCtrlEntry*, size_t nPos, const Point* pPos=0 ); + void CreateAutoMnemonics( MnemonicGenerator* _pGenerator = NULL ); + void RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ); + void FontModified(); + void SelectAll( sal_Bool bSelect = sal_True, sal_Bool bPaint = sal_True ); + void SelectEntry( + SvxIconChoiceCtrlEntry*, + sal_Bool bSelect, + sal_Bool bCallHdl = sal_True, + sal_Bool bAddToSelection = sal_False, + sal_Bool bSyncPaint = sal_False + ); + void Paint( const Rectangle& rRect ); sal_Bool MouseButtonDown( const MouseEvent& ); sal_Bool MouseButtonUp( const MouseEvent& ); sal_Bool MouseMove( const MouseEvent&); sal_Bool RequestHelp( const HelpEvent& rHEvt ); - void SetCursor_Impl( - SvxIconChoiceCtrlEntry* pOldCursor, - SvxIconChoiceCtrlEntry* pNewCursor, - sal_Bool bMod1, - sal_Bool bShift, - sal_Bool bPaintSync = sal_False); + void SetCursor_Impl( + SvxIconChoiceCtrlEntry* pOldCursor, + SvxIconChoiceCtrlEntry* pNewCursor, + sal_Bool bMod1, + sal_Bool bShift, + sal_Bool bPaintSync = sal_False + ); sal_Bool KeyInput( const KeyEvent& ); - void Resize(); - void GetFocus(); - void LoseFocus(); - void SetUpdateMode( sal_Bool bUpdate ); + void Resize(); + void GetFocus(); + void LoseFocus(); + void SetUpdateMode( sal_Bool bUpdate ); sal_Bool GetUpdateMode() const { return bUpdateMode; } - void PaintEntry( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bIsBackgroundPainted=sal_False ); - void PaintEntry( - SvxIconChoiceCtrlEntry*, - const Point&, - OutputDevice* pOut = 0, - sal_Bool bIsBackgroundPainted = sal_False); - void PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* ); - - void SetEntryPos( - SvxIconChoiceCtrlEntry* pEntry, - const Point& rPos, - sal_Bool bAdjustRow = sal_False, - sal_Bool bCheckScrollBars = sal_False, - sal_Bool bKeepGridMap = sal_False ); - - void InvalidateEntry( SvxIconChoiceCtrlEntry* ); + void PaintEntry( + SvxIconChoiceCtrlEntry* pEntry, + sal_Bool bIsBackgroundPainted=sal_False + ); + void PaintEntry( + SvxIconChoiceCtrlEntry*, + const Point&, + OutputDevice* pOut = 0, + sal_Bool bIsBackgroundPainted = sal_False + ); + void PaintEntryVirtOutDev( SvxIconChoiceCtrlEntry* ); + + void SetEntryPos( + SvxIconChoiceCtrlEntry* pEntry, + const Point& rPos, + sal_Bool bAdjustRow = sal_False, + sal_Bool bCheckScrollBars = sal_False, + sal_Bool bKeepGridMap = sal_False + ); + + void InvalidateEntry( SvxIconChoiceCtrlEntry* ); IcnViewFieldType GetItem( SvxIconChoiceCtrlEntry*, const Point& rAbsPos ); - void SetNoSelection(); + void SetNoSelection(); SvxIconChoiceCtrlEntry* GetCurEntry() const { return pCursor; } - void SetCursor( - SvxIconChoiceCtrlEntry*, - // sal_True == bei Single-Selection die Sel. mitfuehren - sal_Bool bSyncSingleSelection = sal_True, - sal_Bool bShowFocusAsync = sal_False ); + void SetCursor( + SvxIconChoiceCtrlEntry*, + // sal_True == bei Single-Selection die Sel. mitfuehren + sal_Bool bSyncSingleSelection = sal_True, + sal_Bool bShowFocusAsync = sal_False + ); SvxIconChoiceCtrlEntry* GetEntry( const Point& rDocPos, sal_Bool bHit = sal_False ); SvxIconChoiceCtrlEntry* GetNextEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry ); - SvxIconChoiceCtrlEntry* GetPrevEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry ); - - Point GetEntryPos( SvxIconChoiceCtrlEntry* ); - void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bBound = sal_True ); - - void Arrange(sal_Bool bKeepPredecessors = sal_False, long nSetMaxVirtWidth =0, long nSetMaxVirtHeight =0 ); - - Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* ); - Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = 0 ); - Rectangle CalcTextRect( - SvxIconChoiceCtrlEntry*, - const Point* pPos = 0, - sal_Bool bForInplaceEdit = sal_False, - const String* pStr = 0 ); - - long CalcBoundingWidth( SvxIconChoiceCtrlEntry* ) const; - long CalcBoundingHeight( SvxIconChoiceCtrlEntry* ) const; - Size CalcBoundingSize( SvxIconChoiceCtrlEntry* ) const; - void FindBoundingRect( SvxIconChoiceCtrlEntry* pEntry ); - void SetBoundingRect_Impl( - SvxIconChoiceCtrlEntry* pEntry, - const Point& rPos, - const Size& rBoundingSize ); + + Point GetEntryPos( SvxIconChoiceCtrlEntry* ); + void MakeEntryVisible( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bBound = sal_True ); + + void Arrange( + sal_Bool bKeepPredecessors = sal_False, + long nSetMaxVirtWidth =0, + long nSetMaxVirtHeight =0 + ); + + Rectangle CalcFocusRect( SvxIconChoiceCtrlEntry* ); + Rectangle CalcBmpRect( SvxIconChoiceCtrlEntry*, const Point* pPos = 0 ); + Rectangle CalcTextRect( + SvxIconChoiceCtrlEntry*, + const Point* pPos = 0, + sal_Bool bForInplaceEdit = sal_False, + const String* pStr = 0 + ); + + long CalcBoundingWidth( SvxIconChoiceCtrlEntry* ) const; + long CalcBoundingHeight( SvxIconChoiceCtrlEntry* ) const; + Size CalcBoundingSize( SvxIconChoiceCtrlEntry* ) const; + void FindBoundingRect( SvxIconChoiceCtrlEntry* pEntry ); + void SetBoundingRect_Impl( + SvxIconChoiceCtrlEntry* pEntry, + const Point& rPos, + const Size& rBoundingSize + ); // berechnet alle BoundRects neu - void RecalcAllBoundingRects(); + void RecalcAllBoundingRects(); // berechnet alle ungueltigen BoundRects neu - void RecalcAllBoundingRectsSmart(); - const Rectangle& GetEntryBoundRect( SvxIconChoiceCtrlEntry* ); - void InvalidateBoundingRect( SvxIconChoiceCtrlEntry* ); - void InvalidateBoundingRect( Rectangle& rRect ) { rRect.Right() = LONG_MAX; bBoundRectsDirty = sal_True; } + void RecalcAllBoundingRectsSmart(); + const Rectangle& GetEntryBoundRect( SvxIconChoiceCtrlEntry* ); + void InvalidateBoundingRect( SvxIconChoiceCtrlEntry* ); + void InvalidateBoundingRect( Rectangle& rRect ) { rRect.Right() = LONG_MAX; bBoundRectsDirty = sal_True; } sal_Bool IsBoundingRectValid( const Rectangle& rRect ) const { return (sal_Bool)( rRect.Right() != LONG_MAX ); } - void PaintEmphasis( - const Rectangle& rRect1, - const Rectangle& rRect2, - sal_Bool bSelected, - sal_Bool bDropTarget, - sal_Bool bCursored, - OutputDevice* pOut, - sal_Bool bIsBackgroundPainted = sal_False); - - void PaintItem( - const Rectangle& rRect, - IcnViewFieldType eItem, - SvxIconChoiceCtrlEntry* pEntry, - sal_uInt16 nPaintFlags, - OutputDevice* pOut, - const String* pStr = 0, - ::vcl::ControlLayoutData* _pLayoutData = NULL ); + void PaintEmphasis( + const Rectangle& rRect1, + const Rectangle& rRect2, + sal_Bool bSelected, + sal_Bool bDropTarget, + sal_Bool bCursored, + OutputDevice* pOut, + sal_Bool bIsBackgroundPainted = sal_False + ); + + void PaintItem( + const Rectangle& rRect, + IcnViewFieldType eItem, + SvxIconChoiceCtrlEntry* pEntry, + sal_uInt16 nPaintFlags, + OutputDevice* pOut, + const String* pStr = 0, + ::vcl::ControlLayoutData* _pLayoutData = NULL + ); // berechnet alle BoundingRects neu, wenn bMustRecalcBoundingRects == sal_True - void CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); } + void CheckBoundingRects() { if (bBoundRectsDirty) RecalcAllBoundingRectsSmart(); } // berechnet alle invalidierten BoundingRects neu - void UpdateBoundingRects(); - void ShowTargetEmphasis( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bShow ); - void PrepareCommandEvent( const CommandEvent& ); - void Command( const CommandEvent& rCEvt ); - void ToTop( SvxIconChoiceCtrlEntry* ); + void UpdateBoundingRects(); + void ShowTargetEmphasis( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bShow ); + void PrepareCommandEvent( const CommandEvent& ); + void Command( const CommandEvent& rCEvt ); + void ToTop( SvxIconChoiceCtrlEntry* ); sal_uLong GetSelectionCount() const; - void SetGrid( const Size& ); - Size GetMinGrid() const; + void SetGrid( const Size& ); + Size GetMinGrid() const; sal_uLong GetGridCount( const Size& rSize, sal_Bool bCheckScrBars, sal_Bool bSmartScrBar ) const; - void Scroll( long nDeltaX, long nDeltaY, sal_Bool bScrollBar = sal_False ); - const Size& GetItemSize( SvxIconChoiceCtrlEntry*, IcnViewFieldType ) const; + void Scroll( long nDeltaX, long nDeltaY, sal_Bool bScrollBar = sal_False ); + const Size& GetItemSize( SvxIconChoiceCtrlEntry*, IcnViewFieldType ) const; - void HideDDIcon(); - void ShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, const Point& rPos ); - void HideShowDDIcon( - SvxIconChoiceCtrlEntry* pRefEntry, - const Point& rPos ); + void HideDDIcon(); + void ShowDDIcon( SvxIconChoiceCtrlEntry* pRefEntry, const Point& rPos ); + void HideShowDDIcon( + SvxIconChoiceCtrlEntry* pRefEntry, + const Point& rPos + ); sal_Bool IsOver( - SvPtrarr* pSelectedRectList, - const Rectangle& rEntryBoundRect ) const; - - void SelectRect( - const Rectangle&, - sal_Bool bAdd = sal_True, - SvPtrarr* pOtherRects = 0 ); - - void CalcScrollOffsets( - const Point& rRefPosPixel, - long& rX, - long& rY, - sal_Bool bDragDrop = sal_False, - sal_uInt16 nBorderWidth = 10 ); + SvPtrarr* pSelectedRectList, + const Rectangle& rEntryBoundRect + ) const; + + void SelectRect( + const Rectangle&, + sal_Bool bAdd = sal_True, + SvPtrarr* pOtherRects = 0 + ); + + void CalcScrollOffsets( + const Point& rRefPosPixel, + long& rX, + long& rY, + sal_Bool bDragDrop = sal_False, + sal_uInt16 nBorderWidth = 10 + ); sal_Bool IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos ); - void MakeVisible( - const Rectangle& rDocPos, - sal_Bool bInScrollBarEvent=sal_False, - sal_Bool bCallRectChangedHdl = sal_True ); - - void AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart = 0 ); - void SetEntryTextMode( SvxIconChoiceCtrlTextMode, SvxIconChoiceCtrlEntry* pEntry = 0 ); + void MakeVisible( + const Rectangle& rDocPos, + sal_Bool bInScrollBarEvent=sal_False, + sal_Bool bCallRectChangedHdl = sal_True + ); + + void AdjustEntryAtGrid( SvxIconChoiceCtrlEntry* pStart = 0 ); + void SetEntryTextMode( + SvxIconChoiceCtrlTextMode, + SvxIconChoiceCtrlEntry* pEntry = 0 + ); SvxIconChoiceCtrlTextMode GetTextMode( const SvxIconChoiceCtrlEntry* pEntry = 0 ) const; - void ShowEntryFocusRect( const SvxIconChoiceCtrlEntry* pEntry ); - void EnableEntryEditing( sal_Bool bEnable ) { bEntryEditingEnabled = bEnable; } + void ShowEntryFocusRect( const SvxIconChoiceCtrlEntry* pEntry ); + void EnableEntryEditing( sal_Bool bEnable ) { bEntryEditingEnabled = bEnable; } sal_Bool IsEntryEditingEnabled() const { return bEntryEditingEnabled; } sal_Bool IsEntryEditing() const { return (sal_Bool)(pCurEditedEntry!=0); } - void EditEntry( SvxIconChoiceCtrlEntry* pEntry ); - void StopEntryEditing( sal_Bool bCancel ); - void LockEntryPos( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bLock ); - sal_uLong GetEntryCount() const { return aEntries.Count(); } - SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const { return (SvxIconChoiceCtrlEntry*)aEntries.GetObject(nPos); } + void EditEntry( SvxIconChoiceCtrlEntry* pEntry ); + void StopEntryEditing( sal_Bool bCancel ); + void LockEntryPos( SvxIconChoiceCtrlEntry* pEntry, sal_Bool bLock ); + size_t GetEntryCount() const { return aEntries.size(); } + SvxIconChoiceCtrlEntry* GetEntry( size_t nPos ) + { + return aEntries[ nPos ]; + } + SvxIconChoiceCtrlEntry* GetEntry( size_t nPos ) const + { + return aEntries[ nPos ]; + } SvxIconChoiceCtrlEntry* GetFirstSelectedEntry( sal_uLong& ) const; SvxIconChoiceCtrlEntry* GetNextSelectedEntry( sal_uLong& ) const; SvxIconChoiceCtrlEntry* GetHdlEntry() const { return pHdlEntry; } - void SetHdlEntry( SvxIconChoiceCtrlEntry* pEntry ) { pHdlEntry = pEntry; } + void SetHdlEntry( SvxIconChoiceCtrlEntry* pEntry ) { pHdlEntry = pEntry; } SvxIconChoiceCtrlTextMode GetEntryTextModeSmart( const SvxIconChoiceCtrlEntry* pEntry ) const; - void SetSelectionMode( SelectionMode eMode ) { eSelectionMode=eMode; } - SelectionMode GetSelectionMode() const { return eSelectionMode; } + void SetSelectionMode( SelectionMode eMode ) { eSelectionMode=eMode; } + SelectionMode GetSelectionMode() const { return eSelectionMode; } sal_Bool AreEntriesMoved() const { return (sal_Bool)((nFlags & F_MOVED_ENTRIES)!=0); } - void SetEntriesMoved( sal_Bool bMoved ) - { - if( bMoved ) nFlags |= F_MOVED_ENTRIES; - else nFlags &= ~(F_MOVED_ENTRIES); - } + void SetEntriesMoved( sal_Bool bMoved ) + { + if( bMoved ) + nFlags |= F_MOVED_ENTRIES; + else + nFlags &= ~(F_MOVED_ENTRIES); + } sal_uLong GetEntryListPos( SvxIconChoiceCtrlEntry* ) const; - void SetEntryListPos( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nNewPos ); - void SetEntryImageSize( const Size& rSize ) { aImageSize = rSize; } - void SetEntryFlags( SvxIconChoiceCtrlEntry* pEntry, sal_uInt16 nFlags ); + void SetEntryListPos( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nNewPos ); + void SetEntryImageSize( const Size& rSize ) { aImageSize = rSize; } + void SetEntryFlags( SvxIconChoiceCtrlEntry* pEntry, sal_uInt16 nFlags ); SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, sal_Bool bRight ); SvxIconChoiceCtrlEntry* GoUpDown( SvxIconChoiceCtrlEntry*, sal_Bool bDown ); - void InitSettings(); - Rectangle GetOutputRect() const; + void InitSettings(); + Rectangle GetOutputRect() const; sal_Bool ArePredecessorsSet() const { return (sal_Bool)(pHead != 0); } SvxIconChoiceCtrlEntry* GetPredecessorHead() const { return pHead; } - void SetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry* pPredecessor); + void SetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry* pPredecessor); sal_Bool GetEntryPredecessor(SvxIconChoiceCtrlEntry* pEntry,SvxIconChoiceCtrlEntry** ppPredecessor); // liefert gueltige Ergebnisse nur im AutoArrange-Modus! SvxIconChoiceCtrlEntry* FindEntryPredecessor( SvxIconChoiceCtrlEntry* pEntry, const Point& ); - void SetPositionMode( SvxIconChoiceCtrlPositionMode ); + void SetPositionMode( SvxIconChoiceCtrlPositionMode ); SvxIconChoiceCtrlPositionMode GetPositionMode() const { return ePositionMode;} - void Flush(); - void SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo& ); + void Flush(); + void SetColumn( sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo& ); const SvxIconChoiceCtrlColumnInfo* GetColumn( sal_uInt16 nIndex ) const; const SvxIconChoiceCtrlColumnInfo* GetItemColumn( sal_uInt16 nSubItem, long& rLeft ) const; - Rectangle GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); } - Rectangle GetVisibleRect() const { return GetOutputRect(); } - - void SetEntryHighlightFrame( SvxIconChoiceCtrlEntry* pEntry,sal_Bool bKeepHighlightFlags=sal_False ); - void HideEntryHighlightFrame(); - void DrawHighlightFrame( OutputDevice* pOut, - const Rectangle& rBmpRect, sal_Bool bHide ); - void StopSelectTimer() { aCallSelectHdlTimer.Stop(); } - void Tracking( const TrackingEvent& rTEvt ); - Point GetPopupMenuPosPixel() const; + Rectangle GetDocumentRect() const { return Rectangle( Point(), aVirtOutputSize ); } + Rectangle GetVisibleRect() const { return GetOutputRect(); } + + void SetEntryHighlightFrame( + SvxIconChoiceCtrlEntry* pEntry, + sal_Bool bKeepHighlightFlags=sal_False + ); + void HideEntryHighlightFrame(); + void DrawHighlightFrame( + OutputDevice* pOut, + const Rectangle& rBmpRect, + sal_Bool bHide + ); + void StopSelectTimer() { aCallSelectHdlTimer.Stop(); } + void Tracking( const TrackingEvent& rTEvt ); + Point GetPopupMenuPosPixel() const; sal_Bool HandleShortCutKey( const KeyEvent& rKeyEvent ); - void CallEventListeners( sal_uLong nEvent, void* pData = NULL ); + void CallEventListeners( sal_uLong nEvent, void* pData = NULL ); - inline ::svt::IAccessibleFactory& - GetAccessibleFactory() { return aAccFactory.getFactory(); } + inline ::svt::IAccessibleFactory& GetAccessibleFactory() + { + return aAccFactory.getFactory(); + } }; // ---------------------------------------------------------------------------------------------- @@ -544,28 +619,40 @@ public: class IcnCursor_Impl { SvxIconChoiceCtrl_Impl* pView; - SvPtrarr* pColumns; - SvPtrarr* pRows; - long nCols; - long nRows; - short nDeltaWidth; - short nDeltaHeight; + SvPtrarr* pColumns; + SvPtrarr* pRows; + long nCols; + long nRows; + short nDeltaWidth; + short nDeltaHeight; SvxIconChoiceCtrlEntry* pCurEntry; - void SetDeltas(); - void ImplCreate(); - void Create() { if( !pColumns ) ImplCreate(); } - - sal_uInt16 GetSortListPos( SvPtrarr* pList, long nValue, int bVertical); - SvxIconChoiceCtrlEntry* SearchCol(sal_uInt16 nCol,sal_uInt16 nTop,sal_uInt16 nBottom,sal_uInt16 nPref, - sal_Bool bDown, sal_Bool bSimple ); - - SvxIconChoiceCtrlEntry* SearchRow(sal_uInt16 nRow,sal_uInt16 nRight,sal_uInt16 nLeft,sal_uInt16 nPref, - sal_Bool bRight, sal_Bool bSimple ); + void SetDeltas(); + void ImplCreate(); + void Create() { if( !pColumns ) ImplCreate(); } + + sal_uInt16 GetSortListPos( SvPtrarr* pList, long nValue, int bVertical); + SvxIconChoiceCtrlEntry* SearchCol( + sal_uInt16 nCol, + sal_uInt16 nTop, + sal_uInt16 nBottom, + sal_uInt16 nPref, + sal_Bool bDown, + sal_Bool bSimple + ); + + SvxIconChoiceCtrlEntry* SearchRow( + sal_uInt16 nRow, + sal_uInt16 nRight, + sal_uInt16 nLeft, + sal_uInt16 nPref, + sal_Bool bRight, + sal_Bool bSimple + ); public: - IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner ); - ~IcnCursor_Impl(); - void Clear(); + IcnCursor_Impl( SvxIconChoiceCtrl_Impl* pOwner ); + ~IcnCursor_Impl(); + void Clear(); // fuer Cursortravelling usw. SvxIconChoiceCtrlEntry* GoLeftRight( SvxIconChoiceCtrlEntry*, sal_Bool bRight ); @@ -576,8 +663,8 @@ public: // 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, SvxIconChoiceCtrlEntry* pRow=0); - static void DestroyGridAdjustData( SvPtrarr& rLists ); + void CreateGridAjustData( SvPtrarr& pLists, SvxIconChoiceCtrlEntry* pRow=0); + static void DestroyGridAdjustData( SvPtrarr& rLists ); }; // ---------------------------------------------------------------------------------------------- @@ -588,48 +675,46 @@ typedef sal_uLong GridId; class IcnGridMap_Impl { - Rectangle _aLastOccupiedGrid; + Rectangle _aLastOccupiedGrid; SvxIconChoiceCtrl_Impl* _pView; - sal_Bool* _pGridMap; - sal_uInt16 _nGridCols, _nGridRows; + sal_Bool* _pGridMap; + sal_uInt16 _nGridCols, _nGridRows; - void Expand(); - void Create_Impl(); - void Create() { if(!_pGridMap) Create_Impl(); } + void Expand(); + void Create_Impl(); + void Create() { if(!_pGridMap) Create_Impl(); } - void GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const; + void GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const; public: - IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView); - ~IcnGridMap_Impl(); - - void Clear(); - - GridId GetGrid( const Point& rDocPos, sal_Bool* pbClipped = 0 ); - GridId GetGrid( sal_uInt16 nGridX, sal_uInt16 nGridY ); - GridId GetUnoccupiedGrid( sal_Bool bOccupyFound=sal_True ); - - void OccupyGrids( const Rectangle&, sal_Bool bOccupy = sal_True ); - void OccupyGrids( const SvxIconChoiceCtrlEntry*, sal_Bool bOccupy = sal_True ); - void OccupyGrid( GridId nId, sal_Bool bOccupy = sal_True ) - { - DBG_ASSERT(!_pGridMap || nId<(sal_uLong)(_nGridCols*_nGridRows),"OccupyGrid: Bad GridId"); - if(_pGridMap && nId < (sal_uLong)(_nGridCols *_nGridRows) ) - _pGridMap[ nId ] = bOccupy; - } - - Rectangle GetGridRect( GridId ); - void GetGridCoord( GridId, sal_uInt16& rGridX, sal_uInt16& rGridY ); - static sal_uLong GetGridCount( const Size& rSizePixel, sal_uInt16 nGridWidth, sal_uInt16 nGridHeight ); - - void OutputSizeChanged(); + IcnGridMap_Impl(SvxIconChoiceCtrl_Impl* pView); + ~IcnGridMap_Impl(); + + void Clear(); + + GridId GetGrid( const Point& rDocPos, sal_Bool* pbClipped = 0 ); + GridId GetGrid( sal_uInt16 nGridX, sal_uInt16 nGridY ); + GridId GetUnoccupiedGrid( sal_Bool bOccupyFound=sal_True ); + + void OccupyGrids( const SvxIconChoiceCtrlEntry*, sal_Bool bOccupy = sal_True ); + void OccupyGrid( GridId nId, sal_Bool bOccupy = sal_True ) + { + DBG_ASSERT(!_pGridMap || nId<(sal_uLong)(_nGridCols*_nGridRows),"OccupyGrid: Bad GridId"); + if(_pGridMap && nId < (sal_uLong)(_nGridCols *_nGridRows) ) + _pGridMap[ nId ] = bOccupy; + } + + Rectangle GetGridRect( GridId ); + void GetGridCoord( GridId, sal_uInt16& rGridX, sal_uInt16& rGridY ); + static sal_uLong GetGridCount( + const Size& rSizePixel, + sal_uInt16 nGridWidth, + sal_uInt16 nGridHeight + ); + + void OutputSizeChanged(); }; - - - - #endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 640f6c5ae923..8602fa4cacfd 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -103,8 +103,10 @@ public: sal_Bool IsGrabFocus() const { return bGrabFocus; } }; -SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pCurView, - WinBits nWinStyle ) : +SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( + SvtIconChoiceCtrl* pCurView, + WinBits nWinStyle +) : aEntries( this ), aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ), aHorSBar( pCurView, WB_DRAG | WB_HSCROLL ), @@ -129,7 +131,7 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( SvtIconChoiceCtrl* pCurView, bHighlightFramePressed = sal_False; eSelectionMode = MULTIPLE_SELECTION; pView = pCurView; - pZOrderList = new List; //SvPtrarr; + pZOrderList = new SvxIconChoiceCtrlEntryList_impl(); ePositionMode = IcnViewPositionModeFree; SetStyle( nWinStyle ); nFlags = 0; @@ -218,19 +220,19 @@ void SvxIconChoiceCtrl_Impl::Clear( sal_Bool bInCtor ) nMaxVirtHeight = aSize.Height() - nHorSBarHeight; if( nMaxVirtHeight <= 0 ) nMaxVirtHeight = DEFAULT_MAX_VIRT_HEIGHT; - pZOrderList->Clear(); //Remove(0,pZOrderList->Count()); + pZOrderList->clear(); SetOrigin( Point() ); if( bUpdateMode ) pView->Invalidate(INVALIDATE_NOCHILDREN); } AdjustScrollBars(); - sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pCur = aEntries[ nCur ]; delete pCur; } - aEntries.Clear(); + aEntries.clear(); DocRectChanged(); VisRectChanged(); } @@ -292,19 +294,18 @@ void SvxIconChoiceCtrl_Impl::FontModified() ShowCursor( sal_True ); } -void SvxIconChoiceCtrl_Impl::InsertEntry( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nPos, +void SvxIconChoiceCtrl_Impl::InsertEntry( SvxIconChoiceCtrlEntry* pEntry, size_t nPos, const Point* pPos ) { StopEditTimer(); - aEntries.Insert( pEntry, nPos ); - if( (nFlags & F_ENTRYLISTPOS_VALID) && nPos >= aEntries.Count() - 1 ) - pEntry->nPos = aEntries.Count() - 1; + aEntries.insert( nPos, pEntry ); + if( (nFlags & F_ENTRYLISTPOS_VALID) && nPos >= aEntries.size() - 1 ) + pEntry->nPos = aEntries.size() - 1; else nFlags &= ~F_ENTRYLISTPOS_VALID; - pZOrderList->Insert( (void*)pEntry, LIST_APPEND ); //pZOrderList->Count() ); + pZOrderList->push_back( pEntry ); pImpCursor->Clear(); -// pGridMap->Clear(); if( pPos ) { Size aSize( CalcBoundingSize( pEntry ) ); @@ -376,10 +377,10 @@ void SvxIconChoiceCtrl_Impl::SetListPositions() if( nFlags & F_ENTRYLISTPOS_VALID ) return; - sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; pEntry->nPos = nCur; } nFlags |= F_ENTRYLISTPOS_VALID; @@ -408,7 +409,7 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ) if( pEntry->IsSelected() ) CallSelectHandler( 0 ); - if( aEntries.Count() == 1 && aEntries.GetObject(0) == pEntry ) + if( aEntries.size() == 1 && aEntries[ 0 ] == pEntry ) { Clear(); return; @@ -435,21 +436,32 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ) } sal_Bool bCurEntryPosValid = (nFlags & F_ENTRYLISTPOS_VALID) ? sal_True : sal_False; - if( bCurEntryPosValid && aEntries.GetObject(aEntries.Count()-1) != pEntry ) + if( bCurEntryPosValid && aEntries[ aEntries.size()-1 ] != pEntry ) nFlags &= ~F_ENTRYLISTPOS_VALID; - sal_uLong nPos = pZOrderList->GetPos( (void*)pEntry ); - pZOrderList->Remove( nPos ); + + for ( + SvxIconChoiceCtrlEntryList_impl::iterator it = pZOrderList->begin(); + it < pZOrderList->end(); + ++it + ) { + if ( *it == pEntry ) + { + pZOrderList->erase( it ); + break; + } + } + if( bCurEntryPosValid ) { - DBG_ASSERT(aEntries.GetObject(pEntry->nPos)==pEntry,"RemoveEntry: Wrong nPos in entry"); - aEntries.Remove( pEntry->nPos ); + DBG_ASSERT(aEntries[ pEntry->nPos ] == pEntry,"RemoveEntry: Wrong nPos in entry"); + aEntries.remove( pEntry->nPos ); } else - aEntries.Remove( pEntry ); + aEntries.remove( pEntry ); pImpCursor->Clear(); pGridMap->Clear(); delete pEntry; - if( IsAutoArrange() && aEntries.Count() ) + if( IsAutoArrange() && aEntries.size() ) aAutoArrangeTimer.Start(); if( bSetNewCursor ) { @@ -544,10 +556,10 @@ void SvxIconChoiceCtrl_Impl::ResetVirtSize() StopEditTimer(); aVirtOutputSize.Width() = 0; aVirtOutputSize.Height() = 0; - const sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + const size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pCur = aEntries[ nCur ]; pCur->ClearFlags( ICNVIEW_FLAG_POS_MOVED ); if( pCur->IsPosLocked() ) { @@ -616,25 +628,25 @@ void SvxIconChoiceCtrl_Impl::AdjustVirtSize( const Rectangle& rRect ) void SvxIconChoiceCtrl_Impl::InitPredecessors() { DBG_ASSERT(!pHead,"SvxIconChoiceCtrl_Impl::InitPredecessors() >> Already initialized"); - sal_uLong nCount = aEntries.Count(); + size_t nCount = aEntries.size(); if( nCount ) { - SvxIconChoiceCtrlEntry* pPrev = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 ); - for( sal_uLong nCur = 1; nCur <= nCount; nCur++ ) + SvxIconChoiceCtrlEntry* pPrev = aEntries[ 0 ]; + for( size_t nCur = 1; nCur <= nCount; nCur++ ) { pPrev->ClearFlags( ICNVIEW_FLAG_POS_LOCKED | ICNVIEW_FLAG_POS_MOVED | ICNVIEW_FLAG_PRED_SET); SvxIconChoiceCtrlEntry* pNext; if( nCur == nCount ) - pNext = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 ); + pNext = aEntries[ 0 ]; else - pNext = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + pNext = aEntries[ nCur ]; pPrev->pflink = pNext; pNext->pblink = pPrev; pPrev = pNext; } - pHead = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 ); + pHead = aEntries[ 0 ]; } else pHead = 0; @@ -645,10 +657,10 @@ void SvxIconChoiceCtrl_Impl::ClearPredecessors() { if( pHead ) { - sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pCur = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pCur = aEntries[ nCur ]; pCur->pflink = 0; pCur->pblink = 0; pCur->ClearFlags( ICNVIEW_FLAG_PRED_SET ); @@ -750,7 +762,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) #endif nFlags |= F_PAINTED; - if( !aEntries.Count() ) + if( !aEntries.size() ) return; if( !pCursor ) { @@ -767,14 +779,14 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) } if( !bfound ) - pCursor = (SvxIconChoiceCtrlEntry*)aEntries.First(); + pCursor = aEntries[ 0 ]; } // Show Focus at Init-Time if ( pView->HasFocus() ) GetFocus(); - sal_uLong nCount = pZOrderList->Count(); + size_t nCount = pZOrderList->size(); if( !nCount ) return; @@ -786,35 +798,33 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) pView->SetClipRegion( aOutputArea ); } - const sal_uInt16 nListInitSize = aEntries.Count() > USHRT_MAX ? - USHRT_MAX : (sal_uInt16)aEntries.Count(); - List* pNewZOrderList = new List( nListInitSize ); - List* pPaintedEntries = new List( nListInitSize ); + SvxIconChoiceCtrlEntryList_impl* pNewZOrderList = new SvxIconChoiceCtrlEntryList_impl(); + SvxIconChoiceCtrlEntryList_impl* pPaintedEntries = new SvxIconChoiceCtrlEntryList_impl(); - sal_uLong nPos = 0; + size_t nPos = 0; while( nCount ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nPos )); + SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nPos ]; const Rectangle& rBoundRect = GetEntryBoundRect( pEntry ); if( rRect.IsOver( rBoundRect ) ) { PaintEntry( pEntry, rBoundRect.TopLeft(), pView, sal_True ); // Eintraege, die neu gezeichnet werden, auf Top setzen - pPaintedEntries->Insert( pEntry, LIST_APPEND ); + pPaintedEntries->push_back( pEntry ); } else - pNewZOrderList->Insert( pEntry, LIST_APPEND ); + pNewZOrderList->push_back( pEntry ); nCount--; nPos++; } delete pZOrderList; pZOrderList = pNewZOrderList; - nCount = pPaintedEntries->Count(); + nCount = pPaintedEntries->size(); if( nCount ) { - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) - pZOrderList->Insert( pPaintedEntries->GetObject(nCur), LIST_APPEND); + for( size_t nCur = 0; nCur < nCount; nCur++ ) + pZOrderList->push_back( (*pPaintedEntries)[ nCur ] ); } delete pPaintedEntries; @@ -824,7 +834,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) void SvxIconChoiceCtrl_Impl::RepaintEntries( sal_uInt16 nEntryFlagsMask ) { - const sal_uLong nCount = pZOrderList->Count(); + const size_t nCount = pZOrderList->size(); if( !nCount ) return; @@ -835,9 +845,9 @@ void SvxIconChoiceCtrl_Impl::RepaintEntries( sal_uInt16 nEntryFlagsMask ) bResetClipRegion = sal_True; pView->SetClipRegion( aOutRect ); } - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nCur)); + SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nCur ]; if( pEntry->GetFlags() & nEntryFlagsMask ) { const Rectangle& rBoundRect = GetEntryBoundRect( pEntry ); @@ -1379,7 +1389,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) case KEY_END: if( pCursor ) { - pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( aEntries.Count() - 1 ); + pNewCursor = aEntries[ aEntries.size() - 1 ]; SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift, sal_True ); } break; @@ -1387,7 +1397,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) case KEY_HOME: if( pCursor ) { - pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( 0 ); + pNewCursor = aEntries[ 0 ]; SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift, sal_True ); } break; @@ -1598,11 +1608,11 @@ sal_Bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar() if(!( nWinBits & WB_HSCROLL) && !aOrigin.X() ) { long nWidth = aOutputSize.Width(); - const sal_uLong nCount = pZOrderList->Count(); + const size_t nCount = pZOrderList->size(); long nMostRight = 0; - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pZOrderList->GetObject(nCur); + SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nCur ]; long nRight = GetEntryBoundRect(pEntry).Right(); if( nRight > nWidth ) return sal_False; @@ -1637,10 +1647,10 @@ sal_Bool SvxIconChoiceCtrl_Impl::CheckVerScrollBar() { long nDeepest = 0; long nHeight = aOutputSize.Height(); - const sal_uLong nCount = pZOrderList->Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + const size_t nCount = pZOrderList->size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pZOrderList->GetObject(nCur); + SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nCur ]; long nBottom = GetEntryBoundRect(pEntry).Bottom(); if( nBottom > nHeight ) return sal_False; @@ -2099,11 +2109,11 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetEntry( const Point& rDocPos, { CheckBoundingRects(); // Z-Order-Liste vom Ende her absuchen - sal_uLong nCount = pZOrderList->Count(); + size_t nCount = pZOrderList->size(); while( nCount ) { nCount--; - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nCount)); + SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nCount ]; if( pEntry->aRect.IsInside( rDocPos ) ) { if( bHit ) @@ -2126,45 +2136,32 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetEntry( const Point& rDocPos, return 0; } -SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry ) -{ +SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextEntry( + const Point& rDocPos, + SvxIconChoiceCtrlEntry* pCurEntry +) { CheckBoundingRects(); SvxIconChoiceCtrlEntry* pTarget = 0; - const sal_uLong nStartPos = pZOrderList->GetPos( (void*)pCurEntry ); - if( nStartPos != LIST_ENTRY_NOTFOUND ) - { - const sal_uLong nCount = pZOrderList->Count(); - for( sal_uLong nCur = nStartPos+1; nCur < nCount; nCur++ ) + + for ( + SvxIconChoiceCtrlEntryList_impl::iterator it = pZOrderList->begin(); + it < pZOrderList->end(); + ++it + ) { + if ( *it == pCurEntry ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nCur)); - if( pEntry->aRect.IsInside( rDocPos ) ) + while ( ++it < pZOrderList->end() ) { - pTarget = pEntry; - break; + if ( (*it)->aRect.IsInside( rDocPos ) ) + { + pTarget = *it; + break; + } } + break; } } - return pTarget; -} -SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetPrevEntry( const Point& rDocPos, SvxIconChoiceCtrlEntry* pCurEntry ) -{ - CheckBoundingRects(); - SvxIconChoiceCtrlEntry* pTarget = 0; - sal_uLong nStartPos = pZOrderList->GetPos( (void*)pCurEntry ); - if( nStartPos != LIST_ENTRY_NOTFOUND && nStartPos != 0 ) - { - nStartPos--; - do - { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nStartPos)); - if( pEntry->aRect.IsInside( rDocPos ) ) - { - pTarget = pEntry; - break; - } - } while( nStartPos > 0 ); - } return pTarget; } @@ -2344,18 +2341,18 @@ Size SvxIconChoiceCtrl_Impl::CalcBoundingSize( SvxIconChoiceCtrlEntry* pEntry ) void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects() { nMaxBoundHeight = 0; - pZOrderList->Clear(); - sal_uLong nCount = aEntries.Count(); - sal_uLong nCur; + pZOrderList->clear(); + size_t nCount = aEntries.size(); + size_t nCur; SvxIconChoiceCtrlEntry* pEntry; if( !IsAutoArrange() || !pHead ) { for( nCur = 0; nCur < nCount; nCur++ ) { - pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + pEntry = aEntries[ nCur ]; FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, LIST_APPEND ); + pZOrderList->push_back( pEntry ); } } else @@ -2366,7 +2363,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects() { DBG_ASSERT(pEntry->pflink&&pEntry->pblink,"SvxIconChoiceCtrl_Impl::RecalcAllBoundingRect > Bad link(s)"); FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, pZOrderList->Count() ); + pZOrderList->push_back( pEntry ); pEntry = pEntry->pflink; nCur++; } @@ -2378,16 +2375,16 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects() void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() { nMaxBoundHeight = 0; - pZOrderList->Clear(); - sal_uLong nCur; + pZOrderList->clear(); + size_t nCur; SvxIconChoiceCtrlEntry* pEntry; - const sal_uLong nCount = aEntries.Count(); + const size_t nCount = aEntries.size(); if( !IsAutoArrange() || !pHead ) { for( nCur = 0; nCur < nCount; nCur++ ) { - pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + pEntry = aEntries[ nCur ]; if( IsBoundingRectValid( pEntry->aRect )) { Size aBoundSize( pEntry->aRect.GetSize() ); @@ -2396,7 +2393,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() } else FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, LIST_APPEND ); + pZOrderList->push_back( pEntry ); } } else @@ -2414,7 +2411,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() } else FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, LIST_APPEND ); + pZOrderList->push_back( pEntry ); pEntry = pEntry->pflink; nCur++; } @@ -2424,10 +2421,10 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() void SvxIconChoiceCtrl_Impl::UpdateBoundingRects() { - const sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + const size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; GetEntryBoundRect( pEntry ); } } @@ -2754,25 +2751,28 @@ void SvxIconChoiceCtrl_Impl::Command( const CommandEvent& rCEvt ) (rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) || (rCEvt.GetCommand() == COMMAND_AUTOSCROLL) ) { -#if 1 if( HandleScrollCommand( rCEvt ) ) return; -#else - ScrollBar* pHor = aHorSBar.IsVisible() ? &aHorSBar : 0; - ScrollBar* pVer = aVerSBar.IsVisible() ? &aVerSBar : 0; - if( pView->HandleScrollCommand( rCEvt, pHor, pVer ) ) - return; -#endif } } void SvxIconChoiceCtrl_Impl::ToTop( SvxIconChoiceCtrlEntry* pEntry ) { - if( pZOrderList->GetObject( pZOrderList->Count() - 1 ) != pEntry ) - { - sal_uLong nPos = pZOrderList->GetPos( (void*)pEntry ); - pZOrderList->Remove( nPos ); - pZOrderList->Insert( pEntry, LIST_APPEND ); + if( !pZOrderList->empty() + && pEntry != pZOrderList->back() + ) { + for( + SvxIconChoiceCtrlEntryList_impl::iterator it = pZOrderList->begin(); + it < pZOrderList->end(); + ++it + ) { + if ( *it == pEntry ) + { + pZOrderList->erase( it ); + pZOrderList->push_back( pEntry ); + break; + } + } } } @@ -2913,7 +2913,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindNewCursor() } } else - pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.First(); + pNewCursor = aEntries[ 0 ]; DBG_ASSERT(!pNewCursor|| (pCursor&&pCursor!=pNewCursor),"FindNewCursor failed"); return pNewCursor; } @@ -2942,10 +2942,10 @@ void SvxIconChoiceCtrl_Impl::DeselectAllBut( SvxIconChoiceCtrlEntry* pThisEntryN // // !!!!!!! Todo: Evtl. Z-Orderlist abarbeiten !!!!!!! // - sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; if( pEntry != pThisEntryNot && pEntry->IsSelected() ) SelectEntry( pEntry, sal_False, sal_True, sal_True, bPaintSync ); } @@ -3148,7 +3148,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const Rectangle& rRect, sal_Bool bAdd, SvPtrarr* pOtherRects ) { aCurSelectionRect = rRect; - if( !pZOrderList || !pZOrderList->Count() ) + if( !pZOrderList || !pZOrderList->size() ) return; // Flag setzen, damit im Select kein ToTop gerufen wird @@ -3157,7 +3157,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const Rectangle& rRect, sal_Bool bAdd, CheckBoundingRects(); pView->Update(); - const sal_uLong nCount = pZOrderList->Count(); + const size_t nCount = pZOrderList->size(); Rectangle aRect( rRect ); aRect.Justify(); @@ -3170,9 +3170,9 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const Rectangle& rRect, sal_Bool bAdd, pView->SetClipRegion( GetOutputRect() ); } - for( sal_uLong nPos = 0; nPos < nCount; nPos++ ) + for( size_t nPos = 0; nPos < nCount; nPos++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)(pZOrderList->GetObject(nPos )); + SvxIconChoiceCtrlEntry* pEntry = (*pZOrderList)[ nPos ]; if( !IsBoundingRectValid( pEntry->aRect )) FindBoundingRect( pEntry ); @@ -3612,8 +3612,8 @@ sal_Bool SvxIconChoiceCtrl_Impl::IsMnemonicChar( sal_Unicode cChar, sal_uLong& r { sal_Bool bRet = sal_False; const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); - sal_uLong nEntryCount = GetEntryCount(); - for ( sal_uLong i = 0; i < nEntryCount; ++i ) + size_t nEntryCount = GetEntryCount(); + for ( size_t i = 0; i < nEntryCount; ++i ) { if ( rI18nHelper.MatchMnemonic( GetEntry( i )->GetText(), cChar ) ) { @@ -3758,12 +3758,12 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong return pCurHighlightFrame; } - sal_uLong nCount = aEntries.Count(); + size_t nCount = aEntries.size(); if( !pHead ) { - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; if( pEntry->IsSelected() ) { rPos = nCur; @@ -3795,14 +3795,14 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry( sal_uLong // kein Round Robin! SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextSelectedEntry( sal_uLong& rStartPos ) const { - sal_uLong nCount = aEntries.Count(); + size_t nCount = aEntries.size(); if( rStartPos > nCount || !GetSelectionCount() ) return 0; if( !pHead ) { - for( sal_uLong nCur = rStartPos+1; nCur < nCount; nCur++ ) + for( size_t nCur = rStartPos+1; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; if( pEntry->IsSelected() ) { rStartPos = nCur; @@ -3812,7 +3812,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextSelectedEntry( sal_uLong& } else { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( rStartPos ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ rStartPos ]; pEntry = pEntry->pflink; while( pEntry != pHead ) { @@ -3833,10 +3833,10 @@ void SvxIconChoiceCtrl_Impl::SelectAll( sal_Bool bSelect, sal_Bool bPaint ) { bPaint = sal_True; - sal_uLong nCount = aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount && (bSelect || GetSelectionCount() ); nCur++ ) + size_t nCount = aEntries.size(); + for( size_t nCur = 0; nCur < nCount && (bSelect || GetSelectionCount() ); nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; SelectEntry( pEntry, bSelect, sal_True, sal_True, bPaint ); } nFlags &= (~F_ADD_MODE); @@ -3993,13 +3993,13 @@ sal_uLong SvxIconChoiceCtrl_Impl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntr void SvxIconChoiceCtrl_Impl::SetEntryListPos( SvxIconChoiceCtrlEntry* pListEntry, sal_uLong nNewPos ) { - sal_uLong nCurPos = GetEntryListPos( pListEntry ); + size_t nCurPos = GetEntryListPos( pListEntry ); if( nCurPos == nNewPos ) return; - aEntries.List::Remove( nCurPos ); - aEntries.List::Insert( (void*)pListEntry, nNewPos ); + aEntries.remove( nCurPos ); + aEntries.insert( nNewPos, pListEntry ); // Eintragspositionen anpassen - sal_uLong nStart, nEnd; + size_t nStart, nEnd; if( nNewPos < nCurPos ) { nStart = nNewPos; @@ -4012,7 +4012,7 @@ void SvxIconChoiceCtrl_Impl::SetEntryListPos( SvxIconChoiceCtrlEntry* pListEntry } for( ; nStart <= nEnd; nStart++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nStart ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nStart ]; pEntry->nPos = nStart; } } @@ -4080,15 +4080,7 @@ void SvxIconChoiceCtrl_Impl::InitSettings() } } -EntryList_Impl::EntryList_Impl( SvxIconChoiceCtrl_Impl* pOwner, sal_uInt16 _nInitSize , sal_uInt16 _nReSize ) : - List( _nInitSize, _nReSize ), - _pOwner( pOwner ) -{ - _pOwner->pHead = 0; -} - -EntryList_Impl::EntryList_Impl( SvxIconChoiceCtrl_Impl* pOwner, sal_uInt16 _nBlockSize, sal_uInt16 _nInitSize, sal_uInt16 _nReSize ) : - List( _nBlockSize, _nInitSize, _nReSize ), +EntryList_Impl::EntryList_Impl( SvxIconChoiceCtrl_Impl* pOwner ) : _pOwner( pOwner ) { _pOwner->pHead = 0; @@ -4099,31 +4091,47 @@ EntryList_Impl::~EntryList_Impl() _pOwner->pHead = 0; } -void EntryList_Impl::Clear() +void EntryList_Impl::clear() { _pOwner->pHead = 0; - List::Clear(); + maIconChoiceCtrlEntryList.clear(); } -void EntryList_Impl::Insert( SvxIconChoiceCtrlEntry* pEntry, sal_uLong nPos ) +void EntryList_Impl::insert( size_t nPos, SvxIconChoiceCtrlEntry* pEntry ) { - List::Insert( pEntry, nPos ); + if ( nPos < maIconChoiceCtrlEntryList.size() ) { + maIconChoiceCtrlEntryList.insert( maIconChoiceCtrlEntryList.begin() + nPos, pEntry ); + } else { + maIconChoiceCtrlEntryList.push_back( pEntry ); + } if( _pOwner->pHead ) pEntry->SetBacklink( _pOwner->pHead->pblink ); } -SvxIconChoiceCtrlEntry* EntryList_Impl::Remove( sal_uLong nPos ) +SvxIconChoiceCtrlEntry* EntryList_Impl::remove( size_t nPos ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)List::Remove( nPos ); - DBG_ASSERT(pEntry,"EntryList_Impl::Remove > Entry not found"); - Removed_Impl( pEntry ); + SvxIconChoiceCtrlEntry* pEntry = NULL; + if ( nPos < maIconChoiceCtrlEntryList.size() ) { + pEntry = maIconChoiceCtrlEntryList[ nPos ]; + maIconChoiceCtrlEntryList.erase( maIconChoiceCtrlEntryList.begin() + nPos ); + Removed_Impl( pEntry ); + } return pEntry; } -void EntryList_Impl::Remove( SvxIconChoiceCtrlEntry* pEntry ) +void EntryList_Impl::remove( SvxIconChoiceCtrlEntry* pEntry ) { - List::Remove( (void*)pEntry ); - Removed_Impl( pEntry ); + for ( + SvxIconChoiceCtrlEntryList_impl::iterator it = maIconChoiceCtrlEntryList.begin(); + it < maIconChoiceCtrlEntryList.end(); + ++it + ) { + if ( *it == pEntry ) { + maIconChoiceCtrlEntryList.erase( it ); + Removed_Impl( pEntry ); + break; + } + } } void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ) @@ -4136,7 +4144,7 @@ void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ) _pOwner->pHead = pEntry->pflink; else { - DBG_ASSERT(!Count(),"EntryList_Impl::Remove > Invalid predecessor" ); + DBG_ASSERT(!size(),"EntryList_Impl::Remove > Invalid predecessor" ); _pOwner->pHead = 0; } } @@ -4146,14 +4154,14 @@ void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ) void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMode ) { - sal_uLong nCur; + size_t nCur; if( eMode == ePositionMode ) return; SvxIconChoiceCtrlPositionMode eOldMode = ePositionMode; ePositionMode = eMode; - sal_uLong nCount = aEntries.Count(); + size_t nCount = aEntries.size(); if( eOldMode == IcnViewPositionModeAutoArrange ) { @@ -4161,7 +4169,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod // mit ungewollten Ueberlappungen, da diese Eintrage im Arrange // nicht beruecksichtigt werden. #if 1 - if( aEntries.Count() ) + if( aEntries.size() ) aAutoArrangeTimer.Start(); #else if( pHead ) @@ -4188,7 +4196,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod List aMovedEntries; for( nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nCur ]; if( pEntry->GetFlags() & (ICNVIEW_FLAG_POS_LOCKED | ICNVIEW_FLAG_POS_MOVED)) { SvxIconChoiceCtrlEntry_Impl* pE = new SvxIconChoiceCtrlEntry_Impl( @@ -4204,7 +4212,7 @@ void SvxIconChoiceCtrl_Impl::SetPositionMode( SvxIconChoiceCtrlPositionMode eMod } for( nCur = 0; nCur < nCount; nCur++ ) delete (SvxIconChoiceCtrlEntry_Impl*)aMovedEntries.GetObject( nCur ); - if( aEntries.Count() ) + if( aEntries.size() ) aAutoArrangeTimer.Start(); } else if( ePositionMode == IcnViewPositionModeAutoAdjust ) @@ -4274,7 +4282,7 @@ sal_Bool SvxIconChoiceCtrl_Impl::GetEntryPredecessor( SvxIconChoiceCtrlEntry* pE if( pEntry == pHead ) { - SvxIconChoiceCtrlEntry* pFirst = (SvxIconChoiceCtrlEntry*)aEntries.GetObject(0); + SvxIconChoiceCtrlEntry* pFirst = aEntries[ 0 ]; if( pFirst != pEntry ) return sal_True; return sal_False; @@ -4293,13 +4301,13 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindEntryPredecessor( SvxIconCho Rectangle aCenterRect( CalcBmpRect( pEntry, &aPos )); Point aNewPos( aCenterRect.Center() ); sal_uLong nGrid = GetPredecessorGrid( aNewPos ); - sal_uLong nCount = aEntries.Count(); + size_t nCount = aEntries.size(); if( nGrid == ULONG_MAX ) return 0; if( nGrid >= nCount ) nGrid = nCount - 1; if( !pHead ) - return (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nGrid ); + return aEntries[ nGrid ]; SvxIconChoiceCtrlEntry* pCur = pHead; // Grid 0 // todo: Liste von hinten aufrollen wenn nGrid > nCount/2 diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx index 93e2990d6658..1b0575fbd9bd 100644 --- a/svtools/source/contnr/imivctl2.cxx +++ b/svtools/source/contnr/imivctl2.cxx @@ -85,10 +85,10 @@ void IcnCursor_Impl::ImplCreate() pColumns = new SvPtrarr[ nCols ]; pRows = new SvPtrarr[ nRows ]; - sal_uLong nCount = pView->aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = pView->aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ]; // const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); Rectangle rRect( pView->CalcBmpRect( pEntry,0 ) ); short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / nDeltaHeight ); @@ -357,8 +357,8 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS if( bDown ) { nNewPos += nEntriesInView; - if( nNewPos >= (long)pView->aEntries.Count() ) - nNewPos = pView->aEntries.Count() - 1; + if( nNewPos >= (long)pView->aEntries.size() ) + nNewPos = pView->aEntries.size() - 1; } else { @@ -367,7 +367,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS nNewPos = 0; } if( nPos != nNewPos ) - return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( (sal_uLong)nNewPos ); + return pView->aEntries[ (size_t)nNewPos ]; return 0; } long nOpt = pView->GetEntryBoundRect( pStart ).Top(); @@ -410,10 +410,10 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoUpDown( SvxIconChoiceCtrlEntry* pCtrlE if( pView->IsAutoArrange() && !(pView->nWinBits & WB_ALIGN_TOP) ) { sal_uLong nPos = pView->GetEntryListPos( pCtrlEntry ); - if( bDown && nPos < (pView->aEntries.Count() - 1) ) - return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nPos + 1 ); + if( bDown && nPos < (pView->aEntries.size() - 1) ) + return pView->aEntries[ nPos + 1 ]; else if( !bDown && nPos > 0 ) - return (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nPos - 1 ); + return pView->aEntries[ nPos - 1 ]; return 0; } @@ -504,10 +504,10 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt SvPtrarr* pRow = new SvPtrarr; rLists.Insert( (void*)pRow, nCurList ); } - const sal_uLong nCount = pView->aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + const size_t nCount = pView->aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ]; const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); sal_uInt16 nIns = GetSortListPos((SvPtrarr*)rLists[nY],rRect.Left(),sal_False); @@ -523,10 +523,10 @@ void IcnCursor_Impl::CreateGridAjustData( SvPtrarr& rLists, SvxIconChoiceCtrlEnt short nRefRow = (short)( ((rRefRect.Top()+rRefRect.Bottom())/2) / pView->nGridDY ); SvPtrarr* pRow = new SvPtrarr; rLists.Insert( (void*)pRow, 0 ); - sal_uLong nCount = pView->aEntries.Count(); - for( sal_uLong nCur = 0; nCur < nCount; nCur++ ) + size_t nCount = pView->aEntries.size(); + for( size_t nCur = 0; nCur < nCount; nCur++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)pView->aEntries.GetObject( nCur ); + SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ]; Rectangle rRect( pView->CalcBmpRect(pEntry) ); //const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); @@ -601,9 +601,9 @@ void IcnGridMap_Impl::Create_Impl() _pGridMap = new sal_Bool[ _nGridRows * _nGridCols]; memset( (void*)_pGridMap, 0, _nGridRows * _nGridCols ); - const sal_uLong nCount = _pView->aEntries.Count(); - for( sal_uLong nCur=0; nCur < nCount; nCur++ ) - OccupyGrids( (SvxIconChoiceCtrlEntry*)_pView->aEntries.GetObject( nCur )); + const size_t nCount = _pView->aEntries.size(); + for( size_t nCur=0; nCur < nCount; nCur++ ) + OccupyGrids( _pView->aEntries[ nCur ] ); } void IcnGridMap_Impl::GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const @@ -728,60 +728,11 @@ GridId IcnGridMap_Impl::GetUnoccupiedGrid( sal_Bool bOccupyFound ) // ein Eintrag belegt nur das unter seinem Zentrum liegende GridRect // diese Variante ist bedeutend schneller als die Belegung ueber das // Bounding-Rect, kann aber zu kleinen Ueberlappungen fuehren -#define OCCUPY_CENTER - void IcnGridMap_Impl::OccupyGrids( const SvxIconChoiceCtrlEntry* pEntry, sal_Bool bOccupy ) { if( !_pGridMap || !_pView->IsBoundingRectValid( pEntry->aRect )) return; -#ifndef OCCUPY_CENTER - OccupyGrids( pEntry->aRect, bOccupy ); -#else OccupyGrid( GetGrid( pEntry->aRect.Center()), bOccupy ); -#endif - -} - -void IcnGridMap_Impl::OccupyGrids( const Rectangle& rRect, sal_Bool bUsed ) -{ - if( !_pGridMap ) - return; - - if( bUsed ) - { - if( _aLastOccupiedGrid == rRect ) - return; - _aLastOccupiedGrid = rRect; - } - else - _aLastOccupiedGrid.SetEmpty(); - - sal_Bool bTopLeftClipped, bBottomRightClipped; - GridId nIdTL = GetGrid( rRect.TopLeft(), &bTopLeftClipped ); - GridId nIdBR = GetGrid( rRect.BottomRight(), &bBottomRightClipped ); - - if( bTopLeftClipped && bBottomRightClipped ) - return; - - sal_uInt16 nX1,nX2,nY1,nY2; - GetGridCoord( nIdTL, nX1, nY1 ); - GetGridCoord( nIdBR, nX2, nY2 ); - sal_uInt16 nTemp; - if( nX1 > nX2 ) - { - nTemp = nX1; - nX1 = nX2; - nX2 = nTemp; - } - if( nY1 > nY2 ) - { - nTemp = nY1; - nY1 = nY2; - nY2 = nTemp; - } - for( ; nX1 <= nX2; nX1++ ) - for( ; nY1 <= nY2; nY1++ ) - OccupyGrid( GetGrid( nX1, nY1 ) ); } void IcnGridMap_Impl::Clear() diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx index f26de38cc1ab..7f1b374cb34a 100644 --- a/svtools/source/contnr/ivctrl.cxx +++ b/svtools/source/contnr/ivctrl.cxx @@ -360,12 +360,6 @@ SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetNextEntry( const Point& rPixPos, S return ((SvtIconChoiceCtrl*)this)->_pImp->GetNextEntry( aPos, pCurEntry ); } -SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetPrevEntry( const Point& rPixPos, SvxIconChoiceCtrlEntry* pCurEntry, sal_Bool ) const -{ - Point aPos( rPixPos ); - aPos -= GetMapMode().GetOrigin(); - return ((SvtIconChoiceCtrl*)this)->_pImp->GetPrevEntry( aPos, pCurEntry ); -} sal_uLong SvtIconChoiceCtrl::GetEntryCount() const { return _pImp->GetEntryCount(); diff --git a/svtools/source/contnr/svicnvw.cxx b/svtools/source/contnr/svicnvw.cxx deleted file mode 100644 index 41d6a100c1f3..000000000000 --- 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/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index da5aff817b60..e0e9efca6f59 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -1012,6 +1012,34 @@ void SvImpLBox::MakeVisible( SvLBoxEntry* pEntry, sal_Bool bMoveToTop ) pView->Invalidate(); } +void SvImpLBox::ScrollToAbsPos( long nPos ) +{ + if( pView->GetVisibleCount() == 0 ) + return; + long nLastEntryPos = pView->GetAbsPos( pView->Last() ); + + if( nPos < 0 ) + nPos = 0; + else if( nPos > nLastEntryPos ) + nPos = nLastEntryPos; + + SvLBoxEntry* pEntry = (SvLBoxEntry*)pView->GetEntryAtAbsPos( nPos ); + if( !pEntry || pEntry == pStartEntry ) + return; + + if( pStartEntry || (m_nStyle & WB_FORCE_MAKEVISIBLE) ) + nFlags &= (~F_FILLING); + + if( pView->IsEntryVisible(pEntry) ) + { + pStartEntry = pEntry; + ShowCursor( sal_False ); + aVerSBar.SetThumbPos( nPos ); + ShowCursor( sal_True ); + if (GetUpdateMode()) + pView->Invalidate(); + } +} void SvImpLBox::RepaintSelectionItems() { @@ -1358,8 +1386,19 @@ void SvImpLBox::InitScrollBarBox() void SvImpLBox::Resize() { Size aSize( pView->Control::GetOutputSizePixel()); + long nEntryHeight = pView->GetEntryHeight(); + int nEntryCount = 0; + if( aSize.Width() <= 0 || aSize.Height() <= 0 ) return; + if( nEntryHeight ) + { + // Set the view height to an integer multiple of the entry height. + nEntryCount = (int) aSize.Height() / nEntryHeight; + aSize.Height() = pView->GetEntryHeight() * nEntryCount; + pView->Control::SetOutputSizePixel( aSize ); + } + nFlags |= F_IN_RESIZE; InitScrollBarBox(); diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx deleted file mode 100644 index 3514c7b6a271..000000000000 --- 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; - aSize.Height() = nHorSBarHeight; -#if defined(WNT) - aSize.Width()++; -#endif -#if defined(WNT) - if( nResult & 0x0001 ) // vertikale Scrollbar ? - { - aSize.Width()++; - nRealWidth++; - } -#endif - if( aSize != aHorSBar.GetSizePixel() ) - aHorSBar.SetSizePixel( aSize ); - aHorSBar.SetVisibleSize( nVisibleWidth ); //nRealWidth ); - aHorSBar.SetPageSize( (nVisibleWidth*75)/100 ); - if( nResult & 0x0002 ) - { - aHorSBar.SetThumbPos( nThumb ); - aHorSBar.Show(); - } - else - { - aHorSBar.SetThumbPos( 0 ); - aHorSBar.Hide(); - } - - aOutputSize.Width() = nRealWidth; -#if defined(WNT) - if( nResult & 0x0002 ) // hor scrollbar ? - nRealHeight++; // weil unterer Rand geclippt wird -#endif - aOutputSize.Height() = nRealHeight; -} - -void SvImpIconView::Resize() -{ - StopEditTimer(); - Rectangle aRect; - if( GetResizeRect(aRect) ) - pView->Invalidate( aRect ); - aOutputSize = pView->GetOutputSizePixel(); - pImpCursor->Clear(); - -#if 1 - const Size& rSize = pView->Control::GetOutputSizePixel(); - PositionScrollBars( rSize.Width(), rSize.Height() ); - // Die ScrollBars werden asynchron ein/ausgeblendet, damit abgeleitete - // Klassen im Resize ein Arrange durchfuehren koennen, ohne dass - // die ScrollBars aufblitzen (SfxExplorerIconView!) - nCurUserEvent = Application::PostUserEvent(LINK(this,SvImpIconView,UserEventHdl),0); -#else - AdjustScrollBars(); - if( GetResizeRect(aRect) ) - PaintResizeRect( aRect ); -#endif -} - -sal_Bool SvImpIconView::CheckHorScrollBar() -{ - if( !pZOrderList || !aHorSBar.IsVisible() ) - return sal_False; - const MapMode& rMapMode = pView->GetMapMode(); - Point aOrigin( rMapMode.GetOrigin() ); - if(!(pView->GetStyle() & WB_HSCROLL) && !aOrigin.X() ) - { - long nWidth = aOutputSize.Width(); - sal_uInt16 nCount = pZOrderList->Count(); - long nMostRight = 0; - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)pZOrderList->operator[](nCur); - long nRight = GetBoundingRect(pEntry).Right(); - if( nRight > nWidth ) - return sal_False; - if( nRight > nMostRight ) - nMostRight = nRight; - } - aHorSBar.Hide(); - aOutputSize.Height() += nHorSBarHeight; - aVirtOutputSize.Width() = nMostRight; - aHorSBar.SetThumbPos( 0 ); - Range aRange; - aRange.Max() = nMostRight - 1; - aHorSBar.SetRange( aRange ); - if( aVerSBar.IsVisible() ) - { - Size aSize( aVerSBar.GetSizePixel()); - aSize.Height() += nHorSBarHeight; - aVerSBar.SetSizePixel( aSize ); - } - return sal_True; - } - return sal_False; -} - -sal_Bool SvImpIconView::CheckVerScrollBar() -{ - if( !pZOrderList || !aVerSBar.IsVisible() ) - return sal_False; - const MapMode& rMapMode = pView->GetMapMode(); - Point aOrigin( rMapMode.GetOrigin() ); - if(!(pView->GetStyle() & WB_VSCROLL) && !aOrigin.Y() ) - { - long nDeepest = 0; - long nHeight = aOutputSize.Height(); - sal_uInt16 nCount = pZOrderList->Count(); - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)pZOrderList->operator[](nCur); - long nBottom = GetBoundingRect(pEntry).Bottom(); - if( nBottom > nHeight ) - return sal_False; - if( nBottom > nDeepest ) - nDeepest = nBottom; - } - aVerSBar.Hide(); - aOutputSize.Width() += nVerSBarWidth; - aVirtOutputSize.Height() = nDeepest; - aVerSBar.SetThumbPos( 0 ); - Range aRange; - aRange.Max() = nDeepest - 1; - aVerSBar.SetRange( aRange ); - if( aHorSBar.IsVisible() ) - { - Size aSize( aHorSBar.GetSizePixel()); - aSize.Width() += nVerSBarWidth; - aHorSBar.SetSizePixel( aSize ); - } - return sal_True; - } - return sal_False; -} - - -// blendet Scrollbars aus, wenn sie nicht mehr benoetigt werden -void SvImpIconView::CheckScrollBars() -{ - CheckVerScrollBar(); - if( CheckHorScrollBar() ) - CheckVerScrollBar(); -} - - -void SvImpIconView::GetFocus() -{ - if( pCursor ) - { - pView->SetEntryFocus( pCursor, sal_True ); - ShowCursor( sal_True ); - } -} - -void SvImpIconView::LoseFocus() -{ - StopEditTimer(); - if( pCursor ) - pView->SetEntryFocus( pCursor,sal_False ); - ShowCursor( sal_False ); -} - -void SvImpIconView::UpdateAll() -{ - AdjustScrollBars(); - pImpCursor->Clear(); - pView->Invalidate(); -} - -void SvImpIconView::PaintEntry( SvLBoxEntry* pEntry, SvIcnVwDataEntry* pViewData ) -{ - Point aPos( GetEntryPosition( pEntry ) ); - PaintEntry( pEntry, aPos, pViewData ); -} - -void SvImpIconView::PaintEmphasis( const Rectangle& rRect, sal_Bool bSelected, - sal_Bool bCursored, OutputDevice* pOut ) -{ - // HACK fuer D&D - if( nFlags & F_NO_EMPHASIS ) - return; - - if( !pOut ) - pOut = pView; - - // Selektion painten - Color aOldFillColor = pOut->GetFillColor(); - Color aOldLineColor = pOut->GetLineColor(); - Color aNewColor; - const StyleSettings& rStyleSettings = pOut->GetSettings().GetStyleSettings(); - if( bSelected ) - { - aNewColor = rStyleSettings.GetHighlightColor(); - } - else - { - aNewColor =rStyleSettings.GetFieldColor(); - } - - if( bCursored ) - { - pOut->SetLineColor( Color( COL_BLACK ) ); - } - pOut->SetFillColor( aNewColor ); - pOut->DrawRect( rRect ); - pOut->SetFillColor( aOldFillColor ); - pOut->SetLineColor( aOldLineColor ); -} - -void SvImpIconView::PaintItem( const Rectangle& rRect, - SvLBoxItem* pItem, SvLBoxEntry* pEntry, sal_uInt16 nPaintFlags, - OutputDevice* pOut ) -{ - if( nViewMode == VIEWMODE_ICON && pItem->IsA() == SV_ITEM_ID_LBOXSTRING ) - { - const String& rStr = ((SvLBoxString*)pItem)->GetText(); - DrawText( pOut, rRect, rStr, DRAWTEXT_FLAGS ); - } - else - { - Point aPos( rRect.TopLeft() ); - const Size& rSize = GetItemSize( pView, pEntry, pItem ); - if( nPaintFlags & PAINTFLAG_HOR_CENTERED ) - aPos.X() += (rRect.GetWidth() - rSize.Width() ) / 2; - if( nPaintFlags & PAINTFLAG_VER_CENTERED ) - aPos.Y() += (rRect.GetHeight() - rSize.Height() ) / 2; - pItem->Paint( aPos, *(SvLBox*)pOut, 0, pEntry ); - } -} - -void SvImpIconView::PaintEntry( SvLBoxEntry* pEntry, const Point& rPos, - SvIcnVwDataEntry* pViewData, OutputDevice* pOut ) -{ - if( !pView->IsUpdateMode() ) - return; - - if( !pOut ) - pOut = pView; - - SvLBoxContextBmp* pBmpItem; - - pView->PreparePaint( pEntry ); - - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - - SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - - sal_Bool bSelected = pViewData->IsSelected(); - sal_Bool bCursored = pViewData->IsCursored(); - - Font aTempFont( pOut->GetFont() ); - // waehrend D&D nicht die Fontfarbe wechseln, da sonst auch die - // Emphasis gezeichnet werden muss! (weisser Adler auf weissem Grund) - if( bSelected && !(nFlags & F_NO_EMPHASIS) ) - { - const StyleSettings& rStyleSettings = pOut->GetSettings().GetStyleSettings(); - Font aNewFont( aTempFont ); - aNewFont.SetColor( rStyleSettings.GetHighlightTextColor() ); - pOut->SetFont( aNewFont ); - } - Rectangle aTextRect( CalcTextRect(pEntry,pStringItem,&rPos,sal_False,pViewData)); - Rectangle aBmpRect( CalcBmpRect(pEntry, &rPos, pViewData ) ); - - switch( nViewMode ) - { - case VIEWMODE_ICON: - pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - PaintEmphasis( aBmpRect, bSelected, bCursored, pOut ); - PaintItem( aBmpRect, pBmpItem, pEntry, - PAINTFLAG_HOR_CENTERED | PAINTFLAG_VER_CENTERED, pOut ); - PaintEmphasis( aTextRect, bSelected, sal_False, pOut ); - PaintItem( aTextRect, pStringItem, pEntry, PAINTFLAG_HOR_CENTERED, pOut ); - break; - - case VIEWMODE_NAME: - pBmpItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - PaintEmphasis( aBmpRect, bSelected, bCursored, pOut ); - PaintItem( aBmpRect, pBmpItem, pEntry, PAINTFLAG_VER_CENTERED, pOut ); - PaintEmphasis( aTextRect, bSelected, sal_False, pOut ); - PaintItem( aTextRect, pStringItem, pEntry,PAINTFLAG_VER_CENTERED, pOut ); - break; - - case VIEWMODE_TEXT: - PaintEmphasis( aTextRect, bSelected, bCursored, pOut ); - PaintItem( aTextRect, pStringItem, pEntry, PAINTFLAG_VER_CENTERED, pOut ); - break; - } - pOut->SetFont( aTempFont ); -} - -void SvImpIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos, - sal_Bool bAdjustAtGrid, sal_Bool bCheckScrollBars ) -{ - if( pModel->GetParent(pEntry) == pCurParent ) - { - ShowCursor( sal_False ); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - Rectangle aBoundRect( GetBoundingRect( pEntry, pViewData )); - pView->Invalidate( aBoundRect ); - ToTop( pEntry ); - if( rPos != aBoundRect.TopLeft() ) - { - Point aGridOffs = pViewData->aGridRect.TopLeft() - - pViewData->aRect.TopLeft(); - pImpCursor->Clear(); - nFlags &= ~F_GRID_INSERT; - aBoundRect.SetPos( rPos ); - pViewData->aRect = aBoundRect; - pViewData->aGridRect.SetPos( rPos + aGridOffs ); - AdjustVirtSize( aBoundRect ); - } - //HACK(Billigloesung, die noch verbessert werden muss) - if( bAdjustAtGrid ) - { - AdjustAtGrid( pEntry ); - ToTop( pEntry ); - } - if( bCheckScrollBars && pView->IsUpdateMode() ) - CheckScrollBars(); - - PaintEntry( pEntry, pViewData ); - ShowCursor( sal_True ); - } -} - -void SvImpIconView::ViewDataInitialized( SvLBoxEntry*) -{ -} - -void SvImpIconView::ModelHasEntryInvalidated( SvListEntry* pEntry ) -{ - if( pEntry == pCursor ) - ShowCursor( sal_False ); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - pView->Invalidate( pViewData->aRect ); - - if( nFlags & F_GRIDMODE ) - Center( (SvLBoxEntry*)pEntry, pViewData ); - else - pViewData->aRect.SetSize( CalcBoundingSize( - (SvLBoxEntry*)pEntry, pViewData ) ); - - ViewDataInitialized( (SvLBoxEntry*)pEntry ); - pView->Invalidate( pViewData->aRect ); - if( pEntry == pCursor ) - ShowCursor( sal_True ); -} - - -void SvImpIconView::InvalidateEntry( SvLBoxEntry* pEntry ) -{ - const Rectangle& rRect = GetBoundingRect( pEntry ); - pView->Invalidate( rRect ); -} - -void SvImpIconView::SetNoSelection() -{ -} - -void SvImpIconView::SetDragDropMode( DragDropMode ) -{ -} - -void SvImpIconView::SetSelectionMode( SelectionMode ) -{ -} - -sal_Bool SvImpIconView::IsEntryInView( SvLBoxEntry* ) -{ - return sal_False; -} - -SvLBoxEntry* SvImpIconView::GetDropTarget( const Point& rPos ) -{ - Point aDocPos( rPos ); - CalcDocPos( aDocPos ); - SvLBoxEntry* pTarget = GetEntry( aDocPos ); - if( !pTarget || !pTarget->HasChilds() ) - pTarget = pCurParent; - return pTarget; -} - -SvLBoxEntry* SvImpIconView::GetEntry( const Point& rDocPos ) -{ - CheckBoundingRects(); - SvLBoxEntry* pTarget = 0; - // Z-Order-Liste vom Ende her absuchen - sal_uInt16 nCount = pZOrderList->Count(); - while( nCount ) - { - nCount--; - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nCount)); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( pViewData->aRect.IsInside( rDocPos ) ) - { - pTarget = pEntry; - break; - } - } - return pTarget; -} - -SvLBoxEntry* SvImpIconView::GetNextEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry ) -{ - CheckBoundingRects(); - SvLBoxEntry* pTarget = 0; - sal_uInt16 nStartPos = pZOrderList->GetPos( (void*)pCurEntry ); - if( nStartPos != USHRT_MAX ) - { - sal_uInt16 nCount = pZOrderList->Count(); - for( sal_uInt16 nCur = nStartPos+1; nCur < nCount; nCur++ ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nCur)); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( pViewData->aRect.IsInside( rDocPos ) ) - { - pTarget = pEntry; - break; - } - } - } - return pTarget; -} - -SvLBoxEntry* SvImpIconView::GetPrevEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry ) -{ - CheckBoundingRects(); - SvLBoxEntry* pTarget = 0; - sal_uInt16 nStartPos = pZOrderList->GetPos( (void*)pCurEntry ); - if( nStartPos != USHRT_MAX && nStartPos != 0 ) - { - nStartPos--; - do - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nStartPos)); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( pViewData->aRect.IsInside( rDocPos ) ) - { - pTarget = pEntry; - break; - } - } while( nStartPos > 0 ); - } - return pTarget; -} - - -Point SvImpIconView::GetEntryPosition( SvLBoxEntry* pEntry ) -{ - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - DBG_ASSERT(pViewData,"Entry not in model"); - return pViewData->aRect.TopLeft(); -} - -const Rectangle& SvImpIconView::GetBoundingRect( SvLBoxEntry* pEntry, SvIcnVwDataEntry* pViewData ) -{ - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - DBG_ASSERT(pViewData,"Entry not in model"); - if( !IsBoundingRectValid( pViewData->aRect )) - FindBoundingRect( pEntry, pViewData ); - return pViewData->aRect; -} - -void SvImpIconView::SetSpaceBetweenEntries( long nHor, long nVer ) -{ - nHorDist = nHor; - nVerDist = nVer; -} - -Rectangle SvImpIconView::CalcBmpRect( SvLBoxEntry* pEntry, const Point* pPos, - SvIcnVwDataEntry* pViewData ) -{ - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - - Rectangle aBound = GetBoundingRect( pEntry, pViewData ); - if( pPos ) - aBound.SetPos( *pPos ); - Point aPos( aBound.TopLeft() ); - - switch( nViewMode ) - { - case VIEWMODE_ICON: - { - aPos.X() += ( aBound.GetWidth() - nMaxBmpWidth ) / 2; - Size aSize( nMaxBmpWidth, nMaxBmpHeight ); - // das Bitmap-Rechteck soll nicht das TextRect beruehren - aSize.Height() -= 3; - return Rectangle( aPos, aSize ); - } - - case VIEWMODE_NAME: - return Rectangle( aPos, - Size( nMaxBmpWidth, aBound.GetHeight() )); - - case VIEWMODE_TEXT: - return Rectangle( aPos, aBound.GetSize() ); - - default: - { - Rectangle aRect; - return aRect; - } - } -} - -Rectangle SvImpIconView::CalcTextRect( SvLBoxEntry* pEntry, - SvLBoxString* pItem, const Point* pPos, sal_Bool bForInplaceEdit, - SvIcnVwDataEntry* pViewData ) -{ - long nBmpHeight, nBmpWidth; - - if( !pItem ) - pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - - Size aTextSize( GetItemSize( pView, pEntry, pItem, pViewData )); - aTextSize.Width() += 2*LROFFS_TEXT; - - Size aContextBmpSize(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,pEntry)); - Rectangle aBound = GetBoundingRect( pEntry, pViewData ); - if( pPos ) - aBound.SetPos( *pPos ); - Point aPos( aBound.TopLeft() ); - - switch( nViewMode ) - { - case VIEWMODE_ICON: - nBmpHeight = aContextBmpSize.Height(); - if( nBmpHeight < nMaxBmpHeight ) - nBmpHeight = nMaxBmpHeight; - aPos.Y() += nBmpHeight; - - // beim Inplace-Editieren, spendieren wir ein bisschen mehr Platz - if( bForInplaceEdit ) - { - // 20% rauf - long nMinWidth = (( (aContextBmpSize.Width()*10) / 100 ) * 2 ) + - aContextBmpSize.Width(); - if( nMinWidth > aBound.GetWidth() ) - nMinWidth = aBound.GetWidth(); - - if( aTextSize.Width() < nMinWidth ) - aTextSize.Width() = nMinWidth; - - // beim Inplace-Ed. darfs auch untere Eintraege ueberlappen - Rectangle aMaxGridTextRect = CalcMaxTextRect(pEntry, pViewData); - Size aOptSize = aMaxGridTextRect.GetSize(); - if( aOptSize.Height() > aTextSize.Height() ) - aTextSize.Height() = aOptSize.Height(); - } - - - aPos.X() += ( aBound.GetWidth() - aTextSize.Width() ) / 2; - break; - - case VIEWMODE_NAME: - nBmpWidth = aContextBmpSize.Width(); - if( nBmpWidth < nMaxBmpWidth ) - nBmpWidth = nMaxBmpWidth; - aPos.X() += nBmpWidth; - // vertikal ausrichten - aPos.Y() += ( nBmpWidth - aTextSize.Height() ) / 2; - break; - } - - Rectangle aRect( aPos, aTextSize ); -// KNALLT BEIM D&D, WENN GECLIPPT WIRD (In DrawText von Thomas) -// ClipAtVirtOutRect( aRect ); - return aRect; -} - - -long SvImpIconView::CalcBoundingWidth( SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) const -{ - DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP),"No Bitmaps"); - DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),"No Text"); - long nStringWidth = GetItemSize( pView, pEntry, pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),pViewData).Width(); - nStringWidth += 2*LROFFS_TEXT; - long nBmpWidth = pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,pEntry).Width(); - long nWidth = 0; - - switch( nViewMode ) - { - case VIEWMODE_ICON: - nWidth = Max( nStringWidth, nBmpWidth ); - nWidth = Max( nWidth, nMaxBmpWidth ); - break; - - case VIEWMODE_NAME: - nWidth = Max( nBmpWidth, nMaxBmpWidth ); - nWidth += NAMEVIEW_OFFS_BMP_STRING; // Abstand Bitmap String - nWidth += nStringWidth; - break; - - case VIEWMODE_TEXT: - nWidth = nStringWidth; - break; - } - return nWidth; -} - -long SvImpIconView::CalcBoundingHeight( SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) const -{ - DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP),"No Bitmaps"); - DBG_ASSERT(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),"No Text"); - long nStringHeight = GetItemSize(pView,pEntry,pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING),pViewData).Height(); - long nBmpHeight = pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,pEntry).Height(); - long nHeight = 0; - - switch( nViewMode ) - { - case VIEWMODE_ICON: - nHeight = Max( nBmpHeight, nMaxBmpHeight ); - nHeight += ICONVIEW_OFFS_BMP_STRING; // Abstand Bitmap String - nHeight += nStringHeight; - break; - - case VIEWMODE_NAME: - nHeight = Max( nBmpHeight, nMaxBmpHeight ); - nHeight = Max( nHeight, nStringHeight ); - break; - - case VIEWMODE_TEXT: - nHeight = nStringHeight; - break; - } - if( nHeight > nMaxBoundHeight ) - { - ((SvImpIconView*)this)->nMaxBoundHeight = nHeight; - ((SvImpIconView*)this)->aHorSBar.SetLineSize( nHeight / 2 ); - ((SvImpIconView*)this)->aVerSBar.SetLineSize( nHeight / 2 ); - } - return nHeight; -} - -Size SvImpIconView::CalcBoundingSize( SvLBoxEntry* pEntry, - SvIcnVwDataEntry* pViewData ) const -{ - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - return Size( CalcBoundingWidth(pEntry,pViewData), - CalcBoundingHeight(pEntry,pViewData) ); -} - -void SvImpIconView::RecalcAllBoundingRects() -{ - nMaxBoundHeight = 0; - pZOrderList->Remove(0, pZOrderList->Count() ); - SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent ); - while( pEntry ) - { - FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, pZOrderList->Count() ); - pEntry = pModel->NextSibling( pEntry ); - } - bMustRecalcBoundingRects = sal_False; - AdjustScrollBars(); -} - -void SvImpIconView::RecalcAllBoundingRectsSmart() -{ - nMaxBoundHeight = 0; - pZOrderList->Remove(0, pZOrderList->Count() ); - SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent ); - while( pEntry ) - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( IsBoundingRectValid( pViewData->aRect )) - { - Size aBoundSize( pViewData->aRect.GetSize() ); - if( aBoundSize.Height() > nMaxBoundHeight ) - nMaxBoundHeight = aBoundSize.Height(); - pZOrderList->Insert( pEntry, pZOrderList->Count() ); - } - else - { - FindBoundingRect( pEntry, pViewData ); - } - pZOrderList->Insert( pEntry, pZOrderList->Count() ); - pEntry = pModel->NextSibling( pEntry ); - } - AdjustScrollBars(); -} - -void SvImpIconView::UpdateBoundingRects() -{ - SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent ); - while( pEntry ) - { - GetBoundingRect( pEntry ); - pEntry = pModel->NextSibling( pEntry ); - } -} - -void SvImpIconView::FindBoundingRect( SvLBoxEntry* pEntry, - SvIcnVwDataEntry* pViewData ) -{ - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - - Size aSize( CalcBoundingSize( pEntry, pViewData ) ); - Point aPos; - - DBG_ASSERT(!pViewData->IsEntryPosLocked(),"Locked entry pos in FindBoundingRect"); - // damits in der IconView nicht drunter & drueber geht - if( pViewData->IsEntryPosLocked() && IsBoundingRectValid(pViewData->aRect) ) - { - AdjustVirtSize( pViewData->aRect ); - return; - } - - aPos = FindNextEntryPos( aSize ); - - if( nFlags & F_GRIDMODE ) - { - Rectangle aGridRect( aPos, Size(nGridDX, nGridDY) ); - pViewData->aGridRect = aGridRect; - Center( pEntry, pViewData ); - AdjustVirtSize( pViewData->aRect ); - pImpCursor->SetGridUsed( pViewData->aRect ); - } - else - { - pViewData->aRect = Rectangle( aPos, aSize ); - AdjustVirtSize( pViewData->aRect ); - } -} - - -void SvImpIconView::SetCursor( SvLBoxEntry* pEntry ) -{ - if( pEntry == pCursor ) - return; - - ShowCursor( sal_False ); - if( pCursor ) - { - pView->SetEntryFocus( pCursor, sal_False ); - if( pView->GetSelectionMode() == SINGLE_SELECTION ) - pView->Select( pCursor, sal_False ); - } - pCursor = pEntry; - ToTop( pCursor ); - if( pCursor ) - { - pView->SetEntryFocus(pCursor, sal_True ); - if( pView->GetSelectionMode() == SINGLE_SELECTION ) - pView->Select( pCursor, sal_True ); - ShowCursor( sal_True ); - } -} - - -void SvImpIconView::ShowCursor( sal_Bool bShow ) -{ - if( !pCursor || !bShow || !pView->HasFocus() ) - { - pView->HideFocus(); - return; - } - Rectangle aRect ( CalcFocusRect( pCursor ) ); - pView->ShowFocus( aRect ); -} - - -void SvImpIconView::HideDDIcon() -{ - pView->Update(); - ImpHideDDIcon(); - pDDBufDev = pDDDev; - pDDDev = 0; -} - -void SvImpIconView::ImpHideDDIcon() -{ - if( pDDDev ) - { - Size aSize( pDDDev->GetOutputSizePixel() ); - // pView restaurieren - pView->DrawOutDev( aDDLastRectPos, aSize, Point(), aSize, *pDDDev ); - } -} - - -void SvImpIconView::ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPosPix ) -{ - pView->Update(); - if( pRefEntry != pDDRefEntry ) - { - DELETEZ(pDDDev); - DELETEZ(pDDBufDev); - } - sal_Bool bSelected = pView->SvListView::Select( pRefEntry, sal_False ); - if( !pDDDev ) - { - if( pDDBufDev ) - { - // nicht bei jedem Move ein Device anlegen, da dies besonders - // auf Remote-Clients zu langsam ist - pDDDev = pDDBufDev; - pDDBufDev = 0; - } - else - { - pDDDev = new VirtualDevice( *pView ); - pDDDev->SetFont( pView->GetFont() ); - } - } - else - { - ImpHideDDIcon(); - } - const Rectangle& rRect = GetBoundingRect( pRefEntry ); - pDDDev->SetOutputSizePixel( rRect.GetSize() ); - - Point aPos( rPosPix ); - CalcDocPos( aPos ); - - Size aSize( pDDDev->GetOutputSizePixel() ); - pDDRefEntry = pRefEntry; - aDDLastEntryPos = aPos; - aDDLastRectPos = aPos; - - // Hintergrund sichern - pDDDev->DrawOutDev( Point(), aSize, aPos, aSize, *pView ); - // Icon in pView malen - nFlags |= F_NO_EMPHASIS; - PaintEntry( pRefEntry, aPos ); - nFlags &= ~F_NO_EMPHASIS; - if( bSelected ) - pView->SvListView::Select( pRefEntry, sal_True ); -} - -void SvImpIconView::HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPosPix ) -{ -/* In Notfaellen folgenden flackernden Code aktivieren: - - HideDDIcon(); - ShowDDIcon( pRefEntry, rPosPix ); - return; -*/ - if( !pDDDev ) - { - ShowDDIcon( pRefEntry, rPosPix ); - return; - } - - if( pRefEntry != pDDRefEntry ) - { - HideDDIcon(); - ShowDDIcon( pRefEntry, rPosPix ); - return; - } - - Point aEmptyPoint; - - Point aCurEntryPos( rPosPix ); - CalcDocPos( aCurEntryPos ); - - const Rectangle& rRect = GetBoundingRect( pRefEntry ); - Size aEntrySize( rRect.GetSize() ); - Rectangle aPrevEntryRect( aDDLastEntryPos, aEntrySize ); - Rectangle aCurEntryRect( aCurEntryPos, aEntrySize ); - - if( !aPrevEntryRect.IsOver( aCurEntryRect ) ) - { - HideDDIcon(); - ShowDDIcon( pRefEntry, rPosPix ); - return; - } - - // Ueberlappung des neuen und alten D&D-Pointers! - - Rectangle aFullRect( aPrevEntryRect.Union( aCurEntryRect ) ); - if( !pDDTempDev ) - { - pDDTempDev = new VirtualDevice( *pView ); - pDDTempDev->SetFont( pView->GetFont() ); - } - - Size aFullSize( aFullRect.GetSize() ); - Point aFullPos( aFullRect.TopLeft() ); - - pDDTempDev->SetOutputSizePixel( aFullSize ); - - // Hintergrund (mit dem alten D&D-Pointer!) sichern - pDDTempDev->DrawOutDev( aEmptyPoint, aFullSize, aFullPos, aFullSize, *pView ); - // den alten Buffer in den neuen Buffer pasten - aDDLastRectPos = aDDLastRectPos - aFullPos; - - pDDTempDev->DrawOutDev( - aDDLastRectPos, - pDDDev->GetOutputSizePixel(), - aEmptyPoint, - pDDDev->GetOutputSizePixel(), - *pDDDev ); - - // Swap - VirtualDevice* pTemp = pDDDev; - pDDDev = pDDTempDev; - pDDTempDev = pTemp; - - // in den restaurierten Hintergrund den neuen D&D-Pointer zeichnen - pDDTempDev->SetOutputSizePixel( pDDDev->GetOutputSizePixel() ); - pDDTempDev->DrawOutDev( - aEmptyPoint, aFullSize, aEmptyPoint, aFullSize, *pDDDev ); - Point aRelPos = aCurEntryPos - aFullPos; - nFlags |= F_NO_EMPHASIS; - PaintEntry( pRefEntry, aRelPos, 0, pDDTempDev ); - nFlags &= ~F_NO_EMPHASIS; - - aDDLastRectPos = aFullPos; - aDDLastEntryPos = aCurEntryPos; - - pView->DrawOutDev( - aDDLastRectPos, - pDDDev->GetOutputSizePixel(), - aEmptyPoint, - pDDDev->GetOutputSizePixel(), - *pDDTempDev ); - - sal_Bool bSelected = pView->SvListView::Select( pRefEntry, sal_False ); - if( bSelected ) - pView->SvListView::Select( pRefEntry, sal_True ); -} - -void SvImpIconView::ShowTargetEmphasis( SvLBoxEntry* pEntry, sal_Bool ) -{ - CheckBoundingRects(); - Rectangle aRect; - if( pEntry != pCurParent && - (pEntry->HasChilds() || pEntry->HasChildsOnDemand()) ) - aRect = CalcBmpRect( pEntry ); - else - { - aRect.SetSize( aOutputSize ); - const MapMode& rMapMode = pView->GetMapMode(); - Point aOrigin( rMapMode.GetOrigin()); - aOrigin *= -1; // in Doc-Koord wandeln - aRect.SetPos( aOrigin ); - aRect.Left()++; aRect.Top()++; - aRect.Right()--; aRect.Bottom()--; - } - ImpDrawXORRect( aRect ); -} - -sal_Bool SvImpIconView::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewPar, sal_uLong& rNewChildPos ) -{ - if( pTarget == pCurParent && pModel->GetParent(pEntry) == pCurParent ) - { - // D&D innerhalb einer Childlist - StopEditTimer(); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - Size aSize( pViewData->aRect.GetSize() ); - Point aNewPos = FindNextEntryPos( aSize ); - AdjustVirtSize( Rectangle( aNewPos, aSize ) ); - SetEntryPosition( pEntry, aNewPos, sal_False, sal_True ); - return sal_False; - } - return pView->SvLBox::NotifyMoving(pTarget,pEntry,rpNewPar,rNewChildPos); -} - -sal_Bool SvImpIconView::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ) -{ - return pView->SvLBox::NotifyCopying(pTarget,pEntry,rpNewParent,rNewChildPos); -} - -void SvImpIconView::WriteDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo) -{ - SvLBoxEntry* pCurEntry = GetCurEntry(); - Point aEntryPos; - if( pCurEntry ) - { - aEntryPos = rPos; - aEntryPos -= GetEntryPosition( pCurEntry ); - } - pInfo->nMouseRelX = aEntryPos.X(); - pInfo->nMouseRelY = aEntryPos.Y(); -} - -void SvImpIconView::ReadDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo ) -{ - Point aDropPos( rPos ); - aDropPos.X() -= pInfo->nMouseRelX; - aDropPos.Y() -= pInfo->nMouseRelY; - SetNextEntryPos( aDropPos ); -} - -void SvImpIconView::InvalidateBoundingRect( SvLBoxEntry* pEntry ) -{ - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - InvalidateBoundingRect( pViewData->aRect ); -} - -void SvImpIconView::PrepareCommandEvent( const Point& rPt ) -{ - aMouseMoveTimer.Stop(); - StopEditTimer(); - nFlags |= F_CMD_ARRIVED; - SvLBoxEntry* pEntry = pView->GetEntry( rPt, sal_True ); - if( (nFlags & F_DOWN_CTRL) && pEntry && !pView->IsSelected(pEntry) ) - pView->Select( pEntry, sal_True ); - nFlags &= ~(F_DOWN_CTRL | F_DOWN_DESELECT); -} - -void SvImpIconView::SttDrag( const Point& rPos ) -{ - PrepareCommandEvent( rPos ); - - nFlags |= F_DRAG_SOURCE; - ShowCursor( sal_False ); -} - -void SvImpIconView::EndDrag() -{ - ShowCursor( sal_True ); - nFlags &= (~F_DRAG_SOURCE); -} - -void SvImpIconView::ToTop( SvLBoxEntry* pEntry ) -{ - DBG_ASSERT(pZOrderList->GetPos(pEntry)!=0xffff,"ToTop:ZOrder?"); - if( pZOrderList->GetObject( pZOrderList->Count() -1 ) != pEntry ) - { - sal_uInt16 nPos = pZOrderList->GetPos( (void*)pEntry ); - pZOrderList->Remove( nPos, 1 ); - pZOrderList->Insert( pEntry, pZOrderList->Count() ); - } -} - -void SvImpIconView::SetCurParent( SvLBoxEntry* pNewParent ) -{ - Clear(); - pCurParent = pNewParent; - ImpArrange(); -} - -void SvImpIconView::ClipAtVirtOutRect( Rectangle& rRect ) const -{ - if( rRect.Bottom() >= aVirtOutputSize.Height() ) - rRect.Bottom() = aVirtOutputSize.Height() - 1; - if( rRect.Right() >= aVirtOutputSize.Width() ) - rRect.Right() = aVirtOutputSize.Width() - 1; - if( rRect.Top() < 0 ) - rRect.Top() = 0; - if( rRect.Left() < 0 ) - rRect.Left() = 0; -} - -// rRect: Bereich des Dokumentes (in Dokumentkoordinaten), der -// sichtbar gemacht werden soll. -// bScrBar == sal_True: Das Rect wurde aufgrund eines ScrollBar-Events berechnet - -void SvImpIconView::MakeVisible( const Rectangle& rRect, sal_Bool bScrBar ) -{ - Rectangle aRect( rRect ); - ClipAtVirtOutRect( aRect ); - MapMode aMapMode( pView->GetMapMode() ); - Point aOrigin( aMapMode.GetOrigin() ); - // in Dokumentkoordinate umwandeln - aOrigin *= -1; - - Rectangle aOutputArea( aOrigin, aOutputSize ); - if( aOutputArea.IsInside( aRect ) ) - return; // ist schon sichtbar - - long nDy; - if( aRect.Top() < aOutputArea.Top() ) - { - // nach oben scrollen (nDy < 0) - nDy = aRect.Top() - aOutputArea.Top(); - } - else if( aRect.Bottom() > aOutputArea.Bottom() ) - { - // nach unten scrollen (nDy > 0) - nDy = aRect.Bottom() - aOutputArea.Bottom(); - } - else - nDy = 0; - - long nDx; - if( aRect.Left() < aOutputArea.Left() ) - { - // nach links scrollen (nDx < 0) - nDx = aRect.Left() - aOutputArea.Left(); - } - else if( aRect.Right() > aOutputArea.Right() ) - { - // nach rechts scrollen (nDx > 0) - nDx = aRect.Right() - aOutputArea.Right(); - } - else - nDx = 0; - - aOrigin.X() += nDx; - aOrigin.Y() += nDy; - aOutputArea.SetPos( aOrigin ); - - pView->Update(); - - // Origin fuer SV invertieren (damit wir in - // Dokumentkoordinaten scrollen/painten koennen) - aOrigin *= -1; - aMapMode.SetOrigin( aOrigin ); - pView->SetMapMode( aMapMode ); - - // in umgekehrte Richtung scrollen! - pView->Control::Scroll( -nDx, -nDy, aOutputArea, sal_True ); - if( aHorSBar.IsVisible() || aVerSBar.IsVisible() ) - { - if( !bScrBar ) - { - aOrigin *= -1; - // Thumbs korrigieren - if(aHorSBar.IsVisible() && aHorSBar.GetThumbPos() != aOrigin.X()) - aHorSBar.SetThumbPos( aOrigin.X() ); - if(aVerSBar.IsVisible() && aVerSBar.GetThumbPos() != aOrigin.Y()) - aVerSBar.SetThumbPos( aOrigin.Y() ); - } - } - // pruefen, ob ScrollBars noch benoetigt werden - CheckScrollBars(); - pView->Update(); -} - - -SvLBoxEntry* SvImpIconView::GetNewCursor() -{ - SvLBoxEntry* pNewCursor; - if( pCursor ) - { - pNewCursor = pImpCursor->GoLeftRight( pCursor, sal_False ); - if( !pNewCursor ) - { - pNewCursor = pImpCursor->GoLeftRight( pCursor, sal_True ); - if( !pNewCursor ) - { - pNewCursor = pImpCursor->GoUpDown( pCursor, sal_False ); - if( !pNewCursor ) - pNewCursor = pImpCursor->GoUpDown( pCursor, sal_True ); - } - } - } - else - pNewCursor = pModel->FirstChild( pCurParent ); - DBG_ASSERT(!pNewCursor|| (pCursor&&pCursor!=pNewCursor),"GetNewCursor failed"); - return pNewCursor; -} - - -sal_uInt16 SvImpIconView:: GetSelectionCount() const -{ - sal_uInt16 nSelected = 0; - SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent); - while( pEntry ) - { - if( pView->IsSelected( pEntry ) ) - nSelected++; - pEntry = pModel->NextSibling( pEntry ); - } - return nSelected; -} - - -void SvImpIconView::ToggleSelection( SvLBoxEntry* pEntry ) -{ - sal_Bool bSel; - if( pView->IsSelected( pEntry ) ) - bSel = sal_False; - else - bSel = sal_True; - pView->Select( pEntry, bSel ); -} - -void SvImpIconView::DeselectAllBut( SvLBoxEntry* pThisEntryNot ) -{ - ClearSelectedRectList(); - SvLBoxEntry* pEntry = pModel->FirstChild( pCurParent ); - while( pEntry ) - { - if( pEntry != pThisEntryNot && pView->IsSelected( pEntry )) - pView->Select( pEntry, sal_False ); - pEntry = pModel->NextSibling( pEntry ); - } -} - -#define ICN_ROWS 50 -#define ICN_COLS 30 - -ImpIcnCursor::ImpIcnCursor( SvImpIconView* pOwner ) -{ - pView = pOwner; - pColumns = 0; - pRows = 0; - pCurEntry = 0; - nDeltaWidth = 0; - nDeltaHeight= 0; - nCols = 0; - nRows = 0; - nGridCols = 0; - nGridRows = 0; - pGridMap = 0; -} - -ImpIcnCursor::~ImpIcnCursor() -{ - delete[] pColumns; - delete[] pRows; - delete pGridMap; -} - -sal_uInt16 ImpIcnCursor::GetSortListPos( SvPtrarr* pList, long nValue, - int bVertical ) -{ - sal_uInt16 nCount = (sal_uInt16)pList->Count(); - if( !nCount ) - return 0; - - sal_uInt16 nCurPos = 0; - long nPrevValue = LONG_MIN; - while( nCount ) - { - const Rectangle& rRect= - pView->GetBoundingRect((SvLBoxEntry*)(pList->GetObject(nCurPos))); - long nCurValue; - if( bVertical ) - nCurValue = rRect.Top(); - else - nCurValue = rRect.Left(); - if( nValue >= nPrevValue && nValue <= nCurValue ) - return (sal_uInt16)nCurPos; - nPrevValue = nCurValue; - nCount--; - nCurPos++; - } - return pList->Count(); -} - -void ImpIcnCursor::ImplCreate() -{ - pView->CheckBoundingRects(); - DBG_ASSERT(pColumns==0&&pRows==0,"ImplCreate: Not cleared"); - - SetDeltas(); - - pColumns = new SvPtrarr[ nCols ]; - pRows = new SvPtrarr[ nRows ]; - - DELETEZ(pGridMap); - - SvLBoxTreeList* pModel = pView->pModel; - SvLBoxEntry* pEntry = pModel->FirstChild( pView->pCurParent ); - while( pEntry ) - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry); - // const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - Rectangle rRect( pView->CalcBmpRect( pEntry,0,pViewData ) ); - short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / nDeltaHeight ); - short nX = (short)( ((rRect.Left()+rRect.Right())/2) / nDeltaWidth ); - - // Rundungsfehler abfangen - if( nY >= nRows ) - nY = sal::static_int_cast< short >(nRows - 1); - if( nX >= nCols ) - nX = sal::static_int_cast< short >(nCols - 1); - - sal_uInt16 nIns = GetSortListPos( &pColumns[nX], rRect.Top(), sal_True ); - pColumns[ nX ].Insert( pEntry, nIns ); - - nIns = GetSortListPos( &pRows[nY], rRect.Left(), sal_False ); - pRows[ nY ].Insert( pEntry, nIns ); - - pViewData->nX = nX; - pViewData->nY = nY; - - pEntry = pModel->NextSibling( pEntry ); - } -} - -void ImpIcnCursor::CreateGridMap() -{ - if( pGridMap ) - return; - - const Size& rSize = pView->aVirtOutputSize; - long nWidth = rSize.Width(); - if( nWidth < pView->nMaxVirtWidth ) - nWidth = pView->nMaxVirtWidth; - nWidth -= 2*LROFFS_WINBORDER; - if( nWidth <= 0 ) - nWidth = 1; - - nGridDX = pView->nGridDX; - nGridDY = pView->nGridDY; - - // Hinweis: Wegen der Abrundung bei Berechnung von nGridCols - // ist es moeglich, dass Eintrage nicht im Grid liegen. Diese - // wurden typischerweise manuell verschoben und gelockt - nGridCols = nWidth / nGridDX; - if( !nGridCols ) nGridCols = 1; - - nGridRows = rSize.Height() / nGridDY; - // nRows nicht abrunden, da zur Vermeidung von Ueberlappungen - // das gesamte BoundingRect des Eintrags zur Markierung im Grid - // herangezogen wird. - if( (nGridRows * nGridDY) < rSize.Height() ) - nGridRows++; - else if( !nGridRows ) - nGridRows = 1; - - //XXX - //nGridRows += 50; // in fuenfziger-Schritten - - pGridMap = new sal_Bool[ nGridRows*nGridCols]; - memset( (void*)pGridMap, 0, nGridRows*nGridCols ); - - SvLBoxTreeList* pModel = pView->pModel; - SvLBoxEntry* pEntry = pModel->FirstChild( pView->pCurParent ); - while( pEntry ) - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry); - const Rectangle& rRect = pViewData->aRect; - // nur, wenn der Entry schon plaziert ist - if( pView->IsBoundingRectValid( rRect )) - { - // Alle vom Eintrag beruehrten Grids kennzeichnen - SetGridUsed( pView->GetBoundingRect( pEntry, pViewData ) ); - } - pEntry = pModel->NextSibling( pEntry ); - } -} - -sal_Bool ImpIcnCursor::GetGrid( const Point& rDocPos, sal_uInt16& rGridX, sal_uInt16& rGridY ) const -{ - Point aPos( rDocPos ); - aPos.X() -= LROFFS_WINBORDER; - aPos.Y() -= TBOFFS_WINBORDER; - rGridX = (sal_uInt16)(aPos.X() / nGridDX); - rGridY = (sal_uInt16)(aPos.Y() / nGridDY); - sal_Bool bInGrid = sal_True; - if( rGridX >= nGridCols ) - { - rGridX = sal::static_int_cast< sal_uInt16 >(nGridCols - 1); - bInGrid = sal_False; - } - if( rGridY >= nGridRows ) - { - rGridY = sal::static_int_cast< sal_uInt16 >(nGridRows - 1); - if( !bInGrid ) - return sal_False; // beide Koordinaten nicht im Grid - } - return sal_True; -} - -void ImpIcnCursor::SetGridUsed( const Rectangle& rRect, sal_Bool bUsed ) -{ - CreateGridMap(); - sal_uInt16 nTLX, nTLY, nBRX, nBRY; - - sal_Bool bTLInGrid = GetGrid( rRect.TopLeft(), nTLX, nTLY ); - sal_Bool bBRInGrid = GetGrid( rRect.BottomRight(), nBRX, nBRY ); - - if( !bTLInGrid && !bBRInGrid ) - return; - - for( sal_uInt16 nCurY = nTLY; nCurY <= nBRY; nCurY++ ) - { - for( sal_uInt16 nCurX = nTLX; nCurX <= nBRX; nCurX++ ) - { - SetGridUsed( nCurX, nCurY, bUsed ); - } - } -} - -void ImpIcnCursor::Clear( sal_Bool bGridToo ) -{ - if( pColumns ) - { - delete[] pColumns; - delete[] pRows; - pColumns = 0; - pRows = 0; - pCurEntry = 0; - nDeltaWidth = 0; - nDeltaHeight = 0; - } - if( bGridToo && pGridMap ) - { - DELETEZ(pGridMap); - nGridRows = 0; - nGridCols = 0; - } -} - -SvLBoxEntry* ImpIcnCursor::SearchCol(sal_uInt16 nCol,sal_uInt16 nTop,sal_uInt16 nBottom, - sal_uInt16, sal_Bool bDown, sal_Bool bSimple ) -{ - DBG_ASSERT(pCurEntry,"SearchCol: No reference entry"); - SvPtrarr* pList = &(pColumns[ nCol ]); - sal_uInt16 nCount = pList->Count(); - if( !nCount ) - return 0; - - const Rectangle& rRefRect = pView->GetBoundingRect(pCurEntry); - - if( bSimple ) - { - sal_uInt16 nListPos = pList->GetPos( pCurEntry ); - DBG_ASSERT(nListPos!=0xffff,"Entry not in Col-List"); - if( bDown ) - { - while( nListPos < nCount-1 ) - { - nListPos++; - SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos ); - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - if( rRect.Top() > rRefRect.Top() ) - return pEntry; - } - return 0; - } - else - { - while( nListPos ) - { - nListPos--; - if( nListPos < nCount ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos ); - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - if( rRect.Top() < rRefRect.Top() ) - return pEntry; - } - } - return 0; - } - } - - if( nTop > nBottom ) - { - sal_uInt16 nTemp = nTop; - nTop = nBottom; - nBottom = nTemp; - } - long nMinDistance = LONG_MAX; - SvLBoxEntry* pResult = 0; - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pList->GetObject( nCur )); - if( pEntry != pCurEntry ) - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry); - sal_uInt16 nY = pViewData->nY; - if( nY >= nTop && nY <= nBottom ) - { - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - long nDistance = rRect.Top() - rRefRect.Top(); - if( nDistance < 0 ) - nDistance *= -1; - if( nDistance && nDistance < nMinDistance ) - { - nMinDistance = nDistance; - pResult = pEntry; - } - } - } - } - return pResult; -} - -SvLBoxEntry* ImpIcnCursor::SearchRow(sal_uInt16 nRow,sal_uInt16 nLeft,sal_uInt16 nRight, - sal_uInt16, sal_Bool bRight, sal_Bool bSimple ) -{ - DBG_ASSERT(pCurEntry,"SearchRow: No reference entry"); - SvPtrarr* pList = &(pRows[ nRow ]); - sal_uInt16 nCount = pList->Count(); - if( !nCount ) - return 0; - - const Rectangle& rRefRect = pView->GetBoundingRect(pCurEntry); - - if( bSimple ) - { - sal_uInt16 nListPos = pList->GetPos( pCurEntry ); - DBG_ASSERT(nListPos!=0xffff,"Entry not in Row-List"); - if( bRight ) - { - while( nListPos < nCount-1 ) - { - nListPos++; - SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos ); - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - if( rRect.Left() > rRefRect.Left() ) - return pEntry; - } - return 0; - } - else - { - while( nListPos ) - { - nListPos--; - if( nListPos < nCount ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)pList->GetObject( nListPos ); - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - if( rRect.Left() < rRefRect.Left() ) - return pEntry; - } - } - return 0; - } - - } - if( nRight < nLeft ) - { - sal_uInt16 nTemp = nRight; - nRight = nLeft; - nLeft = nTemp; - } - long nMinDistance = LONG_MAX; - SvLBoxEntry* pResult = 0; - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pList->GetObject( nCur )); - if( pEntry != pCurEntry ) - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pEntry); - sal_uInt16 nX = pViewData->nX; - if( nX >= nLeft && nX <= nRight ) - { - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - long nDistance = rRect.Left() - rRefRect.Left(); - if( nDistance < 0 ) - nDistance *= -1; - if( nDistance && nDistance < nMinDistance ) - { - nMinDistance = nDistance; - pResult = pEntry; - } - } - } - } - return pResult; -} - - - -/* - Sucht ab dem uebergebenen Eintrag den naechsten rechts- bzw. - linksstehenden. Suchverfahren am Beispiel bRight = sal_True: - - c - b c - a b c - S 1 1 1 ====> Suchrichtung - a b c - b c - c - - S : Startposition - 1 : erstes Suchrechteck - a,b,c : 2., 3., 4. Suchrechteck -*/ - -SvLBoxEntry* ImpIcnCursor::GoLeftRight( SvLBoxEntry* pIcnEntry, sal_Bool bRight ) -{ - SvLBoxEntry* pResult; - pCurEntry = pIcnEntry; - Create(); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pIcnEntry); - sal_uInt16 nY = pViewData->nY; - sal_uInt16 nX = pViewData->nX; - DBG_ASSERT(nY< nRows,"GoLeftRight:Bad column"); - DBG_ASSERT(nX< nCols,"GoLeftRight:Bad row"); - // Nachbar auf gleicher Zeile ? - if( bRight ) - pResult = SearchRow( - nY, nX, sal::static_int_cast< sal_uInt16 >(nCols-1), nX, sal_True, sal_True ); - else - pResult = SearchRow( nY, nX ,0, nX, sal_False, sal_True ); - if( pResult ) - return pResult; - - long nCurCol = nX; - - long nColOffs, nLastCol; - if( bRight ) - { - nColOffs = 1; - nLastCol = nCols; - } - else - { - nColOffs = -1; - nLastCol = -1; // 0-1 - } - - sal_uInt16 nRowMin = nY; - sal_uInt16 nRowMax = nY; - do - { - SvLBoxEntry* pEntry = SearchCol((sal_uInt16)nCurCol,nRowMin,nRowMax,nY,sal_True, sal_False); - if( pEntry ) - return pEntry; - if( nRowMin ) - nRowMin--; - if( nRowMax < (nRows-1)) - nRowMax++; - nCurCol += nColOffs; - } while( nCurCol != nLastCol ); - return 0; -} - -SvLBoxEntry* ImpIcnCursor::GoUpDown( SvLBoxEntry* pIcnEntry, sal_Bool bDown) -{ - SvLBoxEntry* pResult; - pCurEntry = pIcnEntry; - Create(); - SvIcnVwDataEntry* pViewData = ICNVIEWDATA2(pIcnEntry); - sal_uInt16 nY = pViewData->nY; - sal_uInt16 nX = pViewData->nX; - DBG_ASSERT(nY<nRows,"GoUpDown:Bad column"); - DBG_ASSERT(nX<nCols,"GoUpDown:Bad row"); - - // Nachbar in gleicher Spalte ? - if( bDown ) - pResult = SearchCol( - nX, nY, sal::static_int_cast< sal_uInt16 >(nRows-1), nY, sal_True, sal_True ); - else - pResult = SearchCol( nX, nY ,0, nY, sal_False, sal_True ); - if( pResult ) - return pResult; - - long nCurRow = nY; - - long nRowOffs, nLastRow; - if( bDown ) - { - nRowOffs = 1; - nLastRow = nRows; - } - else - { - nRowOffs = -1; - nLastRow = -1; // 0-1 - } - - sal_uInt16 nColMin = nX; - sal_uInt16 nColMax = nX; - do - { - SvLBoxEntry* pEntry = SearchRow((sal_uInt16)nCurRow,nColMin,nColMax,nX,sal_True, sal_False); - if( pEntry ) - return pEntry; - if( nColMin ) - nColMin--; - if( nColMax < (nCols-1)) - nColMax++; - nCurRow += nRowOffs; - } while( nCurRow != nLastRow ); - return 0; -} - -void ImpIcnCursor::SetDeltas() -{ - const Size& rSize = pView->aVirtOutputSize; - if( pView->nFlags & F_GRIDMODE ) - { - nGridDX = pView->nGridDX; - nGridDY = pView->nGridDY; - } - else - { - nGridDX = 20; - nGridDY = 20; - } - nCols = rSize.Width() / nGridDX; - if( !nCols ) - nCols = 1; - nRows = rSize.Height() / nGridDY; - if( (nRows * nGridDY) < rSize.Height() ) - nRows++; - if( !nRows ) - nRows = 1; - - nDeltaWidth = (short)(rSize.Width() / nCols); - nDeltaHeight = (short)(rSize.Height() / nRows); - if( !nDeltaHeight ) - { - nDeltaHeight = 1; - DBG_WARNING("SetDeltas:Bad height"); - } - if( !nDeltaWidth ) - { - nDeltaWidth = 1; - DBG_WARNING("SetDeltas:Bad width"); - } -} - -sal_Bool ImpIcnCursor::FindEmptyGridRect( Rectangle& rRect ) -{ - CreateGridMap(); - sal_uInt16 nCount = (sal_uInt16)(nGridCols * nGridRows); - if( !nCount ) - return sal_False; - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - if( !pGridMap[ nCur ] ) - { - sal_uInt16 nCol = (sal_uInt16)(nCur % nGridCols); - sal_uInt16 nRow = (sal_uInt16)(nCur / nGridCols); - rRect.Top() = nRow * nGridDY + TBOFFS_WINBORDER; - rRect.Bottom() = rRect.Top() + nGridDY; - rRect.Left() = nCol * nGridDX+ LROFFS_WINBORDER; - rRect.Right() = rRect.Left() + nGridDX; - SetGridUsed( nCol, nRow, sal_True ); - - DBG_ASSERT(pGridMap[nCur],"SetGridUsed failed"); - return sal_True; - } - } - // Gridmap ist voll: Um eine Zeile erweitern - rRect.Top() = nGridRows * nGridDY + TBOFFS_WINBORDER; - rRect.Bottom() = rRect.Top() + nGridDY; - rRect.Left() = LROFFS_WINBORDER; - rRect.Right() = rRect.Left() + nGridDX; - return sal_False; -} - -void ImpIcnCursor::CreateGridAjustData( SvPtrarr& rLists, SvLBoxEntry* pRefEntry) -{ - if( !pRefEntry ) - { - sal_uInt16 nAdjustRows = (sal_uInt16)(pView->aVirtOutputSize.Height() / pView->nGridDY); - nAdjustRows++; // wg. Abrundung! - - if( !nAdjustRows ) - return; - for( sal_uInt16 nCurList = 0; nCurList < nAdjustRows; nCurList++ ) - { - SvPtrarr* pRow = new SvPtrarr; - rLists.Insert( (void*)pRow, nCurList ); - } - SvLBoxEntry* pEntry = pView->pModel->FirstChild( pView->pCurParent ); - while( pEntry ) - { - const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); - sal_uInt16 nIns = GetSortListPos((SvPtrarr*)rLists[nY],rRect.Left(),sal_False); - ((SvPtrarr*)rLists[ nY ])->Insert( pEntry, nIns ); - pEntry = pView->pModel->NextSibling( pEntry ); - } - } - else - { - // Aufbau eines hor. "Schlauchs" auf der RefEntry-Zeile - - // UEBERLEGEN: BoundingRect nehmen wg. Ueberlappungen??? - - Rectangle rRefRect( pView->CalcBmpRect( pRefEntry ) ); - //const Rectangle& rRefRect = pView->GetBoundingRect( pRefEntry ); - short nRefRow = (short)( ((rRefRect.Top()+rRefRect.Bottom())/2) / pView->nGridDY ); - SvPtrarr* pRow = new SvPtrarr; - rLists.Insert( (void*)pRow, 0 ); - SvLBoxEntry* pEntry = pView->pModel->FirstChild( pView->pCurParent ); - while( pEntry ) - { - Rectangle rRect( pView->CalcBmpRect(pEntry) ); - //const Rectangle& rRect = pView->GetBoundingRect( pEntry ); - short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / pView->nGridDY ); - if( nY == nRefRow ) - { - sal_uInt16 nIns = GetSortListPos( pRow, rRect.Left(), sal_False ); - pRow->Insert( pEntry, nIns ); - } - pEntry = pView->pModel->NextSibling( pEntry ); - } - } -} - -//static -void ImpIcnCursor::DestroyGridAdjustData( SvPtrarr& rLists ) -{ - sal_uInt16 nCount = rLists.Count(); - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - SvPtrarr* pArr = (SvPtrarr*)rLists[ nCur ]; - delete pArr; - } - rLists.Remove( 0, rLists.Count() ); -} - -void SvImpIconView::SetGrid( long nDX, long nDY ) -{ - nGridDX = nDX; - nGridDY = nDY; - nFlags |= F_GRIDMODE; -} - -Rectangle SvImpIconView::CalcMaxTextRect( const SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) const -{ - Rectangle aRect = pViewData->aGridRect; - long nBmpHeight = ((SvLBoxEntry*)pEntry)->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)->GetSize(pView,(SvLBoxEntry*)pEntry).Height(); - aRect.Top() += nBmpHeight; - aRect.Top() += ICONVIEW_OFFS_BMP_STRING; - if( aRect.Top() > aRect.Bottom()) - aRect.Top() = aRect.Bottom(); - aRect.Left() += LROFFS_BOUND; - aRect.Left()++; - aRect.Right() -= LROFFS_BOUND; - aRect.Right()--; - if( aRect.Left() > aRect.Right()) - aRect.Left() = aRect.Right(); - if( GetTextMode( pEntry, pViewData ) == ShowTextFull ) - aRect.Bottom() = LONG_MAX; - return aRect; -} - -void SvImpIconView::Center( SvLBoxEntry* pEntry, - SvIcnVwDataEntry* pViewData ) const -{ - SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - const String& rEntryText = pStringItem->GetText(); - - Rectangle aTextRect = CalcMaxTextRect(pEntry,pViewData); - aTextRect = GetTextRect( pView, aTextRect, rEntryText, DRAWTEXT_FLAGS ); - pViewData->aTextSize = aTextRect.GetSize(); - - pViewData->aRect = pViewData->aGridRect; - Size aSize( CalcBoundingSize( pEntry, pViewData ) ); - long nBorder = pViewData->aGridRect.GetWidth() - aSize.Width(); - pViewData->aRect.Left() += nBorder / 2; - pViewData->aRect.Right() -= nBorder / 2; - pViewData->aRect.Bottom() = pViewData->aRect.Top() + aSize.Height(); -} - - -// Die Deltas entsprechen Offsets, um die die View auf dem Doc verschoben wird -// links, hoch: Offsets < 0 -// rechts, runter: Offsets > 0 -void SvImpIconView::Scroll( long nDeltaX, long nDeltaY, sal_Bool bScrollBar ) -{ - const MapMode& rMapMode = pView->GetMapMode(); - Point aOrigin( rMapMode.GetOrigin() ); - // in Dokumentkoordinate umwandeln - aOrigin *= -1; - aOrigin.Y() += nDeltaY; - aOrigin.X() += nDeltaX; - Rectangle aRect( aOrigin, aOutputSize ); - MakeVisible( aRect, bScrollBar ); -} - - -const Size& SvImpIconView::GetItemSize( SvIconView* pIconView, - SvLBoxEntry* pEntry, SvLBoxItem* pItem, const SvIcnVwDataEntry* pViewData) const -{ - if( (nFlags & F_GRIDMODE) && pItem->IsA() == SV_ITEM_ID_LBOXSTRING ) - { - if( !pViewData ) - pViewData = ICNVIEWDATA(pEntry); - return pViewData->aTextSize; - } - else - return pItem->GetSize( pIconView, pEntry ); -} - -Rectangle SvImpIconView::CalcFocusRect( SvLBoxEntry* pEntry ) -{ - SvLBoxString* pStringItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - DBG_ASSERT(pStringItem,"Text not set"); - return CalcTextRect( pEntry, pStringItem ); -} - - -void SvImpIconView::SelectRect( const Rectangle& rRect, sal_Bool bAdd, - SvPtrarr* pOtherRects, short nBorderOffs ) -{ - if( !pZOrderList || !pZOrderList->Count() ) - return; - - CheckBoundingRects(); - pView->Update(); - sal_uInt16 nCount = pZOrderList->Count(); - - Rectangle aRect( rRect ); - aRect.Justify(); - if( nBorderOffs ) - { - aRect.Left() -= nBorderOffs; - aRect.Right() += nBorderOffs; - aRect.Top() -= nBorderOffs; - aRect.Bottom() += nBorderOffs; - } - sal_Bool bCalcOverlap = (bAdd && pOtherRects && pOtherRects->Count()) ? sal_True : sal_False; - - for( sal_uInt16 nPos = 0; nPos < nCount; nPos++ ) - { - SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nPos )); - - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - DBG_ASSERT(pViewData,"Entry not in model"); - if( !IsBoundingRectValid( pViewData->aRect )) - FindBoundingRect( pEntry, pViewData ); - const Rectangle& rBoundRect = pViewData->aRect; - sal_Bool bSelected = pViewData->IsSelected(); - - sal_Bool bOverlaps; - if( bCalcOverlap ) - bOverlaps = IsOver( pOtherRects, rBoundRect ); - else - bOverlaps = sal_False; - sal_Bool bOver = aRect.IsOver( rBoundRect ); - - if( bOver && !bOverlaps ) - { - // Ist im neuen Selektionsrechteck und in keinem alten - // => selektieren - if( !bSelected ) - pView->Select( pEntry, sal_True ); - } - else if( !bAdd ) - { - // ist ausserhalb des Selektionsrechtecks - // => Selektion entfernen - if( bSelected ) - pView->Select( pEntry, sal_False ); - } - else if( bAdd && bOverlaps ) - { - // Der Eintrag befindet sich in einem alten (=>Aufspannen - // mehrerer Rechtecke mit Ctrl!) Selektionsrechteck - - // Hier ist noch ein Bug! Der Selektionsstatus eines Eintrags - // in einem vorherigen Rechteck, muss restauriert werden, wenn - // er vom aktuellen Selektionsrechteck beruehrt wurde, jetzt aber - // nicht mehr in ihm liegt. Ich gehe hier der Einfachheit halber - // pauschal davon aus, dass die Eintraege in den alten Rechtecken - // alle selektiert sind. Ebenso ist es falsch, die Schnittmenge - // nur zu deselektieren. - // Loesungsmoeglichkeit: Snapshot der Selektion vor dem Auf- - // spannen des Rechtecks merken - if( rBoundRect.IsOver( rRect)) - { - // Schnittmenge zwischen alten Rects & aktuellem Rect desel. - if( bSelected ) - pView->Select( pEntry, sal_False ); - } - else - { - // Eintrag eines alten Rects selektieren - if( !bSelected ) - pView->Select( pEntry, sal_True ); - } - } - else if( !bOver && bSelected ) - { - // Der Eintrag liegt voellig ausserhalb und wird deshalb desel. - pView->Select( pEntry, sal_False ); - } - } - pView->Update(); -} - -sal_Bool SvImpIconView::IsOver( SvPtrarr* pRectList, const Rectangle& rBoundRect ) const -{ - sal_uInt16 nCount = pRectList->Count(); - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - Rectangle* pRect = (Rectangle*)pRectList->GetObject( nCur ); - if( rBoundRect.IsOver( *pRect )) - return sal_True; - } - return sal_False; -} - -void SvImpIconView::AddSelectedRect( const Rectangle& rRect, short nBorderOffs ) -{ - Rectangle* pRect = new Rectangle( rRect ); - pRect->Justify(); - if( nBorderOffs ) - { - pRect->Left() -= nBorderOffs; - pRect->Right() += nBorderOffs; - pRect->Top() -= nBorderOffs; - pRect->Bottom() += nBorderOffs; - } - aSelectedRectList.Insert( (void*)pRect, aSelectedRectList.Count() ); -} - -void SvImpIconView::ClearSelectedRectList() -{ - sal_uInt16 nCount = aSelectedRectList.Count(); - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - Rectangle* pRect = (Rectangle*)aSelectedRectList.GetObject( nCur ); - delete pRect; - } - aSelectedRectList.Remove( 0, aSelectedRectList.Count() ); -} - - -void SvImpIconView::DrawSelectionRect( const Rectangle& rRect ) -{ - pView->HideTracking(); - nFlags |= F_SELRECT_VISIBLE; - pView->ShowTracking( rRect, SHOWTRACK_SMALL | SHOWTRACK_WINDOW ); - aCurSelectionRect = rRect; -} - -void SvImpIconView::HideSelectionRect() -{ - if( nFlags & F_SELRECT_VISIBLE ) - { - pView->HideTracking(); - nFlags &= ~F_SELRECT_VISIBLE; - } -} - -void SvImpIconView::ImpDrawXORRect( const Rectangle& rRect ) -{ - RasterOp eOldOp = pView->GetRasterOp(); - pView->SetRasterOp( ROP_XOR ); - Color aOldColor = pView->GetFillColor(); - pView->SetFillColor(); - pView->DrawRect( rRect ); - pView->SetFillColor( aOldColor ); - pView->SetRasterOp( eOldOp ); -} - -void SvImpIconView::CalcScrollOffsets( const Point& rPosPixel, - long& rX, long& rY, sal_Bool bInDragDrop, sal_uInt16 nBorderWidth) -{ - // Scrolling der View, falls sich der Mauszeiger im Grenzbereich des - // Fensters befindet - long nPixelToScrollX = 0; - long nPixelToScrollY = 0; - Size aWndSize = aOutputSize; - - nBorderWidth = (sal_uInt16)(Min( (long)(aWndSize.Height()-1), (long)nBorderWidth )); - nBorderWidth = (sal_uInt16)(Min( (long)(aWndSize.Width()-1), (long)nBorderWidth )); - - if ( rPosPixel.X() < nBorderWidth ) - { - if( bInDragDrop ) - nPixelToScrollX = -DD_SCROLL_PIXEL; - else - nPixelToScrollX = rPosPixel.X()- nBorderWidth; - } - else if ( rPosPixel.X() > aWndSize.Width() - nBorderWidth ) - { - if( bInDragDrop ) - nPixelToScrollX = DD_SCROLL_PIXEL; - else - nPixelToScrollX = rPosPixel.X() - (aWndSize.Width() - nBorderWidth); - } - if ( rPosPixel.Y() < nBorderWidth ) - { - if( bInDragDrop ) - nPixelToScrollY = -DD_SCROLL_PIXEL; - else - nPixelToScrollY = rPosPixel.Y() - nBorderWidth; - } - else if ( rPosPixel.Y() > aWndSize.Height() - nBorderWidth ) - { - if( bInDragDrop ) - nPixelToScrollY = DD_SCROLL_PIXEL; - else - nPixelToScrollY = rPosPixel.Y() - (aWndSize.Height() - nBorderWidth); - } - - rX = nPixelToScrollX; - rY = nPixelToScrollY; -} - -IMPL_LINK(SvImpIconView, MouseMoveTimeoutHdl, Timer*, pTimer ) -{ - pTimer->Start(); - MouseMove( aMouseMoveEvent ); - return 0; -} - -void SvImpIconView::EndTracking() -{ - pView->ReleaseMouse(); - if( nFlags & F_RUBBERING ) - { - aMouseMoveTimer.Stop(); - nFlags &= ~(F_RUBBERING | F_ADD_MODE); - } -} - -sal_Bool SvImpIconView::IsTextHit( SvLBoxEntry* pEntry, const Point& rDocPos ) -{ - SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - if( pItem ) - { - Rectangle aRect( CalcTextRect( pEntry, pItem )); - if( aRect.IsInside( rDocPos ) ) - return sal_True; - } - return sal_False; -} - -IMPL_LINK(SvImpIconView, EditTimeoutHdl, Timer*, EMPTYARG ) -{ - SvLBoxEntry* pEntry = GetCurEntry(); - if( pView->IsInplaceEditingEnabled() && pEntry && - pView->IsSelected( pEntry )) - { - pView->EditEntry( pEntry ); - } - return 0; -} - - -// -// Funktionen zum Ausrichten der Eintraege am Grid -// - -// pStart == 0: Alle Eintraege werden ausgerichtet -// sonst: Alle Eintraege der Zeile ab einschliesslich pStart werden ausgerichtet -void SvImpIconView::AdjustAtGrid( SvLBoxEntry* pStart ) -{ - SvPtrarr aLists; - pImpCursor->CreateGridAjustData( aLists, pStart ); - sal_uInt16 nCount = aLists.Count(); - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - AdjustAtGrid( *(SvPtrarr*)aLists[ nCur ], pStart ); - } - ImpIcnCursor::DestroyGridAdjustData( aLists ); - CheckScrollBars(); -} - -// Richtet eine Zeile aus, erweitert ggf. die Breite; Bricht die Zeile nicht um -void SvImpIconView::AdjustAtGrid( const SvPtrarr& rRow, SvLBoxEntry* pStart ) -{ - if( !rRow.Count() ) - return; - - sal_Bool bGo; - if( !pStart ) - bGo = sal_True; - else - bGo = sal_False; - - long nCurRight = 0; - for( sal_uInt16 nCur = 0; nCur < rRow.Count(); nCur++ ) - { - SvLBoxEntry* pCur = (SvLBoxEntry*)rRow[ nCur ]; - if( !bGo && pCur == pStart ) - bGo = sal_True; - - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pCur); - // Massgebend (fuer das menschliche Auge) ist die Bitmap, da sonst - // durch lange Texte der Eintrag stark springen kann - const Rectangle& rBoundRect = GetBoundingRect( pCur, pViewData ); - Rectangle aCenterRect( CalcBmpRect( pCur, 0, pViewData )); - if( bGo && !pViewData->IsEntryPosLocked() ) - { - long nWidth = aCenterRect.GetSize().Width(); - Point aNewPos( AdjustAtGrid( aCenterRect, rBoundRect ) ); - while( aNewPos.X() < nCurRight ) - aNewPos.X() += nGridDX; - if( aNewPos != rBoundRect.TopLeft() ) - SetEntryPosition( pCur, aNewPos ); - nCurRight = aNewPos.X() + nWidth; - } - else - { - nCurRight = rBoundRect.Right(); - } - } -} - -// Richtet Rect am Grid aus, garantiert jedoch nicht, dass die -// neue Pos. frei ist. Die Pos. kann fuer SetEntryPos verwendet werden. -// Das CenterRect beschreibt den Teil des BoundRects, der fuer -// die Berechnung des Ziel-Rechtecks verwendet wird. -Point SvImpIconView::AdjustAtGrid( const Rectangle& rCenterRect, - const Rectangle& rBoundRect ) const -{ - Point aPos( rCenterRect.TopLeft() ); - Size aSize( rCenterRect.GetSize() ); - - aPos.X() -= LROFFS_WINBORDER; - aPos.Y() -= TBOFFS_WINBORDER; - - // align (ref ist mitte des rects) - short nGridX = (short)((aPos.X()+(aSize.Width()/2)) / nGridDX); - short nGridY = (short)((aPos.Y()+(aSize.Height()/2)) / nGridDY); - aPos.X() = nGridX * nGridDX; - aPos.Y() = nGridY * nGridDY; - // hor. center - aPos.X() += (nGridDX - rBoundRect.GetSize().Width() ) / 2; - - aPos.X() += LROFFS_WINBORDER; - aPos.Y() += TBOFFS_WINBORDER; - - return aPos; -} - - -void SvImpIconView::SetTextMode( SvIconViewTextMode eMode, SvLBoxEntry* pEntry ) -{ - if( !pEntry ) - { - if( eTextMode != eMode ) - { - if( eTextMode == ShowTextDontKnow ) - eTextMode = ShowTextShort; - eTextMode = eMode; - pView->Arrange(); - } - } - else - { - SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - if( pViewData->eTextMode != eMode ) - { - pViewData->eTextMode = eMode; - pModel->InvalidateEntry( pEntry ); - AdjustVirtSize( pViewData->aRect ); - } - } -} - -SvIconViewTextMode SvImpIconView::GetTextMode( const SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) const -{ - if( !pEntry ) - return eTextMode; - else - { - if( !pViewData ) - pViewData = ICNVIEWDATA(((SvLBoxEntry*)pEntry)); - return pViewData->GetTextMode(); - } -} - -SvIconViewTextMode SvImpIconView::GetEntryTextModeSmart( const SvLBoxEntry* pEntry, - const SvIcnVwDataEntry* pViewData ) const -{ - DBG_ASSERT(pEntry,"GetEntryTextModeSmart: Entry not set"); - if( !pViewData ) - pViewData = ICNVIEWDATA(((SvLBoxEntry*)pEntry)); - SvIconViewTextMode eMode = pViewData->GetTextMode(); - if( eMode == ShowTextDontKnow ) - return eTextMode; - return eMode; -} - -void SvImpIconView::ShowFocusRect( const SvLBoxEntry* pEntry ) -{ - if( !pEntry ) - pView->HideFocus(); - else - { - Rectangle aRect ( CalcFocusRect( (SvLBoxEntry*)pEntry ) ); - pView->ShowFocus( aRect ); - } -} - -IMPL_LINK(SvImpIconView, UserEventHdl, void*, EMPTYARG ) -{ - nCurUserEvent = 0; - AdjustScrollBars(); - Rectangle aRect; - if( GetResizeRect(aRect) ) - PaintResizeRect( aRect ); - return 0; -} - -void SvImpIconView::CancelUserEvent() -{ - if( nCurUserEvent ) - { - Application::RemoveUserEvent( nCurUserEvent ); - nCurUserEvent = 0; - } -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index d03b956bf571..7695137431f0 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -853,6 +853,11 @@ void SvTreeListBox::ScrollOutputArea( short nDeltaEntries ) NotifyEndScroll(); } +void SvTreeListBox::ScrollToAbsPos( long nPos ) +{ + pImp->ScrollToAbsPos( nPos ); +} + void SvTreeListBox::SetSelectionMode( SelectionMode eSelectMode ) { DBG_CHKTHIS(SvTreeListBox,0); @@ -2447,6 +2452,28 @@ SvLBoxEntry* SvTreeListBox::GetNextEntryInView(SvLBoxEntry* pEntry ) const return pNext; } +SvLBoxEntry* SvTreeListBox::GetLastEntryInView() const +{ + SvLBoxEntry* pEntry = GetFirstEntryInView(); + SvLBoxEntry* pNext = 0; + while( pEntry ) + { + pNext = (SvLBoxEntry*)NextVisible( pEntry ); + if( pNext ) + { + Point aPos( GetEntryPosition(pNext) ); + const Size& rSize = pImp->GetOutputSize(); + if( aPos.Y() < 0 || aPos.Y() >= rSize.Height() ) + break; + else + pEntry = pNext; + } + else + break; + } + return pEntry; +} + void SvTreeListBox::ShowFocusRect( const SvLBoxEntry* pEntry ) { pImp->ShowFocusRect( pEntry ); diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 14dae85f4ee8..e185705806be 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -180,10 +180,10 @@ sal_uInt16 ColorListBox::InsertEntry( const Color& rColor, const XubString& rStr // ----------------------------------------------------------------------- -void ColorListBox::InsertAutomaticEntry() +void ColorListBox::InsertAutomaticEntryColor(const Color &rColor) { // insert the "Automatic"-entry always on the first position - InsertEntry( Color( COL_AUTO ), SvtResId( STR_SVT_AUTOMATIC_COLOR ), 0 ); + InsertEntry( rColor, SvtResId( STR_SVT_AUTOMATIC_COLOR ), 0 ); } // ----------------------------------------------------------------------- diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index bc0ee75a845b..49309fd4f001 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -1978,29 +1978,6 @@ void TabBar::Clear() // ----------------------------------------------------------------------- -void TabBar::EnablePage( sal_uInt16 nPageId, sal_Bool bEnable ) -{ - sal_uInt16 nPos = GetPagePos( nPageId ); - - if ( nPos != PAGE_NOT_FOUND ) - { - ImplTabBarItem* pItem = (*mpItemList)[ nPos ]; - - if ( pItem->mbEnable != bEnable ) - { - pItem->mbEnable = bEnable; - - // Leiste neu ausgeben - if ( IsReallyVisible() && IsUpdateMode() ) - Invalidate( pItem->maRect ); - - CallEventListeners( bEnable ? VCLEVENT_TABBAR_PAGEENABLED : VCLEVENT_TABBAR_PAGEDISABLED, reinterpret_cast<void*>(sal::static_int_cast<sal_IntPtr>(nPageId)) ); - } - } -} - -// ----------------------------------------------------------------------- - sal_Bool TabBar::IsPageEnabled( sal_uInt16 nPageId ) const { sal_uInt16 nPos = GetPagePos( nPageId ); @@ -2302,48 +2279,6 @@ void TabBar::SelectPage( sal_uInt16 nPageId, sal_Bool bSelect ) // ----------------------------------------------------------------------- -void TabBar::SelectPageRange( sal_Bool bSelect, sal_uInt16 nStartPos, sal_uInt16 nEndPos ) -{ - Rectangle aPaintRect; - sal_uInt16 nPos = nStartPos; - ImplTabBarItem* pItem = seek( nPos ); - while ( pItem && (nPos <= nEndPos) ) - { - if ( (pItem->mbSelect != bSelect) && (pItem->mnId != mnCurPageId) ) - { - pItem->mbSelect = bSelect; - aPaintRect.Union( pItem->maRect ); - } - - nPos++; - pItem = next(); - } - - // Leiste neu ausgeben - if ( IsReallyVisible() && IsUpdateMode() && !aPaintRect.IsEmpty() ) - Invalidate( aPaintRect ); -} - -// ----------------------------------------------------------------------- - -sal_uInt16 TabBar::GetSelectPage( sal_uInt16 nSelIndex ) const -{ - sal_uInt16 nSelected = 0; - for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) - { - ImplTabBarItem* pItem = (*mpItemList)[ i ]; - if ( pItem->mbSelect ) - nSelected++; - - if ( nSelected == nSelIndex ) - return pItem->mnId; - } - - return 0; -} - -// ----------------------------------------------------------------------- - sal_uInt16 TabBar::GetSelectPageCount() const { sal_uInt16 nSelected = 0; @@ -2519,78 +2454,6 @@ void TabBar::SetMaxPageWidth( long nMaxWidth ) // ----------------------------------------------------------------------- -void TabBar::SetSelectColor() -{ - if ( mbSelColor ) - { - maSelColor = Color( COL_TRANSPARENT ); - mbSelColor = sal_False; - Invalidate(); - } -} - -// ----------------------------------------------------------------------- - -void TabBar::SetSelectColor( const Color& rColor ) -{ - if ( rColor.GetTransparency() ) - { - if ( mbSelColor ) - { - maSelColor = Color( COL_TRANSPARENT ); - mbSelColor = sal_False; - Invalidate(); - } - } - else - { - if ( maSelColor != rColor ) - { - maSelColor = rColor; - mbSelColor = sal_True; - Invalidate(); - } - } -} - -// ----------------------------------------------------------------------- - -void TabBar::SetSelectTextColor() -{ - if ( mbSelTextColor ) - { - maSelTextColor = Color( COL_TRANSPARENT ); - mbSelTextColor = sal_False; - Invalidate(); - } -} - -// ----------------------------------------------------------------------- - -void TabBar::SetSelectTextColor( const Color& rColor ) -{ - if ( rColor.GetTransparency() ) - { - if ( mbSelTextColor ) - { - maSelTextColor = Color( COL_TRANSPARENT ); - mbSelTextColor = sal_False; - Invalidate(); - } - } - else - { - if ( maSelTextColor != rColor ) - { - maSelTextColor = rColor; - mbSelTextColor = sal_True; - Invalidate(); - } - } -} - -// ----------------------------------------------------------------------- - void TabBar::SetPageText( sal_uInt16 nPageId, const XubString& rText ) { sal_uInt16 nPos = GetPagePos( nPageId ); @@ -2620,15 +2483,6 @@ XubString TabBar::GetPageText( sal_uInt16 nPageId ) const // ----------------------------------------------------------------------- -void TabBar::SetHelpText( sal_uInt16 nPageId, const XubString& rText ) -{ - sal_uInt16 nPos = GetPagePos( nPageId ); - if ( nPos != PAGE_NOT_FOUND ) - (*mpItemList)[ nPos ]->maHelpText = rText; -} - -// ----------------------------------------------------------------------- - XubString TabBar::GetHelpText( sal_uInt16 nPageId ) const { sal_uInt16 nPos = GetPagePos( nPageId ); @@ -2650,15 +2504,6 @@ XubString TabBar::GetHelpText( sal_uInt16 nPageId ) const // ----------------------------------------------------------------------- -void TabBar::SetHelpId( sal_uInt16 nPageId, const rtl::OString& rHelpId ) -{ - sal_uInt16 nPos = GetPagePos( nPageId ); - if ( nPos != PAGE_NOT_FOUND ) - (*mpItemList)[ nPos ]->maHelpId = rHelpId; -} - -// ----------------------------------------------------------------------- - rtl::OString TabBar::GetHelpId( sal_uInt16 nPageId ) const { sal_uInt16 nPos = GetPagePos( nPageId ); @@ -2670,18 +2515,6 @@ rtl::OString TabBar::GetHelpId( sal_uInt16 nPageId ) const // ----------------------------------------------------------------------- -long TabBar::GetMinSize() const -{ - long nMinSize = TABBAR_MINSIZE + TABBAR_OFFSET_X; - if ( mnWinStyle & WB_MINSCROLL ) - nMinSize += mpPrevBtn->GetSizePixel().Width()*2; - else if ( mnWinStyle & WB_SCROLL ) - nMinSize += mpFirstBtn->GetSizePixel().Width()*4; - return nMinSize; -} - -// ----------------------------------------------------------------------- - sal_Bool TabBar::StartDrag( const CommandEvent& rCEvt, Region& rRegion ) { if ( !(mnWinStyle & WB_DRAG) || (rCEvt.GetCommand() != COMMAND_STARTDRAG) ) diff --git a/svtools/source/control/taskbar.cxx b/svtools/source/control/taskbar.cxx index 8d3a6abce18f..a41730c3318b 100644 --- a/svtools/source/control/taskbar.cxx +++ b/svtools/source/control/taskbar.cxx @@ -464,70 +464,6 @@ void TaskBar::Format() // ----------------------------------------------------------------------- -void TaskBar::SetLines( sal_uInt16 nLines ) -{ - mnLines = nLines; -} - -// ----------------------------------------------------------------------- - -void TaskBar::EnableAutoHide( sal_Bool bAutoHide ) -{ - mbAutoHide = bAutoHide; - - if ( mbAutoHide ) - { - ImplNewHeight( TASKBAR_AUTOHIDE_HEIGHT ); - } - else - { - ImplNewHeight( CalcWindowSizePixel().Height() ); - } -} - -// ----------------------------------------------------------------------- - -void TaskBar::ShowStatusText( const String& rText ) -{ - if ( mpStatusBar ) - { - if ( !mbStatusText ) - { - mbStatusText = sal_True; - if ( mpStatusBar->AreItemsVisible() ) - { - mbShowItems = sal_True; - mpStatusBar->HideItems(); - } - else - mbShowItems = sal_True; - maOldText = mpStatusBar->GetText(); - Resize(); - mpStatusBar->SetText( rText ); - Update(); - mpStatusBar->Update(); - } - else - mpStatusBar->SetText( rText ); - } -} - -// ----------------------------------------------------------------------- - -void TaskBar::HideStatusText() -{ - if ( mbStatusText && mpStatusBar ) - { - mbStatusText = sal_False; - mpStatusBar->SetText( maOldText ); - Resize(); - if ( mbShowItems ) - mpStatusBar->ShowItems(); - } -} - -// ----------------------------------------------------------------------- - Size TaskBar::CalcWindowSizePixel() const { TaskButtonBar* pTempButtonBar = GetButtonBar(); diff --git a/svtools/source/control/taskmisc.cxx b/svtools/source/control/taskmisc.cxx index 1476cacb76fb..246d107fc1d1 100644 --- a/svtools/source/control/taskmisc.cxx +++ b/svtools/source/control/taskmisc.cxx @@ -61,14 +61,13 @@ void TaskButtonBar::RequestHelp( const HelpEvent& rHEvt ) WindowArrange::WindowArrange() { - mpWinList = new List; } // ----------------------------------------------------------------------- WindowArrange::~WindowArrange() { - delete mpWinList; + maWinList.clear(); } // ----------------------------------------------------------------------- @@ -103,22 +102,21 @@ static void ImplPosSizeWindow( Window* pWindow, void WindowArrange::ImplTile( const Rectangle& rRect ) { - sal_uInt16 nCount = (sal_uInt16)mpWinList->Count(); + size_t nCount = maWinList.size(); if ( nCount < 3 ) { ImplVert( rRect ); return; } - sal_uInt16 i; - sal_uInt16 j; - sal_uInt16 nCols; - sal_uInt16 nRows; - sal_uInt16 nActRows; - sal_uInt16 nOffset; + sal_uInt16 i; + sal_uInt16 j; + sal_uInt16 nCols; + sal_uInt16 nRows; + sal_uInt16 nActRows; + sal_uInt16 nOffset; long nOverWidth; long nOverHeight; - Window* pWindow; long nX = rRect.Left(); long nY = rRect.Top(); long nWidth = rRect.GetWidth(); @@ -144,7 +142,7 @@ void WindowArrange::ImplTile( const Rectangle& rRect ) nWidth = 1; nOverWidth = nRectWidth-(nWidth*nCols); - pWindow = (Window*)mpWinList->First(); + WindowList_impl::iterator it = maWinList.begin(); for ( i = 0; i < nCols; i++ ) { if ( i < nOffset ) @@ -172,18 +170,17 @@ void WindowArrange::ImplTile( const Rectangle& rRect ) nTempHeight++; nOverHeight--; } - ImplPosSizeWindow( pWindow, nX, nY, nTempWidth, nTempHeight ); + ImplPosSizeWindow( *it, nX, nY, nTempWidth, nTempHeight ); nY += nTempHeight; - pWindow = (Window*)mpWinList->Next(); - if ( !pWindow ) + if ( ++it == maWinList.end() ) break; } nX += nWidth; nY = nRectY; - if ( !pWindow ) + if ( it == maWinList.end() ) break; } } @@ -192,7 +189,7 @@ void WindowArrange::ImplTile( const Rectangle& rRect ) void WindowArrange::ImplHorz( const Rectangle& rRect ) { - long nCount = (long)mpWinList->Count(); + size_t nCount = maWinList.size(); long nX = rRect.Left(); long nY = rRect.Top(); long nWidth = rRect.GetWidth(); @@ -206,9 +203,9 @@ void WindowArrange::ImplHorz( const Rectangle& rRect ) if ( nHeight < 1 ) nHeight = 1; nOver = nRectHeight - (nCount*nHeight); - pWindow = (Window*)mpWinList->First(); - while ( pWindow ) + for( size_t index = 0; index < nCount; ++index ) { + pWindow = maWinList[ index ]; nTempHeight = nHeight; if ( nOver > 0 ) { @@ -217,8 +214,6 @@ void WindowArrange::ImplHorz( const Rectangle& rRect ) } ImplPosSizeWindow( pWindow, nX, nY, nWidth, nTempHeight ); nY += nTempHeight; - - pWindow = (Window*)mpWinList->Next(); } } @@ -226,7 +221,7 @@ void WindowArrange::ImplHorz( const Rectangle& rRect ) void WindowArrange::ImplVert( const Rectangle& rRect ) { - long nCount = (long)mpWinList->Count(); + size_t nCount = maWinList.size(); long nX = rRect.Left(); long nY = rRect.Top(); long nWidth = rRect.GetWidth(); @@ -240,9 +235,9 @@ void WindowArrange::ImplVert( const Rectangle& rRect ) if ( nWidth < 1 ) nWidth = 1; nOver = nRectWidth - (nCount*nWidth); - pWindow = (Window*)mpWinList->First(); - while ( pWindow ) + for( size_t index = 0; index < nCount; ++index ) { + pWindow = maWinList[ index ]; nTempWidth = nWidth; if ( nOver > 0 ) { @@ -251,8 +246,6 @@ void WindowArrange::ImplVert( const Rectangle& rRect ) } ImplPosSizeWindow( pWindow, nX, nY, nTempWidth, nHeight ); nX += nTempWidth; - - pWindow = (Window*)mpWinList->Next(); } } @@ -285,7 +278,7 @@ void WindowArrange::ImplCascade( const Rectangle& rRect ) Window* pTempWindow; // Border-Fenster suchen um den Versatz zu ermitteln - pTempWindow = (Window*)mpWinList->First(); + pTempWindow = maWinList.front(); pTempWindow->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder ); while ( !nTopBorder ) { @@ -313,9 +306,9 @@ void WindowArrange::ImplCascade( const Rectangle& rRect ) nStartOverHeight = nRectHeight-(nHeight+(nCascadeWins*nOff)); i = 0; - pWindow = (Window*)mpWinList->First(); - while ( pWindow ) + for( size_t index = 0, count = maWinList.size(); index < count; ++index ) { + pWindow = maWinList[ index ]; if ( !i ) { nOverWidth = nStartOverWidth; @@ -346,8 +339,6 @@ void WindowArrange::ImplCascade( const Rectangle& rRect ) i++; else i = 0; - - pWindow = (Window*)mpWinList->Next(); } } @@ -355,7 +346,7 @@ void WindowArrange::ImplCascade( const Rectangle& rRect ) void WindowArrange::Arrange( sal_uInt16 nType, const Rectangle& rRect ) { - if ( !mpWinList->Count() ) + if ( maWinList.empty() ) return; switch ( nType ) diff --git a/svtools/source/control/taskstat.cxx b/svtools/source/control/taskstat.cxx index b94aae25a88f..08f2a25b4b2f 100644 --- a/svtools/source/control/taskstat.cxx +++ b/svtools/source/control/taskstat.cxx @@ -110,21 +110,6 @@ TaskStatusFieldItem::TaskStatusFieldItem( const TaskStatusFieldItem& rItem ) : // ----------------------------------------------------------------------- -TaskStatusFieldItem::TaskStatusFieldItem( ITaskStatusNotify* pNotify, - const Image& rImage, - const XubString& rQuickHelpText, - const XubString& rHelpText, - sal_uInt16 nFlags ) : - mpNotify( pNotify ), - maImage( rImage ), - maQuickHelpText( rQuickHelpText ), - maHelpText( rHelpText ), - mnFlags( nFlags ) -{ -} - -// ----------------------------------------------------------------------- - TaskStatusFieldItem::~TaskStatusFieldItem() { } @@ -563,90 +548,4 @@ void TaskStatusBar::InsertStatusField( long, sal_uInt16, ImplUpdateField( sal_False ); } -// ----------------------------------------------------------------------- - -void TaskStatusBar::SetFieldFlags( sal_uInt16 nFlags ) -{ - if ( mnFieldFlags != nFlags ) - { - mnFieldFlags = nFlags; - ImplUpdateField( sal_False ); - } -} - -// ----------------------------------------------------------------------- - -void TaskStatusBar::AddStatusFieldItem( sal_uInt16 nItemId, const TaskStatusFieldItem& rItem, - sal_uInt16 nPos ) -{ - DBG_ASSERT( nItemId, "TaskStatusBar::AddStatusFieldItem() - Item is 0" ); - DBG_ASSERT( !ImplGetFieldItem( nItemId ), "TaskStatusBar::AddStatusFieldItem() - Item-Id already exist" ); - - if ( !mpFieldItemList ) - mpFieldItemList = new ImplTaskSBItemList; - - ImplTaskSBFldItem* pItem = new ImplTaskSBFldItem; - pItem->maItem = rItem; - pItem->mnId = nItemId; - pItem->mnOffX = 0; - if ( nPos < mpFieldItemList->size() ) { - ImplTaskSBItemList::iterator it = mpFieldItemList->begin(); - ::std::advance( it, nPos ); - mpFieldItemList->insert( it, pItem ); - } else { - mpFieldItemList->push_back( pItem ); - } - - ImplUpdateField( sal_True ); -} - -// ----------------------------------------------------------------------- - -void TaskStatusBar::ModifyStatusFieldItem( sal_uInt16 nItemId, const TaskStatusFieldItem& rItem ) -{ - ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId ); - if ( pItem ) - { - sal_Bool bUpdate = (pItem->maItem.GetImage() != rItem.GetImage()) || - (pItem->maItem.GetFlags() != rItem.GetFlags()); - pItem->maItem = rItem; - if ( bUpdate ) - ImplUpdateField( sal_True ); - } -} - -// ----------------------------------------------------------------------- - -void TaskStatusBar::RemoveStatusFieldItem( sal_uInt16 nItemId ) -{ - ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId ); - if ( pItem ) - { - for ( ImplTaskSBItemList::iterator it = mpFieldItemList->begin(); - it < mpFieldItemList->end(); - ++it - ) { - if ( *it == pItem ) { - delete *it; - mpFieldItemList->erase( it ); - break; - } - } - } -} - -// ----------------------------------------------------------------------- - -sal_Bool TaskStatusBar::GetStatusFieldItem( sal_uInt16 nItemId, TaskStatusFieldItem& rItem ) const -{ - ImplTaskSBFldItem* pItem = ImplGetFieldItem( nItemId ); - if ( pItem ) - { - rItem = pItem->maItem; - return sal_True; - } - - return sal_False; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/mcvmath.cxx b/svtools/source/dialogs/mcvmath.cxx index 5d5ad14c82c2..f34737b8a4f0 100644 --- a/svtools/source/dialogs/mcvmath.cxx +++ b/svtools/source/dialogs/mcvmath.cxx @@ -71,23 +71,6 @@ Fix ImpMultBig2( const Fix& a, const Fix& b ) /************************************************************************** |* -|* ImpMultBig2() -|* -|* Beschreibung Multiplikation fuer FixPoint-Berechnungen -|* -**************************************************************************/ - -// first parameter should be the bigger one - -FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb ) -{ - Fix rr = ImpMultBig2(ra.r,rb.r)-ImpMultBig2(ra.i,rb.i); - Fix ii = ImpMultBig2(ra.r,rb.i)+ImpMultBig2(ra.i,rb.r); - return FixCpx( rr,ii ); -} - -/************************************************************************** -|* |* ImpSqrt() |* |* Beschreibung Wurzelfunktion fuer FixPoint-Berechnungen @@ -146,146 +129,4 @@ FixCpx ImpExPI( sal_uInt16 nPhi ) return aIter; } -/************************************************************************** -|* -|* ImpATanx2() -|* -|* Beschreibung ATANX2-Funktion fuer FixPoint-Berechnungen -|* -**************************************************************************/ - -// use for x*x+y*y==1 only - -static sal_uInt16 ImpATanx2( const Fix& rX, const Fix& rY ) -{ - sal_uInt16 phi0 = 0; // result angel higher part - sal_uInt16 phi = 0; // dito lower part - long x = rX.x; - long y = rY.x; - long z; - const char Sft=14-FIX_POST; - short i; - FixCpx aTry; - FixCpx aInc; - FixCpx aIter(1L); - sal_Bool Small = sal_False; - - if ( (x==0) && (y==0) ) - return 0; - - if ( y < 0) - { - // reduce 3. to 1. quadrant (0..90 Degree) - phi0 += 180L * 65536L / 360L; - // turn 180 degree - y *= -1; - x *= -1; - } - - if ( x < 0) - { - // 2. to 1. q. - phi0 += 90L * 65536L / 360L; - // turn 90 degree clockwise - z = y; - y = -x; - x = z; - } - - for ( i = 13; i >= 0; i-- ) - { - aInc.r.x = CosTab[i]>>Sft; // e**(i(phi1+phi2)) = - aInc.i.x = SinTab[i]>>Sft; // e**(i*phi1)) * e**(i*phi2)) - aTry = aIter*aInc; - - if ( Small ) - { - // is try ok - if ( aTry.r.x >= x ) - { - aIter = aTry; - phi += (1<<i); - } - } - else - { - // is try ok - if ( aTry.i.x <= y ) - { - aIter = aTry; - phi += (1<<i); - - if ( i > 11 ) - Small=sal_True; - } - } - } - - return phi0+phi; -} - -/************************************************************************** -|* -|* ImpATan2() -|* -|* Beschreibung ATAN-Funktion fuer FixPoint-Berechnungen -|* -**************************************************************************/ - -sal_uInt16 ImpATan2( const short x, const short y ) -{ - Fix rRad = ImpSqrt(sal_uLong(long(x)*x+long(y)*y)); - - if ( !rRad.x ) - return 0; - Fix fx = x; - fx.DivBig( rRad ); // Normiere auf Einheitskreis - Fix fy = y; - fy.DivBig( rRad ); - - return ImpATanx2( fx, fy ); -} - -/************************************************************************** -|* -|* ImpCartToPolar() -|* -|* Beschreibung Koordinaaten-Wandlung -|* -**************************************************************************/ - -void ImpCartToPolar( const short x, const short y, Fix& rRad, sal_uInt16& rPhi ) -{ - rRad = Fix( ImpSqrt( sal_uLong( long(x)*x+long(y)*y ) ) ); - - if ( !rRad.x ) - rPhi=0; - else - { - // Normiere auf Einheitskreis - Fix fx = x; - fx.DivBig(rRad); - Fix fy = y; - fy.DivBig(rRad); - rPhi = ImpATanx2(fx, fy); - } -} - -/************************************************************************** -|* -|* ImpPolarToCart() -|* -|* Beschreibung Koordinaaten-Wandlung -|* -**************************************************************************/ - -void ImpPolarToCart( const Fix& rR, const sal_uInt16 Phi, short& rX, short& rY ) -{ - FixCpx fc = ImpExPI( Phi ); // calculate sin() & cos() - fc.GetReal().MultBig( rR ); - rX = sal::static_int_cast< short >(long( fc.GetReal() )); - fc.GetImag().MultBig( rR ); - rY = sal::static_int_cast< short >(long( fc.GetImag() )); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/mcvmath.hxx b/svtools/source/dialogs/mcvmath.hxx index 5e0d47e655ef..c3e2005352ab 100644 --- a/svtools/source/dialogs/mcvmath.hxx +++ b/svtools/source/dialogs/mcvmath.hxx @@ -75,8 +75,6 @@ private: friend class FixCpx; friend class ColWheel; -// friend Fix ImpMultBig2( const Fix& a, const Fix& b ); - public: long x; @@ -122,8 +120,6 @@ public: class FixCpx { -// friend FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb ); - public: Fix r; Fix i; @@ -217,13 +213,8 @@ inline FixCpx operator/ ( const FixCpx& a, const FixCpx& b ) // ----------------------------------------------------------------------- Fix ImpMultBig2( const Fix& a, const Fix& b ); -FixCpx ImpMultBig2( const FixCpx& ra, const FixCpx& rb ); - -void ImpCartToPolar( const short x, const short y, Fix& rRad, sal_uInt16& rPhi ); -void ImpPolarToCart( const Fix& rR, const sal_uInt16 Phi, short& rX, short& rY ); sal_uInt16 ImpSqrt( sal_uLong nRadi ); -sal_uInt16 ImpATan2( const short x, const short y ); FixCpx ImpExPI( sal_uInt16 nPhi ); #endif // _MCVMATH_HXX diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx index 728d0e6ea5c7..1c39b8e6f70d 100644 --- a/svtools/source/dialogs/prnsetup.cxx +++ b/svtools/source/dialogs/prnsetup.cxx @@ -281,11 +281,6 @@ void PrinterSetupDialog::SetOptionsHdl( const Link& rLink ) maBtnOptions.Show( rLink.IsSet() ); } -const Link& PrinterSetupDialog::GetOptionsHdl() const -{ - return maBtnOptions.GetClickHdl(); -} - void PrinterSetupDialog::ImplSetInfo() { const QueueInfo* pInfo = Printer::GetQueueInfo(maLbName.GetSelectEntry(), true); diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx index f859e9930cf9..df9c9d1acea9 100644 --- a/svtools/source/edit/syntaxhighlight.cxx +++ b/svtools/source/edit/syntaxhighlight.cxx @@ -237,6 +237,8 @@ extern "C" int CDECL compare_strings( const void *arg1, const void *arg2 ) } +namespace { + class LetterTable { bool IsLetterTab[256]; @@ -252,6 +254,8 @@ public: bool isLetterUnicode( sal_Unicode c ); }; +} + class BasicSimpleCharClass { static LetterTable aLetterTable; @@ -671,41 +675,6 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, return sal_True; } -String SimpleTokenizer_Impl::getTokStr - ( /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ) -{ - return String( pStartPos, (sal_uInt16)( pEndPos - pStartPos ) ); -} - -#ifdef DBG_UTIL -// TEST: Token ausgeben -String SimpleTokenizer_Impl::getFullTokenStr( /*out*/TokenTypes eType, - /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ) -{ - String aOut; - switch( eType ) - { - case TT_UNKNOWN: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_UNKNOWN:") ); break; - case TT_IDENTIFIER: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_IDENTIFIER:") ); break; - case TT_WHITESPACE: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_WHITESPACE:") ); break; - case TT_NUMBER: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_NUMBER:") ); break; - case TT_STRING: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_STRING:") ); break; - case TT_EOL: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_EOL:") ); break; - case TT_COMMENT: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_COMMENT:") ); break; - case TT_ERROR: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_ERROR:") ); break; - case TT_OPERATOR: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_OPERATOR:") ); break; - case TT_KEYWORDS: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_KEYWORD:") ); break; - case TT_PARAMETER: aOut = String( RTL_CONSTASCII_USTRINGPARAM("TT_PARAMETER:") ); break; - } - if( eType != TT_EOL ) - { - aOut += String( pStartPos, (sal_uInt16)( pEndPos - pStartPos ) ); - } - aOut += String( RTL_CONSTASCII_USTRINGPARAM("\n") ); - return aOut; -} -#endif - SimpleTokenizer_Impl::SimpleTokenizer_Impl( HighlighterLanguage aLang ): aLanguage(aLang) { memset( aCharTypeTab, 0, sizeof( aCharTypeTab ) ); diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx index fa7536035288..615ac1258f4d 100644 --- a/svtools/source/edit/textdoc.cxx +++ b/svtools/source/edit/textdoc.cxx @@ -216,23 +216,6 @@ void TextCharAttribList::DeleteEmptyAttribs() mbHasEmptyAttribs = sal_False; } -#ifdef DBG_UTIL -sal_Bool TextCharAttribList::DbgCheckAttribs() -{ - sal_Bool bOK = sal_True; - for ( sal_uInt16 nAttr = 0; nAttr < Count(); nAttr++ ) - { - TextCharAttrib* pAttr = GetObject( nAttr ); - if ( pAttr->GetStart() > pAttr->GetEnd() ) - { - bOK = sal_False; - OSL_FAIL( "Attr verdreht" ); - } - } - return bOK; -} -#endif - // ------------------------------------------------------------------------- // (+) class TextNode // ------------------------------------------------------------------------- @@ -307,10 +290,6 @@ void TextNode::ExpandAttribs( sal_uInt16 nIndex, sal_uInt16 nNew ) if ( bResort ) maCharAttribs.ResortAttribs(); - -#ifdef EDITDEBUG - DBG_ASSERT( CheckOrderedList( (TextCharAttribs*)&maCharAttribs ), "Expand: Start-Liste verdreht" ); -#endif } void TextNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted ) @@ -374,10 +353,6 @@ void TextNode::CollapsAttribs( sal_uInt16 nIndex, sal_uInt16 nDeleted ) if ( bResort ) maCharAttribs.ResortAttribs(); - -#ifdef EDITDEBUG - DBG_ASSERT( CheckOrderedList( (TextCharAttribs)&maCharAttribs ), "Collaps: Start-Liste verdreht" ); -#endif } void TextNode::InsertText( sal_uInt16 nPos, const String& rText ) @@ -460,10 +435,6 @@ void TextNode::Append( const TextNode& rNode ) maText += rNode.GetText(); -#ifdef EDITDEBUG - DBG_ASSERT( maCharAttribs.DbgCheckAttribs(), "Attribute VOR AppendAttribs kaputt" ); -#endif - const sal_uInt16 nAttribs = rNode.GetCharAttribs().Count(); for ( sal_uInt16 nAttr = 0; nAttr < nAttribs; nAttr++ ) { @@ -499,10 +470,6 @@ void TextNode::Append( const TextNode& rNode ) maCharAttribs.InsertAttrib( pNewAttrib ); } } - -#ifdef EDITDEBUG - DBG_ASSERT( maCharAttribs.DbgCheckAttribs(), "Attribute NACH AppendAttribs kaputt" ); -#endif } // ------------------------------------------------------------------------- diff --git a/svtools/source/edit/textdoc.hxx b/svtools/source/edit/textdoc.hxx index c52190ca4d63..41a134da4899 100644 --- a/svtools/source/edit/textdoc.hxx +++ b/svtools/source/edit/textdoc.hxx @@ -69,10 +69,6 @@ public: TextCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_uInt16 nPos ); sal_Bool HasAttrib( sal_uInt16 nWhich ) const; sal_Bool HasBoundingAttrib( sal_uInt16 nBound ); - -#ifdef DBG_UTIL - sal_Bool DbgCheckAttribs(); -#endif }; diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx index 15412276e587..9decddde44f9 100644 --- a/svtools/source/edit/texteng.cxx +++ b/svtools/source/edit/texteng.cxx @@ -253,12 +253,6 @@ void TextEngine::SetFont( const Font& rFont ) } } -void TextEngine::SetDefTab( sal_uInt16 nDefTab ) -{ - mnDefTab = nDefTab; - // evtl neu setzen? -} - void TextEngine::SetMaxTextLen( sal_uLong nLen ) { mnMaxTextLen = nLen; @@ -359,29 +353,6 @@ void TextEngine::SetUpdateMode( sal_Bool bUpdate ) } } -sal_Bool TextEngine::DoesKeyMoveCursor( const KeyEvent& rKeyEvent ) -{ - sal_Bool bDoesMove = sal_False; - - switch ( rKeyEvent.GetKeyCode().GetCode() ) - { - case KEY_UP: - case KEY_DOWN: - case KEY_LEFT: - case KEY_RIGHT: - case KEY_HOME: - case KEY_END: - case KEY_PAGEUP: - case KEY_PAGEDOWN: - { - if ( !rKeyEvent.GetKeyCode().IsMod2() ) - bDoesMove = sal_True; - } - break; - } - return bDoesMove; -} - sal_Bool TextEngine::DoesKeyChangeText( const KeyEvent& rKeyEvent ) { sal_Bool bDoesChange = sal_False; @@ -1509,11 +1480,7 @@ void TextEngine::SeekCursor( sal_uLong nPara, sal_uInt16 nPos, Font& rFont, Outp if ( ( ( pAttrib->GetStart() < nPos ) && ( pAttrib->GetEnd() >= nPos ) ) || !pNode->GetText().Len() ) { - if ( pAttrib->Which() != TEXTATTR_FONTCOLOR ) - { - pAttrib->GetAttr().SetFont( rFont ); - } - else + if ( pAttrib->Which() == TEXTATTR_FONTCOLOR ) { if ( pOutDev ) pOutDev->SetTextColor( ((TextAttribFontColor&)pAttrib->GetAttr()).GetColor() ); @@ -1553,15 +1520,6 @@ void TextEngine::SeekCursor( sal_uLong nPara, sal_uInt16 nPos, Font& rFont, Outp } } -void TextEngine::SetUpdateMode( sal_Bool bUp, TextView* pCurView, sal_Bool bForceUpdate ) -{ - sal_Bool bChanged = ( GetUpdateMode() != bUp ); - - mbUpdate = bUp; - if ( mbUpdate && ( bChanged || bForceUpdate ) ) - FormatAndUpdate( pCurView ); -} - void TextEngine::FormatAndUpdate( TextView* pCurView ) { if ( mbDowning ) @@ -1953,9 +1911,6 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos ) } DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "Keine Portions?!" ); -#ifdef EDITDEBUG - DBG_ASSERT( pTEParaPortion->DbgCheckTextPortions(), "Portions kaputt?" ); -#endif } void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short nNewChars ) @@ -2048,10 +2003,6 @@ void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short } DBG_ASSERT( pTEParaPortion->GetTextPortions().Count(), "RecalcTextPortions: Keine mehr da!" ); } - -#ifdef EDITDEBUG - DBG_ASSERT( pTEParaPortion->DbgCheckTextPortions(), "Portions kaputt?" ); -#endif } void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectangle const* pPaintArea, TextSelection const* pPaintRange, TextSelection const* pSelection ) @@ -2242,13 +2193,6 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan pOutDev->Erase( aTabArea ); } } -#ifdef EDITDEBUG - Rectangle aTabArea( aTmpPos, Point( aTmpPos.X()+nTxtWidth, aTmpPos.Y()+mnCharHeight-1 ) ); - Color aOldColor = pOutDev->GetFillColor(); - pOutDev->SetFillColor( (y%2) ? COL_RED : COL_GREEN ); - pOutDev->DrawRect( aTabArea ); - pOutDev->SetFillColor( aOldColor ); -#endif } break; default: OSL_FAIL( "ImpPaint: Unknown Portion-Type !" ); diff --git a/svtools/source/edit/textundo.cxx b/svtools/source/edit/textundo.cxx index 660c272397f5..56aea0d2c0fa 100644 --- a/svtools/source/edit/textundo.cxx +++ b/svtools/source/edit/textundo.cxx @@ -43,7 +43,6 @@ TYPEINIT1( TextUndoConnectParas, TextUndo ); TYPEINIT1( TextUndoSplitPara, TextUndo ); TYPEINIT1( TextUndoInsertChars, TextUndo ); TYPEINIT1( TextUndoRemoveChars, TextUndo ); -TYPEINIT1( TextUndoSetAttribs, TextUndo ); TextUndoManager::TextUndoManager( TextEngine* p ) @@ -296,44 +295,4 @@ void TextUndoRemoveChars::Redo() SetSelection( aPaM ); } - -TextUndoSetAttribs::TextUndoSetAttribs( TextEngine* pTextEngine, const TextSelection& rSel ) - : TextUndo( pTextEngine ), maSelection( rSel ) -{ - maSelection.Justify(); -// aNewAttribs.Set( rNewItems ); -// mbSetIsRemove = sal_False; -// mnRemoveWhich = 0; -// mnSpecial = 0; -} - -TextUndoSetAttribs::~TextUndoSetAttribs() -{ - // ............... -} - -void TextUndoSetAttribs::Undo() -{ - for ( sal_uLong nPara = maSelection.GetStart().GetPara(); nPara <= maSelection.GetEnd().GetPara(); nPara++ ) - { -// ContentAttribsInfo* pInf = aPrevAttribs[ (sal_uInt16)(nPara-aESel.nStartPara) ]; -// GetTextEngine()->RemoveCharAttribs( nPara ); -// TextNode* pNode = GetTextEngine()->GetTextDoc().GetObject( nPara ); -// for ( sal_uInt16 nAttr = 0; nAttr < pInf->GetPrevCharAttribs().Count(); nAttr++ ) -// { -// GetTextEngine()->GetTextDoc().InsertAttrib( pNode, pX->GetStart(), pX->GetEnd(), *pX->GetItem() ); -// } - } - SetSelection( maSelection ); -} - -void TextUndoSetAttribs::Redo() -{ -// if ( !bSetIsRemove ) -// GetTextEngine()->SetAttribs( aSel, aNewAttribs, nSpecial ); -// else -// GetTextEngine()->RemoveCharAttribs( aSel, bRemoveParaAttribs, nRemoveWhich ); - SetSelection( maSelection ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx index f2b370a9a923..1ee50008aeaf 100644 --- a/svtools/source/edit/textview.cxx +++ b/svtools/source/edit/textview.cxx @@ -1427,22 +1427,6 @@ void TextView::InsertText( const XubString& rStr, sal_Bool bSelect ) } */ -// OLD -TextPaM TextView::CursorLeft( const TextPaM& rPaM, sal_Bool bWordMode ) -{ - return bWordMode ? CursorWordLeft( rPaM ) : CursorLeft( rPaM, (sal_uInt16)i18n::CharacterIteratorMode::SKIPCELL ); - - // Remove (sal_uInt16) typecasts in this file when removing this method! -} - -// OLD -TextPaM TextView::CursorRight( const TextPaM& rPaM, sal_Bool bWordMode ) -{ - return bWordMode ? CursorWordRight( rPaM ) : CursorRight( rPaM, (sal_uInt16)i18n::CharacterIteratorMode::SKIPCELL ); - - // Remove (sal_uInt16) typecasts in this file when removing this method! -} - TextPaM TextView::CursorLeft( const TextPaM& rPaM, sal_uInt16 nCharacterIteratorMode ) { TextPaM aPaM( rPaM ); @@ -2006,15 +1990,6 @@ void TextView::SetPaintSelection( sal_Bool bPaint ) } } -void TextView::SetHighlightSelection( sal_Bool bSelectByHighlight ) -{ - if ( bSelectByHighlight != mpImpl->mbHighlightSelection ) - { - // Falls umschalten zwischendurch moeglich... - mpImpl->mbHighlightSelection = bSelectByHighlight; - } -} - sal_Bool TextView::Read( SvStream& rInput ) { sal_Bool bDone = mpImpl->mpTextEngine->Read( rInput, &mpImpl->maSelection ); @@ -2022,11 +1997,6 @@ sal_Bool TextView::Read( SvStream& rInput ) return bDone; } -sal_Bool TextView::Write( SvStream& rOutput ) -{ - return mpImpl->mpTextEngine->Read( rOutput, &mpImpl->maSelection ); -} - bool TextView::ImplTruncateNewText( rtl::OUString& rNewText ) const { bool bTruncated = false; @@ -2439,18 +2409,12 @@ const Point& TextView::GetStartDocPos() const { return mpImpl->maStartDocPos; } void TextView::SetAutoIndentMode( sal_Bool bAutoIndent ) { mpImpl->mbAutoIndent = bAutoIndent; } -sal_Bool TextView::IsAutoIndentMode() const -{ return mpImpl->mbAutoIndent; } sal_Bool TextView::IsReadOnly() const { return mpImpl->mbReadOnly; } void TextView::SetAutoScroll( sal_Bool bAutoScroll ) { mpImpl->mbAutoScroll = bAutoScroll; } sal_Bool TextView::IsAutoScroll() const { return mpImpl->mbAutoScroll; } -sal_Bool TextView::IsPaintSelection() const -{ return mpImpl->mbPaintSelection; } -sal_Bool TextView::IsHighlightSelection() const -{ return mpImpl->mbHighlightSelection; } sal_Bool TextView::HasSelection() const { return mpImpl->maSelection.HasRange(); } sal_Bool TextView::IsInsertMode() const diff --git a/svtools/source/edit/txtattr.cxx b/svtools/source/edit/txtattr.cxx index 022a40ae848f..e932cbee585a 100644 --- a/svtools/source/edit/txtattr.cxx +++ b/svtools/source/edit/txtattr.cxx @@ -39,15 +39,6 @@ TextAttrib::~TextAttrib() { } -void TextAttrib::SetFont( Font& ) const -{ -} - -TextAttrib* TextAttrib::Clone() const -{ - return NULL; -} - int TextAttrib::operator==( const TextAttrib& rAttr ) const { return mnWhich == rAttr.mnWhich; @@ -115,18 +106,6 @@ int TextAttribFontWeight::operator==( const TextAttrib& rAttr ) const } -TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL ) - : TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL ) -{ - maColor = COL_BLUE; -} - -TextAttribHyperLink::TextAttribHyperLink( const XubString& rURL, const XubString& rDescription ) - : TextAttrib( TEXTATTR_HYPERLINK ), maURL( rURL ), maDescription( rDescription ) -{ - maColor = COL_BLUE; -} - TextAttribHyperLink::TextAttribHyperLink( const TextAttribHyperLink& rAttr ) : TextAttrib( rAttr ), maURL( rAttr.maURL ), maDescription( rAttr.maDescription ) { diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx index 0a03904cf176..47a7a690153f 100644 --- a/svtools/source/filter/exportdialog.cxx +++ b/svtools/source/filter/exportdialog.cxx @@ -1512,4 +1512,4 @@ IMPL_LINK( ExportDialog, OK, void *, EMPTYARG ) return 0; } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/filter2.cxx b/svtools/source/filter/filter2.cxx index d34825312470..b973c9bdb3b0 100644 --- a/svtools/source/filter/filter2.cxx +++ b/svtools/source/filter/filter2.cxx @@ -1352,4 +1352,4 @@ String GraphicDescriptor::GetImportFormatShortName( sal_uInt16 nFormat ) return String( aKeyName, RTL_TEXTENCODING_ASCII_US ); } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/sgfbram.cxx b/svtools/source/filter/sgfbram.cxx index 8559cbee30eb..0ba3c5ed5833 100644 --- a/svtools/source/filter/sgfbram.cxx +++ b/svtools/source/filter/sgfbram.cxx @@ -561,18 +561,6 @@ sal_Bool SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf) return(bRet); } - -/************************************************************************* -|* -|* SgfFilterPScr() -|* -*************************************************************************/ -sal_Bool SgfFilterPScr(SvStream&, SgfHeader&, SgfEntry&) -{ - return sal_False; // PostSrcipt wird noch nicht unterstuetzt ! -} - - /************************************************************************* |* |* CheckSgfTyp() diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx index ddda27f2efa2..ed83389d8fee 100644 --- a/svtools/source/filter/sgvtext.cxx +++ b/svtools/source/filter/sgvtext.cxx @@ -235,23 +235,7 @@ short hPoint2Sgf(short a) return short(b); } -short Sgf2hPoint(short a) -{ - long b; - b=long(a)*5*144/(127*SgfDpmm); - return short(b); -} - // End of Misc.Pas -///////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// - - - -///////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// // AbsRead.Pas // ====================================================================== @@ -304,32 +288,6 @@ UCHAR ConvertTextChar(UCHAR c) return c; } - - -sal_uInt16 GetSchnittBit(UCHAR c) -{ - sal_uInt16 r=0; - switch (c) { - case EscBold : r=TextBoldBit; break; - case EscRSlnt: r=TextRSlnBit; break; - case EscUndln: r=TextUndlBit; break; - case EscStrik: r=TextStrkBit; break; - case EscDbUnd: r=TextDbUnBit; break; - case EscDbStk: r=TextDbStBit; break; - case EscSupSc: r=TextSupSBit; break; - case EscSubSc: r=TextSubSBit; break; - case EscKaptF: r=TextKaptBit; break; - case EscLSlnt: r=TextLSlnBit; break; - case Esc2DShd: r=TextSh2DBit; break; - case Esc3DShd: r=TextSh3DBit; break; - case Esc4DShd: r=TextSh4DBit; break; - case EscEbShd: r=TextShEbBit; - } - return r; -} - - - long ChgValue(long Def, long Min, long Max, UCHAR FlgVal, long NumVal) { long r=0; diff --git a/svtools/source/filter/wmf/emfwr.cxx b/svtools/source/filter/wmf/emfwr.cxx index 4efaa1bbbb88..09cd1876bf96 100644 --- a/svtools/source/filter/wmf/emfwr.cxx +++ b/svtools/source/filter/wmf/emfwr.cxx @@ -30,6 +30,7 @@ #include "precompiled_svtools.hxx" #include "emfwr.hxx" +#include <rtl/strbuf.hxx> #include <vcl/salbtype.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> @@ -1429,7 +1430,9 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) break; default: - OSL_FAIL( ( ByteString( "EMFWriter::ImplWriteActions: unsupported MetaAction #" ) += ByteString::CreateFromInt32( nType ) ).GetBuffer() ); + OSL_FAIL(rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM( + "EMFWriter::ImplWriteActions: unsupported MetaAction #" )). + append(static_cast<sal_Int32>(nType)).getStr()); break; } } diff --git a/svtools/source/filter/wmf/enhwmf.cxx b/svtools/source/filter/wmf/enhwmf.cxx index 23990473aa60..ce7842b0c270 100644 --- a/svtools/source/filter/wmf/enhwmf.cxx +++ b/svtools/source/filter/wmf/enhwmf.cxx @@ -261,22 +261,27 @@ void EnhWMFReader::ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC) } bEMFPlus = true; + sal_Size pos = pWMF->Tell(); void *buffer = malloc( length ); - - int pos = pWMF->Tell(); pOut->PassEMFPlus( buffer, pWMF->Read( buffer, length ) ); + free( buffer ); pWMF->Seek( pos ); bHaveDC = false; - length -= 4; + OSL_ASSERT(length >= 4); + //reduce by 32bit length itself, skip in SeekRel if + //impossibly unavailble + sal_uInt32 nRemainder = length >= 4 ? length-4 : length; - while (length > 0) { - sal_uInt16 type, flags; - sal_uInt32 size, dataSize; - sal_uInt32 next; + const size_t nRequiredHeaderSize = 12; + while (nRemainder > nRequiredHeaderSize) + { + sal_uInt16 type(0), flags(0); + sal_uInt32 size(0), dataSize(0); *pWMF >> type >> flags >> size >> dataSize; + nRemainder -= nRequiredHeaderSize; EMFP_DEBUG(printf ("\t\tEMF+ record type: %d\n", type)); @@ -286,14 +291,16 @@ void EnhWMFReader::ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC) EMFP_DEBUG(printf ("\t\tEMF+ lock DC (device context)\n", type)); } - next = pWMF->Tell() + ( size - 12 ); - - length -= size; - - pWMF->Seek( next ); + //Get the length of the remaining data of this record based + //on the alleged size + sal_uInt32 nRemainingRecordData = size >= nRequiredHeaderSize ? + size-nRequiredHeaderSize : 0; + //clip to available size + nRemainingRecordData = std::min(nRemainingRecordData, nRemainder); + pWMF->SeekRel(nRemainingRecordData); + nRemainder -= nRemainingRecordData; } - - free( buffer ); + pWMF->SeekRel(nRemainder); } void EnhWMFReader::ReadGDIComment() diff --git a/svtools/source/filter/wmf/winmtf.hxx b/svtools/source/filter/wmf/winmtf.hxx index 16e9296a2b8f..270af93a4675 100644 --- a/svtools/source/filter/wmf/winmtf.hxx +++ b/svtools/source/filter/wmf/winmtf.hxx @@ -298,7 +298,6 @@ struct WMF_APMFILEHEADER; //============================ WMFReader ================================== - #ifdef WIN_MTF_ASSERT #define WIN_MTF_ASSERT_INIT 0x80000000 #define WIN_MTF_ASSERT_ONCE 0x40000000 @@ -319,35 +318,34 @@ public : void excludeClipRect( const Rectangle& rRect ); void moveClipRegion( const Size& rSize ); - bool isEmpty() const { return maClip.isCleared(); } + bool isEmpty() const { return maClip.isCleared(); } basegfx::B2DPolyPolygon getClipPath() const; - bool operator==( const WinMtfClipPath& rPath ) const - { - return maClip == rPath.maClip; - }; + bool operator==( const WinMtfClipPath& rPath ) const + { + return maClip == rPath.maClip; + }; }; class WinMtfPathObj : public PolyPolygon { - sal_Bool bClosed; + sal_Bool bClosed; - public : +public : WinMtfPathObj() { bClosed = sal_True; } - void Init() { Clear(); bClosed = sal_True; }; - void ClosePath(); - - void AddPoint( const Point& rPoint ); - void AddPolygon( const Polygon& rPoly ); - void AddPolyLine( const Polygon& rPoly ); - void AddPolyPolygon( const PolyPolygon& rPolyPolygon ); + void Init() { Clear(); bClosed = sal_True; }; + void ClosePath(); + void AddPoint( const Point& rPoint ); + void AddPolygon( const Polygon& rPoly ); + void AddPolyLine( const Polygon& rPoly ); + void AddPolyPolygon( const PolyPolygon& rPolyPolygon ); }; struct WinMtfFontStyle { - Font aFont; + Font aFont; WinMtfFontStyle( LOGFONTW& rLogFont ); }; @@ -362,7 +360,7 @@ typedef enum { struct WinMtfFillStyle { Color aFillColor; - sal_Bool bTransparent; + sal_Bool bTransparent; WinMtfFillStyleType aType; Bitmap aBmp; @@ -387,11 +385,35 @@ struct WinMtfFillStyle } sal_Bool operator==( const WinMtfFillStyle& rStyle ) - { return ( ( aFillColor == rStyle.aFillColor ) && ( bTransparent == rStyle.bTransparent ) && ( aType == rStyle.aType ) ); } + { + return ( ( aFillColor == rStyle.aFillColor ) + && ( bTransparent == rStyle.bTransparent ) + && ( aType == rStyle.aType ) + ); + } sal_Bool operator==( WinMtfFillStyle* pStyle ) - { return ( ( aFillColor == pStyle->aFillColor ) && ( bTransparent == pStyle->bTransparent ) && ( aType == pStyle->aType ) ); } - WinMtfFillStyle& operator=( const WinMtfFillStyle& rStyle ) { aFillColor = rStyle.aFillColor; bTransparent = rStyle.bTransparent; aBmp = rStyle.aBmp; aType = rStyle.aType; return *this; } - WinMtfFillStyle& operator=( WinMtfFillStyle* pStyle ) { aFillColor = pStyle->aFillColor; bTransparent = pStyle->bTransparent; aBmp = pStyle->aBmp; aType = pStyle->aType; return *this; } + { + return ( ( aFillColor == pStyle->aFillColor ) + && ( bTransparent == pStyle->bTransparent ) + && ( aType == pStyle->aType ) + ); + } + WinMtfFillStyle& operator=( const WinMtfFillStyle& rStyle ) + { + aFillColor = rStyle.aFillColor; + bTransparent = rStyle.bTransparent; + aBmp = rStyle.aBmp; + aType = rStyle.aType; + return *this; + } + WinMtfFillStyle& operator=( WinMtfFillStyle* pStyle ) + { + aFillColor = pStyle->aFillColor; + bTransparent = pStyle->bTransparent; + aBmp = pStyle->aBmp; + aType = pStyle->aType; + return *this; + } }; // ----------------------------------------------------------------------------- @@ -415,8 +437,20 @@ struct WinMtfLineStyle aLineInfo ( rStyle ), bTransparent( bTrans ) {} - sal_Bool operator==( const WinMtfLineStyle& rStyle ) { return ( ( aLineColor == rStyle.aLineColor ) && ( bTransparent == rStyle.bTransparent ) && ( aLineInfo == rStyle.aLineInfo ) ); } - sal_Bool operator==( WinMtfLineStyle* pStyle ) { return ( ( aLineColor == pStyle->aLineColor ) && ( bTransparent == pStyle->bTransparent ) && ( aLineInfo == pStyle->aLineInfo ) ); } + sal_Bool operator==( const WinMtfLineStyle& rStyle ) + { + return ( ( aLineColor == rStyle.aLineColor ) + && ( bTransparent == rStyle.bTransparent ) + && ( aLineInfo == rStyle.aLineInfo ) + ); + } + sal_Bool operator==( WinMtfLineStyle* pStyle ) + { + return ( ( aLineColor == pStyle->aLineColor ) + && ( bTransparent == pStyle->bTransparent ) + && ( aLineInfo == pStyle->aLineInfo ) + ); + } WinMtfLineStyle& operator=( const WinMtfLineStyle& rStyle ) { aLineColor = rStyle.aLineColor; @@ -490,13 +524,30 @@ struct BSaveStruct sal_uInt32 nWinRop; WinMtfFillStyle aStyle; - BSaveStruct( const Bitmap& rBmp, const Rectangle& rOutRect, sal_uInt32 nRop, WinMtfFillStyle& rStyle ) : - aBmp( rBmp ), aOutRect( rOutRect ), nWinRop( nRop ), aStyle ( rStyle ){} + BSaveStruct( + const Bitmap& rBmp, + const Rectangle& rOutRect, + sal_uInt32 nRop, + WinMtfFillStyle& rStyle + ) + : aBmp( rBmp ) + , aOutRect( rOutRect ) + , nWinRop( nRop ) + , aStyle ( rStyle ) + {} }; // ----------------------------------------------------------------------------- -enum GDIObjectType { GDI_DUMMY = 0, GDI_PEN = 1, GDI_BRUSH = 2, GDI_FONT = 3, GDI_PALETTE = 4, GDI_BITMAP = 5, GDI_REGION = 6 }; +enum GDIObjectType { + GDI_DUMMY = 0, + GDI_PEN = 1, + GDI_BRUSH = 2, + GDI_FONT = 3, + GDI_PALETTE = 4, + GDI_BITMAP = 5, + GDI_REGION = 6 +}; struct GDIObj { @@ -546,163 +597,193 @@ struct GDIObj class WinMtfOutput { - WinMtfPathObj aPathObj; - WinMtfClipPath aClipPath; - - WinMtfLineStyle maLatestLineStyle; - WinMtfLineStyle maLineStyle; - WinMtfFillStyle maLatestFillStyle; - WinMtfFillStyle maFillStyle; - Font maLatestFont; - Font maFont; - sal_uInt32 mnLatestTextAlign; - sal_uInt32 mnTextAlign; - Color maLatestTextColor; - Color maTextColor; - Color maLatestBkColor; - Color maBkColor; - sal_uInt32 mnLatestTextLayoutMode; - sal_uInt32 mnTextLayoutMode; - sal_uInt32 mnLatestBkMode; - sal_uInt32 mnBkMode; - RasterOp meLatestRasterOp; - RasterOp meRasterOp; - - std::vector< GDIObj* > vGDIObj; - - Point maActPos; - - sal_uInt32 mnRop; - sal_Bool mbNopMode; - sal_Bool mbFillStyleSelected; - sal_Bool mbClipNeedsUpdate; - sal_Bool mbComplexClip; - - std::vector< SaveStructPtr > vSaveStack; - - sal_uInt32 mnGfxMode; - sal_uInt32 mnMapMode; - sal_uInt16 mnUnitsPerInch; - - XForm maXForm; - sal_Int32 mnDevOrgX, mnDevOrgY; - sal_Int32 mnDevWidth, mnDevHeight; - sal_Int32 mnWinOrgX, mnWinOrgY; // aktuelles Window-Origin - sal_Int32 mnWinExtX, mnWinExtY; // aktuelles Window-Extent - - sal_Int32 mnPixX, mnPixY; // Reference Device in pixel - sal_Int32 mnMillX, mnMillY; // Reference Device in Mill - Rectangle mrclFrame; // rectangle in logical units 1/100th mm - Rectangle mrclBounds; - - GDIMetaFile* mpGDIMetaFile; - - void UpdateLineStyle(); - void UpdateFillStyle(); - - Point ImplMap( const Point& rPt ); - Size ImplMap( const Size& rSz ); - Rectangle ImplMap( const Rectangle& rRectangle ); - void ImplMap( Font& rFont ); - Polygon& ImplMap( Polygon& rPolygon ); - PolyPolygon& ImplMap( PolyPolygon& rPolyPolygon ); - void ImplResizeObjectArry( sal_uInt32 nNewEntry ); - void ImplSetNonPersistentLineColorTransparenz(); - void ImplDrawClippedPolyPolygon( const PolyPolygon& rPolyPoly ); - void ImplDrawBitmap( const Point& rPos, const Size& rSize, const BitmapEx rBitmap ); - - public: - - void SetDevOrg( const Point& rPoint ); - void SetDevOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd ); - void SetDevExt( const Size& rSize ); - void ScaleDevExt( double fX, double fY ); - - void SetWinOrg( const Point& rPoint ); - void SetWinOrgOffset( sal_Int32 nX, sal_Int32 nY ); - void SetWinExt( const Size& rSize ); - void ScaleWinExt( double fX, double fY ); - - void SetrclBounds( const Rectangle& rRect ); - void SetrclFrame( const Rectangle& rRect ); - void SetRefPix( const Size& rSize ); - void SetRefMill( const Size& rSize ); - - sal_uInt32 GetMapMode() const { return mnMapMode; }; - void SetMapMode( sal_uInt32 mnMapMode ); - void SetUnitsPerInch( sal_uInt16 nUnitsPerInch ); - void SetWorldTransform( const XForm& rXForm ); - void ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode ); - - void Push(); - void Pop(); - - sal_uInt32 SetRasterOp( sal_uInt32 nRasterOp ); - void StrokeAndFillPath( sal_Bool bStroke, sal_Bool bFill ); - - void SetGfxMode( sal_Int32 nGfxMode ){ mnGfxMode = nGfxMode; }; - sal_Int32 GetGfxMode() const { return mnGfxMode; }; - void SetBkMode( sal_uInt32 nMode ); - void SetBkColor( const Color& rColor ); - void SetTextColor( const Color& rColor ); - void SetTextAlign( sal_uInt32 nAlign ); - void CreateObject( GDIObjectType, void* pStyle = NULL ); - void CreateObject( sal_Int32 nIndex, GDIObjectType, void* pStyle = NULL ); - void DeleteObject( sal_Int32 nIndex ); - void SelectObject( sal_Int32 nIndex ); - CharSet GetCharSet(){ return maFont.GetCharSet(); }; - WinMtfFillStyle& GetFillStyle () { return maFillStyle; } - void SetFont( const Font& rFont ); - const Font& GetFont() const; - void SetTextLayoutMode( const sal_uInt32 nLayoutMode ); - sal_uInt32 GetTextLayoutMode() const; - - void ClearPath(){ aPathObj.Init(); }; - void ClosePath(){ aPathObj.ClosePath(); }; - const PolyPolygon& GetPathObj(){ return aPathObj; }; - - void MoveTo( const Point& rPoint, sal_Bool bRecordPath = sal_False ); - void LineTo( const Point& rPoint, sal_Bool bRecordPath = sal_False ); - void DrawPixel( const Point& rSource, const Color& rColor ); - void DrawLine( const Point& rSource, const Point& rDest ); - void DrawRect( const Rectangle& rRect, sal_Bool bEdge = sal_True ); - void DrawRoundRect( const Rectangle& rRect, const Size& rSize ); - void DrawEllipse( const Rectangle& rRect ); - void DrawArc( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle, sal_Bool bDrawTo = sal_False ); - void DrawPie( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle ); - void DrawChord( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle ); - void DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath = sal_False ); - void DrawPolyPolygon( PolyPolygon& rPolyPolygon, sal_Bool bRecordPath = sal_False ); - void DrawPolyLine( Polygon& rPolygon, sal_Bool bDrawTo = sal_False, sal_Bool bRecordPath = sal_False ); - void DrawPolyBezier( Polygon& rPolygin, sal_Bool bDrawTo = sal_False, sal_Bool bRecordPath = sal_False ); - void DrawText( Point& rPosition, String& rString, sal_Int32* pDXArry = NULL, sal_Bool bRecordPath = sal_False, - sal_Int32 nGraphicsMode = GM_COMPATIBLE ); - void ResolveBitmapActions( List& rSaveList ); - - void IntersectClipRect( const Rectangle& rRect ); - void ExcludeClipRect( const Rectangle& rRect ); - void MoveClipRegion( const Size& rSize ); - void SetClipPath( const PolyPolygon& rPolyPoly, sal_Int32 nClippingMode, sal_Bool bIsMapped ); - void UpdateClipRegion(); - void AddFromGDIMetaFile( GDIMetaFile& rGDIMetaFile ); - - void PassEMFPlus( void* pBuffer, sal_uInt32 nLength ); - void PassEMFPlusHeaderInfo(); - - WinMtfOutput( GDIMetaFile& rGDIMetaFile ); - virtual ~WinMtfOutput(); + WinMtfPathObj aPathObj; + WinMtfClipPath aClipPath; + + WinMtfLineStyle maLatestLineStyle; + WinMtfLineStyle maLineStyle; + WinMtfFillStyle maLatestFillStyle; + WinMtfFillStyle maFillStyle; + Font maLatestFont; + Font maFont; + sal_uInt32 mnLatestTextAlign; + sal_uInt32 mnTextAlign; + Color maLatestTextColor; + Color maTextColor; + Color maLatestBkColor; + Color maBkColor; + sal_uInt32 mnLatestTextLayoutMode; + sal_uInt32 mnTextLayoutMode; + sal_uInt32 mnLatestBkMode; + sal_uInt32 mnBkMode; + RasterOp meLatestRasterOp; + RasterOp meRasterOp; + + std::vector< GDIObj* > vGDIObj; + + Point maActPos; + + sal_uInt32 mnRop; + sal_Bool mbNopMode; + sal_Bool mbFillStyleSelected; + sal_Bool mbClipNeedsUpdate; + sal_Bool mbComplexClip; + + std::vector< SaveStructPtr > vSaveStack; + + sal_uInt32 mnGfxMode; + sal_uInt32 mnMapMode; + sal_uInt16 mnUnitsPerInch; + + XForm maXForm; + sal_Int32 mnDevOrgX, mnDevOrgY; + sal_Int32 mnDevWidth, mnDevHeight; + sal_Int32 mnWinOrgX, mnWinOrgY; // aktuelles Window-Origin + sal_Int32 mnWinExtX, mnWinExtY; // aktuelles Window-Extent + + sal_Int32 mnPixX, mnPixY; // Reference Device in pixel + sal_Int32 mnMillX, mnMillY; // Reference Device in Mill + Rectangle mrclFrame; // rectangle in logical units 1/100th mm + Rectangle mrclBounds; + + GDIMetaFile* mpGDIMetaFile; + + void UpdateLineStyle(); + void UpdateFillStyle(); + + Point ImplMap( const Point& rPt ); + Size ImplMap( const Size& rSz ); + Rectangle ImplMap( const Rectangle& rRectangle ); + void ImplMap( Font& rFont ); + Polygon& ImplMap( Polygon& rPolygon ); + PolyPolygon& ImplMap( PolyPolygon& rPolyPolygon ); + void ImplResizeObjectArry( sal_uInt32 nNewEntry ); + void ImplSetNonPersistentLineColorTransparenz(); + void ImplDrawClippedPolyPolygon( const PolyPolygon& rPolyPoly ); + void ImplDrawBitmap( const Point& rPos, const Size& rSize, const BitmapEx rBitmap ); + +public: + + void SetDevOrg( const Point& rPoint ); + void SetDevOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd ); + void SetDevExt( const Size& rSize ); + void ScaleDevExt( double fX, double fY ); + + void SetWinOrg( const Point& rPoint ); + void SetWinOrgOffset( sal_Int32 nX, sal_Int32 nY ); + void SetWinExt( const Size& rSize ); + void ScaleWinExt( double fX, double fY ); + + void SetrclBounds( const Rectangle& rRect ); + void SetrclFrame( const Rectangle& rRect ); + void SetRefPix( const Size& rSize ); + void SetRefMill( const Size& rSize ); + + sal_uInt32 GetMapMode() const { return mnMapMode; }; + void SetMapMode( sal_uInt32 mnMapMode ); + void SetUnitsPerInch( sal_uInt16 nUnitsPerInch ); + void SetWorldTransform( const XForm& rXForm ); + void ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode ); + + void Push(); + void Pop(); + + sal_uInt32 SetRasterOp( sal_uInt32 nRasterOp ); + void StrokeAndFillPath( sal_Bool bStroke, sal_Bool bFill ); + + void SetGfxMode( sal_Int32 nGfxMode ){ mnGfxMode = nGfxMode; }; + sal_Int32 GetGfxMode() const { return mnGfxMode; }; + void SetBkMode( sal_uInt32 nMode ); + void SetBkColor( const Color& rColor ); + void SetTextColor( const Color& rColor ); + void SetTextAlign( sal_uInt32 nAlign ); + void CreateObject( GDIObjectType, void* pStyle = NULL ); + void CreateObject( sal_Int32 nIndex, GDIObjectType, void* pStyle = NULL ); + void DeleteObject( sal_Int32 nIndex ); + void SelectObject( sal_Int32 nIndex ); + CharSet GetCharSet(){ return maFont.GetCharSet(); }; + WinMtfFillStyle& GetFillStyle () { return maFillStyle; } + void SetFont( const Font& rFont ); + const Font& GetFont() const; + void SetTextLayoutMode( const sal_uInt32 nLayoutMode ); + sal_uInt32 GetTextLayoutMode() const; + + void ClearPath(){ aPathObj.Init(); }; + void ClosePath(){ aPathObj.ClosePath(); }; + const PolyPolygon& GetPathObj(){ return aPathObj; }; + + void MoveTo( const Point& rPoint, sal_Bool bRecordPath = sal_False ); + void LineTo( const Point& rPoint, sal_Bool bRecordPath = sal_False ); + void DrawPixel( const Point& rSource, const Color& rColor ); + void DrawLine( const Point& rSource, const Point& rDest ); + void DrawRect( const Rectangle& rRect, sal_Bool bEdge = sal_True ); + void DrawRoundRect( const Rectangle& rRect, const Size& rSize ); + void DrawEllipse( const Rectangle& rRect ); + void DrawArc( + const Rectangle& rRect, + const Point& rStartAngle, + const Point& rEndAngle, + sal_Bool bDrawTo = sal_False + ); + void DrawPie( + const Rectangle& rRect, + const Point& rStartAngle, + const Point& rEndAngle + ); + void DrawChord( + const Rectangle& rRect, + const Point& rStartAngle, + const Point& rEndAngle + ); + void DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath = sal_False ); + void DrawPolyPolygon( PolyPolygon& rPolyPolygon, sal_Bool bRecordPath = sal_False ); + void DrawPolyLine( + Polygon& rPolygon, + sal_Bool bDrawTo = sal_False, + sal_Bool bRecordPath = sal_False + ); + void DrawPolyBezier( + Polygon& rPolygin, + sal_Bool bDrawTo = sal_False, + sal_Bool bRecordPath = sal_False + ); + void DrawText( + Point& rPosition, + String& rString, + sal_Int32* pDXArry = NULL, + sal_Bool bRecordPath = sal_False, + sal_Int32 nGraphicsMode = GM_COMPATIBLE + ); + void ResolveBitmapActions( List& rSaveList ); + + void IntersectClipRect( const Rectangle& rRect ); + void ExcludeClipRect( const Rectangle& rRect ); + void MoveClipRegion( const Size& rSize ); + void SetClipPath( + const PolyPolygon& rPolyPoly, + sal_Int32 nClippingMode, + sal_Bool bIsMapped + ); + void UpdateClipRegion(); + void AddFromGDIMetaFile( GDIMetaFile& rGDIMetaFile ); + + void PassEMFPlus( void* pBuffer, sal_uInt32 nLength ); + void PassEMFPlusHeaderInfo(); + + WinMtfOutput( GDIMetaFile& rGDIMetaFile ); + virtual ~WinMtfOutput(); }; // ----------------------------------------------------------------------------- class WinMtf { - protected: +protected: WinMtfOutput* pOut; // SvStream* pWMF; // Die einzulesende WMF/EMF-Datei - sal_uInt32 nStartPos, nEndPos; + sal_uInt32 nStartPos, nEndPos; List aBmpSaveList; FilterConfigItem* pFilterConfigItem; @@ -714,10 +795,14 @@ class WinMtf Color ReadColor(); void Callback( sal_uInt16 nPercent ); - WinMtf( WinMtfOutput* pOut, SvStream& rStreamWMF, FilterConfigItem* pConfigItem = NULL ); + WinMtf( + WinMtfOutput* pOut, + SvStream& rStreamWMF, + FilterConfigItem* pConfigItem = NULL + ); ~WinMtf(); - public: +public: }; @@ -730,16 +815,26 @@ class EnhWMFReader : public WinMtf sal_Bool bEMFPlus; - sal_Bool ReadHeader(); - Rectangle ReadRectangle( sal_Int32, sal_Int32, sal_Int32, sal_Int32 ); // Liesst und konvertiert ein Rechteck + sal_Bool ReadHeader(); + // Liesst und konvertiert ein Rechteck + Rectangle ReadRectangle( sal_Int32, sal_Int32, sal_Int32, sal_Int32 ); void ImplExtTextOut( sal_Bool bWideCharakter ); public: - EnhWMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL ) - : WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ), bRecordPath( sal_False ), bEMFPlus( sal_False ) {}; + EnhWMFReader( + SvStream& rStreamWMF, + GDIMetaFile& rGDIMetaFile, + FilterConfigItem* pConfigItem = NULL + ) + : WinMtf( new WinMtfOutput( rGDIMetaFile ) + , rStreamWMF + , pConfigItem ) + , bRecordPath( sal_False ) + , bEMFPlus( sal_False ) + {}; ~EnhWMFReader(); - sal_Bool ReadEnhWMF(); + sal_Bool ReadEnhWMF(); void ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC); void ReadGDIComment(); }; @@ -751,7 +846,7 @@ class WMFReader : public WinMtf private: VirtualDevice aVDev; // just for the purpose of "IsFontAvailable" - sal_uInt16 nUnitsPerInch; + sal_uInt16 nUnitsPerInch; sal_uInt32 nRecSize; // embedded EMF data @@ -771,7 +866,7 @@ private: sal_uInt32 nUnicodeEscapeAction; // Liesst den Kopf der WMF-Datei - sal_Bool ReadHeader(WMF_APMFILEHEADER *pAPMHeader); + sal_Bool ReadHeader( WMF_APMFILEHEADER *pAPMHeader ); // Liesst die Parameter des Rocords mit der Funktionsnummer nFunction. void ReadRecordParams( sal_uInt16 nFunction ); @@ -784,10 +879,14 @@ private: public: - WMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL ) + WMFReader( + SvStream& rStreamWMF, + GDIMetaFile& rGDIMetaFile, + FilterConfigItem* pConfigItem = NULL + ) : WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ) , pEMFStream(NULL) - {} + {} ~WMFReader(); diff --git a/svtools/source/filter/wmf/wmf.cxx b/svtools/source/filter/wmf/wmf.cxx index 9b2a8edf2d6e..03923ddc508a 100644 --- a/svtools/source/filter/wmf/wmf.cxx +++ b/svtools/source/filter/wmf/wmf.cxx @@ -102,13 +102,6 @@ sal_Bool ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetSt // ----------------------------------------------------------------------------- -sal_Bool WriteWindowMetafile( SvStream& rStream, const GDIMetaFile& rMTF ) -{ - return WMFWriter().WriteWMF( rMTF, rStream, NULL ); -} - -// ----------------------------------------------------------------------------- - sal_Bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF ) { return WMFWriter().WriteWMF( rMTF, rStream, NULL, sal_False ); diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index df7bfa9f88b1..e0aa6595f6ac 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -162,15 +162,16 @@ class GraphicCacheEntry { private: - List maGraphicObjectList; + GraphicObjectList_impl maGraphicObjectList; + GraphicID maID; GfxLink maGfxLink; BitmapEx* mpBmpEx; GDIMetaFile* mpMtf; Animation* mpAnimation; - sal_Bool mbSwappedAll; + bool mbSwappedAll; - sal_Bool ImplInit( const GraphicObject& rObj ); + bool ImplInit( const GraphicObject& rObj ); void ImplFillSubstitute( Graphic& rSubstitute ); public: @@ -181,13 +182,13 @@ public: const GraphicID& GetID() const { return maID; } void AddGraphicObjectReference( const GraphicObject& rObj, Graphic& rSubstitute ); - sal_Bool ReleaseGraphicObjectReference( const GraphicObject& rObj ); - sal_uLong GetGraphicObjectReferenceCount() { return maGraphicObjectList.Count(); } - sal_Bool HasGraphicObjectReference( const GraphicObject& rObj ); + bool ReleaseGraphicObjectReference( const GraphicObject& rObj ); + size_t GetGraphicObjectReferenceCount() { return maGraphicObjectList.size(); } + bool HasGraphicObjectReference( const GraphicObject& rObj ); void TryToSwapIn(); void GraphicObjectWasSwappedOut( const GraphicObject& rObj ); - sal_Bool FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); + bool FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ); void GraphicObjectWasSwappedIn( const GraphicObject& rObj ); }; @@ -200,14 +201,17 @@ GraphicCacheEntry::GraphicCacheEntry( const GraphicObject& rObj ) : mpAnimation ( NULL ), mbSwappedAll ( !ImplInit( rObj ) ) { - maGraphicObjectList.Insert( (void*) &rObj, LIST_APPEND ); + maGraphicObjectList.push_back( (GraphicObject*)&rObj ); } // ----------------------------------------------------------------------------- GraphicCacheEntry::~GraphicCacheEntry() { - DBG_ASSERT( !maGraphicObjectList.Count(), "GraphicCacheEntry::~GraphicCacheEntry(): Not all GraphicObjects are removed from this entry" ); + DBG_ASSERT( + maGraphicObjectList.empty(), + "GraphicCacheEntry::~GraphicCacheEntry(): Not all GraphicObjects are removed from this entry" + ); delete mpBmpEx; delete mpMtf; @@ -216,9 +220,9 @@ GraphicCacheEntry::~GraphicCacheEntry() // ----------------------------------------------------------------------------- -sal_Bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj ) +bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj ) { - sal_Bool bRet; + bool bRet = false; if( !rObj.IsSwappedOut() ) { @@ -260,10 +264,8 @@ sal_Bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj ) else maGfxLink = GfxLink(); - bRet = sal_True; + bRet = true; } - else - bRet = sal_False; return bRet; } @@ -277,9 +279,9 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute ) const MapMode aPrefMapMode( rSubstitute.GetPrefMapMode() ); const Link aAnimationNotifyHdl( rSubstitute.GetAnimationNotifyHdl() ); const String aDocFileName( rSubstitute.GetDocFileName() ); - const sal_uLong nDocFilePos = rSubstitute.GetDocFilePos(); + const sal_uLong nDocFilePos = rSubstitute.GetDocFilePos(); const GraphicType eOldType = rSubstitute.GetType(); - const sal_Bool bDefaultType = ( rSubstitute.GetType() == GRAPHIC_DEFAULT ); + const bool bDefaultType = ( rSubstitute.GetType() == GRAPHIC_DEFAULT ); if( rSubstitute.IsLink() && ( GFX_LINK_TYPE_NONE == maGfxLink.GetType() ) ) maGfxLink = rSubstitute.GetLink(); @@ -316,36 +318,37 @@ void GraphicCacheEntry::AddGraphicObjectReference( const GraphicObject& rObj, Gr mbSwappedAll = !ImplInit( rObj ); ImplFillSubstitute( rSubstitute ); - maGraphicObjectList.Insert( (void*) &rObj, LIST_APPEND ); + maGraphicObjectList.push_back( (GraphicObject*) &rObj ); } // ----------------------------------------------------------------------------- -sal_Bool GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject& rObj ) +bool GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject& rObj ) { - sal_Bool bRet = sal_False; - - for( void* pObj = maGraphicObjectList.First(); !bRet && pObj; pObj = maGraphicObjectList.Next() ) - { - if( &rObj == (GraphicObject*) pObj ) + for( + GraphicObjectList_impl::iterator it = maGraphicObjectList.begin(); + it != maGraphicObjectList.end(); + ++it + ) { + if( &rObj == *it ) { - maGraphicObjectList.Remove( pObj ); - bRet = sal_True; + maGraphicObjectList.erase( it ); + return true; } } - return bRet; + return false; } // ----------------------------------------------------------------------------- -sal_Bool GraphicCacheEntry::HasGraphicObjectReference( const GraphicObject& rObj ) +bool GraphicCacheEntry::HasGraphicObjectReference( const GraphicObject& rObj ) { - sal_Bool bRet = sal_False; + bool bRet = false; - for( void* pObj = maGraphicObjectList.First(); !bRet && pObj; pObj = maGraphicObjectList.Next() ) - if( &rObj == (GraphicObject*) pObj ) - bRet = sal_True; + for( size_t i = 0, n = maGraphicObjectList.size(); ( i < n ) && !bRet; ++i ) + if( &rObj == maGraphicObjectList[ i ] ) + bRet = true; return bRet; } @@ -354,41 +357,39 @@ sal_Bool GraphicCacheEntry::HasGraphicObjectReference( const GraphicObject& rObj void GraphicCacheEntry::TryToSwapIn() { - if( mbSwappedAll && maGraphicObjectList.Count() ) - ( (GraphicObject*) maGraphicObjectList.First() )->FireSwapInRequest(); + if( mbSwappedAll && !maGraphicObjectList.empty() ) + maGraphicObjectList.front()->FireSwapInRequest(); } // ----------------------------------------------------------------------------- void GraphicCacheEntry::GraphicObjectWasSwappedOut( const GraphicObject& /*rObj*/ ) { - mbSwappedAll = sal_True; + mbSwappedAll = true; - for( void* pObj = maGraphicObjectList.First(); mbSwappedAll && pObj; pObj = maGraphicObjectList.Next() ) - if( !( (GraphicObject*) pObj )->IsSwappedOut() ) - mbSwappedAll = sal_False; + for( size_t i = 0, n = maGraphicObjectList.size(); ( i < n ) && mbSwappedAll; ++i ) + if( !maGraphicObjectList[ i ]->IsSwappedOut() ) + mbSwappedAll = false; if( mbSwappedAll ) { delete mpBmpEx, mpBmpEx = NULL; - delete mpMtf, mpMtf = NULL; + mpMtf = NULL; // No need to delete it as it has already been dereferenced delete mpAnimation, mpAnimation = NULL; } } // ----------------------------------------------------------------------------- -sal_Bool GraphicCacheEntry::FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ) +bool GraphicCacheEntry::FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute ) { - sal_Bool bRet; + bool bRet = false; if( !mbSwappedAll && rObj.IsSwappedOut() ) { ImplFillSubstitute( rSubstitute ); - bRet = sal_True; + bRet = true; } - else - bRet = sal_False; return bRet; } @@ -676,7 +677,7 @@ void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj ) { // Release cached object GraphicCacheEntry* pEntry = (GraphicCacheEntry*) maGraphicCache.First(); - sal_Bool bRemoved = sal_False; + bool bRemoved = false; while( !bRemoved && pEntry ) { diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 19b09e8f67a7..63df21b3993d 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -547,11 +547,6 @@ void GraphicObject::SetAnimationNotifyHdl( const Link& rLink ) maGraphic.SetAnimationNotifyHdl( rLink ); } -List* GraphicObject::GetAnimationInfoList() const -{ - return maGraphic.GetAnimationInfoList(); -} - sal_Bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz, const GraphicAttr* pAttr, sal_uLong nFlags ) { @@ -1232,4 +1227,4 @@ GraphicObject GraphicObject::CreateGraphicObjectFromURL( const ::rtl::OUString & } } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 1115635157a8..b5d7b2bcda15 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -122,8 +122,8 @@ GraphicManager::GraphicManager( sal_uLong nCacheSize, sal_uLong nMaxObjCacheSize GraphicManager::~GraphicManager() { - for( void* pObj = maObjList.First(); pObj; pObj = maObjList.Next() ) - ( (GraphicObject*) pObj )->GraphicManagerDestroyed(); + for( size_t i = 0, n = maObjList.size(); i < n; ++i ) + maObjList[ i ]->GraphicManagerDestroyed(); delete mpCache; } @@ -271,7 +271,7 @@ sal_Bool GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Si void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute, const ByteString* pID, const GraphicObject* pCopyObj ) { - maObjList.Insert( (void*) &rObj, LIST_APPEND ); + maObjList.push_back( (GraphicObject*)&rObj ); mpCache->AddGraphicObject( rObj, rSubstitute, pID, pCopyObj ); } @@ -280,7 +280,13 @@ void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubst void GraphicManager::ImplUnregisterObj( const GraphicObject& rObj ) { mpCache->ReleaseGraphicObject( rObj ); - maObjList.Remove( (void*) &rObj ); + for( GraphicObjectList_impl::iterator it = maObjList.begin(); it < maObjList.end(); ++it ) + { + if ( *it == &rObj ) { + maObjList.erase( it ); + break; + } + } } // ----------------------------------------------------------------------------- @@ -2384,4 +2390,4 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx, } } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/hatchwindow/hatchwindowfactory.component b/svtools/source/hatchwindow/hatchwindowfactory.component index 153fc8796281..b9ebbaefdd04 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.component +++ b/svtools/source/hatchwindow/hatchwindowfactory.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="hatchwindowfactory" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.embed.DocumentCloser"> <service name="com.sun.star.embed.DocumentCloser"/> diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx index a0ff0d4daf17..93401d8f8f43 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.cxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx @@ -109,13 +109,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OHatchWindowFactory::getSupportedServi extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL hatchwindowfactory_component_getFactory ( const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) { void * pResult = 0; diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx index c7603827f61e..d38046a6f47c 100644 --- a/svtools/source/inc/svimpbox.hxx +++ b/svtools/source/inc/svimpbox.hxx @@ -313,6 +313,7 @@ public: void SetCurEntry( SvLBoxEntry* ); Point GetEntryPosition( SvLBoxEntry* ) const; void MakeVisible( SvLBoxEntry* pEntry, sal_Bool bMoveToTop=sal_False ); + void ScrollToAbsPos( long nPos ); void PaintDDCursor( SvLBoxEntry* ); diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index d4ee29924801..39bb9f83bd87 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -165,30 +165,6 @@ void IMapObject::Read( SvStream& rIStm, const String& rBaseURL ) /****************************************************************************** |* -|* Konvertierung der logischen Koordianten in Pixel -|* -\******************************************************************************/ - -Point IMapObject::GetPixelPoint( const Point& rLogPoint ) -{ - return Application::GetDefaultDevice()->LogicToPixel( rLogPoint, MapMode( MAP_100TH_MM ) ); -} - - -/****************************************************************************** -|* -|* Konvertierung der logischen Koordianten in Pixel -|* -\******************************************************************************/ - -Point IMapObject::GetLogPoint( const Point& rPixelPoint ) -{ - return Application::GetDefaultDevice()->PixelToLogic( rPixelPoint, MapMode( MAP_100TH_MM ) ); -} - - -/****************************************************************************** -|* |* |* \******************************************************************************/ @@ -433,7 +409,7 @@ sal_Bool IMapCircleObject::IsHit( const Point& rPoint ) const const Point aPoint( aCenter - rPoint ); sal_Bool bRet = sal_False; - if ( (sal_uLong) sqrt( (double) aPoint.X() * aPoint.X() + + if ( (sal_Int32) sqrt( (double) aPoint.X() * aPoint.X() + aPoint.Y() * aPoint.Y() ) <= nRadius ) { bRet = sal_True; @@ -743,8 +719,8 @@ sal_Bool IMapPolygonObject::IsEqual( const IMapPolygonObject& rEqObj ) |* \******************************************************************************/ -ImageMap::ImageMap( const String& rName ) : - aName ( rName ) +ImageMap::ImageMap( const String& rName ) +: aName( rName ) { } @@ -759,24 +735,24 @@ ImageMap::ImageMap( const ImageMap& rImageMap ) { DBG_CTOR( ImageMap, NULL ); - sal_uInt16 nCount = rImageMap.GetIMapObjectCount(); + size_t nCount = rImageMap.GetIMapObjectCount(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { IMapObject* pCopyObj = rImageMap.GetIMapObject( i ); switch( pCopyObj->GetType() ) { case( IMAP_OBJ_RECTANGLE ): - maList.Insert( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ), LIST_APPEND ); + maList.push_back( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ) ); break; case( IMAP_OBJ_CIRCLE ): - maList.Insert( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ), LIST_APPEND ); + maList.push_back( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ) ); break; case( IMAP_OBJ_POLYGON ): - maList.Insert( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ), LIST_APPEND ); + maList.push_back( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ) ); break; default: @@ -810,15 +786,9 @@ ImageMap::~ImageMap() void ImageMap::ClearImageMap() { - IMapObject* pObj = (IMapObject*) maList.First(); - - while ( pObj ) - { - delete pObj; - pObj = (IMapObject*) maList.Next(); - } - - maList.Clear(); + for( size_t i = 0, n = maList.size(); i < n; ++i ) + delete maList[ i ]; + maList.clear(); aName = String(); } @@ -832,26 +802,26 @@ void ImageMap::ClearImageMap() ImageMap& ImageMap::operator=( const ImageMap& rImageMap ) { - sal_uInt16 nCount = rImageMap.GetIMapObjectCount(); + size_t nCount = rImageMap.GetIMapObjectCount(); ClearImageMap(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { IMapObject* pCopyObj = rImageMap.GetIMapObject( i ); switch( pCopyObj->GetType() ) { case( IMAP_OBJ_RECTANGLE ): - maList.Insert( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ), LIST_APPEND ); + maList.push_back( new IMapRectangleObject( *(IMapRectangleObject*) pCopyObj ) ); break; case( IMAP_OBJ_CIRCLE ): - maList.Insert( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ), LIST_APPEND ); + maList.push_back( new IMapCircleObject( *(IMapCircleObject*) pCopyObj ) ); break; case( IMAP_OBJ_POLYGON ): - maList.Insert( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ), LIST_APPEND ); + maList.push_back( new IMapPolygonObject( *(IMapPolygonObject*) pCopyObj ) ); break; default: @@ -873,17 +843,17 @@ ImageMap& ImageMap::operator=( const ImageMap& rImageMap ) sal_Bool ImageMap::operator==( const ImageMap& rImageMap ) { - const sal_uInt16 nCount = (sal_uInt16) maList.Count(); - const sal_uInt16 nEqCount = rImageMap.GetIMapObjectCount(); - sal_Bool bRet = sal_False; + const size_t nCount = maList.size(); + const size_t nEqCount = rImageMap.GetIMapObjectCount(); + sal_Bool bRet = sal_False; if ( nCount == nEqCount ) { sal_Bool bDifferent = ( aName != rImageMap.aName ); - for ( sal_uInt16 i = 0; ( i < nCount ) && !bDifferent; i++ ) + for ( size_t i = 0; ( i < nCount ) && !bDifferent; i++ ) { - IMapObject* pObj = (IMapObject*) maList.GetObject( i ); + IMapObject* pObj = maList[ i ]; IMapObject* pEqObj = rImageMap.GetIMapObject( i ); if ( pObj->GetType() == pEqObj->GetType() ) @@ -962,15 +932,15 @@ void ImageMap::InsertIMapObject( const IMapObject& rIMapObject ) switch( rIMapObject.GetType() ) { case( IMAP_OBJ_RECTANGLE ): - maList.Insert( new IMapRectangleObject( (IMapRectangleObject&) rIMapObject ), LIST_APPEND ); + maList.push_back( new IMapRectangleObject( (IMapRectangleObject&) rIMapObject ) ); break; case( IMAP_OBJ_CIRCLE ): - maList.Insert( new IMapCircleObject( (IMapCircleObject&) rIMapObject ), LIST_APPEND ); + maList.push_back( new IMapCircleObject( (IMapCircleObject&) rIMapObject ) ); break; case( IMAP_OBJ_POLYGON ): - maList.Insert( new IMapPolygonObject( (IMapPolygonObject&) rIMapObject ), LIST_APPEND ); + maList.push_back( new IMapPolygonObject( (IMapPolygonObject&) rIMapObject ) ); break; default: @@ -1005,13 +975,12 @@ IMapObject* ImageMap::GetHitIMapObject( const Size& rTotalSize, } // Alle Objekte durchlaufen und HitTest ausfuehren - IMapObject* pObj = (IMapObject*) maList.First(); - while ( pObj ) - { - if ( pObj->IsHit( aRelPoint ) ) + IMapObject* pObj = NULL; + for( size_t i = 0, n = maList.size(); i < n; ++i ) { + if ( maList[ i ]->IsHit( aRelPoint ) ) { + pObj = maList[ i ]; break; - - pObj = (IMapObject*) maList.Next(); + } } return( pObj ? ( pObj->IsActive() ? pObj : NULL ) : NULL ); @@ -1027,10 +996,10 @@ IMapObject* ImageMap::GetHitIMapObject( const Size& rTotalSize, Rectangle ImageMap::GetBoundRect() const { Rectangle aBoundRect; - sal_uLong nCount = maList.Count(); + size_t nCount = maList.size(); - for ( sal_uLong i = 0; i < nCount; i++ ) - aBoundRect.Union( ( (IMapObject*) maList.GetObject( i ) )->GetBoundRect() ); + for ( size_t i = 0; i < nCount; i++ ) + aBoundRect.Union( maList[ i ]->GetBoundRect() ); return aBoundRect; } @@ -1044,11 +1013,11 @@ Rectangle ImageMap::GetBoundRect() const void ImageMap::Scale( const Fraction& rFracX, const Fraction& rFracY ) { - sal_uInt16 nCount = (sal_uInt16) maList.Count(); + size_t nCount = maList.size(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { - IMapObject* pObj = GetIMapObject( i ); + IMapObject* pObj = maList[ i ]; switch( pObj->GetType() ) { @@ -1080,11 +1049,11 @@ void ImageMap::Scale( const Fraction& rFracX, const Fraction& rFracY ) void ImageMap::ImpWriteImageMap( SvStream& rOStm, const String& rBaseURL ) const { IMapObject* pObj; - sal_uInt16 nCount = (sal_uInt16) maList.Count(); + size_t nCount = maList.size(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { - pObj = (IMapObject*) maList.GetObject( i ); + pObj = maList[ i ]; pObj->Write( rOStm, rBaseURL ); } } @@ -1096,10 +1065,10 @@ void ImageMap::ImpWriteImageMap( SvStream& rOStm, const String& rBaseURL ) const |* \******************************************************************************/ -void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String& rBaseURL ) +void ImageMap::ImpReadImageMap( SvStream& rIStm, size_t nCount, const String& rBaseURL ) { // neue Objekte einlesen - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { sal_uInt16 nType; @@ -1112,7 +1081,7 @@ void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String { IMapRectangleObject* pObj = new IMapRectangleObject; pObj->Read( rIStm, rBaseURL ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } break; @@ -1120,7 +1089,7 @@ void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String { IMapCircleObject* pObj = new IMapCircleObject; pObj->Read( rIStm, rBaseURL ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } break; @@ -1128,7 +1097,7 @@ void ImageMap::ImpReadImageMap( SvStream& rIStm, sal_uInt16 nCount, const String { IMapPolygonObject* pObj = new IMapPolygonObject; pObj->Read( rIStm, rBaseURL ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } break; diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index 20e8ae6431b8..359615a1b2c2 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -48,209 +48,111 @@ #define NOTEOL(c) ((c)!='\0') - TYPEINIT0_AUTOFACTORY( ImageMap ); - -/******************************************************************************/ -/******************************************************************************/ - - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - -void IMapObject::AppendCERNCoords( const Point& rPoint100, ByteString& rStr ) const +void IMapObject::AppendCERNCoords(rtl::OStringBuffer& rBuf, const Point& rPoint100) const { const Point aPixPt( Application::GetDefaultDevice()->LogicToPixel( rPoint100, MapMode( MAP_100TH_MM ) ) ); - rStr += '('; - rStr += ByteString::CreateFromInt32( aPixPt.X() ); - rStr += ','; - rStr += ByteString::CreateFromInt32( aPixPt.Y() ); - rStr += ") "; + rBuf.append('('); + rBuf.append(static_cast<sal_Int32>(aPixPt.X())); + rBuf.append(','); + rBuf.append(static_cast<sal_Int32>(aPixPt.Y())); + rBuf.append(RTL_CONSTASCII_STRINGPARAM(") ")); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - -void IMapObject::AppendNCSACoords( const Point& rPoint100, ByteString& rStr ) const +void IMapObject::AppendNCSACoords(rtl::OStringBuffer& rBuf, const Point& rPoint100) const { const Point aPixPt( Application::GetDefaultDevice()->LogicToPixel( rPoint100, MapMode( MAP_100TH_MM ) ) ); - rStr += ByteString::CreateFromInt32( aPixPt.X() ); - rStr += ','; - rStr += ByteString::CreateFromInt32( aPixPt.Y() ); - rStr += ' '; + rBuf.append(static_cast<sal_Int32>(aPixPt.X())); + rBuf.append(','); + rBuf.append(static_cast<sal_Int32>(aPixPt.Y())); + rBuf.append(' '); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - -void IMapObject::AppendCERNURL( ByteString& rStr, const String& rBaseURL ) const +void IMapObject::AppendCERNURL(rtl::OStringBuffer& rBuf, const String& rBaseURL) const { - rStr += ByteString( String(URIHelper::simpleNormalizedMakeRelative( rBaseURL, aURL )), gsl_getSystemTextEncoding() ); + rBuf.append(rtl::OUStringToOString(URIHelper::simpleNormalizedMakeRelative(rBaseURL, aURL), gsl_getSystemTextEncoding())); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - -void IMapObject::AppendNCSAURL( ByteString& rStr, const String& rBaseURL ) const +void IMapObject::AppendNCSAURL(rtl::OStringBuffer& rBuf, const String& rBaseURL) const { - rStr += ByteString( String(URIHelper::simpleNormalizedMakeRelative( rBaseURL, aURL )), gsl_getSystemTextEncoding() ); - rStr += ' '; + rBuf.append(rtl::OUStringToOString(URIHelper::simpleNormalizedMakeRelative(rBaseURL, aURL), gsl_getSystemTextEncoding())); + rBuf.append(' '); } - -/******************************************************************************/ -/******************************************************************************/ - - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void IMapRectangleObject::WriteCERN( SvStream& rOStm, const String& rBaseURL ) const { - ByteString aStr( "rectangle " ); + rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("rectangle ")); - AppendCERNCoords( aRect.TopLeft(), aStr ); - AppendCERNCoords( aRect.BottomRight(), aStr ); - AppendCERNURL( aStr, rBaseURL ); + AppendCERNCoords(aStrBuf, aRect.TopLeft()); + AppendCERNCoords(aStrBuf, aRect.BottomRight()); + AppendCERNURL(aStrBuf, rBaseURL); - rOStm.WriteLine( aStr ); + rOStm.WriteLine(aStrBuf.makeStringAndClear()); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void IMapRectangleObject::WriteNCSA( SvStream& rOStm, const String& rBaseURL ) const { - ByteString aStr( "rect " ); + rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("rect ")); - AppendNCSAURL( aStr, rBaseURL ); - AppendNCSACoords( aRect.TopLeft(), aStr ); - AppendNCSACoords( aRect.BottomRight(), aStr ); + AppendNCSAURL(aStrBuf, rBaseURL); + AppendNCSACoords(aStrBuf, aRect.TopLeft()); + AppendNCSACoords(aStrBuf, aRect.BottomRight()); - rOStm.WriteLine( aStr ); + rOStm.WriteLine(aStrBuf.makeStringAndClear()); } - -/******************************************************************************/ -/******************************************************************************/ - - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void IMapCircleObject::WriteCERN( SvStream& rOStm, const String& rBaseURL ) const { - ByteString aStr( "circle " ); + rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("circle ")); - AppendCERNCoords( aCenter, aStr ); - aStr += ByteString::CreateFromInt32(nRadius); - aStr += ' '; - AppendCERNURL( aStr, rBaseURL ); + AppendCERNCoords(aStrBuf, aCenter); + aStrBuf.append(nRadius); + aStrBuf.append(' '); + AppendCERNURL(aStrBuf, rBaseURL); - rOStm.WriteLine( aStr ); + rOStm.WriteLine(aStrBuf.makeStringAndClear()); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void IMapCircleObject::WriteNCSA( SvStream& rOStm, const String& rBaseURL ) const { - ByteString aStr( "circle " ); + rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("circle ")); - AppendNCSAURL( aStr, rBaseURL ); - AppendNCSACoords( aCenter, aStr ); - AppendNCSACoords( aCenter + Point( nRadius, 0 ), aStr ); + AppendNCSAURL(aStrBuf, rBaseURL); + AppendNCSACoords(aStrBuf, aCenter); + AppendNCSACoords(aStrBuf, aCenter + Point(nRadius, 0)); - rOStm.WriteLine( aStr ); + rOStm.WriteLine(aStrBuf.makeStringAndClear()); } - -/******************************************************************************/ -/******************************************************************************/ - - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void IMapPolygonObject::WriteCERN( SvStream& rOStm, const String& rBaseURL ) const { - ByteString aStr( "polygon " ); - const sal_uInt16 nCount = aPoly.GetSize(); + rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("polygon ")); + const sal_uInt16 nCount = aPoly.GetSize(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) - AppendCERNCoords( aPoly[ i ], aStr ); + for (sal_uInt16 i = 0; i < nCount; ++i) + AppendCERNCoords(aStrBuf, aPoly[i]); - AppendCERNURL( aStr, rBaseURL ); + AppendCERNURL(aStrBuf, rBaseURL); - rOStm.WriteLine( aStr ); + rOStm.WriteLine(aStrBuf.makeStringAndClear()); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void IMapPolygonObject::WriteNCSA( SvStream& rOStm, const String& rBaseURL ) const { - ByteString aStr( "poly " ); - const sal_uInt16 nCount = Min( aPoly.GetSize(), (sal_uInt16) 100 ); + rtl::OStringBuffer aStrBuf(RTL_CONSTASCII_STRINGPARAM("poly ")); + const sal_uInt16 nCount = Min( aPoly.GetSize(), (sal_uInt16) 100 ); - AppendNCSAURL( aStr, rBaseURL ); + AppendNCSAURL(aStrBuf, rBaseURL); - for ( sal_uInt16 i = 0; i < nCount; i++ ) - AppendNCSACoords( aPoly[ i ], aStr ); + for (sal_uInt16 i = 0; i < nCount; ++i) + AppendNCSACoords(aStrBuf, aPoly[i]); - rOStm.WriteLine( aStr ); + rOStm.WriteLine(aStrBuf.makeStringAndClear()); } - -/******************************************************************************/ -/******************************************************************************/ - - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void ImageMap::Write( SvStream& rOStm, sal_uLong nFormat, const String& rBaseURL ) const { switch( nFormat ) @@ -264,21 +166,14 @@ void ImageMap::Write( SvStream& rOStm, sal_uLong nFormat, const String& rBaseURL } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void ImageMap::ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const { IMapObject* pObj; - sal_uInt16 nCount = (sal_uInt16) maList.Count(); + size_t nCount = maList.size(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { - pObj = GetIMapObject( i ); + pObj = maList[ i ]; switch( pObj->GetType() ) { @@ -300,23 +195,16 @@ void ImageMap::ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void ImageMap::ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const { IMapObject* pObj; - sal_uInt16 nCount = (sal_uInt16) maList.Count(); + size_t nCount = maList.size(); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( size_t i = 0; i < nCount; i++ ) { - pObj = GetIMapObject( i ); + pObj = maList[ i ]; - switch( pObj->GetType() ) + switch( pObj->GetType() ) { case( IMAP_OBJ_RECTANGLE ): ( (IMapRectangleObject*) pObj )->WriteNCSA( rOStm, rBaseURL ); @@ -336,13 +224,6 @@ void ImageMap::ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - sal_uLong ImageMap::Read( SvStream& rIStm, sal_uLong nFormat, const String& rBaseURL ) { sal_uLong nRet = IMAP_ERR_FORMAT; @@ -366,13 +247,6 @@ sal_uLong ImageMap::Read( SvStream& rIStm, sal_uLong nFormat, const String& rBas return nRet; } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - sal_uLong ImageMap::ImpReadCERN( SvStream& rIStm, const String& rBaseURL ) { ByteString aStr; @@ -386,13 +260,6 @@ sal_uLong ImageMap::ImpReadCERN( SvStream& rIStm, const String& rBaseURL ) return IMAP_ERR_OK; } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL ) { ByteString aStr( rLine ); @@ -423,7 +290,7 @@ void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL const Rectangle aRect( aTopLeft, aBottomRight ); IMapRectangleObject* pObj = new IMapRectangleObject( aRect, aURL, String(), String(), String(), String() ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } else if ( ( aToken == "circle" ) || ( aToken == "circ" ) ) { @@ -432,7 +299,7 @@ void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL const String aURL( ImpReadCERNURL( &pStr, rBaseURL ) ); IMapCircleObject* pObj = new IMapCircleObject( aCenter, nRadius, aURL, String(), String(), String(), String() ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } else if ( ( aToken == "polygon" ) || ( aToken == "poly" ) ) { @@ -446,18 +313,11 @@ void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL aURL = ImpReadCERNURL( &pStr, rBaseURL ); IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, String(), String(), String(), String() ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - Point ImageMap::ImpReadCERNCoords( const char** ppStr ) { String aStrX; @@ -498,13 +358,6 @@ Point ImageMap::ImpReadCERNCoords( const char** ppStr ) return aPt; } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - long ImageMap::ImpReadCERNRadius( const char** ppStr ) { String aStr; @@ -525,13 +378,6 @@ long ImageMap::ImpReadCERNRadius( const char** ppStr ) return aStr.ToInt32(); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - String ImageMap::ImpReadCERNURL( const char** ppStr, const String& rBaseURL ) { String aStr( String::CreateFromAscii( *ppStr ) ); @@ -544,13 +390,6 @@ String ImageMap::ImpReadCERNURL( const char** ppStr, const String& rBaseURL ) return INetURLObject::GetAbsURL( rBaseURL, aStr ); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - sal_uLong ImageMap::ImpReadNCSA( SvStream& rIStm, const String& rBaseURL ) { ByteString aStr; @@ -564,13 +403,6 @@ sal_uLong ImageMap::ImpReadNCSA( SvStream& rIStm, const String& rBaseURL ) return IMAP_ERR_OK; } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL ) { ByteString aStr( rLine ); @@ -601,7 +433,7 @@ void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL const Rectangle aRect( aTopLeft, aBottomRight ); IMapRectangleObject* pObj = new IMapRectangleObject( aRect, aURL, String(), String(), String(), String() ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } else if ( aToken == "circle" ) { @@ -612,7 +444,7 @@ void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL (double) aDX.Y() * aDX.Y() ); IMapCircleObject* pObj = new IMapCircleObject( aCenter, nRadius, aURL, String(), String(), String(), String() ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } else if ( aToken == "poly" ) { @@ -624,18 +456,11 @@ void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL aPoly[ i ] = ImpReadNCSACoords( &pStr ); IMapPolygonObject* pObj = new IMapPolygonObject( aPoly, aURL, String(), String(), String(), String() ); - maList.Insert( pObj, LIST_APPEND ); + maList.push_back( pObj ); } } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - String ImageMap::ImpReadNCSAURL( const char** ppStr, const String& rBaseURL ) { String aStr; @@ -656,13 +481,6 @@ String ImageMap::ImpReadNCSAURL( const char** ppStr, const String& rBaseURL ) return INetURLObject::GetAbsURL( rBaseURL, aStr ); } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - Point ImageMap::ImpReadNCSACoords( const char** ppStr ) { String aStrX; @@ -699,13 +517,6 @@ Point ImageMap::ImpReadNCSACoords( const char** ppStr ) return aPt; } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - sal_uLong ImageMap::ImpDetectFormat( SvStream& rIStm ) { sal_uLong nPos = rIStm.Tell(); diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 4b24ed4330fd..cbb5eedb3bb3 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -65,6 +65,7 @@ #include <svtools/wmf.hxx> #include <svtools/imap.hxx> #include <svtools/transfer.hxx> +#include <rtl/strbuf.hxx> #include <cstdio> // -------------- @@ -879,15 +880,16 @@ sal_Bool TransferableHelper::SetINetBookmark( const INetBookmark& rBmk, { case( SOT_FORMATSTR_ID_SOLK ): { - ByteString sURL( rBmk.GetURL(), eSysCSet ), - sDesc( rBmk.GetDescription(), eSysCSet ); - ByteString sOut( ByteString::CreateFromInt32( sURL.Len() )); - ( sOut += '@' ) += sURL; - sOut += ByteString::CreateFromInt32( sDesc.Len() ); - ( sOut += '@' ) += sDesc; - - Sequence< sal_Int8 > aSeq( sOut.Len() ); - memcpy( aSeq.getArray(), sOut.GetBuffer(), sOut.Len() ); + rtl::OString sURL(rtl::OUStringToOString(rBmk.GetURL(), eSysCSet)); + rtl::OString sDesc(rtl::OUStringToOString(rBmk.GetDescription(), eSysCSet)); + rtl::OStringBuffer sOut; + sOut.append(sURL.getLength()); + sOut.append('@').append(sURL); + sOut.append(sDesc.getLength()); + sOut.append('@').append(sDesc); + + Sequence< sal_Int8 > aSeq(sOut.getLength()); + memcpy(aSeq.getArray(), sOut.getStr(), sOut.getLength()); maAny <<= aSeq; } break; @@ -973,22 +975,6 @@ sal_Bool TransferableHelper::SetINetImage( const INetImage& rINtImg, // ----------------------------------------------------------------------------- -sal_Bool TransferableHelper::SetFileList( const FileList& rFileList, - const ::com::sun::star::datatransfer::DataFlavor& ) -{ - SvMemoryStream aMemStm( 4096, 4096 ); - - aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 ); - aMemStm << rFileList; - - maAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), - aMemStm.Seek( STREAM_SEEK_TO_END ) ); - - return( maAny.hasValue() ); -} - -// ----------------------------------------------------------------------------- - sal_Bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 nUserObjectId, const DataFlavor& rFlavor ) { SotStorageStreamRef xStm( new SotStorageStream( String() ) ); @@ -1020,15 +1006,6 @@ sal_Bool TransferableHelper::SetObject( void* pUserObject, sal_uInt32 nUserObjec // ----------------------------------------------------------------------------- -sal_Bool TransferableHelper::SetInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rIf, - const ::com::sun::star::datatransfer::DataFlavor& ) -{ - maAny <<= rIf; - return( maAny.hasValue() ); -} - -// ----------------------------------------------------------------------------- - sal_Bool TransferableHelper::WriteObject( SotStorageStreamRef&, void*, sal_uInt32, const DataFlavor& ) { OSL_FAIL( "TransferableHelper::WriteObject( ... ) not implemented" ); @@ -2212,15 +2189,6 @@ sal_Bool TransferableDataHelper::GetInputStream( const DataFlavor& rFlavor, Refe // ----------------------------------------------------------------------------- - -sal_Bool TransferableDataHelper::GetInterface( SotFormatStringId nFormat, Reference< XInterface >& rIf ) -{ - DataFlavor aFlavor; - return( SotExchange::GetFormatDataFlavor( nFormat, aFlavor ) && GetInterface( aFlavor, rIf ) ); -} - -// ----------------------------------------------------------------------------- - sal_Bool TransferableDataHelper::GetInterface( const DataFlavor& rFlavor, Reference< XInterface >& rIf ) { const Any aAny( GetAny( rFlavor ) ); diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index 5e4fa8e56077..fe8921061f8f 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -475,15 +475,6 @@ sal_Bool TransferDataContainer::GetData( const // ----------------------------------------------------------------------------- -void TransferDataContainer::ClearData() -{ - delete pImpl; - pImpl = new TransferDataContainer_Impl; - ClearFormats(); -} - -// ----------------------------------------------------------------------------- - void TransferDataContainer::CopyINetBookmark( const INetBookmark& rBkmk ) { if( !pImpl->pBookmk ) diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx index 17adaeaecd81..189c7e24e4bb 100644 --- a/svtools/source/misc/unitconv.cxx +++ b/svtools/source/misc/unitconv.cxx @@ -293,64 +293,6 @@ FieldUnit MapToFieldUnit( const SfxMapUnit eUnit ) // ----------------------------------------------------------------------- -MapUnit FieldToMapUnit( const SfxFieldUnit /*eUnit*/ ) -{ - return MAP_APPFONT; -} - -// ----------------------------------------------------------------------- - -long ConvertValueToMap( long nVal, SfxMapUnit eUnit ) -{ - long nNew = nVal; - - switch ( eUnit ) - { - case SFX_MAPUNIT_10TH_MM: - case SFX_MAPUNIT_10TH_INCH: - nNew *= 10; - break; - - case SFX_MAPUNIT_100TH_MM: - case SFX_MAPUNIT_100TH_INCH: - nNew *= 100; - break; - - case SFX_MAPUNIT_1000TH_INCH: - nNew *= 1000; - default: ;//prevent warning - } - return nNew; -} - -// ----------------------------------------------------------------------- - -long ConvertValueToUnit( long nVal, SfxMapUnit eUnit ) -{ - long nNew = nVal; - - switch ( eUnit ) - { - case SFX_MAPUNIT_10TH_MM: - case SFX_MAPUNIT_10TH_INCH: - nNew /= 10; - break; - - case SFX_MAPUNIT_100TH_MM: - case SFX_MAPUNIT_100TH_INCH: - nNew /= 100; - break; - - case SFX_MAPUNIT_1000TH_INCH: - nNew /= 1000; - break; - default: ;//prevent warning - } - return nNew; -} - -// ----------------------------------------------------------------------- - long CalcToPoint( long nIn, SfxMapUnit eUnit, sal_uInt16 nFaktor ) { DBG_ASSERT( eUnit == SFX_MAPUNIT_TWIP || diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx index a4251652aac2..a3312c107a52 100644 --- a/svtools/source/productregistration/productregistration.cxx +++ b/svtools/source/productregistration/productregistration.cxx @@ -453,13 +453,7 @@ namespace svt extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL productregistration_component_getFactory ( const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) { void * pResult = 0; diff --git a/svtools/source/productregistration/productregistration.uno.component b/svtools/source/productregistration/productregistration.uno.component index da2cfd37c483..f57860ef6463 100644 --- a/svtools/source/productregistration/productregistration.uno.component +++ b/svtools/source/productregistration/productregistration.uno.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="productregistration" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.setup.ProductRegistration"> <service name="com.sun.star.setup.ProductRegistration"/> diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 31e60e1ab1a1..f1d56f7f6fc5 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -485,7 +485,7 @@ void lcl_ConvertCharToHTML( sal_Unicode c, ByteString& rDest, rDest += *pBuffer++; (((rDest += '&') += '#') += - ByteString::CreateFromInt64( (sal_uInt32)c )) += ';'; + ByteString(rtl::OString::valueOf(static_cast<sal_Int64>(c)))) += ';'; if( pNonConvertableChars && STRING_NOTFOUND == pNonConvertableChars->Search( c ) ) pNonConvertableChars->Append( c ); @@ -658,11 +658,16 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, (const IMapRectangleObject *)pObj; pShape = OOO_STRING_SVTOOLS_HTML_SH_rect; Rectangle aRect( pRectObj->GetRectangle() ); - ((((((aCoords = - ByteString::CreateFromInt32(aRect.Left())) += ',') - += ByteString::CreateFromInt32(aRect.Top())) += ',') - += ByteString::CreateFromInt32(aRect.Right())) += ',') - += ByteString::CreateFromInt32(aRect.Bottom()); + + aCoords = rtl::OStringBuffer() + .append(static_cast<sal_Int32>(aRect.Left())) + .append(',') + .append(static_cast<sal_Int32>(aRect.Top())) + .append(',') + .append(static_cast<sal_Int32>(aRect.Right())) + .append(',') + .append(static_cast<sal_Int32>(aRect.Bottom())) + .makeStringAndClear(); } break; case( IMAP_OBJ_CIRCLE ): @@ -672,10 +677,14 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, pShape= OOO_STRING_SVTOOLS_HTML_SH_circ; Point aCenter( pCirc->GetCenter() ); long nOff = pCirc->GetRadius(); - ((((aCoords = - ByteString::CreateFromInt32(aCenter.X())) += ',') - += ByteString::CreateFromInt32(aCenter.Y())) += ',') - += ByteString::CreateFromInt32(nOff); + + aCoords = rtl::OStringBuffer() + .append(static_cast<sal_Int32>(aCenter.X())) + .append(',') + .append(static_cast<sal_Int32>(aCenter.Y())) + .append(',') + .append(static_cast<sal_Int32>(nOff)) + .makeStringAndClear(); } break; case( IMAP_OBJ_POLYGON ): @@ -685,20 +694,23 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, pShape= OOO_STRING_SVTOOLS_HTML_SH_poly; Polygon aPoly( pPolyObj->GetPolygon() ); sal_uInt16 nCount = aPoly.GetSize(); + rtl::OStringBuffer aTmpBuf; if( nCount>0 ) { const Point& rPoint = aPoly[0]; - ((aCoords = - ByteString::CreateFromInt32(rPoint.X())) += ',') - += ByteString::CreateFromInt32(rPoint.Y()); + aTmpBuf.append(static_cast<sal_Int32>(rPoint.X())) + .append(',') + .append(static_cast<sal_Int32>(rPoint.Y())); } for( sal_uInt16 j=1; j<nCount; j++ ) { const Point& rPoint = aPoly[j]; - (((aCoords += ',') - += ByteString::CreateFromInt32(rPoint.X())) += ',') - += ByteString::CreateFromInt32(rPoint.Y()); + aTmpBuf.append(',') + .append(static_cast<sal_Int32>(rPoint.X())) + .append(',') + .append(static_cast<sal_Int32>(rPoint.Y())); } + aCoords = aTmpBuf.makeStringAndClear(); } break; default: diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 8cf6f406e2bd..b431d0d931c7 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -2266,11 +2266,10 @@ bool HTMLParser::ParseMetaOptions( rtl_TextEncoding HTMLParser::GetEncodingByMIME( const String& rMime ) { - ByteString sType; - ByteString sSubType; + String sType; + String sSubType; INetContentTypeParameterList aParameters; - ByteString sMime( rMime, RTL_TEXTENCODING_ASCII_US ); - if (INetContentTypes::parse(sMime, sType, sSubType, &aParameters)) + if (INetContentTypes::parse(rMime, sType, sSubType, &aParameters)) { const INetContentTypeParameter * pCharset = aParameters.find("charset"); diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index a475343dcaac..5a04328045c6 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -341,7 +341,27 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) ByteString aByteString; while (1) { - aByteString.Append((char)GetHexValue()); + char c = (char)GetHexValue(); + + if (c) + { + aByteString.Append(c); + } + else + { + /* \'00 is a valid internal character in a + * string in RTF, however ByteString::Append + * does nothing if '\0' is passed in. It is + * otherwise capable of handling strings with + * embedded NULs, so add a '\1' and then + * change it, as ByteString::SetChar does not + * care if the character is '\0'. + */ + int nLen = aByteString.Len(); + + aByteString.Append('\001'); + aByteString.SetChar(nLen, '\0'); + } bool bBreak = false; sal_Char nSlash = '\\'; diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx index 21368c0b14d3..065fc6ba5572 100644 --- a/svtools/source/svrtf/rtfout.cxx +++ b/svtools/source/svrtf/rtfout.cxx @@ -141,11 +141,15 @@ SvStream& RTFOutFuncs::Out_Char(SvStream& rStream, sal_Unicode c, // then write as unicode - character if (*pUCMode != nLen) { - rStream << "\\uc" << ByteString::CreateFromInt32(nLen).GetBuffer() << " "; // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored.; + // #i47831# add an additional whitespace, so that + // "document whitespaces" are not ignored.; + rStream << "\\uc" + << rtl::OString::valueOf(nLen).getStr() << " "; *pUCMode = nLen; } - ByteString sNo(ByteString::CreateFromInt32(c)); - rStream << "\\u" << sNo.GetBuffer(); + rStream << "\\u" + << rtl::OString::valueOf( + static_cast<sal_Int32>(c)).getStr(); } for (sal_Int32 nI = 0; nI < nLen; ++nI) @@ -176,17 +180,6 @@ SvStream& RTFOutFuncs::Out_String( SvStream& rStream, const String& rStr, return rStream; } -SvStream& RTFOutFuncs::Out_Fontname(SvStream& rStream, const String& rStr, - rtl_TextEncoding eDestEnc, sal_Bool bWriteHelpFile) -{ - //Fontnames in word have a quirk in that \uc and usage of ansi replacement - //chars after a \u don't work and in wordpad \u doesn't work, so we are - //left with forcing ansi characters only for fontnames - for (xub_StrLen n = 0; n < rStr.Len(); ++n) - Out_Char(rStream, rStr.GetChar(n), 0, eDestEnc, bWriteHelpFile); - return rStream; -} - SvStream& RTFOutFuncs::Out_Hex( SvStream& rStream, sal_uLong nHex, sal_uInt8 nLen ) { sal_Char aNToABuf[] = "0000000000000000"; diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index c652b6028bf0..e49672bbac52 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -96,13 +96,7 @@ DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicRendererVCL ) extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory ( const sal_Char * pImplementationName, void * _pServiceManager, void * pRegistryKey) { void * pResult = 0; diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index d2cf9cbf12cf..4bc5cae12cb6 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -34,7 +34,6 @@ #include <vcl/svapp.hxx> #include <svtools/svmedit.hxx> #include <unoiface.hxx> -#include <svtools/filedlg.hxx> #include <svtools/filectrl.hxx> #include <svtools/roadmap.hxx> #include <svtools/fixedhyper.hxx> diff --git a/svtools/util/svt.component b/svtools/util/svt.component index e15970547a38..2ba695d72e92 100644 --- a/svtools/util/svt.component +++ b/svtools/util/svt.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="svt" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.graphic.GraphicProvider"> <service name="com.sun.star.graphic.GraphicProvider"/> diff --git a/svtools/workben/unodialog/udlg_services.cxx b/svtools/workben/unodialog/udlg_services.cxx index bf9386dd7aea..cb2949791e9c 100644 --- a/svtools/workben/unodialog/udlg_services.cxx +++ b/svtools/workben/unodialog/udlg_services.cxx @@ -56,6 +56,11 @@ namespace udlg } // namespace udlg //........................................................................ -IMPLEMENT_COMPONENT_LIBRARY_API( ::udlg::UdlgModule, ::udlg::initializeModule ) +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) +{ + ::udlg::initializeModule(); + return ::udlg::UdlgModule::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey ); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |