From 174be928f7d7c42a846e574eaaa03572b2655f8c Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 16 Jun 2011 19:57:32 +0300 Subject: Put the local LetterTable class in the anonymous namespace --- svtools/source/edit/syntaxhighlight.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'svtools') diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx index f859e9930cf9..6ccaa07453d8 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; -- cgit v1.2.3 From b33ae7fc706c6f9a8130e34d5eafb0ffbf938905 Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Sat, 18 Jun 2011 00:00:52 +0900 Subject: remove dead code --- regexp/source/reclass.cxx | 7 ------- svl/source/numbers/zformat.cxx | 17 +---------------- svl/source/svdde/ddesvr.cxx | 29 ----------------------------- svtools/source/contnr/imivctl1.cxx | 7 ------- toolkit/source/layout/vcl/wbutton.cxx | 4 ---- vcl/aqua/source/gdi/salatslayout.cxx | 2 -- vcl/unx/kde4/KDESalFrame.cxx | 2 -- 7 files changed, 1 insertion(+), 67 deletions(-) (limited to 'svtools') diff --git a/regexp/source/reclass.cxx b/regexp/source/reclass.cxx index 79457e6c1fd3..b296230ead9f 100644 --- a/regexp/source/reclass.cxx +++ b/regexp/source/reclass.cxx @@ -1362,13 +1362,6 @@ Regexpr::regex_compile() case (sal_Unicode)')': goto normal_backslash; - // unreachable (after goto): -#if 0 - if (COMPILE_STACK_EMPTY) { - FREE_STACK_RETURN(REG_ERPAREN); - } -#endif - handle_close: if (fixup_alt_jump) { /* Push a dummy failure point at the end of the diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 00ebf41a3dd7..cfc916993885 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -2007,15 +2007,7 @@ sal_Bool SvNumberformat::GetOutputString(String& sString, } return sal_False; } -/* -void SvNumberformat::GetNextFareyNumber(sal_uLong nPrec, sal_uLong x0, sal_uLong x1, - sal_uLong y0, sal_uLong y1, - sal_uLong& x2,sal_uLong& y2) -{ - x2 = ((y0+nPrec)/y1)*x1 - x0; - y2 = ((y0+nPrec)/y1)*y1 - y0; -} -*/ + sal_uLong SvNumberformat::ImpGGT(sal_uLong x, sal_uLong y) { if (y == 0) @@ -2417,7 +2409,6 @@ sal_Bool SvNumberformat::GetOutputString(double fNumber, { sal_uLong x2 = ((y0+nBasis)/y1)*x1 - x0; // naechste Farey-Zahl sal_uLong y2 = ((y0+nBasis)/y1)*y1 - y0; -// GetNextFareyNumber(nBasis, x0, x1, y0, y1, x2, y2); x0 = x1; y0 = y1; x1 = x2; @@ -2446,11 +2437,6 @@ sal_Bool SvNumberformat::GetOutputString(double fNumber, else // grosse Nenner { // 0,1234->123/1000 sal_uLong nGgt; -/* - nDiv = nBasis+1; - nFrac = ((sal_uLong)floor(0.5 + fNumber * - pow(10.0,rInfo.nCntExp))); -*/ nDiv = 10000000; nFrac = ((sal_uLong)floor(0.5 + fNumber * 10000000.0)); nGgt = ImpGGT(nDiv, nFrac); @@ -4421,7 +4407,6 @@ String SvNumberformat::GetMappedFormatstring( case NF_SYMBOLTYPE_CALDEL : if ( pStr[j+1].EqualsAscii("buddhist") ) { - //aStr.InsertAscii( "[$-", aStr.Len() ); aStr.InsertAscii( "[$-", 0 ); if ( rNum.IsSet() && rNum.GetNatNum() == 1 && MsLangId::getRealLanguage( rNum.GetLang() ) == diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index 99b8cce0ae71..08894db00556 100644 --- a/svl/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -88,7 +88,6 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback( { int nTopics = 0; -#if 1 TCHAR chTopicBuf[250]; if( hText1 ) DdeQueryString( pInst->hDdeInstSvr, hText1, chTopicBuf, @@ -117,20 +116,6 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback( } } -#else - for( pService = rAll.First();pService;pService = rAll.Next() ) - { - if ( !hText2 || ( *pService->pName == hText2 ) ) - { - std::vector::const_iterator iter; - for (iter = pService->aTopics.begin(); iter != pService->aTopics.end(); ++iter) - { - if ( !hText1 || iter->pName == hText1 ) - nTopics++; - } - } - } -#endif if( !nTopics ) return (HDDEDATA)NULL; @@ -143,18 +128,6 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback( { if ( !hText2 || (*pService->pName == hText2 ) ) { -#if 0 - for ( pTopic = pService->aTopics.First(); pTopic; - pTopic = pService->aTopics.Next() ) - { - if ( !hText1 || (*pTopic->pName == hText1) ) - { - q->hszSvc = *pService->pName; - q->hszTopic = *pTopic->pName; - q++; - } - } -#else String sTopics( pService->Topics() ); sal_uInt16 n = 0; while( STRING_NOTFOUND != n ) @@ -173,8 +146,6 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback( } } } - -#endif } } diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 640f6c5ae923..cdb95366d560 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -2754,15 +2754,8 @@ 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 } } diff --git a/toolkit/source/layout/vcl/wbutton.cxx b/toolkit/source/layout/vcl/wbutton.cxx index 5e303ada03ba..96e6aeb5d251 100644 --- a/toolkit/source/layout/vcl/wbutton.cxx +++ b/toolkit/source/layout/vcl/wbutton.cxx @@ -276,7 +276,6 @@ public: if ( !mxRadioButton.is() ) return; -#if 1 // Have setState fire item event for // RadioGroups::RadioGroup::itemStateChanged () ::RadioButton *r = static_cast(mpWindow)->GetRadioButton (); @@ -284,9 +283,6 @@ public: r->EnableRadioCheck(); mxRadioButton->setState( !!bCheck ); r->EnableRadioCheck (state); -#else - mxRadioButton->setState( !!bCheck ); -#endif fireToggle(); } diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 94022b763a03..1c193378b9cf 100644 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -1043,7 +1043,6 @@ bool ATSLayout::GetDeltaY() const if( mpDeltaY != NULL ) return true; -#if 1 if( !maATSULayout ) return false; @@ -1069,7 +1068,6 @@ bool ATSLayout::GetDeltaY() const mpDeltaY = NULL; return false; } -#endif return true; } diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 98b84ce54d7a..10e73502927c 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -88,8 +88,6 @@ static OUString readEntryUntranslated( KConfigGroup *pGroup, const char *pKey ) return OUString::createFromAscii( (const char *) pGroup->readEntryUntranslated( pKey ).toAscii() ); } -#if 0 -#endif /** Helper function to add information to Font from QFont. Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx). -- cgit v1.2.3 From 0e6ab013f7def9891c2e982bec76458a64953c20 Mon Sep 17 00:00:00 2001 From: Hans-Joachim Lankenau Date: Mon, 30 May 2011 18:09:09 +0200 Subject: ause130: #i117218# change .idl handling to gnu make --- basegfx/prj/build.lst | 2 +- canvas/prj/build.lst | 2 +- comphelper/Library_comphelp.mk | 6 +++++- comphelper/prj/build.lst | 2 +- cppcanvas/prj/build.lst | 2 +- dtrans/prj/build.lst | 2 +- i18nutil/prj/build.lst | 2 +- padmin/Executable_spadmin.bin.mk | 6 +++++- padmin/Library_spa.mk | 10 +++++----- sot/Library_sot.mk | 6 +++++- svl/Library_fsstorage.mk | 6 +++++- svl/Library_passwordcontainer.mk | 6 +++++- svl/Library_svl.mk | 7 ++++++- svl/prj/build.lst | 2 +- svtools/Executable_bmp.mk | 6 +++++- svtools/Executable_bmpsum.mk | 6 +++++- svtools/Executable_g2g.mk | 6 +++++- svtools/Library_hatchwindowfactory.mk | 6 +++++- svtools/Library_productregistration.mk | 6 +++++- svtools/Library_svt.mk | 8 ++++++-- svtools/prj/build.lst | 2 +- toolkit/Library_tk.mk | 6 +++++- tools/Library_tl.mk | 6 +++++- tools/StaticLibrary_ooopathutils.mk | 2 +- tools/prj/build.lst | 2 +- ucbhelper/prj/build.lst | 2 +- unotools/prj/build.lst | 2 +- vcl/prj/build.lst | 2 +- 28 files changed, 90 insertions(+), 33 deletions(-) (limited to 'svtools') diff --git a/basegfx/prj/build.lst b/basegfx/prj/build.lst index fe3354b3f256..01a39b6d964f 100644 --- a/basegfx/prj/build.lst +++ b/basegfx/prj/build.lst @@ -1,4 +1,4 @@ -fx basegfx : o3tl sal offuh cppuhelper cppu CPPUNIT:cppunit NULL +fx basegfx : o3tl sal offapi cppuhelper cppu CPPUNIT:cppunit NULL fx basegfx usr1 - all fx_mkout NULL fx basegfx\inc nmake - all fx_inc NULL fx basegfx\prj get - all fx_prj NULL diff --git a/canvas/prj/build.lst b/canvas/prj/build.lst index 121be382208f..dad6e28c0ea5 100644 --- a/canvas/prj/build.lst +++ b/canvas/prj/build.lst @@ -1,4 +1,4 @@ -cv canvas : javaunohelper comphelper cppuhelper offuh unoil tools svtools vcl basegfx CAIRO:cairo LIBXSLT:libxslt NULL +cv canvas : javaunohelper comphelper cppuhelper offapi unoil tools svtools vcl basegfx CAIRO:cairo LIBXSLT:libxslt NULL cv canvas usr1 - all cv_mkout NULL cv canvas\inc nmake - all cv_inc NULL cv canvas\source\tools nmake - all cv_tools cv_inc NULL diff --git a/comphelper/Library_comphelp.mk b/comphelper/Library_comphelp.mk index 8336b8cb2124..64c58cc65623 100644 --- a/comphelper/Library_comphelp.mk +++ b/comphelper/Library_comphelp.mk @@ -37,7 +37,6 @@ $(eval $(call gb_Library_set_include,comphelper,\ -I$(realpath $(SRCDIR)/comphelper/inc/pch) \ -I$(realpath $(SRCDIR)/comphelper/source/inc) \ $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ )) $(eval $(call gb_Library_set_defs,comphelper,\ @@ -53,6 +52,11 @@ $(eval $(call gb_Library_add_linked_libs,comphelper,\ $(gb_STDLIBS) \ )) +$(eval $(call gb_Library_add_api,comphelper,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_exception_objects,comphelper,\ comphelper/source/compare/AnyCompareFactory \ comphelper/source/container/IndexedPropertyValuesContainer \ diff --git a/comphelper/prj/build.lst b/comphelper/prj/build.lst index a828870f2dbf..7dde46c47c7e 100644 --- a/comphelper/prj/build.lst +++ b/comphelper/prj/build.lst @@ -1,2 +1,2 @@ -ph comphelper : cppuhelper ucbhelper offuh salhelper LIBXSLT:libxslt NULL +ph comphelper : cppuhelper ucbhelper offapi salhelper LIBXSLT:libxslt NULL ch comphelper\prj nmake - all ch_all NULL diff --git a/cppcanvas/prj/build.lst b/cppcanvas/prj/build.lst index 317e3276c249..143af130f39b 100644 --- a/cppcanvas/prj/build.lst +++ b/cppcanvas/prj/build.lst @@ -1,4 +1,4 @@ -cx cppcanvas : comphelper cppuhelper offuh tools vcl basegfx canvas NULL +cx cppcanvas : comphelper cppuhelper offapi tools vcl basegfx canvas NULL cx cppcanvas usr1 - all cx_mkout NULL cx cppcanvas\inc nmake - all cx_inc NULL cx cppcanvas\source\tools nmake - all cx_tools cx_inc NULL diff --git a/dtrans/prj/build.lst b/dtrans/prj/build.lst index f93333ff9dfd..519e1fda37c8 100644 --- a/dtrans/prj/build.lst +++ b/dtrans/prj/build.lst @@ -1,4 +1,4 @@ -dr dtrans : unotools offapi offuh DESKTOP:rdbmaker stoc LIBXSLT:libxslt NULL +dr dtrans : unotools offapi DESKTOP:rdbmaker stoc LIBXSLT:libxslt NULL dr dtrans usr1 - all dr_mkout NULL dr dtrans\inc nmake - all dr_inc NULL dr dtrans\source\cnttype nmake - all dr_cnttype dr_generic dr_inc NULL diff --git a/i18nutil/prj/build.lst b/i18nutil/prj/build.lst index 311b6d572943..55c86ad3038f 100644 --- a/i18nutil/prj/build.lst +++ b/i18nutil/prj/build.lst @@ -1,3 +1,3 @@ -inu i18nutil : sal cppu offuh NULL +inu i18nutil : sal cppu offapi NULL inu i18nutil usr1 - all inu_mkout NULL inu i18nutil\source\utility nmake - all inu_utility NULL diff --git a/padmin/Executable_spadmin.bin.mk b/padmin/Executable_spadmin.bin.mk index bcb69b28e748..4ec56f2cf7e0 100644 --- a/padmin/Executable_spadmin.bin.mk +++ b/padmin/Executable_spadmin.bin.mk @@ -30,7 +30,6 @@ $(eval $(call gb_Executable_Executable,spadmin.bin)) $(eval $(call gb_Executable_set_include,spadmin.bin,\ $$(INCLUDE) \ -I$(OUTDIR)/inc \ - -I$(OUTDIR)/inc/offuh \ )) $(eval $(call gb_Executable_set_cxxflags,spadmin.bin,\ @@ -41,6 +40,11 @@ $(eval $(call gb_Executable_add_linked_static_libs,spadmin.bin,\ vclmain \ )) +$(eval $(call gb_Executable_add_api,spadmin.bin,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Executable_add_linked_libs,spadmin.bin,\ spa \ svt \ diff --git a/padmin/Library_spa.mk b/padmin/Library_spa.mk index 3cd9dc7c271e..e72c676b57eb 100644 --- a/padmin/Library_spa.mk +++ b/padmin/Library_spa.mk @@ -27,16 +27,16 @@ $(eval $(call gb_Library_Library,spa)) -$(eval $(call gb_Library_set_include,spa,\ - $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ -)) - $(eval $(call gb_Library_set_defs,spa,\ $$(DEFS) \ -DSPA_DLLIMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,spa,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,spa,\ svt \ vcl \ diff --git a/sot/Library_sot.mk b/sot/Library_sot.mk index 51679534763c..927fdc001045 100644 --- a/sot/Library_sot.mk +++ b/sot/Library_sot.mk @@ -36,7 +36,11 @@ $(eval $(call gb_Library_set_componentfile,sot,sot/util/sot)) $(eval $(call gb_Library_set_include,sot,\ -I$(realpath $(SRCDIR)/sot/inc/pch) \ $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_api,sot,\ + udkapi \ + offapi \ )) $(eval $(call gb_Library_set_defs,sot,\ diff --git a/svl/Library_fsstorage.mk b/svl/Library_fsstorage.mk index 3e27ae8f4357..121049b9cff7 100644 --- a/svl/Library_fsstorage.mk +++ b/svl/Library_fsstorage.mk @@ -37,10 +37,14 @@ $(eval $(call gb_Library_set_include,fsstorage,\ -I$(realpath $(SRCDIR)/svl/inc/svl) \ -I$(realpath $(SRCDIR)/svl/source/inc) \ -I$(realpath $(SRCDIR)/svl/inc/pch) \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_Library_add_api,fsstorage,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,fsstorage,\ comphelper \ cppu \ diff --git a/svl/Library_passwordcontainer.mk b/svl/Library_passwordcontainer.mk index 58b4b6edb6a7..3826dca597dd 100644 --- a/svl/Library_passwordcontainer.mk +++ b/svl/Library_passwordcontainer.mk @@ -37,10 +37,14 @@ $(eval $(call gb_Library_set_include,passwordcontainer,\ -I$(realpath $(SRCDIR)/svl/inc/svl) \ -I$(realpath $(SRCDIR)/svl/source/inc) \ -I$(realpath $(SRCDIR)/svl/inc/pch) \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_Library_add_api,passwordcontainer,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,passwordcontainer,\ cppu \ cppuhelper \ diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk index 246530a22bb3..638ab9c89832 100644 --- a/svl/Library_svl.mk +++ b/svl/Library_svl.mk @@ -37,7 +37,12 @@ $(eval $(call gb_Library_set_include,svl,\ $$(SOLARINC) \ -I$(realpath $(SRCDIR)/svl/source/inc) \ -I$(realpath $(SRCDIR)/svl/inc/pch) \ - -I$(OUTDIR)/inc/offuh \ + -I$(SRCDIR)/svl/inc/pch \ +)) + +$(eval $(call gb_Library_add_api,svl,\ + udkapi \ + offapi \ )) $(eval $(call gb_Library_set_defs,svl,\ diff --git a/svl/prj/build.lst b/svl/prj/build.lst index 58c150563e5e..5fc7d0e223a3 100644 --- a/svl/prj/build.lst +++ b/svl/prj/build.lst @@ -1,3 +1,3 @@ -sl svl : TRANSLATIONS:translations DESKTOP:rsc offuh ucbhelper unotools cppu cppuhelper comphelper sal sot LIBXSLT:libxslt NULL +sl svl : TRANSLATIONS:translations DESKTOP:rsc offapi ucbhelper unotools cppu cppuhelper comphelper sal sot LIBXSLT:libxslt NULL sl svl\prj nmake - all svl_prj NULL # sl svl\qa\unit nmake - all svl_qa_cppunit svl_util NULL 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 def31f0d121f..2dee92a7dceb 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_set_defs,svt,\ diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst index 7ac223ae1588..a438456220a0 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 NULL st svtools\prj nmake - all st_prj NULL diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk index 1a94bbd21ab1..84c05eb752ab 100644 --- a/toolkit/Library_tk.mk +++ b/toolkit/Library_tk.mk @@ -38,7 +38,6 @@ $(eval $(call gb_Library_set_include,tk,\ -I$(realpath $(SRCDIR)/toolkit/inc) \ -I$(realpath $(SRCDIR)/toolkit/inc/pch) \ -I$(realpath $(SRCDIR)/toolkit/source) \ - -I$(OUTDIR)/inc/offuh \ )) $(eval $(call gb_Library_set_defs,tk,\ @@ -46,6 +45,11 @@ $(eval $(call gb_Library_set_defs,tk,\ -DTOOLKIT_DLLIMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,tk,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,tk,\ comphelper \ cppu \ diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk index da3e0276f521..ad3c9c4ec682 100644 --- a/tools/Library_tl.mk +++ b/tools/Library_tl.mk @@ -38,7 +38,6 @@ $(eval $(call gb_Library_set_include,tl,\ -I$(realpath $(SRCDIR)/tools/inc/pch) \ -I$(SRCDIR)/solenv/inc \ -I$(SRCDIR)/solenv/inc/Xp31 \ - -I$(OUTDIR)/inc/offuh \ -I$(WORKDIR)/CustomTarget/tools/source/reversemap \ )) @@ -48,6 +47,11 @@ $(eval $(call gb_Library_set_defs,tl,\ -DVCL \ )) +$(eval $(call gb_Library_add_api,tl,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,tl,\ basegfx \ comphelper \ diff --git a/tools/StaticLibrary_ooopathutils.mk b/tools/StaticLibrary_ooopathutils.mk index e58becb175d3..c5b2ea6ad846 100644 --- a/tools/StaticLibrary_ooopathutils.mk +++ b/tools/StaticLibrary_ooopathutils.mk @@ -39,7 +39,7 @@ $(eval $(call gb_StaticLibrary_add_exception_objects,ooopathutils,\ # Instead of this evil linking of an object from $(OUTDIR) define StaticLibrary_ooopathutils_hack $(call gb_StaticLibrary_get_target,ooopathutils) : $(OUTDIR)/lib/$(1) -$$(eval $$(call gb_Deliver_add_deliverable,$(OUTDIR)/lib/$(1),$(call gb_CxxObject_get_target,tools/source/misc/pathutils))) +$$(eval $$(call gb_Deliver_add_deliverable,$(OUTDIR)/lib/$(1),$(call gb_CxxObject_get_target,tools/source/misc/pathutils),$(1))) $(OUTDIR)/lib/$(1) : $(call gb_CxxObject_get_target,tools/source/misc/pathutils) $$(call gb_Deliver_deliver,$$<,$$@) diff --git a/tools/prj/build.lst b/tools/prj/build.lst index eeb470c384d6..ee6803567843 100644 --- a/tools/prj/build.lst +++ b/tools/prj/build.lst @@ -1,3 +1,3 @@ -tl tools : cppu external offuh ZLIB:zlib EXPAT:expat basegfx comphelper i18npool NULL +tl tools : cppu external offapi ZLIB:zlib EXPAT:expat basegfx comphelper i18npool NULL tl tools\prj nmake - all tl_prj NULL # tl tools\qa nmake - all tl_qa tl_utl NULL diff --git a/ucbhelper/prj/build.lst b/ucbhelper/prj/build.lst index bbd01df9022a..f97173305622 100644 --- a/ucbhelper/prj/build.lst +++ b/ucbhelper/prj/build.lst @@ -1,4 +1,4 @@ -uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL +uh ucbhelper : offapi sal cppu cppuhelper salhelper NULL uh ucbhelper usr1 - all uh_mkout NULL uh ucbhelper\inc nmake - all uh_inc NULL uh ucbhelper\source\client nmake - all uh_client uh_inc NULL diff --git a/unotools/prj/build.lst b/unotools/prj/build.lst index b7883fa2e3dd..8e182910f277 100644 --- a/unotools/prj/build.lst +++ b/unotools/prj/build.lst @@ -1,3 +1,3 @@ -ut unotools : LIBXSLT:libxslt comphelper cppuhelper offuh tools ucbhelper NULL +ut unotools : LIBXSLT:libxslt comphelper cppuhelper offapi tools ucbhelper NULL ut unotools\prj nmake - all ut_prj NULL diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index 1b32995ae668..6db5d660f085 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -1,4 +1,4 @@ -vc vcl : TRANSLATIONS:translations apple_remote BOOST:boost DESKTOP:rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools DESKTOP:l10ntools icc cpputools svl LIBXSLT:libxslt NULL +vc vcl : TRANSLATIONS:translations apple_remote BOOST:boost DESKTOP:rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offapi basegfx basebmp tools l10ntools icc cpputools svl LIBXSLT:libxslt NULL vc vcl usr1 - all vc_mkout NULL vc vcl\prj nmake - all vc_prj NULL -- cgit v1.2.3 From b74c7e7fceddca2c93bf7586df938f9909feb0f7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 17 Jun 2011 21:39:12 +0100 Subject: silence unhelpful assert --- svtools/source/config/optionsdrawinglayer.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'svtools') 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 Date: Mon, 20 Jun 2011 17:08:12 +0200 Subject: add missing newline to the end of file to silence the compiler --- svtools/inc/svtools/grfmgr.hxx | 2 +- svtools/source/filter/exportdialog.cxx | 2 +- svtools/source/filter/filter2.cxx | 2 +- svtools/source/graphic/grfmgr.cxx | 2 +- svtools/source/graphic/grfmgr2.cxx | 2 +- vcl/inc/vcl/gdimtf.hxx | 2 +- vcl/inc/vcl/graph.hxx | 2 +- vcl/inc/vcl/svgread.hxx | 2 +- vcl/source/gdi/metaact.cxx | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/grfmgr.hxx b/svtools/inc/svtools/grfmgr.hxx index c99ea7a55bcd..e81458644d50 100644 --- a/svtools/inc/svtools/grfmgr.hxx +++ b/svtools/inc/svtools/grfmgr.hxx @@ -574,4 +574,4 @@ public: #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/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/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 19b09e8f67a7..fdfa92a72b00 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -1232,4 +1232,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..fbd00913607b 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -2384,4 +2384,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/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx index 86f8dc5cbc77..e15a536ced0f 100644 --- a/vcl/inc/vcl/gdimtf.hxx +++ b/vcl/inc/vcl/gdimtf.hxx @@ -291,4 +291,4 @@ MetaCommentAction* makePluggableRendererAction( const rtl::OUString& rRendererSe #endif // _SV_GDIMTF_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/graph.hxx b/vcl/inc/vcl/graph.hxx index 61da922acce6..d613c2d8432b 100644 --- a/vcl/inc/vcl/graph.hxx +++ b/vcl/inc/vcl/graph.hxx @@ -222,4 +222,4 @@ public: #endif // _SV_GRAPH_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/vcl/svgread.hxx b/vcl/inc/vcl/svgread.hxx index 4427198eeb5a..cf4f8008c7ef 100644 --- a/vcl/inc/vcl/svgread.hxx +++ b/vcl/inc/vcl/svgread.hxx @@ -80,4 +80,4 @@ namespace vcl #endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 2ffa3c68e4f7..32c4a589f54d 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -4409,4 +4409,4 @@ void MetaRenderGraphicAction::Read( SvStream& rIStm, ImplMetaReadData* ) rIStm >> maRenderGraphic >> maPoint >> maSize >> mfRotateAngle >> mfShearAngleX >> mfShearAngleY; } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3 From 6c359e5757efb9eeefc42c73c0390fb7cc2c1bed Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 20 Jun 2011 21:39:11 +0100 Subject: ByteString->rtl::OStringBuffer --- svtools/inc/svtools/imapcirc.hxx | 2 +- svtools/inc/svtools/imapobj.hxx | 10 +- svtools/source/misc/imap.cxx | 2 +- svtools/source/misc/imap2.cxx | 287 +++++++-------------------------------- 4 files changed, 56 insertions(+), 245 deletions(-) (limited to 'svtools') 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..88362d118ff6 100644 --- a/svtools/inc/svtools/imapobj.hxx +++ b/svtools/inc/svtools/imapobj.hxx @@ -32,6 +32,7 @@ #include "svtools/svtdllapi.h" #include #include +#include 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: diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index d4ee29924801..9cfa72b76ade 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -433,7 +433,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; diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index 20e8ae6431b8..b9231a50c2d3 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(aPixPt.X())); + rBuf.append(','); + rBuf.append(static_cast(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(aPixPt.X())); + rBuf.append(','); + rBuf.append(static_cast(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,13 +166,6 @@ void ImageMap::Write( SvStream& rOStm, sal_uLong nFormat, const String& rBaseURL } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void ImageMap::ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const { IMapObject* pObj; @@ -300,13 +195,6 @@ void ImageMap::ImpWriteCERN( SvStream& rOStm, const String& rBaseURL ) const } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - void ImageMap::ImpWriteNCSA( SvStream& rOStm, const String& rBaseURL ) const { IMapObject* pObj; @@ -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 ); @@ -451,13 +318,6 @@ void ImageMap::ImpReadCERNLine( const ByteString& rLine, const String& rBaseURL } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - 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 ); @@ -629,13 +461,6 @@ void ImageMap::ImpReadNCSALine( const ByteString& rLine, const String& rBaseURL } } - -/****************************************************************************** -|* -|* -|* -\******************************************************************************/ - 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(); -- cgit v1.2.3 From 16c9d63da67897e51960f3684d8d05b06f2c8f81 Mon Sep 17 00:00:00 2001 From: Luke Symes Date: Wed, 22 Jun 2011 15:40:26 +1200 Subject: Set the listbox height to an integer multiple of the listbox entry height. This ensures that we don't get a half visible entry at the bottom of the view. Signed-off-by: Tor Lillqvist --- svtools/source/contnr/svimpbox.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'svtools') diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index da5aff817b60..ab6d4e1b8fb3 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -1358,8 +1358,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(); -- cgit v1.2.3 From 657a01ef25b43df56bc6752b18c9797d49b7201b Mon Sep 17 00:00:00 2001 From: Luke Symes Date: Wed, 22 Jun 2011 15:56:50 +1200 Subject: Implement ScrollToAbsPos for listboxes. Scrolls the listbox so the given entry is the first visible entry. The existing MakeVisible is not good enough since it won't scroll down if the given entry is already visible. Signed-off-by: Tor Lillqvist --- svtools/inc/svtools/svtreebx.hxx | 1 + svtools/inc/svtools/treelist.hxx | 6 ++++++ svtools/source/contnr/svimpbox.cxx | 26 ++++++++++++++++++++++++++ svtools/source/contnr/svtreebx.cxx | 5 +++++ svtools/source/inc/svimpbox.hxx | 1 + 5 files changed, 39 insertions(+) (limited to 'svtools') diff --git a/svtools/inc/svtools/svtreebx.hxx b/svtools/inc/svtools/svtreebx.hxx index 6edd32110317..370ab44f34f4 100644 --- a/svtools/inc/svtools/svtreebx.hxx +++ b/svtools/inc/svtools/svtreebx.hxx @@ -369,6 +369,7 @@ public: SvLBoxEntry* GetFirstEntryInView() const; SvLBoxEntry* GetNextEntryInView(SvLBoxEntry*) const; + void ScrollToAbsPos( long nPos ); void ShowFocusRect( const SvLBoxEntry* pEntry ); void SetTabBar( TabBar* pTabBar ); 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/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index ab6d4e1b8fb3..fd5a649d833c 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -1012,6 +1012,32 @@ void SvImpLBox::MakeVisible( SvLBoxEntry* pEntry, sal_Bool bMoveToTop ) pView->Invalidate(); } +void SvImpLBox::ScrollToAbsPos( long nPos ) +{ + 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() { diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index d03b956bf571..8f9a14926825 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); 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* ); -- cgit v1.2.3 From a7e20d7ae2d39dc8e5a87852ea492e556dbf1c9e Mon Sep 17 00:00:00 2001 From: Luke Symes Date: Wed, 22 Jun 2011 16:03:10 +1200 Subject: Implement GetLastEntryInView for SvTreeListBox. This function matches up with GetFirstEntryInView, and will be useful in saving the scroll state of a SvTreeListBox, in particular the CustomAnimationList. Signed-off-by: Tor Lillqvist --- svtools/inc/svtools/svtreebx.hxx | 1 + svtools/source/contnr/svtreebx.cxx | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'svtools') diff --git a/svtools/inc/svtools/svtreebx.hxx b/svtools/inc/svtools/svtreebx.hxx index 370ab44f34f4..96adfe73aea9 100644 --- a/svtools/inc/svtools/svtreebx.hxx +++ b/svtools/inc/svtools/svtreebx.hxx @@ -369,6 +369,7 @@ public: SvLBoxEntry* GetFirstEntryInView() const; SvLBoxEntry* GetNextEntryInView(SvLBoxEntry*) const; + SvLBoxEntry* GetLastEntryInView() const; void ScrollToAbsPos( long nPos ); void ShowFocusRect( const SvLBoxEntry* pEntry ); diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index 8f9a14926825..7695137431f0 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -2452,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 ); -- cgit v1.2.3 From f1251f68b178860c33521254c9dd4d9b35a96202 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 23 Jun 2011 00:03:52 +0100 Subject: remove parse ByteString variant --- svl/inc/svl/inettype.hxx | 31 --------------------------- svl/source/misc/inettype.cxx | 45 --------------------------------------- svtools/source/svhtml/parhtml.cxx | 7 +++--- 3 files changed, 3 insertions(+), 80 deletions(-) (limited to 'svtools') diff --git a/svl/inc/svl/inettype.hxx b/svl/inc/svl/inettype.hxx index 8f667ae908d4..54dbda7b75d4 100644 --- a/svl/inc/svl/inettype.hxx +++ b/svl/inc/svl/inettype.hxx @@ -382,37 +382,6 @@ public: static INetContentType MapStringToContentType(UniString const & rPresentation); - /** Parse the body of an RFC 2045 Content-Type header field. - - @param rMediaType The body of the Content-Type header field. It must - be of the form - - token "/" token *(";" token "=" (token / quoted-string)) - - with intervening linear white space and comments (cf. RFCs 822, 2045). - The RFC 2231 extension are supported. The encoding of rMediaType - should be US-ASCII, but any values in the range 0x80--0xFF are - interpretet 'as appropriate.' - - @param rType Returns the type (the first of the above tokens), in US- - ASCII encoding and converted to lower case. - - @param rSubType Returns the sub type (the second of the above - tokens), in US-ASCII encoding and converted to lower case. - - @param rParameters If not null, returns the parameters as a list of - INetContentTypeParameters (the attributes are in US-ASCII encoding and - converted to lower case, the values are in Unicode encoding). If - null, only the syntax of the parameters is checked, but they are not - returned. - - @return True if the syntax of the field body is correct. If false is - returned, none of the output parameters will be modified! - */ - static bool parse(ByteString const & rMediaType, ByteString & rType, - ByteString & rSubType, - INetContentTypeParameterList * pParameters = 0); - /** Parse the body of an RFC 2045 Content-Type header field. @param rMediaType The body of the Content-Type header field. It must diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx index 819d9026f1d6..762f53061dcf 100644 --- a/svl/source/misc/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -1147,51 +1147,6 @@ INetContentType INetContentTypes::MapStringToContentType(UniString const & return pEntry ? pEntry->m_eTypeID : CONTENT_TYPE_UNKNOWN; } -//============================================================================ -// static -bool INetContentTypes::parse(ByteString const & rMediaType, - ByteString & rType, ByteString & rSubType, - INetContentTypeParameterList * pParameters) -{ - sal_Char const * p = rMediaType.GetBuffer(); - sal_Char const * pEnd = p + rMediaType.Len(); - - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - sal_Char const * pToken = p; - bool bDowncase = false; - while (p != pEnd && INetMIME::isTokenChar(*p)) - { - bDowncase = bDowncase || INetMIME::isUpperCase(*p); - ++p; - } - if (p == pToken) - return false; - rType = ByteString(pToken, sal::static_int_cast< xub_StrLen >(p - pToken)); - if (bDowncase) - rType.ToLowerAscii(); - - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - if (p == pEnd || *p++ != '/') - return false; - - p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); - pToken = p; - bDowncase = false; - while (p != pEnd && INetMIME::isTokenChar(*p)) - { - bDowncase = bDowncase || INetMIME::isUpperCase(*p); - ++p; - } - if (p == pToken) - return false; - rSubType = ByteString( - pToken, sal::static_int_cast< xub_StrLen >(p - pToken)); - if (bDowncase) - rSubType.ToLowerAscii(); - - return INetMIME::scanParameters(p, pEnd, pParameters) == pEnd; -} - //============================================================================ // static bool INetContentTypes::parse(UniString const & rMediaType, 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"); -- cgit v1.2.3 From ec2ba4881538f485ed17dd1c44c2a9fd0a5d971a Mon Sep 17 00:00:00 2001 From: Matus Kukan Date: Fri, 24 Jun 2011 14:56:31 +0100 Subject: update component factory methods to use new prefixes, to add lib merging --- sot/source/unoolestorage/register.cxx | 4 ++-- sot/util/sot.component | 2 +- svl/source/fsstor/fsfactory.cxx | 4 ++-- svl/source/fsstor/fsstorage.component | 2 +- svl/source/passwordcontainer/passwordcontainer.component | 2 +- svl/source/passwordcontainer/passwordcontainer.cxx | 4 ++-- svl/source/uno/registerservices.cxx | 4 ++-- svl/util/svl.component | 2 +- svtools/source/hatchwindow/hatchwindowfactory.component | 2 +- svtools/source/hatchwindow/hatchwindowfactory.cxx | 4 ++-- svtools/source/productregistration/productregistration.cxx | 4 ++-- svtools/source/productregistration/productregistration.uno.component | 2 +- svtools/source/uno/miscservices.cxx | 4 ++-- svtools/util/svt.component | 2 +- toolkit/source/helper/registerservices.cxx | 4 ++-- toolkit/util/tk.component | 2 +- unotools/source/ucbhelper/xtempfile.cxx | 4 ++-- unotools/util/utl.component | 2 +- vcl/source/components/factory.cxx | 4 ++-- vcl/vcl.macosx.component | 2 +- vcl/vcl.unx.component | 2 +- vcl/vcl.windows.component | 2 +- 22 files changed, 32 insertions(+), 32 deletions(-) (limited to 'svtools') diff --git a/sot/source/unoolestorage/register.cxx b/sot/source/unoolestorage/register.cxx index 696e0cefed93..30f417b29625 100644 --- a/sot/source/unoolestorage/register.cxx +++ b/sot/source/unoolestorage/register.cxx @@ -41,12 +41,12 @@ using namespace ::com::sun::star; extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) +SAL_DLLPUBLIC_EXPORT void SAL_CALL sot_component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) +SAL_DLLPUBLIC_EXPORT void * SAL_CALL sot_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; diff --git a/sot/util/sot.component b/sot/util/sot.component index 7d17c7d54475..44ca8cea7a9a 100644 --- a/sot/util/sot.component +++ b/sot/util/sot.component @@ -26,7 +26,7 @@ * **********************************************************************--> - diff --git a/svl/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx index a641a5d80c04..db6fc301a0d0 100644 --- a/svl/source/fsstor/fsfactory.cxx +++ b/svl/source/fsstor/fsfactory.cxx @@ -235,13 +235,13 @@ uno::Sequence< ::rtl::OUString > SAL_CALL FSStorageFactory::getSupportedServiceN extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( +SAL_DLLPUBLIC_EXPORT void SAL_CALL fsstorage_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 fsstorage_component_getFactory ( const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) { void * pResult = 0; diff --git a/svl/source/fsstor/fsstorage.component b/svl/source/fsstor/fsstorage.component index 3ef0be825972..f9f08487b8a5 100644 --- a/svl/source/fsstor/fsstorage.component +++ b/svl/source/fsstor/fsstorage.component @@ -26,7 +26,7 @@ * **********************************************************************--> - diff --git a/svl/source/passwordcontainer/passwordcontainer.component b/svl/source/passwordcontainer/passwordcontainer.component index 42eb47cf14dd..3fc55af1861e 100644 --- a/svl/source/passwordcontainer/passwordcontainer.component +++ b/svl/source/passwordcontainer/passwordcontainer.component @@ -26,7 +26,7 @@ * **********************************************************************--> - diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 6e922ea29cd7..d584a1c77725 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -1538,13 +1538,13 @@ MasterPasswordRequest_Impl::MasterPasswordRequest_Impl( PasswordRequestMode Mode extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( +SAL_DLLPUBLIC_EXPORT void SAL_CALL passwordcontainer_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 passwordcontainer_component_getFactory ( const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) { void * pResult = 0; diff --git a/svl/source/uno/registerservices.cxx b/svl/source/uno/registerservices.cxx index 5caca580694f..3fa8b0e7ebef 100644 --- a/svl/source/uno/registerservices.cxx +++ b/svl/source/uno/registerservices.cxx @@ -55,13 +55,13 @@ DECLARE_CREATEINSTANCE( PathService ) extern "C" { -SVL_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment ( +SVL_DLLPUBLIC void SAL_CALL svl_component_getImplementationEnvironment ( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -SVL_DLLPUBLIC void* SAL_CALL component_getFactory ( +SVL_DLLPUBLIC void* SAL_CALL svl_component_getFactory ( const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey*/) { void * pResult = 0; diff --git a/svl/util/svl.component b/svl/util/svl.component index 4af1a31f5782..78fc22928ac5 100644 --- a/svl/util/svl.component +++ b/svl/util/svl.component @@ -26,7 +26,7 @@ * **********************************************************************--> - 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 @@ * **********************************************************************--> - diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx index a0ff0d4daf17..13f78b3e353b 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.cxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx @@ -109,13 +109,13 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OHatchWindowFactory::getSupportedServi extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( +SAL_DLLPUBLIC_EXPORT void SAL_CALL hatchwindowfactory_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/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx index a4251652aac2..ebedda0ad071 100644 --- a/svtools/source/productregistration/productregistration.cxx +++ b/svtools/source/productregistration/productregistration.cxx @@ -453,13 +453,13 @@ namespace svt extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( +SAL_DLLPUBLIC_EXPORT void SAL_CALL productregistration_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 @@ * **********************************************************************--> - diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index c652b6028bf0..1b20ef518683 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -96,13 +96,13 @@ DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicRendererVCL ) extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( +SAL_DLLPUBLIC_EXPORT void SAL_CALL svt_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/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 @@ * **********************************************************************--> - diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx index cadd228d1c4b..6e11e72970be 100644 --- a/toolkit/source/helper/registerservices.cxx +++ b/toolkit/source/helper/registerservices.cxx @@ -236,12 +236,12 @@ extern void * SAL_CALL comp_Layout_component_getFactory( const char * implName, extern "C" { -TOOLKIT_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** ) +TOOLKIT_DLLPUBLIC void SAL_CALL tk_component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey ) +TOOLKIT_DLLPUBLIC void* SAL_CALL tk_component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey ) { void* pRet = NULL; diff --git a/toolkit/util/tk.component b/toolkit/util/tk.component index 4d4713e87c45..f6638794de12 100644 --- a/toolkit/util/tk.component +++ b/toolkit/util/tk.component @@ -26,7 +26,7 @@ * **********************************************************************--> - diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx index 7883a3e85cb2..d73981670d5d 100644 --- a/unotools/source/ucbhelper/xtempfile.cxx +++ b/unotools/source/ucbhelper/xtempfile.cxx @@ -486,7 +486,7 @@ throw ( ::css::uno::RuntimeException ) // C functions to implement this as a component -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL utl_component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; @@ -499,7 +499,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnviron * @param pRegistryKey registry data key to read and write component persistent data * @return a component factory (generic uno interface) */ -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL utl_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; diff --git a/unotools/util/utl.component b/unotools/util/utl.component index 8c8198741f55..ab4b67b61da4 100644 --- a/unotools/util/utl.component +++ b/unotools/util/utl.component @@ -26,7 +26,7 @@ * **********************************************************************--> - diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index 04b0e122cbce..f4665832a9a8 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -83,14 +83,14 @@ namespace rsvg extern "C" { - VCL_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( + VCL_DLLPUBLIC void SAL_CALL vcl_component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - VCL_DLLPUBLIC void* SAL_CALL component_getFactory( + VCL_DLLPUBLIC void* SAL_CALL vcl_component_getFactory( const sal_Char* pImplementationName, void* pXUnoSMgr, void* /*pXUnoKey*/ diff --git a/vcl/vcl.macosx.component b/vcl/vcl.macosx.component index 023f805672bd..a4f551c63a79 100644 --- a/vcl/vcl.macosx.component +++ b/vcl/vcl.macosx.component @@ -26,7 +26,7 @@ * **********************************************************************--> - diff --git a/vcl/vcl.unx.component b/vcl/vcl.unx.component index ea14667d17c1..c58bb8fa3c47 100644 --- a/vcl/vcl.unx.component +++ b/vcl/vcl.unx.component @@ -26,7 +26,7 @@ * **********************************************************************--> - diff --git a/vcl/vcl.windows.component b/vcl/vcl.windows.component index df786c4d832b..5dd80ebe0029 100644 --- a/vcl/vcl.windows.component +++ b/vcl/vcl.windows.component @@ -26,7 +26,7 @@ * **********************************************************************--> - -- cgit v1.2.3 From 1dc2221b2639820a3949f37721243a18cfb74dd1 Mon Sep 17 00:00:00 2001 From: Luke Symes Date: Sun, 26 Jun 2011 22:13:01 +1200 Subject: Fix ScrollToAbsPos to work when we have an empty list. --- svtools/source/contnr/svimpbox.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'svtools') diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index fd5a649d833c..e0e9efca6f59 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -1014,6 +1014,8 @@ void SvImpLBox::MakeVisible( SvLBoxEntry* pEntry, sal_Bool bMoveToTop ) void SvImpLBox::ScrollToAbsPos( long nPos ) { + if( pView->GetVisibleCount() == 0 ) + return; long nLastEntryPos = pView->GetAbsPos( pView->Last() ); if( nPos < 0 ) -- cgit v1.2.3 From 7fe95cc52cf08b9351bd9af0a0a99941e4795233 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 29 Jun 2011 09:02:15 +0100 Subject: remove deprecated ByteString::CreateFromInt64 --- l10ntools/source/export.cxx | 6 +- svtools/bmpmaker/bmpsum.cxx | 2 +- svtools/source/svhtml/htmlout.cxx | 2 +- tools/source/ref/pstm.cxx | 12 +-- tools/source/stream/strmunx.cxx | 25 +++--- vcl/unx/generic/fontmanager/fontcache.cxx | 121 +++++++++++++++--------------- 6 files changed, 89 insertions(+), 79 deletions(-) (limited to 'svtools') diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx index 69f1e967b13c..6d08da4144f7 100644 --- a/l10ntools/source/export.cxx +++ b/l10ntools/source/export.cxx @@ -1268,7 +1268,7 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew ) sOutput += sLID; sOutput += "\t"; sOutput += pResData->sHelpId; sOutput += "\t"; sOutput += pResData->sPForm; sOutput += "\t"; - sOutput += ByteString::CreateFromInt64( pResData->nWidth ); sOutput += "\t"; + sOutput += ByteString(rtl::OString::valueOf(static_cast(pResData->nWidth))); sOutput += "\t"; sOutput += sCur; sOutput += "\t"; @@ -1369,7 +1369,7 @@ sal_Bool Export::WriteExportList( ResData *pResData, ExportList *pExportList, // ByteString a("Export::WriteExportList::pEntry"); // Export::DumpMap( a, *pEntry ); - ByteString sLID( ByteString::CreateFromInt64( i + 1 )); + ByteString sLID(rtl::OString::valueOf(static_cast(i + 1))); for( unsigned int n = 0; n < aLanguages.size(); n++ ){ sCur = aLanguages[ n ]; if ( (*pEntry)[ SOURCE_LANGUAGE ].Len() ) @@ -1520,7 +1520,7 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine ) a.Append( "." ); a.Append( pResData->sId ); sal_Int64 x = nListIndex+1; - ByteString b( ByteString::CreateFromInt64( x ) ); + ByteString b(rtl::OString::valueOf(x)); ByteString sKey = MergeDataFile::CreateKey( sPlist , a , b , sFilename ); pResData->addFallbackData( sKey , rText ); } 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(aPair.first))); ByteString aFileName( aFileNameVector[ i ] ); DirEntry aSrcFile( aFileName ); diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 31e60e1ab1a1..b1b428d8fd3b 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(c)))) += ';'; if( pNonConvertableChars && STRING_NOTFOUND == pNonConvertableChars->Search( c ) ) pNonConvertableChars->Append( c ); diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index 75781b427c89..0507048ad12c 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -31,6 +31,7 @@ #include #include +#include #define STOR_NO_OPTIMIZE @@ -152,11 +153,12 @@ SvPersistStream& operator >> ( SvPersistStream & rStm, #ifdef DBG_UTIL if( nObjLen + nObjPos != rStm.Tell() ) { - ByteString aStr( "false list len: read = " ); - aStr += ByteString::CreateFromInt32( (long)(rStm.Tell() - nObjPos) ); - aStr += ", should = "; - aStr += ByteString::CreateFromInt64(nObjLen); - OSL_FAIL( aStr.GetBuffer() ); + rtl::OStringBuffer aStr( + RTL_CONSTASCII_STRINGPARAM("false list len: read = ")); + aStr.append(static_cast(rStm.Tell() - nObjPos)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(", should = ")); + aStr.append(static_cast(nObjLen)); + OSL_FAIL(aStr.getStr()); } #else (void)nObjLen; diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index d9d177ce9658..9c84eeae54f8 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -48,6 +48,7 @@ // class FileBase #include #include +#include using namespace osl; @@ -355,11 +356,13 @@ sal_uInt16 SvFileStream::IsA() const sal_Size SvFileStream::GetData( void* pData, sal_Size nSize ) { #ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStream::GetData(): " ); - aTraceStr += ByteString::CreateFromInt64(nSize); - aTraceStr += " Bytes from "; - aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); + rtl::OStringBuffer aTraceStr( + RTL_CONSTASCII_STRINGPARAM("SvFileStream::GetData(): ")); + aTraceStr.append(static_cast(nSize)); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" Bytes from ")); + aTraceStr.append(rtl::OUStringToOString(aFilename, + osl_getThreadTextEncoding())); + OSL_TRACE("%s", aTraceStr.getStr()); #endif int nRead = 0; @@ -381,11 +384,13 @@ sal_Size SvFileStream::GetData( void* pData, sal_Size nSize ) sal_Size SvFileStream::PutData( const void* pData, sal_Size nSize ) { #ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStrean::PutData: " ); - aTraceStr += ByteString::CreateFromInt64(nSize); - aTraceStr += " Bytes to "; - aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); + rtl::OStringBuffer aTraceStr( + RTL_CONSTASCII_STRINGPARAM("SvFileStream::PutData(): ")); + aTraceStr.append(static_cast(nSize)); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" Bytes to ")); + aTraceStr.append(rtl::OUStringToOString(aFilename, + osl_getThreadTextEncoding())); + OSL_TRACE("%s", aTraceStr.getStr()); #endif int nWrite = 0; diff --git a/vcl/unx/generic/fontmanager/fontcache.cxx b/vcl/unx/generic/fontmanager/fontcache.cxx index e7a4008f07f0..e47c95ec07ca 100644 --- a/vcl/unx/generic/fontmanager/fontcache.cxx +++ b/vcl/unx/generic/fontmanager/fontcache.cxx @@ -40,6 +40,8 @@ #include "tools/stream.hxx" +#include + #include #include @@ -132,13 +134,14 @@ void FontCache::flush() const FontDirMap& rDir( dir_it->second.m_aEntries ); ByteString aDirectory( rManager.getDirectory( dir_it->first ) ); - ByteString aLine( "FontCacheDirectory:" ); - aLine.Append( ByteString::CreateFromInt64( dir_it->second.m_nTimestamp ) ); - aLine.Append( ':' ); - aLine.Append( aDirectory ); + rtl::OStringBuffer aLine( + RTL_CONSTASCII_STRINGPARAM("FontCacheDirectory:")); + aLine.append(dir_it->second.m_nTimestamp); + aLine.append(':'); + aLine.append(aDirectory); if( rDir.empty() && dir_it->second.m_bNoFiles ) - aLine.Insert( "Empty", 0 ); - aStream.WriteLine( aLine ); + aLine.insert(0, RTL_CONSTASCII_STRINGPARAM("Empty")); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); for( FontDirMap::const_iterator entry_it = rDir.begin(); entry_it != rDir.end(); ++entry_it ) { @@ -147,16 +150,16 @@ void FontCache::flush() if( rEntry.begin() == rEntry.end() ) continue; - aLine = "File:"; - aLine.Append( ByteString( entry_it->first ) ); - aStream.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("File:")); + aLine.append(entry_it->first); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); int nEntrySize = entry_it->second.m_aEntry.size(); // write: type;nfonts - aLine = ByteString::CreateFromInt32( rEntry.front()->m_eType ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( nEntrySize ) ); - aStream.WriteLine( aLine ); + aLine.append(static_cast(rEntry.front()->m_eType)); + aLine.append(';'); + aLine.append(static_cast(nEntrySize)); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); sal_Int32 nSubEntry = 0; for( FontCacheEntry::const_iterator it = rEntry.begin(); it != rEntry.end(); ++it, nSubEntry++ ) @@ -171,73 +174,73 @@ void FontCache::flush() else nSubEntry = -1; - aLine = OUStringToOString( pAtoms->getString( ATOM_FAMILYNAME, (*it)->m_nFamilyName ), RTL_TEXTENCODING_UTF8 ); + aLine.append(OUStringToOString(pAtoms->getString( ATOM_FAMILYNAME, (*it)->m_nFamilyName), RTL_TEXTENCODING_UTF8)); for( ::std::list< int >::const_iterator name_it = (*it)->m_aAliases.begin(); name_it != (*it)->m_aAliases.end(); ++name_it ) { const OUString& rAdd( pAtoms->getString( ATOM_FAMILYNAME, *name_it ) ); if( rAdd.getLength() ) { - aLine.Append( ';' ); - aLine.Append( ByteString( String( rAdd ), RTL_TEXTENCODING_UTF8 ) ); + aLine.append(';'); + aLine.append(OUStringToOString(rAdd, RTL_TEXTENCODING_UTF8)); } } - aStream.WriteLine( aLine ); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); const OUString& rPSName( pAtoms->getString( ATOM_PSNAME, (*it)->m_nPSName ) ); - aLine = ByteString::CreateFromInt32( nSubEntry ); - aLine.Append( ';' ); - aLine.Append( ByteString( String( rPSName ), RTL_TEXTENCODING_UTF8 ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_eItalic ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_eWeight ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_eWidth ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_ePitch ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aEncoding ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_nAscend ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_nDescend ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_nLeading ) ); - aLine.Append( ';' ); - aLine.Append( (*it)->m_bHaveVerticalSubstitutedGlyphs ? "1" : "0" ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricX.width ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricX.height ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricY.width ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricY.height ) ); - aLine.Append( ';' ); - aLine.Append( (*it)->m_bUserOverride ? "1" : "0" ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( 0 ) ); - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( 0 ) ); + aLine.append(nSubEntry); + aLine.append(';'); + aLine.append(OUStringToOString(rPSName, RTL_TEXTENCODING_UTF8)); + aLine.append(';'); + aLine.append(static_cast((*it)->m_eItalic)); + aLine.append(';'); + aLine.append(static_cast((*it)->m_eWeight)); + aLine.append(';'); + aLine.append(static_cast((*it)->m_eWidth)); + aLine.append(';'); + aLine.append(static_cast((*it)->m_ePitch)); + aLine.append(';'); + aLine.append(static_cast((*it)->m_aEncoding)); + aLine.append(';'); + aLine.append(static_cast((*it)->m_nAscend)); + aLine.append(';'); + aLine.append(static_cast((*it)->m_nDescend)); + aLine.append(';'); + aLine.append(static_cast((*it)->m_nLeading)); + aLine.append(';'); + aLine.append((*it)->m_bHaveVerticalSubstitutedGlyphs ? '1' : '0'); + aLine.append(';'); + aLine.append(static_cast((*it)->m_aGlobalMetricX.width )); + aLine.append(';'); + aLine.append(static_cast((*it)->m_aGlobalMetricX.height)); + aLine.append(';'); + aLine.append(static_cast((*it)->m_aGlobalMetricY.width )); + aLine.append(';'); + aLine.append(static_cast((*it)->m_aGlobalMetricY.height)); + aLine.append(';'); + aLine.append((*it)->m_bUserOverride ? '1' : '0'); + aLine.append(';'); + aLine.append(static_cast(0)); + aLine.append(';'); + aLine.append(static_cast(0)); switch( (*it)->m_eType ) { case fonttype::Type1: - aLine.Append( ';' ); - aLine.Append( ByteString( static_cast(*it)->m_aMetricFile ) ); + aLine.append(';'); + aLine.append(static_cast(*it)->m_aMetricFile); break; case fonttype::TrueType: - aLine.Append( ';' ); - aLine.Append( ByteString::CreateFromInt32( static_cast(*it)->m_nTypeFlags ) ); + aLine.append(';'); + aLine.append(static_cast(static_cast(*it)->m_nTypeFlags)); break; default: break; } if( (*it)->m_aStyleName.getLength() ) { - aLine.Append( ';' ); - aLine.Append( ByteString( String( (*it)->m_aStyleName ), RTL_TEXTENCODING_UTF8 ) ); + aLine.append(';'); + aLine.append(OUStringToOString((*it)->m_aStyleName, RTL_TEXTENCODING_UTF8)); } - aStream.WriteLine( aLine ); + aStream.WriteLine(ByteString(aLine.makeStringAndClear())); } aStream.WriteLine( ByteString() ); } -- cgit v1.2.3 From 094092d47489fd040668bbcc6315a1221bbfc42b Mon Sep 17 00:00:00 2001 From: Francois Tigeot Date: Fri, 1 Jul 2011 07:31:14 +0200 Subject: Do not include filedlg.hxx when not necessary --- svtools/bmpmaker/bmp.cxx | 1 - svtools/source/uno/unoiface.cxx | 1 - 2 files changed, 2 deletions(-) (limited to 'svtools') 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 #include "svl/solar.hrc" -#include #include "bmpcore.hxx" #include "bmp.hrc" 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 #include #include -#include #include #include #include -- cgit v1.2.3 From a0a3c24609fd50b0672be800043554e3094c84ee Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 2 Jul 2011 23:17:56 +0100 Subject: ByteString::CreateFromInt32->rtl::OString::valueOf --- svtools/source/misc/transfer.cxx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'svtools') diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 4b24ed4330fd..2c93a1045e89 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -65,6 +65,7 @@ #include #include #include +#include #include // -------------- @@ -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; -- cgit v1.2.3 From a1b214effc2d6c3c579a9e822cf04db888cb408d Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 6 Jul 2011 13:08:02 +0100 Subject: add regression testing infrastructure for wmf/emf --- svtools/CppunitTest_svtools_filters_test.mk | 75 ++++++++ svtools/Module_svtools.mk | 4 + svtools/prj/build.lst | 2 +- svtools/qa/cppunit/data/emf/fail/.gitignore | 0 .../qa/cppunit/data/emf/indeterminate/.gitignore | 0 svtools/qa/cppunit/data/emf/pass/.gitignore | 0 svtools/qa/cppunit/data/wmf/fail/.gitignore | 0 .../qa/cppunit/data/wmf/indeterminate/.gitignore | 0 svtools/qa/cppunit/data/wmf/pass/.gitignore | 0 svtools/qa/cppunit/filters-test.cxx | 214 +++++++++++++++++++++ 10 files changed, 294 insertions(+), 1 deletion(-) create mode 100755 svtools/CppunitTest_svtools_filters_test.mk create mode 100644 svtools/qa/cppunit/data/emf/fail/.gitignore create mode 100644 svtools/qa/cppunit/data/emf/indeterminate/.gitignore create mode 100644 svtools/qa/cppunit/data/emf/pass/.gitignore create mode 100644 svtools/qa/cppunit/data/wmf/fail/.gitignore create mode 100644 svtools/qa/cppunit/data/wmf/indeterminate/.gitignore create mode 100644 svtools/qa/cppunit/data/wmf/pass/.gitignore create mode 100644 svtools/qa/cppunit/filters-test.cxx (limited to 'svtools') diff --git a/svtools/CppunitTest_svtools_filters_test.mk b/svtools/CppunitTest_svtools_filters_test.mk new file mode 100755 index 000000000000..952ec02cbecc --- /dev/null +++ b/svtools/CppunitTest_svtools_filters_test.mk @@ -0,0 +1,75 @@ +#************************************************************************* +# 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. +# 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_add_service_rdbs,svtools_filters_test,\ + svtools_filters_test \ +)) + +$(eval $(call gb_CppunitTest_set_args,svtools_filters_test,\ + --headless \ + --invisible \ + --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ +)) + +$(eval $(call gb_RdbTarget_RdbTarget,svtools_filters_test)) + +# vim: set noet sw=4 ts=4: diff --git a/svtools/Module_svtools.mk b/svtools/Module_svtools.mk index 0b669d9dee1b..ac2fff8623a3 100644 --- a/svtools/Module_svtools.mk +++ b/svtools/Module_svtools.mk @@ -39,6 +39,10 @@ $(eval $(call gb_Module_add_targets,svtools,\ Package_inc \ )) +$(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/prj/build.lst b/svtools/prj/build.lst index a438456220a0..d18c9f9df2a2 100644 --- a/svtools/prj/build.lst +++ b/svtools/prj/build.lst @@ -1,2 +1,2 @@ -st svtools : TRANSLATIONS:translations svl offapi 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 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 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 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 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 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 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 + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Caolán McNamara + * + * 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 +#include + +#include +#include + +#include + +#include + +#include + +#include +#include + +#include + +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 m_xContext; + uno::Reference 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 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 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 xUcb = + ucbhelper::ContentBroker::get()->getContentProviderManagerInterface(); + uno::Reference 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: */ -- cgit v1.2.3 From 645361f80286bd316dbec0b26f29c50bac7afa32 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 6 Jul 2011 13:17:03 +0100 Subject: add some wmf test-cases --- svtools/qa/cppunit/data/wmf/fail/CVE-2005-2124-1.wmf | Bin 0 -> 218 bytes svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-1.wmf | Bin 0 -> 68 bytes svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-2.wmf | Bin 0 -> 68 bytes svtools/qa/cppunit/data/wmf/pass/CVE-2005-2123-1.wmf | Bin 0 -> 684 bytes svtools/qa/cppunit/data/wmf/pass/CVE-2006-4071-1.wmf | Bin 0 -> 68 bytes svtools/qa/cppunit/data/wmf/pass/CVE-2007-1090-1.wmf | Bin 0 -> 238 bytes svtools/qa/cppunit/data/wmf/pass/CVE-2007-1238-1.wmf | Bin 0 -> 382 bytes svtools/qa/cppunit/data/wmf/pass/CVE-2007-1245-1.wmf | Bin 0 -> 382 bytes 8 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 svtools/qa/cppunit/data/wmf/fail/CVE-2005-2124-1.wmf create mode 100644 svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-1.wmf create mode 100644 svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-2.wmf create mode 100644 svtools/qa/cppunit/data/wmf/pass/CVE-2005-2123-1.wmf create mode 100644 svtools/qa/cppunit/data/wmf/pass/CVE-2006-4071-1.wmf create mode 100644 svtools/qa/cppunit/data/wmf/pass/CVE-2007-1090-1.wmf create mode 100644 svtools/qa/cppunit/data/wmf/pass/CVE-2007-1238-1.wmf create mode 100644 svtools/qa/cppunit/data/wmf/pass/CVE-2007-1245-1.wmf (limited to 'svtools') 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 new file mode 100644 index 000000000000..5826a98277c2 Binary files /dev/null and b/svtools/qa/cppunit/data/wmf/fail/CVE-2005-2124-1.wmf differ 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 new file mode 100644 index 000000000000..07db62c2a48c Binary files /dev/null and b/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-1.wmf differ 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 new file mode 100644 index 000000000000..5b99a4883ce8 Binary files /dev/null and b/svtools/qa/cppunit/data/wmf/fail/CVE-2006-0143-2.wmf differ 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 new file mode 100644 index 000000000000..6af243b587c5 Binary files /dev/null and b/svtools/qa/cppunit/data/wmf/pass/CVE-2005-2123-1.wmf differ 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 new file mode 100644 index 000000000000..794a7ef9af08 Binary files /dev/null and b/svtools/qa/cppunit/data/wmf/pass/CVE-2006-4071-1.wmf differ 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 new file mode 100644 index 000000000000..c050fa6e3b4d Binary files /dev/null and b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1090-1.wmf differ 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 new file mode 100644 index 000000000000..a01e310089b0 Binary files /dev/null and b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1238-1.wmf differ 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 new file mode 100644 index 000000000000..a01e310089b0 Binary files /dev/null and b/svtools/qa/cppunit/data/wmf/pass/CVE-2007-1245-1.wmf differ -- cgit v1.2.3 From 8ba39261d635a764993d0fd002a47a3ec48a5cf2 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 6 Jul 2011 13:41:52 +0100 Subject: handle busted emf lengths --- svtools/source/filter/wmf/enhwmf.cxx | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'svtools') 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() -- cgit v1.2.3 From 004a29b9ac66f68af5ea12a2303a4b2be77d8145 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Wed, 6 Jul 2011 18:05:48 +0200 Subject: Fixed a crash: GDIMetafile was deleted twice --- svtools/source/graphic/grfcache.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svtools') diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index df7bfa9f88b1..47de44d7695c 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -371,7 +371,7 @@ void GraphicCacheEntry::GraphicObjectWasSwappedOut( const GraphicObject& /*rObj* 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; } } -- cgit v1.2.3 From 7ba7f588ffca35c5a8b9574ca9e22e3a8029e388 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 6 Jul 2011 13:48:19 +0100 Subject: add some emf test-cases --- svtools/qa/cppunit/data/emf/fail/CVE-2004-0209-1.emf | Bin 0 -> 576 bytes svtools/qa/cppunit/data/emf/fail/CVE-2008-1083-1.emf | Bin 0 -> 3524 bytes svtools/qa/cppunit/data/emf/fail/CVE-2009-1217-1.emf | Bin 0 -> 1075 bytes svtools/qa/cppunit/data/emf/pass/CVE-2008-1087-1.emf | Bin 0 -> 3380 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 svtools/qa/cppunit/data/emf/fail/CVE-2004-0209-1.emf create mode 100644 svtools/qa/cppunit/data/emf/fail/CVE-2008-1083-1.emf create mode 100644 svtools/qa/cppunit/data/emf/fail/CVE-2009-1217-1.emf create mode 100644 svtools/qa/cppunit/data/emf/pass/CVE-2008-1087-1.emf (limited to 'svtools') 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 new file mode 100644 index 000000000000..2f77fcda3b99 Binary files /dev/null and b/svtools/qa/cppunit/data/emf/fail/CVE-2004-0209-1.emf differ 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 new file mode 100644 index 000000000000..0cbd952de2f6 Binary files /dev/null and b/svtools/qa/cppunit/data/emf/fail/CVE-2008-1083-1.emf differ 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 new file mode 100644 index 000000000000..ee7db91e37fe Binary files /dev/null and b/svtools/qa/cppunit/data/emf/fail/CVE-2009-1217-1.emf differ 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 new file mode 100644 index 000000000000..9bc2a3f203fa Binary files /dev/null and b/svtools/qa/cppunit/data/emf/pass/CVE-2008-1087-1.emf differ -- cgit v1.2.3 From 43d7111c8371acf14933f1d18c835b898da64121 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 6 Jul 2011 17:22:24 +0100 Subject: don't need this I believe --- svtools/CppunitTest_svtools_filters_test.mk | 6 ------ 1 file changed, 6 deletions(-) (limited to 'svtools') diff --git a/svtools/CppunitTest_svtools_filters_test.mk b/svtools/CppunitTest_svtools_filters_test.mk index 952ec02cbecc..d091ede3f2f9 100755 --- a/svtools/CppunitTest_svtools_filters_test.mk +++ b/svtools/CppunitTest_svtools_filters_test.mk @@ -60,16 +60,10 @@ $(eval $(call gb_CppunitTest_add_type_rdbs,svtools_filters_test,\ types \ )) -$(eval $(call gb_CppunitTest_add_service_rdbs,svtools_filters_test,\ - svtools_filters_test \ -)) - $(eval $(call gb_CppunitTest_set_args,svtools_filters_test,\ --headless \ --invisible \ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ )) -$(eval $(call gb_RdbTarget_RdbTarget,svtools_filters_test)) - # vim: set noet sw=4 ts=4: -- cgit v1.2.3 From 930450f44e1d7b1f4490dea47c5825972490a74f Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 6 Jul 2011 23:43:15 +0100 Subject: ByteString::CreateFromInt32->rtl::OString::valueOf --- svtools/source/filter/wmf/emfwr.cxx | 4 +++- svtools/source/svrtf/rtfout.cxx | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'svtools') diff --git a/svtools/source/filter/wmf/emfwr.cxx b/svtools/source/filter/wmf/emfwr.cxx index 4efaa1bbbb88..d1beacbcd01f 100644 --- a/svtools/source/filter/wmf/emfwr.cxx +++ b/svtools/source/filter/wmf/emfwr.cxx @@ -1429,7 +1429,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(nType)).getStr()); break; } } diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx index 21368c0b14d3..d17148bd291a 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(c)).getStr(); } for (sal_Int32 nI = 0; nI < nLen; ++nI) -- cgit v1.2.3 From 1737c0501328ac481601688021a662d4eccdfd5d Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Fri, 8 Jul 2011 18:12:46 +0900 Subject: header for rtl::OStringBuffer --- svtools/source/filter/wmf/emfwr.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'svtools') diff --git a/svtools/source/filter/wmf/emfwr.cxx b/svtools/source/filter/wmf/emfwr.cxx index d1beacbcd01f..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 #include #include #include -- cgit v1.2.3 From 7d1a41c189e800c453c4855d2b38843bbd2dd209 Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Sat, 9 Jul 2011 16:01:45 -0700 Subject: Replace List with std::vector< AInfo* > I actually moved the List member from the class to a class method. I think this is safe because the member was only used in one method and it's life- span was limited to the one method (populate, process, dispose - all in one "if" block. I also removed all the member's export methods since no one used them. --- svtools/inc/svtools/grfmgr.hxx | 1 - svtools/source/graphic/grfmgr.cxx | 5 ----- vcl/inc/impgraph.hxx | 2 -- vcl/inc/vcl/animate.hxx | 2 -- vcl/inc/vcl/graph.hxx | 2 -- vcl/source/gdi/animate.cxx | 13 ++++++++----- vcl/source/gdi/graph.cxx | 7 ------- vcl/source/gdi/impgraph.cxx | 7 ------- 8 files changed, 8 insertions(+), 31 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/grfmgr.hxx b/svtools/inc/svtools/grfmgr.hxx index e81458644d50..0395a9d5afe5 100644 --- a/svtools/inc/svtools/grfmgr.hxx +++ b/svtools/inc/svtools/grfmgr.hxx @@ -409,7 +409,6 @@ public: sal_Bool HasRenderGraphic() const { return mbHasRenderGraphic; } void ResetAnimationLoopCount(); - List* GetAnimationInfoList() const; Link GetAnimationNotifyHdl() const { return maGraphic.GetAnimationNotifyHdl(); } void SetAnimationNotifyHdl( const Link& rLink ); diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index fdfa92a72b00..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 ) { diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index 6b6bce184770..592f6a73c050 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -144,8 +144,6 @@ private: sal_uLong ImplGetAnimationLoopCount() const; void ImplResetAnimationLoopCount(); - List* ImplGetAnimationInfoList() const; - private: GraphicReader* ImplGetContext(); diff --git a/vcl/inc/vcl/animate.hxx b/vcl/inc/vcl/animate.hxx index 687a4300cb3e..90a49de5d023 100644 --- a/vcl/inc/vcl/animate.hxx +++ b/vcl/inc/vcl/animate.hxx @@ -152,7 +152,6 @@ class VCL_DLLPUBLIC Animation SAL_DLLPRIVATE static sal_uLong mnAnimCount; AnimationBitmapList_impl maList; - List maAInfoList; Link maNotifyLink; BitmapEx maBitmapEx; Timer maTimer; @@ -241,7 +240,6 @@ public: const AnimationBitmap& Get( sal_uInt16 nAnimation ) const; void Replace( const AnimationBitmap& rNewAnimationBmp, sal_uInt16 nAnimation ); - List* GetAInfoList() { return &maAInfoList; } sal_uLong GetSizeBytes() const; sal_uLong GetChecksum() const; diff --git a/vcl/inc/vcl/graph.hxx b/vcl/inc/vcl/graph.hxx index d613c2d8432b..2ca801cfb97b 100644 --- a/vcl/inc/vcl/graph.hxx +++ b/vcl/inc/vcl/graph.hxx @@ -178,8 +178,6 @@ public: sal_uLong GetAnimationLoopCount() const; void ResetAnimationLoopCount(); - List* GetAnimationInfoList() const; - sal_uLong GetChecksum() const; public: diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx index ce05dc1b2ca7..cfc8656dfc0b 100644 --- a/vcl/source/gdi/animate.cxx +++ b/vcl/source/gdi/animate.cxx @@ -455,10 +455,12 @@ void Animation::ImplRestartTimer( sal_uLong nTimeout ) } // ----------------------------------------------------------------------- +typedef ::std::vector< AInfo* > AInfoList_impl; IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) { const size_t nAnimCount = maList.size(); + AInfoList_impl aAInfoList; if( nAnimCount ) { @@ -471,13 +473,14 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) // create AInfo-List for( pView = (ImplAnimView*) mpViewList->First(); pView; pView = (ImplAnimView*) mpViewList->Next() ) - maAInfoList.Insert( pView->ImplCreateAInfo() ); + aAInfoList.push_back( pView->ImplCreateAInfo() ); maNotifyLink.Call( this ); // set view state from AInfo structure - for( pAInfo = (AInfo*) maAInfoList.First(); pAInfo; pAInfo = (AInfo*) maAInfoList.Next() ) + for( size_t i = 0, n = aAInfoList.size(); i < n; ++i ) { + pAInfo = aAInfoList[ i ]; if( !pAInfo->pViewData ) { pView = new ImplAnimView( this, pAInfo->pOutDev, @@ -493,9 +496,9 @@ IMPL_LINK( Animation, ImplTimeoutHdl, Timer*, EMPTYARG ) } // delete AInfo structures - for( pAInfo = (AInfo*) maAInfoList.First(); pAInfo; pAInfo = (AInfo*) maAInfoList.Next() ) - delete (AInfo*) pAInfo; - maAInfoList.Clear(); + for( size_t i = 0, n = aAInfoList.size(); i < n; ++i ) + delete aAInfoList[ i ]; + aAInfoList.clear(); // delete all unmarked views and reset marked state pView = (ImplAnimView*) mpViewList->First(); diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index eb22d31937df..8fa11e969aa8 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -662,13 +662,6 @@ void Graphic::ResetAnimationLoopCount() // ------------------------------------------------------------------------ -List* Graphic::GetAnimationInfoList() const -{ - return mpImpGraphic->ImplGetAnimationInfoList(); -} - -// ------------------------------------------------------------------------ - GraphicReader* Graphic::GetContext() { return mpImpGraphic->ImplGetContext(); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 9d995f361329..bd457f3fda22 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -928,13 +928,6 @@ void ImpGraphic::ImplResetAnimationLoopCount() // ------------------------------------------------------------------------ -List* ImpGraphic::ImplGetAnimationInfoList() const -{ - return( mpAnimation ? mpAnimation->GetAInfoList() : NULL ); -} - -// ------------------------------------------------------------------------ - GraphicReader* ImpGraphic::ImplGetContext() { return mpContext; -- cgit v1.2.3 From d208b1094a5947a7f2605759ccfd1f422ababb1f Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 10 Jul 2011 00:15:19 +0100 Subject: callcatcher: remove unused PIList* methods --- svtools/inc/svtools/helpopt.hxx | 4 ---- svtools/source/config/helpopt.cxx | 18 ------------------ 2 files changed, 22 deletions(-) (limited to 'svtools') 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/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(); -- cgit v1.2.3 From 34a4f4ea3589a06dc22d1c28b893fca0c35d29d2 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 10 Jul 2011 00:49:15 +0100 Subject: callcatcher: WriteWindowMetafile moved to binfilter long ago, remove this copy --- svtools/inc/svtools/filter.hxx | 1 - svtools/inc/svtools/wmf.hxx | 2 -- svtools/source/filter/wmf/wmf.cxx | 7 ------- 3 files changed, 10 deletions(-) (limited to 'svtools') 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/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/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 ); -- cgit v1.2.3 From 0e3e30c57e74be7cb9d8263f2abdde1cfd1d5c84 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 10 Jul 2011 01:03:31 +0100 Subject: remove unused and archaic ImpPolarToCart --- svtools/source/dialogs/mcvmath.cxx | 17 ----------------- svtools/source/dialogs/mcvmath.hxx | 2 -- svtools/source/filter/sgfbram.cxx | 12 ------------ svtools/source/filter/sgvtext.cxx | 16 ---------------- 4 files changed, 47 deletions(-) (limited to 'svtools') diff --git a/svtools/source/dialogs/mcvmath.cxx b/svtools/source/dialogs/mcvmath.cxx index 5d5ad14c82c2..0d2407493c53 100644 --- a/svtools/source/dialogs/mcvmath.cxx +++ b/svtools/source/dialogs/mcvmath.cxx @@ -271,21 +271,4 @@ void ImpCartToPolar( const short x, const short y, Fix& rRad, sal_uInt16& rPhi ) } } -/************************************************************************** -|* -|* 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..8b8e9c67be12 100644 --- a/svtools/source/dialogs/mcvmath.hxx +++ b/svtools/source/dialogs/mcvmath.hxx @@ -220,8 +220,6 @@ 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 ); 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..3409652cf309 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 // ====================================================================== -- cgit v1.2.3 From 27c6b816bc6d4c3191f31a9d0fab3467fcb0a53a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 10 Jul 2011 01:04:01 +0100 Subject: remove unused and archaic ImpCartToPolar --- svtools/source/dialogs/mcvmath.cxx | 25 ------------------------- svtools/source/dialogs/mcvmath.hxx | 1 - 2 files changed, 26 deletions(-) (limited to 'svtools') diff --git a/svtools/source/dialogs/mcvmath.cxx b/svtools/source/dialogs/mcvmath.cxx index 0d2407493c53..c9ad99e404f6 100644 --- a/svtools/source/dialogs/mcvmath.cxx +++ b/svtools/source/dialogs/mcvmath.cxx @@ -246,29 +246,4 @@ sal_uInt16 ImpATan2( const short x, const short y ) 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); - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/mcvmath.hxx b/svtools/source/dialogs/mcvmath.hxx index 8b8e9c67be12..b2fa51d356cc 100644 --- a/svtools/source/dialogs/mcvmath.hxx +++ b/svtools/source/dialogs/mcvmath.hxx @@ -219,7 +219,6 @@ 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 ); sal_uInt16 ImpSqrt( sal_uLong nRadi ); sal_uInt16 ImpATan2( const short x, const short y ); FixCpx ImpExPI( sal_uInt16 nPhi ); -- cgit v1.2.3 From d7f18c8f6004d11ac7ee39b43b0c526cba120cc4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 10 Jul 2011 01:12:33 +0100 Subject: callcatcher: unused GetSchnittBit --- svtools/source/filter/sgvtext.cxx | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'svtools') diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx index 3409652cf309..ed83389d8fee 100644 --- a/svtools/source/filter/sgvtext.cxx +++ b/svtools/source/filter/sgvtext.cxx @@ -288,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; -- cgit v1.2.3 From 583166b5193ecb1cfaa24ab5f2780ed2eff91191 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 10 Jul 2011 01:43:53 +0100 Subject: callcatcher: remove this unused ImpMultBig2 variant --- svtools/source/dialogs/mcvmath.cxx | 17 ----------------- svtools/source/dialogs/mcvmath.hxx | 5 ----- 2 files changed, 22 deletions(-) (limited to 'svtools') diff --git a/svtools/source/dialogs/mcvmath.cxx b/svtools/source/dialogs/mcvmath.cxx index c9ad99e404f6..5b14cb1fcbf7 100644 --- a/svtools/source/dialogs/mcvmath.cxx +++ b/svtools/source/dialogs/mcvmath.cxx @@ -69,23 +69,6 @@ Fix ImpMultBig2( const Fix& a, const Fix& b ) return f; } -/************************************************************************** -|* -|* 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() diff --git a/svtools/source/dialogs/mcvmath.hxx b/svtools/source/dialogs/mcvmath.hxx index b2fa51d356cc..9d36b2665793 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,7 +213,6 @@ 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 ); sal_uInt16 ImpSqrt( sal_uLong nRadi ); sal_uInt16 ImpATan2( const short x, const short y ); -- cgit v1.2.3 From ae0e8ff40caefa3f1667645ddbba30a2551a4283 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 10 Jul 2011 21:43:54 +0100 Subject: callcatcher: unused ImpATan2 --- svtools/source/dialogs/mcvmath.cxx | 22 ---------------------- svtools/source/dialogs/mcvmath.hxx | 1 - 2 files changed, 23 deletions(-) (limited to 'svtools') diff --git a/svtools/source/dialogs/mcvmath.cxx b/svtools/source/dialogs/mcvmath.cxx index 5b14cb1fcbf7..4dcfbd519aa8 100644 --- a/svtools/source/dialogs/mcvmath.cxx +++ b/svtools/source/dialogs/mcvmath.cxx @@ -207,26 +207,4 @@ static sal_uInt16 ImpATanx2( const Fix& rX, const Fix& rY ) 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 ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/dialogs/mcvmath.hxx b/svtools/source/dialogs/mcvmath.hxx index 9d36b2665793..c3e2005352ab 100644 --- a/svtools/source/dialogs/mcvmath.hxx +++ b/svtools/source/dialogs/mcvmath.hxx @@ -215,7 +215,6 @@ inline FixCpx operator/ ( const FixCpx& a, const FixCpx& b ) Fix ImpMultBig2( const Fix& a, const Fix& b ); sal_uInt16 ImpSqrt( sal_uLong nRadi ); -sal_uInt16 ImpATan2( const short x, const short y ); FixCpx ImpExPI( sal_uInt16 nPhi ); #endif // _MCVMATH_HXX -- cgit v1.2.3 From 0e4a38bb6eff9db60caa30af5cc96bcc2bb76a54 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 10 Jul 2011 21:51:12 +0100 Subject: callcatcher: unused FieldToMapUnit --- svtools/inc/svtools/unitconv.hxx | 1 - svtools/source/misc/unitconv.cxx | 7 ------- 2 files changed, 8 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/unitconv.hxx b/svtools/inc/svtools/unitconv.hxx index 51aa3aa61f30..03865882772c 100644 --- a/svtools/inc/svtools/unitconv.hxx +++ b/svtools/inc/svtools/unitconv.hxx @@ -51,7 +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 ); diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx index 17adaeaecd81..ab51323abbfb 100644 --- a/svtools/source/misc/unitconv.cxx +++ b/svtools/source/misc/unitconv.cxx @@ -293,13 +293,6 @@ FieldUnit MapToFieldUnit( const SfxMapUnit eUnit ) // ----------------------------------------------------------------------- -MapUnit FieldToMapUnit( const SfxFieldUnit /*eUnit*/ ) -{ - return MAP_APPFONT; -} - -// ----------------------------------------------------------------------- - long ConvertValueToMap( long nVal, SfxMapUnit eUnit ) { long nNew = nVal; -- cgit v1.2.3 From e6a9ee2d30f08958b82320659c31011efc84fc03 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 10 Jul 2011 21:52:25 +0100 Subject: callcatcher: unused methods --- svtools/inc/svtools/unitconv.hxx | 3 --- svtools/source/misc/unitconv.cxx | 51 ---------------------------------------- 2 files changed, 54 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/unitconv.hxx b/svtools/inc/svtools/unitconv.hxx index 03865882772c..d50c89dc7c19 100644 --- a/svtools/inc/svtools/unitconv.hxx +++ b/svtools/inc/svtools/unitconv.hxx @@ -52,9 +52,6 @@ SVT_DLLPUBLIC long ControlToItem( long nIn, SfxFieldUnit eCtrl, SfxMapUnit SVT_DLLPUBLIC FieldUnit MapToFieldUnit( const SfxMapUnit 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/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx index ab51323abbfb..189c7e24e4bb 100644 --- a/svtools/source/misc/unitconv.cxx +++ b/svtools/source/misc/unitconv.cxx @@ -293,57 +293,6 @@ FieldUnit MapToFieldUnit( const SfxMapUnit eUnit ) // ----------------------------------------------------------------------- -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 || -- cgit v1.2.3 From 3a9ef1a02ddab91c209093b4289ed68d9816e3c5 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 10 Jul 2011 22:45:34 +0100 Subject: compiler can now detect additional unused function --- svtools/source/dialogs/mcvmath.cxx | 78 -------------------------------------- 1 file changed, 78 deletions(-) (limited to 'svtools') diff --git a/svtools/source/dialogs/mcvmath.cxx b/svtools/source/dialogs/mcvmath.cxx index 4dcfbd519aa8..f34737b8a4f0 100644 --- a/svtools/source/dialogs/mcvmath.cxx +++ b/svtools/source/dialogs/mcvmath.cxx @@ -129,82 +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< 11 ) - Small=sal_True; - } - } - } - - return phi0+phi; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3 From 013fa91412f8687a6416dde97c5e963131a0014c Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 11 Jul 2011 21:07:06 +0200 Subject: Remove unused RTFOutFuncs::Out_Fontname --- svtools/source/svrtf/rtfout.cxx | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'svtools') diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx index d17148bd291a..065fc6ba5572 100644 --- a/svtools/source/svrtf/rtfout.cxx +++ b/svtools/source/svrtf/rtfout.cxx @@ -180,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"; -- cgit v1.2.3 From 554981b2d3248bca522559f72cac06ff8dda9318 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Mon, 11 Jul 2011 15:19:37 +0200 Subject: callcatcher: remove unused IMapObject::GetLogPoint --- svtools/inc/svtools/imapobj.hxx | 1 - svtools/source/misc/imap.cxx | 12 ------------ 2 files changed, 13 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/imapobj.hxx b/svtools/inc/svtools/imapobj.hxx index 88362d118ff6..a02b38f24b06 100644 --- a/svtools/inc/svtools/imapobj.hxx +++ b/svtools/inc/svtools/imapobj.hxx @@ -131,7 +131,6 @@ public: 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 ); diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index 9cfa72b76ade..caf84527c800 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -175,18 +175,6 @@ Point IMapObject::GetPixelPoint( const Point& rLogPoint ) } -/****************************************************************************** -|* -|* Konvertierung der logischen Koordianten in Pixel -|* -\******************************************************************************/ - -Point IMapObject::GetLogPoint( const Point& rPixelPoint ) -{ - return Application::GetDefaultDevice()->PixelToLogic( rPixelPoint, MapMode( MAP_100TH_MM ) ); -} - - /****************************************************************************** |* |* -- cgit v1.2.3 From c0ca459ed01dcca4531be11c366b8d66f20982a9 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Mon, 11 Jul 2011 15:20:21 +0200 Subject: callcatcher: remove unused IMapObject::GetPixelPoint --- svtools/inc/svtools/imapobj.hxx | 2 -- svtools/source/misc/imap.cxx | 12 ------------ 2 files changed, 14 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/imapobj.hxx b/svtools/inc/svtools/imapobj.hxx index a02b38f24b06..f97850c061de 100644 --- a/svtools/inc/svtools/imapobj.hxx +++ b/svtools/inc/svtools/imapobj.hxx @@ -130,8 +130,6 @@ public: sal_Bool IsActive() const { return bActive; } void SetActive( sal_Bool bSetActive = sal_True ) { bActive = bSetActive; } - static Point GetPixelPoint( const Point& rLogPoint ); - sal_Bool IsEqual( const IMapObject& rEqObj ); // IMap-Events diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index caf84527c800..cf0615198109 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -163,18 +163,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 ) ); -} - - /****************************************************************************** |* |* -- cgit v1.2.3 From 22f299b12e1c874a43b38f7efdda0d1b952d09a0 Mon Sep 17 00:00:00 2001 From: Matus Kukan Date: Sun, 3 Jul 2011 17:43:02 +0200 Subject: Remove component_getImplementationEnvironment methods --- canvas/source/cairo/exports.dxp | 1 - canvas/source/directx/exports.dxp | 1 - canvas/source/factory/cf_service.cxx | 6 ------ canvas/source/null/exports.dxp | 1 - canvas/source/simplecanvas/exports.dxp | 3 +-- canvas/source/vcl/exports.dxp | 3 +-- comphelper/inc/comphelper/componentmodule.hxx | 5 ----- comphelper/inc/comphelper/servicedecl.hxx | 6 ------ cppcanvas/source/uno/exports.dxp | 1 - cppcanvas/source/uno/exports.map | 1 - dtrans/source/cnttype/exports.dxp | 1 - dtrans/source/cnttype/mctfentry.cxx | 15 --------------- dtrans/source/generic/dtrans.cxx | 8 -------- dtrans/source/generic/exports.dxp | 1 - dtrans/source/win32/clipb/exports.dxp | 2 -- dtrans/source/win32/clipb/wcbentry.cxx | 15 --------------- dtrans/source/win32/dnd/dndentry.cxx | 10 ---------- dtrans/source/win32/dnd/exports.dxp | 1 - dtrans/source/win32/ftransl/exports.dxp | 1 - dtrans/source/win32/ftransl/ftranslentry.cxx | 15 --------------- dtrans/util/exports.dxp | 1 - i18npool/source/registerservices/registerservices.cxx | 5 ----- i18npool/source/search/textsearch.cxx | 6 ------ sax/source/expatwrap/sax_expat.cxx | 6 ------ sax/source/fastparser/facreg.cxx | 6 ------ sax/test/sax/exports.dxp | 3 +-- sax/test/sax/testsax.cxx | 8 -------- sot/source/unoolestorage/register.cxx | 5 ----- svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx | 7 ------- svl/source/fsstor/fsfactory.cxx | 6 ------ svl/source/passwordcontainer/passwordcontainer.cxx | 6 ------ svl/source/uno/registerservices.cxx | 6 ------ svtools/source/hatchwindow/hatchwindowfactory.cxx | 6 ------ .../source/productregistration/productregistration.cxx | 6 ------ svtools/source/uno/miscservices.cxx | 6 ------ toolkit/source/helper/registerservices.cxx | 5 ----- ucbhelper/workben/myucp/myucp_services.cxx | 7 ------- unotools/source/ucbhelper/xtempfile.cxx | 8 -------- vcl/source/components/factory.cxx | 7 ------- 39 files changed, 3 insertions(+), 204 deletions(-) (limited to 'svtools') diff --git a/canvas/source/cairo/exports.dxp b/canvas/source/cairo/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/canvas/source/cairo/exports.dxp +++ b/canvas/source/cairo/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/canvas/source/directx/exports.dxp b/canvas/source/directx/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/canvas/source/directx/exports.dxp +++ b/canvas/source/directx/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index e96f31f5ba7a..316c4b7aecff 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -527,12 +527,6 @@ const ::cppu::ImplementationEntry s_entries [] = { 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_Char const * pImplName, lang::XMultiServiceFactory * pServiceManager, diff --git a/canvas/source/null/exports.dxp b/canvas/source/null/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/canvas/source/null/exports.dxp +++ b/canvas/source/null/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/canvas/source/simplecanvas/exports.dxp b/canvas/source/simplecanvas/exports.dxp index 0cb5620a1603..70033078921a 100644 --- a/canvas/source/simplecanvas/exports.dxp +++ b/canvas/source/simplecanvas/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment -component_getFactory \ No newline at end of file +component_getFactory diff --git a/canvas/source/vcl/exports.dxp b/canvas/source/vcl/exports.dxp index 0cb5620a1603..70033078921a 100644 --- a/canvas/source/vcl/exports.dxp +++ b/canvas/source/vcl/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment -component_getFactory \ No newline at end of file +component_getFactory diff --git a/comphelper/inc/comphelper/componentmodule.hxx b/comphelper/inc/comphelper/componentmodule.hxx index 4bc917ef13d3..198d6c37bb20 100644 --- a/comphelper/inc/comphelper/componentmodule.hxx +++ b/comphelper/inc/comphelper/componentmodule.hxx @@ -355,11 +355,6 @@ namespace comphelper //= implementing the API of a component library (component_*) #define IMPLEMENT_COMPONENT_LIBRARY_API( module_class, initializer_function ) \ - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( \ - const sal_Char **ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) \ - { \ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; \ - } \ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( \ const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) \ { \ diff --git a/comphelper/inc/comphelper/servicedecl.hxx b/comphelper/inc/comphelper/servicedecl.hxx index b025cc7ffdce..c5ab4b79f5f7 100644 --- a/comphelper/inc/comphelper/servicedecl.hxx +++ b/comphelper/inc/comphelper/servicedecl.hxx @@ -387,12 +387,6 @@ BOOST_PP_REPEAT_FROM_TO(1, COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS, #define COMPHELPER_SERVICEDECL_make_exports(varargs_ ) \ 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_Char const* pImplName, \ ::com::sun::star::lang::XMultiServiceFactory* pServiceManager, \ ::com::sun::star::registry::XRegistryKey* pRegistryKey ) \ diff --git a/cppcanvas/source/uno/exports.dxp b/cppcanvas/source/uno/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/cppcanvas/source/uno/exports.dxp +++ b/cppcanvas/source/uno/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/cppcanvas/source/uno/exports.map b/cppcanvas/source/uno/exports.map index a488d5d06a43..f1ded4b70d9a 100644 --- a/cppcanvas/source/uno/exports.map +++ b/cppcanvas/source/uno/exports.map @@ -1,7 +1,6 @@ UDK_3_0_0 { global: _ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions - component_getImplementationEnvironment; component_getFactory; local: *; diff --git a/dtrans/source/cnttype/exports.dxp b/dtrans/source/cnttype/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/dtrans/source/cnttype/exports.dxp +++ b/dtrans/source/cnttype/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/dtrans/source/cnttype/mctfentry.cxx b/dtrans/source/cnttype/mctfentry.cxx index 5a4df1c21798..6b09a8e69ce6 100644 --- a/dtrans/source/cnttype/mctfentry.cxx +++ b/dtrans/source/cnttype/mctfentry.cxx @@ -83,23 +83,8 @@ namespace } } -//----------------------------------------------------------------------------------------------------------- -// the 3 important functions which will be exported -//----------------------------------------------------------------------------------------------------------- - extern "C" { - -//---------------------------------------------------------------------- -// component_getImplementationEnvironment -//---------------------------------------------------------------------- - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - //---------------------------------------------------------------------- // component_getFactory // returns a factory to create XFilePicker-Services diff --git a/dtrans/source/generic/dtrans.cxx b/dtrans/source/generic/dtrans.cxx index 7a47d12920a6..c9295644ea80 100644 --- a/dtrans/source/generic/dtrans.cxx +++ b/dtrans/source/generic/dtrans.cxx @@ -46,14 +46,6 @@ 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( const sal_Char * pImplName, void * pServiceManager, diff --git a/dtrans/source/generic/exports.dxp b/dtrans/source/generic/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/dtrans/source/generic/exports.dxp +++ b/dtrans/source/generic/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/dtrans/source/win32/clipb/exports.dxp b/dtrans/source/win32/clipb/exports.dxp index 926e49f5f1a5..70033078921a 100644 --- a/dtrans/source/win32/clipb/exports.dxp +++ b/dtrans/source/win32/clipb/exports.dxp @@ -1,3 +1 @@ -component_getImplementationEnvironment component_getFactory - diff --git a/dtrans/source/win32/clipb/wcbentry.cxx b/dtrans/source/win32/clipb/wcbentry.cxx index cd0de3ebf9ff..5c61e6c3557f 100644 --- a/dtrans/source/win32/clipb/wcbentry.cxx +++ b/dtrans/source/win32/clipb/wcbentry.cxx @@ -81,23 +81,8 @@ namespace } } -//----------------------------------------------------------------------------------------------------------- -// the 3 important functions which will be exported -//----------------------------------------------------------------------------------------------------------- - extern "C" { - -//---------------------------------------------------------------------- -// component_getImplementationEnvironment -//---------------------------------------------------------------------- - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - //---------------------------------------------------------------------- // component_getFactory // returns a factory to create XFilePicker-Services diff --git a/dtrans/source/win32/dnd/dndentry.cxx b/dtrans/source/win32/dnd/dndentry.cxx index b089f95b6472..e7b56fcc5cf7 100644 --- a/dtrans/source/win32/dnd/dndentry.cxx +++ b/dtrans/source/win32/dnd/dndentry.cxx @@ -63,16 +63,6 @@ sal_Bool SAL_CALL component_canUnload( TimeValue *pTime ) return g_moduleCount.canUnload( &g_moduleCount , pTime ); } -//---------------------------------------------------------------------- -// component_getImplementationEnvironment -//---------------------------------------------------------------------- - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - //---------------------------------------------------------------------- // component_getFactory // returns a factory to create XFilePicker-Services diff --git a/dtrans/source/win32/dnd/exports.dxp b/dtrans/source/win32/dnd/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/dtrans/source/win32/dnd/exports.dxp +++ b/dtrans/source/win32/dnd/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/dtrans/source/win32/ftransl/exports.dxp b/dtrans/source/win32/ftransl/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/dtrans/source/win32/ftransl/exports.dxp +++ b/dtrans/source/win32/ftransl/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/dtrans/source/win32/ftransl/ftranslentry.cxx b/dtrans/source/win32/ftransl/ftranslentry.cxx index fb0655ead9cd..e519b5361102 100644 --- a/dtrans/source/win32/ftransl/ftranslentry.cxx +++ b/dtrans/source/win32/ftransl/ftranslentry.cxx @@ -84,23 +84,8 @@ namespace } } -//----------------------------------------------------------------------------------------------------------- -// the 3 important functions which will be exported -//----------------------------------------------------------------------------------------------------------- - extern "C" { - -//---------------------------------------------------------------------- -// component_getImplementationEnvironment -//---------------------------------------------------------------------- - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - //---------------------------------------------------------------------- // component_getFactory // returns a factory to create XFilePicker-Services diff --git a/dtrans/util/exports.dxp b/dtrans/util/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/dtrans/util/exports.dxp +++ b/dtrans/util/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index fd08933af2fa..5df7bb931b7c 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -576,11 +576,6 @@ static const struct InstancesArray { 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( const sal_Char* sImplementationName, void* _pServiceManager, void* /*_pRegistryKey*/ ) { void* pRet = NULL; diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 756d6c863ff9..f407a614ed1f 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -982,12 +982,6 @@ SAL_CALL TextSearch_CreateInstance( 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( const sal_Char* sImplementationName, void* _pServiceManager, void* /*_pRegistryKey*/ ) { diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 06258510ceca..34df91a83a26 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -1029,12 +1029,6 @@ using namespace sax_expatwrap; 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( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { diff --git a/sax/source/fastparser/facreg.cxx b/sax/source/fastparser/facreg.cxx index e4152cfc1b58..8352b0cf4824 100644 --- a/sax/source/fastparser/facreg.cxx +++ b/sax/source/fastparser/facreg.cxx @@ -35,12 +35,6 @@ Reference< XInterface > SAL_CALL FastSaxSerializer_CreateInstance( const Referen 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( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; diff --git a/sax/test/sax/exports.dxp b/sax/test/sax/exports.dxp index ce95ae0f8deb..86214860d555 100644 --- a/sax/test/sax/exports.dxp +++ b/sax/test/sax/exports.dxp @@ -1,3 +1,2 @@ -component_getImplementationEnvironment component_getFactory -component_writeInfo \ No newline at end of file +component_writeInfo diff --git a/sax/test/sax/testsax.cxx b/sax/test/sax/testsax.cxx index db58f193088f..aad3b9ed5f7c 100644 --- a/sax/test/sax/testsax.cxx +++ b/sax/test/sax/testsax.cxx @@ -786,14 +786,6 @@ using namespace sax_test; extern "C" { - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - - sal_Bool SAL_CALL component_writeInfo( void * pServiceManager, void * pRegistryKey ) { diff --git a/sot/source/unoolestorage/register.cxx b/sot/source/unoolestorage/register.cxx index 30f417b29625..2738a8054af3 100644 --- a/sot/source/unoolestorage/register.cxx +++ b/sot/source/unoolestorage/register.cxx @@ -41,11 +41,6 @@ using namespace ::com::sun::star; extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL sot_component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void * SAL_CALL sot_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; diff --git a/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx index 3172fd9322d6..a287fa499886 100644 --- a/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx +++ b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx @@ -221,13 +221,6 @@ static ::cppu::ImplementationEntry const lRegEntries[] = { 0, 0, 0, 0, 0, 0 } }; -//============================================================================= -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const char** pEnvTypeName, - uno_Environment** ) -{ - *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - //============================================================================= extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const char* sImplName , void* pServiceManager, diff --git a/svl/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx index db6fc301a0d0..61a8f7f15048 100644 --- a/svl/source/fsstor/fsfactory.cxx +++ b/svl/source/fsstor/fsfactory.cxx @@ -235,12 +235,6 @@ uno::Sequence< ::rtl::OUString > SAL_CALL FSStorageFactory::getSupportedServiceN extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL fsstorage_component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void * SAL_CALL fsstorage_component_getFactory ( const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) { diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index d584a1c77725..86c72fb3619b 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -1538,12 +1538,6 @@ MasterPasswordRequest_Impl::MasterPasswordRequest_Impl( PasswordRequestMode Mode extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL passwordcontainer_component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void * SAL_CALL passwordcontainer_component_getFactory ( const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) { diff --git a/svl/source/uno/registerservices.cxx b/svl/source/uno/registerservices.cxx index 3fa8b0e7ebef..d001c73da633 100644 --- a/svl/source/uno/registerservices.cxx +++ b/svl/source/uno/registerservices.cxx @@ -55,12 +55,6 @@ DECLARE_CREATEINSTANCE( PathService ) extern "C" { -SVL_DLLPUBLIC void SAL_CALL svl_component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SVL_DLLPUBLIC void* SAL_CALL svl_component_getFactory ( const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey*/) { diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx index 13f78b3e353b..93401d8f8f43 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.cxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx @@ -109,12 +109,6 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OHatchWindowFactory::getSupportedServi extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL hatchwindowfactory_component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void * SAL_CALL hatchwindowfactory_component_getFactory ( const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) { diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx index ebedda0ad071..a3312c107a52 100644 --- a/svtools/source/productregistration/productregistration.cxx +++ b/svtools/source/productregistration/productregistration.cxx @@ -453,12 +453,6 @@ namespace svt extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL productregistration_component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void * SAL_CALL productregistration_component_getFactory ( const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) { diff --git a/svtools/source/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index 1b20ef518683..e49672bbac52 100644 --- a/svtools/source/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -96,12 +96,6 @@ DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicRendererVCL ) extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL svt_component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory ( const sal_Char * pImplementationName, void * _pServiceManager, void * pRegistryKey) { diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx index 6e11e72970be..3a532b83de14 100644 --- a/toolkit/source/helper/registerservices.cxx +++ b/toolkit/source/helper/registerservices.cxx @@ -236,11 +236,6 @@ extern void * SAL_CALL comp_Layout_component_getFactory( const char * implName, extern "C" { -TOOLKIT_DLLPUBLIC void SAL_CALL tk_component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - TOOLKIT_DLLPUBLIC void* SAL_CALL tk_component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey ) { void* pRet = NULL; diff --git a/ucbhelper/workben/myucp/myucp_services.cxx b/ucbhelper/workben/myucp/myucp_services.cxx index 6551ca755a12..c455addd1a22 100644 --- a/ucbhelper/workben/myucp/myucp_services.cxx +++ b/ucbhelper/workben/myucp/myucp_services.cxx @@ -80,13 +80,6 @@ sal_Bool writeInfo( void * pRegistryKey, } -//========================================================================= -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - //========================================================================= extern "C" sal_Bool SAL_CALL component_writeInfo( void * /*pServiceManager*/, void * pRegistryKey ) diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx index d73981670d5d..bf4a88112929 100644 --- a/unotools/source/ucbhelper/xtempfile.cxx +++ b/unotools/source/ucbhelper/xtempfile.cxx @@ -484,14 +484,6 @@ throw ( ::css::uno::RuntimeException ) return ::cppu::createSingleComponentFactory( XTempFile_createInstance, getImplementationName_Static(), getSupportedServiceNames_Static() ); } -// C functions to implement this as a component - -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL utl_component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - /** * This function is called to get service factories for an implementation. * @param pImplName name of implementation diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index de76b6e84c58..9701e83e886a 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -83,13 +83,6 @@ namespace rsvg extern "C" { - VCL_DLLPUBLIC void SAL_CALL vcl_component_getImplementationEnvironment( - const sal_Char** ppEnvTypeName, - uno_Environment** /*ppEnv*/ ) - { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - VCL_DLLPUBLIC void* SAL_CALL vcl_component_getFactory( const sal_Char* pImplementationName, void* pXUnoSMgr, -- cgit v1.2.3 From 51764de67355e629a3cfdaabd4cbb486586931f1 Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Tue, 12 Jul 2011 20:06:36 -0700 Subject: Replace List with std::vector< IMapObject* > I also removed some unused methods. --- svtools/inc/svtools/imap.hxx | 28 +++++++------ svtools/source/misc/imap.cxx | 91 ++++++++++++++++++++----------------------- svtools/source/misc/imap2.cxx | 26 ++++++------- 3 files changed, 71 insertions(+), 74 deletions(-) (limited to 'svtools') 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 #include +#include 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/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index cf0615198109..39bb9f83bd87 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -719,8 +719,8 @@ sal_Bool IMapPolygonObject::IsEqual( const IMapPolygonObject& rEqObj ) |* \******************************************************************************/ -ImageMap::ImageMap( const String& rName ) : - aName ( rName ) +ImageMap::ImageMap( const String& rName ) +: aName( rName ) { } @@ -735,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: @@ -786,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(); } @@ -808,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: @@ -849,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() ) @@ -938,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: @@ -981,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 ); @@ -1003,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; } @@ -1020,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() ) { @@ -1056,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 ); } } @@ -1072,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; @@ -1088,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; @@ -1096,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; @@ -1104,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 b9231a50c2d3..359615a1b2c2 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -169,11 +169,11 @@ 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() ) { @@ -198,13 +198,13 @@ 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 ); @@ -290,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" ) ) { @@ -299,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" ) ) { @@ -313,7 +313,7 @@ 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 ); } } } @@ -433,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" ) { @@ -444,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" ) { @@ -456,7 +456,7 @@ 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 ); } } } -- cgit v1.2.3 From 832fa247b71184f23eb6f3f88d7347af135c225a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 12 Jul 2011 21:16:08 +0100 Subject: callcatcher: unused methods --- svtools/source/contnr/fileview.cxx | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'svtools') 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 ); -- cgit v1.2.3 From 66803f4a1fd5e4987cfa9abe32972fdb6515c5ec Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Wed, 13 Jul 2011 06:58:16 -0700 Subject: Replace List with std::vector< Window* > I also removed the unused Dummy class members. --- svtools/inc/svtools/taskbar.hxx | 41 +++++++++++++++++----------- svtools/source/control/taskmisc.cxx | 53 +++++++++++++++---------------------- 2 files changed, 47 insertions(+), 47 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/taskbar.hxx b/svtools/inc/svtools/taskbar.hxx index 4fb126e5eefe..36b625eca650 100644 --- a/svtools/inc/svtools/taskbar.hxx +++ b/svtools/inc/svtools/taskbar.hxx @@ -440,30 +440,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/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 ) -- cgit v1.2.3 From ce0ecd94dc4066024d8f8a0c4f7b681e1765cced Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Wed, 13 Jul 2011 07:26:24 -0700 Subject: Whitespace cleanup --- svtools/inc/svtools/grfmgr.hxx | 418 +++++++++++++++++++++++++++-------------- 1 file changed, 277 insertions(+), 141 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/grfmgr.hxx b/svtools/inc/svtools/grfmgr.hxx index 0395a9d5afe5..d48d82851851 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; @@ -412,24 +456,32 @@ public: 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 @@ -464,20 +516,32 @@ 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 ); }; // ------------------ @@ -491,84 +555,156 @@ 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 ); + 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 + ); // 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.Count() > 0UL ); } // 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 -- cgit v1.2.3 From 3e7cc992732fa58271db42ce3c82dc6a07c33223 Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Wed, 13 Jul 2011 19:59:10 -0700 Subject: Replace List with std::vector< GraphicObject* > --- svtools/inc/svtools/grfmgr.hxx | 8 +++++--- svtools/source/graphic/grfmgr2.cxx | 14 ++++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/grfmgr.hxx b/svtools/inc/svtools/grfmgr.hxx index d48d82851851..f7560058c458 100644 --- a/svtools/inc/svtools/grfmgr.hxx +++ b/svtools/inc/svtools/grfmgr.hxx @@ -548,6 +548,8 @@ public: // - GraphicManager - // ------------------ +typedef ::std::vector< GraphicObject* > GraphicObjectList_impl; + class SVT_DLLPUBLIC GraphicManager { friend class GraphicObject; @@ -555,8 +557,8 @@ class SVT_DLLPUBLIC GraphicManager private: - List maObjList; - GraphicCache* mpCache; + GraphicObjectList_impl maObjList; + GraphicCache* mpCache; GraphicManager( const GraphicManager& ) {} GraphicManager& operator=( const GraphicManager& ) { return *this; } @@ -652,7 +654,7 @@ private: const GraphicObject* pCopyObj = NULL ); void SVT_DLLPRIVATE ImplUnregisterObj( const GraphicObject& rObj ); - inline sal_Bool SVT_DLLPRIVATE ImplHasObjects() const { return( maObjList.Count() > 0UL ); } + inline sal_Bool SVT_DLLPRIVATE ImplHasObjects() const { return !maObjList.empty(); } // Only used in swap case by GraphicObject void SVT_DLLPRIVATE ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj ); diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index fbd00913607b..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; + } + } } // ----------------------------------------------------------------------------- -- cgit v1.2.3 From 114508f9d89a361c47d1fbdeef1bc786a08fb11c Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Wed, 13 Jul 2011 21:13:00 -0700 Subject: Replace List with std::vector< GraphicObject* > I also replaced sal_Bool with bool. It's a private class so this is safe; only salBool GraphicCache::FillSwappedGraphicObject() leaks to bool to the world. --- svtools/source/graphic/grfcache.cxx | 87 +++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 42 deletions(-) (limited to 'svtools') diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index 47de44d7695c..4251c1ba7fe2 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,21 +318,24 @@ 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 ) + bool bRet = false; + + for( + GraphicObjectList_impl::iterator it = maGraphicObjectList.begin(); + ( it < maGraphicObjectList.end() ) && !bRet; + ++it + ) { + if( &rObj == *it ) { - maGraphicObjectList.Remove( pObj ); - bRet = sal_True; + maGraphicObjectList.erase( it ); + bRet = true; } } @@ -339,13 +344,13 @@ sal_Bool GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject& // ----------------------------------------------------------------------------- -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,19 +359,19 @@ 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 ) { @@ -378,17 +383,15 @@ void GraphicCacheEntry::GraphicObjectWasSwappedOut( const GraphicObject& /*rObj* // ----------------------------------------------------------------------------- -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 +679,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 ) { -- cgit v1.2.3 From 91ef8382196e2664678bfb96513261eb0303d375 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 13:07:19 +0200 Subject: callcatcher: remove unused TabBar::Foo --- svtools/inc/svtools/tabbar.hxx | 12 --- svtools/source/control/tabbar.cxx | 167 -------------------------------------- 2 files changed, 179 deletions(-) (limited to 'svtools') 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/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(sal::static_int_cast(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) ) -- cgit v1.2.3 From 55de765205359cb0c268a6b2c027e9839102ca04 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 13:15:48 +0200 Subject: callcatcher: remove unused TaskBar::Foo --- svtools/inc/svtools/taskbar.hxx | 5 --- svtools/source/control/taskbar.cxx | 64 -------------------------------------- 2 files changed, 69 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/taskbar.hxx b/svtools/inc/svtools/taskbar.hxx index 36b625eca650..dc6e15a530d4 100644 --- a/svtools/inc/svtools/taskbar.hxx +++ b/svtools/inc/svtools/taskbar.hxx @@ -403,14 +403,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; } 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(); -- cgit v1.2.3 From 8d7b1fba417503130f197c007b24e7c4d8f20329 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 13:20:25 +0200 Subject: callcatcher: remove unused TaskStatusBar::Foo --- svtools/inc/svtools/taskbar.hxx | 11 +---- svtools/source/control/taskstat.cxx | 86 ------------------------------------- 2 files changed, 1 insertion(+), 96 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/taskbar.hxx b/svtools/inc/svtools/taskbar.hxx index dc6e15a530d4..97c69b451e92 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 @@ -331,16 +329,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; }; // ----------- diff --git a/svtools/source/control/taskstat.cxx b/svtools/source/control/taskstat.cxx index b94aae25a88f..56c3071462fd 100644 --- a/svtools/source/control/taskstat.cxx +++ b/svtools/source/control/taskstat.cxx @@ -563,90 +563,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: */ -- cgit v1.2.3 From 36b7696fbc4339a94185b3a33c62f1f49df25129 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 13:22:37 +0200 Subject: callcatcher: remove unused TaskStatusFieldItem::TaskStatusFieldItem --- svtools/inc/svtools/taskbar.hxx | 5 ----- svtools/source/control/taskstat.cxx | 15 --------------- 2 files changed, 20 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/taskbar.hxx b/svtools/inc/svtools/taskbar.hxx index 97c69b451e92..c29fe770f757 100644 --- a/svtools/inc/svtools/taskbar.hxx +++ b/svtools/inc/svtools/taskbar.hxx @@ -251,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; } diff --git a/svtools/source/control/taskstat.cxx b/svtools/source/control/taskstat.cxx index 56c3071462fd..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() { } -- cgit v1.2.3 From e19c00ed76f5d46c3b88d2721b9ac84fcaaed97c Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 13:30:48 +0200 Subject: callcatcher: remove unused TextAttrib stuff --- svtools/inc/svtools/txtattr.hxx | 4 ---- svtools/source/edit/txtattr.cxx | 21 --------------------- 2 files changed, 25 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/txtattr.hxx b/svtools/inc/svtools/txtattr.hxx index 982e9c20be5a..2b6028965475 100644 --- a/svtools/inc/svtools/txtattr.hxx +++ b/svtools/inc/svtools/txtattr.hxx @@ -61,8 +61,6 @@ public: 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 +112,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/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 ) { -- cgit v1.2.3 From a434c5236f4e50f2569043a75295f422e45051c9 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 13:37:20 +0200 Subject: Remove EDITDEBUG --- svtools/source/edit/textdoc.cxx | 16 ---------------- svtools/source/edit/texteng.cxx | 14 -------------- 2 files changed, 30 deletions(-) (limited to 'svtools') diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx index fa7536035288..fa37e13f58c7 100644 --- a/svtools/source/edit/textdoc.cxx +++ b/svtools/source/edit/textdoc.cxx @@ -307,10 +307,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 +370,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 +452,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 +487,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/texteng.cxx b/svtools/source/edit/texteng.cxx index 15412276e587..841093908fb8 100644 --- a/svtools/source/edit/texteng.cxx +++ b/svtools/source/edit/texteng.cxx @@ -1953,9 +1953,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 +2045,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 +2235,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 !" ); -- cgit v1.2.3 From ad50fa236bccb0c201156d0a5ee55d7d31ee036d Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 13:45:29 +0200 Subject: callcatcher: remove TextCharAttribList::DbgCheckAttribs --- svtools/source/edit/textdoc.cxx | 17 ----------------- svtools/source/edit/textdoc.hxx | 4 ---- 2 files changed, 21 deletions(-) (limited to 'svtools') diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx index fa37e13f58c7..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 // ------------------------------------------------------------------------- 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 }; -- cgit v1.2.3 From 1ccbcfddd1e2493401be86328e2030cabccc3ad0 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 13:47:15 +0200 Subject: callcatcher: remove TextEngine::Foo --- svtools/inc/svtools/texteng.hxx | 3 --- svtools/source/edit/texteng.cxx | 43 ----------------------------------------- 2 files changed, 46 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/texteng.hxx b/svtools/inc/svtools/texteng.hxx index ba2c440f6d98..ea81c4806206 100644 --- a/svtools/inc/svtools/texteng.hxx +++ b/svtools/inc/svtools/texteng.hxx @@ -245,13 +245,11 @@ 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 ); sal_uInt16 GetLeftMargin() const; - void SetUpdateMode( sal_Bool bUpdate ); sal_Bool GetUpdateMode() const { return mbUpdate; } sal_uInt16 GetViewCount() const; @@ -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/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx index 841093908fb8..2b041f23be8a 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; @@ -345,43 +339,6 @@ sal_uInt16 TextEngine::GetTextLen( sal_uLong nPara ) const return mpDoc->GetNodes().GetObject( nPara )->GetText().Len(); } -void TextEngine::SetUpdateMode( sal_Bool bUpdate ) -{ - if ( bUpdate != mbUpdate ) - { - mbUpdate = bUpdate; - if ( mbUpdate ) - { - FormatAndUpdate( GetActiveView() ); - if ( GetActiveView() ) - GetActiveView()->ShowCursor(); - } - } -} - -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; -- cgit v1.2.3 From a5d227a076fddd2b1a427baaaf3ec92e3fa40943 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 13:56:26 +0200 Subject: callcatcher: remove TextUndoSetAttribs --- svtools/source/edit/textundo.cxx | 41 ---------------------------------------- 1 file changed, 41 deletions(-) (limited to 'svtools') 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: */ -- cgit v1.2.3 From e8d4b4ffa0cb615e712e4a33879ab96901c8c321 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 14:01:10 +0200 Subject: callcatcher: remove TextView::Foo --- svtools/inc/svtools/textview.hxx | 10 ---------- svtools/source/edit/textview.cxx | 36 ------------------------------------ 2 files changed, 46 deletions(-) (limited to 'svtools') 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/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 -- cgit v1.2.3 From 851cb7e311f79772a4d6623220e7442468b19163 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 14:21:43 +0200 Subject: callcatcher: remove TransferDataContainer::ClearData --- svtools/inc/svtools/transfer.hxx | 2 -- svtools/source/misc/transfer2.cxx | 9 --------- 2 files changed, 11 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/transfer.hxx b/svtools/inc/svtools/transfer.hxx index 397dccfc0fe6..26e84d0c3b12 100644 --- a/svtools/inc/svtools/transfer.hxx +++ b/svtools/inc/svtools/transfer.hxx @@ -565,8 +565,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/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 ) -- cgit v1.2.3 From 7ca22e561b9eb83dbc28427086dea06489c83290 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 14:24:29 +0200 Subject: callcatcher: remove TransferableDataHelper::GetInterface --- svtools/inc/svtools/transfer.hxx | 1 - svtools/source/misc/transfer.cxx | 9 --------- 2 files changed, 10 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/transfer.hxx b/svtools/inc/svtools/transfer.hxx index 26e84d0c3b12..0267824ff36e 100644 --- a/svtools/inc/svtools/transfer.hxx +++ b/svtools/inc/svtools/transfer.hxx @@ -398,7 +398,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: diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 2c93a1045e89..22f0c3fe0ff3 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -2214,15 +2214,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 ) ); -- cgit v1.2.3 From 571eedc0cfa067029d59c78fd19cf06683b9d771 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 14:25:48 +0200 Subject: callcatcher: remove TransferableHelper::Foo --- svtools/inc/svtools/transfer.hxx | 3 --- svtools/source/misc/transfer.cxx | 25 ------------------------- 2 files changed, 28 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/transfer.hxx b/svtools/inc/svtools/transfer.hxx index 0267824ff36e..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: diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 22f0c3fe0ff3..cbb5eedb3bb3 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -975,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() ) ); @@ -1022,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" ); -- cgit v1.2.3 From 10f28d5c9a072bf108a79f3b05ad8247ca0dcea5 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 21:46:17 +0200 Subject: callcatcher: build fixes - remove the correct SetUpdateMode() - Clone() always returns NULL - SetFont() doesn't do anything --- svtools/inc/svtools/texteng.hxx | 2 +- svtools/source/edit/textdoc.cxx | 4 ++-- svtools/source/edit/texteng.cxx | 29 +++++++++++++++-------------- 3 files changed, 18 insertions(+), 17 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/texteng.hxx b/svtools/inc/svtools/texteng.hxx index ea81c4806206..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 ); @@ -250,6 +249,7 @@ public: void SetLeftMargin( sal_uInt16 n ); sal_uInt16 GetLeftMargin() const; + void SetUpdateMode( sal_Bool bUpdate ); sal_Bool GetUpdateMode() const { return mbUpdate; } sal_uInt16 GetViewCount() const; diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx index 615ac1258f4d..4fad052dd498 100644 --- a/svtools/source/edit/textdoc.cxx +++ b/svtools/source/edit/textdoc.cxx @@ -54,14 +54,14 @@ int SAL_CALL CompareStart( const void* pFirst, const void* pSecond ) // ------------------------------------------------------------------------- TextCharAttrib::TextCharAttrib( const TextAttrib& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ) { - mpAttr = rAttr.Clone(); + mpAttr = NULL; mnStart = nStart, mnEnd = nEnd; } TextCharAttrib::TextCharAttrib( const TextCharAttrib& rTextCharAttrib ) { - mpAttr = rTextCharAttrib.GetAttr().Clone(); + mpAttr = NULL; mnStart = rTextCharAttrib.mnStart; mnEnd = rTextCharAttrib.mnEnd; } diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx index 2b041f23be8a..9decddde44f9 100644 --- a/svtools/source/edit/texteng.cxx +++ b/svtools/source/edit/texteng.cxx @@ -339,6 +339,20 @@ sal_uInt16 TextEngine::GetTextLen( sal_uLong nPara ) const return mpDoc->GetNodes().GetObject( nPara )->GetText().Len(); } +void TextEngine::SetUpdateMode( sal_Bool bUpdate ) +{ + if ( bUpdate != mbUpdate ) + { + mbUpdate = bUpdate; + if ( mbUpdate ) + { + FormatAndUpdate( GetActiveView() ); + if ( GetActiveView() ) + GetActiveView()->ShowCursor(); + } + } +} + sal_Bool TextEngine::DoesKeyChangeText( const KeyEvent& rKeyEvent ) { sal_Bool bDoesChange = sal_False; @@ -1466,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() ); @@ -1510,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 ) -- cgit v1.2.3 From 2b4d711e0f716f727b4e7b10d4ba21fa7b8e8412 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Wed, 13 Jul 2011 22:14:43 +0200 Subject: callcatcher: remove PrinterSetupDialog::GetOptionsHdl --- svtools/inc/svtools/prnsetup.hxx | 1 - svtools/source/dialogs/prnsetup.cxx | 5 ----- 2 files changed, 6 deletions(-) (limited to 'svtools') 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/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); -- cgit v1.2.3 From 364b742f3674bf5c90067ba473794042d890e325 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Thu, 14 Jul 2011 09:53:11 +0200 Subject: WaE: unused parameter --- svtools/source/edit/textdoc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svtools') diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx index 4fad052dd498..b31395dd43fa 100644 --- a/svtools/source/edit/textdoc.cxx +++ b/svtools/source/edit/textdoc.cxx @@ -52,7 +52,7 @@ int SAL_CALL CompareStart( const void* pFirst, const void* pSecond ) // ------------------------------------------------------------------------- // (+) class TextCharAttrib // ------------------------------------------------------------------------- -TextCharAttrib::TextCharAttrib( const TextAttrib& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ) +TextCharAttrib::TextCharAttrib( const TextAttrib& /* rAttr */, sal_uInt16 nStart, sal_uInt16 nEnd ) { mpAttr = NULL; mnStart = nStart, -- cgit v1.2.3 From b1e607a2ee4be0bf305c20fb5ba60bad3f0ed316 Mon Sep 17 00:00:00 2001 From: Nigel Hawkins Date: Thu, 14 Jul 2011 09:49:14 +0100 Subject: Fix "unused attribute" build error. This reverts parts of 82ea128f190dbe8d707cb140a5a2bb2b48bef58d e1309004099d1a1c0a9bc1ba6de9e5054629da3c which were a bit over-zealous at removing "unused" stuff. LGPLv3+/MPL --- svtools/inc/svtools/txtattr.hxx | 4 +++- svtools/source/edit/textdoc.cxx | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'svtools') diff --git a/svtools/inc/svtools/txtattr.hxx b/svtools/inc/svtools/txtattr.hxx index 2b6028965475..bf4c8e38b007 100644 --- a/svtools/inc/svtools/txtattr.hxx +++ b/svtools/inc/svtools/txtattr.hxx @@ -59,7 +59,9 @@ 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 diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx index b31395dd43fa..95a26d2c1ebc 100644 --- a/svtools/source/edit/textdoc.cxx +++ b/svtools/source/edit/textdoc.cxx @@ -54,14 +54,14 @@ int SAL_CALL CompareStart( const void* pFirst, const void* pSecond ) // ------------------------------------------------------------------------- TextCharAttrib::TextCharAttrib( const TextAttrib& /* rAttr */, sal_uInt16 nStart, sal_uInt16 nEnd ) { - mpAttr = NULL; + mpAttr = rAttr.Clone(); mnStart = nStart, mnEnd = nEnd; } TextCharAttrib::TextCharAttrib( const TextCharAttrib& rTextCharAttrib ) { - mpAttr = NULL; + mpAttr = rTextCharAttrib.GetAttr().Clone(); mnStart = rTextCharAttrib.mnStart; mnEnd = rTextCharAttrib.mnEnd; } -- cgit v1.2.3 From 42c4b54fe57a40cf3e49c27d7887c4e706f06451 Mon Sep 17 00:00:00 2001 From: Nigel Hawkins Date: Thu, 14 Jul 2011 10:03:12 +0100 Subject: Revert "WaE: unused parameter" This reverts commit 070016df3becc51d467fbf2e70312106d7392c89. Thomas and I both submitted different fixes at about the same time. --- svtools/source/edit/textdoc.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svtools') diff --git a/svtools/source/edit/textdoc.cxx b/svtools/source/edit/textdoc.cxx index 95a26d2c1ebc..615ac1258f4d 100644 --- a/svtools/source/edit/textdoc.cxx +++ b/svtools/source/edit/textdoc.cxx @@ -52,7 +52,7 @@ int SAL_CALL CompareStart( const void* pFirst, const void* pSecond ) // ------------------------------------------------------------------------- // (+) class TextCharAttrib // ------------------------------------------------------------------------- -TextCharAttrib::TextCharAttrib( const TextAttrib& /* rAttr */, sal_uInt16 nStart, sal_uInt16 nEnd ) +TextCharAttrib::TextCharAttrib( const TextAttrib& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ) { mpAttr = rAttr.Clone(); mnStart = nStart, -- cgit v1.2.3 From 785b4c2f48de177974bf05d215ba6fe350598952 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 13 Jul 2011 21:15:45 +0100 Subject: callcatcher: remove unused ifdef branch --- svtools/source/contnr/imivctl.hxx | 1 - svtools/source/contnr/imivctl2.cxx | 49 -------------------------------------- 2 files changed, 50 deletions(-) (limited to 'svtools') diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index 517f0f6b66f1..06d905f7a757 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -609,7 +609,6 @@ public: 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 ) { diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx index 93e2990d6658..d21ff9139a49 100644 --- a/svtools/source/contnr/imivctl2.cxx +++ b/svtools/source/contnr/imivctl2.cxx @@ -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() -- cgit v1.2.3 From d08bf1ca63e51c950ed0bc84b6f1d5232ae97f38 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 14 Jul 2011 15:25:51 +0300 Subject: Don't build these executables when cross-compiling They are not included in the SDK either. --- svtools/Module_svtools.mk | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'svtools') diff --git a/svtools/Module_svtools.mk b/svtools/Module_svtools.mk index ac2fff8623a3..7adeaf80a64c 100644 --- a/svtools/Module_svtools.mk +++ b/svtools/Module_svtools.mk @@ -30,15 +30,20 @@ $(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 \ )) -- cgit v1.2.3 From 86c53492cc40e2d43bd3dac89698b844df961e0e Mon Sep 17 00:00:00 2001 From: David Tardon Date: Fri, 15 Jul 2011 07:51:13 +0200 Subject: error: attempt to increment a singular iterator --- svtools/source/graphic/grfcache.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'svtools') diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index 4251c1ba7fe2..e0aa6595f6ac 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -325,21 +325,19 @@ void GraphicCacheEntry::AddGraphicObjectReference( const GraphicObject& rObj, Gr bool GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject& rObj ) { - bool bRet = false; - for( GraphicObjectList_impl::iterator it = maGraphicObjectList.begin(); - ( it < maGraphicObjectList.end() ) && !bRet; + it != maGraphicObjectList.end(); ++it ) { if( &rObj == *it ) { maGraphicObjectList.erase( it ); - bRet = true; + return true; } } - return bRet; + return false; } // ----------------------------------------------------------------------------- -- cgit v1.2.3 From 50f1b1ff71f603040045903ee383995d29b03e75 Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Fri, 15 Jul 2011 05:41:00 -0700 Subject: Replace List with std::vector< SvxIconChoiceCtrlEntry* > --- svtools/source/contnr/imivctl.hxx | 823 ++++++++++++++++++++----------------- svtools/source/contnr/imivctl1.cxx | 193 ++++----- svtools/source/contnr/imivctl2.cxx | 36 +- 3 files changed, 573 insertions(+), 479 deletions(-) (limited to 'svtools') diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index 06d905f7a757..ced1856eeceb 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,449 @@ 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 + 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; 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*, 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 ); 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 +620,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 +664,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,47 +676,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 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 cdb95366d560..df9b81dab0c7 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -224,13 +224,13 @@ void SvxIconChoiceCtrl_Impl::Clear( sal_Bool bInCtor ) 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 +292,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() ); pImpCursor->Clear(); -// pGridMap->Clear(); if( pPos ) { Size aSize( CalcBoundingSize( pEntry ) ); @@ -376,10 +375,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 +407,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 +434,21 @@ 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 ); if( bCurEntryPosValid ) { DBG_ASSERT(aEntries.GetObject(pEntry->nPos)==pEntry,"RemoveEntry: Wrong nPos in entry"); - aEntries.Remove( pEntry->nPos ); + 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 +543,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 +615,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 +644,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 +749,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) #endif nFlags |= F_PAINTED; - if( !aEntries.Count() ) + if( !aEntries.size() ) return; if( !pCursor ) { @@ -767,7 +766,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) } if( !bfound ) - pCursor = (SvxIconChoiceCtrlEntry*)aEntries.First(); + pCursor = aEntries[ 0 ]; } // Show Focus at Init-Time @@ -786,8 +785,8 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) pView->SetClipRegion( aOutputArea ); } - const sal_uInt16 nListInitSize = aEntries.Count() > USHRT_MAX ? - USHRT_MAX : (sal_uInt16)aEntries.Count(); + const sal_uInt16 nListInitSize = aEntries.size() > USHRT_MAX ? + USHRT_MAX : (sal_uInt16)aEntries.size(); List* pNewZOrderList = new List( nListInitSize ); List* pPaintedEntries = new List( nListInitSize ); @@ -1379,7 +1378,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 +1386,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; @@ -2345,15 +2344,15 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects() { nMaxBoundHeight = 0; pZOrderList->Clear(); - sal_uLong nCount = aEntries.Count(); - sal_uLong nCur; + 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 ); } @@ -2379,15 +2378,15 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() { nMaxBoundHeight = 0; pZOrderList->Clear(); - sal_uLong nCur; + 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() ); @@ -2424,10 +2423,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 ); } } @@ -2906,7 +2905,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::FindNewCursor() } } else - pNewCursor = (SvxIconChoiceCtrlEntry*)aEntries.First(); + pNewCursor = aEntries[ 0 ]; DBG_ASSERT(!pNewCursor|| (pCursor&&pCursor!=pNewCursor),"FindNewCursor failed"); return pNewCursor; } @@ -2935,10 +2934,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 ); } @@ -3605,8 +3604,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 ) ) { @@ -3751,12 +3750,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; @@ -3788,14 +3787,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; @@ -3805,7 +3804,7 @@ SvxIconChoiceCtrlEntry* SvxIconChoiceCtrl_Impl::GetNextSelectedEntry( sal_uLong& } else { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( rStartPos ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ rStartPos ]; pEntry = pEntry->pflink; while( pEntry != pHead ) { @@ -3826,10 +3825,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); @@ -3986,13 +3985,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; @@ -4005,7 +4004,7 @@ void SvxIconChoiceCtrl_Impl::SetEntryListPos( SvxIconChoiceCtrlEntry* pListEntry } for( ; nStart <= nEnd; nStart++ ) { - SvxIconChoiceCtrlEntry* pEntry = (SvxIconChoiceCtrlEntry*)aEntries.GetObject( nStart ); + SvxIconChoiceCtrlEntry* pEntry = aEntries[ nStart ]; pEntry->nPos = nStart; } } @@ -4073,15 +4072,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; @@ -4092,31 +4083,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 ) @@ -4139,14 +4146,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 ) { @@ -4154,7 +4161,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 ) @@ -4181,7 +4188,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( @@ -4197,7 +4204,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 ) @@ -4267,7 +4274,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; @@ -4286,13 +4293,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 d21ff9139a49..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 -- cgit v1.2.3 From 602cbe4d175a264186504786cfbfb3ed3cf77be9 Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Sun, 17 Jul 2011 06:44:39 -0700 Subject: Fix type missmatch in SvxIconChoiceCtrl_Impl. Sorry about that. My compiler (gcc 4.0) doesn't notice on a 32bit build. Thanks go to Maciej Rumianowski for pointing this out. --- svtools/source/contnr/imivctl.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svtools') diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index ced1856eeceb..5dc71796a392 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -351,7 +351,7 @@ public: 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 InsertEntry( SvxIconChoiceCtrlEntry*, size_t nPos, const Point* pPos=0 ); void CreateAutoMnemonics( MnemonicGenerator* _pGenerator = NULL ); void RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ); void FontModified(); -- cgit v1.2.3 From f0c04d9bf3e8e4f3d2ab63f81355375a4331595a Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sun, 17 Jul 2011 16:13:06 +0200 Subject: Some fixes for compilation --- svtools/source/contnr/imivctl1.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'svtools') diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index df9b81dab0c7..a3b73c4508df 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -440,7 +440,7 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ) pZOrderList->Remove( nPos ); if( bCurEntryPosValid ) { - DBG_ASSERT(aEntries.GetObject(pEntry->nPos)==pEntry,"RemoveEntry: Wrong nPos in entry"); + DBG_ASSERT(aEntries[pEntry->nPos]==pEntry,"RemoveEntry: Wrong nPos in entry"); aEntries.remove( pEntry->nPos ); } else @@ -4136,7 +4136,7 @@ void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ) _pOwner->pHead = pEntry->pflink; else { - DBG_ASSERT(!Count(),"EntryList_Impl::Remove > Invalid predecessor" ); + DBG_ASSERT(size() > 0,"EntryList_Impl::Remove > Invalid predecessor" ); _pOwner->pHead = 0; } } -- cgit v1.2.3 From d4908036350fc1f581ae03674c330a2411ea32b1 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sun, 17 Jul 2011 23:23:55 +0200 Subject: An error in my previous fix --- svtools/source/contnr/imivctl1.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'svtools') diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index a3b73c4508df..be1576c8c55c 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -4136,7 +4136,7 @@ void EntryList_Impl::Removed_Impl( SvxIconChoiceCtrlEntry* pEntry ) _pOwner->pHead = pEntry->pflink; else { - DBG_ASSERT(size() > 0,"EntryList_Impl::Remove > Invalid predecessor" ); + DBG_ASSERT(!size(),"EntryList_Impl::Remove > Invalid predecessor" ); _pOwner->pHead = 0; } } -- cgit v1.2.3 From ea8a56a59310d39fe912661dfa9ceaee1cc3de79 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Mon, 18 Jul 2011 11:09:12 +0100 Subject: add new InsertAutomaticEntryColor method --- svtools/inc/svtools/ctrlbox.hxx | 3 ++- svtools/source/control/ctrlbox.cxx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'svtools') 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/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 ); } // ----------------------------------------------------------------------- -- cgit v1.2.3 From 8104b3710e4942881d1e1e9969a28d5fd556521c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 14 Jul 2011 22:07:32 +0100 Subject: callcatcher: remove unused methods --- svl/inc/svl/urihelper.hxx | 26 -------------- svl/source/misc/urihelper.cxx | 61 --------------------------------- svtools/inc/svtools/syntaxhighlight.hxx | 8 ----- svtools/source/edit/syntaxhighlight.cxx | 35 ------------------- vcl/inc/vcl/window.hxx | 1 - vcl/source/window/window2.cxx | 5 --- 6 files changed, 136 deletions(-) (limited to 'svtools') diff --git a/svl/inc/svl/urihelper.hxx b/svl/inc/svl/urihelper.hxx index 67326861642c..61be9f6c831d 100644 --- a/svl/inc/svl/urihelper.hxx +++ b/svl/inc/svl/urihelper.hxx @@ -177,32 +177,6 @@ removePassword(UniString const & rURI, INetURLObject::DecodeMechanism eDecodeMechanism = INetURLObject::DECODE_TO_IURI, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - -//============================================================================ -/** Query the notational conventions used in the file system provided by some - file content provider. - - @param rFileUrl This file URL determines which file content provider is - used to query the desired information. (The UCB's usual mapping from URLs - to content providers is used.) - - @param bAddConvenienceStyles If true, the return value contains not only - the style bit corresponding to the queried content provider's conventions, - but may also contain additional style bits that make using this function - more convenient in certain situations. Currently, the effect is that - FSYS_UNX is extended with FSYS_VOS, and both FSYS_DOS and FSYS_MAC are - extended with FSYS_VOS and FSYS_UNX (i.e., the---unambiguous---detection - of VOS style and Unix style file system paths is always enabled); also, in - case the content provider's conventions cannot be determined, FSYS_DETECT - is returned instead of FSysStyle(0). - - @return The style bit corresponding to the queried content provider's - conventions, or FSysStyle(0) if these cannot be determined. - */ -SVL_DLLPUBLIC INetURLObject::FSysStyle queryFSysStyle(UniString const & rFileUrl, - bool bAddConvenienceStyles = true) - throw (com::sun::star::uno::RuntimeException); - } #endif // SVTOOLS_URIHELPER_HXX diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx index 3f46d8ab9f5b..1bef290f3dfd 100644 --- a/svl/source/misc/urihelper.cxx +++ b/svl/source/misc/urihelper.cxx @@ -865,65 +865,4 @@ URIHelper::removePassword(UniString const & rURI, String(aObj.GetURLNoPass(eDecodeMechanism, eCharset)); } -//============================================================================ -// -// queryFSysStyle -// -//============================================================================ - -INetURLObject::FSysStyle URIHelper::queryFSysStyle(UniString const & rFileUrl, - bool bAddConvenienceStyles) - throw (uno::RuntimeException) -{ - ::ucbhelper::ContentBroker const * pBroker = ::ucbhelper::ContentBroker::get(); - uno::Reference< ucb::XContentProviderManager > xManager; - if (pBroker) - xManager = pBroker->getContentProviderManagerInterface(); - uno::Reference< beans::XPropertySet > xProperties; - if (xManager.is()) - xProperties - = uno::Reference< beans::XPropertySet >( - xManager->queryContentProvider(rFileUrl), uno::UNO_QUERY); - sal_Int32 nNotation = ucb::FileSystemNotation::UNKNOWN_NOTATION; - if (xProperties.is()) - try - { - xProperties->getPropertyValue(rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "FileSystemNotation"))) - >>= nNotation; - } - catch (beans::UnknownPropertyException const &) {} - catch (lang::WrappedTargetException const &) {} - - // The following code depends on the fact that the - // com::sun::star::ucb::FileSystemNotation constants range from UNKNOWN to - // MAC, without any holes. The table below has two entries per notation, - // the first is used if bAddConvenienceStyles == false, while the second - // is used if bAddConvenienceStyles == true: - static INetURLObject::FSysStyle const aMap[][2] - = { { INetURLObject::FSysStyle(0), - INetURLObject::FSYS_DETECT }, - // UNKNOWN - { INetURLObject::FSYS_UNX, - INetURLObject::FSysStyle(INetURLObject::FSYS_VOS - | INetURLObject::FSYS_UNX) }, - // UNIX - { INetURLObject::FSYS_DOS, - INetURLObject::FSysStyle(INetURLObject::FSYS_VOS - | INetURLObject::FSYS_UNX - | INetURLObject::FSYS_DOS) }, - // DOS - { INetURLObject::FSYS_MAC, - INetURLObject::FSysStyle(INetURLObject::FSYS_VOS - | INetURLObject::FSYS_UNX - | INetURLObject::FSYS_MAC) } }; - return aMap[nNotation < ucb::FileSystemNotation::UNKNOWN_NOTATION - || nNotation > ucb::FileSystemNotation::MAC_NOTATION ? - 0 : - nNotation - - ucb::FileSystemNotation::UNKNOWN_NOTATION] - [bAddConvenienceStyles]; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx index 6ccaa07453d8..df9c9d1acea9 100644 --- a/svtools/source/edit/syntaxhighlight.cxx +++ b/svtools/source/edit/syntaxhighlight.cxx @@ -675,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/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index df82b7870854..8cc7bfd0894f 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -914,7 +914,6 @@ public: void SetFakeFocus( bool bFocus ); sal_Bool IsCompoundControl() const; - sal_Bool HasCompoundControlFocus() const; static sal_uIntPtr SaveFocus(); static sal_Bool EndSaveFocus( sal_uIntPtr nSaveId, sal_Bool bRestore = sal_True ); diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index bf81d2665f48..a2dd24378e37 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1759,11 +1759,6 @@ sal_Bool Window::IsCompoundControl() const return mpWindowImpl->mbCompoundControl; } -sal_Bool Window::HasCompoundControlFocus() const -{ - return mpWindowImpl->mbCompoundControlHasFocus; -} - sal_Bool Window::IsChildPointerOverwrite() const { return mpWindowImpl->mbChildPtrOverwrite; -- cgit v1.2.3 From 2274aae7558c69c93ab9d3decb1202caca52f6fc Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Sun, 17 Jul 2011 13:26:54 -0700 Subject: Replace List with SvxIconChoiceCtrlEntryList_impl --- svtools/inc/svtools/ivctrl.hxx | 2 - svtools/source/contnr/imivctl.hxx | 3 +- svtools/source/contnr/imivctl1.cxx | 162 +++++++++++++++++++------------------ svtools/source/contnr/ivctrl.cxx | 6 -- 4 files changed, 86 insertions(+), 87 deletions(-) (limited to 'svtools') 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/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index 5dc71796a392..18b34b780fde 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -195,7 +195,7 @@ class SvxIconChoiceCtrl_Impl IcnGridMap_Impl* pGridMap; long nMaxVirtWidth; // max. Breite aVirtOutputSize bei ALIGN_TOP long nMaxVirtHeight; // max. Hoehe aVirtOutputSize bei ALIGN_LEFT - List* pZOrderList; + SvxIconChoiceCtrlEntryList_impl* pZOrderList; SvPtrarr* pColumns; IcnViewEdit_Impl* pEdit; WinBits nWinBits; @@ -416,7 +416,6 @@ public: 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 ); diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index be1576c8c55c..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,7 +220,7 @@ 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); @@ -302,7 +304,7 @@ void SvxIconChoiceCtrl_Impl::InsertEntry( SvxIconChoiceCtrlEntry* pEntry, size_t else nFlags &= ~F_ENTRYLISTPOS_VALID; - pZOrderList->Insert( (void*)pEntry, LIST_APPEND ); //pZOrderList->Count() ); + pZOrderList->push_back( pEntry ); pImpCursor->Clear(); if( pPos ) { @@ -436,11 +438,22 @@ void SvxIconChoiceCtrl_Impl::RemoveEntry( SvxIconChoiceCtrlEntry* pEntry ) sal_Bool bCurEntryPosValid = (nFlags & F_ENTRYLISTPOS_VALID) ? sal_True : sal_False; 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[pEntry->nPos]==pEntry,"RemoveEntry: Wrong nPos in entry"); + DBG_ASSERT(aEntries[ pEntry->nPos ] == pEntry,"RemoveEntry: Wrong nPos in entry"); aEntries.remove( pEntry->nPos ); } else @@ -773,7 +786,7 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) if ( pView->HasFocus() ) GetFocus(); - sal_uLong nCount = pZOrderList->Count(); + size_t nCount = pZOrderList->size(); if( !nCount ) return; @@ -785,35 +798,33 @@ void SvxIconChoiceCtrl_Impl::Paint( const Rectangle& rRect ) pView->SetClipRegion( aOutputArea ); } - const sal_uInt16 nListInitSize = aEntries.size() > USHRT_MAX ? - USHRT_MAX : (sal_uInt16)aEntries.size(); - 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; @@ -823,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; @@ -834,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 ); @@ -1597,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; @@ -1636,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; @@ -2098,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 ) @@ -2125,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; } @@ -2343,7 +2341,7 @@ Size SvxIconChoiceCtrl_Impl::CalcBoundingSize( SvxIconChoiceCtrlEntry* pEntry ) void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects() { nMaxBoundHeight = 0; - pZOrderList->Clear(); + pZOrderList->clear(); size_t nCount = aEntries.size(); size_t nCur; SvxIconChoiceCtrlEntry* pEntry; @@ -2354,7 +2352,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects() { pEntry = aEntries[ nCur ]; FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, LIST_APPEND ); + pZOrderList->push_back( pEntry ); } } else @@ -2365,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++; } @@ -2377,7 +2375,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRects() void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() { nMaxBoundHeight = 0; - pZOrderList->Clear(); + pZOrderList->clear(); size_t nCur; SvxIconChoiceCtrlEntry* pEntry; const size_t nCount = aEntries.size(); @@ -2395,7 +2393,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() } else FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, LIST_APPEND ); + pZOrderList->push_back( pEntry ); } } else @@ -2413,7 +2411,7 @@ void SvxIconChoiceCtrl_Impl::RecalcAllBoundingRectsSmart() } else FindBoundingRect( pEntry ); - pZOrderList->Insert( pEntry, LIST_APPEND ); + pZOrderList->push_back( pEntry ); pEntry = pEntry->pflink; nCur++; } @@ -2760,11 +2758,21 @@ void SvxIconChoiceCtrl_Impl::Command( const CommandEvent& rCEvt ) 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; + } + } } } @@ -3140,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 @@ -3149,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(); @@ -3162,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 ); 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(); -- cgit v1.2.3 From 8e2abdc5151a4bcef63f9138f2c35837af36ffe4 Mon Sep 17 00:00:00 2001 From: Troy Rollo Date: Tue, 19 Jul 2011 14:47:02 +0100 Subject: Preserve RTF \'00 sequences (NULL) in strings --- svtools/source/svrtf/parrtf.cxx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'svtools') 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 = '\\'; -- cgit v1.2.3 From 91ee802640453de271dac368ad22b315e2527905 Mon Sep 17 00:00:00 2001 From: Joseph Powers Date: Wed, 20 Jul 2011 06:33:30 -0700 Subject: Whitespace cleanup --- svtools/source/filter/wmf/winmtf.hxx | 467 +++++++++++++++++++++-------------- 1 file changed, 283 insertions(+), 184 deletions(-) (limited to 'svtools') 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(); -- cgit v1.2.3 From c2f4124291d1da026c97a560babf0a0dde5c76b6 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Tue, 19 Jul 2011 15:24:13 +0200 Subject: callcatcher: cleanup BrowseBox --- svtools/inc/svtools/brwbox.hxx | 21 ----- svtools/source/brwbox/brwbox1.cxx | 188 -------------------------------------- svtools/source/brwbox/brwbox2.cxx | 7 -- 3 files changed, 216 deletions(-) (limited to 'svtools') 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/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 @@ -265,36 +265,6 @@ void BrowseBox::InsertHandleColumn( sal_uLong nWidth ) ColumnInserted( 0 ); } -//------------------------------------------------------------------- -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, @@ -327,45 +297,6 @@ void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const XubString& rText, ColumnInserted( nPos ); } -//------------------------------------------------------------------- - -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() { @@ -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); @@ -2077,12 +1927,6 @@ long BrowseBox::FirstSelectedColumn( ) const return pColSel ? pColSel->FirstSelected() : BROWSER_ENDOFSELECTION; } -//------------------------------------------------------------------- -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 ); -- cgit v1.2.3 From 3e4269deb560f2f3f8156edd530bae96a8c7dbb1 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 20 Jul 2011 21:36:09 +0100 Subject: ByteString::CreateFromInt32->rtl::OStringBuffer::append --- svtools/source/svhtml/htmlout.cxx | 42 +++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'svtools') diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index b1b428d8fd3b..f1d56f7f6fc5 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -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(aRect.Left())) + .append(',') + .append(static_cast(aRect.Top())) + .append(',') + .append(static_cast(aRect.Right())) + .append(',') + .append(static_cast(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(aCenter.X())) + .append(',') + .append(static_cast(aCenter.Y())) + .append(',') + .append(static_cast(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(rPoint.X())) + .append(',') + .append(static_cast(rPoint.Y())); } for( sal_uInt16 j=1; j(rPoint.X())) + .append(',') + .append(static_cast(rPoint.Y())); } + aCoords = aTmpBuf.makeStringAndClear(); } break; default: -- cgit v1.2.3 From 74140442bbf39e19bdc05f1cfb975f5a11751f2c Mon Sep 17 00:00:00 2001 From: Matúš Kukan Date: Thu, 21 Jul 2011 13:46:53 +0200 Subject: Drop macros from componentmodule.hxx --- comphelper/inc/comphelper/componentmodule.hxx | 92 -------------------------- comphelper/source/inc/comphelper_module.hxx | 50 +++++++++++++- comphelper/source/misc/comphelper_module.cxx | 19 +++++- comphelper/source/misc/comphelper_services.cxx | 7 +- svtools/workben/unodialog/udlg_services.cxx | 7 +- 5 files changed, 79 insertions(+), 96 deletions(-) (limited to 'svtools') diff --git a/comphelper/inc/comphelper/componentmodule.hxx b/comphelper/inc/comphelper/componentmodule.hxx index 198d6c37bb20..5893313c8497 100644 --- a/comphelper/inc/comphelper/componentmodule.hxx +++ b/comphelper/inc/comphelper/componentmodule.hxx @@ -270,98 +270,6 @@ namespace comphelper ) ); } - //========================================================================== - //= helpers - //========================================================================== - - //========================================================================== - // declaring a OModule for a component library - -#define DECLARE_COMPONENT_MODULE( ModuleClass, ClientClass ) \ - /* -------------------------------------------------------------------- */ \ - class ModuleClass : public ::comphelper::OModule \ - { \ - friend struct ModuleClass##Creator; \ - typedef ::comphelper::OModule BaseClass; \ - \ - public: \ - static ModuleClass& getInstance(); \ - \ - private: \ - ModuleClass(); \ - }; \ - \ - /* -------------------------------------------------------------------- */ \ - class ClientClass : public ::comphelper::OModuleClient \ - { \ - private: \ - typedef ::comphelper::OModuleClient BaseClass; \ - \ - public: \ - ClientClass() : BaseClass( ModuleClass::getInstance() ) \ - { \ - } \ - }; \ - \ - /* -------------------------------------------------------------------- */ \ - template < class TYPE > \ - class OAutoRegistration : public ::comphelper::OAutoRegistration< TYPE > \ - { \ - private: \ - typedef ::comphelper::OAutoRegistration< TYPE > BaseClass; \ - \ - public: \ - OAutoRegistration() : BaseClass( ModuleClass::getInstance() ) \ - { \ - } \ - }; \ - /* -------------------------------------------------------------------- */ \ - template < class TYPE > \ - class OSingletonRegistration : public ::comphelper::OSingletonRegistration< TYPE > \ - { \ - private: \ - typedef ::comphelper::OSingletonRegistration< TYPE > BaseClass; \ - \ - public: \ - OSingletonRegistration() : BaseClass( ModuleClass::getInstance() ) \ - { \ - } \ - }; - - //========================================================================== - //= implementing a OModule for a component library - -#define IMPLEMENT_COMPONENT_MODULE( ModuleClass ) \ - struct ModuleClass##Creator \ - { \ - ModuleClass m_aModuleClass; \ - }; \ - namespace \ - { \ - class the##ModuleClass##Instance : public rtl::Static {}; \ - } \ - \ - ModuleClass::ModuleClass() \ - :BaseClass() \ - { \ - } \ - \ - ModuleClass& ModuleClass::getInstance() \ - { \ - return the##ModuleClass##Instance::get().m_aModuleClass; \ - } \ - - //========================================================================== - //= implementing the API of a component library (component_*) - -#define IMPLEMENT_COMPONENT_LIBRARY_API( module_class, initializer_function ) \ - extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( \ - const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) \ - { \ - initializer_function(); \ - return module_class::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey ); \ - } - //........................................................................ } // namespace comphelper //........................................................................ diff --git a/comphelper/source/inc/comphelper_module.hxx b/comphelper/source/inc/comphelper_module.hxx index 9f8e32656715..dfa364df1983 100644 --- a/comphelper/source/inc/comphelper_module.hxx +++ b/comphelper/source/inc/comphelper_module.hxx @@ -35,7 +35,55 @@ namespace comphelper { namespace module { //........................................................................ - DECLARE_COMPONENT_MODULE( ComphelperModule, ComphelperModuleClient ) + class ComphelperModule : public ::comphelper::OModule + { + friend struct ComphelperModuleCreator; + typedef ::comphelper::OModule BaseClass; + + public: + static ComphelperModule& getInstance(); + + private: + ComphelperModule(); + }; + + /* -------------------------------------------------------------------- */ + class ComphelperModuleClient : public ::comphelper::OModuleClient + { + private: + typedef ::comphelper::OModuleClient BaseClass; + + public: + ComphelperModuleClient() : BaseClass( ComphelperModule::getInstance() ) + { + } + }; + + /* -------------------------------------------------------------------- */ + template < class TYPE > + class OAutoRegistration : public ::comphelper::OAutoRegistration< TYPE > + { + private: + typedef ::comphelper::OAutoRegistration< TYPE > BaseClass; + + public: + OAutoRegistration() : BaseClass( ComphelperModule::getInstance() ) + { + } + }; + + /* -------------------------------------------------------------------- */ + template < class TYPE > + class OSingletonRegistration : public ::comphelper::OSingletonRegistration< TYPE > + { + private: + typedef ::comphelper::OSingletonRegistration< TYPE > BaseClass; + + public: + OSingletonRegistration() : BaseClass( ComphelperModule::getInstance() ) + { + } + }; //........................................................................ } } // namespace comphelper::module diff --git a/comphelper/source/misc/comphelper_module.cxx b/comphelper/source/misc/comphelper_module.cxx index 8b9ee4221dfc..b2bdad6665cb 100644 --- a/comphelper/source/misc/comphelper_module.cxx +++ b/comphelper/source/misc/comphelper_module.cxx @@ -35,7 +35,24 @@ namespace comphelper { namespace module { //........................................................................ - IMPLEMENT_COMPONENT_MODULE( ComphelperModule ); + struct ComphelperModuleCreator + { + ComphelperModule m_aComphelperModule; + }; + namespace + { + class theComphelperModuleInstance : public rtl::Static {}; + } + + ComphelperModule::ComphelperModule() + :BaseClass() + { + } + + ComphelperModule& ComphelperModule::getInstance() + { + return theComphelperModuleInstance::get().m_aComphelperModule; + } //........................................................................ } } // namespace comphelper::module diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx index 32d1c53aff93..ad5558fb8ee7 100644 --- a/comphelper/source/misc/comphelper_services.cxx +++ b/comphelper/source/misc/comphelper_services.cxx @@ -85,6 +85,11 @@ namespace comphelper { namespace module } } // namespace comphelper::module //........................................................................ -IMPLEMENT_COMPONENT_LIBRARY_API( ::comphelper::module::ComphelperModule, ::comphelper::module::initializeModule ) +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) +{ + ::comphelper::module::initializeModule(); + return ::comphelper::module::ComphelperModule::getInstance().getComponentFactory( pImplementationName, pServiceManager, pRegistryKey ); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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: */ -- cgit v1.2.3 From ca402fa0dae85f7f289398af34aa43cf06d14e87 Mon Sep 17 00:00:00 2001 From: Thomas Arnhold Date: Thu, 21 Jul 2011 10:36:32 +0200 Subject: callcatcher: completely remove SvIconView --- svtools/Library_svt.mk | 2 - svtools/Package_inc.mk | 1 - svtools/inc/svtools/svicnvw.hxx | 289 --- svtools/source/contnr/svicnvw.cxx | 813 ------- svtools/source/contnr/svimpicn.cxx | 4093 ------------------------------------ 5 files changed, 5198 deletions(-) delete mode 100644 svtools/inc/svtools/svicnvw.hxx delete mode 100644 svtools/source/contnr/svicnvw.cxx delete mode 100644 svtools/source/contnr/svimpicn.cxx (limited to 'svtools') diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 2dee92a7dceb..c3dac5e44649 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -112,9 +112,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/contnr/imivctl1 \ svtools/source/contnr/imivctl2 \ svtools/source/contnr/ivctrl \ - svtools/source/contnr/svicnvw \ svtools/source/contnr/svimpbox \ - svtools/source/contnr/svimpicn \ svtools/source/contnr/svlbitm \ svtools/source/contnr/svlbox \ svtools/source/contnr/svtabbx \ diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk index 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/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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVICNVW_HXX -#define _SVICNVW_HXX - -#include -#include - -class SvImpIconView; -class SvLBoxEntry; -class SvLBoxItem; -class SvLBoxString; -class SvLBoxContextBmp; -class SvPtrarr; - -#define WB_ICON 0x0001 -#define WB_NAME 0x0002 -#define WB_TEXT 0x0004 -#define WB_FLOW 0x0008 - -#define ICNVW_FLAG_POS_LOCKED 0x0001 -#define ICNVW_FLAG_USER1 0x1000 -#define ICNVW_FLAG_USER2 0x2000 -#define ICNVW_FLAG_USER3 0x4000 -#define ICNVW_FLAG_USER4 0x8000 - -enum SvIconViewTextMode -{ - ShowTextFull = 1, - ShowTextShort, - ShowTextSmart, // not implemented - ShowTextDontKnow // only for entries (uses config? from the view) -}; - -class SvIcnVwDataEntry : public SvViewDataEntry -{ -friend class SvImpIconView; - sal_uInt16 nIcnVwFlags; - SvIconViewTextMode eTextMode; -public: - Rectangle aRect; // Bounding-Rect of the Entry - Rectangle aGridRect; // set in grid mode - Size aTextSize; // set in grid mode only - sal_uInt16 nX,nY; // for keyboard control - SvIcnVwDataEntry(); - virtual ~SvIcnVwDataEntry(); - - sal_Bool IsEntryPosLocked() const { return (sal_Bool)((nIcnVwFlags & ICNVW_FLAG_POS_LOCKED) !=0); } - void ClearVwFlags( sal_uInt16 nMask ) { nIcnVwFlags &= (~nMask); } - void SetVwFlags( sal_uInt16 nMask ) { nIcnVwFlags |= nMask; } - sal_uInt16 GetVwFlags() const { return nIcnVwFlags; } - SvIconViewTextMode GetTextMode() const { return eTextMode; } -}; - -#define SV_LISTBOX_ID_ICONVIEW 2 - -class SvIconView : public SvLBox -{ - friend class SvImpIconView; - - SvImpIconView* pImp; - Image aCollapsedEntryBmp; - Image aExpandedEntryBmp; - sal_uInt16 nIcnVwFlags; - void SetModel( SvLBoxTreeList* ); - -protected: - - using SvLBox::CreateEntry; - SvLBoxEntry* CreateEntry( const XubString&, const Image&, const Image&); - void ViewDataInitialized( SvLBoxEntry* ); - virtual SvViewData* CreateViewData( SvListEntry* ); - virtual void InitViewData( SvViewData* pData, SvListEntry* pEntry ); - - void EditingRequest(SvLBoxEntry*,SvLBoxItem*,const Point& ); - void EditedText( const XubString& ); - void EditItemText( SvLBoxEntry*,SvLBoxItem*,const Selection& ); - SvLBoxEntry* pCurEdEntry; - SvLBoxItem* pCurEdItem; - - virtual void WriteDragServerInfo( const Point&, SvLBoxDDInfo* ); - virtual void ReadDragServerInfo( const Point&, SvLBoxDDInfo* ); - virtual void Command( const CommandEvent& rCEvt ); - virtual void PreparePaint( SvLBoxEntry* ); - virtual void StateChanged( StateChangedType nStateChange ); - -public: - - SvIconView( Window* pParent,WinBits nWinStyle=0 ); - SvIconView( Window* pParent,const ResId& rResId ); - ~SvIconView(); - - void DisconnectFromModel(); - - SvLBoxEntry* InsertEntry( const XubString& rText, SvLBoxEntry* pParent = 0, - sal_Bool bChildsOnDemand = sal_False, - sal_uLong nPos=LIST_APPEND ); - - SvLBoxEntry* InsertEntry( const XubString& rText, - const Image& rExpandedEntryBmp, - const Image& rCollapsedEntryBmp, - SvLBoxEntry* pParent = 0, - sal_Bool bChildsOnDemand = sal_False, - sal_uLong nPos = LIST_APPEND ); - - const Image& GetDefaultExpandedEntryBmp() const { return aExpandedEntryBmp;} - const Image& GetDefaultCollapsedEntryBmp() const { return aCollapsedEntryBmp;} - void SetDefaultExpandedEntryBmp( const Image& rBmp) { aExpandedEntryBmp=rBmp;} - void SetDefaultCollapsedEntryBmp( const Image& rBmp ) { aCollapsedEntryBmp=rBmp;} - - void SetEntryText(SvLBoxEntry*, const XubString& ); - void SetExpandedEntryBmp(SvLBoxEntry*, const Image& ); - void SetCollapsedEntryBmp(SvLBoxEntry*, const Image& ); - - XubString GetEntryText(SvLBoxEntry*) const; - Image GetExpandedEntryBmp(SvLBoxEntry*) const; - Image GetCollapsedEntryBmp(SvLBoxEntry*) const; - - virtual SvLBoxEntry* CloneEntry( SvLBoxEntry* pSource ); - - virtual sal_uInt16 IsA(); - - virtual void RequestingChilds( SvLBoxEntry* pParent ); - - virtual void Paint( const Rectangle& rRect ); - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void MouseButtonUp( const MouseEvent& rMEvt ); - virtual void MouseMove( const MouseEvent& rMEvt ); - virtual void KeyInput( const KeyEvent& rKEvt ); - virtual void Resize(); - virtual void GetFocus(); - virtual void LoseFocus(); - void SetUpdateMode( sal_Bool ); - - using SvListView::SetModel; - virtual void SetModel( SvLBoxTreeList*, SvLBoxEntry* pParent ); - virtual void ModelHasCleared(); - virtual void ModelHasInserted( SvListEntry* pEntry ); - virtual void ModelHasInsertedTree( SvListEntry* pEntry ); - virtual void ModelIsMoving(SvListEntry* pSource, - SvListEntry* pTargetParent, sal_uLong nChildPos ); - virtual void ModelHasMoved(SvListEntry* pSource ); - virtual void ModelIsRemoving( SvListEntry* pEntry ); - virtual void ModelHasRemoved( SvListEntry* pEntry ); - virtual void ModelHasEntryInvalidated( SvListEntry* pEntry ); - - virtual void ShowTargetEmphasis( SvLBoxEntry*, sal_Bool bShow ); - using Window::GetDropTarget; - virtual SvLBoxEntry* GetDropTarget( const Point& ); - virtual Region GetDragRegion() const; - // NotifyMoving/Copying is overloaded, since GetDropTarget - // returns a "magic pointer" if the drop happens in/on an empty - // area(?) of the IconView - virtual sal_Bool NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos); - virtual sal_Bool NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos); - - // returns TopLeft of the BoundingRect. Add MapMode.Origin to get the - // position relative to the window - Point GetEntryPosition( SvLBoxEntry* ) const; - void SetEntryPosition( SvLBoxEntry*, const Point& rDocPos); - void SetEntryPosition( SvLBoxEntry*, const Point& rDocPos, - sal_Bool bAdjustAtGrid ); - - void SetFont( const Font& rFont ); - void SetDefaultFont(); - - using SvLBox::GetEntry; - SvLBoxEntry* GetEntry( const Point& rPixPos, sal_Bool ) const; - // returns the entry just above pCurEntry (z-wise) - SvLBoxEntry* GetNextEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const; - // returns the entry just below pCurEntry (z-wise) - SvLBoxEntry* GetPrevEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const; - - SvLBoxEntry* GetEntryFromLogicPos( const Point& rDocPos ) const; - - virtual void PaintEntry( SvLBoxEntry* ); - virtual void PaintEntry( SvLBoxEntry*, const Point& rDocPos ); - Rectangle GetFocusRect( SvLBoxEntry* ); - void InvalidateEntry( SvLBoxEntry* ); - void MakeVisible( SvLBoxEntry* ); - - void SetDragDropMode( DragDropMode ); - void SetSelectionMode( SelectionMode ); - - using SvListView::Select; - sal_Bool Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True ); - void SelectAll( sal_Bool bSelect, sal_Bool bPaint=sal_True ); - virtual void SetCurEntry( SvLBoxEntry* _pEntry ); - virtual SvLBoxEntry* - GetCurEntry() const; - - // locigal coordinates - void SelectRect( - const Rectangle& rRect, - sal_Bool bAdd = sal_False, - // inverts the intersection with rRect - // (ignored if bAdd == sal_False) - SvPtrarr* pOtherRects = 0, - short nBorderOffs = -5 ); - sal_uLong GetSelectionCount() const; - - virtual void Arrange(); - void SetSpaceBetweenEntries( long nHor, long Ver ); - long GetHorSpaceBetweenEntries(); - long GetVerSpaceBetweenEntries(); - - void EnableInplaceEditing( sal_Bool bEnable ); - void EditEntry( SvLBoxEntry* pEntry = 0 ); - virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& ); - virtual sal_Bool EditedEntry( SvLBoxEntry*, const XubString& rNewText ); - - void SetCurParent( SvLBoxEntry* pNewParent ); - SvLBoxEntry* GetCurParent() const; - - virtual void ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1, - SvListEntry* pEntry2, sal_uLong nPos ); - - // pass (0, 0) to switch off grid mode - void SetGrid( long nDX, long nDY ); - - // nDeltaY < 0 : View moves up relative to Doc - // nDeltaY > 0 : View moves down relative to Doc - // nDeltaX < 0 : View moves left relative to Doc - // nDeltaX > 0 : View moves right relative to Doc - using Window::Scroll; - virtual void Scroll( long nDeltaX, long nDeltaY, sal_uInt16 nFlags = 0 ); - - virtual void PrepareCommandEvent( const CommandEvent& ); - virtual void StartDrag( sal_Int8 nAction, const Point& ); - virtual void DragFinished( sal_Int8 ); - virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); - using SvLBox::ExecuteDrop; - virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); - - void ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ); - void HideDDIcon(); - void HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ); - - // to scroll during Drag&Drop - void CalcScrollOffsets( - const Point& rRefPosPixel, - long& rScrollX, - long& rScrollY, - sal_Bool bInDragDrop = sal_False, - sal_uInt16 nBorderWidth = 10 ); - - using Window::EndTracking; - void EndTracking(); - void AdjustAtGrid( SvLBoxEntry* pEntry = 0 ); - void LockEntryPos( SvLBoxEntry* pEntry, sal_Bool bLock = sal_True ); - sal_Bool IsEntryPosLocked( const SvLBoxEntry* pEntry ) const; - - void SetTextMode( SvIconViewTextMode, SvLBoxEntry* pEntry = 0 ); - SvIconViewTextMode GetTextMode( const SvLBoxEntry* pEntry = 0 ) const; - - void ShowFocusRect( const SvLBoxEntry* pEntry ); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/svicnvw.cxx b/svtools/source/contnr/svicnvw.cxx deleted file mode 100644 index 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#include - -#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(""), pParent, sal_False, LIST_APPEND ); -} - -void SvIconView::Paint( const Rectangle& rRect ) -{ - pImp->Paint( rRect ); -} - -void SvIconView::MouseButtonDown( const MouseEvent& rMEvt ) -{ - pImp->MouseButtonDown( rMEvt ); -} - -void SvIconView::MouseButtonUp( const MouseEvent& rMEvt ) -{ - pImp->MouseButtonUp( rMEvt ); -} - -void SvIconView::MouseMove( const MouseEvent& rMEvt ) -{ - pImp->MouseMove( rMEvt ); -} - -void SvIconView::KeyInput( const KeyEvent& rKEvt ) -{ - // unter OS/2 bekommen wir auch beim Editieren Key-Up/Down - if( IsEditingActive() ) - return; - - nImpFlags |= SVLBOX_IS_TRAVELSELECT; - sal_Bool bKeyUsed = pImp->KeyInput( rKEvt ); - if ( !bKeyUsed ) - SvLBox::KeyInput( rKEvt ); - nImpFlags &= ~SVLBOX_IS_TRAVELSELECT; -} - -void SvIconView::Resize() -{ - pImp->Resize(); - SvLBox::Resize(); -} - -void SvIconView::GetFocus() -{ - pImp->GetFocus(); - SvLBox::GetFocus(); -} - -void SvIconView::LoseFocus() -{ - pImp->LoseFocus(); - SvLBox::LoseFocus(); -} - -void SvIconView::SetUpdateMode( sal_Bool bUpdate ) -{ - Control::SetUpdateMode( bUpdate ); - if ( bUpdate ) - pImp->UpdateAll(); -} - -void SvIconView::SetModel( SvLBoxTreeList* ) -{ -} - -void SvIconView::SetModel( SvLBoxTreeList* pNewModel, SvLBoxEntry* pParent ) -{ - nIcnVwFlags |= ICNVW_BLOCK_ENTRYINS; - SvLBox::SetModel( pNewModel ); - nIcnVwFlags &= (~ICNVW_BLOCK_ENTRYINS); - if ( pParent && pParent->HasChildsOnDemand() ) - RequestingChilds( pParent ); - pImp->SetModel( pNewModel, pParent ); -} - -void SvIconView::ModelHasCleared() -{ - SvLBox::ModelHasCleared(); - pImp->Clear(); -} - -void SvIconView::ModelHasInserted( SvListEntry* pEntry ) -{ - if( !(nIcnVwFlags & ICNVW_BLOCK_ENTRYINS ) ) - pImp->EntryInserted( (SvLBoxEntry*)pEntry ); -} - -void SvIconView::ModelHasInsertedTree( SvListEntry* pEntry ) -{ - pImp->TreeInserted( (SvLBoxEntry*)pEntry ); -} - -void SvIconView::ModelIsMoving(SvListEntry* pSource, - SvListEntry* /* pTargetParent */ , sal_uLong /* nChildPos */ ) -{ - pImp->MovingEntry( (SvLBoxEntry*)pSource ); -} - -void SvIconView::ModelHasMoved(SvListEntry* pSource ) -{ - pImp->EntryMoved( (SvLBoxEntry*)pSource ); -} - -void SvIconView::ModelIsRemoving( SvListEntry* pEntry ) -{ - pImp->RemovingEntry( (SvLBoxEntry*)pEntry ); - NotifyRemoving( (SvLBoxEntry*)pEntry ); -} - -void SvIconView::ModelHasRemoved( SvListEntry* /* pEntry */ ) -{ - pImp->EntryRemoved(); -} - -void SvIconView::ModelHasEntryInvalidated( SvListEntry* pEntry ) -{ - // die einzelnen Items des Entries reinitialisieren - SvLBox::ModelHasEntryInvalidated( pEntry ); - // painten - pImp->ModelHasEntryInvalidated( pEntry ); -} - -void SvIconView::ShowTargetEmphasis( SvLBoxEntry* pEntry, sal_Bool bShow ) -{ - pImp->ShowTargetEmphasis( pEntry, bShow ); -} - -Point SvIconView::GetEntryPosition( SvLBoxEntry* pEntry ) const -{ - return ((SvIconView*)this)->pImp->GetEntryPosition( pEntry ); -} - -void SvIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos) -{ - pImp->SetEntryPosition( pEntry, rPos, sal_False, sal_True ); -} - -void SvIconView::SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos, sal_Bool bAdjustAtGrid ) -{ - pImp->SetEntryPosition( pEntry, rPos, bAdjustAtGrid ); -} - -void SvIconView::SetFont( const Font& rFont ) -{ - Font aTempFont( rFont ); - aTempFont.SetTransparent( sal_True ); - SvLBox::SetFont( aTempFont ); - RecalcViewData(); - pImp->ChangedFont(); -} - -void SvIconView::ViewDataInitialized( SvLBoxEntry* pEntry ) -{ - pImp->ViewDataInitialized( pEntry ); -} - -SvLBoxEntry* SvIconView::GetDropTarget( const Point& rPos ) -{ - return pImp->GetDropTarget( rPos ); -} - -SvLBoxEntry* SvIconView::GetEntry( const Point& rPixPos, sal_Bool ) const -{ - Point aPos( rPixPos ); - aPos -= GetMapMode().GetOrigin(); - return ((SvIconView*)this)->pImp->GetEntry( aPos ); -} - -SvLBoxEntry* SvIconView::GetEntryFromLogicPos( const Point& rDocPos ) const -{ - return ((SvIconView*)this)->pImp->GetEntry( rDocPos ); -} - - -void SvIconView::StateChanged( StateChangedType i_nStateChange ) -{ - SvLBox::StateChanged( i_nStateChange ); - if ( i_nStateChange == STATE_CHANGE_STYLE ) - pImp->SetStyle( GetStyle() ); -} - -void SvIconView::PaintEntry( SvLBoxEntry* pEntry ) -{ - pImp->PaintEntry( pEntry ); -} - - -void SvIconView::PaintEntry( SvLBoxEntry* pEntry, const Point& rPos ) -{ - pImp->PaintEntry( pEntry, rPos ); -} - -Rectangle SvIconView::GetFocusRect( SvLBoxEntry* pEntry ) -{ - return pImp->CalcFocusRect( pEntry ); -} - -void SvIconView::InvalidateEntry( SvLBoxEntry* pEntry ) -{ - pImp->InvalidateEntry( pEntry ); -} - -void SvIconView::SetDragDropMode( DragDropMode nDDMode ) -{ - SvLBox::SetDragDropMode( nDDMode ); - pImp->SetDragDropMode( nDDMode ); -} - -void SvIconView::SetSelectionMode( SelectionMode eSelectMode ) -{ - SvLBox::SetSelectionMode( eSelectMode ); - pImp->SetSelectionMode( eSelectMode ); -} - -sal_Bool SvIconView::Select( SvLBoxEntry* pEntry, sal_Bool bSelect ) -{ - EndEditing(); - sal_Bool bRetVal = SvListView::Select( pEntry, bSelect ); - if( bRetVal ) - { - pImp->EntrySelected( pEntry, bSelect ); - pHdlEntry = pEntry; - SelectHdl(); - } - return bRetVal; -} - -void SvIconView::SelectAll( sal_Bool bSelect, sal_Bool ) -{ - SvLBoxEntry* pEntry = pImp->GetCurParent(); - pEntry = FirstChild( pEntry ); - while( pEntry ) - { - Select( pEntry, bSelect ); - pEntry = NextSibling( pEntry ); - } -} - -void SvIconView::SetCurEntry( SvLBoxEntry* _pEntry ) -{ - pImp->SetCursor( _pEntry ); - OnCurrentEntryChanged(); -} - -SvLBoxEntry* SvIconView::GetCurEntry() const -{ - return pImp->GetCurEntry(); -} - -void SvIconView::Arrange() -{ -#ifdef DBG_UTIL - sal_uInt16 n=1; - if( n == 1 && n-1 == 0 ) - { - pImp->Arrange(); - } - else - { - pImp->AdjustAtGrid(); - } -#else - pImp->Arrange(); -#endif -} - - -void SvIconView::SetSpaceBetweenEntries( long nX, long nY ) -{ - pImp->SetSpaceBetweenEntries( nX, nY ); -} - -sal_Bool SvIconView::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ) -{ - return pImp->NotifyMoving(pTarget,pEntry,rpNewParent,rNewChildPos); -} - -sal_Bool SvIconView::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, - SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ) -{ - return pImp->NotifyCopying(pTarget,pEntry,rpNewParent,rNewChildPos); -} - - -void SvIconView::EnableInplaceEditing( sal_Bool bEnable ) -{ - SvLBox::EnableInplaceEditing( bEnable ); -} - -void SvIconView::EditingRequest( SvLBoxEntry* pEntry, SvLBoxItem* pItem, - const Point& ) -{ - if ( pItem->IsA() == SV_ITEM_ID_LBOXSTRING ) - { - Selection aSel( SELECTION_MIN, SELECTION_MAX ); - if ( EditingEntry( pEntry, aSel ) ) - { - SelectAll( sal_False ); - EditItemText( pEntry, (SvLBoxString*)pItem, aSel ); - } - } -} - - -void SvIconView::EditItemText( SvLBoxEntry* pEntry, SvLBoxItem* pItem, - const Selection& rSel ) -{ - DBG_ASSERT(pEntry&&pItem,"EditItemText:Params?"); - pCurEdEntry = pEntry; - pCurEdItem = pItem; - Rectangle aRect( pImp->CalcTextRect( pEntry, (SvLBoxString*)pItem,0,sal_True )); - - aRect.Bottom() += 4; - pImp->MakeVisible( aRect ); // vor der Umrechnung in Pixel-Koord. rufen! - aRect.Bottom() -= 4; - - Point aPos( aRect.TopLeft() ); - aPos += GetMapMode().GetOrigin(); // Dok-Koord. -> Window-Koord. - aRect.SetPos( aPos ); - - aRect.Bottom() += 2; // sieht huebscher aus - - EditText( ((SvLBoxString*)pItem)->GetText(), aRect, rSel, sal_True ); -} - -void SvIconView::EditEntry( SvLBoxEntry* pEntry ) -{ - if( !pEntry ) - pEntry = pImp->GetCurEntry(); - if( pEntry ) - { - SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - if( pItem ) - { - Selection aSel( SELECTION_MIN, SELECTION_MAX ); - if( EditingEntry( pEntry, aSel ) ) - { - SelectAll( sal_False ); - EditItemText( pEntry, pItem, aSel ); - } - } - } -} - -void SvIconView::EditedText( const XubString& rStr ) -{ - XubString aRefStr( ((SvLBoxString*)pCurEdItem)->GetText() ); - if ( EditedEntry( pCurEdEntry, rStr ) ) - { - ((SvLBoxString*)pCurEdItem)->SetText( pCurEdEntry, rStr ); - pModel->InvalidateEntry( pCurEdEntry ); - } - if( GetSelectionMode()==SINGLE_SELECTION && !GetSelectionCount()) - Select( pCurEdEntry ); -} - - -sal_Bool SvIconView::EditingEntry( SvLBoxEntry*, Selection& ) -{ - return sal_True; -} - -sal_Bool SvIconView::EditedEntry( SvLBoxEntry*, const XubString& ) -{ - return sal_True; -} - - -void SvIconView::WriteDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo) -{ - pImp->WriteDragServerInfo( rPos, pInfo ); -} - -void SvIconView::ReadDragServerInfo( const Point& rPos, SvLBoxDDInfo* pInfo ) -{ - pImp->ReadDragServerInfo( rPos, pInfo ); -} - -void SvIconView::Command( const CommandEvent& rCEvt ) -{ - pImp->PrepareCommandEvent( rCEvt.GetMousePosPixel() ); -} - -void SvIconView::SetCurParent( SvLBoxEntry* pNewParent ) -{ - if ( pNewParent && pNewParent->HasChildsOnDemand() ) - RequestingChilds( pNewParent ); - pImp->SetCurParent( pNewParent ); -} - -SvLBoxEntry* SvIconView::GetCurParent() const -{ - return pImp->GetCurParent(); -} - -SvViewData* SvIconView::CreateViewData( SvListEntry* ) -{ - SvIcnVwDataEntry* pEntryData = new SvIcnVwDataEntry; - return (SvViewData*)pEntryData; -} - -void SvIconView::InitViewData( SvViewData* pData, SvListEntry* pEntry ) -{ - SvLBox::InitViewData( pData, pEntry ); - pImp->InvalidateBoundingRect( ((SvIcnVwDataEntry*)pData)->aRect ); -} - -Region SvIconView::GetDragRegion() const -{ - Rectangle aRect; - SvLBoxEntry* pEntry = GetCurEntry(); - if( pEntry ) - aRect = pImp->GetBoundingRect( pEntry ); - Region aRegion( aRect ); - return aRegion; -} - -sal_uLong SvIconView::GetSelectionCount() const -{ - return (sal_uLong)(pImp->GetSelectionCount()); -} - -void SvIconView::SetGrid( long nDX, long nDY ) -{ - pImp->SetGrid( nDX, nDY ); -} - -void SvIconView::ModelNotification( sal_uInt16 nActionId, SvListEntry* pEntry1, - SvListEntry* pEntry2, sal_uLong nPos ) -{ - SvLBox::ModelNotification( nActionId, pEntry1, pEntry2, nPos ); - switch( nActionId ) - { - case LISTACTION_RESORTING: - SetUpdateMode( sal_False ); - break; - - case LISTACTION_RESORTED: - SetUpdateMode( sal_True ); - Arrange(); - break; - - case LISTACTION_CLEARED: - if( IsUpdateMode() ) - Update(); - break; - } -} - - -void SvIconView::Scroll( long nDeltaX, long nDeltaY, sal_uInt16 ) -{ - pImp->Scroll( nDeltaX, nDeltaY, sal_False ); -} - -void SvIconView::PrepareCommandEvent( const CommandEvent& rCEvt ) -{ - pImp->PrepareCommandEvent( rCEvt.GetMousePosPixel() ); -} - -void SvIconView::StartDrag( sal_Int8 nAction, const Point& rPos ) -{ - pImp->SttDrag( rPos ); - SvLBoxEntry* pEntry = GetEntry( rPos, sal_True ); - pImp->mpViewData = pEntry; - SvLBox::StartDrag( nAction, rPos ); -} - -void SvIconView::DragFinished( sal_Int8 ) -{ - pImp->EndDrag(); -} - -sal_Int8 SvIconView::AcceptDrop( const AcceptDropEvent& rEvt ) -{ - if( pImp->mpViewData ) - pImp->HideDDIcon(); - sal_Int8 nRet = SvLBox::AcceptDrop( rEvt ); - if( DND_ACTION_NONE != nRet ) - pImp->ShowDDIcon( pImp->mpViewData, rEvt.maPosPixel ); - - return nRet; -} - -sal_Int8 SvIconView::ExecuteDrop( const ExecuteDropEvent& rEvt ) -{ - if( pImp->mpViewData ) - { - pImp->HideDDIcon(); - pImp->mpViewData = 0; - } - return SvLBox::ExecuteDrop( rEvt ); -} - -void SvIconView::ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ) -{ - pImp->ShowDDIcon( pRefEntry, rPos ); -} - -void SvIconView::HideDDIcon() -{ - pImp->HideDDIcon(); -} - -void SvIconView::HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos ) -{ - pImp->HideShowDDIcon( pRefEntry, rPos ); -} - -void SvIconView::SelectRect( const Rectangle& rRect, sal_Bool bAdd, - SvPtrarr* pRects, short nOffs ) -{ - pImp->SelectRect( rRect, bAdd, pRects, nOffs ); -} - -void SvIconView::CalcScrollOffsets( const Point& rRefPosPixel, long& rX, long& rY, - sal_Bool b, sal_uInt16 nBorderWidth ) -{ - pImp->CalcScrollOffsets( rRefPosPixel, rX, rY, b, nBorderWidth ); -} - -void SvIconView::EndTracking() -{ - pImp->EndTracking(); -} - -void SvIconView::MakeVisible( SvLBoxEntry* pEntry ) -{ - pImp->MakeVisible( pEntry ); -} - -void SvIconView::PreparePaint( SvLBoxEntry* ) -{ -} - -void SvIconView::AdjustAtGrid( SvLBoxEntry* pEntry ) -{ - pImp->AdjustAtGrid( pEntry ); -} - -void SvIconView::LockEntryPos( SvLBoxEntry* pEntry, sal_Bool bLock ) -{ - SvIcnVwDataEntry* pViewData = (SvIcnVwDataEntry*)GetViewData( pEntry ); - if( bLock ) - pViewData->SetVwFlags( ICNVW_FLAG_POS_LOCKED ); - else - pViewData->ClearVwFlags( ICNVW_FLAG_POS_LOCKED ); -} - -sal_Bool SvIconView::IsEntryPosLocked( const SvLBoxEntry* pEntry ) const -{ - const SvIcnVwDataEntry* pViewData = (const SvIcnVwDataEntry*)GetViewData( (SvListEntry*)pEntry ); - return pViewData->IsEntryPosLocked(); -} - -void SvIconView::SetTextMode( SvIconViewTextMode eMode, SvLBoxEntry* pEntry ) -{ - pImp->SetTextMode( eMode, pEntry ); -} - -SvIconViewTextMode SvIconView::GetTextMode( const SvLBoxEntry* pEntry ) const -{ - return pImp->GetTextMode( pEntry ); -} - -SvLBoxEntry* SvIconView::GetNextEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const -{ - Point aPos( rPixPos ); - aPos -= GetMapMode().GetOrigin(); - return ((SvIconView*)this)->pImp->GetNextEntry( aPos, pCurEntry ); -} - -SvLBoxEntry* SvIconView::GetPrevEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, sal_Bool ) const -{ - Point aPos( rPixPos ); - aPos -= GetMapMode().GetOrigin(); - return ((SvIconView*)this)->pImp->GetPrevEntry( aPos, pCurEntry ); -} - -void SvIconView::ShowFocusRect( const SvLBoxEntry* pEntry ) -{ - pImp->ShowFocusRect( pEntry ); -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx deleted file mode 100644 index 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include -#include -#include -#ifdef DBG_UTIL -#include -#endif - -#include -#include -#include -#include -#include - - - -#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-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: */ -- cgit v1.2.3