diff options
760 files changed, 16236 insertions, 2875 deletions
diff --git a/starmath/inc/action.hxx b/starmath/inc/action.hxx index 221b3a579d..33e5a7f4f5 100644 --- a/starmath/inc/action.hxx +++ b/starmath/inc/action.hxx @@ -30,7 +30,7 @@ #ifndef ACTION_HXX #define ACTION_HXX -#include <svtools/undo.hxx> +#include <svl/undo.hxx> #include "format.hxx" class SmDocShell; diff --git a/starmath/inc/config.hxx b/starmath/inc/config.hxx index 7bc3b848ac..2af382d399 100644 --- a/starmath/inc/config.hxx +++ b/starmath/inc/config.hxx @@ -30,8 +30,8 @@ #ifndef CONFIG_HXX #define CONFIG_HXX -#include <svtools/brdcst.hxx> -#include <svtools/lstner.hxx> +#include <svl/brdcst.hxx> +#include <svl/lstner.hxx> #include "format.hxx" #include "cfgitem.hxx" diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx index 3f015a924e..145d4cf616 100644 --- a/starmath/inc/document.hxx +++ b/starmath/inc/document.hxx @@ -35,7 +35,7 @@ #include <sot/storage.hxx> #include <sot/sotref.hxx> #include <sfx2/objsh.hxx> -#include <svtools/lstner.hxx> +#include <svl/lstner.hxx> #include <sfx2/docfac.hxx> #include <vcl/virdev.hxx> #include "format.hxx" diff --git a/starmath/inc/format.hxx b/starmath/inc/format.hxx index 326b2159cb..4d30b5252e 100644 --- a/starmath/inc/format.hxx +++ b/starmath/inc/format.hxx @@ -31,8 +31,8 @@ #define FORMAT_HXX -#include <svtools/smplhint.hxx> -#include <svtools/brdcst.hxx> +#include <svl/smplhint.hxx> +#include <svl/brdcst.hxx> #include "utility.hxx" #include <types.hxx> diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index ced91cc7f6..e7d947cf27 100644 --- a/starmath/inc/smmod.hxx +++ b/starmath/inc/smmod.hxx @@ -34,7 +34,7 @@ #ifndef _SV_RESARY_HXX #include <tools/resary.hxx> #endif -#include <svtools/lstner.hxx> +#include <svl/lstner.hxx> #include <svtools/colorcfg.hxx> #include <tools/shl.hxx> @@ -44,6 +44,8 @@ #include "starmath.hrc" #endif +#include <unotools/options.hxx> + class SvxErrorHandler; class SfxObjectFactory; class SmConfig; @@ -124,7 +126,7 @@ public: ///////////////////////////////////////////////////////////////// -class SmModule : public SfxModule, public SfxListener +class SmModule : public SfxModule, utl::ConfigurationListener { svtools::ColorConfig *pColorConfig; SmConfig *pConfig; @@ -145,8 +147,7 @@ public: SmModule(SfxObjectFactory* pObjFact); virtual ~SmModule(); - // SfxListener - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); svtools::ColorConfig & GetColorConfig(); diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc index 854584e11d..d6a894258a 100644 --- a/starmath/inc/starmath.hrc +++ b/starmath/inc/starmath.hrc @@ -31,7 +31,7 @@ #define _STARMATH_HRC #ifndef _SVX_SVXIDS_HRC -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #endif #ifndef _SFXSIDS_HRC //autogen #include <sfx2/sfxsids.hrc> diff --git a/starmath/inc/symbol.hxx b/starmath/inc/symbol.hxx index 2be59e453c..f2949aa5f5 100644 --- a/starmath/inc/symbol.hxx +++ b/starmath/inc/symbol.hxx @@ -37,8 +37,8 @@ #include <tools/list.hxx> #include <tools/debug.hxx> #include <tools/dynary.hxx> -#include <svtools/lstner.hxx> -#include <svtools/svarray.hxx> +#include <svl/lstner.hxx> +#include <svl/svarray.hxx> #include "utility.hxx" #include <smmod.hxx> diff --git a/starmath/sdi/makefile.mk b/starmath/sdi/makefile.mk index 768280af97..f868756f59 100644 --- a/starmath/sdi/makefile.mk +++ b/starmath/sdi/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -46,8 +46,12 @@ SVSDIINC=$(PRJ)$/inc SDI1NAME=$(TARGET) SVSDI1DEPEND= \ - $(SOLARINCDIR)$/svxslots.ilb \ - smath.sdi \ + $(SOLARINCXDIR)$/sfx2/sfx.sdi \ + $(SOLARINCXDIR)$/sfx2/sfxitems.sdi \ + $(SOLARINCXDIR)$/svx/svx.sdi \ + $(SOLARINCXDIR)$/svx/svxitems.sdi \ + $(SOLARINCXDIR)$/svx/xoitems.sdi \ + smath.sdi \ smslots.sdi \ $(SVSDIINC)$/starmath.hrc diff --git a/starmath/sdi/svxitems.sdi b/starmath/sdi/smitems.sdi index a071a52f83..a071a52f83 100644 --- a/starmath/sdi/svxitems.sdi +++ b/starmath/sdi/smitems.sdi diff --git a/starmath/sdi/smslots.sdi b/starmath/sdi/smslots.sdi index d0ae79a7f5..88bd108bdd 100644 --- a/starmath/sdi/smslots.sdi +++ b/starmath/sdi/smslots.sdi @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,8 +28,6 @@ * ************************************************************************/ -import "svxslots.ilb" - module "312C4240-35E7-101C-B12A-04021C007002" "58216740-35E7-101C-B12A-04021C007002" @@ -39,9 +37,13 @@ StarMath SlotIdFile ( "starmath.hrc" ) SlotIdFile ( "sfx2/sfxsids.hrc" ) SlotIdFile ( "svx/svxids.hrc" ) - TypeLibFile ( "smslots.tlb" ) ] { + include "sfx2/sfxitems.sdi" + include "sfx2/sfx.sdi" + include "svx/svxitems.sdi" + include "svx/xoitems.sdi" + include "svx/svx.sdi" include "smath.sdi" interface StarMath [ @@ -59,7 +61,7 @@ shell SmModule import StarMath[Automation]; } -interface FormulaDocument : OfficeDocument +interface FormulaDocument [ uuid ( "815CBB20-2FC3-11CF-89CA-008029E4B0B1" ) ] @@ -149,13 +151,13 @@ interface FormulaDocument : OfficeDocument ] } -shell SmDocShell : SfxObjectShell +shell SmDocShell { import FormulaDocument[Automation]; } -interface FormulaView : View +interface FormulaView [ uuid ( "CE1A6C00-2FC3-11CF-89CA-008029E4B0B1" ) ] @@ -323,7 +325,7 @@ interface FormulaView : View ] } -shell SmViewShell : SfxViewShell +shell SmViewShell { import FormulaView[Automation]; } diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx index 355a2baab2..ec5c005d68 100644 --- a/starmath/source/accessibility.cxx +++ b/starmath/source/accessibility.cxx @@ -51,7 +51,7 @@ #include <vcl/unohelp2.hxx> #include <tools/gen.hxx> #include <vos/mutex.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <svx/editobj.hxx> #include <svx/editdata.hxx> diff --git a/starmath/source/accessibility.hxx b/starmath/source/accessibility.hxx index 335551aa5d..3c0c3fcc63 100644 --- a/starmath/source/accessibility.hxx +++ b/starmath/source/accessibility.hxx @@ -52,7 +52,7 @@ #include <cppuhelper/interfacecontainer.h> #include <cppuhelper/implbase5.hxx> #include <cppuhelper/implbase6.hxx> -#include <svtools/brdcst.hxx> +#include <svl/brdcst.hxx> #include <svx/editeng.hxx> #include <svx/unoedsrc.hxx> // SvxEditSource, SvxTextForwarder, SvxViewForwarder, SvxEditViewForwarder diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 9d34209aff..693fe32fa2 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -1279,6 +1279,8 @@ void SmMathConfig::SetShowFormulaCursor( BOOL bVal ) SetOtherIfNotEqual( pOther->bFormulaCursor, bVal ); } +void SmMathConfig::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) +{} ///////////////////////////////////////////////////////////////// diff --git a/starmath/source/cfgitem.hxx b/starmath/source/cfgitem.hxx index 7b5029f990..bc62a7a6d3 100644 --- a/starmath/source/cfgitem.hxx +++ b/starmath/source/cfgitem.hxx @@ -44,7 +44,7 @@ #include <tools/solar.h> #include <rtl/ustring.hxx> #include <unotools/configitem.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <vcl/timer.hxx> #include <symbol.hxx> @@ -174,7 +174,7 @@ public: virtual ~SmMathConfig(); // utl::ConfigItem - //virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames ); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames ); virtual void Commit(); // make some protected functions of utl::ConfigItem public diff --git a/starmath/source/config.cxx b/starmath/source/config.cxx index 1ebd6d65bf..3a8034f51f 100644 --- a/starmath/source/config.cxx +++ b/starmath/source/config.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -32,15 +32,15 @@ #include "precompiled_starmath.hxx" -#include <svtools/itemset.hxx> -#include <svtools/hint.hxx> -#include <svtools/smplhint.hxx> -#include <svtools/pathoptions.hxx> +#include <svl/itemset.hxx> +#include <svl/hint.hxx> +#include <svl/smplhint.hxx> +#include <unotools/pathoptions.hxx> #include <sfx2/sfxsids.hrc> -#include <svtools/eitem.hxx> -#include <svtools/itempool.hxx> -#include <svtools/stritem.hxx> -#include <svtools/intitem.hxx> +#include <svl/eitem.hxx> +#include <svl/itempool.hxx> +#include <svl/stritem.hxx> +#include <svl/intitem.hxx> #include <tools/stream.hxx> diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 6b9a0ced72..fe16822b6e 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -34,9 +34,9 @@ #define SMDLL 1 #include "tools/rcid.h" -#include <svtools/eitem.hxx> -#include <svtools/intitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> +#include <svl/stritem.hxx> #include <sfx2/app.hxx> #include <vcl/msgbox.hxx> #include <svtools/ctrltool.hxx> @@ -396,9 +396,9 @@ void SmFontDialog::InitColor_Impl() #endif ColorData nBgCol = COL_WHITE, nTxtCol = COL_BLACK; - if (GetDisplayBackground().GetColor().IsDark()) + const StyleSettings &rS = GetSettings().GetStyleSettings(); + if (rS.GetHighContrastMode()) { - const StyleSettings &rS = GetSettings().GetStyleSettings(); nBgCol = rS.GetFieldColor().GetColor(); nTxtCol = rS.GetFieldTextColor().GetColor(); } @@ -967,7 +967,7 @@ SmDistanceDialog::~SmDistanceDialog() void SmDistanceDialog::ApplyImages() { - BOOL bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + BOOL bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); for (int i = 0; i < NOCATEGORIES; ++i) { SmCategoryDesc *pCat = Categories[i]; @@ -1551,9 +1551,9 @@ void SmSymbolDialog::InitColor_Impl() #endif ColorData nBgCol = COL_WHITE, nTxtCol = COL_BLACK; - if (GetDisplayBackground().GetColor().IsDark()) + const StyleSettings &rS = GetSettings().GetStyleSettings(); + if (rS.GetHighContrastMode()) { - const StyleSettings &rS = GetSettings().GetStyleSettings(); nBgCol = rS.GetFieldColor().GetColor(); nTxtCol = rS.GetFieldTextColor().GetColor(); } @@ -2180,7 +2180,7 @@ void SmSymDefineDialog::InitColor_Impl() #endif ColorData nBgCol = COL_WHITE, nTxtCol = COL_BLACK; - BOOL bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + BOOL bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); if (bHighContrast) { const StyleSettings &rS = GetSettings().GetStyleSettings(); diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 48e5f8f71f..cc85df6aa7 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -55,22 +55,22 @@ #include <sot/exchange.hxx> #include <sot/formats.hxx> #include <sot/storage.hxx> -#include <svtools/eitem.hxx> -#include <svtools/fstathelper.hxx> -#include <svtools/intitem.hxx> -#include <svtools/itempool.hxx> -#include <svtools/lingucfg.hxx> -#include <svtools/linguprops.hxx> -#include <svtools/pathoptions.hxx> -#include <svtools/ptitem.hxx> +#include <svl/eitem.hxx> +#include <svl/fstathelper.hxx> +#include <svl/intitem.hxx> +#include <svl/itempool.hxx> +#include <unotools/lingucfg.hxx> +#include <unotools/linguprops.hxx> +#include <unotools/pathoptions.hxx> +#include <svl/ptitem.hxx> #include <svtools/sfxecode.hxx> -#include <svtools/slstitm.hxx> -#include <svtools/smplhint.hxx> -#include <svtools/stritem.hxx> +#include <svl/slstitm.hxx> +#include <svl/smplhint.hxx> +#include <svl/stritem.hxx> #include <svtools/transfer.hxx> -#include <svtools/undo.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/whiter.hxx> +#include <svl/undo.hxx> +#include <svl/urihelper.hxx> +#include <svl/whiter.hxx> #include <svx/editeng.hxx> #include <svx/editstat.hxx> #include <svx/eeitem.hxx> @@ -467,7 +467,7 @@ void SmDocShell::Draw(OutputDevice &rDev, Point &rPosition) ULONG nOldDrawMode = DRAWMODE_DEFAULT; BOOL bRestoreDrawMode = FALSE; if (OUTDEV_WINDOW == rDev.GetOutDevType() && - ((Window &) rDev).GetDisplayBackground().GetColor().IsDark()) + ((Window &) rDev).GetSettings().GetStyleSettings().GetHighContrastMode()) { nOldDrawMode = rDev.GetDrawMode(); rDev.SetDrawMode( DRAWMODE_DEFAULT ); @@ -823,7 +823,7 @@ BOOL SmDocShell::Load( SfxMedium& rMedium ) xStorage->isStreamElement( C2S( "content.xml" ) ) ) || ( - xAccess->hasByName( C2S( "Content.xml" ) ) && + xAccess->hasByName( C2S( "Content.xml" ) ) && xStorage->isStreamElement( C2S( "Content.xml" ) ) ) ) diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 0e4542b96e..6e9a1827f3 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -52,13 +52,13 @@ #include <svx/editstat.hxx> #include <svx/eeitem.hxx> #include <sfx2/dispatch.hxx> -#include <svtools/intitem.hxx> -#include <svtools/itempool.hxx> -#include <svtools/stritem.hxx> +#include <svl/intitem.hxx> +#include <svl/itempool.hxx> +#include <svl/stritem.hxx> #include <svx/fhgtitem.hxx> #include <svx/wghtitem.hxx> #include <svx/lrspitem.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <svx/fontitem.hxx> #include <sfx2/viewfrm.hxx> diff --git a/starmath/source/math_pch.cxx b/starmath/source/math_pch.cxx index 89d129b81c..7a58e8aa62 100644 --- a/starmath/source/math_pch.cxx +++ b/starmath/source/math_pch.cxx @@ -48,11 +48,11 @@ #include <tools/rtti.hxx> #include <tools/ref.hxx> #include <tools/link.hxx> -#include <svtools/brdcst.hxx> -#include <svtools/svarray.hxx> +#include <svl/brdcst.hxx> +#include <svl/svarray.hxx> #include <tools/debug.hxx> -#include <svtools/hint.hxx> -#include <svtools/smplhint.hxx> +#include <svl/hint.hxx> +#include <svl/smplhint.hxx> #include <sot/sotref.hxx> #include <tools/globname.hxx> #include <sot/factory.hxx> @@ -130,9 +130,9 @@ #include <smdll.hxx> #include <sfx2/sfxsids.hrc> #include <chaos/cntids.hrc> -#include <svtools/cntwids.hrc> -#include <svtools/solar.hrc> -#include <svtools/lstner.hxx> +#include <svl/cntwids.hrc> +#include <svl/solar.hrc> +#include <svl/lstner.hxx> #include <starmath.hrc> #include <basic/sbx.hxx> #include <basic/sbxform.hxx> @@ -143,7 +143,7 @@ #include <basic/sbxmeth.hxx> #include <tools/unqid.hxx> #include <tools/unqidx.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <svtools/args.hxx> #include <smmod.hxx> #include <vos/thread.hxx> @@ -156,7 +156,7 @@ #include <vcl/timer.hxx> #include <sfx2/app.hxx> #include <sfx2/sfx.hrc> -#include <svtools/memberid.hrc> +#include <svl/memberid.hrc> #include <vcl/syswin.hxx> #include <vcl/virdev.hxx> #include <tools/datetime.hxx> @@ -736,7 +736,7 @@ #endif #include <usr/refl.hxx> #include <sfx2/msg.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <sfx2/basedlgs.hxx> #include <vcl/floatwin.hxx> #include <vcl/dialog.hxx> @@ -745,10 +745,10 @@ #include <sfx2/frame.hxx> #include <sfx2/objface.hxx> #include <vcl/event.hxx> -#include <svtools/eitem.hxx> -#include <svtools/intitem.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> #include <symbol.hxx> -#include <svtools/itempool.hxx> +#include <svl/itempool.hxx> #include <vcl/image.hxx> #include <vcl/metric.hxx> #include <sfx2/inimgr.hxx> @@ -756,14 +756,14 @@ #include <tools/pstm.hxx> #include <tools/table.hxx> #include <sfx2/docfac.hxx> -#include <svtools/ownlist.hxx> +#include <svl/ownlist.hxx> #include <sfx2/objsh.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <vcl/mapmod.hxx> #include <sfx2/ipfrm.hxx> #include <vcl/dialog.hxx> #include <sfx2/dispatch.hxx> -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <sfx2/bindings.hxx> #include <dialog.hxx> #include <vcl/button.hxx> @@ -822,9 +822,9 @@ #include <vcl/toolbox.hxx> #include <vcl/dockwin.hxx> #include <smslots.hxx> -#include <svtools/undo.hxx> +#include <svl/undo.hxx> #include <sfx2/request.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <vcl/prntypes.hxx> #include <vcl/jobset.hxx> #include <vcl/gdimtf.hxx> diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index 9ddabab9c3..c9b12abcdb 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -1,7 +1,7 @@ /*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -61,9 +61,9 @@ #include <tools/debug.hxx>
#include <tools/urlobj.hxx>
#include <svtools/sfxecode.hxx>
-#include <svtools/saveopt.hxx>
-#include <svtools/stritem.hxx>
-#include <svtools/itemprop.hxx>
+#include <unotools/saveopt.hxx>
+#include <svl/stritem.hxx>
+#include <svl/itemprop.hxx>
#include <unotools/processfactory.hxx>
#include <unotools/streamwrap.hxx>
#include <xmloff/xmlnmspe.hxx>
@@ -403,8 +403,8 @@ SmXMLExport::SmXMLExport( {
}
-sal_Int64 SAL_CALL SmXMLExport::getSomething(
- const uno::Sequence< sal_Int8 >& rId )
+sal_Int64 SAL_CALL SmXMLExport::getSomething(
+ const uno::Sequence< sal_Int8 >& rId )
throw(uno::RuntimeException)
{
if ( rId.getLength() == 16 &&
@@ -833,7 +833,7 @@ void SmXMLExport::ExportTable(const SmNode *pNode, int nLevel) if (nSize >= 1 && pNode->GetSubNode(nSize-1)->GetNumSubNodes() == 0)
--nSize;
- // try to avoid creating a mtable element when the formula consists only
+ // try to avoid creating a mtable element when the formula consists only
// of a single output line
if (nLevel || (nSize >1))
pTable = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MTABLE, sal_True, sal_True);
@@ -902,7 +902,7 @@ void SmXMLExport::ExportText(const SmNode *pNode, int /*nLevel*/) void SmXMLExport::ExportBlank(const SmNode * /*pNode*/, int /*nLevel*/)
{
- //!! exports an empty <mi> tag since for example "~_~" is allowed in
+ //!! exports an empty <mi> tag since for example "~_~" is allowed in
//!! Math (so it has no sense at all) but must not result in an empty
//!! <msub> tag in MathML !!
@@ -910,7 +910,7 @@ void SmXMLExport::ExportBlank(const SmNode * /*pNode*/, int /*nLevel*/) //const SmBlankNode *pTemp = static_cast<const SmBlankNode *>(pNode);
pText = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MI, sal_True, sal_False);
-
+
GetDocHandler()->characters( OUString() );
delete pText;
}
@@ -1203,10 +1203,10 @@ void SmXMLExport::ExportAttributes(const SmNode *pNode, int nLevel) static bool lcl_HasEffectOnMathvariant( const SmTokenType eType )
{
- return eType == TBOLD || eType == TNBOLD ||
+ return eType == TBOLD || eType == TNBOLD ||
eType == TITALIC || eType == TNBOLD ||
eType == TSANS || eType == TSERIF || eType == TFIXED;
-}
+}
void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel)
{
@@ -1480,7 +1480,7 @@ void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel) // thus at least it will not vanish into nothing
ExportText(pNode, nLevel);
}
- else
+ else
{
//To fully handle generic MathML we need to implement the full
//operator dictionary, we will generate MathML with explicit
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index e7f0c6d7c5..56b35a96c6 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -57,9 +57,9 @@ one go*/ #include <tools/debug.hxx> #include <tools/urlobj.hxx> #include <svtools/sfxecode.hxx> -#include <svtools/saveopt.hxx> -#include <svtools/stritem.hxx> -#include <svtools/itemprop.hxx> +#include <unotools/saveopt.hxx> +#include <svl/stritem.hxx> +#include <svl/itemprop.hxx> #include <unotools/processfactory.hxx> #include <unotools/streamwrap.hxx> #include <xmloff/xmlnmspe.hxx> @@ -337,7 +337,7 @@ ULONG SmXMLImportWrapper::ReadThroughComponent( packages::zip::ZipIOException aBrokenPackage; if ( aSaxEx.WrappedException >>= aBrokenPackage ) return ERRCODE_IO_BROKENPACKAGE; - + if ( bEncrypted ) nError = ERRCODE_SFX_WRONGPASSWORD; } @@ -346,7 +346,7 @@ ULONG SmXMLImportWrapper::ReadThroughComponent( packages::zip::ZipIOException aBrokenPackage; if ( r.WrappedException >>= aBrokenPackage ) return ERRCODE_IO_BROKENPACKAGE; - + if ( bEncrypted ) nError = ERRCODE_SFX_WRONGPASSWORD; } @@ -553,8 +553,8 @@ rtl::OUString SAL_CALL SmXMLImport::getImplementationName() } -sal_Int64 SAL_CALL SmXMLImport::getSomething( - const uno::Sequence< sal_Int8 >&rId ) +sal_Int64 SAL_CALL SmXMLImport::getSomething( + const uno::Sequence< sal_Int8 >&rId ) throw(uno::RuntimeException) { if ( rId.getLength() == 16 && @@ -625,17 +625,17 @@ public: SmXMLImportContext( SmXMLImport &rImport, sal_uInt16 nPrfx, const OUString& rLName) : SvXMLImportContext(rImport, nPrfx, rLName) {} - + const SmXMLImport& GetSmImport() const { return (const SmXMLImport&)GetImport(); } - + SmXMLImport& GetSmImport() { return (SmXMLImport&)GetImport(); } - + virtual void TCharacters(const OUString & /*rChars*/); virtual void Characters(const OUString &rChars); virtual SvXMLImportContext *CreateChildContext(sal_uInt16 /*nPrefix*/, const OUString& /*rLocalName*/, const uno::Reference< xml::sax::XAttributeList > & /*xAttrList*/); @@ -644,7 +644,7 @@ public: void SmXMLImportContext::TCharacters(const OUString & /*rChars*/) { } - + void SmXMLImportContext::Characters(const OUString &rChars) { /* @@ -678,10 +678,10 @@ struct SmXMLContext_Helper OUString sColor; SmXMLImportContext rContext; - - SmXMLContext_Helper(SmXMLImportContext &rImport) : + + SmXMLContext_Helper(SmXMLImportContext &rImport) : nIsBold(-1), nIsItalic(-1), nFontSize(0.0), rContext(rImport) {} - + void RetrieveAttrs(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); void ApplyAttrs(); }; @@ -845,9 +845,9 @@ public: SmXMLDocContext_Impl( SmXMLImport &rImport, sal_uInt16 nPrfx, const OUString& rLName) : SmXMLImportContext(rImport,nPrfx,rLName) {} - + virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList); - + void EndElement(); }; @@ -864,13 +864,13 @@ public: const OUString& rLName) : SmXMLDocContext_Impl(rImport,nPrefix,rLName) { nElementCount = GetSmImport().GetNodeStack().Count(); } - + virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList); - + SvXMLImportContext *StrictCreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList); - + void EndElement(); }; @@ -882,7 +882,7 @@ public: SmXMLFracContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - + void EndElement(); }; @@ -894,7 +894,7 @@ public: SmXMLSqrtContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - + void EndElement(); }; @@ -906,7 +906,7 @@ public: SmXMLRootContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - + void EndElement(); }; @@ -922,7 +922,7 @@ public: SmXMLStyleContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName), aStyleHelper(*this) {} - + void EndElement(); void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); }; @@ -1100,7 +1100,7 @@ public: SmXMLPaddedContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - + void EndElement(); }; @@ -1124,7 +1124,7 @@ public: SmXMLPhantomContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - + void EndElement(); }; @@ -1164,7 +1164,7 @@ public: const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName), cBegin('('), cEnd(')') {} - + void StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList ); void EndElement(); }; @@ -1255,7 +1255,7 @@ public: SmXMLErrorContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - + void EndElement(); }; @@ -1293,9 +1293,9 @@ public: aToken.nLevel = 5; aToken.eType = TNUMBER; } - + virtual void TCharacters(const OUString &rChars); - + void EndElement(); }; @@ -1319,9 +1319,9 @@ public: SmXMLAnnotationContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLImportContext(rImport,nPrefix,rLName), bIsStarMath(sal_False) {} - + virtual void Characters(const OUString &rChars); - + void StartElement(const uno::Reference<xml::sax::XAttributeList > & xAttrList ); }; @@ -1374,9 +1374,9 @@ public: aToken.nLevel = 5; aToken.eType = TTEXT; } - + virtual void TCharacters(const OUString &rChars); - + void EndElement(); }; @@ -1407,9 +1407,9 @@ public: aToken.nLevel = 5; aToken.eType = TTEXT; } - + virtual void TCharacters(const OUString &rChars); - + void EndElement(); }; @@ -1454,9 +1454,9 @@ public: aToken.nLevel = 5; aToken.eType = TIDENT; } - + void TCharacters(const OUString &rChars); - void StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList ) + void StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { aStyleHelper.RetrieveAttrs(xAttrList); }; @@ -1519,7 +1519,7 @@ public: aToken.eType = TSPECIAL; aToken.nLevel = 5; } - + void TCharacters(const OUString &rChars); void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); void EndElement(); @@ -1578,7 +1578,7 @@ public: SmXMLSpaceContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLImportContext(rImport,nPrefix,rLName) {} - + void StartElement(const uno::Reference< xml::sax::XAttributeList >& xAttrList ); }; @@ -1606,10 +1606,10 @@ public: SmXMLSubContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement() - { - GenericEndElement(TRSUB,RSUB); + + void EndElement() + { + GenericEndElement(TRSUB,RSUB); } }; @@ -1647,7 +1647,7 @@ public: SmXMLSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLSubContext_Impl(rImport,nPrefix,rLName) {} - + void EndElement() { GenericEndElement(TRSUP,RSUP); @@ -1665,9 +1665,9 @@ public: SmXMLSubSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement() - { + + void EndElement() + { GenericEndElement(TRSUB,RSUB,RSUP); } }; @@ -1711,7 +1711,7 @@ public: SmXMLUnderContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLSubContext_Impl(rImport,nPrefix,rLName) {} - + void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); void EndElement(); void HandleAccent(); @@ -1782,7 +1782,7 @@ public: SmXMLOverContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLSubContext_Impl(rImport,nPrefix,rLName), nAttrCount(0) {} - + void EndElement(); void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); void HandleAccent(); @@ -1836,9 +1836,9 @@ public: SmXMLUnderOverContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLSubSupContext_Impl(rImport,nPrefix,rLName) {} - - void EndElement() - { + + void EndElement() + { GenericEndElement(TCSUB,CSUB,CSUP); } }; @@ -1854,7 +1854,7 @@ public: const OUString& rLName) : SmXMLSubSupContext_Impl(rImport,nPrefix,rLName), bHasPrescripts(FALSE) {} - + void EndElement(); void MiddleElement(); SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, @@ -1870,7 +1870,7 @@ public: SmXMLNoneContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, const OUString& rLName) : SmXMLImportContext(rImport,nPrefix,rLName) {} - + void EndElement(); }; @@ -1906,7 +1906,7 @@ public: const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - + SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList); @@ -1922,7 +1922,7 @@ public: const OUString& rLName) : SmXMLTableRowContext_Impl(rImport,nPrefix,rLName) {} - + void EndElement(); SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, @@ -1950,9 +1950,9 @@ public: const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - + /*Don't do anything with alignment for now*/ - void EndElement() + void EndElement() { } }; @@ -1966,7 +1966,7 @@ public: const OUString& rLName) : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - + void EndElement(); }; @@ -1980,7 +1980,7 @@ public: SmXMLOfficeContext_Impl( SmXMLImport &rImport, sal_uInt16 nPrfx, const OUString& rLName) : SvXMLImportContext(rImport,nPrfx,rLName) {} - + virtual SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList); }; @@ -1990,10 +1990,10 @@ SvXMLImportContext *SmXMLOfficeContext_Impl::CreateChildContext(sal_uInt16 nPref { SvXMLImportContext *pContext = 0; if ( XML_NAMESPACE_OFFICE == nPrefix && - rLocalName == GetXMLToken(XML_META) ) + rLocalName == GetXMLToken(XML_META) ) { DBG_WARNING("XML_TOK_DOC_META: should not have come here, maybe document is invalid?"); - } + } else if ( XML_NAMESPACE_OFFICE == nPrefix && rLocalName == GetXMLToken(XML_SETTINGS) ) { @@ -2049,8 +2049,8 @@ SvXMLImportContext *SmXMLFlatDocContext_Impl::CreateChildContext( { return SvXMLMetaDocumentContext::CreateChildContext( i_nPrefix, i_rLocalName, i_xAttrList ); - } - else + } + else { return SmXMLOfficeContext_Impl::CreateChildContext( i_nPrefix, i_rLocalName, i_xAttrList ); @@ -2382,7 +2382,7 @@ void SmXMLRootContext_Impl::EndElement() "Root tag is missing component"); SmToken aToken; - aToken.cMathChar = MS_SQRT; //Temporary: alert, based on OpenSymbol font + aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font aToken.nGroup = 0; aToken.nLevel = 0; aToken.eType = TNROOT; @@ -2406,7 +2406,7 @@ void SmXMLSqrtContext_Impl::EndElement() SmXMLRowContext_Impl::EndElement(); SmToken aToken; - aToken.cMathChar = MS_SQRT; //Temporary: alert, based on OpenSymbol font + aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font aToken.nGroup = 0; aToken.nLevel = 0; aToken.eType = TSQRT; @@ -2837,10 +2837,10 @@ SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix, const OUString &rLocalName, const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) { - if ( XML_NAMESPACE_OFFICE == nPrefix ) + if ( XML_NAMESPACE_OFFICE == nPrefix ) { if ( (IsXMLToken(rLocalName, XML_DOCUMENT) || - IsXMLToken(rLocalName, XML_DOCUMENT_META))) + IsXMLToken(rLocalName, XML_DOCUMENT_META))) { uno::Reference<xml::sax::XDocumentHandler> xDocBuilder( mxServiceFactory->createInstance( @@ -2856,12 +2856,12 @@ SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix, // flat OpenDocument file format -- this has not been tested... : new SmXMLFlatDocContext_Impl( *this, nPrefix, rLocalName, xDPS->getDocumentProperties(), xDocBuilder); - } - else + } + else { return new SmXMLOfficeContext_Impl( *this,nPrefix,rLocalName); } - } + } else return new SmXMLDocContext_Impl(*this,nPrefix,rLocalName); } @@ -3187,3 +3187,4 @@ void SmXMLImport::SetConfigurationSettings(const Sequence<PropertyValue>& aConfP //////////////////////////////////////////////////////////// + diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 87f3d17049..b48e7541aa 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -40,7 +40,7 @@ #include <i18npool/lang.h> #include <unotools/charclass.hxx> #include <svx/unolingu.hxx> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #include "parse.hxx" #ifndef _STARMATH_HRC #include "starmath.hrc" diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx index 8898721237..0fcc3f61da 100644 --- a/starmath/source/smdetect.cxx +++ b/starmath/source/smdetect.cxx @@ -60,10 +60,10 @@ #include <rtl/ustring.h> #include <rtl/logfile.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <vcl/window.hxx> -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> #include <tools/urlobj.hxx> #include <vos/mutex.hxx> #include <svtools/sfxecode.hxx> diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx index 6351b7ba75..bc6c0ba57d 100644 --- a/starmath/source/smmod.cxx +++ b/starmath/source/smmod.cxx @@ -37,7 +37,7 @@ #include <sfx2/msg.hxx> #include <sfx2/app.hxx> #include <sfx2/objface.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <sfx2/request.hxx> #include <sfx2/sfx.hrc> #include <sfx2/viewsh.hxx> @@ -47,7 +47,7 @@ #endif #include <vcl/msgbox.hxx> #include <vcl/virdev.hxx> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #include <tools/rtti.hxx> #include "smmod.hxx" #include "symbol.hxx" @@ -251,6 +251,8 @@ SmModule::SmModule(SfxObjectFactory* pObjFact) : SmModule::~SmModule() { delete pConfig; + if (pColorConfig) + pColorConfig->RemoveListener(this); delete pColorConfig; delete pLocSymbolData; delete pSysLocale; @@ -295,19 +297,14 @@ svtools::ColorConfig & SmModule::GetColorConfig() { pColorConfig = new svtools::ColorConfig; ApplyColorConfigValues( *pColorConfig ); - StartListening( *pColorConfig ); + pColorConfig->AddListener(this); } return *pColorConfig; } -void SmModule::Notify( SfxBroadcaster & /*rBC*/, const SfxHint &rHint ) +void SmModule::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) { - if (rHint.ISA(SfxSimpleHint)) - { - ULONG nHintId = ((SfxSimpleHint&)rHint).GetId(); - if (SFX_HINT_COLORS_CHANGED == nHintId) - ApplyColorConfigValues(*pColorConfig); - } + ApplyColorConfigValues(*pColorConfig); } SmConfig * SmModule::GetConfig() diff --git a/starmath/source/toolbox.cxx b/starmath/source/toolbox.cxx index a462fd6949..64be515246 100644 --- a/starmath/source/toolbox.cxx +++ b/starmath/source/toolbox.cxx @@ -33,9 +33,9 @@ #include <rtl/logfile.hxx> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <sfx2/app.hxx> -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include <svtools/imgdef.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/imgmgr.hxx> @@ -222,7 +222,7 @@ const ImageList * SmToolBoxWindow::GetImageList( USHORT nResId, BOOL bHighContra void SmToolBoxWindow::ApplyImageLists( USHORT nCategoryRID ) { - BOOL bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0; + BOOL bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); // set image list for toolbox 'catalog' const ImageList *pImageList = GetImageList( bHighContrast ? RID_ILH_CATALOG : RID_IL_CATALOG, bHighContrast ); diff --git a/starmath/source/typemap.cxx b/starmath/source/typemap.cxx index e4b4c7e37f..a76a819f7d 100644 --- a/starmath/source/typemap.cxx +++ b/starmath/source/typemap.cxx @@ -141,10 +141,10 @@ #define SvxCellVerJustifyEnumItem SfxVoidItem #define SvxCellOrientationEnumItem SfxVoidItem #include <sfx2/msg.hxx> -#include <svtools/stritem.hxx> -#include <svtools/eitem.hxx> +#include <svl/stritem.hxx> +#include <svl/eitem.hxx> #include <svx/zoomitem.hxx> -#include <svtools/slstitm.hxx> +#include <svl/slstitm.hxx> #define SFX_TYPEMAP #include "smslots.hxx" diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 8339e4ed66..1747670204 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -37,7 +37,7 @@ #include <sfx2/printer.hxx> #include <vcl/svapp.hxx> #include <svtools/ctrltool.hxx> -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> #include <unotools/localedatawrapper.hxx> #include <unotools/processfactory.hxx> #include <svx/paperinf.hxx> diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 888bbcd96c..4c409a7f8f 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -51,15 +51,15 @@ #include <sfx2/objface.hxx> #include <sfx2/printer.hxx> #include <sfx2/request.hxx> -#include <svtools/eitem.hxx> -#include <svtools/intitem.hxx> -#include <svtools/itemset.hxx> -#include <svtools/poolitem.hxx> -#include <svtools/ptitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> +#include <svl/itemset.hxx> +#include <svl/poolitem.hxx> +#include <svl/ptitem.hxx> +#include <svl/stritem.hxx> #include <svtools/transfer.hxx> -#include <svtools/undo.hxx> -#include <svtools/whiter.hxx> +#include <svl/undo.hxx> +#include <svl/whiter.hxx> #include <svx/dialogs.hrc> #include <svx/editeng.hxx> #include <svx/svxdlg.hxx> @@ -1653,7 +1653,7 @@ void SmViewShell::Execute(SfxRequest& rReq) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aSet, RID_SVXDLG_ZOOM); + pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aSet); DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 } pDlg->SetLimits( MINZOOM, MAXZOOM ); diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index f71c0f3e23..e2060e83d4 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -31,8 +31,6 @@ #ifndef _POSTITMGR_HXX #define _POSTITMGR_HXX -#include <svtools/lstner.hxx> - #include <list> #include <vector> #include <svx/outlobj.hxx> @@ -41,8 +39,10 @@ #include <tools/debug.hxx> #include <swrect.hxx> #include <unotools/configitem.hxx> +#include <unotools/options.hxx> #include <com/sun/star/util/SearchOptions.hpp> #include <com/sun/star/uno/Any.hxx> +#include <svl/lstner.hxx> class SwWrtShell; class SwDoc; @@ -139,6 +139,9 @@ class SwNoteProps: public utl::ConfigItem } return aNames; } + + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); }; class SwPostItMgr: public SfxListener diff --git a/sw/inc/SwAppletImpl.hxx b/sw/inc/SwAppletImpl.hxx index e99886aa49..051bc5b174 100644 --- a/sw/inc/SwAppletImpl.hxx +++ b/sw/inc/SwAppletImpl.hxx @@ -46,9 +46,9 @@ #include <vcl/wrkwin.hxx> #endif #include <sot/storage.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> -#include <svtools/ownlist.hxx> +#include <svl/ownlist.hxx> class SfxItemSet; diff --git a/sw/inc/SwNumberTree.hxx b/sw/inc/SwNumberTree.hxx index 03815a265c..7f4c88b608 100644 --- a/sw/inc/SwNumberTree.hxx +++ b/sw/inc/SwNumberTree.hxx @@ -385,7 +385,7 @@ public: // RTL_TEXTENCODING_ASCII_US), // int nDepth = -1) const; -#ifndef PRODUCT +#ifdef DBG_UTIL static unsigned long GetInstances(); unsigned long GetSerial(); #endif @@ -494,7 +494,7 @@ protected: */ mutable tSwNumberTreeChildren::iterator mItLastValid; -#ifndef PRODUCT +#ifdef DBG_UTIL /** Counter for the number of created instances. */ diff --git a/sw/inc/acmplwrd.hxx b/sw/inc/acmplwrd.hxx index f9439f3b53..0167fdbaae 100644 --- a/sw/inc/acmplwrd.hxx +++ b/sw/inc/acmplwrd.hxx @@ -32,7 +32,7 @@ #define _SVSTDARR_STRINGSISORTDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> class SwDoc; class SwAutoCompleteWord_Impl; diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx index cb8ac0733b..d1fb7475a1 100644 --- a/sw/inc/authfld.hxx +++ b/sw/inc/authfld.hxx @@ -35,7 +35,7 @@ #include <toxe.hxx> #define _SVSTDARR_LONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> class SwAuthDataArr; /* -----------------21.09.99 13:32------------------- diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx index 5a97eba019..476f0ccadc 100644 --- a/sw/inc/calc.hxx +++ b/sw/inc/calc.hxx @@ -30,7 +30,7 @@ #ifndef _CALC_HXX #define _CALC_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #ifndef __SBX_SBXVALUE //autogen #include <basic/sbxvar.hxx> diff --git a/sw/inc/ccoll.hxx b/sw/inc/ccoll.hxx index 5b6f9953e7..ac731756c8 100644 --- a/sw/inc/ccoll.hxx +++ b/sw/inc/ccoll.hxx @@ -30,7 +30,7 @@ #ifndef _CCOLL_HXX #define _CCOLL_HXX -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <tools/string.hxx> #include <sfx2/tabdlg.hxx> diff --git a/sw/inc/cellatr.hxx b/sw/inc/cellatr.hxx index ad9ae500af..27521f5e40 100644 --- a/sw/inc/cellatr.hxx +++ b/sw/inc/cellatr.hxx @@ -31,8 +31,8 @@ #ifndef _CELLATR_HXX #define _CELLATR_HXX -#include <svtools/intitem.hxx> -#include <svtools/zforlist.hxx> +#include <svl/intitem.hxx> +#include <svl/zforlist.hxx> #include "swdllapi.h" #include "format.hxx" #include "cellfml.hxx" diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 692184be2d..a98e7c69a0 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -111,7 +111,7 @@ struct SwContentAtPos SW_NUMLABEL = 0x0200, // #i23726# SW_CONTENT_CHECK = 0x0400, // --> FME 2005-05-13 #i43742# <-- SW_SMARTTAG = 0x0800 -#ifndef PRODUCT +#ifdef DBG_UTIL ,SW_CURR_ATTRS = 0x4000 // nur zum Debuggen ,SW_TABLEBOXVALUE = 0x8000 // nur zum Debuggen #endif @@ -465,7 +465,7 @@ public: */ void Combine(); -#if defined( PRODUCT ) +#if !defined(DBG_UTIL) void SttCrsrMove() { ++nCrsrMove; StartAction(); } void EndCrsrMove( const BOOL bIdleEnd = FALSE ) { EndAction( bIdleEnd ); --nCrsrMove; } diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx index dc464837b5..54ea07ae61 100644 --- a/sw/inc/dbmgr.hxx +++ b/sw/inc/dbmgr.hxx @@ -33,7 +33,7 @@ #include <tools/string.hxx> #include <tools/link.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <com/sun/star/util/Date.hpp> #include "swdllapi.h" #include <swdbdata.hxx> diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 66695efba4..557f73ad13 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -60,7 +60,7 @@ class SwList; // <-- #include <IDocumentExternalData.hxx> #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <vcl/timer.hxx> @@ -77,7 +77,7 @@ class SwList; #include <com/sun/star/linguistic2/XHyphenatedWord.hpp> #include <vos/ref.hxx> #include <svx/svdtypes.hxx> -#include <svtools/style.hxx> +#include <svl/style.hxx> #include <svx/numitem.hxx> #include "comphelper/implementationreference.hxx" #include <com/sun/star/chart2/data/XDataProvider.hpp> @@ -492,7 +492,7 @@ private: bool mbColumnSelection : 1; // true: this content has bee created by a column selection // (clipboard docs only) -#ifndef PRODUCT +#ifdef DBG_UTIL bool mbXMLExport : 1; // TRUE: during XML export #endif @@ -1066,7 +1066,7 @@ public: inline void SetOLEPrtNotifyPending( bool bSet = true ); void PrtOLENotify( sal_Bool bAll ); //Alle oder nur Markierte -#ifndef PRODUCT +#ifdef DBG_UTIL bool InXMLExport() const { return mbXMLExport; } void SetXMLExport( bool bFlag ) { mbXMLExport = bFlag; } #endif diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx index 9152f8064f..bc237c4d3a 100644 --- a/sw/inc/docary.hxx +++ b/sw/inc/docary.hxx @@ -51,7 +51,7 @@ namespace com { namespace sun { namespace star { namespace i18n { #include <tools/table.hxx> #endif #include <swtypes.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> typedef SwFieldType* SwFldTypePtr; #define GROW_FLDTYPES 16 diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 62b484809e..37b33c0b82 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -39,7 +39,7 @@ #include <swdll.hxx> #include <shellid.hxx> -#include <svtools/lstner.hxx> +#include <svl/lstner.hxx> #include <svtools/embedhlp.hxx> class SwDoc; diff --git a/sw/inc/docstat.hxx b/sw/inc/docstat.hxx index ce641a9f23..bc7f8111fd 100644 --- a/sw/inc/docstat.hxx +++ b/sw/inc/docstat.hxx @@ -33,12 +33,6 @@ #include <tools/solar.h> #include "swdllapi.h" -/////////////////////////////////////////////////////////////////////////// -// PRODUCT: struct SwInternStat ist nur fuer CORE Interne Statistics und -// hat nichts in einer ProductVersion zu suchen. -/////////////////////////////////////////////////////////////////////////// - -struct SwInternStat; struct SW_DLLPUBLIC SwDocStat { @@ -46,11 +40,14 @@ struct SW_DLLPUBLIC SwDocStat USHORT nGrf; USHORT nOLE; ULONG nPage; + /// paragraphs for document statistic: non-empty and non-hidden ones ULONG nPara; + /// all paragraphs, including empty/hidden ones + ULONG nAllPara; ULONG nWord; ULONG nChar; BOOL bModified; - SwInternStat* pInternStat; + SwDocStat(); void Reset(); }; diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index 169339fb07..fa2d2fc760 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -34,10 +34,10 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/style.hxx> -#include <svtools/itemset.hxx> +#include <svl/style.hxx> +#include <svl/itemset.hxx> #include "swdllapi.h" class SwDoc; diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index 68219053da..a6c7fa320a 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -35,7 +35,7 @@ #include <tools/datetime.hxx> -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include "fldbas.hxx" #include "numrule.hxx" @@ -548,6 +548,8 @@ public: const OutlinerParaObject* GetTextObject() const; void SetTextObject( OutlinerParaObject* pText ); + sal_uInt32 GetNumberOfParagraphs() const; + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, USHORT nWhich ) const; virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, USHORT nWhich ); virtual String GetDescription() const; diff --git a/sw/inc/edglbldc.hxx b/sw/inc/edglbldc.hxx index 82974fdabc..9b4f22f24d 100644 --- a/sw/inc/edglbldc.hxx +++ b/sw/inc/edglbldc.hxx @@ -30,7 +30,7 @@ #ifndef _EDGLBLDC_HXX #define _EDGLBLDC_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> class SwSection; class SwTOXBase; diff --git a/sw/inc/edimp.hxx b/sw/inc/edimp.hxx index 26db46cac9..08e23418e4 100644 --- a/sw/inc/edimp.hxx +++ b/sw/inc/edimp.hxx @@ -32,7 +32,7 @@ #define _EDIMP_HXX #include <tools/solar.h> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> class SwPaM; class SwNodeIndex; diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index e858334fd5..0a67b971fd 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -33,7 +33,7 @@ #include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <tools/string.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <vcl/font.hxx> #include <svx/swafopt.hxx> #include "swdllapi.h" diff --git a/sw/inc/errhdl.hxx b/sw/inc/errhdl.hxx index 646c1dab7f..5ecc797ab5 100644 --- a/sw/inc/errhdl.hxx +++ b/sw/inc/errhdl.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -30,7 +30,7 @@ #ifndef _ERRHDL_HXX #define _ERRHDL_HXX -#ifndef PRODUCT +#ifdef DBG_UTIL #include <tools/solar.h> #include <sal/types.h> diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx index e878b44602..d9f51852b8 100644 --- a/sw/inc/expfld.hxx +++ b/sw/inc/expfld.hxx @@ -30,7 +30,7 @@ #ifndef _EXPFLD_HXX #define _EXPFLD_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include "swdllapi.h" #include <fldbas.hxx> #include <cellfml.hxx> diff --git a/sw/inc/extinput.hxx b/sw/inc/extinput.hxx index 3e041d346a..818b8ce797 100644 --- a/sw/inc/extinput.hxx +++ b/sw/inc/extinput.hxx @@ -32,7 +32,7 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <pam.hxx> #include <i18npool/lang.h> diff --git a/sw/inc/fchrfmt.hxx b/sw/inc/fchrfmt.hxx index fe7d30c254..a21b642d24 100644 --- a/sw/inc/fchrfmt.hxx +++ b/sw/inc/fchrfmt.hxx @@ -31,7 +31,7 @@ #define _FCHRFMT_HXX -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <calbck.hxx> #include <format.hxx> diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx index f4753a176e..6490164812 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -278,7 +278,7 @@ protected: public: -#ifndef PRODUCT +#ifdef DBG_UTIL virtual ~SwFieldType(); #endif static const String& GetTypeStr( USHORT nTypeId ); @@ -337,7 +337,7 @@ public: // ResId USHORT Which() const -#ifdef PRODUCT +#ifndef DBG_UTIL { return pType->Which(); } #else ; // in fldbas.cxx implementiert diff --git a/sw/inc/flypos.hxx b/sw/inc/flypos.hxx index 72a5f414eb..43ee823fa1 100644 --- a/sw/inc/flypos.hxx +++ b/sw/inc/flypos.hxx @@ -31,7 +31,7 @@ #define _FLYPOS_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <swdllapi.h> class SwFrmFmt; diff --git a/sw/inc/fmtanchr.hxx b/sw/inc/fmtanchr.hxx index 82841835db..e3b241aebf 100644 --- a/sw/inc/fmtanchr.hxx +++ b/sw/inc/fmtanchr.hxx @@ -34,7 +34,7 @@ #include <hintids.hxx> #include <swtypes.hxx> #include <format.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> struct SwPosition; class IntlWrapper; diff --git a/sw/inc/fmtautofmt.hxx b/sw/inc/fmtautofmt.hxx index 928c02d2be..590d770547 100644 --- a/sw/inc/fmtautofmt.hxx +++ b/sw/inc/fmtautofmt.hxx @@ -31,7 +31,7 @@ #define _FMTAUTOFMT_HXX -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <format.hxx> #include <boost/shared_ptr.hpp> diff --git a/sw/inc/fmtclbl.hxx b/sw/inc/fmtclbl.hxx index a8a78dbcf5..a3e8fa442e 100644 --- a/sw/inc/fmtclbl.hxx +++ b/sw/inc/fmtclbl.hxx @@ -31,7 +31,7 @@ #define _FMTCLBL_HXX -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <hintids.hxx> #include <format.hxx> #include "swdllapi.h" diff --git a/sw/inc/fmtclds.hxx b/sw/inc/fmtclds.hxx index 1868eaaa7e..d70b241b60 100644 --- a/sw/inc/fmtclds.hxx +++ b/sw/inc/fmtclds.hxx @@ -31,7 +31,7 @@ #define _FMTCLDS_HXX #include <tools/color.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include "swdllapi.h" #include <hintids.hxx> #include <format.hxx> diff --git a/sw/inc/fmtcnct.hxx b/sw/inc/fmtcnct.hxx index 2e648a5664..bb1e7aadc3 100644 --- a/sw/inc/fmtcnct.hxx +++ b/sw/inc/fmtcnct.hxx @@ -31,7 +31,7 @@ #define _FMTCNCT_HXX #include <hintids.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <format.hxx> #include <calbck.hxx> diff --git a/sw/inc/fmtcntnt.hxx b/sw/inc/fmtcntnt.hxx index 405f1cef86..0adec4eedd 100644 --- a/sw/inc/fmtcntnt.hxx +++ b/sw/inc/fmtcntnt.hxx @@ -30,7 +30,7 @@ #ifndef _FMTCNTNT_HXX #define _FMTCNTNT_HXX -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <hintids.hxx> #include <format.hxx> diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx index 2d86ec79fd..b10707cd09 100644 --- a/sw/inc/fmtcol.hxx +++ b/sw/inc/fmtcol.hxx @@ -30,7 +30,7 @@ #ifndef _FMTCOL_HXX #define _FMTCOL_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include "swdllapi.h" #include <format.hxx> #include <swtypes.hxx> // fuer MAXLEVEL diff --git a/sw/inc/fmteiro.hxx b/sw/inc/fmteiro.hxx index 61a498ec5e..6de1fc8603 100644 --- a/sw/inc/fmteiro.hxx +++ b/sw/inc/fmteiro.hxx @@ -31,7 +31,7 @@ #define _FMTEIRO_HXX -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <hintids.hxx> #include <format.hxx> #include "swdllapi.h" diff --git a/sw/inc/fmtflcnt.hxx b/sw/inc/fmtflcnt.hxx index f251580a25..b4c21d7315 100644 --- a/sw/inc/fmtflcnt.hxx +++ b/sw/inc/fmtflcnt.hxx @@ -31,7 +31,7 @@ #define _FMTFLCNT_HXX -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> class SwFrmFmt; class SwTxtFlyCnt; diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index 7edbb77a0f..f311530079 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -30,9 +30,9 @@ #ifndef _FMTFLD_HXX #define _FMTFLD_HXX -#include <svtools/poolitem.hxx> -#include <svtools/brdcst.hxx> -#include <svtools/smplhint.hxx> +#include <svl/poolitem.hxx> +#include <svl/brdcst.hxx> +#include <svl/smplhint.hxx> #include "swdllapi.h" #include <calbck.hxx> diff --git a/sw/inc/fmtfollowtextflow.hxx b/sw/inc/fmtfollowtextflow.hxx index dc89b2b392..9738eb26d2 100644 --- a/sw/inc/fmtfollowtextflow.hxx +++ b/sw/inc/fmtfollowtextflow.hxx @@ -31,7 +31,7 @@ #define _FMTFOLLOWTEXTFLOW_HXX -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <hintids.hxx> #include <format.hxx> #include "swdllapi.h" diff --git a/sw/inc/fmtfordr.hxx b/sw/inc/fmtfordr.hxx index abf52ac6ec..3d6353d140 100644 --- a/sw/inc/fmtfordr.hxx +++ b/sw/inc/fmtfordr.hxx @@ -30,7 +30,7 @@ #ifndef _FMTFORDR_HXX #define _FMTFORDR_HXX -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <hintids.hxx> #include <format.hxx> diff --git a/sw/inc/fmtfsize.hxx b/sw/inc/fmtfsize.hxx index 7cf2338e24..e3b365ef00 100644 --- a/sw/inc/fmtfsize.hxx +++ b/sw/inc/fmtfsize.hxx @@ -31,7 +31,7 @@ #define _FMTFSIZE_HXX #include <tools/gen.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include "swdllapi.h" #include <hintids.hxx> #include <swtypes.hxx> diff --git a/sw/inc/fmtftn.hxx b/sw/inc/fmtftn.hxx index 4fe37c153a..0f903e375a 100644 --- a/sw/inc/fmtftn.hxx +++ b/sw/inc/fmtftn.hxx @@ -31,7 +31,7 @@ #define _FMTFTN_HXX #include <tools/string.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include "swdllapi.h" class SwDoc; diff --git a/sw/inc/fmtftntx.hxx b/sw/inc/fmtftntx.hxx index 927f51f7bf..2648a3489f 100644 --- a/sw/inc/fmtftntx.hxx +++ b/sw/inc/fmtftntx.hxx @@ -30,7 +30,7 @@ #ifndef _FMTFTNTX_HXX #define _FMTFTNTX_HXX -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <hintids.hxx> #include <format.hxx> #include <numrule.hxx> diff --git a/sw/inc/fmthdft.hxx b/sw/inc/fmthdft.hxx index e5e5b0b68f..743200f92a 100644 --- a/sw/inc/fmthdft.hxx +++ b/sw/inc/fmthdft.hxx @@ -32,7 +32,7 @@ #include <hintids.hxx> #include <format.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <calbck.hxx> class SwFrmFmt; diff --git a/sw/inc/fmtinfmt.hxx b/sw/inc/fmtinfmt.hxx index 835c221bb2..0031d03b0a 100644 --- a/sw/inc/fmtinfmt.hxx +++ b/sw/inc/fmtinfmt.hxx @@ -31,7 +31,7 @@ #define _FMTINFMT_HXX #include <tools/string.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include "swdllapi.h" class SvxMacro; diff --git a/sw/inc/fmtline.hxx b/sw/inc/fmtline.hxx index 878806a3ce..e38cd780b5 100644 --- a/sw/inc/fmtline.hxx +++ b/sw/inc/fmtline.hxx @@ -31,7 +31,7 @@ #define SW_FMTLINE_HXX -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <hintids.hxx> #include <format.hxx> #include "swdllapi.h" diff --git a/sw/inc/fmtlsplt.hxx b/sw/inc/fmtlsplt.hxx index c186eb5706..bd5cf11b1a 100644 --- a/sw/inc/fmtlsplt.hxx +++ b/sw/inc/fmtlsplt.hxx @@ -30,7 +30,7 @@ #ifndef _FMTTSPLT_HXX #define _FMTTSPLT_HXX -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <hintids.hxx> #include <format.hxx> #include "swdllapi.h" diff --git a/sw/inc/fmtmeta.hxx b/sw/inc/fmtmeta.hxx index 952181d049..f676469b90 100755..100644 --- a/sw/inc/fmtmeta.hxx +++ b/sw/inc/fmtmeta.hxx @@ -31,7 +31,7 @@ #ifndef SW_FMTMETA_HXX #define SW_FMTMETA_HXX -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <sfx2/Metadatable.hxx> #include <boost/shared_ptr.hpp> diff --git a/sw/inc/fmtornt.hxx b/sw/inc/fmtornt.hxx index 26d5fc3d66..f1bc3a3088 100644 --- a/sw/inc/fmtornt.hxx +++ b/sw/inc/fmtornt.hxx @@ -37,7 +37,7 @@ #include <hintids.hxx> #include <swtypes.hxx> #include <format.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> class IntlWrapper; diff --git a/sw/inc/fmtpdsc.hxx b/sw/inc/fmtpdsc.hxx index 5c75ecdef7..d0aaec8a2e 100644 --- a/sw/inc/fmtpdsc.hxx +++ b/sw/inc/fmtpdsc.hxx @@ -31,7 +31,7 @@ #define _FMTPDSC_HXX -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include "swdllapi.h" #include <hintids.hxx> #include <format.hxx> diff --git a/sw/inc/fmtrfmrk.hxx b/sw/inc/fmtrfmrk.hxx index 4c277e41c8..3a163bc5d7 100644 --- a/sw/inc/fmtrfmrk.hxx +++ b/sw/inc/fmtrfmrk.hxx @@ -32,7 +32,7 @@ #include <tools/string.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> class SwTxtRefMark; diff --git a/sw/inc/fmtrowsplt.hxx b/sw/inc/fmtrowsplt.hxx index 30df01bd99..627663b8ec 100644 --- a/sw/inc/fmtrowsplt.hxx +++ b/sw/inc/fmtrowsplt.hxx @@ -30,7 +30,7 @@ #ifndef _FMTROWSPLT_HXX #define _FMTROWSPLT_HXX -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include "swdllapi.h" #include <hintids.hxx> #include <format.hxx> diff --git a/sw/inc/fmtruby.hxx b/sw/inc/fmtruby.hxx index ceb7c87f86..49bcdb8bad 100644 --- a/sw/inc/fmtruby.hxx +++ b/sw/inc/fmtruby.hxx @@ -32,7 +32,7 @@ #include <tools/string.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> class SwTxtRuby; diff --git a/sw/inc/fmtsrnd.hxx b/sw/inc/fmtsrnd.hxx index feeef7aa37..643e4f6293 100644 --- a/sw/inc/fmtsrnd.hxx +++ b/sw/inc/fmtsrnd.hxx @@ -33,7 +33,7 @@ #include "swdllapi.h" #include <hintids.hxx> #include <format.hxx> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> // --> OD 2006-08-15 #i68520# - refactoring // separate enumeration <SwSurround> in own header file diff --git a/sw/inc/fmturl.hxx b/sw/inc/fmturl.hxx index f2744ebf66..be9c08fde3 100644 --- a/sw/inc/fmturl.hxx +++ b/sw/inc/fmturl.hxx @@ -30,7 +30,7 @@ #ifndef _FMTURL_HXX #define _FMTURL_HXX -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include "swdllapi.h" #include <hintids.hxx> #include <format.hxx> diff --git a/sw/inc/fmtwrapinfluenceonobjpos.hxx b/sw/inc/fmtwrapinfluenceonobjpos.hxx index 473135708e..072dab4a25 100644 --- a/sw/inc/fmtwrapinfluenceonobjpos.hxx +++ b/sw/inc/fmtwrapinfluenceonobjpos.hxx @@ -32,7 +32,7 @@ #include <hintids.hxx> #include <format.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <com/sun/star/text/WrapInfluenceOnPosition.hpp> class SW_DLLPUBLIC SwFmtWrapInfluenceOnObjPos: public SfxPoolItem diff --git a/sw/inc/ftnidx.hxx b/sw/inc/ftnidx.hxx index c3a8b5c84c..e4e119439f 100644 --- a/sw/inc/ftnidx.hxx +++ b/sw/inc/ftnidx.hxx @@ -32,7 +32,7 @@ #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> class SwTxtFtn; class SwNodeIndex; diff --git a/sw/inc/grfatr.hxx b/sw/inc/grfatr.hxx index 9f52a00675..f329184436 100644 --- a/sw/inc/grfatr.hxx +++ b/sw/inc/grfatr.hxx @@ -32,8 +32,8 @@ #include <hintids.hxx> // fuer die WhichIds @@@ must be included first @@@ #include <tools/gen.hxx> -#include <svtools/eitem.hxx> -#include <svtools/intitem.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> #include <svx/grfcrop.hxx> #include "swdllapi.h" #include <swatrset.hxx> // fuer inlines diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index 3172447029..f471ed217b 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -28,7 +28,7 @@ * ************************************************************************/ #ifndef _SOLAR_HRC -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #endif #define HID_BASE HID_APP_START diff --git a/sw/inc/hfspacingitem.hxx b/sw/inc/hfspacingitem.hxx index 04b9690b33..269834eaf4 100644 --- a/sw/inc/hfspacingitem.hxx +++ b/sw/inc/hfspacingitem.hxx @@ -31,7 +31,7 @@ #define _SW_HF_EAT_SPACINGITEM_HXX -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <hintids.hxx> #include <format.hxx> diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx index 731791b881..615ba6dec3 100644 --- a/sw/inc/hints.hxx +++ b/sw/inc/hints.hxx @@ -88,14 +88,6 @@ public: }; -class SwInsChr: public SwMsgPoolItem -{ -public: - xub_StrLen nPos; - - SwInsChr( USHORT nP ); -}; - class SwInsTxt: public SwMsgPoolItem { public: @@ -214,7 +206,7 @@ public: USHORT Count() const { return pChgSet->Count(); } void ClearItem( USHORT nWhichL = 0 ) -#ifdef PRODUCT +#ifndef DBG_UTIL { pChgSet->ClearItem( nWhichL ); } #else ; @@ -270,17 +262,6 @@ public: //}; // <-- -class SwNRuleLowerLevel : public SwMsgPoolItem -{ - const String& rName; - BYTE nLvl; -public: - SwNRuleLowerLevel( const String& rRuleName, BYTE nLevel ); - - const String& GetName() const { return rName; } - BYTE GetLevel() const { return nLvl; } -}; - class SwFindNearestNode : public SwMsgPoolItem { const SwNode *pNd, *pFnd; diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx index 755f3694f1..d6b15660f0 100644 --- a/sw/inc/index.hxx +++ b/sw/inc/index.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -43,7 +43,7 @@ class SwIndex; class SwIndexReg; struct SwPosition; -#ifdef PRODUCT +#ifndef DBG_UTIL #define INLINE inline #else #define INLINE @@ -53,7 +53,7 @@ class SW_DLLPUBLIC SwIndex { friend class SwIndexReg; -#ifndef PRODUCT +#ifdef DBG_UTIL static int nSerial; int MySerial; #endif @@ -150,7 +150,7 @@ public: void MoveTo( SwIndexReg& rArr ); }; -#ifdef PRODUCT +#ifndef DBG_UTIL inline xub_StrLen SwIndex::operator++() { diff --git a/sw/inc/istyleaccess.hxx b/sw/inc/istyleaccess.hxx index 9bdfc4be2a..dffced6c25 100644 --- a/sw/inc/istyleaccess.hxx +++ b/sw/inc/istyleaccess.hxx @@ -31,7 +31,7 @@ #define _ISTYLEACCESS_HXX #include <vector> -#include <svtools/stylepool.hxx> +#include <svl/stylepool.hxx> /*-------------------------------------------------------------------- Management of (automatic) styles diff --git a/sw/inc/makefile.mk b/sw/inc/makefile.mk index 36aa661026..16adca8192 100644 --- a/sw/inc/makefile.mk +++ b/sw/inc/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -44,10 +44,10 @@ TARGET=inc .INCLUDE : target.mk -.IF "$(ENABLE_PCH)"!="" && ( "$(PRJNAME)"!="sw" || "$(BUILD_SPECIAL)"!="TRUE" ) +.IF "$(ENABLE_PCH)"!="" # && ( "$(PRJNAME)"!="sw" || "$(BUILD_SPECIAL)"!="TRUE" ) ALLTAR : \ $(SLO)$/precompiled.pch \ $(SLO)$/precompiled_ex.pch - + .ENDIF # "$(ENABLE_PCH)"!="" diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx index 8b5b1c73d9..f46de58ff6 100644 --- a/sw/inc/modcfg.hxx +++ b/sw/inc/modcfg.hxx @@ -33,7 +33,7 @@ #include <tools/string.hxx> #include <vcl/wintypes.hxx> #include <vcl/field.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <unotools/configitem.hxx> #include "swdllapi.h" #include "authratr.hxx" @@ -78,6 +78,7 @@ class SwRevisionConfig : public utl::ConfigItem ~SwRevisionConfig(); virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); void Load(); void SetModified(){ConfigItem::SetModified();} }; @@ -108,6 +109,7 @@ class SwInsertConfig : public utl::ConfigItem ~SwInsertConfig(); virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); void Load(); void SetModified(){ConfigItem::SetModified();} }; @@ -134,6 +136,7 @@ class SwTableConfig : public utl::ConfigItem ~SwTableConfig(); virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); void Load(); void SetModified(){ConfigItem::SetModified();} }; @@ -163,6 +166,7 @@ class SwMiscConfig : public utl::ConfigItem ~SwMiscConfig(); virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); void Load(); void SetModified(){ConfigItem::SetModified();} }; diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index d479fc9e78..7edfad173a 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -32,7 +32,7 @@ #define _NDARR_HXX #include <com/sun/star/embed/XEmbeddedObject.hpp> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #ifndef _BPARR_HXX #include <bparr.hxx> diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx index 620d8a0c2f..67cb843675 100644 --- a/sw/inc/ndhints.hxx +++ b/sw/inc/ndhints.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -31,7 +31,7 @@ #define _NDHINTS_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <tools/mempool.hxx> #include "swtypes.hxx" @@ -117,7 +117,7 @@ public: { return m_HintStarts[nIdx]; } inline USHORT Count() const { return m_HintStarts.Count(); } -#ifndef PRODUCT +#ifdef DBG_UTIL bool Check() const; #endif }; diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx index fa4fd28e82..6326b490b6 100644 --- a/sw/inc/ndindex.hxx +++ b/sw/inc/ndindex.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -45,7 +45,7 @@ class SW_DLLPUBLIC SwNodeIndex friend void SwNodes::DeRegisterIndex( SwNodeIndex& ); friend void SwNodes::RemoveNode( ULONG, ULONG, BOOL ); -#ifndef PRODUCT +#ifdef DBG_UTIL static int nSerial; int MySerial; #endif diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index f65252e0ce..42d9fecd74 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -89,7 +89,7 @@ class SW_DLLPUBLIC SwNode : private /* public*/ BigPtrEntry { friend class SwNodes; -#ifndef PRODUCT +#ifdef DBG_UTIL static long nSerial; long nMySerial; #endif @@ -114,7 +114,7 @@ protected: public: virtual ~SwNode(); -#ifndef PRODUCT +#ifdef DBG_UTIL long int GetSerial() const { return nMySerial; } #endif diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx index 77d0044dbf..1035cb9fe5 100644 --- a/sw/inc/numrule.hxx +++ b/sw/inc/numrule.hxx @@ -116,7 +116,7 @@ public: private: friend void _FinitCore(); -#ifndef PRODUCT +#ifdef DBG_UTIL long int nSerial; static long int nInstances; #endif diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx index 1a1cb98b52..2041e91d10 100644 --- a/sw/inc/pam.hxx +++ b/sw/inc/pam.hxx @@ -192,8 +192,8 @@ public: m_pMark = m_pPoint; } } +#ifndef DBG_UTIL -#ifdef PRODUCT void Exchange() { if (m_pPoint != m_pMark) diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hxx index dc0ca08366..cdc2a16b85 100644 --- a/sw/inc/paratr.hxx +++ b/sw/inc/paratr.hxx @@ -29,8 +29,8 @@ ************************************************************************/ #ifndef _PARATR_HXX #define _PARATR_HXX -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> #include "swdllapi.h" #include <hintids.hxx> #include <calbck.hxx> diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index 0a43d2c73d..e8aadd472a 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -33,6 +33,7 @@ #ifdef PRECOMPILED_HEADERS //---MARKER--- + #include "sal/config.h" #include "sal/types.h" @@ -511,8 +512,6 @@ #include "cppuhelper/weak.hxx" #include "cppuhelper/weakref.hxx" -#include "cppunit/simpleheader.hxx" - #include "framework/interaction.hxx" #include "goodies/grfmgr.hxx" @@ -613,99 +612,99 @@ #include "sot/storinfo.hxx" #include "svtools/FilterConfigItem.hxx" -#include "svtools/PasswordHelper.hxx" +#include "svl/PasswordHelper.hxx" #include "svtools/accessibilityoptions.hxx" -#include "svtools/aeitem.hxx" -#include "svtools/cjkoptions.hxx" -#include "svtools/cmdoptions.hxx" -#include "svtools/cntnrsrt.hxx" +#include "svl/aeitem.hxx" +#include "svl/cjkoptions.hxx" +#include "unotools/cmdoptions.hxx" +#include "svl/cntnrsrt.hxx" #include "svtools/collatorres.hxx" #include "svtools/colorcfg.hxx" -#include "svtools/compatibility.hxx" +#include "unotools/compatibility.hxx" #include "svtools/controldims.hrc" -#include "svtools/ctloptions.hxx" +#include "svl/ctloptions.hxx" #include "svtools/ctrlbox.hxx" #include "svtools/ctrltool.hxx" #include "svtools/editbrowsebox.hxx" #include "svtools/ehdl.hxx" -#include "svtools/eitem.hxx" +#include "svl/eitem.hxx" #include "svtools/embedhlp.hxx" #include "svtools/embedtransfer.hxx" #include "svtools/filter.hxx" -#include "svtools/flagitem.hxx" -#include "svtools/fltrcfg.hxx" -#include "svtools/fstathelper.hxx" -#include "svtools/globalnameitem.hxx" +#include "svl/flagitem.hxx" +#include "unotools/fltrcfg.hxx" +#include "svl/fstathelper.hxx" +#include "svl/globalnameitem.hxx" #include "svtools/headbar.hxx" #include "svtools/htmlkywd.hxx" #include "svtools/htmltokn.h" -#include "svtools/imageitm.hxx" +#include "svl/imageitm.hxx" #include "svtools/imap.hxx" #include "svtools/indexentryres.hxx" -#include "svtools/inethist.hxx" +#include "svl/inethist.hxx" #include "svtools/inetimg.hxx" #include "svtools/insdlg.hxx" -#include "svtools/intitem.hxx" -#include "svtools/isethint.hxx" -#include "svtools/itemiter.hxx" -#include "svtools/itempool.hxx" -#include "svtools/itemprop.hxx" -#include "svtools/itemset.hxx" -#include "svtools/languageoptions.hxx" -#include "svtools/lckbitem.hxx" -#include "svtools/lingucfg.hxx" -#include "svtools/linguprops.hxx" -#include "svtools/lstner.hxx" -#include "svtools/misccfg.hxx" -#include "svtools/moduleoptions.hxx" -#include "svtools/numuno.hxx" -#include "svtools/ownlist.hxx" +#include "svl/intitem.hxx" +#include "svl/isethint.hxx" +#include "svl/itemiter.hxx" +#include "svl/itempool.hxx" +#include "svl/itemprop.hxx" +#include "svl/itemset.hxx" +#include "svl/languageoptions.hxx" +#include "svl/lckbitem.hxx" +#include "unotools/lingucfg.hxx" +#include "unotools/linguprops.hxx" +#include "svl/lstner.hxx" +#include "unotools/misccfg.hxx" +#include "unotools/moduleoptions.hxx" +#include "svl/numuno.hxx" +#include "svl/ownlist.hxx" #include "svtools/parhtml.hxx" -#include "svtools/pathoptions.hxx" -#include "svtools/poolitem.hxx" +#include "unotools/pathoptions.hxx" +#include "svl/poolitem.hxx" #include "svtools/prgsbar.hxx" #include "svtools/printdlg.hxx" #include "svtools/prnsetup.hxx" -#include "svtools/ptitem.hxx" -#include "svtools/rectitem.hxx" +#include "svl/ptitem.hxx" +#include "svl/rectitem.hxx" #include "svtools/rtfkeywd.hxx" #include "svtools/rtfout.hxx" #include "svtools/rtftoken.h" #include "svtools/ruler.hxx" -#include "svtools/saveopt.hxx" +#include "unotools/saveopt.hxx" #include "svtools/scriptedtext.hxx" #include "svtools/sfxecode.hxx" -#include "svtools/slstitm.hxx" -#include "svtools/smplhint.hxx" +#include "svl/slstitm.hxx" +#include "svl/smplhint.hxx" #include "svtools/soerr.hxx" -#include "svtools/solar.hrc" -#include "svtools/sourceviewconfig.hxx" +#include "svl/solar.hrc" +#include "unotools/sourceviewconfig.hxx" #include "svtools/stdctrl.hxx" -#include "svtools/stritem.hxx" -#include "svtools/style.hrc" -#include "svtools/style.hxx" -#include "svtools/svarray.hxx" +#include "svl/stritem.hxx" +#include "svl/style.hrc" +#include "svl/style.hxx" +#include "svl/svarray.hxx" #include "svtools/svmedit.hxx" #include "svtools/svparser.hxx" -#include "svtools/svstdarr.hxx" +#include "svl/svstdarr.hxx" #include "svtools/svtabbx.hxx" #include "svtools/svtreebx.hxx" -#include "svtools/syslocale.hxx" +#include "unotools/syslocale.hxx" #include "svtools/templdlg.hxx" #include "svtools/textview.hxx" #include "svtools/transfer.hxx" #include "svtools/txtattr.hxx" #include "svtools/txtcmp.hxx" -#include "svtools/undo.hxx" -#include "svtools/undoopt.hxx" +#include "svl/undo.hxx" +#include "unotools/undoopt.hxx" #include "svtools/unoevent.hxx" #include "svtools/unoimap.hxx" -#include "svtools/urihelper.hxx" -#include "svtools/urlbmk.hxx" -#include "svtools/useroptions.hxx" +#include "svl/urihelper.hxx" +#include "svl/urlbmk.hxx" +#include "unotools/useroptions.hxx" #include "svtools/valueset.hxx" -#include "svtools/visitem.hxx" -#include "svtools/whiter.hxx" +#include "svl/visitem.hxx" +#include "svl/whiter.hxx" #include "svtools/xtextedt.hxx" #include "svx/IAccessibleParent.hxx" @@ -731,7 +730,7 @@ #include "svx/editstat.hxx" #include "svx/editview.hxx" #include "svx/eeitem.hxx" -#include "svx/escherex.hxx" +#include "filter/msfilter/escherex.hxx" #include "svx/extrusionbar.hxx" #include "svx/extrusioncontrols.hxx" #include "svx/fillctrl.hxx" @@ -766,11 +765,11 @@ #include "svx/lboxctrl.hxx" #include "svx/linectrl.hxx" #include "svx/linkmgr.hxx" -#include "svx/mscodec.hxx" -#include "svx/msdffimp.hxx" -#include "svx/msfiltertracer.hxx" -#include "svx/msocximex.hxx" -#include "svx/msoleexp.hxx" +#include "filter/msfilter/mscodec.hxx" +#include "filter/msfilter/msdffimp.hxx" +#include "filter/msfilter/msfiltertracer.hxx" +#include "filter/msfilter/msocximex.hxx" +#include "filter/msfilter/msoleexp.hxx" #include "svx/numitem.hxx" #include "svx/numvset.hxx" #include "svx/objfac3d.hxx" @@ -921,7 +920,7 @@ #include "vcl/fixed.hxx" #include "vcl/fldunit.hxx" #include "vcl/font.hxx" -#include "vcl/fontcvt.hxx" +#include "unotools/fontcvt.hxx" #include "vcl/graph.hxx" #include "vcl/group.hxx" #include "vcl/help.hxx" diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx index 992377ceb2..5ff4bbbab4 100644 --- a/sw/inc/postithelper.hxx +++ b/sw/inc/postithelper.hxx @@ -35,7 +35,7 @@ #include <redline.hxx> #include <vector> #include <vcl/window.hxx> -#include <svtools/brdcst.hxx> +#include <svl/brdcst.hxx> class SwTxtFld; class SwRootFrm; diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index 0e3c4670c4..9840c23f66 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -34,12 +34,12 @@ #include <tools/string.hxx> #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <pam.hxx> #include <IDocumentRedlineAccess.hxx> -#include <svtools/smplhint.hxx> +#include <svl/smplhint.hxx> class SfxItemSet; class SwView; diff --git a/sw/inc/rolbck.hxx b/sw/inc/rolbck.hxx index f910a44ca8..1f225aeeb8 100644 --- a/sw/inc/rolbck.hxx +++ b/sw/inc/rolbck.hxx @@ -34,9 +34,9 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_USHORTS #define _SVSTDARR_USHORTSSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> //Nur die History anziehen, um das docnew.cxx gegen die CLOOK's zu behaupten. @@ -78,8 +78,7 @@ class SwCharFmt; #include <memory> - -#ifndef PRODUCT +#ifdef DBG_UTIL class Writer; #define OUT_HSTR_HINT( name ) \ friend Writer& OutUndo_Hstr_ ## name( Writer&, const SwHistoryHint& ); diff --git a/sw/inc/rubylist.hxx b/sw/inc/rubylist.hxx index db60d35a6b..cbd023286e 100644 --- a/sw/inc/rubylist.hxx +++ b/sw/inc/rubylist.hxx @@ -30,7 +30,7 @@ #ifndef _RUBYLIST_HXX #define _RUBYLIST_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <swtypes.hxx> #include <fmtruby.hxx> diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index 4d883e8464..9d401aeb90 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -38,7 +38,7 @@ #ifndef _TOOLS_REF_HXX #include <tools/ref.hxx> #endif -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <frmfmt.hxx> // Forward Deklaration diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index d1ffa05e95..375036631a 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -538,7 +538,7 @@ public: inline SvStream& OutULong( ULONG nVal ) { return OutULong( Strm(), nVal ); } void SetStrm( SvStream& rStrm ) { pStrm = &rStrm; } -#ifdef PRODUCT +#ifndef DBG_UTIL SvStream& Strm() { return *pStrm; } #else SvStream& Strm(); @@ -637,6 +637,8 @@ public: typedef Reader* (*FnGetReader)(); typedef void (*FnGetWriter)(const String&, const String& rBaseURL, WriterRef&); +ULONG SaveOrDelMSVBAStorage( SfxObjectShell&, SotStorage&, BOOL, const String& ); +ULONG GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ); struct SwReaderWriterEntry { diff --git a/sw/inc/shellres.hxx b/sw/inc/shellres.hxx index 78b5f7ff61..4080e32418 100644 --- a/sw/inc/shellres.hxx +++ b/sw/inc/shellres.hxx @@ -39,7 +39,7 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif struct SW_DLLPUBLIC ShellResource : public Resource @@ -72,6 +72,8 @@ struct SW_DLLPUBLIC ShellResource : public Resource String aStrNone; // fuer Felder, die Fixiert sind String aFixedStr; + // custom fields of type css::util::Duration + String sDurationFormat; //names of TOXs String aTOXIndexName; diff --git a/sw/inc/sortopt.hxx b/sw/inc/sortopt.hxx index 15c6ec56a0..245f8ea94a 100644 --- a/sw/inc/sortopt.hxx +++ b/sw/inc/sortopt.hxx @@ -31,7 +31,7 @@ #define _SORTOPT_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <tools/string.hxx> #include "swdllapi.h" diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx index ef9ce118a2..35f18717db 100644 --- a/sw/inc/swatrset.hxx +++ b/sw/inc/swatrset.hxx @@ -31,8 +31,8 @@ #define _SWATRSET_HXX #include <tools/solar.h> #include <tools/mempool.hxx> -#include <svtools/itemset.hxx> -#include <svtools/itempool.hxx> +#include <svl/itemset.hxx> +#include <svl/itempool.hxx> #include <swdllapi.h> class SwModify; diff --git a/sw/inc/swfltopt.hxx b/sw/inc/swfltopt.hxx index 9413e9e0ec..be51b02bc8 100644 --- a/sw/inc/swfltopt.hxx +++ b/sw/inc/swfltopt.hxx @@ -40,6 +40,8 @@ public: void GetValues( sal_uInt16 nCnt, const sal_Char** ppNames, sal_uInt32* pValues ); + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); }; #endif diff --git a/sw/inc/swhints.hxx b/sw/inc/swhints.hxx index 6ae503bf7d..1b7fd9b27a 100644 --- a/sw/inc/swhints.hxx +++ b/sw/inc/swhints.hxx @@ -30,7 +30,7 @@ #ifndef SW_HINTS_HXX #define SW_HINTS_HXX -#include <svtools/smplhint.hxx> +#include <svl/smplhint.hxx> #define SW_BROADCASTID_START SFX_HINT_USER00 #define SW_BROADCAST_DRAWVIEWS_CREATED SW_BROADCASTID_START diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index f22dc9f569..d8de7b5c50 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -32,11 +32,12 @@ #include <tools/link.hxx> #include <tools/string.hxx> #include <vcl/fldunit.hxx> -#include <svtools/lstner.hxx> +#include <svl/lstner.hxx> +#include <unotools/options.hxx> #include <sfx2/module.hxx> #include <tools/shl.hxx> -#include <svtools/lstner.hxx> +#include <svl/lstner.hxx> #include "swdllapi.h" #include "shellid.hxx" #include <fldupde.hxx> @@ -77,7 +78,7 @@ namespace com{ namespace sun{ namespace star{ namespace scanner{ class XScannerManager; }}}} -class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener +class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::ConfigurationListener { String sActAuthor; @@ -126,6 +127,8 @@ class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener // Hint abfangen fuer DocInfo virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); + protected: // Briefumschlaege, Etiketten void InsertEnv(SfxRequest&); @@ -165,8 +168,8 @@ public: void ApplyRulerMetric( FieldUnit eMetric, BOOL bHorizontal, BOOL bWeb ); void ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags); void ApplyLinkMode(sal_Int32 nNewLinkMode); - - //default page mode for text grid + + //default page mode for text grid void ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode); // ConfigItems erzeugen diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx index 136eff0922..dd191916f8 100644 --- a/sw/inc/swrect.hxx +++ b/sw/inc/swrect.hxx @@ -35,10 +35,8 @@ class SvStream; class SwRect { - long nX; - long nY; - long nWidth; - long nHeight; + Point m_Point; + Size m_Size; public: @@ -177,137 +175,133 @@ typedef void (SwRect:: *SwRectSetPos)( const Point& ); //---------------------------------- Set-Methoden inline void SwRect::Chg( const Point& rNP, const Size &rNS ) { - nX = rNP.X(); nY = rNP.Y(); - nWidth = rNS.Width(); nHeight = rNS.Height(); + m_Point = rNP; + m_Size = rNS; } inline void SwRect::Pos( const Point& rNew ) { - nX = rNew.X(); nY = rNew.Y(); + m_Point = rNew; } inline void SwRect::Pos( const long nNewX, const long nNewY ) { - nX = nNewX; nY = nNewY; + m_Point.setX(nNewX); + m_Point.setY(nNewY); } inline void SwRect::SSize( const Size& rNew ) { - nWidth = rNew.Width(); nHeight = rNew.Height(); + m_Size = rNew; } inline void SwRect::SSize( const long nNewHeight, const long nNewWidth ) { - nWidth = nNewWidth; nHeight = nNewHeight; + m_Size.setWidth(nNewWidth); + m_Size.setHeight(nNewHeight); } inline void SwRect::Width( long nNew ) { - nWidth = nNew; + m_Size.setWidth(nNew); } inline void SwRect::Height( long nNew ) { - nHeight = nNew; + m_Size.setHeight(nNew); } inline void SwRect::Left( const long nLeft ) { - nWidth += nX - nLeft; - nX = nLeft; + m_Size.Width() += m_Point.getX() - nLeft; + m_Point.setX(nLeft); } inline void SwRect::Right( const long nRight ) { - nWidth = nRight - nX + 1; + m_Size.setWidth(nRight - m_Point.getX() + 1); } inline void SwRect::Top( const long nTop ) { - nHeight += nY - nTop; - nY = nTop; + m_Size.Height() += m_Point.getY() - nTop; + m_Point.setY(nTop); } inline void SwRect::Bottom( const long nBottom ) { - nHeight = nBottom - nY + 1; + m_Size.setHeight(nBottom - m_Point.getY() + 1); } //----------------------------------- Get-Methoden inline const Point &SwRect::Pos() const { - return *(Point*)(&nX); + return m_Point; } inline Point &SwRect::Pos() { - return *(Point*)(&nX); + return m_Point; } inline const Size &SwRect::SSize() const { - return *(Size*)(&nWidth); + return m_Size; } inline Size &SwRect::SSize() { - return *(Size*)(&nWidth); + return m_Size; } inline long SwRect::Width() const { - return nWidth; + return m_Size.Width(); } inline long SwRect::Height() const { - return nHeight; + return m_Size.Height(); } inline long SwRect::Left() const { - return nX; + return m_Point.X(); } inline long SwRect::Right() const { - return nWidth ? nX + nWidth - 1 : nX; + return m_Size.getWidth() ? m_Point.getX() + m_Size.getWidth() - 1 : m_Point.getX(); } inline long SwRect::Top() const { - return nY; + return m_Point.Y(); } inline long SwRect::Bottom() const { - return nHeight ? nY + nHeight - 1 : nY; + return m_Size.getHeight() ? m_Point.getY() + m_Size.getHeight() - 1 : m_Point.getY(); } //----------------------------------- operatoren inline SwRect &SwRect::operator = ( const SwRect &rRect ) { - nX = rRect.Left(); - nY = rRect.Top(); - nWidth = rRect.Width(); - nHeight = rRect.Height(); + m_Point = rRect.m_Point; + m_Size = rRect.m_Size; return *this; } inline BOOL SwRect::operator == ( const SwRect& rRect ) const { - return (nX == rRect.Left() && - nY == rRect.Top() && - nWidth == rRect.Width() && - nHeight == rRect.Height()); + return (m_Point == rRect.m_Point && m_Size == rRect.m_Size); } inline BOOL SwRect::operator != ( const SwRect& rRect ) const { - return (nX != rRect.Left() || - nY != rRect.Top() || - nWidth != rRect.Width() || - nHeight != rRect.Height()); + return (m_Point != rRect.m_Point || m_Size != rRect.m_Size); } inline SwRect &SwRect::operator+=( const Point &rPt ) { - nX += rPt.X(); nY += rPt.Y(); + m_Point += rPt; return *this; } inline SwRect &SwRect::operator-=( const Point &rPt ) { - nX -= rPt.X(); nY -= rPt.Y(); + m_Point -= rPt; return *this; } inline SwRect &SwRect::operator+=( const Size &rSz ) { - nWidth += rSz.Width(); nHeight += rSz.Height(); + m_Size.Width() += rSz.Width(); + m_Size.Height() += rSz.Height(); return *this; } inline SwRect &SwRect::operator-=( const Size &rSz ) { - nWidth -= rSz.Width(); nHeight -= rSz.Height(); + m_Size.Width() -= rSz.Width(); + m_Size.Height() -= rSz.Height(); return *this; } @@ -315,10 +309,10 @@ inline SwRect &SwRect::operator-=( const Size &rSz ) //--------------------------- Sonstiges inline Rectangle SwRect::SVRect() const { - ASSERT( nWidth && nHeight, "SVRect() ohne Widht oder Height" ); - return Rectangle( nX, nY, - nX + nWidth - 1, //Right() - nY + nHeight - 1 ); //Bottom() + ASSERT( !IsEmpty(), "SVRect() without Width or Height" ); + return Rectangle( m_Point.getX(), m_Point.getY(), + m_Point.getX() + m_Size.getWidth() - 1, //Right() + m_Point.getY() + m_Size.getHeight() - 1 ); //Bottom() } inline SwRect SwRect::GetIntersection( const SwRect& rRect ) const @@ -328,51 +322,44 @@ inline SwRect SwRect::GetIntersection( const SwRect& rRect ) const inline BOOL SwRect::HasArea() const { - return nHeight && nWidth; + return !IsEmpty(); } inline BOOL SwRect::IsEmpty() const { - return !(nHeight && nWidth); + return !(m_Size.getHeight() && m_Size.getWidth()); } inline void SwRect::Clear() { - nX = nY = nWidth = nHeight = 0; + m_Point.setX(0); + m_Point.setY(0); + m_Size.setWidth(0); + m_Size.setHeight(0); } //-------------------------- CToren inline SwRect::SwRect() : - nX( 0 ), - nY( 0 ), - nWidth ( 0 ), - nHeight( 0 ) + m_Point( 0, 0 ), + m_Size( 0, 0 ) { } inline SwRect::SwRect( const SwRect &rRect ) : - nX( rRect.Left() ), - nY( rRect.Top() ), - nWidth ( rRect.Width() ), - nHeight( rRect.Height() ) + m_Point( rRect.m_Point ), + m_Size( rRect.m_Size ) { } inline SwRect::SwRect( const Point& rLT, const Size& rSize ) : - nX( rLT.X() ), - nY( rLT.Y() ), - nWidth ( rSize.Width() ), - nHeight( rSize.Height()) + m_Point( rLT ), + m_Size( rSize ) { } inline SwRect::SwRect( const Point& rLT, const Point& rRB ) : - nX( rLT.X() ), - nY( rLT.Y() ), - nWidth ( rRB.X() - rLT.X() + 1 ), - nHeight( rRB.Y() - rLT.Y() + 1 ) + m_Point( rLT ), + m_Size( rRB.X() - rLT.X() + 1, rRB.Y() - rLT.Y() + 1 ) { } inline SwRect::SwRect( long X, long Y, long W, long H ) : - nX( X ), - nY( Y ), - nWidth ( W ), - nHeight( H ) + m_Point( X, Y ), + m_Size( W, H ) { } diff --git a/sw/inc/swregion.hxx b/sw/inc/swregion.hxx index 2ae70060ae..1dd2c5aa70 100644 --- a/sw/inc/swregion.hxx +++ b/sw/inc/swregion.hxx @@ -30,7 +30,7 @@ #ifndef _SWREGION_HXX #define _SWREGION_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include "swrect.hxx" diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index 92a04e4111..a5695c6352 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -33,12 +33,12 @@ #ifndef _TOOLS_REF_HXX #include <tools/ref.hxx> #endif -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <tblenum.hxx> #include <swtypes.hxx> #include <calbck.hxx> #include <swrect.hxx> -#ifdef PRODUCT +#ifndef DBG_UTIL #include <node.hxx> // fuer StartNode->GetMyIndex #else class SwStartNode; @@ -111,7 +111,7 @@ protected: BOOL bModifyLocked :1; BOOL bNewModel :1; // FALSE: old SubTableModel; TRUE: new RowSpanModel -#ifndef PRODUCT +#ifdef DBG_UTIL bool bDontChangeModel; // This is set by functions (like Merge()) to forbid a laet model change #endif @@ -210,7 +210,7 @@ public: BOOL Merge( SwDoc* pDoc, const SwSelBoxes& rBoxes, const SwSelBoxes& rMerged, SwTableBox* pMergeBox, SwUndoTblMerge* pUndo = 0 ) { -#ifndef PRODUCT +#ifdef DBG_UTIL bDontChangeModel = true; #endif return bNewModel ? NewMerge( pDoc, rBoxes, rMerged, pMergeBox, pUndo ) : @@ -219,7 +219,7 @@ public: BOOL SplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, USHORT nCnt=1, BOOL bSameHeight = FALSE ) { -#ifndef PRODUCT +#ifdef DBG_UTIL bDontChangeModel = true; #endif return bNewModel ? NewSplitRow( pDoc, rBoxes, nCnt, bSameHeight ) : @@ -323,7 +323,7 @@ public: SwTwips nAbsDiff, SwTwips nRelDiff, SwUndo** ppUndo ); BOOL SetRowHeight( SwTableBox& rAktBox, USHORT eType, SwTwips nAbsDiff, SwTwips nRelDiff, SwUndo** ppUndo ); -#ifndef PRODUCT +#ifdef DBG_UTIL void CheckConsistency() const; #endif }; @@ -412,7 +412,7 @@ public: const SwStartNode *GetSttNd() const { return pSttNd; } ULONG GetSttIdx() const -#ifdef PRODUCT +#ifndef DBG_UTIL { return pSttNd ? pSttNd->GetIndex() : 0; } #else ; diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx index 51eea3343d..6e98953205 100644 --- a/sw/inc/swundo.hxx +++ b/sw/inc/swundo.hxx @@ -30,7 +30,7 @@ #ifndef _SWUNDO_HXX #define _SWUNDO_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> // die Ids fuer StdAktionen enum SwUndoId diff --git a/sw/inc/tabcol.hxx b/sw/inc/tabcol.hxx index 97a1215aa5..55f474e810 100644 --- a/sw/inc/tabcol.hxx +++ b/sw/inc/tabcol.hxx @@ -33,7 +33,7 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_LONGS #define _SVSTDARR_BOOLS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #ifndef INCLUDED_VECTOR diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx index 100ca2d9da..ececf6e0c4 100644 --- a/sw/inc/tblafmt.hxx +++ b/sw/inc/tblafmt.hxx @@ -47,7 +47,7 @@ JP 20.07.95: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! **************************************************************************/ -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include "hintids.hxx" //_immmer_ vor den solar-items! #include <svx/algitem.hxx> #include <svx/fontitem.hxx> @@ -65,7 +65,7 @@ JP 20.07.95: #include <svx/brshitem.hxx> #include <svx/adjitem.hxx> #include <svx/rotmodit.hxx> -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include <svx/bolnitem.hxx> #include "swdllapi.h" diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx index 5b1b4161cf..71b32a77a9 100644 --- a/sw/inc/tblsel.hxx +++ b/sw/inc/tblsel.hxx @@ -30,7 +30,7 @@ #ifndef _TBLSEL_HXX #define _TBLSEL_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <swtable.hxx> #include <swrect.hxx> #include "swdllapi.h" diff --git a/sw/inc/tgrditem.hxx b/sw/inc/tgrditem.hxx index e18dc78d3a..b5995249cf 100644 --- a/sw/inc/tgrditem.hxx +++ b/sw/inc/tgrditem.hxx @@ -31,7 +31,7 @@ #define SW_TGRDITEM_HXX #include <tools/color.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include "swdllapi.h" #include <hintids.hxx> #include <format.hxx> diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx index 17c9c3103e..74bebda882 100644 --- a/sw/inc/tox.hxx +++ b/sw/inc/tox.hxx @@ -34,8 +34,8 @@ #include <tools/string.hxx> #include <svx/svxenum.hxx> -#include <svtools/svarray.hxx> -#include <svtools/poolitem.hxx> +#include <svl/svarray.hxx> +#include <svl/poolitem.hxx> #include "swdllapi.h" #include <swtypes.hxx> #include <toxe.hxx> diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx index da08842e02..01014b424b 100644 --- a/sw/inc/txatbase.hxx +++ b/sw/inc/txatbase.hxx @@ -31,7 +31,7 @@ #define _TXATBASE_HXX #include <tools/solar.h> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <hintids.hxx> #include <errhdl.hxx> @@ -121,7 +121,6 @@ public: inline const SwTOXMark &GetTOXMark() const; inline const SwFmtRefMark &GetRefMark() const; inline const SwFmtINetFmt &GetINetFmt() const; - inline const SvXMLAttrContainerItem &GetXMLAttrContainer() const; inline const SwFmtRuby &GetRuby() const; inline const SwFmtMeta &GetMeta() const; @@ -230,13 +229,6 @@ inline const SwFmtINetFmt& SwTxtAttr::GetINetFmt() const return (const SwFmtINetFmt&)(*m_pAttr); } -inline const SvXMLAttrContainerItem& SwTxtAttr::GetXMLAttrContainer() const -{ - ASSERT( m_pAttr && m_pAttr->Which() == RES_UNKNOWNATR_CONTAINER, - "Wrong attribute" ); - return (const SvXMLAttrContainerItem&)(*m_pAttr); -} - inline const SwFmtRuby& SwTxtAttr::GetRuby() const { ASSERT( m_pAttr && m_pAttr->Which() == RES_TXTATR_CJK_RUBY, diff --git a/sw/inc/txatritr.hxx b/sw/inc/txatritr.hxx index 9717a1325f..1c78f134c6 100644 --- a/sw/inc/txatritr.hxx +++ b/sw/inc/txatritr.hxx @@ -32,7 +32,7 @@ #include <tools/solar.h> #include <sal/types.h> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <svx/langitem.hxx> #include <hintids.hxx> diff --git a/sw/inc/txtatr.hxx b/sw/inc/txtatr.hxx index 5a36625d52..3af8e54bf6 100644 --- a/sw/inc/txtatr.hxx +++ b/sw/inc/txtatr.hxx @@ -60,15 +60,6 @@ public: }; -// ATT_XMLCONTAINERITEM ****************************** - -class SwTxtXMLAttrContainer : public SwTxtAttrEnd -{ -public: - SwTxtXMLAttrContainer( SvXMLAttrContainerItem& rAttr, - xub_StrLen nStart, xub_StrLen nEnd ); -}; - // ****************************** class SwTxtAttrNesting : public SwTxtAttrEnd diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx index f45806e558..9c5f337460 100644 --- a/sw/inc/undobj.hxx +++ b/sw/inc/undobj.hxx @@ -36,9 +36,9 @@ #define _SVSTDARR_BOOLS #define _SVSTDARR_BYTES #define _SVSTDARR_USHORTSSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <com/sun/star/uno/Sequence.h> #include <numrule.hxx> #include <itabenum.hxx> @@ -115,7 +115,7 @@ namespace utl { class TransliterationWrapper; } -#ifndef PRODUCT +#ifdef DBG_UTIL class Writer; class SwUndo; #define OUT_UNDOBJ( name ) \ @@ -206,6 +206,11 @@ namespace nsDelCntntType const DelCntntType DELCNT_CHKNOCNTNT = 0x80; } +/// will DelCntntIndex destroy a frame anchored at character at rAnchorPos? +bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos, + SwPosition const & rStart, SwPosition const & rEnd, + DelCntntType const nDelCntntType = nsDelCntntType::DELCNT_ALL); + // diese Klasse muss in ein Undo-Object vererbt werden, wenn dieses Inhalt // fuers Redo/Undo ... speichert class SwUndoSaveCntnt diff --git a/sw/inc/unoatxt.hxx b/sw/inc/unoatxt.hxx index 281abb76db..d9194cebd5 100644 --- a/sw/inc/unoatxt.hxx +++ b/sw/inc/unoatxt.hxx @@ -41,8 +41,8 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/document/XEventsSupplier.hpp> -#include <svtools/itemprop.hxx> -#include <svtools/lstner.hxx> +#include <svl/itemprop.hxx> +#include <svl/lstner.hxx> #include <cppuhelper/implbase3.hxx> // helper for implementations #include <cppuhelper/implbase4.hxx> // helper for implementations #include <cppuhelper/implbase5.hxx> // helper for implementations diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx index eeb3a81af1..a1d5139897 100644 --- a/sw/inc/unocoll.hxx +++ b/sw/inc/unocoll.hxx @@ -43,6 +43,7 @@ #include <cppuhelper/implbase4.hxx> // helper for implementations #include <IMark.hxx> #include <unobaseclass.hxx> +#include "swdllapi.h" /*************************************************** *************************************************** * @@ -284,7 +285,7 @@ cppu::WeakImplHelper3 ::com::sun::star::lang::XServiceInfo > SwCollectionBaseClass; -class SwXTextTables : public SwCollectionBaseClass, +class SW_DLLPUBLIC SwXTextTables : public SwCollectionBaseClass, public SwUnoCollection { protected: diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx index 682f034da5..3112d11a81 100644 --- a/sw/inc/unodraw.hxx +++ b/sw/inc/unodraw.hxx @@ -48,7 +48,7 @@ #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/drawing/HomogenMatrix3.hpp> // <-- -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> class SdrMarkList; class SdrView; diff --git a/sw/inc/unoevent.hxx b/sw/inc/unoevent.hxx index 8f63bf4c30..912197d6ac 100644 --- a/sw/inc/unoevent.hxx +++ b/sw/inc/unoevent.hxx @@ -31,7 +31,7 @@ #define _UNOEVENT_HXX #include <svtools/unoevent.hxx> -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> class SvxMacroItem; diff --git a/sw/inc/unoevtlstnr.hxx b/sw/inc/unoevtlstnr.hxx index f9804061aa..c19197e13a 100644 --- a/sw/inc/unoevtlstnr.hxx +++ b/sw/inc/unoevtlstnr.hxx @@ -30,7 +30,7 @@ #ifndef _UNOEVTLSTNR_HXX #define _UNOEVTLSTNR_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <com/sun/star/uno/Reference.h> namespace com{namespace sun{namespace star{ diff --git a/sw/inc/unomailmerge.hxx b/sw/inc/unomailmerge.hxx index a9710a2e32..67f6429e95 100644 --- a/sw/inc/unomailmerge.hxx +++ b/sw/inc/unomailmerge.hxx @@ -43,7 +43,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/beans/PropertyChangeEvent.hpp> #include <com/sun/star/text/XMailMergeBroadcaster.hpp> -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> #include <sfx2/objsh.hxx> // SfxObjectShellRef #include <functional> diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx index 0a19f4fbd4..2ca6e80b6d 100644 --- a/sw/inc/unomap.hxx +++ b/sw/inc/unomap.hxx @@ -30,7 +30,7 @@ #ifndef _UNOMAP_HXX #define _UNOMAP_HXX -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> #define PROPERTY_NONE 0 @@ -251,6 +251,7 @@ #define WID_DOC_LOCK_UPDATES 1016 #define WID_DOC_HAS_VALID_SIGNATURES 1017 #define WID_DOC_BUILDID 1024 +#define WID_DOC_ISTEMPLATEID 1025 // --> OD 2006-03-21 #b6375613# #define WID_APPLY_WORKAROUND_FOR_B6375613 1070 // <-- @@ -295,6 +296,7 @@ #define WID_LAYOUT_SIZE 1104 #define WID_DOC_DIALOG_LIBRARIES 1105 +#define WID_DOC_VBA_DOCOBJ 1106 //AutoText diff --git a/sw/inc/unoobj.hxx b/sw/inc/unoobj.hxx index e2e8b02dde..5fa7d155ef 100644 --- a/sw/inc/unoobj.hxx +++ b/sw/inc/unoobj.hxx @@ -34,8 +34,8 @@ #include <unoevtlstnr.hxx> #include <unobaseclass.hxx> #include <unocrsr.hxx> -#include <svtools/itemprop.hxx> -#include <svtools/svarray.hxx> +#include <svl/itemprop.hxx> +#include <svl/svarray.hxx> #include <frmfmt.hxx> #include <flyenum.hxx> #include <fldbas.hxx> diff --git a/sw/inc/unoport.hxx b/sw/inc/unoport.hxx index b395d1c107..70accec12f 100644 --- a/sw/inc/unoport.hxx +++ b/sw/inc/unoport.hxx @@ -48,7 +48,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <cppuhelper/implbase8.hxx> #include <cppuhelper/implbase3.hxx> -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> #include <memory> #include <deque> diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 0b59929824..14338d4540 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -808,7 +808,9 @@ enum SwPropNameIds /* 0737 */ UNO_NAME_DESCRIPTION, // <-- /* 0738 */ UNO_NAME_META, // #i91565# -/* 0739 */ SW_PROPNAME_END +/* 0739 */ UNO_NAME_IS_TEMPLATE, +/* 0740 */ UNO_NAME_VBA_DOCOBJ, +/* 0741 */ SW_PROPNAME_END }; diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx index f0b9c6c1c2..423d9639e2 100644 --- a/sw/inc/unosett.hxx +++ b/sw/inc/unosett.hxx @@ -44,7 +44,7 @@ #include <cppuhelper/implbase4.hxx> #include <cppuhelper/implbase5.hxx> #include <tools/string.hxx> -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> class SwDoc; class SwFmtCol; diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx index dc0fdc382d..f2f48add60 100644 --- a/sw/inc/unostyle.hxx +++ b/sw/inc/unostyle.hxx @@ -31,8 +31,8 @@ #define _UNOSTYLE_HXX #include <boost/shared_ptr.hpp> -#include <svtools/style.hxx> -#include <svtools/lstner.hxx> +#include <svl/style.hxx> +#include <svl/lstner.hxx> #include <unocoll.hxx> #include <unomap.hxx> #include <com/sun/star/style/XStyle.hpp> diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx index 9c45836143..05983afdba 100644 --- a/sw/inc/unotbl.hxx +++ b/sw/inc/unotbl.hxx @@ -214,14 +214,13 @@ typedef cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::beans::XPropertySet > SwXTextTableCursor_Base; -class SwXTextTableCursor : public SwXTextTableCursor_Base +class SW_DLLPUBLIC SwXTextTableCursor : public SwXTextTableCursor_Base ,public SwClient ,public OTextCursorHelper { SwDepend aCrsrDepend; const SfxItemPropertySet* m_pPropSet; - SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); } // SwUnoCrsr* GetCrsr() const { return (SwUnoCrsr*)aCrsrDepend.GetRegisteredIn(); } protected: @@ -271,6 +270,7 @@ public: const SwUnoCrsr* GetCrsr() const; SwUnoCrsr* GetCrsr(); + SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); } }; /*-----------------11.12.97 09:38------------------- diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 1af8e747c0..7445b228f3 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -30,7 +30,7 @@ #ifndef _UNOTXDOC_HXX #define _UNOTXDOC_HXX #include "swdllapi.h" -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <sfx2/sfxbasemodel.hxx> #include <com/sun/star/beans/PropertyValues.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> @@ -70,7 +70,7 @@ #include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp> #include <com/sun/star/document/XDocumentLanguages.hpp> #include <com/sun/star/util/XCloneable.hpp> -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> #include <svx/fmdmod.hxx> #include <svx/UnoForbiddenCharsTable.hxx> #include <cppuhelper/weak.hxx> diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index 98d88b87b3..1a05d08c40 100644 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -175,7 +175,7 @@ protected: BYTE nTblDest; // Ziel fuer Tabellenhintergrund -#ifndef PRODUCT +#ifdef DBG_UTIL // korrespondieren zu den Angaben in ui/config/cfgvw.src BOOL bTest1 :1; // Test-Flag "Layout not loading" BOOL bTest2 :1; // Test-Flag "WYSIWYG++" @@ -417,7 +417,7 @@ public: USHORT GetViewLayoutColumns() const { return mnViewLayoutColumns; } void SetViewLayoutColumns( USHORT nNew ) { mnViewLayoutColumns = nNew; } -#ifndef PRODUCT +#ifdef DBG_UTIL // korrespondieren zu den Angaben in ui/config/cfgvw.src inline BOOL IsTest1() const { return bTest1; } inline void SetTest1( BOOL b ) { bTest1 = b; } diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 36fe5919ed..afff32a04d 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -32,7 +32,7 @@ #include <com/sun/star/embed/XClassifiedObject.hpp> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <tools/rtti.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include "swdllapi.h" #include <swtypes.hxx> #include <ring.hxx> diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx index 34c11f2393..7988aaf209 100644 --- a/sw/inc/viscrs.hxx +++ b/sw/inc/viscrs.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -169,7 +169,7 @@ public: // TRUE: an die Position kann der Cursor gesetzt werden virtual BOOL IsAtValidPos( BOOL bPoint = TRUE ) const; -#ifndef PRODUCT +#ifdef DBG_UTIL // JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung // am sichtbaren Cursor virtual BOOL IsSelOvr( int eFlags = @@ -213,7 +213,7 @@ public: // TRUE: an die Position kann der Cursor gesetzt werden virtual BOOL IsAtValidPos( BOOL bPoint = TRUE ) const; -#ifndef PRODUCT +#ifdef DBG_UTIL // JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung // am sichtbaren Cursor virtual BOOL IsSelOvr( int eFlags = diff --git a/sw/prj/build.lst b/sw/prj/build.lst index d8cac64ff9..6fd49c1d77 100644..100755 --- a/sw/prj/build.lst +++ b/sw/prj/build.lst @@ -1,4 +1,4 @@ -sw sw : l10n connectivity OOo:writerperfect svx stoc uui writerfilter NULL +sw sw : filter l10n connectivity OOo:writerperfect vbahelper svx stoc writerfilter NULL sw sw usr1 - all sw_mkout NULL sw sw\inc nmake - all sw_inc NULL sw sw\uiconfig\layout nmake - all sw_layout NULL @@ -33,6 +33,7 @@ sw sw\source\ui\smartmenu nmake sw sw\source\ui\table nmake - all sw_table sw_inc NULL sw sw\source\ui\uiview nmake - all sw_uivw sw_sdi sw_inc NULL sw sw\source\ui\uno nmake - all sw_uiuno sw_sdi sw_inc NULL +sw sw\source\ui\vba nmake - all sw_vba sw_inc NULL sw sw\source\ui\utlui nmake - all sw_utlui sw_inc NULL sw sw\source\ui\web nmake - all sw_web sw_uinc sw_sdi sw_inc NULL sw sw\source\ui\wrtsh nmake - all sw_wrtsh sw_inc NULL @@ -69,7 +70,7 @@ sw sw\source\filter\writer nmake - all sw_wrtr sw_i sw sw\source\filter\ww1 nmake - all sw_ww1 sw_inc NULL sw sw\source\filter\ww8 nmake - all sw_ww8 sw_inc NULL sw sw\source\filter\xml nmake - all sw_xml sw_inc NULL -sw sw\source\ui nmake - all sw_ui sw_app sw_cctrl sw_chrdl sw_conf sw_dbui sw_dchdl sw_dcvw sw_dlg sw_envlp sw_fldui sw_fmtui sw_frmdl sw_globd sw_index sw_ling sw_misc sw_rbbar sw_shell sw_table sw_uiuno sw_uivw sw_utlui sw_web sw_wrtsh sw_smartmenu NULL +sw sw\source\ui nmake - all sw_ui sw_app sw_cctrl sw_chrdl sw_conf sw_dbui sw_dchdl sw_dcvw sw_dlg sw_envlp sw_fldui sw_fmtui sw_frmdl sw_globd sw_index sw_ling sw_misc sw_rbbar sw_shell sw_table sw_uiuno sw_uivw sw_utlui sw_web sw_wrtsh sw_smartmenu sw_vba NULL sw sw\source\core nmake - all sw_core sw_attr sw_bast sw_crsr sw_dcnd sw_doc sw_draw sw_edit sw_excpt sw_fld sw_frmed sw_grph sw_layo sw_ole sw_para sw_sw3io sw_swg sw_text sw_tox sw_txtnd sw_uco sw_undo sw_view sw_acc sw_objpos sw_NumberTree sw_tablecore NULL sw sw\source\filter nmake - all sw_flt sw_ascii sw_bsflt sw_html sw_rtf sw_wrtr sw_ww1 sw_ww8 sw_xml NULL sw sw\util nmake - all sw_util sw_core sw_flt sw_sdi sw_ui NULL diff --git a/sw/prj/d.lst b/sw/prj/d.lst index 09c417cd6f..958771dad2 100644 --- a/sw/prj/d.lst +++ b/sw/prj/d.lst @@ -63,6 +63,7 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\swreport\statusbar ..\%__SRC%\bin\swd?????.dll %_DEST%\bin%_EXT%\swd?????.dll ..\%__SRC%\bin\swui?????.dll %_DEST%\bin%_EXT%\swui?????.dll ..\%__SRC%\bin\msword?????.dll %_DEST%\bin%_EXT%\msword?????.dll +..\%__SRC%\bin\vbaswobj*.dll %_DEST%\bin%_EXT%\vbaswobj*.dll ..\%__SRC%\bin\sw*.res %_DEST%\bin%_EXT%\sw*.res ..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.* diff --git a/sw/qa/complex/checkColor/makefile.mk b/sw/qa/complex/checkColor/makefile.mk index 0541b44e1d..d9f7060a83 100755 --- a/sw/qa/complex/checkColor/makefile.mk +++ b/sw/qa/complex/checkColor/makefile.mk @@ -40,7 +40,7 @@ PACKAGE = complex$/checkColor #----- compile .java files ----------------------------------------- -JARFILES = mysql.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar mysql.jar +JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar mysql.jar JAVAFILES = CheckChangeColor.java JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) diff --git a/sw/qa/complex/indeterminateState/makefile.mk b/sw/qa/complex/indeterminateState/makefile.mk index 5261e70667..731822e032 100755 --- a/sw/qa/complex/indeterminateState/makefile.mk +++ b/sw/qa/complex/indeterminateState/makefile.mk @@ -40,7 +40,7 @@ PACKAGE = complex$/indeterminateState #----- compile .java files ----------------------------------------- -JARFILES = mysql.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar JAVAFILES = CheckIndeterminateState.java JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) diff --git a/sw/qa/complex/writer/TextPortionEnumerationTest.java b/sw/qa/complex/writer/TextPortionEnumerationTest.java index aec77b891a..a07b3cccad 100755..100644 --- a/sw/qa/complex/writer/TextPortionEnumerationTest.java +++ b/sw/qa/complex/writer/TextPortionEnumerationTest.java @@ -2099,6 +2099,19 @@ public class TextPortionEnumerationTest extends ComplexTestCase .appendChild( url4.dup().appendChild( new TextNode("7") ) ) .appendChild( new TextNode("89") ); doTest(root, false); + // empty + TreeNode url6 = new HyperlinkNode( mkName("url") ); + inserter.insertRange( new Range(7, 7, url6) ); + root = new TreeNode() + .appendChild( url2.dup().appendChild( new TextNode("12") ) ) + .appendChild( url1.dup().appendChild( new TextNode("3") ) ) + .appendChild( url4.dup().appendChild( new TextNode("4") ) ) + .appendChild( url5.dup().appendChild( new TextNode("56") ) ) + .appendChild( url4.dup().appendChild( new TextNode("7") ) ) +// this one gets eaten, but we still need to test inserting it (#i106930#) +// .appendChild( url6.dup().appendChild( new TextNode("") ) ) + .appendChild( new TextNode("89") ); + doTest(root, false); } public void testRangeHyperlinkRuby() throws Exception diff --git a/sw/qa/complex/writer/makefile.mk b/sw/qa/complex/writer/makefile.mk index de5200d471..9aa7e95c9a 100755 --- a/sw/qa/complex/writer/makefile.mk +++ b/sw/qa/complex/writer/makefile.mk @@ -40,7 +40,7 @@ PACKAGE = complex$/writer #----- compile .java files ----------------------------------------- -JARFILES = mysql.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar JAVAFILES = CheckIndexedPropertyValues.java CheckNamedPropertyValues.java CheckCrossReferences.java CheckBookmarks.java CheckFlies.java TextPortionEnumerationTest.java JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) diff --git a/sw/qa/core/Test-BigPtrArray.cxx b/sw/qa/core/Test-BigPtrArray.cxx index 4b0f9a53cc..965f71224c 100644 --- a/sw/qa/core/Test-BigPtrArray.cxx +++ b/sw/qa/core/Test-BigPtrArray.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" #define TIMELOG -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <bparr.hxx> #include <string> #include <stdlib.h> @@ -45,37 +45,37 @@ using namespace std; namespace /* private */ { - const int NUM_ENTRIES = 100000; - + const int NUM_ENTRIES = 100000; + class BigPtrEntryMock : public BigPtrEntry { public: BigPtrEntryMock(int count) : count_(count) { } - + ~BigPtrEntryMock() { #ifdef ENABLE_DEBUG_OUTPUT printf("Destructor called (%i)\n", count_); #endif } - + int getCount() const { return count_; } - + void setCount(int newCount) { count_ = newCount; } - + ULONG Position() const { return GetPos(); } - + private: int count_; }; @@ -86,30 +86,30 @@ namespace /* private */ pbem->setCount(pbem->getCount() + *((int*)pArgs)); return true; } - + void dumpBigPtrArray(const BigPtrArray& bparr) { #ifdef ENABLE_DEBUG_OUTPUT - for (int i = 0; i < bparr.Count(); i++) + for (int i = 0; i < bparr.Count(); i++) printf("bparr[%i,%i]: %i\n", i, static_cast<BigPtrEntryMock*>(bparr[i])->Position(), static_cast<BigPtrEntryMock*>(bparr[i])->getCount()); - - printf("\n"); + + printf("\n"); #endif } - + void fillBigPtrArray(BigPtrArray& bparr, ULONG numEntries) - { + { for (int i = 0; i < numEntries; i++) bparr.Insert(new BigPtrEntryMock(i), bparr.Count()); } - + void printMethodName(const char* name) { #ifdef ENABLE_DEBUG_OUTPUT printf(name); #endif } - + bool checkElementPositions(const BigPtrArray& bparr) { for (int i = 0; i < bparr.Count(); i++) @@ -118,12 +118,12 @@ namespace /* private */ return false; } return true; - } - + } + void releaseBigPtrArrayContent(BigPtrArray& bparr) { for (int i = 0; i < bparr.Count(); i++) - delete bparr[i]; + delete bparr[i]; } RTL_LOGFILE_CONTEXT(logFile, "BigPtrArray performance measures" ); @@ -132,37 +132,37 @@ namespace /* private */ class BigPtrArrayUnittest : public CppUnit::TestFixture { public: - + BigPtrArrayUnittest() { } - + /** Test constructor/destructor - The size of the BigPtrArray - aka the 'Count' should be 0 + The size of the BigPtrArray + aka the 'Count' should be 0 initially. */ void test_ctor() - { - printMethodName("test_ctor\n"); - - BigPtrArray bparr; - + { + printMethodName("test_ctor\n"); + + BigPtrArray bparr; + CPPUNIT_ASSERT_MESSAGE ( - "BigPtrArray ctor failed", + "BigPtrArray ctor failed", bparr.Count() == 0 - ); - } - + ); + } + void test_insert_entries_at_front() - { + { printMethodName("test_insert_entries_at_front\n"); - + RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_insert_entries_at_front"); - - BigPtrArray bparr; - + + BigPtrArray bparr; + for (int i = 0; i < NUM_ENTRIES; i++) { ULONG oldCount = bparr.Count(); @@ -173,9 +173,9 @@ public: (bparr.Count() == oldCount + 1) ) } - + RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_insert_entries_at_front"); - + for (int i = 0, j = NUM_ENTRIES - 1; i < NUM_ENTRIES; i++, j--) { CPPUNIT_ASSERT_MESSAGE @@ -184,17 +184,17 @@ public: static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == j ) } - + CPPUNIT_ASSERT_MESSAGE ( "test_insert_entries_at_front failed", checkElementPositions(bparr) ) - + releaseBigPtrArrayContent(bparr); - dumpBigPtrArray(bparr); + dumpBigPtrArray(bparr); } - + void test_insert_entries_in_the_middle() { printMethodName("test_insert_entries_in_the_middle\n"); diff --git a/sw/qa/core/makefile.mk b/sw/qa/core/makefile.mk index 66308d1eed..3982536b28 100644 --- a/sw/qa/core/makefile.mk +++ b/sw/qa/core/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk # BEGIN ---------------------------------------------------------------- -# auto generated Target:testjob by codegen.pl +# auto generated Target:testjob by codegen.pl .IF "$(GUI)" == "WNT" CFLAGS+=/Ob1 @@ -52,17 +52,7 @@ SHL1OBJS=$(SLO)$/Test-BigPtrArray.obj \ $(SLO)$/bparr.obj SHL1TARGET=$(TARGET) -SHL1STDLIBS=$(SALLIB) $(TOOLSLIB) - -.IF "$(GUI)" == "WNT" -SHL1STDLIBS+= $(SOLARLIBDIR)$/cppunit.lib -.ENDIF -.IF "$(GUI)" == "UNX" -SHL1STDLIBS+=$(SOLARLIBDIR)$/libcppunit$(DLLPOSTFIX).a -# .IF "$(OS)" == "SOLARIS" -# SHL1STDLIBS += -lrt -laio -# .ENDIF -.ENDIF +SHL1STDLIBS=$(SALLIB) $(TOOLSLIB) $(CPPUNITLIB) $(TESTSHL2LIB) SHL1IMPLIB= i$(SHL1TARGET) diff --git a/sw/sdi/_docsh.sdi b/sw/sdi/_docsh.sdi index cf71e18bd8..de0be1f9a5 100644 --- a/sw/sdi/_docsh.sdi +++ b/sw/sdi/_docsh.sdi @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,7 +28,7 @@ * ************************************************************************/ -interface BaseTextDocument : OfficeDocument +interface BaseTextDocument [ Automation = FALSE; ] @@ -72,7 +72,7 @@ interface BaseTextDocument : OfficeDocument [ ExecMethod = Execute ; ] - + SID_SPELLCHECKER_CHANGED [ ExecMethod = Execute ; @@ -122,7 +122,7 @@ interface BaseTextDocument : OfficeDocument ExecMethod = Execute ; StateMethod = GetState; ] - + SID_ATTR_CHAR_FONTLIST [ StateMethod = GetState ; diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index 27c8cb4d85..5e5316fc61 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -29,7 +29,7 @@ ************************************************************************/ -interface BaseTextEditView : View +interface BaseTextEditView [ Automation = FALSE; ] diff --git a/sw/sdi/docsh.sdi b/sw/sdi/docsh.sdi index ca6fb62396..d1619df2f1 100644 --- a/sw/sdi/docsh.sdi +++ b/sw/sdi/docsh.sdi @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -68,7 +68,7 @@ interface TextDocument : BaseTextDocument ] } -shell SwDocShell : SfxObjectShell +shell SwDocShell { import TextDocument[Automation]; } diff --git a/sw/sdi/makefile.mk b/sw/sdi/makefile.mk index 25b75feea0..016b0df6cb 100644 --- a/sw/sdi/makefile.mk +++ b/sw/sdi/makefile.mk @@ -53,7 +53,12 @@ SDI1EXPORT=swriter # --- Files -------------------------------------------------------- SVSDI1DEPEND= \ - switems.sdi\ + $(SOLARINCXDIR)$/sfx2/sfx.sdi \ + $(SOLARINCXDIR)$/sfx2/sfxitems.sdi \ + $(SOLARINCXDIR)$/svx/svx.sdi \ + $(SOLARINCXDIR)$/svx/svxitems.sdi \ + $(SOLARINCXDIR)$/svx/xoitems.sdi \ + switems.sdi\ swriter.sdi\ _docsh.sdi\ docsh.sdi\ @@ -97,8 +102,7 @@ SVSDI1DEPEND= \ annotsh.sdi\ swslots.hrc \ $(INC)$/globals.hrc \ - $(INC)$/cmdid.h \ - $(SOLARINCXDIR)$/svxslots.ilb + $(INC)$/cmdid.h .ENDIF # --- Targets ------------------------------------------------------- diff --git a/sw/sdi/swslots.sdi b/sw/sdi/swslots.sdi index 789301f418..8eea2b6903 100644 --- a/sw/sdi/swslots.sdi +++ b/sw/sdi/swslots.sdi @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -28,8 +28,6 @@ * ************************************************************************/ -import "svxslots.ilb" - module "9F76B581-23DD-101C-80B6-000024021835" "A1810F00-23DE-101C-80B6-000024021835" @@ -37,10 +35,15 @@ StarWriter [ HelpText( "StarWriter Application" ) SlotIdFile( "swslots.hrc" ) -TypeLibFile( "swslots.tlb" ) ModulePrefix( "Sw" ) ] { + include "sfx2/sfxitems.sdi" + include "sfx2/sfx.sdi" + include "svx/svxitems.sdi" + include "svx/xoitems.sdi" + include "svx/svx.sdi" + item String TbxDummyItem; /* item String XFillAttrSetItem; @@ -116,7 +119,7 @@ ModulePrefix( "Sw" ) include "_mediash.sdi" include "mediash.sdi" - + include "_annotsh.sdi" include "annotsh.sdi" diff --git a/sw/sdi/viewsh.sdi b/sw/sdi/viewsh.sdi index 3d7ccb7f66..bc1a02612f 100644 --- a/sw/sdi/viewsh.sdi +++ b/sw/sdi/viewsh.sdi @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -145,7 +145,7 @@ interface TextEditView : BaseTextEditView } //========================================================================= -shell SwView : SfxViewShell +shell SwView { import TextEditView [Automation]; @@ -155,7 +155,7 @@ shell SwView : SfxViewShell // import ReplaceAttributes; } -interface TextPrintPreview : View +interface TextPrintPreview [ uuid = "1622A480-111A-101D-9757-6E74207A7520" ] { SID_BROWSER_MODE @@ -325,7 +325,7 @@ interface TextPrintPreview : View //========================================================================= -shell SwPagePreView : SfxViewShell +shell SwPagePreView { import TextPrintPreview[Automation]; } diff --git a/sw/sdi/wdocsh.sdi b/sw/sdi/wdocsh.sdi index 478023ac52..711bb4620f 100644 --- a/sw/sdi/wdocsh.sdi +++ b/sw/sdi/wdocsh.sdi @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,7 +47,7 @@ interface WebDocument : BaseTextDocument ] } -shell SwWebDocShell : SfxObjectShell +shell SwWebDocShell { import WebDocument[Automation]; } diff --git a/sw/sdi/wviewsh.sdi b/sw/sdi/wviewsh.sdi index f4b2bb2e91..c65183d7db 100644 --- a/sw/sdi/wviewsh.sdi +++ b/sw/sdi/wviewsh.sdi @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -63,7 +63,7 @@ interface WebEditView : BaseTextEditView ] } -shell SwWebView : SfxViewShell +shell SwWebView { import WebEditView [Automation]; // import SearchSettings; @@ -73,7 +73,7 @@ shell SwWebView : SfxViewShell } -interface WebSourceView : View +interface WebSourceView [ uuid = "95069CE0-69D8-101D-9757-C667E8298000"] { SID_TABLE_CELL // status() @@ -195,7 +195,7 @@ interface WebSourceView : View ] } -shell SwSrcView : SfxViewShell +shell SwSrcView { import WebSourceView [Automation]; diff --git a/sw/source/core/SwNumberTree/SwNumberTree.cxx b/sw/source/core/SwNumberTree/SwNumberTree.cxx index 0c6106461f..8f9caf5f02 100644 --- a/sw/source/core/SwNumberTree/SwNumberTree.cxx +++ b/sw/source/core/SwNumberTree/SwNumberTree.cxx @@ -39,7 +39,7 @@ using std::vector; using std::find; -#ifndef PRODUCT +#ifdef DBG_UTIL unsigned long SwNumberTreeNode::nInstances = 0; #endif @@ -55,7 +55,7 @@ SwNumberTreeNode::SwNumberTreeNode() { mItLastValid = mChildren.end(); -#ifndef PRODUCT +#ifdef DBG_UTIL mnSerial = nInstances; nInstances++; #endif @@ -80,7 +80,7 @@ SwNumberTreeNode::~SwNumberTreeNode() ASSERT( IsPhantom() || mpParent == NULL, ": I'm not supposed to have a parent."); -#ifndef PRODUCT +#ifdef DBG_UTIL nInstances--; #endif @@ -1108,7 +1108,7 @@ SwNumberTreeNode::GetIterator(const SwNumberTreeNode * pChild) const // return aStr; //} -#ifndef PRODUCT +#ifdef DBG_UTIL unsigned long SwNumberTreeNode::GetInstances() { return nInstances; diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 4e3b9e7047..e59faa3f38 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -100,12 +100,12 @@ class SwAccessibleContextMap_Impl: public _SwAccessibleContextMap_Impl { public: -#ifndef PRODUCT +#ifdef DBG_UTIL sal_Bool mbLocked; #endif SwAccessibleContextMap_Impl() -#ifndef PRODUCT +#ifdef DBG_UTIL : mbLocked( sal_False ) #endif {} @@ -227,11 +227,11 @@ class SwAccessibleShapeMap_Impl: public _SwAccessibleShapeMap_Impl public: -#ifndef PRODUCT +#ifdef DBG_UTIL sal_Bool mbLocked; #endif SwAccessibleShapeMap_Impl( SwAccessibleMap *pMap ) -#ifndef PRODUCT +#ifdef DBG_UTIL : mbLocked( sal_False ) #endif { @@ -1009,7 +1009,7 @@ SwAccessibleMap::~SwAccessibleMap() { vos::OGuard aGuard( maMutex ); -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( !mpFrmMap || mpFrmMap->empty(), "Frame map should be empty after disposing the root frame" ); if( mpFrmMap ) @@ -1062,7 +1062,7 @@ SwAccessibleMap::~SwAccessibleMap() { vos::OGuard aGuard( maEventMutex ); -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( !(mpEvents || mpEventMap), "pending events" ); if( mpEvents ) { @@ -1101,12 +1101,12 @@ uno::Reference< XAccessible > SwAccessibleMap::_GetDocumentView( if( !mpFrmMap ) { mpFrmMap = new SwAccessibleContextMap_Impl; -#ifndef PRODUCT +#ifdef DBG_UTIL mpFrmMap->mbLocked = sal_False; #endif } -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( !mpFrmMap->mbLocked, "Map is locked" ); mpFrmMap->mbLocked = sal_True; #endif @@ -1138,7 +1138,7 @@ uno::Reference< XAccessible > SwAccessibleMap::_GetDocumentView( } } -#ifndef PRODUCT +#ifdef DBG_UTIL mpFrmMap->mbLocked = sal_False; #endif } diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index 344f11cbc2..56b04e410d 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,7 +38,7 @@ #include <swcache.hxx> #include <swfntcch.hxx> -#ifndef PRODUCT +#ifdef DBG_UTIL #include <unotextmarkup.hxx> #endif @@ -211,7 +211,7 @@ void SwModify::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue ) LockModify(); -#ifdef PRODUCT +#ifndef DBG_UTIL bInModify = TRUE; #else if( !pOldValue ) @@ -287,7 +287,7 @@ void SwModify::Add(SwClient *pDepend) // nur wenn das hier noch nicht eingetragen ist einfuegen if(pDepend->pRegisteredIn != this ) { -#ifndef PRODUCT +#ifdef DBG_UTIL SwClientIter* pTmp = pClientIters; while( pTmp ) { diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx index a1725667fe..8351496ecb 100644 --- a/sw/source/core/attr/hints.cxx +++ b/sw/source/core/attr/hints.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,12 +47,6 @@ SwFmtChg::SwFmtChg( SwFmt *pFmt ) {} -SwInsChr::SwInsChr( xub_StrLen nP ) - : SwMsgPoolItem( RES_INS_CHR ), - nPos( nP ) -{} - - SwInsTxt::SwInsTxt( xub_StrLen nP, xub_StrLen nL ) : SwMsgPoolItem( RES_INS_TXT ), @@ -147,7 +141,7 @@ SwAttrSetChg::~SwAttrSetChg() } -#ifndef PRODUCT +#ifdef DBG_UTIL void SwAttrSetChg::ClearItem( USHORT nWhch ) { @@ -183,7 +177,7 @@ SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const * Ist keines vorhanden, returnt ein 0-Pointer !!! * Used to be inlined (hintids.hxx) in PRODUCT. ******************************************************************************/ -#ifdef PRODUCT +#ifndef DBG_UTIL const SfxPoolItem* GetDfltAttr( USHORT nWhich ) { return aAttrTab[ nWhich - POOLATTR_BEGIN ]; @@ -227,12 +221,6 @@ SwVirtPageNumInfo::SwVirtPageNumInfo( const SwPageFrm *pPg ) : // aList.Insert(rNd.GetIndex(), &rNd); //} -SwNRuleLowerLevel::SwNRuleLowerLevel( const String& rRuleName, BYTE nSrchLvl ) - : SwMsgPoolItem( RES_GETLOWERNUMLEVEL ), rName( rRuleName ), - nLvl(nSrchLvl) -{ -} - SwFindNearestNode::SwFindNearestNode( const SwNode& rNd ) : SwMsgPoolItem( RES_FINDNEARESTNODE ), pNd( &rNd ), pFnd( 0 ) diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx index 2388a1ae09..23a2d4772d 100644 --- a/sw/source/core/attr/swatrset.cxx +++ b/sw/source/core/attr/swatrset.cxx @@ -33,7 +33,7 @@ #include <hintids.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <svx/colritem.hxx> #include <svx/brshitem.hxx> #include <svx/bolnitem.hxx> @@ -387,7 +387,7 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const // <-- } } -#ifndef PRODUCT +#ifdef DBG_UTIL else ASSERT( !this, "weder Format noch ContentNode - keine Attribute kopiert"); #endif diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx index c97265254c..c5c83fb764 100644 --- a/sw/source/core/bastyp/bparr.cxx +++ b/sw/source/core/bastyp/bparr.cxx @@ -41,7 +41,7 @@ // immer ~ 20 * MAXENTRY == 20000 Eintraege const USHORT nBlockGrowSize = 20; -#ifdef PRODUCT +#ifndef DBG_UTIL #define CHECKIDX( p, n, i, c ) diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index bb81f9116c..dae28acc73 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -49,9 +49,9 @@ #include <unotools/charclass.hxx> #include <svx/unolingu.hxx> #include <svx/scripttypeitem.hxx> -#include <svtools/useroptions.hxx> +#include <unotools/useroptions.hxx> #include <tools/datetime.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include <swmodule.hxx> #include <doc.hxx> #include <viewsh.hxx> @@ -1142,7 +1142,7 @@ else case CALC_DATE : eCurrListOper = CALC_MONTH; break; default : - break; + break; } return eCurrOper; } diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx index 84302c65c4..d05cf8d72a 100644 --- a/sw/source/core/bastyp/index.cxx +++ b/sw/source/core/bastyp/index.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -39,7 +39,7 @@ #include "index.hxx" #include "error.h" // fuers ASSERT -#ifndef PRODUCT +#ifdef DBG_UTIL int SwIndex::nSerial = 0; #endif @@ -103,7 +103,7 @@ SwIndex::SwIndex( SwIndexReg* pArr, xub_StrLen nIdx ) else ChgValue( *pArray->pFirst, nIdx ); -#ifndef PRODUCT +#ifdef DBG_UTIL MySerial = ++nSerial; // nur in der nicht PRODUCT-Version #endif IDX_CHK_ARRAY @@ -115,7 +115,7 @@ SwIndex::SwIndex( const SwIndex& rIdx, short nIdx ) { ChgValue( rIdx, rIdx.nIndex + nIdx ); -#ifndef PRODUCT +#ifdef DBG_UTIL MySerial = ++nSerial; // nur in der nicht PRODUCT-Version #endif IDX_CHK_ARRAY @@ -126,7 +126,7 @@ SwIndex::SwIndex( const SwIndex& rIdx ) : nIndex( rIdx.nIndex ), pArray( rIdx.pArray ), pNext( 0 ), pPrev( 0 ) { ChgValue( rIdx, rIdx.nIndex ); -#ifndef PRODUCT +#ifdef DBG_UTIL MySerial = ++nSerial; // nur in der nicht PRODUCT-Version #endif IDX_CHK_ARRAY @@ -371,7 +371,7 @@ void SwIndexReg::Update( SwIndex const & rIdx, const xub_StrLen nDiff, ARR_CHK_ARRAY } -#ifndef PRODUCT +#ifdef DBG_UTIL #ifndef CFRONT /************************************************************************* diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index b78699fa6e..6f9fdb7546 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -34,7 +34,7 @@ #include <tools/globname.hxx> #include <vcl/mapmod.hxx> #include <svx/xmlcnitm.hxx> -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include <svx/pbinitem.hxx> #include <svx/keepitem.hxx> #include <svx/nlbkitem.hxx> @@ -83,7 +83,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> #include <unotools/collatorwrapper.hxx> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #include <com/sun/star/i18n/CollatorOptions.hpp> #include <unotools/transliterationwrapper.hxx> #include <svx/acorrcfg.hxx> @@ -780,7 +780,7 @@ void _FinitCore() delete SwEditShell::pAutoFmtFlags; -#ifndef PRODUCT +#ifdef DBG_UTIL //Defaultattribut freigeben lassen um asserts zu vermeiden. if ( aAttrTab[0]->GetRefCount() ) SfxItemPool::ReleaseDefaults( aAttrTab, POOLATTR_END-POOLATTR_BEGIN, FALSE); diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx index 3d24c327f2..67383227ca 100644 --- a/sw/source/core/bastyp/swcache.cxx +++ b/sw/source/core/bastyp/swcache.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,7 +38,7 @@ SV_IMPL_PTRARR(SwCacheObjArr,SwCacheObj*); -#ifdef PRODUCT +#ifndef DBG_UTIL #define INCREMENT( nVar ) #else #define INCREMENT( nVar ) ++nVar @@ -53,7 +53,7 @@ SV_IMPL_PTRARR(SwCacheObjArr,SwCacheObj*); |* |*************************************************************************/ -#ifndef PRODUCT +#ifdef DBG_UTIL void SwCache::Check() { @@ -90,7 +90,7 @@ void SwCache::Check() } #endif -#if !defined(PRODUCT) && defined(MADEBUG) +#if defined(DBG_UTIL) && defined(MADEBUG) #define CHECK Check(); #else #define CHECK @@ -107,7 +107,7 @@ void SwCache::Check() SwCache::SwCache( const USHORT nInitSize, const USHORT nGrowSize -#ifndef PRODUCT +#ifdef DBG_UTIL , const ByteString &rNm #endif ) : @@ -118,7 +118,7 @@ SwCache::SwCache( const USHORT nInitSize, const USHORT nGrowSize pLast( 0 ), nMax( nInitSize ), nCurMax( nInitSize ) -#ifndef PRODUCT +#ifdef DBG_UTIL , aName( rNm ), nAppend( 0 ), nInsertFree( 0 ), @@ -137,7 +137,7 @@ SwCache::SwCache( const USHORT nInitSize, const USHORT nGrowSize { } -#ifndef PRODUCT +#ifdef DBG_UTIL SwCache::~SwCache() @@ -197,7 +197,7 @@ void SwCache::Flush( const BYTE ) SwCacheObj *pTmp; while ( pObj ) { -#ifndef PRODUCT +#ifdef DBG_UTIL if ( pObj->IsLocked() ) { ASSERT( TRUE, "Flushing locked objects." ); @@ -322,7 +322,7 @@ SwCacheObj *SwCache::Get( const void *pOwner, const USHORT nIndex, ToTop( pRet ); } -#ifndef PRODUCT +#ifdef DBG_UTIL if ( pRet ) ++nGetSuccess; else @@ -346,7 +346,7 @@ SwCacheObj *SwCache::Get( const void *pOwner, const BOOL bToTop ) if ( bToTop && pRet && pRet != pFirst ) ToTop( pRet ); -#ifndef PRODUCT +#ifdef DBG_UTIL if ( pRet ) ++nGetSuccess; else @@ -588,7 +588,7 @@ SwCacheObj::~SwCacheObj() |* |*************************************************************************/ -#ifndef PRODUCT +#ifdef DBG_UTIL diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx index d241982182..25580a96e4 100644 --- a/sw/source/core/bastyp/swrect.cxx +++ b/sw/source/core/bastyp/swrect.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" -#ifndef PRODUCT +#ifdef DBG_UTIL #ifndef _STREAM_HXX //autogen #include <tools/stream.hxx> #endif @@ -53,13 +53,12 @@ SwRect::SwRect( const Rectangle &rRect ) : - nX( rRect.Left() ), - nY( rRect.Top() ) + m_Point( rRect.Left(), rRect.Top() ) { - nWidth = rRect.Right() == RECT_EMPTY ? 0 : - rRect.Right() - rRect.Left() +1; - nHeight = rRect.Bottom() == RECT_EMPTY ? 0 : - rRect.Bottom() - rRect.Top() + 1; + m_Size.setWidth(rRect.Right() == RECT_EMPTY ? 0 : + rRect.Right() - rRect.Left() +1); + m_Size.setHeight(rRect.Bottom() == RECT_EMPTY ? 0 : + rRect.Bottom() - rRect.Top() + 1); } /************************************************************************* @@ -139,7 +138,7 @@ SwRect& SwRect::Intersection( const SwRect& rRect ) } else //Def.: Bei einer leeren Intersection wird nur die SSize genullt. - nHeight = nWidth = 0; + SSize(0, 0); return *this; } @@ -239,78 +238,90 @@ BOOL SwRect::IsOver( const SwRect& rRect ) const void SwRect::Justify() { - if ( nHeight < 0 ) + if ( m_Size.getHeight() < 0 ) { - nY = nY + nHeight + 1; - nHeight = -nHeight; + m_Point.Y() += m_Size.getHeight() + 1; + m_Size.setHeight(-m_Size.getHeight()); } - if ( nWidth < 0 ) + if ( m_Size.getWidth() < 0 ) { - nX = nX + nWidth + 1; - nWidth = -nWidth; + m_Point.Y() += m_Size.getWidth() + 1; + m_Size.setWidth(-m_Size.getWidth()); } } // Similiar to the inline methods, but we need the function pointers -void SwRect::_Width( const long nNew ) { nWidth = nNew; } -void SwRect::_Height( const long nNew ) { nHeight = nNew; } -void SwRect::_Left( const long nLeft ){ nWidth += nX - nLeft; nX = nLeft; } -void SwRect::_Right( const long nRight ){ nWidth = nRight - nX; } -void SwRect::_Top( const long nTop ){ nHeight += nY - nTop; nY = nTop; } -void SwRect::_Bottom( const long nBottom ){ nHeight = nBottom - nY; } - -long SwRect::_Width() const{ return nWidth; } -long SwRect::_Height() const{ return nHeight; } -long SwRect::_Left() const{ return nX; } -long SwRect::_Right() const{ return nX + nWidth; } -long SwRect::_Top() const{ return nY; } -long SwRect::_Bottom() const{ return nY + nHeight; } - -void SwRect::AddWidth( const long nAdd ) { nWidth += nAdd; } -void SwRect::AddHeight( const long nAdd ) { nHeight += nAdd; } -void SwRect::SubLeft( const long nSub ){ nWidth += nSub; nX -= nSub; } -void SwRect::AddRight( const long nAdd ){ nWidth += nAdd; } -void SwRect::SubTop( const long nSub ){ nHeight += nSub; nY -= nSub; } -void SwRect::AddBottom( const long nAdd ){ nHeight += nAdd; } -void SwRect::SetPosX( const long nNew ){ nX = nNew; } -void SwRect::SetPosY( const long nNew ){ nY = nNew; } +void SwRect::_Width( const long nNew ) { m_Size.setWidth(nNew); } +void SwRect::_Height( const long nNew ) { m_Size.setHeight(nNew); } +void SwRect::_Left( const long nLeft ){ m_Size.Width() += m_Point.getX() - nLeft; m_Point.setX(nLeft); } +void SwRect::_Right( const long nRight ){ m_Size.setWidth(nRight - m_Point.getX()); } +void SwRect::_Top( const long nTop ){ m_Size.Height() += m_Point.getY() - nTop; m_Point.setY(nTop); } +void SwRect::_Bottom( const long nBottom ){ m_Size.setHeight(nBottom - m_Point.getY()); } + +long SwRect::_Width() const{ return m_Size.getWidth(); } +long SwRect::_Height() const{ return m_Size.getHeight(); } +long SwRect::_Left() const{ return m_Point.getX(); } +long SwRect::_Right() const{ return m_Point.getX() + m_Size.getWidth(); } +long SwRect::_Top() const{ return m_Point.getY(); } +long SwRect::_Bottom() const{ return m_Point.getY() + m_Size.getHeight(); } + +void SwRect::AddWidth( const long nAdd ) { m_Size.Width() += nAdd; } +void SwRect::AddHeight( const long nAdd ) { m_Size.Height() += nAdd; } +void SwRect::SubLeft( const long nSub ){ m_Size.Width() += nSub; m_Point.X() -= nSub; } +void SwRect::AddRight( const long nAdd ){ m_Size.Width() += nAdd; } +void SwRect::SubTop( const long nSub ){ m_Size.Height() += nSub; m_Point.Y() -= nSub; } +void SwRect::AddBottom( const long nAdd ){ m_Size.Height() += nAdd; } +void SwRect::SetPosX( const long nNew ){ m_Point.setX(nNew); } +void SwRect::SetPosY( const long nNew ){ m_Point.setY(nNew); } const Size SwRect::_Size() const { return SSize(); } -const Size SwRect::SwappedSize() const { return Size( nHeight, nWidth ); } +const Size SwRect::SwappedSize() const { return Size( m_Size.getHeight(), m_Size.getWidth() ); } const Point SwRect::TopLeft() const { return Pos(); } -const Point SwRect::TopRight() const { return Point( nX + nWidth, nY ); } -const Point SwRect::BottomLeft() const { return Point( nX, nY + nHeight ); } +const Point SwRect::TopRight() const { return Point( m_Point.getX() + m_Size.getWidth(), m_Point.getY() ); } +const Point SwRect::BottomLeft() const { return Point( m_Point.getX(), m_Point.getY() + m_Size.getHeight() ); } const Point SwRect::BottomRight() const - { return Point( nX + nWidth, nY + nHeight ); } -long SwRect::GetLeftDistance( long nLimit ) const { return nX - nLimit; } -long SwRect::GetBottomDistance( long nLim ) const { return nLim - nY - nHeight;} -long SwRect::GetTopDistance( long nLimit ) const { return nY - nLimit; } -long SwRect::GetRightDistance( long nLim ) const { return nLim - nX - nWidth; } + { return Point( m_Point.getX() + m_Size.getWidth(), m_Point.getY() + m_Size.getHeight() ); } +long SwRect::GetLeftDistance( long nLimit ) const { return m_Point.getX() - nLimit; } +long SwRect::GetBottomDistance( long nLim ) const { return nLim - m_Point.getY() - m_Size.getHeight();} +long SwRect::GetTopDistance( long nLimit ) const { return m_Point.getY() - nLimit; } +long SwRect::GetRightDistance( long nLim ) const { return nLim - m_Point.getX() - m_Size.getWidth(); } BOOL SwRect::OverStepLeft( long nLimit ) const - { return nLimit > nX && nX + nWidth > nLimit; } + { return nLimit > m_Point.getX() && m_Point.getX() + m_Size.getWidth() > nLimit; } BOOL SwRect::OverStepBottom( long nLimit ) const - { return nLimit > nY && nY + nHeight > nLimit; } + { return nLimit > m_Point.getY() && m_Point.getY() + m_Size.getHeight() > nLimit; } BOOL SwRect::OverStepTop( long nLimit ) const - { return nLimit > nY && nY + nHeight > nLimit; } + { return nLimit > m_Point.getY() && m_Point.getY() + m_Size.getHeight() > nLimit; } BOOL SwRect::OverStepRight( long nLimit ) const - { return nLimit > nX && nX + nWidth > nLimit; } + { return nLimit > m_Point.getX() && m_Point.getX() + m_Size.getWidth() > nLimit; } void SwRect::SetLeftAndWidth( long nLeft, long nNew ) - { nX = nLeft; nWidth = nNew; } +{ + m_Point.setX(nLeft); + m_Size.setWidth(nNew); +} void SwRect::SetTopAndHeight( long nTop, long nNew ) - { nY = nTop; nHeight = nNew; } +{ + m_Point.setY(nTop); + m_Size.setHeight(nNew); +} void SwRect::SetRightAndWidth( long nRight, long nNew ) - { nX = nRight - nNew; nWidth = nNew; } +{ + m_Point.setX(nRight - nNew); + m_Size.setWidth(nNew); +} void SwRect::SetBottomAndHeight( long nBottom, long nNew ) - { nY = nBottom - nNew; nHeight = nNew; } +{ + m_Point.setY(nBottom - nNew); + m_Size.setHeight(nNew); +} void SwRect::SetUpperLeftCorner( const Point& rNew ) - { nX = rNew.nA; nY = rNew.nB; } + { m_Point = rNew; } void SwRect::SetUpperRightCorner( const Point& rNew ) - { nX = rNew.nA - nWidth; nY = rNew.nB; } + { m_Point = Point(rNew.nA - m_Size.getWidth(), rNew.nB); } void SwRect::SetLowerLeftCorner( const Point& rNew ) - { nX = rNew.nA; nY = rNew.nB - nHeight; } + { m_Point = Point(rNew.nA, rNew.nB - m_Size.getHeight()); } -#ifndef PRODUCT +#ifdef DBG_UTIL /************************************************************************* * operator<<( ostream&, SwRect&) *************************************************************************/ diff --git a/sw/source/core/bastyp/swregion.cxx b/sw/source/core/bastyp/swregion.cxx index f0ee36b12a..d2926f6d7e 100644 --- a/sw/source/core/bastyp/swregion.cxx +++ b/sw/source/core/bastyp/swregion.cxx @@ -117,7 +117,7 @@ void SwRegionRects::operator-=( const SwRect &rRect ) if ( 0 < (nTmp = aInter.Top() - aTmp.Top()) ) { const long nOldVal = aTmp.Height(); - aTmp.SSize().Height() = nTmp; + aTmp.Height(nTmp); InsertRect( aTmp, i, bDel ); aTmp.Height( nOldVal ); } diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 5c6fc9a21c..efb7c6bd76 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -332,7 +332,7 @@ if( GetWin() ) } -#if !defined( PRODUCT ) +#if defined(DBG_UTIL) void SwCrsrShell::SttCrsrMove() { @@ -1459,7 +1459,7 @@ void SwCrsrShell::UpdateCrsr( USHORT eFlags, BOOL bIdleEnd ) Point aCentrPt( aCharRect.Center() ); aTmpState.bSetInReadOnly = IsReadOnlyAvailable(); pTblFrm->GetCrsrOfst( pTblCrsr->GetPoint(), aCentrPt, &aTmpState ); -#ifdef PRODUCT +#ifndef DBG_UTIL pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() ); #else if ( !pTblFrm->GetCharRect( aCharRect, *pTblCrsr->GetPoint() ) ) @@ -2014,7 +2014,7 @@ void SwCrsrShell::Combine() SwCrsrSaveState aSaveState( *pCurCrsr ); if( pCrsrStk->HasMark() ) // nur wenn GetMark gesetzt wurde { -#ifdef PRODUCT +#ifndef DBG_UTIL CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, TRUE ); #else if( !CheckNodesRange( pCrsrStk->GetMark()->nNode, pCurCrsr->GetPoint()->nNode, TRUE )) diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index d788c1e66e..a39ccb99c9 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -33,7 +33,7 @@ #include <hintids.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svx/lrspitem.hxx> #include <svx/adjitem.hxx> #include <svx/brkitem.hxx> @@ -1337,7 +1337,7 @@ BOOL SwCrsrShell::GetContentAtPos( const Point& rPt, if( !bRet && ( SwContentAtPos::SW_TABLEBOXFML & rCntntAtPos.eCntntAtPos -#ifndef PRODUCT +#ifdef DBG_UTIL || SwContentAtPos::SW_TABLEBOXVALUE & rCntntAtPos.eCntntAtPos #endif )) @@ -1349,7 +1349,7 @@ BOOL SwCrsrShell::GetContentAtPos( const Point& rPt, if( pSttNd && 0 != ( pTblNd = pTxtNd->FindTableNode()) && 0 != ( pBox = pTblNd->GetTable().GetTblBox( pSttNd->GetIndex() )) && -#ifndef PRODUCT +#ifdef DBG_UTIL ( SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState( RES_BOXATR_FORMULA, FALSE, &pItem ) || SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState( @@ -1383,7 +1383,7 @@ BOOL SwCrsrShell::GetContentAtPos( const Point& rPt, // erzeuge aus der internen (fuer CORE) // die externe (fuer UI) Formel rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXFML; -#ifndef PRODUCT +#ifdef DBG_UTIL if( RES_BOXATR_VALUE == pItem->Which() ) rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXVALUE; else @@ -1417,7 +1417,7 @@ BOOL SwCrsrShell::GetContentAtPos( const Point& rPt, } } -#ifndef PRODUCT +#ifdef DBG_UTIL if( !bRet && SwContentAtPos::SW_CURR_ATTRS & rCntntAtPos.eCntntAtPos ) { xub_StrLen n = aPos.nContent.GetIndex(); diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 61fefca669..2808184f8c 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -38,8 +38,8 @@ #include <i18npool/mslangid.hxx> #include <hintids.hxx> #include <vcl/svapp.hxx> -#include <svtools/itemiter.hxx> -#include <svtools/whiter.hxx> +#include <svl/itemiter.hxx> +#include <svl/whiter.hxx> #include <svx/brkitem.hxx> #include <svx/colritem.hxx> #include <svx/fontitem.hxx> diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index ab93dee334..d715f78e33 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -37,7 +37,7 @@ #define _SVSTDARR_USHORTS #define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <vcl/svapp.hxx> #include <txatritr.hxx> #include <fldbas.hxx> diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index d80f1a2465..d7823ec532 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -550,7 +550,7 @@ void SwPaM::SetMark() (*m_pMark) = (*m_pPoint); } -#ifndef PRODUCT +#ifdef DBG_UTIL void SwPaM::Exchange() { @@ -1218,12 +1218,12 @@ String SwPaM::GetTxt() const return aResult; } -BOOL SwPaM::Overlap(const SwPaM & a, const SwPaM & b) +BOOL SwPaM::Overlap(const SwPaM & a, const SwPaM & b) { return !(*b.End() <= *a.Start() || *a.End() <= *b.End()); } BOOL SwPaM::LessThan(const SwPaM & a, const SwPaM & b) { - return (*a.Start() < *b.Start()) || (*a.Start() == *b.Start() && *a.End() < *b.End()); + return (*a.Start() < *b.Start()) || (*a.Start() == *b.Start() && *a.End() < *b.End()); } diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 749046780b..b938d5ace5 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -39,7 +39,7 @@ #include <com/sun/star/i18n/CharType.hdl> #include <unotools/charclass.hxx> -#include <svtools/ctloptions.hxx> +#include <svl/ctloptions.hxx> #include <swmodule.hxx> #include <fmtcntnt.hxx> #include <swtblfmt.hxx> diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 0f14a62bed..76bdb74d5b 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -307,7 +307,7 @@ BOOL SwCrsrShell::SelTblBox() const SwStartNode* pStartNode = pCurCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode(); -#ifndef PRODUCT +#ifdef DBG_UTIL // the old code checks whether we're in a table by asking the // frame. This should yield the same result as searching for the // table box start node, right? diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 8f31456292..1e0d6b3703 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -34,7 +34,7 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <vcl/dialog.hxx> @@ -77,42 +77,42 @@ MapMode* SwSelPaintRects::pMapMode = 0; #ifdef SHOW_BOOKMARKS // #include <IMark.hxx> -// +// // class SwBookmarkRects : public SwSelPaintRects // { // virtual void Paint( const Rectangle& rRect ); // virtual void FillRects(); -// +// // public: // SwBookmarkRects( const SwCrsrShell& rSh ) : SwSelPaintRects( rSh ) {} // }; -// +// // void SwBookmarkRects::Paint( const Rectangle& rRect ) // { // Window* pWin = GetShell()->GetWin(); -// +// // RasterOp eOld( pWin->GetRasterOp() ); // BOOL bLCol = pWin->IsLineColor(); // Color aLCol( pWin->GetLineColor() ); // BOOL bFCol = pWin->IsFillColor(); // Color aFCol( pWin->GetFillColor() ); -// +// // pWin->SetRasterOp( ROP_XOR ); // Color aCol( RGB_COLORDATA( 0xF0, 0xC8, 0xF0 ) ^ COL_WHITE ); // pWin->SetFillColor( aCol ); // pWin->SetLineColor( aCol ); -// +// // pWin->DrawRect( rRect ); -// +// // if( bLCol ) pWin->SetLineColor( aLCol ); else pWin->SetLineColor(); // if( bFCol ) pWin->SetFillColor( aFCol ); else pWin->SetFillColor(); // pWin->SetRasterOp( eOld ); // } -// +// // void SwBookmarkRects::FillRects() // { // SwRegionRects aReg( GetShell()->VisArea() ); -// +// // const SwBookmarks& rBkmkTbl = GetShell()->getIDocumentMarkAccess()->getBookmarks(); // SwShellCrsr* pCrsr = 0; // for( USHORT n = 0; n < rBkmkTbl.Count(); ++n ) @@ -131,23 +131,23 @@ MapMode* SwSelPaintRects::pMapMode = 0; // pCrsr->FillRects(); // for( USHORT i = 0; i < pCrsr->Count(); ++i ) // aReg -= (*pCrsr)[ i ]; -// +// // pCrsr->Remove( 0, i ); // } // } // if( pCrsr ) delete pCrsr; -// +// // aReg.Invert(); // SwRects::Insert( &aReg, 0 ); // } -// +// // SwBookmarkRects* pBookMarkRects = 0; -// +// // void ShowBookmarks( const SwCrsrShell* pSh, int nAction, const SwRect* pRect = 0 ) // { // if( !pBookMarkRects && pSh->getIDocumentMarkAccess()->getBookmarks().Count() ) // pBookMarkRects = new SwBookmarkRects( *pSh ); -// +// // if( pBookMarkRects ) // { // switch( nAction ) @@ -156,12 +156,12 @@ MapMode* SwSelPaintRects::pMapMode = 0; // case 2: pBookMarkRects->Hide(); break; // case 3: pBookMarkRects->Invalidate( *pRect ); break; // } -// +// // if( !pBookMarkRects->Count() ) // delete pBookMarkRects, pBookMarkRects = 0; // } // } -// +// // #define SHOWBOOKMARKS1( nAct ) ShowBookmarks( GetShell(),nAct ); // #define SHOWBOOKMARKS2( nAct, pRect ) ShowBookmarks( GetShell(),nAct, pRect ); @@ -517,7 +517,7 @@ void SwVisCrsr::_SetPosAndShow() ////////////////////////////////////////////////////////////////////////////// SwSelPaintRects::SwSelPaintRects( const SwCrsrShell& rCSh ) -: SwRects( 0 ), +: SwRects( 0 ), pCShell( &rCSh ), mpCursorOverlay(0) { @@ -575,7 +575,7 @@ void SwSelPaintRects::Show() const Rectangle aPntRect(aNextRect.SVRect()); aNewRanges.push_back(basegfx::B2DRange( - aPntRect.Left(), aPntRect.Top(), + aPntRect.Left(), aPntRect.Top(), aPntRect.Right() + 1, aPntRect.Bottom() + 1)); } @@ -862,7 +862,7 @@ BOOL SwShellCrsr::UpDown( BOOL bUp, USHORT nCnt ) &GetPtPos(), GetShell()->GetUpDownX() ); } -#ifndef PRODUCT +#ifdef DBG_UTIL // JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung // am sichtbaren Cursor @@ -1001,7 +1001,7 @@ BOOL SwShellTableCrsr::IsInside( const Point& rPt ) const return FALSE; } -#ifndef PRODUCT +#ifdef DBG_UTIL // JP 05.03.98: zum Testen des UNO-Crsr Verhaltens hier die Implementierung // am sichtbaren Cursor diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx index 3e48b5ab4b..691b966521 100644 --- a/sw/source/core/doc/SwStyleNameMapper.cxx +++ b/sw/source/core/doc/SwStyleNameMapper.cxx @@ -34,7 +34,7 @@ #include <SwStyleNameMapper.hxx> #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <tools/resmgr.hxx> #include <poolfmt.hxx> #ifndef _RDIC_HRC diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index 2fb1676d5b..de37b13d76 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -33,8 +33,8 @@ #ifdef DEBUG #include <tools/string.hxx> -#include <svtools/poolitem.hxx> -#include <svtools/itemiter.hxx> +#include <svl/poolitem.hxx> +#include <svl/itemiter.hxx> #include <string> #include <map> #include <node.hxx> @@ -551,7 +551,7 @@ String lcl_dbg_out(const SwNode & rNode) aTmpStr += String::CreateFromInt32(rNode.GetIndex()); aTmpStr += String("\"", RTL_TEXTENCODING_ASCII_US); -#ifndef PRODUCT +#ifdef DBG_UTIL aTmpStr += String(" serial=\"", RTL_TEXTENCODING_ASCII_US); aTmpStr += String::CreateFromInt32(rNode.GetSerial()); aTmpStr += String("\"", RTL_TEXTENCODING_ASCII_US); @@ -743,7 +743,7 @@ void lcl_dbg_nodes_inner(String & aStr, SwNodes & rNodes, ULONG & nIndex) SwNode * pEndNode = NULL; if (pStartNode != NULL) pEndNode = pStartNode->EndOfSectionNode(); - + ULONG nCount = rNodes.Count(); ULONG nStartIndex = nIndex; diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index d5fc2798c6..8654d9c3af 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -47,7 +47,7 @@ #include <tools/urlobj.hxx> #include <tools/poly.hxx> #include <vcl/virdev.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <sfx2/printer.hxx> #include <svx/keepitem.hxx> #include <svx/cscoitem.hxx> @@ -106,6 +106,8 @@ #include <SwUndoFmt.hxx> #include <unocrsr.hxx> #include <docsh.hxx> +#include <docufld.hxx> + #include <vector> #include <osl/diagnose.h> @@ -465,6 +467,9 @@ void SwDoc::setPrinter(/*[in]*/ SfxPrinter *pP,/*[in]*/ bool bDeleteOld,/*[in]*/ if ( bDeleteOld ) delete pPrt; pPrt = pP; + + if ( pDrawModel && !get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) ) + pDrawModel->SetRefDevice( pPrt ); } if ( bCallPrtDataChanged && @@ -493,6 +498,9 @@ void SwDoc::setVirtualDevice(/*[in]*/ VirtualDevice* pVd,/*[in]*/ bool bDeleteOl if ( bDeleteOld ) delete pVirDev; pVirDev = pVd; + + if ( pDrawModel && get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) ) + pDrawModel->SetRefDevice( pVirDev ); } } @@ -528,6 +536,9 @@ void SwDoc::setReferenceDeviceType(/*[in]*/ bool bNewVirtual,/*[in]*/ bool bNewH pMyVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE06 ); else pMyVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 ); + + if( pDrawModel ) + pDrawModel->SetRefDevice( pMyVirDev ); } else { @@ -537,8 +548,10 @@ void SwDoc::setReferenceDeviceType(/*[in]*/ bool bNewVirtual,/*[in]*/ bool bNewH // triggers this funny situation: // getReferenceDevice()->getPrinter()->CreatePrinter_() // ->setPrinter()-> PrtDataChanged() - getPrinter( true ); + SfxPrinter* pPrinter = getPrinter( true ); // <-- + if( pDrawModel ) + pDrawModel->SetRefDevice( pPrinter ); } set(IDocumentSettingAccess::USE_VIRTUAL_DEVICE, bNewVirtual ); @@ -1066,6 +1079,24 @@ void SwDoc::UpdateDocStat( SwDocStat& rStat ) } } + // #i93174#: notes contain paragraphs that are not nodes + { + SwFieldType * const pPostits( GetSysFldType(RES_POSTITFLD) ); + SwClientIter aIter(*pPostits); + SwFmtFld const * pFmtFld = + static_cast<SwFmtFld const*>(aIter.First( TYPE(SwFmtFld) )); + while (pFmtFld) + { + if (pFmtFld->IsFldInDoc()) + { + SwPostItField const * const pField( + static_cast<SwPostItField const*>(pFmtFld->GetFld())); + rStat.nAllPara += pField->GetNumberOfParagraphs(); + } + pFmtFld = static_cast<SwFmtFld const*>(aIter.Next()); + } + } + rStat.nPage = GetRootFrm() ? GetRootFrm()->GetPageNum() : 0; rStat.bModified = FALSE; SetDocStat( rStat ); @@ -1091,12 +1122,21 @@ void SwDoc::UpdateDocStat( SwDocStat& rStat ) aStat[n++].Value <<= (sal_Int32)rStat.nChar; // For e.g. autotext documents there is no pSwgInfo (#i79945) - if (GetDocShell()) { - uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - GetDocShell()->GetModel(), uno::UNO_QUERY_THROW); - uno::Reference<document::XDocumentProperties> xDocProps( + SfxObjectShell * const pObjShell( GetDocShell() ); + if (pObjShell) + { + const uno::Reference<document::XDocumentPropertiesSupplier> xDPS( + pObjShell->GetModel(), uno::UNO_QUERY_THROW); + const uno::Reference<document::XDocumentProperties> xDocProps( xDPS->getDocumentProperties()); + // #i96786#: do not set modified flag when updating statistics + const bool bDocWasModified( IsModified() ); + const ModifyBlocker_Impl b(pObjShell); xDocProps->setDocumentStatistics(aStat); + if (!bDocWasModified) + { + ResetModified(); + } } // event. Stat. Felder Updaten diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 5fa7731fcb..58e3cccc6f 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -428,7 +428,7 @@ Compare::Compare( ULONG nDiff, CompareData& rData1, CompareData& rData2 ) SetDiscard( rData2, pDiscard2, pCount1 ); // die Arrays koennen wir wieder vergessen - delete pCount1; delete pCount2; + delete [] pCount1; delete [] pCount2; CheckDiscard( rData1.GetLineCount(), pDiscard1 ); CheckDiscard( rData2.GetLineCount(), pDiscard2 ); @@ -437,7 +437,7 @@ Compare::Compare( ULONG nDiff, CompareData& rData1, CompareData& rData2 ) pMD2 = new MovedData( rData2, pDiscard2 ); // die Arrays koennen wir wieder vergessen - delete pDiscard1; delete pDiscard2; + delete [] pDiscard1; delete [] pDiscard2; } { diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx index a6c6d2ab8a..e5e0aa84a7 100644 --- a/sw/source/core/doc/docdde.cxx +++ b/sw/source/core/doc/docdde.cxx @@ -41,7 +41,7 @@ #include <tools/urlobj.hxx> #define _SVSTDARR_STRINGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <svx/linkmgr.hxx> // LinkManager #include <unotools/charclass.hxx> #include <fmtcntnt.hxx> diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 88176f79c8..acfaaeb761 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -70,7 +70,7 @@ #include <fldbas.hxx> #include <swwait.hxx> #include <GetMetricVal.hxx> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #ifndef _STATSTR_HRC #include <statstr.hrc> #endif diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index 3befc37ff3..4c797d6282 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -258,7 +258,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj); // --> OD 2005-08-16 #i53320# -#ifndef PRODUCT +#ifdef DBG_UTIL SwAnchoredDrawObject* pAnchoredDrawObj = static_cast<SwAnchoredDrawObject*>(pContact->GetAnchoredObj( pObj )); ASSERT( bGroupMembersNotPositioned == pAnchoredDrawObj->NotYetPositioned(), diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 05a3efac0e..3d65dfe816 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -39,7 +39,7 @@ #include <tools/datetime.hxx> #ifndef _SVSTDARR_HXX #define _SVSTDARR_ULONGS -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #endif #ifndef _APP_HXX //autogen #include <vcl/svapp.hxx> @@ -601,7 +601,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) { if( aPara.CalcWithStackOverflow() ) pFld->CalcField( aPara ); -#ifndef PRODUCT +#ifdef DBG_UTIL else { // mind. ein ASSERT @@ -669,7 +669,7 @@ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt ) { if( aPara.CalcWithStackOverflow() ) pFml->Calc( aPara, nValue ); -#ifndef PRODUCT +#ifdef DBG_UTIL else { // mind. ein ASSERT @@ -907,7 +907,7 @@ void _SetGetExpFld::SetBodyPos( const SwCntntFrm& rFrm ) SwNodeIndex aIdx( *rFrm.GetNode() ); SwDoc& rDoc = *aIdx.GetNodes().GetDoc(); SwPosition aPos( aIdx ); -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( ::GetBodyTxtNode( rDoc, aPos, rFrm ), "wo steht das Feld" ); #else ::GetBodyTxtNode( rDoc, aPos, rFrm ); @@ -2551,7 +2551,7 @@ void SwDocUpdtFld::GetBodyNode( const SwTxtFld& rTFld, USHORT nFldWhich ) { // einen Index fuers bestimmen vom TextNode anlegen SwPosition aPos( rDoc.GetNodes().GetEndOfPostIts() ); -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht das Feld" ); #else GetBodyTxtNode( rDoc, aPos, *pFrm ); @@ -2599,7 +2599,7 @@ void SwDocUpdtFld::GetBodyNode( const SwSectionNode& rSectNd ) if( !pFrm ) break; -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht das Feld" ); #else GetBodyTxtNode( rDoc, aPos, *pFrm ); diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index e0645fcdc1..cfda405205 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -33,7 +33,7 @@ #include <hintids.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svx/svdobj.hxx> #include <svx/svdpage.hxx> #include <svx/svdmodel.hxx> @@ -677,7 +677,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, // Continue with next selected object and assert, if this isn't excepted. if ( !pContact ) { -#ifndef PRODUCT +#ifdef DBG_UTIL bool bNoUserCallExcepted = pObj->ISA(SwDrawVirtObj) && !static_cast<SwDrawVirtObj*>(pObj)->IsConnected(); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index fff14d4ed3..3033eaf9a2 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -37,20 +37,20 @@ #define _SVSTDARR_USHORTS #include <hintids.hxx> #include <rtl/logfile.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <sfx2/app.hxx> -#include <svtools/misccfg.hxx> #include <svx/tstpitem.hxx> #include <svx/eeitem.hxx> #include <svx/langitem.hxx> #include <svx/lrspitem.hxx> #include <svx/brkitem.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #ifndef _ZFORLIST_HXX //autogen #define _ZFORLIST_DECLARE_TABLE -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #endif #include <comphelper/processfactory.hxx> +#include <unotools/misccfg.hxx> #include <com/sun/star/i18n/WordType.hdl> #include <fmtpdsc.hxx> #include <fmthdft.hxx> @@ -625,7 +625,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, (RES_TXTATR_CHARFMT == nWhich) || (RES_TXTATR_INETFMT == nWhich) || (RES_TXTATR_AUTOFMT == nWhich) || - isUNKNOWNATR(nWhich) ) + (RES_TXTATR_UNKNOWN_CONTAINER == nWhich) ) { pCharSet = &rChgSet; bCharAttr = true; @@ -636,7 +636,8 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, || isPARATR_LIST(nWhich) // <-- || isFRMATR(nWhich) - || isGRFATR(nWhich) ) + || isGRFATR(nWhich) + || isUNKNOWNATR(nWhich) ) { pOtherSet = &rChgSet; bOtherAttr = true; @@ -653,7 +654,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, RES_TXTATR_AUTOFMT, RES_TXTATR_AUTOFMT, RES_TXTATR_INETFMT, RES_TXTATR_INETFMT, RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT, - RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, + RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER, 0 ); SfxItemSet* pTmpOtherItemSet = new SfxItemSet( pDoc->GetAttrPool(), @@ -663,6 +664,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, // <-- RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_GRFATR_BEGIN, RES_GRFATR_END-1, + RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, 0 ); pTmpCharItemSet->Put( rChgSet ); @@ -755,7 +757,7 @@ lcl_InsAttr(SwDoc *const pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet, SfxItemSet aTxtSet( pDoc->GetAttrPool(), RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK, RES_TXTATR_META, RES_TXTATR_METAFIELD, - RES_TXTATR_CJK_RUBY, RES_TXTATR_WITHEND_END-1, + RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY, 0 ); aTxtSet.Put( rChgSet ); @@ -1744,36 +1746,45 @@ BOOL lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs ) pFmt != pCNd->GetFmtColl() && pFmt->GetItemState( RES_PARATR_NUMRULE ) == SFX_ITEM_SET ) { - // --> OD 2008-04-08 #refactorlists# -// if ( pPara->pHistory ) -// { -// SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) ); -// ASSERT( pTNd, -// "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" ); -// SwRegHistory aRegH( pTNd, *pTNd, pPara->pHistory ); -// pCNd->ResetAttr( RES_PARATR_NUMRULE ); -// } -// else -// { -// pCNd->ResetAttr( RES_PARATR_NUMRULE ); -// } - std::auto_ptr< SwRegHistory > pRegH; - if ( pPara->pHistory ) + // --> OD 2009-09-07 #b6876367# + // Check, if the list style of the paragraph will change. + bool bChangeOfListStyleAtParagraph( true ); + SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) ); + ASSERT( pTNd, + "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" ); { - SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) ); - ASSERT( pTNd, - "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" ); - pRegH.reset( new SwRegHistory( pTNd, *pTNd, pPara->pHistory ) ); + SwNumRule* pNumRuleAtParagraph( pTNd->GetNumRule() ); + if ( pNumRuleAtParagraph ) + { + const SwNumRuleItem& rNumRuleItemAtParagraphStyle = + pFmt->GetNumRule(); + if ( rNumRuleItemAtParagraphStyle.GetValue() == + pNumRuleAtParagraph->GetName() ) + { + bChangeOfListStyleAtParagraph = false; + } + } } - pCNd->ResetAttr( RES_PARATR_NUMRULE ); + if ( bChangeOfListStyleAtParagraph ) + { + // --> OD 2008-04-08 #refactorlists# + std::auto_ptr< SwRegHistory > pRegH; + if ( pPara->pHistory ) + { + pRegH.reset( new SwRegHistory( pTNd, *pTNd, pPara->pHistory ) ); + } - // reset all list attributes - pCNd->ResetAttr( RES_PARATR_LIST_LEVEL ); - pCNd->ResetAttr( RES_PARATR_LIST_ISRESTART ); - pCNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE ); - pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED ); - pCNd->ResetAttr( RES_PARATR_LIST_ID ); + pCNd->ResetAttr( RES_PARATR_NUMRULE ); + + // reset all list attributes + pCNd->ResetAttr( RES_PARATR_LIST_LEVEL ); + pCNd->ResetAttr( RES_PARATR_LIST_ISRESTART ); + pCNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE ); + pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED ); + pCNd->ResetAttr( RES_PARATR_LIST_ID ); + } + // <-- } // <-- } @@ -2442,7 +2453,7 @@ void SwDoc::_CreateNumberFormatter() Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); pNumberFormatter = new SvNumberFormatter( xMSF, eLang ); pNumberFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL ); - pNumberFormatter->SetYear2000(static_cast<USHORT>(SFX_APP()->GetMiscConfig()->GetYear2000())); + pNumberFormatter->SetYear2000(static_cast<USHORT>(::utl::MiscCfg().GetYear2000())); } @@ -2658,18 +2669,18 @@ namespace docfunc if ( !pParentTxtFmtColl ) continue; - // --> OD 2007-12-07 #i77708# - // consider that explicitly no list style is set - empty string - // at numrule item. -// const SwNumRuleItem& rDirectItem = pParentTxtFmtColl->GetNumRule(); -// if ( rDirectItem.GetValue().Len() != 0 ) if ( SFX_ITEM_SET == pParentTxtFmtColl->GetItemState( RES_PARATR_NUMRULE ) ) { - bRet = true; - break; + // --> OD 2009-11-12 #i106218# + // consider that the outline style is set + const SwNumRuleItem& rDirectItem = pParentTxtFmtColl->GetNumRule(); + if ( rDirectItem.GetValue() != rDoc.GetOutlineNumRule()->GetName() ) + { + bRet = true; + break; + } + // <-- } - // <-- - } } diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 1d39e35de2..2595a769e8 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -34,9 +34,9 @@ #include <hintids.hxx> #include <unotools/tempfile.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/stritem.hxx> -#include <svtools/eitem.hxx> +#include <svl/urihelper.hxx> +#include <svl/stritem.hxx> +#include <svl/eitem.hxx> #include <sfx2/app.hxx> #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index fe244d4957..0ab5de60a7 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -31,8 +31,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <svtools/linguprops.hxx> -#include <svtools/lingucfg.hxx> +#include <unotools/linguprops.hxx> +#include <unotools/lingucfg.hxx> #include <com/sun/star/embed/EmbedStates.hpp> #include <hintids.hxx> #include <com/sun/star/util/XCloseable.hpp> @@ -212,7 +212,7 @@ SwFrmFmt *SwDoc::MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet ) } break; -#ifndef PRODUCT +#ifdef DBG_UTIL case FLY_PAGE: case FLY_AUTO_CNTNT: case FLY_AT_FLY: @@ -1693,7 +1693,7 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, SwTxtAttr * const pHnt = pTxtNode->GetTxtAttrForCharAt( nIdx, RES_TXTATR_FLYCNT ); -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT, "Missing FlyInCnt-Hint." ); ASSERT( pHnt && ((SwFmtFlyCnt&)pHnt->GetFlyCnt()). @@ -1878,14 +1878,14 @@ IMPL_LINK( SwDoc, DoIdleJobs, Timer *, pTimer ) if (GetRootFrm()->IsNeedGrammarCheck()) { BOOL bIsOnlineSpell = pSh->GetViewOptions()->IsOnlineSpell(); - + sal_Bool bIsAutoGrammar = sal_False; SvtLinguConfig().GetProperty( C2U( UPN_IS_GRAMMAR_AUTO ) ) >>= bIsAutoGrammar; if (bIsOnlineSpell && bIsAutoGrammar) StartGrammarChecking( *this ); } - + sal_uInt16 nFldUpdFlag; if( GetRootFrm()->IsIdleFormat() ) GetRootFrm()->GetCurrShell()->LayoutIdle(); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index eb208db2e7..e791d5c4ad 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -47,14 +47,14 @@ #include <sfx2/docfile.hxx> #include <sfx2/frame.hxx> -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include <svx/svxids.hrc> #include <svx/svdogrp.hxx> #include <svx/linkmgr.hxx> #include <svx/forbiddencharacterstable.hxx> -#include <svtools/zforlist.hxx> -#include <svtools/compatibility.hxx> -#include <svtools/lingucfg.hxx> +#include <svl/zforlist.hxx> +#include <unotools/compatibility.hxx> +#include <unotools/lingucfg.hxx> #include <svx/svdpage.hxx> #include <paratr.hxx> #include <fchrfmt.hxx> @@ -319,7 +319,7 @@ SwDoc::SwDoc() : mbInsOnlyTxtGlssry = mbContains_MSVBasic = mbKernAsianPunctuation = -#ifndef PRODUCT +#ifdef DBG_UTIL mbXMLExport = #endif // --> OD 2006-03-21 #b6375613# @@ -374,7 +374,7 @@ SwDoc::SwDoc() : // pMacroTable = new SvxMacroTableDtor; - + mpGrammarContact = ::createGrammarContact(); /* @@ -474,7 +474,7 @@ SwDoc::~SwDoc() // this assures that dipose gets called if there is need for it. aChartDataProviderImplRef.reset(); delete pChartControllerHelper; - + delete mpGrammarContact; mpGrammarContact = 0; @@ -1047,7 +1047,7 @@ SwDoc::GetMetaFieldManager() return *m_pMetaFieldManager; } -void SwDoc::InitTOXTypes() +void SwDoc::InitTOXTypes() { ShellResource* pShellRes = ViewShell::GetShellRes(); SwTOXType * pNew = new SwTOXType(TOX_CONTENT, pShellRes->aTOXContentName ); @@ -1104,7 +1104,7 @@ SwDoc* SwDoc::CreateCopy() const } if( aNewDefaults.Count() ) pRet->SetDefault( aNewDefaults ); - + /* pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ), pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ), @@ -1241,7 +1241,7 @@ SwDoc* SwDoc::CreateCopy() const // by asking SvtCompatibilityOptions, see below. // const SvtCompatibilityOptions aOptions; - */ + */ pRet->mbParaSpaceMax = mbParaSpaceMax ; pRet->mbParaSpaceMaxAtPages = mbParaSpaceMaxAtPages ; pRet->mbTabCompat = mbTabCompat ; @@ -1267,20 +1267,20 @@ SwDoc* SwDoc::CreateCopy() const pRet->mbOldPrinterMetrics = mbOldPrinterMetrics ; pRet->mbTabRelativeToIndent = mbTabRelativeToIndent ; pRet->mbTabAtLeftIndentForParagraphsInList = mbTabAtLeftIndentForParagraphsInList ; - - // + + // // COMPATIBILITY FLAGS END // /* pMacroTable = new SvxMacroTableDtor; - + mpGrammarContact = ::createGrammarContact(); // Formate pFrmFmtTbl->Insert(pDfltFrmFmt, 0 ); pCharFmtTbl->Insert(pDfltCharFmt, 0 ); - // FmtColls + // FmtColls // TXT pTxtFmtCollTbl->Insert(pDfltTxtFmtColl, 0 ); // GRF @@ -1353,6 +1353,7 @@ SwDoc* SwDoc::CreateCopy() const ResetModified(); */ + pRet->ReplaceStyles( *(SwDoc*)this ); //copy content pRet->Paste( *this ); return pRet; @@ -1417,7 +1418,7 @@ void SwDoc::Paste( const SwDoc& rSource ) SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() ); if( FLY_PAGE == aAnchor.GetAnchorId() ) { - aAnchor.SetPageNum( aAnchor.GetPageNum() + /*nStartPageNumber - */1 ); + aAnchor.SetPageNum( aAnchor.GetPageNum() /*+ nStartPageNumber - */); } else continue; diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 75d0dd1faa..b1cbd29eb7 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -35,7 +35,7 @@ #include <hintids.hxx> #include <tools/shl.hxx> #ifndef _SFX_ITEMITER_HXX //autogen -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #endif #include <sfx2/app.hxx> #include <svx/colritem.hxx> @@ -59,7 +59,7 @@ using namespace com::sun::star; TYPEINIT1(SwRedlineHint, SfxHint); -#ifdef PRODUCT +#ifndef DBG_UTIL #define _CHECK_REDLINE( pDoc ) #define _DEBUG_REDLINE( pDoc ) @@ -309,9 +309,11 @@ Verhalten von Delete-Redline: bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) { -#ifndef PRODUCT +#if 0 +// #i93179# disabled: ASSERT in ~SwIndexReg #ifdef DBG_UTIL SwRedline aCopy( *pNewRedl ); #endif + bool bError = true; _CHECK_REDLINE( this ) if( IsRedlineOn() && !IsShowOriginal( eRedlineMode ) && @@ -431,6 +433,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) pRedlineTbl->Insert( pRedl ); } + bError = false; bDelete = true; } else if( (( POS_BEFORE == eCmpPos && @@ -446,6 +449,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) pRedlineTbl->Remove( n ); pRedlineTbl->Insert( pRedl ); + bError = false; bDelete = true; } else if ( POS_OUTSIDE == eCmpPos ) @@ -1108,7 +1112,8 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) case POS_EQUAL: case POS_INSIDE: - delete pNewRedl, pNewRedl = 0; + // TODO Check if there is any side effect + //delete pNewRedl, pNewRedl = 0; break; case POS_OUTSIDE: @@ -1271,7 +1276,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete ) } _CHECK_REDLINE( this ) - return 0 != pNewRedl; + return ( 0 != pNewRedl ) || !bError; } void SwDoc::CompressRedlines() @@ -3693,7 +3698,7 @@ void SwRedline::SetContentIdx( const SwNodeIndex* pIdx ) delete pCntntSect, pCntntSect = 0; bIsVisible = FALSE; } -#ifndef PRODUCT +#ifdef DBG_UTIL else ASSERT( !this, "das ist keine gueltige Operation" ); #endif diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 5414b72869..752b146b9f 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -386,7 +386,7 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) { if( bUndo ) { - pRedlUndo = new SwUndoRedlineSort( rPaM, rOpt ); + pRedlUndo = new SwUndoRedlineSort( *pRedlPam,rOpt ); DoUndo( FALSE ); } // erst den Bereich kopieren, dann @@ -471,20 +471,36 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) AppendUndo( pRedlUndo ); } - // nBeg ist der Start vom sortierten Bereich + // nBeg is start of sorted range SwNodeIndex aSttIdx( GetNodes(), nBeg ); - // der Kopierte Bereich ist das Geloeschte - AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, *pRedlPam ), true); + // the copied range is deleted + SwRedline *const pDeleteRedline( + new SwRedline( nsRedlineType_t::REDLINE_DELETE, *pRedlPam )); - // das sortierte ist das Eingefuegte + // pRedlPam points to nodes that may be deleted (hidden) by + // AppendRedline, so adjust it beforehand to prevent ASSERT pRedlPam->GetPoint()->nNode = aSttIdx; SwCntntNode* pCNd = aSttIdx.GetNode().GetCntntNode(); pRedlPam->GetPoint()->nContent.Assign( pCNd, 0 ); + AppendRedline(pDeleteRedline, true); + + // the sorted range is inserted AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, *pRedlPam ), true); if( pRedlUndo ) + { + SwNodeIndex aInsEndIdx( pRedlPam->GetMark()->nNode, -1 ); + pRedlPam->GetMark()->nNode = aInsEndIdx; + SwCntntNode *const pPrevNode = + pRedlPam->GetMark()->nNode.GetNode().GetCntntNode(); + pRedlPam->GetMark()->nContent.Assign( pPrevNode, pPrevNode->Len() ); + + pRedlUndo->SetValues( *pRedlPam ); + } + + if( pRedlUndo ) pRedlUndo->SetOffset( aSttIdx ); delete pRedlPam, pRedlPam = 0; diff --git a/sw/source/core/doc/docstat.cxx b/sw/source/core/doc/docstat.cxx index 6ebc2d9a8f..8455adb859 100644 --- a/sw/source/core/doc/docstat.cxx +++ b/sw/source/core/doc/docstat.cxx @@ -45,10 +45,10 @@ SwDocStat::SwDocStat() : nOLE(0), nPage(1), nPara(1), + nAllPara(1), nWord(0), nChar(0), - bModified(TRUE), - pInternStat(0) + bModified(TRUE) {} /************************************************************************ @@ -62,9 +62,9 @@ void SwDocStat::Reset() nOLE = 0; nPage = 1; nPara = 1; + nAllPara= 1; nWord = 0; nChar = 0; bModified = TRUE; - pInternStat = 0; } diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 57ce88fec8..67fd5c7288 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -36,7 +36,7 @@ #include <hintids.hxx> #define _SVSTDARR_STRINGSSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <svx/langitem.hxx> #include <svx/brkitem.hxx> #include <svx/tstpitem.hxx> @@ -2220,7 +2220,9 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, } } pNd->InsertText( aNumStr, aPos, - IDocumentContentOperations::INS_EMPTYEXPAND ); + static_cast<IDocumentContentOperations::InsertFlags>( + IDocumentContentOperations::INS_EMPTYEXPAND | + IDocumentContentOperations::INS_FORCEHINTEXPAND) ); if(pPageNoCharFmt) { SwFmtCharFmt aCharFmt( pPageNoCharFmt ); diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index 8a5115ca14..372dbba83e 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -48,7 +48,7 @@ //--> #outlinelevel added by zhaojianwei #ifndef _SFXINTITEM_HXX -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #endif //<--end diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index 836ab14104..8d21b72435 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -397,7 +397,7 @@ USHORT SwHTMLTableLayout::GetBrowseWidth( const SwDoc& rDoc ) */ ASSERT( nWidth, "No browse width available" ); } -#ifndef PRODUCT +#ifdef DBG_UTIL else { // und wenn das auch nicht klappt, gibt es zur Zeit keine Breite @@ -1660,13 +1660,13 @@ static BOOL lcl_ResizeBox( const SwTableBox*& rpBox, void* pPara ) static BOOL lcl_ResizeLine( const SwTableLine*& rpLine, void* pPara ) { USHORT *pWidth = (USHORT *)pPara; -#ifndef PRODUCT +#ifdef DBG_UTIL USHORT nOldWidth = *pWidth; #endif *pWidth = 0; ((SwTableLine *)rpLine)->GetTabBoxes().ForEach( &lcl_ResizeBox, pWidth ); -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( !nOldWidth || Abs(*pWidth-nOldWidth) < COLFUZZY, "Zeilen einer Box sind unterschiedlich lang" ); #endif @@ -1777,7 +1777,7 @@ void SwHTMLTableLayout::SetWidths( BOOL bCallPass2, USHORT nAbsAvail, } } -#ifndef PRODUCT +#ifdef DBG_UTIL { // steht im tblrwcl.cxx extern void _CheckBoxWidth( const SwTableLine&, SwTwips ); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 8784290172..a5c058bb4f 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -39,7 +39,7 @@ #include <vcl/svapp.hxx> #include <svtools/imapobj.hxx> #include <svtools/imap.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <svtools/soerr.hxx> #include <sfx2/progress.hxx> #include <sfx2/docfile.hxx> diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 27c0145b35..7d45261f9c 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -64,7 +64,7 @@ #include <algorithm> // <-- // --> OD 2008-06-06 #i89178# -#include <svtools/saveopt.hxx> +#include <unotools/saveopt.hxx> // <-- // --> OD 2008-07-08 #i91400# #include <IDocumentListsAccess.hxx> @@ -478,7 +478,7 @@ const SwFmtVertOrient* SwNumFmt::GetGraphicOrientation() const } } -#ifndef PRODUCT +#ifdef DBG_UTIL long int SwNumRule::nInstances = 0; #endif @@ -512,7 +512,7 @@ SwNumRule::SwNumRule( const String& rNm, msDefaultListId() // <-- { -#ifndef PRODUCT +#ifdef DBG_UTIL nSerial = nInstances++; #endif @@ -632,7 +632,7 @@ SwNumRule::SwNumRule( const SwNumRule& rNumRule ) msDefaultListId( rNumRule.msDefaultListId ) // <-- { -#ifndef PRODUCT +#ifdef DBG_UTIL nSerial = nInstances++; #endif @@ -1317,6 +1317,7 @@ namespace numfunc @author OD */ virtual void Notify( const uno::Sequence<rtl::OUString>& aPropertyNames ); + virtual void Commit(); static SwDefBulletConfig* mpInstance; @@ -1487,6 +1488,10 @@ namespace numfunc InitFont(); } + void SwDefBulletConfig::Commit() + { + } + const String& GetDefBulletFontname() { return SwDefBulletConfig::getInstance()->GetFontname(); @@ -1562,6 +1567,7 @@ namespace numfunc @author OD */ virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames ); + virtual void Commit(); static SwNumberingUIBehaviorConfig* mpInstance; @@ -1596,6 +1602,8 @@ namespace numfunc return aPropNames; } + void SwNumberingUIBehaviorConfig::Commit() {} + void SwNumberingUIBehaviorConfig::LoadConfig() { com::sun::star::uno::Sequence<rtl::OUString> aPropNames = GetPropNames(); diff --git a/sw/source/core/doc/swstylemanager.cxx b/sw/source/core/doc/swstylemanager.cxx index 99fa615419..f2be9ef5ab 100644 --- a/sw/source/core/doc/swstylemanager.cxx +++ b/sw/source/core/doc/swstylemanager.cxx @@ -34,7 +34,7 @@ #include "swstylemanager.hxx" #include <hash_map> -#include <svtools/stylepool.hxx> +#include <svl/stylepool.hxx> #include <doc.hxx> #include <charfmt.hxx> #include <docary.hxx> diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 2dc28332f3..32beedc352 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,10 +37,10 @@ #include <tools/shl.hxx> #include <vcl/svapp.hxx> #include <sfx2/docfile.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/zforlist.hxx> -#include <svtools/zformat.hxx> -#include <svtools/pathoptions.hxx> +#include <svl/urihelper.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> +#include <unotools/pathoptions.hxx> #include <sfx2/app.hxx> #include <svx/dialmgr.hxx> #ifndef _SVX_DIALOGS_HRC diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index 6bca094d3e..84fa3845a3 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -35,7 +35,7 @@ #include <hintids.hxx> #define _ZFORLIST_DECLARE_TABLE -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include <frmfmt.hxx> #include <doc.hxx> #include <cntfrm.hxx> diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index e07062d5de..2f3fb01501 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -74,7 +74,7 @@ using namespace com::sun::star::uno; using namespace ::com::sun::star; -#ifdef PRODUCT +#ifndef DBG_UTIL #define CHECK_TABLE(t) #else #ifdef DEBUG @@ -197,7 +197,7 @@ BOOL lcl_DelOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, typedef BOOL (*FN_lcl_SetBoxWidth)(SwTableLine*, CR_SetBoxWidth&, SwTwips, BOOL ); -#if !defined( PRODUCT ) || defined( JP_DEBUG ) +#if defined(DBG_UTIL) || defined( JP_DEBUG ) void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize ); @@ -3506,7 +3506,7 @@ void lcl_AjustLines( SwTableLine* pLine, CR_SetBoxWidth& rParam ) } } -#if !defined( PRODUCT ) || defined( JP_DEBUG ) +#if defined(DBG_UTIL) || defined( JP_DEBUG ) void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize ) { diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx index 4b194cb410..8cb750ea4a 100644 --- a/sw/source/core/doc/visiturl.cxx +++ b/sw/source/core/doc/visiturl.cxx @@ -33,7 +33,7 @@ #include <sfx2/docfile.hxx> -#include <svtools/inethist.hxx> +#include <svl/inethist.hxx> #include <fmtinfmt.hxx> #include <txtinet.hxx> #include <doc.hxx> diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 60b7fe6287..f7897bed15 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -59,7 +59,7 @@ #include <pagedesc.hxx> #include <poolfmt.hxx> #include <SwNodeNum.hxx> -#ifdef PRODUCT +#ifndef DBG_UTIL #define CHECK_TABLE(t) #else #ifdef DEBUG @@ -1329,7 +1329,7 @@ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndConte aRedlRest.Restore(); -#ifndef PRODUCT +#ifdef DBG_UTIL { //JP 17.06.99: Bug 66973 - check count only if the selection is in // the same (or no) section. Becaus not full selected diff --git a/sw/source/core/docnode/ndindex.cxx b/sw/source/core/docnode/ndindex.cxx index 8e7c933b99..5d0e64f890 100644 --- a/sw/source/core/docnode/ndindex.cxx +++ b/sw/source/core/docnode/ndindex.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,7 +37,7 @@ #include "error.h" // fuers ASSERT #include "ndindex.hxx" -#ifndef PRODUCT +#ifdef DBG_UTIL int SwNodeIndex::nSerial = 0; #endif @@ -71,7 +71,7 @@ SwNodeIndex::SwNodeIndex( SwNodes& rNds, ULONG nIdx ) { rNds.RegisterIndex( *this ); -#ifndef PRODUCT +#ifdef DBG_UTIL MySerial = ++nSerial; // nur in der nicht PRODUCT-Version #endif } @@ -86,7 +86,7 @@ SwNodeIndex::SwNodeIndex( const SwNodeIndex& rIdx, long nDiff ) pNd = rIdx.pNd; pNd->GetNodes().RegisterIndex( *this ); -#ifndef PRODUCT +#ifdef DBG_UTIL MySerial = ++nSerial; // nur in der nicht PRODUCT-Version #endif } @@ -101,7 +101,7 @@ SwNodeIndex::SwNodeIndex( const SwNode& rNd, long nDiff ) pNd = (SwNode*)&rNd; pNd->GetNodes().RegisterIndex( *this ); -#ifndef PRODUCT +#ifdef DBG_UTIL MySerial = ++nSerial; // nur in der nicht PRODUCT-Version #endif } diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx index 4b94c1bf12..7bc5b9e721 100644 --- a/sw/source/core/docnode/ndnotxt.cxx +++ b/sw/source/core/docnode/ndnotxt.cxx @@ -34,7 +34,7 @@ #include <hintids.hxx> #include <tools/poly.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <svx/contdlg.hxx> #include <vcl/svapp.hxx> #include <docary.hxx> diff --git a/sw/source/core/docnode/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx index ef07ac70f6..15996c48a9 100644 --- a/sw/source/core/docnode/ndnum.cxx +++ b/sw/source/core/docnode/ndnum.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -50,7 +50,7 @@ BOOL SwOutlineNodes::Seek_Entry( const SwNodePtr rSrch, USHORT* pFndPos ) const //JP 17.03.98: aufgrund des Bug 48592 - wo unter anderem nach Undo/Redo // Nodes aus dem falschen NodesArray im OutlineArray standen, // jetzt mal einen Check eingebaut. -#ifndef PRODUCT +#ifdef DBG_UTIL { for( USHORT n = 1; n < nO; ++n ) if( &(*this)[ n-1 ]->GetNodes() != @@ -125,7 +125,7 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd) // die Gliederungs-Felder Updaten GetDoc()->GetSysFldType( RES_CHAPTERFLD )->UpdateFlds(); } -} +} //void SwNodes::UpdateOutlineNode( const SwNode& rNd, BYTE nOldLevel, //#outline level,removed by zhaojianwei // BYTE nNewLevel ) diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 5da8c44c3a..0b3bbc0b43 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -34,7 +34,7 @@ #include <hintids.hxx> #include <svx/linkmgr.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <tools/resid.hxx> #include <fmtcntnt.hxx> #include <fmtanchr.hxx> diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 8f01680de5..31f477752f 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -104,7 +104,7 @@ // --> OD 2005-12-05 #i27138# #include <rootfrm.hxx> // <-- -#ifdef PRODUCT +#ifndef DBG_UTIL #define CHECK_TABLE(t) #else #ifdef DEBUG @@ -1322,7 +1322,8 @@ SwTableNode* SwNodes::TextToTable( const std::vector< std::vector<SwNodeRange> > SwTxtNode& rTxtNode = static_cast<SwTxtNode&>(rNode); // setze den bei allen TextNode in der Tabelle den TableNode // als StartNode - rTxtNode.pStartOfSection = pTblNd; +// FIXME: this is setting wrong node StartOfSections in nested tables. +// rTxtNode.pStartOfSection = pTblNd; // remove PageBreaks/PageDesc/ColBreak const SwAttrSet* pSet = rTxtNode.GetpSwAttrSet(); if( pSet ) @@ -1401,7 +1402,6 @@ SwTableNode* SwNodes::TextToTable( const std::vector< std::vector<SwNodeRange> > aCellNodeIdx = SwNodeIndex( *aCellNodeIdx.GetNode().EndOfSectionNode() ); } - // Section der Box zuweisen pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine ); pLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, nBoxes++ ); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 69a6f68d90..73d0124567 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -341,7 +341,7 @@ USHORT SwNode::GetSectionLevel() const |* *******************************************************************/ -#ifndef PRODUCT +#ifdef DBG_UTIL long SwNode::nSerial = 0; #endif @@ -373,7 +373,7 @@ SwNode::SwNode( const SwNodeIndex &rWhere, const BYTE nNdType ) pStartOfSection = (SwStartNode*)this; } -#ifndef PRODUCT +#ifdef DBG_UTIL nMySerial = nSerial; nSerial++; #endif @@ -406,7 +406,7 @@ SwNode::SwNode( SwNodes& rNodes, ULONG nPos, const BYTE nNdType ) pStartOfSection = (SwStartNode*)this; } -#ifndef PRODUCT +#ifdef DBG_UTIL nMySerial = nSerial; nSerial++; #endif @@ -1479,7 +1479,6 @@ SwCntntNode *SwCntntNode::JoinPrev() // erfrage vom Modify Informationen BOOL SwCntntNode::GetInfo( SfxPoolItem& rInfo ) const { - const SwNumRuleItem* pItem; switch( rInfo.Which() ) { case RES_AUTOFMT_DOCNODE: @@ -1509,18 +1508,6 @@ BOOL SwCntntNode::GetInfo( SfxPoolItem& rInfo ) const // return TRUE; // <-- - case RES_GETLOWERNUMLEVEL: - if( IsTxtNode() && - 0 != ( pItem = (SwNumRuleItem*)GetNoCondAttr( - RES_PARATR_NUMRULE, TRUE )) && pItem->GetValue().Len() && - pItem->GetValue() == ((SwNRuleLowerLevel&)rInfo).GetName() && - ((SwTxtNode*)this)->GetActualListLevel() - > ((SwNRuleLowerLevel&)rInfo).GetLevel() ) - { - return FALSE; - } - break; - case RES_FINDNEARESTNODE: if( ((SwFmtPageDesc&)GetAttr( RES_PAGEDESC )).GetPageDesc() ) ((SwFindNearestNode&)rInfo).CheckNode( *this ); @@ -1572,7 +1559,7 @@ BOOL SwCntntNode::SetAttr(const SfxPoolItem& rAttr ) } return bRet; } -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> BOOL SwCntntNode::SetAttr( const SfxItemSet& rSet ) { diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index dd5a91b2ba..489d1c4dcf 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -50,7 +50,7 @@ #include <fmtmeta.hxx> #include <docsh.hxx> -#include <svtools/smplhint.hxx> +#include <svl/smplhint.hxx> extern BOOL CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd, BOOL bChkSection ); @@ -408,7 +408,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, ULONG nSz, if( pFrmNd && !((SwCntntNode*)pFrmNd)->GetDepends() ) pFrmNd = 0; -#ifndef PRODUCT +#ifdef DBG_UTIL if( !pFrmNd ) ASSERT( !this, "ChgNode() - kein FrameNode gefunden" ); #endif diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 23dffa13ac..66dbd2e7a9 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -34,8 +34,8 @@ #include <stdlib.h> #include <hintids.hxx> -#include <svtools/intitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/intitem.hxx> +#include <svl/stritem.hxx> #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> #include <svx/protitem.hxx> diff --git a/sw/source/core/docnode/swthreadmanager.cxx b/sw/source/core/docnode/swthreadmanager.cxx index fea0cd217c..8b173a1221 100644 --- a/sw/source/core/docnode/swthreadmanager.cxx +++ b/sw/source/core/docnode/swthreadmanager.cxx @@ -39,35 +39,29 @@ @author OD */ -SwThreadManager* SwThreadManager::mpThreadManager = 0; -osl::Mutex* SwThreadManager::mpGetManagerMutex = new osl::Mutex(); +bool SwThreadManager::mbThreadManagerInstantiated = false; SwThreadManager::SwThreadManager() : mpThreadManagerImpl( new ThreadManager( SwThreadJoiner::GetThreadJoiner() ) ) { mpThreadManagerImpl->Init(); + mbThreadManagerInstantiated = true; } SwThreadManager::~SwThreadManager() { - delete mpThreadManagerImpl; } +struct InitInstance : public rtl::Static<SwThreadManager, InitInstance> {}; + SwThreadManager& SwThreadManager::GetThreadManager() { - osl::MutexGuard aGuard(*mpGetManagerMutex); - - if ( mpThreadManager == 0 ) - { - mpThreadManager = new SwThreadManager(); - } - - return *mpThreadManager; + return InitInstance::get(); } bool SwThreadManager::ExistsThreadManager() { - return (mpThreadManager != 0); + return mbThreadManagerInstantiated; } oslInterlockedCount SwThreadManager::AddThread( const rtl::Reference< ObservableThread >& rThread ) diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx index 3b03da30d0..11fb6bad6b 100644 --- a/sw/source/core/draw/dpage.cxx +++ b/sw/source/core/draw/dpage.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -32,8 +32,8 @@ #include "precompiled_sw.hxx" #include <basic/basmgr.hxx> #include <svtools/imapobj.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/securityoptions.hxx> +#include <svl/urihelper.hxx> +#include <unotools/securityoptions.hxx> #include <vcl/help.hxx> #include <svx/svdview.hxx> #include <fmturl.hxx> diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx index af52b77336..ddafb79647 100644 --- a/sw/source/core/draw/drawdoc.cxx +++ b/sw/source/core/draw/drawdoc.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -35,9 +35,9 @@ #include <svx/svxids.hrc> #endif #include <tools/stream.hxx> -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include <sot/storage.hxx> -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include <svx/forbiddencharacterstable.hxx> #include <unotools/ucbstreamhelper.hxx> diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 114ae919a1..26c94709c2 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -38,7 +38,7 @@ #include <ctype.h> #include <hintids.hxx> -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <unotools/charclass.hxx> #include <svx/boxitem.hxx> #include <svx/lrspitem.hxx> diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index f12766f6ae..431887c0bf 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -60,7 +60,7 @@ #include <crsskip.hxx> #include <txtfrm.hxx> // SwTxtFrm #include <scriptinfo.hxx> -#include <svtools/ctloptions.hxx> +#include <svl/ctloptions.hxx> #include <charfmt.hxx> // #i27615# #include <numrule.hxx> diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index 41879086d0..980bc00080 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -34,7 +34,7 @@ #include <osl/endian.h> #include <hintids.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <tools/cachestr.hxx> #include <doc.hxx> #include <pam.hxx> diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 8e79603719..c1e368a0b8 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -283,7 +283,7 @@ const Graphic* SwEditShell::GetGraphic( BOOL bWait ) const if( pGrf->IsSwapOut() || ( pGrfNode->IsLinkedFile() && GRAPHIC_DEFAULT == pGrf->GetType() ) ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( pGrfNode->SwapIn( bWait ) || !bWait, "Grafik konnte nicht geladen werden" ); #else pGrfNode->SwapIn( bWait ); @@ -294,7 +294,7 @@ const Graphic* SwEditShell::GetGraphic( BOOL bWait ) const { if ( pGrf->IsSwapOut() && !pGrfNode->IsLinkedFile() ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( pGrfNode->SwapIn( bWait ) || !bWait, "Grafik konnte nicht geladen werden" ); #else pGrfNode->SwapIn( bWait ); @@ -726,7 +726,7 @@ Graphic SwEditShell::GetIMapGraphic() const if( rGrf.IsSwapOut() || ( ((SwGrfNode*)pNd)->IsLinkedFile() && GRAPHIC_DEFAULT == rGrf.GetType() ) ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( ((SwGrfNode*)pNd)->SwapIn( TRUE ) || !TRUE, "Grafik konnte nicht geladen werden" ); #else ((SwGrfNode*)pNd)->SwapIn( TRUE ); diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index b9d4523edb..e04d62c4f5 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -585,7 +585,7 @@ BOOL SwEditShell::IsProtectedOutlinePara() const } } } -#ifndef PRODUCT +#ifdef DBG_UTIL else { ASSERT(!this, "Cursor not on an outline node" ); diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index b4e6ceb991..7bc8f0e310 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -36,7 +36,7 @@ #include <hints.hxx> #define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #ifndef _APP_HXX //autogen #include <vcl/svapp.hxx> diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index c4b81facd8..aade7c6041 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -38,7 +38,7 @@ #include <tools/urlobj.hxx> #include <svtools/txtcmp.hxx> #ifndef SVTOOLS_FSTATHELPER_HXX -#include <svtools/fstathelper.hxx> +#include <svl/fstathelper.hxx> #endif #include <sfx2/docfile.hxx> #include "svx/unolingu.hxx" diff --git a/sw/source/core/except/dbgloop.cxx b/sw/source/core/except/dbgloop.cxx index 2998d7728e..4d45f84001 100644 --- a/sw/source/core/except/dbgloop.cxx +++ b/sw/source/core/except/dbgloop.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#ifdef PRODUCT +#ifndef DBG_UTIL #error Wer fummelt denn an den makefiles rum? #endif #include <tools/stream.hxx> diff --git a/sw/source/core/except/makefile.mk b/sw/source/core/except/makefile.mk index 1000bcaab8..660eb8faf5 100644 --- a/sw/source/core/except/makefile.mk +++ b/sw/source/core/except/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -49,8 +49,7 @@ PRJPCH= CXXFILES = -.IF "$(product)"=="" -.IF "$(cap)"=="" +.IF "$(dbgutil)"!="" CXXFILES += \ errhdl.cxx \ dbgloop.cxx @@ -59,7 +58,6 @@ SLOFILES += \ $(SLO)$/errhdl.obj \ $(SLO)$/dbgloop.obj .ENDIF -.ENDIF # --- Tagets ------------------------------------------------------- .INCLUDE : target.mk diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index 281de8b636..be59f24541 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -38,7 +38,7 @@ #define _SVSTDARR_ULONGS #include <hintids.hxx> -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <svx/unolingu.hxx> #include <svx/langitem.hxx> #include <swtypes.hxx> diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index 442cbd5d1e..7f0982926c 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -34,7 +34,7 @@ #include <float.h> #include <sfx2/app.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include <svx/pageitem.hxx> #include <svx/dataaccessdescriptor.hxx> #include <com/sun/star/sdbc/DataType.hpp> diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index d5204f1c1d..daf8e04387 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,31 +47,32 @@ #include <com/sun/star/text/UserFieldFormat.hpp> #include <com/sun/star/text/PageNumberType.hpp> #include <com/sun/star/text/ReferenceFieldPart.hpp> -#ifndef _COM_SUN_STAR_TEXT_FilenameDisplayFormat_HPP_ #include <com/sun/star/text/FilenameDisplayFormat.hpp> -#endif #include <com/sun/star/text/XDependentTextField.hpp> #include <com/sun/star/text/DocumentStatistic.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/Duration.hpp> #include <unotools/localedatawrapper.hxx> #include <svx/unolingu.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/types.hxx> #include <comphelper/string.hxx> #include <tools/urlobj.hxx> -#ifndef _APP_HXX //autogen #include <vcl/svapp.hxx> -#endif -#include <svtools/urihelper.hxx> -#include <svtools/useroptions.hxx> -#include <svtools/syslocale.hxx> +#include <svl/urihelper.hxx> +#include <unotools/useroptions.hxx> +#include <unotools/syslocale.hxx> +#include <svl/zforlist.hxx> #include <tools/time.hxx> #include <tools/datetime.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/Time.hpp> #include <tools/shl.hxx> #include <swmodule.hxx> @@ -90,9 +91,7 @@ #include <cntfrm.hxx> // #include <pam.hxx> #include <viewsh.hxx> -#ifndef _DBMGR_HXX #include <dbmgr.hxx> -#endif #include <shellres.hxx> #include <docufld.hxx> #include <flddat.hxx> @@ -100,18 +99,12 @@ #include <ndtxt.hxx> #include <expfld.hxx> #include <poolfmt.hxx> -#ifndef _DOCSH_HXX #include <docsh.hxx> -#endif -#ifndef _UNOFLDMID_H #include <unofldmid.h> -#endif #include <swunohelper.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif -#include <svx/outliner.hxx> +#include <svx/outliner.hxx> #include <svx/outlobj.hxx> #define URL_DECODE INetURLObject::DECODE_UNAMBIGUOUS @@ -1114,6 +1107,21 @@ SwDocInfoField::SwDocInfoField(SwDocInfoFieldType* pTyp, sal_uInt16 nSub, const /* --------------------------------------------------------------------------- ---------------------------------------------------------------------------*/ +template<class T> +double lcl_TimeToDouble( const T& rTime ) +{ + const double fMilliSecondsPerDay = 86400000.0; + return ((rTime.Hours*3600000)+(rTime.Minutes*60000)+(rTime.Seconds*1000)+(rTime.HundredthSeconds*10)) / fMilliSecondsPerDay; +} + +template<class D> +double lcl_DateToDouble( const D& rDate, const Date& rNullDate ) +{ + long nDate = Date::DateToDays( rDate.Day, rDate.Month, rDate.Year ); + long nNullDate = Date::DateToDays( rNullDate.GetDay(), rNullDate.GetMonth(), rNullDate.GetYear() ); + return double( nDate - nNullDate ); +} + String SwDocInfoField::Expand() const { if ( ( nSubType & 0xFF ) == DI_CUSTOM ) @@ -1132,7 +1140,7 @@ String SwDocInfoField::Expand() const uno::Reference<document::XDocumentProperties> xDocProps( xDPS->getDocumentProperties()); uno::Reference < beans::XPropertySet > xSet( xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); uno::Reference < beans::XPropertySetInfo > xSetInfo = xSet->getPropertySetInfo(); - + uno::Any aAny; if( xSetInfo->hasPropertyByName( aName ) ) aAny = xSet->getPropertyValue( aName ); @@ -1145,18 +1153,43 @@ String SwDocInfoField::Expand() const ::rtl::OUString sVal; uno::Reference < script::XTypeConverter > xConverter( comphelper::getProcessServiceFactory() ->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")), uno::UNO_QUERY ); - uno::Any aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING ); - aNew >>= sVal; + util::Date aDate; + util::DateTime aDateTime; + util::Duration aDuration; + if( aAny >>= aDate) + { + SvNumberFormatter* pFormatter = pDocShell->GetDoc()->GetNumberFormatter(); + Date* pNullDate = pFormatter->GetNullDate(); + sVal = ExpandValue( lcl_DateToDouble<util::Date>( aDate, *pNullDate ), GetFormat(), GetLanguage()); + } + else if( aAny >>= aDateTime ) + { + double fDateTime = lcl_TimeToDouble<util::DateTime>( aDateTime ); + SvNumberFormatter* pFormatter = pDocShell->GetDoc()->GetNumberFormatter(); + Date* pNullDate = pFormatter->GetNullDate(); + fDateTime += lcl_DateToDouble<util::DateTime>( aDateTime, *pNullDate ); + sVal = ExpandValue( fDateTime, GetFormat(), GetLanguage()); + } + else if( aAny >>= aDuration ) + { + String sText(aDuration.Negative ? '-' : '+'); + sText += ViewShell::GetShellRes()->sDurationFormat; + sText.SearchAndReplace(String::CreateFromAscii( "%1"), String::CreateFromInt32( aDuration.Years ) ); + sText.SearchAndReplace(String::CreateFromAscii( "%2"), String::CreateFromInt32( aDuration.Months ) ); + sText.SearchAndReplace(String::CreateFromAscii( "%3"), String::CreateFromInt32( aDuration.Days ) ); + sText.SearchAndReplace(String::CreateFromAscii( "%4"), String::CreateFromInt32( aDuration.Hours ) ); + sText.SearchAndReplace(String::CreateFromAscii( "%5"), String::CreateFromInt32( aDuration.Minutes) ); + sText.SearchAndReplace(String::CreateFromAscii( "%6"), String::CreateFromInt32( aDuration.Seconds) ); + sVal = sText; + } + else + { + uno::Any aNew = xConverter->convertToSimpleType( aAny, uno::TypeClass_STRING ); + aNew >>= sVal; + } ((SwDocInfoField*)this)->aContent = sVal; } } - else - { - // property is "void" - means it has not been added until now - do it! - aAny <<= ::rtl::OUString(aContent); - uno::Reference < beans::XPropertyContainer > xCont( xSet, uno::UNO_QUERY ); - xCont->addProperty( aName, ::com::sun::star::beans::PropertyAttribute::REMOVEABLE, aAny ); - } } catch (uno::Exception&) {} } @@ -1877,12 +1910,17 @@ void SwPostItField::SetTextObject( OutlinerParaObject* pText ) mpText = pText; } +sal_uInt32 SwPostItField::GetNumberOfParagraphs() const +{ + return (mpText) ? mpText->Count() : 1; +} + /*-----------------05.03.98 13:42------------------- --------------------------------------------------*/ BOOL SwPostItField::QueryValue( uno::Any& rAny, USHORT nWhichId ) const { - switch( nWhichId ) + switch( nWhichId ) { case FIELD_PROP_PAR1: rAny <<= OUString(sAuthor); @@ -2320,7 +2358,7 @@ sal_uInt16 SwRefPageGetFieldType::MakeSetList( _SetGetExpFlds& rTmpLst ) { // einen sdbcx::Index fuers bestimmen vom TextNode anlegen SwPosition aPos( pDoc->GetNodes().GetEndOfPostIts() ); -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( GetBodyTxtNode( *pDoc, aPos, *pFrm ), "wo steht das Feld" ); #else diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index 930394256f..33861fb8de 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -35,8 +35,8 @@ // #include <math.h> #include <float.h> #include <rtl/math.hxx> -#include <svtools/zforlist.hxx> -#include <svtools/zformat.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> #include <svx/unolingu.hxx> #ifndef _UNOFLDMID_H #include <unofldmid.h> @@ -167,7 +167,7 @@ SwFieldType::SwFieldType( USHORT nWhichId ) DBG_CTOR( SwFieldType, 0 ); } -#ifndef PRODUCT +#ifdef DBG_UTIL SwFieldType::~SwFieldType() { @@ -213,7 +213,7 @@ SwField::~SwField() Beschreibung: Statt Umweg ueber den Typ --------------------------------------------------------------------*/ -#ifndef PRODUCT +#ifdef DBG_UTIL USHORT SwField::Which() const { ASSERT(pType, "Kein Typ vorhanden"); diff --git a/sw/source/core/fields/flddat.cxx b/sw/source/core/fields/flddat.cxx index 648fb63539..f5d15510d8 100644 --- a/sw/source/core/fields/flddat.cxx +++ b/sw/source/core/fields/flddat.cxx @@ -33,7 +33,7 @@ // #include <math.h> #include <tools/datetime.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include <com/sun/star/util/DateTime.hpp> #include <doc.hxx> #include <fldbas.hxx> diff --git a/sw/source/core/fields/flddropdown.cxx b/sw/source/core/fields/flddropdown.cxx index 357e1c842e..af36690bda 100644 --- a/sw/source/core/fields/flddropdown.cxx +++ b/sw/source/core/fields/flddropdown.cxx @@ -37,7 +37,7 @@ #include <algorithm> #define INCLUDED_ALGORITHM #endif -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #ifndef _UNOFLDMID_H #include <unofldmid.h> diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 7204947d1a..12062bb3fb 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -34,7 +34,7 @@ #define _SVSTDARR_USHORTSSORT #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <com/sun/star/text/ReferenceFieldPart.hpp> #include <com/sun/star/text/ReferenceFieldSource.hpp> #include <unotools/localedatawrapper.hxx> diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx index 870881dc21..32227567a7 100644 --- a/sw/source/core/fields/usrfld.cxx +++ b/sw/source/core/fields/usrfld.cxx @@ -32,8 +32,8 @@ #include "precompiled_sw.hxx" -#include <svtools/zforlist.hxx> -#include <svtools/zformat.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> #include <svx/svdmodel.hxx> diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index bc66235cde..27f93b5cf6 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,7 +37,7 @@ #include <vcl/graph.hxx> #include <sot/formats.hxx> #include <sot/storage.hxx> -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/viewsh.hxx> #include <svx/xexch.hxx> diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx index 1e304cca24..8cca232fb4 100644 --- a/sw/source/core/frmedt/fedesc.cxx +++ b/sw/source/core/frmedt/fedesc.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -70,7 +70,7 @@ USHORT SwFEShell::GetPageDescCnt() const void SwFEShell::ChgCurPageDesc( const SwPageDesc& rDesc ) { -#ifndef PRODUCT +#ifdef DBG_UTIL //Die SS veraendert keinen PageDesc, sondern setzt nur das Attribut. //Der Pagedesc muss im Dokument vorhanden sein! BOOL bFound = FALSE; diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 640a49f13d..70ee872744 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" #include <hintids.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svtools/imapobj.hxx> #include <svtools/soerr.hxx> #include <svx/protitem.hxx> @@ -218,7 +218,7 @@ sal_Bool lcl_ChkAndSetNewAnchor( const SwFlyFrm& rFly, SfxItemSet& rSet ) SwDoc* pDoc = (SwDoc*)rFmt.GetDoc(); -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( !(nNew == FLY_PAGE && (FLY_AT_CNTNT==nOld || FLY_AUTO_CNTNT==nOld || FLY_IN_CNTNT==nOld ) && pDoc->IsInHeaderFooter( rOldAnch.GetCntntAnchor()->nNode )), @@ -602,7 +602,7 @@ Point SwFEShell::FindAnchorPos( const Point& rAbsPos, sal_Bool bMoveIt ) SwRect aTmpRect( aRet, rAbsPos ); if( aTmpRect.HasArea() ) MakeVisible( aTmpRect ); -#ifndef PRODUCT +#ifdef DBG_UTIL //TODO: That doesn't seem to be intended if( Color(COL_TRANSPARENT) != GetOut()->GetLineColor() ) { diff --git a/sw/source/core/frmedt/feflyole.cxx b/sw/source/core/frmedt/feflyole.cxx index d477118795..caabbee173 100644 --- a/sw/source/core/frmedt/feflyole.cxx +++ b/sw/source/core/frmedt/feflyole.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,7 +37,7 @@ #endif #include <sfx2/viewsh.hxx> #include <sfx2/app.hxx> -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #include <sfx2/viewfrm.hxx> #include <sot/exchange.hxx> diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx index 6626da2420..f4efffd15a 100644 --- a/sw/source/core/graphic/ndgrf.cxx +++ b/sw/source/core/graphic/ndgrf.cxx @@ -33,9 +33,9 @@ #include <hintids.hxx> #include <vcl/salbtype.hxx> // FRound #include <tools/urlobj.hxx> -#include <svtools/undo.hxx> +#include <svl/undo.hxx> #ifndef SVTOOLS_FSTATHELPER_HXX -#include <svtools/fstathelper.hxx> +#include <svl/fstathelper.hxx> #endif #include <svtools/imap.hxx> #include <svtools/filter.hxx> diff --git a/sw/source/core/inc/SwXTextDefaults.hxx b/sw/source/core/inc/SwXTextDefaults.hxx index 58d4567510..7a7426cbf6 100644 --- a/sw/source/core/inc/SwXTextDefaults.hxx +++ b/sw/source/core/inc/SwXTextDefaults.hxx @@ -36,7 +36,7 @@ #ifndef _COM_SUN_STAR_BEANS_XSERVICEINFO_HPP_ #include <com/sun/star/lang/XServiceInfo.hpp> #endif -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> class SwDoc; diff --git a/sw/source/core/inc/blink.hxx b/sw/source/core/inc/blink.hxx index 382a761fb1..8ca7dbbc99 100644 --- a/sw/source/core/inc/blink.hxx +++ b/sw/source/core/inc/blink.hxx @@ -37,7 +37,7 @@ class SwTxtFrm; #include <vcl/timer.hxx> #include <tools/gen.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> class SwBlinkPortion { diff --git a/sw/source/core/inc/dbg_lay.hxx b/sw/source/core/inc/dbg_lay.hxx index 16b778fc1d..f2be6d6d8c 100644 --- a/sw/source/core/inc/dbg_lay.hxx +++ b/sw/source/core/inc/dbg_lay.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -66,7 +66,7 @@ #define SNAP_FLYFRAMES 0x00000002 #define SNAP_TABLECONT 0x00000004 -#ifndef PRODUCT +#ifdef DBG_UTIL #include "swtypes.hxx" diff --git a/sw/source/core/inc/dbgloop.hxx b/sw/source/core/inc/dbgloop.hxx index 4c66bdd82f..eb446bb4df 100644 --- a/sw/source/core/inc/dbgloop.hxx +++ b/sw/source/core/inc/dbgloop.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -31,7 +31,7 @@ #ifndef _DBGLOOP_HXX #define _DBGLOOP_HXX -#ifndef PRODUCT +#ifdef DBG_UTIL #include <tools/solar.h> diff --git a/sw/source/core/inc/docsort.hxx b/sw/source/core/inc/docsort.hxx index 8b3428fceb..d67ee8c102 100644 --- a/sw/source/core/inc/docsort.hxx +++ b/sw/source/core/inc/docsort.hxx @@ -30,7 +30,7 @@ #ifndef _SORT_HXX #define _SORT_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <ndindex.hxx> diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx index 8db243ce3b..174c6225fa 100644 --- a/sw/source/core/inc/doctxm.hxx +++ b/sw/source/core/inc/doctxm.hxx @@ -31,7 +31,7 @@ #define _DOCTXM_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <tools/gen.hxx> #include <tox.hxx> #include <section.hxx> diff --git a/sw/source/core/inc/drawfont.hxx b/sw/source/core/inc/drawfont.hxx index 9fc27ae2d0..d1144b0076 100644 --- a/sw/source/core/inc/drawfont.hxx +++ b/sw/source/core/inc/drawfont.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -97,11 +97,11 @@ class SwDrawTextInfo SwDrawTextInfo(); // nicht zulaessig public: -#ifndef PRODUCT +#ifdef DBG_UTIL BOOL bPos : 1; // These flags should control, that the appropriate BOOL bWrong : 1; // Set-function has been called before calling BOOL bGrammarCheck : 1; // the Get-function of a member - BOOL bSize : 1; + BOOL bSize : 1; BOOL bFnt : 1; BOOL bHyph : 1; BOOL bLeft : 1; @@ -160,7 +160,7 @@ public: bUpper = FALSE; bDrawSpace = FALSE; -#ifndef PRODUCT +#ifdef DBG_UTIL // these flags control, whether the matching member variables have // been set by using the Set-function before they may be accessed // by their Get-function: @@ -383,7 +383,7 @@ public: void SetPos( const Point &rNew ) { pPos = &rNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bPos = TRUE; #endif } @@ -391,7 +391,7 @@ public: void SetHyphPos( xub_StrLen *pNew ) { pHyphPos = pNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bHyph = TRUE; #endif } @@ -404,7 +404,7 @@ public: void SetWrong( const SwWrongList* pNew ) { pWrong = pNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bWrong = TRUE; #endif } @@ -412,7 +412,7 @@ public: void SetGrammarCheck( const SwWrongList* pNew ) { pGrammarCheck = pNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bGrammarCheck = TRUE; #endif } @@ -425,7 +425,7 @@ public: void SetSize( const Size &rNew ) { pSize = &rNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bSize = TRUE; #endif } @@ -433,7 +433,7 @@ public: void SetFont( SwFont* pNew ) { pFnt = pNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bFnt = TRUE; #endif } @@ -451,7 +451,7 @@ public: void SetOfst( xub_StrLen nNew ) { nOfst = nNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bOfst = TRUE; #endif } @@ -459,7 +459,7 @@ public: void SetLeft( long nNew ) { nLeft = nNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bLeft = TRUE; #endif } @@ -467,7 +467,7 @@ public: void SetRight( long nNew ) { nRight = nNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bRight = TRUE; #endif } @@ -475,7 +475,7 @@ public: void SetKanaDiff( long nNew ) { nKanaDiff = nNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bKana = TRUE; #endif } @@ -488,7 +488,7 @@ public: void SetAscent( USHORT nNew ) { nAscent = nNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bAscent = TRUE; #endif } @@ -510,7 +510,7 @@ public: nSpace = nNew; nSperren = 0; } -#ifndef PRODUCT +#ifdef DBG_UTIL bSpace = TRUE; bSperr = TRUE; #endif @@ -518,7 +518,7 @@ public: void SetNumberOfBlanks( xub_StrLen nNew ) { -#ifndef PRODUCT +#ifdef DBG_UTIL bNumberOfBlanks = TRUE; #endif nNumberOfBlanks = nNew; @@ -547,7 +547,7 @@ public: void SetUpper( BOOL bNew ) { bUpper = bNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bUppr = TRUE; #endif } @@ -555,7 +555,7 @@ public: void SetDrawSpace( BOOL bNew ) { bDrawSpace = bNew; -#ifndef PRODUCT +#ifdef DBG_UTIL bDrawSp = TRUE; #endif } diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index 8312125fc6..ed5faed512 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -168,7 +168,7 @@ public: virtual void CheckDirection( BOOL bVert ); virtual void Cut(); -#ifndef PRODUCT +#ifdef DBG_UTIL virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); #endif diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx index 740ef9b992..d5d1c38494 100644 --- a/sw/source/core/inc/fntcache.hxx +++ b/sw/source/core/inc/fntcache.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -54,7 +54,7 @@ class SwFntCache : public SwCache public: inline SwFntCache() : SwCache(50,50 -#ifndef PRODUCT +#ifdef DBG_UTIL , ByteString( RTL_CONSTASCII_STRINGPARAM( "Globaler Font-Cache pFntCache" )) #endif diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 9a3503014a..73e84e0420 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _FRAME_HXX #define _FRAME_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include "swtypes.hxx" // fuer SwTwips #include "swrect.hxx" #include "calbck.hxx" // fuer SwClient diff --git a/sw/source/core/inc/ftnfrm.hxx b/sw/source/core/inc/ftnfrm.hxx index 0a1ac9c63f..8702569b98 100644 --- a/sw/source/core/inc/ftnfrm.hxx +++ b/sw/source/core/inc/ftnfrm.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -74,7 +74,7 @@ class SwFtnFrm: public SwLayoutFrm // --> OD 2005-05-18 #i49383# - control unlock of position of lower anchored objects. bool mbUnlockPosOfLowerObjs : 1; // <-- -#ifndef PRODUCT +#ifdef DBG_UTIL protected: virtual SwTwips ShrinkFrm( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); @@ -89,7 +89,7 @@ public: BOOL operator<( const SwTxtFtn* pTxtFtn ) const; -#ifdef PRODUCT +#ifndef DBG_UTIL const SwCntntFrm *GetRef() const { return pRef; } SwCntntFrm *GetRef() { return pRef; } #else diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx index 0a4be4c763..439c2e8b28 100644 --- a/sw/source/core/inc/layact.hxx +++ b/sw/source/core/inc/layact.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -218,13 +218,13 @@ class SwLayIdle BOOL bPageValid; // Konnte die Seite alles validiert werden? BOOL bAllValid; // Konnte alles validiert werden? -#ifndef PRODUCT +#ifdef DBG_UTIL BOOL bIndicator; #endif #ifdef _LAYACT_CXX -#ifndef PRODUCT +#ifdef DBG_UTIL void ShowIdle( ColorData eName ); #endif diff --git a/sw/source/core/inc/laycache.hxx b/sw/source/core/inc/laycache.hxx index 60414797b5..336d680835 100644 --- a/sw/source/core/inc/laycache.hxx +++ b/sw/source/core/inc/laycache.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -72,7 +72,7 @@ public: return pImpl; } void UnlockImpl() { --nLockCount; } -#ifndef PRODUCT +#ifdef DBG_UTIL sal_Bool CompareLayout( const SwDoc& rDoc ) const; #endif }; diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx index dac9783874..9efae5c769 100644 --- a/sw/source/core/inc/mvsave.hxx +++ b/sw/source/core/inc/mvsave.hxx @@ -35,7 +35,7 @@ #ifndef _KEYCOD_HXX //autogen #include <vcl/keycod.hxx> #endif -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <IDocumentMarkAccess.hxx> #include <vector> diff --git a/sw/source/core/inc/noteurl.hxx b/sw/source/core/inc/noteurl.hxx index f39c1564d6..68909e562e 100644 --- a/sw/source/core/inc/noteurl.hxx +++ b/sw/source/core/inc/noteurl.hxx @@ -32,7 +32,7 @@ #define _NOTEURL_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <tools/string.hxx> #include "swrect.hxx" diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx index 38f0b8a723..fb9da90497 100644 --- a/sw/source/core/inc/pagefrm.hxx +++ b/sw/source/core/inc/pagefrm.hxx @@ -31,7 +31,7 @@ #define _PAGEFRM_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include "ftnboss.hxx" #include <tools/mempool.hxx> diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx index ee925015c5..3223f971dc 100644 --- a/sw/source/core/inc/rootfrm.hxx +++ b/sw/source/core/inc/rootfrm.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -203,7 +203,7 @@ public: virtual void Paint( const SwRect& ) const; virtual SwTwips ShrinkFrm( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); -#ifndef PRODUCT +#ifdef DBG_UTIL virtual void Cut(); virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); #endif @@ -313,7 +313,7 @@ public: void InsertEmptySct( SwSectionFrm* pDel ); void DeleteEmptySct() { if( pDestroy ) _DeleteEmptySct(); } void RemoveFromList( SwSectionFrm* pSct ) { if( pDestroy ) _RemoveFromList( pSct ); } -#ifndef PRODUCT +#ifdef DBG_UTIL // Wird zur Zeit nur fuer ASSERTs benutzt: BOOL IsInDelList( SwSectionFrm* pSct ) const; // Ist der SectionFrm in der Liste enthalten? #endif diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx index 2724613464..9c875a8a70 100644 --- a/sw/source/core/inc/scriptinfo.hxx +++ b/sw/source/core/inc/scriptinfo.hxx @@ -34,7 +34,7 @@ #define _SVSTDARR_BYTES #define _SVSTDARR_USHORTS #define _SVSTDARR_XUB_STRLEN -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <i18npool/lang.h> #include <list> diff --git a/sw/source/core/inc/scrrect.hxx b/sw/source/core/inc/scrrect.hxx index 4031c1e967..e3827e1d17 100644 --- a/sw/source/core/inc/scrrect.hxx +++ b/sw/source/core/inc/scrrect.hxx @@ -30,7 +30,7 @@ #ifndef _SCRRECT_HXX #define _SCRRECT_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include "swrect.hxx" #include <swtypes.hxx> diff --git a/sw/source/core/inc/swblocks.hxx b/sw/source/core/inc/swblocks.hxx index a48ba1493f..c994dc8be9 100644 --- a/sw/source/core/inc/swblocks.hxx +++ b/sw/source/core/inc/swblocks.hxx @@ -35,7 +35,7 @@ #ifndef _DATE_HXX //autogen #include <tools/datetime.hxx> #endif -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> class SfxMedium; diff --git a/sw/source/core/inc/swcache.hxx b/sw/source/core/inc/swcache.hxx index cb356f871a..bc4f5d34ac 100644 --- a/sw/source/core/inc/swcache.hxx +++ b/sw/source/core/inc/swcache.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -60,7 +60,7 @@ * */ -#ifndef PRODUCT +#ifdef DBG_UTIL #ifndef _STRING_HXX //autogen #include <tools/string.hxx> #endif @@ -68,7 +68,7 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif class SwCacheObj; @@ -94,7 +94,7 @@ class SwCache : public SwCacheObjArr void DeleteObj( SwCacheObj *pObj ); -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aName; long nAppend; //Anzahl der Eintragungen durch Erweiterung. long nInsertFree; //Anzahl der Eintragungen auf freie Plaetze. @@ -116,7 +116,7 @@ class SwCache : public SwCacheObjArr public: //nur BYTE hineinstecken!!! -#ifndef PRODUCT +#ifdef DBG_UTIL SwCache( const USHORT nInitSize, const USHORT nGrowSize, const ByteString &rNm ); ~SwCache(); @@ -197,7 +197,7 @@ public: inline BOOL IsLocked() const { return 0 != nLock; } -#ifdef PRODUCT +#ifndef DBG_UTIL inline void Lock() { ++nLock; } inline void Unlock() { --nLock; } #else @@ -249,7 +249,7 @@ public: inline void SwCache::IncreaseMax( const USHORT nAdd ) { nCurMax = nCurMax + sal::static_int_cast< USHORT >(nAdd); -#ifndef PRODUCT +#ifdef DBG_UTIL ++nIncreaseMax; #endif } @@ -257,7 +257,7 @@ inline void SwCache::DecreaseMax( const USHORT nSub ) { if ( nCurMax > nSub ) nCurMax = nCurMax - sal::static_int_cast< USHORT >(nSub); -#ifndef PRODUCT +#ifdef DBG_UTIL ++nDecreaseMax; #endif } diff --git a/sw/source/core/inc/swfntcch.hxx b/sw/source/core/inc/swfntcch.hxx index e6e9859b9d..3f5c861d60 100644 --- a/sw/source/core/inc/swfntcch.hxx +++ b/sw/source/core/inc/swfntcch.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -49,7 +49,7 @@ class SwFontCache : public SwCache public: inline SwFontCache() : SwCache(50,50 -#ifndef PRODUCT +#ifdef DBG_UTIL , "Globaler AttributSet/Font-Cache pSwFontCache" #endif ) {} diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx index 68d031dab5..9cd9e16ac7 100644 --- a/sw/source/core/inc/swfont.hxx +++ b/sw/source/core/inc/swfont.hxx @@ -848,7 +848,7 @@ public: * class SvStatistics *************************************************************************/ -#ifdef PRODUCT +#ifndef DBG_UTIL #define SV_STAT(nWhich) #else diff --git a/sw/source/core/inc/swthreadmanager.hxx b/sw/source/core/inc/swthreadmanager.hxx index 7ec4df7585..1029efb217 100644 --- a/sw/source/core/inc/swthreadmanager.hxx +++ b/sw/source/core/inc/swthreadmanager.hxx @@ -34,6 +34,10 @@ #include <osl/mutex.hxx> #include <rtl/ref.hxx> +#include <boost/utility.hpp> +#include <memory> + + class ObservableThread; class ThreadManager; @@ -45,6 +49,7 @@ class ThreadManager; @author OD */ class SwThreadManager + : private ::boost::noncopyable { public: @@ -52,6 +57,9 @@ class SwThreadManager static bool ExistsThreadManager(); + // private: don't call! + SwThreadManager(); + // private: don't call! ~SwThreadManager(); oslInterlockedCount AddThread( const rtl::Reference< ObservableThread >& rThread ); @@ -76,12 +84,9 @@ class SwThreadManager bool StartingOfThreadsSuspended(); private: - static SwThreadManager* mpThreadManager; - static osl::Mutex* mpGetManagerMutex; + static bool mbThreadManagerInstantiated; - ThreadManager* mpThreadManagerImpl; - - SwThreadManager(); + ::std::auto_ptr<ThreadManager> mpThreadManagerImpl; }; #endif diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx index 62e71094ed..a909a02fd9 100644 --- a/sw/source/core/inc/tblrwcl.hxx +++ b/sw/source/core/inc/tblrwcl.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -31,7 +31,7 @@ #define _TBLRWCL_HXX #ifndef _SVSTDARR_HXX #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <vector> #include <swtypes.hxx> @@ -69,7 +69,7 @@ BOOL lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* pPara ); BOOL lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* pPara ); -#ifndef PRODUCT +#ifdef DBG_UTIL void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize ); #endif @@ -100,7 +100,7 @@ public: : aPosArr( 16, 16 ), aBoxes( 16, 16 ), pHst( pHist ), nMode( nMd ), nWidth( 0 ), bGetFromTop( bTop ), bGetValues( TRUE ) - + {} void AddBox( const SwTableBox& rBox ); diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index d5a6f67912..a704ea2b33 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -405,7 +405,7 @@ public: inline sal_Bool IsSwapped() const { return bIsSwapped; } // Hat der Frm eine lokale Fussnote (in diesem Frm bzw. Follow)? -#ifdef PRODUCT +#ifndef DBG_UTIL void CalcFtnFlag(); #else void CalcFtnFlag( xub_StrLen nStop = STRING_LEN );//Fuer den Test von SplitFrm diff --git a/sw/source/core/inc/visiturl.hxx b/sw/source/core/inc/visiturl.hxx index 9b71ffeee8..59c7239959 100644 --- a/sw/source/core/inc/visiturl.hxx +++ b/sw/source/core/inc/visiturl.hxx @@ -33,7 +33,7 @@ -#include <svtools/lstner.hxx> +#include <svl/lstner.hxx> class SwDoc; class SwURLStateChanged : public SfxListener diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index e327b0bbdf..394303d743 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -127,7 +127,7 @@ // --> OD 2006-03-06 #125892# #include <HandleAnchorNodeChg.hxx> // <-- -#include <svtools/cjkoptions.hxx> +#include <svl/cjkoptions.hxx> using namespace ::com::sun::star; using ::rtl::OUString; @@ -691,7 +691,7 @@ void SwFmtPageDesc::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) //mich also bei meinem Format aus. //Dabei werden ich Deletet!!! if( IS_TYPE( SwFmt, pDefinedIn )) -#ifndef PRODUCT +#ifdef DBG_UTIL { sal_Bool bDel = ((SwFmt*)pDefinedIn)->ResetFmtAttr( RES_PAGEDESC ); ASSERT( bDel, ";-) FmtPageDesc nicht zerstoert." ); @@ -700,7 +700,7 @@ void SwFmtPageDesc::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) ((SwFmt*)pDefinedIn)->ResetFmtAttr( RES_PAGEDESC ); #endif else if( IS_TYPE( SwCntntNode, pDefinedIn )) -#ifndef PRODUCT +#ifdef DBG_UTIL { sal_Bool bDel = ((SwCntntNode*)pDefinedIn)->ResetAttr( RES_PAGEDESC ); ASSERT( bDel, ";-) FmtPageDesc nicht zerstoert." ); diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index bb73a85bbc..91090ac630 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -851,7 +851,7 @@ void SwPageFrm::MakeAll() if ( Frm() != aOldRect && GetUpper() ) static_cast<SwRootFrm*>(GetUpper())->CheckViewLayout( 0, 0 ); -#ifndef PRODUCT +#ifdef DBG_UTIL //Der Upper (Root) muss mindestens so breit //sein, dass er die breiteste Seite aufnehmen kann. if ( GetUpper() ) @@ -1139,7 +1139,7 @@ void SwCntntFrm::MakeAll() // <-- PROTOCOL_ENTER( this, PROT_MAKEALL, 0, 0 ) -#ifndef PRODUCT +#ifdef DBG_UTIL const SwDoc *pDoc = GetAttrSet()->GetDoc(); if( pDoc ) { @@ -1695,7 +1695,7 @@ void SwCntntFrm::MakeAll() ( !bSct || !FindSctFrm()->IsColLocked() ) ) bMoveOrFit = TRUE; } -#ifndef PRODUCT +#ifdef DBG_UTIL else { ASSERT( FALSE, "+TxtFrm hat WouldFit-Versprechen nicht eingehalten." ); diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx index 6c5d9e6b66..35cf44542f 100644 --- a/sw/source/core/layout/dbg_lay.cxx +++ b/sw/source/core/layout/dbg_lay.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -106,7 +106,7 @@ * * --------------------------------------------------*/ -#ifdef PRODUCT +#ifndef DBG_UTIL #error Wer fummelt denn an den makefiles rum? #endif @@ -119,7 +119,7 @@ #define _SVSTDARR_USHORTS #define _SVSTDARR_USHORTSSORT #define _SVSTDARR_LONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <stdio.h> @@ -139,7 +139,7 @@ SwImplProtocol* SwProtocol::pImpl = NULL; ULONG lcl_GetFrameId( const SwFrm* pFrm ) { -#ifndef PRODUCT +#ifdef DBG_UTIL static BOOL bFrameId = FALSE; if( bFrameId ) return pFrm->GetFrmId(); diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 8899002e4e..c7eb4b408c 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" #include "hintids.hxx" -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svtools/imap.hxx> #ifndef _GRAPH_HXX //autogen #include <vcl/graph.hxx> diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 85d8ac89c1..5e6e53b69b 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -277,7 +277,7 @@ void SwFlyFreeFrm::MakeAll() } Unlock(); -#ifndef PRODUCT +#ifdef DBG_UTIL SWRECTFN( this ) ASSERT( bHeightClipped || ( (Frm().*fnRect->fnGetHeight)() > 0 && (Prt().*fnRect->fnGetHeight)() > 0), @@ -966,7 +966,7 @@ void SwPageFrm::AppendDrawObjToPage( SwAnchoredObject& _rNewObj ) } if ( !pSortedObjs->Insert( _rNewObj ) ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( pSortedObjs->Contains( _rNewObj ), "Drawing object not appended into list <pSortedObjs>." ); #endif diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 756269cd03..82c921750a 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1690,7 +1690,7 @@ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, delete pPageMaker; if( pDoc->GetLayoutCache() ) { -#ifndef PRODUCT +#ifdef DBG_UTIL #if OSL_DEBUG_LEVEL > 1 pDoc->GetLayoutCache()->CompareLayout( *pDoc ); #endif diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index be92d50f6a..d413deeb86 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -356,7 +356,7 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL ) //moeglich. //Wenn die Seite eine spezielle Fussnotenseite ist, so nehmen wir uns auch //soviel Platz wie eben moeglich. -#ifndef PRODUCT +#ifdef DBG_UTIL if ( !GetUpper() || !GetUpper()->IsFtnBossFrm() ) { ASSERT( !this, "Keine FtnBoss." ); return 0; @@ -562,7 +562,7 @@ void SwFtnFrm::InvalidateNxtFtnCnts( SwPageFrm *pPage ) } } -#ifndef PRODUCT +#ifdef DBG_UTIL SwTwips SwFtnFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo ) { @@ -711,7 +711,7 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling ) pDel->Cut(); delete pDel; } -#ifndef PRODUCT +#ifdef DBG_UTIL SwDoc *pDoc = GetFmt()->GetDoc(); if ( GetPrev() ) { @@ -1142,7 +1142,7 @@ SwFtnContFrm *SwFtnBossFrm::MakeFtnCont() //immer direkt hinter dem Bodytext. //Sein FrmFmt ist immer das DefaultFrmFmt. -#ifndef PRODUCT +#ifdef DBG_UTIL if ( FindFtnCont() ) { ASSERT( !this, "Fussnotencontainer bereits vorhanden." ); return 0; @@ -1171,7 +1171,7 @@ SwFtnContFrm *SwFtnBossFrm::FindFtnCont() while( pFrm && !pFrm->IsFtnContFrm() ) pFrm = pFrm->GetNext(); -#ifndef PRODUCT +#ifdef DBG_UTIL if ( pFrm ) { SwFrm *pFtn = pFrm->GetLower(); @@ -1416,7 +1416,7 @@ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck ) void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew ) { -#if (OSL_DEBUG_LEVEL > 1) && !defined(PRODUCT) +#if (OSL_DEBUG_LEVEL > 1) && defined(DBG_UTIL) static USHORT nStop = 0; if ( nStop == pNew->GetFrmId() ) { @@ -3278,7 +3278,7 @@ SwSaveFtnHeight::~SwSaveFtnHeight() } -#ifndef PRODUCT +#ifdef DBG_UTIL //JP 15.10.2001: in a non pro version test if the attribute has the same // meaning which his reference is diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 2718e15a6c..5eb767a656 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -69,7 +69,7 @@ #include <SwSmartTagMgr.hxx> #define _SVSTDARR_BOOLS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #define _LAYACT_CXX #include "layact.hxx" @@ -116,7 +116,7 @@ //Sparen von Schreibarbeit um den Zugriff auf zerstoerte Seiten zu vermeiden. -#ifndef PRODUCT +#ifdef DBG_UTIL static void BreakPoint() { @@ -2808,7 +2808,7 @@ BOOL SwLayIdle::DoIdleJob( IdleJobType eJob, BOOL bVisAreaOnly ) } -#ifndef PRODUCT +#ifdef DBG_UTIL #if OSL_DEBUG_LEVEL > 1 /************************************************************************* @@ -2857,7 +2857,7 @@ void SwLayIdle::ShowIdle( ColorData eColorData ) SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) : pRoot( pRt ), pImp( pI ) -#ifndef PRODUCT +#ifdef DBG_UTIL #if OSL_DEBUG_LEVEL > 1 , bIndicator( FALSE ) #endif @@ -3041,7 +3041,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) : if( pImp->IsAccessible() ) pImp->FireAccessibleEvents(); -#ifndef PRODUCT +#ifdef DBG_UTIL #if OSL_DEBUG_LEVEL > 1 if ( bIndicator && pImp->GetShell()->GetWin() ) { diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index aff3c4e07e..977f458863 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -348,7 +348,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc ) } } -#ifndef PRODUCT +#ifdef DBG_UTIL sal_Bool SwLayoutCache::CompareLayout( const SwDoc& rDoc ) const { sal_Bool bRet = sal_True; diff --git a/sw/source/core/layout/layhelp.hxx b/sw/source/core/layout/layhelp.hxx index d488cfdbf4..0d8c5feaf1 100644 --- a/sw/source/core/layout/layhelp.hxx +++ b/sw/source/core/layout/layhelp.hxx @@ -34,7 +34,7 @@ #define _SVSTDARR_ULONGS #define _SVSTDARR_BYTES #define _SVSTDARR_XUB_STRLEN -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <swrect.hxx> diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx index ea3d8bfd91..99bb2a5763 100644 --- a/sw/source/core/layout/layouter.cxx +++ b/sw/source/core/layout/layouter.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -201,7 +201,7 @@ void SwLooping::Control( SwPageFrm* pPage ) } else if( ++nCount > LOOP_DETECT ) { -#ifndef PRODUCT +#ifdef DBG_UTIL #if OSL_DEBUG_LEVEL > 1 static BOOL bNoLouie = FALSE; if( bNoLouie ) diff --git a/sw/source/core/layout/makefile.mk b/sw/source/core/layout/makefile.mk index e2e8a2c282..234ee77c55 100644 --- a/sw/source/core/layout/makefile.mk +++ b/sw/source/core/layout/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -105,12 +105,10 @@ SLOFILES = \ $(SLO)$/virtoutp.obj \ $(SLO)$/wsfrm.obj -.IF "$(product)"=="" -.IF "$(cap)"=="" +.IF "$(dbgutil)"!="" SLOFILES += \ $(SLO)$/dbg_lay.obj .ENDIF -.ENDIF # --- Targets ------------------------------------------------------- diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index 8ccadcf1de..3abc28b7e2 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -311,7 +311,7 @@ void _FrmInit() { SwRootFrm::pVout = new SwLayVout(); SwCache *pNew = new SwCache( 100, 100 -#ifndef PRODUCT +#ifdef DBG_UTIL , "static SwBorderAttrs::pCache" #endif ); @@ -322,7 +322,7 @@ void _FrmInit() void _FrmFinit() { -#ifndef PRODUCT +#ifdef DBG_UTIL // im Chache duerfen nur noch 0-Pointer stehen for( USHORT n = SwFrm::GetCachePtr()->Count(); n; ) if( (*SwFrm::GetCachePtr())[ --n ] ) diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index cf45cba307..b7079fad50 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -34,7 +34,7 @@ #include <com/sun/star/embed/EmbedStates.hpp> #include <ndole.hxx> #include <docary.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <fmtfsize.hxx> #include <fmthdft.hxx> #include <fmtclds.hxx> @@ -1196,7 +1196,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, BOOL bNotifyFields ) if ( pPage->GetFmt() != pFmtWish ) pPage->SetFrmFmt( pFmtWish ); } -#ifndef PRODUCT +#ifdef DBG_UTIL else { ASSERT( FALSE, "CheckPageDescs, missing solution" ); @@ -1239,7 +1239,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, BOOL bNotifyFields ) pDoc->UpdatePageFlds( &aMsgHnt ); } -#ifndef PRODUCT +#ifdef DBG_UTIL //Ein paar Pruefungen muessen schon erlaubt sein. //1. Keine zwei EmptyPages hintereinander. @@ -1670,7 +1670,7 @@ void SwRootFrm::AssertPageFlys( SwPageFrm *pPage ) { //Umhaengen kann er sich selbst, indem wir ihm //einfach ein Modify mit seinem AnkerAttr schicken. -#ifdef PRODUCT +#ifndef DBG_UTIL rFmt.SwModify::Modify( 0, (SwFmtAnchor*)&rAnch ); #else const sal_uInt32 nCnt = pPage->GetSortedObjs()->Count(); diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 34b94415d5..06f3f34f60 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -41,7 +41,7 @@ #endif #include <tools/poly.hxx> #define _SVSTDARR_LONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <svx/xoutbmp.hxx> #include <sfx2/progress.hxx> #include <svx/brshitem.hxx> @@ -1366,7 +1366,7 @@ void MA_FASTCALL lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage, continue; -#ifndef PRODUCT +#ifdef DBG_UTIL //Flys, die innerhalb des eigenen verankert sind, muessen eine //groessere OrdNum haben oder Zeichengebunden sein. if ( pSelfFly && bLowerOfSelf ) @@ -2052,7 +2052,7 @@ void lcl_AdjustRectToPixelSize( SwRect& io_aSwRect, const OutputDevice &aOut ) io_aSwRect = SwRect( aSizedRect ); -#ifndef PRODUCT +#ifdef DBG_UTIL Rectangle aTestOrgPxRect = aOut.LogicToPixel( io_aSwRect.SVRect() ); Rectangle aTestNewPxRect = aOut.LogicToPixel( aSizedRect ); ASSERT( aTestOrgPxRect == aTestNewPxRect, diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 5dcb6040d7..e06b2751b3 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <hints.hxx> #include <txtftn.hxx> #include <fmtftn.hxx> @@ -1160,6 +1160,10 @@ void SwSectionFrm::SimpleFormat() SWRECTFN( this ) if( GetPrev() || GetUpper() ) { + // --> OD 2009-09-28 #b6882166# + // assure notifications on position changes. + const SwLayNotify aNotify( this ); + // <-- (this->*fnRect->fnMakePos)( GetUpper(), GetPrev(), FALSE ); bValidPos = TRUE; } @@ -2777,7 +2781,7 @@ void SwRootFrm::_RemoveFromList( SwSectionFrm* pSct ) pDestroy->Remove( nPos ); } -#ifndef PRODUCT +#ifdef DBG_UTIL BOOL SwRootFrm::IsInDelList( SwSectionFrm* pSct ) const { diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 736070142c..21b78c69eb 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -411,7 +411,7 @@ SwFrm::~SwFrm() delete pDrawObjs; } -#ifndef PRODUCT +#ifdef DBG_UTIL // JP 15.10.2001: for detection of access to deleted frames pDrawObjs = (SwSortedObjs*)0x33333333; #endif diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 0ba077e799..2041797e54 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -48,7 +48,7 @@ #include "dbg_lay.hxx" #include <ftnidx.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <docary.hxx> #include <svx/keepitem.hxx> #include <svx/ulspitem.hxx> @@ -3650,7 +3650,7 @@ SwCntntFrm *SwTabFrm::FindLastCntnt() // Spalten abklappern, dies erledigt SwSectionFrm::FindLastCntnt if( pRet->IsColBodyFrm() ) { -#ifndef PRODUCT +#ifdef DBG_UTIL SwSectionFrm* pSect = pRet->FindSctFrm(); ASSERT( pSect, "Wo kommt denn die Spalte her?") ASSERT( IsAnLower( pSect ), "Gespaltene Zelle?" ); @@ -4617,7 +4617,7 @@ void SwRowFrm::Format( const SwBorderAttrs *pAttrs ) { bValidSize = TRUE; -#ifndef PRODUCT +#ifdef DBG_UTIL if ( HasFixSize() ) { const SwFmtFrmSize &rFrmSize = GetFmt()->GetFrmSize(); diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 0e7256351a..ba43b3a096 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -1286,7 +1286,7 @@ const SwCntntFrm *SwLayoutFrm::GetCntntPos( Point& rPoint, break; } -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( pActual, "Keinen Cntnt gefunden." ); if ( bBodyOnly ) ASSERT( pActual->IsInDocBody(), "Cnt nicht im Body." ); diff --git a/sw/source/core/layout/unusedf.cxx b/sw/source/core/layout/unusedf.cxx index d501f6ea5d..994a4d9ce6 100644 --- a/sw/source/core/layout/unusedf.cxx +++ b/sw/source/core/layout/unusedf.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -67,7 +67,7 @@ BOOL SwFrm::GetCrsrOfst( SwPosition *, Point&, SwCrsrMoveState* ) const return FALSE; } -#ifndef PRODUCT +#ifdef DBG_UTIL void SwRootFrm::Cut() { diff --git a/sw/source/core/layout/virtoutp.cxx b/sw/source/core/layout/virtoutp.cxx index d7fef3a404..61877ab397 100644 --- a/sw/source/core/layout/virtoutp.cxx +++ b/sw/source/core/layout/virtoutp.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ // OD 12.11.2002 #96272# - include declaration for <SetMappingForVirtDev> #include "setmapvirtdev.hxx" -#ifndef PRODUCT +#ifdef DBG_UTIL /************************************************************************* * class DbgRect @@ -186,7 +186,7 @@ void SwLayVout::Enter( ViewShell *pShell, SwRect &rRect, BOOL bOn ) { Flush(); -#ifndef PRODUCT +#ifdef DBG_UTIL if( pShell->GetViewOptions()->IsTest3() ) { ++nCount; diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index d00d3e3459..73e8ea22bf 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,7 +38,7 @@ #ifndef _OUTDEV_HXX #include <vcl/outdev.hxx> #endif -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svx/brshitem.hxx> #include <svx/keepitem.hxx> #include <svx/brkitem.hxx> @@ -102,7 +102,7 @@ SwFrm::SwFrm( SwModify *pMod ) : pPrev( 0 ), pDrawObjs( 0 ) { -#ifndef PRODUCT +#ifdef DBG_UTIL bFlag01 = bFlag02 = bFlag03 = bFlag04 = bFlag05 = 0; #endif @@ -3866,7 +3866,7 @@ void lcl_InvalidateCntnt( SwCntntFrm *pCnt, BYTE nInv ) if( pLastSctCnt == pCnt ) pLastSctCnt = NULL; } -#ifndef PRODUCT +#ifdef DBG_UTIL else ASSERT( !pLastSctCnt, "Where's the last SctCntnt?" ); #endif @@ -3894,7 +3894,7 @@ void lcl_InvalidateCntnt( SwCntntFrm *pCnt, BYTE nInv ) pLastSctCnt = NULL; } } -#ifndef PRODUCT +#ifdef DBG_UTIL else ASSERT( !pLastTabCnt, "Where's the last TabCntnt?" ); #endif diff --git a/sw/source/core/makefile.mk b/sw/source/core/makefile.mk index d9ea1102e3..d87e67b218 100644 --- a/sw/source/core/makefile.mk +++ b/sw/source/core/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -73,7 +73,7 @@ SUBLIBS3= \ $(SLB)$/SwNumberTree.lib \ $(SLB)$/tablecore.lib -.IF "$(PRODUCT)" == "" +.IF "$(dbgutil)"!="" SUBLIBS3+= \ $(SLB)$/except.lib .ENDIF diff --git a/sw/source/core/sw3io/sw3convert.cxx b/sw/source/core/sw3io/sw3convert.cxx index a6bafcce75..35a72dc8e2 100644 --- a/sw/source/core/sw3io/sw3convert.cxx +++ b/sw/source/core/sw3io/sw3convert.cxx @@ -38,15 +38,15 @@ #include <stdio.h> #include "hintids.hxx" #include <tools/resid.hxx> -#include <svtools/macitem.hxx> -#include <svtools/zforlist.hxx> -#include <svtools/zformat.hxx> -#include <svtools/urihelper.hxx> +#include <svl/macitem.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> +#include <svl/urihelper.hxx> #include <sfx2/linkmgr.hxx> #ifndef _SVSTDARR_USHORTS_DECL #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <svx/lrspitem.hxx> #include <svx/tstpitem.hxx> diff --git a/sw/source/core/swg/SwXMLSectionList.cxx b/sw/source/core/swg/SwXMLSectionList.cxx index ab1e097102..07a1781116 100644 --- a/sw/source/core/swg/SwXMLSectionList.cxx +++ b/sw/source/core/swg/SwXMLSectionList.cxx @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" #define _SVSTDARR_STRINGSDTOR #define _SVSTDARR_STRINGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <SwXMLSectionList.hxx> #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 0c329ee5b3..8fff214edd 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include <svtools/unoevent.hxx> #include <sfx2/docfile.hxx> #include <unotools/streamwrap.hxx> diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx index 9dae3794ba..f9f8f07f1c 100644 --- a/sw/source/core/swg/swblocks.cxx +++ b/sw/source/core/swg/swblocks.cxx @@ -36,9 +36,9 @@ #include <sot/storage.hxx> #include <tools/urlobj.hxx> #ifndef SVTOOLS_FSTATHELPER_HXX -#include <svtools/fstathelper.hxx> +#include <svl/fstathelper.hxx> #endif -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include <unotools/charclass.hxx> #include <frmfmt.hxx> #include <doc.hxx> diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 587914ae0b..cf1d6a8ed2 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -50,7 +50,7 @@ #include <svx/protitem.hxx> #include <swtblfmt.hxx> -#ifdef PRODUCT +#ifndef DBG_UTIL #define CHECK_TABLE(t) #else #ifdef DEBUG @@ -779,7 +779,7 @@ BOOL SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, aFndBox.MakeFrms( *this ); // aFndBox.RestoreChartData( *this ); -#ifndef PRODUCT +#ifdef DBG_UTIL { const SwTableBoxes &rTabBoxes = aLines[0]->GetTabBoxes(); long nNewWidth = 0; @@ -2147,7 +2147,7 @@ void SwTable::CleanUpBottomRowSpan( USHORT nDelLines ) } } -#ifndef PRODUCT +#ifdef DBG_UTIL struct RowSpanCheck { @@ -2181,7 +2181,7 @@ void SwTable::CheckConsistency() const if( nRowSp < 0 ) { ASSERT( aIter != aRowSpanCells.end(), "Missing master box" ) -#ifndef PRODUCT +#ifdef DBG_UTIL //RowSpanCheck &rCheck = *aIter; #endif ASSERT( aIter->nLeft == nWidth && aIter->nRight == nNewWidth, diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index caffe6edbf..df3fdf29f9 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -74,7 +74,7 @@ #include <redline.hxx> #include <list> -#ifdef PRODUCT +#ifndef DBG_UTIL #define CHECK_TABLE(t) #else #ifdef DEBUG @@ -876,7 +876,7 @@ void lcl_ProcessBoxSet( SwTableBox *pBox, Parm &rParm ) // Last line check: if ( pBox->GetUpper()->GetUpper() && pBox->GetUpper() != pBox->GetUpper()->GetUpper()->GetTabLines() - [pBox->GetUpper()->GetUpper()->GetTabLines().Count()-1]) + [pBox->GetUpper()->GetUpper()->GetTabLines().Count()-1]) { pBox = 0; } @@ -1090,7 +1090,7 @@ void SwTable::SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld, } } -#ifndef PRODUCT +#ifdef DBG_UTIL { // steht im tblrwcl.cxx extern void _CheckBoxWidth( const SwTableLine&, SwTwips ); @@ -1197,7 +1197,7 @@ static void lcl_CalcNewWidths( std::list<USHORT> &rSpanPos, ChangeList& rChanges USHORT nPos = (USHORT)nSum; while( pCurr != rChanges.end() && pCurr->first < nPos ) { -#ifndef PRODUCT +#ifdef DBG_UTIL USHORT nTemp = pCurr->first; nTemp = pCurr->second; #endif @@ -1297,7 +1297,7 @@ static void lcl_CalcNewWidths( std::list<USHORT> &rSpanPos, ChangeList& rChanges void SwTable::NewSetTabCols( Parm &rParm, const SwTabCols &rNew, const SwTabCols &rOld, const SwTableBox *pStart, BOOL bCurRowOnly ) { -#ifndef PRODUCT +#ifdef DBG_UTIL static int nCallCount = 0; ++nCallCount; #endif @@ -2013,7 +2013,7 @@ BOOL SwTableBox::IsInHeadline( const SwTable* pTbl ) const return pTbl->GetTabLines()[ 0 ] == pLine; } -#ifndef PRODUCT +#ifdef DBG_UTIL ULONG SwTableBox::GetSttIdx() const { diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index d6241c775f..a9715cc9ff 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -46,7 +46,7 @@ #include <svx/langitem.hxx> #include <svx/scripttypeitem.hxx> #include <tools/urlobj.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include <swatrset.hxx> #include <frmatr.hxx> #include <paratr.hxx> @@ -106,7 +106,7 @@ FrmTagIdMap SwEnhancedPDFExportHelper::aFrmTagIdMap; LanguageType SwEnhancedPDFExportHelper::eLanguageDefault = 0; -#ifndef PRODUCT +#ifdef DBG_UTIL static std::vector< USHORT > aStructStack; @@ -295,7 +295,7 @@ SwTaggedPDFHelper::SwTaggedPDFHelper( const Num_Info* pNumInfo, if ( mpPDFExtOutDevData && mpPDFExtOutDevData->GetIsExportTaggedPDF() ) { -#ifndef PRODUCT +#ifdef DBG_UTIL sal_Int32 nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement(); lcl_DBGCheckStack(); #endif @@ -308,7 +308,7 @@ SwTaggedPDFHelper::SwTaggedPDFHelper( const Num_Info* pNumInfo, else BeginTag( vcl::PDFWriter::NonStructElement, aEmptyString ); -#ifndef PRODUCT +#ifdef DBG_UTIL nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement(); lcl_DBGCheckStack(); #endif @@ -323,13 +323,13 @@ SwTaggedPDFHelper::~SwTaggedPDFHelper() { if ( mpPDFExtOutDevData && mpPDFExtOutDevData->GetIsExportTaggedPDF() ) { -#ifndef PRODUCT +#ifdef DBG_UTIL sal_Int32 nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement(); lcl_DBGCheckStack(); #endif EndStructureElements(); -#ifndef PRODUCT +#ifdef DBG_UTIL nCurrentStruct = mpPDFExtOutDevData->GetCurrentStructureElement(); lcl_DBGCheckStack(); #endif @@ -398,7 +398,7 @@ bool SwTaggedPDFHelper::CheckReopenTag() const bool bSuccess = mpPDFExtOutDevData->SetCurrentStructureElement( nReopenTag ); ASSERT( bSuccess, "Failed to reopen tag" ) -#ifndef PRODUCT +#ifdef DBG_UTIL aStructStack.push_back( 99 ); #endif @@ -421,7 +421,7 @@ bool SwTaggedPDFHelper::CheckRestoreTag() const (void)bSuccess; ASSERT( bSuccess, "Failed to restore reopened tag" ) -#ifndef PRODUCT +#ifdef DBG_UTIL aStructStack.pop_back(); #endif @@ -441,7 +441,7 @@ void SwTaggedPDFHelper::BeginTag( vcl::PDFWriter::StructElement eType, const Str const sal_Int32 nId = mpPDFExtOutDevData->BeginStructureElement( eType, rtl::OUString( rString ) ); ++nEndStructureElement; -#ifndef PRODUCT +#ifdef DBG_UTIL aStructStack.push_back( static_cast<USHORT>(eType) ); #endif @@ -501,7 +501,7 @@ void SwTaggedPDFHelper::EndTag() { mpPDFExtOutDevData->EndStructureElement(); -#ifndef PRODUCT +#ifdef DBG_UTIL aStructStack.pop_back(); #endif } @@ -977,7 +977,7 @@ void SwTaggedPDFHelper::BeginNumberedListStructureElements() nRestoreCurrentTag = mpPDFExtOutDevData->GetCurrentStructureElement(); mpPDFExtOutDevData->SetCurrentStructureElement( nReopenTag ); -#ifndef PRODUCT +#ifdef DBG_UTIL aStructStack.push_back( 99 ); #endif } @@ -1529,7 +1529,7 @@ SwEnhancedPDFExportHelper::SwEnhancedPDFExportHelper( SwEditShell& rSh, aNumListBodyIdMap.clear(); aFrmTagIdMap.clear(); -#ifndef PRODUCT +#ifdef DBG_UTIL aStructStack.clear(); #endif diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index 4ac576d66a..23e2a0e8e2 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -34,7 +34,7 @@ #include <errhdl.hxx> // ASSERT #include <atrhndl.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <vcl/outdev.hxx> #include <svx/cmapitem.hxx> #include <svx/colritem.hxx> @@ -523,13 +523,11 @@ void SwAttrHandler::PushAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) sal_Bool SwAttrHandler::Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem ) { - ASSERT( rItem.Which() < RES_TXTATR_WITHEND_END || - RES_UNKNOWNATR_CONTAINER == rItem.Which() , + ASSERT( rItem.Which() < RES_TXTATR_WITHEND_END, "I do not want this attribute, nWhich >= RES_TXTATR_WITHEND_END" ); // robust - if ( RES_TXTATR_WITHEND_END <= rItem.Which() || - RES_UNKNOWNATR_CONTAINER == rItem.Which() ) + if ( RES_TXTATR_WITHEND_END <= rItem.Which() ) return sal_False; USHORT nStack = StackPos[ rItem.Which() ]; @@ -557,6 +555,9 @@ sal_Bool SwAttrHandler::Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem ) void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) { + if ( RES_TXTATR_WITHEND_END <= rAttr.Which() ) + return; // robust + // these special attributes in fact represent a collection of attributes // they have to be removed from each stack they belong to if ( RES_TXTATR_INETFMT == rAttr.Which() || @@ -583,7 +584,7 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) } // this is the usual case, we have a basic attribute, remove it from the // stack and reset the font - else if ( RES_UNKNOWNATR_CONTAINER != rAttr.Which() ) + else { aAttrStack[ StackPos[ rAttr.Which() ] ].Remove( rAttr ); // reset font according to attribute on top of stack @@ -600,13 +601,13 @@ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt ) void SwAttrHandler::Pop( const SwTxtAttr& rAttr ) { - ASSERT( rAttr.Which() < RES_TXTATR_WITHEND_END || - RES_UNKNOWNATR_CONTAINER == rAttr.Which() , + ASSERT( rAttr.Which() < RES_TXTATR_WITHEND_END, "I do not have this attribute, nWhich >= RES_TXTATR_WITHEND_END" ); - if ( RES_UNKNOWNATR_CONTAINER != rAttr.Which() && - rAttr.Which() < RES_TXTATR_WITHEND_END ) + if ( rAttr.Which() < RES_TXTATR_WITHEND_END ) + { aAttrStack[ StackPos[ rAttr.Which() ] ].Remove( rAttr ); + } } /************************************************************************* diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 2fb972d2be..33abb7b176 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -887,7 +887,7 @@ sal_Bool SwTxtFrm::_UnitUp( SwPaM *pPam, const SwTwips nOffset, aCharBox.Pos().X() = aCharBox.Pos().X() - 150; // siehe Kommentar in SwTxtFrm::GetCrsrOfst() -#ifndef PRODUCT +#ifdef DBG_UTIL const ULONG nOldNode = pPam->GetPoint()->nNode.GetIndex(); #endif // Der Node soll nicht gewechselt werden @@ -1253,7 +1253,7 @@ sal_Bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset, if( pNextLine || bFirstOfDouble ) { aCharBox.SSize().Width() /= 2; -#ifndef PRODUCT +#ifdef DBG_UTIL // siehe Kommentar in SwTxtFrm::GetCrsrOfst() const ULONG nOldNode = pPam->GetPoint()->nNode.GetIndex(); #endif diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 55ddcdadd9..d396a7e247 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -248,7 +248,7 @@ sal_Bool SwTxtFrm::CalcFollow( const xub_StrLen nTxtOfst ) ( pMyFollow->IsVertical() && !pMyFollow->Prt().Width() ) || ( ! pMyFollow->IsVertical() && !pMyFollow->Prt().Height() ) ) { -#ifndef PRODUCT +#ifdef DBG_UTIL const SwFrm *pOldUp = GetUpper(); #endif @@ -377,7 +377,7 @@ sal_Bool SwTxtFrm::CalcFollow( const xub_StrLen nTxtOfst ) pPage->ValidateCntnt(); } -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( pOldUp == GetUpper(), "SwTxtFrm::CalcFollow: heavy follow" ); #endif @@ -667,7 +667,7 @@ SwCntntFrm *SwTxtFrm::JoinFrm() } } -#ifndef PRODUCT +#ifdef DBG_UTIL else if ( pFoll->GetValidPrtAreaFlag() || pFoll->GetValidSizeFlag() ) { @@ -767,7 +767,7 @@ SwCntntFrm *SwTxtFrm::SplitFrm( const xub_StrLen nTxtPos ) } } -#ifndef PRODUCT +#ifdef DBG_UTIL else { CalcFtnFlag( nTxtPos-1 ); @@ -1843,7 +1843,7 @@ void SwTxtFrm::Format( const SwBorderAttrs * ) const SwFrm *pDbgFtnCont = (const SwFrm*)(FindPageFrm()->FindFtnCont()); (void)pDbgFtnCont; -#ifndef PRODUCT +#ifdef DBG_UTIL // nStopAt laesst sich vom CV bearbeiten. static MSHORT nStopAt = 0; if( nStopAt == GetFrmId() ) @@ -2089,7 +2089,7 @@ sal_Bool SwTxtFrm::FormatQuick( bool bForceQuickFormat ) const XubString aXXX = GetTxtNode()->GetTxt(); const SwTwips nDbgY = Frm().Top(); (void)nDbgY; -#ifndef PRODUCT +#ifdef DBG_UTIL // nStopAt laesst sich vom CV bearbeiten. static MSHORT nStopAt = 0; if( nStopAt == GetFrmId() ) @@ -2135,7 +2135,7 @@ sal_Bool SwTxtFrm::FormatQuick( bool bForceQuickFormat ) //DBG_LOOP; shadows declaration above. //resolved into: #if OSL_DEBUG_LEVEL > 1 -#ifndef PRODUCT +#ifdef DBG_UTIL DbgLoop aDbgLoop2( (const void*) this ); #endif #endif diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index d1f2416958..f796f0f957 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -728,7 +728,7 @@ void SwTxtFrm::Paint( const SwRect &rRect ) const //DBG_LOOP; shadows declaration above. //resolved into: #if OSL_DEBUG_LEVEL > 1 -#ifndef PRODUCT +#ifdef DBG_UTIL DbgLoop aDbgLoop2( (const void*) this ); #endif #endif diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index 049ea79078..b1c2eaefb5 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -176,7 +176,7 @@ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf, { nCutPos = rInf.GetTxtBreak( nLineWidth, nMaxLen, nMaxComp ); -#ifndef PRODUCT +#ifdef DBG_UTIL if ( STRING_LEN != nCutPos ) { rInf.GetTxtSize( &rSI, rInf.GetIdx(), nCutPos - rInf.GetIdx(), diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index b27a551ff7..f374020964 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -33,8 +33,8 @@ #include <com/sun/star/uno/Sequence.h> -#include <svtools/linguprops.hxx> -#include <svtools/lingucfg.hxx> +#include <unotools/linguprops.hxx> +#include <unotools/lingucfg.hxx> #include <hintids.hxx> #include <sfx2/printer.hxx> #include <svx/hyznitem.hxx> @@ -114,13 +114,13 @@ namespace numfunc } // <-- -#ifndef PRODUCT +#ifdef DBG_UTIL // Test2: WYSIWYG++ // Test4: WYSIWYG debug static sal_Bool bDbgLow = sal_False; #endif -#ifndef PRODUCT +#ifdef DBG_UTIL sal_Bool SwTxtSizeInfo::IsOptCalm() const { return !GetOpt().IsTest3(); } @@ -236,7 +236,7 @@ SwTxtInfo::SwTxtInfo( const SwTxtInfo &rInf ) { } -#ifndef PRODUCT +#ifdef DBG_UTIL /************************************************************************* * ChkOutDev() *************************************************************************/ @@ -288,7 +288,7 @@ SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew ) bSnapToGrid( rNew.SnapToGrid() ), nDirection( rNew.GetDirection() ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ChkOutDev( *this ); #endif } @@ -325,7 +325,7 @@ void SwTxtSizeInfo::CtorInitTxtSizeInfo( SwTxtFrm *pFrame, SwFont *pNewFnt, pRef = pOut; } -#ifndef PRODUCT +#ifdef DBG_UTIL ChkOutDev( *this ); #endif @@ -412,7 +412,7 @@ SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew, const XubString &rTxt, bSnapToGrid( rNew.SnapToGrid() ), nDirection( rNew.GetDirection() ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ChkOutDev( *this ); #endif SetLen( GetMinLen( *this ) ); @@ -570,7 +570,7 @@ void SwTxtPaintInfo::CtorInitTxtPaintInfo( SwTxtFrm *pFrame, const SwRect &rPain pGrammarCheckList = NULL; pSmartTags = NULL; // SMARTTAGS -#ifdef PRODUCT +#ifndef DBG_UTIL pBrushItem = 0; #else pBrushItem = ((SvxBrushItem*)-1); @@ -1156,7 +1156,7 @@ void SwTxtPaintInfo::DrawCheckBox( const SwFieldFormPortion &rPor, bool checked) } const int delta=10; Rectangle r(aIntersect.Left()+delta, aIntersect.Top()+delta, aIntersect.Right()-delta, aIntersect.Bottom()-delta); - pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); + pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); pOut->SetLineColor( Color(0, 0, 0)); pOut->SetFillColor(); pOut->DrawRect( r ); diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index 450bb16947..c03a94d090 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -79,7 +79,7 @@ class SwWrongList; #define DIR_RIGHT2LEFT 2 #define DIR_TOP2BOTTOM 3 -#ifndef PRODUCT +#ifdef DBG_UTIL #define OPTCALM( rInf ) (rInf).IsOptCalm() #define OPTLOW( rInf ) (rInf).IsOptLow() #define OPTDBG( rInf ) (rInf).IsOptDbg() @@ -380,7 +380,7 @@ public: { return ( pKanaComp && nKanaIdx < pKanaComp->Count() ) ? (*pKanaComp)[nKanaIdx] : 0; } -#ifndef PRODUCT +#ifdef DBG_UTIL sal_Bool IsOptCalm() const; sal_Bool IsOptLow() const; sal_Bool IsOptDbg() const; @@ -415,7 +415,7 @@ class SwTxtPaintInfo : public SwTxtSizeInfo void _DrawText( const XubString &rText, const SwLinePortion &rPor, const xub_StrLen nIdx, const xub_StrLen nLen, const sal_Bool bKern, const sal_Bool bWrong = sal_False, - const sal_Bool bSmartTag = sal_False, + const sal_Bool bSmartTag = sal_False, const sal_Bool bGrammarCheck = sal_False ); // SMARTTAGS SwTxtPaintInfo &operator=(const SwTxtPaintInfo&); @@ -423,7 +423,7 @@ class SwTxtPaintInfo : public SwTxtSizeInfo void _DrawBackBrush( const SwLinePortion &rPor ) const; protected: -#ifdef PRODUCT +#ifndef DBG_UTIL SwTxtPaintInfo() { pFrm = 0; pWrongList = 0; pGrammarCheckList = 0; pWrongList = 0; pSmartTags = 0; pSpaceAdd = 0; pBrushItem = 0;} #else SwTxtPaintInfo() { pFrm = 0; pWrongList = 0; pGrammarCheckList = 0; pSmartTags = 0; pSpaceAdd = 0; @@ -508,7 +508,7 @@ public: inline void SetWrongList( const SwWrongList *pNew ){ pWrongList = pNew; } inline const SwWrongList* GetpWrongList() const { return pWrongList; } - + inline void SetGrammarCheckList( const SwWrongList *pNew ){ pGrammarCheckList = pNew; } inline const SwWrongList* GetGrammarCheckList() const { return pGrammarCheckList; } diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx index 2d7a670c85..80e877dccf 100644 --- a/sw/source/core/text/itratr.hxx +++ b/sw/source/core/text/itratr.hxx @@ -37,7 +37,7 @@ #define _SVSTDARR_XUB_STRLEN #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> class OutputDevice; class SwFont; diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 7fbb6bae55..b40398463f 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -158,7 +158,7 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) const SwTxtNode *pNode = pFrm->GetTxtNode(); const SvxLRSpaceItem &rSpace = pFrm->GetTxtNode()->GetSwAttrSet().GetLRSpace(); - // --> OD 2009-09-02 #i95907# + // --> OD 2009-09-08 #i95907#, #b6879723# const bool bListLevelIndentsApplicable = pFrm->GetTxtNode()->AreListLevelIndentsApplicable(); // <-- @@ -183,7 +183,7 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) pFrm->Prt().Left() + nLMWithNum - pNode->GetLeftMarginWithNum( sal_False ) - - // --> OD 2009-09-02 #i95907# + // --> OD 2009-09-08 #i95907#, #b6879723# // rSpace.GetLeft() + // rSpace.GetTxtLeft(); ( bListLevelIndentsApplicable @@ -193,14 +193,18 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) } else { - if ( !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) + // --> OD 2009-09-08 #i95907#, #b6879723# +// if ( !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) + if ( bListLevelIndentsApplicable || + !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) + // <-- { // this calculation is identical this the calculation for R2L layout - see above nLeft = pFrm->Frm().Left() + pFrm->Prt().Left() + nLMWithNum - pNode->GetLeftMarginWithNum( sal_False ) - - // --> OD 2009-09-02 #i95907# + // --> OD 2009-09-08 #i95907#, #b6879723# // rSpace.GetLeft() + // rSpace.GetTxtLeft(); ( bListLevelIndentsApplicable @@ -223,7 +227,7 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) // paras inside cells inside new documents: ( pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) || !pFrm->IsInTab() || - !nLMWithNum) ) + !nLMWithNum ) ) // <-- { nLeft = pFrm->Prt().Left() + pFrm->Frm().Left(); @@ -235,8 +239,8 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) nFirst = nLeft; else { - short nFLOfst; - long nFirstLineOfs; + short nFLOfst = 0; + long nFirstLineOfs = 0; if( !pNode->GetFirstLineOfsWithNum( nFLOfst ) && rSpace.IsAutoFirst() ) { @@ -290,8 +294,13 @@ void SwTxtMargin::CtorInitTxtMargin( SwTxtFrm *pNewFrm, SwTxtSizeInfo *pNewInf ) else nFirstLineOfs = nFLOfst; + // --> OD 2009-09-08 #i95907#, #b6879723# +// if ( pFrm->IsRightToLeft() || +// !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) if ( pFrm->IsRightToLeft() || - !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) + bListLevelIndentsApplicable || + !pNode->getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING) ) + // <-- { nFirst = nLeft + nFirstLineOfs; } diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 57dacd703a..3899c94656 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -66,7 +66,7 @@ #include <doc.hxx> // SwDoc #include <pormulti.hxx> // SwMultiPortion #define _SVSTDARR_LONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <unotools/charclass.hxx> #if OSL_DEBUG_LEVEL > 1 diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index 550b8fb291..3bed270774 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -103,7 +103,7 @@ void SwTxtPainter::CtorInitTxtPainter( SwTxtFrm *pNewFrm, SwTxtPaintInfo *pNewIn pInf = pNewInf; SwFont *pMyFnt = GetFnt(); GetInfo().SetFont( pMyFnt ); -#ifndef PRODUCT +#ifdef DBG_UTIL if( ALIGN_BASELINE != pMyFnt->GetAlign() ) { ASSERT( ALIGN_BASELINE == pMyFnt->GetAlign(), diff --git a/sw/source/core/text/makefile.mk b/sw/source/core/text/makefile.mk index fbc000002e..d710c97979 100644 --- a/sw/source/core/text/makefile.mk +++ b/sw/source/core/text/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -50,13 +50,6 @@ CFLAGS+=-DENABLE_GRAPHITE .ENDIF # --- Files -------------------------------------------------------- -.IF "$(product)$(cap)" == "" -CXXFILES += \ - txtio.cxx -.ENDIF - - - SLOFILES = \ $(SLO)$/atrstck.obj \ $(SLO)$/EnhancedPDFExportHelper.obj \ @@ -100,7 +93,7 @@ SLOFILES = \ $(SLO)$/SwGrammarMarkUp.obj \ $(SLO)$/wrong.obj -.IF "$(product)$(cap)" == "" +.IF "$(dbgutil)"!="" SLOFILES += \ $(SLO)$/txtio.obj .ENDIF diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 8fcdbca8e7..913ca9e393 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -82,8 +82,13 @@ SwFldPortion *SwFldPortion::Clone( const XubString &rExpand ) const { SwFont *pNewFnt; if( 0 != ( pNewFnt = pFnt ) ) + { pNewFnt = new SwFont( *pFnt ); - SwFldPortion* pClone = new SwFldPortion( rExpand, pNewFnt ); + } + // --> OD 2009-11-25 #i107143# + // pass placeholder property to created <SwFldPortion> instance. + SwFldPortion* pClone = new SwFldPortion( rExpand, pNewFnt, bPlaceHolder ); + // <-- pClone->SetNextOffset( nNextOffset ); pClone->m_bNoLength = this->m_bNoLength; return pClone; diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx index 2292a27b78..5f52d45631 100644 --- a/sw/source/core/text/porfld.hxx +++ b/sw/source/core/text/porfld.hxx @@ -60,7 +60,7 @@ protected: sal_Bool bAnimated : 1; // wird von SwGrfNumPortion benutzt sal_Bool bNoPaint : 1; // wird von SwGrfNumPortion benutzt sal_Bool bReplace : 1; // wird von SwGrfNumPortion benutzt - sal_Bool bPlaceHolder : 1; + const sal_Bool bPlaceHolder : 1; sal_Bool m_bNoLength : 1; // HACK for meta suffix (no CH_TXTATR) inline void SetFont( SwFont *pNew ) { pFnt = pNew; } diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx index b5a1372893..f207c80ad8 100644 --- a/sw/source/core/text/porglue.cxx +++ b/sw/source/core/text/porglue.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -114,7 +114,7 @@ void SwGluePortion::Paint( const SwTxtPaintInfo &rInf ) const if( rInf.OnWin() && rInf.GetOpt().IsBlank() && rInf.IsNoSymbol() ) { -#ifndef PRODUCT +#ifdef DBG_UTIL const xub_Unicode cChar = rInf.GetChar( rInf.GetIdx() ); ASSERT( CH_BLANK == cChar || CH_BULLET == cChar, "SwGluePortion::Paint: blank expected" ); diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index b0e331db47..73ad538c74 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -195,7 +195,7 @@ sal_Bool lcl_ConnectToPrev( xub_Unicode cCh, xub_Unicode cPrevCh ) // to the left. So we look for the characters that are actually connectable // to the left. Here is the complete list of WH: - // (hennerdrewes): + // (hennerdrewes): // added lam forms 0x06B5..0x06B8 // added 0x6FA..0x6FC, according to unicode documentation, although not present in my fonts // added heh goal 0x6C1 @@ -210,7 +210,7 @@ sal_Bool lcl_ConnectToPrev( xub_Unicode cCh, xub_Unicode cPrevCh ) ( 0x6FA <= cPrevCh && cPrevCh <= 0x6FC ) ; // check for ligatures cPrevChar + cChar - if( bRet ) + if( bRet ) bRet = !lcl_IsLigature( cPrevCh, cCh ); return bRet; } @@ -1163,7 +1163,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) // after a Seen or Sad if (nPriorityLevel >= 1 && nIdx < nWordLen - 1) { - if( isSeenOrSadChar( cCh ) + if( isSeenOrSadChar( cCh ) && (rWord.GetChar( nIdx+1 ) != 0x200C) ) // #i98410#: prevent ZWNJ expansion { nKashidaPos = aScanner.GetBegin() + nIdx; @@ -1293,7 +1293,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) nLastKashida = nChg; }; -#ifndef PRODUCT +#ifdef DBG_UTIL // check kashida data long nTmpKashidaPos = -1; sal_Bool bWrongKash = sal_False; diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx index 4d757c7061..e2345e5ecf 100644 --- a/sw/source/core/text/porlay.hxx +++ b/sw/source/core/text/porlay.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -258,7 +258,7 @@ public: const SwLinePortion* _pDontConsiderPortion = NULL, const bool _bNoFlyCntPorAndLinePor = false ) const; -#ifndef PRODUCT +#ifdef DBG_UTIL void DebugPortions( SvStream &rOs, const XubString &rTxt, const xub_StrLen nStart ); //$ ostream #endif diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx index 1e866c8323..ba32938900 100644 --- a/sw/source/core/text/porlin.cxx +++ b/sw/source/core/text/porlin.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,7 +47,7 @@ #include "porglue.hxx" #include "inftxt.hxx" #include "blink.hxx" -#ifndef PRODUCT +#ifdef DBG_UTIL sal_Bool ChkChain( SwLinePortion *pStart ) { @@ -216,7 +216,7 @@ SwLinePortion *SwLinePortion::Insert( SwLinePortion *pIns ) { pIns->FindLastPortion()->SetPortion( pPortion ); SetPortion( pIns ); -#ifndef PRODUCT +#ifdef DBG_UTIL ChkChain( this ); #endif return pIns; @@ -247,7 +247,7 @@ SwLinePortion *SwLinePortion::Append( SwLinePortion *pIns ) SwLinePortion *pPos = FindLastPortion(); pPos->SetPortion( pIns ); pIns->SetPortion( 0 ); -#ifndef PRODUCT +#ifdef DBG_UTIL ChkChain( this ); #endif return pIns; @@ -307,7 +307,7 @@ SwPosSize SwLinePortion::GetTxtSize( const SwTxtSizeInfo & ) const return SwPosSize(); } -#ifndef PRODUCT +#ifdef DBG_UTIL /************************************************************************* * virtual SwLinePortion::Check() diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx index 9beb401c93..e21d07b9f4 100644 --- a/sw/source/core/text/porlin.hxx +++ b/sw/source/core/text/porlin.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ class SwPortionHandler; // Das CLASSIO-Makro implementiert die 'freischwebende' Funktion. // Auf diese Weise erhaelt man beide Vorteile: virtuelle Ausgabeoperatoren // und allgemeine Verwendbarkeit. -#ifndef PRODUCT +#ifdef DBG_UTIL #define OUTPUT_OPERATOR virtual SvStream &operator<<( SvStream & aOs ) const; #else #define OUTPUT_OPERATOR @@ -177,7 +177,7 @@ public: virtual void Paint( const SwTxtPaintInfo &rInf ) const = 0; void PrePaint( const SwTxtPaintInfo &rInf, const SwLinePortion *pLast ) const; -#ifndef PRODUCT +#ifdef DBG_UTIL virtual sal_Bool Check( SvStream &rOs, SwTxtSizeInfo &rInfo ); //$ ostream #endif diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 3a9a7a1072..2563b10615 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -33,7 +33,7 @@ #include "hintids.hxx" -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <tools/shl.hxx> #ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_ #include <com/sun/star/i18n/ScriptType.hdl> diff --git a/sw/source/core/text/redlnitr.hxx b/sw/source/core/text/redlnitr.hxx index 1a7316b61e..f172b4fa3e 100644 --- a/sw/source/core/text/redlnitr.hxx +++ b/sw/source/core/text/redlnitr.hxx @@ -39,7 +39,7 @@ #include "swfont.hxx" #ifndef _SVSTDARR_USHORTS #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif class SwTxtNode; diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index f263deb90c..38d5bb9fe1 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -98,7 +98,7 @@ #include <svx/svdoedge.hxx> -#ifndef PRODUCT +#ifdef DBG_UTIL #include "viewopt.hxx" // SwViewOptions, nur zum Testen (Test2) #endif #include "doc.hxx" @@ -1817,7 +1817,7 @@ const SwRect SwContourCache::ContourRect( const SwFmt* pFmt, delete pPolyPolygon; // UPPER_LOWER_TEST -#ifndef PRODUCT +#ifdef DBG_UTIL const SwRootFrm* pTmpRootFrm = pFmt->getIDocumentLayoutAccess()->GetRootFrm(); if( pTmpRootFrm->GetCurrShell() ) { @@ -1890,7 +1890,7 @@ const SwRect SwContourCache::ContourRect( const SwFmt* pFmt, * SwContourCache::ShowContour() * zeichnet die PolyPolygone des Caches zu Debugzwecken. *************************************************************************/ -#ifndef PRODUCT +#ifdef DBG_UTIL void SwContourCache::ShowContour( OutputDevice* pOut, const SdrObject* pObj, const Color& rClosedColor, const Color& rOpenColor ) @@ -1941,7 +1941,7 @@ void SwContourCache::ShowContour( OutputDevice* pOut, const SdrObject* pObj, * SwTxtFly::ShowContour() * zeichnet die PolyPolygone des Caches zu Debugzwecken. *************************************************************************/ -#ifndef PRODUCT +#ifdef DBG_UTIL void SwTxtFly::ShowContour( OutputDevice* pOut ) { diff --git a/sw/source/core/text/txtfly.hxx b/sw/source/core/text/txtfly.hxx index 6849cefb95..899d260902 100644 --- a/sw/source/core/text/txtfly.hxx +++ b/sw/source/core/text/txtfly.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _TXTFLY_HXX #define _TXTFLY_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include "swtypes.hxx" #include "swrect.hxx" @@ -102,7 +102,7 @@ public: const long nXPos, const sal_Bool bRight ); // <-- -#ifndef PRODUCT +#ifdef DBG_UTIL void ShowContour( OutputDevice* pOut, const SdrObject* pObj, const Color& rClosedColor, const Color& rOpenColor ); #endif @@ -235,7 +235,7 @@ public: } // <-- -#ifndef PRODUCT +#ifdef DBG_UTIL void ShowContour( OutputDevice* pOut ); #endif }; diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 8da2cbf4fb..0efd87ef72 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" #include <hintids.hxx> #include <hints.hxx> -#include <svtools/ctloptions.hxx> +#include <svl/ctloptions.hxx> #include <sfx2/printer.hxx> #include <sfx2/sfxuno.hxx> #include <svx/langitem.hxx> @@ -940,17 +940,6 @@ void SwTxtFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) InvalidateLineNum(); } break; - case RES_INS_CHR: - { - nPos = ((SwInsChr*)pNew)->nPos; - InvalidateRange( SwCharRange( nPos, 1 ), 1 ); - SET_WRONG( nPos, 1, true ) - SET_SCRIPT_INVAL( nPos ) - bSetFldsDirty = sal_True; - if( HasFollow() ) - lcl_ModifyOfst( this, nPos, 1 ); - } - break; case RES_INS_TXT: { nPos = ((SwInsTxt*)pNew)->nPos; diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 4b3befe53a..83ecf7a7ec 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -106,7 +106,7 @@ SwTxtFrm *SwTxtFrm::FindFtnRef( const SwTxtFtn *pFtn ) * CalcFtnFlag() *************************************************************************/ -#ifdef PRODUCT +#ifndef DBG_UTIL void SwTxtFrm::CalcFtnFlag() #else void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//Fuer den Test von SplitFrm @@ -120,7 +120,7 @@ void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//Fuer den Test von SplitFrm const USHORT nSize = pHints->Count(); -#ifdef PRODUCT +#ifndef DBG_UTIL const xub_StrLen nEnd = GetFollow() ? GetFollow()->GetOfst() : STRING_LEN; #else const xub_StrLen nEnd = nStop != STRING_LEN ? nStop @@ -364,7 +364,7 @@ SwTwips SwTxtFrm::_GetFtnFrmHeight() const SwTwips nTmp = (*fnRect->fnYDiff)( (pCont->*fnRect->fnGetPrtBottom)(), (Frm().*fnRect->fnGetTop)() ); -#ifndef PRODUCT +#ifdef DBG_UTIL if( nTmp < 0 ) { sal_Bool bInvalidPos = sal_False; diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx index 602cc4803d..722cae6b04 100644 --- a/sw/source/core/text/txthyph.cxx +++ b/sw/source/core/text/txthyph.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,7 +47,7 @@ #include <guess.hxx> // #include <splargs.hxx> // SwInterHyphInfo -#ifndef PRODUCT +#ifdef DBG_UTIL extern const sal_Char *GetLangName( const MSHORT nLang ); #endif diff --git a/sw/source/core/text/txtinit.cxx b/sw/source/core/text/txtinit.cxx index 4730568fbb..f7f6091377 100644 --- a/sw/source/core/text/txtinit.cxx +++ b/sw/source/core/text/txtinit.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -79,7 +79,7 @@ void _TextInit() pFntCache = new SwFntCache; // Cache for SwSubFont -> SwFntObj = { Font aFont, Font* pScrFont, Font* pPrtFont, OutputDevice* pPrinter, ... } pSwFontCache = new SwFontCache; // Cache for SwTxtFmtColl -> SwFontObj = { SwFont aSwFont, SfxPoolItem* pDefaultArray } SwCache *pTxtCache = new SwCache( 250, 100 // Cache for SwTxtFrm -> SwTxtLine = { SwParaPortion* pLine } -#ifndef PRODUCT +#ifdef DBG_UTIL , "static SwTxtFrm::pTxtCache" #endif ); diff --git a/sw/source/core/text/txtio.cxx b/sw/source/core/text/txtio.cxx index 0d461f4311..890c67ab4f 100644 --- a/sw/source/core/text/txtio.cxx +++ b/sw/source/core/text/txtio.cxx @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" -#ifdef PRODUCT +#ifndef DBG_UTIL #error Wer fummelt denn an den makefiles? #endif diff --git a/sw/source/core/text/txtpaint.cxx b/sw/source/core/text/txtpaint.cxx index 0c0ed86b4f..2b3cabec23 100644 --- a/sw/source/core/text/txtpaint.cxx +++ b/sw/source/core/text/txtpaint.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -122,7 +122,7 @@ void SwSaveClip::_ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm, #endif } #if OSL_DEBUG_LEVEL > 1 -#ifndef PRODUCT +#ifdef DBG_UTIL static sal_Bool bDbg = sal_False; if( bDbg ) { diff --git a/sw/source/core/text/txtpaint.hxx b/sw/source/core/text/txtpaint.hxx index 81b92bfabd..e997858351 100644 --- a/sw/source/core/text/txtpaint.hxx +++ b/sw/source/core/text/txtpaint.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -71,7 +71,7 @@ inline SwSaveClip::~SwSaveClip() Reset(); } -#ifndef PRODUCT +#ifdef DBG_UTIL /************************************************************************* * class SwDbgOut diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index b299cae970..ed4f7059a0 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -328,7 +328,7 @@ SwTabPortion::SwTabPortion( const KSHORT nTabPosition, const xub_Unicode cFillCh : SwFixPortion( 0, 0 ), nTabPos(nTabPosition), cFill(cFillChar) { nLineLength = 1; -#ifndef PRODUCT +#ifdef DBG_UTIL if( IsFilled() ) { ASSERT( ' ' != cFill, "SwTabPortion::CTOR: blanks ?!" ); @@ -563,7 +563,7 @@ sal_Bool SwTabPortion::PostFormat( SwTxtFormatInfo &rInf ) void SwTabPortion::Paint( const SwTxtPaintInfo &rInf ) const { -#ifndef PRODUCT +#ifdef DBG_UTIL // Wir wollen uns die Fixbreite anzeigen if( rInf.OnWin() && OPTDBG( rInf ) && !rInf.GetOpt().IsPagePreview() && \ diff --git a/sw/source/core/tox/toxhlp.cxx b/sw/source/core/tox/toxhlp.cxx index eab3d53c7b..69aefa9f66 100644 --- a/sw/source/core/tox/toxhlp.cxx +++ b/sw/source/core/tox/toxhlp.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -62,12 +62,12 @@ IndexEntrySupplierWrapper::IndexEntrySupplierWrapper() } } catch ( UNO_NMSPC::Exception& -#ifndef PRODUCT +#ifdef DBG_UTIL e #endif ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "IndexEntrySupplierWrapper: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -88,12 +88,12 @@ String IndexEntrySupplierWrapper::GetIndexKey( const String& rTxt, sRet = xIES->getIndexKey( rTxt, rTxtReading, rLocale ); } catch ( UNO_NMSPC::Exception& -#ifndef PRODUCT +#ifdef DBG_UTIL e #endif ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getIndexKey: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -109,12 +109,12 @@ String IndexEntrySupplierWrapper::GetFollowingText( BOOL bMorePages ) const sRet = xIES->getIndexFollowPageWord( bMorePages, aLcl ); } catch ( UNO_NMSPC::Exception& -#ifndef PRODUCT +#ifdef DBG_UTIL e #endif ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getIndexFollowPageWord: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -132,12 +132,12 @@ IndexEntrySupplierWrapper::GetAlgorithmList( const STAR_NMSPC::lang::Locale& rLc sRet = xIES->getAlgorithmList( rLcl ); } catch ( UNO_NMSPC::Exception& -#ifndef PRODUCT +#ifdef DBG_UTIL e #endif ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getAlgorithmList: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -155,12 +155,12 @@ sal_Bool IndexEntrySupplierWrapper::LoadAlgorithm( bRet = xIES->loadAlgorithm( rLcl, sSortAlgorithm, nOptions ); } catch ( UNO_NMSPC::Exception& -#ifndef PRODUCT +#ifdef DBG_UTIL e #endif ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "loadAlgorithm: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -181,12 +181,12 @@ sal_Int16 IndexEntrySupplierWrapper::CompareIndexEntry( rTxt2, rTxtReading2, rLocale2 ); } catch ( UNO_NMSPC::Exception& -#ifndef PRODUCT +#ifdef DBG_UTIL e #endif ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "compareIndexEntry: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 5a128fbf8a..63e551e8c8 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -191,7 +191,7 @@ SwTOXSortTabBase::SwTOXSortTabBase( TOXSortType nTyp, const SwCntntNode* pNd, { SwPosition aPos( *pNd ); const SwDoc& rDoc = *pNd->GetDoc(); -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht der Absatz" ); #else diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 5248100afd..4ddfae6a0b 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -46,7 +46,7 @@ #include "hints.hxx" #include <IDocumentFieldsAccess.hxx> -#include <svtools/smplhint.hxx> +#include <svl/smplhint.hxx> TYPEINIT3( SwFmtFld, SfxPoolItem, SwClient,SfxBroadcaster) TYPEINIT1(SwFmtFldHint, SfxHint); diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 73640e2ba6..8beccc1cfa 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -35,7 +35,7 @@ #define _SVSTDARR_USHORTS #define _SVSTDARR_USHORTSSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <doc.hxx> #include <cntfrm.hxx> // ASSERT in ~SwTxtFtn() #include <pagefrm.hxx> // RemoveFtn() diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index 3d0a043920..99e0810da5 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -35,9 +35,9 @@ #include "unomid.h" #include <basic/sbxvar.hxx> -#include <svtools/macitem.hxx> -#include <svtools/stritem.hxx> -#include <svtools/stylepool.hxx> +#include <svl/macitem.hxx> +#include <svl/stritem.hxx> +#include <svl/stylepool.hxx> #include <fmtautofmt.hxx> #include <fchrfmt.hxx> #include <fmtinfmt.hxx> @@ -59,7 +59,7 @@ #include <unometa.hxx> #include <unoobj.hxx> // SwXTextRange #include <docsh.hxx> -#include <svtools/zforlist.hxx> // GetNumberFormat +#include <svl/zforlist.hxx> // GetNumberFormat #include <boost/bind.hpp> #include <algorithm> diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 6f83edd429..2b30826062 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -386,7 +386,9 @@ USHORT SwFntObj::GetFontHeight( const ViewShell* pSh, const OutputDevice& rOut ) const FontMetric aOutMet( rRefDev.GetFontMetric() ); long nTmpPrtHeight = (USHORT)aOutMet.GetAscent() + aOutMet.GetDescent(); (void) nTmpPrtHeight; - ASSERT( nTmpPrtHeight == nPrtHeight, "GetTextHeight != Ascent + Descent" ) + // #i106098#: do not compare with == here due to rounding error + ASSERT( abs(nTmpPrtHeight - nPrtHeight) < 3, + "GetTextHeight != Ascent + Descent" ); #endif ((OutputDevice&)rRefDev).SetFont( aOldFnt ); @@ -1042,7 +1044,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) // a window. Therefore bUseSrcFont is always 0 in this case. // -#ifndef PRODUCT +#ifdef DBG_UTIL const BOOL bNoAdjust = bPrt || ( pWin && diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx index 9f32dd7975..0ad7ca6278 100644 --- a/sw/source/core/txtnode/fntcap.cxx +++ b/sw/source/core/txtnode/fntcap.cxx @@ -707,7 +707,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) if( nPos == STRING_LEN || nPos > nMaxPos ) nPos = nMaxPos; ASSERT( nPos, "nextCharBlock not implemented?" ); -#ifndef PRODUCT +#ifdef DBG_UTIL if( !nPos ) nPos = nMaxPos; #endif @@ -821,7 +821,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo ) if( nPos == STRING_LEN || nPos > nMaxPos ) nPos = nMaxPos; ASSERT( nPos, "endOfCharBlock not implemented?" ); -#ifndef PRODUCT +#ifdef DBG_UTIL if( !nPos ) nPos = nMaxPos; #endif diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx index 1cb509fd3e..79c66ba8b7 100644 --- a/sw/source/core/txtnode/ndhints.cxx +++ b/sw/source/core/txtnode/ndhints.cxx @@ -1,6 +1,8 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * * * Copyright 2008 by Sun Microsystems, Inc. * @@ -50,7 +52,7 @@ _SV_IMPL_SORTAR_ALG( SwpHtEnd, SwTxtAttr* ) void DumpHints( const SwpHtStart &rHtStart, const SwpHtEnd &rHtEnd ) { -#ifndef PRODUCT +#ifdef DBG_UTIL aDbstream << "DumpHints:" << endl; (aDbstream << "\tStarts:" ).WriteNumber(rHtStart.Count()) << endl; for( USHORT i = 0; i < rHtStart.Count(); ++i ) @@ -247,7 +249,7 @@ BOOL SwpHtEnd::Seek_Entry( const SwTxtAttr *pElement, USHORT *pPos ) const void SwpHintsArray::Insert( const SwTxtAttr *pHt ) { Resort(); -#ifndef PRODUCT +#ifdef DBG_UTIL USHORT nPos; ASSERT(!m_HintStarts.Seek_Entry( pHt, &nPos ), "Insert: hint already in HtStart"); @@ -256,7 +258,7 @@ void SwpHintsArray::Insert( const SwTxtAttr *pHt ) #endif m_HintStarts.Insert( pHt ); m_HintEnds.Insert( pHt ); -#ifndef PRODUCT +#ifdef DBG_UTIL #ifdef NIE (aDbstream << "Insert: " ).WriteNumber( long( pHt ) ) << endl; DumpHints( m_HintStarts, m_HintEnds ); @@ -275,7 +277,7 @@ void SwpHintsArray::DeleteAtPos( const USHORT nPos ) USHORT nEndPos; m_HintEnds.Seek_Entry( pHt, &nEndPos ); m_HintEnds.Remove( nEndPos ); -#ifndef PRODUCT +#ifdef DBG_UTIL #ifdef NIE (aDbstream << "DeleteAtPos: " ).WriteNumber( long( pHt ) ) << endl; DumpHints( m_HintStarts, m_HintEnds ); @@ -283,7 +285,7 @@ void SwpHintsArray::DeleteAtPos( const USHORT nPos ) #endif } -#ifndef PRODUCT +#ifdef DBG_UTIL /************************************************************************* * SwpHintsArray::Check() @@ -441,7 +443,7 @@ bool SwpHintsArray::Resort() if( pLast && !lcl_IsLessStart( *pLast, *pHt ) ) { #ifdef NIE -#ifndef PRODUCT +#ifdef DBG_UTIL // ASSERT( bResort, "!Resort/Start: correcting hints-array" ); aDbstream << "Resort: Starts" << endl; DumpHints( m_HintStarts, m_HintEnds ); @@ -464,7 +466,7 @@ bool SwpHintsArray::Resort() if( pLast && !lcl_IsLessEnd( *pLast, *pHt ) ) { #ifdef NIE -#ifndef PRODUCT +#ifdef DBG_UTIL aDbstream << "Resort: Ends" << endl; DumpHints( m_HintStarts, m_HintEnds ); #endif @@ -480,7 +482,7 @@ bool SwpHintsArray::Resort() } pLast = pHt; } -#ifndef PRODUCT +#ifdef DBG_UTIL #ifdef NIE aDbstream << "Resorted:" << endl; DumpHints( m_HintStarts, m_HintEnds ); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 7930190ffa..218cdfb9a8 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -40,12 +40,12 @@ // --> OD 2008-01-17 #newlistlevelattrs# #include <svx/tstpitem.hxx> // <-- -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #ifndef _SVSTDARR_HXX #define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/ctloptions.hxx> +#include <svl/ctloptions.hxx> #include <swmodule.hxx> #include <txtfld.hxx> #include <txtinet.hxx> @@ -92,13 +92,13 @@ #include <numrule.hxx> //--> #outlinelevel added by zhaojianwei -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> //<--end #include <swtable.hxx> #include <docsh.hxx> #include <SwNodeNum.hxx> // --> OD 2008-02-25 #refactorlists# -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include <list.hxx> // <-- @@ -111,7 +111,7 @@ SV_DECL_PTRARR(SwpHts,SwTxtAttr*,1,1) // Leider ist das SwpHints nicht ganz wasserdicht: // Jeder darf an den Hints rumfummeln, ohne die Sortierreihenfolge // und Verkettung sicherstellen zu muessen. -#ifndef PRODUCT +#ifdef DBG_UTIL #define CHECK_SWPHINTS(pNd) { if( pNd->GetpSwpHints() && \ !pNd->GetDoc()->IsInReading() ) \ pNd->GetpSwpHints()->Check(); } @@ -372,7 +372,7 @@ void lcl_ChangeFtnRef( SwTxtNode &rNode ) ((SwTxtFrm*)pFrm)->SetFtn( TRUE ); } } -#ifndef PRODUCT +#ifdef DBG_UTIL while( 0 != (pCntnt = (SwCntntFrm*)aIter.Next()) ) { SwFtnFrm *pDbgFtn = pCntnt->FindFtnFrm(); @@ -943,9 +943,7 @@ void SwTxtNode::Update( SwIndex const & rPos, const xub_StrLen nChangeLen, bool bNoExp = false; bool bResort = false; const USHORT coArrSz = static_cast<USHORT>(RES_TXTATR_WITHEND_END) - - static_cast<USHORT>(RES_CHRATR_BEGIN) + - static_cast<USHORT>(RES_UNKNOWNATR_END) - - static_cast<USHORT>(RES_UNKNOWNATR_BEGIN); + static_cast<USHORT>(RES_CHRATR_BEGIN); BOOL aDontExp[ coArrSz ]; memset( &aDontExp, 0, coArrSz * sizeof(BOOL) ); @@ -980,14 +978,6 @@ void SwTxtNode::Update( SwIndex const & rPos, const xub_StrLen nChangeLen, nWhPos = static_cast<USHORT>(nWhich - RES_CHRATR_BEGIN); } - else if (isUNKNOWNATR(nWhich)) - { - nWhPos = static_cast<USHORT>( - nWhich - - static_cast<USHORT>(RES_UNKNOWNATR_BEGIN) + - static_cast<USHORT>(RES_TXTATR_WITHEND_END) - - static_cast<USHORT>(RES_CHRATR_BEGIN) ); - } else continue; @@ -2852,6 +2842,9 @@ long SwTxtNode::GetLeftMarginWithNum( BOOL bTxtLeft ) const BOOL SwTxtNode::GetFirstLineOfsWithNum( short& rFLOffset ) const { BOOL bRet( FALSE ); + // --> OD 2009-09-08 #i95907#, #b6879723# + rFLOffset = 0; + // <-- // --> OD 2005-11-02 #i51089 - TUNING# const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L; @@ -2885,8 +2878,6 @@ BOOL SwTxtNode::GetFirstLineOfsWithNum( short& rFLOffset ) const } // <-- } - else - rFLOffset = 0; bRet = TRUE; } diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index 5a4d720489..15a973b122 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -88,7 +88,7 @@ #define FNT_ATM_HACK #endif -#ifndef PRODUCT +#ifdef DBG_UTIL // globale Variable SvStatistics aSvStat; #endif @@ -825,7 +825,7 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf ) rInf.SetText( aNewText ); rInf.SetIdx( 0 ); rInf.SetLen( aNewText.Len() ); - aTxtSize = pLastFont->GetTextSize( rInf ); + aTxtSize = pLastFont->GetTextSize( rInf ); rInf.SetIdx( nOldIdx ); rInf.SetLen( nOldLen ); } @@ -837,9 +837,9 @@ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf ) rInf.SetText( aNewText ); rInf.SetIdx( 0 ); rInf.SetLen( aNewText.Len() ); - aTxtSize = pLastFont->GetTextSize( rInf ); + aTxtSize = pLastFont->GetTextSize( rInf ); rInf.SetIdx( nOldIdx ); - rInf.SetLen( nOldLen ); + rInf.SetLen( nOldLen ); } return aTxtSize; diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 7bd02bf4e4..47d1cb01bd 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -35,9 +35,9 @@ #include <hintids.hxx> #include <sot/factory.hxx> #include <svx/xmlcnitm.hxx> -#include <svtools/whiter.hxx> -#include <svtools/itemiter.hxx> -#include <svtools/stylepool.hxx> +#include <svl/whiter.hxx> +#include <svl/itemiter.hxx> +#include <svl/stylepool.hxx> #include <svx/fontitem.hxx> #include <svx/langitem.hxx> #include <svx/emphitem.hxx> @@ -84,11 +84,11 @@ // OD 26.06.2003 #108784# #include <dcontact.hxx> #include <docsh.hxx> -#include <svtools/smplhint.hxx> +#include <svl/smplhint.hxx> #include <algorithm> #include <map> -#ifndef PRODUCT +#ifdef DBG_UTIL #define CHECK Check(); #else #define CHECK @@ -153,12 +153,14 @@ bool isOverlap(const xub_StrLen nStart1, const xub_StrLen nEnd1, || ((nStart1 < nStart2) && (nStart2 < nEnd1) && (nEnd1 < nEnd2)); // (2) } +/// #i106930#: now asymmetric: empty hint1 is _not_ nested, but empty hint2 is static bool isNestedAny(const xub_StrLen nStart1, const xub_StrLen nEnd1, const xub_StrLen nStart2, const xub_StrLen nEnd2) { - return (nStart1 == nStart2) // in this case ends do not matter - || ((nStart1 < nStart2) ? (nEnd1 >= nEnd2) : (nEnd1 <= nEnd2)); + return ((nStart1 == nStart2) || (nEnd1 == nEnd2)) + ? (nStart1 != nEnd1) // same start/end: nested except if hint1 empty + : ((nStart1 < nStart2) ? (nEnd1 >= nEnd2) : (nEnd1 <= nEnd2)); } static @@ -658,7 +660,7 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, } } -#ifndef PRODUCT +#ifdef DBG_UTIL if( !rNode.GetDoc()->IsInReading() ) CHECK; #endif @@ -1065,11 +1067,6 @@ SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr, case RES_TXTATR_TOXMARK: pNew = new SwTxtTOXMark( (SwTOXMark&)rNew, nStt, &nEnd ); break; - case RES_UNKNOWNATR_CONTAINER: - case RES_TXTATR_UNKNOWN_CONTAINER: - pNew = new SwTxtXMLAttrContainer( (SvXMLAttrContainerItem&)rNew, - nStt, nEnd ); - break; case RES_TXTATR_CJK_RUBY: pNew = new SwTxtRuby( (SwFmtRuby&)rNew, nStt, nEnd ); break; @@ -1415,11 +1412,11 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) // FussNote im Redline-Bereich NICHT ins FtnArray einfuegen! if( StartOfSectionIndex() > rNodes.GetEndOfRedlines().GetIndex() ) { -#ifndef PRODUCT +#ifdef DBG_UTIL const BOOL bSuccess = #endif pDoc->GetFtnIdxs().Insert( pTxtFtn ); -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( bSuccess, "FtnIdx nicht eingetragen." ); #endif } @@ -1669,8 +1666,7 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt, SfxItemSet aCharSet( *rSet.GetPool(), aCharAutoFmtSetRange ); - USHORT nWhich, nCount = 0; - SwTxtAttr* pNew; + USHORT nCount = 0; SfxItemIter aIter( *pSet ); const SfxPoolItem* pItem = aIter.GetCurItem(); @@ -1678,8 +1674,10 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt, { if ( pItem && (reinterpret_cast<SfxPoolItem*>(-1) != pItem)) { - nWhich = pItem->Which(); - if ( isCHRATR(nWhich) || isTXTATR(nWhich) || isUNKNOWNATR(nWhich) ) + const USHORT nWhich = pItem->Which(); + ASSERT( isCHRATR(nWhich) || isTXTATR(nWhich), + "SwTxtNode::SetAttr(): unknown attribute" ); + if ( isCHRATR(nWhich) || isTXTATR(nWhich) ) { if ((RES_TXTATR_CHARFMT == nWhich) && (GetDoc()->GetDfltCharFmt() == @@ -1698,7 +1696,8 @@ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt, } else { - pNew = MakeTxtAttr( *GetDoc(), + + SwTxtAttr *const pNew = MakeTxtAttr( *GetDoc(), const_cast<SfxPoolItem&>(*pItem), nStt, nEnd ); if ( pNew ) { @@ -1862,20 +1861,18 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, } const USHORT nSize = m_pSwpHints->Count(); - USHORT n; - xub_StrLen nAttrStart; - const xub_StrLen* pAttrEnd; if( nStt == nEnd ) // kein Bereich: { - for( n = 0; n < nSize; ++n ) // + for (USHORT n = 0; n < nSize; ++n) { const SwTxtAttr* pHt = (*m_pSwpHints)[n]; - nAttrStart = *pHt->GetStart(); + const xub_StrLen nAttrStart = *pHt->GetStart(); if( nAttrStart > nEnd ) // ueber den Bereich hinaus break; - if( 0 == ( pAttrEnd = pHt->GetEnd() )) // nie Attribute ohne Ende + const xub_StrLen* pAttrEnd = pHt->GetEnd(); + if ( ! pAttrEnd ) // no attributes without end continue; if( ( nAttrStart < nStt && @@ -1889,22 +1886,21 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, else // es ist ein Bereich definiert { // --> FME 2007-03-13 #i75299# - std::vector< SwPoolItemEndPair >* pAttrArr = 0; + ::std::auto_ptr< std::vector< SwPoolItemEndPair > > pAttrArr; // <-- const USHORT coArrSz = static_cast<USHORT>(RES_TXTATR_WITHEND_END) - - static_cast<USHORT>(RES_CHRATR_BEGIN) + - static_cast<USHORT>(RES_UNKNOWNATR_END) - - static_cast<USHORT>(RES_UNKNOWNATR_BEGIN); + static_cast<USHORT>(RES_CHRATR_BEGIN); - for( n = 0; n < nSize; ++n ) + for (USHORT n = 0; n < nSize; ++n) { const SwTxtAttr* pHt = (*m_pSwpHints)[n]; - nAttrStart = *pHt->GetStart(); + const xub_StrLen nAttrStart = *pHt->GetStart(); if( nAttrStart > nEnd ) // ueber den Bereich hinaus break; - if( 0 == ( pAttrEnd = pHt->GetEnd() )) // nie Attribute ohne Ende + const xub_StrLen* pAttrEnd = pHt->GetEnd(); + if ( ! pAttrEnd ) // no attributes without end continue; BOOL bChkInvalid = FALSE; @@ -1927,7 +1923,7 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, if( bChkInvalid ) { // uneindeutig ? - SfxItemIter* pItemIter = 0; + ::std::auto_ptr< SfxItemIter > pItemIter; const SfxPoolItem* pItem = 0; if ( RES_TXTATR_AUTOFMT == pHt->Which() ) @@ -1935,7 +1931,7 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, const SfxItemSet* pAutoSet = CharFmt::GetItemSet( pHt->GetAttr() ); if ( pAutoSet ) { - pItemIter = new SfxItemIter( *pAutoSet ); + pItemIter.reset( new SfxItemIter( *pAutoSet ) ); pItem = pItemIter->GetCurItem(); } } @@ -1947,9 +1943,14 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, while ( pItem ) { const USHORT nHintWhich = pItem->Which(); + ASSERT(!isUNKNOWNATR(nHintWhich), + "SwTxtNode::GetAttr(): unkonwn attribute?"); - if( !pAttrArr ) - pAttrArr = new std::vector< SwPoolItemEndPair >( coArrSz ); + if ( !pAttrArr.get() ) + { + pAttrArr.reset( + new std::vector< SwPoolItemEndPair >(coArrSz)); + } std::vector< SwPoolItemEndPair >::iterator pPrev = pAttrArr->begin(); if (isCHRATR(nHintWhich) || @@ -1957,12 +1958,6 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, { pPrev += nHintWhich - RES_CHRATR_BEGIN; } - else if (isUNKNOWNATR(nHintWhich)) - { - pPrev += nHintWhich - RES_UNKNOWNATR_BEGIN + ( - static_cast< USHORT >(RES_TXTATR_WITHEND_END) - - static_cast< USHORT >(RES_CHRATR_BEGIN) ); - } else { pPrev = pAttrArr->end(); @@ -2006,28 +2001,21 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, } } - pItem = ( pItemIter && !pItemIter->IsAtEnd() ) ? pItemIter->NextItem() : 0; + pItem = ( pItemIter.get() && !pItemIter->IsAtEnd() ) + ? pItemIter->NextItem() : 0; } // end while - - delete pItemIter; } } - if( pAttrArr ) + if ( pAttrArr.get() ) { - for( n = 0; n < coArrSz; ++n ) + for (USHORT n = 0; n < coArrSz; ++n) { const SwPoolItemEndPair& rItemPair = (*pAttrArr)[ n ]; if( (0 != rItemPair.mpItem) && ((SfxPoolItem*)-1 != rItemPair.mpItem) ) { - USHORT nWh; - if( n < static_cast<USHORT>( static_cast<USHORT>(RES_TXTATR_WITHEND_END) - - static_cast<USHORT>(RES_CHRATR_BEGIN) ) ) - nWh = static_cast<USHORT>(n + RES_CHRATR_BEGIN); - else - nWh = n - static_cast<USHORT>( static_cast<USHORT>(RES_TXTATR_WITHEND_END) - - static_cast<USHORT>(RES_CHRATR_BEGIN) + - static_cast<USHORT>(RES_UNKNOWNATR_BEGIN) ); + const USHORT nWh = + static_cast<USHORT>(n + RES_CHRATR_BEGIN); if( nEnd <= rItemPair.mnEndPos ) // hinter oder genau Ende { @@ -2039,8 +2027,6 @@ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStt, xub_StrLen nEnd, rSet.InvalidateItem( nWh ); } } - - delete pAttrArr; } } if( aFmtSet.Count() ) @@ -2630,7 +2616,7 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode, { SwpHintsArray::Insert( pHint ); CalcFlags(); -#ifndef PRODUCT +#ifdef DBG_UTIL if( !rNode.GetDoc()->IsInReading() ) CHECK; #endif @@ -2723,7 +2709,7 @@ bool SwpHints::TryInsertHint( SwTxtAttr* const pHint, SwTxtNode &rNode, rNode.Modify( 0, &aHint ); } -#ifndef PRODUCT +#ifdef DBG_UTIL if( !bNoHintAdjustMode && !rNode.GetDoc()->IsInReading() ) CHECK; #endif diff --git a/sw/source/core/txtnode/txatbase.cxx b/sw/source/core/txtnode/txatbase.cxx index 61b425ccce..5617ba35b0 100644 --- a/sw/source/core/txtnode/txatbase.cxx +++ b/sw/source/core/txtnode/txatbase.cxx @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" -#include <svtools/itempool.hxx> +#include <svl/itempool.hxx> #include <txatbase.hxx> #include <fmtfld.hxx> #include <docufld.hxx> diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx index f500d28596..23900ed60b 100644 --- a/sw/source/core/txtnode/txtatr2.cxx +++ b/sw/source/core/txtnode/txtatr2.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -31,7 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <hintids.hxx> #include <hints.hxx> #include <sfx2/objsh.hxx> @@ -52,13 +51,6 @@ TYPEINIT1(SwTxtINetFmt,SwClient); TYPEINIT1(SwTxtRuby,SwClient); -// ATT_XMLCONTAINERITEM ****************************** - -SwTxtXMLAttrContainer::SwTxtXMLAttrContainer( - SvXMLAttrContainerItem& rAttr, - xub_StrLen nStt, xub_StrLen nEnde ) - : SwTxtAttrEnd( rAttr, nStt, nEnde ) -{} /************************************************************************* * class SwTxtCharFmt diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index db2743218f..6677d2b647 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -41,7 +41,7 @@ #endif #include <hintids.hxx> #include <vcl/svapp.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svx/splwrap.hxx> #include <svx/langitem.hxx> #include <svx/fontitem.hxx> @@ -368,7 +368,6 @@ static bool lcl_HaveCommonAttributes( IStyleAccess& rStyleAccess, return bRet; } - inline BOOL InRange(xub_StrLen nIdx, xub_StrLen nStart, xub_StrLen nEnd) { return ((nIdx >=nStart) && (nIdx <= nEnd)); } @@ -1676,6 +1675,7 @@ void SwTxtNode::ReplaceTextOnly( xub_StrLen nPos, xub_StrLen nLen, void SwTxtNode::CountWords( SwDocStat& rStat, xub_StrLen nStt, xub_StrLen nEnd ) const { + ++rStat.nAllPara; // #i93174#: count _all_ paragraphs if( nStt < nEnd ) { if ( !IsHidden() ) diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 35c09ac23b..ab797b488e 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -203,9 +203,9 @@ void SwDoc::AppendUndo( SwUndo* pUndo ) USHORT nEnde = UNDO_ACTION_LIMIT; // nur zum Testen der neuen DOC-Member -#ifndef PRODUCT +#ifdef DBG_UTIL { - SwUndoId nId = UNDO_EMPTY; + SwUndoId nId = UNDO_EMPTY; USHORT nUndosCnt = 0, nSttEndCnt = 0; for( USHORT nCnt = 0; nCnt < nUndoPos; ++nCnt ) { @@ -551,7 +551,7 @@ SwUndoId SwDoc::EndUndo(SwUndoId eUndoId, const SwRewriter * pRewriter) pUndoEnd->SetSttOffset( nSize ); // nur zum Testen der Start/End-Verpointerung vom Start/End Undo -#ifndef PRODUCT +#ifdef DBG_UTIL { USHORT nEndCnt = 1, nCnt = pUndos->Count(); SwUndoId nTmpId = UNDO_EMPTY; diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 44ac5f49c4..1d8d7b3cf7 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -33,7 +33,7 @@ #include <hintids.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <fmtftn.hxx> #include <fchrfmt.hxx> #include <fmtflcnt.hxx> @@ -833,7 +833,7 @@ SwHistoryResetAttrSet::SwHistoryResetAttrSet( const SfxItemSet& rSet, , m_Array( (BYTE)rSet.Count() ) { SfxItemIter aIter( rSet ); - bool bAutoStyle = true; + bool bAutoStyle = false; while( TRUE ) { diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index 512c7c1afe..422a02f0b2 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -39,7 +39,7 @@ #include <svx/svdmodel.hxx> #include <svx/tstpitem.hxx> #include <svx/svdpage.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <fmtflcnt.hxx> diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 38a83445c5..ba175e42a8 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -68,7 +68,7 @@ public: SwNodeIndex* GetMvSttIdx() const { return SwUndoSaveSection::GetMvSttIdx(); } -#ifndef PRODUCT +#ifdef DBG_UTIL USHORT nRedlineCount; #endif }; @@ -666,14 +666,9 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark, { if( !pHistory ) pHistory = new SwHistory; - if( pAPos->nNode < pEnd->nNode && - ( ( nsDelCntntType::DELCNT_CHKNOCNTNT & nDelCntntType ) || - ( pStt->nNode < pAPos->nNode || !pStt->nContent.GetIndex() ) ) ) + if (IsDestroyFrameAnchoredAtChar( + *pAPos, *pStt, *pEnd, nDelCntntType)) { - // Here we identified the objects to destroy: - // - anchored between start and end of the selection - // - anchored in start of the selection with "CheckNoContent" - // - anchored in start of sel. and the selection start at pos 0 pHistory->Add( *pFmt, nChainInsPos ); n = n >= rSpzArr.Count() ? rSpzArr.Count() : n+1; } @@ -1094,7 +1089,7 @@ SwRedlineSaveData::SwRedlineSaveData( SwComparePosition eCmpPos, ASSERT( !this, "keine gueltigen Daten!" ) } -#ifndef PRODUCT +#ifdef DBG_UTIL nRedlineCount = rSttPos.nNode.GetNode().GetDoc()->GetRedlineTbl().Count(); #endif } @@ -1388,3 +1383,20 @@ String DenoteSpecialCharacters(const String & rStr) return aResult; } + +bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos, + SwPosition const & rStart, SwPosition const & rEnd, + DelCntntType const nDelCntntType) +{ + + // Here we identified the objects to destroy: + // - anchored between start and end of the selection + // - anchored in start of the selection with "CheckNoContent" + // - anchored in start of sel. and the selection start at pos 0 + return (rAnchorPos.nNode < rEnd.nNode) + && ( (nsDelCntntType::DELCNT_CHKNOCNTNT & nDelCntntType) + || (rStart.nNode < rAnchorPos.nNode) + || !rStart.nContent.GetIndex() + ); +} + diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index d9ce9b12a8..58383f9415 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -33,7 +33,7 @@ #include <hintids.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <fmtflcnt.hxx> #include <fmtanchr.hxx> #include <fmtcntnt.hxx> diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 944e239daf..8ce47d86dc 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -247,6 +247,12 @@ void SwUndoRedlineSort::_Undo( SwUndoIter& rIter ) // im aSaveRange steht der kopierte, sprich der originale. SwDoc& rDoc = rIter.GetDoc(); + SwPosition* pStart = rIter.pAktPam->Start(); + SwPosition* pEnd = rIter.pAktPam->End(); + + SwNodeIndex aPrevIdx( pStart->nNode, -1 ); + ULONG nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex(); + if( 0 == ( nsRedlineMode_t::REDLINE_SHOW_DELETE & rDoc.GetRedlineMode()) ) { // die beiden Redline Objecte suchen und diese dann anzeigen lassen, @@ -254,17 +260,17 @@ void SwUndoRedlineSort::_Undo( SwUndoIter& rIter ) // das Geloeschte ist versteckt, also suche das INSERT // Redline Object. Dahinter steht das Geloeschte USHORT nFnd = rDoc.GetRedlinePos( - *rDoc.GetNodes()[ nSttNode + nOffset + 1 ], + *rDoc.GetNodes()[ nSttNode + 1 ], nsRedlineType_t::REDLINE_INSERT ); ASSERT( USHRT_MAX != nFnd && nFnd+1 < rDoc.GetRedlineTbl().Count(), "kein Insert Object gefunden" ); ++nFnd; - rDoc.GetRedlineTbl()[nFnd]->Show(); - SetPaM( *rIter.pAktPam ); + rDoc.GetRedlineTbl()[nFnd]->Show( 1 ); } { SwPaM aTmp( *rIter.pAktPam->GetMark() ); + aTmp.GetMark()->nContent = 0; aTmp.SetMark(); aTmp.GetPoint()->nNode = nSaveEndNode; aTmp.GetPoint()->nContent.Assign( aTmp.GetCntntNode(), nSaveEndCntnt ); @@ -272,13 +278,52 @@ void SwUndoRedlineSort::_Undo( SwUndoIter& rIter ) } rDoc.DelFullPara( *rIter.pAktPam ); + + SwPaM* pPam = rIter.pAktPam; + pPam->DeleteMark(); + pPam->GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 ); + SwCntntNode* pCNd = pPam->GetCntntNode(); + pPam->GetPoint()->nContent.Assign(pCNd, 0 ); + pPam->SetMark(); + + pPam->GetPoint()->nNode += nOffsetTemp; + pCNd = pPam->GetCntntNode(); + pPam->GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); + + SetValues( *pPam ); + SetPaM( *rIter.pAktPam ); } void SwUndoRedlineSort::_Redo( SwUndoIter& rIter ) { SwPaM& rPam = *rIter.pAktPam; + + SwPaM* pPam = &rPam; + SwPosition* pStart = pPam->Start(); + SwPosition* pEnd = pPam->End(); + + SwNodeIndex aPrevIdx( pStart->nNode, -1 ); + ULONG nOffsetTemp = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex(); + xub_StrLen nCntStt = pStart->nContent.GetIndex(); + rIter.GetDoc().SortText( rPam, *pOpt ); + + pPam->DeleteMark(); + pPam->GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 ); + SwCntntNode* pCNd = pPam->GetCntntNode(); + xub_StrLen nLen = pCNd->Len(); + if( nLen > nCntStt ) + nLen = nCntStt; + pPam->GetPoint()->nContent.Assign(pCNd, nLen ); + pPam->SetMark(); + + pPam->GetPoint()->nNode += nOffsetTemp; + pCNd = pPam->GetCntntNode(); + pPam->GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); + + SetValues( rPam ); + SetPaM( rPam ); rPam.GetPoint()->nNode = nSaveEndNode; rPam.GetPoint()->nContent.Assign( rPam.GetCntntNode(), nSaveEndCntnt ); diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index ab501f9558..2782a408ac 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -66,8 +66,7 @@ #include <comcore.hrc> #include <unochart.hxx> - -#ifdef PRODUCT +#ifndef DBG_UTIL #define CHECK_TABLE(t) #else #ifdef DEBUG @@ -77,7 +76,7 @@ #endif #endif -#ifdef PRODUCT +#ifndef DBG_UTIL #define _DEBUG_REDLINE( pDoc ) #else void lcl_DebugRedline( const SwDoc* pDoc ); @@ -195,7 +194,7 @@ public: void InsertSort( SvUShorts& rArr, USHORT nIdx, USHORT* pInsPos = 0 ); void InsertSort( SvULongs& rArr, ULONG nIdx, USHORT* pInsPos = 0 ); -#if defined( JP_DEBUG ) && !defined( PRODUCT ) +#if defined( JP_DEBUG ) && defined(DBG_UTIL) #include "shellio.hxx" void DumpDoc( SwDoc* pDoc, const String& rFileNm ); void CheckTable( const SwTable& ); @@ -3253,7 +3252,7 @@ void InsertSort( SvULongs& rArr, ULONG nIdx, USHORT* pInsPos ) *pInsPos = nU; } -#if defined( JP_DEBUG ) && !defined( PRODUCT ) +#if defined( JP_DEBUG ) && defined(DBG_UTIL) void DumpDoc( SwDoc* pDoc, const String& rFileNm ) diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx index 0a269e7aa7..f954b79827 100644 --- a/sw/source/core/unocore/swunohelper.cxx +++ b/sw/source/core/unocore/swunohelper.cxx @@ -52,7 +52,7 @@ #include <ucbhelper/contentidentifier.hxx> #include <ucbhelper/contentbroker.hxx> #include <ucbhelper/content.hxx> -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <swunohelper.hxx> #include <swunodef.hxx> #include <errhdl.hxx> diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 2c1cb1ceb5..167add1e58 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -41,7 +41,7 @@ #include <vos/mutex.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> -#include <svtools/zforlist.hxx> // SvNumberFormatter +#include <svl/zforlist.hxx> // SvNumberFormatter #include <svtools/chartprettypainter.hxx> #include <tools/link.hxx> diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 06bbca43e0..78799c8a96 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -59,7 +59,7 @@ #include <com/sun/star/text/XTextTablesSupplier.hpp> #include <com/sun/star/text/TableColumnSeparator.hpp> #include <com/sun/star/text/XTextTable.hpp> -#include <svtools/PasswordHelper.hxx> +#include <svl/PasswordHelper.hxx> #include <svtools/unoimap.hxx> #include <svtools/unoevent.hxx> #include <unotbl.hxx> diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index b3d17e83a4..1ac40712b4 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -59,7 +59,7 @@ #include <swundo.hxx> #include <cntfrm.hxx> #include <pagefrm.hxx> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <tools/urlobj.hxx> #include <docary.hxx> #include <swtable.hxx> @@ -70,11 +70,11 @@ #include <svtools/ctrltool.hxx> #define _SVSTDARR_USHORTS #define _SVSTDARR_USHORTSSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <sfx2/docfilt.hxx> #include <sfx2/docfile.hxx> #include <sfx2/fcontnr.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <com/sun/star/beans/PropertyState.hpp> #include <SwStyleNameMapper.hxx> #include <redline.hxx> @@ -1032,9 +1032,11 @@ void makeRedline( SwPaM& rPaM, } SwRedline* pRedline = new SwRedline( aRedlineData, rPaM ); + RedlineMode_t nPrevMode = pRedlineAccess->GetRedlineMode( ); + pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_ON); bool bRet = pRedlineAccess->AppendRedline( pRedline, false ); - pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_NONE); + pRedlineAccess->SetRedlineMode_intern( nPrevMode ); if( !bRet ) throw lang::IllegalArgumentException(); } diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 0abfc6844e..a88f0a26c0 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -2117,6 +2117,7 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange) OTextCursorHelper* pCursor = 0; SwXTextPortion* pPortion = 0; SwXText* pText = 0; + SwXParagraph* pParagraph = 0; pRange = reinterpret_cast< SwXTextRange * >( sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) )); @@ -2126,6 +2127,8 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange) sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) )); pPortion = reinterpret_cast< SwXTextPortion * >( sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextPortion::getUnoTunnelId()) )); + pParagraph = reinterpret_cast< SwXParagraph * >( + sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXParagraph::getUnoTunnelId( ) ) ) ); if (pRange) pDoc = pRange->GetDoc(); @@ -2137,6 +2140,8 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange) { pDoc = pPortion->GetCursor()->GetDoc(); } + else if ( !pDoc && pParagraph && pParagraph->GetTxtNode( ) ) + pDoc = pParagraph->GetTxtNode( )->GetDoc( ); } diff --git a/sw/source/core/unocore/unoevent.cxx b/sw/source/core/unocore/unoevent.cxx index cfec12bfb7..af6d731aa1 100644 --- a/sw/source/core/unocore/unoevent.cxx +++ b/sw/source/core/unocore/unoevent.cxx @@ -43,7 +43,7 @@ #include <svx/svxids.hrc> #endif #include "fmtinfmt.hxx" -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include <rtl/ustrbuf.hxx> #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP #include <com/sun/star/beans/PropertyValue.hpp> diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index f8dc8e5cce..2167a0c918 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -88,7 +88,7 @@ #include <tools/urlobj.hxx> #include <svx/dataaccessdescriptor.hxx> #define _SVSTDARR_STRINGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <vos/mutex.hxx> #include <vcl/svapp.hxx> #include <textapi.hxx> diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 4d535f1262..4e7789b27f 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -2250,6 +2250,8 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s {SW_PROP_NMID(UNO_NAME_NAME), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0}, + {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0}, + {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 5486a8a97f..30f57c7df8 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -112,7 +112,7 @@ #include <fmtflcnt.hxx> #define _SVSTDARR_USHORTS #define _SVSTDARR_USHORTSSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <svx/brshitem.hxx> #include <fmtclds.hxx> #include <dcontact.hxx> diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 36dd9cc160..5b09353555 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -112,7 +112,7 @@ #define _SVSTDARR_USHORTS #define _SVSTDARR_USHORTSSORT #define _SVSTDARR_XUB_STRLEN -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <svx/brshitem.hxx> #include <fmtclds.hxx> #include <dcontact.hxx> @@ -1192,6 +1192,12 @@ SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt) : m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)), pMark(NULL) { + SwTable* pTable = SwTable::FindTable( &rTblFmt ); + SwTableNode* pTblNode = pTable->GetTableNode( ); + SwPosition aPosition( *pTblNode ); + SwPaM aPam( aPosition ); + + _CreateNewBookmark( aPam ); } SwXTextRange::~SwXTextRange() diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index 89032a3b20..732e777eaa 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -48,7 +48,7 @@ #define _SVSTDARR_USHORTS #define _SVSTDARR_USHORTSSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <com/sun/star/beans/SetPropertyTolerantFailed.hpp> #include <com/sun/star/beans/GetPropertyTolerantResult.hpp> @@ -293,7 +293,6 @@ void SAL_CALL SwXParagraph::SetPropertyValues_Impl( const OUString* pPropertyNames = rPropertyNames.getConstArray(); const uno::Any* pValues = rValues.getConstArray(); const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap(); - OUString sTmp; SwParaSelection aParaSel( & aCursor ); for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { @@ -306,7 +305,7 @@ void SAL_CALL SwXParagraph::SetPropertyValues_Impl( throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); SwXTextCursor::SetPropertyValue(aCursor, *m_pPropSet, - sTmp, pValues[nProp]); + pPropertyNames[nProp], pValues[nProp]); } } } diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index 8671230214..ceb9b4885e 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -35,7 +35,7 @@ #include <cmdid.h> #include <vos/mutex.hxx> #include <vcl/svapp.hxx> -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> #include <unocrsrhelper.hxx> #include <unoport.hxx> #include <unoobj.hxx> @@ -719,10 +719,6 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion: aResult.Result = beans::TolerantPropertySetResultType::SUCCESS; aResultVector.push_back( aResult ); } - // this assertion should never occur! - DBG_ASSERT( !aResultVector.size() || aResult.Result != beans::TolerantPropertySetResultType::UNKNOWN_FAILURE, - "unknown failure while retrieving property" ); - } } catch (beans::UnknownPropertyException &) diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 327bfd7c68..6809c389d1 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -831,7 +831,6 @@ lcl_ExportHints( case RES_TXTATR_AUTOFMT: case RES_TXTATR_INETFMT: case RES_TXTATR_CHARFMT: - case RES_TXTATR_UNKNOWN_CONTAINER: break; // these are handled as properties of a "Text" portion default: DBG_ERROR("unknown attribute"); diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx index fc0cddd250..3c75ee9af9 100644 --- a/sw/source/core/unocore/unoprnms.cxx +++ b/sw/source/core/unocore/unoprnms.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" #include <tools/debug.hxx> -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> #include <unoprnms.hxx> diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 55b6fc7d0f..a78d27225a 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -36,7 +36,7 @@ #include <cmdid.h> #include <hintids.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <svx/brshitem.hxx> #ifndef _SVX_XMLCNITEM_HXX #include <svx/xmlcnitm.hxx> diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 6033541f9d..bc3203f764 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -35,10 +35,10 @@ #include <hintids.hxx> #include <vos/mutex.hxx> #include <vcl/svapp.hxx> -#include <svtools/smplhint.hxx> +#include <svl/smplhint.hxx> #include <svtools/ctrltool.hxx> -#include <svtools/style.hxx> -#include <svtools/itemiter.hxx> +#include <svl/style.hxx> +#include <svl/itemiter.hxx> #include <svx/pageitem.hxx> #include <svx/sizeitem.hxx> #include <svx/ulspitem.hxx> diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 0adf9c79ac..b2e863595f 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -63,7 +63,7 @@ #include <fmtpdsc.hxx> #include <pagedesc.hxx> #define _SVSTDARR_STRINGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <viewsh.hxx> #include <tabfrm.hxx> #include <redline.hxx> @@ -87,7 +87,7 @@ #include <com/sun/star/table/CellContentType.hpp> #include <unotbl.hxx> #include <unoobj.hxx> -#include <svtools/zforlist.hxx> // SvNumberFormatter +#include <svl/zforlist.hxx> // SvNumberFormatter #include <svx/brkitem.hxx> #include <svx/shaditem.hxx> #include <svx/lrspitem.hxx> diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 73d08d7cf5..0373d8877a 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -66,6 +66,8 @@ #include <memory> #include <stdlib.h> +#include <iostream> + using namespace ::com::sun::star; using ::rtl::OUString; @@ -1827,19 +1829,11 @@ uno::Reference< text::XTextTable > SwXText::convertToTable( */ if(aStartCellPam.Start()->nNode < aEndCellPam.End()->nNode) { - const SwNode& rStartNode = aStartCellPam.Start()->nNode.GetNode(); - if(!rStartNode.IsTxtNode() || - !aEndCellPam.End()->nNode.GetNode().IsTxtNode()) - { - //start and end of the cell must be on a SwTxtNode - bExcept = true; - break; - } // increment on each StartNode and decrement on each EndNode // we must reach zero at the end and must not go below zero long nOpenNodeBlock = 0; SwNodeIndex aCellIndex = aStartCellPam.Start()->nNode; - while( ++aCellIndex < aEndCellPam.End()->nNode.GetIndex()) + while( aCellIndex < aEndCellPam.End()->nNode.GetIndex()) { if( aCellIndex.GetNode().IsStartNode() ) ++nOpenNodeBlock; @@ -1850,6 +1844,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable( bExcept = true; break; } + ++aCellIndex; } if( nOpenNodeBlock != 0) { @@ -1895,7 +1890,9 @@ uno::Reference< text::XTextTable > SwXText::convertToTable( //node border anyway } else + { bExcept = true; + } } //now check if there's a need to insert another paragraph break if( aEndCellPam.End()->nContent.GetIndex() < aEndCellPam.End()->nNode.GetNode().GetTxtNode()->Len()) @@ -1952,7 +1949,22 @@ uno::Reference< text::XTextTable > SwXText::convertToTable( const beans::PropertyValue* pTableProperties = rTableProperties.getConstArray(); sal_Int32 nProperty = 0; for( ; nProperty < rTableProperties.getLength(); ++nProperty) - xPrSet->setPropertyValue( pTableProperties[nProperty].Name, pTableProperties[nProperty].Value ); + { + try + { + xPrSet->setPropertyValue( pTableProperties[nProperty].Name, pTableProperties[nProperty].Value ); + } + catch ( const uno::Exception e ) + { +#if DEBUG + std::clog << "Exception when setting property: "; + std::clog << rtl::OUStringToOString( pTableProperties[nProperty].Name, RTL_TEXTENCODING_UTF8 ).getStr( ); + std::clog << ". Message: "; + std::clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ); + std::clog << std::endl; +#endif + } + } //apply row properties uno::Reference< table::XTableRows > xRows = xRet->getRows(); @@ -2009,6 +2021,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable( //--< #endif + //apply cell properties for( nRow = 0; nRow < rCellProperties.getLength(); ++nRow) { @@ -2021,7 +2034,8 @@ uno::Reference< text::XTextTable > SwXText::convertToTable( uno::Reference< beans::XPropertySet > xCell( pTextTable->getCellByPosition(nCell, nRow), uno::UNO_QUERY ); for( nProperty = 0; nProperty < nCellProperties; ++nProperty) { - if(aCellProperties[nProperty].Name.equalsAsciiL( + const OUString& rName = aCellProperties[nProperty].Name; + if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "VerticalMerge"))) { //determine left border position @@ -2084,8 +2098,24 @@ uno::Reference< text::XTextTable > SwXText::convertToTable( } } } - else - xCell->setPropertyValue(aCellProperties[nProperty].Name, aCellProperties[nProperty].Value); + else + { + try + { + xCell->setPropertyValue(rName, aCellProperties[nProperty].Value); + } + catch ( const uno::Exception e ) + { + // Apply the paragraph and char properties to the cell's content + uno::Reference< text::XText > xCellText( xCell, uno::UNO_QUERY ); + uno::Reference< text::XTextCursor > xCellCurs = xCellText->createTextCursor( ); + xCellCurs->gotoStart( false ); + xCellCurs->gotoEnd( true ); + + uno::Reference< beans::XPropertySet > xCellTextProps( xCellCurs, uno::UNO_QUERY ); + xCellTextProps->setPropertyValue( rName, aCellProperties[nProperty].Value ); + } + } } } } diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx index a0c6d78e37..87f1d7cfe0 100644 --- a/sw/source/core/view/vdraw.cxx +++ b/sw/source/core/view/vdraw.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -45,7 +45,7 @@ /// include <svx/svdoutl.hxx> #include <svx/svdoutl.hxx> -#ifndef PRODUCT +#ifdef DBG_UTIL #ifndef _SVX_FMGLOB_HXX #include <svx/fmglob.hxx> #endif diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index fa038871c0..7d280ff1b6 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -376,6 +376,37 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) // #i75172# end DrawingLayer paint DLPostPaint2(true); } + + // --> OD 2009-12-03 #i107365# + // Direct paint has been performed. Thus, take care of + // transparent child windows. + if ( GetWin() ) + { + Window& rWindow = *(GetWin()); + if(rWindow.IsChildTransparentModeEnabled() && rWindow.GetChildCount()) + { + const Rectangle aRectanglePixel(rWindow.LogicToPixel(aRect.SVRect())); + + for ( sal_uInt16 a(0); a < rWindow.GetChildCount(); a++ ) + { + Window* pCandidate = rWindow.GetChild(a); + + if ( pCandidate && pCandidate->IsPaintTransparent() ) + { + const Rectangle aCandidatePosSizePixel( + pCandidate->GetPosPixel(), + pCandidate->GetSizePixel()); + + if ( aCandidatePosSizePixel.IsOver(aRectanglePixel) ) + { + pCandidate->Invalidate( INVALIDATE_NOTRANSPARENT|INVALIDATE_CHILDREN ); + pCandidate->Update(); + } + } + } + } + } + // <-- } delete pVout; @@ -407,7 +438,7 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) UISizeNotify(); ++nStartAction; -#ifndef PRODUCT +#ifdef DBG_UTIL // test option 'No Scroll' suppresses the automatic repair of the scrolled area if ( !GetViewOptions()->IsTest8() ) #endif @@ -589,7 +620,7 @@ void ViewShell::MakeVisible( const SwRect &rRect ) EndAction(); } while( nOldH != pRoot->Frm().Height() && nLoopCnt-- ); } -#ifndef PRODUCT +#ifdef DBG_UTIL else { //MA: 04. Nov. 94, braucht doch keiner oder?? @@ -746,7 +777,7 @@ void ViewShell::LayoutIdle() SET_CURR_SHELL( this ); -#ifndef PRODUCT +#ifdef DBG_UTIL // Wenn Test5 gedrueckt ist, wird der IdleFormatierer abgeknipst. if( pOpt->IsTest5() ) return; @@ -1146,7 +1177,7 @@ void ViewShell::VisPortChgd( const SwRect &rRect) if ( rRect == VisArea() ) return; -#ifndef PRODUCT +#ifdef DBG_UTIL if ( bInEndAction ) { //Da Rescheduled doch schon wieder irgendwo einer? @@ -2685,7 +2716,7 @@ const BitmapEx& ViewShell::GetReplacementBitmap( bool bIsErrorState ) if( !*ppRet ) { USHORT nBmpResId = - Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark() + Application::GetSettings().GetStyleSettings().GetHighContrastMode() ? nHCResId : nResId; *ppRet = new BitmapEx( SW_RES( nBmpResId ) ); } diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 3ae5a3b5ba..28348a682c 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -45,7 +45,7 @@ #include <svx/pbinitem.hxx> #include <svx/svdview.hxx> #include <unotools/localedatawrapper.hxx> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #include <txtfld.hxx> #include <fmtfld.hxx> #include <fmtfsize.hxx> @@ -776,16 +776,32 @@ SwDoc * ViewShell::CreatePrtDoc( SfxPrinter* pPrt, SfxObjectShellRef &rDocShellR pActCrsr = dynamic_cast<SwShellCrsr*>(pActCrsr->GetPrev()); } - // Die Y-Position der ersten Selektion - const Point aSelPoint = pFESh->IsTableMode() ? - pFESh->GetTableCrsr()->GetSttPos() : - pFirstCrsr->GetSttPos(); + Point aSelPoint; + if( pFESh->IsTableMode() ) + { + SwShellTableCrsr* pShellTblCrsr = pFESh->GetTableCrsr(); + + const SwCntntNode* pCntntNode = pShellTblCrsr->GetNode()->GetCntntNode(); + const SwCntntFrm *pCntntFrm = pCntntNode ? pCntntNode->GetFrm( 0, pShellTblCrsr->Start() ) : 0; + if( pCntntFrm ) + { + SwRect aCharRect; + SwCrsrMoveState aTmpState( MV_NONE ); + pCntntFrm->GetCharRect( aCharRect, *pShellTblCrsr->Start(), &aTmpState ); + aSelPoint = Point( aCharRect.Left(), aCharRect.Top() ); + } + } + else + { + aSelPoint = pFirstCrsr->GetSttPos(); + } const SwPageFrm* pPage = GetLayout()->GetPageAtPos( aSelPoint ); + ASSERT( pPage, "no page found!" ); - // und ihren Seitendescribtor - const SwPageDesc* pPageDesc = pPrtDoc->FindPageDescByName( - pPage->GetPageDesc()->GetName() ); + // get page descriptor - fall back to the first one if pPage could not be found + const SwPageDesc* pPageDesc = pPage ? pPrtDoc->FindPageDescByName( + pPage->GetPageDesc()->GetName() ) : &pPrtDoc->_GetPageDesc( (sal_uInt16)0 ); if( !pFESh->IsTableMode() && pActCrsr->HasMark() ) { // Am letzten Absatz die Absatzattribute richten: @@ -868,15 +884,32 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) // Die Y-Position der ersten Selektion // Die Y-Position der ersten Selektion - const Point aSelPoint = pFESh->IsTableMode() ? - pFESh->GetTableCrsr()->GetSttPos() : - pFirstCrsr->GetSttPos(); + Point aSelPoint; + if( pFESh->IsTableMode() ) + { + SwShellTableCrsr* pShellTblCrsr = pFESh->GetTableCrsr(); + + const SwCntntNode* pCntntNode = pShellTblCrsr->GetNode()->GetCntntNode(); + const SwCntntFrm *pCntntFrm = pCntntNode ? pCntntNode->GetFrm( 0, pShellTblCrsr->Start() ) : 0; + if( pCntntFrm ) + { + SwRect aCharRect; + SwCrsrMoveState aTmpState( MV_NONE ); + pCntntFrm->GetCharRect( aCharRect, *pShellTblCrsr->Start(), &aTmpState ); + aSelPoint = Point( aCharRect.Left(), aCharRect.Top() ); + } + } + else + { + aSelPoint = pFirstCrsr->GetSttPos(); + } const SwPageFrm* pPage = GetLayout()->GetPageAtPos( aSelPoint ); + ASSERT( pPage, "no page found!" ); - // und ihren Seitendescribtor - const SwPageDesc* pPageDesc = pPrtDoc->FindPageDescByName( - pPage->GetPageDesc()->GetName() ); + // get page descriptor - fall back to the first one if pPage could not be found + const SwPageDesc* pPageDesc = pPage ? pPrtDoc->FindPageDescByName( + pPage->GetPageDesc()->GetName() ) : &pPrtDoc->_GetPageDesc( (sal_uInt16)0 ); if( !pFESh->IsTableMode() && pActCrsr->HasMark() ) { // Am letzten Absatz die Absatzattribute richten: diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index 10e85b5c08..9b509a8eeb 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -34,7 +34,7 @@ #include <tools/stream.hxx> #ifndef _SVSTDARR_HXX #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <svx/fontitem.hxx> #include <pam.hxx> diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index 4e55ee6ce6..428e50da1f 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -39,7 +39,7 @@ #include <i18npool/mslangid.hxx> #include <vcl/msgbox.hxx> #include <svtools/parhtml.hxx> -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <sot/storage.hxx> #include <sot/clsids.hxx> #include <sfx2/app.hxx> @@ -418,6 +418,9 @@ void SwFilterOptions::GetValues( sal_uInt16 nCnt, const sal_Char** ppNames, pValues[ n ] = 0; } +void SwFilterOptions::Commit() {} +void SwFilterOptions::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + /* */ @@ -1008,3 +1011,24 @@ void GetWW8Writer( const String& rFltName, const String& rBaseURL, WriterRef& xR else xRet = WriterRef(0); } + +typedef ULONG ( __LOADONCALLAPI *SaveOrDel )( SfxObjectShell&, SotStorage&, BOOL, const String& ); +typedef ULONG ( __LOADONCALLAPI *GetSaveWarning )( SfxObjectShell& ); + +ULONG SaveOrDelMSVBAStorage( SfxObjectShell& rDoc, SotStorage& rStor, BOOL bSaveInto, const String& rStorageName ) +{ + SaveOrDel pFunction = reinterpret_cast<SaveOrDel>( GetMswordLibSymbol( "SaveOrDelMSVBAStorage_ww8" ) ); + if( pFunction ) + return pFunction( rDoc, rStor, bSaveInto, rStorageName ); + return ERRCODE_NONE; +} + +ULONG GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS ) +{ + GetSaveWarning pFunction = reinterpret_cast<GetSaveWarning>( GetMswordLibSymbol( "GetSaveWarningOfMSVBAStorage_ww8" ) ); + if( pFunction ) + return pFunction( rDocS ); + return ERRCODE_NONE; +} + + diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 8182f28e59..a1fb3d5aeb 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -33,11 +33,11 @@ #include <hintids.hxx> #include <tools/date.hxx> #include <tools/time.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #ifndef SVTOOLS_FSTATHELPER_HXX -#include <svtools/fstathelper.hxx> +#include <svl/fstathelper.hxx> #endif -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #include <sfx2/docfile.hxx> #include <svx/lrspitem.hxx> #include <svx/ulspitem.hxx> @@ -158,7 +158,7 @@ ULONG SwReader::Read( const Reader& rOptions ) SwNodeIndex aSplitIdx( pDoc->GetNodes() ); RedlineMode_t eOld = pDoc->GetRedlineMode(); - pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE ); + RedlineMode_t ePostReadRedlineMode( nsRedlineMode_t::REDLINE_IGNORE ); // Array von FlyFormaten SwSpzFrmFmts aFlyFrmArr; @@ -170,6 +170,8 @@ ULONG SwReader::Read( const Reader& rOptions ) if( bSaveUndo ) pUndo = new SwUndoInsDoc( *pPam ); + pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE ); + SwPaM* pUndoPam = 0; if( bDocUndo || pCrsr ) { @@ -190,8 +192,15 @@ ULONG SwReader::Read( const Reader& rOptions ) xub_StrLen nEndCntnt = pCNd ? pCNd->Len() - nSttCntnt : 0; SwNodeIndex aEndPos( pPam->GetPoint()->nNode, 1 ); + pDoc->SetRedlineMode_intern( eOld ); + nError = po->Read( *pDoc, GetBaseURL(), *pPam, aFileName ); + // an ODF document may contain redline mode in settings.xml; save it! + ePostReadRedlineMode = pDoc->GetRedlineMode(); + + pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE ); + if( !IsError( nError )) // dann setzen wir das Ende mal richtig { aEndPos--; @@ -230,13 +239,27 @@ ULONG SwReader::Read( const Reader& rOptions ) const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor(); if( USHRT_MAX == aFlyFrmArr.GetPos( pFrmFmt) ) { - if( FLY_PAGE == rAnchor.GetAnchorId() || - ( FLY_AT_CNTNT == rAnchor.GetAnchorId() && - rAnchor.GetCntntAnchor() && - ( pUndoPam->GetPoint()->nNode == - rAnchor.GetCntntAnchor()->nNode || - pUndoPam->GetMark()->nNode == - rAnchor.GetCntntAnchor()->nNode ) ) ) + SwPosition const*const pFrameAnchor( + rAnchor.GetCntntAnchor()); + if ( (FLY_PAGE == rAnchor.GetAnchorId()) + || ( pFrameAnchor + && ( ( (FLY_AT_CNTNT == rAnchor.GetAnchorId()) + && ( (pUndoPam->GetPoint()->nNode == + pFrameAnchor->nNode) + || (pUndoPam->GetMark()->nNode == + pFrameAnchor->nNode) + ) + ) + // #i97570# also check frames anchored AT char + || ( (FLY_AUTO_CNTNT == rAnchor.GetAnchorId()) + && !IsDestroyFrameAnchoredAtChar( + *pFrameAnchor, + *pUndoPam->GetPoint(), + *pUndoPam->GetMark()) + ) + ) + ) + ) { if( bChkHeaderFooter && FLY_AT_CNTNT == rAnchor.GetAnchorId() && @@ -351,7 +374,9 @@ ULONG SwReader::Read( const Reader& rOptions ) pDoc->UpdateLinks( TRUE ); // <-- - eOld = (RedlineMode_t)(pDoc->GetRedlineMode() & ~nsRedlineMode_t::REDLINE_IGNORE); + // not insert: set the redline mode read from settings.xml + eOld = static_cast<RedlineMode_t>( + ePostReadRedlineMode & ~nsRedlineMode_t::REDLINE_IGNORE); pDoc->SetFieldsDirty(false, NULL, 0); } diff --git a/sw/source/filter/html/SwAppletImpl.cxx b/sw/source/filter/html/SwAppletImpl.cxx index 25b071ed6d..ab82fd2bd1 100644 --- a/sw/source/filter/html/SwAppletImpl.cxx +++ b/sw/source/filter/html/SwAppletImpl.cxx @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" #include <SwAppletImpl.hxx> #include <svtools/htmlkywd.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/embed/EmbedStates.hpp> diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 38f82babb9..4bb446e1f4 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -38,7 +38,7 @@ #ifndef _WRKWIN_HXX //autogen #include <vcl/wrkwin.hxx> #endif -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <svx/boxitem.hxx> #include <svx/ulspitem.hxx> #include <svx/udlnitem.hxx> @@ -67,7 +67,7 @@ #include <svtools/htmlout.hxx> #include <svtools/htmlkywd.hxx> #include <svx/htmlmode.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <tools/urlobj.hxx> #include <tools/bigint.hxx> #include <unotools/charclass.hxx> diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 45e5ce7e55..3962ac7469 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -43,12 +43,12 @@ #if !defined _SVSTDARR_XUB_STRLEN_DECL || !defined _SVSTDARR_USHORTS_DECL #define _SVSTDARR_XUB_STRLEN #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <svtools/htmlout.hxx> #include <svtools/htmlkywd.hxx> #include <svtools/htmltokn.h> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <svx/htmlmode.hxx> #include <svx/escpitem.hxx> #include <svx/brkitem.hxx> diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 1eab2c7fbc..7bec01cd7c 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -37,7 +37,7 @@ #include <sfx2/sfx.hrc> #define _SVSTDARR_STRINGSSORTDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <basic/sbx.hxx> #include <basic/basmgr.hxx> #include <basic/sbmod.hxx> diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index ea7c9f0ff9..62ae86f551 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -34,9 +34,9 @@ #include "hintids.hxx" -#include <svtools/itemiter.hxx> -#include <svtools/whiter.hxx> -#include <svtools/urihelper.hxx> +#include <svl/itemiter.hxx> +#include <svl/whiter.hxx> +#include <svl/urihelper.hxx> #include <i18npool/mslangid.hxx> #include <sfx2/docfile.hxx> #ifndef _APP_HXX //autogen diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx index f23e852d09..bfde0b1db2 100644 --- a/sw/source/filter/html/htmlctxt.cxx +++ b/sw/source/filter/html/htmlctxt.cxx @@ -33,7 +33,7 @@ #include "hintids.hxx" -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svx/lrspitem.hxx> #include <svx/ulspitem.hxx> #include <svx/brshitem.hxx> diff --git a/sw/source/filter/html/htmldraw.cxx b/sw/source/filter/html/htmldraw.cxx index e31acbabc0..0b44d5d790 100644 --- a/sw/source/filter/html/htmldraw.cxx +++ b/sw/source/filter/html/htmldraw.cxx @@ -52,8 +52,8 @@ #include <svx/brshitem.hxx> #include <svx/lrspitem.hxx> #include <svx/ulspitem.hxx> -#include <svtools/itemiter.hxx> -#include <svtools/whiter.hxx> +#include <svl/itemiter.hxx> +#include <svl/whiter.hxx> #include <svtools/htmlout.hxx> #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 0017b15db7..ec07acdfa0 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,8 +38,8 @@ #include "docsh.hxx" #include <svtools/htmltokn.h> -#include <svtools/zformat.hxx> -#include <svtools/useroptions.hxx> +#include <svl/zformat.hxx> +#include <unotools/useroptions.hxx> #include <fmtfld.hxx> #include <ndtxt.hxx> #include <doc.hxx> diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx index 880009e3a9..b53df3f464 100644 --- a/sw/source/filter/html/htmlfly.cxx +++ b/sw/source/filter/html/htmlfly.cxx @@ -38,7 +38,7 @@ #include "hintids.hxx" #include <tools/string.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #ifndef _APP_HXX #include <vcl/svapp.hxx> #endif diff --git a/sw/source/filter/html/htmlfly.hxx b/sw/source/filter/html/htmlfly.hxx index 5d4d86f648..fef71ea0b5 100644 --- a/sw/source/filter/html/htmlfly.hxx +++ b/sw/source/filter/html/htmlfly.hxx @@ -35,7 +35,7 @@ #include <tools/string.hxx> #ifndef _SVARRAY_H -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #endif class SdrObject; diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 7a0449db96..35ab4d5ef4 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -44,7 +44,7 @@ #endif #include <svtools/htmlkywd.hxx> #include <svtools/htmltokn.h> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <sfx2/request.hxx> #include <sfx2/docfile.hxx> #ifndef _SFXAPP_HXX diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 972a3f6246..07b3c78d85 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -48,12 +48,12 @@ #ifndef _WRKWIN_HXX //autogen #include <vcl/wrkwin.hxx> #endif -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include <tools/urlobj.hxx> #include <svtools/htmlout.hxx> #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> -#include "svtools/urihelper.hxx" +#include "svl/urihelper.hxx" #ifndef _TOOLKIT_UNOHLP_HXX #include <toolkit/helper/vclunohelper.hxx> #endif diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx index eb306d979c..e0051c67f3 100644 --- a/sw/source/filter/html/htmlftn.cxx +++ b/sw/source/filter/html/htmlftn.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -354,7 +354,7 @@ void SwHTMLWriter::OutFootEndNotes() if( !pFootEndNotes ) return; -#ifndef PRODUCT +#ifdef DBG_UTIL USHORT nFtn = nFootNote, nEn = nEndNote; #endif nFootNote = 0, nEndNote = 0; @@ -419,7 +419,7 @@ void SwHTMLWriter::OutFootEndNotes() } } -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( nFtn == nFootNote, "SwHTMLWriter::OutFootEndNotes: Anzahl Fussnoten stimmt nicht" ); ASSERT( nEn == nEndNote, diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 688ed149a5..e1a3141de0 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -37,8 +37,8 @@ #include <vcl/wrkwin.hxx> #endif #include <i18npool/mslangid.hxx> -#include <svtools/stritem.hxx> -#include <svtools/urihelper.hxx> +#include <svl/stritem.hxx> +#include <svl/urihelper.hxx> #include <svx/fhgtitem.hxx> #include <svx/lrspitem.hxx> #include <svx/adjitem.hxx> @@ -53,7 +53,7 @@ #include <svtools/imap.hxx> #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> -#include <svtools/eventcfg.hxx> +#include <unotools/eventcfg.hxx> #include <fmtornt.hxx> #include <fmturl.hxx> diff --git a/sw/source/filter/html/htmlnum.cxx b/sw/source/filter/html/htmlnum.cxx index 0499cfd863..bd70ff6d9c 100644 --- a/sw/source/filter/html/htmlnum.cxx +++ b/sw/source/filter/html/htmlnum.cxx @@ -37,7 +37,7 @@ #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> #include <svtools/htmlout.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <svx/brshitem.hxx> #include <svx/lrspitem.hxx> #include <vcl/svapp.hxx> diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 27852b37ab..125cce095a 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -36,9 +36,9 @@ #include "hintids.hxx" -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <vcl/svapp.hxx> #include <sfx2/frmhtml.hxx> #include <sfx2/frmhtmlw.hxx> @@ -59,7 +59,7 @@ #include <fmtcntnt.hxx> #include <frmfmt.hxx> -#include <svtools/ownlist.hxx> +#include <svl/ownlist.hxx> #include "pam.hxx" #include "doc.hxx" #include "ndtxt.hxx" diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index 293a7f8a64..e8ed0babd7 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -72,7 +72,7 @@ #include "viewsh.hxx" #include "swcss1.hxx" #include "swhtml.hxx" -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #define CONTEXT_FLAGS_MULTICOL (HTML_CNTXT_STRIP_PARA | \ HTML_CNTXT_KEEP_NUMRULE | \ diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 90489ff312..c4f47c68a9 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -48,7 +48,7 @@ #include <svx/spltitem.hxx> #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <fmtornt.hxx> @@ -912,7 +912,7 @@ void HTMLTableRow::Shrink( sal_uInt16 nCells ) { ASSERT( nCells < pCells->Count(), "Anzahl Zellen falsch" ); -#ifndef PRODUCT +#ifdef DBG_UTIL sal_uInt16 nEnd = pCells->Count(); #endif // The colspan of empty cells at the end has to be fixed to the new @@ -930,7 +930,7 @@ void HTMLTableRow::Shrink( sal_uInt16 nCells ) else break; } -#ifndef PRODUCT +#ifdef DBG_UTIL for( i=nCells; i<nEnd; i++ ) { HTMLTableCell *pCell = (*pCells)[i]; @@ -1790,7 +1790,7 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper, HTMLTableCell *pCell = GetCell(nTopRow,nCol); const sal_Bool bSplit = 1 == pCell->GetColSpan(); -#ifndef PRODUCT +#ifdef DBG_UTIL if( nCol == nRightCol-1 ) { ASSERT( bSplit, "Split-Flag falsch" ); @@ -3394,7 +3394,7 @@ void _CellSaveStruct::AddContents( HTMLTableCnts *pNewCnts ) void _CellSaveStruct::InsertCell( SwHTMLParser& rParser, HTMLTable *pCurTable ) { -#ifndef PRODUCT +#ifdef DBG_UTIL // Die Attribute muessen schon beim Auefrauemen des Kontext-Stacks // entfernt worden sein, sonst ist etwas schiefgelaufen. Das // Checken wir mal eben ... diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index d0d16334d8..38f8680372 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -67,7 +67,7 @@ #include <htmlnum.hxx> #include <wrthtml.hxx> #include <wrtswtbl.hxx> -#ifndef PRODUCT +#ifdef DBG_UTIL #ifndef _VIEWSH_HXX #include <viewsh.hxx> #endif @@ -1200,7 +1200,7 @@ Writer& OutHTML_SwTblNode( Writer& rWrt, SwTableNode & rNode, const SwHTMLTableLayout *pLayout = rTbl.GetHTMLTableLayout(); -#ifndef PRODUCT +#ifdef DBG_UTIL ViewShell *pSh; rWrt.pDoc->GetEditShell( &pSh ); if ( pSh && pSh->GetViewOptions()->IsTest1() ) diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index bda9ee26e0..d2f40c1253 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -39,7 +39,7 @@ #endif #include <i18npool/mslangid.hxx> #include <svtools/ctrltool.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <svx/udlnitem.hxx> #include <svx/adjitem.hxx> #include <svx/blnkitem.hxx> @@ -57,7 +57,7 @@ #include <svx/ulspitem.hxx> #include <svx/lrspitem.hxx> #include <svx/langitem.hxx> -#include <svtools/itempool.hxx> +#include <svl/itempool.hxx> #include <svx/spltitem.hxx> #include <svx/widwitem.hxx> #include <svx/frmdiritem.hxx> diff --git a/sw/source/filter/html/svxcss1.hxx b/sw/source/filter/html/svxcss1.hxx index 36ed19fc3a..c24b07bda4 100644 --- a/sw/source/filter/html/svxcss1.hxx +++ b/sw/source/filter/html/svxcss1.hxx @@ -31,12 +31,12 @@ #define _SVXCSS1_HXX #include <tools/string.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <svx/svxenum.hxx> #ifndef _SVSTDARR_HXX #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <rtl/textenc.h> #include "parcss1.hxx" diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index a883fa4207..ae4a704777 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -36,19 +36,19 @@ #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/i18n/ScriptType.hpp> -#ifndef PRODUCT +#ifdef DBG_UTIL #include <stdlib.h> #endif #include <hintids.hxx> #define _SVSTDARR_STRINGS -#include <svtools/svstdarr.hxx> -#include <svtools/stritem.hxx> +#include <svl/svstdarr.hxx> +#include <svl/stritem.hxx> #include <svtools/imap.hxx> #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> #include <svtools/ctrltool.hxx> -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <sfx2/fcontnr.hxx> @@ -307,7 +307,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn, // <-- nOpenParaToken( 0 ), eJumpTo( JUMPTO_NONE ), -#ifndef PRODUCT +#ifdef DBG_UTIL nContinue( 0 ), #endif eParaAdjust( SVX_ADJUST_END ), @@ -437,7 +437,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn, __EXPORT SwHTMLParser::~SwHTMLParser() { -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( !nContinue, "DTOR im Continue - Das geht schief!!!" ); #endif BOOL bAsync = pDoc->IsInLoadAsynchron(); @@ -588,7 +588,7 @@ SvParserState __EXPORT SwHTMLParser::CallParser() void __EXPORT SwHTMLParser::Continue( int nToken ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( !nContinue, "Continue im Continue - Das sollte doch nicht sein, oder?" ); nContinue++; #endif @@ -603,7 +603,7 @@ void __EXPORT SwHTMLParser::Continue( int nToken ) // Die ViewShell vom Dokument holen, merken und als aktuelle setzen. ViewShell *pInitVSh = CallStartAction(); - + if( SVPAR_ERROR != eState && GetMedium() && !bViewCreated ) { // Beim ersten Aufruf erstmal returnen, Doc anzeigen @@ -614,7 +614,7 @@ void __EXPORT SwHTMLParser::Continue( int nToken ) bViewCreated = TRUE; pDoc->SetInLoadAsynchron( TRUE ); -#ifndef PRODUCT +#ifdef DBG_UTIL nContinue--; #endif @@ -724,7 +724,7 @@ void __EXPORT SwHTMLParser::Continue( int nToken ) pPam->GetPoint()->nContent.Assign( pTxtNode, nStt ); } -#ifndef PRODUCT +#ifdef DBG_UTIL // !!! sollte nicht moeglich sein, oder ?? ASSERT( pSttNdIdx->GetIndex()+1 != pPam->GetBound( TRUE ).nNode.GetIndex(), "Pam.Bound1 steht noch im Node" ); @@ -922,7 +922,7 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( FALSE ).nNode.GetIndex() ) // wieder rekonstruieren. CallEndAction( TRUE ); -#ifndef PRODUCT +#ifdef DBG_UTIL nContinue--; #endif } @@ -977,7 +977,7 @@ void __EXPORT SwHTMLParser::NextToken( int nToken ) return ; } -#ifndef PRODUCT +#ifdef DBG_UTIL if( pPendStack ) { switch( nToken ) @@ -2471,12 +2471,12 @@ ViewShell *SwHTMLParser::CallStartAction( ViewShell *pVSh, BOOL bChkPtr ) if( !pVSh || bChkPtr ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ViewShell *pOldVSh = pVSh; #endif pDoc->GetEditShell( &pVSh ); ASSERT( !pVSh || !pOldVSh || pOldVSh == pVSh, "CallStartAction: Wer hat die ViewShell ausgetauscht?" ); -#ifndef PRODUCT +#ifdef DBG_UTIL if( pOldVSh && !pVSh ) pVSh = 0; #endif @@ -2757,7 +2757,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable, switch( nWhich ) { - case RES_FLTR_BOOKMARK: // insert bookmark + case RES_FLTR_BOOKMARK: // insert bookmark { const String sName( ((SfxStringItem*)pAttr->pItem)->GetValue() ); IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); @@ -2771,7 +2771,7 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable, sName, IDocumentMarkAccess::BOOKMARK ); - // jump to bookmark + // jump to bookmark if( JUMPTO_MARK == eJumpTo && pNewMark->GetName() == ::rtl::OUString(sJmpMark) ) { bChkJumpMark = TRUE; @@ -3882,7 +3882,7 @@ void SwHTMLParser::EndPara( BOOL bReal ) { if( HTML_LI_ON==nOpenParaToken && pTable ) { -#ifndef PRODUCT +#ifdef DBG_UTIL const SwNumRule *pNumRule = pPam->GetNode()->GetTxtNode()->GetNumRule(); #endif ASSERT( pNumRule, "Wo ist die Numrule geblieben" ); diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 9ba812b62e..bb89c877dc 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,11 +44,11 @@ #ifndef _SVSTDARR_STRINGSDTOR_DECL #define _SVSTDARR_STRINGSDTOR #endif -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <tools/urlobj.hxx> #include <sfx2/sfxhtml.hxx> -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include <svx/svxenum.hxx> #include <fmtornt.hxx> #include <com/sun/star/drawing/XShape.hpp> @@ -453,7 +453,7 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient enum JumpToMarks { JUMPTO_NONE, JUMPTO_MARK, JUMPTO_TABLE, JUMPTO_FRAME, JUMPTO_REGION, JUMPTO_GRAPHIC } eJumpTo; -#ifndef PRODUCT +#ifdef DBG_UTIL sal_uInt16 nContinue; // Tiefe der Continue-Aufrufe #endif diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 26e150ad1a..1a74d5a129 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -34,7 +34,7 @@ #include <stdlib.h> #include <hintids.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <rtl/tencinfo.h> #include <vcl/wrkwin.hxx> #include <sfx2/linkmgr.hxx> @@ -51,7 +51,7 @@ #include <svx/fontitem.hxx> #include <svx/scripttypeitem.hxx> #include <svx/langitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <svx/frmdiritem.hxx> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 477dd11dd5..d3f112ed8b 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -37,7 +37,7 @@ #define _SVSTDARR_STRINGSDTOR #define _SVSTDARR_STRINGSSORTDTOR #define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <i18npool/lang.h> #include <tools/stream.hxx> diff --git a/sw/source/filter/inc/fltglbls.hxx b/sw/source/filter/inc/fltglbls.hxx index 9b5c349179..328a857f21 100644 --- a/sw/source/filter/inc/fltglbls.hxx +++ b/sw/source/filter/inc/fltglbls.hxx @@ -32,7 +32,7 @@ #include <tools/string.hxx> #include <i18npool/lang.h> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> class SfxPoolItem; diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx index f7688da6ec..64c12c2840 100644 --- a/sw/source/filter/inc/msfilter.hxx +++ b/sw/source/filter/inc/msfilter.hxx @@ -45,7 +45,7 @@ #include <fltshell.hxx> // fuer den Attribut Stack #include <redline.hxx> #include <shellio.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #define CREATE_CONST_ASC(s) String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM(s)) diff --git a/sw/source/filter/inc/wrtswtbl.hxx b/sw/source/filter/inc/wrtswtbl.hxx index 7edf77ba37..7797d227bf 100644 --- a/sw/source/filter/inc/wrtswtbl.hxx +++ b/sw/source/filter/inc/wrtswtbl.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -32,7 +32,7 @@ #include <tools/solar.h> #include <tools/color.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <swdllapi.h> @@ -262,7 +262,7 @@ protected: BOOL bRelWidths : 1; // Breiten relativ ausgeben? BOOL bUseLayoutHeights : 1; // Layout zur Hoehenbestimmung nehmen? -#ifndef PRODUCT +#ifdef DBG_UTIL BOOL bGetLineHeightCalled : 1; #endif diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx index 9b97984126..c7688b089b 100644 --- a/sw/source/filter/rtf/rtfatr.cxx +++ b/sw/source/filter/rtf/rtfatr.cxx @@ -42,12 +42,12 @@ #include <com/sun/star/i18n/ScriptType.hdl> #endif #include <vcl/cvtgrf.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/stritem.hxx> +#include <svl/urihelper.hxx> +#include <svl/stritem.hxx> #include <svtools/rtfkeywd.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <svtools/rtfout.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svx/fontitem.hxx> #include <svx/hyznitem.hxx> #ifndef _SVX_TSTPITEM_HXX //autogen diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx index d891d53fd2..d273a129ca 100644 --- a/sw/source/filter/rtf/rtffld.cxx +++ b/sw/source/filter/rtf/rtffld.cxx @@ -41,9 +41,9 @@ #ifndef _GRAPH_HXX //autogen #include <vcl/graph.hxx> #endif -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <svtools/rtftoken.h> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include <svx/fontitem.hxx> #include <svx/fhgtitem.hxx> #include <svx/langitem.hxx> diff --git a/sw/source/filter/rtf/rtffly.cxx b/sw/source/filter/rtf/rtffly.cxx index 706dc39b81..c761fe1cd9 100644 --- a/sw/source/filter/rtf/rtffly.cxx +++ b/sw/source/filter/rtf/rtffly.cxx @@ -35,7 +35,7 @@ #include <tools/list.hxx> #include <tools/cachestr.hxx> #include <svtools/rtftoken.h> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svx/prntitem.hxx> #include <svx/opaqitem.hxx> #include <svx/protitem.hxx> diff --git a/sw/source/filter/rtf/rtfnum.cxx b/sw/source/filter/rtf/rtfnum.cxx index df96878b38..85954250bf 100644 --- a/sw/source/filter/rtf/rtfnum.cxx +++ b/sw/source/filter/rtf/rtfnum.cxx @@ -34,7 +34,7 @@ #include <tools/stream.hxx> #include <svtools/rtftoken.h> #include <svtools/rtfkeywd.hxx> -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include <svtools/rtfout.hxx> #include <svx/lrspitem.hxx> #include <svx/fontitem.hxx> @@ -734,7 +734,7 @@ void SwRTFParser::RemoveUnusedNumRule( SwNumRule* pRule ) } pDoc->DelNumRule( pRule->GetName() ); } -#ifndef PRODUCT +#ifdef DBG_UTIL else { ASSERT( pRule, "NumRulePointer 0 kann nicht geloescht werden" ); diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index 0cac44fb90..b07a93f0bb 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -39,9 +39,9 @@ #include <tools/errinf.hxx> #endif #include <tools/stream.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svtools/rtftoken.h> -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include <svx/fhgtitem.hxx> #include <svx/ulspitem.hxx> #ifndef _SVX_TSTPITEM_HXX //autogen @@ -387,7 +387,7 @@ void SwRTFParser::Continue( int nToken ) pPam->GetPoint()->nContent.Assign( pTxtNode, nStt ); } -#ifndef PRODUCT +#ifdef DBG_UTIL // !!! sollte nicht moeglich sein, oder ?? ASSERT( pSttNdIdx->GetIndex()+1 != pPam->GetBound( TRUE ).nNode.GetIndex(), "Pam.Bound1 steht noch im Node" ); @@ -1061,7 +1061,7 @@ void rtfSections::InsertSegments(bool bNewDoc) namespace sw{ namespace util{ - + InsertedTableClient::InsertedTableClient(SwTableNode & rNode) { rNode.Add(this); @@ -1071,7 +1071,7 @@ SwTableNode * InsertedTableClient::GetTableNode() { return dynamic_cast<SwTableNode *> (pRegisteredIn); } - + InsertedTablesManager::InsertedTablesManager(const SwDoc &rDoc) : mbHasRoot(rDoc.GetRootFrm()) { @@ -1091,7 +1091,7 @@ void InsertedTablesManager::DelAndMakeTblFrms() if (pTable) { SwFrmFmt * pFrmFmt = pTable->GetTable().GetFrmFmt(); - + if (pFrmFmt != NULL) { SwNodeIndex *pIndex = aIter->second; @@ -1108,9 +1108,9 @@ void InsertedTablesManager::InsertTable(SwTableNode &rTableNode, SwPaM &rPaM) return; //Associate this tablenode with this after position, replace an //old //node association if necessary - + InsertedTableClient * pClient = new InsertedTableClient(rTableNode); - + maTables.insert(TblMap::value_type(pClient, &(rPaM.GetPoint()->nNode))); } } @@ -2214,7 +2214,7 @@ void SwRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) SwPaM aPam( *pPam->GetPoint() ); -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( nSNd <= nENd, "Start groesser als Ende" ); SwNode* pDebugNd = pDoc->GetNodes()[ nSNd ]; ASSERT( pDebugNd->IsCntntNode(), "Start kein ContentNode" ); @@ -2803,7 +2803,7 @@ void SwRTFParser::MakeStyleTab() for( USHORT n = rColls.Count(); n; ) //if( MAXLEVEL > (nLvl = rColls[ --n ]->GetOutlineLevel() ))//#outline level,zhaojianwei // nValidOutlineLevels |= 1 << nLvl; - if( rColls[ --n ]->IsAssignedToListLevelOfOutlineStyle()) + if( rColls[ --n ]->IsAssignedToListLevelOfOutlineStyle()) nValidOutlineLevels |= 1 << rColls[ n ]->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei } @@ -3983,7 +3983,7 @@ SwTxtFmtColl* SwRTFParser::MakeColl(const String& rName, USHORT nPos, { pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false ); //pColl->SetOutlineLevel( nOutlineLevel ); //#outline level,removed by zhaojianwei - if(nOutlineLevel < MAXLEVEL ) //->add by zhaojianwei + if(nOutlineLevel < MAXLEVEL ) //->add by zhaojianwei pColl->AssignToListLevelOfOutlineStyle( nOutlineLevel ); else pColl->DeleteAssignmentToListLevelOfOutlineStyle(); //<-end,zhaojianwei diff --git a/sw/source/filter/rtf/swparrtf.hxx b/sw/source/filter/rtf/swparrtf.hxx index 006c721698..77b7ed14a1 100644 --- a/sw/source/filter/rtf/swparrtf.hxx +++ b/sw/source/filter/rtf/swparrtf.hxx @@ -44,7 +44,7 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_BOOLS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <svx/svxrtf.hxx> #include <svx/numitem.hxx> diff --git a/sw/source/filter/rtf/wrtrtf.cxx b/sw/source/filter/rtf/wrtrtf.cxx index 7f2179d3ec..65828f6d53 100644 --- a/sw/source/filter/rtf/wrtrtf.cxx +++ b/sw/source/filter/rtf/wrtrtf.cxx @@ -36,7 +36,7 @@ #include <comphelper/string.hxx> #include <tools/stream.hxx> #include <tools/datetime.hxx> -#include <vcl/fontcvt.hxx> +#include <unotools/fontcvt.hxx> #include <rtl/tencinfo.h> #include <svtools/rtfkeywd.hxx> #include <svtools/rtfout.hxx> diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index e0a2067cfc..289b67670a 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -33,11 +33,11 @@ #include <hintids.hxx> #define _SVSTDARR_STRINGSSORTDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <sot/storage.hxx> #include <sfx2/docfile.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <svtools/filter.hxx> #include <svx/impgrf.hxx> #include <svx/fontitem.hxx> @@ -250,7 +250,7 @@ SwPaM* Writer::NewSwPaM( SwDoc & rDoc, ULONG nStartIdx, ULONG nEndIdx, ///////////////////////////////////////////////////////////////////////////// // Stream-spezifisches -#ifndef PRODUCT +#ifdef DBG_UTIL SvStream& Writer::Strm() { ASSERT( pStrm, "Oh-oh. Dies ist ein Storage-Writer. Gleich knallts!" ); diff --git a/sw/source/filter/writer/wrt_fn.cxx b/sw/source/filter/writer/wrt_fn.cxx index bac681a875..2b56c3c9e6 100644 --- a/sw/source/filter/writer/wrt_fn.cxx +++ b/sw/source/filter/writer/wrt_fn.cxx @@ -30,8 +30,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <svtools/itemiter.hxx> -#include <svtools/whiter.hxx> +#include <svl/itemiter.hxx> +#include <svl/whiter.hxx> #include "shellio.hxx" diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx index 01e0690d9c..ce6aed9876 100644 --- a/sw/source/filter/writer/wrtswtbl.cxx +++ b/sw/source/filter/writer/wrtswtbl.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -114,7 +114,7 @@ long SwWriteTable::GetBoxWidth( const SwTableBox *pBox ) long SwWriteTable::GetLineHeight( const SwTableLine *pLine ) { -#ifndef PRODUCT +#ifdef DBG_UTIL BOOL bOldGetLineHeightCalled = bGetLineHeightCalled; bGetLineHeightCalled = TRUE; #endif @@ -135,7 +135,7 @@ long SwWriteTable::GetLineHeight( const SwTableLine *pLine ) // <-- bUseLayoutHeights = bLayoutAvailable; /*FALSE;*/ -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( bLayoutAvailable || !bOldGetLineHeightCalled, "Layout ungueltig?" ); #endif } @@ -431,7 +431,7 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, BOOL bSubExpanded = FALSE; USHORT nLines = rLines.Count(); -#ifndef PRODUCT +#ifdef DBG_UTIL USHORT nEndCPos = 0; #endif @@ -467,11 +467,11 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, } else { -#ifndef PRODUCT +#ifdef DBG_UTIL long nCheckPos = nRPos + GetLineHeight( pLine ); #endif nRPos = nStartRPos + nParentLineHeight; -#ifndef PRODUCT +#ifdef DBG_UTIL SwWriteTableRow aRow( nStartRPos + nParentLineHeight, bUseLayoutHeights ); ASSERT( aRows.Seek_Entry(&aRow), "Parent-Zeile nicht gefunden" ); @@ -514,7 +514,7 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, } else { -#ifndef PRODUCT +#ifdef DBG_UTIL USHORT nCheckPos = nCPos + (USHORT)GetBoxWidth( pBox ); if( !nEndCPos ) { @@ -528,7 +528,7 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, } #endif nCPos = nStartCPos + nParentLineWidth; -#ifndef PRODUCT +#ifdef DBG_UTIL SwWriteTableCol aCol( nStartCPos + nParentLineWidth ); ASSERT( aCols.Seek_Entry(&aCol), "Parent-Zelle nicht gefunden" ); @@ -594,7 +594,7 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, USHORT nStartRow, // Und ihren Index USHORT nOldRow = nRow; SwWriteTableRow aRow( nRPos,bUseLayoutHeights ); -#ifndef PRODUCT +#ifdef DBG_UTIL BOOL bFound = #endif aRows.Seek_Entry( &aRow, &nRow ); @@ -679,7 +679,7 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, USHORT nStartRow, // Und ihren Index USHORT nOldCol = nCol; SwWriteTableCol aCol( nCPos ); -#ifndef PRODUCT +#ifdef DBG_UTIL BOOL bFound2 = #endif aCols.Seek_Entry( &aCol, &nCol ); @@ -776,7 +776,7 @@ SwWriteTable::SwWriteTable(const SwTableLines& rLines, long nWidth, nInnerBorder(0), nBaseWidth(nBWidth), nHeadEndRow(USHRT_MAX), nLeftSub(nLSub), nRightSub(nRSub), nTabWidth(nWidth), bRelWidths(bRel), bUseLayoutHeights(true), -#ifndef PRODUCT +#ifdef DBG_UTIL bGetLineHeightCalled(false), #endif bColsOption(false), bColTags(true), bLayoutExport(false), @@ -803,7 +803,7 @@ SwWriteTable::SwWriteTable( const SwHTMLTableLayout *pLayoutInfo ) nInnerBorder(0), nBaseWidth(pLayoutInfo->GetWidthOption()), nHeadEndRow(0), nLeftSub(0), nRightSub(0), nTabWidth(pLayoutInfo->GetWidthOption()), bRelWidths(pLayoutInfo->HasPrcWidthOption()), bUseLayoutHeights(false), -#ifndef PRODUCT +#ifdef DBG_UTIL bGetLineHeightCalled(false), #endif bColsOption(pLayoutInfo->HasColsOption()), diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index bf79021866..0e66638169 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -38,7 +38,7 @@ #ifndef _GRAPH_HXX //autogen #include <vcl/graph.hxx> #endif -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <svx/impgrf.hxx> #include <svx/boxitem.hxx> #include <svx/boxitem.hxx> @@ -47,7 +47,7 @@ #include <svx/cntritem.hxx> #include <svx/postitem.hxx> #include <svx/crsditem.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <unotools/charclass.hxx> #include <txtftn.hxx> #include <fmtpdsc.hxx> @@ -1685,7 +1685,7 @@ SfxItemSet* SwFltOutBase::NewFlyDefaults() BOOL SwFltOutBase::BeginFly( RndStdIds eAnchor /*= FLY_AT_CNTNT*/, BOOL bAbsolutePos /*= FALSE*/, const SfxItemSet* -#ifndef PRODUCT +#ifdef DBG_UTIL pMoreAttrs /*= 0*/ #endif ) diff --git a/sw/source/filter/ww1/w1class.cxx b/sw/source/filter/ww1/w1class.cxx index 7fb33d4529..a137ca479f 100644 --- a/sw/source/filter/ww1/w1class.cxx +++ b/sw/source/filter/ww1/w1class.cxx @@ -257,7 +257,7 @@ Ww1StyleSheet::Ww1StyleSheet(Ww1Fib& _rFib) DBG_ASSERT(cbStshf==0, "Ww1StyleSheet"); bOK = cbStshf == 0; } - delete del; + delete [] del; } USHORT Ww1StyleSheet::ReadNames( BYTE*& p, USHORT& rnCountBytes ) diff --git a/sw/source/filter/ww1/w1filter.cxx b/sw/source/filter/ww1/w1filter.cxx index 60cc3b95e3..b932a49c18 100644 --- a/sw/source/filter/ww1/w1filter.cxx +++ b/sw/source/filter/ww1/w1filter.cxx @@ -58,7 +58,7 @@ #ifndef _SVX_TSTPITEM_HXX //autogen #include <svx/tstpitem.hxx> #endif -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <fmtfsize.hxx> #include <doc.hxx> #include <pam.hxx> @@ -1899,11 +1899,11 @@ void Ww1Picture::WriteBmp(SvStream& rOut) nSize -= sizeof(BYTE); } if(rOut.Write(pBuf, padx) != padx){ - delete pBuf; + delete [] pBuf; goto error; } } - delete pBuf; + delete [] pBuf; } #else for (j=0;nSize>0&&j<maxy;j++) diff --git a/sw/source/filter/ww1/w1sprm.cxx b/sw/source/filter/ww1/w1sprm.cxx index 8d3c5701b9..a90dd0fe2f 100644 --- a/sw/source/filter/ww1/w1sprm.cxx +++ b/sw/source/filter/ww1/w1sprm.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -267,7 +267,7 @@ void Ww1SingleSprmPBrc::Start( Ww1Shell& rOut, BYTE, W1_BRC10* pBrc, USHORT -#ifndef PRODUCT +#ifdef DBG_UTIL nSize #endif , @@ -467,7 +467,7 @@ void Ww1SingleSprmPFInTable::Start( void Ww1SingleSprmPFInTable::Stop( Ww1Shell& -#ifndef PRODUCT +#ifdef DBG_UTIL rOut #endif , diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index 022b3d045b..965d997955 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -161,7 +161,8 @@ WW8TableNodeInfo::WW8TableNodeInfo(const SwNode * pNode) : mnDepth(0), mpNode(pNode), - mpNext(NULL) + mpNext(NULL), + mpNextNode(NULL) { } @@ -190,9 +191,7 @@ WW8TableNodeInfo::~WW8TableNodeInfo() } #ifdef DEBUG -//!! does not compile with debug=t -> unresolved external (dbg_out), -//!! sommeone who knows what he wants to get should fix this -// sResult += dbg_out(*mpNode); + sResult += dbg_out(*mpNode); #endif sResult +="</tableNodeInfo>"; @@ -247,6 +246,17 @@ void WW8TableNodeInfo::setTable(const SwTable * pTable) void WW8TableNodeInfo::setNext(WW8TableNodeInfo * pNext) { mpNext = pNext; + +#ifdef DEBUG + ::std::clog << "<setnext><from>" << toString() << "</from><to>" + << pNext->toString() << "</to></setnext>" + << ::std::endl; +#endif +} + +void WW8TableNodeInfo::setNextNode(SwNode * pNode) +{ + mpNode = pNode; } void WW8TableNodeInfo::setCell(sal_uInt32 nCell) @@ -287,6 +297,11 @@ WW8TableNodeInfo * WW8TableNodeInfo::getNext() const return mpNext; } +SwNode * WW8TableNodeInfo::getNextNode() const +{ + return mpNextNode; +} + bool WW8TableNodeInfo::isEndOfLine() const { return getInnerForDepth(mnDepth)->isEndOfLine(); @@ -362,6 +377,14 @@ void WW8TableInfo::processSwTable(const SwTable * pTable) pPrev = processTableLine(pTable, pLine, n, 1, pPrev); } + if (pPrev != NULL) + { + SwTableNode * pTableNode = pTable->GetTableNode(); + SwEndNode * pEndNode = pTableNode->EndOfSectionNode(); + + pPrev->setNextNode(pEndNode); + } + #ifdef DEBUG ::std::clog << "</processSwTable>" << ::std::endl; #endif @@ -602,6 +625,13 @@ const SwNode * WW8TableInfo::getNextNode(const SwNode * pNode) if (pNextInfo != NULL) pResult = pNextInfo->getNode(); + else + { + SwNode * pNextNode = pNodeInfo->getNextNode(); + + if (pNextNode != NULL) + pResult = pNextNode; + } } return pResult; diff --git a/sw/source/filter/ww8/WW8TableInfo.hxx b/sw/source/filter/ww8/WW8TableInfo.hxx index b5eee16dd6..0db4637465 100644 --- a/sw/source/filter/ww8/WW8TableInfo.hxx +++ b/sw/source/filter/ww8/WW8TableInfo.hxx @@ -97,6 +97,7 @@ private: const SwNode * mpNode; Inners_t mInners; WW8TableNodeInfo * mpNext; + SwNode * mpNextNode; public: typedef boost::shared_ptr<WW8TableNodeInfo> Pointer_t; @@ -112,6 +113,7 @@ public: void setCell(sal_uInt32 nCell); void setRow(sal_uInt32 nRow); void setNext(WW8TableNodeInfo * pNext); + void setNextNode(SwNode * pNode); sal_uInt32 getDepth() const; bool isEndOfLine() const; @@ -120,6 +122,7 @@ public: const SwTableBox * getTableBox() const; const SwTable * getTable() const; WW8TableNodeInfo * getNext() const; + SwNode * getNextNode() const; const Inners_t & getInners() const; const WW8TableNodeInfoInner::Pointer_t getFirstInner() const; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 44a5c329a5..9480f67382 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -44,7 +44,7 @@ #include <hintids.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <svx/fontitem.hxx> #include <svx/tstpitem.hxx> diff --git a/sw/source/filter/ww8/dump/ww8scan.hxx b/sw/source/filter/ww8/dump/ww8scan.hxx index abec5069e7..e24f3a85b7 100644 --- a/sw/source/filter/ww8/dump/ww8scan.hxx +++ b/sw/source/filter/ww8/dump/ww8scan.hxx @@ -48,7 +48,7 @@ #define _SVSTDARR_STRINGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #ifndef WW8STRUC_HXX #include <ww8struc.hxx> // FIB, STSHI, STD diff --git a/sw/source/filter/ww8/escher.hxx b/sw/source/filter/ww8/escher.hxx index 6cd2f9b280..86c0357793 100644 --- a/sw/source/filter/ww8/escher.hxx +++ b/sw/source/filter/ww8/escher.hxx @@ -34,7 +34,7 @@ #define _ESCHER_HXX #ifndef _ESCHEREX_HXX -#include <svx/escherex.hxx> +#include <filter/msfilter/escherex.hxx> #endif const sal_uInt32 nInlineHack = 0x00010001; diff --git a/sw/source/filter/ww8/tracer.cxx b/sw/source/filter/ww8/tracer.cxx index 7e1e48b1f9..a8541139ef 100644 --- a/sw/source/filter/ww8/tracer.cxx +++ b/sw/source/filter/ww8/tracer.cxx @@ -34,7 +34,7 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ #include <tools/urlobj.hxx> //INetURLObject #include <sfx2/docfile.hxx> //SfxMedium -#include <svx/msfiltertracer.hxx> //MSFilterTracer +#include <filter/msfilter/msfiltertracer.hxx> //MSFilterTracer #include "tracer.hxx" //sw::log::Tracer using rtl::OUString; diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index 861587ff6e..8b6a98eca8 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -42,7 +42,7 @@ #include <algorithm> //std::swap #include <functional> //std::binary_function -# include <svtools/itemiter.hxx> //SfxItemIter +# include <svl/itemiter.hxx> //SfxItemIter # include <svx/svdobj.hxx> //SdrObject # include <svx/svdoole2.hxx> //SdrOle2Obj # include <svx/fmglob.hxx> //FmFormInventor diff --git a/sw/source/filter/ww8/writerhelper.hxx b/sw/source/filter/ww8/writerhelper.hxx index 18e73b1e2d..68a474b227 100644 --- a/sw/source/filter/ww8/writerhelper.hxx +++ b/sw/source/filter/ww8/writerhelper.hxx @@ -40,8 +40,8 @@ #include <sfx2/objsh.hxx> #include "types.hxx" -#include <svtools/itempool.hxx> //SfxItemPool -#include <svtools/itemset.hxx> //SfxItemSet +#include <svl/itempool.hxx> //SfxItemPool +#include <svl/itemset.hxx> //SfxItemSet #include <format.hxx> //SwFmt #include <node.hxx> //SwCntntNode #include <pam.hxx> //SwPaM diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index 8c77c6a3c7..071bc6dce1 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -48,7 +48,7 @@ #endif #ifndef SV_FONTCVT_HXX -# include <vcl/fontcvt.hxx> //GetSubsFontName +# include <unotools/fontcvt.hxx> //GetSubsFontName #endif # include <svx/paperinf.hxx> //lA0Width... # include <svx/lrspitem.hxx> //SvxLRSpaceItem diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index a23f68f813..b05a763210 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1,6 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * * * Copyright 2008 by Sun Microsystems, Inc. * @@ -38,14 +39,14 @@ #define _SVSTDARR_ULONGSSORT #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <vcl/cvtgrf.hxx> #include <vcl/virdev.hxx> #include <com/sun/star/drawing/XShape.hpp> #include <vcl/svapp.hxx> #include <sot/storage.hxx> #include <svtools/filter.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svx/svdobj.hxx> #include <svx/svdotext.hxx> #include <svx/svdmodel.hxx> @@ -204,9 +205,9 @@ void WW8Export::DoComboBox(const rtl::OUString &rName, // write the refence to the "picture" structure ULONG nDataStt = pDataStrm->Tell(); pChpPlc->AppendFkpEntry( Strm().Tell() ); - + WriteChar( 0x01 ); - + static BYTE aArr1[] = { 0x03, 0x6a, 0,0,0,0, // sprmCPicLocation @@ -216,29 +217,29 @@ void WW8Export::DoComboBox(const rtl::OUString &rName, }; BYTE* pDataAdr = aArr1 + 2; Set_UInt32( pDataAdr, nDataStt ); - + pChpPlc->AppendFkpEntry(Strm().Tell(), sizeof(aArr1), aArr1); - + OutputField(0, ww::eFORMDROPDOWN, FieldString(ww::eFORMDROPDOWN), WRITEFIELD_CLOSE); - + ::sw::WW8FFData aFFData; - - aFFData.setType(2); + + aFFData.setType(2); aFFData.setName(rName); aFFData.setHelp(rHelp); aFFData.setStatus(rToolTip); - + sal_uInt32 nListItems = rListItems.getLength(); - + for (sal_uInt32 i = 0; i < nListItems; i++) { if (i < 0x20 && rSelected == rListItems[i]) aFFData.setResult(::sal::static_int_cast<sal_uInt8>(i)); aFFData.addListboxEntry(rListItems[i]); } - - aFFData.Write(pDataStrm); + + aFFData.Write(pDataStrm); } void WW8Export::DoCheckBox(uno::Reference<beans::XPropertySet> xPropSet) @@ -265,12 +266,12 @@ void WW8Export::DoCheckBox(uno::Reference<beans::XPropertySet> xPropSet) pChpPlc->AppendFkpEntry(Strm().Tell(), sizeof( aArr1 ), aArr1 ); - + ::sw::WW8FFData aFFData; - + aFFData.setType(1); aFFData.setCheckboxHeight(0x14); - + sal_Int16 nTemp = 0; xPropSet->getPropertyValue(C2U("DefaultState")) >>= nTemp; sal_uInt32 nIsDefaultChecked(nTemp); @@ -292,7 +293,7 @@ void WW8Export::DoCheckBox(uno::Reference<beans::XPropertySet> xPropSet) ASSERT(!this, "how did that happen"); } } - + ::rtl::OUString aStr; static ::rtl::OUString sName(C2U("Name")); if (xPropSetInfo->hasPropertyByName(sName)) @@ -342,7 +343,7 @@ void WW8Export::DoFormText(const SwInputField * pFld) sizeof( aArr1 ), aArr1 ); ::sw::WW8FFData aFFData; - + aFFData.setType(0); aFFData.setName(pFld->GetPar2()); aFFData.setHelp(pFld->GetHelp()); @@ -2018,7 +2019,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) if (bSwapInPage) (const_cast<SdrObject*>(pSdrObj))->SetPage(0); } -#ifndef PRODUCT +#ifdef DBG_UTIL else ASSERT( !this, "Where is the SDR-Object?" ); #endif diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 7ef0640ed1..a9b5351f79 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -53,8 +53,8 @@ #include <svx/brkitem.hxx> #include <svx/frmdiritem.hxx> #include <svx/tstpitem.hxx> -#include "svtools/urihelper.hxx" -#include <svtools/whiter.hxx> +#include "svl/urihelper.hxx" +#include <svl/whiter.hxx> #include <fmtpdsc.hxx> #include <fmtfsize.hxx> #include <fmtornt.hxx> diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index f945c0ad62..a650399f78 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -46,20 +46,20 @@ #include <docsh.hxx> #define _SVSTDARR_BOOLS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> -#include <svtools/fltrcfg.hxx> +#include <unotools/fltrcfg.hxx> #include <vcl/salbtype.hxx> #include <sot/storage.hxx> -#include <svtools/zformat.hxx> +#include <svl/zformat.hxx> #include <sfx2/docinf.hxx> #include <svx/tstpitem.hxx> #include <svx/svdmodel.hxx> #include <svx/svdpage.hxx> #include <svx/hyznitem.hxx> #include <svx/langitem.hxx> -#include <svx/msoleexp.hxx> -#include <svx/msocximex.hxx> +#include <filter/msfilter/msoleexp.hxx> +#include <filter/msfilter/msocximex.hxx> #include <svx/lrspitem.hxx> #include <svx/boxitem.hxx> #include <svx/brshitem.hxx> @@ -112,9 +112,10 @@ #include "dbgoutsw.hxx" #include <sfx2/docfile.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <unotools/tempfile.hxx> -#include <svx/mscodec.hxx> +#include <filter/msfilter/mscodec.hxx> +#include <filter/msfilter/svxmsbas.hxx> #include <osl/time.h> #include <rtl/random.h> #include "WW8Sttbf.hxx" @@ -741,7 +742,7 @@ ULONG SwWW8Writer::FillUntil( SvStream& rStrm, ULONG nEndPos ) if( nEndPos > nCurPos ) SwWW8Writer::FillCount( rStrm, nEndPos - nCurPos ); -#ifndef PRODUCT +#ifdef DBG_UTIL else ASSERT( nEndPos == nCurPos, "Falsches FillUntil()" ); #endif @@ -1606,7 +1607,7 @@ void SwWW8Writer::WriteString_xstz(SvStream& rStrm, const String& rStr, bool bAd ww::bytes aBytes; SwWW8Writer::InsUInt16(aBytes, rStr.Len()); SwWW8Writer::InsAsString16(aBytes, rStr); - if (bAddZero) + if (bAddZero) SwWW8Writer::InsUInt16(aBytes, 0); rStrm.Write(&aBytes[0], aBytes.size()); } @@ -1694,7 +1695,7 @@ void WW8Export::OutSwString(const String& rStr, xub_StrLen nStt, if( nStt || nLen != rStr.Len() ) { String sOut( rStr.Copy( nStt, nLen ) ); - + #ifdef DEBUG ::std::clog << ::rtl::OUStringToOString(sOut, RTL_TEXTENCODING_ASCII_US).getStr() << ::std::endl; #endif @@ -1704,7 +1705,7 @@ void WW8Export::OutSwString(const String& rStr, xub_StrLen nStt, else SwWW8Writer::WriteString8(Strm(), sOut, false, eChrSet); } - else + else { #ifdef DEBUG ::std::clog << ::rtl::OUStringToOString(rStr, RTL_TEXTENCODING_ASCII_US).getStr() << ::std::endl; @@ -1716,9 +1717,9 @@ void WW8Export::OutSwString(const String& rStr, xub_StrLen nStt, SwWW8Writer::WriteString8(Strm(), rStr, false, eChrSet); } } - + #ifdef DEBUG - ::std::clog << "</OutSwString>" << ::std::endl; + ::std::clog << "</OutSwString>" << ::std::endl; #endif } @@ -1728,7 +1729,7 @@ void WW8Export::WriteCR(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo WriteChar('\007'); else WriteChar( '\015' ); - + pPiece->SetParaBreak(); } @@ -1860,12 +1861,12 @@ void WW8AttributeOutput::TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pT if ( nDepth > 0 ) { - /* Cell */ + /* Cell */ m_rWW8Export.InsUInt16( NS_sprm::LN_PFInTable ); m_rWW8Export.pO->Insert( (BYTE)0x1, m_rWW8Export.pO->Count() ); m_rWW8Export.InsUInt16( NS_sprm::LN_PTableDepth ); m_rWW8Export.InsUInt32( nDepth ); - + if ( nDepth > 1 && pTableTextNodeInfoInner->isEndOfCell() ) { m_rWW8Export.InsUInt16( NS_sprm::LN_PCell ); @@ -1945,15 +1946,15 @@ static sal_uInt16 lcl_TCFlags(const SwTableBox * pBox) void WW8AttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) { const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); - const SwTableLine * pTabLine = pTabBox->GetUpper(); + const SwTableLine * pTabLine = pTabBox->GetUpper(); const SwTableBoxes & rTblBoxes = pTabLine->GetTabBoxes(); - + sal_uInt8 nBoxes = rTblBoxes.Count(); for ( sal_uInt8 n = 0; n < nBoxes; n++ ) { const SwTableBox * pTabBox1 = rTblBoxes[n]; const SwFrmFmt * pFrmFmt = pTabBox1->GetFrmFmt(); - + if ( FRMDIR_VERT_TOP_RIGHT == m_rWW8Export.TrueFrameDirection( *pFrmFmt ) ) { m_rWW8Export.InsUInt16( NS_sprm::LN_TTextFlow ); @@ -1967,7 +1968,7 @@ void WW8AttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_ void WW8AttributeOutput::TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) { const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); - const SwTableLine * pTabLine = pTabBox->GetUpper(); + const SwTableLine * pTabLine = pTabBox->GetUpper(); const SwFrmFmt * pLineFmt = pTabLine->GetFrmFmt(); /* @@ -1975,7 +1976,7 @@ void WW8AttributeOutput::TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pT feature equivalent to this, Word stores 1 for fCantSplit if the row cannot be split, we set true if we can split it. An example is #i4569# */ - + const SwFmtRowSplit& rSplittable = pLineFmt->GetRowSplit(); BYTE nCantSplit = (!rSplittable.GetValue()) ? 1 : 0; if ( m_rWW8Export.bWrtWW8 ) @@ -1995,7 +1996,7 @@ void WW8AttributeOutput::TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTable { const SwTable * pTable = pTableTextNodeInfoInner->getTable(); const SwFrmFmt * pFrmFmt = pTable->GetFrmFmt(); - + if ( m_rWW8Export.bWrtWW8 ) { if ( m_rWW8Export.TrueFrameDirection(*pFrmFmt) == FRMDIR_HORI_RIGHT_TOP ) @@ -2009,10 +2010,10 @@ void WW8AttributeOutput::TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTable void WW8AttributeOutput::TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) { const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); - const SwTableLine * pTabLine = pTabBox->GetUpper(); + const SwTableLine * pTabLine = pTabBox->GetUpper(); const SwFrmFmt * pLineFmt = pTabLine->GetFrmFmt(); -#if 0 +#if 0 const SwTable * pTable = pTableTextNodeInfo->getTable(); bool bNewTableModel = pTable->IsNewModel(); bool bFixRowHeight = false; @@ -2020,7 +2021,7 @@ void WW8AttributeOutput::TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTab if (! bNewModel) { sal_uInt32 nBoxes = rTabBoxes.Count(); - + for (sal_uInt32 n = 0; n < nBoxes; n++) { SwTableBox * pBox1 = rTabBoxes[n]; @@ -2052,21 +2053,21 @@ void WW8AttributeOutput::TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTab m_rWW8Export.pO->Insert( 189, m_rWW8Export.pO->Count() ); m_rWW8Export.InsUInt16( (USHORT)nHeight ); } - + } void WW8AttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) { const SwTable * pTable = pTableTextNodeInfoInner->getTable(); - + const SwFrmFmt *pFmt = pTable->GetFrmFmt(); ASSERT(pFmt,"Impossible"); if (!pFmt) return; - + const SwFmtHoriOrient &rHori = pFmt->GetHoriOrient(); const SwFmtVertOrient &rVert = pFmt->GetVertOrient(); - + if ( (text::RelOrientation::PRINT_AREA == rHori.GetRelationOrient() || text::RelOrientation::FRAME == rHori.GetRelationOrient()) @@ -2098,7 +2099,7 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t const SwTableLine * pTabLine = pTabBox->GetUpper(); const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes(); const SwTable * pTable = pTableTextNodeInfoInner->getTable(); - + if ( pTable->GetRowsToRepeat() > pTableTextNodeInfoInner->getRow() ) { if( m_rWW8Export.bWrtWW8 ) @@ -2112,7 +2113,7 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t sal_uInt32 nBoxes = rTabBoxes.Count(); if ( nBoxes > 32 ) nBoxes = 32; - + // sprm header m_rWW8Export.InsUInt16( NS_sprm::LN_TDefTable ); sal_uInt16 nSprmSize = 2 + (nBoxes + 1) * 2 + nBoxes * 20; @@ -2121,7 +2122,7 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t // number of boxes m_rWW8Export.pO->Insert( static_cast<BYTE>(nBoxes), m_rWW8Export.pO->Count() ); - /* cellxs */ + /* cellxs */ /* ALWAYS relative when text::HoriOrientation::NONE (nPageSize + ( nPageSize / 10 )) < nTblSz, in that case the cell width's and table width's are not real. The table @@ -2136,9 +2137,9 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t const SwFmtHoriOrient &rHori = pFmt->GetHoriOrient(); const SwFmtVertOrient &rVert = pFmt->GetVertOrient(); - + sal_uInt16 nTblOffset = 0; - + if ( (text::RelOrientation::PRINT_AREA == rHori.GetRelationOrient() || text::RelOrientation::FRAME == rHori.GetRelationOrient()) @@ -2161,36 +2162,36 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t break; } } - + sal_uInt32 n = 0; - m_rWW8Export.InsUInt16( nTblOffset ); - + m_rWW8Export.InsUInt16( nTblOffset ); + std::vector<SwTwips> gridCols = GetGridCols( pTableTextNodeInfoInner ); for ( std::vector<SwTwips>::const_iterator it = gridCols.begin(), end = gridCols.end(); it != end; ++it ) { m_rWW8Export.InsUInt16( static_cast<USHORT>( *it ) + nTblOffset ); } - + /* TCs */ for ( n = 0; n < nBoxes; n++ ) { #ifdef DEBUG sal_uInt16 npOCount = m_rWW8Export.pO->Count(); #endif - + SwTableBox * pTabBox1 = rTabBoxes[n]; const SwFrmFmt & rBoxFmt = *(pTabBox1->GetFrmFmt()); if ( m_rWW8Export.bWrtWW8 ) { - sal_uInt16 nFlags = lcl_TCFlags(pTabBox1); + sal_uInt16 nFlags = lcl_TCFlags(pTabBox1); m_rWW8Export.InsUInt16( nFlags ); } - + static BYTE aNullBytes[] = { 0x0, 0x0 }; - + m_rWW8Export.pO->Insert( aNullBytes, 2, m_rWW8Export.pO->Count() ); // dummy m_rWW8Export.Out_SwFmtTableBox( *m_rWW8Export.pO, rBoxFmt.GetBox() ); // 8/16 Byte - + #ifdef DEBUG ::std::clog << "<tclength>" << m_rWW8Export.pO->Count() - npOCount << "</tclength>" << ::std::endl; @@ -2206,7 +2207,7 @@ std::vector<SwTwips> AttributeOutputBase::GetGridCols( ww8::WW8TableNodeInfoInne const SwTableLine * pTabLine = pTabBox->GetUpper(); const SwTableBoxes & rTabBoxes = pTabLine->GetTabBoxes(); const SwTable *pTable = pTableTextNodeInfoInner->getTable( ); - + // number of cell written sal_uInt32 nBoxes = rTabBoxes.Count(); if ( nBoxes > 32 ) @@ -2294,9 +2295,9 @@ void AttributeOutputBase::GetTablePageSize( ww8::WW8TableNodeInfoInner::Pointer_ const SvxLRSpaceItem &rLR = pFmt->GetLRSpace(); nPageSize -= (rLR.GetLeft() + rLR.GetRight()); } - + } - + ASSERT(nWidthPercent, "Impossible"); if (nWidthPercent) { @@ -2321,7 +2322,7 @@ void WW8AttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointe BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT }; - + for ( int i = 0; i < 4; ++i ) { SwWW8Writer::InsUInt16( *m_rWW8Export.pO, 0xD634 ); @@ -2330,7 +2331,7 @@ void WW8AttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointe m_rWW8Export.pO->Insert( BYTE(1), m_rWW8Export.pO->Count() ); m_rWW8Export.pO->Insert( BYTE(1 << i), m_rWW8Export.pO->Count() ); m_rWW8Export.pO->Insert( BYTE(3), m_rWW8Export.pO->Count() ); - + SwWW8Writer::InsUInt16( *m_rWW8Export.pO, pFrmFmt->GetBox().GetDistance( aBorders[i] ) ); } @@ -2348,17 +2349,17 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t else m_rWW8Export.pO->Insert( (BYTE)191, m_rWW8Export.pO->Count() ); m_rWW8Export.pO->Insert( (BYTE)(nBoxes * 2), m_rWW8Export.pO->Count() ); // Len - + for ( sal_uInt8 n = 0; n < nBoxes; n++ ) { const SwTableBox * pBox1 = rTabBoxes[n]; const SwFrmFmt * pFrmFmt = pBox1->GetFrmFmt(); const SfxPoolItem * pI = NULL; Color aColor; - + if ( SFX_ITEM_ON == pFrmFmt->GetAttrSet().GetItemState( RES_BACKGROUND, false, &pI ) ) { - aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor(); + aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor(); } else aColor = COL_AUTO; @@ -2370,38 +2371,45 @@ void WW8AttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t if ( m_rWW8Export.bWrtWW8 ) { + sal_uInt32 aSprmIds[] = {NS_sprm::LN_TCellShd, NS_sprm::LN_TCellShadow}; sal_uInt8 nBoxes0 = rTabBoxes.Count(); if (nBoxes0 > 21) nBoxes0 = 21; - - m_rWW8Export.InsUInt16( NS_sprm::LN_TCellShd ); - m_rWW8Export.pO->Insert( static_cast<BYTE>(nBoxes0 * 10), m_rWW8Export.pO->Count() ); - - for ( sal_uInt8 n = 0; n < nBoxes0; n++ ) + + for (sal_uInt32 m = 0; m < 2; m++) { - const SwTableBox * pBox1 = rTabBoxes[n]; - const SwFrmFmt * pFrmFmt = pBox1->GetFrmFmt(); - const SfxPoolItem * pI = NULL; - Color aColor; - - if ( SFX_ITEM_ON == pFrmFmt->GetAttrSet().GetItemState( RES_BACKGROUND, false, &pI ) ) + m_rWW8Export.InsUInt16( aSprmIds[m] ); + m_rWW8Export.pO->Insert( static_cast<BYTE>(nBoxes0 * 10), + m_rWW8Export.pO->Count() ); + + for ( sal_uInt8 n = 0; n < nBoxes0; n++ ) { - aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor(); - } - else - aColor = COL_AUTO; - - WW8SHDLong aSHD; - aSHD.setCvFore( 0xFF000000 ); - - sal_uInt32 nBgColor = aColor.GetColor(); - if ( nBgColor == COL_AUTO ) - aSHD.setCvBack( 0xFF000000 ); - else - aSHD.setCvBack( wwUtility::RGBToBGR( nBgColor ) ); + const SwTableBox * pBox1 = rTabBoxes[n]; + const SwFrmFmt * pFrmFmt = pBox1->GetFrmFmt(); + const SfxPoolItem * pI = NULL; + Color aColor; + + if ( SFX_ITEM_ON == + pFrmFmt->GetAttrSet(). + GetItemState( RES_BACKGROUND, false, &pI ) ) + { + aColor = dynamic_cast<const SvxBrushItem *>(pI)->GetColor(); + } + else + aColor = COL_AUTO; - aSHD.Write( m_rWW8Export ); - } + WW8SHDLong aSHD; + aSHD.setCvFore( 0xFF000000 ); + + sal_uInt32 nBgColor = aColor.GetColor(); + if ( nBgColor == COL_AUTO ) + aSHD.setCvBack( 0xFF000000 ); + else + aSHD.setCvBack( wwUtility::RGBToBGR( nBgColor ) ); + + aSHD.Write( m_rWW8Export ); + } + } } } @@ -2415,11 +2423,24 @@ void WW8Export::SectionBreaksAndFrames( const SwTxtNode& rNode ) OutWW6FlyFrmsInCntnt( rNode ); } +#ifdef DEBUG +struct SwNodeHash +{ + size_t operator()(SwNode * pNode) const { return reinterpret_cast<size_t>(pNode); } +}; + +typedef ::std::hash_set<SwNode *, SwNodeHash> SwNodeHashSet; +typedef ::std::deque<SwNode *> SwNodeDeque; +#endif + void MSWordExportBase::WriteText() { #ifdef DEBUG ::std::clog << "<WriteText>" << ::std::endl; -// ::std::clog << dbg_out(pCurPam->GetDoc()->GetNodes()) << ::std::endl; + ::std::clog << dbg_out(pCurPam->GetDoc()->GetNodes()) << ::std::endl; + + SwNodeHashSet aNodeSet; + SwNodeDeque aNodeDeque; #endif while( pCurPam->GetPoint()->nNode < pCurPam->GetMark()->nNode || @@ -2428,6 +2449,29 @@ void MSWordExportBase::WriteText() { SwNode * pNd = pCurPam->GetNode(); +#ifdef DEBUG + if (aNodeSet.find(pNd) == aNodeSet.end()) + { + aNodeSet.insert(pNd); + aNodeDeque.push_back(pNd); + } + else + { + ::std::clog << "<already-done><which>" << dbg_out(*pNd) + << "</which><nodes>" << ::std::endl; + + SwNodeDeque::const_iterator aEnd = aNodeDeque.end(); + + for (SwNodeDeque::const_iterator aIt = aNodeDeque.begin(); + aIt != aEnd; aIt++) + { + ::std::clog << dbg_out(**aIt) << ::std::endl; + } + + ::std::clog << "</nodes></already-done>" << ::std::endl; + } +#endif + if ( pNd->IsTxtNode() ) SectionBreaksAndFrames( *pNd->GetTxtNode() ); @@ -2490,16 +2534,16 @@ void MSWordExportBase::WriteText() SwNode * pCurrentNode = &pCurPam->GetPoint()->nNode.GetNode(); const SwNode * pNextNode = mpTableInfo->getNextNode(pCurrentNode); - + if (pNextNode != NULL) pCurPam->GetPoint()->nNode = SwNodeIndex(*pNextNode); else pCurPam->GetPoint()->nNode++; - + ULONG nPos = pCurPam->GetPoint()->nNode.GetIndex(); ::SetProgressState( nPos, pCurPam->GetDoc()->GetDocShell() ); } - + #ifdef DEBUG ::std::clog << "</WriteText>" << ::std::endl; #endif @@ -2664,33 +2708,41 @@ void WW8Export::WriteFkpPlcUsw() // Write SttbfAssoc WW8SttbAssoc * pSttbfAssoc = dynamic_cast<WW8SttbAssoc *> (pDoc->getExternalData(::sw::STTBF_ASSOC).get()); - ::std::vector<String> aStrings; - - ::ww8::StringVector_t & aSttbStrings = pSttbfAssoc->getStrings(); - ::ww8::StringVector_t::const_iterator aItEnd = aSttbStrings.end(); - for (::ww8::StringVector_t::const_iterator aIt = aSttbStrings.begin(); - aIt != aItEnd; aIt++) + // --> OD 2009-10-19 #i106057# + if ( pSttbfAssoc ) + // <-- { - String aStr(aIt->getStr()); - aStrings.push_back(aStr); - } - - WriteAsStringTable(aStrings, pFib->fcSttbfAssoc, - pFib->lcbSttbfAssoc); + ::std::vector<String> aStrings; + ::ww8::StringVector_t & aSttbStrings = pSttbfAssoc->getStrings(); + ::ww8::StringVector_t::const_iterator aItEnd = aSttbStrings.end(); + for (::ww8::StringVector_t::const_iterator aIt = aSttbStrings.begin(); + aIt != aItEnd; aIt++) + { + String aStr(aIt->getStr()); + aStrings.push_back(aStr); + } + WriteAsStringTable(aStrings, pFib->fcSttbfAssoc, + pFib->lcbSttbfAssoc); + } } Strm().Seek( 0 ); // Reclaim stored FIB data from document. ::ww8::WW8FibData * pFibData = dynamic_cast<ww8::WW8FibData *> (pDoc->getExternalData(::sw::FIB).get()); - - pFib->fReadOnlyRecommended = - pFibData->getReadOnlyRecommended() ? 1 : 0; - pFib->fWriteReservation = - pFibData->getWriteReservation() ? 1 : 0; + // --> OD 2009-10-19 #i106057# + if ( pFibData ) + // <-- + { + pFib->fReadOnlyRecommended = + pFibData->getReadOnlyRecommended() ? 1 : 0; + pFib->fWriteReservation = + pFibData->getWriteReservation() ? 1 : 0; + } pFib->Write( Strm() ); // FIB + } void WW8Export::StoreDoc1() @@ -2813,7 +2865,7 @@ namespace { const ULONG WW_BLOCKSIZE = 0x200; - void EncryptRC4(svx::MSCodec_Std97& rCtx, SvStream &rIn, SvStream &rOut) + void EncryptRC4(msfilter::MSCodec_Std97& rCtx, SvStream &rIn, SvStream &rOut) { rIn.Seek(STREAM_SEEK_TO_END); ULONG nLen = rIn.Tell(); @@ -2828,7 +2880,7 @@ namespace rCtx.Encode(in, nBS, in, nBS); rOut.Write(in, nBS); } - } + } } void MSWordExportBase::ExportDocument( bool bWriteAll ) @@ -3033,12 +3085,12 @@ void WW8Export::ExportDocument_Impl() StoreDoc1(); if ( bEncrypt ) - { + { // Generate random number with a seed of time as salt. TimeValue aTime; osl_getSystemTime( &aTime ); rtlRandomPool aRandomPool = rtl_random_createPool (); - rtl_random_addBytes ( aRandomPool, &aTime, 8 ); + rtl_random_addBytes ( aRandomPool, &aTime, 8 ); sal_uInt8 aDocId[ 16 ] = {0}; rtl_random_getBytes( aRandomPool, aDocId, 16 ); @@ -3049,7 +3101,7 @@ void WW8Export::ExportDocument_Impl() for (xub_StrLen nChar = 0; nChar < nLen; ++nChar ) aPassword[nChar] = sUniPassword.GetChar(nChar); - svx::MSCodec_Std97 aCtx; + msfilter::MSCodec_Std97 aCtx; aCtx.InitKey(aPassword, aDocId); SvStream *pStrmTemp, *pTableStrmTemp, *pDataStrmTemp; @@ -3058,11 +3110,11 @@ void WW8Export::ExportDocument_Impl() pDataStrmTemp = &xDataStrm; if ( pDataStrmTemp && pDataStrmTemp != pStrmTemp) - EncryptRC4(aCtx, *pDataStrm, *pDataStrmTemp); + EncryptRC4(aCtx, *pDataStrm, *pDataStrmTemp); EncryptRC4(aCtx, *pTableStrm, *pTableStrmTemp); - // Write Unencrypted Header 52 bytes to the start of the table stream + // Write Unencrypted Header 52 bytes to the start of the table stream // EncryptionVersionInfo (4 bytes): A Version structure where Version.vMajor MUST be 0x0001, and Version.vMinor MUST be 0x0001. pTableStrmTemp->Seek( 0 ); sal_uInt32 nEncType = 0x10001; @@ -3074,19 +3126,19 @@ void WW8Export::ExportDocument_Impl() pTableStrmTemp->Write( aDocId, 16 ); pTableStrmTemp->Write( pSaltData, 16 ); - pTableStrmTemp->Write( pSaltDigest, 16 ); + pTableStrmTemp->Write( pSaltDigest, 16 ); EncryptRC4(aCtx, GetWriter().Strm(), *pStrmTemp); - // Write Unencrypted Fib 68 bytes to the start of the workdocument stream + // Write Unencrypted Fib 68 bytes to the start of the workdocument stream pFib->fEncrypted = 1; // fEncrypted indicates the document is encrypted. pFib->fObfuscated = 0; // Must be 0 for RC4. pFib->nHash = 0x34; // encrypt header bytes count of table stream. pFib->nKey = 0; // lkey2 must be 0 for RC4. - pStrmTemp->Seek( 0 ); - pFib->WriteHeader( *pStrmTemp ); - } + pStrmTemp->Seek( 0 ); + pFib->WriteHeader( *pStrmTemp ); + } if (pUsedNumTbl) // all used NumRules { @@ -3280,7 +3332,7 @@ ULONG SwWW8Writer::Write( SwPaM& rPaM, SfxMedium& rMed, MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam ) : aMainStg(sMainStream), pISet(0), pUsedNumTbl(0), mpTopNodeOfHdFtPage(0), - pBmpPal(0), pKeyMap(0), pOLEExp(0), pOCXExp(0), pOleMap(0), + pBmpPal(0), pKeyMap(0), pOLEExp(0), pOCXExp(0), pOleMap(0), mpTableInfo(new ww8::WW8TableInfo()), nUniqueList(0), mnHdFtIndex(0), pAktPageDesc(0), pPapPlc(0), pChpPlc(0), pChpIter(0), pStyles( NULL ), @@ -3343,11 +3395,23 @@ SwWW8Writer::~SwWW8Writer() { } +extern "C" SAL_DLLPUBLIC_EXPORT ULONG SAL_CALL SaveOrDelMSVBAStorage_ww8( SfxObjectShell& rDoc, SotStorage& rStor, BOOL bSaveInto, const String& rStorageName ) +{ + SvxImportMSVBasic aTmp( rDoc, rStor ); + return aTmp.SaveOrDelMSVBAStorage( bSaveInto, rStorageName ); +} + extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportDOC( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) { xRet = new SwWW8Writer( rFltName, rBaseURL ); } + +extern "C" SAL_DLLPUBLIC_EXPORT ULONG SAL_CALL GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell &rDocS ) +{ + return SvxImportMSVBasic::GetSaveWarningOfMSVBAStorage( rDocS ); +} + bool WW8_WrPlcFtnEdn::WriteTxt( WW8Export& rWrt ) { bool bRet = false; @@ -3470,7 +3534,7 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) if ( pAsCheckbox ) type = 1; - const ::rtl::OUString ffname = rFieldmark.GetFieldname(); + const ::rtl::OUString ffname = rFieldmark.GetFieldname(); ULONG nDataStt = pDataStrm->Tell(); pChpPlc->AppendFkpEntry(Strm().Tell()); @@ -3489,7 +3553,7 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) pChpPlc->AppendFkpEntry( Strm().Tell(), sizeof( aArr1 ), aArr1 ); - sal_uInt8 aFldHeader[] = + sal_uInt8 aFldHeader[] = { 0xFF, 0xFF, 0xFF, 0xFF, // Unicode Marker... 0, 0, 0, 0//, 0, 0, 0, 0 @@ -3510,7 +3574,6 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) const sal_uInt8 aFldData[] = { - 0,0,0,0, // len of struct 0x44,0, // the start of "next" data 0,0,0,0,0,0,0,0,0,0, // PIC-Structure! /10 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // | /16 @@ -3518,7 +3581,8 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // | /16 0,0,0,0, // / /4 }; - int slen = sizeof( aFldData ) + sal_uInt32 slen=sizeof(sal_uInt32) + + sizeof(aFldData) + sizeof( aFldHeader ) + 2*ffname.getLength() + 4 + 2*ffdeftext.getLength() + 4 @@ -3527,12 +3591,11 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) + 2*ffstattext.getLength() + 4 + 2*ffentrymcr.getLength() + 4 + 2*ffexitmcr.getLength() + 4; -#ifdef OSL_BIGENDIAN - slen = SWAPLONG( slen ); -#endif // OSL_BIGENDIAN - *( (sal_uInt32 *)aFldData ) = slen; + + *pDataStrm << slen; + int len = sizeof( aFldData ); - OSL_ENSURE( len == 0x44, "SwWW8Writer::WriteFormData(..) - wrong aFldData length" ); + OSL_ENSURE( len == 0x44-sizeof(sal_uInt32), "SwWW8Writer::WriteFormData(..) - wrong aFldData length" ); pDataStrm->Write( aFldData, len ); len = sizeof( aFldHeader ); @@ -3568,34 +3631,35 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer #endif m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren - + if (pNodeInfoInner->isEndOfCell()) { #ifdef DEBUG ::std::clog << "<endOfCell/>" << ::std::endl; #endif m_rWW8Export.WriteCR(pNodeInfoInner); - + m_rWW8Export.pO->Insert( (BYTE*)&nStyle, 2, m_rWW8Export.pO->Count() ); // Style # TableInfoCell(pNodeInfoInner); m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(), m_rWW8Export.pO->GetData() ); - + m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren } - + if (pNodeInfoInner->isEndOfLine()) { #ifdef DEBUG ::std::clog << "<endOfLine/>" << ::std::endl; #endif TableRowEnd(pNodeInfoInner->getDepth()); - + + ShortToSVBT16(0, nStyle); m_rWW8Export.pO->Insert( (BYTE*)&nStyle, 2, m_rWW8Export.pO->Count() ); // Style # TableInfoRow(pNodeInfoInner); m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(), m_rWW8Export.pO->GetData() ); - + m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); // leeren } #ifdef DEBUG @@ -3610,15 +3674,15 @@ void MSWordExportBase::OutputEndNode( const SwEndNode &rNode ) #endif ww8::WW8TableNodeInfo::Pointer_t pNodeInfo = mpTableInfo->getTableNodeInfo( &rNode ); - + if (pNodeInfo) - { + { if (pNodeInfo.get() != NULL) - { -#ifdef DEBUG + { +#ifdef DEBUG ::std::clog << pNodeInfo->toString() << ::std::endl; #endif - + const ww8::WW8TableNodeInfo::Inners_t aInners = pNodeInfo->getInners(); ww8::WW8TableNodeInfo::Inners_t::const_iterator aIt(aInners.begin()); ww8::WW8TableNodeInfo::Inners_t::const_iterator aEnd(aInners.end()); @@ -3628,7 +3692,7 @@ void MSWordExportBase::OutputEndNode( const SwEndNode &rNode ) AttrOutput().TableNodeInfoInner(pInner); aIt++; } - } + } } #ifdef DEBUG ::std::clog << "</OutWW8_SwEndNode>" << ::std::endl; diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index a96a2e5e17..9a7686c228 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -36,7 +36,7 @@ #include <tools/gen.hxx> #ifndef _SVSTDARR_HXX #define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <map> @@ -44,7 +44,7 @@ #include <shellio.hxx> #include <wrt_fn.hxx> -#include <svx/msocximex.hxx> +#include <filter/msfilter/msocximex.hxx> #include "ww8struc.hxx" #include "ww8scan.hxx" diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index ed3d1b3b7e..3e6b3de46c 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -37,8 +37,8 @@ #include <com/sun/star/embed/Aspects.hpp> #include <rtl/math.hxx> #include <svtools/filter.hxx> -#include <svtools/itemiter.hxx> -#include "svtools/urihelper.hxx" +#include <svl/itemiter.hxx> +#include "svl/urihelper.hxx" #include <svtools/embedhlp.hxx> @@ -49,7 +49,7 @@ #include <svx/boxitem.hxx> #include <svx/shaditem.hxx> #include <svx/shaditem.hxx> -#include <svx/msoleexp.hxx> +#include <filter/msfilter/msoleexp.hxx> #include <svx/lrspitem.hxx> // SvxLRSpaceItem #include <svx/ulspitem.hxx> #include <svx/fhgtitem.hxx> diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index e379e44a65..afc8a436d8 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -41,9 +41,9 @@ #include <vcl/svapp.hxx> #include <vcl/salbtype.hxx> -#include <svtools/zformat.hxx> -#include <svtools/itemiter.hxx> -#include <svtools/whiter.hxx> +#include <svl/zformat.hxx> +#include <svl/itemiter.hxx> +#include <svl/whiter.hxx> #include <svx/fontitem.hxx> #include <svx/tstpitem.hxx> #include <svx/adjitem.hxx> @@ -966,7 +966,7 @@ void WW8AttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTe TableRowEnd( pTextNodeInfoInner->getDepth() ); SVBT16 nSty; - ShortToSVBT16( m_rWW8Export.nStyleBeforeFly, nSty ); + ShortToSVBT16( 0, nSty ); m_rWW8Export.pO->Insert( (BYTE*)&nSty, 2, m_rWW8Export.pO->Count() ); // Style # TableInfoRow( pTextNodeInfoInner ); m_rWW8Export.pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.pO->Count(), @@ -1559,7 +1559,7 @@ bool WW8Export::TransBrush(const Color& rCol, WW8_SHD& rShd) rShd = WW8_SHD(); // alles Nullen : transparent else { - rShd.SetFore( 8); + rShd.SetFore( 0); rShd.SetBack( TransCol( rCol ) ); rShd.SetStyle( bWrtWW8, 0 ); } @@ -3582,7 +3582,7 @@ ULONG WW8Export::ReplaceCr( BYTE nChar ) pChpPlc->AppendFkpEntry(rStrm.Tell()); nRetPos = rStrm.Tell(); } -#ifdef PRODUCT +#ifndef DBG_UTIL else { ASSERT( nRetPos || nPos == (ULONG)pFib->fcMin, diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index fe7fb79e01..b41d6cf90e 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -33,7 +33,7 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ #include <tools/urlobj.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <rtl/tencinfo.h> #include <swerror.h> #ifndef _NDTXT diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 4948ac5edd..0553267d12 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <hintids.hxx> #include <osl/endian.h> #include <svx/fmglob.hxx> @@ -75,7 +75,7 @@ #include <svx/outliner.hxx> // #79453# #include <svx/frmdiritem.hxx> #include <svx/xfltrit.hxx> -#include <svx/msdffimp.hxx> +#include <filter/msfilter/msdffimp.hxx> #include <grfatr.hxx> // class SwCropGrf #include <fmtornt.hxx> #include <fmtcntnt.hxx> diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index 0472567812..004d04d9d4 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -37,14 +37,14 @@ #include <iterator> #endif #include <hintids.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <svx/impgrf.hxx> #include <svx/svdpage.hxx> #include <svx/svdmodel.hxx> #include <svx/svdograf.hxx> #include <svx/svdoole2.hxx> #include <svx/opaqitem.hxx> -#include <svx/msdffimp.hxx> +#include <filter/msfilter/msdffimp.hxx> #include <sfx2/app.hxx> #include <sfx2/docfile.hxx> #include <sfx2/fcontnr.hxx> diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 9b5a785220..2ae8a362ea 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -60,18 +60,18 @@ // --> OD 2005-02-28 #i43427# #include <svx/opaqitem.hxx> // <-- -#include <svx/svxmsbas.hxx> +#include <filter/msfilter/svxmsbas.hxx> #include <svx/unoapi.hxx> #include <svx/svdoole2.hxx> -#include <svx/msdffimp.hxx> +#include <filter/msfilter/msdffimp.hxx> #include <svx/svdoashp.hxx> #include <svx/svxerr.hxx> -#include <svx/mscodec.hxx> +#include <filter/msfilter/mscodec.hxx> #include <svx/svdmodel.hxx> #include <svx/svdogrp.hxx> #include <svx/xflclit.hxx> -#include <svtools/fltrcfg.hxx> +#include <unotools/fltrcfg.hxx> #include <fmtfld.hxx> #include <fmturl.hxx> #include <fmtinfmt.hxx> @@ -129,7 +129,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> -#include <svtools/itemiter.hxx> //SfxItemIter +#include <svl/itemiter.hxx> //SfxItemIter #include <stdio.h> @@ -4216,7 +4216,7 @@ namespace #define WW_BLOCKSIZE 0x200 - void DecryptRC4(svx::MSCodec_Std97& rCtx, SvStream &rIn, SvStream &rOut) + void DecryptRC4(msfilter::MSCodec_Std97& rCtx, SvStream &rIn, SvStream &rOut) { rIn.Seek(STREAM_SEEK_TO_END); ULONG nLen = rIn.Tell(); @@ -4233,7 +4233,7 @@ namespace } } - void DecryptXOR(svx::MSCodec_XorWord95 &rCtx, SvStream &rIn, SvStream &rOut) + void DecryptXOR(msfilter::MSCodec_XorWord95 &rCtx, SvStream &rIn, SvStream &rOut) { ULONG nSt = rIn.Tell(); rIn.Seek(STREAM_SEEK_TO_END); @@ -4366,7 +4366,7 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) for (xub_StrLen nChar = 0; nChar < sPassword.Len(); ++nChar ) aPassword[nChar] = sPassword.GetChar(nChar); - svx::MSCodec_XorWord95 aCtx; + msfilter::MSCodec_XorWord95 aCtx; aCtx.InitKey(aPassword); if (aCtx.VerifyKey(pWwFib->nKey, pWwFib->nHash)) { @@ -4379,7 +4379,7 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) sal_uInt8 *pIn = new sal_uInt8[nUnencryptedHdr]; pStrm->Read(pIn, nUnencryptedHdr); aDecryptMain.Write(pIn, nUnencryptedHdr); - delete pIn; + delete [] pIn; DecryptXOR(aCtx, *pStrm, aDecryptMain); @@ -4424,7 +4424,7 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) sal_uInt8 aSaltHash[ 16 ]; pTableStream->Read(aSaltHash, 16); - svx::MSCodec_Std97 aCtx; + msfilter::MSCodec_Std97 aCtx; aCtx.InitKey(aPassword, aDocId); if (aCtx.VerifyKey(aSaltData, aSaltHash)) { diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index a377602b87..662b6d36f3 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -33,8 +33,8 @@ #define _WW8PAR_HXX #include <tools/string.hxx> -#include <svx/msdffimp.hxx> -#include <svx/msocximex.hxx> +#include <filter/msfilter/msdffimp.hxx> +#include <filter/msfilter/msocximex.hxx> #include <svx/frmdir.hxx> #include <fltshell.hxx> // fuer den Attribut Stack diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 635a2b7e6a..65912eb6b6 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -285,7 +285,7 @@ void sw::util::RedlineStack::close( const SwPosition& rPos, { if( pTabDesc && pTabDesc->getOldRedlineStack() ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ASSERT( pTabDesc->getOldRedlineStack()->close(rPos, eType), "close without open!"); #else pTabDesc->getOldRedlineStack()->close( rPos, eType ); @@ -1170,6 +1170,7 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const BYTE* pS) pS++; short nLen = (INT16)SVBT16ToShort( pS - 2 ); // nicht schoen + BYTE nCols = *pS; // Anzahl der Zellen short nOldCols = nWwCols; @@ -1200,7 +1201,11 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const BYTE* pS) setcelldefaults(pTCs,nCols); } - if( nFileCols ) + short nColsToRead = nFileCols; + if (nColsToRead > nCols) + nColsToRead = nCols; + + if( nColsToRead ) { // lies TCs ein @@ -1216,9 +1221,9 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const BYTE* pS) if( bVer67 ) { WW8_TCellVer6* pTc = (WW8_TCellVer6*)pT; - for(i=0; i<nFileCols; i++, ++pAktTC,++pTc) + for(i=0; i<nColsToRead; i++, ++pAktTC,++pTc) { - if( i < nFileCols ) + if( i < nColsToRead ) { // TC aus File ? BYTE aBits1 = SVBT8ToByte( pTc->aBits1Ver6 ); pAktTC->bFirstMerged = ( ( aBits1 & 0x01 ) != 0 ); @@ -1248,7 +1253,7 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const BYTE* pS) else { WW8_TCellVer8* pTc = (WW8_TCellVer8*)pT; - for (int k = 0; k < nFileCols; ++k, ++pAktTC, ++pTc ) + for (int k = 0; k < nColsToRead; ++k, ++pAktTC, ++pTc ) { UINT16 aBits1 = SVBT16ToShort( pTc->aBits1Ver8 ); pAktTC->bFirstMerged = ( ( aBits1 & 0x0001 ) != 0 ); @@ -1296,6 +1301,12 @@ void WW8TabBandDesc::ProcessSprmTSetBRC(bool bVer67, const BYTE* pParamsTSetBRC) BYTE nitcLim = pParamsTSetBRC[1];// (last col to be changed)+1 BYTE nFlag = *(pParamsTSetBRC+2); + if (nitcFirst >= nWwCols) + return; + + if (nitcLim > nWwCols) + nitcLim = nWwCols; + bool bChangeRight = (nFlag & 0x08) ? true : false; bool bChangeBottom = (nFlag & 0x04) ? true : false; bool bChangeLeft = (nFlag & 0x02) ? true : false; @@ -1491,7 +1502,7 @@ void WW8TabBandDesc::ProcessSpacing(const BYTE* pParams) if (nLen != 6) return; mbHasSpacing=true; -#ifndef PRODUCT +#ifdef DBG_UTIL BYTE nWhichCell = #endif *pParams++; @@ -1545,7 +1556,7 @@ void WW8TabBandDesc::ProcessSpecificSpacing(const BYTE* pParams) ASSERT(nOverrideSpacing[nWhichCell] < 0x10, "Unexpected value for nSideBits"); -#ifndef PRODUCT +#ifdef DBG_UTIL BYTE nUnknown2 = #endif *pParams++; @@ -1879,7 +1890,7 @@ WW8TabDesc::WW8TabDesc(SwWW8ImplReader* pIoClass, WW8_CP nStartCp) : const BYTE b0 = pParams[0]; const BYTE b1 = pParams[1]; const BYTE b2 = pParams[2]; - if (b0 == 3) // Twips + if (b0 == 3) // Twips nPreferredWidth = b2 * 0x100 + b1; } break; @@ -3624,9 +3635,9 @@ void SwWW8ImplReader::TabCellEnd() { pTableDesc->TableCellEnd(); - if (bReadTable - && pWFlyPara == NULL - && mpTableEndPaM.get() != NULL + if (bReadTable + && pWFlyPara == NULL + && mpTableEndPaM.get() != NULL && (! SwPaM::Overlap(*pPaM, *mpTableEndPaM)) && SwPaM::LessThan(*mpTableEndPaM, *pPaM) && mpTableEndPaM->GetPoint()->nNode.GetNode().IsTxtNode() @@ -3636,7 +3647,7 @@ void SwWW8ImplReader::TabCellEnd() rDoc.DelFullPara(*mpTableEndPaM); } } - + bFirstPara = true; // We have come to the end of a cell so FirstPara flag bReadTable = false; mpTableEndPaM.reset(); @@ -3691,7 +3702,7 @@ void SwWW8ImplReader::StopTable() maTracer.EnterEnvironment(sw::log::eTable, rtl::OUString::valueOf( static_cast<sal_Int32>(maTableStack.size()))); } - + bReadTable = true; // --> OD 2009-04-16 #i101116# // Keep PaM on table end only for nested tables diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 4e1ec2fcfd..b6b91459fc 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -33,7 +33,7 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <vcl/svapp.hxx> #include <vcl/outdev.hxx> @@ -75,7 +75,7 @@ #include <svx/crsditem.hxx> #include <svx/udlnitem.hxx> #include <svx/postitem.hxx> -#include <svx/msocximex.hxx> +#include <filter/msfilter/msocximex.hxx> #include <errhdl.hxx> #include <unoobj.hxx> #include <doc.hxx> @@ -95,7 +95,7 @@ #include "ww8par2.hxx" // wg. Listen-Attributen in Styles #include <IMark.hxx> -#include <svtools/fltrcfg.hxx> +#include <unotools/fltrcfg.hxx> #include <stdio.h> @@ -255,7 +255,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, String& rStr ) sal_Bool bUseEnhFields=(pOpt && pOpt->IsUseEnhancedFields()); if (!bUseEnhFields) { - pFormImpl->InsertFormula(aFormula); + pFormImpl->InsertFormula(aFormula); return FLD_OK; } else { String aBookmarkName; @@ -267,7 +267,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, String& rStr ) USHORT bkmFindIdx; String aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx); - if (aBookmarkFind.Len()>0) { + if (aBookmarkFind.Len()>0) { pB->SetStatus(bkmFindIdx, BOOK_FIELD); // mark as consumed by field if (aBookmarkFind.Len()>0) { aBookmarkName=aBookmarkFind; @@ -280,7 +280,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, String& rStr ) } if (aBookmarkName.Len()>0) { - ::sw::mark::ICheckboxFieldmark* pFieldmark = + ::sw::mark::ICheckboxFieldmark* pFieldmark = dynamic_cast< ::sw::mark::ICheckboxFieldmark*>(rDoc.getIDocumentMarkAccess()->makeMark( *pPaM, aBookmarkName, diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index f36ebeda5d..eda0dea5fa 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -46,10 +46,10 @@ #include <com/sun/star/drawing/XShape.hpp> #include <hintids.hxx> #include <svx/svdoole2.hxx> -#include <svx/msdffimp.hxx> +#include <filter/msfilter/msdffimp.hxx> #include <svx/impgrf.hxx> #include <svx/unoapi.hxx> -#include <svx/msocximex.hxx> +#include <filter/msfilter/msocximex.hxx> #include <sot/exchange.hxx> #include <swtypes.hxx> diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 3cded67e9f..7e6e294866 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -40,9 +40,9 @@ #include <tools/solar.h> #include <com/sun/star/ucb/XCommandEnvironment.hpp> -#include <svtools/urihelper.hxx> -#include <svtools/zforlist.hxx> -#include <svtools/zformat.hxx> +#include <svl/urihelper.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> #include <sfx2/linkmgr.hxx> #ifndef _UCBHELPER_CONTENT_HXX_ diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 64143da9d8..9739922e4a 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ #include <stdlib.h> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <rtl/tencinfo.h> @@ -3282,7 +3282,7 @@ void SwWW8ImplReader::Read_SubSuperProp( USHORT, const BYTE* pData, short nLen ) const SvxFontHeightItem* pF = (const SvxFontHeightItem*)GetFmtAttr(RES_CHRATR_FONTSIZE); ASSERT(pF, "Expected to have the fontheight available here"); - + // #i59022: Check ensure nHeight != 0. Div by zero otherwise. INT32 nHeight = 240; if (pF != NULL && pF->GetHeight() != 0) @@ -4673,7 +4673,7 @@ void SwWW8ImplReader::Read_ParaBackColor(USHORT, const BYTE* pData, short nLen) sal_uInt32 SwWW8ImplReader::ExtractColour(const BYTE* &rpData, bool -#ifndef PRODUCT +#ifdef DBG_UTIL bVer67 #endif ) diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index ebecc1d1bd..76029cc249 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -686,7 +686,7 @@ void XMLRedlineImportHelper::InsertIntoDocument(RedlineInfo* pRedlineInfo) if( nPoint < pRedlineInfo->pContentIndex->GetIndex() || nPoint > pRedlineInfo->pContentIndex->GetNode().EndOfSectionIndex() ) pRedline->SetContentIdx(pRedlineInfo->pContentIndex); -#ifndef PRODUCT +#ifdef DBG_UTIL else ASSERT( false, "Recursive change tracking" ); #endif diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index db83d59eaf..90af842e88 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -55,10 +55,10 @@ #include <com/sun/star/packages/zip/ZipIOException.hpp> #include <com/sun/star/packages/WrongPasswordException.hpp> #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <sfx2/docfile.hxx> #include <svtools/sfxecode.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <unotools/streamwrap.hxx> #include <svx/xmlgrhlp.hxx> #include <svx/xmleohlp.hxx> diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index 87e4246504..b67efcd4fd 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -46,9 +46,9 @@ #include <unotools/streamwrap.hxx> #include <svx/xmlgrhlp.hxx> #include <svx/xmleohlp.hxx> -#include <svtools/saveopt.hxx> +#include <unotools/saveopt.hxx> #include <tools/urlobj.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <sfx2/frame.hxx> #include <sfx2/docfile.hxx> #include <pam.hxx> diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index f2ec2a722d..25544a79c5 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -41,13 +41,9 @@ #include <com/sun/star/xforms/XFormsSupplier.hpp> #include <svx/svdmodel.hxx> #include <svx/svdpage.hxx> -#ifndef _XMLGRHLP_HXX -#ifndef _XMLGRHLP_HXX #include <svx/xmlgrhlp.hxx> -#endif #include <svx/xmleohlp.hxx> #include <svx/xmlgrhlp.hxx> -#endif #include <svx/eeitem.hxx> #include <svx/svddef.hxx> #include <xmloff/nmspmap.hxx> @@ -66,9 +62,7 @@ #include <xmltexte.hxx> #include <xmlexp.hxx> #include <sfx2/viewsh.hxx> -#ifndef _COMPHELPER_PROCESSFACTORYHXX_ #include <comphelper/processfactory.hxx> -#endif #include <docary.hxx> #include <svx/unolingu.hxx> #include <svx/forbiddencharacterstable.hxx> @@ -326,13 +320,15 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) // figures given above // The styles in pDoc also count the default style that never // gets exported -> subtract one. - sal_Int32 nRef = 1; + sal_Int32 nRef = 1; // meta.xml nRef += pDoc->GetCharFmts()->Count() - 1; nRef += pDoc->GetFrmFmts()->Count() - 1; nRef += pDoc->GetTxtFmtColls()->Count() - 1; // nRef += pDoc->GetPageDescCnt(); - nRef += aDocStat.nPara; - pProgress->SetReference( 2*nRef ); + nRef *= 2; // for the above styles, xmloff will increment by 2! + // #i93174#: count all paragraphs for the progress bar + nRef += aDocStat.nAllPara; // 1: only content, no autostyle + pProgress->SetReference( nRef ); pProgress->SetValue( 0 ); } } diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx index 2135be52ea..37f906d66f 100644 --- a/sw/source/filter/xml/xmlexpit.cxx +++ b/sw/source/filter/xml/xmlexpit.cxx @@ -34,9 +34,9 @@ #include <xmloff/xmluconv.hxx> #include <rtl/ustrbuf.hxx> -#include <svtools/itempool.hxx> -#include <svtools/poolitem.hxx> -#include <svtools/itemset.hxx> +#include <svl/itempool.hxx> +#include <svl/poolitem.hxx> +#include <svl/itemset.hxx> #include <xmloff/attrlist.hxx> #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> @@ -45,7 +45,7 @@ #ifndef _SVSTDARR_USHORTS #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index ec50718350..49be1e08ce 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -37,7 +37,7 @@ #ifndef _SVSTDARR_STRINGSSORT_DECL #define _SVSTDARR_STRINGSSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <xmloff/nmspmap.hxx> #include <format.hxx> diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index 84a39dd84b..3136f7b2fd 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,16 +38,11 @@ #include "xmlexpit.hxx" #include <xmloff/nmspmap.hxx> #include <xmloff/XMLTextListAutoStylePool.hxx> -#ifndef _XMLOFF_XMLTEXTMASTERPAGEEXPORT #include <xmloff/XMLTextMasterPageExport.hxx> -#endif -#ifndef _XMLOFF_TXTPRMAP_HXX #include <xmloff/txtprmap.hxx> -#endif #include <xmloff/xmlaustp.hxx> #include <xmloff/families.hxx> -#include <xmloff/ProgressBarHelper.hxx> #include <format.hxx> #include <fmtpdsc.hxx> #include <pagedesc.hxx> @@ -58,6 +53,7 @@ #include "xmlexp.hxx" #include <SwStyleNameMapper.hxx> + using ::rtl::OUString; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; @@ -87,7 +83,7 @@ void SwXMLExport::ExportFmt( const SwFmt& rFmt, enum XMLTokenEnum eFamily ) if( eFamily != XML_TOKEN_INVALID ) AddAttribute( XML_NAMESPACE_STYLE, XML_FAMILY, eFamily ); -#ifndef PRODUCT +#ifdef DBG_UTIL // style:parent-style-name="..." (if its not the default only) const SwFmt* pParent = rFmt.DerivedFrom(); // Parent-Namen nur uebernehmen, wenn kein Default diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 666a717bc1..a2856b65ad 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -65,7 +65,7 @@ #include <sfx2/printer.hxx> #include <ForbiddenCharactersEnum.hxx> #include <xmloff/xmluconv.hxx> -#include <svtools/saveopt.hxx> +#include <unotools/saveopt.hxx> #include <tools/diagnose_ex.h> #include <hash_set> #include <stringhash.hxx> @@ -179,7 +179,7 @@ SvXMLImportContext *SwXMLBodyContext_Impl::CreateChildContext( // --> OD 2006-10-11 #i69629# // enhance class <SwXMLDocContext_Impl> in order to be able to create subclasses // NB: virtually inherit so we can multiply inherit properly -// in SwXMLOfficeDocContext_Impl +// in SwXMLOfficeDocContext_Impl class SwXMLDocContext_Impl : public virtual SvXMLImportContext { // --> OD 2006-10-11 #i69629# @@ -385,7 +385,7 @@ void SwXMLDocStylesContext_Impl::EndElement() // assign paragraph styles to list levels of outline style after all styles // are imported and finished. SwXMLImport& rSwImport = dynamic_cast<SwXMLImport&>( GetImport()); - GetImport().GetTextImport()->SetOutlineStyles( + GetImport().GetTextImport()->SetOutlineStyles( (rSwImport.GetStyleFamilyMask() & SFX_STYLE_FAMILY_PARA ) ? sal_True : sal_False); // <-- } @@ -842,7 +842,7 @@ void SwXMLImport::endDocument( void ) pTxtNode->GetTxt().Len() ); } -#ifndef PRODUCT +#ifdef DBG_UTIL // !!! This should be impossible !!!! ASSERT( pSttNdIdx->GetIndex()+1 != pPaM->GetBound( sal_True ).nNode.GetIndex(), diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx index fd17a1c222..2f452eb807 100644 --- a/sw/source/filter/xml/xmlimpit.cxx +++ b/sw/source/filter/xml/xmlimpit.cxx @@ -32,9 +32,9 @@ #include "precompiled_sw.hxx" #include "xmlimpit.hxx" #include <xmloff/xmluconv.hxx> -#include <svtools/itempool.hxx> -#include <svtools/poolitem.hxx> -#include <svtools/itemset.hxx> +#include <svl/itempool.hxx> +#include <svl/poolitem.hxx> +#include <svl/itemset.hxx> #include <xmloff/attrlist.hxx> #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index 933c31be23..4aaa7bceaa 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -39,8 +39,8 @@ #include <xmloff/xmltoken.hxx> #include <xmloff/xmluconv.hxx> #include <xmloff/numehelp.hxx> -#include <svtools/cntnrsrt.hxx> -#include <svtools/zforlist.hxx> +#include <svl/cntnrsrt.hxx> +#include <svl/zforlist.hxx> #include <svx/brshitem.hxx> #include <svx/boxitem.hxx> #include <fmtrowsplt.hxx> @@ -142,7 +142,7 @@ SwXMLTableLines_Impl::SwXMLTableLines_Impl( const SwTableLines& rLines ) : pLines( &rLines ), nWidth( 0UL ) { -#ifndef PRODUCT +#ifdef DBG_UTIL sal_uInt16 nEndCPos = 0U; #endif sal_uInt16 nLines = rLines.Count(); @@ -176,7 +176,7 @@ SwXMLTableLines_Impl::SwXMLTableLines_Impl( const SwTableLines& rLines ) : } else { -#ifndef PRODUCT +#ifdef DBG_UTIL sal_uInt16 nCheckPos = nCPos + (sal_uInt16)SwWriteTable::GetBoxWidth( pBox ); if( !nEndCPos ) @@ -193,7 +193,7 @@ SwXMLTableLines_Impl::SwXMLTableLines_Impl( const SwTableLines& rLines ) : } #endif nCPos = (sal_uInt16)nWidth; -#ifndef PRODUCT +#ifdef DBG_UTIL SwXMLTableColumn_Impl aCol( (sal_uInt16)nWidth ); ASSERT( aCols.Seek_Entry(&aCol), "couldn't find last column" ); ASSERT( SwXMLTableColumn_Impl(nCheckPos) == @@ -699,7 +699,7 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines, // Und ihren Index sal_uInt16 nOldCol = nCol; SwXMLTableColumn_Impl aCol( nCPos ); -#ifndef PRODUCT +#ifdef DBG_UTIL sal_Bool bFound = #endif pLines->GetColumns().Seek_Entry( &aCol, &nCol ); @@ -989,7 +989,7 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine, const sal_uInt16 nOldCol = nCol; { SwXMLTableColumn_Impl aCol( nCPos ); -#ifndef PRODUCT +#ifdef DBG_UTIL const sal_Bool bFound = #endif rLines.GetColumns().Seek_Entry( &aCol, &nCol ); diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 20eb2e53ed..7e6c33c9e7 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -39,8 +39,8 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/table/XCellRange.hpp> -#include <svtools/itemset.hxx> -#include <svtools/zformat.hxx> +#include <svl/itemset.hxx> +#include <svl/zformat.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltkmap.hxx> #include <xmloff/nmspmap.hxx> @@ -2315,7 +2315,7 @@ SwTableLine *SwXMLTableContext::MakeTableLine( SwTableBox *pUpper, bSplit = 1UL == pCell->GetColSpan(); } -#ifndef PRODUCT +#ifdef DBG_UTIL if( nCol == nRightCol-1UL ) { ASSERT( bSplit, "Split-Flag falsch" ); diff --git a/sw/source/filter/xml/xmltbli.hxx b/sw/source/filter/xml/xmltbli.hxx index b6477044ac..1fceac3718 100644 --- a/sw/source/filter/xml/xmltbli.hxx +++ b/sw/source/filter/xml/xmltbli.hxx @@ -40,7 +40,7 @@ #define _SVSTDARR_USHORTS #define _SVSTDARR_BOOLS #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif class SwXMLImport; diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx index 254cae1f7f..e577bf8a57 100644 --- a/sw/source/filter/xml/xmltexte.cxx +++ b/sw/source/filter/xml/xmltexte.cxx @@ -60,8 +60,8 @@ #include <SwAppletImpl.hxx> #define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> -#include "svtools/urihelper.hxx" +#include <svl/svstdarr.hxx> +#include "svl/urihelper.hxx" #include <sfx2/frmdescr.hxx> #include <SwStyleNameMapper.hxx> diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index 160aa2286a..695bb1a3b5 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -74,7 +74,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <svtools/embedhlp.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> using ::rtl::OUString; using ::rtl::OUStringBuffer; diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src index 76b853f149..985d4ddc95 100644 --- a/sw/source/ui/app/app.src +++ b/sw/source/ui/app/app.src @@ -30,7 +30,7 @@ -#include <svtools/style.hrc> +#include <svl/style.hrc> #include <sfx2/sfx.hrc> #include <svx/dialogs.hrc> #include <svx/globlmn.hrc> diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx index f4b4a4838d..c9ca781e7c 100644 --- a/sw/source/ui/app/apphdl.cxx +++ b/sw/source/ui/app/apphdl.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,10 +37,10 @@ #include <tools/link.hxx> #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/undoopt.hxx> -#include <svtools/pathoptions.hxx> +#include <svl/svstdarr.hxx> +#include <svl/urihelper.hxx> +#include <unotools/undoopt.hxx> +#include <unotools/pathoptions.hxx> #include <svtools/accessibilityoptions.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/event.hxx> @@ -48,15 +48,15 @@ #include <svx/dataaccessdescriptor.hxx> #include <svx/srchitem.hxx> #include <svtools/colorcfg.hxx> -#include <svtools/eitem.hxx> -#include <svtools/whiter.hxx> -#include <svtools/isethint.hxx> +#include <svl/eitem.hxx> +#include <svl/whiter.hxx> +#include <svl/isethint.hxx> #include <svx/hyprlink.hxx> #include <sfx2/request.hxx> #include <sfx2/fcontnr.hxx> -#include <svtools/stritem.hxx> -#include <svtools/ctloptions.hxx> -#include <svtools/useroptions.hxx> +#include <svl/stritem.hxx> +#include <svl/ctloptions.hxx> +#include <unotools/useroptions.hxx> #include <vcl/msgbox.hxx> #include <vcl/wrkwin.hxx> #include <svx/insctrl.hxx> @@ -753,82 +753,8 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } else if(rHint.ISA(SfxSimpleHint)) { - ULONG nHintId = ((SfxSimpleHint&)rHint).GetId(); - if(SFX_HINT_COLORS_CHANGED == nHintId || - SFX_HINT_ACCESSIBILITY_CHANGED == nHintId ) - { - sal_Bool bAccessibility = sal_False; - if(SFX_HINT_COLORS_CHANGED == nHintId) - SwViewOption::ApplyColorConfigValues(*pColorConfig); - else - bAccessibility = sal_True; - - //invalidate all edit windows - const TypeId aSwViewTypeId = TYPE(SwView); - const TypeId aSwPreViewTypeId = TYPE(SwPagePreView); - const TypeId aSwSrcViewTypeId = TYPE(SwSrcView); - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while(pViewShell) - { - if(pViewShell->GetWindow()) - { - if((pViewShell->IsA(aSwViewTypeId) || - pViewShell->IsA(aSwPreViewTypeId) || - pViewShell->IsA(aSwSrcViewTypeId))) - { - if(bAccessibility) - { - if(pViewShell->IsA(aSwViewTypeId)) - ((SwView*)pViewShell)->ApplyAccessiblityOptions(*pAccessibilityOptions); - else if(pViewShell->IsA(aSwPreViewTypeId)) - ((SwPagePreView*)pViewShell)->ApplyAccessiblityOptions(*pAccessibilityOptions); - } - pViewShell->GetWindow()->Invalidate(); - } - } - pViewShell = SfxViewShell::GetNext( *pViewShell ); - } - } - else if( SFX_HINT_CTL_SETTINGS_CHANGED == nHintId ) - { - const SfxObjectShell* pObjSh = SfxObjectShell::GetFirst(); - while( pObjSh ) - { - if( pObjSh->IsA(TYPE(SwDocShell)) ) - { - const SwDoc* pDoc = ((SwDocShell*)pObjSh)->GetDoc(); - ViewShell* pVSh = 0; - pDoc->GetEditShell( &pVSh ); - if ( pVSh ) - pVSh->ChgNumberDigits(); - } - pObjSh = SfxObjectShell::GetNext(*pObjSh); - } - } - else if(SFX_HINT_USER_OPTIONS_CHANGED == nHintId) - { - bAuthorInitialised = FALSE; - } - else if(SFX_HINT_UNDO_OPTIONS_CHANGED == nHintId) - { - const int nNew = GetUndoOptions().GetUndoCount(); - const int nOld = SwEditShell::GetUndoActionCount(); - if(!nNew || !nOld) - { - sal_Bool bUndo = nNew != 0; - //ueber DocShells iterieren und Undo umschalten - - TypeId aType(TYPE(SwDocShell)); - SwDocShell* pDocShell = (SwDocShell*)SfxObjectShell::GetFirst(&aType); - while( pDocShell ) - { - pDocShell->GetDoc()->DoUndo( bUndo ); - pDocShell = (SwDocShell*)SfxObjectShell::GetNext(*pDocShell, &aType); - } - } - SwEditShell::SetUndoActionCount( static_cast< USHORT >(nNew)); - } - else if(SFX_HINT_DEINITIALIZING == nHintId) + USHORT nHintId = ((SfxSimpleHint&)rHint).GetId(); + if(SFX_HINT_DEINITIALIZING == nHintId) { DELETEZ(pWebUsrPref); DELETEZ(pUsrPref) ; @@ -842,20 +768,98 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) DELETEZ(pWebToolbarConfig) ; DELETEZ(pAuthorNames) ; DELETEZ(pDBConfig); - EndListening(*pColorConfig); + pColorConfig->RemoveListener(this); DELETEZ(pColorConfig); - EndListening(*pAccessibilityOptions); + pAccessibilityOptions->RemoveListener(this); DELETEZ(pAccessibilityOptions); - EndListening(*pCTLOptions); + pCTLOptions->RemoveListener(this); DELETEZ(pCTLOptions); - EndListening(*pUserOptions); + pUserOptions->RemoveListener(this); DELETEZ(pUserOptions); - EndListening(*pUndoOptions); + pUndoOptions->RemoveListener(this); DELETEZ(pUndoOptions); } } } +void SwModule::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, sal_uInt32 ) +{ + if( pBrdCst == pUserOptions ) + { + bAuthorInitialised = FALSE; + } + else if( pBrdCst == pUndoOptions ) + { + const int nNew = GetUndoOptions().GetUndoCount(); + const int nOld = SwEditShell::GetUndoActionCount(); + if(!nNew || !nOld) + { + sal_Bool bUndo = nNew != 0; + //ueber DocShells iterieren und Undo umschalten + + TypeId aType(TYPE(SwDocShell)); + SwDocShell* pDocShell = (SwDocShell*)SfxObjectShell::GetFirst(&aType); + while( pDocShell ) + { + pDocShell->GetDoc()->DoUndo( bUndo ); + pDocShell = (SwDocShell*)SfxObjectShell::GetNext(*pDocShell, &aType); + } + } + SwEditShell::SetUndoActionCount( static_cast< USHORT >(nNew)); + } + else if ( pBrdCst == pColorConfig || pBrdCst == pAccessibilityOptions ) + { + sal_Bool bAccessibility = sal_False; + if( pBrdCst == pColorConfig ) + SwViewOption::ApplyColorConfigValues(*pColorConfig); + else + bAccessibility = sal_True; + + //invalidate all edit windows + const TypeId aSwViewTypeId = TYPE(SwView); + const TypeId aSwPreViewTypeId = TYPE(SwPagePreView); + const TypeId aSwSrcViewTypeId = TYPE(SwSrcView); + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while(pViewShell) + { + if(pViewShell->GetWindow()) + { + if((pViewShell->IsA(aSwViewTypeId) || + pViewShell->IsA(aSwPreViewTypeId) || + pViewShell->IsA(aSwSrcViewTypeId))) + { + if(bAccessibility) + { + if(pViewShell->IsA(aSwViewTypeId)) + ((SwView*)pViewShell)->ApplyAccessiblityOptions(*pAccessibilityOptions); + else if(pViewShell->IsA(aSwPreViewTypeId)) + ((SwPagePreView*)pViewShell)->ApplyAccessiblityOptions(*pAccessibilityOptions); + } + pViewShell->GetWindow()->Invalidate(); + } + } + pViewShell = SfxViewShell::GetNext( *pViewShell ); + } + } + else if( pBrdCst == pCTLOptions ) + { + const SfxObjectShell* pObjSh = SfxObjectShell::GetFirst(); + while( pObjSh ) + { + if( pObjSh->IsA(TYPE(SwDocShell)) ) + { + const SwDoc* pDoc = ((SwDocShell*)pObjSh)->GetDoc(); + ViewShell* pVSh = 0; + pDoc->GetEditShell( &pVSh ); + if ( pVSh ) + pVSh->ChgNumberDigits(); + } + pObjSh = SfxObjectShell::GetNext(*pObjSh); + } + } + +} + /* -----------------------------20.02.01 12:43-------------------------------- ---------------------------------------------------------------------------*/ @@ -874,7 +878,7 @@ svtools::ColorConfig& SwModule::GetColorConfig() { pColorConfig = new svtools::ColorConfig; SwViewOption::ApplyColorConfigValues(*pColorConfig); - StartListening(*pColorConfig); + pColorConfig->AddListener(this); } return *pColorConfig; } @@ -886,7 +890,7 @@ SvtAccessibilityOptions& SwModule::GetAccessibilityOptions() if(!pAccessibilityOptions) { pAccessibilityOptions = new SvtAccessibilityOptions; - StartListening(*pAccessibilityOptions); + pAccessibilityOptions->AddListener(this); } return *pAccessibilityOptions; } @@ -898,7 +902,7 @@ SvtCTLOptions& SwModule::GetCTLOptions() if(!pCTLOptions) { pCTLOptions = new SvtCTLOptions; - StartListening(*pCTLOptions); + pCTLOptions->AddListener(this); } return *pCTLOptions; } @@ -910,7 +914,7 @@ SvtUserOptions& SwModule::GetUserOptions() if(!pUserOptions) { pUserOptions = new SvtUserOptions; - StartListening(*pUserOptions); + pUserOptions->AddListener(this); } return *pUserOptions; } @@ -922,7 +926,7 @@ SvtUndoOptions& SwModule::GetUndoOptions() if(!pUndoOptions) { pUndoOptions = new SvtUndoOptions; - StartListening(*pUndoOptions); + pUndoOptions->AddListener(this); } return *pUndoOptions; } diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx index 26dbff2f8e..dd95c398eb 100644 --- a/sw/source/ui/app/appopt.cxx +++ b/sw/source/ui/app/appopt.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,12 +38,12 @@ #include <com/sun/star/i18n/ScriptType.hpp> #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <sfx2/request.hxx> #include <sfx2/app.hxx> #include <sfx2/printer.hxx> @@ -87,14 +87,14 @@ #include <glosdoc.hxx> #include <uiitems.hxx> #include <svx/langitem.hxx> -#include <svtools/lingucfg.hxx> +#include <unotools/lingucfg.hxx> #include <svx/unolingu.hxx> #ifndef _GLOBALS_HRC #include <globals.hrc> #endif #include <globals.h> // globale Konstanten z.B. -#include <svtools/slstitm.hxx> +#include <svl/slstitm.hxx> #include "swabstdlg.hxx" #include <swwrtshitem.hxx> @@ -151,7 +151,7 @@ SfxItemSet* SwModule::CreateItemSet( USHORT nId ) SID_ATTR_LANGUAGE, SID_ATTR_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE, -#ifndef PRODUCT +#ifdef DBG_UTIL FN_PARAM_SWTEST, FN_PARAM_SWTEST, #endif 0); @@ -285,7 +285,7 @@ SfxItemSet* SwModule::CreateItemSet( USHORT nId ) pRet->Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND)); } -#ifndef PRODUCT +#ifdef DBG_UTIL /*-----------------01.02.97 13.02------------------- Test-Optionen --------------------------------------------------*/ @@ -491,7 +491,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) } -#ifndef PRODUCT +#ifdef DBG_UTIL /*-------------------------------------------------------------------------- Writer Testseite auswerten ----------------------------------------------------------------------------*/ @@ -614,7 +614,7 @@ SfxTabPage* SwModule::CreateTabPage( USHORT nId, Window* pParent, const SfxItemS } } break; -#ifndef PRODUCT +#ifdef DBG_UTIL case RID_SW_TP_OPTTEST_PAGE: { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index ec29858041..8cb2cdb66c 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -38,16 +38,15 @@ #include <vcl/wrkwin.hxx> #include <vcl/jobset.hxx> #include <tools/urlobj.hxx> -#include <svtools/whiter.hxx> -#include <svtools/zforlist.hxx> -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/whiter.hxx> +#include <svl/zforlist.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> #include <svx/adjitem.hxx> #include <basic/sbx.hxx> -#include <svtools/moduleoptions.hxx> -#include <sfx2/app.hxx> +#include <unotools/moduleoptions.hxx> +#include <unotools/misccfg.hxx> #include <sfx2/request.hxx> -#include <svtools/misccfg.hxx> #include <sfx2/passwd.hxx> #include <sfx2/bindings.hxx> #include <sfx2/docfile.hxx> @@ -58,7 +57,6 @@ #include <svx/srchitem.hxx> #include <svx/flstitem.hxx> #include <svx/htmlmode.hxx> -#include <svx/svxmsbas.hxx> #include <svtools/soerr.hxx> #include <sot/clsids.hxx> #include <basic/basmgr.hxx> @@ -111,8 +109,8 @@ #include "warnpassword.hxx" #include <cfgid.h> -#include <svtools/moduleoptions.hxx> -#include <svtools/fltrcfg.hxx> +#include <unotools/moduleoptions.hxx> +#include <unotools/fltrcfg.hxx> #include <svx/htmlcfg.hxx> #include <sfx2/fcontnr.hxx> #include <sfx2/objface.hxx> @@ -382,8 +380,7 @@ BOOL SwDocShell::Save() //SvxImportMSVBasic aTmp( *this, pIo->GetStorage() ); //aTmp.SaveOrDelMSVBAStorage( FALSE, aEmptyStr ); if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() ) - nVBWarning = SvxImportMSVBasic:: - GetSaveWarningOfMSVBAStorage( *this ); + nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) (*this) ); pDoc->SetContainsMSVBasic( FALSE ); } @@ -501,8 +498,7 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) //SvxImportMSVBasic aTmp( *this, pIo->GetStorage() ); //aTmp.SaveOrDelMSVBAStorage( FALSE, aEmptyStr ); if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() ) - nVBWarning = SvxImportMSVBasic:: - GetSaveWarningOfMSVBAStorage( *this ); + nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) *this ); pDoc->SetContainsMSVBasic( FALSE ); } @@ -599,8 +595,7 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) DBG_ASSERT( !xStg->GetError(), "No storage available for storing VBA macros!" ); if ( !xStg->GetError() ) { - SvxImportMSVBasic aTmp( *this, *xStg ); - nVBWarning = aTmp.SaveOrDelMSVBAStorage( bSave, String::CreateFromAscii("Macros") ); + nVBWarning = SaveOrDelMSVBAStorage( (SfxObjectShell&) *this, *xStg, bSave, String::CreateFromAscii("Macros") ); xStg->Commit(); pDoc->SetContainsMSVBasic( TRUE ); } @@ -1134,7 +1129,7 @@ void SwDocShell::GetState(SfxItemSet& rSet) rSet.Put( SfxUInt16Item( nWhich, static_cast< sal_uInt16 >( pFmtr ? pFmtr->GetYear2000() - : SFX_APP()->GetMiscConfig()->GetYear2000() ))); + : ::utl::MiscCfg().GetYear2000() ))); } break; case SID_ATTR_CHAR_FONTLIST: diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 1b0a0c1c0e..edfbe2883c 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -49,14 +49,14 @@ #ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif -#include <svtools/lckbitem.hxx> -#include <svtools/eitem.hxx> +#include <svl/lckbitem.hxx> +#include <svl/eitem.hxx> /* -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> */ -#include <svtools/zforlist.hxx> -#include <svtools/zformat.hxx> -#include <svtools/pathoptions.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> +#include <unotools/pathoptions.hxx> #include <svtools/transfer.hxx> #ifndef _SFXSIDS_HRC //autogen #include <sfx2/dialogs.hrc> @@ -180,8 +180,6 @@ SfxDocumentInfoDialog* SwDocShell::CreateDocumentInfoDialog( Window *pParent, const SfxItemSet &rSet) { SfxDocumentInfoDialog* pDlg = new SfxDocumentInfoDialog(pParent, rSet); -// const SfxDocumentInfoItem& rItem = (const SfxDocumentInfoItem&)rSet.Get(SID_DOCINFO); -// if(rItem.IsOwnFormat()) //nur mit Statistik, wenn dieses Doc auch angezeigt wird, nicht //aus dem Doc-Manager SwDocShell* pDocSh = (SwDocShell*) SfxObjectShell::Current(); @@ -641,7 +639,7 @@ void SwDocShell::Execute(SfxRequest& rReq) SvStringsISortDtor aTmpLst; aTmpLst.Insert( &rACW.GetWordList() ); pAFlags->pAutoCmpltList = &aTmpLst; - + SfxApplication* pApp = SFX_APP(); SfxRequest aAppReq(SID_AUTO_CORRECT_DLG, SFX_CALLMODE_SYNCHRON, pApp->GetPool()); SfxBoolItem aSwOptions( SID_AUTO_CORRECT_DLG, TRUE ); @@ -1230,7 +1228,7 @@ void SwDocShell::Execute(SfxRequest& rReq) { bDone = FALSE; BOOL bCreateHtml = FN_NEW_HTML_DOC == nWhich; - + BOOL bCreateByOutlineLevel = false; //#outline level,add by zhaojianwei sal_Int32 nTemplateOutlineLevel = 0 ; //#outline level,add by zhaojianwei @@ -1342,7 +1340,7 @@ void SwDocShell::Execute(SfxRequest& rReq) // aListBoxEntries.realloc(nIdx); //<-end,zhaojianwei - + //#outline level,add by zhaojianwei ///////////////////////////////////////////////////////////////////// @@ -1352,7 +1350,7 @@ void SwDocShell::Execute(SfxRequest& rReq) { int nLevel; for(USHORT n = 0; n < rOutlNds.Count(); ++n ) - if( ( nLevel = rOutlNds[n]->GetTxtNode()->GetAttrOutlineLevel()) > 0 && + if( ( nLevel = rOutlNds[n]->GetTxtNode()->GetAttrOutlineLevel()) > 0 && ! bOutline[nLevel-1] ) { bOutline[nLevel-1] = true; @@ -1450,7 +1448,7 @@ void SwDocShell::Execute(SfxRequest& rReq) if( PrepareClose( FALSE ) ) { SwWait aWait( *this, TRUE ); - + //bDone = bCreateHtml //#outline level,removed by zhaojianwei // ? pDoc->GenerateHTMLDoc( aFileName, pSplitColl ) // : pDoc->GenerateGlobalDoc( aFileName, pSplitColl ); @@ -1609,7 +1607,7 @@ void SwDocShell::SetModified( BOOL bSet ) { if (!pDoc->IsInCallModified() ) { - EnableSetModified( FALSE ); + EnableSetModified( FALSE ); if( bSet ) { BOOL bOld = pDoc->IsModified(); @@ -1813,7 +1811,7 @@ void SwDocShell::ToggleBrowserMode(BOOL bSet, SwView* _pView ) } while ( pTmpFrm ); const SwViewOption& rViewOptions = *pTempView->GetWrtShell().GetViewOptions(); - + // set view columns before toggling: if ( bSet ) { diff --git a/sw/source/ui/app/docshdrw.cxx b/sw/source/ui/app/docshdrw.cxx index b91f9183bf..ab1d4d4f62 100644 --- a/sw/source/ui/app/docshdrw.cxx +++ b/sw/source/ui/app/docshdrw.cxx @@ -45,7 +45,7 @@ -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <svx/drawitem.hxx> #include <svx/svdmodel.hxx> #include <svx/svdoutl.hxx> diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index b2ce3411c4..7853c7f8fd 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,19 +40,16 @@ #include <i18npool/mslangid.hxx> #include <sot/storinfo.hxx> #include <sot/storage.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include <svtools/ctrltool.hxx> -#include <svtools/lingucfg.hxx> +#include <unotools/lingucfg.hxx> #include <sfx2/docfile.hxx> -#ifndef _OFA_MISCCFG_HXX //autogen -#include <svtools/misccfg.hxx> -#endif #include <sfx2/printer.hxx> #include <sfx2/bindings.hxx> #include <svx/asiancfg.hxx> #include <svx/unolingu.hxx> #include <sfx2/request.hxx> -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include <svx/adjitem.hxx> #ifndef _SVX_AKRNTEM_HXX #include <svx/akrnitem.hxx> @@ -655,7 +652,7 @@ sal_Bool SwDocShell::Load( SfxMedium& rMedium ) pDoc->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true); } } -#ifndef PRODUCT +#ifdef DBG_UTIL else ASSERT( !this, "ohne Sw3Reader geht nichts" ); #endif @@ -824,7 +821,7 @@ void SwDocShell::SubInitNew() sal_Bool bSquaredPageMode = SW_MOD()->GetUsrPref(FALSE)->IsSquaredPageMode(); pDoc->SetDefaultPageMode( bSquaredPageMode ); } - + pDoc->ResetModified(); } diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx index 5168264a93..67828f5471 100644 --- a/sw/source/ui/app/docst.cxx +++ b/sw/source/ui/app/docst.cxx @@ -36,16 +36,16 @@ #include <hintids.hxx> #include <sfx2/app.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <sfx2/templdlg.hxx> #include <sfx2/tplpitem.hxx> #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/newstyle.hxx> -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include <svx/brshitem.hxx> -#include <svtools/stritem.hxx> -#include <svtools/languageoptions.hxx> +#include <svl/stritem.hxx> +#include <svl/languageoptions.hxx> #include <svx/eeitem.hxx> #include <svx/htmlmode.hxx> #include <swmodule.hxx> diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx index db72c86319..e4c324ce3e 100644 --- a/sw/source/ui/app/docstyle.cxx +++ b/sw/source/ui/app/docstyle.cxx @@ -33,11 +33,11 @@ #define _SVSTDARR_USHORTS -#include <svtools/smplhint.hxx> +#include <svl/smplhint.hxx> #include <hintids.hxx> -#include <svtools/itemiter.hxx> -#include <svtools/eitem.hxx> -#include <svtools/syslocale.hxx> +#include <svl/itemiter.hxx> +#include <svl/eitem.hxx> +#include <unotools/syslocale.hxx> #include <svx/boxitem.hxx> #include <svx/numitem.hxx> // --> OD 2008-02-13 #newlistlevelattrs# @@ -68,7 +68,7 @@ #endif #include <paratr.hxx> #include <SwStyleNameMapper.hxx> -#include <svtools/cjkoptions.hxx> +#include <svl/cjkoptions.hxx> #include <comphelper/processfactory.hxx> #include <unotools/localedatawrapper.hxx> #include <unotools/intlwrapper.hxx> diff --git a/sw/source/ui/app/mainwn.cxx b/sw/source/ui/app/mainwn.cxx index c86509835b..486d4d0c54 100644 --- a/sw/source/ui/app/mainwn.cxx +++ b/sw/source/ui/app/mainwn.cxx @@ -37,7 +37,7 @@ #include <tools/shl.hxx> #include <tools/string.hxx> #ifndef _SVARRAY_HXX -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <sfx2/progress.hxx> #ifndef _RESID_HXX //autogen diff --git a/sw/source/ui/app/swdll.cxx b/sw/source/ui/app/swdll.cxx index d26756eaae..965708ca15 100644 --- a/sw/source/ui/app/swdll.cxx +++ b/sw/source/ui/app/swdll.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -51,7 +51,7 @@ #include <dobjfac.hxx> #include <cfgid.h> -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #ifndef _FM_FMOBJFAC_HXX #include <svx/fmobjfac.hxx> diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx index 50e28709d4..50d2e81697 100644 --- a/sw/source/ui/app/swmodul1.cxx +++ b/sw/source/ui/app/swmodul1.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -36,7 +36,7 @@ #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/childwin.hxx> -#include <svtools/useroptions.hxx> +#include <unotools/useroptions.hxx> #include <cppuhelper/weak.hxx> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> @@ -294,7 +294,7 @@ void SwModule::ApplyRulerMetric( FieldUnit eMetric, BOOL bHorizontal, BOOL bWeb } if( bHorizontal ) pPref->SetHScrollMetric(eMetric); - else + else pPref->SetVScrollMetric(eMetric); SwView* pTmpView = SwModule::GetFirstView(); diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx index 779add8526..fe2c630dcb 100644 --- a/sw/source/ui/app/swmodule.cxx +++ b/sw/source/ui/app/swmodule.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -154,7 +154,7 @@ #include <svtools/colorcfg.hxx> #include <svx/acorrcfg.hxx> -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #ifndef _AVMEDIA_MEDIAPPLAYER_HXX #include <avmedia/mediaplayer.hxx> diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx index d21b3340a0..39445817f1 100644 --- a/sw/source/ui/chrdlg/break.cxx +++ b/sw/source/ui/chrdlg/break.cxx @@ -37,7 +37,7 @@ #include <sfx2/request.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index 033d96e955..44ee430c60 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -41,11 +41,11 @@ #ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif -#include <svtools/urihelper.hxx> -#include <svtools/stritem.hxx> +#include <svl/urihelper.hxx> +#include <svl/stritem.hxx> #include <svx/flstitem.hxx> #include <svx/htmlmode.hxx> -#include <svtools/cjkoptions.hxx> +#include <svl/cjkoptions.hxx> #ifndef _CMDID_H #include <cmdid.h> diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index 37913b4da4..4fc483c056 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -39,7 +39,7 @@ #include <hintids.hxx> #define _SVSTDARR_STRINGSDTOR #define _SVSTDARR_STRINGSISORTDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include "cmdid.h" #include "swmodule.hxx" @@ -51,7 +51,7 @@ #ifndef _METRIC_HXX //autogen #include <vcl/metric.hxx> #endif -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <svx/fontitem.hxx> #include <svx/htmlmode.hxx> #include <sfx2/objsh.hxx> @@ -68,7 +68,7 @@ #define _SVSTDARR_XUB_STRLEN #define _SVSTDARR_USHORTS #define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include "charatr.hxx" #include "viewopt.hxx" diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx index 61816c9e81..1f6dd1e124 100644 --- a/sw/source/ui/chrdlg/numpara.cxx +++ b/sw/source/ui/chrdlg/numpara.cxx @@ -47,9 +47,9 @@ #ifndef _SVX_SVXIDS_HRC #include <svx/svxids.hrc> #endif -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> -#include <svtools/intitem.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> +#include <svl/intitem.hxx> #include <fmtline.hxx> #include <numpara.hxx> #include <numpara.hrc> diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx index d23a482187..e7189fd524 100644 --- a/sw/source/ui/chrdlg/pardlg.cxx +++ b/sw/source/ui/chrdlg/pardlg.cxx @@ -38,15 +38,15 @@ #include "hintids.hxx" #include <svx/htmlmode.hxx> -#include <svtools/style.hxx> +#include <svl/style.hxx> #include <svx/htmlcfg.hxx> #ifndef _SVSTDARR_STRINGSSORTDTOR #define _SVSTDARR_STRINGSSORTDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/cjkoptions.hxx> +#include <svl/cjkoptions.hxx> #include "docsh.hxx" #include "wrtsh.hxx" #include "frmatr.hxx" @@ -62,8 +62,8 @@ #include "chrdlg.hrc" #include "poolfmt.hrc" #include <svx/svxids.hrc> -#include <svtools/eitem.hxx> -#include <svtools/intitem.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> #include <svx/flagsdef.hxx> diff --git a/sw/source/ui/chrdlg/tblnumfm.cxx b/sw/source/ui/chrdlg/tblnumfm.cxx index 8dc40898e8..350b5bf049 100644 --- a/sw/source/ui/chrdlg/tblnumfm.cxx +++ b/sw/source/ui/chrdlg/tblnumfm.cxx @@ -51,7 +51,7 @@ #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <sfx2/tabdlg.hxx> SwNumFmtDlg::SwNumFmtDlg(Window* pParent, const SfxItemSet& rSet) diff --git a/sw/source/ui/config/barcfg.cxx b/sw/source/ui/config/barcfg.cxx index 79b92b9a7a..6686652bd9 100644 --- a/sw/source/ui/config/barcfg.cxx +++ b/sw/source/ui/config/barcfg.cxx @@ -151,3 +151,5 @@ void SwToolbarConfigItem::Commit() PutProperties(aNames, aValues); } +void SwToolbarConfigItem::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + diff --git a/sw/source/ui/config/cfgitems.cxx b/sw/source/ui/config/cfgitems.cxx index f0245d958b..43702e834c 100644 --- a/sw/source/ui/config/cfgitems.cxx +++ b/sw/source/ui/config/cfgitems.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -407,7 +407,7 @@ void SwShadowCursorItem::FillViewOptions( SwViewOption& rVOpt ) const rVOpt.SetShdwCrsrFillMode( eMode ); } -#ifndef PRODUCT +#ifdef DBG_UTIL /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ diff --git a/sw/source/ui/config/dbconfig.cxx b/sw/source/ui/config/dbconfig.cxx index 9ed37142d6..e87cc6dc9f 100644 --- a/sw/source/ui/config/dbconfig.cxx +++ b/sw/source/ui/config/dbconfig.cxx @@ -140,5 +140,7 @@ const SwDBData& SwDBConfig::GetBibliographySource() return *pBibImpl; } +void SwDBConfig::Commit() {} +void SwDBConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} diff --git a/sw/source/ui/config/fontcfg.cxx b/sw/source/ui/config/fontcfg.cxx index 533a3869e8..348244774e 100644 --- a/sw/source/ui/config/fontcfg.cxx +++ b/sw/source/ui/config/fontcfg.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -35,7 +35,7 @@ #include <fontcfg.hxx> #include <i18npool/mslangid.hxx> #include <vcl/outdev.hxx> -#include <svtools/lingucfg.hxx> +#include <unotools/lingucfg.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/i18n/ScriptType.hpp> @@ -358,3 +358,5 @@ sal_Int32 SwStdFontConfig::GetFontHeight( sal_uInt8 nFont, sal_uInt8 nScriptType return nRet; } +void SwStdFontConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx index fd8d7969b6..d4a0c25a59 100644 --- a/sw/source/ui/config/mailconfigpage.cxx +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -295,7 +295,7 @@ SwTestAccountSettingsDialog::SwTestAccountSettingsDialog(SwMailConfigPage* pPare #ifdef MSC #pragma warning (default : 4355) #endif - m_aImageList( SW_RES( GetSettings().GetStyleSettings().GetWindowColor().IsDark() ? ILIST_HC : ILIST) ), + m_aImageList( SW_RES( GetSettings().GetStyleSettings().GetHighContrastMode() ? ILIST_HC : ILIST) ), m_sTask( SW_RES( ST_TASK )), m_sStatus( SW_RES( ST_STATUS )), m_sEstablish( SW_RES( ST_ESTABLISH )), diff --git a/sw/source/ui/config/modcfg.cxx b/sw/source/ui/config/modcfg.cxx index 3f004af143..fa89402682 100644 --- a/sw/source/ui/config/modcfg.cxx +++ b/sw/source/ui/config/modcfg.cxx @@ -50,7 +50,7 @@ #include <modcfg.hxx> #endif #include <fldupde.hxx> -#include <svtools/syslocaleoptions.hxx> +#include <unotools/syslocaleoptions.hxx> #include <caption.hxx> #include <com/sun/star/uno/Any.hxx> @@ -336,6 +336,8 @@ sal_Int32 lcl_ConvertAttrToCfg(const AuthorCharAttr& rAttr) return nRet; } //----------------------------------------------------------------------------- +void SwRevisionConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + void SwRevisionConfig::Commit() { const Sequence<OUString>& aNames = GetPropertyNames(); @@ -691,6 +693,8 @@ void lcl_WriteOpt(const InsCaptionOpt& rOpt, Any* pValues, sal_Int32 nProp, sal_ } } //----------------------------------------------------------------------------- +void SwInsertConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + void SwInsertConfig::Commit() { const Sequence<OUString>& aNames = GetPropertyNames(); @@ -1207,6 +1211,8 @@ SwTableConfig::~SwTableConfig() /*-- 10.10.00 16:22:56--------------------------------------------------- -----------------------------------------------------------------------*/ +void SwTableConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + void SwTableConfig::Commit() { const Sequence<OUString>& aNames = GetPropertyNames(); @@ -1318,6 +1324,8 @@ const Sequence<OUString>& SwMiscConfig::GetPropertyNames() /*-- 18.01.01 17:02:47--------------------------------------------------- -----------------------------------------------------------------------*/ +void SwMiscConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + void SwMiscConfig::Commit() { const Sequence<OUString>& aNames = GetPropertyNames(); diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 8943eec2ed..3898e5ca36 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -76,7 +76,7 @@ #include <SwNodeNum.hxx> #include <doc.hxx> -#include <svtools/cjkoptions.hxx> +#include <svl/cjkoptions.hxx> using namespace ::com::sun::star; diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 886239a524..b16b22325e 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,11 +42,11 @@ #include <vcl/svapp.hxx> #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/cjkoptions.hxx> +#include <svl/cjkoptions.hxx> #include <svtools/ctrltool.hxx> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <svx/htmlmode.hxx> #include <sfx2/printer.hxx> #include <sfx2/bindings.hxx> @@ -97,10 +97,10 @@ #include <optdlg.hrc> #endif #include <svx/strarray.hxx> -#include <svtools/slstitm.hxx> +#include <svl/slstitm.hxx> #include <sfx2/request.hxx> #include <swwrtshitem.hxx> -#include <svtools/ctloptions.hxx> +#include <svl/ctloptions.hxx> #include <unomid.h> @@ -1763,7 +1763,7 @@ void SwMarkPreview::InitColors( void ) const StyleSettings& rSettings = GetSettings().GetStyleSettings(); m_aBgCol = Color( rSettings.GetWindowColor() ); - BOOL bHC = m_aBgCol.IsDark(); + BOOL bHC = rSettings.GetHighContrastMode(); m_aLineCol = bHC? SwViewOption::GetFontColor() : Color( COL_BLACK ); m_aShadowCol = bHC? m_aBgCol : rSettings.GetShadowColor(); m_aTxtCol = bHC? SwViewOption::GetFontColor() : Color( COL_GRAY ); @@ -2445,7 +2445,7 @@ void SwRedlineOptionsTabPage::InitFontStyle(SvxFontPrevWindow& rExampleWin) } -#ifndef PRODUCT +#ifdef DBG_UTIL /******************************************************* ******************************************************/ /*----------------- OS 11.01.95 ----------------------- diff --git a/sw/source/ui/config/prtopt.cxx b/sw/source/ui/config/prtopt.cxx index 6eed7fb1f8..9519dd6c21 100644 --- a/sw/source/ui/config/prtopt.cxx +++ b/sw/source/ui/config/prtopt.cxx @@ -143,6 +143,9 @@ SwPrintOptions::~SwPrintOptions() /* -----------------------------06.09.00 16:43-------------------------------- ---------------------------------------------------------------------------*/ + +void SwPrintOptions::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + void SwPrintOptions::Commit() { Sequence<OUString> aNames = GetPropertyNames(); diff --git a/sw/source/ui/config/uinums.cxx b/sw/source/ui/config/uinums.cxx index f11ccd86fc..ce2e162685 100644 --- a/sw/source/ui/config/uinums.cxx +++ b/sw/source/ui/config/uinums.cxx @@ -35,13 +35,13 @@ #include <hintids.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/pathoptions.hxx> +#include <svl/urihelper.hxx> +#include <unotools/pathoptions.hxx> #include <tools/stream.hxx> #ifndef _SFX_INIMGR_HXX #endif #include <sfx2/docfile.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svx/brshitem.hxx> diff --git a/sw/source/ui/config/usrpref.cxx b/sw/source/ui/config/usrpref.cxx index ad1285e3d0..44623ea8ad 100644 --- a/sw/source/ui/config/usrpref.cxx +++ b/sw/source/ui/config/usrpref.cxx @@ -33,7 +33,7 @@ #include <tools/stream.hxx> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #include "swtypes.hxx" #include "hintids.hxx" @@ -427,6 +427,9 @@ void SwLayoutViewConfig::Load() } } } + +void SwLayoutViewConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + /* -----------------------------19.01.01 13:07-------------------------------- ---------------------------------------------------------------------------*/ @@ -531,6 +534,8 @@ void SwGridConfig::Load() } } +void SwGridConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + /* -----------------------------19.01.01 13:07-------------------------------- ---------------------------------------------------------------------------*/ @@ -621,6 +626,9 @@ void SwCursorConfig::Load() } } + +void SwCursorConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + /*-- 28.09.00 09:55:33--------------------------------------------------- -----------------------------------------------------------------------*/ @@ -654,6 +662,9 @@ void SwWebColorConfig::Commit() } PutProperties(aPropNames, aValues); } + +void SwWebColorConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + /*-- 28.09.00 09:55:34--------------------------------------------------- -----------------------------------------------------------------------*/ diff --git a/sw/source/ui/config/viewopt.cxx b/sw/source/ui/config/viewopt.cxx index fed94bcba8..bfd650b8a4 100644 --- a/sw/source/ui/config/viewopt.cxx +++ b/sw/source/ui/config/viewopt.cxx @@ -58,11 +58,11 @@ #include <crstate.hxx> #include <svtools/colorcfg.hxx> #include <svtools/accessibilityoptions.hxx> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #include <svx/acorrcfg.hxx> -#ifndef PRODUCT +#ifdef DBG_UTIL BOOL SwViewOption::bTest9 = FALSE; //DrawingLayerNotLoading #endif Color SwViewOption::aDocBoundColor(COL_LIGHTGRAY); @@ -115,7 +115,7 @@ BOOL SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const && bFormView == rOpt.IsFormView() && mbViewLayoutBookMode == rOpt.mbViewLayoutBookMode && bShowPlaceHolderFields == rOpt.bShowPlaceHolderFields -#ifndef PRODUCT +#ifdef DBG_UTIL // korrespondieren zu den Angaben in ui/config/cfgvw.src && bTest1 == rOpt.IsTest1() && bTest2 == rOpt.IsTest2() @@ -246,7 +246,7 @@ SwViewOption::SwViewOption() : bSelectionInReadonly = SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly(); -#ifndef PRODUCT +#ifdef DBG_UTIL // korrespondieren zu den Angaben in ui/config/cfgvw.src bTest1 = bTest2 = bTest3 = bTest4 = bTest5 = bTest6 = bTest7 = bTest8 = bTest10 = FALSE; @@ -281,7 +281,7 @@ SwViewOption::SwViewOption(const SwViewOption& rVOpt) mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode; bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields; -#ifndef PRODUCT +#ifdef DBG_UTIL bTest1 = rVOpt.bTest1 ; bTest2 = rVOpt.bTest2 ; bTest3 = rVOpt.bTest3 ; @@ -321,7 +321,7 @@ SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt ) mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode; bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields; -#ifndef PRODUCT +#ifdef DBG_UTIL bTest1 = rVOpt.bTest1 ; bTest2 = rVOpt.bTest2 ; bTest3 = rVOpt.bTest3 ; diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index ea75d3f558..ec8ad0dc14 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -67,8 +67,8 @@ #include <com/sun/star/frame/XStorable.hpp> #include <swunohelper.hxx> #include <vcl/waitobj.hxx> -#include <svtools/pathoptions.hxx> -#include <svtools/urihelper.hxx> +#include <unotools/pathoptions.hxx> +#include <svl/urihelper.hxx> #include <addresslistdialog.hrc> #include <dbui.hrc> @@ -271,7 +271,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) : m_xDBContext->getByName(pNames[nName]) >>= xSourceProperties; pUserData->sURL = lcl_getFlatURL( xSourceProperties ); bEnableEdit = pUserData->sURL.getLength() > 0 && - SWUnoHelper::UCB_IsFile( pUserData->sURL ) && //#i97577# + SWUnoHelper::UCB_IsFile( pUserData->sURL ) && //#i97577# !SWUnoHelper::UCB_IsReadOnlyFileName( pUserData->sURL ); } catch(const uno::Exception& ) diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 527847b39a..dc96002db7 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ #ifndef _SVT_CONTROLDIMS_HRC_ #include <svtools/controldims.hrc> #endif -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include <sfx2/filedlghelper.hxx> #include <sfx2/docfilt.hxx> #include <sfx2/fcontnr.hxx> @@ -570,7 +570,7 @@ IMPL_LINK(SwCreateAddressListDialog, FindHdl_Impl, PushButton*, EMPTYARG) ++aHeaderIter) rColumnBox.InsertEntry(*aHeaderIter); rColumnBox.SelectEntryPos( 0 ); - } + } else m_pFindDlg->Show(!m_pFindDlg->IsVisible()); return 0; diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index ff140629c2..c4913d65f3 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -64,19 +64,19 @@ #include <com/sun/star/sdbc/XRowSet.hpp> #include <comphelper/processfactory.hxx> #include <svx/langitem.hxx> -#include <svtools/numuno.hxx> -#include <svtools/stritem.hxx> +#include <svl/numuno.hxx> +#include <svl/stritem.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> #ifndef __SV_MNEMONIC_HXX #include <vcl/mnemonic.hxx> #endif -#include <svtools/style.hxx> -#include <svtools/zformat.hxx> +#include <svl/style.hxx> +#include <svl/zformat.hxx> #include <svx/htmlmode.hxx> #include <svx/unolingu.hxx> #include <sfx2/app.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <svx/brshitem.hxx> #include <svx/boxitem.hxx> #include <svx/rulritem.hxx> @@ -1651,6 +1651,8 @@ static rtl::OUString lcl_CreateUniqueName(const Sequence<rtl::OUString>& aNames) /* -----------------------------05.12.00 15:00-------------------------------- ---------------------------------------------------------------------------*/ +void SwInsertDBColAutoPilot::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + void SwInsertDBColAutoPilot::Commit() { Sequence <rtl::OUString> aNames = GetNodeNames(rtl::OUString()); diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index ef1bc3375c..6573946433 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -63,16 +63,16 @@ #include <pagedesc.hxx> #include <vcl/lstbox.hxx> #include <unotools/tempfile.hxx> -#include <svtools/pathoptions.hxx> -#include <svtools/urihelper.hxx> +#include <unotools/pathoptions.hxx> +#include <svl/urihelper.hxx> #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/zforlist.hxx> -#include <svtools/zformat.hxx> -#include <svtools/stritem.hxx> -#include <svtools/eitem.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> +#include <svl/stritem.hxx> +#include <svl/eitem.hxx> #include <sfx2/printer.hxx> #include <sfx2/docfile.hxx> #include <sfx2/progress.hxx> @@ -120,7 +120,7 @@ #include <i18npool/mslangid.hxx> #include <com/sun/star/util/XNumberFormatTypes.hpp> #include <svx/langitem.hxx> -#include <svtools/numuno.hxx> +#include <svl/numuno.hxx> #include <unomailmerge.hxx> #include <sfx2/event.hxx> @@ -3233,7 +3233,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, if(nDocNo == 1 ) { uno::Reference< util::XCloneable > xClone( rSourceView.GetDocShell()->GetModel(), uno::UNO_QUERY); - uno::Reference< lang::XUnoTunnel > xWorkDocShell( xClone->createClone(), uno::UNO_QUERY); + uno::Reference< lang::XUnoTunnel > xWorkDocShell( xClone->createClone(), uno::UNO_QUERY); SwXTextDocument* pWorkModel = reinterpret_cast<SwXTextDocument*>(xWorkDocShell->getSomething(SwXTextDocument::getUnoTunnelId())); xWorkDocSh = pWorkModel->GetDocShell(); } @@ -3242,7 +3242,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, SwDoc* pNewDoc = rSourceView.GetDocShell()->GetDoc()->CreateCopy(); xWorkDocSh = new SwDocShell( pNewDoc, SFX_CREATE_MODE_STANDARD ); xWorkDocSh->DoInitNew(); - } + } //create a ViewFrame SwView* pWorkView = static_cast< SwView* >( SfxViewFrame::CreateViewFrame( *xWorkDocSh, 0, sal_True )->GetViewShell() ); SwWrtShell& rWorkShell = pWorkView->GetWrtShell(); @@ -3288,7 +3288,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, pTargetShell->GetDoc()->MakePageDesc( sNewPageDescName ); SwPageDesc* pTargetPageDesc = pTargetShell->FindPageDescByName( sNewPageDescName ); const SwPageDesc* pWorkPageDesc = rWorkShell.FindPageDescByName( sStartingPageDesc ); - + if(pWorkPageDesc && pTargetPageDesc) { pTargetDoc->CopyPageDesc( *pWorkPageDesc, *pTargetPageDesc, sal_False ); @@ -3298,7 +3298,7 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, } if(nDocNo == 1 || bPageStylesWithHeaderFooter) { - pTargetView->GetDocShell()->_LoadStyles( *pWorkView->GetDocShell(), sal_True ); + pTargetView->GetDocShell()->_LoadStyles( *rSourceView.GetDocShell(), sal_True ); } if(nDocNo > 1) { diff --git a/sw/source/ui/dbui/maildispatcher.cxx b/sw/source/ui/dbui/maildispatcher.cxx index 67f550acf5..183764a5b2 100644 --- a/sw/source/ui/dbui/maildispatcher.cxx +++ b/sw/source/ui/dbui/maildispatcher.cxx @@ -110,8 +110,7 @@ namespace /* private */ MailDispatcher::MailDispatcher(uno::Reference<mail::XSmtpService> mailserver) : mailserver_ (mailserver), run_(false), - shutdown_requested_(false), - bIsInRun(false) + shutdown_requested_(false) { wakening_call_.reset(); mail_dispatcher_active_.reset(); @@ -206,12 +205,6 @@ bool MailDispatcher::isStarted() const return run_; } -bool MailDispatcher::isRunning() const -{ - return bIsInRun; -} - - void MailDispatcher::addListener(::rtl::Reference<IMailDispatcherListener> listener) { OSL_PRECOND(!shutdown_requested_, "MailDispatcher thread is shuting down already"); @@ -267,7 +260,6 @@ void MailDispatcher::run() // signal that the mail dispatcher thread is now alive mail_dispatcher_active_.set(); - bIsInRun = true; for(;;) { wakening_call_.wait(); @@ -295,7 +287,6 @@ void MailDispatcher::run() std::for_each(listeners_cloned.begin(), listeners_cloned.end(), GenericEventNotifier(&IMailDispatcherListener::idle, this)); } } // end for SSH ALI - bIsInRun = false; } /*-- 27.08.2004 12:04:46--------------------------------------------------- diff --git a/sw/source/ui/dbui/mailmergechildwindow.cxx b/sw/source/ui/dbui/mailmergechildwindow.cxx index ca506787a4..d02480a6ef 100644 --- a/sw/source/ui/dbui/mailmergechildwindow.cxx +++ b/sw/source/ui/dbui/mailmergechildwindow.cxx @@ -103,7 +103,7 @@ SwMailMergeChildWin::SwMailMergeChildWin( SfxBindings* _pBindings, m_aBackTB(this, SW_RES( TB_BACK )) { m_aBackTB.SetSelectHdl(LINK(this, SwMailMergeChildWin, BackHdl)); - sal_uInt16 nIResId = GetSettings().GetStyleSettings().GetWindowColor().IsDark() ? + sal_uInt16 nIResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? ILIST_TBX_HC : ILIST_TBX; ResId aResId( nIResId, *pSwResMgr ); ImageList aIList(aResId); @@ -639,7 +639,7 @@ void SwSendMailDialog::IterateMails() { if(!SwMailMergeHelper::CheckMailAddress( pCurrentMailDescriptor->sEMail )) { - ImageList& rImgLst = GetSettings().GetStyleSettings().GetWindowColor().IsDark() ? + ImageList& rImgLst = GetSettings().GetStyleSettings().GetHighContrastMode() ? m_aImageListHC : m_aImageList; Image aInsertImg = rImgLst.GetImage( FN_FORMULA_CANCEL ); @@ -747,7 +747,7 @@ void SwSendMailDialog::DocumentSent( uno::Reference< mail::XMailMessage> xMessag Application::PostUserEvent( STATIC_LINK( this, SwSendMailDialog, StopSendMails ), this ); } - ImageList& rImgLst = GetSettings().GetStyleSettings().GetWindowColor().IsDark() ? + ImageList& rImgLst = GetSettings().GetStyleSettings().GetHighContrastMode() ? m_aImageListHC : m_aImageList; Image aInsertImg = rImgLst.GetImage( bResult ? FN_FORMULA_APPLY : FN_FORMULA_CANCEL ); diff --git a/sw/source/ui/dbui/mmaddressblockpage.hxx b/sw/source/ui/dbui/mmaddressblockpage.hxx index 94f22278c7..f3f879debb 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.hxx +++ b/sw/source/ui/dbui/mmaddressblockpage.hxx @@ -43,7 +43,7 @@ #include <svtools/headbar.hxx> #include <svtools/svtreebx.hxx> #include <vcl/combobox.hxx> -#include <svtools/lstner.hxx> +#include <svl/lstner.hxx> class SwMailMergeWizard; class SwMailMergeConfigItem; /*-- 13.04.2004 15:50:37--------------------------------------------------- diff --git a/sw/source/ui/dbui/mmconfigitem.cxx b/sw/source/ui/dbui/mmconfigitem.cxx index 6605b2dbaf..dda498ab1d 100644 --- a/sw/source/ui/dbui/mmconfigitem.cxx +++ b/sw/source/ui/dbui/mmconfigitem.cxx @@ -63,7 +63,7 @@ #include <unomid.h> #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> using namespace utl; using ::rtl::OUString; @@ -183,8 +183,8 @@ public: SwMailMergeConfigItem_Impl(); ~SwMailMergeConfigItem_Impl(); - virtual void Commit(); - + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); const Sequence< ::rtl::OUString> GetAddressBlocks(sal_Bool bConvertToConfig = sal_False) const; void SetAddressBlocks( @@ -538,6 +538,8 @@ const Sequence<OUString>& SwMailMergeConfigItem_Impl::GetPropertyNames() /*-- 15.04.2004 08:48:39--------------------------------------------------- -----------------------------------------------------------------------*/ +void SwMailMergeConfigItem_Impl::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + void SwMailMergeConfigItem_Impl::Commit() { Sequence<OUString> aNames = GetPropertyNames(); diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx index 1c479cb995..423185fb0b 100644 --- a/sw/source/ui/dbui/mmdocselectpage.cxx +++ b/sw/source/ui/dbui/mmdocselectpage.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -35,7 +35,7 @@ #endif -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include <sfx2/filedlghelper.hxx> #include <sfx2/new.hxx> #include <sfx2/docfilt.hxx> @@ -214,7 +214,7 @@ sal_Bool SwMailMergeDocSelectPage::commitPage( CommitPageReason _eReason ) (m_aRecentDocRB.IsChecked() && (sReloadDocument = m_aRecentDocLB.GetSelectEntry()).getLength()); if( _eReason == eValidate ) m_pWizard->SetDocumentLoad(!m_aCurrentDocRB.IsChecked()); - + if(bNext && !m_aCurrentDocRB.IsChecked()) { if(sReloadDocument.getLength()) diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index ea475f8bb6..1560648be9 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -47,7 +47,7 @@ #endif #include <swundo.hxx> #include <sfx2/dispatch.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <sfx2/docfilt.hxx> #include <com/sun/star/text/XParagraphCursor.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> @@ -67,7 +67,7 @@ #include <fmtornt.hxx> #include <fmtfsize.hxx> #include <svx/boxitem.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <shellio.hxx> #include <osl/file.hxx> #include <unoprnms.hxx> diff --git a/sw/source/ui/dbui/mmmergepage.cxx b/sw/source/ui/dbui/mmmergepage.cxx index e57d4028ac..a8a0f48c27 100644 --- a/sw/source/ui/dbui/mmmergepage.cxx +++ b/sw/source/ui/dbui/mmmergepage.cxx @@ -44,7 +44,7 @@ #include <mmmergepage.hrc> #include <svx/srchitem.hxx> #include <sfx2/dispatch.hxx> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <swabstdlg.hxx> /*-- 02.04.2004 16:38:45--------------------------------------------------- diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index eb1f75d579..1106a1ac62 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -53,8 +53,8 @@ #include <hintids.hxx> #include <svx/scripttypeitem.hxx> #include <svx/langitem.hxx> -#include <svtools/itemset.hxx> -#include <svtools/stritem.hxx> +#include <svl/itemset.hxx> +#include <svl/stritem.hxx> #include <svtools/ehdl.hxx> #include <svtools/sfxecode.hxx> #include <vcl/msgbox.hxx> @@ -68,7 +68,7 @@ //#include <sfx2/docfilt.hxx> //#endif #include <tools/urlobj.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #ifndef _VCL_PRINT_HXX #include <vcl/print.hxx> #endif diff --git a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx index 8969beb163..ae783c9917 100644 --- a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -47,8 +47,8 @@ #include <svx/svdview.hxx> #include <svx/svditer.hxx> #include <svx/svdogrp.hxx> -#include <svtools/linguprops.hxx> -#include <svtools/lingucfg.hxx> +#include <unotools/linguprops.hxx> +#include <unotools/lingucfg.hxx> #include <doc.hxx> #ifndef _DOCSH_HXX #include <docsh.hxx> @@ -414,7 +414,7 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence (void) String sInfo(SW_RES(STR_SPELLING_COMPLETED)); //#i84610# Window* pTemp = GetWindow(); // temporary needed for g++ 3.3.5 - InfoBox(pTemp, sInfo ).Execute(); + InfoBox(pTemp, sInfo ).Execute(); LockFocusNotification( false ); //take care that the now valid selection is stored LoseFocus(); @@ -493,7 +493,7 @@ void SwSpellDialogChildWindow::SetGrammarChecking(bool bOn) m_bIsGrammarCheckingOn = bOn; String aPropName( C2S(UPN_IS_GRAMMAR_INTERACTIVE ) ); SvtLinguConfig().SetProperty( aPropName, aVal ); - // set current spell position to the start of the current sentence to + // set current spell position to the start of the current sentence to // continue with this sentence after grammar checking state has been changed SwWrtShell* pWrtShell = GetWrtShell_Impl(); if(pWrtShell) @@ -517,7 +517,7 @@ void SwSpellDialogChildWindow::SetGrammarChecking(bool bOn) pOutliner->PutSpellingToSentenceStart( pSdrView->GetTextEditOutlinerView()->GetEditView() ); } } - } + } } /*-- 28.10.2003 08:41:09--------------------------------------------------- diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index 34b04822c0..6907737855 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,7 +37,7 @@ #include <rtl/textenc.h> #include <i18npool/mslangid.hxx> #include <com/sun/star/i18n/ScriptType.hpp> -#include <svtools/lingucfg.hxx> +#include <unotools/lingucfg.hxx> #include <fontcfg.hxx> #include <swmodule.hxx> #include <svx/unolingu.hxx> diff --git a/sw/source/ui/dialog/macassgn.cxx b/sw/source/ui/dialog/macassgn.cxx index 9a06a311e1..50e76dcfc5 100644 --- a/sw/source/ui/dialog/macassgn.cxx +++ b/sw/source/ui/dialog/macassgn.cxx @@ -39,7 +39,7 @@ #include "hintids.hxx" #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <svx/htmlmode.hxx> #ifndef _SVX_SVXIDS_HRC //autogen #include <svx/svxids.hrc> diff --git a/sw/source/ui/dialog/regionsw.cxx b/sw/source/ui/dialog/regionsw.cxx index abda1181f3..6c850d9936 100644 --- a/sw/source/ui/dialog/regionsw.cxx +++ b/sw/source/ui/dialog/regionsw.cxx @@ -34,13 +34,13 @@ #include <hintids.hxx> #include <uitool.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/PasswordHelper.hxx> +#include <svl/urihelper.hxx> +#include <svl/PasswordHelper.hxx> #ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif -#include <svtools/stritem.hxx> -#include <svtools/eitem.hxx> +#include <svl/stritem.hxx> +#include <svl/eitem.hxx> #include <sot/formats.hxx> #ifndef _PASSWD_HXX //autogen #include <sfx2/passwd.hxx> diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 4e27969016..10c153c484 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -36,7 +36,7 @@ #endif #include "swdlgfact.hxx" -#include <svtools/style.hxx> +#include <svl/style.hxx> #ifndef _SVX_SVXIDS_HRC #include <svx/svxids.hrc> #endif @@ -1698,7 +1698,7 @@ CreateTabPage SwAbstractDialogFactory_Impl::GetTabPageCreatorFunc( USHORT nId ) break; case RID_SW_TP_OPTTEST_PAGE : case TP_OPTTEST_PAGE : -#ifndef PRODUCT +#ifdef DBG_UTIL pRet = SwTestTabPage::Create; #endif break; diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 88e3df03a2..e34dc9387e 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -36,12 +36,12 @@ #include <hintids.hxx> #include <regionsw.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/PasswordHelper.hxx> +#include <svl/urihelper.hxx> +#include <svl/PasswordHelper.hxx> #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> -#include <svtools/stritem.hxx> -#include <svtools/eitem.hxx> +#include <svl/stritem.hxx> +#include <svl/eitem.hxx> #include <sfx2/passwd.hxx> #include <sfx2/docfilt.hxx> #include <sfx2/request.hxx> @@ -1480,14 +1480,16 @@ static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox ) uno::Reference < embed::XStorage > xStg; if( rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is() ) { - SvStringsDtor aArr( 10, 10 ); + SvStrings aArr( 10, 10 ); sal_uInt32 nFormat = SotStorage::GetFormatID( xStg ); if ( nFormat == SOT_FORMATSTR_ID_STARWRITER_60 || nFormat == SOT_FORMATSTR_ID_STARWRITERGLOB_60 || nFormat == SOT_FORMATSTR_ID_STARWRITER_8 || nFormat == SOT_FORMATSTR_ID_STARWRITERGLOB_8) - SwGetReaderXML()->GetSectionList( rMedium, (SvStrings&) aArr ); + SwGetReaderXML()->GetSectionList( rMedium, aArr ); for( USHORT n = 0; n < aArr.Count(); ++n ) rBox.InsertEntry( *aArr[ n ] ); + + aArr.DeleteAndDestroy(0, aArr.Count()); } } /* -----------------21.05.99 10:16------------------- diff --git a/sw/source/ui/dochdl/gloshdl.cxx b/sw/source/ui/dochdl/gloshdl.cxx index d8bb52b31e..c82bbb4d75 100644 --- a/sw/source/ui/dochdl/gloshdl.cxx +++ b/sw/source/ui/dochdl/gloshdl.cxx @@ -44,12 +44,12 @@ #ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include <sfx2/fcontnr.hxx> #include <sfx2/docfile.hxx> #define _SVSTDARR_STRINGS -#include <svtools/svstdarr.hxx> -#include <svtools/urihelper.hxx> +#include <svl/svstdarr.hxx> +#include <svl/urihelper.hxx> #include <unotools/transliterationwrapper.hxx> #include <poolfmt.hxx> #include <fmtcol.hxx> diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index e991938aad..a1589281d5 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -60,13 +60,13 @@ #include <vcl/msgbox.hxx> #endif #include <sfx2/dispatch.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <svtools/imap.hxx> #include <sot/storage.hxx> #ifndef _GRAPH_HXX #include <vcl/graph.hxx> #endif -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <svx/svdmodel.hxx> #include <svx/xexch.hxx> #include <svx/xmlexchg.hxx> @@ -75,7 +75,7 @@ #include <sfx2/mieclip.hxx> #include <svx/svdetc.hxx> #include <svx/xoutbmp.hxx> -#include <svtools/urlbmk.hxx> +#include <svl/urlbmk.hxx> #include <svtools/htmlout.hxx> #include <svx/hlnkitem.hxx> #include <svtools/inetimg.hxx> diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx index 9862ace5cd..17673cd387 100644 --- a/sw/source/ui/docvw/PostItMgr.cxx +++ b/sw/source/ui/docvw/PostItMgr.cxx @@ -70,9 +70,9 @@ #include <sfx2/srchitem.hxx> -#include <svtools/languageoptions.hxx> +#include <svl/languageoptions.hxx> #include <svtools/langtab.hxx> -#include <svtools/smplhint.hxx> +#include <svl/smplhint.hxx> #include <svx/svdview.hxx> #include <svx/eeitem.hxx> @@ -1941,9 +1941,14 @@ void SwPostItMgr::AssureStdModeAtShell() { mpWrtShell->UnSelectFrm(); mpWrtShell->LeaveSelFrmMode(); + mpWrtShell->GetView().LeaveDrawCreate(); mpWrtShell->EnterStdMode(); mpWrtShell->DrawSelChanged(); mpView->StopShellTimer(); } } + +void SwNoteProps::Commit() {} +void SwNoteProps::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 0f45470c91..a548726ad7 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -48,15 +48,15 @@ #include <vcl/msgbox.hxx> #include <vcl/cmdevt.h> #include <sot/storage.hxx> -#include <svtools/macitem.hxx> -#include <svtools/securityoptions.hxx> +#include <svl/macitem.hxx> +#include <unotools/securityoptions.hxx> #ifndef __SBX_SBXVARIABLE_HXX //autogen #include <basic/sbxvar.hxx> #endif -#include <svtools/ctloptions.hxx> +#include <svl/ctloptions.hxx> #include <basic/sbx.hxx> -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> #ifndef _SFX_CLIENTSH_HXX #include <sfx2/ipclient.hxx> #endif @@ -64,7 +64,7 @@ #include <sfx2/request.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> -#include <svtools/ptitem.hxx> +#include <svl/ptitem.hxx> #include <svx/sizeitem.hxx> #include <svx/langitem.hxx> #include <svx/htmlmode.hxx> @@ -156,7 +156,7 @@ #include "postit.hxx" //JP 11.10.2001: enable test code for bug fix 91313 -#if !defined( PRODUCT ) && (OSL_DEBUG_LEVEL > 1) +#if defined(DBG_UTIL) && (OSL_DEBUG_LEVEL > 1) //#define TEST_FOR_BUG91313 #endif @@ -1503,7 +1503,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) case KS_CheckKey: eKeyState = KS_KeyToView; // default weiter zur View -#ifndef PRODUCT +#ifdef DBG_UTIL //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // JP 19.01.99: zum Umschalten des Cursor Verhaltens in ReadOnly // Bereichen @@ -1765,7 +1765,7 @@ KEYINPUT_CHECKTABLE_INSDEL: !rSh.GetCurNumRule()->IsOutlineRule() && !rSh.HasSelection() && rSh.IsSttPara() && rSh.IsEndPara() ) - eKeyState = KS_NumOff, eNextKeyState = KS_OutlineLvOff; + eKeyState = KS_NumOff, eNextKeyState = KS_OutlineLvOff; //RETURN fuer neuen Absatz mit AutoFormatierung else if( pACfg && pACfg->IsAutoFmtByInput() && @@ -1899,7 +1899,7 @@ KEYINPUT_CHECKTABLE_INSDEL: #endif if (rSh.IsFormProtected() || rSh.GetCurrentFieldmark() || rSh.GetChar(FALSE)==CH_TXT_ATR_FORMELEMENT) { - eKeyState=KS_GotoNextFieldMark; + eKeyState=KS_GotoNextFieldMark; } else if( rSh.GetCurNumRule() && rSh.IsSttOfPara() && @@ -1954,7 +1954,7 @@ KEYINPUT_CHECKTABLE_INSDEL: BOOL bOld = rSh.ChgCrsrTimerFlag( FALSE ); #endif if (rSh.IsFormProtected() || rSh.GetCurrentFieldmark()|| rSh.GetChar(FALSE)==CH_TXT_ATR_FORMELEMENT) { - eKeyState=KS_GotoPrevFieldMark; + eKeyState=KS_GotoPrevFieldMark; } else if( rSh.GetCurNumRule() && rSh.IsSttOfPara() && !rSh.HasReadonlySel() ) @@ -1991,7 +1991,7 @@ KEYINPUT_CHECKTABLE_INSDEL: SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); //if( pColl && 0 < pColl->GetOutlineLevel() && //#outline level,zhaojianwei // MAXLEVEL - 1 >= pColl->GetOutlineLevel() ) - if( pColl && + if( pColl && pColl->IsAssignedToListLevelOfOutlineStyle() && 0 < pColl->GetAssignedOutlineStyleLevel()) eKeyState = KS_OutlineUp; @@ -2369,14 +2369,14 @@ KEYINPUT_CHECKTABLE_INSDEL: nKS_NUMINDENTINC_Count = 2; break; - case KS_GotoNextFieldMark: + case KS_GotoNextFieldMark: { ::sw::mark::IFieldmark const * const pFieldmark = rSh.GetFieldmarkAfter(); if(pFieldmark) rSh.GotoFieldmark(pFieldmark); } break; - case KS_GotoPrevFieldMark: + case KS_GotoPrevFieldMark: { ::sw::mark::IFieldmark const * const pFieldmark = rSh.GetFieldmarkBefore(); if(pFieldmark) rSh.GotoFieldmark(pFieldmark); @@ -4775,7 +4775,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) aEvent.ExecutePosition.X = aPixPos.X(); aEvent.ExecutePosition.Y = aPixPos.Y(); Menu* pMenu = 0; - ::rtl::OUString sMenuName = + ::rtl::OUString sMenuName = ::rtl::OUString::createFromAscii( "private:resource/ReadonlyContextMenu"); if( GetView().TryContextMenuInterception( *pROPopup, sMenuName, pMenu, aEvent ) ) { diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx index b277c13949..7771bd4058 100644 --- a/sw/source/ui/docvw/edtwin2.cxx +++ b/sw/source/ui/docvw/edtwin2.cxx @@ -34,26 +34,26 @@ #include <hintids.hxx> #include <doc.hxx> -#ifndef PRODUCT +#ifdef DBG_UTIL #include <stdio.h> #endif #ifndef _HELP_HXX //autogen #include <vcl/help.hxx> #endif -#include <svtools/stritem.hxx> -#include <svtools/securityoptions.hxx> +#include <svl/stritem.hxx> +#include <unotools/securityoptions.hxx> #include <tools/urlobj.hxx> #include <txtrfmrk.hxx> #include <fmtrfmrk.hxx> #include <svx/flditem.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <svx/svdotext.hxx> #ifndef _OUTLINER_HXX //autogen #define _EEITEMID_HXX #include <svx/outliner.hxx> #endif -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svx/svdview.hxx> #include <svx/svdpagv.hxx> #include <swmodule.hxx> @@ -162,7 +162,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) SwContentAtPos::SW_TOXMARK | SwContentAtPos::SW_REFMARK | SwContentAtPos::SW_SMARTTAG | -#ifndef PRODUCT +#ifdef DBG_UTIL SwContentAtPos::SW_TABLEBOXVALUE | ( bBalloon ? SwContentAtPos::SW_CURR_ATTRS : 0) | #endif @@ -176,7 +176,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) sTxt.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "= " )); sTxt += ((SwTblBoxFormula*)aCntntAtPos.aFnd.pAttr)->GetFormula(); break; -#ifndef PRODUCT +#ifdef DBG_UTIL case SwContentAtPos::SW_TABLEBOXVALUE: { sTxt = UniString( diff --git a/sw/source/ui/docvw/postit.cxx b/sw/source/ui/docvw/postit.cxx index 157a6e1997..c807e24ff8 100644 --- a/sw/source/ui/docvw/postit.cxx +++ b/sw/source/ui/docvw/postit.cxx @@ -68,11 +68,11 @@ #include <svx/unolingu.hxx> #include <svtools/langtab.hxx> -#include <svtools/slstitm.hxx> -#include <svtools/securityoptions.hxx> -#include <svtools/useroptions.hxx> -#include <svtools/languageoptions.hxx> -#include <svtools/zforlist.hxx> +#include <svl/slstitm.hxx> +#include <unotools/securityoptions.hxx> +#include <unotools/useroptions.hxx> +#include <svl/languageoptions.hxx> +#include <svl/zforlist.hxx> #include <svtools/svmedit.hxx> #include <linguistic/lngprops.hxx> @@ -268,7 +268,7 @@ void PostItTxt::KeyInput( const KeyEvent& rKeyEvt ) ( (aStatus==SwPostItHelper::DELETED) && (!mpMarginWin->Engine()->GetEditEngine().DoesKeyChangeText(rKeyEvt))) ) */ bool bIsProtected = mpMarginWin->IsProtected(); - if (!bIsProtected || (bIsProtected && !mpMarginWin->Engine()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) ) + if (!bIsProtected || (bIsProtected && !mpMarginWin->Engine()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) ) bDone = mpOutlinerView->PostKeyEvent( rKeyEvt ); else InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute(); @@ -536,7 +536,7 @@ SwMarginWin::SwMarginWin(Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPost mpShadow = new SwPostItShadow(basegfx::B2DPoint(0,0),basegfx::B2DPoint(0,0),Color(0,0,0),SS_NORMAL); mpShadow->setVisible(false); pOverlayManager->add(*mpShadow); - } + } } SwMarginWin::~SwMarginWin() @@ -824,7 +824,7 @@ void SwMarginWin::Rescale() //aMode.SetScaleX( aMode.GetScaleX() * Fraction( 8, 10 ) ); //aMode.SetScaleY( aMode.GetScaleY() * Fraction( 8, 10 ) ); mpOutliner->SetRefMapMode( aMode ); - SetMapMode( aMode ); + SetMapMode( aMode ); mpPostItTxt->SetMapMode( aMode ); if ( mpMeta ) { @@ -886,7 +886,7 @@ void SwMarginWin::SetPosAndSize() basegfx::B2DPoint( mAnkorRect.Left(), mAnkorRect.Bottom()+2*15), basegfx::B2DPoint( mPageBorder ,mAnkorRect.Bottom()+2*15), basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()), - basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()) , + basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()) , mColorAnkor, false, false); @@ -917,7 +917,7 @@ void SwMarginWin::SetPosAndSize() Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height())); mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y())); } - + if (mpMgr->ShowNotes()) { if (IsFollow() && !HasChildPathFocus()) @@ -961,7 +961,7 @@ void SwMarginWin::DoResize() { mpVScrollbar->Hide(); } - + mpMeta->SetPosSizePixel(0,aHeight,GetSizePixel().Width()-GetMetaButtonAreaWidth(),GetMetaHeight()); mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ; mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) ); @@ -980,7 +980,7 @@ void SwMarginWin::DoResize() mpPostItTxt->SetPosSizePixel((aTextHeight > aHeight) && !IsPreview() ? GetScrollbarWidth() : 0 , 0, aWidth, aHeight); mpVScrollbar->SetPosSizePixel( 0, 0, GetScrollbarWidth(), aHeight); } - + mpVScrollbar->SetVisibleSize( PixelToLogic(Size(0,aHeight)).Height() ); mpVScrollbar->SetPageSize( PixelToLogic(Size(0,aHeight)).Height() * 8 / 10 ); mpVScrollbar->SetLineSize( mpOutliner->GetTextHeight() / 10 ); @@ -1176,7 +1176,7 @@ void SwMarginWin::HideNote() if (IsVisible()) Window::Hide(); if (mpAnkor) - { + { if (mpMgr->IsShowAnkor()) mpAnkor->SetAnkorState(AS_TRI); else @@ -1189,7 +1189,7 @@ void SwMarginWin::HideNote() void SwMarginWin::ActivatePostIt() { mpMgr->AssureStdModeAtShell(); - + mpOutliner->ClearModifyFlag(); mpOutliner->GetUndoManager().Clear(); @@ -1256,7 +1256,7 @@ void SwMarginWin::ExecuteCommand(USHORT nSlot) { case FN_POSTIT: case FN_REPLY: - { + { // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note // will be created SwView* pView = DocView(); @@ -1280,7 +1280,7 @@ void SwMarginWin::ExecuteCommand(USHORT nSlot) /* case FN_HIDE_NOTE: if ( Mgr()->GetActivePostIt() == this ) - { + { Mgr()->SetActivePostIt(0); // put the cursor back into the document SwitchToFieldPos(); @@ -1736,7 +1736,7 @@ void SwPostIt::MouseButtonDown( const MouseEvent& rMEvt ) if( !(sAuthor = aUserOpt.GetID()).Len() ) sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR )); // do not allow to reply to ourself and no answer possible if this note is in a protected section - if ((sAuthor == GetAuthor()) || (IsProtected())) + if ((sAuthor == GetAuthor()) || (IsProtected())) mpButtonPopup->EnableItem(FN_REPLY,false); else mpButtonPopup->EnableItem(FN_REPLY,true); @@ -1774,7 +1774,7 @@ void SwPostIt::InitAnswer(OutlinerParaObject* pText) // insert old, selected text or "..." // TOOD: iterate over all paragraphs, not only first one to find out if it is empty - if (pText->GetTextObject().GetText(0) != String(EMPTYSTRING)) + if (pText->GetTextObject().GetText(0) != String(EMPTYSTRING)) View()->GetEditView().InsertText(pText->GetTextObject()); else View()->InsertText(rtl::OUString::createFromAscii("..."),false); @@ -1786,7 +1786,7 @@ void SwPostIt::InitAnswer(OutlinerParaObject* pText) aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC)); View()->SetAttribs(aAnswerSet); View()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF)); - + //remove all attributes and reset our standard ones View()->GetEditView().RemoveAttribsKeepLanguages(true); View()->SetAttribs(DefaultItem()); @@ -1824,7 +1824,7 @@ SvxLanguageItem SwPostIt::GetLanguage(void) bool SwPostIt::IsProtected() { bool aReturn; - aReturn = mpFmtFld ? (SwMarginWin::IsProtected() || (mStatus==SwPostItHelper::DELETED) || + aReturn = mpFmtFld ? (SwMarginWin::IsProtected() || (mStatus==SwPostItHelper::DELETED) || mpFmtFld->IsProtect()) : (SwMarginWin::IsProtected() || (mStatus==SwPostItHelper::DELETED)); return aReturn; } @@ -1860,12 +1860,12 @@ void SwRedComment::SetPostItText() { Engine()->SetModifyHdl( Link() ); Engine()->EnableUndo( FALSE ); - + Engine()->Clear(); View()->SetAttribs(DefaultItem()); View()->InsertText(pRedline->GetComment(),false); - Engine()->ClearModifyFlag(); + Engine()->ClearModifyFlag(); Engine()->GetUndoManager().Clear(); Engine()->EnableUndo( TRUE ); Engine()->SetModifyHdl( LINK( this, SwMarginWin, ModifyHdl ) ); @@ -1886,7 +1886,7 @@ void SwRedComment::ActivatePostIt() // do we want the redline selected? // otherwise, SwRedComment::ActivatePostIt() as well as SwRedComment::DeactivatePostIt() // can be thrown out completly - DocView()->GetDocShell()->GetWrtShell()->GotoRedline( + DocView()->GetDocShell()->GetWrtShell()->GotoRedline( DocView()->GetDocShell()->GetWrtShell()->FindRedlineOfData(pRedline->GetRedlineData()),true); } @@ -1910,9 +1910,9 @@ void SwRedComment::Delete() Mgr()->RemoveItem(pRedline); } -void SwRedComment::GotoPos() +void SwRedComment::GotoPos() { - DocView()->GetDocShell()->GetWrtShell()->GotoRedline( + DocView()->GetDocShell()->GetWrtShell()->GotoRedline( DocView()->GetDocShell()->GetWrtShell()->FindRedlineOfData(pRedline->GetRedlineData())); } @@ -1941,8 +1941,8 @@ bool SwRedComment::IsProtected() // helper SwPostItShadowPrimitive // // Used to allow view-dependent primitive definition. For that purpose, the -// initially created primitive (this one) always has to be view-independent, -// but the decomposition is made view-dependent. Very simple primitive which +// initially created primitive (this one) always has to be view-independent, +// but the decomposition is made view-dependent. Very simple primitive which // just remembers the discrete data and applies it at decomposition time. class SwPostItShadowPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D @@ -2131,7 +2131,7 @@ private: basegfx::B2DPolygon maLineTop; AnkorState maAnkorState; basegfx::BColor maColor; - + // discrete line width double mfLogicLineWidth; @@ -2219,11 +2219,11 @@ drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkorPrimitive::createLoc aDotDashArray.push_back(fDashLen); aDotDashArray.push_back(fDistance); - + const drawinglayer::attribute::StrokeAttribute aStrokeAttribute( aDotDashArray, fDistance + fDashLen); - + const drawinglayer::primitive2d::Primitive2DReference aStrokedLine( new drawinglayer::primitive2d::PolygonStrokePrimitive2D( getLine(), @@ -2290,7 +2290,7 @@ drawinglayer::primitive2d::Primitive2DSequence SwPostItAnkorPrimitive::createLoc drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aLineTop); } - + return aRetval; } diff --git a/sw/source/ui/docvw/romenu.cxx b/sw/source/ui/docvw/romenu.cxx index 7bd6e7f501..8d8451188f 100644 --- a/sw/source/ui/docvw/romenu.cxx +++ b/sw/source/ui/docvw/romenu.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,9 +37,9 @@ #include <vcl/graph.hxx> #include <vcl/msgbox.hxx> #include <sot/formats.hxx> -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> -#include <svtools/pathoptions.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> +#include <unotools/pathoptions.hxx> #include <svtools/filter.hxx> #include <svtools/imap.hxx> #include <svtools/inetimg.hxx> diff --git a/sw/source/ui/docvw/srcedtw.cxx b/sw/source/ui/docvw/srcedtw.cxx index ac6786427e..ed2d42db0c 100644 --- a/sw/source/ui/docvw/srcedtw.cxx +++ b/sw/source/ui/docvw/srcedtw.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -49,7 +49,7 @@ #include <sfx2/app.hxx> #include <svtools/htmltokn.h> #include <svtools/txtattr.hxx> -#include <svtools/sourceviewconfig.hxx> +#include <unotools/sourceviewconfig.hxx> #include <svtools/colorcfg.hxx> #include <svx/flstitem.hxx> #include <vcl/metric.hxx> @@ -248,7 +248,7 @@ SwSrcEditWindow::SwSrcEditWindow( Window* pParent, SwSrcView* pParentView ) : pVScrollbar(0), pSrcView(pParentView), - pSourceViewConfig(new svt::SourceViewConfig), + pSourceViewConfig(new utl::SourceViewConfig), nCurTextWidth(0), nStartLine(USHRT_MAX), @@ -258,14 +258,14 @@ SwSrcEditWindow::SwSrcEditWindow( Window* pParent, SwSrcView* pParentView ) : { SetHelpId(HID_SOURCE_EDITWIN); CreateTextEngine(); - StartListening(*pSourceViewConfig); + pSourceViewConfig->AddListener(this); } /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ SwSrcEditWindow::~SwSrcEditWindow() { - EndListening(*pSourceViewConfig); + pSourceViewConfig->RemoveListener(this); delete pSourceViewConfig; aSyntaxIdleTimer.Stop(); if ( pTextEngine ) @@ -819,7 +819,7 @@ void SwSrcEditWindow::ImpDoHighlight( const String& rSource, USHORT nLineOff ) --------------------------------------------------*/ -void SwSrcEditWindow::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +void SwSrcEditWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { if ( rHint.ISA( TextHint ) ) { @@ -842,7 +842,11 @@ void SwSrcEditWindow::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) DoDelayedSyntaxHighlight( (USHORT)rTextHint.GetValue() ); } } - else if(&rBC == pSourceViewConfig) +} + +void SwSrcEditWindow::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, sal_uInt32 ) +{ + if( pBrdCst == pSourceViewConfig) SetFont(); } diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index d10ceb30e5..7114470d0e 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -44,7 +44,7 @@ #define _SVSTDARR_LONGSSORT #define _SVSTDARR_LONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <svx/paperinf.hxx> #ifndef _SVX_TSTPITEM_HXX //autogen #include <svx/tstpitem.hxx> diff --git a/sw/source/ui/envelp/envfmt.hxx b/sw/source/ui/envelp/envfmt.hxx index 7363907e95..3478dde394 100644 --- a/sw/source/ui/envelp/envfmt.hxx +++ b/sw/source/ui/envelp/envfmt.hxx @@ -33,7 +33,7 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <svtools/stdctrl.hxx> #ifndef _FIELD_HXX //autogen diff --git a/sw/source/ui/envelp/envimg.cxx b/sw/source/ui/envelp/envimg.cxx index c81ef6cec9..fefe09f318 100644 --- a/sw/source/ui/envelp/envimg.cxx +++ b/sw/source/ui/envelp/envimg.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,7 +38,7 @@ #include <sfx2/app.hxx> #include <svx/paperinf.hxx> #include <com/sun/star/uno/Sequence.hxx> -#include <svtools/useroptions.hxx> +#include <unotools/useroptions.hxx> #include <tools/shl.hxx> #include <swmodule.hxx> #include <errhdl.hxx> @@ -293,6 +293,9 @@ void SwEnvCfgItem::Commit() } PutProperties(aNames, aValues); } + +void SwEnvCfgItem::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + /* -----------------------------26.09.00 14:04-------------------------------- ---------------------------------------------------------------------------*/ diff --git a/sw/source/ui/envelp/envprt.cxx b/sw/source/ui/envelp/envprt.cxx index 295f740cff..46b3c4d47b 100644 --- a/sw/source/ui/envelp/envprt.cxx +++ b/sw/source/ui/envelp/envprt.cxx @@ -107,7 +107,7 @@ SwEnvPrtPage::~SwEnvPrtPage() IMPL_LINK( SwEnvPrtPage, ClickHdl, Button *, EMPTYARG ) { - sal_Bool bHC = GetDisplayBackground().GetColor().IsDark(); + sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); if (aBottomButton.IsChecked()) { // Briefumschlaege von unten diff --git a/sw/source/ui/envelp/labelcfg.cxx b/sw/source/ui/envelp/labelcfg.cxx index 32ae96881b..a5b17d1256 100644 --- a/sw/source/ui/envelp/labelcfg.cxx +++ b/sw/source/ui/envelp/labelcfg.cxx @@ -65,6 +65,9 @@ void SwLabelConfig::Commit() { // the config item is not writable yet } + +void SwLabelConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + /* -----------------------------15.01.01 11:42-------------------------------- ---------------------------------------------------------------------------*/ diff --git a/sw/source/ui/envelp/labimg.cxx b/sw/source/ui/envelp/labimg.cxx index 2fe0e20539..63a21637b4 100644 --- a/sw/source/ui/envelp/labimg.cxx +++ b/sw/source/ui/envelp/labimg.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,7 +38,7 @@ #endif #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> -#include <svtools/useroptions.hxx> +#include <unotools/useroptions.hxx> #include <tools/shl.hxx> #include <swmodule.hxx> #include "labimg.hxx" @@ -410,6 +410,8 @@ SwLabCfgItem::SwLabCfgItem(sal_Bool bLabel) : /* -----------------------------25.09.00 16:26-------------------------------- ---------------------------------------------------------------------------*/ +void SwLabCfgItem::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + void SwLabCfgItem::Commit() { Sequence<OUString> aNames = GetPropertyNames(); diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx index 2e4ef15bfd..0726587513 100644 --- a/sw/source/ui/envelp/labprt.cxx +++ b/sw/source/ui/envelp/labprt.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -37,7 +37,7 @@ #include <svtools/prnsetup.hxx> -#include <svtools/cmdoptions.hxx> +#include <unotools/cmdoptions.hxx> #include <vcl/print.hxx> #include <wrtsh.hxx> #include <label.hxx> @@ -137,7 +137,7 @@ IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton ) if ( bEnable ) aColField.GrabFocus(); -#ifndef PRODUCT +#ifdef DBG_UTIL else ASSERT( pButton == &aPageButton, "NewButton?" ); #endif diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index c5f63855b5..f24625638c 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,8 +38,8 @@ #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> #include <tools/urlobj.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/pathoptions.hxx> +#include <svl/urihelper.hxx> +#include <unotools/pathoptions.hxx> #include <goodies/mailenum.hxx> #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> @@ -193,7 +193,7 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell, aColumnFT (this, SW_RES(FT_COLUMN)), aColumnLB (this, SW_RES(LB_COLUMN)), - + aPathFT (this, SW_RES(FT_PATH)), aPathED (this, SW_RES(ED_PATH)), aPathPB (this, SW_RES(PB_PATH)), @@ -268,7 +268,7 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell, &aPathFT , &aPathED , &aPathPB , - &aFilterFT , + &aFilterFT , &aFilterLB , &aColumnLB , &aAddressFldLB, @@ -370,9 +370,9 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell, //#i63267# printing might be disabled bool bIsPrintable = !Application::GetSettings().GetMiscSettings().GetDisablePrinting(); - aPrinterRB.Enable(bIsPrintable); + aPrinterRB.Enable(bIsPrintable); OutputTypeHdl(bIsPrintable ? &aPrinterRB : &aFileRB); - + aLk = LINK(this, SwMailMergeDlg, FilenameHdl); aGenerateFromDataBaseCB.SetClickHdl( aLk ); BOOL bColumn = pModOpt->IsNameFromColumn(); @@ -455,7 +455,7 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell, { comphelper::SequenceAsHashMap aFilter(xList->nextElement()); OUString sFilter = aFilter.getUnpackedValueOrDefault(sName, OUString()); - + uno::Any aProps = xFilterFactory->getByName(sFilter); uno::Sequence< beans::PropertyValue > aFilterProperties; aProps >>= aFilterProperties; @@ -481,7 +481,7 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell, } catch( const uno::Exception& ) { - } + } } /*------------------------------------------------------------------------ @@ -514,7 +514,7 @@ void SwMailMergeDlg::Apply() { } /*-- 01.06.2007 13:06:50--------------------------------------------------- - + -----------------------------------------------------------------------*/ void lcl_MoveControlY( Window* ppW, long nDiffSize ) { @@ -533,15 +533,15 @@ void lcl_ChangeWidth( Window* ppW, long nDiffSize ) Size aSize( ppW->GetSizePixel()); aSize.Width() += nDiffSize; ppW->SetSizePixel( aSize ); -} +} void SwMailMergeDlg::Resize() { //the only controls that profit from the resize is pBeamerWin // and aPathED, aFilenameED and aColumnLB - + Size aCurSize( GetSizePixel() ); - //find the difference - Size aDiffSize( aCurSize.Width() - m_aDialogSize.Width(), + //find the difference + Size aDiffSize( aCurSize.Width() - m_aDialogSize.Width(), aCurSize.Height() - m_aDialogSize.Height() ); m_aDialogSize = aCurSize; if( pBeamerWin->IsVisible() ) @@ -603,7 +603,7 @@ void SwMailMergeDlg::Resize() lcl_ChangeWidth( &aPathED, aDiffSize.Width() ); lcl_ChangeWidth( &aFilterLB, aDiffSize.Width() ); lcl_ChangeWidth( &aDestFL, aDiffSize.Width() ); - + Size aBeamerSize( pBeamerWin->GetSizePixel() ) ; aBeamerSize.Width() += aDiffSize.Width(); aBeamerSize.Height() += aDiffSize.Height(); @@ -662,7 +662,7 @@ IMPL_LINK( SwMailMergeDlg, OutputTypeHdl, RadioButton *, pBtn ) IMPL_LINK( SwMailMergeDlg, SaveTypeHdl, RadioButton*, pBtn ) { bool bIndividual = pBtn == &aSaveIndividualRB; - + aGenerateFromDataBaseCB.Enable( bIndividual ); if( bIndividual ) { @@ -730,7 +730,7 @@ bool SwMailMergeDlg::ExecQryShell() } else { - nMergeType = static_cast< USHORT >( aSaveSingleDocRB.IsChecked() ? + nMergeType = static_cast< USHORT >( aSaveSingleDocRB.IsChecked() ? DBMGR_MERGE_SINGLE_FILE : DBMGR_MERGE_MAILFILES ); SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium(); INetURLObject aAbs; @@ -755,7 +755,7 @@ bool SwMailMergeDlg::ExecQryShell() if( aFilterLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) m_sSaveFilter = *static_cast<const ::rtl::OUString*>(aFilterLB.GetEntryData( aFilterLB.GetSelectEntryPos() )); } - else + else { //#i97667# reset column name - otherwise it's remembered from the last run pMgr->SetEMailColumn(::rtl::OUString()); @@ -765,7 +765,7 @@ bool SwMailMergeDlg::ExecQryShell() if(!sPath.Len()) return false; m_sSaveFilter = sFilter; - } + } pMgr->SetSubject(sPath); } @@ -872,7 +872,7 @@ IMPL_LINK( SwMailMergeDlg, AttachFileHdl, PushButton *, EMPTYARG ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - AbstractSvxMultiFileDialog* pFileDlg = pFact->CreateSvxMultiFileDialog( this, RID_SVXDLG_MULTIPATH); + AbstractSvxMultiFileDialog* pFileDlg = pFact->CreateSvxMultiFileDialog( this ); DBG_ASSERT(pFileDlg, "Dialogdiet fail!"); pFileDlg->SetFiles(aAttachED.GetText()); pFileDlg->SetHelpId(HID_FILEDLG_MAILMRGE2); diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx index a8432eb6b8..47f10db6fb 100644 --- a/sw/source/ui/fldui/flddinf.cxx +++ b/sw/source/ui/fldui/flddinf.cxx @@ -38,15 +38,12 @@ #include <sfx2/request.hxx> #include <sfx2/frame.hxx> #include <vcl/svapp.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> -#ifndef _HELPID_H #include <helpid.h> -#endif #include <swtypes.hxx> -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif #include <fldbas.hxx> #include <docufld.hxx> #include <wrtsh.hxx> @@ -63,13 +60,16 @@ #ifndef _VIEW_HXX #include <view.hxx> #endif -#include <svtools/zformat.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/Date.hpp> #define USER_DATA_VERSION_1 "1" #define USER_DATA_VERSION USER_DATA_VERSION_1 using namespace nsSwDocInfoSubType; - +using namespace com::sun::star; /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ @@ -103,7 +103,7 @@ SwFldDokInfPage::SwFldDokInfPage(Window* pWindow, const SfxItemSet& rCoreSet ) : SFX_ITEMSET_ARG( &rCoreSet, pItem, SfxUnoAnyItem, SID_DOCINFO, FALSE ); if ( pItem ) - pItem->GetValue() >>= aPropertyNames; + pItem->GetValue() >>= xCustomPropertySet; } /*-------------------------------------------------------------------- @@ -168,24 +168,31 @@ void __EXPORT SwFldDokInfPage::Reset(const SfxItemSet& ) { if (DI_CUSTOM == i) { - if (aPropertyNames.getLength() ) + if(xCustomPropertySet.is() ) { + uno::Reference< beans::XPropertySetInfo > xSetInfo = xCustomPropertySet->getPropertySetInfo(); + const uno::Sequence< beans::Property > rProperties = xSetInfo->getProperties(); +// uno::Sequence< ::rtl::OUString > aPropertyNames(rProperties.getLength()); +// for (sal_Int32 i = 0; i < rProperties.getLength(); ++i) { +// aPropertyNames[i] = rProperties[i].Name; +// } //if ( !IsFldEdit() ) + if( rProperties.getLength() ) { pInfo = aTypeTLB.InsertEntry( String(SW_RES( STR_CUSTOM )) ); pInfo->SetUserData(reinterpret_cast<void*>(USHRT_MAX)); - } - for (sal_Int32 n=0; n<aPropertyNames.getLength(); n++) - { - rtl::OUString sEntry = aPropertyNames[n]; - pEntry = aTypeTLB.InsertEntry(sEntry, pInfo); - if(m_sOldCustomFieldName.equals( sEntry )) + for (sal_Int32 n=0; n < rProperties.getLength(); n++) { - pSelEntry = pEntry; - aTypeTLB.Expand( pInfo ); + rtl::OUString sEntry = rProperties[n].Name; + pEntry = aTypeTLB.InsertEntry(sEntry, pInfo); + if(m_sOldCustomFieldName.equals( sEntry )) + { + pSelEntry = pEntry; + aTypeTLB.Expand( pInfo ); + } + pEntry->SetUserData(reinterpret_cast<void*>(i)); } - pEntry->SetUserData(reinterpret_cast<void*>(i)); } } } @@ -263,12 +270,12 @@ IMPL_LINK( SwFldDokInfPage, TypeHdl, ListBox *, EMPTYARG ) /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ - IMPL_LINK( SwFldDokInfPage, SubTypeHdl, ListBox *, EMPTYARG ) { USHORT nSubType = (USHORT)(ULONG)pSelEntry->GetUserData(); USHORT nPos = aSelectionLB.GetSelectEntryPos(); USHORT nExtSubType; + USHORT nNewType = 0; if (nSubType != DI_EDIT) { @@ -279,7 +286,33 @@ IMPL_LINK( SwFldDokInfPage, SubTypeHdl, ListBox *, EMPTYARG ) aFormatLB.Clear(); aFormatLB.Enable(FALSE); aFormatFT.Enable(FALSE); - return 0; + if( nSubType == DI_CUSTOM ) + { + //find out which type the custom field has - for a start set to DATE format + ::rtl::OUString sName = aTypeTLB.GetEntryText(pSelEntry); + try + { + uno::Any aVal = xCustomPropertySet->getPropertyValue( sName ); + const uno::Type& rValueType = aVal.getValueType(); + if( rValueType == ::getCppuType( (util::DateTime*)0 )) + { + nNewType = NUMBERFORMAT_DATETIME; + } + else if( rValueType == ::getCppuType( (util::Date*)0 )) + { + nNewType = NUMBERFORMAT_DATE; + } + else if( rValueType == ::getCppuType( (util::Time*)0 )) + { + nNewType = NUMBERFORMAT_TIME; + } + } + catch( const uno::Exception& ) + { + } + } + else + return 0; } nPos = 0; } @@ -290,7 +323,6 @@ IMPL_LINK( SwFldDokInfPage, SubTypeHdl, ListBox *, EMPTYARG ) nExtSubType = DI_SUB_TIME; USHORT nOldType = 0; - USHORT nNewType = 0; BOOL bEnable = FALSE; BOOL bOneArea = FALSE; @@ -312,7 +344,6 @@ IMPL_LINK( SwFldDokInfPage, SubTypeHdl, ListBox *, EMPTYARG ) bOneArea = TRUE; break; } - if (!nNewType) { aFormatLB.Clear(); @@ -334,7 +365,7 @@ IMPL_LINK( SwFldDokInfPage, SubTypeHdl, ListBox *, EMPTYARG ) if (IsFldEdit()) { nPos = aSelectionLB.GetSelectEntryPos(); - if (nPos != LISTBOX_ENTRY_NOTFOUND) + if (nPos != LISTBOX_ENTRY_NOTFOUND ) { nSubType = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos); @@ -346,18 +377,21 @@ IMPL_LINK( SwFldDokInfPage, SubTypeHdl, ListBox *, EMPTYARG ) SwWrtShell *pSh = GetWrtShell(); if(pSh) { - SvNumberFormatter* pFormatter = pSh->GetNumberFormatter(); LanguageType eLang = aFormatLB.GetCurLanguage(); if (nNewType == NUMBERFORMAT_DATE) nFormat = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_SHORT, eLang); else if (nNewType == NUMBERFORMAT_TIME) - nFormat = pFormatter->GetFormatIndex( NF_TIME_HHMM, eLang); + nFormat = pFormatter->GetFormatIndex( NF_TIME_HHMM, eLang); } } aFormatLB.SetDefFormat(nFormat); } } + else if( (nSubType == DI_CUSTOM) && (nNewType != 0) ) + { + aFormatLB.SetDefFormat(nFormat); + } } aFormatLB.Enable(bEnable); diff --git a/sw/source/ui/fldui/flddinf.hxx b/sw/source/ui/fldui/flddinf.hxx index 9f57450577..66e78ae64c 100644 --- a/sw/source/ui/fldui/flddinf.hxx +++ b/sw/source/ui/fldui/flddinf.hxx @@ -33,15 +33,16 @@ #include <sfx2/tabdlg.hxx> #include <vcl/fixed.hxx> #include <vcl/lstbox.hxx> -#ifndef _SV_BUTTON_HXX //autogen #include <vcl/button.hxx> -#endif #include <vcl/group.hxx> #include <svtools/svtreebx.hxx> #include "numfmtlb.hxx" #include "fldpage.hxx" +namespace com{namespace sun{ namespace star{ namespace beans{ + class XPropertySet; +}}}} /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ @@ -57,7 +58,7 @@ class SwFldDokInfPage : public SwFldPage CheckBox aFixedCB; SvLBoxEntry* pSelEntry; - com::sun::star::uno::Sequence < ::rtl::OUString > aPropertyNames; + com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > xCustomPropertySet; String aInfoStr; diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx index fa4b55af69..c8ef4e7a33 100644 --- a/sw/source/ui/fldui/flddok.cxx +++ b/sw/source/ui/fldui/flddok.cxx @@ -56,7 +56,7 @@ #include <view.hxx> #endif #include <wrtsh.hxx> -#include <svtools/zformat.hxx> +#include <svl/zformat.hxx> #include <index.hrc> diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index 2826df5dd0..ffc3e84ba7 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -226,15 +226,15 @@ SfxTabPage* SwFldEditDlg::CreatePage(USHORT nGroup) uno::Reference< beans::XPropertySet > xUDProps( xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); - uno::Reference< beans::XPropertySetInfo > xSetInfo - = xUDProps->getPropertySetInfo(); - const uno::Sequence< beans::Property > props - = xSetInfo->getProperties(); - uno::Sequence< ::rtl::OUString > names(props.getLength()); - for (sal_Int32 i = 0; i < props.getLength(); ++i) { - names[i] = props[i].Name; - } - pSet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(names) ) ); +// uno::Reference< beans::XPropertySetInfo > xSetInfo +// = xUDProps->getPropertySetInfo(); +// const uno::Sequence< beans::Property > props +// = xSetInfo->getProperties(); +// uno::Sequence< ::rtl::OUString > names(props.getLength()); +// for (sal_Int32 i = 0; i < props.getLength(); ++i) { +// names[i] = props[i].Name; +// } + pSet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(xUDProps) ) ); pTabPage = SwFldDokInfPage::Create(this, *pSet); nHelpId = HID_EDIT_FLD_DOKINF; break; diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx index 871049660b..ad518a0336 100644 --- a/sw/source/ui/fldui/fldfunc.cxx +++ b/sw/source/ui/fldui/fldfunc.cxx @@ -460,7 +460,7 @@ IMPL_LINK( SwFldFuncPage, ListModifyHdl, Control*, pControl) { aListItemsLB.SetUpdateMode(FALSE); if(pControl == &aListAddPB || - pControl == &aListItemED && aListAddPB.IsEnabled()) + (pControl == &aListItemED && aListAddPB.IsEnabled())) { String sEntry(aListItemED.GetText()); aListItemsLB.InsertEntry(sEntry); diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx index 67c921f011..a767990c23 100644 --- a/sw/source/ui/fldui/fldmgr.cxx +++ b/sw/source/ui/fldui/fldmgr.cxx @@ -33,7 +33,7 @@ #include <cmdid.h> #include <hintids.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/text/XDefaultNumberingProvider.hpp> @@ -53,13 +53,13 @@ #include <sfx2/app.hxx> #include <basic/basmgr.hxx> #include <svx/langitem.hxx> -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include <basic/sbmod.hxx> #include <fmtrfmrk.hxx> #include <basic/sbmeth.hxx> #include <basic/sbx.hxx> -#include <svtools/zforlist.hxx> -#include <svtools/zformat.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> #include <vcl/mnemonic.hxx> #include <view.hxx> #include <wrtsh.hxx> // Actives Fenster diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx index e3a286aa0e..1c293a75f4 100644 --- a/sw/source/ui/fldui/fldpage.cxx +++ b/sw/source/ui/fldui/fldpage.cxx @@ -37,7 +37,7 @@ #include <vcl/lstbox.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <sfx2/request.hxx> #include <svx/htmlmode.hxx> #include <dbfld.hxx> diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx index 3e2d031c0a..e594b04e8b 100644 --- a/sw/source/ui/fldui/fldtdlg.cxx +++ b/sw/source/ui/fldui/fldtdlg.cxx @@ -48,47 +48,23 @@ #include <vcl/msgbox.hxx> #include <svx/htmlmode.hxx> #include <viewopt.hxx> -#ifndef _DOCSH_HXX #include <docsh.hxx> -#endif #include <fldwrap.hxx> -#ifndef _FLDDB_HXX #include <flddb.hxx> -#endif -#ifndef _FLDDINF_HXX #include <flddinf.hxx> -#endif -#ifndef _FLDVAR_HXX #include <fldvar.hxx> -#endif -#ifndef _FLDDOK_HXX #include <flddok.hxx> -#endif -#ifndef _FLDFUNC_HXX #include <fldfunc.hxx> -#endif -#ifndef _FLDREF_HXX #include <fldref.hxx> -#endif #include <wrtsh.hxx> #include <view.hxx> -#ifndef _FLDTDLG_HXX #include <fldtdlg.hxx> -#endif #include <swmodule.hxx> -#ifndef _HELPID_H #include <helpid.h> -#endif -#ifndef _FLDUI_HRC #include <fldui.hrc> -#endif -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif -#ifndef _FLDTDLG_HRC #include <fldtdlg.hrc> -#endif #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> @@ -245,15 +221,7 @@ SfxItemSet* SwFldDlg::CreateInputItemSet( USHORT nID ) uno::Reference< beans::XPropertySet > xUDProps( xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW); - uno::Reference< beans::XPropertySetInfo > xSetInfo - = xUDProps->getPropertySetInfo(); - const uno::Sequence< beans::Property > props - = xSetInfo->getProperties(); - uno::Sequence< ::rtl::OUString > names(props.getLength()); - for (sal_Int32 i = 0; i < props.getLength(); ++i) { - names[i] = props[i].Name; - } - pISet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(names) ) ); + pISet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(xUDProps) ) ); return pISet; } else diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index 0c3a3e070a..99a63ab894 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -52,7 +52,7 @@ #include <fldvar.hxx> #endif #include <calc.hxx> -#include <svtools/zformat.hxx> +#include <svl/zformat.hxx> #ifndef _GLOBALS_HRC #include <globals.hrc> #endif diff --git a/sw/source/ui/fldui/javaedit.cxx b/sw/source/ui/fldui/javaedit.cxx index 4464ac59c8..8d721a48fe 100644 --- a/sw/source/ui/fldui/javaedit.cxx +++ b/sw/source/ui/fldui/javaedit.cxx @@ -46,7 +46,7 @@ #include <vcl/msgbox.hxx> #endif #include <vcl/svapp.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #ifndef _VIEW_HXX #include <view.hxx> #endif diff --git a/sw/source/ui/fldui/makefile.mk b/sw/source/ui/fldui/makefile.mk index a94fdaef17..23160cf80f 100644 --- a/sw/source/ui/fldui/makefile.mk +++ b/sw/source/ui/fldui/makefile.mk @@ -80,6 +80,7 @@ SLOFILES = \ EXCEPTIONSFILES = \ $(SLO)$/fldtdlg.obj \ $(SLO)$/fldedt.obj \ + $(SLO)$/flddinf.obj \ $(SLO)$/xfldui.obj LIB1TARGET = $(SLB)$/$(TARGET).lib diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 026a59ade1..d8f316875a 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -40,7 +40,7 @@ #ifndef _SVSTDARR_STRINGSSORTDTOR #define _SVSTDARR_STRINGSSORTDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <vcl/msgbox.hxx> #include <sfx2/viewfrm.hxx> @@ -48,7 +48,7 @@ #include <svx/flstitem.hxx> #include <svx/htmlmode.hxx> #include <svx/htmlcfg.hxx> -#include <svtools/cjkoptions.hxx> +#include <svl/cjkoptions.hxx> #include <numpara.hxx> #include <fmtclds.hxx> #include <swtypes.hxx> @@ -95,11 +95,11 @@ #endif #include <SwStyleNameMapper.hxx> #include <svx/svxids.hrc> -#include <svtools/stritem.hxx> -#include <svtools/aeitem.hxx> -#include <svtools/slstitm.hxx> -#include <svtools/eitem.hxx> -#include <svtools/intitem.hxx> +#include <svl/stritem.hxx> +#include <svl/aeitem.hxx> +#include <svl/slstitm.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> #include <svx/flagsdef.hxx> diff --git a/sw/source/ui/frmdlg/colex.cxx b/sw/source/ui/frmdlg/colex.cxx index 8b06398c80..d042ce7dca 100644 --- a/sw/source/ui/frmdlg/colex.cxx +++ b/sw/source/ui/frmdlg/colex.cxx @@ -39,7 +39,7 @@ #include <algorithm> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <svx/lrspitem.hxx> #include <svx/ulspitem.hxx> #include <svx/sizeitem.hxx> diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index 46969d633f..b7d67803ff 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -44,7 +44,7 @@ #include <svx/lrspitem.hxx> #include <svx/sizeitem.hxx> #include "svx/frmdiritem.hxx" -#include <svtools/ctloptions.hxx> +#include <svl/ctloptions.hxx> #include <sfx2/dispatch.hxx> #include <vcl/msgbox.hxx> #include <swmodule.hxx> diff --git a/sw/source/ui/frmdlg/frmmgr.cxx b/sw/source/ui/frmdlg/frmmgr.cxx index 1d649e833a..97bd17351f 100644 --- a/sw/source/ui/frmdlg/frmmgr.cxx +++ b/sw/source/ui/frmdlg/frmmgr.cxx @@ -37,7 +37,7 @@ #include "hintids.hxx" -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <svx/protitem.hxx> #include <svx/boxitem.hxx> #include <svx/opaqitem.hxx> diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 0a24a1a516..2bbaa672f5 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -46,8 +46,8 @@ #include <hintids.hxx> #include <vcl/msgbox.hxx> #include <vcl/mnemonic.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/stritem.hxx> +#include <svl/urihelper.hxx> +#include <svl/stritem.hxx> #include <svx/impgrf.hxx> #include <svx/htmlmode.hxx> #include <svx/sizeitem.hxx> @@ -2641,8 +2641,8 @@ void BmpWindow::Paint( const Rectangle& ) aGraphic.Draw( this, aPntPos, aPntSz ); else { - bool bIsDark = ( GetSettings().GetStyleSettings().GetWindowColor().IsDark() != FALSE ); - DrawBitmapEx( aPntPos, aPntSz, bIsDark ? aBmpHC : aBmp ); + bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); + DrawBitmapEx( aPntPos, aPntSz, bHC ? aBmpHC : aBmp ); } } diff --git a/sw/source/ui/frmdlg/uiborder.cxx b/sw/source/ui/frmdlg/uiborder.cxx index 199521c70f..6904621557 100644 --- a/sw/source/ui/frmdlg/uiborder.cxx +++ b/sw/source/ui/frmdlg/uiborder.cxx @@ -38,10 +38,10 @@ #include <svx/svxdlg.hxx> #include <svx/svxids.hrc> #include <svx/dialogs.hrc> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <svx/flagsdef.hxx> #include <sfx2/tabdlg.hxx> -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include "swtypes.hxx" #include "uiborder.hxx" diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx index a971b012ca..c9488c26ba 100644 --- a/sw/source/ui/frmdlg/wrap.cxx +++ b/sw/source/ui/frmdlg/wrap.cxx @@ -41,7 +41,7 @@ #include <vcl/graph.hxx> #include <svx/htmlmode.hxx> #include <sfx2/objsh.hxx> -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include <svx/opaqitem.hxx> #include <svx/ulspitem.hxx> #include <svx/lrspitem.hxx> @@ -748,7 +748,7 @@ void SwWrapTabPage::DataChanged( const DataChangedEvent& rDCEvt ) ---------------------------------------------------------------------------*/ void SwWrapTabPage::ApplyImageList() { - ImageList& rImgLst = GetDisplayBackground().GetColor().IsDark() ? + ImageList& rImgLst = GetSettings().GetStyleSettings().GetHighContrastMode() ? aWrapILH : aWrapIL; aWrapThroughRB.SetModeRadioImage(rImgLst.GetImage(IMG_THROUGH)); diff --git a/sw/source/ui/globdoc/globdoc.cxx b/sw/source/ui/globdoc/globdoc.cxx index 3321dff7df..d759144f02 100644 --- a/sw/source/ui/globdoc/globdoc.cxx +++ b/sw/source/ui/globdoc/globdoc.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -34,7 +34,7 @@ #include <sot/clsids.hxx> -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #include <unomid.h> diff --git a/sw/source/ui/inc/barcfg.hxx b/sw/source/ui/inc/barcfg.hxx index ca2694da67..e214a772c6 100644 --- a/sw/source/ui/inc/barcfg.hxx +++ b/sw/source/ui/inc/barcfg.hxx @@ -41,7 +41,8 @@ public: SwToolbarConfigItem( sal_Bool bWeb ); ~SwToolbarConfigItem(); - virtual void Commit(); + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); void SetTopToolbar( sal_Int32 nSelType, sal_Int32 nBarId ); }; diff --git a/sw/source/ui/inc/basesh.hxx b/sw/source/ui/inc/basesh.hxx index 3d32bb8b87..9bd2ed0af3 100644 --- a/sw/source/ui/inc/basesh.hxx +++ b/sw/source/ui/inc/basesh.hxx @@ -39,7 +39,7 @@ #include <vcl/timer.hxx> #include <sfx2/module.hxx> #include <sfx2/shell.hxx> -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <mdiexp.hxx> diff --git a/sw/source/ui/inc/cfgitems.hxx b/sw/source/ui/inc/cfgitems.hxx index ee9eebdd3f..a13d4face1 100644 --- a/sw/source/ui/inc/cfgitems.hxx +++ b/sw/source/ui/inc/cfgitems.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -31,7 +31,7 @@ #define _CFGITEMS_HXX #include <tools/color.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include "swdllapi.h" #include <printdata.hxx> @@ -39,7 +39,7 @@ class SwWriterApp; class SwModule; -#ifndef PRODUCT +#ifdef DBG_UTIL class SwTestTabPage; #endif class SwAddPrinterTabPage; @@ -170,7 +170,7 @@ public: BOOL IsPrintPageBackground() const { return bPrintPageBackground; } BOOL IsPrintBlackFont() const { return bPrintBlackFont; } //#i81434# - printing of hidden text - sal_Bool IsPrintHiddenText() const { return bPrintHiddenText; } + sal_Bool IsPrintHiddenText() const { return bPrintHiddenText; } sal_Bool IsPrintTextPlaceholder() const { return bPrintTextPlaceholder; } BOOL IsPrintSingleJobs() const { return bPrintSingleJobs; } @@ -207,7 +207,7 @@ public: void SetOn( BOOL bFlag ) { bOn = bFlag; } }; -#ifndef PRODUCT +#ifdef DBG_UTIL /*--------OS 12.01.95 ----------------------------------- Item fuer Einstellungsdialog - Testeinstellungen --------------------------------------------------------- */ diff --git a/sw/source/ui/inc/dbconfig.hxx b/sw/source/ui/inc/dbconfig.hxx index a47ce7fbad..ea7431a8e5 100644 --- a/sw/source/ui/inc/dbconfig.hxx +++ b/sw/source/ui/inc/dbconfig.hxx @@ -49,6 +49,8 @@ public: void Load(); const SwDBData& GetAddressSource(); const SwDBData& GetBibliographySource(); + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); }; #endif diff --git a/sw/source/ui/inc/dbinsdlg.hxx b/sw/source/ui/inc/dbinsdlg.hxx index 785858e921..d6b60f1734 100644 --- a/sw/source/ui/inc/dbinsdlg.hxx +++ b/sw/source/ui/inc/dbinsdlg.hxx @@ -47,7 +47,7 @@ #include <vcl/lstbox.hxx> #include <svtools/svmedit.hxx> #include <sfx2/basedlgs.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <unotools/configitem.hxx> #include <numfmtlb.hxx> #include <swdbdata.hxx> @@ -165,8 +165,8 @@ class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem DECL_LINK( HeaderHdl, Button* ); BOOL SplitTextToColArr( const String& rTxt, _DB_Columns& rColArr, BOOL bInsField ); - - + using SfxModalDialog::Notify; + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); virtual void Commit(); void Load(); diff --git a/sw/source/ui/inc/edtwin.hxx b/sw/source/ui/inc/edtwin.hxx index 467cbe7023..aa5bafbf6a 100644 --- a/sw/source/ui/inc/edtwin.hxx +++ b/sw/source/ui/inc/edtwin.hxx @@ -38,7 +38,7 @@ #include <swevent.hxx> #define _SVSTDARR_STRINGSISORTDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> class SwWrtShell; class SwView; diff --git a/sw/source/ui/inc/envimg.hxx b/sw/source/ui/inc/envimg.hxx index b3d16509f5..71dfe242b1 100644 --- a/sw/source/ui/inc/envimg.hxx +++ b/sw/source/ui/inc/envimg.hxx @@ -30,7 +30,7 @@ #ifndef _ENVIMG_HXX #define _ENVIMG_HXX -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <unotools/configitem.hxx> #include "swdllapi.h" @@ -97,6 +97,7 @@ public: SwEnvItem& GetItem() {return aEnvItem;} virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); }; #endif diff --git a/sw/source/ui/inc/fldmgr.hxx b/sw/source/ui/inc/fldmgr.hxx index 6b6396409f..b2989611a5 100644 --- a/sw/source/ui/inc/fldmgr.hxx +++ b/sw/source/ui/inc/fldmgr.hxx @@ -31,7 +31,7 @@ #define _FLDMGR_HXX #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <tools/string.hxx> #include "swdllapi.h" diff --git a/sw/source/ui/inc/fontcfg.hxx b/sw/source/ui/inc/fontcfg.hxx index b72b50763f..11b854ec77 100644 --- a/sw/source/ui/inc/fontcfg.hxx +++ b/sw/source/ui/inc/fontcfg.hxx @@ -87,6 +87,7 @@ public: ~SwStdFontConfig(); virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); const String& GetFontStandard(sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_STANDARD + FONT_PER_GROUP * nFontGroup];} const String& GetFontOutline(sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_OUTLINE + FONT_PER_GROUP * nFontGroup];} diff --git a/sw/source/ui/inc/formatclipboard.hxx b/sw/source/ui/inc/formatclipboard.hxx index 523e2b3662..5d3fbdd222 100644 --- a/sw/source/ui/inc/formatclipboard.hxx +++ b/sw/source/ui/inc/formatclipboard.hxx @@ -34,9 +34,9 @@ // header for class SwWrtShell #include <wrtsh.hxx> // header for class SfxItemSet -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> // header for class SfxStyleSheetBasePool -#include <svtools/style.hxx> +#include <svl/style.hxx> //----------------------------------------------------------------------------- /** This class acts as data container and execution class for the format paintbrush feature in writer. diff --git a/sw/source/ui/inc/glosdoc.hxx b/sw/source/ui/inc/glosdoc.hxx index 355078b6d7..53ff1d9947 100644 --- a/sw/source/ui/inc/glosdoc.hxx +++ b/sw/source/ui/inc/glosdoc.hxx @@ -31,7 +31,7 @@ #define _GLOSDOC_HXX #include <tools/string.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <com/sun/star/text/XAutoTextGroup.hpp> class SwTextBlocks; diff --git a/sw/source/ui/inc/gloslst.hxx b/sw/source/ui/inc/gloslst.hxx index 729a0def10..db50b3c70f 100644 --- a/sw/source/ui/inc/gloslst.hxx +++ b/sw/source/ui/inc/gloslst.hxx @@ -35,7 +35,7 @@ #include <tools/datetime.hxx> #include <tools/string.hxx> #include <vcl/timer.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> class SwGlossaries; class SvStringsISortDtor; diff --git a/sw/source/ui/inc/label.hxx b/sw/source/ui/inc/label.hxx index f5b74db370..6cee259003 100644 --- a/sw/source/ui/inc/label.hxx +++ b/sw/source/ui/inc/label.hxx @@ -33,7 +33,7 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <sfx2/tabdlg.hxx> #include <com/sun/star/frame/XModel.hpp> diff --git a/sw/source/ui/inc/labelcfg.hxx b/sw/source/ui/inc/labelcfg.hxx index c921b40107..b0e4e79c3b 100644 --- a/sw/source/ui/inc/labelcfg.hxx +++ b/sw/source/ui/inc/labelcfg.hxx @@ -46,7 +46,8 @@ public: SwLabelConfig(); virtual ~SwLabelConfig(); - virtual void Commit(); + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); void FillLabels(const rtl::OUString& rManufacturer, SwLabRecs& rLabArr); const com::sun::star::uno::Sequence<rtl::OUString>& diff --git a/sw/source/ui/inc/labimg.hxx b/sw/source/ui/inc/labimg.hxx index 0b49f10f48..e5cd139236 100644 --- a/sw/source/ui/inc/labimg.hxx +++ b/sw/source/ui/inc/labimg.hxx @@ -31,7 +31,7 @@ #ifndef _LABIMG_HXX #define _LABIMG_HXX -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <unotools/configitem.hxx> #include "swdllapi.h" @@ -126,7 +126,8 @@ public: SwLabItem& GetItem() {return aItem;} - virtual void Commit(); + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); }; #endif diff --git a/sw/source/ui/inc/maildispatcher.hxx b/sw/source/ui/inc/maildispatcher.hxx index 898e715470..b88569191f 100644 --- a/sw/source/ui/inc/maildispatcher.hxx +++ b/sw/source/ui/inc/maildispatcher.hxx @@ -131,7 +131,6 @@ public: /** returns if the thread is still running */ using osl::Thread::isRunning; - bool isRunning() const; /** returns if shutdown has already been called */ @@ -167,7 +166,6 @@ private: ::rtl::Reference<MailDispatcher> m_xSelfReference; bool run_; bool shutdown_requested_; - bool bIsInRun; }; #endif // INCLUDED_MAILDISPATCHER_HXX diff --git a/sw/source/ui/inc/navicfg.hxx b/sw/source/ui/inc/navicfg.hxx index 599f5c8458..af60f5dfe2 100644 --- a/sw/source/ui/inc/navicfg.hxx +++ b/sw/source/ui/inc/navicfg.hxx @@ -50,7 +50,8 @@ public: SwNavigationConfig(); ~SwNavigationConfig(); - virtual void Commit(); + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); sal_Int32 GetRootType()const {return nRootType;} void SetRootType(sal_Int32 nSet){ diff --git a/sw/source/ui/inc/navipi.hxx b/sw/source/ui/inc/navipi.hxx index 0d065db253..012ed8c8dd 100644 --- a/sw/source/ui/inc/navipi.hxx +++ b/sw/source/ui/inc/navipi.hxx @@ -35,7 +35,7 @@ #ifndef _LSTBOX_HXX //autogen #include <vcl/lstbox.hxx> #endif -#include <svtools/lstner.hxx> +#include <svl/lstner.hxx> #include <svtools/transfer.hxx> #include <sfx2/childwin.hxx> #include <sfx2/ctrlitem.hxx> diff --git a/sw/source/ui/inc/numfmtlb.hxx b/sw/source/ui/inc/numfmtlb.hxx index 5b9fb76cb8..62cc045fe5 100644 --- a/sw/source/ui/inc/numfmtlb.hxx +++ b/sw/source/ui/inc/numfmtlb.hxx @@ -31,7 +31,7 @@ #define _SWNUMFMTLB_HXX #include <vcl/lstbox.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include "swdllapi.h" class SwView; diff --git a/sw/source/ui/inc/optcomp.hxx b/sw/source/ui/inc/optcomp.hxx index b9daacb46a..b40f0a67a6 100644 --- a/sw/source/ui/inc/optcomp.hxx +++ b/sw/source/ui/inc/optcomp.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -33,7 +33,7 @@ #include <sfx2/tabdlg.hxx> #include <vcl/fixed.hxx> #include <vcl/lstbox.hxx> -#include <svtools/compatibility.hxx> +#include <unotools/compatibility.hxx> #include <svx/checklbx.hxx> // class SwCompatibilityOptPage ------------------------------------------ diff --git a/sw/source/ui/inc/optpage.hxx b/sw/source/ui/inc/optpage.hxx index 050ea9f54d..877833c309 100644 --- a/sw/source/ui/inc/optpage.hxx +++ b/sw/source/ui/inc/optpage.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -466,7 +466,7 @@ public: TabPage Testeinstellungen fuer SW --------------------------------------------------------- */ -#ifndef PRODUCT +#ifdef DBG_UTIL class SwTestTabPage : public SfxTabPage { diff --git a/sw/source/ui/inc/prtopt.hxx b/sw/source/ui/inc/prtopt.hxx index 87943bab40..47ffc772f9 100644 --- a/sw/source/ui/inc/prtopt.hxx +++ b/sw/source/ui/inc/prtopt.hxx @@ -42,7 +42,8 @@ public: SwPrintOptions(sal_Bool bWeb); virtual ~SwPrintOptions(); - virtual void Commit(); + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); virtual void doSetModified( ) { bModified = sal_True; SetModified();} SwPrintOptions& operator=(const SwPrintData& rData) diff --git a/sw/source/ui/inc/redlndlg.hxx b/sw/source/ui/inc/redlndlg.hxx index 74d99eaa78..e59d1519ec 100644 --- a/sw/source/ui/inc/redlndlg.hxx +++ b/sw/source/ui/inc/redlndlg.hxx @@ -35,9 +35,9 @@ #include <tools/datetime.hxx> #include <vcl/msgbox.hxx> #ifndef _SVSTDARR_HXX -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <sfx2/basedlgs.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> diff --git a/sw/source/ui/inc/srcedtw.hxx b/sw/source/ui/inc/srcedtw.hxx index 25adc176fa..0db95e3c71 100644 --- a/sw/source/ui/inc/srcedtw.hxx +++ b/sw/source/ui/inc/srcedtw.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -31,7 +31,8 @@ #define _SRCEDTW_HXX #include <vcl/window.hxx> -#include <svtools/lstner.hxx> +#include <svl/lstner.hxx> +#include <unotools/options.hxx> #include <vcl/timer.hxx> #ifndef _TABLE_HXX //autogen @@ -46,6 +47,11 @@ class TextEngine; class ExtTextView; class DataChangedEvent; +namespace utl +{ + class SourceViewConfig; +} + class TextViewOutWin : public Window { ExtTextView* pTextView; @@ -69,7 +75,7 @@ public: //------------------------------------------------------------ namespace svt{ class SourceViewConfig;} -class SwSrcEditWindow : public Window, public SfxListener +class SwSrcEditWindow : public Window, public SfxListener, public utl::ConfigurationListener { private: ExtTextView* pTextView; @@ -80,7 +86,7 @@ private: *pVScrollbar; SwSrcView* pSrcView; - svt::SourceViewConfig* pSourceViewConfig; + utl::SourceViewConfig* pSourceViewConfig; long nCurTextWidth; USHORT nStartLine; @@ -93,7 +99,7 @@ private: Table aSyntaxLineTable; void ImpDoHighlight( const String& rSource, USHORT nLineOff ); - + using OutputDevice::SetFont; void SetFont(); @@ -114,6 +120,7 @@ protected: void DoSyntaxHighlight( USHORT nPara ); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); DECL_LINK(ScrollHdl, ScrollBar*); diff --git a/sw/source/ui/inc/swlbox.hxx b/sw/source/ui/inc/swlbox.hxx index 0666dbdc39..fcd59427a9 100644 --- a/sw/source/ui/inc/swlbox.hxx +++ b/sw/source/ui/inc/swlbox.hxx @@ -30,7 +30,7 @@ #ifndef _SWLBOX_HXX #define _SWLBOX_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #ifndef _LSTBOX_HXX //autogen #include <vcl/lstbox.hxx> diff --git a/sw/source/ui/inc/swwrtshitem.hxx b/sw/source/ui/inc/swwrtshitem.hxx index 7b232ff3cb..378461021e 100644 --- a/sw/source/ui/inc/swwrtshitem.hxx +++ b/sw/source/ui/inc/swwrtshitem.hxx @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SW_WRTSHELLITEM_HXX #define _SW_WRTSHELLITEM_HXX -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include "swdllapi.h" class SwWrtShell; diff --git a/sw/source/ui/inc/uiitems.hxx b/sw/source/ui/inc/uiitems.hxx index 43237c4258..872f023208 100644 --- a/sw/source/ui/inc/uiitems.hxx +++ b/sw/source/ui/inc/uiitems.hxx @@ -30,7 +30,7 @@ #ifndef _UIITEMS_HXX #define _UIITEMS_HXX -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include "swdllapi.h" #include "cmdid.h" #include "pagedesc.hxx" diff --git a/sw/source/ui/inc/uinums.hxx b/sw/source/ui/inc/uinums.hxx index f3faf4b302..b7c053e83f 100644 --- a/sw/source/ui/inc/uinums.hxx +++ b/sw/source/ui/inc/uinums.hxx @@ -30,7 +30,7 @@ #ifndef _UINUMS_HXX #define _UINUMS_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <numrule.hxx> #include "swdllapi.h" diff --git a/sw/source/ui/inc/unotxvw.hxx b/sw/source/ui/inc/unotxvw.hxx index 7062a4b78e..b62204a28f 100644 --- a/sw/source/ui/inc/unotxvw.hxx +++ b/sw/source/ui/inc/unotxvw.hxx @@ -47,7 +47,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/datatransfer/XTransferableSupplier.hpp> #include <cppuhelper/implbase8.hxx> // helper for implementations -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> #include "calbck.hxx" #include "TextCursorHelper.hxx" #include <comphelper/uno3.hxx> diff --git a/sw/source/ui/inc/usrpref.hxx b/sw/source/ui/inc/usrpref.hxx index 38b7b2f99a..00a328d165 100644 --- a/sw/source/ui/inc/usrpref.hxx +++ b/sw/source/ui/inc/usrpref.hxx @@ -71,6 +71,7 @@ class SwLayoutViewConfig : public utl::ConfigItem SwLayoutViewConfig(BOOL bWeb, SwMasterUsrPref& rParent); ~SwLayoutViewConfig(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); virtual void Commit(); void Load(); void SetModified(){ConfigItem::SetModified();} @@ -88,7 +89,8 @@ class SwGridConfig : public utl::ConfigItem SwGridConfig(BOOL bWeb, SwMasterUsrPref& rParent); ~SwGridConfig(); - virtual void Commit(); + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); void Load(); void SetModified(){ConfigItem::SetModified();} }; @@ -104,7 +106,8 @@ class SwCursorConfig : public utl::ConfigItem SwCursorConfig(SwMasterUsrPref& rParent); ~SwCursorConfig(); - virtual void Commit(); + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); void Load(); void SetModified(){ConfigItem::SetModified();} }; @@ -120,7 +123,8 @@ class SwWebColorConfig : public utl::ConfigItem SwWebColorConfig(SwMasterUsrPref& rParent); ~SwWebColorConfig(); - virtual void Commit(); + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); void Load(); void SetModified(){ConfigItem::SetModified();} }; diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 34312b19bc..502d54b2d7 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -38,9 +38,9 @@ #include <rsc/rscsfx.hxx> #include <vcl/msgbox.hxx> #include <vcl/help.hxx> -#include <svtools/stritem.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/pathoptions.hxx> +#include <svl/stritem.hxx> +#include <svl/urihelper.hxx> +#include <unotools/pathoptions.hxx> #include <sfx2/request.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> diff --git a/sw/source/ui/index/idxmrk.cxx b/sw/source/ui/index/idxmrk.cxx index be9d1d0e4e..956754c5c7 100644 --- a/sw/source/ui/index/idxmrk.cxx +++ b/sw/source/ui/index/idxmrk.cxx @@ -37,7 +37,7 @@ #include <helpid.h> #endif #define _SVSTDARR_STRINGSSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -45,15 +45,15 @@ #include <com/sun/star/util/SearchOptions.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <com/sun/star/i18n/TransliterationModules.hpp> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif #include <sfx2/dispatch.hxx> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <svtools/txtcmp.hxx> #include <svx/scripttypeitem.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <svx/langitem.hxx> #include <swtypes.hxx> #include <idxmrk.hxx> @@ -78,7 +78,7 @@ #include <fldbas.hxx> #include <utlui.hrc> #include <swcont.hxx> -#include <svtools/cjkoptions.hxx> +#include <svl/cjkoptions.hxx> #include <ndtxt.hxx> #include <breakit.hxx> diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index f65fe57f11..812d5f1e7f 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -40,7 +40,7 @@ #include <helpid.h> #endif #define _SVSTDARR_STRINGSSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -48,15 +48,15 @@ #include <com/sun/star/util/SearchOptions.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <com/sun/star/i18n/TransliterationModules.hpp> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif #include <sfx2/dispatch.hxx> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <svtools/txtcmp.hxx> #include <svx/scripttypeitem.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <svx/langitem.hxx> #include "svx/unolingu.hxx" #include <swtypes.hxx> @@ -82,7 +82,7 @@ #include <fldbas.hxx> #include <utlui.hrc> #include <swcont.hxx> -#include <svtools/cjkoptions.hxx> +#include <svl/cjkoptions.hxx> #include <ndtxt.hxx> #include <breakit.hxx> #include <SwRewriter.hxx> diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 52540f21dd..ddce0b731d 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -35,10 +35,10 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/lingucfg.hxx> -#include <svtools/linguprops.hxx> +#include <unotools/lingucfg.hxx> +#include <unotools/linguprops.hxx> #include <svtools/filter.hxx> #include <svx/impgrf.hxx> #include <svx/svxacorr.hxx> @@ -64,12 +64,12 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/i18n/ScriptType.hpp> #include <svx/dlgutil.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <svx/langitem.hxx> #include <svx/splwrap.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> -#include <svtools/lingucfg.hxx> +#include <unotools/lingucfg.hxx> #include <svx/acorrcfg.hxx> #include <swmodule.hxx> #include <cmdid.h> @@ -92,7 +92,7 @@ // <- #111827# #include <unomid.h> -#include <svtools/languageoptions.hxx> +#include <svl/languageoptions.hxx> #include <map> #include <svtools/langtab.hxx> #include <com/sun/star/document/XDocumentLanguages.hpp> @@ -101,7 +101,7 @@ #include "swabstdlg.hxx" #include "chrdlg.hrc" #include <svx/brshitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <viewopt.hxx> #include <uitool.hxx> @@ -428,7 +428,7 @@ bGrammarResults(false) sal_Int16 nStringCount = static_cast< sal_Int16 >( aSuggestions.getLength() ); SvtLinguConfig aCfg; - const bool bIsDark = Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark(); + const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); PopupMenu *pMenu = GetPopupMenu(MN_AUTOCORR); pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); @@ -440,7 +440,7 @@ bGrammarResults(false) uno::Reference< container::XNamed > xNamed( xSpellAlt, uno::UNO_QUERY ); if (xNamed.is()) { - aSuggestionImageUrl = aCfg.GetSpellAndGrammarContextSuggestionImage( xNamed->getName(), bIsDark ); + aSuggestionImageUrl = aCfg.GetSpellAndGrammarContextSuggestionImage( xNamed->getName(), bHC ); aImage = Image( lcl_GetImageFromPngUrl( aSuggestionImageUrl ) ); } @@ -529,7 +529,7 @@ bGrammarResults(false) if (xSvcInfo.is()) { OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage( - xSvcInfo->getImplementationName(), bIsDark) ); + xSvcInfo->getImplementationName(), bHC) ); if (aDictionaryImageUrl.getLength() > 0) { Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) ); @@ -583,7 +583,7 @@ bGrammarResults(false) uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(); Image rImg = ::GetImage( xFrame, ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, - Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark() ); + Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); SetItemImage( MN_SPELLING, rImg ); ////////////////////////////////////////////////////////////////////////////////// @@ -645,7 +645,7 @@ aInfo16( SW_RES(IMG_INFO_16) ) } InsertSeparator( nPos++ ); } - + OUString aIgnoreSelection( String( SW_RES( STR_IGNORE_SELECTION ) ) ); OUString aSpellingAndGrammar = RetrieveLabelFromCommand( C2U(".uno:SpellingAndGrammarDialog") ); SetItemText( MN_SPELLING, aSpellingAndGrammar ); @@ -717,7 +717,7 @@ aInfo16( SW_RES(IMG_INFO_16) ) uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(); Image rImg = ::GetImage( xFrame, ::rtl::OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False, - Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark() ); + Application::GetSettings().GetStyleSettings().GetHighContrastMode() ); SetItemImage( MN_SPELLING, rImg ); ////////////////////////////////////////////////////////////////////////////////// diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index b38c934b7c..146e75031e 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -37,7 +37,7 @@ #include <sfx2/request.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <vcl/msgbox.hxx> diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx index 004b08de43..9ae7ccbd15 100644 --- a/sw/source/ui/misc/docfnote.cxx +++ b/sw/source/ui/misc/docfnote.cxx @@ -36,7 +36,7 @@ #endif -#include <svtools/style.hxx> +#include <svl/style.hxx> #include <errhdl.hxx> #include <wrtsh.hxx> #ifndef _VIEW_HXX diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx index 0b66dde4d5..17250df77b 100644 --- a/sw/source/ui/misc/glosbib.cxx +++ b/sw/source/ui/misc/glosbib.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -46,8 +46,8 @@ #include <unotools/transliterationwrapper.hxx> #include <unotools/tempfile.hxx> -#include <svtools/svstdarr.hxx> -#include <svtools/pathoptions.hxx> +#include <svl/svstdarr.hxx> +#include <unotools/pathoptions.hxx> #include <swtypes.hxx> #include <glosbib.hxx> #include <gloshdl.hxx> diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx index a34c374291..6dc1fd4fd0 100644 --- a/sw/source/ui/misc/glosdoc.cxx +++ b/sw/source/ui/misc/glosdoc.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,17 +38,17 @@ #define _SVSTDARR_STRINGS #include <unotools/transliterationwrapper.hxx> -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #ifndef __RSC //autogen #include <tools/errinf.hxx> #endif #include <tools/debug.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #ifndef SVTOOLS_FSTATHELPER_HXX -#include <svtools/fstathelper.hxx> +#include <svl/fstathelper.hxx> #endif -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include <unotools/tempfile.hxx> #include <swtypes.hxx> #include <errhdl.hxx> // ASSERT diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 89a37a86e7..e2d5cd7f3f 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -50,11 +50,11 @@ #include <vcl/help.hxx> #endif #ifndef _SVSTDARR_HXX -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/stritem.hxx> -#include <svtools/pathoptions.hxx> -#include <svtools/lingucfg.hxx> +#include <svl/stritem.hxx> +#include <unotools/pathoptions.hxx> +#include <unotools/lingucfg.hxx> #include <sfx2/request.hxx> #include <sfx2/fcontnr.hxx> @@ -70,7 +70,7 @@ #include <com/sun/star/ui/dialogs/XFilePicker.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <unotools/charclass.hxx> #include <swwait.hxx> #include <swtypes.hxx> @@ -1216,7 +1216,7 @@ IMPL_LINK( SwGlossaryDlg, PathHdl, Button *, pBtn ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - AbstractSvxMultiPathDialog* pDlg = pFact->CreateSvxMultiPathDialog( pBtn, RID_SVXDLG_MULTIPATH); + AbstractSvxMultiPathDialog* pDlg = pFact->CreateSvxMultiPathDialog( pBtn ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); SvtPathOptions aPathOpt; String sGlosPath( aPathOpt.GetAutoTextPath() ); diff --git a/sw/source/ui/misc/glshell.cxx b/sw/source/ui/misc/glshell.cxx index 4156650fdc..f213ebe967 100644 --- a/sw/source/ui/misc/glshell.cxx +++ b/sw/source/ui/misc/glshell.cxx @@ -34,13 +34,13 @@ #include <com/sun/star/frame/XTitle.hpp> #include <tools/list.hxx> -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> #include <sfx2/printer.hxx> #include <sfx2/request.hxx> #include <sfx2/sfxsids.hrc> #include <svx/srchitem.hxx> -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include <gloshdl.hxx> #include <svx/acorrcfg.hxx> diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx index e0f21b11cf..ac45a05afb 100644 --- a/sw/source/ui/misc/insfnote.cxx +++ b/sw/source/ui/misc/insfnote.cxx @@ -36,8 +36,8 @@ #endif #include <hintids.hxx> -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> #include <sfx2/request.hxx> #include <svx/fontitem.hxx> #include <vcl/msgbox.hxx> diff --git a/sw/source/ui/misc/insrule.cxx b/sw/source/ui/misc/insrule.cxx index 87468ba50c..03facdece9 100644 --- a/sw/source/ui/misc/insrule.cxx +++ b/sw/source/ui/misc/insrule.cxx @@ -43,7 +43,7 @@ #include <vcl/msgbox.hxx> #endif #include <svx/brshitem.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <vcl/graph.hxx> #include "swtypes.hxx" diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx index c799cb9ec9..08918c0d2b 100644 --- a/sw/source/ui/misc/linenum.cxx +++ b/sw/source/ui/misc/linenum.cxx @@ -37,7 +37,7 @@ #include <sfx2/viewfrm.hxx> -#include <svtools/style.hxx> +#include <svl/style.hxx> #include <vcl/msgbox.hxx> #include <view.hxx> #include <wrtsh.hxx> diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index e413da5580..656f076800 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -93,9 +93,9 @@ #include <SwStyleNameMapper.hxx> #include <svx/svxids.hrc> #include <svx/dialogs.hrc> -#include <svtools/stritem.hxx> -#include <svtools/aeitem.hxx> -#include <svtools/slstitm.hxx> +#include <svl/stritem.hxx> +#include <svl/aeitem.hxx> +#include <svl/slstitm.hxx> static BOOL bLastRelative = FALSE; diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index 8b24c0b2d8..4440cbcde3 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -65,7 +65,7 @@ #include <uinums.hxx> #include <poolfmt.hxx> #include <shellres.hxx> -#include <svtools/style.hxx> +#include <svl/style.hxx> #include <charfmt.hxx> #include <docstyle.hxx> #include <viewopt.hxx> diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx index d684116f4e..2116375b9a 100644 --- a/sw/source/ui/misc/pgfnote.cxx +++ b/sw/source/ui/misc/pgfnote.cxx @@ -48,10 +48,10 @@ #include <vcl/field.hxx> #include <vcl/svapp.hxx> #include <unotools/localedatawrapper.hxx> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #include <svx/sizeitem.hxx> #include <svx/pageitem.hxx> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <svx/ulspitem.hxx> #include <uitool.hxx> #include <pagedesc.hxx> diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx index 59f71f1379..4b29b408b1 100644 --- a/sw/source/ui/misc/redlndlg.cxx +++ b/sw/source/ui/misc/redlndlg.cxx @@ -41,9 +41,9 @@ #include <tools/datetime.hxx> #include <vcl/msgbox.hxx> #ifndef _SVSTDARR_HXX -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> #include <svx/ctredlin.hxx> @@ -1281,7 +1281,7 @@ IMPL_LINK( SwRedlineAcceptDlg, CommandHdl, void*, EMPTYARG ) rRedline.GetRedlineData().GetTimeStamp() ), SID_ATTR_POSTIT_DATE )); - AbstractSvxPostItDialog* pDlg = pFact->CreateSvxPostItDialog( pParentDlg, aSet, RID_SVXDLG_POSTIT, FALSE ); + AbstractSvxPostItDialog* pDlg = pFact->CreateSvxPostItDialog( pParentDlg, aSet, FALSE ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); pDlg->HideAuthor(); diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index 52c7686dc9..306e99e7dd 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -39,8 +39,8 @@ #ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif -#include <svtools/intitem.hxx> -#include <svtools/eitem.hxx> +#include <svl/intitem.hxx> +#include <svl/eitem.hxx> #include <sfx2/dispatch.hxx> #include <svx/svxids.hrc> #include <svx/unolingu.hxx> diff --git a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx index d2e7d3ed2e..710185118b 100644 --- a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx +++ b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx @@ -45,9 +45,9 @@ #include <tools/datetime.hxx> #include <vcl/msgbox.hxx> #ifndef _SVSTDARR_HXX -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> #include <svx/ctredlin.hxx> diff --git a/sw/source/ui/ribbar/concustomshape.cxx b/sw/source/ui/ribbar/concustomshape.cxx index a155f1c179..32059b83f9 100644 --- a/sw/source/ui/ribbar/concustomshape.cxx +++ b/sw/source/ui/ribbar/concustomshape.cxx @@ -61,7 +61,7 @@ #ifndef _FM_FMMODEL_HXX #include <svx/fmmodel.hxx> #endif -#include <svtools/itempool.hxx> +#include <svl/itempool.hxx> #include <svx/svdpage.hxx> #include <svx/svdoashp.hxx> #include <svx/adjitem.hxx> diff --git a/sw/source/ui/ribbar/drawbase.cxx b/sw/source/ui/ribbar/drawbase.cxx index a9fe374f73..e79d25ec9f 100644 --- a/sw/source/ui/ribbar/drawbase.cxx +++ b/sw/source/ui/ribbar/drawbase.cxx @@ -34,7 +34,7 @@ #include <tools/list.hxx> #include <svx/svdview.hxx> #include <svx/svdobj.hxx> -#include <svtools/ptitem.hxx> +#include <svl/ptitem.hxx> #include <svx/sizeitem.hxx> #include <sfx2/request.hxx> #include <sfx2/bindings.hxx> diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx index cd98771445..3f129b9848 100644 --- a/sw/source/ui/ribbar/inputwin.cxx +++ b/sw/source/ui/ribbar/inputwin.cxx @@ -37,8 +37,8 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> #include <svx/ruler.hxx> -#include <svtools/zforlist.hxx> -#include <svtools/stritem.hxx> +#include <svl/zforlist.hxx> +#include <svl/stritem.hxx> #include "swtypes.hxx" #include "cmdid.h" @@ -95,10 +95,10 @@ SwInputWindow::SwInputWindow( Window* pParent, SfxBindings* pBind ) InsertWindow( ED_FORMULA, &aEdit); SetHelpId(ED_FORMULA, HID_EDIT_FORMULA); - BOOL bDark = GetSettings().GetStyleSettings().GetFaceColor().IsDark(); - SetItemImage( FN_FORMULA_CALC, pManager->GetImage(FN_FORMULA_CALC, bDark )); - SetItemImage( FN_FORMULA_CANCEL, pManager->GetImage(FN_FORMULA_CANCEL, bDark )); - SetItemImage( FN_FORMULA_APPLY, pManager->GetImage(FN_FORMULA_APPLY, bDark )); + BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); + SetItemImage( FN_FORMULA_CALC, pManager->GetImage(FN_FORMULA_CALC, bHC )); + SetItemImage( FN_FORMULA_CANCEL, pManager->GetImage(FN_FORMULA_CANCEL, bHC )); + SetItemImage( FN_FORMULA_APPLY, pManager->GetImage(FN_FORMULA_APPLY, bHC )); SetItemBits( FN_FORMULA_CALC, GetItemBits( FN_FORMULA_CALC ) | TIB_DROPDOWNONLY ); SetDropdownClickHdl( LINK( this, SwInputWindow, DropdownClickHdl )); @@ -156,12 +156,11 @@ void SwInputWindow::DataChanged( const DataChangedEvent& rDCEvt ) // update item images SwModule *pMod = SW_MOD(); SfxImageManager *pImgMgr = SfxImageManager::GetImageManager( pMod ); - //!! Don't use display-background to check for IsDark !! - BOOL bDark = GetSettings().GetStyleSettings().GetFaceColor().IsDark(); + BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); // - SetItemImage( FN_FORMULA_CALC, pImgMgr->GetImage(FN_FORMULA_CALC, bDark )); - SetItemImage( FN_FORMULA_CANCEL, pImgMgr->GetImage(FN_FORMULA_CANCEL, bDark )); - SetItemImage( FN_FORMULA_APPLY, pImgMgr->GetImage(FN_FORMULA_APPLY, bDark )); + SetItemImage( FN_FORMULA_CALC, pImgMgr->GetImage(FN_FORMULA_CALC, bHC )); + SetItemImage( FN_FORMULA_CANCEL, pImgMgr->GetImage(FN_FORMULA_CANCEL, bHC )); + SetItemImage( FN_FORMULA_APPLY, pImgMgr->GetImage(FN_FORMULA_APPLY, bHC )); } ToolBox::DataChanged( rDCEvt ); diff --git a/sw/source/ui/ribbar/tblctrl.cxx b/sw/source/ui/ribbar/tblctrl.cxx index dd39140585..99e8bb76b7 100644 --- a/sw/source/ui/ribbar/tblctrl.cxx +++ b/sw/source/ui/ribbar/tblctrl.cxx @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include <vcl/toolbox.hxx> #include <sfx2/app.hxx> diff --git a/sw/source/ui/ribbar/tbxanchr.cxx b/sw/source/ui/ribbar/tbxanchr.cxx index 2deec94563..0448bc3b5a 100644 --- a/sw/source/ui/ribbar/tbxanchr.cxx +++ b/sw/source/ui/ribbar/tbxanchr.cxx @@ -37,7 +37,7 @@ #include <vcl/timer.hxx> #include <sfx2/app.hxx> #include <svx/htmlmode.hxx> -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include <sfx2/dispatch.hxx> #ifndef _TOOLBOX_HXX //autogen #include <vcl/toolbox.hxx> diff --git a/sw/source/ui/ribbar/workctrl.cxx b/sw/source/ui/ribbar/workctrl.cxx index e74b212fd4..e692364362 100644 --- a/sw/source/ui/ribbar/workctrl.cxx +++ b/sw/source/ui/ribbar/workctrl.cxx @@ -34,7 +34,7 @@ #include <string> // HACK: prevent conflict between STLPORT and Workshop headers -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <svx/htmlmode.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/bindings.hxx> @@ -65,7 +65,7 @@ #include <helpid.h> #endif #include <wrtsh.hxx> -#include <svtools/imageitm.hxx> +#include <svl/imageitm.hxx> #include <vcl/lstbox.hxx> #include <rtl/ustring.hxx> #include "swabstdlg.hxx" @@ -115,7 +115,7 @@ void SAL_CALL SwTbxInsertCtrl::update() throw (uno::RuntimeException) Image aImage = GetImage( m_xFrame, aSlotURL, hasBigImages(), - rTbx.GetDisplayBackground().GetColor().IsDark() ); + rTbx.GetSettings().GetStyleSettings().GetHighContrastMode() ); rTbx.SetItemImage(GetId(), aImage); rTbx.Invalidate(); @@ -146,11 +146,11 @@ void SwTbxInsertCtrl::StateChanged( USHORT /*nSID*/, rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); aSlotURL += rtl::OUString::valueOf( sal_Int32( nId )); + ToolBox& rBox = GetToolBox(); Image aImage = GetImage( m_xFrame, aSlotURL, hasBigImages(), - GetToolBox().GetDisplayBackground().GetColor().IsDark() ); - ToolBox& rBox = GetToolBox(); + rBox.GetSettings().GetStyleSettings().GetHighContrastMode() ); rBox.SetItemImage(GetId(), aImage); rBox.SetItemImageMirrorMode( GetId(), FALSE ); rBox.SetItemImageAngle( GetId(), pItem->GetRotation() ); @@ -572,7 +572,7 @@ void SwScrollNaviPopup::DataChanged( const DataChangedEvent& rDCEvt ) ---------------------------------------------------------------------------*/ void SwScrollNaviPopup::ApplyImageList() { - ImageList& rImgLst = aToolBox.GetDisplayBackground().GetColor().IsDark() ? + ImageList& rImgLst = aToolBox.GetSettings().GetStyleSettings().GetHighContrastMode() ? aIListH : aIList; for(USHORT i = 0; i < NID_COUNT; i++) { @@ -746,7 +746,7 @@ SwNaviImageButton::SwNaviImageButton( FreeResource(); SetStyle(GetStyle()|WB_NOPOINTERFOCUS); SetQuickHelpText(sQuickText); - SetModeImage( GetDisplayBackground().GetColor().IsDark() ? aImageH : aImage); + SetModeImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? aImageH : aImage); } /* -----------------------------2002/07/05 9:41------------------------------- @@ -755,7 +755,7 @@ void SwNaviImageButton::DataChanged( const DataChangedEvent& rDCEvt ) { if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - SetModeImage( GetDisplayBackground().GetColor().IsDark() ? aImageH : aImage); + SetModeImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? aImageH : aImage); Window::DataChanged( rDCEvt ); } diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 68b8e87c3b..443b181cbc 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -57,18 +57,18 @@ #include <svx/fontitem.hxx> #include <svx/fhgtitem.hxx> #include <svx/clipfmtitem.hxx> -#include <svtools/stritem.hxx> -#include <svtools/slstitm.hxx> +#include <svl/stritem.hxx> +#include <svl/slstitm.hxx> #include <svx/colritem.hxx> #include <svx/wghtitem.hxx> #include <svx/cntritem.hxx> #include <svx/postitem.hxx> #include <svx/frmdiritem.hxx> #include <svx/svdoutl.hxx> -#include <svtools/whiter.hxx> -#include <svtools/cjkoptions.hxx> -#include <svtools/ctloptions.hxx> -#include <svtools/useroptions.hxx> +#include <svl/whiter.hxx> +#include <svl/cjkoptions.hxx> +#include <svl/ctloptions.hxx> +#include <unotools/useroptions.hxx> #include <vcl/msgbox.hxx> #include <svx/flditem.hxx> #include <svx/editstat.hxx> @@ -108,18 +108,18 @@ #include <svx/dialogs.hrc> #include <svx/svxids.hrc> -#include <svtools/itempool.hxx> +#include <svl/itempool.hxx> #include <svx/outliner.hxx> #include <svx/editeng.hxx> #include <svx/editview.hxx> -#include <svtools/languageoptions.hxx> +#include <svl/languageoptions.hxx> #include <svx/langitem.hxx> #include <svtools/langtab.hxx> -#include <svtools/slstitm.hxx> +#include <svl/slstitm.hxx> #include <docsh.hxx> -#include <svtools/undo.hxx> +#include <svl/undo.hxx> #include "swabstdlg.hxx" //CHINA001 #include "chrdlg.hrc" //CHINA001 #include "misc.hrc" diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 84b6f53a57..993772ad76 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -32,8 +32,8 @@ #include "precompiled_sw.hxx" #include <sot/factory.hxx> #include <hintids.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/languageoptions.hxx> +#include <svl/urihelper.hxx> +#include <svl/languageoptions.hxx> #ifndef _SVX_SVXIDS_HRC #include <svx/svxids.hrc> @@ -45,8 +45,8 @@ #include <sfx2/docfile.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/request.hxx> -#include <svtools/whiter.hxx> -#include <svtools/visitem.hxx> +#include <svl/whiter.hxx> +#include <svl/visitem.hxx> #include <sfx2/objitem.hxx> #include <svtools/filter.hxx> #include <svx/gallery.hxx> @@ -55,11 +55,11 @@ #include <svx/contdlg.hxx> #include <vcl/graph.hxx> #include <svx/impgrf.hxx> -#include <svtools/slstitm.hxx> +#include <svl/slstitm.hxx> #include <vcl/msgbox.hxx> -#include <svtools/ptitem.hxx> -#include <svtools/itemiter.hxx> -#include <svtools/stritem.hxx> +#include <svl/ptitem.hxx> +#include <svl/itemiter.hxx> +#include <svl/stritem.hxx> #include <svx/colritem.hxx> #include <svx/shaditem.hxx> #include <svx/boxitem.hxx> @@ -517,6 +517,9 @@ void SwBaseShell::ExecUndo(SfxRequest &rReq) if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, FALSE, &pItem )) nCnt = ((SfxUInt16Item*)pItem)->GetValue(); + // #i106349#: save pointer: undo/redo may delete the shell, i.e., this! + SfxViewFrame *const pViewFrame( GetView().GetViewFrame() ); + switch( nId ) { case SID_UNDO: @@ -538,7 +541,7 @@ void SwBaseShell::ExecUndo(SfxRequest &rReq) DBG_ERROR("falscher Dispatcher"); } - GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False); + if (pViewFrame) { pViewFrame->GetBindings().InvalidateAll(sal_False); } } /*-------------------------------------------------------------------- diff --git a/sw/source/ui/shells/beziersh.cxx b/sw/source/ui/shells/beziersh.cxx index 613f3b7327..c370ebdfbe 100644 --- a/sw/source/ui/shells/beziersh.cxx +++ b/sw/source/ui/shells/beziersh.cxx @@ -35,8 +35,8 @@ #include "cmdid.h" #include <svx/svdview.hxx> #include <svx/srchitem.hxx> -#include <svtools/eitem.hxx> -#include <svtools/whiter.hxx> +#include <svl/eitem.hxx> +#include <svl/whiter.hxx> #include <svx/svdopath.hxx> #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> diff --git a/sw/source/ui/shells/drawdlg.cxx b/sw/source/ui/shells/drawdlg.cxx index 3d3b4e688a..464c1b4e59 100644 --- a/sw/source/ui/shells/drawdlg.cxx +++ b/sw/source/ui/shells/drawdlg.cxx @@ -83,7 +83,7 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { - SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( NULL, &aNewAttr, RID_SVXDLG_TEXT, pView ); + SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( NULL, &aNewAttr, pView ); USHORT nResult = pDlg->Execute(); if (nResult == RET_OK) @@ -111,7 +111,6 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) AbstractSvxAreaTabDialog * pDlg = pFact->CreateSvxAreaTabDialog( NULL, &aNewAttr, pDoc, - RID_SVXDLG_AREA, pView); DBG_ASSERT(pDlg, "Dialogdiet fail!"); const SvxColorTableItem* pColorItem = (const SvxColorTableItem*) @@ -154,7 +153,6 @@ void SwDrawShell::ExecDrawDlg(SfxRequest& rReq) SfxAbstractTabDialog * pDlg = pFact->CreateSvxLineTabDialog( NULL, &aNewAttr, pDoc, - RID_SVXDLG_LINE, pObj, bHasMarked); DBG_ASSERT(pDlg, "Dialogdiet fail!"); diff --git a/sw/source/ui/shells/drawsh.cxx b/sw/source/ui/shells/drawsh.cxx index 9dd27332aa..cd2c4c6a17 100644 --- a/sw/source/ui/shells/drawsh.cxx +++ b/sw/source/ui/shells/drawsh.cxx @@ -35,12 +35,12 @@ #include <tools/shl.hxx> #include <svx/svdview.hxx> #include <svx/svdotext.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <svx/fontwork.hxx> #include <sfx2/request.hxx> #include <sfx2/bindings.hxx> #include <sfx2/objface.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <svx/srchitem.hxx> #include <svx/xftsfit.hxx> #include <svx/extrusionbar.hxx> diff --git a/sw/source/ui/shells/drformsh.cxx b/sw/source/ui/shells/drformsh.cxx index 59586c2a53..6ec599bc6d 100644 --- a/sw/source/ui/shells/drformsh.cxx +++ b/sw/source/ui/shells/drformsh.cxx @@ -36,7 +36,7 @@ #include <hintids.hxx> #include <svx/hlnkitem.hxx> #include <svx/svdview.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <sfx2/request.hxx> #include <sfx2/objface.hxx> #include <sfx2/app.hxx> @@ -59,7 +59,7 @@ #include "shells.hrc" #include "drwbassh.hxx" #include "drformsh.hxx" -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <view.hxx> #include <sfx2/docfile.hxx> #include <docsh.hxx> diff --git a/sw/source/ui/shells/drwbassh.cxx b/sw/source/ui/shells/drwbassh.cxx index 75026e8d4e..2b5aa3db2a 100644 --- a/sw/source/ui/shells/drwbassh.cxx +++ b/sw/source/ui/shells/drwbassh.cxx @@ -39,11 +39,11 @@ #include <sfx2/objface.hxx> #include <sfx2/request.hxx> #include <sfx2/bindings.hxx> -#include <svtools/aeitem.hxx> +#include <svl/aeitem.hxx> #include <svx/svdview.hxx> #include <vcl/msgbox.hxx> #include <svx/srchitem.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <svx/swframevalidation.hxx> #include <svx/anchorid.hxx> #include <svx/htmlmode.hxx> @@ -238,7 +238,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) if ( pFact ) { AbstractSvxCaptionDialog* pCaptionDlg = - pFact->CreateCaptionDialog( NULL, pSdrView, RID_SVXDLG_CAPTION, nAllowedAnchors ); + pFact->CreateCaptionDialog( NULL, pSdrView, nAllowedAnchors ); pCaptionDlg->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) ); pDlg = pCaptionDlg; DBG_ASSERT(pDlg, "Dialogdiet fail!"); @@ -251,7 +251,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) { AbstractSvxTransformTabDialog* pTransform = - pFact->CreateSvxTransformTabDialog( NULL, NULL, pSdrView, RID_SVXDLG_TRANSFORM, nAllowedAnchors ); + pFact->CreateSvxTransformTabDialog( NULL, NULL, pSdrView, nAllowedAnchors ); pTransform->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) ); pDlg = pTransform; DBG_ASSERT(pDlg, "Dialogdiet fail!"); @@ -567,7 +567,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialogdiet fail!"); - AbstractSvxObjectNameDialog* pDlg = pFact->CreateSvxObjectNameDialog(NULL, aName, RID_SVXDLG_OBJECT_NAME); + AbstractSvxObjectNameDialog* pDlg = pFact->CreateSvxObjectNameDialog(NULL, aName); OSL_ENSURE(pDlg, "Dialogdiet fail!"); pDlg->SetCheckNameHdl(LINK(this, SwDrawBaseShell, CheckGroupShapeNameHdl)); @@ -599,7 +599,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialogdiet fail!"); - AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription, RID_SVXDLG_OBJECT_TITLE_DESC); + AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription); OSL_ENSURE(pDlg, "Dialogdiet fail!"); if(RET_OK == pDlg->Execute()) diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index 60059cdeb1..784fcb1f84 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -59,9 +59,9 @@ #include <svx/frmdiritem.hxx> #include <svx/svdoutl.hxx> #include <sfx2/viewfrm.hxx> -#include <svtools/whiter.hxx> -#include <svtools/cjkoptions.hxx> -#include <svtools/ctloptions.hxx> +#include <svl/whiter.hxx> +#include <svl/cjkoptions.hxx> +#include <svl/ctloptions.hxx> #include <sfx2/bindings.hxx> #include <vcl/msgbox.hxx> #include <sfx2/dispatch.hxx> @@ -99,10 +99,10 @@ #include "misc.hrc" //modified on Jul. 30th -#include <svtools/languageoptions.hxx> +#include <svl/languageoptions.hxx> #include <svx/langitem.hxx> #include <svtools/langtab.hxx> -#include <svtools/slstitm.hxx> +#include <svl/slstitm.hxx> #include <string.h> #include <svx/eeitem.hxx> diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index ad6ab1d2e7..1d7f5bbd84 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -32,8 +32,8 @@ #include "precompiled_sw.hxx" #include <hintids.hxx> #include <i18npool/lang.h> -#include <svtools/slstitm.hxx> -#include <svtools/cjkoptions.hxx> +#include <svl/slstitm.hxx> +#include <svl/cjkoptions.hxx> #include <svx/fontitem.hxx> #include <svx/langitem.hxx> #include <svx/svdview.hxx> @@ -49,7 +49,7 @@ #include <sfx2/bindings.hxx> #include <svx/fontwork.hxx> #include <sfx2/request.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <svx/outliner.hxx> #include <svx/editstat.hxx> #include <svx/svdoutl.hxx> @@ -577,7 +577,7 @@ void SwDrawTextShell::ExecDraw(SfxRequest &rReq) { SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( &(GetView().GetViewFrame()->GetWindow()), - &aNewAttr, RID_SVXDLG_TEXT, pSdrView ); + &aNewAttr, pSdrView ); USHORT nResult = pDlg->Execute(); if (nResult == RET_OK) diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx index 57f2babbfb..06f5231665 100644 --- a/sw/source/ui/shells/frmsh.cxx +++ b/sw/source/ui/shells/frmsh.cxx @@ -33,15 +33,15 @@ #include <hintids.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <svtools/imapobj.hxx> #include <svx/srchitem.hxx> #include <svtools/imap.hxx> #include <sfx2/viewfrm.hxx> #include <basic/sbstar.hxx> -#include <svtools/rectitem.hxx> -#include <svtools/ptitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/rectitem.hxx> +#include <svl/ptitem.hxx> +#include <svl/stritem.hxx> #include <svx/colritem.hxx> #include <svx/bolnitem.hxx> #include <svx/boxitem.hxx> @@ -618,8 +618,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog( NULL, aTitle, - aDescription, - RID_SVXDLG_OBJECT_TITLE_DESC ); + aDescription ); OSL_ENSURE(pDlg, "Dialogdiet fail!"); if ( pDlg->Execute() == RET_OK ) diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx index e0e5ec9178..b820b319a5 100644 --- a/sw/source/ui/shells/grfsh.cxx +++ b/sw/source/ui/shells/grfsh.cxx @@ -40,9 +40,9 @@ #include <hintids.hxx> #include <tools/urlobj.hxx> #include <vcl/msgbox.hxx> -#include <svtools/stritem.hxx> -#include <svtools/whiter.hxx> -#include <svtools/urihelper.hxx> +#include <svl/stritem.hxx> +#include <svl/whiter.hxx> +#include <svl/urihelper.hxx> #include <sfx2/docfile.hxx> #include <sfx2/dispatch.hxx> diff --git a/sw/source/ui/shells/grfshex.cxx b/sw/source/ui/shells/grfshex.cxx index bb6d1bedbf..8cf626538a 100644 --- a/sw/source/ui/shells/grfshex.cxx +++ b/sw/source/ui/shells/grfshex.cxx @@ -51,7 +51,7 @@ #endif #include <caption.hxx> #define _SVSTDARR_STRINGSSORTDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <svtools/filter.hxx> #include <svx/impgrf.hxx> #include <svx/htmlmode.hxx> @@ -81,7 +81,7 @@ #include <sfx2/request.hxx> #include <sfx2/viewfrm.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <avmedia/mediawindow.hxx> #include <vcl/svapp.hxx> diff --git a/sw/source/ui/shells/langhelper.cxx b/sw/source/ui/shells/langhelper.cxx index 7a3c424d27..3fa52625b2 100755 --- a/sw/source/ui/shells/langhelper.cxx +++ b/sw/source/ui/shells/langhelper.cxx @@ -48,11 +48,11 @@ #include <svx/scripttypeitem.hxx> #include <svx/langitem.hxx> -#include <svtools/languageoptions.hxx> +#include <svl/languageoptions.hxx> #include <svtools/langtab.hxx> -#include <svtools/slstitm.hxx> -#include <svtools/svstdarr.hxx> -#include <svtools/stritem.hxx> +#include <svl/slstitm.hxx> +#include <svl/svstdarr.hxx> +#include <svl/stritem.hxx> #include <ndtxt.hxx> #include <pam.hxx> diff --git a/sw/source/ui/shells/listsh.cxx b/sw/source/ui/shells/listsh.cxx index 1cc1d6a145..c5190449dd 100644 --- a/sw/source/ui/shells/listsh.cxx +++ b/sw/source/ui/shells/listsh.cxx @@ -40,11 +40,11 @@ #include <sfx2/request.hxx> #include <sfx2/objface.hxx> #include <sfx2/bindings.hxx> -#include <svtools/stritem.hxx> -#include <svtools/eitem.hxx> +#include <svl/stritem.hxx> +#include <svl/eitem.hxx> #include <tools/urlobj.hxx> -#include <svtools/whiter.hxx> -#include <svtools/intitem.hxx> +#include <svl/whiter.hxx> +#include <svl/intitem.hxx> #include <tools/shl.hxx> #include <svx/srchitem.hxx> diff --git a/sw/source/ui/shells/mediash.cxx b/sw/source/ui/shells/mediash.cxx index a823568f05..3688b33269 100644 --- a/sw/source/ui/shells/mediash.cxx +++ b/sw/source/ui/shells/mediash.cxx @@ -40,9 +40,9 @@ #include <hintids.hxx> #include <tools/urlobj.hxx> #include <vcl/msgbox.hxx> -#include <svtools/stritem.hxx> -#include <svtools/whiter.hxx> -#include <svtools/urihelper.hxx> +#include <svl/stritem.hxx> +#include <svl/whiter.hxx> +#include <svl/urihelper.hxx> #include <sfx2/dispatch.hxx> #include <svx/sizeitem.hxx> #include <svx/protitem.hxx> diff --git a/sw/source/ui/shells/slotadd.cxx b/sw/source/ui/shells/slotadd.cxx index 393823521a..6668f61d12 100644 --- a/sw/source/ui/shells/slotadd.cxx +++ b/sw/source/ui/shells/slotadd.cxx @@ -35,12 +35,12 @@ #include "uiitems.hxx" #include "cmdid.h" -#include <svtools/globalnameitem.hxx> +#include <svl/globalnameitem.hxx> -#include <svtools/imageitm.hxx> -#include <svtools/aeitem.hxx> -#include <svtools/rectitem.hxx> +#include <svl/imageitm.hxx> +#include <svl/aeitem.hxx> +#include <svl/rectitem.hxx> #include <sfx2/objitem.hxx> #include <sfx2/objsh.hxx> #include <svx/rulritem.hxx> @@ -49,7 +49,7 @@ #include <svx/zoomslideritem.hxx> #include <svx/hlnkitem.hxx> #include <svx/SmartTagItem.hxx> -#include <svtools/ptitem.hxx> +#include <svl/ptitem.hxx> #include <svx/pageitem.hxx> #include <svx/srchitem.hxx> #include <sfx2/tplpitem.hxx> @@ -130,7 +130,7 @@ #include "fmtline.hxx" #include <svx/clipfmtitem.hxx> #include <svx/blnkitem.hxx> -#include <svtools/slstitm.hxx> +#include <svl/slstitm.hxx> #include <svx/paravertalignitem.hxx> #include <svx/charreliefitem.hxx> #include <svx/charrotateitem.hxx> diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx index 577ea95c64..0ce16da163 100644 --- a/sw/source/ui/shells/tabsh.cxx +++ b/sw/source/ui/shells/tabsh.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -34,11 +34,11 @@ #ifndef _ZFORLIST_HXX #define _ZFORLIST_DECLARE_TABLE -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #endif -#include <svtools/stritem.hxx> -#include <svtools/whiter.hxx> -#include <svtools/moduleoptions.hxx> +#include <svl/stritem.hxx> +#include <svl/whiter.hxx> +#include <unotools/moduleoptions.hxx> #include <svx/rulritem.hxx> #include <svx/srchitem.hxx> #include <svx/lrspitem.hxx> @@ -55,7 +55,7 @@ #include <svx/numinf.hxx> #include <svx/svddef.hxx> #include <svx/svxdlg.hxx> -#include <svtools/zformat.hxx> +#include <svl/zformat.hxx> #include <sfx2/bindings.hxx> #include <vcl/msgbox.hxx> #include <sfx2/request.hxx> @@ -735,7 +735,7 @@ void SwTableShell::Execute(SfxRequest &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); - SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(),aCoreSet, + SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(),aCoreSet, pView->GetViewFrame()->GetFrame()->GetFrameInterface(), RC_DLG_SWNUMFMTDLG ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); @@ -969,7 +969,7 @@ void SwTableShell::Execute(SfxRequest &rReq) case FN_TABLE_INSERT_ROW_DLG: { if ( FN_TABLE_INSERT_ROW_DLG != nSlot || !rSh.IsInRepeatedHeadline()) - { + { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ::std::auto_ptr<SvxAbstractInsRowColDlg> pDlg( pFact ? pFact->CreateSvxInsRowColDlg( GetView().GetWindow(), nSlot == FN_TABLE_INSERT_COL_DLG, nSlot) : 0); @@ -1046,7 +1046,7 @@ void SwTableShell::Execute(SfxRequest &rReq) rSh.SplitTable(pType->GetValue()) ; default: ;//wrong parameter, do nothing } - } + } else { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); diff --git a/sw/source/ui/shells/textdrw.cxx b/sw/source/ui/shells/textdrw.cxx index 8031028cad..92704d307d 100644 --- a/sw/source/ui/shells/textdrw.cxx +++ b/sw/source/ui/shells/textdrw.cxx @@ -57,7 +57,7 @@ #include <docsh.hxx> #endif #include <sfx2/docfile.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <avmedia/mediawindow.hxx> #include <unomid.h> diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx index 529ac59604..b0238213d9 100644 --- a/sw/source/ui/shells/textfld.cxx +++ b/sw/source/ui/shells/textfld.cxx @@ -1,7 +1,7 @@ /************ ************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,11 +38,11 @@ #include <fmtfld.hxx> #include <tools/urlobj.hxx> #include <vcl/msgbox.hxx> -#include <svtools/itempool.hxx> -#include <svtools/useroptions.hxx> -#include <svtools/whiter.hxx> -#include <svtools/eitem.hxx> -#include <svtools/macitem.hxx> +#include <svl/itempool.hxx> +#include <unotools/useroptions.hxx> +#include <svl/whiter.hxx> +#include <svl/eitem.hxx> +#include <svl/macitem.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/request.hxx> #include <svx/postattr.hxx> @@ -391,8 +391,8 @@ void SwTextShell::ExecField(SfxRequest &rReq) } break; case FN_REDLINE_COMMENT: - { - /* this code can be used once we want redline comments in the margin, all other stuff can + { + /* this code can be used once we want redline comments in the margin, all other stuff can then be deleted String sComment; const SwRedline *pRedline = rSh.GetCurrRedline(); @@ -463,7 +463,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) SvxAbstractDialogFactory* pFact2 = SvxAbstractDialogFactory::Create(); DBG_ASSERT(pFact2, "Dialogdiet fail!"); - AbstractSvxPostItDialog* pDlg = pFact2->CreateSvxPostItDialog( pMDI, aSet, RID_SVXDLG_POSTIT, bTravel, TRUE ); + AbstractSvxPostItDialog* pDlg = pFact2->CreateSvxPostItDialog( pMDI, aSet, bTravel, TRUE ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); pDlg->HideAuthor(); diff --git a/sw/source/ui/shells/textglos.cxx b/sw/source/ui/shells/textglos.cxx index 257ac55680..2135e33452 100644 --- a/sw/source/ui/shells/textglos.cxx +++ b/sw/source/ui/shells/textglos.cxx @@ -33,8 +33,8 @@ #include <sfx2/request.hxx> -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> #include "errhdl.hxx" #include "view.hxx" diff --git a/sw/source/ui/shells/textidx.cxx b/sw/source/ui/shells/textidx.cxx index c3fb70f483..643169e309 100644 --- a/sw/source/ui/shells/textidx.cxx +++ b/sw/source/ui/shells/textidx.cxx @@ -37,8 +37,8 @@ #endif #include <sfx2/request.hxx> #include <sfx2/viewfrm.hxx> -#include <svtools/stritem.hxx> -#include <svtools/eitem.hxx> +#include <svl/stritem.hxx> +#include <svl/eitem.hxx> #include <svx/sizeitem.hxx> #include <fmtfsize.hxx> #include <fldbas.hxx> diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index 965b0f5d32..79bc6334e3 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -35,7 +35,7 @@ #define _SW_FRMVALID_HXX #include <hintids.hxx> -#include <svtools/globalnameitem.hxx> +#include <svl/globalnameitem.hxx> #include <sfx2/objface.hxx> #include <sfx2/lnkbase.hxx> @@ -43,18 +43,18 @@ #include <tools/errinf.hxx> #endif #include <svx/svdview.hxx> -#include <svtools/ptitem.hxx> -#include <svtools/stritem.hxx> -#include <svtools/moduleoptions.hxx> +#include <svl/ptitem.hxx> +#include <svl/stritem.hxx> +#include <unotools/moduleoptions.hxx> #include <vcl/msgbox.hxx> #include <sfx2/fcontnr.hxx> #include <svx/hlnkitem.hxx> #include <svx/srchitem.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/docfile.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <basic/sbxvar.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <sfx2/request.hxx> #include <svx/opaqitem.hxx> #include <svx/fontitem.hxx> @@ -832,7 +832,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) case SID_INSERT_SOUND: case SID_INSERT_VIDEO: /*!SvxPluginFileDlg::IsAvailable( nWhich ) || - + discussed with mba: for performance reasons we skip the IsAvailable call here */ if ( GetShell().IsSelFrmMode() || diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index 3042101976..09ba7b28cc 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -38,30 +38,30 @@ #include <helpid.h> #include <i18npool/mslangid.hxx> -#include <svtools/languageoptions.hxx> +#include <svl/languageoptions.hxx> #include <svx/langitem.hxx> #include <svtools/langtab.hxx> -#include <svtools/slstitm.hxx> +#include <svl/slstitm.hxx> #include <string.h> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <svx/htmlmode.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/objitem.hxx> #include <vcl/msgbox.hxx> #include <vcl/unohelp2.hxx> #include <sfx2/request.hxx> -#include <svtools/eitem.hxx> -#include <svtools/macitem.hxx> +#include <svl/eitem.hxx> +#include <svl/macitem.hxx> #include <svx/lrspitem.hxx> #include <svx/ulspitem.hxx> #include <svx/colritem.hxx> #include <svx/tstpitem.hxx> #include <svx/brshitem.hxx> #include <svx/svxacorr.hxx> -#include <svtools/cjkoptions.hxx> -#include <svtools/ctloptions.hxx> +#include <svl/cjkoptions.hxx> +#include <svl/ctloptions.hxx> #include <IDocumentSettingAccess.hxx> #include <charfmt.hxx> #include <svx/fontitem.hxx> @@ -116,13 +116,13 @@ #include <IDocumentStatistics.hxx> #include <sfx2/sfxdlg.hxx> -#include <svtools/languageoptions.hxx> -#include <svtools/lingucfg.hxx> +#include <svl/languageoptions.hxx> +#include <unotools/lingucfg.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/util/XChangesBatch.hpp> #include <com/sun/star/uno/Any.hxx> #include <svx/unolingu.hxx> -#include <svtools/syslocaleoptions.hxx> +#include <unotools/syslocaleoptions.hxx> #include <doc.hxx> #include <view.hxx> #include <ndtxt.hxx> diff --git a/sw/source/ui/shells/textsh2.cxx b/sw/source/ui/shells/textsh2.cxx index 6fa11897ef..a56889491b 100644 --- a/sw/source/ui/shells/textsh2.cxx +++ b/sw/source/ui/shells/textsh2.cxx @@ -38,16 +38,16 @@ #endif #include <svtools/svmedit.hxx> -#include <svtools/eitem.hxx> -#include <svtools/whiter.hxx> +#include <svl/eitem.hxx> +#include <svl/whiter.hxx> #include <sfx2/event.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/viewfrm.hxx> #ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif -#include <svtools/stritem.hxx> -#include <svtools/itemset.hxx> +#include <svl/stritem.hxx> +#include <svl/itemset.hxx> #include <sfx2/request.hxx> #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx index fc64a6c132..29fc07107a 100644 --- a/sw/source/ui/shells/txtattr.cxx +++ b/sw/source/ui/shells/txtattr.cxx @@ -37,10 +37,10 @@ #ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif -#include <svtools/whiter.hxx> -#include <svtools/stritem.hxx> -#include <svtools/itemiter.hxx> -#include <svtools/ctloptions.hxx> +#include <svl/whiter.hxx> +#include <svl/stritem.hxx> +#include <svl/itemiter.hxx> +#include <svl/ctloptions.hxx> #include <swmodule.hxx> #include <sfx2/bindings.hxx> #include <sfx2/request.hxx> diff --git a/sw/source/ui/shells/txtcrsr.cxx b/sw/source/ui/shells/txtcrsr.cxx index 66d48d6f3f..888f5560ec 100644 --- a/sw/source/ui/shells/txtcrsr.cxx +++ b/sw/source/ui/shells/txtcrsr.cxx @@ -33,7 +33,7 @@ #include <sfx2/request.hxx> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #ifndef __SBX_SBXVARIABLE_HXX //autogen #include <basic/sbxvar.hxx> #endif diff --git a/sw/source/ui/shells/txtnum.cxx b/sw/source/ui/shells/txtnum.cxx index 3bbee67624..6b4be8da6e 100644 --- a/sw/source/ui/shells/txtnum.cxx +++ b/sw/source/ui/shells/txtnum.cxx @@ -37,8 +37,8 @@ #include <vcl/msgbox.hxx> #endif #include <sfx2/request.hxx> -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> #include <svx/numitem.hxx> #include <svx/brshitem.hxx> #include <numrule.hxx> diff --git a/sw/source/ui/smartmenu/stmenu.cxx b/sw/source/ui/smartmenu/stmenu.cxx index 0b08a7d0b8..39bd1908f8 100644 --- a/sw/source/ui/smartmenu/stmenu.cxx +++ b/sw/source/ui/smartmenu/stmenu.cxx @@ -34,7 +34,7 @@ #include "precompiled_sw.hxx" #include <stmenu.hxx> #include <com/sun/star/uno/Sequence.hxx> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <sfx2/dispatch.hxx> #include <SwSmartTagMgr.hxx> diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx index 8b80758df6..d2f0e792dd 100644 --- a/sw/source/ui/table/convert.cxx +++ b/sw/source/ui/table/convert.cxx @@ -38,7 +38,7 @@ #include <vcl/msgbox.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <sfx2/viewfrm.hxx> #include <modcfg.hxx> #include <svx/htmlmode.hxx> diff --git a/sw/source/ui/table/convert.src b/sw/source/ui/table/convert.src index 4da05104ef..ea4b4c6e87 100644 --- a/sw/source/ui/table/convert.src +++ b/sw/source/ui/table/convert.src @@ -177,7 +177,7 @@ ModalDialog DLG_CONV_TEXT_TABLE PushButton BT_AUTOFORMAT { Pos = MAP_APPFONT ( 12 , 152 ) ; - Size = MAP_APPFONT ( 66 , 14 ) ; + Size = MAP_APPFONT ( 86 , 14 ) ; TabStop = TRUE ; Hide = TRUE ; Text [ en-US ] = "Auto~Format..." ; diff --git a/sw/source/ui/table/instable.src b/sw/source/ui/table/instable.src index 58b4bbb44d..11ea4ca90c 100644 --- a/sw/source/ui/table/instable.src +++ b/sw/source/ui/table/instable.src @@ -159,7 +159,7 @@ ModalDialog DLG_INSERT_TABLE PushButton BT_AUTOFORMAT { Pos = MAP_APPFONT ( 12 , 146 ) ; - Size = MAP_APPFONT ( 66 , 14 ) ; + Size = MAP_APPFONT ( 86 , 14 ) ; TabStop = TRUE ; Text [ en-US ] = "Auto~Format..." ; }; diff --git a/sw/source/ui/table/rowht.cxx b/sw/source/ui/table/rowht.cxx index edf6938c05..00cd7fc555 100644 --- a/sw/source/ui/table/rowht.cxx +++ b/sw/source/ui/table/rowht.cxx @@ -36,8 +36,8 @@ #endif -#include <svtools/intitem.hxx> -#include <svtools/eitem.hxx> +#include <svl/intitem.hxx> +#include <svl/eitem.hxx> #include <sfx2/dispatch.hxx> #include <svx/dlgutil.hxx> diff --git a/sw/source/ui/table/swtablerep.cxx b/sw/source/ui/table/swtablerep.cxx index 082004e70d..a2bcfcb920 100644 --- a/sw/source/ui/table/swtablerep.cxx +++ b/sw/source/ui/table/swtablerep.cxx @@ -35,14 +35,14 @@ #include <hintids.hxx> #include <tools/list.hxx> #include <vcl/msgbox.hxx> -#include <svtools/stritem.hxx> -#include <svtools/intitem.hxx> +#include <svl/stritem.hxx> +#include <svl/intitem.hxx> #include <svx/htmlmode.hxx> #include <svx/keepitem.hxx> #include <svx/brkitem.hxx> #include <svx/ulspitem.hxx> #include <svx/frmdiritem.hxx> -#include <svtools/ctloptions.hxx> +#include <svl/ctloptions.hxx> #include <swmodule.hxx> #include <fmtornt.hxx> #include <fmtpdsc.hxx> diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index c7296b1e96..b7561449a4 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -39,14 +39,14 @@ #include <hintids.hxx> #include <tools/list.hxx> #include <vcl/msgbox.hxx> -#include <svtools/stritem.hxx> -#include <svtools/intitem.hxx> +#include <svl/stritem.hxx> +#include <svl/intitem.hxx> #include <svx/htmlmode.hxx> #include <svx/keepitem.hxx> #include <svx/brkitem.hxx> #include <svx/ulspitem.hxx> #include <svx/frmdiritem.hxx> -#include <svtools/ctloptions.hxx> +#include <svl/ctloptions.hxx> #include <swmodule.hxx> #include <fmtornt.hxx> #include <fmtpdsc.hxx> diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx index 1b756f47ef..44b7d8ff04 100644 --- a/sw/source/ui/table/tautofmt.cxx +++ b/sw/source/ui/table/tautofmt.cxx @@ -45,7 +45,7 @@ #include <vcl/msgbox.hxx> #endif #include <vcl/svapp.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/i18n/XBreakIterator.hpp> #include <comphelper/processfactory.hxx> diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index 385cfdeee0..f55f2cf637 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -41,9 +41,9 @@ #include <vcl/cmdevt.hxx> #include <vcl/button.hxx> #include <svtools/printdlg.hxx> -#include <svtools/whiter.hxx> -#include <svtools/stritem.hxx> -#include <svtools/eitem.hxx> +#include <svl/whiter.hxx> +#include <svl/stritem.hxx> +#include <svl/eitem.hxx> #include <sfx2/printer.hxx> #include <sfx2/app.hxx> #include <sfx2/topfrm.hxx> @@ -1376,7 +1376,7 @@ void SwPagePreView::Execute( SfxRequest &rReq ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aCoreSet, RID_SVXDLG_ZOOM); + pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aCoreSet); DBG_ASSERT(pDlg, "Dialogdiet fail!"); } @@ -2531,7 +2531,7 @@ USHORT SwPagePreView::SetPrinter( SfxPrinter *pNew, USHORT nDiffFlags, bool ) SID_ATTR_LONG_ULSPACE, SID_ATTR_LONG_LRSPACE, SID_RULER_BORDERS, SID_RULER_PAGE_POS, 0 }; -#ifndef PRODUCT +#ifdef DBG_UTIL { const USHORT* pPtr = aInval + 1; do { diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 5653071d84..07cfce2d2e 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -43,14 +43,14 @@ #include <vcl/wrkwin.hxx> #include <vcl/metric.hxx> #include <svtools/ctrltool.hxx> -#include <svtools/intitem.hxx> -#include <svtools/stritem.hxx> -#include <svtools/pathoptions.hxx> -#include <svtools/undo.hxx> +#include <svl/intitem.hxx> +#include <svl/stritem.hxx> +#include <unotools/pathoptions.hxx> +#include <svl/undo.hxx> #include <svtools/txtcmp.hxx> -#include <svtools/eitem.hxx> -#include <svtools/whiter.hxx> -#include <svtools/saveopt.hxx> +#include <svl/eitem.hxx> +#include <svl/whiter.hxx> +#include <unotools/saveopt.hxx> #include <svtools/transfer.hxx> #include <svx/htmlcfg.hxx> diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index 191ff8ac0d..c0763ec845 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -40,11 +40,11 @@ #include <vcl/graph.hxx> #include <vcl/inputctx.hxx> #include <basic/sbxobj.hxx> -#include <svtools/eitem.hxx> -#include <svtools/undoopt.hxx> -#include <svtools/lingucfg.hxx> +#include <svl/eitem.hxx> +#include <unotools/undoopt.hxx> +#include <unotools/lingucfg.hxx> #include <svtools/printdlg.hxx> -#include <svtools/useroptions.hxx> +#include <unotools/useroptions.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> #include <sfx2/docfile.hxx> diff --git a/sw/source/ui/uiview/view0.cxx b/sw/source/ui/uiview/view0.cxx index d005588603..bf8bf5a2b6 100644 --- a/sw/source/ui/uiview/view0.cxx +++ b/sw/source/ui/uiview/view0.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,14 +38,14 @@ #include <svx/galbrws.hxx> #include <svx/srchitem.hxx> #include <SwSpellDialogChildWindow.hxx> -#include <svtools/eitem.hxx> -#include <svtools/linguprops.hxx> -#include <svtools/lingucfg.hxx> +#include <svl/eitem.hxx> +#include <unotools/linguprops.hxx> +#include <unotools/lingucfg.hxx> #include <viewopt.hxx> #include <globals.h> #include <sfx2/app.hxx> #include <sfx2/request.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <svx/srchdlg.hxx> #include <sfx2/templdlg.hxx> #include <uivwimp.hxx> @@ -99,7 +99,7 @@ using namespace ::com::sun::star; using ::rtl::OUString; -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #include <IDocumentSettingAccess.hxx> @@ -275,7 +275,7 @@ void SwView::StateViewOptions(SfxItemSet &rSet) aBool.SetValue( SwViewOption::IsTableBoundaries() ); break; case FN_VIEW_NOTES: { - aBool.SetValue( pOpt->IsPostIts()); + aBool.SetValue( pOpt->IsPostIts()); if (!GetPostItMgr()->HasNotes()) { aBool.SetWhich( nWhich ); @@ -400,7 +400,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq) case FN_VIEW_NOTES: if ( STATE_TOGGLE == eState ) bFlag = !pOpt->IsPostIts(); - + GetPostItMgr()->SetLayout(); pOpt->SetPostIts( bFlag ); if (pOpt->IsPostIts()) @@ -502,7 +502,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq) if (pDoc && bIsAutoGrammar) StartGrammarChecking( *pDoc ); - } + } } break; case FN_SHADOWCURSOR: @@ -537,7 +537,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq) rSh.ResetModified(); pModule->ApplyUsrPref( *pOpt, this, bWebView ? VIEWOPT_DEST_WEB : VIEWOPT_DEST_TEXT ); - + //mod #i6193# let postits know about new spellcheck setting if ( nSlot == SID_AUTOSPELL_CHECK ) GetPostItMgr()->SetSpellChecking(); diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 493daabe92..15338aa201 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -46,8 +46,8 @@ #define _SVSTDARR_STRINGSSORTDTOR -#include <svtools/svstdarr.hxx> -#include <svtools/aeitem.hxx> +#include <svl/svstdarr.hxx> +#include <svl/aeitem.hxx> // #ifndef _FILTER_HXX // #include <svtools/filter.hxx> @@ -59,8 +59,8 @@ #include <undobj.hxx> #include <swundo.hxx> #include <caption.hxx> -#include <svtools/PasswordHelper.hxx> -#include <svtools/urihelper.hxx> +#include <svl/PasswordHelper.hxx> +#include <svl/urihelper.hxx> #include <sfx2/passwd.hxx> #include <sfx2/sfxdlg.hxx> #include <sfx2/filedlghelper.hxx> @@ -91,8 +91,8 @@ #include <svx/sizeitem.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/topfrm.hxx> -#include <svtools/whiter.hxx> -#include <svtools/ptitem.hxx> +#include <svl/whiter.hxx> +#include <svl/ptitem.hxx> #include <svx/linkmgr.hxx> #ifndef __RSC //autogen #include <tools/errinf.hxx> @@ -1624,7 +1624,7 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aCoreSet, RID_SVXDLG_ZOOM); + pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aCoreSet); DBG_ASSERT(pDlg, "Dialogdiet fail!"); } diff --git a/sw/source/ui/uiview/viewcoll.cxx b/sw/source/ui/uiview/viewcoll.cxx index 08647e0b4a..1688c3dfe7 100644 --- a/sw/source/ui/uiview/viewcoll.cxx +++ b/sw/source/ui/uiview/viewcoll.cxx @@ -39,7 +39,7 @@ #include <vcl/window.hxx> #include <sfx2/request.hxx> #include <sfx2/viewfrm.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <rsc/rscsfx.hxx> diff --git a/sw/source/ui/uiview/viewdlg.cxx b/sw/source/ui/uiview/viewdlg.cxx index 01df8db671..8b715474ce 100644 --- a/sw/source/ui/uiview/viewdlg.cxx +++ b/sw/source/ui/uiview/viewdlg.cxx @@ -36,7 +36,7 @@ #include "hintids.hxx" #include <sfx2/viewfrm.hxx> #include <svx/tstpitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <sfx2/request.hxx> diff --git a/sw/source/ui/uiview/viewdraw.cxx b/sw/source/ui/uiview/viewdraw.cxx index 6be34b4953..9ab1df6a91 100644 --- a/sw/source/ui/uiview/viewdraw.cxx +++ b/sw/source/ui/uiview/viewdraw.cxx @@ -33,8 +33,8 @@ #include "hintids.hxx" -#include <svtools/aeitem.hxx> -#include <svtools/itempool.hxx> +#include <svl/aeitem.hxx> +#include <svl/itempool.hxx> #include <svx/svdobj.hxx> #include <svx/svdview.hxx> #include <svx/svdpage.hxx> diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 304457a828..92a6cc8fcb 100644 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -36,7 +36,7 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/linguistic2/XThesaurus.hpp> @@ -47,7 +47,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <vcl/msgbox.hxx> #include <svtools/ehdl.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/request.hxx> #include <svx/dlgutil.hxx> diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index 4f3870c559..60238e1346 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -43,25 +43,25 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <sfx2/request.hxx> #include <sfx2/app.hxx> -#include <svtools/flagitem.hxx> +#include <svl/flagitem.hxx> #include <vcl/msgbox.hxx> #include <svtools/printdlg.hxx> #include <sfx2/printer.hxx> #include <sfx2/prnmon.hxx> #include <svx/paperinf.hxx> #include <sfx2/dispatch.hxx> -#include <svtools/misccfg.hxx> +#include <unotools/misccfg.hxx> #include <svx/prtqry.hxx> #include <svx/svdview.hxx> -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> -#include <svtools/intitem.hxx> -#include <svtools/flagitem.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> +#include <svl/intitem.hxx> +#include <svl/flagitem.hxx> #include <svx/linkmgr.hxx> #include <modcfg.hxx> @@ -85,10 +85,10 @@ #include <globals.hrc> #include <view.hrc> #include <app.hrc> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <swwrtshitem.hxx> #include "swabstdlg.hxx" -#include <svtools/slstitm.hxx> +#include <svl/slstitm.hxx> #include <unomid.h> @@ -252,7 +252,10 @@ ErrCode SwView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilent, QueryBox aBox( &GetEditWin(), SW_RES( DLG_PRT_FIELDNAME ) ); USHORT nRet = aBox.Execute(); if( RET_CANCEL == nRet) + { + delete pProgress; return ERRCODE_IO_ABORT; + } // disable field commands if( RET_NO != nRet ) { @@ -618,17 +621,17 @@ void SetAppPrintOptions( ViewShell* pSh, BOOL bWeb ) SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, 0 ); - SfxMiscCfg* pMisc = SFX_APP()->GetMiscConfig(); + utl::MiscCfg aMisc; if(bWeb) aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(((SwWrtShell*)pSh)->GetView().GetDocShell()))); aSet.Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, - pMisc->IsNotFoundWarning() )); + aMisc.IsNotFoundWarning() )); aSet.Put(aAddPrinterItem); aSet.Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC, - (pMisc->IsPaperSizeWarning() ? SFX_PRINTER_CHG_SIZE : 0) | - (pMisc->IsPaperOrientationWarning() ? SFX_PRINTER_CHG_ORIENTATION : 0 ))); + (aMisc.IsPaperSizeWarning() ? SFX_PRINTER_CHG_SIZE : 0) | + (aMisc.IsPaperOrientationWarning() ? SFX_PRINTER_CHG_ORIENTATION : 0 ))); pIDDA->getPrinter( true )->SetOptions( aSet ); } diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx index 1735041b3d..85c965ee65 100644 --- a/sw/source/ui/uiview/viewsrch.cxx +++ b/sw/source/ui/uiview/viewsrch.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -35,17 +35,17 @@ #include <string> // HACK: prevent conflict between STLPORT and Workshop headers #include <hintids.hxx> #include <com/sun/star/util/SearchOptions.hpp> -#include <svtools/cjkoptions.hxx> -#include <svtools/ctloptions.hxx> +#include <svl/cjkoptions.hxx> +#include <svl/ctloptions.hxx> #include <svx/pageitem.hxx> -#include <svtools/whiter.hxx> +#include <svl/whiter.hxx> #include <sfx2/dispatch.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #ifndef _T2XTCMP_HXX //autogen #include <svtools/txtcmp.hxx> #endif -#include <svtools/itempool.hxx> -#include <svtools/eitem.hxx> +#include <svl/itempool.hxx> +#include <svl/eitem.hxx> #include <svx/srchitem.hxx> #include <sfx2/request.hxx> #include <svx/srchdlg.hxx> @@ -157,7 +157,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) break; case FID_SEARCH_OFF: - if(pArgs) + if(pArgs) { // Dialog abmelden delete pSrchItem; @@ -428,7 +428,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) } break; default: -#ifndef PRODUCT +#ifdef DBG_UTIL if(nSlot) { ByteString sStr( "nSlot: " ); diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx index 9800c1ed63..183498c31c 100644 --- a/sw/source/ui/uiview/viewstat.cxx +++ b/sw/source/ui/uiview/viewstat.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -33,14 +33,14 @@ #include <hintids.hxx> #include <com/sun/star/linguistic2/XThesaurus.hpp> #include <com/sun/star/uno/Sequence.hxx> -#include <svtools/aeitem.hxx> -#include <svtools/whiter.hxx> -#include <svtools/cjkoptions.hxx> +#include <svl/aeitem.hxx> +#include <svl/whiter.hxx> +#include <svl/cjkoptions.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/objitem.hxx> -#include <svtools/imageitm.hxx> -#include <svtools/languageoptions.hxx> +#include <svl/imageitm.hxx> +#include <svl/languageoptions.hxx> #include <svx/protitem.hxx> #include <svx/linkmgr.hxx> #include <svx/langitem.hxx> @@ -67,9 +67,9 @@ #include <wview.hxx> #endif #include <globdoc.hxx> -#include <svtools/stritem.hxx> -#include <svtools/moduleoptions.hxx> -#include <svtools/visitem.hxx> +#include <svl/stritem.hxx> +#include <unotools/moduleoptions.hxx> +#include <svl/visitem.hxx> #ifndef _CMDID_H #include <cmdid.h> @@ -299,7 +299,7 @@ void SwView::GetState(SfxItemSet &rSet) break; case FN_REDLINE_ACCEPT_DIRECT: case FN_REDLINE_REJECT_DIRECT: - { + { SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE ); Point aCrsrPos = pWrtShell->GetCrsrDocPos( sal_True ); if( !pWrtShell->GetContentAtPos( aCrsrPos, aCntntAtPos ) ) diff --git a/sw/source/ui/uiview/viewtab.cxx b/sw/source/ui/uiview/viewtab.cxx index 04ff2c9047..9e4c4060fe 100644 --- a/sw/source/ui/uiview/viewtab.cxx +++ b/sw/source/ui/uiview/viewtab.cxx @@ -44,11 +44,11 @@ #include <svx/ulspitem.hxx> #include <svx/boxitem.hxx> #include <svx/frmdiritem.hxx> -#include <svtools/eitem.hxx> -#include <svtools/whiter.hxx> +#include <svl/eitem.hxx> +#include <svl/whiter.hxx> #include <svx/ruler.hxx> #include <svx/protitem.hxx> -#include <svtools/rectitem.hxx> +#include <svl/rectitem.hxx> #include <sfx2/bindings.hxx> #include <fmtfsize.hxx> #include <fmthdft.hxx> diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx index 60474dff99..a3fbd23474 100644 --- a/sw/source/ui/uno/SwXDocumentSettings.cxx +++ b/sw/source/ui/uno/SwXDocumentSettings.cxx @@ -49,7 +49,7 @@ #include <sfx2/printer.hxx> #include <editsh.hxx> #include <drawdoc.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include <unoobj.hxx> #include <unotxdoc.hxx> #include <cmdid.h> diff --git a/sw/source/ui/uno/dlelstnr.cxx b/sw/source/ui/uno/dlelstnr.cxx index 5453c721c0..d9b4c83795 100644 --- a/sw/source/ui/uno/dlelstnr.cxx +++ b/sw/source/ui/uno/dlelstnr.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,7 +41,7 @@ #include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp> -#include <svtools/lingucfg.hxx> +#include <unotools/lingucfg.hxx> #include <com/sun/star/uno/Reference.h> #include <comphelper/processfactory.hxx> @@ -92,12 +92,12 @@ SwLinguServiceEventListener::SwLinguServiceEventListener() Reference< XLinguServiceEventBroadcaster > xBC( xGCIterator, UNO_QUERY ); if (xBC.is()) xBC->addLinguServiceEventListener( (XLinguServiceEventListener *) this ); - } + } } catch (uno::Exception &) { DBG_ASSERT(0, "exception caught in SwLinguServiceEventListener c-tor" ); - } + } } } /* -----------------------------17.03.00 09:07-------------------------------- diff --git a/sw/source/ui/uno/swdet2.cxx b/sw/source/ui/uno/swdet2.cxx index a385f542a8..4d369d2b7e 100644 --- a/sw/source/ui/uno/swdet2.cxx +++ b/sw/source/ui/uno/swdet2.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -49,7 +49,7 @@ #include <web.hrc> #include <globdoc.hrc> -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #include <unomid.h> diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index c48834b40d..d0fcf366ee 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -53,10 +53,10 @@ #include <ucbhelper/simpleinteractionrequest.hxx> #include <rtl/ustring.h> #include <rtl/logfile.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <vcl/window.hxx> -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> #include <tools/urlobj.hxx> #include <vos/mutex.hxx> #include <svtools/sfxecode.hxx> @@ -72,7 +72,7 @@ #include <sfx2/brokenpackageint.hxx> #include <svx/impgrf.hxx> #include <svtools/FilterConfigItem.hxx> -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #include <com/sun/star/util/XArchiver.hpp> #include <comphelper/ihwrapnofilter.hxx> @@ -298,7 +298,7 @@ SwFilterDetect::~SwFilterDetect() rtl::Reference< ::comphelper::OIHWrapNoFilterDialog > xHandler = new ::comphelper::OIHWrapNoFilterDialog( xInteraction ); if ( nIndexOfInteractionHandler != -1 ) lDescriptor[nIndexOfInteractionHandler].Value <<= uno::Reference< XInteractionHandler >( static_cast< task::XInteractionHandler* >( xHandler.get() ) ); - + aMedium.SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } } diff --git a/sw/source/ui/uno/unoatxt.cxx b/sw/source/ui/uno/unoatxt.cxx index 4801259cd7..df941b500a 100644 --- a/sw/source/ui/uno/unoatxt.cxx +++ b/sw/source/ui/uno/unoatxt.cxx @@ -41,9 +41,9 @@ #include <vos/mutex.hxx> #include <tools/debug.hxx> #include <vcl/svapp.hxx> -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <svtools/unoevent.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <sfx2/event.hxx> #include <swtypes.hxx> #include <glosdoc.hxx> @@ -61,8 +61,8 @@ #include <docsh.hxx> #include <swunodef.hxx> #include <swmodule.hxx> -#include <svtools/smplhint.hxx> -#include <svtools/macitem.hxx> +#include <svl/smplhint.hxx> +#include <svl/macitem.hxx> #include <svx/acorrcfg.hxx> diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index ce1e099e83..fb42b86801 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -35,8 +35,8 @@ #include <vcl/svapp.hxx> #include <vos/mutex.hxx> #include <osl/mutex.hxx> -#include <svtools/itemprop.hxx> -#include <svtools/urihelper.hxx> +#include <svl/itemprop.hxx> +#include <svl/urihelper.hxx> #include <svx/dataaccessdescriptor.hxx> #include <tools/shl.hxx> // GetAppData #include <tools/tempfile.hxx> diff --git a/sw/source/ui/uno/unomod.cxx b/sw/source/ui/uno/unomod.cxx index 2f7716bac1..d5315fbd33 100644 --- a/sw/source/ui/uno/unomod.cxx +++ b/sw/source/ui/uno/unomod.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -576,17 +576,17 @@ void SwXPrintSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, break; case HANDLE_PRINTSET_PROSPECT_RTL: { - rValue <<= mpPrtOpt->IsPrintProspect_RTL(); + bBoolVal = mpPrtOpt->IsPrintProspect_RTL(); } break; case HANDLE_PRINTSET_PLACEHOLDER: { - rValue <<= mpPrtOpt->IsPrintTextPlaceholder(); + bBoolVal = mpPrtOpt->IsPrintTextPlaceholder(); } break; case HANDLE_PRINTSET_HIDDEN_TEXT: { - rValue <<= mpPrtOpt->IsPrintHiddenText(); + bBoolVal = mpPrtOpt->IsPrintHiddenText(); } break; default: @@ -823,7 +823,7 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c break; case HANDLE_VIEWSET_HORI_RULER_METRIC: case HANDLE_VIEWSET_VERT_RULER_METRIC: - { + { sal_Int32 nUnit = -1; if( rValue >>= nUnit ) switch( nUnit ) @@ -844,9 +844,9 @@ void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, c mbApplyVRulerMetric = sal_True; } break; - default: + default: throw IllegalArgumentException(); - } + } } break; default: @@ -862,17 +862,17 @@ void SwXViewSettings::_postSetValues () if(mbApplyZoom ) pView->SetZoom( (SvxZoomType)mpViewOption->GetZoomType(), mpViewOption->GetZoom(), sal_True ); - if(mbApplyHRulerMetric) + if(mbApplyHRulerMetric) pView->ChangeTabMetric((FieldUnit)eHRulerUnit); - if(mbApplyVRulerMetric) + if(mbApplyVRulerMetric) pView->ChangeVLinealMetric((FieldUnit)eVRulerUnit); - + } else { - if(mbApplyHRulerMetric) + if(mbApplyHRulerMetric) SW_MOD()->ApplyRulerMetric( (FieldUnit)eHRulerUnit, sal_True, bWeb ); - if(mbApplyVRulerMetric) + if(mbApplyVRulerMetric) SW_MOD()->ApplyRulerMetric( (FieldUnit)eVRulerUnit, sal_False, bWeb ); } @@ -880,7 +880,7 @@ void SwXViewSettings::_postSetValues () SW_MOD()->ApplyUsrPref( *mpViewOption, pView, pView ? VIEWOPT_DEST_VIEW_ONLY : bWeb ? VIEWOPT_DEST_WEB : VIEWOPT_DEST_TEXT ); - + delete mpViewOption; mpViewOption = NULL; @@ -1004,7 +1004,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u } break; case HANDLE_VIEWSET_HORI_RULER_METRIC: - { + { if ( pView ) { FieldUnit eUnit; @@ -1015,12 +1015,12 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u { const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( bWeb ); rValue <<= (sal_Int32)pUsrPref->GetHScrollMetric(); - } + } bBool = sal_False; } break; case HANDLE_VIEWSET_VERT_RULER_METRIC: - { + { if ( pView ) { FieldUnit eUnit; @@ -1031,7 +1031,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u { const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( bWeb ); rValue <<= (sal_Int32)pUsrPref->GetVScrollMetric(); - } + } bBool = sal_False; } break; diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 1ebfda6d1c..044c5bd78f 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -46,9 +46,9 @@ #include <viewsh.hxx> #include <pvprtdat.hxx> #include <swprtopt.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <unotxdoc.hxx> -#include <svtools/numuno.hxx> +#include <svl/numuno.hxx> #include <unoobj.hxx> #include <unosett.hxx> #include <unocoll.hxx> @@ -61,7 +61,7 @@ #include <unoprnms.hxx> #include <unostyle.hxx> #include <unodraw.hxx> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <pagedesc.hxx> #include <svtools/txtcmp.hxx> #include <unocrsr.hxx> @@ -103,7 +103,7 @@ #include <SwXPrintPreviewSettings.hxx> #include <doc.hxx> #include <svx/forbiddencharacterstable.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include <drawdoc.hxx> #include <SwStyleNameMapper.hxx> #include <osl/file.hxx> @@ -127,7 +127,7 @@ #include <unostyle.hxx> //SwAutoStyleFamily #include <istyleaccess.hxx> // handling of automatic styles -#include <svtools/stylepool.hxx> +#include <svl/stylepool.hxx> #include <swatrset.hxx> //#include <com/sun/star/i18n/ScriptType.hpp> @@ -138,7 +138,7 @@ #include <svx/eeitem.hxx> #include <svx/editeng.hxx> #include <svx/svdoutl.hxx> -#include <svtools/languageoptions.hxx> +#include <svl/languageoptions.hxx> #include <svx/svdview.hxx> // @@ -3506,7 +3506,7 @@ Any lcl_GetDisplayBitmap(String sLinkSuffix) if(USHRT_MAX != nImgId) { nImgId += 20000; - BOOL bHighContrast = Application::GetSettings().GetStyleSettings().GetWindowColor().IsDark(); + BOOL bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); ImageList aEntryImages( SW_RES(bHighContrast ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP) ); const Image& rImage = aEntryImages.GetImage( nImgId ); Bitmap aBitmap( rImage.GetBitmapEx().GetBitmap() ); diff --git a/sw/source/ui/uno/warnpassword.cxx b/sw/source/ui/uno/warnpassword.cxx index 01d27b6360..1af8e77c25 100644 --- a/sw/source/ui/uno/warnpassword.cxx +++ b/sw/source/ui/uno/warnpassword.cxx @@ -33,7 +33,7 @@ // ============================================================================ #include "warnpassword.hxx" #include <com/sun/star/task/XInteractionHandler.hpp> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <sfx2/docfile.hxx> #include <sfx2/sfxsids.hrc> #include <ucbhelper/simpleinteractionrequest.hxx> diff --git a/sw/source/ui/utlui/attrdesc.cxx b/sw/source/ui/utlui/attrdesc.cxx index ae8df6cde9..a25d2c801d 100644 --- a/sw/source/ui/utlui/attrdesc.cxx +++ b/sw/source/ui/utlui/attrdesc.cxx @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #include <vcl/svapp.hxx> #include <svx/itemtype.hxx> #include <goodies/grfmgr.hxx> diff --git a/sw/source/ui/utlui/bookctrl.cxx b/sw/source/ui/utlui/bookctrl.cxx index 99e0849c78..40dc397900 100644 --- a/sw/source/ui/utlui/bookctrl.cxx +++ b/sw/source/ui/utlui/bookctrl.cxx @@ -35,10 +35,10 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/intitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/intitem.hxx> +#include <svl/stritem.hxx> #include <sfx2/dispatch.hxx> #ifndef _EVENT_HXX //autogen #include <vcl/event.hxx> diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index 10a94901f5..c031c4f546 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -33,9 +33,9 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif -#include <svtools/urlbmk.hxx> +#include <svl/urlbmk.hxx> #include <tools/urlobj.hxx> #include <sfx2/docfile.hxx> #include <sfx2/dispatch.hxx> @@ -1354,7 +1354,7 @@ void SwContentTree::Display( sal_Bool bActive ) { if(!bIsImageListInitialized) { - USHORT nResId = GetDisplayBackground().GetColor().IsDark() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP; + USHORT nResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP; aEntryImages = ImageList(SW_RES(nResId)); bIsImageListInitialized = sal_True; } @@ -3257,7 +3257,7 @@ void SwContentTree::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) { - USHORT nResId = GetDisplayBackground().GetColor().IsDark() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP; + USHORT nResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP; aEntryImages = ImageList(SW_RES(nResId)); FindActiveTypeAndRemoveUserData(); Display(sal_True); diff --git a/sw/source/ui/utlui/glbltree.cxx b/sw/source/ui/utlui/glbltree.cxx index 9b504b73a7..546b276a5b 100644 --- a/sw/source/ui/utlui/glbltree.cxx +++ b/sw/source/ui/utlui/glbltree.cxx @@ -33,23 +33,23 @@ #ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> #endif -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <sfx2/fcontnr.hxx> #include <svx/linkmgr.hxx> #include <sfx2/dispatch.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <sfx2/docfile.hxx> #ifndef _HELP_HXX //autogen #include <vcl/help.hxx> #endif #include <sot/filelist.hxx> -#include <svtools/eitem.hxx> -#include <svtools/urlbmk.hxx> +#include <svl/eitem.hxx> +#include <svl/urlbmk.hxx> #include <svtools/filter.hxx> #include <sfx2/docinsert.hxx> #include <sfx2/filedlghelper.hxx> @@ -728,7 +728,7 @@ void SwGlobalTree::Display(BOOL bOnlyUpdateUserData) { if(!bIsImageListInitialized) { - USHORT nResId = GetDisplayBackground().GetColor().IsDark() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP; + USHORT nResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP; aEntryImages = ImageList(SW_RES(nResId)); bIsImageListInitialized = TRUE; } @@ -1396,7 +1396,7 @@ void SwGlobalTree::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) { - USHORT nResId = GetDisplayBackground().GetColor().IsDark() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP; + USHORT nResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP; aEntryImages = ImageList(SW_RES(nResId)); Update(sal_True); } diff --git a/sw/source/ui/utlui/gloslst.cxx b/sw/source/ui/utlui/gloslst.cxx index 3b1f9dd012..ce6143a817 100644 --- a/sw/source/ui/utlui/gloslst.cxx +++ b/sw/source/ui/utlui/gloslst.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite @@ -36,7 +36,7 @@ #define _SVSTDARR_STRINGSDTOR #define _SVSTDARR_STRINGSISORTDTOR #define _SVSTDARR_STRINGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <tools/urlobj.hxx> #include <vcl/dialog.hxx> #include <vcl/msgbox.hxx> @@ -48,9 +48,9 @@ #endif #include <vcl/lstbox.hxx> #ifndef SVTOOLS_FSTATHELPER_HXX -#include <svtools/fstathelper.hxx> +#include <svl/fstathelper.hxx> #endif -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include <unotools/transliterationwrapper.hxx> #include <swtypes.hxx> #include <swmodule.hxx> diff --git a/sw/source/ui/utlui/initui.cxx b/sw/source/ui/utlui/initui.cxx index 9f90efe028..6a2c3f1f30 100644 --- a/sw/source/ui/utlui/initui.cxx +++ b/sw/source/ui/utlui/initui.cxx @@ -54,7 +54,7 @@ #ifndef _DBMGR_HXX #include <dbmgr.hxx> #endif -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #include <unomid.h> @@ -169,6 +169,7 @@ ShellResource::ShellResource() aStrAllPageHeadFoot( SW_RES( STR_ALLPAGE_HEADFOOT ) ), aStrNone( SW_RES( STR_TEMPLATE_NONE )), aFixedStr( SW_RES( STR_FIELD_FIXED )), + sDurationFormat( SW_RES( STR_DURATION_FORMAT )), aTOXIndexName( SW_RES(STR_TOI)), aTOXUserName( SW_RES(STR_TOU)), diff --git a/sw/source/ui/utlui/initui.hrc b/sw/source/ui/utlui/initui.hrc index 571ee01134..cfeb63ebda 100644 --- a/sw/source/ui/utlui/initui.hrc +++ b/sw/source/ui/utlui/initui.hrc @@ -64,5 +64,6 @@ #define STR_PAGEDESC_FOLLOWNAME 27 #define STR_HYPERLINK_CLICK 28 #define STR_GETREFFLD_REFITEMNOTFOUND 29 +#define STR_DURATION_FORMAT 30 #endif diff --git a/sw/source/ui/utlui/initui.src b/sw/source/ui/utlui/initui.src index 8111f8259b..55f0a496b8 100644 --- a/sw/source/ui/utlui/initui.src +++ b/sw/source/ui/utlui/initui.src @@ -112,6 +112,10 @@ Resource RID_SW_SHELLRES { Text [ en-US ] = "(fixed)" ; }; + String STR_DURATION_FORMAT + { + Text [en-US] = " Y: %1 M: %2 D: %3 H: %4 M: %5 S: %6"; + }; String STR_TOI { Text [ en-US ] = "Alphabetical Index" ; diff --git a/sw/source/ui/utlui/navicfg.cxx b/sw/source/ui/utlui/navicfg.cxx index 044e5e6d27..7e5bcd7f92 100644 --- a/sw/source/ui/utlui/navicfg.cxx +++ b/sw/source/ui/utlui/navicfg.cxx @@ -139,3 +139,6 @@ void SwNavigationConfig::Commit() PutProperties(aNames, aValues); } +void SwNavigationConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {} + + diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx index f9989ee273..e42f5205ab 100644 --- a/sw/source/ui/utlui/navipi.cxx +++ b/sw/source/ui/utlui/navipi.cxx @@ -37,10 +37,10 @@ #include <string> // HACK: prevent conflict between STLPORT and Workshop headers #include <tools/list.hxx> -#include <svtools/urlbmk.hxx> -#include <svtools/stritem.hxx> +#include <svl/urlbmk.hxx> +#include <svl/stritem.hxx> #include <svtools/filter.hxx> -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <sot/formats.hxx> #include <sot/filelist.hxx> #include <sfx2/event.hxx> @@ -1034,8 +1034,8 @@ void SwNavigationPI::StateChanged( USHORT nSID, SfxItemState /*eState*/, aContentTree.SetActiveShell(pWrtShell); BOOL bGlobal = IsGlobalDoc(); aContentToolBox.EnableItem(FN_GLOBAL_SWITCH, bGlobal); - if(!bGlobal && IsGlobalMode() || - !IsGlobalMode() && pConfig->IsGlobalActive()) + if( (!bGlobal && IsGlobalMode()) || + (!IsGlobalMode() && pConfig->IsGlobalActive()) ) { ToggleTree(); } @@ -1375,7 +1375,7 @@ void SwNavigationPI::SetRegionDropMode(USHORT nNewMode) else if(nRegionMode == REGION_MODE_EMBEDDED) nDropId = FN_DROP_REGION_COPY; - ImageList& rImgLst = aContentToolBox.GetDisplayBackground().GetColor().IsDark() + ImageList& rImgLst = aContentToolBox.GetSettings().GetStyleSettings().GetHighContrastMode() ? aContentImageListH : aContentImageList; aContentToolBox.SetItemImage( FN_DROP_REGION, @@ -1531,7 +1531,7 @@ void SwNavigationPI::InitImageList() { USHORT k; - ImageList& rImgLst = aContentToolBox.GetDisplayBackground().GetColor().IsDark() ? + ImageList& rImgLst = aContentToolBox.GetSettings().GetStyleSettings().GetHighContrastMode() ? aContentImageListH : aContentImageList; for( k = 0; k < aContentToolBox.GetItemCount(); k++) aContentToolBox.SetItemImage(aContentToolBox.GetItemId(k), diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx index d6ea01d58b..5d5bb06349 100644 --- a/sw/source/ui/utlui/numfmtlb.cxx +++ b/sw/source/ui/utlui/numfmtlb.cxx @@ -40,14 +40,14 @@ #include <i18npool/lang.h> #ifndef _ZFORMAT_HXX //autogen #define _ZFORLIST_DECLARE_TABLE -#include <svtools/zformat.hxx> +#include <svl/zformat.hxx> #endif -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <svx/svxids.hrc> #include <svx/numinf.hxx> #include <vcl/msgbox.hxx> #include <svx/flagsdef.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <docsh.hxx> #include <swtypes.hxx> #include <swmodule.hxx> diff --git a/sw/source/ui/utlui/swrenamexnameddlg.cxx b/sw/source/ui/utlui/swrenamexnameddlg.cxx index 288a51b7bc..e3340c37f0 100644 --- a/sw/source/ui/utlui/swrenamexnameddlg.cxx +++ b/sw/source/ui/utlui/swrenamexnameddlg.cxx @@ -57,7 +57,7 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <comphelper/processfactory.hxx> #include <sfx2/dispatch.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <shellio.hxx> #include <docsh.hxx> #include <view.hxx> diff --git a/sw/source/ui/utlui/tmplctrl.cxx b/sw/source/ui/utlui/tmplctrl.cxx index 0ce43a8858..05cf66e911 100644 --- a/sw/source/ui/utlui/tmplctrl.cxx +++ b/sw/source/ui/utlui/tmplctrl.cxx @@ -34,11 +34,11 @@ // include --------------------------------------------------------------- -#include <svtools/style.hxx> +#include <svl/style.hxx> #ifndef _MENU_HXX //autogen #include <vcl/menu.hxx> #endif -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <sfx2/dispatch.hxx> #ifndef _STATUS_HXX //autogen #include <vcl/status.hxx> diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx index e9dcc6785a..755a07a058 100644 --- a/sw/source/ui/utlui/uitool.cxx +++ b/sw/source/ui/utlui/uitool.cxx @@ -37,9 +37,9 @@ #include <tools/datetime.hxx> #include <vcl/svapp.hxx> #include <unotools/collatorwrapper.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/stritem.hxx> -#include <svtools/syslocale.hxx> +#include <svl/urihelper.hxx> +#include <svl/stritem.hxx> +#include <unotools/syslocale.hxx> #include <sfx2/app.hxx> #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> @@ -51,7 +51,7 @@ #include <svx/sizeitem.hxx> #include <svx/pageitem.hxx> #include <svx/lrspitem.hxx> -#include <svtools/style.hxx> +#include <svl/style.hxx> #ifndef _VCL_LSTBOX_HXX //autogen #include <vcl/lstbox.hxx> #endif diff --git a/sw/source/ui/utlui/unotools.cxx b/sw/source/ui/utlui/unotools.cxx index 1b23e3560e..324768ab7d 100644 --- a/sw/source/ui/utlui/unotools.cxx +++ b/sw/source/ui/utlui/unotools.cxx @@ -53,7 +53,7 @@ #include <com/sun/star/frame/XLayoutManager.hpp> #include <comphelper/processfactory.hxx> #include <sfx2/dispatch.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <shellio.hxx> #include <docsh.hxx> #include <view.hxx> diff --git a/sw/source/ui/utlui/viewlayoutctrl.cxx b/sw/source/ui/utlui/viewlayoutctrl.cxx index 5825200ebf..23478588f5 100644 --- a/sw/source/ui/utlui/viewlayoutctrl.cxx +++ b/sw/source/ui/utlui/viewlayoutctrl.cxx @@ -38,7 +38,7 @@ #include <vcl/status.hxx> #endif #include <vcl/image.hxx> -#include <svtools/eitem.hxx> +#include <svl/eitem.hxx> #include <svx/viewlayoutitem.hxx> #ifndef _UTLUI_HRC #include <utlui.hrc> @@ -78,13 +78,13 @@ SwViewLayoutControl::SwViewLayoutControl( USHORT _nSlotId, USHORT _nId, StatusBa { mpImpl->mnState = 0; - const sal_Bool bIsDark = GetStatusBar().GetBackground().GetColor().IsDark(); - mpImpl->maImageSingleColumn = Image( bIsDark ? SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN_HC) : SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN) ); - mpImpl->maImageSingleColumn_Active = Image( bIsDark ? SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE_HC) : SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE) ); - mpImpl->maImageAutomatic = Image( bIsDark ? SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_HC) : SW_RES(IMG_VIEWLAYOUT_AUTOMATIC) ); - mpImpl->maImageAutomatic_Active = Image( bIsDark ? SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE_HC) : SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE) ); - mpImpl->maImageBookMode = Image( bIsDark ? SW_RES(IMG_VIEWLAYOUT_BOOKMODE_HC) : SW_RES(IMG_VIEWLAYOUT_BOOKMODE) ); - mpImpl->maImageBookMode_Active = Image( bIsDark ? SW_RES(IMG_VIEWLAYOUT_BOOKMODE_ACTIVE_HC) : SW_RES(IMG_VIEWLAYOUT_BOOKMODE_ACTIVE) ); + const sal_Bool bHC = GetStatusBar().GetSettings().GetStyleSettings().GetHighContrastMode(); + mpImpl->maImageSingleColumn = Image( bHC ? SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN_HC) : SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN) ); + mpImpl->maImageSingleColumn_Active = Image( bHC ? SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE_HC) : SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE) ); + mpImpl->maImageAutomatic = Image( bHC ? SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_HC) : SW_RES(IMG_VIEWLAYOUT_AUTOMATIC) ); + mpImpl->maImageAutomatic_Active = Image( bHC ? SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE_HC) : SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE) ); + mpImpl->maImageBookMode = Image( bHC ? SW_RES(IMG_VIEWLAYOUT_BOOKMODE_HC) : SW_RES(IMG_VIEWLAYOUT_BOOKMODE) ); + mpImpl->maImageBookMode_Active = Image( bHC ? SW_RES(IMG_VIEWLAYOUT_BOOKMODE_ACTIVE_HC) : SW_RES(IMG_VIEWLAYOUT_BOOKMODE_ACTIVE) ); } // ----------------------------------------------------------------------- diff --git a/sw/source/ui/utlui/zoomctrl.cxx b/sw/source/ui/utlui/zoomctrl.cxx index 26f7a9c2ce..7a49743b46 100644 --- a/sw/source/ui/utlui/zoomctrl.cxx +++ b/sw/source/ui/utlui/zoomctrl.cxx @@ -39,7 +39,7 @@ #include <vcl/status.hxx> #endif #include <sfx2/app.hxx> -#include <svtools/stritem.hxx> +#include <svl/stritem.hxx> #include <svx/zoomitem.hxx> #include "swtypes.hxx" diff --git a/sw/source/ui/vba/makefile.mk b/sw/source/ui/vba/makefile.mk new file mode 100644 index 0000000000..f4c604f5d4 --- /dev/null +++ b/sw/source/ui/vba/makefile.mk @@ -0,0 +1,111 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.6 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=sw +TARGET=vbaswobj +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +DLLPRE = + +.IF "$(ENABLE_VBA)"!="YES" +dummy: + @echo "not building vba..." +.ENDIF + +INCPRE=$(INCCOM)$/$(TARGET) +CDEFS+=-DVBA_OOBUILD_HACK +# ------------------------------------------------------------------ + +SLOFILES= \ + $(SLO)$/vbaglobals.obj \ + $(SLO)$/vbaapplication.obj \ + $(SLO)$/vbadocument.obj \ + $(SLO)$/vbawindow.obj \ + $(SLO)$/vbasystem.obj \ + $(SLO)$/vbarangehelper.obj \ + $(SLO)$/vbarange.obj \ + $(SLO)$/vbabookmark.obj \ + $(SLO)$/vbabookmarks.obj \ + $(SLO)$/vbavariable.obj \ + $(SLO)$/vbavariables.obj \ + $(SLO)$/vbaview.obj \ + $(SLO)$/wordvbahelper.obj \ + $(SLO)$/service.obj \ + $(SLO)$/vbadocumentproperties.obj \ + $(SLO)$/vbapane.obj \ + $(SLO)$/vbapanes.obj \ + $(SLO)$/vbaoptions.obj \ + $(SLO)$/vbaselection.obj \ + $(SLO)$/vbatemplate.obj \ + $(SLO)$/vbaparagraphformat.obj \ + $(SLO)$/vbaautotextentry.obj \ + $(SLO)$/vbaparagraph.obj \ + $(SLO)$/vbafind.obj \ + $(SLO)$/vbareplacement.obj \ + $(SLO)$/vbastyle.obj \ + $(SLO)$/vbastyles.obj \ + $(SLO)$/vbafont.obj \ + $(SLO)$/vbapalette.obj \ + $(SLO)$/vbainformationhelper.obj \ + $(SLO)$/vbatable.obj \ + $(SLO)$/vbatables.obj \ + $(SLO)$/vbafield.obj \ + $(SLO)$/vbaborders.obj \ + $(SLO)$/vbadocuments.obj \ + $(SLO)$/vbaheaderfooter.obj \ + $(SLO)$/vbaheaderfooterhelper.obj \ + $(SLO)$/vbaaddin.obj \ + $(SLO)$/vbaaddins.obj \ + $(SLO)$/vbadialogs.obj \ + $(SLO)$/vbadialog.obj \ + $(SLO)$/vbawrapformat.obj \ + $(SLO)$/vbapagesetup.obj \ + $(SLO)$/vbasection.obj \ + $(SLO)$/vbasections.obj \ + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +ALLTAR : \ + $(MISC)$/$(TARGET).don \ + +$(SLOFILES) : $(MISC)$/$(TARGET).don + +$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb + +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@ + echo $@ + diff --git a/sw/source/ui/vba/service.cxx b/sw/source/ui/vba/service.cxx new file mode 100644 index 0000000000..84f82ca825 --- /dev/null +++ b/sw/source/ui/vba/service.cxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: service.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "cppuhelper/implementationentry.hxx" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/registry/XRegistryKey.hpp" +#include "comphelper/servicedecl.hxx" + +// ============================================================================= +// component exports +// ============================================================================= +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +namespace sdecl = comphelper::service_decl; + +namespace globals +{ +extern sdecl::ServiceDecl const serviceDecl; +} + +namespace document +{ +extern sdecl::ServiceDecl const serviceDecl; +} + +namespace wrapformat +{ +extern sdecl::ServiceDecl const serviceDecl; +} + +extern "C" +{ + void SAL_CALL component_getImplementationEnvironment( + const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) + { + OSL_TRACE("In component_getImplementationEnv"); + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; + } + + sal_Bool SAL_CALL component_writeInfo( + lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey ) + { + OSL_TRACE("In component_writeInfo"); + + // Component registration + return component_writeInfoHelper( pServiceManager, pRegistryKey, + globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl ); + } + + void * SAL_CALL component_getFactory( + const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager, + registry::XRegistryKey * pRegistryKey ) + { + OSL_TRACE("In component_getFactory for %s", pImplName ); + void* pRet = component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl ); + OSL_TRACE("Ret is 0x%x", pRet); + return pRet; + } +} diff --git a/sw/source/ui/vba/vbaaddin.cxx b/sw/source/ui/vba/vbaaddin.cxx new file mode 100644 index 0000000000..745523ae93 --- /dev/null +++ b/sw/source/ui/vba/vbaaddin.cxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaaddin.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include <tools/urlobj.hxx> +#include <osl/file.hxx> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaAddin::SwVbaAddin( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const rtl::OUString& rFileURL, sal_Bool bAutoload ) throw ( uno::RuntimeException ) : + SwVbaAddin_BASE( rParent, rContext ), msFileURL( rFileURL ), mbAutoload( bAutoload ), mbInstalled( bAutoload ) +{ +} + +SwVbaAddin::~SwVbaAddin() +{ +} + +::rtl::OUString SAL_CALL SwVbaAddin::getName() throw (uno::RuntimeException) +{ + rtl::OUString sName; + INetURLObject aURL( msFileURL ); + ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName ); + return sName; +} + +void SAL_CALL +SwVbaAddin::setName( const rtl::OUString& ) throw ( css::uno::RuntimeException ) +{ + throw uno::RuntimeException( rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM(" Fail to set name")), uno::Reference< uno::XInterface >() ); +} + +::rtl::OUString SAL_CALL SwVbaAddin::getPath() throw (uno::RuntimeException) +{ + INetURLObject aURL( msFileURL ); + aURL.CutLastName(); + return aURL.GetURLPath(); +} + +::sal_Bool SAL_CALL SwVbaAddin::getAutoload() throw (uno::RuntimeException) +{ + return mbAutoload; +} + +::sal_Bool SAL_CALL SwVbaAddin::getInstalled() throw (uno::RuntimeException) +{ + return mbInstalled; +} + +void SAL_CALL SwVbaAddin::setInstalled( ::sal_Bool _installed ) throw (uno::RuntimeException) +{ + if( _installed != mbInstalled ) + { + mbInstalled = _installed; + // TODO: should call AutoExec and AutoExit etc. + } +} + +rtl::OUString& +SwVbaAddin::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAddin") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaAddin::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Addin" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbaaddin.hxx b/sw/source/ui/vba/vbaaddin.hxx new file mode 100644 index 0000000000..aa744e628d --- /dev/null +++ b/sw/source/ui/vba/vbaaddin.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_ADDIN_HXX +#define SW_VBA_ADDIN_HXX + +#include <ooo/vba/word/XAddin.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XAddin > SwVbaAddin_BASE; + +class SwVbaAddin : public SwVbaAddin_BASE +{ +private: + rtl::OUString msFileURL; + sal_Bool mbAutoload; + sal_Bool mbInstalled; + +public: + SwVbaAddin( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const rtl::OUString& rFileURL, sal_Bool bAutoload ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaAddin(); + + // Attributes + virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); + virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getAutoload() throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getInstalled() throw (css::uno::RuntimeException); + virtual void SAL_CALL setInstalled( ::sal_Bool _installed ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_ADDIN_HXX */ diff --git a/sw/source/ui/vba/vbaaddins.cxx b/sw/source/ui/vba/vbaaddins.cxx new file mode 100644 index 0000000000..351bda2830 --- /dev/null +++ b/sw/source/ui/vba/vbaaddins.cxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaaddins.hxx" +#include "vbaaddin.hxx" +#include <cppuhelper/implbase3.hxx> +#include <unotools/pathoptions.hxx> +#include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +uno::Reference< container::XIndexAccess > lcl_getAddinCollection( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) +{ + XNamedObjectCollectionHelper< word::XAddin >::XNamedVec maAddins; + + // first get the autoload addins in the directory STARTUP + uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference< ucb::XSimpleFileAccess > xSFA( xMCF->createInstanceWithContext( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), xContext), uno::UNO_QUERY_THROW ); + SvtPathOptions aPathOpt; + // FIXME: temporary the STARTUP path is located in $OO/basic3.1/program/addin + String aAddinPath = aPathOpt.GetAddinPath(); + OSL_TRACE("lcl_getAddinCollection: %s", rtl::OUStringToOString( aAddinPath, RTL_TEXTENCODING_UTF8 ).getStr() ); + if( xSFA->isFolder( aAddinPath ) ) + { + uno::Sequence< rtl::OUString > sEntries = xSFA->getFolderContents( aAddinPath, sal_False ); + sal_Int32 nEntry = sEntries.getLength(); + for( sal_Int32 index = 0; index < nEntry; ++index ) + { + rtl::OUString sUrl = sEntries[ index ]; + if( !xSFA->isFolder( sUrl ) && sUrl.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) ) + { + maAddins.push_back( uno::Reference< word::XAddin >( new SwVbaAddin( xParent, xContext, sUrl, sal_True ) ) ); + } + } + } + + // TODO: second get the customize addins in the org.openoffice.Office.Writer/GlobalTemplateList + + uno::Reference< container::XIndexAccess > xAddinsAccess( new XNamedObjectCollectionHelper< word::XAddin >( maAddins ) ); + return xAddinsAccess; +} + +SwVbaAddins::SwVbaAddins( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext ) throw (uno::RuntimeException): SwVbaAddins_BASE( xParent, xContext, lcl_getAddinCollection( xParent,xContext ) ) +{ +} +// XEnumerationAccess +uno::Type +SwVbaAddins::getElementType() throw (uno::RuntimeException) +{ + return word::XAddin::static_type(0); +} +uno::Reference< container::XEnumeration > +SwVbaAddins::createEnumeration() throw (uno::RuntimeException) +{ + uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); + return xEnumerationAccess->createEnumeration(); +} + +uno::Any +SwVbaAddins::createCollectionObject( const css::uno::Any& aSource ) +{ + return aSource; +} + +rtl::OUString& +SwVbaAddins::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAddins") ); + return sImplName; +} + +css::uno::Sequence<rtl::OUString> +SwVbaAddins::getServiceNames() +{ + static uno::Sequence< rtl::OUString > sNames; + if ( sNames.getLength() == 0 ) + { + sNames.realloc( 1 ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Addins") ); + } + return sNames; +} diff --git a/sw/source/ui/vba/vbaaddins.hxx b/sw/source/ui/vba/vbaaddins.hxx new file mode 100644 index 0000000000..dfab837bed --- /dev/null +++ b/sw/source/ui/vba/vbaaddins.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_ADDINS_HXX +#define SW_VBA_ADDINS_HXX + +#include <vbahelper/vbacollectionimpl.hxx> +#include <ooo/vba/word/XAddins.hpp> +#include <vbahelper/vbahelperinterface.hxx> + +typedef CollTestImplHelper< ooo::vba::word::XAddins > SwVbaAddins_BASE; + +class SwVbaAddins : public SwVbaAddins_BASE +{ +public: + SwVbaAddins( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext ) throw (css::uno::RuntimeException); + virtual ~SwVbaAddins() {} + + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + + // SwVbaAddins_BASE + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif /* SW_VBA_ADDINS_HXX */ diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx new file mode 100644 index 0000000000..243acca522 --- /dev/null +++ b/sw/source/ui/vba/vbaapplication.cxx @@ -0,0 +1,206 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbaapplication.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <stdio.h> +#include "vbaapplication.hxx" +#include "vbadocument.hxx" +#include <osl/file.hxx> +#include <vbahelper/vbahelper.hxx> +#include "vbawindow.hxx" +#include "vbasystem.hxx" +#include "vbaoptions.hxx" +#include "vbaselection.hxx" +#include "vbadocuments.hxx" +#include "vbaaddins.hxx" +#include "vbadialogs.hxx" +#include <ooo/vba/word/WdEnableCancelKey.hpp> +#include <svx/acorrcfg.hxx> +#include "wordvbahelper.hxx" +#include <docsh.hxx> + +using namespace ::ooo; +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_QUERY; +using ::rtl::OUString; + +// Enable our own join detection for Intersection and Union +// should be more efficient than using ScRangeList::Join ( because +// we already are testing the same things ) + +#define OWN_JOIN 1 + +// #TODO is this defined somewhere else? +#if ( defined UNX ) || ( defined OS2 ) //unix +#define FILE_PATH_SEPERATOR "/" +#else // windows +#define FILE_PATH_SEPERATOR "\\" +#endif + +#define EXCELVERSION "11.0" + +uno::Any sbxToUnoValue( SbxVariable* pVar ); + +SwVbaApplication::SwVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): SwVbaApplication_BASE( xContext ) +{ +} + +SwVbaApplication::~SwVbaApplication() +{ +} + +SfxObjectShell* SwVbaApplication::GetDocShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) +{ + return static_cast< SfxObjectShell* >( word::getDocShell( xModel ) ); +} + +rtl::OUString SAL_CALL +SwVbaApplication::getName() throw (uno::RuntimeException) +{ + static rtl::OUString appName( RTL_CONSTASCII_USTRINGPARAM("Microsoft Word" ) ); + return appName; +} + +uno::Reference< word::XDocument > SAL_CALL +SwVbaApplication::getActiveDocument() throw (uno::RuntimeException) +{ + return new SwVbaDocument( this, mxContext, getCurrentDocument() ); +} + +uno::Reference< word::XWindow > SAL_CALL +SwVbaApplication::getActiveWindow() throw (uno::RuntimeException) +{ + // #FIXME sofar can't determine Parent + return new SwVbaWindow( uno::Reference< XHelperInterface >(), mxContext, getCurrentDocument() ); +} + +uno::Reference<word::XSystem > SAL_CALL +SwVbaApplication::getSystem() throw (uno::RuntimeException) +{ + return uno::Reference< word::XSystem >( new SwVbaSystem( mxContext ) ); +} + +uno::Reference<word::XOptions > SAL_CALL +SwVbaApplication::getOptions() throw (uno::RuntimeException) +{ + return uno::Reference< word::XOptions >( new SwVbaOptions( mxContext ) ); +} + +uno::Any SAL_CALL +SwVbaApplication::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException) +{ + return VbaApplicationBase::CommandBars( aIndex ); +} + +uno::Reference< word::XSelection > SAL_CALL +SwVbaApplication::getSelection() throw (uno::RuntimeException) +{ + return new SwVbaSelection( this, mxContext, getCurrentDocument() ); +} + +uno::Any SAL_CALL +SwVbaApplication::Documents( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< XCollection > xCol( new SwVbaDocuments( this, mxContext ) ); + if ( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +uno::Any SAL_CALL +SwVbaApplication::Addins( const uno::Any& index ) throw (uno::RuntimeException) +{ + static uno::Reference< XCollection > xCol( new SwVbaAddins( this, mxContext ) ); + if ( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +uno::Any SAL_CALL +SwVbaApplication::Dialogs( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< word::XDialogs > xCol( new SwVbaDialogs( this, mxContext, getCurrentDocument() )); + if ( index.hasValue() ) + return xCol->Item( index ); + return uno::makeAny( xCol ); +} + +sal_Bool SAL_CALL SwVbaApplication::getDisplayAutoCompleteTips() throw (css::uno::RuntimeException) +{ + return SvxAutoCorrCfg::Get()->IsAutoTextTip(); +} + +void SAL_CALL SwVbaApplication::setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException) +{ + SvxAutoCorrCfg::Get()->SetAutoTextTip( _displayAutoCompleteTips ); +} + +sal_Int32 SAL_CALL SwVbaApplication::getEnableCancelKey() throw (css::uno::RuntimeException) +{ + // the default value is wdCancelInterrupt in Word + return word::WdEnableCancelKey::wdCancelInterrupt; +} + +void SAL_CALL SwVbaApplication::setEnableCancelKey( sal_Int32/* _enableCancelKey */) throw (css::uno::RuntimeException) +{ + // seems not supported in Writer +} + +float SAL_CALL SwVbaApplication::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException) +{ + return VbaApplicationBase::CentimetersToPoints( _Centimeters ); +} + +uno::Reference< frame::XModel > +SwVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException) +{ + return getCurrentWordDoc( mxContext ); +} + +rtl::OUString& +SwVbaApplication::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaApplication") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaApplication::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Application" ) ); + } + return aServiceNames; +} diff --git a/sw/source/ui/vba/vbaapplication.hxx b/sw/source/ui/vba/vbaapplication.hxx new file mode 100644 index 0000000000..7d57680170 --- /dev/null +++ b/sw/source/ui/vba/vbaapplication.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbaapplication.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_APPLICATION_HXX +#define SW_VBA_APPLICATION_HXX + +#include <ooo/vba/word/XApplication.hpp> +#include <ooo/vba/word/XDocument.hpp> +#include <ooo/vba/word/XWindow.hpp> +#include <ooo/vba/word/XSystem.hpp> +#include <ooo/vba/word/XOptions.hpp> +#include <ooo/vba/word/XSelection.hpp> +#include <ooo/vba/word/XAddins.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <vbahelper/vbaapplicationbase.hxx> +#include <cppuhelper/implbase1.hxx> + +//typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XApplication > SwVbaApplication_BASE; +typedef cppu::ImplInheritanceHelper1< VbaApplicationBase, ooo::vba::word::XApplication > SwVbaApplication_BASE; + +class SwVbaApplication : public SwVbaApplication_BASE +{ +public: + SwVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext ); + virtual ~SwVbaApplication(); + + virtual SfxObjectShell* GetDocShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException); + + // XApplication + virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::word::XDocument > SAL_CALL getActiveDocument() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::word::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getDisplayAutoCompleteTips() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getEnableCancelKey() throw (css::uno::RuntimeException); + virtual void SAL_CALL setEnableCancelKey( sal_Int32 _enableCancelKey ) throw (css::uno::RuntimeException); + virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +protected: + virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException); +}; +#endif /* SW_VBA_APPLICATION_HXX */ diff --git a/sw/source/ui/vba/vbaautotextentry.cxx b/sw/source/ui/vba/vbaautotextentry.cxx new file mode 100644 index 0000000000..46cf12c18d --- /dev/null +++ b/sw/source/ui/vba/vbaautotextentry.cxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaautotextentry.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include "vbarange.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaAutoTextEntry::SwVbaAutoTextEntry( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XAutoTextEntry >& xEntry ) throw ( uno::RuntimeException ) : + SwVbaAutoTextEntry_BASE( rParent, rContext ), mxEntry( xEntry ) +{ +} + +SwVbaAutoTextEntry::~SwVbaAutoTextEntry() +{ +} + +uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::Reference< word::XRange >& _where, const uno::Any& /*_richtext*/ ) throw ( uno::RuntimeException ) +{ + SwVbaRange* pWhere = dynamic_cast<SwVbaRange*>( _where.get() ); + if( pWhere ) + { + uno::Reference< text::XTextRange > xTextRange = pWhere->getXTextRange(); + xTextRange->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) ); // set marker + uno::Reference< text::XTextRange > xEndMarker = xTextRange->getEnd(); + xEndMarker->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) ); // set marker + uno::Reference< text::XText > xText = pWhere->getXText(); + mxEntry->applyTo( xEndMarker->getStart() ); + uno::Reference< text::XTextCursor > xTC = xText->createTextCursorByRange( xTextRange->getStart() ); + xTC->goRight( 1, sal_True ); + xTC->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker + xEndMarker->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker + xTC->gotoRange( xEndMarker, sal_True ); + pWhere->setXTextCursor( xTC ); + } + return uno::Reference< word::XRange >( pWhere ); +} + +rtl::OUString& +SwVbaAutoTextEntry::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAutoTextEntry") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaAutoTextEntry::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.AutoTextEntry" ) ); + } + return aServiceNames; +} + + +SwVbaAutoTextEntries::SwVbaAutoTextEntries( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : SwVbaAutoTextEntries_BASE( xParent, xContext, xIndexAccess ), mxAutoTextEntryAccess( xIndexAccess ) +{ +} + +// XEnumerationAccess +uno::Type +SwVbaAutoTextEntries::getElementType() throw (uno::RuntimeException) +{ + return word::XAutoTextEntry::static_type(0); +} +uno::Reference< container::XEnumeration > +SwVbaAutoTextEntries::createEnumeration() throw (uno::RuntimeException) +{ + uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); + return xEnumerationAccess->createEnumeration(); +} + +uno::Any +SwVbaAutoTextEntries::createCollectionObject( const css::uno::Any& aSource ) +{ + uno::Reference< text::XAutoTextEntry > xEntry( aSource, uno::UNO_QUERY_THROW ); + return uno::makeAny( uno::Reference< word::XAutoTextEntry >( new SwVbaAutoTextEntry( this, mxContext, xEntry ) ) ); +} + +rtl::OUString& +SwVbaAutoTextEntries::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAutoTextEntries") ); + return sImplName; +} + +css::uno::Sequence<rtl::OUString> +SwVbaAutoTextEntries::getServiceNames() +{ + static uno::Sequence< rtl::OUString > sNames; + if ( sNames.getLength() == 0 ) + { + sNames.realloc( 1 ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.AutoTextEntries") ); + } + return sNames; +} diff --git a/sw/source/ui/vba/vbaautotextentry.hxx b/sw/source/ui/vba/vbaautotextentry.hxx new file mode 100644 index 0000000000..5dc9cc321b --- /dev/null +++ b/sw/source/ui/vba/vbaautotextentry.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_AUTOTEXTENTRY_HXX +#define SW_VBA_AUTOTEXTENTRY_HXX + +#include <vbahelper/vbacollectionimpl.hxx> +#include <ooo/vba/word/XAutoTextEntries.hpp> +#include <ooo/vba/word/XAutoTextEntry.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/word/XRange.hpp> +#include <com/sun/star/text/XAutoTextEntry.hpp> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XAutoTextEntry > SwVbaAutoTextEntry_BASE; + +class SwVbaAutoTextEntry : public SwVbaAutoTextEntry_BASE +{ +private: + css::uno::Reference< css::text::XAutoTextEntry > mxEntry; + +public: + SwVbaAutoTextEntry( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XAutoTextEntry >& xEntry ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaAutoTextEntry(); + + // XAutoTextEntry + virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL Insert( const css::uno::Reference< ooo::vba::word::XRange >& _where, const css::uno::Any& _richtext ) throw ( css::uno::RuntimeException ); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + + +/* class SwVbaAutoTextEntries */ +typedef CollTestImplHelper< ooo::vba::word::XAutoTextEntries > SwVbaAutoTextEntries_BASE; + +class SwVbaAutoTextEntries : public SwVbaAutoTextEntries_BASE +{ +private: + css::uno::Reference< css::container::XIndexAccess > mxAutoTextEntryAccess; + +public: + SwVbaAutoTextEntries( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw (css::uno::RuntimeException); + virtual ~SwVbaAutoTextEntries() {} + + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + + // SwVbaAutoTextEntries_BASE + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif /* SW_VBA_AUTOTEXTENTRY_HXX */ diff --git a/sw/source/ui/vba/vbabookmark.cxx b/sw/source/ui/vba/vbabookmark.cxx new file mode 100644 index 0000000000..c7328f4664 --- /dev/null +++ b/sw/source/ui/vba/vbabookmark.cxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbabookmark.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XTextContent.hpp> +#include <com/sun/star/text/XTextViewCursor.hpp> +#include <com/sun/star/text/XTextViewCursorSupplier.hpp> +#include "vbarange.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaBookmark::SwVbaBookmark( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, + const css::uno::Reference< frame::XModel >& rModel, const rtl::OUString& rName ) throw ( css::uno::RuntimeException ) : + SwVbaBookmark_BASE( rParent, rContext ), mxModel( rModel ), maName( rName ), mbValid( sal_True ) +{ + uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( mxModel, uno::UNO_QUERY_THROW ); + mxBookmark.set( xBookmarksSupplier->getBookmarks()->getByName( maName ), uno::UNO_QUERY_THROW ); +} + +SwVbaBookmark::~SwVbaBookmark() +{ +} + +void SwVbaBookmark::checkVality() throw ( uno::RuntimeException ) +{ + if( !mbValid ) + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The bookmark is not valid" ) ), uno::Reference< uno::XInterface >() ); +} + +void SAL_CALL SwVbaBookmark::Delete() throw ( uno::RuntimeException ) +{ + checkVality(); + uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW ); + xTextDocument->getText()->removeTextContent( mxBookmark ); + mbValid = sal_False; +} + +void SAL_CALL SwVbaBookmark::Select() throw ( uno::RuntimeException ) +{ + checkVality(); + uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( mxModel->getCurrentController(), uno::UNO_QUERY_THROW ); + xViewCursorSupplier->getViewCursor()->gotoRange( mxBookmark->getAnchor(),sal_False ); +} + +rtl::OUString SAL_CALL SwVbaBookmark::getName() throw ( uno::RuntimeException ) +{ + return maName; +} + +void SAL_CALL SwVbaBookmark::setName( const rtl::OUString& _name ) throw ( uno::RuntimeException ) +{ + uno::Reference< container::XNamed > xNamed( mxBookmark, uno::UNO_QUERY_THROW ); + xNamed->setName( _name ); +} + +uno::Any SAL_CALL SwVbaBookmark::Range() throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextContent > xTextContent( mxBookmark, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextRange > xTextRange( xTextContent->getAnchor(), uno::UNO_QUERY_THROW ); + return uno::makeAny( uno::Reference< word::XRange>( new SwVbaRange( this, mxContext, xTextDocument, xTextRange->getStart(), xTextRange->getEnd(), xTextRange->getText() ) ) ); +} + +rtl::OUString& +SwVbaBookmark::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBookmark") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaBookmark::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Bookmark" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbabookmark.hxx b/sw/source/ui/vba/vbabookmark.hxx new file mode 100644 index 0000000000..00d8d3456d --- /dev/null +++ b/sw/source/ui/vba/vbabookmark.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_BOOKMARK_HXX +#define SW_VBA_BOOKMARK_HXX + +#include <ooo/vba/word/XBookmark.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/text/XBookmarksSupplier.hpp> +#include <com/sun/star/text/XTextContent.hpp> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XBookmark > SwVbaBookmark_BASE; + +class SwVbaBookmark : public SwVbaBookmark_BASE +{ +private: + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::text::XTextContent > mxBookmark; + rtl::OUString maName; + sal_Bool mbValid; + +private: + void checkVality() throw ( css::uno::RuntimeException ); + +public: + SwVbaBookmark( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, + const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaBookmark(); + + // Methods + virtual rtl::OUString SAL_CALL getName() throw ( css::uno::RuntimeException ); + virtual void SAL_CALL setName( const rtl::OUString& ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL Delete() throw ( css::uno::RuntimeException ); + virtual void SAL_CALL Select() throw ( css::uno::RuntimeException ); + virtual css::uno::Any SAL_CALL Range() throw ( css::uno::RuntimeException ); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_BOOKMARK_HXX */ diff --git a/sw/source/ui/vba/vbabookmarks.cxx b/sw/source/ui/vba/vbabookmarks.cxx new file mode 100644 index 0000000000..0b80600ef2 --- /dev/null +++ b/sw/source/ui/vba/vbabookmarks.cxx @@ -0,0 +1,240 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbabookmarks.hxx" +#include "vbabookmark.hxx" +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XTextViewCursor.hpp> +#include <com/sun/star/text/XTextViewCursorSupplier.hpp> +#include <ooo/vba/word/WdBookmarkSortBy.hpp> +#include "vbarange.hxx" +#include "wordvbahelper.hxx" +#include <cppuhelper/implbase2.hxx> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +class BookmarksEnumeration : public EnumerationHelperImpl +{ + uno::Reference< frame::XModel > mxModel; + uno::WeakReference< XHelperInterface > mxParent; +public: + BookmarksEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), mxModel( xModel ), mxParent( xParent ) {} + + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + uno::Reference< container::XNamed > xNamed( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); + rtl::OUString aName = xNamed->getName(); + return uno::makeAny( uno::Reference< word::XBookmark > ( new SwVbaBookmark( mxParent, m_xContext, mxModel, aName ) ) ); + } + +}; + +// Bookmarks use case-insensitive name lookup in MS Word. +typedef ::cppu::WeakImplHelper2< container::XNameAccess, container::XIndexAccess > BookmarkCollectionHelper_BASE; +class BookmarkCollectionHelper : public BookmarkCollectionHelper_BASE +{ +private: + uno::Reference< container::XNameAccess > mxNameAccess; + uno::Reference< container::XIndexAccess > mxIndexAccess; + uno::Any cachePos; +public: + BookmarkCollectionHelper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : mxIndexAccess( xIndexAccess ) + { + mxNameAccess.set( mxIndexAccess, uno::UNO_QUERY_THROW ); + } + // XElementAccess + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return mxIndexAccess->getElementType(); } + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return mxIndexAccess->hasElements(); } + // XNameAcess + virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( !hasByName(aName) ) + throw container::NoSuchElementException(); + return cachePos; + } + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) + { + return mxNameAccess->getElementNames(); + } + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) + { + if( mxNameAccess->hasByName( aName ) ) + { + cachePos = mxNameAccess->getByName( aName ); + return sal_True; + } + else + { + for( sal_Int32 nIndex = 0; nIndex < mxIndexAccess->getCount(); nIndex++ ) + { + uno::Reference< container::XNamed > xNamed( mxIndexAccess->getByIndex( nIndex ), uno::UNO_QUERY_THROW ); + rtl::OUString aBookmarkName = xNamed->getName(); + if( aName.equalsIgnoreAsciiCase( aBookmarkName ) ) + { + cachePos <<= xNamed; + return sal_True; + } + } + } + return sal_False; + } + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) + { + return mxIndexAccess->getCount(); + } + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException ) + { + return mxIndexAccess->getByIndex( Index ); + } +}; + +SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xBookmarks, const uno::Reference< frame::XModel >& xModel ): SwVbaBookmarks_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new BookmarkCollectionHelper( xBookmarks ) ) ), mxModel( xModel ) +{ + mxBookmarksSupplier.set( mxModel, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW ); + // use view cursor to insert bookmark, or it will fail if insert bookmark in table + // mxText = xDocument->getText(); + mxText = word::getXTextViewCursor( mxModel )->getText(); +} +// XEnumerationAccess +uno::Type +SwVbaBookmarks::getElementType() throw (uno::RuntimeException) +{ + return word::XBookmark::static_type(0); +} +uno::Reference< container::XEnumeration > +SwVbaBookmarks::createEnumeration() throw (uno::RuntimeException) +{ + uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); + return new BookmarksEnumeration( getParent(), mxContext,xEnumAccess->createEnumeration(), mxModel ); +} + +uno::Any +SwVbaBookmarks::createCollectionObject( const css::uno::Any& aSource ) +{ + uno::Reference< container::XNamed > xNamed( aSource, uno::UNO_QUERY_THROW ); + rtl::OUString aName = xNamed->getName(); + return uno::makeAny( uno::Reference< word::XBookmark > ( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) ); +} + +void SwVbaBookmarks::removeBookmarkByName( const rtl::OUString& rName ) throw (uno::RuntimeException) +{ + uno::Reference< text::XTextContent > xBookmark( m_xNameAccess->getByName( rName ), uno::UNO_QUERY_THROW ); + mxText->removeTextContent( xBookmark ); +} + +void SwVbaBookmarks::addBookmarkByName( const rtl::OUString& rName, const uno::Reference< text::XTextRange >& rTextRange ) throw (uno::RuntimeException) +{ + uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxModel, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextContent > xBookmark( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Bookmark")) ), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW ); + xNamed->setName( rName ); + mxText->insertTextContent( rTextRange, xBookmark, sal_False ); +} + +uno::Any SAL_CALL +SwVbaBookmarks::Add( const rtl::OUString& rName, const uno::Any& rRange ) throw (uno::RuntimeException) +{ + uno::Reference< text::XTextRange > xTextRange; + uno::Reference< word::XRange > xRange; + if( rRange >>= xRange ) + { + SwVbaRange* pRange = dynamic_cast< SwVbaRange* >( xRange.get() ); + if( pRange ) + xTextRange = pRange->getXTextRange(); + } + else + { + // FIXME: insert the bookmark into current view cursor + xTextRange.set( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW ); + } + + // remove the exist bookmark + // rtl::OUString aName = rName.toAsciiLowerCase(); + rtl::OUString aName = rName; + if( m_xNameAccess->hasByName( aName ) ) + removeBookmarkByName( aName ); + + addBookmarkByName( aName, xTextRange ); + + return uno::makeAny( uno::Reference< word::XBookmark >( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) ); +} + +sal_Int32 SAL_CALL +SwVbaBookmarks::getDefaultSorting() throw (css::uno::RuntimeException) +{ + return word::WdBookmarkSortBy::wdSortByName; +} + +void SAL_CALL +SwVbaBookmarks::setDefaultSorting( sal_Int32/* _type*/ ) throw (css::uno::RuntimeException) +{ + // not support in Writer +} + +sal_Bool SAL_CALL +SwVbaBookmarks::getShowHidden() throw (css::uno::RuntimeException) +{ + return sal_True; +} + +void SAL_CALL +SwVbaBookmarks::setShowHidden( sal_Bool /*_hidden*/ ) throw (css::uno::RuntimeException) +{ + // not support in Writer +} + +sal_Bool SAL_CALL +SwVbaBookmarks::Exists( const rtl::OUString& rName ) throw (css::uno::RuntimeException) +{ + sal_Bool bExist = m_xNameAccess->hasByName( rName ); + return bExist; +} + +rtl::OUString& +SwVbaBookmarks::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBookmarks") ); + return sImplName; +} + +css::uno::Sequence<rtl::OUString> +SwVbaBookmarks::getServiceNames() +{ + static uno::Sequence< rtl::OUString > sNames; + if ( sNames.getLength() == 0 ) + { + sNames.realloc( 1 ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Bookmarks") ); + } + return sNames; +} diff --git a/sw/source/ui/vba/vbabookmarks.hxx b/sw/source/ui/vba/vbabookmarks.hxx new file mode 100644 index 0000000000..cbdafe60d5 --- /dev/null +++ b/sw/source/ui/vba/vbabookmarks.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_BOOKMARKS_HXX +#define SW_VBA_BOOKMARKS_HXX + +#include <vbahelper/vbacollectionimpl.hxx> +#include <ooo/vba/word/XBookmarks.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <com/sun/star/text/XBookmarksSupplier.hpp> +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/text/XText.hpp> + +typedef CollTestImplHelper< ooo::vba::word::XBookmarks > SwVbaBookmarks_BASE; + +class SwVbaBookmarks : public SwVbaBookmarks_BASE +{ +private: + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::text::XBookmarksSupplier > mxBookmarksSupplier; + css::uno::Reference< css::text::XText > mxText; + +private: + void removeBookmarkByName( const rtl::OUString& rName ) throw (css::uno::RuntimeException); + void addBookmarkByName( const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw (css::uno::RuntimeException); + +public: + SwVbaBookmarks( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xBookmarks, const css::uno::Reference< css::frame::XModel >& xModel ); + virtual ~SwVbaBookmarks() {} + + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + + // SwVbaBookmarks_BASE + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); + + // XBookmarks + virtual sal_Int32 SAL_CALL getDefaultSorting() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDefaultSorting( sal_Int32 _type ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getShowHidden() throw (css::uno::RuntimeException); + virtual void SAL_CALL setShowHidden( sal_Bool _hidden ) throw (css::uno::RuntimeException); + + virtual css::uno::Any SAL_CALL Add( const rtl::OUString& rName, const css::uno::Any& rRange ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL Exists( const rtl::OUString& rName ) throw (css::uno::RuntimeException); +}; + +#endif /* SW_VBA_BOOKMARKS_HXX */ diff --git a/sw/source/ui/vba/vbaborders.cxx b/sw/source/ui/vba/vbaborders.cxx new file mode 100644 index 0000000000..142d86225f --- /dev/null +++ b/sw/source/ui/vba/vbaborders.cxx @@ -0,0 +1,381 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbaborders.cxx,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaborders.hxx" +#include <ooo/vba/word/XBorder.hpp> +#include <ooo/vba/word/WdBorderType.hpp> +#include <ooo/vba/word/WdLineStyle.hpp> +#include <cppuhelper/implbase3.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/table/TableBorder.hpp> +#include <com/sun/star/table/ShadowFormat.hpp> +#include <com/sun/star/table/ShadowLocation.hpp> +#include "vbapalette.hxx" + +using namespace ::com::sun::star; +using namespace ::ooo::vba; + + +typedef ::cppu::WeakImplHelper1<container::XIndexAccess > RangeBorders_Base; +typedef InheritedHelperInterfaceImpl1<word::XBorder > SwVbaBorder_Base; + +// #TODO sort these indexes to match the order in which Word iterates over the +// borders, the enumeration will match the order in this list +static const sal_Int16 supportedIndexTable[] = { word::WdBorderType::wdBorderBottom, word::WdBorderType::wdBorderDiagonalDown, word::WdBorderType::wdBorderDiagonalUp, word::WdBorderType::wdBorderHorizontal, word::WdBorderType::wdBorderLeft, word::WdBorderType::wdBorderRight, word::WdBorderType::wdBorderTop, word::WdBorderType::wdBorderVertical }; + +const static rtl::OUString sTableBorder( RTL_CONSTASCII_USTRINGPARAM("TableBorder") ); + +// Equiv widths in in 1/100 mm +const static sal_Int32 OOLineThin = 35; +const static sal_Int32 OOLineMedium = 88; +const static sal_Int32 OOLineThick = 141; +const static sal_Int32 OOLineHairline = 2; + +class SwVbaBorder : public SwVbaBorder_Base +{ +private: + uno::Reference< beans::XPropertySet > m_xProps; + sal_Int32 m_LineType; + VbaPalette m_Palette; + bool setBorderLine( table::BorderLine& rBorderLine ) + { + table::TableBorder aTableBorder; + m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder; + + switch ( m_LineType ) + { + case word::WdBorderType::wdBorderLeft: + aTableBorder.IsLeftLineValid = sal_True; + aTableBorder.LeftLine= rBorderLine; + break; + case word::WdBorderType::wdBorderTop: + aTableBorder.IsTopLineValid = sal_True; + aTableBorder.TopLine = rBorderLine; + break; + + case word::WdBorderType::wdBorderBottom: + aTableBorder.IsBottomLineValid = sal_True; + aTableBorder.BottomLine = rBorderLine; + break; + case word::WdBorderType::wdBorderRight: + aTableBorder.IsRightLineValid = sal_True; + aTableBorder.RightLine = rBorderLine; + break; + case word::WdBorderType::wdBorderVertical: + aTableBorder.IsVerticalLineValid = sal_True; + aTableBorder.VerticalLine = rBorderLine; + break; + case word::WdBorderType::wdBorderHorizontal: + aTableBorder.IsHorizontalLineValid = sal_True; + aTableBorder.HorizontalLine = rBorderLine; + break; + case word::WdBorderType::wdBorderDiagonalDown: + case word::WdBorderType::wdBorderDiagonalUp: + // #TODO have to ignore at the momement, would be + // nice to investigate what we can do here + break; + default: + return false; + } + m_xProps->setPropertyValue( sTableBorder, uno::makeAny(aTableBorder) ); + return true; + } + + bool getBorderLine( table::BorderLine& rBorderLine ) + { + table::TableBorder aTableBorder; + m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder; + switch ( m_LineType ) + { + case word::WdBorderType::wdBorderLeft: + if ( aTableBorder.IsLeftLineValid ) + rBorderLine = aTableBorder.LeftLine; + break; + case word::WdBorderType::wdBorderTop: + if ( aTableBorder.IsTopLineValid ) + rBorderLine = aTableBorder.TopLine; + break; + case word::WdBorderType::wdBorderBottom: + if ( aTableBorder.IsBottomLineValid ) + rBorderLine = aTableBorder.BottomLine; + break; + case word::WdBorderType::wdBorderRight: + if ( aTableBorder.IsRightLineValid ) + rBorderLine = aTableBorder.RightLine; + break; + case word::WdBorderType::wdBorderVertical: + if ( aTableBorder.IsVerticalLineValid ) + rBorderLine = aTableBorder.VerticalLine; + break; + case word::WdBorderType::wdBorderHorizontal: + if ( aTableBorder.IsHorizontalLineValid ) + rBorderLine = aTableBorder.HorizontalLine; + break; + + case word::WdBorderType::wdBorderDiagonalDown: + case word::WdBorderType::wdBorderDiagonalUp: + // #TODO have to ignore at the momement, would be + // nice to investigate what we can do here + break; + default: + return false; + } + return true; + } + SwVbaBorder(); // no impl +protected: + virtual rtl::OUString& getServiceImplName() + { + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBorder") ); + return sImplName; + } + virtual css::uno::Sequence<rtl::OUString> getServiceNames() + { + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Border" ) ); + } + return aServiceNames; + } +public: + SwVbaBorder( const uno::Reference< beans::XPropertySet > & xProps, const uno::Reference< uno::XComponentContext >& xContext, sal_Int32 lineType, VbaPalette& rPalette) : SwVbaBorder_Base( uno::Reference< XHelperInterface >( xProps, uno::UNO_QUERY ), xContext ), m_xProps( xProps ), m_LineType( lineType ), m_Palette( rPalette ) {} + + uno::Any SAL_CALL getLineStyle() throw (uno::RuntimeException) + { + sal_Int32 nLineStyle = word::WdLineStyle::wdLineStyleNone; + table::BorderLine aBorderLine; + if ( getBorderLine( aBorderLine ) ) + { + if( aBorderLine.InnerLineWidth !=0 && aBorderLine.OuterLineWidth !=0 ) + { + nLineStyle = word::WdLineStyle::wdLineStyleDouble; + } + else if( aBorderLine.InnerLineWidth !=0 || aBorderLine.OuterLineWidth !=0 ) + { + nLineStyle = word::WdLineStyle::wdLineStyleSingle; + } + else + { + nLineStyle = word::WdLineStyle::wdLineStyleNone; + } + } + return uno::makeAny( nLineStyle ); + } + void SAL_CALL setLineStyle( const uno::Any& _linestyle ) throw (uno::RuntimeException) + { + // Urk no choice but to silently ignore we don't support this attribute + // #TODO would be nice to support the word line styles + sal_Int32 nLineStyle = 0; + _linestyle >>= nLineStyle; + table::BorderLine aBorderLine; + if ( getBorderLine( aBorderLine ) ) + { + switch ( nLineStyle ) + { + case word::WdLineStyle::wdLineStyleNone: + { + aBorderLine.InnerLineWidth = 0; + aBorderLine.OuterLineWidth = 0; + break; + } + case word::WdLineStyle::wdLineStyleDashDot: + case word::WdLineStyle::wdLineStyleDashDotDot: + case word::WdLineStyle::wdLineStyleDashDotStroked: + case word::WdLineStyle::wdLineStyleDashLargeGap: + case word::WdLineStyle::wdLineStyleDashSmallGap: + case word::WdLineStyle::wdLineStyleDot: + case word::WdLineStyle::wdLineStyleDouble: + case word::WdLineStyle::wdLineStyleDoubleWavy: + case word::WdLineStyle::wdLineStyleEmboss3D: + case word::WdLineStyle::wdLineStyleEngrave3D: + case word::WdLineStyle::wdLineStyleInset: + case word::WdLineStyle::wdLineStyleOutset: + case word::WdLineStyle::wdLineStyleSingle: + case word::WdLineStyle::wdLineStyleSingleWavy: + case word::WdLineStyle::wdLineStyleThickThinLargeGap: + case word::WdLineStyle::wdLineStyleThickThinMedGap: + case word::WdLineStyle::wdLineStyleThickThinSmallGap: + case word::WdLineStyle::wdLineStyleThinThickLargeGap: + case word::WdLineStyle::wdLineStyleThinThickMedGap: + case word::WdLineStyle::wdLineStyleThinThickSmallGap: + case word::WdLineStyle::wdLineStyleThinThickThinLargeGap: + case word::WdLineStyle::wdLineStyleThinThickThinMedGap: + case word::WdLineStyle::wdLineStyleThinThickThinSmallGap: + case word::WdLineStyle::wdLineStyleTriple: + { + aBorderLine.InnerLineWidth = 0; + aBorderLine.OuterLineWidth = OOLineHairline; + break; + } + default: + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Bad param" ) ), uno::Reference< uno::XInterface >() ); + } + setBorderLine( aBorderLine ); + } + else + throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Method failed" ) ), uno::Reference< uno::XInterface >() ); + } +}; + +class RangeBorders : public RangeBorders_Base +{ +private: + uno::Reference< table::XCellRange > m_xRange; + uno::Reference< uno::XComponentContext > m_xContext; + VbaPalette m_Palette; + sal_Int32 getTableIndex( sal_Int32 nConst ) + { + // hokay return position of the index in the table + sal_Int32 nIndexes = getCount(); + sal_Int32 realIndex = 0; + const sal_Int16* pTableEntry = supportedIndexTable; + for ( ; realIndex < nIndexes; ++realIndex, ++pTableEntry ) + { + if ( *pTableEntry == nConst ) + return realIndex; + } + return getCount(); // error condition + } +public: + RangeBorders( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, VbaPalette& rPalette ) : m_xRange( xRange ), m_xContext( xContext ), m_Palette( rPalette ) + { + } + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) + { + return sizeof( supportedIndexTable ) / sizeof( supportedIndexTable[0] ); + } + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) + { + + sal_Int32 nIndex = getTableIndex( Index ); + if ( nIndex >= 0 && nIndex < getCount() ) + { + uno::Reference< beans::XPropertySet > xProps( m_xRange, uno::UNO_QUERY_THROW ); + return uno::makeAny( uno::Reference< word::XBorder >( new SwVbaBorder( xProps, m_xContext, supportedIndexTable[ nIndex ], m_Palette )) ); + } + throw lang::IndexOutOfBoundsException(); + } + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) + { + return word::XBorder::static_type(0); + } + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) + { + return sal_True; + } +}; + +uno::Reference< container::XIndexAccess > +rangeToBorderIndexAccess( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, VbaPalette& rPalette ) +{ + return new RangeBorders( xRange, xContext, rPalette ); +} + +class RangeBorderEnumWrapper : public EnumerationHelper_BASE +{ + uno::Reference<container::XIndexAccess > m_xIndexAccess; + sal_Int32 nIndex; +public: + RangeBorderEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) + { + return ( nIndex < m_xIndexAccess->getCount() ); + } + + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( nIndex < m_xIndexAccess->getCount() ) + return m_xIndexAccess->getByIndex( nIndex++ ); + throw container::NoSuchElementException(); + } +}; + +// for Table borders +SwVbaBorders::SwVbaBorders( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< table::XCellRange >& xRange, VbaPalette& rPalette ): SwVbaBorders_BASE( xParent, xContext, rangeToBorderIndexAccess( xRange ,xContext, rPalette ) ) +{ + m_xProps.set( xRange, uno::UNO_QUERY_THROW ); +} + +uno::Reference< container::XEnumeration > +SwVbaBorders::createEnumeration() throw (uno::RuntimeException) +{ + return new RangeBorderEnumWrapper( m_xIndexAccess ); +} + +uno::Any +SwVbaBorders::createCollectionObject( const css::uno::Any& aSource ) +{ + return aSource; // its already a Border object +} + +uno::Type +SwVbaBorders::getElementType() throw (uno::RuntimeException) +{ + return word::XBorders::static_type(0); +} + +uno::Any +SwVbaBorders::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeException) +{ + return createCollectionObject( m_xIndexAccess->getByIndex( nIndex ) ); +} + +sal_Bool SAL_CALL SwVbaBorders::getShadow() throw (uno::RuntimeException) +{ + table::ShadowFormat aShadowFormat; + m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowFormat") ) ) >>= aShadowFormat; + return ( aShadowFormat.Location != table::ShadowLocation_NONE ); +} + +void SAL_CALL SwVbaBorders::setShadow( sal_Bool /*_shadow*/ ) throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); +} + +rtl::OUString& +SwVbaBorders::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBorders") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaBorders::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Borders" ) ); + } + return aServiceNames; +} diff --git a/sw/source/ui/vba/vbaborders.hxx b/sw/source/ui/vba/vbaborders.hxx new file mode 100644 index 0000000000..e8897e9c2c --- /dev/null +++ b/sw/source/ui/vba/vbaborders.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbaborders.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_BORDERS_HXX +#define SW_VBA_BORDERS_HXX + +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/word/XBorders.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <vbahelper/vbacollectionimpl.hxx> + +typedef CollTestImplHelper< ov::word::XBorders > SwVbaBorders_BASE; +class VbaPalette; +class SwVbaBorders : public SwVbaBorders_BASE +{ + // XEnumerationAccess + virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException); + css::uno::Reference< css::beans::XPropertySet > m_xProps; +public: + SwVbaBorders( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::table::XCellRange >& xRange, VbaPalette& rPalette ); + virtual ~SwVbaBorders() {} + + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + + // SwVbaCollectionBaseImpl + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + + virtual sal_Bool SAL_CALL getShadow() throw (css::uno::RuntimeException); + virtual void SAL_CALL setShadow( sal_Bool _shadow ) throw (css::uno::RuntimeException); + + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif //SW_VBA_BORDERS_HXX + diff --git a/sw/source/ui/vba/vbadialog.cxx b/sw/source/ui/vba/vbadialog.cxx new file mode 100644 index 0000000000..fee57c54cd --- /dev/null +++ b/sw/source/ui/vba/vbadialog.cxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadialog.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbadialog.hxx" +#include <ooo/vba/word/WdWordDialog.hpp> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +struct WordDialogTable +{ + sal_Int32 wdDialog; + const sal_Char* ooDialog; +}; + +static const WordDialogTable aWordDialogTable[] = +{ + { word::WdWordDialog::wdDialogFileNew, ".uno:NewDoc" }, + { word::WdWordDialog::wdDialogFileOpen, ".uno:Open" }, + { word::WdWordDialog::wdDialogFilePrint, ".uno:Print" }, + { word::WdWordDialog::wdDialogFileSaveAs, ".uno:SaveAs" }, + { 0, 0 } +}; + +rtl::OUString +SwVbaDialog::mapIndexToName( sal_Int32 nIndex ) +{ + for( const WordDialogTable* pTable = aWordDialogTable; pTable != NULL; pTable++ ) + { + if( nIndex == pTable->wdDialog ) + { + return rtl::OUString::createFromAscii( pTable->ooDialog ); + } + } + return rtl::OUString(); +} + +rtl::OUString& +SwVbaDialog::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDialog") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaDialog::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Dialog" ) ); + } + return aServiceNames; +} diff --git a/sw/source/ui/vba/vbadialog.hxx b/sw/source/ui/vba/vbadialog.hxx new file mode 100644 index 0000000000..0a54b1428b --- /dev/null +++ b/sw/source/ui/vba/vbadialog.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadialog.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_DIALOG_HXX +#define SW_VBA_DIALOG_HXX + +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/word/XDialog.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <vbahelper/vbadialogbase.hxx> + +typedef cppu::ImplInheritanceHelper1< VbaDialogBase, ov::word::XDialog > SwVbaDialog_BASE; + +class SwVbaDialog : public SwVbaDialog_BASE +{ +public: + SwVbaDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nIndex ):SwVbaDialog_BASE( xParent, xContext, xModel, nIndex ) {} + virtual ~SwVbaDialog() {} + + // Methods + virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif /* SW_VBA_DIALOG_HXX */ diff --git a/sw/source/ui/vba/vbadialogs.cxx b/sw/source/ui/vba/vbadialogs.cxx new file mode 100644 index 0000000000..0ffdc3a928 --- /dev/null +++ b/sw/source/ui/vba/vbadialogs.cxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadialogs.cxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <ooo/vba/word/XDialog.hpp> +#include "vbadialogs.hxx" +#include "vbadialog.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +uno::Any +SwVbaDialogs::Item( const uno::Any &aItem ) throw (uno::RuntimeException) +{ + sal_Int32 nIndex = 0; + aItem >>= nIndex; + uno::Reference< word::XDialog > aDialog( new SwVbaDialog( uno::Reference< XHelperInterface >( Application(),uno::UNO_QUERY_THROW ), mxContext, m_xModel, nIndex ) ); + return uno::Any( aDialog ); +} + +rtl::OUString& +SwVbaDialogs::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDialogs") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaDialogs::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Dialogs" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbadialogs.hxx b/sw/source/ui/vba/vbadialogs.hxx new file mode 100644 index 0000000000..e680b25c8b --- /dev/null +++ b/sw/source/ui/vba/vbadialogs.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadialogs.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_DIALOGS_HXX +#define SW_VBA_DIALOGS_HXX + +#include <com/sun/star/uno/XComponentContext.hpp> +#include <ooo/vba/word/XDialogs.hpp> +#include <ooo/vba/XCollection.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <vbahelper/vbadialogsbase.hxx> +#include <cppuhelper/implbase1.hxx> + +typedef cppu::ImplInheritanceHelper1< VbaDialogsBase, ov::word::XDialogs > SwVbaDialogs_BASE; + +class SwVbaDialogs : public SwVbaDialogs_BASE +{ +public: + SwVbaDialogs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel ): SwVbaDialogs_BASE( xParent, xContext, xModel ) {} + virtual ~SwVbaDialogs() {} + + // XCollection + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif /* SW_VBA_DIALOGS_HXX */ diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx new file mode 100644 index 0000000000..9f5bd51e5b --- /dev/null +++ b/sw/source/ui/vba/vbadocument.cxx @@ -0,0 +1,384 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadocument.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbadocument.hxx" +#include "vbarange.hxx" +#include "vbarangehelper.hxx" +#include "vbadocumentproperties.hxx" +#include "vbabookmarks.hxx" +#include "vbavariables.hxx" +#include <com/sun/star/text/XBookmarksSupplier.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XDocumentInfoSupplier.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/drawing/XControlShape.hpp> +#include <com/sun/star/drawing/XControlShape.hpp> +#include <com/sun/star/form/XFormsSupplier.hpp> +#include <ooo/vba/XControlProvider.hpp> + +#include <vbahelper/helperdecl.hxx> +#include <wordvbahelper.hxx> +#include <docsh.hxx> +#include "vbatemplate.hxx" +#include "vbaparagraph.hxx" +#include "vbastyles.hxx" +#include "vbatables.hxx" +#include "vbafield.hxx" +#include "vbapagesetup.hxx" +#include "vbasections.hxx" +#include <vbahelper/vbashapes.hxx> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaDocument::SwVbaDocument( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< frame::XModel > xModel ): SwVbaDocument_BASE( xParent, xContext, xModel ) +{ + Initialize(); +} +SwVbaDocument::SwVbaDocument( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) : SwVbaDocument_BASE( aArgs, xContext ) +{ + Initialize(); +} + +SwVbaDocument::~SwVbaDocument() +{ +} + +void SwVbaDocument::Initialize() +{ + mxTextDocument.set( getModel(), uno::UNO_QUERY_THROW ); +} + +uno::Reference< word::XRange > SAL_CALL +SwVbaDocument::getContent() throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextRange > xStart = mxTextDocument->getText()->getStart(); + uno::Reference< text::XTextRange > xEnd; + return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, xStart, xEnd, sal_True ) ); +} + +uno::Reference< word::XRange > SAL_CALL +SwVbaDocument::Range( const uno::Any& rStart, const uno::Any& rEnd ) throw ( uno::RuntimeException ) +{ + if( !rStart.hasValue() && !rEnd.hasValue() ) + return getContent(); + + sal_Int32 nStart = 0; + sal_Int32 nEnd = 0; + rStart >>= nStart; + rEnd >>= nEnd; + nStart--; + nEnd--; + + uno::Reference< text::XTextRange > xStart; + uno::Reference< text::XTextRange > xEnd; + if( nStart != -1 || nEnd != -1 ) + { + if( nStart == -1 ) + xStart = mxTextDocument->getText()->getStart(); + else + xStart = SwVbaRangeHelper::getRangeByPosition( mxTextDocument->getText(), nStart ); + + if( nEnd == -1 ) + xEnd = mxTextDocument->getText()->getEnd(); + else + xEnd = SwVbaRangeHelper::getRangeByPosition( mxTextDocument->getText(), nEnd ); + } + + if( !xStart.is() && !xEnd.is() ) + { + try + { + // FIXME + xStart = mxTextDocument->getText()->getStart(); + xEnd = mxTextDocument->getText()->getEnd(); + } + catch( uno::Exception ) + { + DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString()); + } + } + return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, xStart, xEnd ) ); +} + +uno::Any SAL_CALL +SwVbaDocument::BuiltInDocumentProperties( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< XCollection > xCol( new SwVbaBuiltinDocumentProperties( mxParent, mxContext, getModel() ) ); + if ( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +uno::Any SAL_CALL +SwVbaDocument::CustomDocumentProperties( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< XCollection > xCol( new SwVbaCustomDocumentProperties( mxParent, mxContext, getModel() ) ); + if ( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +uno::Any SAL_CALL +SwVbaDocument::Bookmarks( const uno::Any& rIndex ) throw ( uno::RuntimeException ) +{ + uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( getModel(),uno::UNO_QUERY_THROW ); + uno::Reference<container::XIndexAccess > xBookmarks( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xBookmarksVba( new SwVbaBookmarks( this, mxContext, xBookmarks, getModel() ) ); + if ( rIndex.getValueTypeClass() == uno::TypeClass_VOID ) + return uno::makeAny( xBookmarksVba ); + + return uno::Any( xBookmarksVba->Item( rIndex, uno::Any() ) ); +} + +uno::Any SAL_CALL +SwVbaDocument::Variables( const uno::Any& rIndex ) throw ( uno::RuntimeException ) +{ + uno::Reference< document::XDocumentPropertiesSupplier > xDocumentPropertiesSupplier( getModel(),uno::UNO_QUERY_THROW ); + uno::Reference< document::XDocumentProperties > xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties(); + uno::Reference< beans::XPropertyAccess > xUserDefined( xDocumentProperties->getUserDefinedProperties(), uno::UNO_QUERY_THROW ); + + uno::Reference< XCollection > xVariables( new SwVbaVariables( this, mxContext, xUserDefined ) ); + if ( rIndex.getValueTypeClass() == uno::TypeClass_VOID ) + return uno::makeAny( xVariables ); + + return uno::Any( xVariables->Item( rIndex, uno::Any() ) ); +} + +uno::Any SAL_CALL +SwVbaDocument::Paragraphs( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< XCollection > xCol( new SwVbaParagraphs( mxParent, mxContext, mxTextDocument ) ); + if ( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +uno::Any SAL_CALL +SwVbaDocument::Styles( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< XCollection > xCol( new SwVbaStyles( mxParent, mxContext, getModel() ) ); + if ( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +uno::Any SAL_CALL +SwVbaDocument::Fields( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, getModel() ) ); + if ( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +uno::Any SAL_CALL +SwVbaDocument::Shapes( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getModel(), uno::UNO_QUERY_THROW ); + //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); + uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess, xModel ) ); + + if ( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +uno::Any SAL_CALL +SwVbaDocument::Sections( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< XCollection > xCol( new SwVbaSections( mxParent, mxContext, getModel() ) ); + if ( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +uno::Any SAL_CALL +SwVbaDocument::PageSetup( ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW ); + return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, mxModel, xPageProps ) ) ); +} + +rtl::OUString& +SwVbaDocument::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDocument") ); + return sImplName; +} +uno::Any SAL_CALL +SwVbaDocument::getAttachedTemplate() throw (uno::RuntimeException) +{ + uno::Reference< word::XTemplate > xTemplate; + uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW ); + uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW ); + uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW ); + rtl::OUString sTemplateName = xDocProps->getTemplateName(); + + xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateName ); + return uno::makeAny( xTemplate ); +} + +void SAL_CALL +SwVbaDocument::setAttachedTemplate( const css::uno::Any& /*_attachedtemplate*/ ) throw (uno::RuntimeException) +{ + throw uno::RuntimeException(); +} + +uno::Any SAL_CALL +SwVbaDocument::Tables( const css::uno::Any& aIndex ) throw (uno::RuntimeException) +{ + uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xColl( new SwVbaTables( mxParent, mxContext, xModel ) ); + + if ( aIndex.hasValue() ) + return xColl->Item( aIndex, uno::Any() ); + return uno::makeAny( xColl ); +} + +void SAL_CALL SwVbaDocument::Activate() throw (uno::RuntimeException) +{ + VbaDocumentBase::Activate(); +} + +uno::Any +SwVbaDocument::getControlShape( const ::rtl::OUString& sName ) +{ + uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); + + sal_Int32 nCount = xIndexAccess->getCount(); + for( int index = 0; index < nCount; index++ ) + { + uno::Any aUnoObj = xIndexAccess->getByIndex( index ); + // It seems there are some drawing objects that can not query into Control shapes? + uno::Reference< drawing::XControlShape > xControlShape( aUnoObj, uno::UNO_QUERY ); + if( xControlShape.is() ) + { + uno::Reference< container::XNamed > xNamed( xControlShape->getControl(), uno::UNO_QUERY_THROW ); + if( sName.equals( xNamed->getName() )) + { + return aUnoObj; + } + } + } + return uno::Any(); +} + +uno::Reference< beans::XIntrospectionAccess > SAL_CALL +SwVbaDocument::getIntrospection( ) throw (uno::RuntimeException) +{ + return uno::Reference< beans::XIntrospectionAccess >(); +} + +uno::Any SAL_CALL +SwVbaDocument::invoke( const ::rtl::OUString& aFunctionName, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ ) throw (lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) +{ + OSL_TRACE("** SwVbaDocument::invoke( %s ), will barf", + rtl::OUStringToOString( aFunctionName, RTL_TEXTENCODING_UTF8 ).getStr() ); + + throw uno::RuntimeException(); // unsupported operation +} + +void SAL_CALL +SwVbaDocument::setValue( const ::rtl::OUString& /*aPropertyName*/, const uno::Any& /*aValue*/ ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) +{ + throw uno::RuntimeException(); // unsupported operation +} +uno::Any SAL_CALL +SwVbaDocument::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException) +{ + uno::Reference< drawing::XControlShape > xControlShape( getControlShape( aPropertyName ), uno::UNO_QUERY_THROW ); + + uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); + uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), mxContext ), uno::UNO_QUERY_THROW ); + uno::Reference< msforms::XControl > xControl( xControlProvider->createControl( xControlShape, getModel() ) ); + return uno::makeAny( xControl ); +} + +::sal_Bool SAL_CALL +SwVbaDocument::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::RuntimeException) +{ + return sal_False; +} + +::sal_Bool SAL_CALL +SwVbaDocument::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException) +{ + uno::Reference< container::XNameAccess > xFormControls( getFormControls() ); + if ( xFormControls.is() ) + return xFormControls->hasByName( aName ); + return sal_False; +} + +uno::Reference< container::XNameAccess > +SwVbaDocument::getFormControls() +{ + uno::Reference< container::XNameAccess > xFormControls; + try + { + uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY_THROW ); + uno::Reference< form::XFormsSupplier > xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY_THROW ); + // get the www-standard container ( maybe we should access the + // 'www-standard' by name rather than index, this seems an + // implementation detail + xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW ); + } + catch( uno::Exception& ) + { + } + return xFormControls; +} + +uno::Sequence< rtl::OUString > +SwVbaDocument::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Document" ) ); + } + return aServiceNames; +} + +namespace document +{ +namespace sdecl = comphelper::service_decl; +sdecl::vba_service_class_<SwVbaDocument, sdecl::with_args<true> > serviceImpl; +extern sdecl::ServiceDecl const serviceDecl( + serviceImpl, + "SwVbaDocument", + "ooo.vba.word.Document" ); +} + diff --git a/sw/source/ui/vba/vbadocument.hxx b/sw/source/ui/vba/vbadocument.hxx new file mode 100644 index 0000000000..a0e3971b67 --- /dev/null +++ b/sw/source/ui/vba/vbadocument.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadocument.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_DOCUMENT_HXX +#define SW_VBA_DOCUMENT_HXX + +#include <ooo/vba/word/XDocument.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <vbahelper/vbadocumentbase.hxx> +#include <com/sun/star/text/XTextDocument.hpp> + +typedef cppu::ImplInheritanceHelper1< VbaDocumentBase, ooo::vba::word::XDocument > SwVbaDocument_BASE; + +class SwVbaDocument : public SwVbaDocument_BASE +{ +private: + css::uno::Reference< css::text::XTextDocument > mxTextDocument; + + void Initialize(); + css::uno::Any getControlShape( const rtl::OUString& sName ); + css::uno::Reference< css::container::XNameAccess > getFormControls(); + +public: + SwVbaDocument( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& m_xContext, css::uno::Reference< css::frame::XModel > xModel ); + SwVbaDocument( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ); + virtual ~SwVbaDocument(); + + // XDocument + virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getContent() throw ( css::uno::RuntimeException ); + virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL Range( const css::uno::Any& rStart, const css::uno::Any& rEnd ) throw ( css::uno::RuntimeException ); + virtual css::uno::Any SAL_CALL BuiltInDocumentProperties( const css::uno::Any& index ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL CustomDocumentProperties( const css::uno::Any& index ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Bookmarks( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException ); + virtual css::uno::Any SAL_CALL Variables( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException ); + virtual css::uno::Any SAL_CALL getAttachedTemplate() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Paragraphs( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException ); + virtual css::uno::Any SAL_CALL Styles( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException ); + virtual css::uno::Any SAL_CALL Tables( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Shapes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Activate() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL PageSetup() throw (css::uno::RuntimeException); + // XInvocation + virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); + virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_DOCUMENT_HXX */ diff --git a/sw/source/ui/vba/vbadocumentproperties.cxx b/sw/source/ui/vba/vbadocumentproperties.cxx new file mode 100644 index 0000000000..0d9d824f1b --- /dev/null +++ b/sw/source/ui/vba/vbadocumentproperties.cxx @@ -0,0 +1,767 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadocument.cxx,v $ + * $Revision: 1.7 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbadocumentproperties.hxx" +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase3.hxx> +#include <com/sun/star/document/XDocumentInfoSupplier.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/beans/XPropertyContainer.hpp> +#include <ooo/vba/word/WdBuiltInProperty.hpp> +#include <ooo/vba/office/MsoDocProperties.hpp> +#include <memory> +#include <boost/shared_ptr.hpp> +#include "wordvbahelper.hxx" +#include "fesh.hxx" +#include "docsh.hxx" +using namespace ::ooo::vba; +using namespace css; + +sal_Int8 lcl_toMSOPropType( const uno::Type& aType ) throw ( lang::IllegalArgumentException ) +{ + sal_Int16 msoType = office::MsoDocProperties::msoPropertyTypeString; + + switch ( aType.getTypeClass() ) + { + case uno::TypeClass_BOOLEAN: + msoType = office::MsoDocProperties::msoPropertyTypeBoolean; + break; + case uno::TypeClass_FLOAT: + msoType = office::MsoDocProperties::msoPropertyTypeFloat; + break; + case uno::TypeClass_STRUCT: // Assume date + msoType = office::MsoDocProperties::msoPropertyTypeDate; + break; + case uno::TypeClass_BYTE: + case uno::TypeClass_SHORT: + case uno::TypeClass_LONG: + case uno::TypeClass_HYPER: + msoType = office::MsoDocProperties::msoPropertyTypeNumber; + break; + default: + throw lang::IllegalArgumentException(); + } + return msoType; +} + +class PropertGetSetHelper +{ +protected: + uno::Reference< frame::XModel > m_xModel; + uno::Reference< beans::XPropertySet > mxProps; +public: + PropertGetSetHelper( const uno::Reference< frame::XModel >& xModel ):m_xModel( xModel ) + { + uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( m_xModel, uno::UNO_QUERY_THROW ); + mxProps.set( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW ); + } + virtual ~PropertGetSetHelper() {} + virtual uno::Any getPropertyValue( const rtl::OUString& rPropName ) = 0; + virtual void setPropertyValue( const rtl::OUString& rPropName, const uno::Any& aValue ) = 0; + virtual uno::Reference< beans::XPropertySet > getUnoProperties() { return mxProps; } + +}; + +class BuiltinPropertyGetSetHelper : public PropertGetSetHelper +{ +public: + BuiltinPropertyGetSetHelper( const uno::Reference< frame::XModel >& xModel ) :PropertGetSetHelper( xModel ) + { + } + virtual uno::Any getPropertyValue( const rtl::OUString& rPropName ) + { + if ( rPropName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("EditingDuration" ) ) ) ) + { + sal_Int32 nSecs = 0; + mxProps->getPropertyValue( rPropName ) >>= nSecs; + return uno::makeAny( nSecs/60 ); // minutes + } + return mxProps->getPropertyValue( rPropName ); + } + virtual void setPropertyValue( const rtl::OUString& rPropName, const uno::Any& aValue ) + { + mxProps->setPropertyValue( rPropName, aValue ); + } +}; + +class CustomPropertyGetSetHelper : public BuiltinPropertyGetSetHelper +{ +public: + CustomPropertyGetSetHelper( const uno::Reference< frame::XModel >& xModel ) :BuiltinPropertyGetSetHelper( xModel ) + { + uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( mxProps, uno::UNO_QUERY_THROW ); + uno::Reference< document::XDocumentProperties > xDocProp( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW ); + mxProps.set( xDocProp->getUserDefinedProperties(), uno::UNO_QUERY_THROW ); + } +}; +class StatisticPropertyGetSetHelper : public PropertGetSetHelper +{ + SwDocShell* mpDocShell; + uno::Reference< beans::XPropertySet > mxModelProps; +public: + StatisticPropertyGetSetHelper( const uno::Reference< frame::XModel >& xModel ) :PropertGetSetHelper( xModel ) , mpDocShell( NULL ) + { + mxModelProps.set( m_xModel, uno::UNO_QUERY_THROW ); + mpDocShell = word::getDocShell( xModel ); + } + virtual uno::Any getPropertyValue( const rtl::OUString& rPropName ) + { + uno::Sequence< beans::NamedValue > stats; + try + { + // Characters, ParagraphCount & WordCount are available from + // the model ( and addtionally these also update the statics object ) + //return mxProps->getPropertyValue( rPropName ); + return mxModelProps->getPropertyValue( rPropName ); + } + catch( uno::Exception& ) + { + OSL_TRACE("Got exception"); + } + uno::Any aReturn; + if ( rPropName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount")) ) ) // special processing needed + { + if ( mpDocShell ) + { + SwFEShell* pFEShell = mpDocShell->GetFEShell(); + if(pFEShell) + { + aReturn <<= pFEShell->GetLineCount(FALSE); + } + } + } + else + { + mxModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphCount") ) ) >>= stats; + mxProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentStatistic") ) ) >>= stats; + + sal_Int32 nLen = stats.getLength(); + bool bFound = false; + for ( sal_Int32 index = 0; index < nLen && !bFound ; ++index ) + { + if ( rPropName.equals( stats[ index ].Name ) ) + { + aReturn = stats[ index ].Value; + bFound = true; + } + } + if ( !bFound ) + throw uno::RuntimeException(); // bad Property + } + return aReturn; + } + + virtual void setPropertyValue( const rtl::OUString& rPropName, const uno::Any& aValue ) + { + + uno::Sequence< beans::NamedValue > stats; + mxProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentStatistic") ) ) >>= stats; + + sal_Int32 nLen = stats.getLength(); + for ( sal_Int32 index = 0; index < nLen; ++index ) + { + if ( rPropName.equals( stats[ index ].Name ) ) + { + stats[ index ].Value = aValue; + mxProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentStatistic") ), uno::makeAny( stats ) ); + break; + } + } + } +}; + +class DocPropInfo +{ +public: + rtl::OUString msMSODesc; + rtl::OUString msOOOPropName; + boost::shared_ptr< PropertGetSetHelper > mpPropGetSetHelper; + + static DocPropInfo createDocPropInfo( const rtl::OUString& sDesc, const rtl::OUString& sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper ) + { + return createDocPropInfo( rtl::OUStringToOString( sDesc, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sPropName, RTL_TEXTENCODING_UTF8 ).getStr(), rHelper ); + } + + static DocPropInfo createDocPropInfo( const sal_Char* sDesc, const sal_Char* sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper ) + { + DocPropInfo aItem; + aItem.msMSODesc = rtl::OUString::createFromAscii( sDesc ); + aItem.msOOOPropName = rtl::OUString::createFromAscii( sPropName ); + aItem.mpPropGetSetHelper = rHelper; + return aItem; + } + uno::Any getValue() + { + if ( mpPropGetSetHelper.get() ) + return mpPropGetSetHelper->getPropertyValue( msOOOPropName ); + return uno::Any(); + } + void setValue( const uno::Any& rValue ) + { + if ( mpPropGetSetHelper.get() ) + mpPropGetSetHelper->setPropertyValue( msOOOPropName, rValue ); + } + uno::Reference< beans::XPropertySet > getUnoProperties() + { + + uno::Reference< beans::XPropertySet > xProps; + if ( mpPropGetSetHelper.get() ) + return mpPropGetSetHelper->getUnoProperties(); + return xProps; + } +}; + + +typedef std::hash_map< sal_Int32, DocPropInfo > MSOIndexToOODocPropInfo; + +class BuiltInIndexHelper +{ + MSOIndexToOODocPropInfo m_docPropInfoMap; + BuiltInIndexHelper(); +public: + BuiltInIndexHelper( const uno::Reference< frame::XModel >& xModel ) + { + boost::shared_ptr< PropertGetSetHelper > aStandardHelper( new BuiltinPropertyGetSetHelper( xModel ) ); + boost::shared_ptr< PropertGetSetHelper > aUsingStatsHelper( new StatisticPropertyGetSetHelper( xModel ) ); + + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTitle ] = DocPropInfo::createDocPropInfo( "Title", "Title", aStandardHelper ); + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySubject ] = DocPropInfo::createDocPropInfo( "Subject", "Subject", aStandardHelper ); + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAuthor ] = DocPropInfo::createDocPropInfo( "Author", "Author", aStandardHelper ); + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyKeywords ] = DocPropInfo::createDocPropInfo( "Keywords", "Keywords", aStandardHelper ); + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyComments ] = DocPropInfo::createDocPropInfo( "Comments", "Description", aStandardHelper ); + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTemplate ] = DocPropInfo::createDocPropInfo( "Template", "Template", aStandardHelper ); + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLastAuthor ] = DocPropInfo::createDocPropInfo( "Last author", "ModifiedBy", aStandardHelper ); // doesn't seem to exist - throw or return nothing ? + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyRevision ] = DocPropInfo::createDocPropInfo( "Revision number", "EditingCycles", aStandardHelper ); // doesn't seem to exist - throw or return nothing ? + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAppName ] = DocPropInfo::createDocPropInfo( "Application name", "Generator", aStandardHelper ); // doesn't seem to exist - throw or return nothing ? + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastPrinted ] = DocPropInfo::createDocPropInfo( "Last print date", "PrintDate", aStandardHelper ); // doesn't seem to exist - throw or return nothing ? + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeCreated ] = DocPropInfo::createDocPropInfo( "Creation date", "CreationDate", aStandardHelper ); + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastSaved ] = DocPropInfo::createDocPropInfo( "Last save time", "ModifyDate", aStandardHelper ); + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyVBATotalEdit ] = DocPropInfo::createDocPropInfo( "Total editing time", "EditingDuration", aStandardHelper ); // Not sure if this is correct + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyPages ] = DocPropInfo::createDocPropInfo( "Number of pages", "PageCount", aUsingStatsHelper ); // special handling required ? + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyWords ] = DocPropInfo::createDocPropInfo( "Number of words", "WordCount", aUsingStatsHelper ); // special handling require ? + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharacters ] = DocPropInfo::createDocPropInfo( "Number of characters", "CharacterCount", aUsingStatsHelper ); // special handling required ? + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySecurity ] = DocPropInfo::createDocPropInfo( "Security", "", aStandardHelper ); // doesn't seem to exist + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCategory ] = DocPropInfo::createDocPropInfo( "Category", "Category", aStandardHelper ); // hacked in + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyFormat ] = DocPropInfo::createDocPropInfo( "Format", "", aStandardHelper ); // doesn't seem to exist + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyManager ] = DocPropInfo::createDocPropInfo( "Manager", "Manager", aStandardHelper ); // hacked in + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCompany ] = DocPropInfo::createDocPropInfo( "Company", "Company", aStandardHelper ); // hacked in + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyBytes ] = DocPropInfo::createDocPropInfo( "Number of bytes", "", aStandardHelper ); // doesn't seem to exist - size on disk exists ( for an already saved document ) perhaps it will do ( or we need something else ) + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLines ] = DocPropInfo::createDocPropInfo( "Number of lines", "LineCount", aUsingStatsHelper ); // special handling + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyParas ] = DocPropInfo::createDocPropInfo( "Number of paragraphs", "ParagraphCount", aUsingStatsHelper ); // special handling + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySlides ] = DocPropInfo::createDocPropInfo( "Number of slides", "" , aStandardHelper ); // doesn't seem to exist + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyNotes ] = DocPropInfo::createDocPropInfo( "Number of notes", "", aStandardHelper ); // doesn't seem to exist + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHiddenSlides ] = DocPropInfo::createDocPropInfo("Number of hidden Slides", "", aStandardHelper ); // doesn't seem to exist + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyMMClips ] = DocPropInfo::createDocPropInfo( "Number of multimedia clips", "", aStandardHelper ); // doesn't seem to exist + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHyperlinkBase ] = DocPropInfo::createDocPropInfo( "Hyperlink base", "AutoloadURL", aStandardHelper ); + m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharsWSpaces ] = DocPropInfo::createDocPropInfo( "Number of characters (with spaces)", "", aStandardHelper ); // doesn't seem to be supported + } + + MSOIndexToOODocPropInfo& getDocPropInfoMap() { return m_docPropInfoMap; } +}; + + +typedef InheritedHelperInterfaceImpl1< ooo::vba::XDocumentProperty > SwVbaDocumentProperty_BASE; + +class SwVbaBuiltInDocumentProperty : public SwVbaDocumentProperty_BASE +{ +protected: + DocPropInfo mPropInfo; +public: + SwVbaBuiltInDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo ); + // XDocumentProperty + virtual void SAL_CALL Delete( ) throw (script::BasicErrorException, uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getName( ) throw (script::BasicErrorException, uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException); + virtual ::sal_Int8 SAL_CALL getType( ) throw (script::BasicErrorException, uno::RuntimeException); + virtual void SAL_CALL setType( ::sal_Int8 Type ) throw (script::BasicErrorException, uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException); + virtual void SAL_CALL setLinkToContent( ::sal_Bool LinkToContent ) throw (script::BasicErrorException, uno::RuntimeException); + virtual uno::Any SAL_CALL getValue( ) throw (script::BasicErrorException, uno::RuntimeException); + virtual void SAL_CALL setValue( const uno::Any& Value ) throw (script::BasicErrorException, uno::RuntimeException); + virtual rtl::OUString SAL_CALL getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException); + virtual void SAL_CALL setLinkSource( const rtl::OUString& LinkSource ) throw (script::BasicErrorException, uno::RuntimeException); + //XDefaultProperty + virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (uno::RuntimeException) { return rtl::OUString::createFromAscii("Value"); } + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual uno::Sequence<rtl::OUString> getServiceNames(); +}; + +class SwVbaCustomDocumentProperty : public SwVbaBuiltInDocumentProperty +{ +public: + + SwVbaCustomDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo ); + + virtual ::sal_Bool SAL_CALL getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException); + virtual void SAL_CALL setLinkToContent( ::sal_Bool LinkToContent ) throw (script::BasicErrorException, uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException); + virtual void SAL_CALL setLinkSource( const rtl::OUString& LinkSource ) throw (script::BasicErrorException, uno::RuntimeException); + virtual void SAL_CALL Delete( ) throw (script::BasicErrorException, uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException); + virtual void SAL_CALL setType( ::sal_Int8 Type ) throw (script::BasicErrorException, uno::RuntimeException); + +}; + + +SwVbaCustomDocumentProperty::SwVbaCustomDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo ) : SwVbaBuiltInDocumentProperty( xParent, xContext, rInfo ) +{ +} + +sal_Bool +SwVbaCustomDocumentProperty::getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // #FIXME we need to store the link content somewhere + return sal_False; +} + +void +SwVbaCustomDocumentProperty::setLinkToContent( sal_Bool /*bLinkContent*/ ) throw (script::BasicErrorException, uno::RuntimeException) +{ +} + +rtl::OUString +SwVbaCustomDocumentProperty::getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // #FIXME we need to store the link content somewhere + return rtl::OUString();; +} + +void +SwVbaCustomDocumentProperty::setLinkSource( const rtl::OUString& /*rsLinkContent*/ ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // #FIXME we need to store the link source somewhere +} + +void SAL_CALL +SwVbaCustomDocumentProperty::setName( const ::rtl::OUString& /*Name*/ ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // setName on existing property ? + // #FIXME + // do we need to delete existing property and create a new one? +} + +void SAL_CALL +SwVbaCustomDocumentProperty::setType( ::sal_Int8 /*Type*/ ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // setType, do we need to do a conversion? + // #FIXME the underlying value needs to be changed to the new type +} + +void SAL_CALL +SwVbaCustomDocumentProperty::Delete( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + uno::Reference< beans::XPropertyContainer > xContainer( mPropInfo.getUnoProperties(), uno::UNO_QUERY_THROW ); + xContainer->removeProperty( getName() ); +} + +SwVbaBuiltInDocumentProperty::SwVbaBuiltInDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo ) : SwVbaDocumentProperty_BASE( xParent, xContext ), mPropInfo( rInfo ) +{ +} + +void SAL_CALL +SwVbaBuiltInDocumentProperty::Delete( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // not valid for Builtin + throw uno::RuntimeException(); +} + +::rtl::OUString SAL_CALL +SwVbaBuiltInDocumentProperty::getName( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + return mPropInfo.msMSODesc; +} + +void SAL_CALL +SwVbaBuiltInDocumentProperty::setName( const rtl::OUString& ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // not valid for Builtin + throw uno::RuntimeException(); +} + +::sal_Int8 SAL_CALL +SwVbaBuiltInDocumentProperty::getType( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + return lcl_toMSOPropType( getValue().getValueType() ); +} + +void SAL_CALL +SwVbaBuiltInDocumentProperty::setType( ::sal_Int8 /*Type*/ ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // not valid for Builtin + throw uno::RuntimeException(); +} + +::sal_Bool SAL_CALL +SwVbaBuiltInDocumentProperty::getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + return sal_False; // built-in always false +} + +void SAL_CALL +SwVbaBuiltInDocumentProperty::setLinkToContent( ::sal_Bool /*LinkToContent*/ ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // not valid for Builtin + throw uno::RuntimeException(); +} + +uno::Any SAL_CALL +SwVbaBuiltInDocumentProperty::getValue( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + uno::Any aRet = mPropInfo.getValue(); + if ( !aRet.hasValue() ) + throw uno::RuntimeException(); + return aRet; +} + +void SAL_CALL +SwVbaBuiltInDocumentProperty::setValue( const uno::Any& Value ) throw (script::BasicErrorException, uno::RuntimeException) +{ + mPropInfo.setValue( Value ); +} + +rtl::OUString SAL_CALL +SwVbaBuiltInDocumentProperty::getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // not valid for Builtin + throw uno::RuntimeException(); +} + +void SAL_CALL +SwVbaBuiltInDocumentProperty::setLinkSource( const rtl::OUString& /*LinkSource*/ ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // not valid for Builtin + throw uno::RuntimeException(); +} + +rtl::OUString& +SwVbaBuiltInDocumentProperty::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBuiltinDocumentProperty") ); + return sImplName; +} + +uno::Sequence<rtl::OUString> +SwVbaBuiltInDocumentProperty::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.DocumentProperty" ) ); + } + return aServiceNames; +} +typedef ::cppu::WeakImplHelper3< com::sun::star::container::XIndexAccess + ,com::sun::star::container::XNameAccess + ,com::sun::star::container::XEnumerationAccess + > PropertiesImpl_BASE; + +typedef std::hash_map< sal_Int32, uno::Reference< XDocumentProperty > > DocProps; + +typedef ::cppu::WeakImplHelper1< com::sun::star::container::XEnumeration > DocPropEnumeration_BASE; +class DocPropEnumeration : public DocPropEnumeration_BASE +{ + DocProps mDocProps; + DocProps::iterator mIt; +public: + + DocPropEnumeration( const DocProps& rProps ) : mDocProps( rProps ), mIt( mDocProps.begin() ) {} + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) + { + return mIt != mDocProps.end(); + } + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( !hasMoreElements() ) + throw container::NoSuchElementException(); + return uno::makeAny( mIt++->second ); + } +}; + +typedef std::hash_map< rtl::OUString, uno::Reference< XDocumentProperty >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > DocPropsByName; + +class BuiltInPropertiesImpl : public PropertiesImpl_BASE +{ +protected: + + uno::Reference< XHelperInterface > m_xParent; + uno::Reference< uno::XComponentContext > m_xContext; + uno::Reference< frame::XModel > m_xModel; + uno::Reference< document::XDocumentInfo > m_xOOOBuiltIns; + + DocProps mDocProps; + DocPropsByName mNamedDocProps; + + public: + BuiltInPropertiesImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : m_xParent( xParent ), m_xContext( xContext ), m_xModel( xModel ) + { + BuiltInIndexHelper builtIns( m_xModel ); + for ( sal_Int32 index = word::WdBuiltInProperty::wdPropertyTitle; index <= word::WdBuiltInProperty::wdPropertyCharsWSpaces; ++index ) + { + mDocProps[ index ] = new SwVbaBuiltInDocumentProperty( xParent, xContext, builtIns.getDocPropInfoMap()[ index ] ); + mNamedDocProps[ mDocProps[ index ]->getName() ] = mDocProps[ index ]; + } + } +// XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) + { + return mDocProps.size(); + } + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException ) + { + // correct the correct by the base class for 1 based indices + DocProps::iterator it = mDocProps.find( ++Index ); + if ( it == mDocProps.end() ) + throw lang::IndexOutOfBoundsException(); + return uno::makeAny( it->second ); + } + virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( !hasByName( aName ) ) + throw container::NoSuchElementException(); + DocPropsByName::iterator it = mNamedDocProps.find( aName ); + return uno::Any( it->second ); + + } + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) + { + uno::Sequence< rtl::OUString > aNames( getCount() ); + rtl::OUString* pName = aNames.getArray(); + DocPropsByName::iterator it_end = mNamedDocProps.end(); + for( DocPropsByName::iterator it = mNamedDocProps.begin(); it != it_end; ++it, ++pName ) + *pName = it->first; + return aNames; + } + + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) + { + DocPropsByName::iterator it = mNamedDocProps.find( aName ); + if ( it == mNamedDocProps.end() ) + return sal_False; + return sal_True; + } +// XElementAccess + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) + { + return XDocumentProperty::static_type(0); + } + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) + { + return mDocProps.size() > 0; + } + virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) + { + return new DocPropEnumeration( mDocProps ); + } +}; + +SwVbaBuiltinDocumentProperties::SwVbaBuiltinDocumentProperties( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaDocumentproperties_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new BuiltInPropertiesImpl( xParent, xContext, xModel ) ) ), m_xModel( xModel ) +{ +} + +uno::Reference< XDocumentProperty > SAL_CALL +SwVbaBuiltinDocumentProperties::Add( const ::rtl::OUString& /*Name*/, ::sal_Bool /*LinkToContent*/, ::sal_Int8 /*Type*/, const uno::Any& /*value*/, const uno::Any& /*LinkSource*/ ) throw (script::BasicErrorException, uno::RuntimeException) +{ + throw uno::RuntimeException( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("not supported for Builtin properties") ), uno::Reference< uno::XInterface >() ); +} + +// XEnumerationAccess +uno::Type SAL_CALL +SwVbaBuiltinDocumentProperties::getElementType() throw (uno::RuntimeException) +{ + return XDocumentProperty::static_type(0); +} + +uno::Reference< container::XEnumeration > SAL_CALL +SwVbaBuiltinDocumentProperties::createEnumeration() throw (uno::RuntimeException) +{ + uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); + return xEnumAccess->createEnumeration(); +} + +// ScVbaCollectionBaseImpl +uno::Any +SwVbaBuiltinDocumentProperties::createCollectionObject( const uno::Any& aSource ) +{ + // pass through + return aSource; +} + +// XHelperInterface +rtl::OUString& +SwVbaBuiltinDocumentProperties::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBuiltinDocumentProperties") ); + return sImplName; +} + +uno::Sequence<rtl::OUString> +SwVbaBuiltinDocumentProperties::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.DocumentProperties" ) ); + } + return aServiceNames; +} + +class CustomPropertiesImpl : public PropertiesImpl_BASE +{ + uno::Reference< XHelperInterface > m_xParent; + uno::Reference< uno::XComponentContext > m_xContext; + uno::Reference< frame::XModel > m_xModel; + uno::Reference< beans::XPropertySet > mxUserDefinedProp; + boost::shared_ptr< PropertGetSetHelper > mpPropGetSetHelper; +public: + CustomPropertiesImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : m_xParent( xParent ), m_xContext( xContext ), m_xModel( xModel ) + { + // suck in the document( custom ) properties + uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( m_xModel, uno::UNO_QUERY_THROW ); + uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW ); + uno::Reference< document::XDocumentProperties > xDocProp( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW ); + mxUserDefinedProp.set( xDocProp->getUserDefinedProperties(), uno::UNO_QUERY_THROW ); + mpPropGetSetHelper.reset( new CustomPropertyGetSetHelper( m_xModel ) ); + }; + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) + { + return mxUserDefinedProp->getPropertySetInfo()->getProperties().getLength(); + } + + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException ) + { + uno::Sequence< beans::Property > aProps = mxUserDefinedProp->getPropertySetInfo()->getProperties(); + if ( Index >= aProps.getLength() ) + throw lang::IndexOutOfBoundsException(); + // How to determine type e.g Date? ( com.sun.star.util.DateTime ) + DocPropInfo aPropInfo = DocPropInfo::createDocPropInfo( aProps[ Index ].Name, aProps[ Index ].Name, mpPropGetSetHelper ); + return uno::makeAny( uno::Reference< XDocumentProperty >( new SwVbaCustomDocumentProperty( m_xParent, m_xContext, aPropInfo ) ) ); + } + + virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( !hasByName( aName ) ) + throw container::NoSuchElementException(); + + DocPropInfo aPropInfo = DocPropInfo::createDocPropInfo( aName, aName, mpPropGetSetHelper ); + return uno::makeAny( uno::Reference< XDocumentProperty >( new SwVbaCustomDocumentProperty( m_xParent, m_xContext, aPropInfo ) ) ); + } + + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) + { + uno::Sequence< beans::Property > aProps = mxUserDefinedProp->getPropertySetInfo()->getProperties(); + uno::Sequence< rtl::OUString > aNames( aProps.getLength() ); + rtl::OUString* pString = aNames.getArray(); + rtl::OUString* pEnd = ( pString + aNames.getLength() ); + beans::Property* pProp = aProps.getArray(); + for ( ; pString != pEnd; ++pString, ++pProp ) + *pString = pProp->Name; + return aNames; + } + + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) + { + OSL_TRACE("hasByName(%s) returns %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), mxUserDefinedProp->getPropertySetInfo()->hasPropertyByName( aName ) ); + return mxUserDefinedProp->getPropertySetInfo()->hasPropertyByName( aName ); + } + + // XElementAccess + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) + { + return XDocumentProperty::static_type(0); + } + + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) + { + return getCount() > 0; + } + + virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) + { + // create a map of properties ( the key doesn't matter ) + OSL_TRACE("Creating an enumeration"); + sal_Int32 key = 0; + sal_Int32 nElem = getCount(); + DocProps simpleDocPropSnapShot; + for ( ; key < nElem; ++key ) + simpleDocPropSnapShot[ key ].set( getByIndex( key ), uno::UNO_QUERY_THROW ); + OSL_TRACE("After creating the enumeration"); + return new DocPropEnumeration( simpleDocPropSnapShot ); + } + + void addProp( const ::rtl::OUString& Name, ::sal_Int8 /*Type*/, const uno::Any& Value ) + { + sal_Int16 attributes = 128; + uno::Reference< beans::XPropertyContainer > xContainer( mxUserDefinedProp, uno::UNO_QUERY_THROW ); + // TODO fixme, perform the necessary Type Value conversions + xContainer->addProperty( Name, attributes, Value ); + } + +}; + + +SwVbaCustomDocumentProperties::SwVbaCustomDocumentProperties( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaBuiltinDocumentProperties( xParent, xContext, xModel ) +{ + // replace the m_xIndexAccess implementation ( we need a virtual init ) + m_xIndexAccess.set( new CustomPropertiesImpl( xParent, xContext, xModel ) ); + m_xNameAccess.set( m_xIndexAccess, uno::UNO_QUERY_THROW ); +} + +uno::Reference< XDocumentProperty > SAL_CALL +SwVbaCustomDocumentProperties::Add( const ::rtl::OUString& Name, ::sal_Bool LinkToContent, ::sal_Int8 Type, const uno::Any& Value, const uno::Any& LinkSource ) throw (script::BasicErrorException, uno::RuntimeException) +{ + CustomPropertiesImpl* pCustomProps = dynamic_cast< CustomPropertiesImpl* > ( m_xIndexAccess.get() ); + uno::Reference< XDocumentProperty > xDocProp; + if ( pCustomProps ) + { + rtl::OUString sLinkSource; + pCustomProps->addProp( Name, Type, Value ); + + xDocProp.set( m_xNameAccess->getByName( Name ), uno::UNO_QUERY_THROW ); + xDocProp->setLinkToContent( LinkToContent ); + + if ( LinkSource >>= sLinkSource ) + xDocProp->setLinkSource( sLinkSource ); + } + return xDocProp; +} + +// XHelperInterface +rtl::OUString& +SwVbaCustomDocumentProperties::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCustomDocumentProperties") ); + return sImplName; +} diff --git a/sw/source/ui/vba/vbadocumentproperties.hxx b/sw/source/ui/vba/vbadocumentproperties.hxx new file mode 100644 index 0000000000..a75c6a6ca9 --- /dev/null +++ b/sw/source/ui/vba/vbadocumentproperties.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadocument.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_DOCUMENTPROPERTIES_HXX +#define SW_VBA_DOCUMENTPROPERTIES_HXX + +#include <ooo/vba/XDocumentProperties.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <vbahelper/vbacollectionimpl.hxx> +#include <hash_map> + +typedef CollTestImplHelper< ov::XDocumentProperties > SwVbaDocumentproperties_BASE; + +class SwVbaBuiltinDocumentProperties : public SwVbaDocumentproperties_BASE +{ +protected: + css::uno::Reference< css::frame::XModel > m_xModel; +public: + SwVbaBuiltinDocumentProperties( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xDocument ); + + // XDocumentProperties + virtual css::uno::Reference< ::ooo::vba::XDocumentProperty > SAL_CALL Add( const ::rtl::OUString& Name, ::sal_Bool LinkToContent, ::sal_Int8 Type, const css::uno::Any& Value, const css::uno::Any& LinkSource ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + // ScVbaCollectionBaseImpl + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +class SwVbaCustomDocumentProperties : public SwVbaBuiltinDocumentProperties +{ +public: + SwVbaCustomDocumentProperties( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xDocument ); +// XDocumentProperties + virtual css::uno::Reference< ::ooo::vba::XDocumentProperty > SAL_CALL Add( const ::rtl::OUString& Name, ::sal_Bool LinkToContent, ::sal_Int8 Type, const css::uno::Any& Value, const css::uno::Any& LinkSource ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); +}; + +#endif /* SW_VBA_DOCUMENTPROPERTY_HXX */ diff --git a/sw/source/ui/vba/vbadocuments.cxx b/sw/source/ui/vba/vbadocuments.cxx new file mode 100644 index 0000000000..28978ae078 --- /dev/null +++ b/sw/source/ui/vba/vbadocuments.cxx @@ -0,0 +1,200 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbadocuments.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <comphelper/processfactory.hxx> + +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase3.hxx> + +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/FrameSearchFlag.hpp> +#include <com/sun/star/util/XModifiable.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/beans/PropertyVetoException.hpp> +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <com/sun/star/document/XTypeDetection.hpp> +#include <com/sun/star/uri/XUriReference.hpp> +#include <com/sun/star/uri/XUriReferenceFactory.hpp> + +#include <sfx2/objsh.hxx> +#include <tools/urlobj.hxx> + +#include "vbaglobals.hxx" +#include "vbadocument.hxx" +#include "vbadocuments.hxx" +#include <vbahelper/vbahelper.hxx> + +#include <hash_map> +#include <osl/file.hxx> +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +static uno::Any +getDocument( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextDocument > &xDoc, const uno::Any& aApplication ) +{ + // FIXME: fine as long as SwVbaDocument is stateless ... + uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY ); + if( !xModel.is() ) + return uno::Any(); + + SwVbaDocument *pWb = new SwVbaDocument( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel ); + return uno::Any( uno::Reference< word::XDocument > (pWb) ); +} + +class DocumentEnumImpl : public EnumerationHelperImpl +{ + uno::Any m_aApplication; +public: + DocumentEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Any& aApplication ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), m_aApplication( aApplication ) {} + + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + uno::Reference< text::XTextDocument > xDoc( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); + return getDocument( m_xContext, xDoc, m_aApplication ); + } +}; + +SwVbaDocuments::SwVbaDocuments( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : SwVbaDocuments_BASE( xParent, xContext, VbaDocumentsBase::WORD_DOCUMENT ) +{ +} +// XEnumerationAccess +uno::Type +SwVbaDocuments::getElementType() throw (uno::RuntimeException) +{ + return word::XDocument::static_type(0); +} +uno::Reference< container::XEnumeration > +SwVbaDocuments::createEnumeration() throw (uno::RuntimeException) +{ + // #FIXME its possible the DocumentEnumImpl here doens't reflect + // the state of this object ( although it should ) would be + // safer to create an enumeration based on this objects state + // rather than one effectively based of the desktop component + uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); + return new DocumentEnumImpl( mxContext, xEnumerationAccess->createEnumeration(), Application() ); +} + +uno::Any +SwVbaDocuments::createCollectionObject( const uno::Any& aSource ) +{ + uno::Reference< text::XTextDocument > xDoc( aSource, uno::UNO_QUERY_THROW ); + return getDocument( mxContext, xDoc, Application() ); +} + +uno::Any SAL_CALL +SwVbaDocuments::Add( const uno::Any& Template, const uno::Any& /*NewTemplate*/, const uno::Any& /*DocumentType*/, const uno::Any& /*Visible*/ ) throw (uno::RuntimeException) +{ + rtl::OUString sFileName; + if( Template.hasValue() && ( Template >>= sFileName ) ) + { + return Open( sFileName, uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any()); + } + uno::Reference <text::XTextDocument> xTextDoc( VbaDocumentsBase::Add() , uno::UNO_QUERY_THROW ); + + if( xTextDoc.is() ) + return getDocument( mxContext, xTextDoc, Application() ); + return uno::Any(); +} + +// #TODO# #FIXME# can any of the unused params below be used? +void SAL_CALL +SwVbaDocuments::Close( const uno::Any& /*SaveChanges*/, const uno::Any& /*OriginalFormat*/, const uno::Any& /*RouteDocument*/ ) throw (uno::RuntimeException) +{ + VbaDocumentsBase::Close(); +} + +// #TODO# #FIXME# can any of the unused params below be used? +uno::Any SAL_CALL +SwVbaDocuments::Open( const ::rtl::OUString& Filename, const uno::Any& /*ConfirmConversions*/, const uno::Any& ReadOnly, const uno::Any& /*AddToRecentFiles*/, const uno::Any& /*PasswordDocument*/, const uno::Any& /*PasswordTemplate*/, const uno::Any& /*Revert*/, const uno::Any& /*WritePasswordDocument*/, const uno::Any& /*WritePasswordTemplate*/, const uno::Any& /*Format*/, const uno::Any& /*Encoding*/, const uno::Any& /*Visible*/, const uno::Any& /*OpenAndRepair*/, const uno::Any& /*DocumentDirection*/, const uno::Any& /*NoEncodingDialog*/, const uno::Any& /*XMLTransform*/ ) throw (uno::RuntimeException) +{ + // we need to detect if this is a URL, if not then assume its a file path + rtl::OUString aURL; + INetURLObject aObj; + aObj.SetURL( Filename ); + bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID; + if ( bIsURL ) + aURL = Filename; + else + osl::FileBase::getFileURLFromSystemPath( Filename, aURL ); + + uno::Sequence< beans::PropertyValue > sProps(0); + + uno::Reference <text::XTextDocument> xSpreadDoc( VbaDocumentsBase::Open( Filename, ReadOnly, sProps ), uno::UNO_QUERY_THROW ); + uno::Any aRet = getDocument( mxContext, xSpreadDoc, Application() ); + uno::Reference< word::XDocument > xDocument( aRet, uno::UNO_QUERY ); + if ( xDocument.is() ) + xDocument->Activate(); + return aRet; +} + + // VbaDocumentsBase / XDocumentsBase (to avoid warning C4266 for hiding function on wntmsci) +uno::Any SAL_CALL +SwVbaDocuments::Add() throw (uno::RuntimeException) +{ + return VbaDocumentsBase::Add(); +} + +void SAL_CALL +SwVbaDocuments::Close( ) throw (uno::RuntimeException) +{ + VbaDocumentsBase::Close(); +} + +uno::Any SAL_CALL +SwVbaDocuments::Open( const ::rtl::OUString& Filename, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (uno::RuntimeException) +{ + return VbaDocumentsBase::Open( Filename, ReadOnly, rProps ); +} + +rtl::OUString& +SwVbaDocuments::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDocuments") ); + return sImplName; +} + +uno::Sequence<rtl::OUString> +SwVbaDocuments::getServiceNames() +{ + static uno::Sequence< rtl::OUString > sNames; + if ( sNames.getLength() == 0 ) + { + sNames.realloc( 1 ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Documents") ); + } + return sNames; +} diff --git a/sw/source/ui/vba/vbadocuments.hxx b/sw/source/ui/vba/vbadocuments.hxx new file mode 100644 index 0000000000..4b59b1da8c --- /dev/null +++ b/sw/source/ui/vba/vbadocuments.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_DOCUMENTS_HXX +#define SW_VBA_DOCUMENTS_HXX + + +#include <vbahelper/vbacollectionimpl.hxx> +#include <ooo/vba/word/XDocuments.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <vbahelper/vbadocumentsbase.hxx> +#include "wordvbahelper.hxx" + + +typedef cppu::ImplInheritanceHelper1< VbaDocumentsBase, ov::word::XDocuments > SwVbaDocuments_BASE; + +class SwVbaDocuments : public SwVbaDocuments_BASE +{ +public: + SwVbaDocuments( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~SwVbaDocuments() {} + + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + + // SwVbaDocuments_BASE + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); + + // Methods + virtual css::uno::Any SAL_CALL Add( const css::uno::Any& Template, const css::uno::Any& NewTemplate, const css::uno::Any& DocumentType, const css::uno::Any& Visible ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ConfirmConversions, const css::uno::Any& ReadOnly, const css::uno::Any& AddToRecentFiles, const css::uno::Any& PasswordDocument, const css::uno::Any& PasswordTemplate, const css::uno::Any& Revert, const css::uno::Any& WritePasswordDocument, const css::uno::Any& WritePasswordTemplate, const css::uno::Any& Format, const css::uno::Any& Encoding, const css::uno::Any& Visible, const css::uno::Any& OpenAndRepair, const css::uno::Any& DocumentDirection, const css::uno::Any& NoEncodingDialog, const css::uno::Any& XMLTransform ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& OriginalFormat, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException); + + // VbaDocumentsBase / XDocumentsBase (to avoid warning C4266 for hiding function on wntmsci) + virtual css::uno::Any SAL_CALL Add() throw (css::uno::RuntimeException); + virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ReadOnly, const css::uno::Sequence< css::beans::PropertyValue >& rProps ) throw (css::uno::RuntimeException); +}; + +#endif /* SW_VBA_DOCUMENTS_HXX */ diff --git a/sw/source/ui/vba/vbafield.cxx b/sw/source/ui/vba/vbafield.cxx new file mode 100644 index 0000000000..345632669b --- /dev/null +++ b/sw/source/ui/vba/vbafield.cxx @@ -0,0 +1,481 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbafield.hxx" +#include "vbarange.hxx" +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/text/XTextViewCursorSupplier.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/text/XTextFieldsSupplier.hpp> +#include <ooo/vba/word/WdFieldType.hpp> +#include <com/sun/star/text/FilenameDisplayFormat.hpp> +#include <com/sun/star/util/XRefreshable.hpp> +#include <swtypes.hxx> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +// *** SwVbaField *********************************************** + +SwVbaField::SwVbaField( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const uno::Reference< css::text::XTextField >& xTextField) throw ( uno::RuntimeException ) : SwVbaField_BASE( rParent, rContext ), mxTextDocument( rDocument ) +{ + mxTextField.set( xTextField, uno::UNO_QUERY_THROW ); +} + +// XHelperInterface +rtl::OUString& +SwVbaField::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaField") ); + return sImplName; +} + +uno::Sequence<rtl::OUString> +SwVbaField::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Field" ) ); + } + return aServiceNames; +} + +// *** _ReadFieldParams *********************************************** +// the codes are copied from ww8par5.cxx +class _ReadFieldParams +{ +private: + String aData; + xub_StrLen nLen, nFnd, nNext, nSavPtr; + String aFieldName; +public: + _ReadFieldParams( const String& rData ); + ~_ReadFieldParams(); + + xub_StrLen GoToTokenParam(); + long SkipToNextToken(); + xub_StrLen GetTokenSttPtr() const { return nFnd; } + + xub_StrLen FindNextStringPiece( xub_StrLen _nStart = STRING_NOTFOUND ); + bool GetTokenSttFromTo(xub_StrLen* _pFrom, xub_StrLen* _pTo, + xub_StrLen _nMax); + + String GetResult() const; + String GetFieldName()const { return aFieldName; } +}; + + +_ReadFieldParams::_ReadFieldParams( const String& _rData ) + : aData( _rData ), nLen( _rData.Len() ), nNext( 0 ) +{ + /* + erstmal nach einer oeffnenden Klammer oder einer Leerstelle oder einem + Anfuehrungszeichen oder einem Backslash suchen, damit der Feldbefehl + (also INCLUDEPICTURE bzw EINFUeGENGRAFIK bzw ...) ueberlesen wird + */ + while( (nLen > nNext) && (aData.GetChar( nNext ) == ' ') ) + ++nNext; + + sal_Unicode c; + while( nLen > nNext + && (c = aData.GetChar( nNext )) != ' ' + && c != '"' + && c != '\\' + && c != 132 + && c != 0x201c ) + ++nNext; + + nFnd = nNext; + nSavPtr = nNext; + aFieldName = aData.Copy( 0, nFnd ); +// cLastChar = aData.GetChar( nSavPtr ); +} + + +_ReadFieldParams::~_ReadFieldParams() +{ +// aData.SetChar( nSavPtr, cLastChar ); +} + + +String _ReadFieldParams::GetResult() const +{ + return (STRING_NOTFOUND == nFnd) + ? aEmptyStr + : aData.Copy( nFnd, (nSavPtr - nFnd) ); +} + + +xub_StrLen _ReadFieldParams::GoToTokenParam() +{ + xub_StrLen nOld = nNext; + if( -2 == SkipToNextToken() ) + return GetTokenSttPtr(); + nNext = nOld; + return STRING_NOTFOUND; +} + +// ret: -2: NOT a '\' parameter but normal Text +long _ReadFieldParams::SkipToNextToken() +{ + long nRet = -1; // Ende + if ( + (STRING_NOTFOUND != nNext) && (nLen > nNext) && + STRING_NOTFOUND != (nFnd = FindNextStringPiece(nNext)) + ) + { + nSavPtr = nNext; + + if ('\\' == aData.GetChar(nFnd) && '\\' != aData.GetChar(nFnd + 1)) + { + nRet = aData.GetChar(++nFnd); + nNext = ++nFnd; // und dahinter setzen + } + else + { + nRet = -2; + if ( + (STRING_NOTFOUND != nSavPtr ) && + ( + ('"' == aData.GetChar(nSavPtr - 1)) || + (0x201d == aData.GetChar(nSavPtr - 1)) + ) + ) + { + --nSavPtr; + } + } + } + return nRet; +} + +// FindNextPara sucht naechsten Backslash-Parameter oder naechste Zeichenkette +// bis zum Blank oder naechsten "\" oder zum schliessenden Anfuehrungszeichen +// oder zum String-Ende von pStr. +// +// Ausgabe ppNext (falls ppNext != 0) Suchbeginn fuer naechsten Parameter bzw. 0 +// +// Returnwert: 0 falls String-Ende erreicht, +// ansonsten Anfang des Paramters bzw. der Zeichenkette +// +xub_StrLen _ReadFieldParams::FindNextStringPiece(const xub_StrLen nStart) +{ + xub_StrLen n = ( STRING_NOTFOUND == nStart ) ? nFnd : nStart; // Anfang + xub_StrLen n2; // Ende + + nNext = STRING_NOTFOUND; // Default fuer nicht gefunden + + while( (nLen > n) && (aData.GetChar( n ) == ' ') ) + ++n; + + if( nLen == n ) + return STRING_NOTFOUND; // String End reached! + + if( (aData.GetChar( n ) == '"') // Anfuehrungszeichen vor Para? + || (aData.GetChar( n ) == 0x201c) + || (aData.GetChar( n ) == 132) ) + { + n++; // Anfuehrungszeichen ueberlesen + n2 = n; // ab hier nach Ende suchen + while( (nLen > n2) + && (aData.GetChar( n2 ) != '"') + && (aData.GetChar( n2 ) != 0x201d) + && (aData.GetChar( n2 ) != 147) ) + n2++; // Ende d. Paras suchen + } + else // keine Anfuehrungszeichen + { + n2 = n; // ab hier nach Ende suchen + while( (nLen > n2) && (aData.GetChar( n2 ) != ' ') ) // Ende d. Paras suchen + { + if( aData.GetChar( n2 ) == '\\' ) + { + if( aData.GetChar( n2+1 ) == '\\' ) + n2 += 2; // Doppel-Backslash -> OK + else + { + if( n2 > n ) + n2--; + break; // einfach-Backslash -> Ende + } + } + else + n2++; // kein Backslash -> OK + } + } + if( nLen > n2 ) + { + if(aData.GetChar( n2 ) != ' ') n2++; + nNext = n2; + } + return n; +} + + + +// read parameters "1-3" or 1-3 with both values between 1 and nMax +bool _ReadFieldParams::GetTokenSttFromTo(USHORT* pFrom, USHORT* pTo, USHORT nMax) +{ + USHORT nStart = 0; + USHORT nEnd = 0; + xub_StrLen n = GoToTokenParam(); + if( STRING_NOTFOUND != n ) + { + + String sParams( GetResult() ); + + xub_StrLen nIndex = 0; + String sStart( sParams.GetToken(0, '-', nIndex) ); + if( STRING_NOTFOUND != nIndex ) + { + nStart = static_cast<USHORT>(sStart.ToInt32()); + nEnd = static_cast<USHORT>(sParams.Copy(nIndex).ToInt32()); + } + } + if( pFrom ) *pFrom = nStart; + if( pTo ) *pTo = nEnd; + + return nStart && nEnd && (nMax >= nStart) && (nMax >= nEnd); +} + +// *** SwVbaFields *********************************************** + +uno::Any lcl_createField( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel, const uno::Any& aSource ) +{ + uno::Reference< text::XTextField > xTextField( aSource, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextDocument > xTextDocument( xModel, uno::UNO_QUERY_THROW ); + uno::Reference< word::XField > xField( new SwVbaField( xParent, xContext, xTextDocument, xTextField ) ); + return uno::makeAny( xField ); +} + +typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > FieldEnumeration_BASE; +typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > FieldCollectionHelper_BASE; + +class FieldEnumeration : public FieldEnumeration_BASE +{ + uno::Reference< XHelperInterface > mxParent; + uno::Reference< uno::XComponentContext > mxContext; + uno::Reference< frame::XModel > mxModel; + uno::Reference< container::XEnumeration > mxEnumeration; +public: + FieldEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< container::XEnumeration >& xEnumeration ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ), mxEnumeration( xEnumeration ) + { + } + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) + { + return mxEnumeration->hasMoreElements(); + } + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( !hasMoreElements() ) + throw container::NoSuchElementException(); + return lcl_createField( mxParent, mxContext, mxModel, mxEnumeration->nextElement() ); + } +}; + +class FieldCollectionHelper : public FieldCollectionHelper_BASE +{ + uno::Reference< XHelperInterface > mxParent; + uno::Reference< uno::XComponentContext > mxContext; + uno::Reference< frame::XModel > mxModel; + uno::Reference< container::XEnumerationAccess > mxEnumerationAccess; +public: + FieldCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) throw (css::uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ) + { + uno::Reference< text::XTextFieldsSupplier > xSupp( xModel, uno::UNO_QUERY_THROW ); + mxEnumerationAccess.set( xSupp->getTextFields(), uno::UNO_QUERY_THROW ); + } + // XElementAccess + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return mxEnumerationAccess->getElementType(); } + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return mxEnumerationAccess->hasElements(); } + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) + { + uno::Reference< container::XEnumeration > xEnumeration = mxEnumerationAccess->createEnumeration(); + sal_Int32 nCount = 0; + while( xEnumeration->hasMoreElements() ) + { + ++nCount; + xEnumeration->nextElement(); + } + return nCount; + } + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException ) + { + if( Index < 0 || Index >= getCount() ) + throw lang::IndexOutOfBoundsException(); + + uno::Reference< container::XEnumeration > xEnumeration = mxEnumerationAccess->createEnumeration(); + sal_Int32 nCount = 0; + while( xEnumeration->hasMoreElements() ) + { + if( nCount == Index ) + { + return xEnumeration->nextElement(); + } + ++nCount; + } + throw lang::IndexOutOfBoundsException(); + } + // XEnumerationAccess + virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) + { + uno::Reference< container::XEnumeration > xEnumeration = mxEnumerationAccess->createEnumeration(); + return uno::Reference< container::XEnumeration >( new FieldEnumeration( mxParent, mxContext, mxModel, xEnumeration ) ); + } +}; + +SwVbaFields::SwVbaFields( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaFields_BASE( xParent, xContext , uno::Reference< container::XIndexAccess >( new FieldCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel ) +{ + mxMSF.set( mxModel, uno::UNO_QUERY_THROW ); +} + +uno::Reference< word::XField > SAL_CALL +SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& Type, const css::uno::Any& Text, const css::uno::Any& /*PreserveFormatting*/ ) throw (css::uno::RuntimeException) +{ + sal_Int32 nType = word::WdFieldType::wdFieldEmpty; + Type >>= nType; + rtl::OUString sText; + Text >>= sText; + + String sFieldName; + if( ( nType == word::WdFieldType::wdFieldEmpty ) && ( sText.getLength() > 0 ) ) + { + _ReadFieldParams aReadParam(sText); + sFieldName = aReadParam.GetFieldName(); + } + + uno::Reference< text::XTextContent > xTextField; + if( nType == word::WdFieldType::wdFieldFileName || sFieldName.EqualsIgnoreCaseAscii("FILENAME") ) + { + xTextField.set( Create_Field_FileName( sText ), uno::UNO_QUERY_THROW ); + } + else + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + } + + SwVbaRange* pVbaRange = dynamic_cast< SwVbaRange* >( Range.get() ); + uno::Reference< text::XTextRange > xTextRange = pVbaRange->getXTextRange(); + uno::Reference< text::XText > xText = xTextRange->getText(); + xText->insertTextContent( xTextRange, xTextField, true ); + return uno::Reference< word::XField >( new SwVbaField( mxParent, mxContext, uno::Reference< text::XTextDocument >( mxModel, uno::UNO_QUERY_THROW ), uno::Reference< text::XTextField >( xTextField, uno::UNO_QUERY_THROW ) ) ); +} + +uno::Reference< text::XTextField > SwVbaFields::Create_Field_FileName( const rtl::OUString _text ) throw (uno::RuntimeException) +{ + uno::Reference< text::XTextField > xTextField( mxMSF->createInstance( rtl::OUString::createFromAscii("com.sun.star.text.TextField.FileName") ), uno::UNO_QUERY_THROW ); + sal_Int16 nFileFormat = text::FilenameDisplayFormat::NAME_AND_EXT; + if( _text.getLength() > 0 ) + { + long nRet; + _ReadFieldParams aReadParam( _text ); + while (-1 != (nRet = aReadParam.SkipToNextToken())) + { + switch (nRet) + { + case 'p': + nFileFormat = text::FilenameDisplayFormat::FULL; + break; + case '*': + //Skip over MERGEFORMAT + aReadParam.SkipToNextToken(); + break; + default: + DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); + break; + } + } + } + + uno::Reference< beans::XPropertySet > xProps( xTextField, uno::UNO_QUERY_THROW ); + xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FileFormat") ), uno::makeAny( nFileFormat ) ); + + return xTextField; +} + +uno::Reference< container::XEnumeration > SAL_CALL +SwVbaFields::createEnumeration() throw (uno::RuntimeException) +{ + uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); + return xEnumerationAccess->createEnumeration(); +} + +// ScVbaCollectionBaseImpl +uno::Any +SwVbaFields::createCollectionObject( const uno::Any& aSource ) +{ + return lcl_createField( mxParent, mxContext, mxModel, aSource ); +} + +sal_Int32 SAL_CALL SwVbaFields::Update() throw (uno::RuntimeException) +{ + sal_Int32 nUpdate = 1; + try + { + uno::Reference< text::XTextFieldsSupplier > xSupp( mxModel, uno::UNO_QUERY_THROW ); + uno::Reference< util::XRefreshable > xRef( xSupp->getTextFields(), uno::UNO_QUERY_THROW ); + xRef->refresh(); + nUpdate = 0; + }catch( uno::Exception ) + { + nUpdate = 1; + } + return nUpdate; +} + +// XHelperInterface +rtl::OUString& +SwVbaFields::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFields") ); + return sImplName; +} + +// XEnumerationAccess +uno::Type SAL_CALL +SwVbaFields::getElementType() throw (uno::RuntimeException) +{ + return word::XField::static_type(0); +} + +uno::Sequence<rtl::OUString> +SwVbaFields::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Fields" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbafield.hxx b/sw/source/ui/vba/vbafield.hxx new file mode 100644 index 0000000000..ab284164d3 --- /dev/null +++ b/sw/source/ui/vba/vbafield.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_FIELD_HXX +#define SW_VBA_FIELD_HXX +#include <vbahelper/vbahelperinterface.hxx> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XTextField.hpp> +#include <ooo/vba/word/XField.hpp> +#include <ooo/vba/word/XFields.hpp> +#include <vbahelper/vbacollectionimpl.hxx> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XField > SwVbaField_BASE; + +class SwVbaField : public SwVbaField_BASE +{ + css::uno::Reference< css::text::XTextDocument > mxTextDocument; + css::uno::Reference< css::text::XTextField > mxTextField; +public: + SwVbaField( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const css::uno::Reference< css::text::XTextField >& xTextField) throw ( css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +// *** SwVbaFields *********************************************** + +typedef CollTestImplHelper< ov::word::XFields > SwVbaFields_BASE; + +class SwVbaFields : public SwVbaFields_BASE +{ + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF; +private: + css::uno::Reference< css::text::XTextField > Create_Field_FileName( const rtl::OUString _text ) throw (css::uno::RuntimeException); + +public: + SwVbaFields( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel ); + // XFields + virtual css::uno::Reference< ::ooo::vba::word::XField > SAL_CALL Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& Type, const css::uno::Any& Text, const css::uno::Any& PreserveFormatting ) throw (css::uno::RuntimeException); + virtual sal_Int32 SAL_CALL Update() throw (css::uno::RuntimeException); + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + // ScVbaCollectionBaseImpl + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif diff --git a/sw/source/ui/vba/vbafind.cxx b/sw/source/ui/vba/vbafind.cxx new file mode 100644 index 0000000000..d226cddf9b --- /dev/null +++ b/sw/source/ui/vba/vbafind.cxx @@ -0,0 +1,431 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbafind.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include "vbareplacement.hxx" +#include <ooo/vba/word/WdFindWrap.hpp> +#include <ooo/vba/word/WdReplace.hpp> +#include <com/sun/star/text/XTextRangeCompare.hpp> +#include "wordvbahelper.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaFind::SwVbaFind( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) : + SwVbaFind_BASE( rParent, rContext ), mxModel( xModel ), mxTextRange( xTextRange ), mbReplace( sal_False ), mnReplaceType( word::WdReplace::wdReplaceOne ), mnWrap( word::WdFindWrap::wdFindStop ) +{ + mxReplaceable.set( mxModel, uno::UNO_QUERY_THROW ); + mxPropertyReplace.set( mxReplaceable->createReplaceDescriptor(), uno::UNO_QUERY_THROW ); + mxTVC = word::getXTextViewCursor( mxModel ); + mxSelSupp.set( mxModel->getCurrentController(), uno::UNO_QUERY_THROW ); +} + +SwVbaFind::~SwVbaFind() +{ +} + +sal_Bool SwVbaFind::InRange( const uno::Reference< text::XTextRange >& xCurrentRange ) throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextRangeCompare > xTRC( mxTextRange->getText(), uno::UNO_QUERY_THROW ); + if( xTRC->compareRegionStarts( mxTextRange, xCurrentRange ) >= 0 && xTRC->compareRegionEnds( mxTextRange, xCurrentRange ) <= 0 ) + return sal_True; + return sal_False; +} + +sal_Bool SwVbaFind::InEqualRange( const uno::Reference< text::XTextRange >& xCurrentRange ) throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextRangeCompare > xTRC( mxTextRange->getText(), uno::UNO_QUERY_THROW ); + if( xTRC->compareRegionStarts( mxTextRange, xCurrentRange ) == 0 && xTRC->compareRegionEnds( mxTextRange, xCurrentRange ) == 0 ) + return sal_True; + return sal_False; +} + +void SwVbaFind::SetReplaceWith( const rtl::OUString& rText ) throw (uno::RuntimeException) +{ + mxPropertyReplace->setReplaceString( rText ); + mbReplace = sal_True; +} + +rtl::OUString SwVbaFind::GetReplaceWith() throw (uno::RuntimeException) +{ + return mxPropertyReplace->getReplaceString(); +} +void SwVbaFind::SetReplace( sal_Int32 type ) +{ + mnReplaceType = type; + mbReplace = sal_True; +} + +rtl::OUString SwVbaFind::ReplaceWildcards( const rtl::OUString& /*rText*/ ) throw ( uno::RuntimeException ) +{ + // TODO: + return rtl::OUString(); +} + +uno::Reference< text::XTextRange > SwVbaFind::FindOneElement() throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextRange > xFoundOne; + if( mxTVC->getString().getLength() > 0 ) + { + if( getForward() ) + { + xFoundOne.set( mxReplaceable->findNext( mxTextRange->getStart(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY ); + } + else + { + xFoundOne.set( mxReplaceable->findNext( mxTextRange->getEnd(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY ); + } + + if( xFoundOne.is() && InEqualRange( xFoundOne ) ) + { + xFoundOne.set( mxReplaceable->findNext( xFoundOne, uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY ); + } + else if( xFoundOne.is() && !InRange( xFoundOne ) ) + { + xFoundOne = uno::Reference< text::XTextRange >(); + } + } + else + { + xFoundOne.set( mxReplaceable->findNext( mxTextRange, uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY ); + } + + if( !xFoundOne.is() && ( getWrap() == word::WdFindWrap::wdFindContinue || getWrap() == word::WdFindWrap::wdFindAsk ) ) + { + if( getForward() ) + { + mxTVC->gotoStart(sal_False); + xFoundOne.set( mxReplaceable->findNext( mxTextRange->getStart(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY ); + } + else + { + mxTVC->gotoEnd( sal_False ); + xFoundOne.set( mxReplaceable->findNext( mxTextRange->getEnd(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY ); + + } + } + return xFoundOne; +} + +sal_Bool SwVbaFind::SearchReplace() throw (uno::RuntimeException) +{ + sal_Bool result = sal_False; + + // TODO: map wildcards in area to OOo wildcards + + if( mbReplace ) + { + switch( mnReplaceType ) + { + case word::WdReplace::wdReplaceNone: + { + result = sal_True; + break; + } + case word::WdReplace::wdReplaceOne: + { + uno::Reference< text::XTextRange > xFindOne = FindOneElement(); + if( xFindOne.is() ) + { + xFindOne->setString( GetReplaceWith() ); + result = mxSelSupp->select( uno::makeAny( xFindOne ) ); + } + break; + } + case word::WdReplace::wdReplaceAll: + { + uno::Reference< container::XIndexAccess > xIndexAccess = mxReplaceable->findAll( uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ); + if( xIndexAccess->getCount() > 0 ) + { + for( sal_Int32 i = 0; i < xIndexAccess->getCount(); i++ ) + { + uno::Reference< text::XTextRange > xTextRange( xIndexAccess->getByIndex( i ), uno::UNO_QUERY_THROW ); + if( mnWrap == word::WdFindWrap::wdFindContinue || mnWrap == word::WdFindWrap::wdFindAsk || InRange( xTextRange ) ) + { + xTextRange->setString( GetReplaceWith() ); + result = sal_True; + } + } + } + break; + } + default: + { + result = sal_False; + } + } + } + else + { + uno::Reference< text::XTextRange > xFindOne = FindOneElement(); + if( xFindOne.is() ) + result = mxSelSupp->select( uno::makeAny( xFindOne ) ); + } + + return result; +} + +::rtl::OUString SAL_CALL SwVbaFind::getText() throw (uno::RuntimeException) +{ + return mxPropertyReplace->getSearchString(); +} + +void SAL_CALL SwVbaFind::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException) +{ + mxPropertyReplace->setSearchString( _text ); +} + +uno::Any SAL_CALL SwVbaFind::getReplacement() throw (uno::RuntimeException) +{ + return uno::makeAny( uno::Reference< word::XReplacement >( new SwVbaReplacement( this, mxContext, mxPropertyReplace ) ) ); +} + +void SAL_CALL SwVbaFind::setReplacement( const uno::Any& /*_replacement */ ) throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); +} + +::sal_Bool SAL_CALL SwVbaFind::getForward() throw (uno::RuntimeException) +{ + sal_Bool bBackward = sal_False; + mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchBackwards") ) ) >>= bBackward; + return !bBackward; +} + +void SAL_CALL SwVbaFind::setForward( ::sal_Bool _forward ) throw (uno::RuntimeException) +{ + sal_Bool bBackward = !_forward; + mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchBackwards") ), uno::makeAny( bBackward ) ); +} + +::sal_Int32 SAL_CALL SwVbaFind::getWrap() throw (uno::RuntimeException) +{ + // seems not supported in Writer + return mnWrap; +} + +void SAL_CALL SwVbaFind::setWrap( ::sal_Int32 _wrap ) throw (uno::RuntimeException) +{ + // seems not supported in Writer + mnWrap = _wrap; +} + +::sal_Bool SAL_CALL SwVbaFind::getFormat() throw (uno::RuntimeException) +{ + return mxPropertyReplace->getValueSearch(); +} + +void SAL_CALL SwVbaFind::setFormat( ::sal_Bool _format ) throw (uno::RuntimeException) +{ + mxPropertyReplace->setValueSearch( _format ); +} + +::sal_Bool SAL_CALL SwVbaFind::getMatchCase() throw (uno::RuntimeException) +{ + sal_Bool value = sal_False; + mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchCaseSensitive") ) ) >>= value; + return value; +} + +void SAL_CALL SwVbaFind::setMatchCase( ::sal_Bool _matchcase ) throw (uno::RuntimeException) +{ + mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchCaseSensitive") ), uno::makeAny( _matchcase ) ); +} + +::sal_Bool SAL_CALL SwVbaFind::getMatchWholeWord() throw (uno::RuntimeException) +{ + sal_Bool value = sal_False; + mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchWords") ) ) >>= value; + return value; +} + +void SAL_CALL SwVbaFind::setMatchWholeWord( ::sal_Bool _matchwholeword ) throw (uno::RuntimeException) +{ + mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchWords") ), uno::makeAny( _matchwholeword ) ); +} + +::sal_Bool SAL_CALL SwVbaFind::getMatchWildcards() throw (uno::RuntimeException) +{ + sal_Bool value = sal_False; + mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchRegularExpression") ) ) >>= value; + return value; +} + +void SAL_CALL SwVbaFind::setMatchWildcards( ::sal_Bool _matchwildcards ) throw (uno::RuntimeException) +{ + mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchRegularExpression") ), uno::makeAny( _matchwildcards ) ); +} + +::sal_Bool SAL_CALL SwVbaFind::getMatchSoundsLike() throw (uno::RuntimeException) +{ + sal_Bool value = sal_False; + mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ) ) >>= value; + return value; +} + +void SAL_CALL SwVbaFind::setMatchSoundsLike( ::sal_Bool _matchsoundslike ) throw (uno::RuntimeException) +{ + // seems not accurate + mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ), uno::makeAny( _matchsoundslike ) ); +} + +::sal_Bool SAL_CALL SwVbaFind::getMatchAllWordForms() throw (uno::RuntimeException) +{ + sal_Bool value = sal_False; + mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ) ) >>= value; + if( value ) + mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarityRelax") ) ) >>= value; + return value; +} + +void SAL_CALL SwVbaFind::setMatchAllWordForms( ::sal_Bool _matchallwordforms ) throw (uno::RuntimeException) +{ + // seems not accurate + mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ), uno::makeAny( _matchallwordforms ) ); + mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarityRelax") ), uno::makeAny( _matchallwordforms ) ); +} + +uno::Any SAL_CALL SwVbaFind::getStyle() throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); +} + +void SAL_CALL SwVbaFind::setStyle( const uno::Any& /*_style */ ) throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); +} + +sal_Bool SAL_CALL +SwVbaFind::Execute( const uno::Any& FindText, const uno::Any& MatchCase, const uno::Any& MatchWholeWord, const uno::Any& MatchWildcards, const uno::Any& MatchSoundsLike, const uno::Any& MatchAllWordForms, const uno::Any& Forward, const uno::Any& Wrap, const uno::Any& Format, const uno::Any& ReplaceWith, const uno::Any& Replace, const uno::Any& /*MatchKashida*/, const uno::Any& /*MatchDiacritics*/, const uno::Any& /*MatchAlefHamza*/, const uno::Any& /*MatchControl*/, const uno::Any& /*MatchPrefix*/, const uno::Any& /*MatchSuffix*/, const uno::Any& /*MatchPhrase*/, const uno::Any& /*IgnoreSpace*/, const uno::Any& /*IgnorePunct*/ ) throw (uno::RuntimeException) +{ + sal_Bool result = sal_False; + if( FindText.hasValue() ) + { + rtl::OUString sText; + FindText >>= sText; + setText( sText ); + } + + sal_Bool bValue = sal_False; + if( MatchCase.hasValue() ) + { + MatchCase >>= bValue; + setMatchCase( bValue ); + } + + if( MatchWholeWord.hasValue() ) + { + MatchWholeWord >>= bValue; + setMatchWholeWord( bValue ); + } + + if( MatchWildcards.hasValue() ) + { + MatchWildcards >>= bValue; + setMatchWildcards( bValue ); + } + + if( MatchSoundsLike.hasValue() ) + { + MatchSoundsLike >>= bValue; + setMatchSoundsLike( bValue ); + } + + if( MatchAllWordForms.hasValue() ) + { + MatchAllWordForms >>= bValue; + setMatchAllWordForms( bValue ); + } + + if( Forward.hasValue() ) + { + Forward >>= bValue; + setForward( bValue ); + } + + if( Wrap.hasValue() ) + { + sal_Int32 nWrapType = 0; + Wrap >>= nWrapType; + setWrap( nWrapType ); + } + + if( Format.hasValue() ) + { + Format >>= bValue; + setFormat( bValue ); + } + + if( ReplaceWith.hasValue() ) + { + rtl::OUString sValue; + ReplaceWith >>= sValue; + SetReplaceWith( sValue ); + } + + if( Replace.hasValue() ) + { + sal_Int32 nValue(0); + Replace >>= nValue; + SetReplace( nValue ); + } + + result = SearchReplace(); + + return result; +} + +void SAL_CALL +SwVbaFind::ClearFormatting( ) throw (uno::RuntimeException) +{ + uno::Sequence< beans::PropertyValue > aSearchAttribs; + mxPropertyReplace->setSearchAttributes( aSearchAttribs ); +} + +rtl::OUString& +SwVbaFind::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFind") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaFind::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Find" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbafind.hxx b/sw/source/ui/vba/vbafind.hxx new file mode 100644 index 0000000000..b274a19a02 --- /dev/null +++ b/sw/source/ui/vba/vbafind.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_FIND_HXX +#define SW_VBA_FIND_HXX + +#include <ooo/vba/word/XFind.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/util/XReplaceable.hpp> +#include <com/sun/star/util/XPropertyReplace.hpp> +#include <com/sun/star/text/XTextViewCursor.hpp> +#include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFind > SwVbaFind_BASE; + +class SwVbaFind : public SwVbaFind_BASE +{ +private: + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::text::XTextRange > mxTextRange; + css::uno::Reference< css::util::XReplaceable > mxReplaceable; + css::uno::Reference< css::util::XPropertyReplace> mxPropertyReplace; + css::uno::Reference< css::text::XTextViewCursor> mxTVC; + css::uno::Reference< css::view::XSelectionSupplier> mxSelSupp; + sal_Bool mbReplace; + sal_Int32 mnReplaceType; + sal_Int32 mnWrap; + +private: + sal_Bool InRange( const css::uno::Reference< css::text::XTextRange >& xCurrentRange ) throw ( css::uno::RuntimeException ); + sal_Bool InEqualRange( const css::uno::Reference< css::text::XTextRange >& xCurrentRange ) throw ( css::uno::RuntimeException ); + void SetReplace( sal_Int32 type ); + void SetReplaceWith( const rtl::OUString& rText ) throw ( css::uno::RuntimeException ); + rtl::OUString GetReplaceWith() throw ( css::uno::RuntimeException ); + rtl::OUString ReplaceWildcards( const rtl::OUString& rText ) throw ( css::uno::RuntimeException ); + css::uno::Reference< css::text::XTextRange > FindOneElement() throw ( css::uno::RuntimeException ); + sal_Bool SearchReplace() throw ( css::uno::RuntimeException ); + +public: + SwVbaFind( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaFind(); + + // Attributes + virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); + virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getReplacement() throw (css::uno::RuntimeException); + virtual void SAL_CALL setReplacement( const css::uno::Any& _replacement ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getForward() throw (css::uno::RuntimeException); + virtual void SAL_CALL setForward( ::sal_Bool _forward ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getWrap() throw (css::uno::RuntimeException); + virtual void SAL_CALL setWrap( ::sal_Int32 _wrap ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getFormat() throw (css::uno::RuntimeException); + virtual void SAL_CALL setFormat( ::sal_Bool _format ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getMatchCase() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMatchCase( ::sal_Bool _matchcase ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getMatchWholeWord() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMatchWholeWord( ::sal_Bool _matchwholeword ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getMatchWildcards() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMatchWildcards( ::sal_Bool _matchwildcards ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getMatchSoundsLike() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMatchSoundsLike( ::sal_Bool _matchsoundslike ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getMatchAllWordForms() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMatchAllWordForms( ::sal_Bool _matchallwordforms ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException); + virtual void SAL_CALL setStyle( const css::uno::Any& _style ) throw (css::uno::RuntimeException); + + // Methods + virtual ::sal_Bool SAL_CALL Execute( const css::uno::Any& FindText, const css::uno::Any& MatchCase, const css::uno::Any& MatchWholeWord, const css::uno::Any& MatchWildcards, const css::uno::Any& MatchSoundsLike, const css::uno::Any& MatchAllWordForms, const css::uno::Any& Forward, const css::uno::Any& Wrap, const css::uno::Any& Format, const css::uno::Any& ReplaceWith, const css::uno::Any& Replace, const css::uno::Any& MatchKashida, const css::uno::Any& MatchDiacritics, const css::uno::Any& MatchAlefHamza, const css::uno::Any& MatchControl, const css::uno::Any& MatchPrefix, const css::uno::Any& MatchSuffix, const css::uno::Any& MatchPhrase, const css::uno::Any& IgnoreSpace, const css::uno::Any& IgnorePunct ) throw (css::uno::RuntimeException); + virtual void SAL_CALL ClearFormatting( ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_FIND_HXX */ diff --git a/sw/source/ui/vba/vbafont.cxx b/sw/source/ui/vba/vbafont.cxx new file mode 100644 index 0000000000..4855d923ff --- /dev/null +++ b/sw/source/ui/vba/vbafont.cxx @@ -0,0 +1,216 @@ +#include "vbafont.hxx" +#include <com/sun/star/awt/FontUnderline.hpp> +#include <ooo/vba/word/WdUnderline.hpp> +#include <hash_map> +#include <ooo/vba/word/WdColorIndex.hpp> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +const uno::Any aLongAnyTrue( sal_Int16(-1) ); +const uno::Any aLongAnyFalse( sal_Int16( 0 ) ); + +struct MapPair +{ + sal_Int32 nMSOConst; + sal_Int32 nOOOConst; +}; + +static MapPair UnderLineTable[] = { + { word::WdUnderline::wdUnderlineNone, com::sun::star::awt::FontUnderline::NONE }, + { word::WdUnderline::wdUnderlineSingle, com::sun::star::awt::FontUnderline::SINGLE }, + { word::WdUnderline::wdUnderlineWords, com::sun::star::awt::FontUnderline::SINGLE }, + { word::WdUnderline::wdUnderlineDouble, com::sun::star::awt::FontUnderline::DOUBLE }, + { word::WdUnderline::wdUnderlineDotted, com::sun::star::awt::FontUnderline::DOTTED }, + { word::WdUnderline::wdUnderlineThick, com::sun::star::awt::FontUnderline::BOLDDASH }, + { word::WdUnderline::wdUnderlineDash, com::sun::star::awt::FontUnderline::DASH }, + { word::WdUnderline::wdUnderlineDotDash, com::sun::star::awt::FontUnderline::DASHDOT }, + { word::WdUnderline::wdUnderlineDotDotDash, com::sun::star::awt::FontUnderline::DASHDOTDOT }, + { word::WdUnderline::wdUnderlineWavy, com::sun::star::awt::FontUnderline::WAVE }, + { word::WdUnderline::wdUnderlineDottedHeavy, com::sun::star::awt::FontUnderline::BOLDDOTTED }, + { word::WdUnderline::wdUnderlineDashHeavy, com::sun::star::awt::FontUnderline::BOLDDASH }, + { word::WdUnderline::wdUnderlineDotDashHeavy, com::sun::star::awt::FontUnderline::BOLDDASHDOT }, + { word::WdUnderline::wdUnderlineDotDotDashHeavy, com::sun::star::awt::FontUnderline::BOLDDASHDOTDOT }, + { word::WdUnderline::wdUnderlineWavyHeavy, com::sun::star::awt::FontUnderline::BOLDWAVE }, + { word::WdUnderline::wdUnderlineDashLong, com::sun::star::awt::FontUnderline::LONGDASH }, + { word::WdUnderline::wdUnderlineWavyDouble, com::sun::star::awt::FontUnderline::DOUBLEWAVE }, + { word::WdUnderline::wdUnderlineDashLongHeavy, com::sun::star::awt::FontUnderline::BOLDLONGDASH }, +}; + +typedef std::hash_map< sal_Int32, sal_Int32 > ConstToConst; +class UnderLineMapper +{ + ConstToConst MSO2OOO; + ConstToConst OOO2MSO; +private: + UnderLineMapper() + { + sal_Int32 nLen = sizeof( UnderLineTable )/ sizeof( UnderLineTable[0] ); + + for ( sal_Int32 index=0; index<nLen; ++index ) + { + MSO2OOO[ UnderLineTable[ index ].nMSOConst ] = UnderLineTable[ index ].nOOOConst; + OOO2MSO[ UnderLineTable[ index ].nOOOConst ] = UnderLineTable[ index ].nMSOConst; + } + } +public: + static rtl::OUString propName() + { + static rtl::OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("CharUnderline") ); + return sPropName; + } + + static UnderLineMapper& instance() + { + static UnderLineMapper theMapper; + return theMapper; + } + + sal_Int32 getOOOFromMSO( sal_Int32 nMSOConst ) throw( lang::IllegalArgumentException ) + { + ConstToConst::iterator it = MSO2OOO.find( nMSOConst ); + if ( it == MSO2OOO.end() ) + throw lang::IllegalArgumentException(); + return it->second; + } + sal_Int32 getMSOFromOOO( sal_Int32 nOOOConst ) throw( lang::IllegalArgumentException ) + { + ConstToConst::iterator it = OOO2MSO.find( nOOOConst ); + if ( it == OOO2MSO.end() ) + throw lang::IllegalArgumentException(); + return it->second; + } +}; + +SwVbaFont::SwVbaFont( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPalette, uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException ) : SwVbaFont_BASE( xParent, xContext, xPalette, xPropertySet ) +{ +} + +uno::Any SAL_CALL +SwVbaFont::getUnderline() throw (uno::RuntimeException) +{ + sal_Int32 nOOVal = 0; + mxFont->getPropertyValue( UnderLineMapper::propName() ) >>= nOOVal; + return uno::makeAny( UnderLineMapper::instance().getMSOFromOOO( nOOVal ) ); +} + +void SAL_CALL +SwVbaFont::setUnderline( const uno::Any& _underline ) throw (uno::RuntimeException) +{ + sal_Int32 nMSOVal = 0; + + if ( _underline >>= nMSOVal ) + { + sal_Int32 nOOVal = UnderLineMapper::instance().getOOOFromMSO( nMSOVal ); + mxFont->setPropertyValue( UnderLineMapper::propName(), uno::makeAny( nOOVal ) ); + } +} + +rtl::OUString& +SwVbaFont::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFont") ); + return sImplName; +} + +void SAL_CALL +SwVbaFont::setColorIndex( const uno::Any& _colorindex ) throw( uno::RuntimeException ) +{ + sal_Int32 nIndex = 0; + _colorindex >>= nIndex; + return setColor( OORGBToXLRGB(mxPalette->getByIndex( nIndex )) ); +} + +uno::Any SAL_CALL +SwVbaFont::getColorIndex() throw ( uno::RuntimeException ) +{ + sal_Int32 nColor = 0; + + XLRGBToOORGB( getColor() ) >>= nColor; + sal_Int32 nElems = mxPalette->getCount(); + sal_Int32 nIndex = 0; + for ( sal_Int32 count=0; count<nElems; ++count ) + { + sal_Int32 nPaletteColor = 0; + mxPalette->getByIndex( count ) >>= nPaletteColor; + if ( nPaletteColor == nColor ) + { + nIndex = count; + break; + } + } + return uno::makeAny( nIndex ); +} +uno::Any SAL_CALL +SwVbaFont::getSubscript() throw ( uno::RuntimeException ) +{ + sal_Bool bRes = sal_False; + SwVbaFont_BASE::getSubscript() >>= bRes; + if ( bRes ) + return aLongAnyTrue; + return aLongAnyFalse; +} + +uno::Any SAL_CALL +SwVbaFont::getSuperscript() throw ( uno::RuntimeException ) +{ + sal_Bool bRes = sal_False; + SwVbaFont_BASE::getSuperscript() >>= bRes; + if ( bRes ) + return aLongAnyTrue; + return aLongAnyFalse; +} + +uno::Any SAL_CALL +SwVbaFont::getBold() throw (uno::RuntimeException) +{ + sal_Bool bRes = sal_False; + SwVbaFont_BASE::getBold() >>= bRes; + if ( bRes ) + return aLongAnyTrue; + return aLongAnyFalse; +} + +uno::Any SAL_CALL +SwVbaFont::getItalic() throw (uno::RuntimeException) +{ + sal_Bool bRes = sal_False; + SwVbaFont_BASE::getItalic() >>= bRes; + if ( bRes ) + return aLongAnyTrue; + return aLongAnyFalse; +} + +uno::Any SAL_CALL +SwVbaFont::getStrikethrough() throw (css::uno::RuntimeException) +{ + sal_Bool bRes = sal_False; + SwVbaFont_BASE::getStrikethrough() >>= bRes; + if ( bRes ) + return aLongAnyTrue; + return aLongAnyFalse; +} + +uno::Any SAL_CALL +SwVbaFont::getShadow() throw (uno::RuntimeException) +{ + sal_Bool bRes = sal_False; + SwVbaFont_BASE::getShadow() >>= bRes; + if ( bRes ) + return aLongAnyTrue; + return aLongAnyFalse; +} + +uno::Sequence< rtl::OUString > +SwVbaFont::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Font" ) ); + } + return aServiceNames; +} + + diff --git a/sw/source/ui/vba/vbafont.hxx b/sw/source/ui/vba/vbafont.hxx new file mode 100644 index 0000000000..b684daa58b --- /dev/null +++ b/sw/source/ui/vba/vbafont.hxx @@ -0,0 +1,31 @@ +#ifndef VBA_FONT_HXX +#define VBA_FONT_HXX + +#include <vbahelper/vbafontbase.hxx> +#include <ooo/vba/word/XFont.hpp> + +typedef cppu::ImplInheritanceHelper1< VbaFontBase, ov::word::XFont > SwVbaFont_BASE; + +class SwVbaFont : public SwVbaFont_BASE +{ +public: + SwVbaFont( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPalette, css::uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaFont(){} + + // Attributes + virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getColorIndex() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getUnderline() throw (css::uno::RuntimeException); + virtual void SAL_CALL setUnderline( const css::uno::Any& _underline ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getSubscript() throw ( css::uno::RuntimeException ); + virtual css::uno::Any SAL_CALL getSuperscript() throw ( css::uno::RuntimeException ); + + virtual css::uno::Any SAL_CALL getBold() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getItalic() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getStrikethrough() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getShadow() throw (css::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif diff --git a/sw/source/ui/vba/vbaglobals.cxx b/sw/source/ui/vba/vbaglobals.cxx new file mode 100644 index 0000000000..ac143ed878 --- /dev/null +++ b/sw/source/ui/vba/vbaglobals.cxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbaglobals.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <vbahelper/helperdecl.hxx> +#include "vbaglobals.hxx" + +#include <comphelper/unwrapargs.hxx> + +#include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <cppuhelper/bootstrap.hxx> +#include "vbaapplication.hxx" +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::ooo::vba; + + +rtl::OUString sDocCtxName( RTL_CONSTASCII_USTRINGPARAM("WordDocumentContext") ); + +// ============================================================================= +// SwVbaGlobals +// ============================================================================= + +SwVbaGlobals::SwVbaGlobals( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& rxContext ) : SwVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext, sDocCtxName ) +{ + OSL_TRACE("SwVbaGlobals::SwVbaGlobals()"); + uno::Sequence< beans::PropertyValue > aInitArgs( 2 ); + aInitArgs[ 0 ].Name = rtl::OUString::createFromAscii("Application"); + aInitArgs[ 0 ].Value = uno::makeAny( getApplication() ); + aInitArgs[ 1 ].Name = sDocCtxName; + aInitArgs[ 1 ].Value = uno::makeAny( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ) ); + + init( aInitArgs ); +} + +SwVbaGlobals::~SwVbaGlobals() +{ + OSL_TRACE("SwVbaGlobals::~SwVbaGlobals"); +} + +// ============================================================================= +// XGlobals +// ============================================================================= +uno::Reference<word::XApplication > +SwVbaGlobals::getApplication() throw (uno::RuntimeException) +{ + OSL_TRACE("In SwVbaGlobals::getApplication"); + if ( !mxApplication.is() ) + mxApplication.set( new SwVbaApplication( mxContext) ); + + return mxApplication; +} + +uno::Reference<word::XSystem > SAL_CALL +SwVbaGlobals::getSystem() throw (uno::RuntimeException) +{ + return getApplication()->getSystem(); +} + +uno::Reference< word::XDocument > SAL_CALL +SwVbaGlobals::getActiveDocument() throw (uno::RuntimeException) +{ + return getApplication()->getActiveDocument(); +} + +uno::Reference< word::XWindow > SAL_CALL +SwVbaGlobals::getActiveWindow() throw (uno::RuntimeException) +{ + return getApplication()->getActiveWindow(); +} + +rtl::OUString SAL_CALL +SwVbaGlobals::getName() throw (uno::RuntimeException) +{ + return getApplication()->getName(); +} + +uno::Reference<word::XOptions > SAL_CALL +SwVbaGlobals::getOptions() throw (uno::RuntimeException) +{ + return getApplication()->getOptions(); +} + +uno::Any SAL_CALL +SwVbaGlobals::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException) +{ + return getApplication()->CommandBars( aIndex ); +} + +uno::Any SAL_CALL +SwVbaGlobals::Documents( const uno::Any& index ) throw (uno::RuntimeException) +{ + return getApplication()->Documents( index ); +} + +uno::Any SAL_CALL +SwVbaGlobals::Addins( const uno::Any& index ) throw (uno::RuntimeException) +{ + return getApplication()->Addins( index ); +} + +uno::Any SAL_CALL +SwVbaGlobals::Dialogs( const uno::Any& index ) throw (uno::RuntimeException) +{ + return getApplication()->Dialogs( index ); +} + +uno::Reference<word::XSelection > SAL_CALL +SwVbaGlobals::getSelection() throw (uno::RuntimeException) +{ + return getApplication()->getSelection(); +} + +float SAL_CALL SwVbaGlobals::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException) +{ + return getApplication()->CentimetersToPoints( _Centimeters ); +} + +rtl::OUString& +SwVbaGlobals::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaGlobals") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaGlobals::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Globals" ) ); + } + return aServiceNames; +} + +uno::Sequence< rtl::OUString > +SwVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException) +{ + static bool bInit = false; + static uno::Sequence< rtl::OUString > serviceNames( SwVbaGlobals_BASE::getAvailableServiceNames() ); + if ( !bInit ) + { + rtl::OUString names[] = { + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.word.Document" ) ), +// #FIXME #TODO make Application a proper service +// ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.word.Application" ) ), + }; + sal_Int32 nWordServices = ( sizeof( names )/ sizeof( names[0] ) ); + sal_Int32 startIndex = serviceNames.getLength(); + serviceNames.realloc( serviceNames.getLength() + nWordServices ); + for ( sal_Int32 index = 0; index < nWordServices; ++index ) + serviceNames[ startIndex + index ] = names[ index ]; + bInit = true; + } + return serviceNames; +} + +namespace globals +{ +namespace sdecl = comphelper::service_decl; +sdecl::vba_service_class_<SwVbaGlobals, sdecl::with_args<true> > serviceImpl; +extern sdecl::ServiceDecl const serviceDecl( + serviceImpl, + "SwVbaGlobals", + "ooo.vba.word.Globals" ); +} + diff --git a/sw/source/ui/vba/vbaglobals.hxx b/sw/source/ui/vba/vbaglobals.hxx new file mode 100644 index 0000000000..1123dafa33 --- /dev/null +++ b/sw/source/ui/vba/vbaglobals.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbaglobals.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_GLOBALS_HXX +#define SW_VBA_GLOBALS_HXX + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <ooo/vba/word/XGlobals.hpp> +#include <ooo/vba/word/XApplication.hpp> +#include <ooo/vba/word/XSystem.hpp> +#include <ooo/vba/word/XOptions.hpp> +#include <ooo/vba/word/XSelection.hpp> +#include <cppuhelper/implbase1.hxx> +#include <vbahelper/vbahelper.hxx> +#include <vbahelper/vbaglobalbase.hxx> + +// ============================================================================= +// class SwVbaGlobals +// ============================================================================= + + +typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::word::XGlobals > SwVbaGlobals_BASE; + +class SwVbaGlobals : public SwVbaGlobals_BASE +{ +private: + css::uno::Reference< ooo::vba::word::XApplication > mxApplication; + + virtual css::uno::Reference< ooo::vba::word::XApplication > getApplication() throw (css::uno::RuntimeException); + +public: + + SwVbaGlobals( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& rxContext ); + virtual ~SwVbaGlobals(); + + // XGlobals + virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::word::XDocument > SAL_CALL getActiveDocument() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ov::word::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException); + // XMultiServiceFactory + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_GLOBALS_HXX */ diff --git a/sw/source/ui/vba/vbaheaderfooter.cxx b/sw/source/ui/vba/vbaheaderfooter.cxx new file mode 100644 index 0000000000..954834d7c1 --- /dev/null +++ b/sw/source/ui/vba/vbaheaderfooter.cxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaheaderfooter.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include <ooo/vba/word/WdHeaderFooterIndex.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include "vbarange.hxx" +#include <vbahelper/vbashapes.hxx> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaHeaderFooter::SwVbaHeaderFooter( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rProps, sal_Bool isHeader, sal_Int32 index ) throw ( uno::RuntimeException ) : SwVbaHeaderFooter_BASE( rParent, rContext ), mxModel( xModel ), mxPageStyleProps( rProps ), mbHeader( isHeader ), mnIndex( index ) +{ +} + +sal_Bool SAL_CALL SwVbaHeaderFooter::getIsHeader() throw (uno::RuntimeException) +{ + return mbHeader; +} + +sal_Bool SAL_CALL SwVbaHeaderFooter::getLinkToPrevious() throw (uno::RuntimeException) +{ + // seems always false + return sal_False; +} + +void SAL_CALL SwVbaHeaderFooter::setLinkToPrevious( ::sal_Bool /*_linktoprevious*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +uno::Reference< word::XRange > SAL_CALL SwVbaHeaderFooter::getRange() throw (uno::RuntimeException) +{ + rtl::OUString sPropsNameText; + if( mbHeader ) + { + sPropsNameText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") ); + } + else + { + sPropsNameText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") ); + } + if( mnIndex == word::WdHeaderFooterIndex::wdHeaderFooterEvenPages ) + { + sPropsNameText.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left") ) ); + } + + uno::Reference< text::XText > xText( mxPageStyleProps->getPropertyValue( sPropsNameText ), uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW ); + return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, xDocument, xText->getStart(), xText->getEnd(), xText ) ); +} + +uno::Any SAL_CALL +SwVbaHeaderFooter::Shapes( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW ); + //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); + uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess, mxModel ) ); + if ( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +rtl::OUString& +SwVbaHeaderFooter::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaHeaderFooter") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaHeaderFooter::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Pane" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbaheaderfooter.hxx b/sw/source/ui/vba/vbaheaderfooter.hxx new file mode 100644 index 0000000000..264aab8e61 --- /dev/null +++ b/sw/source/ui/vba/vbaheaderfooter.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_HEADERFOOTER_HXX +#define SW_VBA_HEADERFOOTER_HXX + +#include <ooo/vba/word/XHeaderFooter.hpp> +#include <ooo/vba/word/XRange.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XHeaderFooter > SwVbaHeaderFooter_BASE; + +class SwVbaHeaderFooter : public SwVbaHeaderFooter_BASE +{ +private: + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::beans::XPropertySet > mxPageStyleProps; + sal_Bool mbHeader; + sal_Int32 mnIndex; + +public: + SwVbaHeaderFooter( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps, sal_Bool isHeader, sal_Int32 index ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaHeaderFooter(){} + + // Attributes + virtual ::sal_Bool SAL_CALL getIsHeader() throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getLinkToPrevious() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLinkToPrevious( ::sal_Bool _linktoprevious ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL getRange() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Shapes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_HEADERFOOTER_HXX */ diff --git a/sw/source/ui/vba/vbaheaderfooterhelper.cxx b/sw/source/ui/vba/vbaheaderfooterhelper.cxx new file mode 100644 index 0000000000..4069b85691 --- /dev/null +++ b/sw/source/ui/vba/vbaheaderfooterhelper.cxx @@ -0,0 +1,178 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaheaderfooterhelper.hxx" +#include "wordvbahelper.hxx" +#include <comphelper/processfactory.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/text/XTextViewCursorSupplier.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/container/XNameAccess.hpp> + +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +#define FIRST_PAGE 1; + +// Class HeaderFooterHelper + +sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) +{ + uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); + + sal_Bool isOn = sal_False; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn; + if( !isOn ) + return sal_False; + + sal_Bool isShared = sal_False; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared; + + rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") ); + if( !isShared ) + { + if( 0 == xPageCursor->getPage() % 2 ) + { + aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") ); + } + else + { + aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") ); + } + } + + uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW ); + //FIXME: can not compare in this way? + return ( xText == xCurrentText ); +} + +sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) +{ + if( isHeader( xModel, xCurrentText ) ) + { + uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); + // FIXME: getPage allways returns 1 + sal_Int32 nPage = xPageCursor->getPage(); + return nPage == FIRST_PAGE; + } + return sal_False; +} + +sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) +{ + if( isHeader( xModel, xCurrentText ) ) + { + uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); + sal_Bool isShared = sal_False; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared; + if( !isShared ) + { + uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); + return ( 0 == xPageCursor->getPage() % 2 ); + } + } + return sal_False; +} + +sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) +{ + uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); + + sal_Bool isOn = sal_False; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn; + if( !isOn ) + return sal_False; + + sal_Bool isShared = sal_False; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared; + + rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") ); + if( !isShared ) + { + if( 0 == xPageCursor->getPage() % 2 ) + { + aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") ); + } + else + { + aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") ); + } + } + + uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW ); + + return ( xText == xCurrentText ); +} + +sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) +{ + if( isFooter( xModel, xCurrentText ) ) + { + uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); + sal_Int32 nPage = xPageCursor->getPage(); + return nPage == FIRST_PAGE; + } + return sal_False; +} + +sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) +{ + if( isFooter( xModel, xCurrentText ) ) + { + uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); + sal_Bool isShared = sal_False; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared; + if( !isShared ) + { + uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); + return ( 0 == xPageCursor->getPage() % 2 ); + } + } + return sal_False; +} + +sal_Bool HeaderFooterHelper::isPrimaryHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) +{ + if( isHeader( xModel, xCurrentText ) ) + { + return( !( isFirstPageHeader( xModel, xCurrentText ) && isEvenPagesHeader( xModel, xCurrentText ) ) ); + } + return sal_False; +} + +sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) +{ + if( isHeader( xModel, xCurrentText ) ) + { + return( !( isFirstPageFooter( xModel, xCurrentText ) && isEvenPagesFooter( xModel, xCurrentText ) ) ); + } + return sal_False; +} diff --git a/sw/source/ui/vba/vbaheaderfooterhelper.hxx b/sw/source/ui/vba/vbaheaderfooterhelper.hxx new file mode 100644 index 0000000000..2dffc59b61 --- /dev/null +++ b/sw/source/ui/vba/vbaheaderfooterhelper.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelper.hxx,v $ + * $Revision: 1.5.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_WORD_VBA_HEADERFOOTERHELPER_HXX +#define SW_WORD_VBA_HEADERFOOTERHELPER_HXX + +#include <vbahelper/vbahelper.hxx> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XTextViewCursor.hpp> +#include <com/sun/star/text/XPageCursor.hpp> +#include <com/sun/star/style/XStyle.hpp> + +class HeaderFooterHelper +{ +public: + static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); + static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); + static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); + static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); + static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); + static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); + static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); + static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); +}; + +#endif diff --git a/sw/source/ui/vba/vbainformationhelper.cxx b/sw/source/ui/vba/vbainformationhelper.cxx new file mode 100644 index 0000000000..e062ed09bb --- /dev/null +++ b/sw/source/ui/vba/vbainformationhelper.cxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbainformationhelper.hxx" +#include <com/sun/star/text/XPageCursor.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include "wordvbahelper.hxx" +#include <docsh.hxx> +#include <doc.hxx> +#include <vbahelper/vbahelper.hxx> +#include <swtypes.hxx> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +static const sal_Int32 DEFAULT_PAGE_DISTANCE = 500; + +sal_Int32 SwVbaInformationHelper::handleWdActiveEndPageNumber( const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException ) +{ + uno::Reference< text::XPageCursor > xPageCursor( xTVCursor, uno::UNO_QUERY_THROW ); + return xPageCursor->getPage(); +} + +sal_Int32 SwVbaInformationHelper::handleWdNumberOfPagesInDocument( const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException ) +{ + return word::getPageCount( xModel ); +} + +double SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException ) +{ + xTVCursor->collapseToStart(); + uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); + sal_Int32 nTopMargin = 0; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ) ) >>= nTopMargin; + sal_Int32 nCurrentPos = xTVCursor->getPosition().Y; + + sal_Int32 nCurrentPage = handleWdActiveEndPageNumber( xTVCursor ); + sal_Int32 nPageHeight = word::getDocShell( xModel )->GetDoc()->GetPageSize( nCurrentPage, sal_False ).Height(); + // FIXME: handle multipul page style + // it is very strange that the curros position is incorrect when open Word file. + // e.g. if current cursor in the top left of the text body of the first page without header, + // the top value of current position should be 0, but is 201 when open a Word file. + nCurrentPos = nCurrentPos + nTopMargin - ( DEFAULT_PAGE_DISTANCE + TWIP_TO_MM100( nPageHeight ) ) * ( nCurrentPage - 1 ); + return Millimeter::getInPoints( nCurrentPos ); +} diff --git a/sw/source/ui/vba/vbainformationhelper.hxx b/sw/source/ui/vba/vbainformationhelper.hxx new file mode 100644 index 0000000000..96241bb75e --- /dev/null +++ b/sw/source/ui/vba/vbainformationhelper.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_INFORMATIONHELPER_HXX +#define SW_VBA_INFORMATIONHELPER_HXX + +#include <vbahelper/vbahelperinterface.hxx> +#include <com/sun/star/text/XTextViewCursor.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +class SwVbaInformationHelper +{ +public: + static sal_Int32 handleWdActiveEndPageNumber( const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException ); + static sal_Int32 handleWdNumberOfPagesInDocument( const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException ); + static double handleWdVerticalPositionRelativeToPage( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException ); + //static double verticalPositionRelativeToPageBoundary( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor, const css::uno::Reference< css::beans::XPropertySet >& xStyleProps ) throw( css::uno::RuntimeException ); + +}; +#endif /* SW_VBA_INFORMATIONHELPER_HXX */ diff --git a/sw/source/ui/vba/vbaoptions.cxx b/sw/source/ui/vba/vbaoptions.cxx new file mode 100644 index 0000000000..d6efc4d831 --- /dev/null +++ b/sw/source/ui/vba/vbaoptions.cxx @@ -0,0 +1,287 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microoptionss, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaoptions.hxx" +#include <vbahelper/vbahelper.hxx> +#include <ooo/vba/word/WdDefaultFilePath.hpp> +#include <ooo/vba/word/WdLineStyle.hpp> +#include <ooo/vba/word/WdLineWidth.hpp> +#include <ooo/vba/word/WdColorIndex.hpp> +#include <com/sun/star/util/XStringSubstitution.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <osl/file.hxx> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaOptions::SwVbaOptions( uno::Reference<uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : SwVbaOptions_BASE( uno::Reference< XHelperInterface >(), xContext ) +{ + mxFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); +} + +SwVbaOptions::~SwVbaOptions() +{ +} + +uno::Any SAL_CALL +SwVbaOptions::DefaultFilePath( sal_Int32 _path ) throw ( uno::RuntimeException ) +{ + switch( _path ) + { + case word::WdDefaultFilePath::wdDocumentsPath: + { + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Work") ); + break; + } + case word::WdDefaultFilePath::wdPicturesPath: + { + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Gallery") ); + break; + } + case word::WdDefaultFilePath::wdUserTemplatesPath: + case word::WdDefaultFilePath::wdWorkgroupTemplatesPath: + { + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Template") ); + break; + } + case word::WdDefaultFilePath::wdStartupPath: + { + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Addin") ); + break; + } + case word::WdDefaultFilePath::wdUserOptionsPath: + { + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserConfig") ); + break; + } + case word::WdDefaultFilePath::wdToolsPath: + case word::WdDefaultFilePath::wdProgramPath: + { + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Module") ); + break; + } + case word::WdDefaultFilePath::wdTempFilePath: + { + msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Temp") ); + break; + } + default: + { + DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() ); + break; + } + } + return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( this ) ) ); +} + +void SwVbaOptions::setValueEvent( const uno::Any& value ) +{ + rtl::OUString sNewPath; + value >>= sNewPath; + rtl::OUString sNewPathUrl; + ::osl::File::getFileURLFromSystemPath( sNewPath, sNewPathUrl ); + uno::Reference< beans::XPropertySet > xPathSettings( mxFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.PathSettings") ), uno::UNO_QUERY_THROW ); + rtl::OUString sOldPathUrl; + xPathSettings->getPropertyValue( msDefaultFilePath ) >>= sOldPathUrl; + // path could be a multipath, Microsoft doesn't support this feature in Word currently + // only the last path is from interest. + sal_Int32 nIndex = sOldPathUrl.lastIndexOf( sal_Unicode(';') ); + if( nIndex != -1 ) + { + sNewPathUrl = sOldPathUrl.copy( 0, nIndex + 1 ).concat( sNewPathUrl ); + } + xPathSettings->setPropertyValue( msDefaultFilePath, uno::makeAny( sNewPathUrl ) ); +} + +uno::Any SwVbaOptions::getValueEvent() +{ + uno::Reference< beans::XPropertySet > xPathSettings( mxFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.PathSettings") ), uno::UNO_QUERY_THROW ); + rtl::OUString sPathUrl; + xPathSettings->getPropertyValue( msDefaultFilePath ) >>= sPathUrl; + // path could be a multipath, Microsoft doesn't support this feature in Word currently + // only the last path is from interest. + sal_Int32 nIndex = sPathUrl.lastIndexOf( sal_Unicode(';') ); + if( nIndex != -1 ) + { + sPathUrl = sPathUrl.copy( nIndex + 1 ); + } + rtl::OUString sPath; + ::osl::File::getSystemPathFromFileURL( sPathUrl, sPath ); + return uno::makeAny( sPath ); +} + +sal_Int32 SAL_CALL SwVbaOptions::getDefaultBorderLineStyle() throw (uno::RuntimeException) +{ + return word::WdLineStyle::wdLineStyleSingle; +} + +void SAL_CALL SwVbaOptions::setDefaultBorderLineStyle( ::sal_Int32 /*_defaultborderlinestyle*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +sal_Int32 SAL_CALL SwVbaOptions::getDefaultBorderLineWidth() throw (uno::RuntimeException) +{ + return word::WdLineWidth::wdLineWidth050pt; +} + +void SAL_CALL SwVbaOptions::setDefaultBorderLineWidth( ::sal_Int32 /*_defaultborderlinewidth*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +sal_Int32 SAL_CALL SwVbaOptions::getDefaultBorderColorIndex() throw (uno::RuntimeException) +{ + return word::WdColorIndex::wdAuto; +} + +void SAL_CALL SwVbaOptions::setDefaultBorderColorIndex( ::sal_Int32 /*_defaultbordercolorindex*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +::sal_Bool SAL_CALL SwVbaOptions::getReplaceSelection() throw (uno::RuntimeException) +{ + return sal_True; +} + +void SAL_CALL SwVbaOptions::setReplaceSelection( ::sal_Bool /*_replaceselection*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +::sal_Bool SAL_CALL SwVbaOptions::getMapPaperSize() throw (uno::RuntimeException) +{ + return sal_False; +} + +void SAL_CALL SwVbaOptions::setMapPaperSize( ::sal_Bool /*_mappapersize*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeApplyHeadings() throw (uno::RuntimeException) +{ + return sal_False; +} + +void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeApplyHeadings( ::sal_Bool /*_autoformatasyoutypeapplyheadings*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeApplyBulletedLists() throw (uno::RuntimeException) +{ + return sal_False; +} + +void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeApplyBulletedLists( ::sal_Bool /*_autoformatasyoutypeapplybulletedlists*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeApplyNumberedLists() throw (uno::RuntimeException) +{ + return sal_False; +} + +void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeApplyNumberedLists( ::sal_Bool /*_autoformatasyoutypeapplynumberedlists*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeFormatListItemBeginning() throw (uno::RuntimeException) +{ + return sal_False; +} + +void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeFormatListItemBeginning( ::sal_Bool /*_autoformatasyoutypeformatlistitembeginning*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeDefineStyles() throw (uno::RuntimeException) +{ + return sal_False; +} + +void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeDefineStyles( ::sal_Bool /*_autoformatasyoutypedefinestyles*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatApplyHeadings() throw (uno::RuntimeException) +{ + return sal_False; +} + +void SAL_CALL SwVbaOptions::setAutoFormatApplyHeadings( ::sal_Bool /*_autoformatapplyheadings*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatApplyLists() throw (uno::RuntimeException) +{ + return sal_False; +} + +void SAL_CALL SwVbaOptions::setAutoFormatApplyLists( ::sal_Bool /*_autoformatapplylists*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + +::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatApplyBulletedLists() throw (uno::RuntimeException) +{ + return sal_False; +} + +void SAL_CALL SwVbaOptions::setAutoFormatApplyBulletedLists( ::sal_Bool /*_autoformatapplybulletedlists*/ ) throw (uno::RuntimeException) +{ + // not support in Writer +} + + +rtl::OUString& +SwVbaOptions::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaOptions") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaOptions::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Options" ) ); + } + return aServiceNames; +} diff --git a/sw/source/ui/vba/vbaoptions.hxx b/sw/source/ui/vba/vbaoptions.hxx new file mode 100644 index 0000000000..77ed77453b --- /dev/null +++ b/sw/source/ui/vba/vbaoptions.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbasystem.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_OPTIONS_HXX +#define SW_VBA_OPTIONS_HXX + +#include <ooo/vba/word/XOptions.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> +#include <vbahelper/vbapropvalue.hxx> +#include <comphelper/processfactory.hxx> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XOptions > SwVbaOptions_BASE; + +class SwVbaOptions : public SwVbaOptions_BASE, + public PropListener +{ +private: + rtl::OUString msDefaultFilePath; + css::uno::Reference< css::lang::XMultiServiceFactory > mxFactory; +public: + SwVbaOptions( css::uno::Reference< css::uno::XComponentContext >& m_xContext ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaOptions(); + + // Attributes + virtual ::sal_Int32 SAL_CALL getDefaultBorderLineStyle() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDefaultBorderLineStyle( ::sal_Int32 _defaultborderlinestyle ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getDefaultBorderLineWidth() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDefaultBorderLineWidth( ::sal_Int32 _defaultborderlinewidth ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getDefaultBorderColorIndex() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDefaultBorderColorIndex( ::sal_Int32 _defaultbordercolorindex ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getReplaceSelection() throw (css::uno::RuntimeException); + virtual void SAL_CALL setReplaceSelection( ::sal_Bool _replaceselection ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getMapPaperSize() throw (css::uno::RuntimeException); + virtual void SAL_CALL setMapPaperSize( ::sal_Bool _mappapersize ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeApplyHeadings() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAutoFormatAsYouTypeApplyHeadings( ::sal_Bool _autoformatasyoutypeapplyheadings ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeApplyBulletedLists() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAutoFormatAsYouTypeApplyBulletedLists( ::sal_Bool _autoformatasyoutypeapplybulletedlists ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeApplyNumberedLists() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAutoFormatAsYouTypeApplyNumberedLists( ::sal_Bool _autoformatasyoutypeapplynumberedlists ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeFormatListItemBeginning() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAutoFormatAsYouTypeFormatListItemBeginning( ::sal_Bool _autoformatasyoutypeformatlistitembeginning ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeDefineStyles() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAutoFormatAsYouTypeDefineStyles( ::sal_Bool _autoformatasyoutypedefinestyles ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getAutoFormatApplyHeadings() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAutoFormatApplyHeadings( ::sal_Bool _autoformatapplyheadings ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getAutoFormatApplyLists() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAutoFormatApplyLists( ::sal_Bool _autoformatapplylists ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getAutoFormatApplyBulletedLists() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAutoFormatApplyBulletedLists( ::sal_Bool _autoformatapplybulletedlists ) throw (css::uno::RuntimeException); + + // Methods + virtual css::uno::Any SAL_CALL DefaultFilePath( sal_Int32 _path ) throw ( css::uno::RuntimeException ); + + //PropListener + virtual void setValueEvent( const css::uno::Any& value ); + virtual css::uno::Any getValueEvent(); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_OPTIONS_HXX */ diff --git a/sw/source/ui/vba/vbapagesetup.cxx b/sw/source/ui/vba/vbapagesetup.cxx new file mode 100644 index 0000000000..1403d05063 --- /dev/null +++ b/sw/source/ui/vba/vbapagesetup.cxx @@ -0,0 +1,275 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbapagesetup.hxx" +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XPageCursor.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <ooo/vba/word/WdSectionStart.hpp> +#include <ooo/vba/word/WdOrientation.hpp> +#include "wordvbahelper.hxx" + +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +SwVbaPageSetup::SwVbaPageSetup(const uno::Reference< XHelperInterface >& xParent, + const uno::Reference< uno::XComponentContext >& xContext, + const uno::Reference< frame::XModel >& xModel, + const uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException): + SwVbaPageSetup_BASE( xParent, xContext ) +{ + mxModel.set( xModel, uno::UNO_QUERY_THROW ); + mxPageProps.set( xProps, uno::UNO_QUERY_THROW ); + mnOrientPortrait = word::WdOrientation::wdOrientPortrait; + mnOrientLandscape = word::WdOrientation::wdOrientLandscape; +} + +double SAL_CALL SwVbaPageSetup::getGutter() throw (uno::RuntimeException) +{ + // not support in Writer + return 0; +} + +void SAL_CALL SwVbaPageSetup::setGutter( double _gutter ) throw (uno::RuntimeException) +{ + // default add gutter into left margin + if( _gutter != 0 ) + { + double margin = VbaPageSetupBase::getLeftMargin() + _gutter; + VbaPageSetupBase::setLeftMargin( margin ); + } +} + +double SAL_CALL SwVbaPageSetup::getHeaderDistance() throw (uno::RuntimeException) +{ + sal_Bool isHeaderOn = sal_False; + mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn; + if( !isHeaderOn ) + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_True ) ); + return VbaPageSetupBase::getHeaderMargin(); +} + + /** + * changes the value of TopMargin to the value of new MS-Word-HeaderDistance. Subtracts the difference + * between old TopMargin and the new headerDistance from the value of HeaderSpacing (which defines the + * space between the header and the body of the text). calculates the new HeaderHeight (= height of the + * header + headerBodyDistance). + * + * @param: headerDistance is the value that is set in MS Word for the distance from the top of the page + * to the header + */ +void SAL_CALL SwVbaPageSetup::setHeaderDistance( double _headerdistance ) throw (uno::RuntimeException) +{ + sal_Int32 newHeaderDistance = Millimeter::getInHundredthsOfOneMillimeter( _headerdistance ); + sal_Bool isHeaderOn = sal_False; + sal_Int32 aktTopMargin = 0; + sal_Int32 aktSpacing = 0; + sal_Int32 aktHeaderHeight = 0; + + mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn; + if( !isHeaderOn ) + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_True ) ); + + mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))) >>= aktTopMargin; + mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance"))) >>= aktSpacing; + mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))) >>= aktHeaderHeight; + + sal_Int32 newSpacing = aktSpacing - ( newHeaderDistance - aktTopMargin ); + sal_Int32 height = aktHeaderHeight - aktSpacing; + sal_Int32 newHeaderHeight = newSpacing + height; + + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), uno::makeAny( newHeaderDistance ) ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance")), uno::makeAny( newSpacing ) ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight")), uno::makeAny( newHeaderHeight ) ); +} + +double SAL_CALL SwVbaPageSetup::getFooterDistance() throw (uno::RuntimeException) +{ + sal_Bool isFooterOn = sal_False; + mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isFooterOn; + if( !isFooterOn ) + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_True ) ); + return VbaPageSetupBase::getFooterMargin(); +} + +void SAL_CALL SwVbaPageSetup::setFooterDistance( double _footerdistance ) throw (uno::RuntimeException) +{ + sal_Int32 newFooterDistance = Millimeter::getInHundredthsOfOneMillimeter( _footerdistance ); + sal_Bool isFooterOn = sal_False; + sal_Int32 aktBottomMargin = 0; + sal_Int32 aktSpacing = 0; + sal_Int32 aktFooterHeight = 0; + + mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isFooterOn; + if( !isFooterOn ) + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_True ) ); + + mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))) >>= aktBottomMargin; + mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance"))) >>= aktSpacing; + mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))) >>= aktFooterHeight; + + sal_Int32 newSpacing = aktSpacing - ( newFooterDistance - aktBottomMargin ); + sal_Int32 height = aktFooterHeight - aktSpacing; + sal_Int32 newFooterHeight = newSpacing + height; + + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), uno::makeAny( newFooterDistance ) ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance")), uno::makeAny( newSpacing ) ); + mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight")), uno::makeAny( newFooterHeight ) ); +} + +sal_Bool SAL_CALL SwVbaPageSetup::getDifferentFirstPageHeaderFooter() throw (uno::RuntimeException) +{ + rtl::OUString pageStyle = getStyleOfFirstPage(); + if( pageStyle.equalsAscii( "First Page" ) ) + return sal_True; + + return sal_False; +} + +void SAL_CALL SwVbaPageSetup::setDifferentFirstPageHeaderFooter( sal_Bool status ) throw (uno::RuntimeException) +{ + if( status == getDifferentFirstPageHeaderFooter() ) + return; + + rtl::OUString newStyle; + if( status ) + newStyle = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("First Page") ); + else + newStyle = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ); + + uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW ); + sal_Int32 nTopMargin = 0; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))) >>= nTopMargin; + sal_Int32 nBottomMargin = 0; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))) >>= nBottomMargin; + sal_Int32 nLeftMargin = 0; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin"))) >>= nLeftMargin; + sal_Int32 nRightMargin = 0; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin"))) >>= nRightMargin; + sal_Int32 nHeaderHeight = 0; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))) >>= nHeaderHeight; + sal_Int32 nFooterHeight = 0; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))) >>= nFooterHeight; + + sal_Bool isHeaderOn = sal_False; + xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn; + if( isHeaderOn ) + { + nTopMargin += nHeaderHeight; + nBottomMargin += nFooterHeight; + xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_False ) ); + xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_False ) ); + } + uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW ); + if( xPageCursor->getPage() != 1 ) + { + xPageCursor->jumpToFirstPage(); + } + + uno::Reference< beans::XPropertySet > xCursorProps( xPageCursor, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xTableProps( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ), uno::UNO_QUERY ); + if( xTableProps.is() ) + { + xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ), uno::makeAny( newStyle ) ); + } + else + { + xCursorProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ), uno::makeAny( newStyle ) ); + } + + uno::Reference< beans::XPropertySet > xFirstPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW ); + xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ), uno::makeAny( nTopMargin ) ); + xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ), uno::makeAny( nBottomMargin ) ); + xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), uno::makeAny( nLeftMargin ) ); + xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ), uno::makeAny( nRightMargin ) ); +} + +rtl::OUString SwVbaPageSetup::getStyleOfFirstPage() throw (uno::RuntimeException) +{ + rtl::OUString styleFirstPage; + uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW ); + if( xPageCursor->getPage() != 1 ) + { + xPageCursor->jumpToFirstPage(); + } + + uno::Reference< beans::XPropertySet > xCursorProps( xPageCursor, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xTableProps( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ), uno::UNO_QUERY ); + if( xTableProps.is() ) + { + xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ) ) >>= styleFirstPage; + } + else + { + xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ) ) >>= styleFirstPage; + } + return styleFirstPage; +} + +::sal_Int32 SAL_CALL SwVbaPageSetup::getSectionStart() throw (uno::RuntimeException) +{ + // FIXME: + sal_Int32 wdSectionStart = word::WdSectionStart::wdSectionNewPage; + uno::Reference< container::XNamed > xNamed( mxPageProps, uno::UNO_QUERY_THROW ); + rtl::OUString sStyleName = xNamed->getName(); + //mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sStyleName; + if( sStyleName.equalsAscii("Left Page") ) + wdSectionStart = word::WdSectionStart::wdSectionEvenPage; + else if( sStyleName.equalsAscii("Right Page") ) + wdSectionStart = word::WdSectionStart::wdSectionOddPage; + else + wdSectionStart = word::WdSectionStart::wdSectionNewPage; + return wdSectionStart; +} + +void SAL_CALL SwVbaPageSetup::setSectionStart( ::sal_Int32 /*_sectionstart*/ ) throw (uno::RuntimeException) +{ + // fail to find corresponding feature in Writer + // #FIXME: +} + +rtl::OUString& +SwVbaPageSetup::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPageSetup") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaPageSetup::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.PageSetup" ) ); + } + return aServiceNames; +} diff --git a/sw/source/ui/vba/vbapagesetup.hxx b/sw/source/ui/vba/vbapagesetup.hxx new file mode 100644 index 0000000000..a9747c942a --- /dev/null +++ b/sw/source/ui/vba/vbapagesetup.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_PAGESETUP_HXX +#define SW_VBA_PAGESETUP_HXX + +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/word/XPageSetup.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <vbahelper/vbapagesetupbase.hxx> + +typedef cppu::ImplInheritanceHelper1< VbaPageSetupBase, ooo::vba::word::XPageSetup > SwVbaPageSetup_BASE; + +class SwVbaPageSetup : public SwVbaPageSetup_BASE +{ +private: + rtl::OUString getStyleOfFirstPage() throw (css::uno::RuntimeException); + +public: + SwVbaPageSetup( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, + const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Reference< css::frame::XModel >& xModel, + const css::uno::Reference< css::beans::XPropertySet >& xProps ) throw (css::uno::RuntimeException); + virtual ~SwVbaPageSetup(){} + + // Attributes + virtual double SAL_CALL getGutter() throw (css::uno::RuntimeException); + virtual void SAL_CALL setGutter( double _gutter ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getHeaderDistance() throw (css::uno::RuntimeException); + virtual void SAL_CALL setHeaderDistance( double _headerdistance ) throw (css::uno::RuntimeException); + virtual double SAL_CALL getFooterDistance() throw (css::uno::RuntimeException); + virtual void SAL_CALL setFooterDistance( double _footerdistance ) throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL getDifferentFirstPageHeaderFooter() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDifferentFirstPageHeaderFooter( sal_Bool status ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getSectionStart() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSectionStart( ::sal_Int32 _sectionstart ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif diff --git a/sw/source/ui/vba/vbapalette.cxx b/sw/source/ui/vba/vbapalette.cxx new file mode 100644 index 0000000000..40191df6f8 --- /dev/null +++ b/sw/source/ui/vba/vbapalette.cxx @@ -0,0 +1,75 @@ +#include "vbapalette.hxx" +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <ooo/vba/word/WdColor.hpp> +#include <ooo/vba/word/WdColorIndex.hpp> + +using namespace ::ooo::vba; +using namespace ::ooo::vba::word; +using namespace ::com::sun::star; + +static const sal_Int32 ColorTable[] = +{ +WdColor::wdColorAutomatic, // 0 +WdColor::wdColorBlack, // 1 +WdColor::wdColorBlue, // 2 +WdColor::wdColorTurquoise, // 3 +WdColor::wdColorBrightGreen, // 4 +WdColor::wdColorPink, // 5 +WdColor::wdColorRed, // 6 +WdColor::wdColorYellow, // 7 +WdColor::wdColorWhite, // 8 +WdColor::wdColorDarkBlue, // 9 +WdColor::wdColorTeal, // 10 +WdColor::wdColorGreen, // 11 +WdColor::wdColorViolet, // 12 +WdColor::wdColorDarkRed, // 13 +WdColor::wdColorDarkYellow, // 14 +WdColor::wdColorGray50, // 15 +WdColor::wdColorGray25, // 16 +}; + +typedef ::cppu::WeakImplHelper1< container::XIndexAccess > XIndexAccess_BASE; + +class DefaultPalette : public XIndexAccess_BASE +{ +public: + DefaultPalette(){} + + // Methods XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException) + { + return sizeof(ColorTable) / sizeof(ColorTable[0]); + } + + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( Index < 0 || Index >= getCount() ) + throw lang::IndexOutOfBoundsException(); + return uno::makeAny( sal_Int32( ColorTable[ Index ] ) ); + } + + // Methods XElementAcess + virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException) + { + return ::getCppuType( (sal_Int32*)0 ); + } + virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException) + { + return sal_True; + } + +}; + +VbaPalette::VbaPalette() +{ + mxPalette = new DefaultPalette(); +} + +uno::Reference< container::XIndexAccess > +VbaPalette::getPalette() const +{ + + return mxPalette; +} + diff --git a/sw/source/ui/vba/vbapalette.hxx b/sw/source/ui/vba/vbapalette.hxx new file mode 100644 index 0000000000..130e405a13 --- /dev/null +++ b/sw/source/ui/vba/vbapalette.hxx @@ -0,0 +1,15 @@ +#ifndef VBAPALETTE_HXX +#define VBAPALETTE_HXX +#include <vbahelper/vbahelper.hxx> + +class VbaPalette +{ + css::uno::Reference< css::container::XIndexAccess > mxPalette; +public: + VbaPalette(); + // if no palette available e.g. because the document doesn't have a + // palette defined then a default palette will be returned. + css::uno::Reference< css::container::XIndexAccess > getPalette() const; +}; + +#endif diff --git a/sw/source/ui/vba/vbapane.cxx b/sw/source/ui/vba/vbapane.cxx new file mode 100644 index 0000000000..6a5973dd18 --- /dev/null +++ b/sw/source/ui/vba/vbapane.cxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbapane.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include "vbaview.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaPane::SwVbaPane( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, + const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : + SwVbaPane_BASE( rParent, rContext ), mxModel( xModel ) +{ +} + +SwVbaPane::~SwVbaPane() +{ +} + +uno::Any SAL_CALL +SwVbaPane::View() throw ( css::uno::RuntimeException ) +{ + return uno::makeAny( uno::Reference< word::XView >( new SwVbaView( this, mxContext, mxModel ) ) ); +} + +void SAL_CALL +SwVbaPane::Close( ) throw ( css::uno::RuntimeException ) +{ + rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseWin")); + dispatchRequests( mxModel,url ); +} + +rtl::OUString& +SwVbaPane::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPane") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaPane::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Pane" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbapane.hxx b/sw/source/ui/vba/vbapane.hxx new file mode 100644 index 0000000000..d2501c01cc --- /dev/null +++ b/sw/source/ui/vba/vbapane.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_PANE_HXX +#define SW_VBA_PANE_HXX + +#include <ooo/vba/word/XPane.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XPane > SwVbaPane_BASE; + +class SwVbaPane : public SwVbaPane_BASE +{ +private: + css::uno::Reference< css::frame::XModel > mxModel; + +public: + SwVbaPane( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, + const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaPane(); + + // Methods + virtual css::uno::Any SAL_CALL View( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_PANE_HXX */ diff --git a/sw/source/ui/vba/vbapanes.cxx b/sw/source/ui/vba/vbapanes.cxx new file mode 100644 index 0000000000..58c4763491 --- /dev/null +++ b/sw/source/ui/vba/vbapanes.cxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbapanes.hxx" +#include "vbapane.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +// I assume there is only one pane in Writer +typedef ::cppu::WeakImplHelper1<container::XIndexAccess > PanesIndexAccess_Base; +class PanesIndexAccess : public PanesIndexAccess_Base +{ +private: + uno::Reference< XHelperInterface > mxParent; + uno::Reference< uno::XComponentContext > mxContext; + uno::Reference< frame::XModel > mxModel; + +public: + PanesIndexAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ) {} + ~PanesIndexAccess(){} + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) + { + return 1; + } + virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) + { + if( Index != 1 ) + throw container::NoSuchElementException(); + return uno::makeAny( uno::Reference< word::XPane >( new SwVbaPane( mxParent, mxContext, mxModel ) ) ); + } + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) + { + return word::XPane::static_type(0); + } + virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) + { + return sal_True; + } +}; + +class PanesEnumWrapper : public EnumerationHelper_BASE +{ + uno::Reference<container::XIndexAccess > m_xIndexAccess; + sal_Int32 nIndex; +public: + PanesEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) + { + return ( nIndex < m_xIndexAccess->getCount() ); + } + + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( nIndex < m_xIndexAccess->getCount() ) + return m_xIndexAccess->getByIndex( nIndex++ ); + throw container::NoSuchElementException(); + } +}; + +SwVbaPanes::SwVbaPanes( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaPanes_BASE( xParent, xContext, new PanesIndexAccess( xParent, xContext, xModel ) ), mxModel( xModel ) +{ +} +// XEnumerationAccess +uno::Type +SwVbaPanes::getElementType() throw (uno::RuntimeException) +{ + return word::XPane::static_type(0); +} +uno::Reference< container::XEnumeration > +SwVbaPanes::createEnumeration() throw (uno::RuntimeException) +{ + return new PanesEnumWrapper( m_xIndexAccess ); +} + +uno::Any +SwVbaPanes::createCollectionObject( const css::uno::Any& aSource ) +{ + return aSource; +} + +rtl::OUString& +SwVbaPanes::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPanes") ); + return sImplName; +} + +css::uno::Sequence<rtl::OUString> +SwVbaPanes::getServiceNames() +{ + static uno::Sequence< rtl::OUString > sNames; + if ( sNames.getLength() == 0 ) + { + sNames.realloc( 1 ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Panes") ); + } + return sNames; +} diff --git a/sw/source/ui/vba/vbapanes.hxx b/sw/source/ui/vba/vbapanes.hxx new file mode 100644 index 0000000000..98e89035ab --- /dev/null +++ b/sw/source/ui/vba/vbapanes.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_PANES_HXX +#define SW_VBA_PANES_HXX + +#include <vbahelper/vbacollectionimpl.hxx> +#include <ooo/vba/word/XPanes.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <vbahelper/vbahelperinterface.hxx> + +typedef CollTestImplHelper< ooo::vba::word::XPanes > SwVbaPanes_BASE; + +class SwVbaPanes : public SwVbaPanes_BASE +{ +private: + css::uno::Reference< css::frame::XModel > mxModel; + +public: + SwVbaPanes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel ); + virtual ~SwVbaPanes() {} + + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + + // SwVbaPanes_BASE + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif /* SW_VBA_PANES_HXX */ diff --git a/sw/source/ui/vba/vbaparagraph.cxx b/sw/source/ui/vba/vbaparagraph.cxx new file mode 100644 index 0000000000..94360a6099 --- /dev/null +++ b/sw/source/ui/vba/vbaparagraph.cxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaparagraph.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include "vbarange.hxx" +#include <com/sun/star/lang/XServiceInfo.hpp> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaParagraph::SwVbaParagraph( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xDocument, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) : + SwVbaParagraph_BASE( rParent, rContext ), mxTextDocument( xDocument ), mxTextRange( xTextRange ) +{ +} + +SwVbaParagraph::~SwVbaParagraph() +{ +} + +uno::Reference< word::XRange > SAL_CALL +SwVbaParagraph::getRange( ) throw ( uno::RuntimeException ) +{ + return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, mxTextRange->getStart(), mxTextRange->getEnd(), mxTextRange->getText(), sal_True ) ); +} + +rtl::OUString& +SwVbaParagraph::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraph") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaParagraph::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Paragraph" ) ); + } + return aServiceNames; +} + + +//typedef ::cppu::WeakImplHelper1< container::XEnumeration > ParagraphEnumeration_BASE; +typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > ParagraphCollectionHelper_BASE; + +class ParagraphCollectionHelper : public ParagraphCollectionHelper_BASE +{ +private: + uno::Reference< text::XTextDocument > mxTextDocument; + + uno::Reference< container::XEnumeration > getEnumeration() throw (uno::RuntimeException) + { + uno::Reference< container::XEnumerationAccess > xParEnumAccess( mxTextDocument->getText(), uno::UNO_QUERY_THROW ); + return xParEnumAccess->createEnumeration(); + } + +public: + ParagraphCollectionHelper( const uno::Reference< text::XTextDocument >& xDocument ) throw (uno::RuntimeException): mxTextDocument( xDocument ) + { + } + // XElementAccess + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return text::XTextRange::static_type(0); } + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return sal_True; } + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) + { + sal_Int32 nCount = 0; + uno::Reference< container::XEnumeration > xParEnum = getEnumeration(); + while( xParEnum->hasMoreElements() ) + { + uno::Reference< lang::XServiceInfo > xServiceInfo( xParEnum->nextElement(), uno::UNO_QUERY_THROW ); + if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph") ) ) ) + { + nCount++; + } + } + return nCount; + } + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException ) + { + if( Index < getCount() ) + { + sal_Int32 nCount = 0; + uno::Reference< container::XEnumeration > xParEnum = getEnumeration(); + while( xParEnum->hasMoreElements() ) + { + uno::Reference< lang::XServiceInfo > xServiceInfo( xParEnum->nextElement(), uno::UNO_QUERY_THROW ); + if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph") ) ) ) + { + if( Index == nCount ) + return uno::makeAny( xServiceInfo ); + nCount++; + } + } + } + throw lang::IndexOutOfBoundsException(); + } + // XEnumerationAccess + virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) + { + return getEnumeration(); + } +}; + +SwVbaParagraphs::SwVbaParagraphs( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDocument ) throw (uno::RuntimeException) : SwVbaParagraphs_BASE( xParent, xContext, new ParagraphCollectionHelper( xDocument ) ), mxTextDocument( xDocument ) +{ +} + +// XEnumerationAccess +uno::Type +SwVbaParagraphs::getElementType() throw (uno::RuntimeException) +{ + return word::XParagraph::static_type(0); +} +uno::Reference< container::XEnumeration > +SwVbaParagraphs::createEnumeration() throw (uno::RuntimeException) +{ + uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); + return xEnumerationAccess->createEnumeration(); +} + +uno::Any +SwVbaParagraphs::createCollectionObject( const css::uno::Any& aSource ) +{ + uno::Reference< text::XTextRange > xTextRange( aSource, uno::UNO_QUERY_THROW ); + return uno::makeAny( uno::Reference< word::XParagraph >( new SwVbaParagraph( this, mxContext, mxTextDocument, xTextRange ) ) ); +} + +rtl::OUString& +SwVbaParagraphs::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraphs") ); + return sImplName; +} + +css::uno::Sequence<rtl::OUString> +SwVbaParagraphs::getServiceNames() +{ + static uno::Sequence< rtl::OUString > sNames; + if ( sNames.getLength() == 0 ) + { + sNames.realloc( 1 ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Paragraphs") ); + } + return sNames; +} diff --git a/sw/source/ui/vba/vbaparagraph.hxx b/sw/source/ui/vba/vbaparagraph.hxx new file mode 100644 index 0000000000..a20d21ac6a --- /dev/null +++ b/sw/source/ui/vba/vbaparagraph.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_PARAGRAPH_HXX +#define SW_VBA_PARAGRAPH_HXX + +#include <vbahelper/vbacollectionimpl.hxx> +#include <ooo/vba/word/XParagraphs.hpp> +#include <ooo/vba/word/XParagraph.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/text/XTextDocument.hpp> + + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XParagraph > SwVbaParagraph_BASE; + +class SwVbaParagraph : public SwVbaParagraph_BASE +{ +private: + css::uno::Reference< css::text::XTextDocument > mxTextDocument; + css::uno::Reference< css::text::XTextRange > mxTextRange; + +public: + SwVbaParagraph( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xDocument, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaParagraph(); + + // XParagraph + virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() throw ( css::uno::RuntimeException ); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + + +/* class SwVbaParagraphs */ +typedef CollTestImplHelper< ooo::vba::word::XParagraphs > SwVbaParagraphs_BASE; + +class SwVbaParagraphs : public SwVbaParagraphs_BASE +{ +private: + css::uno::Reference< css::text::XTextDocument > mxTextDocument; +public: + SwVbaParagraphs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xDocument ) throw (css::uno::RuntimeException); + virtual ~SwVbaParagraphs() {} + + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + + // SwVbaParagraphs_BASE + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif /* SW_VBA_PARAGRAPH_HXX */ diff --git a/sw/source/ui/vba/vbaparagraphformat.cxx b/sw/source/ui/vba/vbaparagraphformat.cxx new file mode 100644 index 0000000000..c695a2164f --- /dev/null +++ b/sw/source/ui/vba/vbaparagraphformat.cxx @@ -0,0 +1,576 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaparagraphformat.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include "wordvbahelper.hxx" +#include <com/sun/star/style/LineSpacingMode.hpp> +#include <ooo/vba/word/WdLineSpacing.hpp> +#include <ooo/vba/word/WdParagraphAlignment.hpp> +#include <ooo/vba/word/WdOutlineLevel.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> +#include <com/sun/star/style/BreakType.hpp> + + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +static const sal_Int16 CHARACTER_INDENT_FACTOR = 12; +static const sal_Int16 PERCENT100 = 100; +static const sal_Int16 PERCENT150 = 150; +static const sal_Int16 PERCENT200 = 200; + +SwVbaParagraphFormat::SwVbaParagraphFormat( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< beans::XPropertySet >& rParaProps ) : SwVbaParagraphFormat_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mxParaProps( rParaProps ) +{ +} + +SwVbaParagraphFormat::~SwVbaParagraphFormat() +{ +} + +sal_Int32 SAL_CALL SwVbaParagraphFormat::getAlignment() throw (uno::RuntimeException) +{ + style::ParagraphAdjust aParaAdjust = style::ParagraphAdjust_LEFT; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAdjust") ) ) >>= aParaAdjust; + return getMSWordAlignment( aParaAdjust ); +} + +void SAL_CALL SwVbaParagraphFormat::setAlignment( sal_Int32 _alignment ) throw (uno::RuntimeException) +{ + style::ParagraphAdjust aParaAdjust = ( style::ParagraphAdjust ) getOOoAlignment( _alignment ); + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAdjust") ), uno::makeAny( aParaAdjust ) ); +} + +float SAL_CALL SwVbaParagraphFormat::getFirstLineIndent() throw (uno::RuntimeException) +{ + sal_Int32 indent = 0; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaFirstLineIndent") ) ) >>= indent; + return (float)( Millimeter::getInPoints( indent ) ); +} + +void SAL_CALL SwVbaParagraphFormat::setFirstLineIndent( float _firstlineindent ) throw (uno::RuntimeException) +{ + sal_Int32 indent = Millimeter::getInHundredthsOfOneMillimeter( _firstlineindent ); + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaFirstLineIndent") ), uno::makeAny( indent ) ); +} + +uno::Any SAL_CALL SwVbaParagraphFormat::getKeepTogether() throw (uno::RuntimeException) +{ + sal_Bool bKeep = sal_False; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaKeepTogether") ) ) >>= bKeep; + return uno::makeAny ( bKeep ); +} + +void SAL_CALL SwVbaParagraphFormat::setKeepTogether( const uno::Any& _keeptogether ) throw (uno::RuntimeException) +{ + sal_Bool bKeep = sal_False; + if( _keeptogether >>= bKeep ) + { + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaKeepTogether") ), uno::makeAny( bKeep ) ); + } + else + { + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + } +} + +uno::Any SAL_CALL SwVbaParagraphFormat::getKeepWithNext() throw (uno::RuntimeException) +{ + sal_Bool bKeep = sal_False; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaSplit") ) ) >>= bKeep; + return uno::makeAny ( bKeep ); +} + +void SAL_CALL SwVbaParagraphFormat::setKeepWithNext( const uno::Any& _keepwithnext ) throw (uno::RuntimeException) +{ + sal_Bool bKeep = sal_False; + if( _keepwithnext >>= bKeep ) + { + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaSplit") ), uno::makeAny( bKeep ) ); + } + else + { + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + } +} + +uno::Any SAL_CALL SwVbaParagraphFormat::getHyphenation() throw (uno::RuntimeException) +{ + sal_Bool bHypn = sal_False; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation") ) ) >>= bHypn; + return uno::makeAny ( bHypn ); +} + +void SAL_CALL SwVbaParagraphFormat::setHyphenation( const uno::Any& _hyphenation ) throw (uno::RuntimeException) +{ + sal_Bool bHypn = sal_False; + if( _hyphenation >>= bHypn ) + { + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation") ), uno::makeAny( bHypn ) ); + } + else + { + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + } +} + +float SAL_CALL SwVbaParagraphFormat::getLineSpacing() throw (uno::RuntimeException) +{ + style::LineSpacing aLineSpacing; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing; + return getMSWordLineSpacing( aLineSpacing ); +} + +void SAL_CALL SwVbaParagraphFormat::setLineSpacing( float _linespacing ) throw (uno::RuntimeException) +{ + style::LineSpacing aLineSpacing; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing; + aLineSpacing = getOOoLineSpacing( _linespacing, aLineSpacing.Mode ); + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ), uno::makeAny( aLineSpacing ) ); +} + +sal_Int32 SAL_CALL SwVbaParagraphFormat::getLineSpacingRule() throw (uno::RuntimeException) +{ + style::LineSpacing aLineSpacing; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing; + return getMSWordLineSpacingRule( aLineSpacing ); +} + +void SAL_CALL SwVbaParagraphFormat::setLineSpacingRule( sal_Int32 _linespacingrule ) throw (uno::RuntimeException) +{ + style::LineSpacing aLineSpacing = getOOoLineSpacingFromRule( _linespacingrule ); + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ), uno::makeAny( aLineSpacing ) ); +} + +uno::Any SAL_CALL SwVbaParagraphFormat::getNoLineNumber() throw (uno::RuntimeException) +{ + sal_Bool noLineNum = sal_False; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberCount") ) ) >>= noLineNum; + return uno::makeAny ( noLineNum ); +} + +void SAL_CALL SwVbaParagraphFormat::setNoLineNumber( const uno::Any& _nolinenumber ) throw (uno::RuntimeException) +{ + sal_Bool noLineNum = sal_False; + if( _nolinenumber >>= noLineNum ) + { + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberCount") ), uno::makeAny( noLineNum ) ); + } + else + { + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + } +} + +sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() throw (uno::RuntimeException) +{ + sal_Int32 nLevel = word::WdOutlineLevel::wdOutlineLevelBodyText; + rtl::OUString aHeading; + const rtl::OUString HEADING = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Heading") ); + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ) ) >>= aHeading; + if( aHeading.indexOf( HEADING ) == 0 ) + { + // get the sub string after "Heading" + nLevel = aHeading.copy( HEADING.getLength() ).toInt32(); + } + return nLevel; +} + +void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 /*_outlinelevel*/ ) throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); +} + +uno::Any SAL_CALL SwVbaParagraphFormat::getPageBreakBefore() throw (uno::RuntimeException) +{ + style::BreakType aBreakType; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ) ) >>= aBreakType; + sal_Bool bBreakBefore = ( aBreakType == style::BreakType_PAGE_BEFORE || aBreakType == style::BreakType_PAGE_BOTH ); + return uno::makeAny( bBreakBefore ); +} + +void SAL_CALL SwVbaParagraphFormat::setPageBreakBefore( const uno::Any& _breakbefore ) throw (uno::RuntimeException) +{ + sal_Bool bBreakBefore = sal_False; + if( _breakbefore >>= bBreakBefore ) + { + style::BreakType aBreakType; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ) ) >>= aBreakType; + if( bBreakBefore ) + { + if( aBreakType == style::BreakType_NONE ) + aBreakType = style::BreakType_PAGE_BEFORE; + else if ( aBreakType == style::BreakType_PAGE_AFTER ) + aBreakType = style::BreakType_PAGE_BOTH; + } + else + { + if( aBreakType == style::BreakType_PAGE_BOTH ) + aBreakType = style::BreakType_PAGE_AFTER; + else if ( aBreakType == style::BreakType_PAGE_BEFORE ) + aBreakType = style::BreakType_PAGE_AFTER; + } + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ), uno::makeAny( aBreakType ) ); + } + else + { + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + } +} + +float SAL_CALL SwVbaParagraphFormat::getSpaceBefore() throw (uno::RuntimeException) +{ + sal_Int32 nSpace = 0; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTopMargin") ) ) >>= nSpace; + return (float)( Millimeter::getInPoints( nSpace ) ); +} + +void SAL_CALL SwVbaParagraphFormat::setSpaceBefore( float _space ) throw (uno::RuntimeException) +{ + sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space ); + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTopMargin") ), uno::makeAny( nSpace ) ); +} + +float SAL_CALL SwVbaParagraphFormat::getSpaceAfter() throw (uno::RuntimeException) +{ + sal_Int32 nSpace = 0; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaBottomMargin") ) ) >>= nSpace; + return (float)( Millimeter::getInPoints( nSpace ) ); +} + +void SAL_CALL SwVbaParagraphFormat::setSpaceAfter( float _space ) throw (uno::RuntimeException) +{ + sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space ); + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaBottomMargin") ), uno::makeAny( nSpace ) ); +} + +float SAL_CALL SwVbaParagraphFormat::getLeftIndent() throw (uno::RuntimeException) +{ + sal_Int32 nIndent = 0; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin") ) ) >>= nIndent; + return (float)( Millimeter::getInPoints( nIndent ) ); +} + +void SAL_CALL SwVbaParagraphFormat::setLeftIndent( float _leftindent ) throw (uno::RuntimeException) +{ + sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _leftindent ); + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin") ), uno::makeAny( nIndent ) ); +} + +float SAL_CALL SwVbaParagraphFormat::getRightIndent() throw (uno::RuntimeException) +{ + sal_Int32 nIndent = 0; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaRightMargin") ) ) >>= nIndent; + return (float)( Millimeter::getInPoints( nIndent ) ); +} + +void SAL_CALL SwVbaParagraphFormat::setRightIndent( float _rightindent ) throw (uno::RuntimeException) +{ + sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _rightindent ); + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaRightMargin") ), uno::makeAny( nIndent ) ); +} + +uno::Any SAL_CALL SwVbaParagraphFormat::getTabStops() throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); +} + +void SAL_CALL SwVbaParagraphFormat::setTabStops( const uno::Any& /*_tabstops*/ ) throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); +} + +uno::Any SAL_CALL SwVbaParagraphFormat::getWidowControl() throw (uno::RuntimeException) +{ + sal_Bool bWidow = sal_False; + sal_Int8 nWidow = 0; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaWidows") ) ) >>= nWidow; + sal_Int8 nOrphan = 0; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaOrphans") ) ) >>= nOrphan; + // if the amount of single lines on one page > 1 and the same of start and end of the paragraph, + // true is retured. + bWidow = ( nWidow > 1 && nOrphan == nWidow ); + return uno::makeAny( bWidow ); +} + +void SAL_CALL SwVbaParagraphFormat::setWidowControl( const uno::Any& _widowcontrol ) throw (uno::RuntimeException) +{ + // if we get true, the part of the paragraph on one page has to be + // at least two lines + sal_Bool bWidow = sal_False; + if( _widowcontrol >>= bWidow ) + { + sal_Int8 nControl = bWidow? 2:1; + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaWidows") ), uno::makeAny( nControl ) ); + mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaOrphans") ), uno::makeAny( nControl ) ); + } + else + { + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + } +} + +style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacing( float _lineSpace, sal_Int16 mode ) +{ + style::LineSpacing aLineSpacing; + if( mode != style::LineSpacingMode::MINIMUM && mode != style::LineSpacingMode::FIX ) + { + // special behaviour of word: if the space is set to these values, the rule and + // the height are changed accordingly + if( _lineSpace == CHARACTER_INDENT_FACTOR ) + { + aLineSpacing.Mode = style::LineSpacingMode::PROP; + aLineSpacing.Height = PERCENT100; + } + else if( _lineSpace == ( sal_Int16 )( CHARACTER_INDENT_FACTOR * 1.5 ) ) + { + aLineSpacing.Mode = style::LineSpacingMode::PROP; + aLineSpacing.Height = PERCENT150; + } + else if( _lineSpace == ( sal_Int16 )( ( CHARACTER_INDENT_FACTOR ) * 2 ) ) + { + aLineSpacing.Mode = style::LineSpacingMode::PROP; + aLineSpacing.Height = PERCENT200; + } + else + { + aLineSpacing.Mode = style::LineSpacingMode::FIX; + aLineSpacing.Height = ( sal_Int16 )( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) ); + } + } + else + { + aLineSpacing.Mode = mode; + aLineSpacing.Height = ( sal_Int16 )( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) ); + } + return aLineSpacing; +} + +style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacingFromRule( sal_Int32 _linespacingrule ) +{ + style::LineSpacing aLineSpacing; + switch( _linespacingrule ) + { + case word::WdLineSpacing::wdLineSpace1pt5: + { + aLineSpacing.Mode = style::LineSpacingMode::PROP; + aLineSpacing.Height = PERCENT150; + break; + } + case word::WdLineSpacing::wdLineSpaceAtLeast: + { + aLineSpacing.Mode = style::LineSpacingMode::MINIMUM; + aLineSpacing.Height = getCharHeight(); + break; + } + case word::WdLineSpacing::wdLineSpaceDouble: + { + aLineSpacing.Mode = style::LineSpacingMode::PROP; + aLineSpacing.Height = getCharHeight(); + break; + } + case word::WdLineSpacing::wdLineSpaceExactly: + case word::WdLineSpacing::wdLineSpaceMultiple: + { + aLineSpacing.Mode = style::LineSpacingMode::FIX; + aLineSpacing.Height = getCharHeight(); + break; + } + case word::WdLineSpacing::wdLineSpaceSingle: + { + aLineSpacing.Mode = style::LineSpacingMode::PROP; + aLineSpacing.Height = PERCENT100; + break; + } + default: + { + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + break; + } + } + return aLineSpacing; +} + +float SwVbaParagraphFormat::getMSWordLineSpacing( style::LineSpacing& rLineSpacing ) +{ + float wdLineSpacing = 0; + if( rLineSpacing.Mode != style::LineSpacingMode::PROP ) + { + wdLineSpacing = (float)( Millimeter::getInPoints( rLineSpacing.Height ) ); + } + else + { + wdLineSpacing = (float)( CHARACTER_INDENT_FACTOR * rLineSpacing.Height ) / PERCENT100; + } + return wdLineSpacing; +} + +sal_Int32 SwVbaParagraphFormat::getMSWordLineSpacingRule( style::LineSpacing& rLineSpacing ) +{ + sal_Int32 wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle; + switch( rLineSpacing.Mode ) + { + case style::LineSpacingMode::PROP: + { + switch( rLineSpacing.Height ) + { + case PERCENT100: + { + wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle; + break; + } + case PERCENT150: + { + wdLineSpacing = word::WdLineSpacing::wdLineSpace1pt5; + break; + } + case PERCENT200: + { + wdLineSpacing = word::WdLineSpacing::wdLineSpaceDouble; + break; + } + default: + { + wdLineSpacing = word::WdLineSpacing::wdLineSpaceMultiple; + } + } + break; + } + case style::LineSpacingMode::MINIMUM: + { + wdLineSpacing = word::WdLineSpacing::wdLineSpaceAtLeast; + break; + } + case style::LineSpacingMode::FIX: + case style::LineSpacingMode::LEADING: + { + wdLineSpacing = word::WdLineSpacing::wdLineSpaceExactly; + break; + } + default: + { + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + } + } + return wdLineSpacing; +} + +sal_Int16 SwVbaParagraphFormat::getCharHeight() throw (uno::RuntimeException) +{ + float fCharHeight = 0.0; + mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharHeight") ) ) >>= fCharHeight; + return (sal_Int16)( Millimeter::getInHundredthsOfOneMillimeter( fCharHeight ) ); +} + +sal_Int32 SwVbaParagraphFormat::getOOoAlignment( sal_Int32 _alignment ) +{ + sal_Int32 nParaAjust = style::ParagraphAdjust_LEFT; + switch( _alignment ) + { + case word::WdParagraphAlignment::wdAlignParagraphCenter: + { + nParaAjust = style::ParagraphAdjust_CENTER; + break; + } + case word::WdParagraphAlignment::wdAlignParagraphJustify: + { + nParaAjust = style::ParagraphAdjust_BLOCK; + break; + } + case word::WdParagraphAlignment::wdAlignParagraphLeft: + { + nParaAjust = style::ParagraphAdjust_LEFT; + break; + } + case word::WdParagraphAlignment::wdAlignParagraphRight: + { + nParaAjust = style::ParagraphAdjust_RIGHT; + break; + } + default: + { + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + } + } + return nParaAjust; +} + +sal_Int32 SwVbaParagraphFormat::getMSWordAlignment( sal_Int32 _alignment ) +{ + sal_Int32 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft; + switch( _alignment ) + { + case style::ParagraphAdjust_CENTER: + { + wdAlignment = word::WdParagraphAlignment::wdAlignParagraphCenter; + break; + } + case style::ParagraphAdjust_LEFT: + { + wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft; + break; + } + case style::ParagraphAdjust_BLOCK: + { + wdAlignment = word::WdParagraphAlignment::wdAlignParagraphJustify; + break; + } + case style::ParagraphAdjust_RIGHT: + { + wdAlignment = word::WdParagraphAlignment::wdAlignParagraphRight; + break; + } + default: + { + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + } + } + return wdAlignment; +} + +rtl::OUString& +SwVbaParagraphFormat::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraphFormat") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaParagraphFormat::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ParagraphFormat" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbaparagraphformat.hxx b/sw/source/ui/vba/vbaparagraphformat.hxx new file mode 100644 index 0000000000..0a5561f11d --- /dev/null +++ b/sw/source/ui/vba/vbaparagraphformat.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_PARAGRAPHFORMAT_HXX +#define SW_VBA_PARAGRAPHFORMAT_HXX + +#include <ooo/vba/word/XParagraphFormat.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/style/LineSpacing.hpp> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XParagraphFormat > SwVbaParagraphFormat_BASE; + +class SwVbaParagraphFormat : public SwVbaParagraphFormat_BASE +{ +private: + css::uno::Reference< css::text::XTextDocument > mxTextDocument; + css::uno::Reference< css::beans::XPropertySet > mxParaProps; + +private: + css::style::LineSpacing getOOoLineSpacing( float _lineSpace, sal_Int16 mode ); + css::style::LineSpacing getOOoLineSpacingFromRule( sal_Int32 _linespacingrule ); + float getMSWordLineSpacing( css::style::LineSpacing& rLineSpacing ); + sal_Int32 getMSWordLineSpacingRule( css::style::LineSpacing& rLineSpacing ); + sal_Int16 getCharHeight() throw (css::uno::RuntimeException); + sal_Int32 getOOoAlignment( sal_Int32 _alignment ); + sal_Int32 getMSWordAlignment( sal_Int32 _alignment ); + +public: + SwVbaParagraphFormat( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::beans::XPropertySet >& rParaProps ); + virtual ~SwVbaParagraphFormat(); + + // Attributes + virtual ::sal_Int32 SAL_CALL getAlignment() throw (css::uno::RuntimeException); + virtual void SAL_CALL setAlignment( ::sal_Int32 _alignment ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getFirstLineIndent() throw (css::uno::RuntimeException); + virtual void SAL_CALL setFirstLineIndent( float _firstlineindent ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getKeepTogether() throw (css::uno::RuntimeException); + virtual void SAL_CALL setKeepTogether( const css::uno::Any& _keeptogether ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getKeepWithNext() throw (css::uno::RuntimeException); + virtual void SAL_CALL setKeepWithNext( const css::uno::Any& _keepwithnext ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getHyphenation() throw (css::uno::RuntimeException); + virtual void SAL_CALL setHyphenation( const css::uno::Any& _hyphenation ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getLineSpacing() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLineSpacing( float _linespacing ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getLineSpacingRule() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLineSpacingRule( ::sal_Int32 _linespacingrule ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getNoLineNumber() throw (css::uno::RuntimeException); + virtual void SAL_CALL setNoLineNumber( const css::uno::Any& _nolinenumber ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getOutlineLevel() throw (css::uno::RuntimeException); + virtual void SAL_CALL setOutlineLevel( ::sal_Int32 _outlinelevel ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getPageBreakBefore() throw (css::uno::RuntimeException); + virtual void SAL_CALL setPageBreakBefore( const css::uno::Any& _pagebreakbefore ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getSpaceBefore() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSpaceBefore( float _spacebefore ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getSpaceAfter() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSpaceAfter( float _spaceafter ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getLeftIndent() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLeftIndent( float _leftindent ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getRightIndent() throw (css::uno::RuntimeException); + virtual void SAL_CALL setRightIndent( float _rightindent ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getTabStops() throw (css::uno::RuntimeException); + virtual void SAL_CALL setTabStops( const css::uno::Any& _tabstops ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getWidowControl() throw (css::uno::RuntimeException); + virtual void SAL_CALL setWidowControl( const css::uno::Any& _widowcontrol ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_PARAGRAPHFORMAT_HXX */ diff --git a/sw/source/ui/vba/vbarange.cxx b/sw/source/ui/vba/vbarange.cxx new file mode 100644 index 0000000000..64d13837b1 --- /dev/null +++ b/sw/source/ui/vba/vbarange.cxx @@ -0,0 +1,348 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbarange.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include "vbarangehelper.hxx" +#include <ooo/vba/word/WdBreakType.hpp> +#include <com/sun/star/style/BreakType.hpp> +#include <com/sun/star/text/ControlCharacter.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include "wordvbahelper.hxx" +#include "vbaparagraphformat.hxx" +#include "vbastyle.hxx" +#include "vbafont.hxx" +#include "vbapalette.hxx" +#include "vbapagesetup.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, sal_Bool _bMaySpanEndOfDocument ) throw (uno::RuntimeException) : SwVbaRange_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mbMaySpanEndOfDocument( _bMaySpanEndOfDocument ) +{ + uno::Reference< text::XTextRange > xEnd; + initialize( rStart, xEnd ); +} + +SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument ) throw (uno::RuntimeException) : SwVbaRange_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mbMaySpanEndOfDocument( _bMaySpanEndOfDocument ) +{ + initialize( rStart, rEnd ); +} + +SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd, const uno::Reference< text::XText >& rText, sal_Bool _bMaySpanEndOfDocument ) throw (uno::RuntimeException) : SwVbaRange_BASE( rParent, rContext ),mxTextDocument( rTextDocument ), mxText( rText ), mbMaySpanEndOfDocument( _bMaySpanEndOfDocument ) +{ + initialize( rStart, rEnd ); +} + +SwVbaRange::~SwVbaRange() +{ +} + +void SwVbaRange::initialize( const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd ) throw (uno::RuntimeException) +{ + if( !mxText.is() ) + { + mxText = mxTextDocument->getText(); + } + + mxTextCursor = SwVbaRangeHelper::initCursor( rStart, mxText ); + mxTextCursor->collapseToStart(); + + if( rEnd.is() ) + mxTextCursor->gotoRange( rEnd, sal_True ); + else + mxTextCursor->gotoEnd( sal_True ); +} + +uno::Reference< text::XTextRange > SAL_CALL +SwVbaRange::getXTextRange() throw (uno::RuntimeException) +{ + uno::Reference< text::XTextRange > xTextRange( mxTextCursor, uno::UNO_QUERY_THROW ); + return xTextRange; +} + +void SwVbaRange::setXTextRange( const uno::Reference< text::XTextRange >& xRange ) throw (uno::RuntimeException) +{ + mxTextCursor->gotoRange( xRange->getStart(), sal_False ); + mxTextCursor->gotoRange( xRange->getEnd(), sal_True ); +} + +/** +* The complexity in this method is because we need to workaround +* an issue that the last paragraph in a document does not have a trailing CRLF. +* @return +*/ +rtl::OUString SAL_CALL +SwVbaRange::getText() throw ( uno::RuntimeException ) +{ + rtl::OUString aText = mxTextCursor->getString(); + sal_Int32 nLen = aText.getLength(); + + // FIXME: should add a line separator if the range includes the last paragraph + if( nLen == 0 ) + { + if( mxTextCursor->isCollapsed() ) + { + mxTextCursor->goRight( 1, sal_True ); + aText = mxTextCursor->getString(); + mxTextCursor->collapseToStart(); + } + else + { + uno::Reference< text::XTextRange > xStart = mxTextCursor->getStart(); + uno::Reference< text::XTextRange > xEnd = mxTextCursor->getEnd(); + mxTextCursor->collapseToEnd(); + mxTextCursor->goRight( 1, sal_True ); + mxTextCursor->gotoRange( xStart, sal_False ); + mxTextCursor->gotoRange( xEnd, sal_True ); + } + } + + return aText; +} + +void SAL_CALL +SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException ) +{ + if( rText.indexOf( '\n' ) != -1 ) + { + mxTextCursor->setString( rtl::OUString() ); + // process CR in strings + uno::Reference< text::XTextRange > xRange( mxTextCursor, uno::UNO_QUERY_THROW ); + SwVbaRangeHelper::insertString( xRange, mxText, rText, sal_True ); + } + else + { + mxTextCursor->setString( rText ); + } +} + +// FIXME: test is not pass +void SAL_CALL SwVbaRange::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException) +{ + // default type is wdPageBreak; + sal_Int32 nBreakType = word::WdBreakType::wdPageBreak; + if( _breakType.hasValue() ) + _breakType >>= nBreakType; + + style::BreakType eBreakType = style::BreakType_NONE; + switch( nBreakType ) + { + case word::WdBreakType::wdPageBreak: + eBreakType = style::BreakType_PAGE_BEFORE; + break; + case word::WdBreakType::wdColumnBreak: + eBreakType = style::BreakType_COLUMN_AFTER; + break; + case word::WdBreakType::wdLineBreak: + case word::WdBreakType::wdLineBreakClearLeft: + case word::WdBreakType::wdLineBreakClearRight: + case word::WdBreakType::wdSectionBreakContinuous: + case word::WdBreakType::wdSectionBreakEvenPage: + case word::WdBreakType::wdSectionBreakNextPage: + case word::WdBreakType::wdSectionBreakOddPage: + case word::WdBreakType::wdTextWrappingBreak: + DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() ); + break; + default: + DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); + } + + if( eBreakType != style::BreakType_NONE ) + { + if( !mxTextCursor->isCollapsed() ) + { + mxTextCursor->setString( rtl::OUString() ); + mxTextCursor->collapseToStart(); + } + + uno::Reference< beans::XPropertySet > xProp( mxTextCursor, uno::UNO_QUERY_THROW ); + xProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ), uno::makeAny( eBreakType ) ); + } +} + +void SAL_CALL +SwVbaRange::Select() throw ( uno::RuntimeException ) +{ + uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextViewCursor > xTextViewCursor = word::getXTextViewCursor( xModel ); + xTextViewCursor->gotoRange( mxTextCursor->getStart(), sal_False ); + xTextViewCursor->gotoRange( mxTextCursor->getEnd(), sal_True ); +} + +void SAL_CALL +SwVbaRange::InsertParagraph() throw ( uno::RuntimeException ) +{ + mxTextCursor->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); + InsertParagraphBefore(); +} + +void SAL_CALL +SwVbaRange::InsertParagraphBefore() throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextRange > xTextRange = mxTextCursor->getStart(); + mxText->insertControlCharacter( xTextRange, text::ControlCharacter::PARAGRAPH_BREAK, sal_True ); + mxTextCursor->gotoRange( xTextRange, sal_True ); +} + +void SAL_CALL +SwVbaRange::InsertParagraphAfter() throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextRange > xTextRange = mxTextCursor->getEnd(); + mxText->insertControlCharacter( xTextRange, text::ControlCharacter::PARAGRAPH_BREAK, sal_True ); +} + +uno::Reference< word::XParagraphFormat > SAL_CALL +SwVbaRange::getParagraphFormat() throw ( uno::RuntimeException ) +{ + uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW ); + return uno::Reference< word::XParagraphFormat >( new SwVbaParagraphFormat( this, mxContext, mxTextDocument, xParaProps ) ); +} + +void SAL_CALL +SwVbaRange::setParagraphFormat( const uno::Reference< word::XParagraphFormat >& /*rParagraphFormat*/ ) throw ( uno::RuntimeException ) +{ + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); +} + +uno::Reference< word::XStyle > SAL_CALL +SwVbaRange::getStyle() throw ( uno::RuntimeException ) +{ + rtl::OUString aStyleName; + rtl::OUString aStyleType; + uno::Reference< beans::XPropertySet > xProp( mxTextCursor, uno::UNO_QUERY_THROW ); + if( ( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharStyleName") ) ) >>= aStyleName ) && aStyleName.getLength() ) + { + aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") ); + } + else if( ( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ) ) >>= aStyleName ) && aStyleName.getLength() ) + { + aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ); + } + if( aStyleType.getLength() == 0 ) + { + DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() ); + } + uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW); + uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW ); + return uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) ); +} + +void SAL_CALL +SwVbaRange::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException ) +{ + uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW ); + SwVbaStyle::setStyle( xParaProps, rStyle ); +} + +uno::Reference< word::XFont > SAL_CALL +SwVbaRange::getFont() throw ( uno::RuntimeException ) +{ + VbaPalette aColors; + return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), uno::Reference< beans::XPropertySet >( getXTextRange(), uno::UNO_QUERY_THROW ) ); +} + +::sal_Int32 SAL_CALL SwVbaRange::getLanguageID() throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW ); + return SwVbaStyle::getLanguageID( xParaProps ); +} + +void SAL_CALL SwVbaRange::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW ); + SwVbaStyle::setLanguageID( xParaProps, _languageid ); +} + +uno::Any SAL_CALL +SwVbaRange::PageSetup( ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW ); + uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW ); + rtl::OUString aPageStyleName; + xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName; + uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPageProps( xPageStyles->getByName( aPageStyleName ), uno::UNO_QUERY_THROW ); + return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, xModel, xPageProps ) ) ); +} + +::sal_Int32 SAL_CALL SwVbaRange::getStart() throw (uno::RuntimeException) +{ + uno::Reference< text::XText > xText = mxTextDocument->getText(); + return SwVbaRangeHelper::getPosition( xText, mxTextCursor->getStart() ); +} + +void SAL_CALL SwVbaRange::setStart( ::sal_Int32 _start ) throw (uno::RuntimeException) +{ + uno::Reference< text::XText > xText = mxTextDocument->getText(); + uno::Reference< text::XTextRange > xStart = SwVbaRangeHelper::getRangeByPosition( xText, _start ); + uno::Reference< text::XTextRange > xEnd = mxTextCursor->getEnd(); + + mxTextCursor->gotoRange( xStart, sal_False ); + mxTextCursor->gotoRange( xEnd, sal_True ); +} + +::sal_Int32 SAL_CALL SwVbaRange::getEnd() throw (uno::RuntimeException) +{ + uno::Reference< text::XText > xText = mxTextDocument->getText(); + return SwVbaRangeHelper::getPosition( xText, mxTextCursor->getEnd() ); +} + +void SAL_CALL SwVbaRange::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeException) +{ + uno::Reference< text::XText > xText = mxTextDocument->getText(); + uno::Reference< text::XTextRange > xEnd = SwVbaRangeHelper::getRangeByPosition( xText, _end ); + + mxTextCursor->collapseToStart(); + mxTextCursor->gotoRange( xEnd, sal_True ); +} + +rtl::OUString& +SwVbaRange::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRange") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaRange::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Range" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbarange.hxx b/sw/source/ui/vba/vbarange.hxx new file mode 100644 index 0000000000..d0d47b7872 --- /dev/null +++ b/sw/source/ui/vba/vbarange.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_RANGE_HXX +#define SW_VBA_RANGE_HXX + +#include <ooo/vba/word/XRange.hpp> +#include <ooo/vba/word/XParagraphFormat.hpp> +#include <ooo/vba/word/XFont.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/text/XTextDocument.hpp> +#include <ooo/vba/word/XStyle.hpp> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaRange_BASE; + +class SwVbaRange : public SwVbaRange_BASE +{ +private: + css::uno::Reference< css::text::XTextDocument > mxTextDocument; + css::uno::Reference< css::text::XTextCursor > mxTextCursor; + css::uno::Reference< css::text::XText > mxText; + sal_Bool mbMaySpanEndOfDocument; + +private: + void initialize( const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd ) throw (css::uno::RuntimeException); +public: + SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException); + SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException); + SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, const css::uno::Reference< css::text::XText >& rText, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException); + virtual ~SwVbaRange(); + css::uno::Reference< css::text::XTextDocument > getDocument() { return mxTextDocument; } + + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getXTextRange() throw (css::uno::RuntimeException); + void setXTextRange( const css::uno::Reference< css::text::XTextRange >& xRange ) throw (css::uno::RuntimeException); + css::uno::Reference< css::text::XText > getXText() { return mxText; } + void setXTextCursor( const css::uno::Reference< css::text::XTextCursor >& xTextCursor ) { mxTextCursor = xTextCursor; } + + // Attribute + virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); + virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException); + virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException); + virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException); + + virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException); + // Methods + virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Select() throw (css::uno::RuntimeException); + virtual void SAL_CALL InsertParagraph() throw (css::uno::RuntimeException); + virtual void SAL_CALL InsertParagraphBefore() throw (css::uno::RuntimeException); + virtual void SAL_CALL InsertParagraphAfter() throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getLanguageID() throw (css::uno::RuntimeException); + virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL PageSetup() throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getStart() throw (css::uno::RuntimeException); + virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException); + virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_RANGE_HXX */ diff --git a/sw/source/ui/vba/vbarangehelper.cxx b/sw/source/ui/vba/vbarangehelper.cxx new file mode 100644 index 0000000000..5df01b883f --- /dev/null +++ b/sw/source/ui/vba/vbarangehelper.cxx @@ -0,0 +1,174 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbarangehelper.hxx" +#include <com/sun/star/text/ControlCharacter.hpp> +#include <com/sun/star/text/XTextRangeCompare.hpp> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +/** + * get a range in a xText by creating + * a cursor that iterates over the text. If the iterating cursor is + * equal to the desired position, the range equivalent is returned. + * Some special cases are tables that are inside of the text, because the + * position has to be adjusted. + * @param xText a text where a range position is searched + * @param position a position inside o the text + * @return a range for the postion; null is returned if no range can be + * constructed. + */ +uno::Reference< text::XTextRange > SwVbaRangeHelper::getRangeByPosition( const uno::Reference< text::XText >& rText, sal_Int32 _position ) throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextRange > xRange; + if( rText.is() ) + { + sal_Int32 nPos = 0; + uno::Reference< text::XTextCursor > xCursor = rText->createTextCursor(); + xCursor->collapseToStart(); + sal_Bool bCanGo = sal_True; + while( !xRange.is() && bCanGo ) + { + if( _position == nPos ) + { + xRange = xCursor->getStart(); + } + else + { + bCanGo = xCursor->goRight( 1, sal_False ); + nPos++; + } + } + } + return xRange; +} + + +void SwVbaRangeHelper::insertString( uno::Reference< text::XTextRange >& rTextRange, uno::Reference< text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( uno::RuntimeException ) +{ + sal_Int32 nlastIndex = 0; + sal_Int32 nIndex = 0; + uno::Reference< text::XTextRange > xRange = rTextRange; + + while(( nIndex = rStr.indexOf('\n', nlastIndex)) >= 0 ) + { + xRange = xRange->getEnd(); + if( nlastIndex < ( nIndex - 1 ) ) + { + rText->insertString( xRange, rStr.copy( nlastIndex, ( nIndex - 1 - nlastIndex ) ), _bAbsorb ); + xRange = xRange->getEnd(); + } + + rText->insertControlCharacter( xRange, text::ControlCharacter::PARAGRAPH_BREAK, _bAbsorb ); + nlastIndex = nIndex + 1; + } + + if( nlastIndex < rStr.getLength() ) + { + xRange = xRange->getEnd(); + + rtl::OUString aWatt = rStr.copy( nlastIndex ); + rText->insertString( xRange, aWatt, _bAbsorb ); + } +} + +uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Reference< text::XTextRange >& rTextRange, const uno::Reference< text::XText >& rText ) throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextCursor > xTextCursor; + sal_Bool bGotTextCursor = sal_False; + + try + { + xTextCursor = rText->createTextCursorByRange( rTextRange ); + bGotTextCursor = sal_True; + } + catch (uno::Exception& e) + { + DebugHelper::exception(e); + } + + if( !bGotTextCursor ) + { + try + { + uno::Reference< text::XText > xText = rTextRange->getText(); + xTextCursor = xText->createTextCursor(); + bGotTextCursor = sal_True; + } + catch( uno::Exception& e ) + { + DebugHelper::exception(e); + } + } + + if( !bGotTextCursor ) + { + try + { + xTextCursor = rText->createTextCursor(); + bGotTextCursor = sal_True; + } + catch( uno::Exception& e ) + { + DebugHelper::exception(e); + } + } + return xTextCursor; +} + +sal_Int32 SwVbaRangeHelper::getPosition( const uno::Reference< text::XText >& rText, const uno::Reference< text::XTextRange >& rTextRange ) throw ( uno::RuntimeException ) +{ + sal_Int32 nPosition = -1; + if( rText.is() && rTextRange.is() ) + { + nPosition = 0; + uno::Reference< text::XTextCursor > xCursor = rText->createTextCursor(); + xCursor->collapseToStart(); + uno::Reference< text::XTextRangeCompare > xCompare( rText, uno::UNO_QUERY_THROW ); + // compareValue is 0 if the ranges are equal + sal_Int32 nCompareValue = xCompare->compareRegionStarts( xCursor->getStart(), rTextRange ); + sal_Bool canGo = sal_True; + + while( nCompareValue !=0 && canGo ) + { + canGo = xCursor->goRight( 1, sal_False ); + nCompareValue = xCompare->compareRegionStarts( xCursor->getStart(), rTextRange ); + nPosition++; + } + + // check fails: no correct position found + if( !canGo && nCompareValue != 0 ) + { + nPosition = -1; + } + } + + return nPosition; +} diff --git a/sw/source/ui/vba/vbarangehelper.hxx b/sw/source/ui/vba/vbarangehelper.hxx new file mode 100644 index 0000000000..5e478999d7 --- /dev/null +++ b/sw/source/ui/vba/vbarangehelper.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_RANGEHELPER_HXX +#define SW_VBA_RANGEHELPER_HXX + +#include <vbahelper/vbahelperinterface.hxx> +#include <com/sun/star/text/XTextViewCursor.hpp> +#include <com/sun/star/text/XText.hpp> + +class SwVbaRangeHelper +{ +public: + static css::uno::Reference< css::text::XTextRange > getRangeByPosition( const css::uno::Reference< css::text::XText >& rText, sal_Int32 _position )throw ( css::uno::RuntimeException ); + static void insertString( css::uno::Reference< css::text::XTextRange >& rTextRange, css::uno::Reference< css::text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( css::uno::RuntimeException ); + static css::uno::Reference< css::text::XTextCursor > initCursor( const css::uno::Reference< css::text::XTextRange >& rTextRange, const css::uno::Reference< css::text::XText >& rText ) throw ( css::uno::RuntimeException ); + static sal_Int32 getPosition( const css::uno::Reference< css::text::XText >& rText, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw ( css::uno::RuntimeException ); + +}; +#endif /* SW_VBA_RANGEHELPER_HXX */ diff --git a/sw/source/ui/vba/vbareplacement.cxx b/sw/source/ui/vba/vbareplacement.cxx new file mode 100644 index 0000000000..b9f6ce717b --- /dev/null +++ b/sw/source/ui/vba/vbareplacement.cxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbareplacement.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaReplacement::SwVbaReplacement( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< util::XPropertyReplace >& xPropertyReplace ) throw ( uno::RuntimeException ) : + SwVbaReplacement_BASE( rParent, rContext ), mxPropertyReplace( xPropertyReplace ) +{ +} + +SwVbaReplacement::~SwVbaReplacement() +{ +} + +::rtl::OUString SAL_CALL SwVbaReplacement::getText() throw (uno::RuntimeException) +{ + return mxPropertyReplace->getReplaceString(); +} + +void SAL_CALL SwVbaReplacement::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException) +{ + mxPropertyReplace->setReplaceString( _text ); +} + +rtl::OUString& +SwVbaReplacement::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaReplacement") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaReplacement::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Replacement" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbareplacement.hxx b/sw/source/ui/vba/vbareplacement.hxx new file mode 100644 index 0000000000..63df4d9dab --- /dev/null +++ b/sw/source/ui/vba/vbareplacement.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_REPLACEMENT_HXX +#define SW_VBA_REPLACEMENT_HXX + +#include <ooo/vba/word/XReplacement.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/util/XPropertyReplace.hpp> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XReplacement > SwVbaReplacement_BASE; + +class SwVbaReplacement : public SwVbaReplacement_BASE +{ +private: + css::uno::Reference< css::util::XPropertyReplace> mxPropertyReplace; + +public: + SwVbaReplacement( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::util::XPropertyReplace >& xPropertyReplace ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaReplacement(); + + // Attributes + virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); + virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_REPLACEMENT_HXX */ diff --git a/sw/source/ui/vba/vbasection.cxx b/sw/source/ui/vba/vbasection.cxx new file mode 100644 index 0000000000..4d1848bbe1 --- /dev/null +++ b/sw/source/ui/vba/vbasection.cxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbasection.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include "vbapagesetup.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaSection::SwVbaSection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xProps ) throw ( uno::RuntimeException ) : + SwVbaSection_BASE( rParent, rContext ), mxModel( xModel ), mxPageProps( xProps ) +{ +} + +SwVbaSection::~SwVbaSection() +{ +} + +::sal_Bool SAL_CALL SwVbaSection::getProtectedForForms() throw (uno::RuntimeException) +{ + return sal_False; +} + +void SAL_CALL SwVbaSection::setProtectedForForms( ::sal_Bool /*_protectedforforms*/ ) throw (uno::RuntimeException) +{ +} + +uno::Any SAL_CALL SwVbaSection::Headers( ) throw (uno::RuntimeException) +{ + return uno::Any(); +} + +uno::Any SAL_CALL SwVbaSection::Footers( ) throw (uno::RuntimeException) +{ + return uno::Any(); +} + +uno::Any SAL_CALL +SwVbaSection::PageSetup( ) throw (uno::RuntimeException) +{ + return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, mxModel, mxPageProps ) ) ); +} + +rtl::OUString& +SwVbaSection::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSection") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaSection::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Section" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbasection.hxx b/sw/source/ui/vba/vbasection.hxx new file mode 100644 index 0000000000..8e8bb15c89 --- /dev/null +++ b/sw/source/ui/vba/vbasection.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_SECTION_HXX +#define SW_VBA_SECTION_HXX + +#include <ooo/vba/word/XSection.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSection > SwVbaSection_BASE; + +class SwVbaSection : public SwVbaSection_BASE +{ +private: + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::beans::XPropertySet > mxPageProps; + +public: + SwVbaSection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaSection(); + + // Attributes + virtual ::sal_Bool SAL_CALL getProtectedForForms() throw (css::uno::RuntimeException); + virtual void SAL_CALL setProtectedForForms( ::sal_Bool _protectedforforms ) throw (css::uno::RuntimeException); + + // Methods + virtual css::uno::Any SAL_CALL Headers( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Footers( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL PageSetup( ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_SECTION_HXX */ diff --git a/sw/source/ui/vba/vbasections.cxx b/sw/source/ui/vba/vbasections.cxx new file mode 100644 index 0000000000..c2bc7c3a73 --- /dev/null +++ b/sw/source/ui/vba/vbasections.cxx @@ -0,0 +1,190 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbasections.hxx" +#include "vbasection.hxx" +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/style/XStyle.hpp> +#include <docsh.hxx> +#include <doc.hxx> +#include "wordvbahelper.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +typedef ::cppu::WeakImplHelper1< container::XEnumeration > SectionEnumeration_BASE; +typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > SectionCollectionHelper_Base; +typedef std::vector< uno::Reference< beans::XPropertySet > > XSectionVec; + +class SectionEnumeration : public SectionEnumeration_BASE +{ + XSectionVec mxSections; + XSectionVec::iterator mIt; + +public: + SectionEnumeration( const XSectionVec& rVec ) : mxSections( rVec ), mIt( mxSections.begin() ) {} + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) + { + return ( mIt != mxSections.end() ); + } + + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( hasMoreElements() ) + return uno::makeAny( *mIt++ ); + throw container::NoSuchElementException(); + } +}; + +// here I regard pagestyle as section +class SectionCollectionHelper : public SectionCollectionHelper_Base +{ +private: + uno::Reference< XHelperInterface > mxParent; + uno::Reference< uno::XComponentContext > mxContext; + uno::Reference< frame::XModel > mxModel; + XSectionVec mxSections; + +public: + SectionCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ) + { + uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( mxModel, uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW ); + sal_Int32 nCount = xPageStyles->getCount(); + for( sal_Int32 index = 0; index < nCount; ++index ) + { + uno::Reference< style::XStyle > xStyle( xPageStyles->getByIndex( index ), uno::UNO_QUERY_THROW ); + // only the pagestyles in using are considered + if( xStyle->isInUse( ) ) + { + uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW ); + mxSections.push_back( xPageProps ); + } + } + } + + ~SectionCollectionHelper(){} + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) + { + return mxSections.size(); + } + virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( Index < 0 || Index >= getCount() ) + throw css::lang::IndexOutOfBoundsException(); + + uno::Reference< beans::XPropertySet > xPageProps( mxSections[ Index ], uno::UNO_QUERY_THROW ); + return uno::makeAny( uno::Reference< word::XSection >( new SwVbaSection( mxParent, mxContext, mxModel, xPageProps ) ) ); + } + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) + { + return word::XSection::static_type(0); + } + virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) + { + return sal_True; + } + // XEnumerationAccess + virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) + { + return new SectionEnumeration( mxSections ); + } +}; + +class SectionsEnumWrapper : public EnumerationHelperImpl +{ + uno::Reference< frame::XModel > mxModel; + uno::WeakReference< XHelperInterface > mxParent; +public: + SectionsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), mxModel( xModel ), mxParent( xParent ) {} + + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + uno::Reference< beans::XPropertySet > xPageProps( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); + return uno::makeAny( uno::Reference< word::XSection > ( new SwVbaSection( mxParent, m_xContext, mxModel, xPageProps ) ) ); + } +}; + +SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaSections_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new SectionCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel ) +{ +} + +uno::Any SAL_CALL +SwVbaSections::PageSetup( ) throw (uno::RuntimeException) +{ + if( m_xIndexAccess->getCount() ) + { + // check if the first section is our want + uno::Reference< word::XSection > xSection( m_xIndexAccess->getByIndex( 0 ), uno::UNO_QUERY_THROW ); + return xSection->PageSetup(); + } + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("There is no section") ), uno::Reference< uno::XInterface >() ); +} + +// XEnumerationAccess +uno::Type SAL_CALL +SwVbaSections::getElementType() throw (uno::RuntimeException) +{ + return word::XSection::static_type(0); +} + +uno::Reference< container::XEnumeration > SAL_CALL +SwVbaSections::createEnumeration() throw (uno::RuntimeException) +{ + uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); + return new SectionsEnumWrapper( this, mxContext, xEnumAccess->createEnumeration(), mxModel ); +} + +uno::Any +SwVbaSections::createCollectionObject( const css::uno::Any& aSource ) +{ + return aSource; +} + +rtl::OUString& +SwVbaSections::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSections") ); + return sImplName; +} + +css::uno::Sequence<rtl::OUString> +SwVbaSections::getServiceNames() +{ + static uno::Sequence< rtl::OUString > sNames; + if ( sNames.getLength() == 0 ) + { + sNames.realloc( 1 ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Sections") ); + } + return sNames; +} diff --git a/sw/source/ui/vba/vbasections.hxx b/sw/source/ui/vba/vbasections.hxx new file mode 100644 index 0000000000..c247ce1e9a --- /dev/null +++ b/sw/source/ui/vba/vbasections.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_SECTIONS_HXX +#define SW_VBA_SECTIONS_HXX + +#include <vbahelper/vbacollectionimpl.hxx> +#include <ooo/vba/word/XSections.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <vbahelper/vbahelperinterface.hxx> + +typedef CollTestImplHelper< ooo::vba::word::XSections > SwVbaSections_BASE; + +class SwVbaSections : public SwVbaSections_BASE +{ +private: + css::uno::Reference< css::frame::XModel > mxModel; + +public: + SwVbaSections( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel ); + virtual ~SwVbaSections() {} + + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + + virtual css::uno::Any SAL_CALL PageSetup( ) throw (css::uno::RuntimeException); + + // SwVbaSections_BASE + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif /* SW_VBA_SECTIONS_HXX */ diff --git a/sw/source/ui/vba/vbaselection.cxx b/sw/source/ui/vba/vbaselection.cxx new file mode 100644 index 0000000000..386e523a3c --- /dev/null +++ b/sw/source/ui/vba/vbaselection.cxx @@ -0,0 +1,682 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaselection.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include "vbarange.hxx" +#include "vbafind.hxx" +#include "wordvbahelper.hxx" +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/text/XTextTable.hpp> +#include <com/sun/star/text/XTextTableCursor.hpp> +#include <com/sun/star/text/ControlCharacter.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <ooo/vba/word/WdUnits.hpp> +#include <ooo/vba/word/WdMovementType.hpp> +#include <ooo/vba/word/WdGoToItem.hpp> +#include <ooo/vba/word/WdGoToDirection.hpp> +#include <ooo/vba/word/XBookmark.hpp> +#include <ooo/vba/word/XApplication.hpp> +#include <com/sun/star/text/XPageCursor.hpp> +#include "unotbl.hxx" +#include "unocoll.hxx" +#include "vbatable.hxx" +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/view/XViewCursor.hpp> +#include <ooo/vba/word/WdInformation.hpp> +#include <ooo/vba/word/WdHeaderFooterIndex.hpp> +#include "vbainformationhelper.hxx" +#include "vbafield.hxx" +#include "vbaheaderfooter.hxx" +#include "vbaheaderfooterhelper.hxx" +#include <vbahelper/vbashaperange.hxx> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaSelection::SwVbaSelection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel ) throw ( uno::RuntimeException ) : SwVbaSelection_BASE( rParent, rContext ), mxModel( rModel ) +{ + mxTextViewCursor = word::getXTextViewCursor( mxModel ); +} + +SwVbaSelection::~SwVbaSelection() +{ +} + +uno::Reference< text::XTextRange > SwVbaSelection::GetSelectedRange() throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextRange > xTextRange; + uno::Reference< lang::XServiceInfo > xServiceInfo( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW ); + if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextRanges") ) ) ) + { + uno::Reference< container::XIndexAccess > xTextRanges( xServiceInfo, uno::UNO_QUERY_THROW ); + if( xTextRanges->getCount() > 0 ) + { + // if there are multipul selection, just return the last selected Range. + xTextRange.set( xTextRanges->getByIndex( xTextRanges->getCount()-1 ), uno::UNO_QUERY_THROW ); + } + } + else + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + } + return xTextRange; +} + +uno::Reference< word::XRange > SAL_CALL +SwVbaSelection::getRange() throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextRange > xTextRange = GetSelectedRange(); + uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW ); + return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, xDocument, xTextRange->getStart(), xTextRange->getEnd(), mxTextViewCursor->getText() ) ); +} + +rtl::OUString SAL_CALL +SwVbaSelection::getText() throw ( uno::RuntimeException ) +{ + return getRange()->getText(); +} + +void SAL_CALL +SwVbaSelection::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException ) +{ + getRange()->setText( rText ); +} + +void SAL_CALL +SwVbaSelection::TypeText( const rtl::OUString& rText ) throw ( uno::RuntimeException ) +{ + // FIXME: handle the property Options.ReplaceSelection, the default value is TRUE + setText( rText ); +} + +void SAL_CALL +SwVbaSelection::HomeKey( const uno::Any& _unit, const uno::Any& _extend ) throw ( uno::RuntimeException ) +{ + sal_Int32 nUnit = word::WdUnits::wdLine; + sal_Int32 nExtend = word::WdMovementType::wdMove; + _unit >>= nUnit; + _extend >>= nExtend; + + switch( nUnit ) + { + case word::WdUnits::wdStory: + { + // go to the begin of the document + rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc")); + dispatchRequests( mxModel,url ); + // If something is selected, it needs to go twice + dispatchRequests( mxModel,url ); + break; + } + case word::WdUnits::wdLine: + { + // go to the begin of the Line + rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfLine")); + dispatchRequests( mxModel,url ); + break; + } + default: + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + break; + } + } +} + +void SAL_CALL +SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw ( uno::RuntimeException ) +{ + sal_Int32 nUnit = word::WdUnits::wdLine; + sal_Int32 nExtend = word::WdMovementType::wdMove; + _unit >>= nUnit; + _extend >>= nExtend; + + switch( nUnit ) + { + case word::WdUnits::wdStory: + { + // go to the end of the document + rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc")); + dispatchRequests( mxModel,url ); + // If something is selected, it needs to go twice + dispatchRequests( mxModel,url ); + break; + } + case word::WdUnits::wdLine: + { + // go to the end of the Line + rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfLine")); + dispatchRequests( mxModel,url ); + break; + } + default: + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + break; + } + } +} + +void SAL_CALL +SwVbaSelection::Delete( const uno::Any& /*_unit*/, const uno::Any& /*_count*/ ) throw ( uno::RuntimeException ) +{ + // FIXME: handle the arguments: _unit and _count + rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete")); + dispatchRequests( mxModel,url ); +} + +void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( uno::RuntimeException ) +{ + uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextTable > xTextTable; + uno::Reference< table::XCell > xCell; + xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable; + xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cell") ) ) >>= xCell; + if( !xTextTable.is() || !xCell.is() ) + { + DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); + return; + } + uno::Reference< beans::XPropertySet > xCellProps( xCell, uno::UNO_QUERY_THROW ); + rtl::OUString aCellName; + xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellName") ) ) >>= aCellName; + uno::Reference< text::XTextTableCursor > xTextTableCursor = xTextTable->createCursorByCellName( aCellName ); + // move the table cursor + switch( eDirection ) + { + case MOVE_LEFT: + { + xTextTableCursor->goLeft( nCount, sal_False ); + break; + } + case MOVE_RIGHT: + { + xTextTableCursor->goRight( nCount, sal_False ); + break; + } + case MOVE_UP: + { + xTextTableCursor->goUp( nCount, sal_False ); + break; + } + case MOVE_DOWN: + { + xTextTableCursor->goDown( nCount, sal_False ); + break; + } + default: + { + DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); + return; + } + } + // move the view cursor + xCell = xTextTable->getCellByName( xTextTableCursor->getRangeName() ); + mxTextViewCursor->gotoRange( uno::Reference< text::XTextRange >( xCell, uno::UNO_QUERY_THROW ), sal_False ); +} + +void SAL_CALL +SwVbaSelection::MoveRight( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException ) +{ + sal_Int32 nUnit = word::WdUnits::wdCharacter; + sal_Int32 nCount = 1; + sal_Int32 nExtend = word::WdMovementType::wdMove; + + if( _unit.hasValue() ) + _unit >>= nUnit; + if( _count.hasValue() ) + _count >>= nCount; + if( _extend.hasValue() ) + _extend >>= nExtend; + + if( nCount == 0 ) + return; + + if( nCount < 0 ) + { + // TODO: call MoveLeft; + MoveLeft( _unit, uno::makeAny( -nCount ), _extend ); + return; + } + + switch( nUnit ) + { + case word::WdUnits::wdCell: + { + if( nExtend == word::WdMovementType::wdExtend ) + { + DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); + return; + } + NextCell( nCount, MOVE_RIGHT ); + break; + } + default: + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + break; + } + } + +} + +void SAL_CALL +SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException ) +{ + sal_Int32 nUnit = word::WdUnits::wdCharacter; + sal_Int32 nCount = 1; + sal_Int32 nExtend = word::WdMovementType::wdMove; + + if( _unit.hasValue() ) + _unit >>= nUnit; + if( _count.hasValue() ) + _count >>= nCount; + if( _extend.hasValue() ) + _extend >>= nExtend; + + if( nCount == 0 ) + return; + + if( nCount < 0 ) + { + MoveRight( _unit, uno::makeAny( -nCount ), _extend ); + return; + } + + switch( nUnit ) + { + case word::WdUnits::wdCell: + { + if( nExtend == word::WdMovementType::wdExtend ) + { + DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); + return; + } + NextCell( nCount, MOVE_LEFT ); + break; + } + default: + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + break; + } + } + +} + +void SAL_CALL +SwVbaSelection::MoveDown( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException ) +{ + sal_Int32 nUnit = word::WdUnits::wdCharacter; + sal_Int32 nCount = 1; + sal_Int32 nExtend = word::WdMovementType::wdMove; + + if( _unit.hasValue() ) + _unit >>= nUnit; + if( _count.hasValue() ) + _count >>= nCount; + if( _extend.hasValue() ) + _extend >>= nExtend; + + if( nCount == 0 ) + return; + + if( nCount < 0 ) + { + // TODO: call MoveLeft; + //MoveUp( _unit, uno::makeAny( -nCount ), _extend ); + return; + } + + switch( nUnit ) + { + case word::WdUnits::wdLine: + { + uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW ); + sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True; + xViewCursor->goDown( nCount, bExpand ); + break; + } + default: + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + break; + } + } + +} + +void SAL_CALL +SwVbaSelection::TypeParagraph() throw ( uno::RuntimeException ) +{ + // #FIXME: if the selection is an entire paragraph, it's replaced + // by the new paragraph + sal_Bool isCollapsed = mxTextViewCursor->isCollapsed(); + InsertParagraph(); + if( isCollapsed ) + mxTextViewCursor->collapseToStart(); +} + +void SAL_CALL +SwVbaSelection::InsertParagraph() throw ( uno::RuntimeException ) +{ + // #FIME: the selection should include the new paragraph. + getRange()->InsertParagraph(); +} + +void SAL_CALL +SwVbaSelection::InsertParagraphBefore() throw ( uno::RuntimeException ) +{ + getRange()->InsertParagraphBefore(); +} + +void SAL_CALL +SwVbaSelection::InsertParagraphAfter() throw ( uno::RuntimeException ) +{ + getRange()->InsertParagraphAfter(); +} + +uno::Reference< word::XParagraphFormat > SAL_CALL +SwVbaSelection::getParagraphFormat() throw ( uno::RuntimeException ) +{ + return getRange()->getParagraphFormat(); +} + +void SAL_CALL +SwVbaSelection::setParagraphFormat( const uno::Reference< word::XParagraphFormat >& rParagraphFormat ) throw ( uno::RuntimeException ) +{ + return getRange()->setParagraphFormat( rParagraphFormat ); +} + +uno::Reference< word::XFind > SAL_CALL +SwVbaSelection::getFind() throw ( uno::RuntimeException ) +{ + uno::Reference< text::XTextRange > xTextRange = GetSelectedRange(); + return uno::Reference< word::XFind >( new SwVbaFind( this, mxContext, mxModel, xTextRange ) ); +} + +uno::Reference< word::XStyle > SAL_CALL +SwVbaSelection::getStyle() throw ( uno::RuntimeException ) +{ + return getRange()->getStyle(); +} + +void SAL_CALL +SwVbaSelection::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException ) +{ + return getRange()->setStyle( rStyle ); +} + +uno::Reference< word::XFont > SAL_CALL +SwVbaSelection::getFont() throw ( uno::RuntimeException ) +{ + return getRange()->getFont(); +} + +void SAL_CALL +SwVbaSelection::TypeBackspace() throw ( uno::RuntimeException ) +{ + rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SwBackspace")); + dispatchRequests( mxModel,url ); +} + +uno::Reference< word::XRange > SAL_CALL SwVbaSelection::GoTo( const uno::Any& _what, const uno::Any& _which, const uno::Any& _count, const uno::Any& _name ) throw (uno::RuntimeException) +{ + sal_Int32 nWhat = 0; + if( ( _what >>= nWhat ) != sal_True ) + DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); + switch( nWhat ) + { + case word::WdGoToItem::wdGoToBookmark: + { + rtl::OUString sName; + uno::Reference< word::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); + uno::Reference< word::XBookmark > xBookmark( xApplication->getActiveDocument()->Bookmarks(_name), uno::UNO_QUERY_THROW ); + xBookmark->Select(); + //return uno::Reference< word::XRange >( xBookmark->Range(), uno::UNO_QUERY_THROW ); + break; + } + case word::WdGoToItem::wdGoToPage: + { + uno::Reference< text::XPageCursor > xPageCursor( mxTextViewCursor, uno::UNO_QUERY_THROW ); + sal_Int32 nCurrPage = xPageCursor->getPage(); + sal_Int32 nLastPage = word::getPageCount( mxModel ); + sal_Int32 nCount = 0; + if( _count.hasValue() ) + _count >>= nCount; + sal_Int32 nWhich = 0; + if( _which.hasValue() ) + _which >>= nWhich; + sal_Int32 nPage = 0; + switch( nWhich ) + { + case word::WdGoToDirection::wdGoToLast: + { + nPage = nLastPage; + break; + } + case word::WdGoToDirection::wdGoToNext: + { + nPage = nCurrPage + 1; + break; + } + case word::WdGoToDirection::wdGoToPrevious: + { + nPage = nCurrPage - 1; + break; + } + default: + { + nPage = nCount; + } + } + if( nPage <= 0 ) + nPage = 1; + if( nPage > nLastPage ) + nPage = nLastPage; + xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) ); + break; + } + case word::WdGoToItem::wdGoToSection: + { + // TODO: implement Section object + } + default: + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + } + return getRange(); +} + +::sal_Int32 SAL_CALL SwVbaSelection::getLanguageID() throw (uno::RuntimeException) +{ + return getRange()->getLanguageID(); +} + +void SAL_CALL SwVbaSelection::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException) +{ + getRange()->setLanguageID( _languageid ); +} + +uno::Any SAL_CALL SwVbaSelection::Information( sal_Int32 _type ) throw (uno::RuntimeException) +{ + uno::Any result; + //uno::Reference< view::XSelectionSupplier > xSel( mxModel->getCurrentController(), uno::UNO_QUERY_THROW ); + //uno::Any aSelectedObject = xSel->getSelection(); + switch( _type ) + { + case word::WdInformation::wdActiveEndPageNumber: + { + result = uno::makeAny( SwVbaInformationHelper::handleWdActiveEndPageNumber( mxTextViewCursor ) ); + break; + } + case word::WdInformation::wdNumberOfPagesInDocument: + { + result = uno::makeAny( SwVbaInformationHelper::handleWdNumberOfPagesInDocument( mxModel ) ); + break; + } + case word::WdInformation::wdVerticalPositionRelativeToPage: + { + result = uno::makeAny( SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( mxModel, mxTextViewCursor ) ); + break; + } + default: + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + } + // This method fails to restore the previouse selection + //xSel->select( aSelectedObject ); + return result; +} + +void SAL_CALL SwVbaSelection::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException) +{ + getRange()->InsertBreak( _breakType ); +} + +uno::Any SAL_CALL +SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException) +{ + // Hacky implementation due to missing api ( and lack of knowledge ) + // we can only support a selection that is a single table + if ( !aIndex.hasValue() ) // currently we can't support multiple tables in a selection + throw uno::RuntimeException(); + // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw + uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY ); + + if ( !xTextTableCursor.is() ) + throw uno::RuntimeException(); + + sal_Int32 nIndex = 0; + aIndex >>= nIndex; + + uno::Any aRet; + + if ( nIndex != 1 ) + throw uno::RuntimeException(); + SwXTextTableCursor* pTTCursor = dynamic_cast< SwXTextTableCursor* >( xTextTableCursor.get() ); + if ( pTTCursor ) + { + SwFrmFmt* pFmt = pTTCursor->GetFrmFmt(); + rtl::OUString sTableName; + if ( pFmt ) + { + uno::Reference< text::XTextTable > xTbl = SwXTextTables::GetObject(*pFmt); + uno::Reference< css::text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW ); + uno::Reference< word::XTable > xVBATbl = new SwVbaTable( mxParent, mxContext, xTextDoc, xTbl ); + aRet <<= xVBATbl; + } + } + return aRet; + +} + +uno::Any SAL_CALL +SwVbaSelection::Fields( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, mxModel ) ); + if ( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +uno::Reference< word::XHeaderFooter > SAL_CALL +SwVbaSelection::getHeaderFooter() throw ( uno::RuntimeException ) +{ + uno::Reference< text::XText > xCurrentText = word::getXTextViewCursor( mxModel )->getText(); + if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFooter( mxModel, xCurrentText ) ) + { + uno::Reference< beans::XPropertySet > xPageStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW ); + sal_Int32 nIndex = word::WdHeaderFooterIndex::wdHeaderFooterPrimary; + sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel, xCurrentText ); + if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) ) + nIndex = word::WdHeaderFooterIndex::wdHeaderFooterEvenPages; + else if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) ) + nIndex = word::WdHeaderFooterIndex::wdHeaderFooterFirstPage; + + return uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, xPageStyleProps, isHeader, nIndex ) ); + + } + return uno::Reference< word::XHeaderFooter >(); +} + +uno::Any SAL_CALL +SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException) +{ + uno::Reference< drawing::XShapes > xShapes( mxModel->getCurrentSelection(), uno::UNO_QUERY ); + + if ( !xShapes.is() ) + throw uno::RuntimeException(); + + uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW ); + uno::Reference< drawing::XDrawPage > xDrawPage = xDrawPageSupplier->getDrawPage(); + uno::Reference< container::XIndexAccess > xShapesAccess( xShapes, uno::UNO_QUERY_THROW ); + return uno::makeAny( uno::Reference< msforms::XShapeRange >( new ScVbaShapeRange( this, mxContext, xShapesAccess, xDrawPage, mxModel ) ) ); +} + +::sal_Int32 SAL_CALL SwVbaSelection::getStart() throw (uno::RuntimeException) +{ + return getRange()->getStart(); +} + +void SAL_CALL SwVbaSelection::setStart( ::sal_Int32 _start ) throw (uno::RuntimeException) +{ + getRange()->setStart( _start ); +} +::sal_Int32 SAL_CALL SwVbaSelection::getEnd() throw (uno::RuntimeException) +{ + return getRange()->getEnd(); +} + +void SAL_CALL SwVbaSelection::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeException) +{ + getRange()->setEnd( _end ); +} + +rtl::OUString& +SwVbaSelection::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSelection") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaSelection::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Selection" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbaselection.hxx b/sw/source/ui/vba/vbaselection.hxx new file mode 100644 index 0000000000..1deb725d3a --- /dev/null +++ b/sw/source/ui/vba/vbaselection.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_SELECTION_HXX +#define SW_VBA_SELECTION_HXX + +#include <ooo/vba/word/XSelection.hpp> +#include <ooo/vba/word/XRange.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <com/sun/star/text/XTextViewCursor.hpp> +#include <ooo/vba/word/XParagraphFormat.hpp> +#include <ooo/vba/word/XFind.hpp> +#include <ooo/vba/word/XStyle.hpp> +#include <ooo/vba/word/XFont.hpp> +#include <ooo/vba/word/XHeaderFooter.hpp> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSelection > SwVbaSelection_BASE; + +class SwVbaSelection : public SwVbaSelection_BASE +{ +private: + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor; + css::uno::Reference< ooo::vba::word::XRange > mxRange; + + enum E_DIRECTION + { + MOVE_LEFT = 1, + MOVE_RIGHT, + MOVE_UP, + MOVE_DOWN + }; + +private: + void NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( css::uno::RuntimeException ); + css::uno::Reference< css::text::XTextRange > GetSelectedRange() throw ( css::uno::RuntimeException ); + +public: + SwVbaSelection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaSelection(); + + // Attribute + virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); + virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() throw (css::uno::RuntimeException); + virtual void SAL_CALL HomeKey( const css::uno::Any& _unit, const css::uno::Any& _extend ) throw (css::uno::RuntimeException); + virtual void SAL_CALL EndKey( const css::uno::Any& _unit, const css::uno::Any& _extend ) throw (css::uno::RuntimeException); + virtual void SAL_CALL TypeText( const rtl::OUString& rText ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Delete( const css::uno::Any& _unit, const css::uno::Any& _count ) throw (css::uno::RuntimeException); + virtual void SAL_CALL MoveRight( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException); + virtual void SAL_CALL MoveLeft( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException); + virtual void SAL_CALL MoveDown( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException); + virtual void SAL_CALL TypeParagraph() throw (css::uno::RuntimeException); + virtual void SAL_CALL InsertParagraph() throw (css::uno::RuntimeException); + virtual void SAL_CALL InsertParagraphBefore() throw (css::uno::RuntimeException); + virtual void SAL_CALL InsertParagraphAfter() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException); + virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XFind > SAL_CALL getFind() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException); + virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException); + virtual void SAL_CALL TypeBackspace() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL GoTo( const css::uno::Any& _what, const css::uno::Any& _which, const css::uno::Any& _count, const css::uno::Any& _name ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getLanguageID( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Information( sal_Int32 _type ) throw (css::uno::RuntimeException); + virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Tables( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XHeaderFooter > SAL_CALL getHeaderFooter() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL ShapeRange( ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getStart() throw (css::uno::RuntimeException); + virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException); + virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_SELECTION_HXX */ diff --git a/sw/source/ui/vba/vbastyle.cxx b/sw/source/ui/vba/vbastyle.cxx new file mode 100644 index 0000000000..44ef92479f --- /dev/null +++ b/sw/source/ui/vba/vbastyle.cxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "vbastyle.hxx" +#include <ooo/vba/word/WdStyleType.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <i18npool/mslangid.hxx> +#include "vbafont.hxx" +#include "vbapalette.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + + +SwVbaStyle::SwVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet ) throw ( script::BasicErrorException, uno::RuntimeException ) : SwVbaStyle_BASE( xParent, xContext ) , mxStyleProps( _xPropertySet ) +{ + mxStyle.set( _xPropertySet, uno::UNO_QUERY_THROW ); +} + +void SAL_CALL +SwVbaStyle::setName( const ::rtl::OUString& Name ) throw (uno::RuntimeException) +{ + mxStyle->setName(Name); +} + +::rtl::OUString SAL_CALL +SwVbaStyle::getName() throw (uno::RuntimeException) +{ + return mxStyle->getName(); +} + +sal_Int32 SwVbaStyle::getLanguageID( const uno::Reference< beans::XPropertySet >& xTCProps ) throw (uno::RuntimeException) +{ + lang::Locale aLocale; + xTCProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharLocale") ) ) >>= aLocale; + return MsLangId::convertLocaleToLanguage( aLocale ); +} + +void SwVbaStyle::setLanguageID( const uno::Reference< beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) throw (uno::RuntimeException) +{ + lang::Locale aLocale = MsLangId::convertLanguageToLocale( static_cast<LanguageType>(_languageid) ); + xTCProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharLocale") ), uno::makeAny( aLocale ) ) ; +} + +::sal_Int32 SAL_CALL SwVbaStyle::getLanguageID() throw (uno::RuntimeException) +{ + return getLanguageID( mxStyleProps ); +} + +void SAL_CALL SwVbaStyle::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException) +{ + setLanguageID( mxStyleProps, _languageid ); +} + +::sal_Int32 SAL_CALL SwVbaStyle::getType() throw (uno::RuntimeException) +{ + sal_Int32 nType = word::WdStyleType::wdStyleTypeParagraph; + uno::Reference< lang::XServiceInfo > xServiceInfo( mxStyle, uno::UNO_QUERY_THROW ); + if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.ParagraphStyle") ) ) ) + nType = word::WdStyleType::wdStyleTypeParagraph; + else if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.CharacterStyle") ) ) ) + nType = word::WdStyleType::wdStyleTypeCharacter; + else // if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingStyle") ) ) ) + nType = word::WdStyleType::wdStyleTypeList; + return nType; +} + +uno::Reference< word::XFont > SAL_CALL +SwVbaStyle::getFont() throw ( uno::RuntimeException ) +{ + VbaPalette aColors; + return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), mxStyleProps ); +} + +void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xTCProps, const uno::Reference< ooo::vba::word::XStyle >& xStyle )throw (uno::RuntimeException) +{ + rtl::OUString aStyleType = getOOoStyleTypeFromMSWord( xStyle->getType() ); + xTCProps->setPropertyValue( aStyleType, uno::makeAny( xStyle->getName() ) ); +} + +rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType ) +{ + rtl::OUString aStyleType; + switch( _wdStyleType ) + { + case word::WdStyleType::wdStyleTypeParagraph: + case word::WdStyleType::wdStyleTypeTable: + { + aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ); + break; + } + case word::WdStyleType::wdStyleTypeCharacter: + { + aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharStyleName") ); + break; + } + case word::WdStyleType::wdStyleTypeList: + { + aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName") ); + break; + } + default: + DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() ); + } + return aStyleType; +} + +rtl::OUString& +SwVbaStyle::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaStyle") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaStyle::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.XStyle" ) ); + } + return aServiceNames; +} diff --git a/sw/source/ui/vba/vbastyle.hxx b/sw/source/ui/vba/vbastyle.hxx new file mode 100644 index 0000000000..709f43d83b --- /dev/null +++ b/sw/source/ui/vba/vbastyle.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_STYLE_HXX +#define SW_VBA_STYLE_HXX +#include <ooo/vba/word/XStyle.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/style/XStyle.hpp> +#include <ooo/vba/word/XFont.hpp> + + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XStyle > SwVbaStyle_BASE; + +class SwVbaStyle : public SwVbaStyle_BASE +{ +private: + css::uno::Reference< css::beans::XPropertySet > mxStyleProps; + css::uno::Reference< css::style::XStyle > mxStyle; +public: + SwVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::script::BasicErrorException, css::uno::RuntimeException ); + virtual ~SwVbaStyle(){} + + static void setStyle( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, const css::uno::Reference< ooo::vba::word::XStyle >& xStyle ) throw (css::uno::RuntimeException); + static rtl::OUString getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType ); + static sal_Int32 getLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps ) throw (css::uno::RuntimeException); + static void setLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) throw (css::uno::RuntimeException); + + // Attributes + virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); + virtual void SAL_CALL setName( const rtl::OUString& Name ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getLanguageID( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif //SW_VBA_AXIS_HXX diff --git a/sw/source/ui/vba/vbastyles.cxx b/sw/source/ui/vba/vbastyles.cxx new file mode 100644 index 0000000000..bdc31da4fa --- /dev/null +++ b/sw/source/ui/vba/vbastyles.cxx @@ -0,0 +1,380 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbastyles.cxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbastyles.hxx" +#include "vbastyle.hxx" +#include <cppuhelper/implbase3.hxx> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/style/XStyle.hpp> +#include <ooo/vba/word/WdBuiltinStyle.hpp> +#include <ooo/vba/word/WdStyleType.hpp> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +struct BuiltinStyleTable +{ + sal_Int32 wdBuiltinStyle; + const sal_Char* pOOoStyleName; + sal_Int32 wdStyleType; +}; + +const BuiltinStyleTable aBuiltinStyleTable[] = +{ + { word::WdBuiltinStyle::wdStyleBlockQuotation, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleBodyText, "Text body", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleBodyText2, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleBodyText3, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleBodyTextFirstIndent, "First line indent", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleBodyTextFirstIndent2, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleBodyTextIndent, "Text body indent", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleBodyTextIndent2, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleBodyTextIndent3, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleCaption, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleClosing, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleCommentReference, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleCommentText, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleDate, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleDefaultParagraphFont, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleEmphasis, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleEndnoteReference, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleEndnoteText, "Endnote", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleEnvelopeAddress, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleEnvelopeReturn, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleFooter, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleFootnoteReference, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleFootnoteText, "Footnote", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHeader, "Header", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHeading1, "Heading 1", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHeading2, "Heading 2", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHeading3, "Heading 3", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHeading4, "Heading 4", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHeading5, "Heading 5", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHeading6, "Heading 6", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHeading7, "Heading 7", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHeading8, "Heading 8", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHeading9, "Heading 9", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHtmlAcronym, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHtmlAddress, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHtmlCite, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHtmlCode, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHtmlDfn, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHtmlKbd, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHtmlNormal, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHtmlPre, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHtmlSamp, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHtmlTt, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHtmlVar, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHyperlink, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleHyperlinkFollowed, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleIndex1, "Index 1", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleIndex2, "Index 2", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleIndex3, "Index 3", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleIndex4, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleIndex5, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleIndex6, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleIndex7, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleIndex8, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleIndex9, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleIndexHeading, "Index Heading", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleLineNumber, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleList, "List", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleList2, "List 2", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleList3, "List 3", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleList4, "List 4", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleList5, "List 5", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleListBullet, "List 1", word::WdStyleType::wdStyleTypeList }, + { word::WdBuiltinStyle::wdStyleListBullet2, "List 2", word::WdStyleType::wdStyleTypeList }, + { word::WdBuiltinStyle::wdStyleListBullet3, "List 3", word::WdStyleType::wdStyleTypeList }, + { word::WdBuiltinStyle::wdStyleListBullet4, "List 4", word::WdStyleType::wdStyleTypeList }, + { word::WdBuiltinStyle::wdStyleListBullet5, "List 5", word::WdStyleType::wdStyleTypeList }, + { word::WdBuiltinStyle::wdStyleListContinue, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleListContinue2, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleListContinue3, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleListContinue4, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleListContinue5, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleListNumber, "Numbering 1", word::WdStyleType::wdStyleTypeList }, + { word::WdBuiltinStyle::wdStyleListNumber2, "Numbering 2", word::WdStyleType::wdStyleTypeList }, + { word::WdBuiltinStyle::wdStyleListNumber3, "Numbering 3", word::WdStyleType::wdStyleTypeList }, + { word::WdBuiltinStyle::wdStyleListNumber4, "Numbering 4", word::WdStyleType::wdStyleTypeList }, + { word::WdBuiltinStyle::wdStyleListNumber5, "Numbering 5", word::WdStyleType::wdStyleTypeList }, + { word::WdBuiltinStyle::wdStyleMacroText, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleMessageHeader, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleNavPane, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleNormal, "Default", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleNormalIndent, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleNormalTable, "Table", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleNoteHeading, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStylePageNumber, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStylePlainText, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleSalutation, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleSignature, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleStrong, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleSubtitle, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTableOfAuthorities, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTableOfFigures, "", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTitle, "Title", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTOAHeading, "Contents Heading", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTOC1, "Contents 1", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTOC2, "Contents 2", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTOC3, "Contents 3", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTOC4, "Contents 4", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTOC5, "Contents 5", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTOC6, "Contents 6", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTOC7, "Contents 7", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTOC8, "Contents 8", word::WdStyleType::wdStyleTypeParagraph }, + { word::WdBuiltinStyle::wdStyleTOC9, "Contents 9", word::WdStyleType::wdStyleTypeParagraph }, + { 0, 0, 0 } +}; + + +static uno::Sequence< rtl::OUString > getStyleTypes() +{ + uno::Sequence< rtl::OUString > aRet(3); + rtl::OUString* pArray = aRet.getArray(); + pArray[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ); + pArray[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") ); + pArray[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") ); + return aRet; +} + +typedef ::cppu::WeakImplHelper1< container::XEnumeration > StyleEnumeration_BASE; +typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > StyleCollectionHelper_BASE; +/* +class StylesEnumeration : public StyleEnumeration_BASE +{ +public: + StylesEnumeration( const SheetMap& sMap ) : mSheetMap( sMap ), mIt( mSheetMap.begin() ) {} + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) + { + return ( mIt != mSheetMap.end() ); + } + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( !hasMoreElements() ) + throw container::NoSuchElementException(); + uno::Reference< sheet::XSpreadsheet > xSheet( *mIt++ ); + return uno::makeAny( xSheet ) ; + } +}; +*/ +class StyleCollectionHelper : public StyleCollectionHelper_BASE +{ +private: + uno::Reference< frame::XModel > mxModel; + uno::Reference< container::XNameAccess > mxStyleFamilies; + uno::Reference< container::XNameContainer > mxCurrentStyleFamily; + uno::Any cachePos; +public: + StyleCollectionHelper( const uno::Reference< frame::XModel >& _xModel ) : mxModel( _xModel ) + { + uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( _xModel, uno::UNO_QUERY_THROW); + mxStyleFamilies = xStyleSupplier->getStyleFamilies(); + } + uno::Reference< container::XNameContainer > getCurrentStyleFamily(){ return mxCurrentStyleFamily; } + // XElementAccess + virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return style::XStyle::static_type(0); } + virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 0; } + // XNameAcess + virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( !hasByName(aName) ) + throw container::NoSuchElementException(); + return cachePos; + } + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) + { + uno::Sequence< rtl::OUString > sNames( getCount() ); + rtl::OUString* pString = sNames.getArray(); + uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes(); + sal_Int32 nCount = 0; + for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ ) + { + uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW ); + uno::Sequence< rtl::OUString > sElementNames = xNameAccess->getElementNames(); + for( sal_Int32 j = 0; j < sElementNames.getLength(); j++ ) + { + pString[nCount++] = sElementNames[j]; + } + } + return sNames; + } + virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) + { + uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes(); + for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ ) + { + uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW ); + if( xNameAccess->hasByName( aName ) ) + { + cachePos = xNameAccess->getByName( aName ); + mxCurrentStyleFamily.set( xNameAccess, uno::UNO_QUERY_THROW ); + return sal_True; + } + } + return sal_False; + } + + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) + { + uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes(); + sal_Int32 nCount = 0; + for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ ) + { + uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW ); + nCount += xIndexAccess->getCount(); + } + return nCount; + } + virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException ) + { + if ( Index < 0 || Index >= getCount() ) + throw lang::IndexOutOfBoundsException(); + + // FIXME: need to make a alphabetically sorted list of style names + uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes(); + for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ ) + { + uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW ); + sal_Int32 nCount = xIndexAccess->getCount(); + if( Index >= nCount ) + Index -= nCount; + else + { + mxCurrentStyleFamily.set( xIndexAccess, uno::UNO_QUERY_THROW ); + return xIndexAccess->getByIndex( Index ); + } + } + throw lang::IndexOutOfBoundsException(); + } + // XEnumerationAccess + virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) + { + // FIXME: + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + } +}; + +SwVbaStyles::SwVbaStyles( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) throw ( script::BasicErrorException ) : SwVbaStyles_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new StyleCollectionHelper( xModel ) ) ), mxModel( xModel ) +{ + mxMSF.set( mxModel, uno::UNO_QUERY_THROW ); +} + +uno::Any +SwVbaStyles::createCollectionObject(const uno::Any& aObject) +{ + uno::Reference< beans::XPropertySet > xStyleProp( aObject, uno::UNO_QUERY_THROW ); + return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProp ) ) ); +} + +uno::Type SAL_CALL +SwVbaStyles::getElementType() throw (uno::RuntimeException) +{ + return word::XStyle::static_type(0); +} + +uno::Reference< container::XEnumeration > SAL_CALL +SwVbaStyles::createEnumeration() throw (uno::RuntimeException) +{ + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); +} + +uno::Any SAL_CALL +SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::RuntimeException) +{ + //handle WdBuiltinStyle + sal_Int32 nIndex = 0; + if( ( Index1 >>= nIndex ) && ( nIndex < 0 ) ) + { + for( const BuiltinStyleTable* pTable = aBuiltinStyleTable; pTable != NULL; pTable++ ) + { + if( nIndex == pTable->wdBuiltinStyle ) + { + rtl::OUString aStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName ); + if( aStyleName.getLength() > 0 ) + { + rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType ); + switch( pTable->wdStyleType ) + { + case word::WdStyleType::wdStyleTypeParagraph: + case word::WdStyleType::wdStyleTypeTable: + { + aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ); + break; + } + case word::WdStyleType::wdStyleTypeCharacter: + { + aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") ); + break; + } + case word::WdStyleType::wdStyleTypeList: + { + aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") ); + break; + } + default: + DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() ); + } + uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxModel, uno::UNO_QUERY_THROW); + uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW ); + return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) ) ); + } + else + { + OSL_TRACE("SwVbaStyles::Item: the builtin style type is not implemented"); + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); + } + } + } + } + return SwVbaStyles_BASE::Item( Index1, Index2 ); +} + +rtl::OUString& +SwVbaStyles::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaStyles") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaStyles::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.XStyles" ) ); + } + return aServiceNames; +} diff --git a/sw/source/ui/vba/vbastyles.hxx b/sw/source/ui/vba/vbastyles.hxx new file mode 100644 index 0000000000..6bd3d21057 --- /dev/null +++ b/sw/source/ui/vba/vbastyles.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbastyles.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_STYLES_HXX +#define SW_VBA_STYLES_HXX + +#include <ooo/vba/word/XStyles.hpp> +#include <vbahelper/vbacollectionimpl.hxx> + +typedef CollTestImplHelper< ooo::vba::word::XStyles > SwVbaStyles_BASE; +class SwVbaStyles: public SwVbaStyles_BASE +{ + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF; +public: + SwVbaStyles( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::script::BasicErrorException ); + + virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) throw (css::uno::RuntimeException); + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + virtual css::uno::Any createCollectionObject(const css::uno::Any&); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif diff --git a/sw/source/ui/vba/vbasystem.cxx b/sw/source/ui/vba/vbasystem.cxx new file mode 100644 index 0000000000..d497ff2787 --- /dev/null +++ b/sw/source/ui/vba/vbasystem.cxx @@ -0,0 +1,195 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbasystem.hxx" +#include <vbahelper/vbahelper.hxx> +#include <ooo/vba/word/WdCursorType.hpp> +#include <tools/diagnose_ex.h> +#include <tools/config.hxx> +#include <tools/string.hxx> +#include <osl/file.hxx> +#include <tools/urlobj.hxx> +#include <tools/string.hxx> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +PrivateProfileStringListener::PrivateProfileStringListener( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey ) + :maFileName( rFileName ), maGroupName( rGroupName ), maKey( rKey ) +{ +} + +PrivateProfileStringListener::~PrivateProfileStringListener() +{ +} + +void PrivateProfileStringListener::Initialize( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey ) +{ + maFileName = rFileName; + maGroupName = rGroupName; + maKey = rKey; +} + +uno::Any PrivateProfileStringListener::getValueEvent() +{ + // get the private profile string + Config aCfg( maFileName ); + aCfg.SetGroup( maGroupName ); + rtl::OUString sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW ); + + return uno::makeAny( sValue ); +} + +void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value ) +{ + // set the private profile string + Config aCfg( maFileName ); + aCfg.SetGroup( maGroupName ); + + rtl::OUString aValue; + value >>= aValue; + aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) ); +} + +SwVbaSystem::SwVbaSystem( uno::Reference<uno::XComponentContext >& xContext ): SwVbaSystem_BASE( uno::Reference< XHelperInterface >(), xContext ) +{ +} + +SwVbaSystem::~SwVbaSystem() +{ +} + +sal_Int32 SAL_CALL +SwVbaSystem::getCursor() throw (uno::RuntimeException) +{ + sal_Int32 nPointerStyle = getPointerStyle( getCurrentWordDoc(mxContext) ); + + switch( nPointerStyle ) + { + case POINTER_ARROW: + return word::WdCursorType::wdCursorNorthwestArrow; + case POINTER_NULL: + return word::WdCursorType::wdCursorNormal; + case POINTER_WAIT: + return word::WdCursorType::wdCursorWait; + case POINTER_TEXT: + return word::WdCursorType::wdCursorIBeam; + default: + return word::WdCursorType::wdCursorNormal; + } +} + +void SAL_CALL +SwVbaSystem::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException) +{ + try + { + switch( _cursor ) + { + case word::WdCursorType::wdCursorNorthwestArrow: + { + const Pointer& rPointer( POINTER_ARROW ); + setCursorHelper( getCurrentWordDoc(mxContext), rPointer, sal_False ); + break; + } + case word::WdCursorType::wdCursorWait: + { + const Pointer& rPointer( static_cast< PointerStyle >( POINTER_WAIT ) ); + //It will set the edit window, toobar and statusbar's mouse pointer. + setCursorHelper( getCurrentWordDoc(mxContext), rPointer, sal_True ); + break; + } + case word::WdCursorType::wdCursorIBeam: + { + const Pointer& rPointer( static_cast< PointerStyle >( POINTER_TEXT ) ); + //It will set the edit window, toobar and statusbar's mouse pointer. + setCursorHelper( getCurrentWordDoc( mxContext ), rPointer, sal_True ); + break; + } + case word::WdCursorType::wdCursorNormal: + { + const Pointer& rPointer( POINTER_NULL ); + setCursorHelper( getCurrentWordDoc( mxContext ), rPointer, sal_False ); + break; + } + default: + throw uno::RuntimeException( rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("Unknown value for Cursor pointer")), uno::Reference< uno::XInterface >() ); + // TODO: isn't this a flaw in the API? It should be allowed to throw an + // IllegalArgumentException, or so + } + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +uno::Any SAL_CALL +SwVbaSystem::PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( uno::RuntimeException ) +{ + if( rFilename.getLength() == 0 ) + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() ); + + // FIXME: need to detect whether it is a relative file path + // we need to detect if this is a URL, if not then assume its a file path + rtl::OUString sFileUrl; + INetURLObject aObj; + aObj.SetURL( rFilename ); + bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID; + if ( bIsURL ) + sFileUrl = rFilename; + else + osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl); + + ByteString aGroupName = ByteString( rSection.getStr(), RTL_TEXTENCODING_DONTKNOW); + ByteString aKey = ByteString( rKey.getStr(), RTL_TEXTENCODING_DONTKNOW); + maPrivateProfileStringListener.Initialize( sFileUrl, aGroupName, aKey ); + + return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( &maPrivateProfileStringListener ) ) ); +} + +rtl::OUString& +SwVbaSystem::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSystem") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaSystem::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.System" ) ); + } + return aServiceNames; +} diff --git a/sw/source/ui/vba/vbasystem.hxx b/sw/source/ui/vba/vbasystem.hxx new file mode 100644 index 0000000000..a88e0d9928 --- /dev/null +++ b/sw/source/ui/vba/vbasystem.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbasystem.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_SYSTEM_HXX +#define SW_VBA_SYSTEM_HXX + +#include <ooo/vba/word/XSystem.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> +#include <vbahelper/vbapropvalue.hxx> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSystem > SwVbaSystem_BASE; + +class PrivateProfileStringListener : public PropListener +{ +private: + rtl::OUString maFileName; + ByteString maGroupName; + ByteString maKey; +public: + PrivateProfileStringListener(){}; + PrivateProfileStringListener( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey ); + virtual ~PrivateProfileStringListener(); + void Initialize( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey ); + + //PropListener + virtual void setValueEvent( const css::uno::Any& value ); + virtual css::uno::Any getValueEvent(); +}; + +class SwVbaSystem : public SwVbaSystem_BASE +{ +private: + PrivateProfileStringListener maPrivateProfileStringListener; + +public: + SwVbaSystem( css::uno::Reference< css::uno::XComponentContext >& m_xContext ); + virtual ~SwVbaSystem(); + + // XSystem + virtual sal_Int32 SAL_CALL getCursor() throw ( css::uno::RuntimeException ); + virtual void SAL_CALL setCursor( sal_Int32 _cursor ) throw ( css::uno::RuntimeException ); + virtual css::uno::Any SAL_CALL PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( css::uno::RuntimeException ); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_SYSTEM_HXX */ diff --git a/sw/source/ui/vba/vbatable.cxx b/sw/source/ui/vba/vbatable.cxx new file mode 100644 index 0000000000..7598dfc6cf --- /dev/null +++ b/sw/source/ui/vba/vbatable.cxx @@ -0,0 +1,97 @@ +#include "vbatable.hxx" +#include "vbarange.hxx" +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/text/XTextViewCursorSupplier.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/text/XTextTable.hpp> +#include <com/sun/star/text/XTextTablesSupplier.hpp> +#include <com/sun/star/table/XTableRows.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include "vbaborders.hxx" +#include "vbapalette.hxx" + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaTable::SwVbaTable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const uno::Reference< css::text::XTextTable >& xTextTable) throw ( uno::RuntimeException ) : SwVbaTable_BASE( rParent, rContext ), mxTextDocument( rDocument ) +{ + mxTextTable.set( xTextTable, uno::UNO_QUERY_THROW ); +} + +uno::Reference< word::XRange > SAL_CALL +SwVbaTable::Range( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + return new SwVbaRange( mxParent, mxContext, mxTextDocument, mxTextTable->getAnchor() ); +} + +void SAL_CALL +SwVbaTable::Select( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW ); + uno::Reference< frame::XController > xController = xModel->getCurrentController(); + + uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( xController, uno::UNO_QUERY_THROW ); + uno::Reference< view::XSelectionSupplier > xSelectionSupplier( xController, uno::UNO_QUERY_THROW ); + + // set the view cursor to the start of the table. + xSelectionSupplier->select( uno::makeAny( mxTextTable ) ); + + // go to the end of the table and span the view + uno::Reference< text::XTextViewCursor > xCursor = xViewCursorSupplier->getViewCursor(); + xCursor->gotoEnd(sal_True); + +} + +void SAL_CALL +SwVbaTable::Delete( ) throw (script::BasicErrorException, uno::RuntimeException) +{ + uno::Reference< table::XTableRows > xRows( mxTextTable->getRows() ); + xRows->removeByIndex( 0, xRows->getCount() ); +} + +uno::Reference< word::XRange > SAL_CALL +SwVbaTable::ConvertToText( const uno::Any& /*Separator*/, const uno::Any& /*NestedTables*/ ) throw (script::BasicErrorException, uno::RuntimeException) +{ + // #FIXME the helper api uses the dreaded dispatch mechanism, holding off + // implementation while I look for alternative solution + throw uno::RuntimeException(); +} + +rtl::OUString SAL_CALL +SwVbaTable::getName() throw (uno::RuntimeException) +{ + uno::Reference< container::XNamed > xNamed( mxTextTable, uno::UNO_QUERY_THROW ); + return xNamed->getName(); +} + +uno::Any SAL_CALL +SwVbaTable::Borders( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< table::XCellRange > aCellRange( mxTextTable, uno::UNO_QUERY_THROW ); + VbaPalette aPalette; + uno::Reference< XCollection > xCol( new SwVbaBorders( this, mxContext, aCellRange, aPalette ) ); + if ( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +// XHelperInterface +rtl::OUString& +SwVbaTable::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTable") ); + return sImplName; +} + +uno::Sequence<rtl::OUString> +SwVbaTable::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Table" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbatable.hxx b/sw/source/ui/vba/vbatable.hxx new file mode 100644 index 0000000000..c28a3cdaf3 --- /dev/null +++ b/sw/source/ui/vba/vbatable.hxx @@ -0,0 +1,28 @@ +#ifndef SW_VBA_TABLE_HXX +#define SW_VBA_TABLE_HXX +#include <vbahelper/vbahelperinterface.hxx> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XTextTable.hpp> +#include <ooo/vba/word/XRange.hpp> +#include <ooo/vba/word/XTable.hpp> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTable > SwVbaTable_BASE; + +class SwVbaTable : public SwVbaTable_BASE +{ + css::uno::Reference< css::text::XTextDocument > mxTextDocument; + css::uno::Reference< css::text::XTextTable > mxTextTable; +public: + SwVbaTable( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const css::uno::Reference< css::text::XTextTable >& xTextTable) throw ( css::uno::RuntimeException); + css::uno::Reference< css::text::XTextDocument > getDocument() { return mxTextDocument; }; + virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL Range( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual void SAL_CALL Select( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL ConvertToText( const css::uno::Any& Separator, const css::uno::Any& NestedTables ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getName( ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif diff --git a/sw/source/ui/vba/vbatables.cxx b/sw/source/ui/vba/vbatables.cxx new file mode 100644 index 0000000000..53178d1c79 --- /dev/null +++ b/sw/source/ui/vba/vbatables.cxx @@ -0,0 +1,131 @@ +#include "vbatables.hxx" +#include "vbatable.hxx" +#include "vbarange.hxx" +#include <com/sun/star/text/XTextTable.hpp> +#include <com/sun/star/text/XTextTablesSupplier.hpp> +#include <com/sun/star/text/XTextDocument.hpp> +#include <comphelper/componentcontext.hxx> + +using namespace ::ooo::vba; +using namespace css; + +uno::Reference< container::XIndexAccess > lcl_getTables( const uno::Reference< frame::XModel >& xDoc ) +{ + uno::Reference< container::XIndexAccess > xTables; + uno::Reference< text::XTextTablesSupplier > xSupp( xDoc, uno::UNO_QUERY ); + if ( xSupp.is() ) + xTables.set( xSupp->getTextTables(), uno::UNO_QUERY_THROW ); + return xTables; +} + +uno::Any lcl_createTable( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xDocument, const uno::Any& aSource ) +{ + uno::Reference< text::XTextTable > xTextTable( aSource, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextDocument > xTextDocument( xDocument, uno::UNO_QUERY_THROW ); + uno::Reference< word::XTable > xTable( new SwVbaTable( xParent, xContext, xTextDocument, xTextTable ) ); + return uno::makeAny( xTable ); +} + +typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumBase; + +class TableEnumerationImpl : public EnumBase +{ + uno::Reference< XHelperInterface > mxParent; + uno::Reference< uno::XComponentContext > mxContext; + uno::Reference< frame::XModel > mxDocument; + uno::Reference< container::XIndexAccess > mxIndexAccess; + sal_Int32 mnCurIndex; +public: + TableEnumerationImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxParent( xParent ), mxContext( xContext ), mxDocument( xDocument ), mxIndexAccess( xIndexAccess ), mnCurIndex(0) + { + } + virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) + { + return ( mnCurIndex < mxIndexAccess->getCount() ); + } + virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) + { + if ( !hasMoreElements() ) + throw container::NoSuchElementException(); + return lcl_createTable( mxParent, mxContext, mxDocument, mxIndexAccess->getByIndex( mnCurIndex++ ) ); + } + +}; + +SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , lcl_getTables( xDocument ) ), mxDocument( xDocument ) +{ +} + + +uno::Reference< word::XTable > SAL_CALL +SwVbaTables::Add( const uno::Reference< word::XRange >& Range, const uno::Any& NumRows, const uno::Any& NumColumns, const uno::Any& /*DefaultTableBehavior*/, const uno::Any& /*AutoFitBehavior*/ ) throw (script::BasicErrorException, uno::RuntimeException) +{ + sal_Int32 nCols = 0; + sal_Int32 nRows = 0; + SwVbaRange* pVbaRange = dynamic_cast< SwVbaRange* >( Range.get() ); + // Preconditions + if ( !( pVbaRange && ( NumRows >>= nRows ) && ( NumColumns >>= nCols ) ) ) + throw uno::RuntimeException(); // #FIXME better exception?? + if ( nCols <= 0 || nRows <= 0 ) + throw uno::RuntimeException(); // #FIXME better exception?? + + uno::Reference< frame::XModel > xModel( pVbaRange->getDocument(), uno::UNO_QUERY_THROW ); + uno::Reference< lang::XMultiServiceFactory > xMsf( xModel, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextRange > xTextRange = pVbaRange->getXTextRange(); + + uno::Reference< text::XTextTable > xTable; + xTable.set( xMsf->createInstance( rtl::OUString::createFromAscii("com.sun.star.text.TextTable") ), uno::UNO_QUERY_THROW ); +/* + comphelper::ComponentContext aCtx( xMsf ); + if ( !aCtx.createComponent( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ), xTable ) ); + throw uno::RuntimeException(); // #FIXME better exception?? +*/ + xTable->initialize( nRows, nCols ); + uno::Reference< text::XText > xText = xTextRange->getText(); + uno::Reference< text::XTextContent > xContext( xTable, uno::UNO_QUERY_THROW ); + + xText->insertTextContent( xTextRange, xContext, true ); + uno::Reference< word::XTable > xVBATable( new SwVbaTable( mxParent, mxContext, pVbaRange->getDocument(), xTable ) ); + return xVBATable; +} + +uno::Reference< container::XEnumeration > SAL_CALL +SwVbaTables::createEnumeration() throw (uno::RuntimeException) +{ + return new TableEnumerationImpl( mxParent, mxContext, mxDocument, m_xIndexAccess ); +} + +// ScVbaCollectionBaseImpl +uno::Any +SwVbaTables::createCollectionObject( const uno::Any& aSource ) +{ + return lcl_createTable( mxParent, mxContext, mxDocument, aSource ); +} + +// XHelperInterface +rtl::OUString& +SwVbaTables::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTables") ); + return sImplName; +} + +// XEnumerationAccess +uno::Type SAL_CALL +SwVbaTables::getElementType() throw (uno::RuntimeException) +{ + return word::XTable::static_type(0); +} + +uno::Sequence<rtl::OUString> +SwVbaTables::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Tables" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbatables.hxx b/sw/source/ui/vba/vbatables.hxx new file mode 100644 index 0000000000..79df2f90b7 --- /dev/null +++ b/sw/source/ui/vba/vbatables.hxx @@ -0,0 +1,28 @@ +#ifndef SW_VBA_TABLES_HXX +#define SW_VBA_TABLES_HXX + +#include <ooo/vba/word/XTables.hpp> +#include <vbahelper/vbacollectionimpl.hxx> + + +typedef CollTestImplHelper< ov::word::XTables > SwVbaTables_BASE; + +class SwVbaTables : public SwVbaTables_BASE +{ + css::uno::Reference< css::frame::XModel > mxDocument; +public: + SwVbaTables( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xDocument ); + // XTables + virtual css::uno::Reference< ov::word::XTable > SAL_CALL Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& NumRows, const css::uno::Any& NumColumns, const css::uno::Any& DefaultTableBehavior, const css::uno::Any& AutoFitBehavior ) throw (css::script::BasicErrorException, css::uno::RuntimeException); + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + // ScVbaCollectionBaseImpl + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif diff --git a/sw/source/ui/vba/vbatemplate.cxx b/sw/source/ui/vba/vbatemplate.cxx new file mode 100644 index 0000000000..136a9ec43a --- /dev/null +++ b/sw/source/ui/vba/vbatemplate.cxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbatemplate.hxx" +#include <vbahelper/vbahelper.hxx> +#include "wordvbahelper.hxx" +#include "vbaautotextentry.hxx" +#include <comphelper/processfactory.hxx> +#include <com/sun/star/text/XAutoTextContainer.hpp> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName ) + : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msName( rName ) +{ +} + + +SwVbaTemplate::~SwVbaTemplate() +{ +} + +rtl::OUString +SwVbaTemplate::getName() throw ( css::uno::RuntimeException ) +{ + return msName; +} + +uno::Any SAL_CALL +SwVbaTemplate::AutoTextEntries( const uno::Any& index ) throw (uno::RuntimeException) +{ + uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); + uno::Reference< text::XAutoTextContainer > xAutoTextContainer( xMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.AutoTextContainer") ) ), uno::UNO_QUERY_THROW ); + + // the default template is "Normal.dot" in Word. + rtl::OUString sGroup( RTL_CONSTASCII_USTRINGPARAM("Normal") ); + sal_Int32 nIndex = msName.lastIndexOf( sal_Unicode('.') ); + if( nIndex > 0 ) + { + sGroup = msName.copy( 0, msName.lastIndexOf( sal_Unicode('.') ) ); + // OSL_TRACE("SwVbaTemplate::AutoTextEntries: %s", rtl::OUStringToOString( sGroup, RTL_TEXTENCODING_UTF8 ).getStr() ); + } + + uno::Reference< container::XIndexAccess > xGroup; + if( xAutoTextContainer->hasByName( sGroup ) ) + { + xGroup.set( xAutoTextContainer->getByName( sGroup ), uno::UNO_QUERY_THROW ); + } + else + { + throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Auto Text Entry doesn't exist") ), uno::Reference< uno::XInterface >() ); + //xGroup.set( xAutoTextContainer->insertNewByName( sGroup ), uno::UNO_QUERY_THROW ); + } + + uno::Reference< XCollection > xCol( new SwVbaAutoTextEntries( this, mxContext, xGroup ) ); + if( index.hasValue() ) + return xCol->Item( index, uno::Any() ); + return uno::makeAny( xCol ); +} + +rtl::OUString& +SwVbaTemplate::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTemplate") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaTemplate::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Template" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbatemplate.hxx b/sw/source/ui/vba/vbatemplate.hxx new file mode 100644 index 0000000000..29453e344b --- /dev/null +++ b/sw/source/ui/vba/vbatemplate.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_TEMPLATE_HXX +#define SW_VBA_TEMPLATE_HXX + +#include <ooo/vba/word/XTemplate.hpp> +#include <vbahelper/vbahelperinterface.hxx> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTemplate > SwVbaTemplate_BASE; + +class SwVbaTemplate : public SwVbaTemplate_BASE +{ +private: + css::uno::Reference< css::frame::XModel > mxModel; + rtl::OUString msName; +public: + SwVbaTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, + const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& ); + virtual ~SwVbaTemplate(); + + // XTemplate + virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL AutoTextEntries( const css::uno::Any& index ) throw (css::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_TEMPLATE_HXX */ diff --git a/sw/source/ui/vba/vbavariable.cxx b/sw/source/ui/vba/vbavariable.cxx new file mode 100644 index 0000000000..35be7a9567 --- /dev/null +++ b/sw/source/ui/vba/vbavariable.cxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbavariable.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +SwVbaVariable::SwVbaVariable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, + const uno::Reference< beans::XPropertyAccess >& rUserDefined, const rtl::OUString& rName ) throw ( uno::RuntimeException ) : + SwVbaVariable_BASE( rParent, rContext ), mxUserDefined( rUserDefined ), maName( rName ) +{ +} + +SwVbaVariable::~SwVbaVariable() +{ +} + +rtl::OUString SAL_CALL +SwVbaVariable::getName() throw ( css::uno::RuntimeException ) +{ + return maName; +} + +void SAL_CALL +SwVbaVariable::setName( const rtl::OUString& ) throw ( css::uno::RuntimeException ) +{ + throw uno::RuntimeException( rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM(" Fail to set name")), uno::Reference< uno::XInterface >() ); +} + +uno::Any SAL_CALL +SwVbaVariable::getValue() throw ( css::uno::RuntimeException ) +{ + uno::Reference< beans::XPropertySet > xProp( mxUserDefined, uno::UNO_QUERY_THROW ); + return xProp->getPropertyValue( maName ); +} + +void SAL_CALL +SwVbaVariable::setValue( const uno::Any& rValue ) throw ( css::uno::RuntimeException ) +{ + // FIXME: fail to set the value if the new type of vaue is differenct from the original one. + uno::Reference< beans::XPropertySet > xProp( mxUserDefined, uno::UNO_QUERY_THROW ); + xProp->setPropertyValue( maName, rValue ); +} + +sal_Int32 SAL_CALL +SwVbaVariable::getIndex() throw ( css::uno::RuntimeException ) +{ + const uno::Sequence< beans::PropertyValue > props = mxUserDefined->getPropertyValues(); + for (sal_Int32 i = 0; i < props.getLength(); ++i) + { + if( maName.equals( props[i].Name ) ) + return i+1; + } + + return 0; +} + +rtl::OUString& +SwVbaVariable::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaVariable") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaVariable::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Variable" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbavariable.hxx b/sw/source/ui/vba/vbavariable.hxx new file mode 100644 index 0000000000..533d0d20e6 --- /dev/null +++ b/sw/source/ui/vba/vbavariable.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_VARIABLE_HXX +#define SW_VBA_VARIABLE_HXX + +#include <ooo/vba/word/XVariable.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/beans/XPropertyAccess.hpp> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XVariable > SwVbaVariable_BASE; + +class SwVbaVariable : public SwVbaVariable_BASE +{ +private: + css::uno::Reference< css::beans::XPropertyAccess > mxUserDefined; + rtl::OUString maName; + +public: + SwVbaVariable( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, + const css::uno::Reference< css::beans::XPropertyAccess >& rUserDefined, const rtl::OUString& rName ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaVariable(); + + // XVariable + virtual rtl::OUString SAL_CALL getName() throw ( css::uno::RuntimeException ); + virtual void SAL_CALL setName( const rtl::OUString& ) throw ( css::uno::RuntimeException ); + virtual css::uno::Any SAL_CALL getValue() throw ( css::uno::RuntimeException ); + virtual void SAL_CALL setValue( const css::uno::Any& rValue ) throw ( css::uno::RuntimeException ); + virtual sal_Int32 SAL_CALL getIndex() throw ( css::uno::RuntimeException ); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_VARIABLE_HXX */ diff --git a/sw/source/ui/vba/vbavariables.cxx b/sw/source/ui/vba/vbavariables.cxx new file mode 100644 index 0000000000..6098454594 --- /dev/null +++ b/sw/source/ui/vba/vbavariables.cxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbavariables.hxx" +#include "vbavariable.hxx" +#include <com/sun/star/beans/XPropertyContainer.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +uno::Reference< container::XIndexAccess > createVariablesAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< beans::XPropertyAccess >& xUserDefined ) throw ( uno::RuntimeException ) +{ + // FIXME: the performance is poor? + XNamedObjectCollectionHelper< word::XVariable >::XNamedVec mVariables; + const uno::Sequence< beans::PropertyValue > props = xUserDefined->getPropertyValues(); + sal_Int32 nCount = props.getLength(); + mVariables.reserve( nCount ); + for( sal_Int32 i=0; i < nCount; i++ ) + mVariables.push_back( uno::Reference< word::XVariable > ( new SwVbaVariable( xParent, xContext, xUserDefined, props[i].Name ) ) ); + + uno::Reference< container::XIndexAccess > xVariables( new XNamedObjectCollectionHelper< word::XVariable >( mVariables ) ); + return xVariables; +} + +SwVbaVariables::SwVbaVariables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertyAccess >& rUserDefined ): SwVbaVariables_BASE( xParent, xContext, createVariablesAccess( xParent, xContext, rUserDefined ) ), mxUserDefined( rUserDefined ) +{ +} +// XEnumerationAccess +uno::Type +SwVbaVariables::getElementType() throw (uno::RuntimeException) +{ + return word::XVariable::static_type(0); +} +uno::Reference< container::XEnumeration > +SwVbaVariables::createEnumeration() throw (uno::RuntimeException) +{ + uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); + return xEnumerationAccess->createEnumeration(); +} + +uno::Any +SwVbaVariables::createCollectionObject( const css::uno::Any& aSource ) +{ + return aSource; +} + +uno::Any SAL_CALL +SwVbaVariables::Add( const rtl::OUString& rName, const uno::Any& rValue ) throw (uno::RuntimeException) +{ + uno::Any aValue; + if( rValue.hasValue() ) + aValue = rValue; + else + aValue <<= rtl::OUString(); + uno::Reference< beans::XPropertyContainer > xPropertyContainer( mxUserDefined, uno::UNO_QUERY_THROW ); + xPropertyContainer->addProperty( rName, beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::REMOVEABLE, aValue ); + + return uno::makeAny( uno::Reference< word::XVariable >( new SwVbaVariable( getParent(), mxContext, mxUserDefined, rName ) ) ); +} + +rtl::OUString& +SwVbaVariables::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaVariables") ); + return sImplName; +} + +css::uno::Sequence<rtl::OUString> +SwVbaVariables::getServiceNames() +{ + static uno::Sequence< rtl::OUString > sNames; + if ( sNames.getLength() == 0 ) + { + sNames.realloc( 1 ); + sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Variables") ); + } + return sNames; +} diff --git a/sw/source/ui/vba/vbavariables.hxx b/sw/source/ui/vba/vbavariables.hxx new file mode 100644 index 0000000000..ceaed61a25 --- /dev/null +++ b/sw/source/ui/vba/vbavariables.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_VARIABLES_HXX +#define SW_VBA_VARIABLES_HXX + +#include <vbahelper/vbacollectionimpl.hxx> +#include <ooo/vba/word/XVariables.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <com/sun/star/beans/XPropertyAccess.hpp> + +typedef CollTestImplHelper< ooo::vba::word::XVariables > SwVbaVariables_BASE; + +class SwVbaVariables : public SwVbaVariables_BASE +{ +private: + css::uno::Reference< css::beans::XPropertyAccess > mxUserDefined; + +public: + SwVbaVariables( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertyAccess >& rUserDefined ); + virtual ~SwVbaVariables() {} + + // XEnumerationAccess + virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); + + // SwVbaVariables_BASE + virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); + + // XVariables + virtual css::uno::Any SAL_CALL Add( const rtl::OUString& rName, const css::uno::Any& rValue ) throw (css::uno::RuntimeException); +}; + +#endif /* SW_VBA_VARIABLES_HXX */ diff --git a/sw/source/ui/vba/vbaview.cxx b/sw/source/ui/vba/vbaview.cxx new file mode 100644 index 0000000000..01459846cd --- /dev/null +++ b/sw/source/ui/vba/vbaview.cxx @@ -0,0 +1,425 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbaview.hxx" +#include <vbahelper/vbahelper.hxx> +#include <tools/diagnose_ex.h> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/view/XViewSettingsSupplier.hpp> +#include <com/sun/star/text/XTextViewCursorSupplier.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XTextTable.hpp> +#include <com/sun/star/table/XCellRange.hpp> +#include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XFootnotesSupplier.hpp> +#include <com/sun/star/text/XEndnotesSupplier.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <ooo/vba/word/WdSpecialPane.hpp> +#include <ooo/vba/word/WdViewType.hpp> +#include <ooo/vba/word/WdSeekView.hpp> + +#include "wordvbahelper.hxx" +#include "vbaheaderfooterhelper.hxx" +#include <view.hxx> + +using namespace ::ooo::vba; +using namespace ::com::sun::star; + +static const sal_Int32 DEFAULT_BODY_DISTANCE = 500; + +SwVbaView::SwVbaView( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, + const uno::Reference< frame::XModel >& rModel ) throw ( uno::RuntimeException ) : + SwVbaView_BASE( rParent, rContext ), mxModel( rModel ) +{ + uno::Reference< frame::XController > xController = mxModel->getCurrentController(); + + uno::Reference< text::XTextViewCursorSupplier > xTextViewCursorSupp( xController, uno::UNO_QUERY_THROW ); + mxViewCursor = xTextViewCursorSupp->getViewCursor(); + + uno::Reference< view::XViewSettingsSupplier > xViewSettingSupp( xController, uno::UNO_QUERY_THROW ); + mxViewSettings.set( xViewSettingSupp->getViewSettings(), uno::UNO_QUERY_THROW ); +} + +SwVbaView::~SwVbaView() +{ +} + +::sal_Int32 SAL_CALL +SwVbaView::getSeekView() throw (css::uno::RuntimeException) +{ + // FIXME: if the view cursor is in table, field, section and frame + // handle if the cursor is in table + uno::Reference< text::XText > xCurrentText = mxViewCursor->getText(); + uno::Reference< beans::XPropertySet > xCursorProps( mxViewCursor, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextContent > xTextContent; + while( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextContent ) + { + xCurrentText = xTextContent->getAnchor()->getText(); + xCursorProps.set( xCurrentText->createTextCursor(), uno::UNO_QUERY_THROW ); + } + uno::Reference< lang::XServiceInfo > xServiceInfo( xCurrentText, uno::UNO_QUERY_THROW ); + rtl::OUString aImplName = xServiceInfo->getImplementationName(); + if( aImplName.equalsAscii("SwXBodyText") ) + { + return word::WdSeekView::wdSeekMainDocument; + } + else if( aImplName.equalsAscii("SwXHeadFootText") ) + { + if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) ) + { + if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) ) + return word::WdSeekView::wdSeekFirstPageHeader; + else if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) ) + return word::WdSeekView::wdSeekEvenPagesHeader; + else + return word::WdSeekView::wdSeekPrimaryHeader; + } + else + { + if( HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) ) + return word::WdSeekView::wdSeekFirstPageFooter; + else if( HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) ) + return word::WdSeekView::wdSeekEvenPagesFooter; + else + return word::WdSeekView::wdSeekPrimaryFooter; + } + } + else if( aImplName.equalsAscii("SwXFootnote") ) + { + if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Endnote") ) ) ) + return word::WdSeekView::wdSeekEndnotes; + else + return word::WdSeekView::wdSeekFootnotes; + } + + return word::WdSeekView::wdSeekMainDocument; +} + +void SAL_CALL +SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeException) +{ + // FIXME: save the current cursor position, if the cursor is in the main + // document, so we can jump back to this position, if the macro sets + // the ViewMode back to wdSeekMainDocument + + // if( _seekview == getSeekView() ) + // return; + + switch( _seekview ) + { + case word::WdSeekView::wdSeekFirstPageFooter: + case word::WdSeekView::wdSeekFirstPageHeader: + case word::WdSeekView::wdSeekCurrentPageFooter: + case word::WdSeekView::wdSeekCurrentPageHeader: + case word::WdSeekView::wdSeekPrimaryFooter: + case word::WdSeekView::wdSeekPrimaryHeader: + case word::WdSeekView::wdSeekEvenPagesFooter: + case word::WdSeekView::wdSeekEvenPagesHeader: + { + // need to test + mxViewCursor->gotoRange( getHFTextRange( _seekview ), sal_False ); + break; + } + case word::WdSeekView::wdSeekFootnotes: + { + uno::Reference< text::XFootnotesSupplier > xFootnotesSupp( mxModel, uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexAccess > xFootnotes( xFootnotesSupp->getFootnotes(), uno::UNO_QUERY_THROW ); + if( xFootnotes->getCount() > 0 ) + { + uno::Reference< text::XText > xText( xFootnotes->getByIndex(0), uno::UNO_QUERY_THROW ); + mxViewCursor->gotoRange( xText->getStart(), sal_False ); + } + else + { + DebugHelper::exception( SbERR_NO_ACTIVE_OBJECT, rtl::OUString() ); + } + break; + } + case word::WdSeekView::wdSeekEndnotes: + { + uno::Reference< text::XEndnotesSupplier > xEndnotesSupp( mxModel, uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexAccess > xEndnotes( xEndnotesSupp->getEndnotes(), uno::UNO_QUERY_THROW ); + if( xEndnotes->getCount() > 0 ) + { + uno::Reference< text::XText > xText( xEndnotes->getByIndex(0), uno::UNO_QUERY_THROW ); + mxViewCursor->gotoRange( xText->getStart(), sal_False ); + } + else + { + DebugHelper::exception( SbERR_NO_ACTIVE_OBJECT, rtl::OUString() ); + } + break; + } + case word::WdSeekView::wdSeekMainDocument: + { + uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW ); + uno::Reference< text::XText > xText = xTextDocument->getText(); + mxViewCursor->gotoRange( getFirstObjectPosition( xText ), sal_False ); + break; + } + } +} + +::sal_Int32 SAL_CALL +SwVbaView::getSplitSpecial() throw (css::uno::RuntimeException) +{ + return word::WdSpecialPane::wdPaneNone; +} + +void SAL_CALL +SwVbaView::setSplitSpecial( ::sal_Int32/* _splitspecial */) throw (css::uno::RuntimeException) +{ + // not support in Writer +} + +::sal_Bool SAL_CALL +SwVbaView::getTableGridLines() throw (css::uno::RuntimeException) +{ + sal_Bool bShowTableGridLine = sal_False; + mxViewSettings->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowTableBoundaries"))) >>= bShowTableGridLine; + return bShowTableGridLine; +} + +void SAL_CALL +SwVbaView::setTableGridLines( ::sal_Bool _tablegridlines ) throw (css::uno::RuntimeException) +{ + mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowTableBoundaries")), uno::makeAny( _tablegridlines ) ); +} + +::sal_Int32 SAL_CALL +SwVbaView::getType() throw (css::uno::RuntimeException) +{ + // FIXME: handle wdPrintPreview type + sal_Bool bOnlineLayout = sal_False; + mxViewSettings->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout"))) >>= bOnlineLayout; + return bOnlineLayout ? word::WdViewType::wdWebView : word::WdViewType::wdPrintView; +} + +void SAL_CALL +SwVbaView::setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException) +{ + // FIXME: handle wdPrintPreview type + switch( _type ) + { + case word::WdViewType::wdPrintView: + case word::WdViewType::wdNormalView: + { + mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout")), uno::makeAny( sal_False ) ); + break; + } + case word::WdViewType::wdWebView: + { + mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout")), uno::makeAny( sal_True ) ); + break; + } + case word::WdViewType::wdPrintPreview: + { + PrintPreviewHelper( uno::Any(),word::getView( mxModel ) ); + break; + } + default: + DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() ); + + } +} + +uno::Reference< text::XTextRange > SwVbaView::getHFTextRange( sal_Int32 nType ) throw (uno::RuntimeException) +{ + mxModel->lockControllers(); + + rtl::OUString aPropIsOn; + rtl::OUString aPropIsShared; + rtl::OUString aPropBodyDistance; + rtl::OUString aPropText; + + switch( nType ) + { + case word::WdSeekView::wdSeekCurrentPageFooter: + case word::WdSeekView::wdSeekFirstPageFooter: + case word::WdSeekView::wdSeekPrimaryFooter: + case word::WdSeekView::wdSeekEvenPagesFooter: + { + aPropIsOn = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn") ); + aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared") ); + aPropBodyDistance = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance") ); + aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") ); + break; + } + case word::WdSeekView::wdSeekCurrentPageHeader: + case word::WdSeekView::wdSeekFirstPageHeader: + case word::WdSeekView::wdSeekPrimaryHeader: + case word::WdSeekView::wdSeekEvenPagesHeader: + { + aPropIsOn = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn") ); + aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared") ); + aPropBodyDistance = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance") ); + aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") ); + break; + } + } + + uno::Reference< text::XPageCursor > xPageCursor( mxViewCursor, uno::UNO_QUERY_THROW ); + + if( nType == word::WdSeekView::wdSeekFirstPageFooter + || nType == word::WdSeekView::wdSeekFirstPageHeader ) + { + xPageCursor->jumpToFirstPage(); + } + + uno::Reference< style::XStyle > xStyle; + uno::Reference< text::XText > xText; + switch( nType ) + { + case word::WdSeekView::wdSeekPrimaryFooter: + case word::WdSeekView::wdSeekPrimaryHeader: + case word::WdSeekView::wdSeekEvenPagesFooter: + case word::WdSeekView::wdSeekEvenPagesHeader: + { + // The primary header is the first header of the section. + // If the header is not shared between odd and even pages + // the odd page's header is the primary header. If the + // first page's header is different from the rest of the + // document, it is NOT the primary header ( the next primary + // header would be on page 3 ) + // The even pages' header is only available if the header is + // not shared and the current style is applied to a page with + // an even page number + uno::Reference< beans::XPropertySet > xCursorProps( mxViewCursor, uno::UNO_QUERY_THROW ); + rtl::OUString aPageStyleName; + xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName; + if( aPageStyleName.equalsAscii("First Page") ) + { + // go to the beginning of where the next style is used + sal_Bool hasNextPage = sal_False; + xStyle = word::getCurrentPageStyle( mxModel ); + do + { + hasNextPage = xPageCursor->jumpToNextPage(); + } + while( hasNextPage && ( xStyle == word::getCurrentPageStyle( mxModel ) ) ); + + if( !hasNextPage ) + DebugHelper::exception( SbERR_BAD_ACTION, rtl::OUString() ); + } + break; + } + default: + { + break; + } + } + + xStyle = word::getCurrentPageStyle( mxModel ); + uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW ); + sal_Bool isOn = sal_False; + xPageProps->getPropertyValue( aPropIsOn ) >>= isOn; + sal_Bool isShared = sal_False; + xPageProps->getPropertyValue( aPropIsShared ) >>= isShared; + if( !isOn ) + { + xPageProps->setPropertyValue( aPropIsOn, uno::makeAny( sal_True ) ); + xPageProps->setPropertyValue( aPropBodyDistance, uno::makeAny( DEFAULT_BODY_DISTANCE ) ); + } + if( !isShared ) + { + rtl::OUString aTempPropText = aPropText; + if( nType == word::WdSeekView::wdSeekEvenPagesFooter + || nType == word::WdSeekView::wdSeekEvenPagesHeader ) + { + aTempPropText += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left") ); + } + else + { + aTempPropText += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Right") ); + } + xText.set( xPageProps->getPropertyValue( aTempPropText), uno::UNO_QUERY_THROW ); + } + else + { + if( nType == word::WdSeekView::wdSeekEvenPagesFooter + || nType == word::WdSeekView::wdSeekEvenPagesHeader ) + { + DebugHelper::exception( SbERR_BAD_ACTION, rtl::OUString() ); + } + xText.set( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW ); + } + + mxModel->unlockControllers(); + if( !xText.is() ) + { + DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() ); + } + uno::Reference< text::XTextRange > xTextRange = getFirstObjectPosition( xText ); + return xTextRange; +} + +uno::Reference< text::XTextRange > SwVbaView::getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException) +{ + // if the first object is table, get the position of first cell + uno::Reference< text::XTextRange > xTextRange; + uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW ); + uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration(); + if( xParaEnum->hasMoreElements() ) + { + uno::Reference< lang::XServiceInfo > xServiceInfo( xParaEnum->nextElement(), uno::UNO_QUERY_THROW ); + if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ) ) ) + { + uno::Reference< table::XCellRange > xCellRange( xServiceInfo, uno::UNO_QUERY_THROW ); + uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW ); + xTextRange = xFirstCellText->getStart(); + } + } + if( !xTextRange.is() ) + xTextRange = xText->getStart(); + return xTextRange; +} + +rtl::OUString& +SwVbaView::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaView") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaView::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.View" ) ); + } + return aServiceNames; +} + diff --git a/sw/source/ui/vba/vbaview.hxx b/sw/source/ui/vba/vbaview.hxx new file mode 100644 index 0000000000..020ca77c1c --- /dev/null +++ b/sw/source/ui/vba/vbaview.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: + * $Revision: + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_VIEW_HXX +#define SW_VBA_VIEW_HXX + +#include <ooo/vba/word/XView.hpp> +#include <vbahelper/vbahelperinterface.hxx> +#include <com/sun/star/text/XTextViewCursor.hpp> +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XView > SwVbaView_BASE; + +class SwVbaView : public SwVbaView_BASE +{ +private: + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::text::XTextViewCursor > mxViewCursor; + css::uno::Reference< css::beans::XPropertySet > mxViewSettings; + + css::uno::Reference< css::text::XTextRange > getHFTextRange( sal_Int32 nType ) throw (css::uno::RuntimeException); + css::uno::Reference< css::text::XTextRange > getFirstObjectPosition( const css::uno::Reference< css::text::XText >& xText ) throw (css::uno::RuntimeException); + +public: + SwVbaView( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, + const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException ); + virtual ~SwVbaView(); + + // XView + virtual ::sal_Int32 SAL_CALL getSeekView() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getSplitSpecial() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSplitSpecial( ::sal_Int32 _splitspecial ) throw (css::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getTableGridLines() throw (css::uno::RuntimeException); + virtual void SAL_CALL setTableGridLines( ::sal_Bool _tablegridlines ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException); + virtual void SAL_CALL setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException); + + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; +#endif /* SW_VBA_VIEW_HXX */ diff --git a/sw/source/ui/vba/vbawindow.cxx b/sw/source/ui/vba/vbawindow.cxx new file mode 100644 index 0000000000..bf41730c6a --- /dev/null +++ b/sw/source/ui/vba/vbawindow.cxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbawindow.cxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <vbahelper/helperdecl.hxx> +#include "vbawindow.hxx" +#include "vbaglobals.hxx" +#include "vbadocument.hxx" +#include "vbaview.hxx" +#include "vbapanes.hxx" +#include "vbapane.hxx" + +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +SwVbaWindow::SwVbaWindow( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowImpl_BASE( xParent, xContext, xModel ) +{ +} + +SwVbaWindow::SwVbaWindow( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xContext ) + : WindowImpl_BASE( args, xContext ) +{ +} + +void +SwVbaWindow::Activate() throw (css::uno::RuntimeException) +{ + SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); + + document.Activate(); +} + +void +SwVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& RouteDocument ) throw (uno::RuntimeException) +{ + // FIXME: it is incorrect when there are more than 1 windows + SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); + uno::Any FileName; + document.Close(SaveChanges, FileName, RouteDocument ); +} + +uno::Any SAL_CALL +SwVbaWindow::getView() throw (uno::RuntimeException) +{ + return uno::makeAny( uno::Reference< word::XView >( new SwVbaView( this, mxContext, m_xModel ) ) ); +} + +void SAL_CALL SwVbaWindow::setView( const uno::Any& _view ) throw (uno::RuntimeException) +{ + sal_Int32 nType = 0; + if( _view >>= nType ) + { + SwVbaView view( this, mxContext, m_xModel ); + view.setType( nType ); + } +} + +uno::Any SAL_CALL +SwVbaWindow::Panes( const uno::Any& aIndex ) throw (uno::RuntimeException) +{ + uno::Reference< XCollection > xPanes( new SwVbaPanes( this, mxContext, m_xModel ) ); + if( aIndex.getValueTypeClass() == uno::TypeClass_VOID ) + return uno::makeAny( xPanes ); + + return uno::Any( xPanes->Item( aIndex, uno::Any() ) ); +} + +uno::Any SAL_CALL +SwVbaWindow::ActivePane() throw (uno::RuntimeException) +{ + return uno::makeAny( uno::Reference< word::XPane >( new SwVbaPane( this, mxContext, m_xModel ) ) ); +} + +rtl::OUString& +SwVbaWindow::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaWindow") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaWindow::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Window" ) ); + } + return aServiceNames; +} diff --git a/sw/source/ui/vba/vbawindow.hxx b/sw/source/ui/vba/vbawindow.hxx new file mode 100644 index 0000000000..8d4af66ef7 --- /dev/null +++ b/sw/source/ui/vba/vbawindow.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbawindow.hxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_WINDOW_HXX +#define SW_VBA_WINDOW_HXX +#include <cppuhelper/implbase1.hxx> +#include <ooo/vba/word/XWindow.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <vbahelper/vbahelperinterface.hxx> +#include <vbahelper/vbawindowbase.hxx> + +typedef cppu::ImplInheritanceHelper1< VbaWindowBase, ov::word::XWindow > WindowImpl_BASE; + +class SwVbaWindow : public WindowImpl_BASE +{ +public: + SwVbaWindow( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel ); + SwVbaWindow( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext ); + + + // Attributes + virtual css::uno::Any SAL_CALL getView() throw (css::uno::RuntimeException); + virtual void SAL_CALL setView( const css::uno::Any& _view ) throw (css::uno::RuntimeException); + // Methods + virtual void SAL_CALL Activate( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL Panes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL ActivePane() throw (css::uno::RuntimeException); + // XHelperInterface + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif //SW_VBA_WINDOW_HXX diff --git a/sw/source/ui/vba/vbawrapformat.cxx b/sw/source/ui/vba/vbawrapformat.cxx new file mode 100644 index 0000000000..e5a126a6ca --- /dev/null +++ b/sw/source/ui/vba/vbawrapformat.cxx @@ -0,0 +1,260 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbawrapformat.cxx,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "vbawrapformat.hxx" +#include <ooo/vba/word/WdWrapSideType.hpp> +#include <ooo/vba/word/WdWrapType.hpp> +#include <com/sun/star/text/WrapTextMode.hpp> +#include <vbahelper/vbahelper.hxx> +#include <vbahelper/helperdecl.hxx> + +using namespace ooo::vba; +using namespace com::sun::star; + +SwVbaWrapFormat::SwVbaWrapFormat( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : SwVbaWrapFormat_BASE( xParent, xContext ), m_xShape( xShape ), mnWrapFormatType( 0 ), mnSide( word::WdWrapSideType::wdWrapBoth ) +{ + m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); +} + +SwVbaWrapFormat::SwVbaWrapFormat( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) : SwVbaWrapFormat_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext ), m_xShape( getXSomethingFromArgs< drawing::XShape >( aArgs, 1, false ) ), mnWrapFormatType( 0 ), mnSide( word::WdWrapSideType::wdWrapBoth ) +{ + m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); +} + +void SwVbaWrapFormat::makeWrap() throw (uno::RuntimeException) +{ + text::WrapTextMode eTextMode = text::WrapTextMode_NONE; + if( mnSide == word::WdWrapSideType::wdWrapLeft ) + { + eTextMode = text::WrapTextMode_LEFT; + } + else if( mnSide == word::WdWrapSideType::wdWrapRight ) + { + eTextMode = text::WrapTextMode_RIGHT; + } + else if( mnSide == word::WdWrapSideType::wdWrapBoth || + mnSide == word::WdWrapSideType::wdWrapLargest ) + { + switch( mnWrapFormatType ) + { + case word::WdWrapType::wdWrapNone: + case word::WdWrapType::wdWrapThrough: + { + eTextMode = text::WrapTextMode_THROUGHT; + break; + } + case word::WdWrapType::wdWrapInline: + case word::WdWrapType::wdWrapTopBottom: + { + eTextMode = text::WrapTextMode_NONE; + break; + } + case word::WdWrapType::wdWrapSquare: + { + eTextMode = text::WrapTextMode_PARALLEL; + m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SurroundContour") ), uno::makeAny( sal_False ) ); + break; + } + case word::WdWrapType::wdWrapTight: + { + eTextMode = text::WrapTextMode_PARALLEL; + m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SurroundContour") ), uno::makeAny( sal_True ) ); + break; + } + default: + { + DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); + } + } + } + m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextWrap") ), uno::makeAny( eTextMode ) ); +} + +::sal_Int32 SAL_CALL SwVbaWrapFormat::getType() throw (uno::RuntimeException) +{ + sal_Int32 nType = word::WdWrapType::wdWrapSquare; + text::WrapTextMode eTextMode; + m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextWrap") )) >>= eTextMode; + switch( eTextMode ) + { + case text::WrapTextMode_NONE: + { + nType = word::WdWrapType::wdWrapTopBottom; + break; + } + case text::WrapTextMode_THROUGHT: + { + nType = word::WdWrapType::wdWrapNone; + break; + } + case text::WrapTextMode_PARALLEL: + { + sal_Bool bContour = sal_False; + m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SurroundContour") )) >>= bContour; + if( bContour ) + nType = word::WdWrapType::wdWrapTight; + else + nType = word::WdWrapType::wdWrapSquare; + break; + } + case text::WrapTextMode_DYNAMIC: + case text::WrapTextMode_LEFT: + case text::WrapTextMode_RIGHT: + { + nType = word::WdWrapType::wdWrapThrough; + break; + } + default: + { + nType = word::WdWrapType::wdWrapSquare; + } + } + return nType; +} + +void SAL_CALL SwVbaWrapFormat::setType( ::sal_Int32 _type ) throw (uno::RuntimeException) +{ + mnWrapFormatType = _type; + makeWrap(); +} + +::sal_Int32 SAL_CALL SwVbaWrapFormat::getSide() throw (uno::RuntimeException) +{ + sal_Int32 nSide = word::WdWrapSideType::wdWrapBoth; + text::WrapTextMode eTextMode; + m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextWrap") )) >>= eTextMode; + switch( eTextMode ) + { + case text::WrapTextMode_LEFT: + { + nSide = word::WdWrapSideType::wdWrapLeft; + break; + } + case text::WrapTextMode_RIGHT: + { + nSide = word::WdWrapSideType::wdWrapRight; + break; + } + default: + { + nSide = word::WdWrapSideType::wdWrapBoth; + } + } + return nSide; +} + +void SAL_CALL SwVbaWrapFormat::setSide( ::sal_Int32 _side ) throw (uno::RuntimeException) +{ + mnSide = _side; + makeWrap(); +} + +float SwVbaWrapFormat::getDistance( const rtl::OUString& sName ) throw (uno::RuntimeException) +{ + sal_Int32 nDistance = 0; + m_xPropertySet->getPropertyValue( sName ) >>= nDistance; + return static_cast< float >( Millimeter::getInPoints( nDistance ) ); +} + +void SwVbaWrapFormat::setDistance( const rtl::OUString& sName, float _distance ) throw (uno::RuntimeException) +{ + sal_Int32 nDistance = Millimeter::getInHundredthsOfOneMillimeter( _distance ); + m_xPropertySet->setPropertyValue( sName, uno::makeAny( nDistance ) ); +} + +float SAL_CALL SwVbaWrapFormat::getDistanceTop() throw (uno::RuntimeException) +{ + return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ) ); +} + +void SAL_CALL SwVbaWrapFormat::setDistanceTop( float _distancetop ) throw (uno::RuntimeException) +{ + setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ), _distancetop ); +} + +float SAL_CALL SwVbaWrapFormat::getDistanceBottom() throw (uno::RuntimeException) +{ + return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ) ); +} + +void SAL_CALL SwVbaWrapFormat::setDistanceBottom( float _distancebottom ) throw (uno::RuntimeException) +{ + setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ), _distancebottom ); +} + +float SAL_CALL SwVbaWrapFormat::getDistanceLeft() throw (uno::RuntimeException) +{ + return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ) ); +} + +void SAL_CALL SwVbaWrapFormat::setDistanceLeft( float _distanceleft ) throw (uno::RuntimeException) +{ + setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), _distanceleft ); +} + +float SAL_CALL SwVbaWrapFormat::getDistanceRight() throw (uno::RuntimeException) +{ + return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ) ); +} + +void SAL_CALL SwVbaWrapFormat::setDistanceRight( float _distanceright ) throw (uno::RuntimeException) +{ + setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ), _distanceright ); +} + +rtl::OUString& +SwVbaWrapFormat::getServiceImplName() +{ + static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaWrapFormat") ); + return sImplName; +} + +uno::Sequence< rtl::OUString > +SwVbaWrapFormat::getServiceNames() +{ + static uno::Sequence< rtl::OUString > aServiceNames; + if ( aServiceNames.getLength() == 0 ) + { + aServiceNames.realloc( 1 ); + aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.WrapFormat" ) ); + } + return aServiceNames; +} + +namespace wrapformat +{ +namespace sdecl = comphelper::service_decl; +sdecl::vba_service_class_<SwVbaWrapFormat, sdecl::with_args<true> > serviceImpl; +extern sdecl::ServiceDecl const serviceDecl( + serviceImpl, + "SwVbaWrapFormat", + "ooo.vba.word.WrapFormat" ); +} + + diff --git a/sw/source/ui/vba/vbawrapformat.hxx b/sw/source/ui/vba/vbawrapformat.hxx new file mode 100644 index 0000000000..4da7c690e4 --- /dev/null +++ b/sw/source/ui/vba/vbawrapformat.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbafillformat.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VBA_XWRAPFORMAT_HXX +#define SW_VBA_XWRAPFORMAT_HXX + +#include <com/sun/star/drawing/XShape.hpp> +#include <ooo/vba/word/XWrapFormat.hpp> +#include <vbahelper/vbahelperinterface.hxx> + +typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XWrapFormat > SwVbaWrapFormat_BASE; + +class SwVbaWrapFormat : public SwVbaWrapFormat_BASE +{ +private: + css::uno::Reference< css::drawing::XShape > m_xShape; + css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; + sal_Int32 mnWrapFormatType; + sal_Int32 mnSide; + +private: + void makeWrap() throw (css::uno::RuntimeException); + float getDistance( const rtl::OUString& sName ) throw (css::uno::RuntimeException); + void setDistance( const rtl::OUString& sName, float _distance ) throw (css::uno::RuntimeException); + +public: + SwVbaWrapFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape ); + SwVbaWrapFormat( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ); + + virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException); + virtual void SAL_CALL setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getSide() throw (css::uno::RuntimeException); + virtual void SAL_CALL setSide( ::sal_Int32 _side ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getDistanceTop() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDistanceTop( float _distancetop ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getDistanceBottom() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDistanceBottom( float _distancebottom ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getDistanceLeft() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDistanceLeft( float _distanceleft ) throw (css::uno::RuntimeException); + virtual float SAL_CALL getDistanceRight() throw (css::uno::RuntimeException); + virtual void SAL_CALL setDistanceRight( float _distanceright ) throw (css::uno::RuntimeException); + + virtual rtl::OUString& getServiceImplName(); + virtual css::uno::Sequence<rtl::OUString> getServiceNames(); +}; + +#endif//SW_VBA_XWRAPFORMAT_HXX diff --git a/sw/source/ui/vba/wordvbahelper.cxx b/sw/source/ui/vba/wordvbahelper.cxx new file mode 100644 index 0000000000..b1bb076550 --- /dev/null +++ b/sw/source/ui/vba/wordvbahelper.cxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelper.cxx,v $ + * $Revision: 1.5.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <docsh.hxx> +#include "wordvbahelper.hxx" +#include <comphelper/processfactory.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/text/XTextViewCursorSupplier.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <unotxdoc.hxx> +#include <doc.hxx> + +using namespace ::com::sun::star; +using namespace ::ooo::vba; + +#define FIRST_PAGE 1; + +namespace ooo +{ +namespace vba +{ +namespace word +{ + +SwDocShell* getDocShell( const uno::Reference< frame::XModel>& xModel ) +{ + uno::Reference< lang::XUnoTunnel > xTunnel( xModel, uno::UNO_QUERY_THROW ); + SwXTextDocument* pXDoc = reinterpret_cast< SwXTextDocument * >( sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextDocument::getUnoTunnelId()))); + return pXDoc ? pXDoc->GetDocShell() : 0; +} + +SwView* getView( const uno::Reference< frame::XModel>& xModel ) +{ + SwDocShell* pDocShell = getDocShell( xModel ); + return pDocShell? pDocShell->GetView() : 0; +} + +uno::Reference< text::XTextViewCursor > getXTextViewCursor( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) +{ + uno::Reference< frame::XController > xController = xModel->getCurrentController(); + uno::Reference< text::XTextViewCursorSupplier > xTextViewCursorSupp( xController, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextViewCursor > xTextViewCursor = xTextViewCursorSupp->getViewCursor(); + return xTextViewCursor; +} + +uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) +{ + uno::Reference< beans::XPropertySet > xCursorProps( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); + rtl::OUString aPageStyleName; + xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName; + uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW ); + uno::Reference< style::XStyle > xStyle( xPageStyles->getByName( aPageStyleName ), uno::UNO_QUERY_THROW ); + + return xStyle; +} + +sal_Int32 getPageCount( const uno::Reference< frame::XModel>& xModel ) throw (uno::RuntimeException) +{ + SwDocShell* pDocShell = getDocShell( xModel ); + return pDocShell ? pDocShell->GetDoc()->GetPageCount() : 0; +} + +} // word +} // +} // diff --git a/sw/source/ui/vba/wordvbahelper.hxx b/sw/source/ui/vba/wordvbahelper.hxx new file mode 100644 index 0000000000..65cdbae6bf --- /dev/null +++ b/sw/source/ui/vba/wordvbahelper.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: vbahelper.hxx,v $ + * $Revision: 1.5.32.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_WORD_VBA_HELPER_HXX +#define SW_WORD_VBA_HELPER_HXX + +#include <vbahelper/vbahelper.hxx> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XTextViewCursor.hpp> +#include <com/sun/star/text/XPageCursor.hpp> +#include <com/sun/star/style/XStyle.hpp> + +class SwDocShell; +class SwView; +namespace ooo +{ + namespace vba + { + namespace word + { + //css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException); + SwDocShell* getDocShell( const css::uno::Reference< css::frame::XModel>& xModel ); + SwView* getView( const css::uno::Reference< css::frame::XModel>& xModel ); + css::uno::Reference< css::text::XTextViewCursor > getXTextViewCursor( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException); + css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException); + sal_Int32 getPageCount( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException); + +} // word +} // vba +} // ooo +#endif diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx index 21f1882f9e..67372ea5d1 100644 --- a/sw/source/ui/wrtsh/select.cxx +++ b/sw/source/ui/wrtsh/select.cxx @@ -35,8 +35,8 @@ #include <limits.h> #include <hintids.hxx> #include <sfx2/bindings.hxx> -#include <svtools/eitem.hxx> -#include <svtools/macitem.hxx> +#include <svl/eitem.hxx> +#include <svl/macitem.hxx> #include <unotools/charclass.hxx> #include <svx/scripttypeitem.hxx> #ifndef _CMDID_H @@ -343,7 +343,6 @@ void SwWrtShell::UnSelectFrm() // Rahmenselektion aufheben mit garantiert ungueltiger Position Point aPt(LONG_MIN, LONG_MIN); SelectObj(aPt, 0); - GetView().LeaveDrawCreate(); SwTransferable::ClearSelection( *this ); } diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index 6294722f46..f372bebac0 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -44,7 +44,7 @@ #include <hintids.hxx> #include <svx/svdview.hxx> #include <sot/factory.hxx> -#include <svtools/itemiter.hxx> +#include <svl/itemiter.hxx> #ifndef _SOUND_HXX //autogen #include <vcl/sound.hxx> #endif @@ -56,7 +56,7 @@ #include <svtools/ehdl.hxx> #include <svtools/soerr.hxx> #include <tools/cachestr.hxx> -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #include <svx/sizeitem.hxx> #include <svx/brkitem.hxx> #include <svx/svxacorr.hxx> diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx index 0927372db9..6738faa0d5 100644 --- a/sw/source/ui/wrtsh/wrtsh2.cxx +++ b/sw/source/ui/wrtsh/wrtsh2.cxx @@ -32,12 +32,12 @@ #include "precompiled_sw.hxx" #include <hintids.hxx> // define ITEMIDs -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> #include <sfx2/frame.hxx> #include <vcl/msgbox.hxx> -#include <svtools/urihelper.hxx> -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> +#include <svl/urihelper.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> #include <sfx2/docfile.hxx> #include <sfx2/fcontnr.hxx> #include <sfx2/dispatch.hxx> diff --git a/sw/source/ui/wrtsh/wrtundo.cxx b/sw/source/ui/wrtsh/wrtundo.cxx index 63aa5bfb42..f90dd3606a 100644 --- a/sw/source/ui/wrtsh/wrtundo.cxx +++ b/sw/source/ui/wrtsh/wrtundo.cxx @@ -36,7 +36,7 @@ #define _SVSTDARR_STRINGSDTOR #include <tools/resid.hxx> #include <sfx2/app.hxx> -#include <svtools/slstitm.hxx> +#include <svl/slstitm.hxx> #include <wrtsh.hxx> #include <swundo.hxx> // fuer Undo-Ids #include <swdtflvr.hxx> diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk index 4b3abf042b..fc1ff731b4 100644 --- a/sw/util/makefile.mk +++ b/sw/util/makefile.mk @@ -127,6 +127,7 @@ SHL1STDLIBS+= \ $(SALHELPERLIB) \ $(ICUUCLIB) \ $(I18NUTILLIB) \ + $(VBAHELPERLIB) \ $(AVMEDIALIB) .IF "$(GUI)"=="WNT" @@ -148,6 +149,7 @@ DEF2NAME= $(SHL2TARGET) SHL2STDLIBS= \ $(SFX2LIB) \ $(SVTOOLLIB) \ + $(UNOTOOLSLIB) \ $(SVLLIB) \ $(VCLLIB) \ $(SOTLIB) \ @@ -163,7 +165,7 @@ SHL2OBJS= $(SLO)$/swdetect.obj \ $(SLO)$/detreg.obj \ $(SLO)$/iodetect.obj -.IF "$(product)"=="" +.IF "$(dbgutil)"!="" SHL2OBJS+= \ $(SLO)$/errhdl.obj .ENDIF @@ -321,7 +323,7 @@ DEF4NAME=$(SHL4TARGET) SHL4STDLIBS= \ $(ISWLIB) \ $(SVXCORELIB) \ - $(SVXMSFILTERLIB) \ + $(MSFILTERLIB) \ $(SFXLIB) \ $(GOODIESLIB) \ $(BASEGFXLIB) \ @@ -339,6 +341,40 @@ SHL4STDLIBS= \ $(CPPUHELPERLIB) \ $(SALLIB) \ $(ICUUCLIB) \ + $(BASICLIB) \ $(I18NUTILLIB) +#target vba +TARGET_VBA=vbaswobj +SHL5TARGET=$(TARGET_VBA)$(DLLPOSTFIX).uno +SHL5IMPLIB= i$(TARGET_VBA) + +SHL5VERSIONMAP=$(TARGET_VBA).map +SHL5DEF=$(MISC)$/$(SHL5TARGET).def +DEF5NAME=$(SHL5TARGET) +SHL5STDLIBS= \ + $(ISWLIB) \ + $(CPPUHELPERLIB) \ + $(VCLLIB) \ + $(CPPULIB) \ + $(COMPHELPERLIB) \ + $(SVLIB) \ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(SALLIB)\ + $(VBAHELPERLIB) \ + $(BASICLIB) \ + $(SFXLIB) \ + $(SVXLIB) \ + $(SVTOOLLIB) \ + $(SVLLIB) \ + $(VCLLIB) \ + $(TKLIB) \ + $(I18NISOLANGLIB) \ + $(SVXCORELIB) \ + $(SVXMSFILTERLIB) \ + +SHL5DEPN=$(SHL1TARGETN) +SHL5LIBS=$(SLB)$/$(TARGET_VBA).lib + .INCLUDE : target.mk diff --git a/sw/util/msword.map b/sw/util/msword.map index 53c3eaf213..db60fc5ce8 100644..100755 --- a/sw/util/msword.map +++ b/sw/util/msword.map @@ -4,7 +4,8 @@ MSWORD_1_0 { ExportRTF; ImportDOC; ExportDOC; - + SaveOrDelMSVBAStorage_ww8; + GetSaveWarningOfMSVBAStorage_ww8; local: *; }; diff --git a/sw/util/vbaswobj.map b/sw/util/vbaswobj.map new file mode 100644 index 0000000000..737cddbfe3 --- /dev/null +++ b/sw/util/vbaswobj.map @@ -0,0 +1,9 @@ +OOO_1.1 { + global: + component_getImplementationEnvironment; + component_getFactory; + component_writeInfo; + + local: + *; +}; |