diff options
author | hg <hg@oosvn01.> | 2009-10-08 15:46:11 +0000 |
---|---|---|
committer | hg <hg@oosvn01.> | 2009-10-08 15:46:11 +0000 |
commit | 7d476e2e47e4572c44b325e976048bb8ae6959b6 (patch) | |
tree | b7f17c1cf3235cf394bd10eb867af0bf545bf83b | |
parent | 73220d96bca7cb760051144a5ea731119287d9f1 (diff) | |
parent | 5edc2d8ffaf658b05e4b044e44bd360697c3d08c (diff) |
merge with m50
276 files changed, 16549 insertions, 14812 deletions
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx index 6e8aa988f77f..a2814082a9e5 100644 --- a/starmath/inc/dialog.hxx +++ b/starmath/inc/dialog.hxx @@ -53,7 +53,7 @@ #include "format.hxx" #include "symbol.hxx" - +class SubsetMap; #define CATEGORY_NONE 0xFFFF /**************************************************************************/ diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index c70d75242e36..867c9508a074 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -33,7 +33,7 @@ #define NODE_HXX -#include <tools/dynary.hxx> +#include <vector> #include "parse.hxx" #include "types.hxx" @@ -63,9 +63,12 @@ extern SmFormat *pActiveFormat; class SmDocShell; - class SmNode; -DECLARE_DYNARRAY(SmNodeArray, SmNode *) +class SmStructureNode; + +typedef std::vector< SmNode * > SmNodeArray; +typedef std::vector< SmStructureNode * > SmStructureNodeArray; + //////////////////////////////////////////////////////////////////////////////// @@ -185,9 +188,6 @@ public: //////////////////////////////////////////////////////////////////////////////// -class SmStructureNode; - -DECLARE_DYNARRAY(SmStructureNodeArray, SmStructureNode *) class SmStructureNode : public SmNode { @@ -205,12 +205,11 @@ public: virtual BOOL IsVisible() const; virtual USHORT GetNumSubNodes() const; - void SetNumSubNodes(USHORT nSize) { aSubNodes.SetSize(nSize); } + void SetNumSubNodes(USHORT nSize) { aSubNodes.resize(nSize); } using SmNode::GetSubNode; virtual SmNode * GetSubNode(USHORT nIndex); - void SetSubNodes(SmNode *pFirst, SmNode *pSecond, - SmNode *pThird = NULL); + void SetSubNodes(SmNode *pFirst, SmNode *pSecond, SmNode *pThird = NULL); void SetSubNodes(const SmNodeArray &rNodeArray); virtual SmStructureNode & operator = ( const SmStructureNode &rNode ); diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx index c558e6973368..f05c4beec7ae 100644 --- a/starmath/inc/unomodel.hxx +++ b/starmath/inc/unomodel.hxx @@ -59,6 +59,9 @@ public: //////////////////////////////////////////////////////////// +#define A2OU(pText) rtl::OUString::createFromAscii(pText) + +//----------------------------------------------------------------------------- class SmModel : public SfxBaseModel, public comphelper::PropertySetHelper, public com::sun::star::lang::XServiceInfo, @@ -93,15 +96,11 @@ public: virtual void SAL_CALL render( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& rSelection, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rxOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); //XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName(void) - throw( ::com::sun::star::uno::RuntimeException ); - virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) - throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) - throw( ::com::sun::star::uno::RuntimeException ); - - virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xParent ) - throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException ); + virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xParent ) throw( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException ); static ::com::sun::star::uno::Sequence< rtl::OUString > getSupportedServiceNames_Static(); static ::rtl::OUString getImplementationName_Static(); diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx index 42bb5015b55f..aa3e02340968 100644 --- a/starmath/source/accessibility.cxx +++ b/starmath/source/accessibility.cxx @@ -72,7 +72,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::uno; using namespace com::sun::star::accessibility; -#define C2U(cChar) rtl::OUString::createFromAscii(cChar) +#define A2OU(cChar) rtl::OUString::createFromAscii(cChar) ////////////////////////////////////////////////////////////////////// @@ -824,7 +824,7 @@ OUString SAL_CALL SmGraphicAccessible::getImplementationName() throw (RuntimeException) { //vos::OGuard aGuard(Application::GetSolarMutex()); - return C2U("SmGraphicAccessible"); + return A2OU("SmGraphicAccessible"); } sal_Bool SAL_CALL SmGraphicAccessible::supportsService( @@ -832,10 +832,10 @@ sal_Bool SAL_CALL SmGraphicAccessible::supportsService( throw (RuntimeException) { //vos::OGuard aGuard(Application::GetSolarMutex()); - return rServiceName == C2U( "com::sun::star::accessibility::Accessible" ) || - rServiceName == C2U( "com::sun::star::accessibility::AccessibleComponent" ) || - rServiceName == C2U( "com::sun::star::accessibility::AccessibleContext" ) || - rServiceName == C2U( "com::sun::star::accessibility::AccessibleText" ); + return rServiceName == A2OU( "com::sun::star::accessibility::Accessible" ) || + rServiceName == A2OU( "com::sun::star::accessibility::AccessibleComponent" ) || + rServiceName == A2OU( "com::sun::star::accessibility::AccessibleContext" ) || + rServiceName == A2OU( "com::sun::star::accessibility::AccessibleText" ); } Sequence< OUString > SAL_CALL SmGraphicAccessible::getSupportedServiceNames() @@ -844,10 +844,10 @@ Sequence< OUString > SAL_CALL SmGraphicAccessible::getSupportedServiceNames() //vos::OGuard aGuard(Application::GetSolarMutex()); Sequence< OUString > aNames(4); OUString *pNames = aNames.getArray(); - pNames[0] = C2U( "com::sun::star::accessibility::Accessible" ); - pNames[1] = C2U( "com::sun::star::accessibility::AccessibleComponent" ); - pNames[2] = C2U( "com::sun::star::accessibility::AccessibleContext" ); - pNames[3] = C2U( "com::sun::star::accessibility::AccessibleText" ); + pNames[0] = A2OU( "com::sun::star::accessibility::Accessible" ); + pNames[1] = A2OU( "com::sun::star::accessibility::AccessibleComponent" ); + pNames[2] = A2OU( "com::sun::star::accessibility::AccessibleContext" ); + pNames[3] = A2OU( "com::sun::star::accessibility::AccessibleText" ); return aNames; } @@ -2026,7 +2026,7 @@ OUString SAL_CALL SmEditAccessible::getImplementationName() throw (RuntimeException) { //vos::OGuard aGuard(Application::GetSolarMutex()); - return C2U("SmEditAccessible"); + return A2OU("SmEditAccessible"); } sal_Bool SAL_CALL SmEditAccessible::supportsService( @@ -2034,9 +2034,9 @@ sal_Bool SAL_CALL SmEditAccessible::supportsService( throw (RuntimeException) { //vos::OGuard aGuard(Application::GetSolarMutex()); - return rServiceName == C2U( "com::sun::star::accessibility::Accessible" ) || - rServiceName == C2U( "com::sun::star::accessibility::AccessibleComponent" ) || - rServiceName == C2U( "com::sun::star::accessibility::AccessibleContext" ); + return rServiceName == A2OU( "com::sun::star::accessibility::Accessible" ) || + rServiceName == A2OU( "com::sun::star::accessibility::AccessibleComponent" ) || + rServiceName == A2OU( "com::sun::star::accessibility::AccessibleContext" ); } Sequence< OUString > SAL_CALL SmEditAccessible::getSupportedServiceNames() @@ -2045,9 +2045,9 @@ Sequence< OUString > SAL_CALL SmEditAccessible::getSupportedServiceNames() //vos::OGuard aGuard(Application::GetSolarMutex()); Sequence< OUString > aNames(3); OUString *pNames = aNames.getArray(); - pNames[0] = C2U( "com::sun::star::accessibility::Accessible" ); - pNames[1] = C2U( "com::sun::star::accessibility::AccessibleComponent" ); - pNames[2] = C2U( "com::sun::star::accessibility::AccessibleContext" ); + pNames[0] = A2OU( "com::sun::star::accessibility::Accessible" ); + pNames[1] = A2OU( "com::sun::star::accessibility::AccessibleComponent" ); + pNames[2] = A2OU( "com::sun::star::accessibility::AccessibleContext" ); return aNames; } diff --git a/starmath/source/accessibility.hxx b/starmath/source/accessibility.hxx index 0e12425bf15c..3fcda91bd05c 100644 --- a/starmath/source/accessibility.hxx +++ b/starmath/source/accessibility.hxx @@ -68,8 +68,6 @@ namespace com { namespace sun { namespace star { namespace accessibility { struct AccessibleEventObject; }}}} -#define css com::sun::star - ////////////////////////////////////////////////////////////////////// // // classes and helper-classes used for accessibility in the graphic-window diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index e6b540a9d092..16461d97d6e1 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -1261,22 +1261,6 @@ void SmMathConfig::SetIgnoreSpacesRight( BOOL bVal ) } -BOOL SmMathConfig::IsToolboxVisible() const -{ - if (!pOther) - ((SmMathConfig *) this)->LoadOther(); - return pOther->bToolboxVisible; -} - - -void SmMathConfig::SetToolboxVisible( BOOL bVal ) -{ - if (!pOther) - LoadOther(); - SetOtherIfNotEqual( pOther->bToolboxVisible, bVal ); -} - - BOOL SmMathConfig::IsAutoRedraw() const { if (!pOther) diff --git a/starmath/source/cfgitem.hxx b/starmath/source/cfgitem.hxx index a6a82c65425a..8987e153026f 100644 --- a/starmath/source/cfgitem.hxx +++ b/starmath/source/cfgitem.hxx @@ -207,8 +207,6 @@ public: BOOL IsIgnoreSpacesRight() const; void SetIgnoreSpacesRight( BOOL bVal ); - BOOL IsToolboxVisible() const; - void SetToolboxVisible( BOOL bVal ); BOOL IsAutoRedraw() const; void SetAutoRedraw( BOOL bVal ); BOOL IsShowFormulaCursor() const; diff --git a/starmath/source/commands.src b/starmath/source/commands.src index 16e02a68f807..a154139160ab 100644 --- a/starmath/source/commands.src +++ b/starmath/source/commands.src @@ -35,7 +35,6 @@ //////////////////////////////////////////////////////////// - String RID_PLUSX { Text = "+<?> " ; }; String RID_MINUSX { Text = "-<?> " ; }; String RID_PLUSMINUSX { Text = "+-<?> " ; }; diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 54d15d93d05b..314f1a7d4d77 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -33,84 +33,79 @@ #include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/uno/Any.h> + +#include <comphelper/accessibletexthelper.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/storagehelper.hxx> #include <rtl/logfile.hxx> #include <rtl/ustring.hxx> -#include <ucbhelper/content.hxx> -#include <sot/formats.hxx> -#include <sot/storage.hxx> -#include <svtools/linguprops.hxx> -#include <svtools/lingucfg.hxx> -#include <svtools/smplhint.hxx> -#include <svtools/pathoptions.hxx> -#ifndef _SO_CLSIDS_HXX //autogen +#include <sfx2/app.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/fcontnr.hxx> +#include <sfx2/msg.hxx> +#include <sfx2/objface.hxx> +#include <sfx2/printer.hxx> +#include <sfx2/request.hxx> +#include <sfx2/viewfrm.hxx> #include <sot/clsids.hxx> -#endif #include <sot/exchange.hxx> -#include <vcl/msgbox.hxx> - -#include <vcl/mapunit.hxx> -#include <vcl/mapmod.hxx> -#include <comphelper/storagehelper.hxx> -#include <comphelper/processfactory.hxx> -#include <comphelper/accessibletexthelper.hxx> +#include <sot/formats.hxx> +#include <sot/storage.hxx> #include <svtools/eitem.hxx> -#include <svtools/whiter.hxx> +#include <svtools/fstathelper.hxx> #include <svtools/intitem.hxx> -#include <svtools/stritem.hxx> +#include <svtools/itempool.hxx> +#include <svtools/lingucfg.hxx> +#include <svtools/linguprops.hxx> +#include <svtools/pathoptions.hxx> #include <svtools/ptitem.hxx> +#include <svtools/sfxecode.hxx> +#include <svtools/slstitm.hxx> +#include <svtools/smplhint.hxx> +#include <svtools/stritem.hxx> +#include <svtools/transfer.hxx> #include <svtools/undo.hxx> -#include <svtools/itempool.hxx> #include <svtools/urihelper.hxx> -#include <svtools/fstathelper.hxx> -#include <svtools/transfer.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/docfile.hxx> -#include <sfx2/app.hxx> -#include <sfx2/request.hxx> -#include <sfx2/viewfrm.hxx> -#include <svtools/sfxecode.hxx> -#include <sfx2/printer.hxx> -#include <sfx2/docfilt.hxx> -#include <svtools/itempool.hxx> +#include <svtools/whiter.hxx> #include <svx/editeng.hxx> -#include <svx/eeitem.hxx> #include <svx/editstat.hxx> -#include <svx/fontitem.hxx> +#include <svx/eeitem.hxx> #include <svx/fhgtitem.hxx> +#include <svx/fontitem.hxx> #include <svx/unolingu.hxx> -#include <svtools/slstitm.hxx> -#include <com/sun/star/uno/Any.h> -#include <com/sun/star/lang/Locale.hpp> +#include <ucbhelper/content.hxx> +#include <vcl/mapmod.hxx> +#include <vcl/mapunit.hxx> +#include <vcl/msgbox.hxx> -#ifndef STARMATH_HRC -#include <starmath.hrc> -#endif #include <document.hxx> -#include <unomodel.hxx> +#include <action.hxx> #include <config.hxx> +#include <dialog.hxx> +#include <format.hxx> +#include <smdll.hxx> +#include <starmath.hrc> #include <symbol.hxx> #include <toolbox.hxx> -#include <dialog.hxx> -#include <action.hxx> -#include <view.hxx> +#include <unomodel.hxx> #include <utility.hxx> -#include <format.hxx> -#include <mathtype.hxx> -#include <mathml.hxx> +#include <view.hxx> +#include "mathtype.hxx" +#include "mathmlimport.hxx" +#include "mathmlexport.hxx" -#include <smdll.hxx> -#include <sfx2/fcontnr.hxx> -#include <sfx2/msg.hxx> -#include <sfx2/objface.hxx> using namespace ::com::sun::star; +using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::accessibility; -#define A2OU(x) rtl::OUString::createFromAscii( x ) #define DOCUMENT_BUFFER_SIZE (USHORT)32768 @@ -261,7 +256,7 @@ void SmDocShell::ArrangeFormula() if (IsFormulaArranged()) return; - //! Nur fr die Dauer der Existenz dieses Objekts sind am Drucker die + //! Nur f�r die Dauer der Existenz dieses Objekts sind am Drucker die //! richtigen Einstellungen garantiert. SmPrinterAccess aPrtAcc(*this); // OutputDevice *pOutDev = aPrtAcc.GetPrinter(); @@ -274,7 +269,7 @@ void SmDocShell::ArrangeFormula() #endif } - // falls ntig ein anderes OutputDevice holen fr das formatiert wird + // falls n�tig ein anderes OutputDevice holen f�r das formatiert wird if (!pOutDev) { SmViewShell *pView = SmGetActiveView(); @@ -756,7 +751,7 @@ BOOL SmDocShell::ConvertFrom(SfxMedium &rMedium) pTree = 0; } Reference<com::sun::star::frame::XModel> xModel(GetModel()); - SmXMLWrapper aEquation(xModel); + SmXMLImportWrapper aEquation(xModel); bSuccess = 0 == aEquation.Import(rMedium); } else @@ -830,7 +825,7 @@ BOOL SmDocShell::Load( SfxMedium& rMedium ) { // is this a fabulous math package ? Reference<com::sun::star::frame::XModel> xModel(GetModel()); - SmXMLWrapper aEquation(xModel); + SmXMLImportWrapper aEquation(xModel); ULONG nError = aEquation.Import(rMedium); bRet = 0 == nError; SetError( nError ); @@ -865,7 +860,7 @@ BOOL SmDocShell::Save() ArrangeFormula(); Reference<com::sun::star::frame::XModel> xModel(GetModel()); - SmXMLWrapper aEquation(xModel); + SmXMLExportWrapper aEquation(xModel); aEquation.SetFlat(sal_False); return aEquation.Export(*GetMedium()); } @@ -938,7 +933,7 @@ BOOL SmDocShell::SaveAs( SfxMedium& rMedium ) ArrangeFormula(); Reference<com::sun::star::frame::XModel> xModel(GetModel()); - SmXMLWrapper aEquation(xModel); + SmXMLExportWrapper aEquation(xModel); aEquation.SetFlat(sal_False); bRet = aEquation.Export(rMedium); } @@ -962,14 +957,14 @@ BOOL SmDocShell::ConvertTo( SfxMedium &rMedium ) if(rFltName.EqualsAscii( STAROFFICE_XML )) { Reference<com::sun::star::frame::XModel> xModel(GetModel()); - SmXMLWrapper aEquation(xModel); + SmXMLExportWrapper aEquation(xModel); aEquation.SetFlat(sal_False); bRet = aEquation.Export(rMedium); } else if(rFltName.EqualsAscii( MATHML_XML )) { Reference<com::sun::star::frame::XModel> xModel(GetModel()); - SmXMLWrapper aEquation(xModel); + SmXMLExportWrapper aEquation(xModel); aEquation.SetFlat(sal_True); bRet = aEquation.Export(rMedium); } diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index d41500d2dbc1..d9c333611071 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -88,7 +88,7 @@ void SmGetLeftSelectionPart(const ESelection aSel, { // compare start and end of selection and use the one that comes first if ( aSel.nStartPara < aSel.nEndPara - || aSel.nStartPara == aSel.nEndPara && aSel.nStartPos < aSel.nEndPos) + || (aSel.nStartPara == aSel.nEndPara && aSel.nStartPos < aSel.nEndPos) ) { nPara = aSel.nStartPara; nPos = aSel.nStartPos; } diff --git a/starmath/source/makefile.mk b/starmath/source/makefile.mk index bb7d99a30ddb..0f604a22b346 100644 --- a/starmath/source/makefile.mk +++ b/starmath/source/makefile.mk @@ -63,7 +63,8 @@ SLO1FILES = \ $(SLO)$/dialog.obj \ $(SLO)$/document.obj \ $(SLO)$/mathtype.obj \ - $(SLO)$/mathml.obj \ + $(SLO)$/mathmlimport.obj \ + $(SLO)$/mathmlexport.obj \ $(SLO)$/format.obj \ $(SLO)$/node.obj \ $(SLO)$/parse.obj \ @@ -92,7 +93,10 @@ EXCEPTIONSFILES = \ $(SLO)$/accessibility.obj \ $(SLO)$/cfgitem.obj \ $(SLO)$/document.obj \ - $(SLO)$/mathml.obj \ + $(SLO)$/node.obj \ + $(SLO)$/parse.obj \ + $(SLO)$/mathmlimport.obj \ + $(SLO)$/mathmlexport.obj \ $(SLO)$/mathtype.obj \ $(SLO)$/view.obj \ $(SLO)$/viewhdl.obj \ diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx new file mode 100644 index 000000000000..9ddabab9c325 --- /dev/null +++ b/starmath/source/mathmlexport.cxx @@ -0,0 +1,1568 @@ +/*************************************************************************
+ *
+ * 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: x $
+ * $Revision: 1.00 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_starmath.hxx"
+
+/*
+ Warning: The SvXMLElementExport helper class creates the beginning and
+ closing tags of xml elements in its constructor and destructor, so theres
+ hidden stuff going on, on occasion the ordering of these classes declarations
+ may be significant
+*/
+
+
+#include <com/sun/star/xml/sax/XErrorHandler.hpp>
+#include <com/sun/star/xml/sax/XEntityResolver.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XDTDHandler.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/uno/Any.h>
+
+#include <rtl/math.hxx>
+#include <sfx2/frame.hxx>
+#include <sfx2/docfile.hxx>
+#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/processfactory.hxx>
+#include <unotools/streamwrap.hxx>
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlmetai.hxx>
+#include <osl/mutex.hxx>
+#include <comphelper/genericpropertyset.hxx>
+
+#include <memory>
+
+#include "mathmlexport.hxx"
+#include "mathtype.hxx"
+#include <starmath.hrc>
+#include <unomodel.hxx>
+#include <document.hxx>
+#include <utility.hxx>
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+#define EXPORT_SVC_NAME RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.XMLExportFilter")
+
+#undef WANTEXCEPT
+
+
+////////////////////////////////////////////////////////////
+
+sal_Bool SmXMLExportWrapper::Export(SfxMedium &rMedium)
+{
+ sal_Bool bRet=sal_True;
+ uno::Reference<lang::XMultiServiceFactory>
+ xServiceFactory(utl::getProcessServiceFactory());
+ DBG_ASSERT(xServiceFactory.is(),"got no service manager");
+
+ //Get model
+ uno::Reference< lang::XComponent > xModelComp(xModel, uno::UNO_QUERY );
+
+ sal_Bool bEmbedded = sal_False;
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ SmDocShell *pDocShell = pModel ?
+ static_cast<SmDocShell*>(pModel->GetObjectShell()) : 0;
+ if ( pDocShell &&
+ SFX_CREATE_MODE_EMBEDDED == pDocShell->GetCreateMode() )
+ bEmbedded = sal_True;
+
+ uno::Reference<task::XStatusIndicator> xStatusIndicator;
+ if (!bEmbedded)
+ {
+ if (pDocShell /*&& pDocShell->GetMedium()*/)
+ {
+ DBG_ASSERT( pDocShell->GetMedium() == &rMedium,
+ "different SfxMedium found" );
+
+ SfxItemSet* pSet = rMedium.GetItemSet();
+ if (pSet)
+ {
+ const SfxUnoAnyItem* pItem = static_cast<const SfxUnoAnyItem*>(
+ pSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) );
+ if (pItem)
+ pItem->GetValue() >>= xStatusIndicator;
+ }
+ }
+
+ // set progress range and start status indicator
+ if (xStatusIndicator.is())
+ {
+ sal_Int32 nProgressRange = bFlat ? 1 : 3;
+ xStatusIndicator->start(String(SmResId(STR_STATSTR_WRITING)),
+ nProgressRange);
+ }
+ }
+
+
+ // create XPropertySet with three properties for status indicator
+ comphelper::PropertyMapEntry aInfoMap[] =
+ {
+ { "UsePrettyPrinting", sizeof("UsePrettyPrinting")-1, 0,
+ &::getBooleanCppuType(),
+ beans::PropertyAttribute::MAYBEVOID, 0},
+ { "BaseURI", sizeof("BaseURI")-1, 0,
+ &::getCppuType( (OUString *)0 ),
+ beans::PropertyAttribute::MAYBEVOID, 0 },
+ { "StreamRelPath", sizeof("StreamRelPath")-1, 0,
+ &::getCppuType( (OUString *)0 ),
+ beans::PropertyAttribute::MAYBEVOID, 0 },
+ { "StreamName", sizeof("StreamName")-1, 0,
+ &::getCppuType( (OUString *)0 ),
+ beans::PropertyAttribute::MAYBEVOID, 0 },
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+ uno::Reference< beans::XPropertySet > xInfoSet(
+ comphelper::GenericPropertySet_CreateInstance(
+ new comphelper::PropertySetInfo( aInfoMap ) ) );
+
+ SvtSaveOptions aSaveOpt;
+ OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting"));
+ sal_Bool bUsePrettyPrinting( bFlat || aSaveOpt.IsPrettyPrinting() );
+ Any aAny;
+ aAny.setValue( &bUsePrettyPrinting, ::getBooleanCppuType() );
+ xInfoSet->setPropertyValue( sUsePrettyPrinting, aAny );
+
+ // Set base URI
+ OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("BaseURI") );
+ xInfoSet->setPropertyValue( sPropName, makeAny( rMedium.GetBaseURL( true ) ) );
+
+ sal_Int32 nSteps=0;
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+ if (!bFlat) //Storage (Package) of Stream
+ {
+ uno::Reference < embed::XStorage > xStg = rMedium.GetOutputStorage();
+ sal_Bool bOASIS = ( SotStorage::GetVersion( xStg ) > SOFFICE_FILEFORMAT_60 );
+
+ // TODO/LATER: handle the case of embedded links gracefully
+ if ( bEmbedded ) //&& !pStg->IsRoot() )
+ {
+ OUString aName;
+ if ( rMedium.GetItemSet() )
+ {
+ const SfxStringItem* pDocHierarchItem = static_cast<const SfxStringItem*>(
+ rMedium.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) );
+ if ( pDocHierarchItem )
+ aName = pDocHierarchItem->GetValue();
+ }
+
+ if ( aName.getLength() )
+ {
+ sPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath"));
+ xInfoSet->setPropertyValue( sPropName, makeAny( aName ) );
+ }
+ }
+
+ if ( !bEmbedded )
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ bRet = WriteThroughComponent(
+ xStg, xModelComp, "meta.xml", xServiceFactory, xInfoSet,
+ (bOASIS ? "com.sun.star.comp.Math.XMLOasisMetaExporter"
+ : "com.sun.star.comp.Math.XMLMetaExporter"),
+ sal_False);
+ }
+ if ( bRet )
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ bRet = WriteThroughComponent(
+ xStg, xModelComp, "content.xml", xServiceFactory, xInfoSet,
+ "com.sun.star.comp.Math.XMLContentExporter");
+ }
+
+ if ( bRet )
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ bRet = WriteThroughComponent(
+ xStg, xModelComp, "settings.xml", xServiceFactory, xInfoSet,
+ (bOASIS ? "com.sun.star.comp.Math.XMLOasisSettingsExporter"
+ : "com.sun.star.comp.Math.XMLSettingsExporter") );
+ }
+ }
+ else
+ {
+ SvStream *pStream = rMedium.GetOutStream();
+ uno::Reference<io::XOutputStream> xOut(
+ new utl::OOutputStreamWrapper(*pStream) );
+
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ bRet = WriteThroughComponent(
+ xOut, xModelComp, xServiceFactory, xInfoSet,
+ "com.sun.star.comp.Math.XMLContentExporter");
+ }
+
+ if (xStatusIndicator.is())
+ xStatusIndicator->end();
+
+ return bRet;
+}
+
+
+/// export through an XML exporter component (output stream version)
+sal_Bool SmXMLExportWrapper::WriteThroughComponent(
+ Reference<io::XOutputStream> xOutputStream,
+ Reference<XComponent> xComponent,
+ Reference<lang::XMultiServiceFactory> & rFactory,
+ Reference<beans::XPropertySet> & rPropSet,
+ const sal_Char* pComponentName )
+{
+ DBG_ASSERT(xOutputStream.is(), "I really need an output stream!");
+ DBG_ASSERT(xComponent.is(), "Need component!");
+ DBG_ASSERT(NULL != pComponentName, "Need component name!");
+
+ // get component
+ Reference< io::XActiveDataSource > xSaxWriter(
+ rFactory->createInstance(
+ OUString::createFromAscii("com.sun.star.xml.sax.Writer") ),
+ UNO_QUERY );
+ DBG_ASSERT( xSaxWriter.is(), "can't instantiate XML writer" );
+ if (!xSaxWriter.is())
+ return sal_False;
+
+ // connect XML writer to output stream
+ xSaxWriter->setOutputStream( xOutputStream );
+
+ // prepare arguments (prepend doc handler to given arguments)
+ Reference<xml::sax::XDocumentHandler> xDocHandler( xSaxWriter,UNO_QUERY);
+
+ Sequence<Any> aArgs( 2 );
+ aArgs[0] <<= xDocHandler;
+ aArgs[1] <<= rPropSet;
+
+ // get filter component
+ Reference< document::XExporter > xExporter(
+ rFactory->createInstanceWithArguments(
+ OUString::createFromAscii(pComponentName), aArgs), UNO_QUERY);
+ DBG_ASSERT( xExporter.is(),
+ "can't instantiate export filter component" );
+ if ( !xExporter.is() )
+ return sal_False;
+
+
+ // connect model and filter
+ xExporter->setSourceDocument( xComponent );
+
+ // filter!
+ Reference < XFilter > xFilter( xExporter, UNO_QUERY );
+ uno::Sequence< PropertyValue > aProps(0);
+ xFilter->filter( aProps );
+
+ uno::Reference<lang::XUnoTunnel> xFilterTunnel;
+ xFilterTunnel = uno::Reference<lang::XUnoTunnel>
+ ( xFilter, uno::UNO_QUERY );
+ SmXMLExport *pFilter = reinterpret_cast< SmXMLExport * >(
+ sal::static_int_cast< sal_uIntPtr >(
+ xFilterTunnel->getSomething( SmXMLExport::getUnoTunnelId() )));
+ return pFilter ? pFilter->GetSuccess() : sal_True;
+}
+
+
+/// export through an XML exporter component (storage version)
+sal_Bool SmXMLExportWrapper::WriteThroughComponent(
+ const Reference < embed::XStorage >& xStorage,
+ Reference<XComponent> xComponent,
+ const sal_Char* pStreamName,
+ Reference<lang::XMultiServiceFactory> & rFactory,
+ Reference<beans::XPropertySet> & rPropSet,
+ const sal_Char* pComponentName,
+ sal_Bool bCompress
+ )
+{
+ DBG_ASSERT(xStorage.is(), "Need storage!");
+ DBG_ASSERT(NULL != pStreamName, "Need stream name!");
+
+ // open stream
+ Reference < io::XStream > xStream;
+ OUString sStreamName = OUString::createFromAscii(pStreamName);
+ try
+ {
+ xStream = xStorage->openStreamElement( sStreamName,
+ embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
+ }
+ catch ( uno::Exception& )
+ {
+ DBG_ERROR( "Can't create output stream in package!" );
+ return sal_False;
+ }
+
+ String aPropName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("MediaType") ) );
+ OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") );
+ uno::Any aAny;
+ aAny <<= aMime;
+
+ uno::Reference < beans::XPropertySet > xSet( xStream, uno::UNO_QUERY );
+ xSet->setPropertyValue( aPropName, aAny );
+
+ if ( !bCompress )
+ {
+ aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Compressed") );
+ sal_Bool bFalse = sal_False;
+ aAny.setValue( &bFalse, ::getBooleanCppuType() );
+ xSet->setPropertyValue( aPropName, aAny );
+ }
+
+ // even plain stream must be encrypted in encrypted document
+ OUString aTmpPropName( RTL_CONSTASCII_USTRINGPARAM("UseCommonStoragePasswordEncryption") );
+ sal_Bool bTrue = sal_True;
+ aAny.setValue( &bTrue, ::getBooleanCppuType() );
+ xSet->setPropertyValue( aTmpPropName, aAny );
+
+ // set Base URL
+ if ( rPropSet.is() )
+ {
+ OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("StreamName") );
+ rPropSet->setPropertyValue( sPropName, makeAny( sStreamName ) );
+ }
+
+ // write the stuff
+ sal_Bool bRet = WriteThroughComponent( xStream->getOutputStream(), xComponent, rFactory,
+ rPropSet, pComponentName );
+
+ // stream is closed by SAX parser
+ //if ( bRet )
+ // xStream->getOutputStream()->closeOutput();
+
+ return bRet;
+}
+
+////////////////////////////////////////////////////////////
+
+// #110680#
+SmXMLExport::SmXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ sal_uInt16 nExportFlags)
+: SvXMLExport( xServiceFactory, MAP_INCH, XML_MATH, nExportFlags ) ,
+ pTree(0) ,
+ bSuccess(sal_False)
+{
+}
+
+sal_Int64 SAL_CALL SmXMLExport::getSomething(
+ const uno::Sequence< sal_Int8 >& rId )
+throw(uno::RuntimeException)
+{
+ if ( rId.getLength() == 16 &&
+ 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this));
+
+ return SvXMLExport::getSomething( rId );
+}
+
+const uno::Sequence< sal_Int8 > & SmXMLExport::getUnoTunnelId() throw()
+{
+ static uno::Sequence< sal_Int8 > * pSeq = 0;
+ if ( !pSeq )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+OUString SAL_CALL SmXMLExport_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLExporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLExport_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( EXPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLExport_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_ALL );
+ // EXPORT_OASIS is required here allthough there is no differrence between
+ // OOo and OASIS, because without the flag, a transformation to OOo would
+ // be chained in.
+ return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_OASIS|EXPORT_ALL );
+}
+
+////////////////////////////////////////////////////////////
+
+OUString SAL_CALL SmXMLExportMetaOOO_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLMetaExporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLExportMetaOOO_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( EXPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLExportMetaOOO_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_META );
+ return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_META );
+}
+
+////////////////////////////////////////////////////////////
+
+OUString SAL_CALL SmXMLExportMeta_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLOasisMetaExporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLExportMeta_getSupportedServiceNames()
+throw()
+{
+ const OUString aServiceName( EXPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLExportMeta_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_META );
+ return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_OASIS|EXPORT_META );
+}
+
+////////////////////////////////////////////////////////////
+
+OUString SAL_CALL SmXMLExportSettingsOOO_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLSettingsExporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLExportSettingsOOO_getSupportedServiceNames()
+throw()
+{
+ const OUString aServiceName( EXPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLExportSettingsOOO_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_SETTINGS );
+ return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_SETTINGS );
+}
+
+////////////////////////////////////////////////////////////
+
+OUString SAL_CALL SmXMLExportSettings_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLOasisSettingsExporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLExportSettings_getSupportedServiceNames()
+throw()
+{
+ const OUString aServiceName( EXPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLExportSettings_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_SETTINGS );
+ return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_OASIS|EXPORT_SETTINGS );
+}
+
+////////////////////////////////////////////////////////////
+
+OUString SAL_CALL SmXMLExportContent_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLContentExporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLExportContent_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( EXPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLExportContent_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_CONTENT );
+ // The EXPORT_OASIS flag is only required to avoid that a transformer is
+ // chanied in
+ return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_OASIS|EXPORT_CONTENT );
+}
+
+////////////////////////////////////////////////////////////
+
+// XServiceInfo
+// override empty method from parent class
+rtl::OUString SAL_CALL SmXMLExport::getImplementationName()
+throw(uno::RuntimeException)
+{
+ OUString aTxt;
+ switch( getExportFlags() )
+ {
+ case EXPORT_META:
+ aTxt = SmXMLExportMeta_getImplementationName();
+ break;
+ case EXPORT_SETTINGS:
+ aTxt = SmXMLExportSettings_getImplementationName();
+ break;
+ case EXPORT_CONTENT:
+ aTxt = SmXMLExportContent_getImplementationName();
+ break;
+ case EXPORT_ALL:
+ default:
+ aTxt = SmXMLExport_getImplementationName();
+ break;
+ }
+ return aTxt;
+}
+
+sal_uInt32 SmXMLExport::exportDoc(enum XMLTokenEnum eClass)
+{
+ if ( (getExportFlags() & EXPORT_CONTENT) == 0 )
+ {
+ SvXMLExport::exportDoc( eClass );
+ }
+ else
+ {
+ uno::Reference <frame::XModel> xModel = GetModel();
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ if (pModel)
+ {
+ SmDocShell *pDocShell =
+ static_cast<SmDocShell*>(pModel->GetObjectShell());
+ pTree = pDocShell->GetFormulaTree();
+ aText = pDocShell->GetText();
+ }
+
+ GetDocHandler()->startDocument();
+
+ /*Add xmlns line*/
+ SvXMLAttributeList &rList = GetAttrList();
+
+ // make use of a default namespace
+ ResetNamespaceMap(); // Math doesn't need namespaces from xmloff, since it now uses default namespaces (because that is common with current MathML usage in the web)
+ _GetNamespaceMap().Add( OUString::createFromAscii(""), GetXMLToken(XML_N_MATH), XML_NAMESPACE_MATH );
+
+ rList.AddAttribute(GetNamespaceMap().GetAttrNameByKey(XML_NAMESPACE_MATH_IDX),
+ GetNamespaceMap().GetNameByKey( XML_NAMESPACE_MATH_IDX));
+
+ //I think we need something like ImplExportEntities();
+ _ExportContent();
+ GetDocHandler()->endDocument();
+ }
+
+ bSuccess=sal_True;
+ return 0;
+}
+
+void SmXMLExport::_ExportContent()
+{
+ SvXMLElementExport aEquation(*this, XML_NAMESPACE_MATH, XML_MATH, sal_True, sal_True);
+ SvXMLElementExport *pSemantics=0;
+
+ if (aText.Len())
+ {
+ pSemantics = new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
+ XML_SEMANTICS, sal_True, sal_True);
+ }
+
+ ExportNodes(pTree, 0);
+
+ if (aText.Len())
+ {
+ // Convert symbol names
+ uno::Reference <frame::XModel> xModel = GetModel();
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+ SmDocShell *pDocShell = pModel ?
+ static_cast<SmDocShell*>(pModel->GetObjectShell()) : 0;
+ DBG_ASSERT( pDocShell, "doc shell missing" );
+ if (pDocShell)
+ {
+ SmParser &rParser = pDocShell->GetParser();
+ BOOL bVal = rParser.IsExportSymbolNames();
+ rParser.SetExportSymbolNames( TRUE );
+ SmNode *pTmpTree = rParser.Parse( aText );
+ aText = rParser.GetText();
+ delete pTmpTree;
+ rParser.SetExportSymbolNames( bVal );
+ }
+
+ AddAttribute(XML_NAMESPACE_MATH, XML_ENCODING,
+ OUString(RTL_CONSTASCII_USTRINGPARAM("StarMath 5.0")));
+ SvXMLElementExport aAnnotation(*this, XML_NAMESPACE_MATH,
+ XML_ANNOTATION, sal_True, sal_False);
+ GetDocHandler()->characters(OUString( aText ));
+ }
+ delete pSemantics;
+}
+
+void SmXMLExport::GetViewSettings( Sequence < PropertyValue >& aProps)
+{
+ uno::Reference <frame::XModel> xModel = GetModel();
+ if ( !xModel.is() )
+ return;
+
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ if ( !pModel )
+ return;
+
+ SmDocShell *pDocShell =
+ static_cast<SmDocShell*>(pModel->GetObjectShell());
+ if ( !pDocShell )
+ return;
+
+ aProps.realloc( 4 );
+ PropertyValue *pValue = aProps.getArray();
+ sal_Int32 nIndex = 0;
+
+ Rectangle aRect( pDocShell->GetVisArea() );
+
+ pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaTop") );
+ pValue[nIndex++].Value <<= aRect.Top();
+
+ pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaLeft") );
+ pValue[nIndex++].Value <<= aRect.Left();
+
+ pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaWidth") );
+ pValue[nIndex++].Value <<= aRect.GetWidth();
+
+ pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaHeight") );
+ pValue[nIndex++].Value <<= aRect.GetHeight();
+}
+
+void SmXMLExport::GetConfigurationSettings( Sequence < PropertyValue > & rProps)
+{
+ Reference < XPropertySet > xProps ( GetModel(), UNO_QUERY );
+ if ( xProps.is() )
+ {
+ Reference< XPropertySetInfo > xPropertySetInfo = xProps->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ Sequence< Property > aProps = xPropertySetInfo->getProperties();
+ sal_Int32 nCount(aProps.getLength());
+ if (nCount > 0)
+ {
+ rProps.realloc(nCount);
+ PropertyValue* pProps = rProps.getArray();
+ if (pProps)
+ {
+ const OUString sFormula ( RTL_CONSTASCII_USTRINGPARAM ( "Formula" ) );
+ const OUString sBasicLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "BasicLibraries" ) );
+ const OUString sDialogLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "DialogLibraries" ) );
+ const OUString sRuntimeUID ( RTL_CONSTASCII_USTRINGPARAM ( "RuntimeUID" ) );
+ for (sal_Int32 i = 0; i < nCount; i++, pProps++)
+ {
+ const OUString &rPropName = aProps[i].Name;
+ if (rPropName != sFormula &&
+ rPropName != sBasicLibraries &&
+ rPropName != sDialogLibraries &&
+ rPropName != sRuntimeUID)
+ {
+ pProps->Name = rPropName;
+ pProps->Value = xProps->getPropertyValue(rPropName);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void SmXMLExport::ExportLine(const SmNode *pNode, int nLevel)
+{
+ ExportExpression(pNode, nLevel);
+}
+
+void SmXMLExport::ExportBinaryHorizontal(const SmNode *pNode, int nLevel)
+{
+ ExportExpression(pNode, nLevel);
+}
+
+void SmXMLExport::ExportUnaryHorizontal(const SmNode *pNode, int nLevel)
+{
+ ExportExpression(pNode, nLevel);
+}
+
+void SmXMLExport::ExportExpression(const SmNode *pNode, int nLevel)
+{
+ SvXMLElementExport *pRow=0;
+ ULONG nSize = pNode->GetNumSubNodes();
+
+ if (nSize > 1)
+ pRow = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MROW, sal_True, sal_True);
+
+ //if (nSize)
+ //{
+ for (USHORT i = 0; i < nSize; i++)
+ if (const SmNode *pTemp = pNode->GetSubNode(i))
+ ExportNodes(pTemp, nLevel+1);
+ //}
+#if 0
+ else
+ {
+ //This saves us from situations like "a newline" where the
+ //lack of a term following the newline would otherwise create
+ //a incorrect token like <mtr/>
+ SvXMLElementExport aDummy(*this, XML_NAMESPACE_MATH, XML_MI, sal_True, sal_False);
+ sal_Unicode nArse[2] = {'\n','\0'};
+ GetDocHandler()->characters(nArse);
+ }
+#endif
+
+ delete pRow;
+}
+
+void SmXMLExport::ExportBinaryVertical(const SmNode *pNode, int nLevel)
+{
+ DBG_ASSERT(pNode->GetNumSubNodes()==3,"Bad Fraction");
+ SvXMLElementExport aFraction(*this, XML_NAMESPACE_MATH, XML_MFRAC, sal_True, sal_True);
+ ExportNodes(pNode->GetSubNode(0), nLevel);
+ ExportNodes(pNode->GetSubNode(2), nLevel);
+}
+
+void SmXMLExport::ExportTable(const SmNode *pNode, int nLevel)
+{
+ SvXMLElementExport *pTable=0;
+
+ USHORT nSize = pNode->GetNumSubNodes();
+
+ //If the list ends in newline then the last entry has
+ //no subnodes, the newline is superfulous so we just drop
+ //the last node, inclusion would create a bad MathML
+ //table
+ if (nSize >= 1 && pNode->GetSubNode(nSize-1)->GetNumSubNodes() == 0)
+ --nSize;
+
+ // 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);
+
+ for (USHORT i = 0; i < nSize; i++)
+ if (const SmNode *pTemp = pNode->GetSubNode(i))
+ {
+ SvXMLElementExport *pRow=0;
+ SvXMLElementExport *pCell=0;
+ if (pTable)
+ {
+ pRow = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MTR, sal_True, sal_True);
+ pCell = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MTD, sal_True, sal_True);
+ }
+ ExportNodes(pTemp, nLevel+1);
+ delete pCell;
+ delete pRow;
+ }
+
+ delete pTable;
+}
+
+void SmXMLExport::ExportMath(const SmNode *pNode, int /*nLevel*/)
+{
+ const SmMathSymbolNode *pTemp = static_cast<const SmMathSymbolNode *>(pNode);
+ SvXMLElementExport aMath(*this, XML_NAMESPACE_MATH, XML_MO, sal_True, sal_False);
+ sal_Unicode nArse[2];
+ nArse[0] = pTemp->GetText().GetChar(0);
+ sal_Unicode cTmp = ConvertMathToMathML( nArse[0] );
+ if (cTmp != 0)
+ nArse[0] = cTmp;
+ DBG_ASSERT(nArse[0] != 0xffff,"Non existant symbol");
+ nArse[1] = 0;
+ GetDocHandler()->characters(nArse);
+}
+
+void SmXMLExport::ExportText(const SmNode *pNode, int /*nLevel*/)
+{
+ SvXMLElementExport *pText;
+ const SmTextNode *pTemp = static_cast<const SmTextNode *>(pNode);
+ switch (pNode->GetToken().eType)
+ {
+ default:
+ case TIDENT:
+ {
+ //Note that we change the fontstyle to italic for strings that
+ //are italic and longer than a single character.
+ sal_Bool bIsItalic = IsItalic( pTemp->GetFont() );
+ if ((pTemp->GetText().Len() > 1) && bIsItalic)
+ AddAttribute(XML_NAMESPACE_MATH, XML_MATHVARIANT, XML_ITALIC);
+ else if ((pTemp->GetText().Len() == 1) && !bIsItalic)
+ AddAttribute(XML_NAMESPACE_MATH, XML_MATHVARIANT, XML_NORMAL);
+ pText = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MI,sal_True,sal_False);
+ break;
+ }
+ case TNUMBER:
+ pText = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MN,sal_True,sal_False);
+ break;
+ case TTEXT:
+ pText = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MTEXT,sal_True,sal_False);
+ break;
+ }
+ GetDocHandler()->characters(OUString(pTemp->GetText().GetBuffer()));
+ delete pText;
+}
+
+void SmXMLExport::ExportBlank(const SmNode * /*pNode*/, int /*nLevel*/)
+{
+ //!! 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 !!
+
+ SvXMLElementExport *pText;
+ //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;
+}
+
+void SmXMLExport::ExportSubSupScript(const SmNode *pNode, int nLevel)
+{
+ const SmNode *pSub = 0;
+ const SmNode *pSup = 0;
+ const SmNode *pCSub = 0;
+ const SmNode *pCSup = 0;
+ const SmNode *pLSub = 0;
+ const SmNode *pLSup = 0;
+ SvXMLElementExport *pThing = 0, *pThing2 = 0;
+
+ //if we have prescripts at all then we must use the tensor notation
+
+ //This is one of those excellent locations where scope is vital to
+ //arrange the construction and destruction of the element helper
+ //classes correctly
+ pLSub = pNode->GetSubNode(LSUB+1);
+ pLSup = pNode->GetSubNode(LSUP+1);
+ if (pLSub || pLSup)
+ {
+ SvXMLElementExport aMultiScripts(*this, XML_NAMESPACE_MATH,
+ XML_MMULTISCRIPTS, sal_True, sal_True);
+
+
+ if (NULL != (pCSub = pNode->GetSubNode(CSUB+1))
+ && NULL != (pCSup = pNode->GetSubNode(CSUP+1)))
+ {
+ pThing2 = new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
+ XML_MUNDEROVER, sal_True,sal_True);
+ }
+ else if (NULL != (pCSub = pNode->GetSubNode(CSUB+1)))
+ {
+ pThing2 = new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
+ XML_MUNDER, sal_True,sal_True);
+ }
+ else if (NULL != (pCSup = pNode->GetSubNode(CSUP+1)))
+ {
+ pThing2 = new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
+ XML_MOVER, sal_True,sal_True);
+ }
+
+ ExportNodes(pNode->GetSubNode(0), nLevel+1); //Main Term
+
+ if (pCSub)
+ ExportNodes(pCSub, nLevel+1);
+ if (pCSup)
+ ExportNodes(pCSup, nLevel+1);
+ delete pThing2;
+
+ pSub = pNode->GetSubNode(RSUB+1);
+ pSup = pNode->GetSubNode(RSUP+1);
+ if (pSub || pSup)
+ {
+ if (pSub)
+ ExportNodes(pSub, nLevel+1);
+ else
+ {
+ SvXMLElementExport aNone(*this, XML_NAMESPACE_MATH, XML_NONE,sal_True,sal_True);
+ }
+ if (pSup)
+ ExportNodes(pSup, nLevel+1);
+ else
+ {
+ SvXMLElementExport aNone(*this, XML_NAMESPACE_MATH, XML_NONE,sal_True,sal_True);
+ }
+ }
+
+ //Seperator element between suffix and prefix sub/sup pairs
+ {
+ SvXMLElementExport aPrescripts(*this, XML_NAMESPACE_MATH,
+ XML_MPRESCRIPTS, sal_True,sal_True);
+ }
+
+ if (pLSub)
+ ExportNodes(pLSub, nLevel+1);
+ else
+ {
+ SvXMLElementExport aNone(*this, XML_NAMESPACE_MATH, XML_NONE,
+ sal_True,sal_True);
+
+ }
+ if (pLSup)
+ ExportNodes(pLSup, nLevel+1);
+ else
+ {
+ SvXMLElementExport aNone(*this, XML_NAMESPACE_MATH, XML_NONE,
+ sal_True,sal_True);
+
+ }
+ }
+ else
+ {
+ if (NULL != (pSub = pNode->GetSubNode(RSUB+1)) &&
+ NULL != (pSup = pNode->GetSubNode(RSUP+1)))
+ {
+ pThing = new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
+ XML_MSUBSUP, sal_True,sal_True);
+ }
+ else if (NULL != (pSub = pNode->GetSubNode(RSUB+1)))
+ {
+ pThing = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MSUB,
+ sal_True,sal_True);
+ }
+ else if (NULL != (pSup = pNode->GetSubNode(RSUP+1)))
+ {
+ pThing = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MSUP,
+ sal_True,sal_True);
+ }
+
+ if (NULL != (pCSub = pNode->GetSubNode(CSUB+1))
+ && NULL != (pCSup=pNode->GetSubNode(CSUP+1)))
+ {
+ pThing2 = new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
+ XML_MUNDEROVER, sal_True,sal_True);
+ }
+ else if (NULL != (pCSub = pNode->GetSubNode(CSUB+1)))
+ {
+ pThing2 = new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
+ XML_MUNDER, sal_True,sal_True);
+ }
+ else if (NULL != (pCSup = pNode->GetSubNode(CSUP+1)))
+ {
+ pThing2 = new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
+ XML_MOVER, sal_True,sal_True);
+ }
+ ExportNodes(pNode->GetSubNode(0), nLevel+1); //Main Term
+
+ if (pCSub)
+ ExportNodes(pCSub, nLevel+1);
+ if (pCSup)
+ ExportNodes(pCSup, nLevel+1);
+ delete pThing2;
+
+ if (pSub)
+ ExportNodes(pSub, nLevel+1);
+ if (pSup)
+ ExportNodes(pSup, nLevel+1);
+ delete pThing;
+ }
+}
+
+void SmXMLExport::ExportBrace(const SmNode *pNode, int nLevel)
+{
+ const SmNode *pTemp;
+ const SmNode *pLeft=pNode->GetSubNode(0);
+ const SmNode *pRight=pNode->GetSubNode(2);
+ SvXMLElementExport *pFences=0,*pRow=0;
+ if ( ((pLeft) && (pLeft->GetToken().eType != TNONE)) &&
+ ((pRight) && (pRight->GetToken().eType != TNONE)) &&
+ (pNode->GetScaleMode() == SCALE_HEIGHT))
+ {
+ sal_Unicode nArse[2];
+ nArse[1] = 0;
+ nArse[0] = static_cast<
+ const SmMathSymbolNode* >(pLeft)->GetText().GetChar(0);
+ DBG_ASSERT(nArse[0] != 0xffff,"Non existant symbol");
+ AddAttribute(XML_NAMESPACE_MATH, XML_OPEN,nArse);
+ nArse[0] = static_cast<
+ const SmMathSymbolNode* >(pRight)->GetText().GetChar(0);
+ DBG_ASSERT(nArse[0] != 0xffff,"Non existant symbol");
+ AddAttribute(XML_NAMESPACE_MATH, XML_CLOSE,nArse);
+ pFences = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MFENCED,
+ sal_True,sal_True);
+ }
+ else if (pLeft && (pLeft->GetToken().eType != TNONE))
+ {
+ pRow = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MROW,
+ sal_True, sal_True);
+ if (pNode->GetScaleMode() == SCALE_HEIGHT)
+ AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_TRUE);
+ else
+ AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_FALSE);
+ ExportNodes(pLeft, nLevel+1);
+ }
+ else
+ pRow = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MROW,
+ sal_True, sal_True);
+
+ if (NULL != (pTemp = pNode->GetSubNode(1)))
+ ExportNodes(pTemp, nLevel+1);
+ if (pFences)
+ delete pFences;
+ else if (pRight && (pRight->GetToken().eType != TNONE))
+ {
+ if (pNode->GetScaleMode() == SCALE_HEIGHT)
+ AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_TRUE);
+ else
+ AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_FALSE);
+ ExportNodes(pRight, nLevel+1);
+ }
+ delete pRow;
+}
+
+void SmXMLExport::ExportRoot(const SmNode *pNode, int nLevel)
+{
+ if (pNode->GetSubNode(0))
+ {
+ SvXMLElementExport aRoot(*this, XML_NAMESPACE_MATH, XML_MROOT,sal_True,
+ sal_True);
+ ExportNodes(pNode->GetSubNode(2), nLevel+1);
+ ExportNodes(pNode->GetSubNode(0), nLevel+1);
+ }
+ else
+ {
+ SvXMLElementExport aSqrt(*this, XML_NAMESPACE_MATH, XML_MSQRT,sal_True,
+ sal_True);
+ ExportNodes(pNode->GetSubNode(2), nLevel+1);
+ }
+}
+
+void SmXMLExport::ExportOperator(const SmNode *pNode, int nLevel)
+{
+ /*we need to either use content or font and size attributes
+ *here*/
+#if 0
+ {
+ SvXMLElementExport aMath(*this, XML_NAMESPACE_MATH, XML_MO,
+ sal_True,sal_False);
+ SmTextNode *pTemp = (SmTextNode *)pNode->GetSubNode(0);
+ GetDocHandler()->characters(pTemp->GetText());
+ }
+#endif
+ SvXMLElementExport aRow(*this, XML_NAMESPACE_MATH, XML_MROW,
+ sal_True, sal_True);
+ ExportNodes(pNode->GetSubNode(0), nLevel+1);
+ ExportNodes(pNode->GetSubNode(1), nLevel+1);
+}
+
+void SmXMLExport::ExportAttributes(const SmNode *pNode, int nLevel)
+{
+ SvXMLElementExport *pElement=0;
+
+ if (pNode->GetToken().eType == TUNDERLINE)
+ {
+ AddAttribute(XML_NAMESPACE_MATH, XML_ACCENTUNDER,
+ XML_TRUE);
+ pElement = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MUNDER,
+ sal_True,sal_True);
+ }
+ else if (pNode->GetToken().eType != TOVERSTRIKE)
+ {
+ AddAttribute(XML_NAMESPACE_MATH, XML_ACCENT,
+ XML_TRUE);
+ pElement = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MOVER,
+ sal_True,sal_True);
+ }
+
+ ExportNodes(pNode->GetSubNode(1), nLevel+1);
+ switch (pNode->GetToken().eType)
+ {
+ case TOVERLINE:
+ {
+ //proper entity support required
+ SvXMLElementExport aMath(*this, XML_NAMESPACE_MATH, XML_MO,
+ sal_True,sal_True);
+#if 0
+ GetDocHandler()->characters(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("&overbar;")));
+#else
+ sal_Unicode nArse[2] = {0xAF,0x00};
+#endif
+ GetDocHandler()->characters(nArse);
+ }
+ break;
+ case TUNDERLINE:
+ {
+ //proper entity support required
+ SvXMLElementExport aMath(*this, XML_NAMESPACE_MATH, XML_MO,
+ sal_True,sal_True);
+#if 0
+ GetDocHandler()->characters(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("&underbar;")));
+#else
+ sal_Unicode nArse[2] = {0x0332,0x00};
+#endif
+ GetDocHandler()->characters(nArse);
+ }
+ break;
+ case TOVERSTRIKE:
+ break;
+ default:
+ ExportNodes(pNode->GetSubNode(0), nLevel+1);
+ break;
+ }
+ delete pElement;
+}
+
+static bool lcl_HasEffectOnMathvariant( const SmTokenType eType )
+{
+ return eType == TBOLD || eType == TNBOLD ||
+ eType == TITALIC || eType == TNBOLD ||
+ eType == TSANS || eType == TSERIF || eType == TFIXED;
+}
+
+void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel)
+{
+ SvXMLElementExport *pElement = 0;
+
+ //
+ // gather the mathvariant attribut relevant data from all
+ // successively following SmFontNodes...
+ //
+ int nBold = -1; // for the following variables: -1 = yet undefined; 0 = false; 1 = true;
+ int nItalic = -1; // for the following variables: -1 = yet undefined; 0 = false; 1 = true;
+ int nSansSerifFixed = -1;
+ SmTokenType eNodeType = TUNKNOWN;
+ while (lcl_HasEffectOnMathvariant( (eNodeType = pNode->GetToken().eType) ))
+ {
+ switch (eNodeType)
+ {
+ case TBOLD : nBold = 1; break;
+ case TNBOLD : nBold = 0; break;
+ case TITALIC : nItalic = 1; break;
+ case TNITALIC : nItalic = 0; break;
+ case TSANS : nSansSerifFixed = 0; break;
+ case TSERIF : nSansSerifFixed = 1; break;
+ case TFIXED : nSansSerifFixed = 2; break;
+ default:
+ DBG_ASSERT( 0, "unexpected case" );
+ }
+ // According to the parser every node that is to be evaluated heres
+ // has a single non-zero subnode at index 1!! Thus we only need to check
+ // that single node for follow-up nodes that have an effect on the attribute.
+ if (pNode->GetNumSubNodes() > 1 && pNode->GetSubNode(1) &&
+ lcl_HasEffectOnMathvariant( pNode->GetSubNode(1)->GetToken().eType))
+ {
+ pNode = pNode->GetSubNode(1);
+ }
+ else
+ break;
+ }
+
+ switch (pNode->GetToken().eType)
+ {
+ //wrap a phantom element around everything*/
+ case TPHANTOM:
+ pElement = new SvXMLElementExport(*this, XML_NAMESPACE_MATH,
+ XML_MPHANTOM, sal_True,sal_True);
+ break;
+ case TBLACK:
+ AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_BLACK);
+ break;
+ case TWHITE:
+ AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_WHITE);
+ break;
+ case TRED:
+ AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_RED);
+ break;
+ case TGREEN:
+ AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_GREEN);
+ break;
+ case TBLUE:
+ AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_BLUE);
+ break;
+ case TCYAN:
+ AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_AQUA);
+ break;
+ case TMAGENTA:
+ AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_FUCHSIA);
+ break;
+ case TYELLOW:
+ AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_YELLOW);
+ break;
+ case TSIZE:
+ {
+ const SmFontNode *pFontNode = static_cast<const SmFontNode *>(pNode);
+ const Fraction &aFrac = pFontNode->GetSizeParameter();
+
+ OUStringBuffer sStrBuf;
+ switch(pFontNode->GetSizeType())
+ {
+ case FNTSIZ_MULTIPLY:
+ SvXMLUnitConverter::convertDouble(sStrBuf,
+ static_cast<double>(aFrac*Fraction(100.00)));
+ sStrBuf.append(static_cast<sal_Unicode>('%'));
+ break;
+ case FNTSIZ_DIVIDE:
+ SvXMLUnitConverter::convertDouble(sStrBuf,
+ static_cast<double>(Fraction(100.00)/aFrac));
+ sStrBuf.append(static_cast<sal_Unicode>('%'));
+ break;
+ case FNTSIZ_ABSOLUT:
+ SvXMLUnitConverter::convertDouble(sStrBuf,
+ static_cast<double>(aFrac));
+ sStrBuf.append(
+ GetXMLToken(XML_UNIT_PT));
+ break;
+ default:
+ {
+ //The problem here is that the wheels fall off because
+ //font size is stored in 100th's of a mm not pts, and
+ //rounding errors take their toll on the original
+ //value specified in points.
+
+ //Must fix StarMath to retain the original pt values
+ Fraction aTemp = Sm100th_mmToPts(pFontNode->GetFont().
+ GetSize().Height());
+
+ if (pFontNode->GetSizeType() == FNTSIZ_MINUS)
+ aTemp-=aFrac;
+ else
+ aTemp+=aFrac;
+
+ double mytest = static_cast<double>(aTemp);
+
+ mytest = ::rtl::math::round(mytest,1);
+ SvXMLUnitConverter::convertDouble(sStrBuf,mytest);
+ sStrBuf.append(GetXMLToken(XML_UNIT_PT));
+ }
+ break;
+ }
+
+ OUString sStr(sStrBuf.makeStringAndClear());
+ AddAttribute(XML_NAMESPACE_MATH, XML_MATHSIZE, sStr);
+ }
+ break;
+ case TBOLD:
+ case TITALIC:
+ case TNBOLD:
+ case TNITALIC:
+ case TFIXED:
+ case TSANS:
+ case TSERIF:
+ {
+ // nBold: -1 = yet undefined; 0 = false; 1 = true;
+ // nItalic: -1 = yet undefined; 0 = false; 1 = true;
+ // nSansSerifFixed: -1 = undefined; 0 = sans; 1 = serif; 2 = fixed;
+ const sal_Char *pText = "normal";
+ if (nSansSerifFixed == -1 || nSansSerifFixed == 1)
+ {
+ pText = "normal";
+ if (nBold == 1 && nItalic != 1)
+ pText = "bold";
+ else if (nBold != 1 && nItalic == 1)
+ pText = "italic";
+ else if (nBold == 1 && nItalic == 1)
+ pText = "bold-italic";
+ }
+ else if (nSansSerifFixed == 0)
+ {
+ pText = "sans-serif";
+ if (nBold == 1 && nItalic != 1)
+ pText = "bold-sans-serif";
+ else if (nBold != 1 && nItalic == 1)
+ pText = "sans-serif-italic";
+ else if (nBold == 1 && nItalic == 1)
+ pText = "sans-serif-bold-italic";
+ }
+ else if (nSansSerifFixed == 2)
+ pText = "monospace"; // no modifiers allowed for monospace ...
+ else
+ {
+ DBG_ASSERT( 0, "unexpected case" );
+ }
+ AddAttribute(XML_NAMESPACE_MATH, XML_MATHVARIANT, A2OU(pText));
+ }
+ break;
+ default:
+ break;
+
+ }
+#if 0
+ if (pNode->GetNumSubNodes() > 1) //or in the future is a node that
+ //cannot take the currently supported
+ //properties
+#endif
+ //for now we will just always export with a style and not worry about
+ //anyone else for the moment.
+ {
+ //wrap a style around it
+ SvXMLElementExport aStyle(*this, XML_NAMESPACE_MATH, XML_MSTYLE, sal_True,sal_True);
+ ExportExpression(pNode, nLevel);
+ }
+#if 0
+ else
+ ExportNodes(pNode->GetSubNode(0), nLevel+1);
+#endif
+
+ delete pElement;
+}
+
+
+void SmXMLExport::ExportVerticalBrace(const SmNode *pNode, int nLevel)
+{
+ //Place the overbrace value OVER a vertical brace and then place that
+ //expression OVER the overbrace value, If someone can find a
+ //dedicated term in MathML to handle this overbrace/underbrace concept
+ //let me know. C.
+ XMLTokenEnum which;
+
+ switch (pNode->GetToken().eType)
+ {
+ case TOVERBRACE:
+ default:
+ which = XML_MOVER;
+ break;
+ case TUNDERBRACE:
+ which = XML_MUNDER;
+ break;
+ }
+
+ DBG_ASSERT(pNode->GetNumSubNodes()==3,"Bad Vertical Brace");
+ SvXMLElementExport aOver1(*this, XML_NAMESPACE_MATH,which, sal_True, sal_True);
+ {//Scoping
+ // using accents will draw the over-/underbraces too close to the base
+ // see http://www.w3.org/TR/MathML2/chapter3.html#id.3.4.5.2
+ // also XML_ACCENT is illegal with XML_MUNDER. Thus no XML_ACCENT attribut here!
+// AddAttribute(XML_NAMESPACE_MATH, XML_ACCENT, XML_TRUE);
+ SvXMLElementExport aOver2(*this, XML_NAMESPACE_MATH,which, sal_True, sal_True);
+ ExportNodes(pNode->GetSubNode(0), nLevel);
+ ExportNodes(pNode->GetSubNode(1), nLevel);
+ }
+ ExportNodes(pNode->GetSubNode(2), nLevel);
+}
+
+void SmXMLExport::ExportMatrix(const SmNode *pNode, int nLevel)
+{
+ SvXMLElementExport aTable(*this, XML_NAMESPACE_MATH, XML_MTABLE, sal_True, sal_True);
+ const SmMatrixNode *pMatrix = static_cast<const SmMatrixNode *>(pNode);
+ USHORT i=0;
+ for (ULONG y = 0; y < pMatrix->GetNumRows(); y++)
+ {
+ SvXMLElementExport aRow(*this, XML_NAMESPACE_MATH, XML_MTR, sal_True, sal_True);
+ for (ULONG x = 0; x < pMatrix->GetNumCols(); x++)
+ if (const SmNode *pTemp = pNode->GetSubNode(i++))
+ {
+ SvXMLElementExport aCell(*this, XML_NAMESPACE_MATH, XML_MTD, sal_True, sal_True);
+ ExportNodes(pTemp, nLevel+1);
+ }
+ }
+}
+
+void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel)
+{
+ if (!pNode)
+ return;
+ switch(pNode->GetType())
+ {
+ case NTABLE:
+ ExportTable(pNode, nLevel);
+ break;
+ case NALIGN:
+ case NBRACEBODY:
+ case NEXPRESSION:
+ ExportExpression(pNode, nLevel);
+ break;
+ case NLINE:
+ ExportLine(pNode, nLevel);
+ break;
+ case NTEXT:
+ ExportText(pNode, nLevel);
+ break;
+ case NSPECIAL: //NSPECIAL requires some sort of Entity preservation in the XML engine.
+ case NGLYPH_SPECIAL:
+ case NMATH:
+ {
+ sal_Unicode cTmp = 0;
+ const SmTextNode *pTemp = static_cast< const SmTextNode * >(pNode);
+ if (pTemp->GetText().Len() > 0)
+ cTmp = ConvertMathToMathML( pTemp->GetText().GetChar(0) );
+ if (cTmp == 0)
+ {
+ // no conversion to MathML implemented -> export it as text
+ // thus at least it will not vanish into nothing
+ ExportText(pNode, nLevel);
+ }
+ else
+ {
+ //To fully handle generic MathML we need to implement the full
+ //operator dictionary, we will generate MathML with explicit
+ //stretchiness for now.
+ sal_Int16 nLength = GetAttrList().getLength();
+ sal_Bool bAddStretch=sal_True;
+ for ( sal_Int16 i = 0; i < nLength; i++ )
+ {
+ OUString sLocalName;
+ sal_uInt16 nPrefix = GetNamespaceMap().GetKeyByAttrName(
+ GetAttrList().getNameByIndex(i), &sLocalName );
+
+ if ( ( XML_NAMESPACE_MATH == nPrefix ) &&
+ IsXMLToken(sLocalName, XML_STRETCHY) )
+ {
+ bAddStretch = sal_False;
+ break;
+ }
+ }
+ if (bAddStretch)
+ {
+ AddAttribute(XML_NAMESPACE_MATH, XML_STRETCHY, XML_FALSE);
+ }
+ ExportMath(pNode, nLevel);
+ }
+ }
+ break;
+ case NPLACE:
+ ExportMath(pNode, nLevel);
+ break;
+ case NBINHOR:
+ ExportBinaryHorizontal(pNode, nLevel);
+ break;
+ case NUNHOR:
+ ExportUnaryHorizontal(pNode, nLevel);
+ break;
+ case NBRACE:
+ ExportBrace(pNode, nLevel);
+ break;
+ case NBINVER:
+ ExportBinaryVertical(pNode, nLevel);
+ break;
+ case NSUBSUP:
+ ExportSubSupScript(pNode, nLevel);
+ break;
+ case NROOT:
+ ExportRoot(pNode, nLevel);
+ break;
+ case NOPER:
+ ExportOperator(pNode, nLevel);
+ break;
+ case NATTRIBUT:
+ ExportAttributes(pNode, nLevel);
+ break;
+ case NFONT:
+ ExportFont(pNode, nLevel);
+ break;
+ case NVERTICAL_BRACE:
+ ExportVerticalBrace(pNode, nLevel);
+ break;
+ case NMATRIX:
+ ExportMatrix(pNode, nLevel);
+ break;
+ case NBLANK:
+ ExportBlank(pNode, nLevel);
+ break;
+ default:
+ DBG_ASSERT( 0, "Warning: failed to export a node?" );
+ break;
+
+#if 0
+ default:
+ {
+ ULONG nSize = pNode->GetNumSubNodes();
+ for (ULONG i = 0; i < nSize; i++)
+ if (SmNode *pTemp = pNode->GetSubNode(i))
+ ExportNodes(pTemp, nLevel+1);
+ }
+ break;
+#endif
+ }
+}
+
+////////////////////////////////////////////////////////////
+
diff --git a/starmath/source/mathmlexport.hxx b/starmath/source/mathmlexport.hxx new file mode 100644 index 000000000000..fa76076e6616 --- /dev/null +++ b/starmath/source/mathmlexport.hxx @@ -0,0 +1,146 @@ +/*************************************************************************
+ *
+ * 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: x $
+ * $Revision: 1.00 $
+ *
+ * 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 _MATHMLEXPORT_HXX_
+#define _MATHMLEXPORT_HXX_
+
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/DocumentSettingsContext.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <node.hxx>
+
+class SfxMedium;
+namespace com { namespace sun { namespace star {
+ namespace io {
+ class XInputStream;
+ class XOutputStream; }
+ namespace beans {
+ class XPropertySet; }
+} } }
+
+
+////////////////////////////////////////////////////////////
+
+class SmXMLExportWrapper
+{
+ com::sun::star::uno::Reference<com::sun::star::frame::XModel> xModel;
+ sal_Bool bFlat; //set true for export to flat .mml, set false for
+ //export to a .sxm (or whatever) package
+public:
+ SmXMLExportWrapper(com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rRef)
+ : xModel(rRef), bFlat(sal_True) {}
+
+ sal_Bool Export(SfxMedium &rMedium);
+ void SetFlat(sal_Bool bIn) {bFlat = bIn;}
+
+ sal_Bool WriteThroughComponent(
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ xOutputStream,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ xComponent,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const sal_Char* pComponentName );
+
+ sal_Bool WriteThroughComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ xComponent,
+ const sal_Char* pStreamName,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const sal_Char* pComponentName,
+ sal_Bool bCompress=sal_True );
+};
+
+////////////////////////////////////////////////////////////
+
+class SmXMLExport : public SvXMLExport
+{
+ const SmNode * pTree;
+ String aText;
+ sal_Bool bSuccess;
+
+protected:
+ void ExportNodes(const SmNode *pNode, int nLevel);
+ void ExportTable(const SmNode *pNode, int nLevel);
+ void ExportLine(const SmNode *pNode, int nLevel);
+ void ExportExpression(const SmNode *pNode, int nLevel);
+ void ExportText(const SmNode *pNode, int nLevel);
+ void ExportMath(const SmNode *pNode, int nLevel);
+ void ExportPolygon(const SmNode *pNode, int nLevel);
+ void ExportBinaryHorizontal(const SmNode *pNode, int nLevel);
+ void ExportUnaryHorizontal(const SmNode *pNode, int nLevel);
+ void ExportBrace(const SmNode *pNode, int nLevel);
+ void ExportBinaryVertical(const SmNode *pNode, int nLevel);
+ void ExportSubSupScript(const SmNode *pNode, int nLevel);
+ void ExportRoot(const SmNode *pNode, int nLevel);
+ void ExportOperator(const SmNode *pNode, int nLevel);
+ void ExportAttributes(const SmNode *pNode, int nLevel);
+ void ExportFont(const SmNode *pNode, int nLevel);
+ void ExportVerticalBrace(const SmNode *pNode, int nLevel);
+ void ExportMatrix(const SmNode *pNode, int nLevel);
+ void ExportBlank(const SmNode *pNode, int nLevel);
+
+public:
+ // #110680#
+ SmXMLExport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ sal_uInt16 nExportFlags=EXPORT_ALL);
+ virtual ~SmXMLExport() {};
+
+ // XServiceInfo (override parent method)
+ ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+
+ // XUnoTunnel
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException);
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+
+ void _ExportAutoStyles() {}
+ void _ExportMasterStyles() {}
+ void _ExportContent();
+ sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum eClass);
+
+ virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
+ virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
+
+ sal_Bool GetSuccess() {return bSuccess;}
+};
+
+////////////////////////////////////////////////////////////
+
+#endif
+
diff --git a/starmath/source/mathml.cxx b/starmath/source/mathmlimport.cxx index dc3e153d3613..bf719d661dad 100644 --- a/starmath/source/mathml.cxx +++ b/starmath/source/mathmlimport.cxx @@ -1,4464 +1,3167 @@ -/************************************************************************* - * - * 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: mathml.cxx,v $ - * $Revision: 1.88 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_starmath.hxx" - -/* - Warning: The SvXMLElementExport helper class creates the beginning and - closing tags of xml elements in its constructor and destructor, so theres - hidden stuff going on, on occasion the ordering of these classes declarations - may be significant -*/ - -/*todo: Change characters and tcharacters to accumulate the characters together -into one string, xml parser hands them to us line by line rather than all in -one go*/ -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/embed/ElementModes.hpp> - -#ifndef _TOOLS_DEBUG_H -#include <tools/debug.hxx> -#endif -#include <tools/urlobj.hxx> -#include <rtl/math.hxx> -#include <svtools/sfxecode.hxx> -#include <svtools/saveopt.hxx> -#include <sfx2/docfile.hxx> -#include <svtools/stritem.hxx> -#include <unomodel.hxx> -#include <mathml.hxx> -#include <document.hxx> -#include <utility.hxx> -#include <osl/mutex.hxx> -#include <com/sun/star/uno/Any.h> -#include <xmloff/xmlnmspe.hxx> -#include <xmloff/xmltoken.hxx> -#include <xmloff/nmspmap.hxx> -#include <xmloff/attrlist.hxx> -#include <xmloff/xmluconv.hxx> -#include <xmloff/xmlmetai.hxx> -#include <unotools/processfactory.hxx> -#include <unotools/streamwrap.hxx> - -#include <com/sun/star/xml/sax/XErrorHandler.hpp> -#include <com/sun/star/xml/sax/XEntityResolver.hpp> -#include <com/sun/star/xml/sax/InputSource.hpp> -#include <com/sun/star/xml/sax/XDTDHandler.hpp> -#include <com/sun/star/xml/sax/XParser.hpp> -#include <com/sun/star/io/XActiveDataSource.hpp> -#include <com/sun/star/io/XActiveDataControl.hpp> -#include <com/sun/star/document/XDocumentProperties.hpp> -#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> -#include <com/sun/star/packages/zip/ZipIOException.hpp> -#include <com/sun/star/task/XStatusIndicatorFactory.hpp> -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <comphelper/genericpropertyset.hxx> -#include <svtools/itemprop.hxx> - -#include <sfx2/frame.hxx> - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::document; -using namespace com::sun::star::container; -using namespace com::sun::star::beans; -using namespace com::sun::star; -using namespace ::xmloff::token; -using ::rtl::OUString; -using ::rtl::OUStringBuffer; -#include "mathtype.hxx" - -#ifndef STARMATH_HRC -#include <starmath.hrc> -#endif -#ifndef PARSE_HXX -#include <parser.hxx> -#endif - -#define IMPORT_SVC_NAME RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.XMLImportFilter") -#define EXPORT_SVC_NAME RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.XMLExportFilter") - -#undef WANTEXCEPT - -/// read a component (file + filter version) -ULONG SmXMLWrapper::ReadThroughComponent( - Reference<io::XInputStream> xInputStream, - Reference<XComponent> xModelComponent, - Reference<lang::XMultiServiceFactory> & rFactory, - Reference<beans::XPropertySet> & rPropSet, - const sal_Char* pFilterName, - sal_Bool bEncrypted ) -{ - ULONG nError = ERRCODE_SFX_DOLOADFAILED; - DBG_ASSERT(xInputStream.is(), "input stream missing"); - DBG_ASSERT(xModelComponent.is(), "document missing"); - DBG_ASSERT(rFactory.is(), "factory missing"); - DBG_ASSERT(NULL != pFilterName,"I need a service name for the component!"); - - // prepare ParserInputSrouce - xml::sax::InputSource aParserInput; - aParserInput.aInputStream = xInputStream; - - // get parser - Reference< xml::sax::XParser > xParser( - rFactory->createInstance( - OUString::createFromAscii("com.sun.star.xml.sax.Parser") ), - UNO_QUERY ); - DBG_ASSERT( xParser.is(), "Can't create parser" ); - if( !xParser.is() ) - return nError; - - Sequence<Any> aArgs( 1 ); - aArgs[0] <<= rPropSet; - - // get filter - Reference< xml::sax::XDocumentHandler > xFilter( - rFactory->createInstanceWithArguments( - OUString::createFromAscii(pFilterName), aArgs ), - UNO_QUERY ); - DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." ); - if( !xFilter.is() ) - return nError; - - // connect parser and filter - xParser->setDocumentHandler( xFilter ); - - // connect model and filter - Reference < XImporter > xImporter( xFilter, UNO_QUERY ); - xImporter->setTargetDocument( xModelComponent ); - - // finally, parser the stream - try - { - xParser->parseStream( aParserInput ); - - uno::Reference<lang::XUnoTunnel> xFilterTunnel; - xFilterTunnel = uno::Reference<lang::XUnoTunnel> - ( xFilter, uno::UNO_QUERY ); - SmXMLImport *pFilter = reinterpret_cast< SmXMLImport * >( - sal::static_int_cast< sal_uIntPtr >( - xFilterTunnel->getSomething( SmXMLImport::getUnoTunnelId() ))); - if( pFilter && pFilter->GetSuccess() ) - nError = 0; - } - catch( xml::sax::SAXParseException& ) - { - if( bEncrypted ) - nError = ERRCODE_SFX_WRONGPASSWORD; - } - catch( xml::sax::SAXException& ) - { - if( bEncrypted ) - nError = ERRCODE_SFX_WRONGPASSWORD; - } - catch( packages::zip::ZipIOException& ) - { - nError = ERRCODE_IO_BROKENPACKAGE; - } - catch( io::IOException& ) - { - } - - return nError; -} - -ULONG SmXMLWrapper::ReadThroughComponent( - const uno::Reference< embed::XStorage >& xStorage, - Reference<XComponent> xModelComponent, - const sal_Char* pStreamName, - const sal_Char* pCompatibilityStreamName, - Reference<lang::XMultiServiceFactory> & rFactory, - Reference<beans::XPropertySet> & rPropSet, - const sal_Char* pFilterName ) -{ - DBG_ASSERT(xStorage.is(), "Need storage!"); - DBG_ASSERT(NULL != pStreamName, "Please, please, give me a name!"); - - // open stream (and set parser input) - OUString sStreamName = OUString::createFromAscii(pStreamName); - uno::Reference < container::XNameAccess > xAccess( xStorage, uno::UNO_QUERY ); - if ( !xAccess->hasByName(sStreamName) || !xStorage->isStreamElement(sStreamName) ) - { - // stream name not found! Then try the compatibility name. - // do we even have an alternative name? - if ( pCompatibilityStreamName ) - sStreamName = OUString::createFromAscii(pCompatibilityStreamName); - } - - // get input stream - try - { - uno::Reference < io::XStream > xEventsStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ ); - - // determine if stream is encrypted or not - uno::Reference < beans::XPropertySet > xProps( xEventsStream, uno::UNO_QUERY ); - Any aAny = xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Encrypted") ) ); - sal_Bool bEncrypted = sal_False; - if ( aAny.getValueType() == ::getBooleanCppuType() ) - aAny >>= bEncrypted; - - // set Base URL - if( rPropSet.is() ) - { - OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("StreamName") ); - rPropSet->setPropertyValue( sPropName, makeAny( sStreamName ) ); - } - - - Reference < io::XInputStream > xStream = xEventsStream->getInputStream(); - return ReadThroughComponent( xStream, xModelComponent, rFactory, rPropSet, pFilterName, bEncrypted ); - } - catch ( packages::WrongPasswordException& ) - { - return ERRCODE_SFX_WRONGPASSWORD; - } - catch( packages::zip::ZipIOException& ) - { - return ERRCODE_IO_BROKENPACKAGE; - } - catch ( uno::Exception& ) - { - } - - return ERRCODE_SFX_DOLOADFAILED; -} - -ULONG SmXMLWrapper::Import(SfxMedium &rMedium) -{ - ULONG nError = ERRCODE_SFX_DOLOADFAILED; - - uno::Reference<lang::XMultiServiceFactory> xServiceFactory( - utl::getProcessServiceFactory()); - DBG_ASSERT(xServiceFactory.is(), "XMLReader::Read: got no service manager"); - if( !xServiceFactory.is() ) - return nError; - - //Make a model component from our SmModel - uno::Reference< lang::XComponent > xModelComp( xModel, uno::UNO_QUERY ); - DBG_ASSERT( xModelComp.is(), "XMLReader::Read: got no model" ); - - // try to get an XStatusIndicator from the Medium - uno::Reference<task::XStatusIndicator> xStatusIndicator; - - sal_Bool bEmbedded = sal_False; - uno::Reference <lang::XUnoTunnel> xTunnel; - xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY); - SmModel *pModel = reinterpret_cast<SmModel *> - (xTunnel->getSomething(SmModel::getUnoTunnelId())); - - SmDocShell *pDocShell = pModel ? - static_cast<SmDocShell*>(pModel->GetObjectShell()) : 0; - if (pDocShell) - { -// if (pDocShell->GetMedium()) - { - DBG_ASSERT( pDocShell->GetMedium() == &rMedium, - "different SfxMedium found" ); - - SfxItemSet* pSet = rMedium.GetItemSet(); - if (pSet) - { - const SfxUnoAnyItem* pItem = static_cast<const SfxUnoAnyItem*>( - pSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) ); - if (pItem) - pItem->GetValue() >>= xStatusIndicator; - } - } - - if( SFX_CREATE_MODE_EMBEDDED == pDocShell->GetCreateMode() ) - bEmbedded = sal_True; - } - - comphelper::PropertyMapEntry aInfoMap[] = - { - { "PrivateData", sizeof("PrivateData")-1, 0, - &::getCppuType( (Reference<XInterface> *)0 ), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { "BaseURI", sizeof("BaseURI")-1, 0, - &::getCppuType( (OUString *)0 ), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { "StreamRelPath", sizeof("StreamRelPath")-1, 0, - &::getCppuType( (OUString *)0 ), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { "StreamName", sizeof("StreamName")-1, 0, - &::getCppuType( (OUString *)0 ), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { NULL, 0, 0, NULL, 0, 0 } - }; - uno::Reference< beans::XPropertySet > xInfoSet( - comphelper::GenericPropertySet_CreateInstance( - new comphelper::PropertySetInfo( aInfoMap ) ) ); - - // Set base URI - OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("BaseURI") ); - xInfoSet->setPropertyValue( sPropName, makeAny( rMedium.GetBaseURL() ) ); - - sal_Int32 nSteps=3; - if( !(rMedium.IsStorage())) - nSteps = 1; - - sal_Int32 nProgressRange(nSteps); - if (xStatusIndicator.is()) - { - xStatusIndicator->start(String(SmResId(STR_STATSTR_READING)), - nProgressRange); - } - - nSteps=0; - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - if( rMedium.IsStorage()) - { - // TODO/LATER: handle the case of embedded links gracefully - if( bEmbedded ) // && !rMedium.GetStorage()->IsRoot() ) - { - OUString aName( RTL_CONSTASCII_USTRINGPARAM( "dummyObjName" ) ); - if ( rMedium.GetItemSet() ) - { - const SfxStringItem* pDocHierarchItem = static_cast<const SfxStringItem*>( - rMedium.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) ); - if ( pDocHierarchItem ) - aName = pDocHierarchItem->GetValue(); - } - - if( aName.getLength() ) - { - sPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")); - xInfoSet->setPropertyValue( sPropName, makeAny( aName ) ); - } - } - - sal_Bool bOASIS = ( SotStorage::GetVersion( rMedium.GetStorage() ) > SOFFICE_FILEFORMAT_60 ); - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - ULONG nWarn = ReadThroughComponent( - rMedium.GetStorage(), xModelComp, "meta.xml", "Meta.xml", - xServiceFactory, xInfoSet, - (bOASIS ? "com.sun.star.comp.Math.XMLOasisMetaImporter" - : "com.sun.star.comp.Math.XMLMetaImporter") ); - - if ( nWarn != ERRCODE_IO_BROKENPACKAGE ) - { - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - nWarn = ReadThroughComponent( - rMedium.GetStorage(), xModelComp, "settings.xml", 0, - xServiceFactory, xInfoSet, - (bOASIS ? "com.sun.star.comp.Math.XMLOasisSettingsImporter" - : "com.sun.star.comp.Math.XMLSettingsImporter" ) ); - - if ( nWarn != ERRCODE_IO_BROKENPACKAGE ) - { - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - nError = ReadThroughComponent( - rMedium.GetStorage(), xModelComp, "content.xml", "Content.xml", - xServiceFactory, xInfoSet, "com.sun.star.comp.Math.XMLImporter" ); - } - else - nError = ERRCODE_IO_BROKENPACKAGE; - } - else - nError = ERRCODE_IO_BROKENPACKAGE; - } - else - { - Reference<io::XInputStream> xInputStream = - new utl::OInputStreamWrapper(rMedium.GetInStream()); - - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - nError = ReadThroughComponent( xInputStream, xModelComp, - xServiceFactory, xInfoSet, "com.sun.star.comp.Math.XMLImporter", FALSE ); - } - - if (xStatusIndicator.is()) - xStatusIndicator->end(); - return nError; -} - -SmXMLImport::SmXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, - sal_uInt16 nImportFlags) -: SvXMLImport( xServiceFactory, nImportFlags ), - pPresLayoutElemTokenMap(0), - pPresLayoutAttrTokenMap(0), - pFencedAttrTokenMap(0), - pOperatorAttrTokenMap(0), - pAnnotationAttrTokenMap(0), - pPresElemTokenMap(0), - pPresScriptEmptyElemTokenMap(0), - pPresTableElemTokenMap(0), - pColorTokenMap(0), - bSuccess(sal_False) -{ -} - -#ifdef TL_NOT_USED_YET -SmXMLImport::SmXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, - com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, - const rtl::OUString & /*rFileName*/ ) -: SvXMLImport( xServiceFactory, rModel ) , - pPresLayoutElemTokenMap(0), - pPresLayoutAttrTokenMap(0), - pFencedAttrTokenMap(0), - pOperatorAttrTokenMap(0), - pAnnotationAttrTokenMap(0), - pPresElemTokenMap(0), - pPresScriptEmptyElemTokenMap(0), - pPresTableElemTokenMap(0), - pColorTokenMap(0), - bSuccess(sal_False) -{ -} -#endif //TL_NOT_USED_YET - -const uno::Sequence< sal_Int8 > & SmXMLImport::getUnoTunnelId() throw() -{ - static uno::Sequence< sal_Int8 > * pSeq = 0; - if( !pSeq ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static uno::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; -} - -// #110680# -SmXMLExport::SmXMLExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, - sal_uInt16 nExportFlags) -: SvXMLExport( xServiceFactory, MAP_INCH, XML_MATH, nExportFlags ) , - pTree(0) , - bSuccess(sal_False) -{ -} - -#ifdef TL_NOT_USED_YET -// #110680# -SmXMLExport::SmXMLExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, - const SmNode *pIn, - const rtl::OUString &rFileName, - com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler) -: SvXMLExport( xServiceFactory, rFileName, rHandler ), - pTree(pIn), - bSuccess(sal_False) -{ -} -#endif //TL_NOT_USED_YET - -const uno::Sequence< sal_Int8 > & SmXMLExport::getUnoTunnelId() throw() -{ - static uno::Sequence< sal_Int8 > * pSeq = 0; - if( !pSeq ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static uno::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; -} - -//------------------------------------------------------------------------------ - -OUString SAL_CALL SmXMLImport_getImplementationName() throw() -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLImporter" ) ); -} - -uno::Sequence< OUString > SAL_CALL SmXMLImport_getSupportedServiceNames() - throw() -{ - const OUString aServiceName( IMPORT_SVC_NAME ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SmXMLImport_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr) - throw( uno::Exception ) -{ - // #110680# - // return (cppu::OWeakObject*)new SmXMLImport(IMPORT_ALL); - return (cppu::OWeakObject*)new SmXMLImport(rSMgr, IMPORT_ALL); -} - -//------------------------------------------------------------------------------ - -OUString SAL_CALL SmXMLExport_getImplementationName() throw() -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLExporter" ) ); -} - -uno::Sequence< OUString > SAL_CALL SmXMLExport_getSupportedServiceNames() - throw() -{ - const OUString aServiceName( EXPORT_SVC_NAME ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SmXMLExport_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr) - throw( uno::Exception ) -{ - // #110680# - // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_ALL ); - // EXPORT_OASIS is required here allthough there is no differrence between - // OOo and OASIS, because without the flag, a transformation to OOo would - // be chained in. - return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_OASIS|EXPORT_ALL ); -} - -//------------------------------------------------------------------------------ - -OUString SAL_CALL SmXMLImportMeta_getImplementationName() throw() -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLOasisMetaImporter" ) ); -} - -uno::Sequence< OUString > SAL_CALL SmXMLImportMeta_getSupportedServiceNames() - throw() -{ - const OUString aServiceName( IMPORT_SVC_NAME ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SmXMLImportMeta_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr) - throw( uno::Exception ) -{ - // #110680# - // return (cppu::OWeakObject*)new SmXMLImport( IMPORT_META ); - return (cppu::OWeakObject*)new SmXMLImport( rSMgr, IMPORT_META ); -} - -//------------------------------------------------------------------------------ - -OUString SAL_CALL SmXMLExportMetaOOO_getImplementationName() throw() -{ -return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLMetaExporter" ) ); -} - -uno::Sequence< OUString > SAL_CALL SmXMLExportMetaOOO_getSupportedServiceNames() - throw() -{ -const OUString aServiceName( EXPORT_SVC_NAME ); -const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SmXMLExportMetaOOO_createInstance( -const uno::Reference< lang::XMultiServiceFactory > & rSMgr) -throw( uno::Exception ) -{ -// #110680# -// return (cppu::OWeakObject*)new SmXMLExport( EXPORT_META ); -return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_META ); -} - -//------------------------------------------------------------------------------ - -OUString SAL_CALL SmXMLExportMeta_getImplementationName() throw() -{ -return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLOasisMetaExporter" ) ); -} - -uno::Sequence< OUString > SAL_CALL SmXMLExportMeta_getSupportedServiceNames() - throw() -{ -const OUString aServiceName( EXPORT_SVC_NAME ); -const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SmXMLExportMeta_createInstance( -const uno::Reference< lang::XMultiServiceFactory > & rSMgr) -throw( uno::Exception ) -{ -// #110680# -// return (cppu::OWeakObject*)new SmXMLExport( EXPORT_META ); -return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_OASIS|EXPORT_META ); -} - -//------------------------------------------------------------------------------ - -OUString SAL_CALL SmXMLImportSettings_getImplementationName() throw() -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLOasisSettingsImporter" ) ); -} - -uno::Sequence< OUString > SAL_CALL SmXMLImportSettings_getSupportedServiceNames() - throw() -{ - const OUString aServiceName( IMPORT_SVC_NAME ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SmXMLImportSettings_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr) - throw( uno::Exception ) -{ - // #110680# - // return (cppu::OWeakObject*)new SmXMLImport( IMPORT_SETTINGS ); - return (cppu::OWeakObject*)new SmXMLImport( rSMgr, IMPORT_SETTINGS ); -} - -//------------------------------------------------------------------------------ - -OUString SAL_CALL SmXMLExportSettingsOOO_getImplementationName() throw() -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLSettingsExporter" ) ); -} - -uno::Sequence< OUString > SAL_CALL SmXMLExportSettingsOOO_getSupportedServiceNames() - throw() -{ - const OUString aServiceName( EXPORT_SVC_NAME ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SmXMLExportSettingsOOO_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr) - throw( uno::Exception ) -{ - // #110680# - // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_SETTINGS ); - return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_SETTINGS ); -} - -//------------------------------------------------------------------------------ - -OUString SAL_CALL SmXMLExportSettings_getImplementationName() throw() -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLOasisSettingsExporter" ) ); -} - -uno::Sequence< OUString > SAL_CALL SmXMLExportSettings_getSupportedServiceNames() - throw() -{ - const OUString aServiceName( EXPORT_SVC_NAME ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SmXMLExportSettings_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr) - throw( uno::Exception ) -{ - // #110680# - // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_SETTINGS ); - return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_OASIS|EXPORT_SETTINGS ); -} - - -//------------------------------------------------------------------------------ - -OUString SAL_CALL SmXMLExportContent_getImplementationName() throw() -{ - return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLContentExporter" ) ); -} - -uno::Sequence< OUString > SAL_CALL SmXMLExportContent_getSupportedServiceNames() - throw() -{ - const OUString aServiceName( EXPORT_SVC_NAME ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; -} - -uno::Reference< uno::XInterface > SAL_CALL SmXMLExportContent_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr) - throw( uno::Exception ) -{ - // #110680# - // return (cppu::OWeakObject*)new SmXMLExport( EXPORT_CONTENT ); - // The EXPORT_OASIS flag is only required to avoid that a transformer is - // chanied in - return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_OASIS|EXPORT_CONTENT ); -} - -//------------------------------------------------------------------------------ - -// XServiceInfo -// override empty method from parent class -rtl::OUString SAL_CALL SmXMLExport::getImplementationName() - throw(uno::RuntimeException) -{ - OUString aTxt; - switch( getExportFlags() ) - { - case EXPORT_META: - aTxt = SmXMLExportMeta_getImplementationName(); - break; - case EXPORT_SETTINGS: - aTxt = SmXMLExportSettings_getImplementationName(); - break; - case EXPORT_CONTENT: - aTxt = SmXMLExportContent_getImplementationName(); - break; - case EXPORT_ALL: - default: - aTxt = SmXMLExport_getImplementationName(); - break; - } - return aTxt; -} - -// XServiceInfo -// override empty method from parent class -rtl::OUString SAL_CALL SmXMLImport::getImplementationName() - throw(uno::RuntimeException) -{ - OUString aTxt; - switch( getImportFlags() ) - { - case IMPORT_META: - aTxt = SmXMLImportMeta_getImplementationName(); - break; - case IMPORT_SETTINGS: - aTxt = SmXMLImportSettings_getImplementationName(); - break; - case IMPORT_ALL: - default: - aTxt = SmXMLImport_getImplementationName(); - break; - } - return aTxt; -} - - -sal_Int64 SAL_CALL SmXMLImport::getSomething( const uno::Sequence< sal_Int8 >& - rId ) throw(uno::RuntimeException) -{ - if( rId.getLength() == 16 && - 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); - - return SvXMLImport::getSomething( rId ); -} - -sal_Int64 SAL_CALL SmXMLExport::getSomething( const uno::Sequence< sal_Int8 >& - rId ) throw(uno::RuntimeException) -{ - if( rId.getLength() == 16 && - 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); - - return SvXMLExport::getSomething( rId ); -} - - -void SmXMLImport::endDocument(void) - throw(xml::sax::SAXException, uno::RuntimeException) -{ - //Set the resulted tree into the SmDocShell where it belongs - SmNode *pTree; - if (NULL != (pTree = GetTree())) - { - uno::Reference <frame::XModel> xModel = GetModel(); - uno::Reference <lang::XUnoTunnel> xTunnel; - xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY); - SmModel *pModel = reinterpret_cast<SmModel *> - (xTunnel->getSomething(SmModel::getUnoTunnelId())); - - if (pModel) - { - SmDocShell *pDocShell = - static_cast<SmDocShell*>(pModel->GetObjectShell()); - pDocShell->SetFormulaTree(pTree); - if (0 == aText.Len()) //If we picked up no annotation text - { - //Make up some editable text - aText = pDocShell->GetText(); - pTree->CreateTextFromNode(aText); - aText.EraseTrailingChars(); - if((aText.GetChar(0) == '{') && - (aText.GetChar(aText.Len()-1) == '}')) - { - aText.Erase(0,1); - aText.Erase(aText.Len()-1,1); - } - } - pDocShell->SetText( String() ); - - // Convert symbol names - SmParser &rParser = pDocShell->GetParser(); - BOOL bVal = rParser.IsImportSymbolNames(); - rParser.SetImportSymbolNames( TRUE ); - SmNode *pTmpTree = rParser.Parse( aText ); - aText = rParser.GetText(); - delete pTmpTree; - rParser.SetImportSymbolNames( bVal ); - - pDocShell->SetText( aText ); - } - DBG_ASSERT(pModel,"So there *was* a uno problem after all"); - - bSuccess = sal_True; - } - - SvXMLImport::endDocument(); -} - -/// export through an XML exporter component (output stream version) -sal_Bool SmXMLWrapper::WriteThroughComponent( - Reference<io::XOutputStream> xOutputStream, - Reference<XComponent> xComponent, - Reference<lang::XMultiServiceFactory> & rFactory, - Reference<beans::XPropertySet> & rPropSet, - const sal_Char* pComponentName ) -{ - DBG_ASSERT(xOutputStream.is(), "I really need an output stream!"); - DBG_ASSERT(xComponent.is(), "Need component!"); - DBG_ASSERT(NULL != pComponentName, "Need component name!"); - - // get component - Reference< io::XActiveDataSource > xSaxWriter( - rFactory->createInstance( - OUString::createFromAscii("com.sun.star.xml.sax.Writer") ), - UNO_QUERY ); - DBG_ASSERT( xSaxWriter.is(), "can't instantiate XML writer" ); - if(!xSaxWriter.is()) - return sal_False; - - // connect XML writer to output stream - xSaxWriter->setOutputStream( xOutputStream ); - - // prepare arguments (prepend doc handler to given arguments) - Reference<xml::sax::XDocumentHandler> xDocHandler( xSaxWriter,UNO_QUERY); - - Sequence<Any> aArgs( 2 ); - aArgs[0] <<= xDocHandler; - aArgs[1] <<= rPropSet; - - // get filter component - Reference< document::XExporter > xExporter( - rFactory->createInstanceWithArguments( - OUString::createFromAscii(pComponentName), aArgs), UNO_QUERY); - DBG_ASSERT( xExporter.is(), - "can't instantiate export filter component" ); - if( !xExporter.is() ) - return sal_False; - - - // connect model and filter - xExporter->setSourceDocument( xComponent ); - - // filter! - Reference < XFilter > xFilter( xExporter, UNO_QUERY ); - uno::Sequence< PropertyValue > aProps(0); - xFilter->filter( aProps ); - - uno::Reference<lang::XUnoTunnel> xFilterTunnel; - xFilterTunnel = uno::Reference<lang::XUnoTunnel> - ( xFilter, uno::UNO_QUERY ); - SmXMLExport *pFilter = reinterpret_cast< SmXMLExport * >( - sal::static_int_cast< sal_uIntPtr >( - xFilterTunnel->getSomething( SmXMLExport::getUnoTunnelId() ))); - return pFilter ? pFilter->GetSuccess() : sal_True; -} - -/// export through an XML exporter component (storage version) -sal_Bool SmXMLWrapper::WriteThroughComponent( - const Reference < embed::XStorage >& xStorage, - Reference<XComponent> xComponent, - const sal_Char* pStreamName, - Reference<lang::XMultiServiceFactory> & rFactory, - Reference<beans::XPropertySet> & rPropSet, - const sal_Char* pComponentName, - sal_Bool bCompress - ) -{ - DBG_ASSERT(xStorage.is(), "Need storage!"); - DBG_ASSERT(NULL != pStreamName, "Need stream name!"); - - // open stream - Reference < io::XStream > xStream; - OUString sStreamName = OUString::createFromAscii(pStreamName); - try - { - xStream = xStorage->openStreamElement( sStreamName, - embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE ); - } - catch ( uno::Exception& ) - { - DBG_ERROR( "Can't create output stream in package!" ); - return sal_False; - } - - String aPropName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("MediaType") ) ); - OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") ); - uno::Any aAny; - aAny <<= aMime; - - uno::Reference < beans::XPropertySet > xSet( xStream, uno::UNO_QUERY ); - xSet->setPropertyValue( aPropName, aAny ); - - if( !bCompress ) - { - aPropName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("Compressed") ); - sal_Bool bFalse = sal_False; - aAny.setValue( &bFalse, ::getBooleanCppuType() ); - xSet->setPropertyValue( aPropName, aAny ); - } - - // even plain stream must be encrypted in encrypted document - OUString aTmpPropName( RTL_CONSTASCII_USTRINGPARAM("UseCommonStoragePasswordEncryption") ); - sal_Bool bTrue = sal_True; - aAny.setValue( &bTrue, ::getBooleanCppuType() ); - xSet->setPropertyValue( aTmpPropName, aAny ); - - // set Base URL - if( rPropSet.is() ) - { - OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("StreamName") ); - rPropSet->setPropertyValue( sPropName, makeAny( sStreamName ) ); - } - - // write the stuff - sal_Bool bRet = WriteThroughComponent( xStream->getOutputStream(), xComponent, rFactory, - rPropSet, pComponentName ); - - // stream is closed by SAX parser - //if( bRet ) - // xStream->getOutputStream()->closeOutput(); - - return bRet; -} - -sal_Bool SmXMLWrapper::Export(SfxMedium &rMedium) -{ - sal_Bool bRet=sal_True; - uno::Reference<lang::XMultiServiceFactory> - xServiceFactory(utl::getProcessServiceFactory()); - DBG_ASSERT(xServiceFactory.is(),"got no service manager"); - - //Get model - uno::Reference< lang::XComponent > xModelComp(xModel, uno::UNO_QUERY ); - - sal_Bool bEmbedded = sal_False; - uno::Reference <lang::XUnoTunnel> xTunnel; - xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY); - SmModel *pModel = reinterpret_cast<SmModel *> - (xTunnel->getSomething(SmModel::getUnoTunnelId())); - - SmDocShell *pDocShell = pModel ? - static_cast<SmDocShell*>(pModel->GetObjectShell()) : 0; - if( pDocShell && - SFX_CREATE_MODE_EMBEDDED == pDocShell->GetCreateMode() ) - bEmbedded = sal_True; - - uno::Reference<task::XStatusIndicator> xStatusIndicator; - if (!bEmbedded) - { - if (pDocShell /*&& pDocShell->GetMedium()*/) - { - DBG_ASSERT( pDocShell->GetMedium() == &rMedium, - "different SfxMedium found" ); - - SfxItemSet* pSet = rMedium.GetItemSet(); - if (pSet) - { - const SfxUnoAnyItem* pItem = static_cast<const SfxUnoAnyItem*>( - pSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) ); - if (pItem) - pItem->GetValue() >>= xStatusIndicator; - } - } - - // set progress range and start status indicator - if (xStatusIndicator.is()) - { - sal_Int32 nProgressRange = bFlat ? 1 : 3; - xStatusIndicator->start(String(SmResId(STR_STATSTR_WRITING)), - nProgressRange); - } - } - - - // create XPropertySet with three properties for status indicator - comphelper::PropertyMapEntry aInfoMap[] = - { - { "UsePrettyPrinting", sizeof("UsePrettyPrinting")-1, 0, - &::getBooleanCppuType(), - beans::PropertyAttribute::MAYBEVOID, 0}, - { "BaseURI", sizeof("BaseURI")-1, 0, - &::getCppuType( (OUString *)0 ), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { "StreamRelPath", sizeof("StreamRelPath")-1, 0, - &::getCppuType( (OUString *)0 ), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { "StreamName", sizeof("StreamName")-1, 0, - &::getCppuType( (OUString *)0 ), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { NULL, 0, 0, NULL, 0, 0 } - }; - uno::Reference< beans::XPropertySet > xInfoSet( - comphelper::GenericPropertySet_CreateInstance( - new comphelper::PropertySetInfo( aInfoMap ) ) ); - - SvtSaveOptions aSaveOpt; - OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting")); - sal_Bool bUsePrettyPrinting( bFlat || aSaveOpt.IsPrettyPrinting() ); - Any aAny; - aAny.setValue( &bUsePrettyPrinting, ::getBooleanCppuType() ); - xInfoSet->setPropertyValue( sUsePrettyPrinting, aAny ); - - // Set base URI - OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("BaseURI") ); - xInfoSet->setPropertyValue( sPropName, makeAny( rMedium.GetBaseURL( true ) ) ); - - sal_Int32 nSteps=0; - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - if (!bFlat) //Storage (Package) of Stream - { - uno::Reference < embed::XStorage > xStg = rMedium.GetOutputStorage(); - sal_Bool bOASIS = ( SotStorage::GetVersion( xStg ) > SOFFICE_FILEFORMAT_60 ); - - // TODO/LATER: handle the case of embedded links gracefully - if( bEmbedded ) //&& !pStg->IsRoot() ) - { - OUString aName; - if ( rMedium.GetItemSet() ) - { - const SfxStringItem* pDocHierarchItem = static_cast<const SfxStringItem*>( - rMedium.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) ); - if ( pDocHierarchItem ) - aName = pDocHierarchItem->GetValue(); - } - - if( aName.getLength() ) - { - sPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")); - xInfoSet->setPropertyValue( sPropName, makeAny( aName ) ); - } - } - - if( !bEmbedded ) - { - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - bRet = WriteThroughComponent( - xStg, xModelComp, "meta.xml", xServiceFactory, xInfoSet, - (bOASIS ? "com.sun.star.comp.Math.XMLOasisMetaExporter" - : "com.sun.star.comp.Math.XMLMetaExporter"), - sal_False); - } - if( bRet ) - { - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - bRet = WriteThroughComponent( - xStg, xModelComp, "content.xml", xServiceFactory, xInfoSet, - "com.sun.star.comp.Math.XMLContentExporter"); - } - - if( bRet ) - { - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - bRet = WriteThroughComponent( - xStg, xModelComp, "settings.xml", xServiceFactory, xInfoSet, - (bOASIS ? "com.sun.star.comp.Math.XMLOasisSettingsExporter" - : "com.sun.star.comp.Math.XMLSettingsExporter") ); - } - } - else - { - SvStream *pStream = rMedium.GetOutStream(); - uno::Reference<io::XOutputStream> xOut( - new utl::OOutputStreamWrapper(*pStream) ); - - if (xStatusIndicator.is()) - xStatusIndicator->setValue(nSteps++); - - bRet = WriteThroughComponent( - xOut, xModelComp, xServiceFactory, xInfoSet, - "com.sun.star.comp.Math.XMLContentExporter"); - } - - if (xStatusIndicator.is()) - xStatusIndicator->end(); - - return bRet; -} - -sal_uInt32 SmXMLExport::exportDoc(enum XMLTokenEnum eClass) -{ - if( (getExportFlags() & EXPORT_CONTENT) == 0 ) - { - SvXMLExport::exportDoc( eClass ); - } - else - { - uno::Reference <frame::XModel> xModel = GetModel(); - uno::Reference <lang::XUnoTunnel> xTunnel; - xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY); - SmModel *pModel = reinterpret_cast<SmModel *> - (xTunnel->getSomething(SmModel::getUnoTunnelId())); - - if (pModel) - { - SmDocShell *pDocShell = - static_cast<SmDocShell*>(pModel->GetObjectShell()); - pTree = pDocShell->GetFormulaTree(); - aText = pDocShell->GetText(); - } - - GetDocHandler()->startDocument(); - - if( (getExportFlags() & EXPORT_NODOCTYPE) == 0 && - GetExtDocHandler().is() ) - { - OUString aDocType( RTL_CONSTASCII_USTRINGPARAM( "<!DOCTYPE math:math PUBLIC \"-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN\" \"math.dtd\">" ) ); - GetExtDocHandler()->unknown( aDocType ); - } - - /*Add xmlns line*/ - SvXMLAttributeList &rList = GetAttrList(); - rList.AddAttribute(GetNamespaceMap().GetAttrNameByKey( - XML_NAMESPACE_MATH_IDX),GetNamespaceMap().GetNameByKey( - XML_NAMESPACE_MATH_IDX)); - - //I think we need something like ImplExportEntities(); - _ExportContent(); - GetDocHandler()->endDocument(); - } - - bSuccess=sal_True; - return 0; -} - -class SmXMLImportContext: public SvXMLImportContext -{ -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) - { - /* - Whitespace occurring within the content of token elements is "trimmed" - from the ends (i.e. all whitespace at the beginning and end of the - content is removed), and "collapsed" internally (i.e. each sequence of - 1 or more whitespace characters is replaced with one blank character). - */ - //collapsing not done yet! - const OUString &rChars2 = rChars.trim(); - if (rChars2.getLength()) - TCharacters(rChars2/*.collapse()*/); - } - virtual SvXMLImportContext *CreateChildContext(sal_uInt16 /*nPrefix*/, - const OUString& /*rLocalName*/, - const uno::Reference< xml::sax::XAttributeList > & /*xAttrList*/) {return 0;} -}; - -class SmXMLDocContext_Impl : public SmXMLImportContext -{ -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(); -}; - - -/*avert thy gaze from the proginator*/ -class SmXMLRowContext_Impl : public SmXMLDocContext_Impl -{ -public: - SmXMLRowContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - 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(); -protected: - ULONG nElementCount; -}; - -class SmXMLFracContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLFracContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - void EndElement(); -}; - -class SmXMLSqrtContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLSqrtContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - void EndElement(); -}; - -class SmXMLRootContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLRootContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - void EndElement(); -}; - -struct SmXMLContext_Helper -{ - SmXMLContext_Helper(SmXMLImportContext &rImport) : - nIsBold(-1), nIsItalic(-1),nFontSize(0.0), rContext(rImport) {} - - void RetrieveAttrs(const uno::Reference< xml::sax::XAttributeList > &xAttrList ); - void ApplyAttrs(); - - sal_Int8 nIsBold; - sal_Int8 nIsItalic; - double nFontSize; - sal_Bool bFontNodeNeeded; - OUString sFontFamily; - OUString sColor; - - SmXMLImportContext rContext; -}; - -void SmXMLContext_Helper::RetrieveAttrs(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ - sal_Int8 nOldIsBold=nIsBold; - sal_Int8 nOldIsItalic=nIsItalic; - double nOldFontSize=nFontSize; - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - OUString sOldFontFamily = sFontFamily; - for (sal_Int16 i=0;i<nAttrCount;i++) - { - OUString sAttrName = xAttrList->getNameByIndex(i); - OUString aLocalName; - sal_uInt16 nPrefix = rContext.GetSmImport().GetNamespaceMap(). - GetKeyByAttrName(sAttrName,&aLocalName); - OUString sValue = xAttrList->getValueByIndex(i); - const SvXMLTokenMap &rAttrTokenMap = - rContext.GetSmImport().GetPresLayoutAttrTokenMap(); - switch(rAttrTokenMap.Get(nPrefix,aLocalName)) - { - case XML_TOK_FONTWEIGHT: - nIsBold = sValue.equals(GetXMLToken(XML_BOLD)); - break; - case XML_TOK_FONTSTYLE: - nIsItalic = sValue.equals(GetXMLToken(XML_ITALIC)); - break; - case XML_TOK_FONTSIZE: - SvXMLUnitConverter::convertDouble(nFontSize,sValue); - rContext.GetSmImport().GetMM100UnitConverter(). - setXMLMeasureUnit(MAP_POINT); - if (-1 == sValue.indexOf(GetXMLToken(XML_UNIT_PT))) - { - if (-1 == sValue.indexOf('%')) - nFontSize=0.0; - else - { - rContext.GetSmImport().GetMM100UnitConverter(). - setXMLMeasureUnit(MAP_RELATIVE); - } - } - break; - case XML_TOK_FONTFAMILY: - sFontFamily = sValue; - break; - case XML_TOK_COLOR: - sColor = sValue; - break; - default: - break; - } - } - - if ((nOldIsBold!=nIsBold) || (nOldIsItalic!=nIsItalic) || - (nOldFontSize!=nFontSize) || (sOldFontFamily!=sFontFamily) - || sColor.getLength()) - bFontNodeNeeded=sal_True; - else - bFontNodeNeeded=sal_False; -} - -void SmXMLContext_Helper::ApplyAttrs() -{ - SmNodeStack &rNodeStack = rContext.GetSmImport().GetNodeStack(); - - if (bFontNodeNeeded) - { - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - - if (nIsBold != -1) - { - if (nIsBold) - aToken.eType = TBOLD; - else - aToken.eType = TNBOLD; - SmStructureNode *pFontNode = static_cast<SmStructureNode *> - (new SmFontNode(aToken)); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (nIsItalic != -1) - { - if (nIsItalic) - aToken.eType = TITALIC; - else - aToken.eType = TNITALIC; - SmStructureNode *pFontNode = static_cast<SmStructureNode *> - (new SmFontNode(aToken)); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (nFontSize != 0.0) - { - aToken.eType = TSIZE; - SmFontNode *pFontNode = new SmFontNode(aToken); - - if (MAP_RELATIVE == rContext.GetSmImport().GetMM100UnitConverter(). - getXMLMeasureUnit()) - { - if (nFontSize < 100.00) - pFontNode->SetSizeParameter(Fraction(100.00/nFontSize), - FNTSIZ_DIVIDE); - else - pFontNode->SetSizeParameter(Fraction(nFontSize/100.00), - FNTSIZ_MULTIPLY); - } - else - pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT); - - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (sFontFamily.getLength()) - { - if (sFontFamily.equalsIgnoreAsciiCase(GetXMLToken(XML_FIXED))) - aToken.eType = TFIXED; - else if (sFontFamily.equalsIgnoreAsciiCase(OUString( - RTL_CONSTASCII_USTRINGPARAM("sans")))) - aToken.eType = TSANS; - else if (sFontFamily.equalsIgnoreAsciiCase(OUString( - RTL_CONSTASCII_USTRINGPARAM("serif")))) - aToken.eType = TSERIF; - else //Just give up, we need to extend our font mechanism to be - //more general - return; - - aToken.aText = sFontFamily; - SmFontNode *pFontNode = new SmFontNode(aToken); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (sColor.getLength()) - { - //Again we can only handle a small set of colours in - //StarMath for now. - const SvXMLTokenMap& rTokenMap = - rContext.GetSmImport().GetColorTokenMap(); - aToken.eType = static_cast<SmTokenType>(rTokenMap.Get( - XML_NAMESPACE_MATH, sColor)); - if (aToken.eType != -1) - { - SmFontNode *pFontNode = new SmFontNode(aToken); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - } - - } -} - -class SmXMLStyleContext_Impl : public SmXMLRowContext_Impl -{ -public: - /*Right now the style tag is completely ignored*/ - 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 ); -protected: - SmXMLContext_Helper aStyleHelper; -}; - -void SmXMLStyleContext_Impl::StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ -#if 1 - aStyleHelper.RetrieveAttrs(xAttrList); -#else - sal_Int8 nOldIsBold=nIsBold; - sal_Int8 nOldIsItalic=nIsItalic; - double nOldFontSize=nFontSize; - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - OUString sOldFontFamily = sFontFamily; - for (sal_Int16 i=0;i<nAttrCount;i++) - { - OUString sAttrName = xAttrList->getNameByIndex(i); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). - GetKeyByAttrName(sAttrName,&aLocalName); - OUString sValue = xAttrList->getValueByIndex(i); - const SvXMLTokenMap &rAttrTokenMap = - GetSmImport().GetPresLayoutAttrTokenMap(); - switch(rAttrTokenMap.Get(nPrefix,aLocalName)) - { - case XML_TOK_FONTWEIGHT: - nIsBold = sValue.equals(GetXMLToken(XML_BOLD)); - break; - case XML_TOK_FONTSTYLE: - nIsItalic = sValue.equals(GetXMLToken(XML_ITALIC)); - break; - case XML_TOK_FONTSIZE: - SvXMLUnitConverter::convertDouble(nFontSize,sValue); - GetSmImport().GetMM100UnitConverter(). - setXMLMeasureUnit(MAP_POINT); - if (-1 == sValue.indexOf(GetXMLToken(XML_UNIT_PT))) - if (-1 == sValue.indexOf('%')) - nFontSize=0.0; - else - { - GetSmImport().GetMM100UnitConverter(). - setXMLMeasureUnit(MAP_RELATIVE); - } - break; - case XML_TOK_FONTFAMILY: - sFontFamily = sValue; - break; - case XML_TOK_COLOR: - sColor = sValue; - break; - default: - break; - } - } - - if ((nOldIsBold!=nIsBold) || (nOldIsItalic!=nIsItalic) || - (nOldFontSize!=nFontSize) || (sOldFontFamily!=sFontFamily) - || sColor.getLength()) - bFontNodeNeeded=sal_True; - else - bFontNodeNeeded=sal_False; -#endif -} - - -void SmXMLStyleContext_Impl::EndElement() -{ - /* - <mstyle> accepts any number of arguments; if this number is not 1, its - contents are treated as a single "inferred <mrow>" containing its - arguments - */ - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - if (rNodeStack.Count() - nElementCount > 1) - SmXMLRowContext_Impl::EndElement(); -#if 1 - aStyleHelper.ApplyAttrs(); -#else - if (bFontNodeNeeded) - { - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - - if (nIsBold != -1) - { - if (nIsBold) - aToken.eType = TBOLD; - else - aToken.eType = TNBOLD; - SmStructureNode *pFontNode = static_cast<SmStructureNode *> - (new SmFontNode(aToken)); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (nIsItalic != -1) - { - if (nIsItalic) - aToken.eType = TITALIC; - else - aToken.eType = TNITALIC; - SmStructureNode *pFontNode = static_cast<SmStructureNode *> - (new SmFontNode(aToken)); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (nFontSize != 0.0) - { - aToken.eType = TSIZE; - SmFontNode *pFontNode = new SmFontNode(aToken); - - if (MAP_RELATIVE == GetSmImport().GetMM100UnitConverter(). - getXMLMeasureUnit()) - { - if (nFontSize < 100.00) - pFontNode->SetSizeParameter(Fraction(100.00/nFontSize), - FNTSIZ_DIVIDE); - else - pFontNode->SetSizeParameter(Fraction(nFontSize/100.00), - FNTSIZ_MULTIPLY); - } - else - pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT); - - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (sFontFamily.getLength()) - { - if (sFontFamily.equalsIgnoreCase(GetXMLToken(XML_FIXED))) - aToken.eType = TFIXED; - else if (sFontFamily.equalsIgnoreCase(OUString( - RTL_CONSTASCII_USTRINGPARAM("sans")))) - aToken.eType = TSANS; - else if (sFontFamily.equalsIgnoreCase(OUString( - RTL_CONSTASCII_USTRINGPARAM("serif")))) - aToken.eType = TSERIF; - else //Just give up, we need to extend our font mechanism to be - //more general - return; - - aToken.aText = sFontFamily; - SmFontNode *pFontNode = new SmFontNode(aToken); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - if (sColor.getLength()) - { - //Again we can only handle a small set of colours in - //StarMath for now. - const SvXMLTokenMap& rTokenMap = - GetSmImport().GetColorTokenMap(); - aToken.eType = static_cast<SmTokenType>(rTokenMap.Get( - XML_NAMESPACE_MATH, sColor)); - if (aToken.eType != -1) - { - SmFontNode *pFontNode = new SmFontNode(aToken); - pFontNode->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pFontNode); - } - } - - } -#endif -} - -class SmXMLPaddedContext_Impl : public SmXMLRowContext_Impl -{ -public: - /*Right now the style tag is completely ignored*/ - SmXMLPaddedContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - void EndElement(); -}; - -void SmXMLPaddedContext_Impl::EndElement() -{ - /* - <mpadded> accepts any number of arguments; if this number is not 1, its - contents are treated as a single "inferred <mrow>" containing its - arguments - */ - if (GetSmImport().GetNodeStack().Count() - nElementCount > 1) - SmXMLRowContext_Impl::EndElement(); -} - -class SmXMLPhantomContext_Impl : public SmXMLRowContext_Impl -{ -public: - /*Right now the style tag is completely ignored*/ - SmXMLPhantomContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - void EndElement(); -}; - -void SmXMLPhantomContext_Impl::EndElement() -{ - /* - <mphantom> accepts any number of arguments; if this number is not 1, its - contents are treated as a single "inferred <mrow>" containing its - arguments - */ - if (GetSmImport().GetNodeStack().Count() - nElementCount > 1) - SmXMLRowContext_Impl::EndElement(); - - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - aToken.eType = TPHANTOM; - - SmStructureNode *pPhantom = static_cast<SmStructureNode *> - (new SmFontNode(aToken)); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - pPhantom->SetSubNodes(0,rNodeStack.Pop()); - rNodeStack.Push(pPhantom); -} - -class SmXMLFencedContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLFencedContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName), - cBegin('('), cEnd(')') {} - void StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ); - void EndElement(); -protected: - sal_Unicode cBegin; - sal_Unicode cEnd; -}; - - -void SmXMLFencedContext_Impl::StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for (sal_Int16 i=0;i<nAttrCount;i++) - { - OUString sAttrName = xAttrList->getNameByIndex(i); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). - GetKeyByAttrName(sAttrName,&aLocalName); - OUString sValue = xAttrList->getValueByIndex(i); - const SvXMLTokenMap &rAttrTokenMap = - GetSmImport().GetFencedAttrTokenMap(); - switch(rAttrTokenMap.Get(nPrefix,aLocalName)) - { - //temp, starmath cannot handle multichar brackets (I think) - case XML_TOK_OPEN: - cBegin = sValue[0]; - break; - case XML_TOK_CLOSE: - cEnd = sValue[0]; - break; - default: - /*Go to superclass*/ - break; - } - } -} - - -void SmXMLFencedContext_Impl::EndElement() -{ - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.aText = ','; - aToken.eType = TLEFT; - aToken.nLevel = 5; - - aToken.eType = TLPARENT; - aToken.cMathChar = cBegin; - SmStructureNode *pSNode = new SmBraceNode(aToken); - SmNode *pLeft = new SmMathSymbolNode(aToken); - - aToken.cMathChar = cEnd; - aToken.eType = TRPARENT; - SmNode *pRight = new SmMathSymbolNode(aToken); - - SmNodeArray aRelationArray; - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - - aToken.cMathChar = '\0'; - aToken.aText = ','; - aToken.eType = TIDENT; - - ULONG i=rNodeStack.Count()-nElementCount; - if (rNodeStack.Count()-nElementCount > 1) - i+=rNodeStack.Count()-1-nElementCount; - aRelationArray.SetSize(i); - while(rNodeStack.Count() > nElementCount) - { - aRelationArray.Put(--i,rNodeStack.Pop()); - if (rNodeStack.Count() > 1) - aRelationArray.Put(--i,new SmGlyphSpecialNode(aToken)); - } - - SmToken aDummy; - SmStructureNode *pBody = new SmExpressionNode(aDummy); - pBody->SetSubNodes(aRelationArray); - - - pSNode->SetSubNodes(pLeft,pBody,pRight); - pSNode->SetScaleMode(SCALE_HEIGHT); - GetSmImport().GetNodeStack().Push(pSNode); -} - - -class SmXMLErrorContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLErrorContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - void EndElement(); -}; - -void SmXMLErrorContext_Impl::EndElement() -{ - /*Right now the error tag is completely ignored, what - can I do with it in starmath, ?, maybe we need a - report window ourselves, do a test for validity of - the xml input, use merrors, and then generate - the markup inside the merror with a big red colour - of something. For now just throw them all away. - */ - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - while(rNodeStack.Count() > nElementCount) - { - SmNode *pNode = rNodeStack.Pop(); - delete pNode; - } -} - -class SmXMLNumberContext_Impl : public SmXMLImportContext -{ -public: - SmXMLNumberContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName) - { - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - aToken.eType = TNUMBER; - } - virtual void TCharacters(const OUString &rChars); - void EndElement(); -protected: - SmToken aToken; -}; - -void SmXMLNumberContext_Impl::TCharacters(const OUString &rChars) -{ - aToken.aText = rChars; -} - -void SmXMLNumberContext_Impl::EndElement() -{ - GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_NUMBER)); -} - -class SmXMLAnnotationContext_Impl : public SmXMLImportContext -{ -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 ); -private: - sal_Bool bIsStarMath; -}; - -void SmXMLAnnotationContext_Impl::StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for (sal_Int16 i=0;i<nAttrCount;i++) - { - OUString sAttrName = xAttrList->getNameByIndex(i); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). - GetKeyByAttrName(sAttrName,&aLocalName); - - OUString sValue = xAttrList->getValueByIndex(i); - const SvXMLTokenMap &rAttrTokenMap = - GetSmImport().GetAnnotationAttrTokenMap(); - switch(rAttrTokenMap.Get(nPrefix,aLocalName)) - { - case XML_TOK_ENCODING: - bIsStarMath= sValue.equals( - OUString(RTL_CONSTASCII_USTRINGPARAM("StarMath 5.0"))); - break; - default: - break; - } - } -} - -void SmXMLAnnotationContext_Impl::Characters(const OUString &rChars) -{ - if (bIsStarMath) - GetSmImport().GetText().Append(String(rChars)); -} - -class SmXMLTextContext_Impl : public SmXMLImportContext -{ -public: - SmXMLTextContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName) - { - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - aToken.eType = TTEXT; - } - virtual void TCharacters(const OUString &rChars); - void EndElement(); -protected: - SmToken aToken; -}; - -void SmXMLTextContext_Impl::TCharacters(const OUString &rChars) -{ - aToken.aText = rChars; -} - -void SmXMLTextContext_Impl::EndElement() -{ - GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_TEXT)); -} - -class SmXMLStringContext_Impl : public SmXMLImportContext -{ -public: - SmXMLStringContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName) - { - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - aToken.eType = TTEXT; - } - virtual void TCharacters(const OUString &rChars); - void EndElement(); -protected: - SmToken aToken; -}; - -void SmXMLStringContext_Impl::TCharacters(const OUString &rChars) -{ - /* - The content of <ms> elements should be rendered with visible "escaping" of - certain characters in the content, including at least "double quote" - itself, and preferably whitespace other than individual blanks. The intent - is for the viewer to see that the expression is a string literal, and to - see exactly which characters form its content. For example, <ms>double - quote is "</ms> might be rendered as "double quote is \"". - - Obviously this isn't fully done here. - */ - aToken.aText.Erase(); - aToken.aText += '\"'; - aToken.aText += String(rChars); - aToken.aText += '\"'; -} - -void SmXMLStringContext_Impl::EndElement() -{ - GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_FIXED)); -} - -class SmXMLIdentifierContext_Impl : public SmXMLImportContext -{ -public: - SmXMLIdentifierContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName),aStyleHelper(*this) - { - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - aToken.eType = TIDENT; - } - void TCharacters(const OUString &rChars); - void StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) {aStyleHelper.RetrieveAttrs(xAttrList);}; - void EndElement(); -protected: - SmXMLContext_Helper aStyleHelper; - SmToken aToken; -}; - -void SmXMLIdentifierContext_Impl::EndElement() -{ - SmTextNode *pNode = 0; - //we will handle identifier italic/normal here instead of with a standalone - //font node - if (((aStyleHelper.nIsItalic == -1) && (aToken.aText.Len() > 1)) - || ((aStyleHelper.nIsItalic == 0) && (aToken.aText.Len() == 1))) - { - pNode = new SmTextNode(aToken,FNT_FUNCTION); - pNode->GetFont().SetItalic(ITALIC_NONE); - aStyleHelper.nIsItalic = -1; - } - else - pNode = new SmTextNode(aToken,FNT_VARIABLE); - if (aStyleHelper.bFontNodeNeeded && aStyleHelper.nIsItalic != -1) - { - if (aStyleHelper.nIsItalic) - pNode->GetFont().SetItalic(ITALIC_NORMAL); - else - pNode->GetFont().SetItalic(ITALIC_NONE); - } - - if ((-1!=aStyleHelper.nIsBold) || (0.0!=aStyleHelper.nFontSize) || - (aStyleHelper.sFontFamily.getLength()) || - aStyleHelper.sColor.getLength()) - aStyleHelper.bFontNodeNeeded=sal_True; - else - aStyleHelper.bFontNodeNeeded=sal_False; - if (aStyleHelper.bFontNodeNeeded) - aStyleHelper.ApplyAttrs(); - GetSmImport().GetNodeStack().Push(pNode); -} - -void SmXMLIdentifierContext_Impl::TCharacters(const OUString &rChars) -{ - aToken.aText = rChars; -} - -class SmXMLOperatorContext_Impl : public SmXMLImportContext -{ -public: - SmXMLOperatorContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName), bIsStretchy(sal_False) - { - aToken.nGroup = 0; - aToken.eType = TSPECIAL; - aToken.nLevel = 5; - } - void TCharacters(const OUString &rChars); - void StartElement(const uno::Reference< - xml::sax::XAttributeList > &xAttrList ); - void EndElement(); -protected: - SmToken aToken; -private: - sal_Bool bIsStretchy; -}; - -void SmXMLOperatorContext_Impl::TCharacters(const OUString &rChars) -{ - aToken.cMathChar = rChars[0]; -} - -void SmXMLOperatorContext_Impl::EndElement() -{ - SmMathSymbolNode *pNode = new SmMathSymbolNode(aToken); - //For stretchy scaling the scaling must be retrieved from this node - //and applied to the expression itself so as to get the expression - //to scale the operator to the height of the expression itself - if (bIsStretchy) - pNode->SetScaleMode(SCALE_HEIGHT); - GetSmImport().GetNodeStack().Push(pNode); -} - - - -void SmXMLOperatorContext_Impl::StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for (sal_Int16 i=0;i<nAttrCount;i++) - { - OUString sAttrName = xAttrList->getNameByIndex(i); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). - GetKeyByAttrName(sAttrName,&aLocalName); - - OUString sValue = xAttrList->getValueByIndex(i); - const SvXMLTokenMap &rAttrTokenMap = - GetSmImport().GetOperatorAttrTokenMap(); - switch(rAttrTokenMap.Get(nPrefix,aLocalName)) - { - case XML_TOK_STRETCHY: - bIsStretchy = sValue.equals( - GetXMLToken(XML_TRUE)); - break; - default: - break; - } - } -} - - -class SmXMLSpaceContext_Impl : public SmXMLImportContext -{ -public: - SmXMLSpaceContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName) {} - void StartElement(const uno::Reference< - xml::sax::XAttributeList >& xAttrList ); -}; - -void SmXMLSpaceContext_Impl::StartElement( - const uno::Reference<xml::sax::XAttributeList > & /*xAttrList*/ ) -{ - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.eType = TBLANK; - aToken.nLevel = 5; - SmBlankNode *pBlank = new SmBlankNode(aToken); - pBlank->IncreaseBy(aToken); - GetSmImport().GetNodeStack().Push(pBlank); -} - -class SmXMLSubContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLSubContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - void EndElement() { GenericEndElement(TRSUB,RSUB); } -protected: - void GenericEndElement(SmTokenType eType,SmSubSup aSubSup); -}; - - -void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType,SmSubSup aSubSup) -{ - /*The <msub> element requires exactly 2 arguments.*/ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, - "Sub has not two arguments"); - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = eType; - SmSubSupNode *pNode = new SmSubSupNode(aToken); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - - // initialize subnodes array - SmNodeArray aSubNodes; - aSubNodes.SetSize(1 + SUBSUP_NUM_ENTRIES); - for (ULONG i = 1; i < aSubNodes.GetSize(); i++) - aSubNodes.Put(i, NULL); - - aSubNodes.Put(aSubSup+1,rNodeStack.Pop()); - aSubNodes.Put(0, rNodeStack.Pop()); - pNode->SetSubNodes(aSubNodes); - rNodeStack.Push(pNode); -} - -class SmXMLSupContext_Impl : public SmXMLSubContext_Impl -{ -public: - SmXMLSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLSubContext_Impl(rImport,nPrefix,rLName) {} - void EndElement() {GenericEndElement(TRSUP,RSUP);} -}; - -class SmXMLSubSupContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLSubSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {} - void EndElement() { GenericEndElement(TRSUB,RSUB,RSUP); } -protected: - void GenericEndElement(SmTokenType eType, - SmSubSup aSub,SmSubSup aSup); - -}; - -void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType, - SmSubSup aSub,SmSubSup aSup) -{ - /*The <msub> element requires exactly 3 arguments.*/ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 3, - "SubSup has not three arguments"); - - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = eType; - SmSubSupNode *pNode = new SmSubSupNode(aToken); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - - // initialize subnodes array - SmNodeArray aSubNodes; - aSubNodes.SetSize(1 + SUBSUP_NUM_ENTRIES); - for (ULONG i = 1; i < aSubNodes.GetSize(); i++) - aSubNodes.Put(i, NULL); - - aSubNodes.Put(aSup+1,rNodeStack.Pop()); - aSubNodes.Put(aSub+1,rNodeStack.Pop()); - aSubNodes.Put(0, rNodeStack.Pop()); - pNode->SetSubNodes(aSubNodes); - rNodeStack.Push(pNode); -} - -class SmXMLUnderContext_Impl : public SmXMLSubContext_Impl -{ -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(); -protected: - sal_Int16 nAttrCount; -}; - -void SmXMLUnderContext_Impl::StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ - nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; -} - -void SmXMLUnderContext_Impl::HandleAccent() -{ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, - "Sub has not two arguments"); - - /*Just one special case for the underline thing*/ - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - SmNode *pTest = rNodeStack.Pop(); - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TUNDERLINE; - - - SmNodeArray aSubNodes; - aSubNodes.SetSize(2); - - SmStructureNode *pNode = new SmAttributNode(aToken); - if ((pTest->GetToken().cMathChar & 0x0FFF) == 0x0332) - { - aSubNodes.Put(0, new SmRectangleNode(aToken)); - delete pTest; - } - else - aSubNodes.Put(0, pTest); - - aSubNodes.Put(1, rNodeStack.Pop()); - pNode->SetSubNodes(aSubNodes); - pNode->SetScaleMode(SCALE_WIDTH); - rNodeStack.Push(pNode); -} - - -void SmXMLUnderContext_Impl::EndElement() -{ - if (!nAttrCount) - GenericEndElement(TCSUB,CSUB); - else - HandleAccent(); -#if 0 - //UnderBrace trick - SmStructureNode *pNode = rNodeStack.Pop(); - if (pNode->GetSubNode(1)->GetToken().cMathChar == (0x0332|0xf000)) - if (pNode->GetSubNode(0)->GetToken().cMathChar == (0x0332|0xf000)) -#endif -} - -class SmXMLOverContext_Impl : public SmXMLSubContext_Impl -{ -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(); -protected: - sal_Int16 nAttrCount; -}; - - -void SmXMLOverContext_Impl::StartElement(const uno::Reference< - xml::sax::XAttributeList > & xAttrList ) -{ - nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; -} - - -void SmXMLOverContext_Impl::EndElement() -{ - if (!nAttrCount) - GenericEndElement(TCSUP,CSUP); - else - HandleAccent(); -} - - -void SmXMLOverContext_Impl::HandleAccent() -{ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, - "Sub has not two arguments"); - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TACUTE; - - SmAttributNode *pNode = new SmAttributNode(aToken); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - - SmNodeArray aSubNodes; - aSubNodes.SetSize(2); - aSubNodes.Put(0, rNodeStack.Pop()); - aSubNodes.Put(1, rNodeStack.Pop()); - pNode->SetSubNodes(aSubNodes); - pNode->SetScaleMode(SCALE_WIDTH); - rNodeStack.Push(pNode); - -} - -class SmXMLUnderOverContext_Impl : public SmXMLSubSupContext_Impl -{ -public: - SmXMLUnderOverContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLSubSupContext_Impl(rImport,nPrefix,rLName) {} - void EndElement() { GenericEndElement(TCSUB,CSUB,CSUP); } -}; - -class SmXMLMultiScriptsContext_Impl : public SmXMLSubSupContext_Impl -{ -public: - SmXMLMultiScriptsContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : - SmXMLSubSupContext_Impl(rImport,nPrefix,rLName), - bHasPrescripts(FALSE) {} - void EndElement(); - void MiddleElement(); - SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList > &xAttrList); -private: - sal_Bool bHasPrescripts; -}; - -class SmXMLNoneContext_Impl : public SmXMLImportContext -{ -public: - SmXMLNoneContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName) {} - void EndElement(); -}; - - -void SmXMLNoneContext_Impl::EndElement(void) -{ - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.aText.Erase(); - aToken.nLevel = 5; - aToken.eType = TIDENT; - GetSmImport().GetNodeStack().Push( - new SmTextNode(aToken,FNT_VARIABLE)); -} - -class SmXMLPrescriptsContext_Impl : public SmXMLImportContext -{ -public: - SmXMLPrescriptsContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) - : SmXMLImportContext(rImport,nPrefix,rLName) {} -}; - -class SmXMLTableRowContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLTableRowContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : - SmXMLRowContext_Impl(rImport,nPrefix,rLName) - {} - SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList > &xAttrList); -}; - - -class SmXMLTableContext_Impl : public SmXMLTableRowContext_Impl -{ -public: - SmXMLTableContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : - SmXMLTableRowContext_Impl(rImport,nPrefix,rLName) - {} - void EndElement(); - SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList > &xAttrList); -}; - - -class SmXMLTableCellContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLTableCellContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : - SmXMLRowContext_Impl(rImport,nPrefix,rLName) - {} -}; - -class SmXMLAlignGroupContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLAlignGroupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : - SmXMLRowContext_Impl(rImport,nPrefix,rLName) - {} - /*Don't do anything with alignment for now*/ - void EndElement() {} -}; - -class SmXMLActionContext_Impl : public SmXMLRowContext_Impl -{ -public: - SmXMLActionContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix, - const OUString& rLName) : - SmXMLRowContext_Impl(rImport,nPrefix,rLName) - {} - void EndElement(); -}; - -// NB: virtually inherit so we can multiply inherit properly -// in SmXMLFlatDocContext_Impl -class SmXMLOfficeContext_Impl : public virtual SvXMLImportContext -{ -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); -}; - -SvXMLImportContext *SmXMLOfficeContext_Impl::CreateChildContext(sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference< xml::sax::XAttributeList > &xAttrList) -{ - SvXMLImportContext *pContext = 0; - if( XML_NAMESPACE_OFFICE == nPrefix && - 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) ) - pContext = new XMLDocumentSettingsContext( GetImport(), - XML_NAMESPACE_OFFICE, rLocalName, - xAttrList ); - else - pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); - - return pContext; -} - -// context for flat file xml format -class SmXMLFlatDocContext_Impl - : public SmXMLOfficeContext_Impl, public SvXMLMetaDocumentContext -{ -public: - SmXMLFlatDocContext_Impl( SmXMLImport& i_rImport, - USHORT i_nPrefix, const OUString & i_rLName, - const uno::Reference<document::XDocumentProperties>& i_xDocProps, - const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder); - - virtual ~SmXMLFlatDocContext_Impl(); - - virtual SvXMLImportContext *CreateChildContext( - USHORT i_nPrefix, const OUString& i_rLocalName, - const uno::Reference<xml::sax::XAttributeList>& i_xAttrList); -}; - -SmXMLFlatDocContext_Impl::SmXMLFlatDocContext_Impl( SmXMLImport& i_rImport, - USHORT i_nPrefix, const OUString & i_rLName, - const uno::Reference<document::XDocumentProperties>& i_xDocProps, - const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) : - SvXMLImportContext(i_rImport, i_nPrefix, i_rLName), - SmXMLOfficeContext_Impl(i_rImport, i_nPrefix, i_rLName), - SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName, - i_xDocProps, i_xDocBuilder) -{ -} - -SmXMLFlatDocContext_Impl::~SmXMLFlatDocContext_Impl() { } - - -SvXMLImportContext *SmXMLFlatDocContext_Impl::CreateChildContext( - USHORT i_nPrefix, const OUString& i_rLocalName, - const uno::Reference<xml::sax::XAttributeList>& i_xAttrList) -{ - // behave like meta base class iff we encounter office:meta - if( XML_NAMESPACE_OFFICE == i_nPrefix && - i_rLocalName == GetXMLToken(XML_META) ) { - return SvXMLMetaDocumentContext::CreateChildContext( - i_nPrefix, i_rLocalName, i_xAttrList ); - } else { - return SmXMLOfficeContext_Impl::CreateChildContext( - i_nPrefix, i_rLocalName, i_xAttrList ); - } -} - -static __FAR_DATA SvXMLTokenMapEntry aPresLayoutElemTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_SEMANTICS, XML_TOK_SEMANTICS }, - { XML_NAMESPACE_MATH, XML_MATH, XML_TOK_MATH }, - { XML_NAMESPACE_MATH, XML_MSTYLE, XML_TOK_MSTYLE }, - { XML_NAMESPACE_MATH, XML_MERROR, XML_TOK_MERROR }, - { XML_NAMESPACE_MATH, XML_MPHANTOM, XML_TOK_MPHANTOM }, - { XML_NAMESPACE_MATH, XML_MROW, XML_TOK_MROW }, - { XML_NAMESPACE_MATH, XML_MFRAC, XML_TOK_MFRAC }, - { XML_NAMESPACE_MATH, XML_MSQRT, XML_TOK_MSQRT }, - { XML_NAMESPACE_MATH, XML_MROOT, XML_TOK_MROOT }, - { XML_NAMESPACE_MATH, XML_MSUB, XML_TOK_MSUB }, - { XML_NAMESPACE_MATH, XML_MSUP, XML_TOK_MSUP }, - { XML_NAMESPACE_MATH, XML_MSUBSUP, XML_TOK_MSUBSUP }, - { XML_NAMESPACE_MATH, XML_MUNDER, XML_TOK_MUNDER }, - { XML_NAMESPACE_MATH, XML_MOVER, XML_TOK_MOVER }, - { XML_NAMESPACE_MATH, XML_MUNDEROVER, XML_TOK_MUNDEROVER }, - { XML_NAMESPACE_MATH, XML_MMULTISCRIPTS, XML_TOK_MMULTISCRIPTS }, - { XML_NAMESPACE_MATH, XML_MTABLE, XML_TOK_MTABLE }, - { XML_NAMESPACE_MATH, XML_MACTION, XML_TOK_MACTION }, - { XML_NAMESPACE_MATH, XML_MFENCED, XML_TOK_MFENCED }, - { XML_NAMESPACE_MATH, XML_MPADDED, XML_TOK_MPADDED }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aPresLayoutAttrTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_FONTWEIGHT, XML_TOK_FONTWEIGHT }, - { XML_NAMESPACE_MATH, XML_FONTSTYLE, XML_TOK_FONTSTYLE }, - { XML_NAMESPACE_MATH, XML_FONTSIZE, XML_TOK_FONTSIZE }, - { XML_NAMESPACE_MATH, XML_FONTFAMILY, XML_TOK_FONTFAMILY }, - { XML_NAMESPACE_MATH, XML_COLOR, XML_TOK_COLOR }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aFencedAttrTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_OPEN, XML_TOK_OPEN }, - { XML_NAMESPACE_MATH, XML_CLOSE, XML_TOK_CLOSE }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aOperatorAttrTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_STRETCHY, XML_TOK_STRETCHY }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aAnnotationAttrTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_ENCODING, XML_TOK_ENCODING }, - XML_TOKEN_MAP_END -}; - - -static __FAR_DATA SvXMLTokenMapEntry aPresElemTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_ANNOTATION, XML_TOK_ANNOTATION }, - { XML_NAMESPACE_MATH, XML_MI, XML_TOK_MI }, - { XML_NAMESPACE_MATH, XML_MN, XML_TOK_MN }, - { XML_NAMESPACE_MATH, XML_MO, XML_TOK_MO }, - { XML_NAMESPACE_MATH, XML_MTEXT, XML_TOK_MTEXT }, - { XML_NAMESPACE_MATH, XML_MSPACE,XML_TOK_MSPACE }, - { XML_NAMESPACE_MATH, XML_MS, XML_TOK_MS }, - { XML_NAMESPACE_MATH, XML_MALIGNGROUP, XML_TOK_MALIGNGROUP }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aPresScriptEmptyElemTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_MPRESCRIPTS, XML_TOK_MPRESCRIPTS }, - { XML_NAMESPACE_MATH, XML_NONE, XML_TOK_NONE }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aPresTableElemTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_MTR, XML_TOK_MTR }, - { XML_NAMESPACE_MATH, XML_MTD, XML_TOK_MTD }, - XML_TOKEN_MAP_END -}; - -static __FAR_DATA SvXMLTokenMapEntry aColorTokenMap[] = -{ - { XML_NAMESPACE_MATH, XML_BLACK, TBLACK}, - { XML_NAMESPACE_MATH, XML_WHITE, TWHITE}, - { XML_NAMESPACE_MATH, XML_RED, TRED}, - { XML_NAMESPACE_MATH, XML_GREEN, TGREEN}, - { XML_NAMESPACE_MATH, XML_BLUE, TBLUE}, - { XML_NAMESPACE_MATH, XML_AQUA, TCYAN}, - { XML_NAMESPACE_MATH, XML_FUCHSIA, TMAGENTA}, - { XML_NAMESPACE_MATH, XML_YELLOW, TYELLOW}, - XML_TOKEN_MAP_END -}; - - -const SvXMLTokenMap& SmXMLImport::GetPresLayoutElemTokenMap() -{ - if(!pPresLayoutElemTokenMap) - pPresLayoutElemTokenMap = new SvXMLTokenMap(aPresLayoutElemTokenMap); - return *pPresLayoutElemTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetPresLayoutAttrTokenMap() -{ - if(!pPresLayoutAttrTokenMap) - pPresLayoutAttrTokenMap = new SvXMLTokenMap(aPresLayoutAttrTokenMap); - return *pPresLayoutAttrTokenMap; -} - - -const SvXMLTokenMap& SmXMLImport::GetFencedAttrTokenMap() -{ - if(!pFencedAttrTokenMap) - pFencedAttrTokenMap = new SvXMLTokenMap(aFencedAttrTokenMap); - return *pFencedAttrTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetOperatorAttrTokenMap() -{ - if(!pOperatorAttrTokenMap) - pOperatorAttrTokenMap = new SvXMLTokenMap(aOperatorAttrTokenMap); - return *pOperatorAttrTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetAnnotationAttrTokenMap() -{ - if(!pAnnotationAttrTokenMap) - pAnnotationAttrTokenMap = new SvXMLTokenMap(aAnnotationAttrTokenMap); - return *pAnnotationAttrTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetPresElemTokenMap() -{ - if(!pPresElemTokenMap) - pPresElemTokenMap = new SvXMLTokenMap(aPresElemTokenMap); - return *pPresElemTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetPresScriptEmptyElemTokenMap() -{ - if(!pPresScriptEmptyElemTokenMap) - pPresScriptEmptyElemTokenMap = new - SvXMLTokenMap(aPresScriptEmptyElemTokenMap); - return *pPresScriptEmptyElemTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetPresTableElemTokenMap() -{ - if(!pPresTableElemTokenMap) - pPresTableElemTokenMap = new SvXMLTokenMap(aPresTableElemTokenMap); - return *pPresTableElemTokenMap; -} - -const SvXMLTokenMap& SmXMLImport::GetColorTokenMap() -{ - if(!pColorTokenMap) - pColorTokenMap = new SvXMLTokenMap(aColorTokenMap); - return *pColorTokenMap; -} - -SvXMLImportContext *SmXMLDocContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference<xml::sax::XAttributeList>& xAttrList) -{ - SvXMLImportContext* pContext = 0L; - - const SvXMLTokenMap& rTokenMap = GetSmImport().GetPresLayoutElemTokenMap(); - - //UINT32 nTest = rTokenMap.Get(nPrefix, rLocalName); - - switch(rTokenMap.Get(nPrefix, rLocalName)) - { - //Consider semantics a dummy except for any starmath annotations - case XML_TOK_SEMANTICS: - pContext = GetSmImport().CreateRowContext(nPrefix,rLocalName, - xAttrList); - break; - /*General Layout Schemata*/ - case XML_TOK_MROW: - pContext = GetSmImport().CreateRowContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MFRAC: - pContext = GetSmImport().CreateFracContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MSQRT: - pContext = GetSmImport().CreateSqrtContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MROOT: - pContext = GetSmImport().CreateRootContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MSTYLE: - pContext = GetSmImport().CreateStyleContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MERROR: - pContext = GetSmImport().CreateErrorContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MPADDED: - pContext = GetSmImport().CreatePaddedContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MPHANTOM: - pContext = GetSmImport().CreatePhantomContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MFENCED: - pContext = GetSmImport().CreateFencedContext(nPrefix,rLocalName, - xAttrList); - break; - /*Script and Limit Schemata*/ - case XML_TOK_MSUB: - pContext = GetSmImport().CreateSubContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MSUP: - pContext = GetSmImport().CreateSupContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MSUBSUP: - pContext = GetSmImport().CreateSubSupContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MUNDER: - pContext = GetSmImport().CreateUnderContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MOVER: - pContext = GetSmImport().CreateOverContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MUNDEROVER: - pContext = GetSmImport().CreateUnderOverContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MMULTISCRIPTS: - pContext = GetSmImport().CreateMultiScriptsContext(nPrefix, - rLocalName, xAttrList); - break; - case XML_TOK_MTABLE: - pContext = GetSmImport().CreateTableContext(nPrefix, - rLocalName, xAttrList); - break; - case XML_TOK_MACTION: - pContext = GetSmImport().CreateActionContext(nPrefix, - rLocalName, xAttrList); - break; - default: - /*Basically theres an implicit mrow around certain bare - *elements, use a RowContext to see if this is one of - *those ones*/ - SmXMLRowContext_Impl aTempContext(GetSmImport(),nPrefix, - GetXMLToken(XML_MROW)); - - pContext = aTempContext.StrictCreateChildContext(nPrefix, - rLocalName, xAttrList); - break; - } - return pContext; -} - -void SmXMLDocContext_Impl::EndElement() -{ - SmNodeArray ContextArray; - ContextArray.SetSize(1); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - - for(ULONG i=0;i< 1;i++) - ContextArray.Put(i, rNodeStack.Pop()); - - SmToken aDummy; - SmStructureNode *pSNode = new SmLineNode(aDummy); - pSNode->SetSubNodes(ContextArray); - rNodeStack.Push(pSNode); - - SmNodeArray LineArray; - ULONG n = rNodeStack.Count(); - LineArray.SetSize(n); - for (ULONG j = 0; j < n; j++) - LineArray.Put(n - (j + 1), rNodeStack.Pop()); - SmStructureNode *pSNode2 = new SmTableNode(aDummy); - pSNode2->SetSubNodes(LineArray); - rNodeStack.Push(pSNode2); -} - -void SmXMLFracContext_Impl::EndElement() -{ - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TOVER; - SmStructureNode *pSNode = new SmBinVerNode(aToken); - SmNode *pOper = new SmRectangleNode(aToken); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - DBG_ASSERT(rNodeStack.Count() - nElementCount == 2, - "Fraction (mfrac) tag is missing component"); - - if (rNodeStack.Count() - nElementCount == 2) - { - SmNode *pSecond = rNodeStack.Pop(); - SmNode *pFirst = rNodeStack.Pop(); - pSNode->SetSubNodes(pFirst,pOper,pSecond); - rNodeStack.Push(pSNode); - } -} - -void SmXMLRootContext_Impl::EndElement() -{ - /*The <mroot> element requires exactly 2 arguments.*/ - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2, - "Root tag is missing component"); - - SmToken aToken; - aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TNROOT; - SmStructureNode *pSNode = new SmRootNode(aToken); - SmNode *pOper = new SmRootSymbolNode(aToken); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - SmNode *pIndex = rNodeStack.Pop(); - SmNode *pBase = rNodeStack.Pop(); - pSNode->SetSubNodes(pIndex,pOper,pBase); - rNodeStack.Push(pSNode); -} - -void SmXMLSqrtContext_Impl::EndElement() -{ - /* - <msqrt> accepts any number of arguments; if this number is not 1, its - contents are treated as a single "inferred <mrow>" containing its - arguments - */ - if (GetSmImport().GetNodeStack().Count() - nElementCount > 1) - SmXMLRowContext_Impl::EndElement(); - - SmToken aToken; - aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TSQRT; - SmStructureNode *pSNode = new SmRootNode(aToken); - SmNode *pOper = new SmRootSymbolNode(aToken); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - pSNode->SetSubNodes(0,pOper,rNodeStack.Pop()); - rNodeStack.Push(pSNode); -} - -void SmXMLRowContext_Impl::EndElement() -{ - SmNodeArray aRelationArray; - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - ULONG nSize = rNodeStack.Count()-nElementCount; - - if (nSize) - { - aRelationArray.SetSize(nSize); - for(ULONG j=rNodeStack.Count()-nElementCount;j > 0;j--) - aRelationArray.Put(j-1,rNodeStack.Pop()); - - - //If the first or last element is an operator with stretchyness - //set then we must create a brace node here from those elements, - //removing the stretchness from the operators and applying it to - //ourselves, and creating the appropiate dummy StarMath none bracket - //to balance the arrangement - if (((aRelationArray.Get(0)->GetScaleMode() == SCALE_HEIGHT) - && (aRelationArray.Get(0)->GetType() == NMATH)) - || ((aRelationArray.Get(nSize-1)->GetScaleMode() == SCALE_HEIGHT) - && (aRelationArray.Get(nSize-1)->GetType() == NMATH))) - { - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - - int nLeft=0,nRight=0; - if ((aRelationArray.Get(0)->GetScaleMode() == SCALE_HEIGHT) - && (aRelationArray.Get(0)->GetType() == NMATH)) - { - aToken = aRelationArray.Get(0)->GetToken(); - nLeft=1; - } - else - aToken.cMathChar = '\0'; - - aToken.eType = TLPARENT; - SmNode *pLeft = new SmMathSymbolNode(aToken); - - if ((aRelationArray.Get(nSize-1)->GetScaleMode() == SCALE_HEIGHT) - && (aRelationArray.Get(nSize-1)->GetType() == NMATH)) - { - aToken = aRelationArray.Get(nSize-1)->GetToken(); - nRight=1; - } - else - aToken.cMathChar = '\0'; - - aToken.eType = TRPARENT; - SmNode *pRight = new SmMathSymbolNode(aToken); - - SmNodeArray aRelationArray2; - - //!! nSize-nLeft-nRight may be < 0 !! - int nRelArrSize = nSize-nLeft-nRight; - if (nRelArrSize > 0) - { - aRelationArray2.SetSize(nRelArrSize); - for(int i=0;i < nRelArrSize;i++) - aRelationArray2.Put(i,aRelationArray.Get(i+nLeft)); - } - - SmToken aDummy; - SmStructureNode *pSNode = new SmBraceNode(aToken); - SmStructureNode *pBody = new SmExpressionNode(aDummy); - pBody->SetSubNodes(aRelationArray2); - - pSNode->SetSubNodes(pLeft,pBody,pRight); - pSNode->SetScaleMode(SCALE_HEIGHT); - rNodeStack.Push(pSNode); - return; - } - } - else //Multiple newlines result in empty row elements - { - aRelationArray.SetSize(1); - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 5; - aToken.eType = TNEWLINE; - aRelationArray.Put(0,new SmLineNode(aToken)); - } - - SmToken aDummy; - SmStructureNode *pSNode = new SmExpressionNode(aDummy); - pSNode->SetSubNodes(aRelationArray); - rNodeStack.Push(pSNode); -} - - - - - -SvXMLImportContext *SmXMLRowContext_Impl::StrictCreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference<xml::sax::XAttributeList>& xAttrList) -{ - SvXMLImportContext* pContext = 0L; - - const SvXMLTokenMap& rTokenMap = GetSmImport().GetPresElemTokenMap(); - switch(rTokenMap.Get(nPrefix, rLocalName)) - { - /*Note that these should accept malignmark subelements, but do not*/ - case XML_TOK_MN: - pContext = GetSmImport().CreateNumberContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MI: - pContext = GetSmImport().CreateIdentifierContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MO: - pContext = GetSmImport().CreateOperatorContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MTEXT: - pContext = GetSmImport().CreateTextContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MSPACE: - pContext = GetSmImport().CreateSpaceContext(nPrefix,rLocalName, - xAttrList); - break; - case XML_TOK_MS: - pContext = GetSmImport().CreateStringContext(nPrefix,rLocalName, - xAttrList); - break; - - /*Note: The maligngroup should only be seen when the row - * (or decendants) are in a table*/ - case XML_TOK_MALIGNGROUP: - pContext = GetSmImport().CreateAlignGroupContext(nPrefix,rLocalName, - xAttrList); - break; - - case XML_TOK_ANNOTATION: - pContext = GetSmImport().CreateAnnotationContext(nPrefix,rLocalName, - xAttrList); - break; - - default: - break; - } - return pContext; -} - - - -SvXMLImportContext *SmXMLRowContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference<xml::sax::XAttributeList>& xAttrList) -{ - SvXMLImportContext* pContext = StrictCreateChildContext(nPrefix, - rLocalName, xAttrList); - - if (!pContext) - { - //Hmm, unrecognized for this level, check to see if its - //an element that can have an implicit schema around it - pContext = SmXMLDocContext_Impl::CreateChildContext(nPrefix, - rLocalName,xAttrList); - } - return pContext; -} - - -SvXMLImportContext *SmXMLMultiScriptsContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference<xml::sax::XAttributeList>& xAttrList) -{ - SvXMLImportContext* pContext = 0L; - - const SvXMLTokenMap& rTokenMap = GetSmImport(). - GetPresScriptEmptyElemTokenMap(); - switch(rTokenMap.Get(nPrefix, rLocalName)) - { - case XML_TOK_MPRESCRIPTS: - MiddleElement(); - pContext = GetSmImport().CreatePrescriptsContext(nPrefix, - rLocalName, xAttrList); - break; - case XML_TOK_NONE: - pContext = GetSmImport().CreateNoneContext(nPrefix,rLocalName, - xAttrList); - break; - default: - pContext = SmXMLRowContext_Impl::CreateChildContext(nPrefix, - rLocalName,xAttrList); - break; - } - return pContext; -} - -void SmXMLMultiScriptsContext_Impl::MiddleElement() -{ - bHasPrescripts=sal_True; - - DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount > 0, - "Sub has no arguments"); - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - if (rNodeStack.Count()-nElementCount > 1) - { - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TRSUB; - ULONG nFinalCount = rNodeStack.Count()-nElementCount-1; - - SmNodeStack aReverseStack; - while (rNodeStack.Count()-nElementCount) - { - SmNode *pThing = rNodeStack.Pop(); - aReverseStack.Push(pThing); - } - - for (ULONG nCount=0;nCount < nFinalCount;nCount+=2) - { - SmSubSupNode *pNode = new SmSubSupNode(aToken); - - // initialize subnodes array - SmNodeArray aSubNodes; - aSubNodes.SetSize(1 + SUBSUP_NUM_ENTRIES); - for (ULONG i = 1; i < aSubNodes.GetSize(); i++) - aSubNodes.Put(i, NULL); - - /*On each loop the base and its sub sup pair becomes the - base for the next loop to which the next sub sup pair is - attached, i.e. wheels within wheels*/ - //if (nCount == 0) - aSubNodes.Put(0, aReverseStack.Pop()); - - SmNode *pScriptNode = aReverseStack.Pop(); - - if (pScriptNode && ((pScriptNode->GetToken().eType != TIDENT) || - (pScriptNode->GetToken().aText.Len()))) - aSubNodes.Put(RSUB+1,pScriptNode); - pScriptNode = aReverseStack.Pop(); - if (pScriptNode && ((pScriptNode->GetToken().eType != TIDENT) || - (pScriptNode->GetToken().aText.Len()))) - aSubNodes.Put(RSUP+1,pScriptNode); - - pNode->SetSubNodes(aSubNodes); - aReverseStack.Push(pNode); - } - rNodeStack.Push(aReverseStack.Pop()); - } -} - - -void SmXMLTableContext_Impl::EndElement() -{ - SmNodeArray aExpressionArray; - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - SmNodeStack aReverseStack; - aExpressionArray.SetSize(rNodeStack.Count()-nElementCount); - - ULONG nRows = rNodeStack.Count()-nElementCount; - USHORT nCols = 0; - - SmStructureNode *pArray; - for(ULONG i=rNodeStack.Count()-nElementCount;i > 0;i--) - { - pArray = (SmStructureNode *)rNodeStack.Pop(); - if (pArray->GetNumSubNodes() == 0) - { - //This is a little tricky, it is possible that there was - //be elements that were not inside a <mtd> pair, in which - //case they will not be in a row, i.e. they will not have - //SubNodes, so we have to wait until here before we can - //resolve the situation. Implicitsurrounding tags are - //surprisingly difficult to get right within this - //architecture - - SmNodeArray aRelationArray; - aRelationArray.SetSize(1); - aRelationArray.Put(0,pArray); - SmToken aDummy; - pArray = new SmExpressionNode(aDummy); - pArray->SetSubNodes(aRelationArray); - } - - if (pArray->GetNumSubNodes() > nCols) - nCols = pArray->GetNumSubNodes(); - aReverseStack.Push(pArray); - } - aExpressionArray.SetSize(nCols*nRows); - ULONG j=0; - while (aReverseStack.Count()) - { - pArray = (SmStructureNode *)aReverseStack.Pop(); - for (USHORT i=0;i<pArray->GetNumSubNodes();i++) - aExpressionArray.Put(j++,pArray->GetSubNode(i)); - } - - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = TRGROUP; - aToken.nLevel = 0; - aToken.eType = TMATRIX; - SmMatrixNode *pSNode = new SmMatrixNode(aToken); - pSNode->SetSubNodes(aExpressionArray); - pSNode->SetRowCol(static_cast<USHORT>(nRows),nCols); - rNodeStack.Push(pSNode); -} - -SvXMLImportContext *SmXMLTableRowContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference<xml::sax::XAttributeList>& xAttrList) -{ - SvXMLImportContext* pContext = 0L; - - const SvXMLTokenMap& rTokenMap = GetSmImport(). - GetPresTableElemTokenMap(); - switch(rTokenMap.Get(nPrefix, rLocalName)) - { - case XML_TOK_MTD: - pContext = GetSmImport().CreateTableCellContext(nPrefix, - rLocalName, xAttrList); - break; - default: - pContext = SmXMLRowContext_Impl::CreateChildContext(nPrefix, - rLocalName,xAttrList); - break; - } - return pContext; -} - -SvXMLImportContext *SmXMLTableContext_Impl::CreateChildContext( - sal_uInt16 nPrefix, - const OUString& rLocalName, - const uno::Reference<xml::sax::XAttributeList>& xAttrList) -{ - SvXMLImportContext* pContext = 0L; - - const SvXMLTokenMap& rTokenMap = GetSmImport(). - GetPresTableElemTokenMap(); - switch(rTokenMap.Get(nPrefix, rLocalName)) - { - case XML_TOK_MTR: - pContext = GetSmImport().CreateTableRowContext(nPrefix,rLocalName, - xAttrList); - break; - default: - pContext = SmXMLTableRowContext_Impl::CreateChildContext(nPrefix, - rLocalName,xAttrList); - break; - } - return pContext; -} - -void SmXMLMultiScriptsContext_Impl::EndElement() -{ - if (!bHasPrescripts) - MiddleElement(); - - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - if (rNodeStack.Count()-nElementCount > 1) - { - SmToken aToken; - aToken.cMathChar = '\0'; - aToken.nGroup = 0; - aToken.nLevel = 0; - aToken.eType = TLSUB; - ULONG nFinalCount = rNodeStack.Count()-nElementCount-1; - - SmNodeStack aReverseStack; - while (rNodeStack.Count()-nElementCount) - aReverseStack.Push(rNodeStack.Pop()); - for (ULONG nCount=0;nCount < nFinalCount;nCount+=2) - { - SmSubSupNode *pNode = new SmSubSupNode(aToken); - - // initialize subnodes array - SmNodeArray aSubNodes; - aSubNodes.SetSize(1 + SUBSUP_NUM_ENTRIES); - for (ULONG i = 1; i < aSubNodes.GetSize(); i++) - aSubNodes.Put(i, NULL); - - /*On each loop the base and its sub sup pair becomes the - base for the next loop to which the next sub sup pair is - attached, i.e. wheels within wheels*/ - //if (nCount == 0) - aSubNodes.Put(0, aReverseStack.Pop()); - - SmNode *pScriptNode = aReverseStack.Pop(); - if (pScriptNode->GetToken().aText.Len()) - aSubNodes.Put(LSUB+1,pScriptNode); - pScriptNode = aReverseStack.Pop(); - if (pScriptNode->GetToken().aText.Len()) - aSubNodes.Put(LSUP+1,pScriptNode); - - pNode->SetSubNodes(aSubNodes); - aReverseStack.Push(pNode); - } - rNodeStack.Push(aReverseStack.Pop()); - } - -} -void SmXMLActionContext_Impl::EndElement() -{ - /*For now we will just assume that the - selected attribute is one, and then just display - that expression alone, i.e. remove all expect the - first pushed one*/ - - SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - for(ULONG i=rNodeStack.Count()-nElementCount;i > 1;i--) - { - delete rNodeStack.Pop(); - } -} - -SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - if( XML_NAMESPACE_OFFICE == nPrefix ) { - if ( (IsXMLToken(rLocalName, XML_DOCUMENT) || - IsXMLToken(rLocalName, XML_DOCUMENT_META))) { - uno::Reference<xml::sax::XDocumentHandler> xDocBuilder( - mxServiceFactory->createInstance( - ::rtl::OUString::createFromAscii( - "com.sun.star.xml.dom.SAXDocumentBuilder")), - uno::UNO_QUERY_THROW); - uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - GetModel(), uno::UNO_QUERY_THROW); - return IsXMLToken(rLocalName, XML_DOCUMENT_META) - ? new SvXMLMetaDocumentContext(*this, - XML_NAMESPACE_OFFICE, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder) - // flat OpenDocument file format -- this has not been tested... - : new SmXMLFlatDocContext_Impl( *this, nPrefix, rLocalName, - xDPS->getDocumentProperties(), xDocBuilder); - } else { - return new SmXMLOfficeContext_Impl( *this,nPrefix,rLocalName); - } - } else - return new SmXMLDocContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateRowContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLRowContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateTextContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLTextContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateAnnotationContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLAnnotationContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateStringContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLStringContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateNumberContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLNumberContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateIdentifierContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLIdentifierContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateOperatorContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLOperatorContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateSpaceContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLSpaceContext_Impl(*this,nPrefix,rLocalName); -} - - -SvXMLImportContext *SmXMLImport::CreateFracContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLFracContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateSqrtContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLSqrtContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateRootContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLRootContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateStyleContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLStyleContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreatePaddedContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLPaddedContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreatePhantomContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLPhantomContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateFencedContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLFencedContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateErrorContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLErrorContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateSubContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLSubContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateSubSupContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLSubSupContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateSupContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLSupContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateUnderContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLUnderContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateOverContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLOverContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateUnderOverContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLUnderOverContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateMultiScriptsContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLMultiScriptsContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateTableContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLTableContext_Impl(*this,nPrefix,rLocalName); -} -SvXMLImportContext *SmXMLImport::CreateTableRowContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLTableRowContext_Impl(*this,nPrefix,rLocalName); -} -SvXMLImportContext *SmXMLImport::CreateTableCellContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLTableCellContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateNoneContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLNoneContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreatePrescriptsContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLPrescriptsContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateAlignGroupContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLAlignGroupContext_Impl(*this,nPrefix,rLocalName); -} - -SvXMLImportContext *SmXMLImport::CreateActionContext(sal_uInt16 nPrefix, - const OUString &rLocalName, - const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/) -{ - return new SmXMLActionContext_Impl(*this,nPrefix,rLocalName); -} - -SmXMLImport::~SmXMLImport() throw () -{ - delete pPresLayoutElemTokenMap; - delete pPresElemTokenMap; - delete pPresScriptEmptyElemTokenMap; - delete pPresTableElemTokenMap; - delete pPresLayoutAttrTokenMap; - delete pFencedAttrTokenMap; - delete pColorTokenMap; - delete pOperatorAttrTokenMap; - delete pAnnotationAttrTokenMap; -} - -void SmXMLImport::SetViewSettings(const Sequence<PropertyValue>& aViewProps) -{ - uno::Reference <frame::XModel> xModel = GetModel(); - if( !xModel.is() ) - return; - - uno::Reference <lang::XUnoTunnel> xTunnel; - xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY); - SmModel *pModel = reinterpret_cast<SmModel *> - (xTunnel->getSomething(SmModel::getUnoTunnelId())); - - if( !pModel ) - return; - - SmDocShell *pDocShell = - static_cast<SmDocShell*>(pModel->GetObjectShell()); - if( !pDocShell ) - return; - - Rectangle aRect( pDocShell->GetVisArea() ); - - sal_Int32 nCount = aViewProps.getLength(); - const PropertyValue *pValue = aViewProps.getConstArray(); - - long nTmp = 0; - //sal_Bool bShowDeletes = sal_False, bShowInserts = sal_False, bShowFooter = sal_False, bShowHeader = sal_False; - - for (sal_Int32 i = 0; i < nCount ; i++) - { - if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaTop" ) ) ) - { - pValue->Value >>= nTmp; - aRect.setY( nTmp ); - } - else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaLeft" ) ) ) - { - pValue->Value >>= nTmp; - aRect.setX( nTmp ); - } - else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaWidth" ) ) ) - { - pValue->Value >>= nTmp; - Size aSize( aRect.GetSize() ); - aSize.Width() = nTmp; - aRect.SetSize( aSize ); - } - else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaHeight" ) ) ) - { - pValue->Value >>= nTmp; - Size aSize( aRect.GetSize() ); - aSize.Height() = nTmp; - aRect.SetSize( aSize ); - } - pValue++; - } - - pDocShell->SetVisArea ( aRect ); -} - -void SmXMLImport::SetConfigurationSettings(const Sequence<PropertyValue>& aConfProps) -{ - uno::Reference < XPropertySet > xProps ( GetModel(), UNO_QUERY ); - if ( xProps.is() ) - { - Reference < XPropertySetInfo > xInfo ( xProps->getPropertySetInfo() ); - if (xInfo.is() ) - { - sal_Int32 nCount = aConfProps.getLength(); - const PropertyValue* pValues = aConfProps.getConstArray(); - - const OUString sFormula ( RTL_CONSTASCII_USTRINGPARAM ( "Formula" ) ); - const OUString sBasicLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "BasicLibraries" ) ); - const OUString sDialogLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "DialogLibraries" ) ); - while( nCount-- ) - { - if (pValues->Name != sFormula && - pValues->Name != sBasicLibraries && - pValues->Name != sDialogLibraries) - { - try - { - if( xInfo->hasPropertyByName( pValues->Name ) ) - xProps->setPropertyValue( pValues->Name, pValues->Value ); - } - catch( Exception& ) - { - DBG_ERROR( "SmXMLImport::SetConfigurationSettings: Exception!" ); - } - } - - pValues++; - } - } - } -} -void SmXMLExport::_ExportContent() -{ - SvXMLElementExport aEquation(*this,XML_NAMESPACE_MATH,XML_MATH, sal_True, - sal_True); - SvXMLElementExport *pSemantics=0; - - if (aText.Len()) - { - pSemantics = new SvXMLElementExport(*this,XML_NAMESPACE_MATH, - XML_SEMANTICS, sal_True, sal_True); - } - - ExportNodes(pTree,0); - - if (aText.Len()) - { - // Convert symbol names - uno::Reference <frame::XModel> xModel = GetModel(); - uno::Reference <lang::XUnoTunnel> xTunnel; - xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY); - SmModel *pModel = reinterpret_cast<SmModel *> - (xTunnel->getSomething(SmModel::getUnoTunnelId())); - SmDocShell *pDocShell = pModel ? - static_cast<SmDocShell*>(pModel->GetObjectShell()) : 0; - DBG_ASSERT( pDocShell, "doc shell missing" ); - if (pDocShell) - { - SmParser &rParser = pDocShell->GetParser(); - BOOL bVal = rParser.IsExportSymbolNames(); - rParser.SetExportSymbolNames( TRUE ); - SmNode *pTmpTree = rParser.Parse( aText ); - aText = rParser.GetText(); - delete pTmpTree; - rParser.SetExportSymbolNames( bVal ); - } - - AddAttribute(XML_NAMESPACE_MATH,XML_ENCODING, - OUString(RTL_CONSTASCII_USTRINGPARAM("StarMath 5.0"))); - SvXMLElementExport aAnnotation(*this,XML_NAMESPACE_MATH, - XML_ANNOTATION,sal_True, sal_False); - GetDocHandler()->characters(OUString( aText )); - } - delete pSemantics; -} - -void SmXMLExport::GetViewSettings( Sequence < PropertyValue >& aProps) -{ - uno::Reference <frame::XModel> xModel = GetModel(); - if( !xModel.is() ) - return; - - uno::Reference <lang::XUnoTunnel> xTunnel; - xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY); - SmModel *pModel = reinterpret_cast<SmModel *> - (xTunnel->getSomething(SmModel::getUnoTunnelId())); - - if( !pModel ) - return; - - SmDocShell *pDocShell = - static_cast<SmDocShell*>(pModel->GetObjectShell()); - if( !pDocShell ) - return; - - aProps.realloc( 4 ); - PropertyValue *pValue = aProps.getArray(); - sal_Int32 nIndex = 0; - - Rectangle aRect( pDocShell->GetVisArea() ); - - pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaTop") ); - pValue[nIndex++].Value <<= aRect.Top(); - - pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaLeft") ); - pValue[nIndex++].Value <<= aRect.Left(); - - pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaWidth") ); - pValue[nIndex++].Value <<= aRect.GetWidth(); - - pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "ViewAreaHeight") ); - pValue[nIndex++].Value <<= aRect.GetHeight(); -} - -void SmXMLExport::GetConfigurationSettings( Sequence < PropertyValue > & rProps) -{ - Reference < XPropertySet > xProps ( GetModel(), UNO_QUERY ); - if ( xProps.is() ) - { - Reference< XPropertySetInfo > xPropertySetInfo = xProps->getPropertySetInfo(); - if (xPropertySetInfo.is()) - { - Sequence< Property > aProps = xPropertySetInfo->getProperties(); - sal_Int32 nCount(aProps.getLength()); - if (nCount) - { - rProps.realloc(nCount); - PropertyValue* pProps = rProps.getArray(); - if (pProps) - { - const OUString sFormula ( RTL_CONSTASCII_USTRINGPARAM ( "Formula" ) ); - const OUString sBasicLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "BasicLibraries" ) ); - const OUString sDialogLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "DialogLibraries" ) ); - const OUString sRuntimeUID ( RTL_CONSTASCII_USTRINGPARAM ( "RuntimeUID" ) ); - for (sal_Int32 i = 0; i < nCount; i++, pProps++) - { - const OUString &rPropName = aProps[i].Name; - if (rPropName != sFormula && - rPropName != sBasicLibraries && - rPropName != sDialogLibraries && - rPropName != sRuntimeUID) - { - pProps->Name = rPropName; - pProps->Value = xProps->getPropertyValue(rPropName); - } - } - } - } - } - } -} - -void SmXMLExport::ExportLine(const SmNode *pNode,int nLevel) -{ - ExportExpression(pNode,nLevel); -} - -void SmXMLExport::ExportBinaryHorizontal(const SmNode *pNode,int nLevel) -{ - ExportExpression(pNode,nLevel); -} - -void SmXMLExport::ExportUnaryHorizontal(const SmNode *pNode,int nLevel) -{ - ExportExpression(pNode,nLevel); -} - -void SmXMLExport::ExportExpression(const SmNode *pNode,int nLevel) -{ - SvXMLElementExport *pRow=0; - ULONG nSize = pNode->GetNumSubNodes(); - - if (nSize > 1) - pRow = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,XML_MROW, - sal_True, sal_True); - - //if (nSize) - //{ - for (USHORT i = 0; i < nSize; i++) - if (const SmNode *pTemp = pNode->GetSubNode(i)) - ExportNodes(pTemp,nLevel+1); - //} -#if 0 - else - { - //This saves us from situations like "a newline" where the - //lack of a term following the newline would otherwise create - //a incorrect token like <mtr/> - SvXMLElementExport aDummy(*this,XML_NAMESPACE_MATH,XML_MI, - sal_True,sal_True); - sal_Unicode nArse[2] = {'\n','\0'}; - GetDocHandler()->characters(nArse); - } -#endif - - delete pRow; -} - -void SmXMLExport::ExportBinaryVertical(const SmNode *pNode,int nLevel) -{ - DBG_ASSERT(pNode->GetNumSubNodes()==3,"Bad Fraction"); - SvXMLElementExport aFraction(*this,XML_NAMESPACE_MATH,XML_MFRAC, sal_True, - sal_True); - ExportNodes(pNode->GetSubNode(0),nLevel); - ExportNodes(pNode->GetSubNode(2),nLevel); -} - -void SmXMLExport::ExportTable(const SmNode *pNode, int nLevel) -{ - SvXMLElementExport *pTable=0; - - USHORT nSize = pNode->GetNumSubNodes(); - - //If the list ends in newline then the last entry has - //no subnodes, the newline is superfulous so we just drop - //the last node, inclusion would create a bad MathML - //table - if (pNode->GetSubNode(nSize-1)->GetNumSubNodes() == 0) - nSize--; - - if ( nLevel || (nSize >1)) - pTable = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,XML_MTABLE, - sal_True, sal_True); - - for (USHORT i = 0; i < nSize; i++) - if (const SmNode *pTemp = pNode->GetSubNode(i)) - { - SvXMLElementExport *pRow=0; - if (pTable) - pRow = new SvXMLElementExport(*this,XML_NAMESPACE_MATH, - XML_MTR, sal_True, sal_True); - ExportNodes(pTemp,nLevel+1); - delete pRow; - } - - delete pTable; -} - -void SmXMLExport::ExportMath(const SmNode *pNode, int /*nLevel*/) -{ - const SmMathSymbolNode *pTemp = static_cast<const SmMathSymbolNode *> - (pNode); - SvXMLElementExport aMath(*this,XML_NAMESPACE_MATH,XML_MO, - sal_True,sal_False); - sal_Unicode nArse[2]; - nArse[0] = pTemp->GetText().GetChar(0); - sal_Unicode cTmp = ConvertMathToMathML( nArse[0] ); - if (cTmp != 0) - nArse[0] = cTmp; - DBG_ASSERT(nArse[0] != 0xffff,"Non existant symbol"); - nArse[1] = 0; - GetDocHandler()->characters(nArse); -} - -void SmXMLExport::ExportText(const SmNode *pNode, int /*nLevel*/) -{ - SvXMLElementExport *pText; - const SmTextNode *pTemp = static_cast<const SmTextNode *>(pNode); - switch (pNode->GetToken().eType) - { - default: - case TIDENT: - { - //Note that we change the fontstyle to italic for strings that - //are italic and longer than a single character. - sal_Bool bIsItalic = IsItalic( pTemp->GetFont() ); - if ((pTemp->GetText().Len() > 1) && bIsItalic) - AddAttribute(XML_NAMESPACE_MATH,XML_FONTSTYLE, - XML_ITALIC); - else if ((pTemp->GetText().Len() == 1) && !bIsItalic) - AddAttribute(XML_NAMESPACE_MATH,XML_FONTSTYLE, - XML_NORMAL); - pText = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,XML_MI, - sal_True,sal_False); - break; - } - case TNUMBER: - pText = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,XML_MN, - sal_True,sal_False); - break; - case TTEXT: - pText = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,XML_MTEXT, - sal_True,sal_False); - break; - } - GetDocHandler()->characters(OUString(pTemp->GetText().GetBuffer())); - delete pText; -} - -void SmXMLExport::ExportBlank(const SmNode * /*pNode*/, int /*nLevel*/) -{ - //!! 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 !! - - SvXMLElementExport *pText; - //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; -} - -void SmXMLExport::ExportSubSupScript(const SmNode *pNode,int nLevel) -{ - const SmNode *pSub = 0; - const SmNode *pSup = 0; - const SmNode *pCSub = 0; - const SmNode *pCSup = 0; - const SmNode *pLSub = 0; - const SmNode *pLSup = 0; - SvXMLElementExport *pThing = 0, *pThing2 = 0; - - //if we have prescripts at all then we must use the tensor notation - - //This is one of those excellent locations where scope is vital to - //arrange the construction and destruction of the element helper - //classes correctly - pLSub = pNode->GetSubNode(LSUB+1); - pLSup = pNode->GetSubNode(LSUP+1); - if (pLSub || pLSup) - { - SvXMLElementExport aMultiScripts(*this,XML_NAMESPACE_MATH, - XML_MMULTISCRIPTS, sal_True, sal_True); - - - if (NULL != (pCSub = pNode->GetSubNode(CSUB+1)) - && NULL != (pCSup = pNode->GetSubNode(CSUP+1))) - { - pThing2 = new SvXMLElementExport(*this,XML_NAMESPACE_MATH, - XML_MUNDEROVER, sal_True,sal_True); - } - else if (NULL != (pCSub = pNode->GetSubNode(CSUB+1))) - { - pThing2 = new SvXMLElementExport(*this,XML_NAMESPACE_MATH, - XML_MUNDER, sal_True,sal_True); - } - else if (NULL != (pCSup = pNode->GetSubNode(CSUP+1))) - { - pThing2 = new SvXMLElementExport(*this,XML_NAMESPACE_MATH, - XML_MOVER, sal_True,sal_True); - } - - ExportNodes(pNode->GetSubNode(0), nLevel+1); //Main Term - - if (pCSub) - ExportNodes(pCSub, nLevel+1); - if (pCSup) - ExportNodes(pCSup, nLevel+1); - delete pThing2; - - pSub = pNode->GetSubNode(RSUB+1); - pSup = pNode->GetSubNode(RSUP+1); - if (pSub || pSup) - { - if (pSub) - ExportNodes(pSub, nLevel+1); - else - { - SvXMLElementExport aNone(*this,XML_NAMESPACE_MATH, XML_NONE, - sal_True,sal_True); - } - if (pSup) - ExportNodes(pSup, nLevel+1); - else - { - SvXMLElementExport aNone(*this,XML_NAMESPACE_MATH, XML_NONE, - sal_True,sal_True); - } - } - - //Seperator element between suffix and prefix sub/sup pairs - { - SvXMLElementExport aPrescripts(*this,XML_NAMESPACE_MATH, - XML_MPRESCRIPTS, sal_True,sal_True); - } - - if (pLSub) - ExportNodes(pLSub, nLevel+1); - else - { - SvXMLElementExport aNone(*this,XML_NAMESPACE_MATH, XML_NONE, - sal_True,sal_True); - - } - if (pLSup) - ExportNodes(pLSup, nLevel+1); - else - { - SvXMLElementExport aNone(*this,XML_NAMESPACE_MATH, XML_NONE, - sal_True,sal_True); - - } - } - else - { - if (NULL != (pSub = pNode->GetSubNode(RSUB+1)) && - NULL != (pSup = pNode->GetSubNode(RSUP+1))) - { - pThing = new SvXMLElementExport(*this,XML_NAMESPACE_MATH, - XML_MSUBSUP, sal_True,sal_True); - } - else if (NULL != (pSub = pNode->GetSubNode(RSUB+1))) - { - pThing = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,XML_MSUB, - sal_True,sal_True); - } - else if (NULL != (pSup = pNode->GetSubNode(RSUP+1))) - { - pThing = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,XML_MSUP, - sal_True,sal_True); - } - - if (NULL != (pCSub = pNode->GetSubNode(CSUB+1)) - && NULL != (pCSup=pNode->GetSubNode(CSUP+1))) - { - pThing2 = new SvXMLElementExport(*this,XML_NAMESPACE_MATH, - XML_MUNDEROVER, sal_True,sal_True); - } - else if (NULL != (pCSub = pNode->GetSubNode(CSUB+1))) - { - pThing2 = new SvXMLElementExport(*this,XML_NAMESPACE_MATH, - XML_MUNDER, sal_True,sal_True); - } - else if (NULL != (pCSup = pNode->GetSubNode(CSUP+1))) - { - pThing2 = new SvXMLElementExport(*this,XML_NAMESPACE_MATH, - XML_MOVER, sal_True,sal_True); - } - ExportNodes(pNode->GetSubNode(0), nLevel+1); //Main Term - - if (pCSub) - ExportNodes(pCSub, nLevel+1); - if (pCSup) - ExportNodes(pCSup, nLevel+1); - delete pThing2; - - if (pSub) - ExportNodes(pSub, nLevel+1); - if (pSup) - ExportNodes(pSup, nLevel+1); - delete pThing; - } -} - -void SmXMLExport::ExportBrace(const SmNode *pNode, int nLevel) -{ - const SmNode *pTemp; - const SmNode *pLeft=pNode->GetSubNode(0); - const SmNode *pRight=pNode->GetSubNode(2); - SvXMLElementExport *pFences=0,*pRow=0; - if ( ((pLeft) && (pLeft->GetToken().eType != TNONE)) && - ((pRight) && (pRight->GetToken().eType != TNONE)) && - (pNode->GetScaleMode() == SCALE_HEIGHT)) - { - sal_Unicode nArse[2]; - nArse[1] = 0; - nArse[0] = static_cast< - const SmMathSymbolNode* >(pLeft)->GetText().GetChar(0); - DBG_ASSERT(nArse[0] != 0xffff,"Non existant symbol"); - AddAttribute(XML_NAMESPACE_MATH,XML_OPEN,nArse); - nArse[0] = static_cast< - const SmMathSymbolNode* >(pRight)->GetText().GetChar(0); - DBG_ASSERT(nArse[0] != 0xffff,"Non existant symbol"); - AddAttribute(XML_NAMESPACE_MATH,XML_CLOSE,nArse); - pFences = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,XML_MFENCED, - sal_True,sal_True); - } - else if (pLeft && (pLeft->GetToken().eType != TNONE)) - { - pRow = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,XML_MROW, - sal_True, sal_True); - if (pNode->GetScaleMode() == SCALE_HEIGHT) - AddAttribute(XML_NAMESPACE_MATH,XML_STRETCHY,XML_TRUE); - else - AddAttribute(XML_NAMESPACE_MATH,XML_STRETCHY,XML_FALSE); - ExportNodes(pLeft,nLevel+1); - } - else - pRow = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,XML_MROW, - sal_True, sal_True); - - if (NULL != (pTemp = pNode->GetSubNode(1))) - ExportNodes(pTemp,nLevel+1); - if (pFences) - delete pFences; - else if (pRight && (pRight->GetToken().eType != TNONE)) - { - if (pNode->GetScaleMode() == SCALE_HEIGHT) - AddAttribute(XML_NAMESPACE_MATH,XML_STRETCHY,XML_TRUE); - else - AddAttribute(XML_NAMESPACE_MATH,XML_STRETCHY,XML_FALSE); - ExportNodes(pRight,nLevel+1); - } - delete pRow; -} - -void SmXMLExport::ExportRoot(const SmNode *pNode, int nLevel) -{ - if (pNode->GetSubNode(0)) - { - SvXMLElementExport aRoot(*this,XML_NAMESPACE_MATH,XML_MROOT,sal_True, - sal_True); - ExportNodes(pNode->GetSubNode(2),nLevel+1); - ExportNodes(pNode->GetSubNode(0),nLevel+1); - } - else - { - SvXMLElementExport aSqrt(*this,XML_NAMESPACE_MATH,XML_MSQRT,sal_True, - sal_True); - ExportNodes(pNode->GetSubNode(2),nLevel+1); - } -} - -void SmXMLExport::ExportOperator(const SmNode *pNode, int nLevel) -{ - /*we need to either use content or font and size attributes - *here*/ -#if 0 - { - SvXMLElementExport aMath(*this,XML_NAMESPACE_MATH,XML_MO, - sal_True,sal_False); - SmTextNode *pTemp = (SmTextNode *)pNode->GetSubNode(0); - GetDocHandler()->characters(pTemp->GetText()); - } -#endif - SvXMLElementExport aRow(*this,XML_NAMESPACE_MATH,XML_MROW, - sal_True, sal_True); - ExportNodes(pNode->GetSubNode(0),nLevel+1); - ExportNodes(pNode->GetSubNode(1),nLevel+1); -} - -void SmXMLExport::ExportAttributes(const SmNode *pNode, int nLevel) -{ - SvXMLElementExport *pElement=0; - - if (pNode->GetToken().eType == TUNDERLINE) - { - AddAttribute(XML_NAMESPACE_MATH,XML_ACCENTUNDER, - XML_TRUE); - pElement = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,XML_MUNDER, - sal_True,sal_True); - } - else if (pNode->GetToken().eType != TOVERSTRIKE) - { - AddAttribute(XML_NAMESPACE_MATH,XML_ACCENT, - XML_TRUE); - pElement = new SvXMLElementExport(*this,XML_NAMESPACE_MATH,XML_MOVER, - sal_True,sal_True); - } - - ExportNodes(pNode->GetSubNode(1),nLevel+1); - switch (pNode->GetToken().eType) - { - case TOVERLINE: - { - //proper entity support required - SvXMLElementExport aMath(*this,XML_NAMESPACE_MATH,XML_MO, - sal_True,sal_False); -#if 0 - GetDocHandler()->characters( - OUString(RTL_CONSTASCII_USTRINGPARAM("&overbar;"))); -#else - sal_Unicode nArse[2] = {0xAF,0x00}; -#endif - GetDocHandler()->characters(nArse); - } - break; - case TUNDERLINE: - { - //proper entity support required - SvXMLElementExport aMath(*this,XML_NAMESPACE_MATH,XML_MO, - sal_True,sal_False); -#if 0 - GetDocHandler()->characters( - OUString(RTL_CONSTASCII_USTRINGPARAM("&underbar;"))); -#else - sal_Unicode nArse[2] = {0x0332,0x00}; -#endif - GetDocHandler()->characters(nArse); - } - break; - case TOVERSTRIKE: - break; - default: - ExportNodes(pNode->GetSubNode(0),nLevel+1); - break; - } - delete pElement; -} - -void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel) -{ - SvXMLElementExport *pElement=0; - switch (pNode->GetToken().eType) - { - //wrap a phantom element around everything*/ - case TPHANTOM: - pElement = new SvXMLElementExport(*this,XML_NAMESPACE_MATH, - XML_MPHANTOM, sal_True,sal_True); - break; - case TBOLD: - AddAttribute(XML_NAMESPACE_MATH,XML_FONTWEIGHT, - XML_BOLD); - break; - case TITALIC: - AddAttribute(XML_NAMESPACE_MATH,XML_FONTSTYLE, - XML_ITALIC); - break; - case TNBOLD: - AddAttribute(XML_NAMESPACE_MATH,XML_FONTWEIGHT, - XML_WEIGHT_NORMAL); - break; - case TNITALIC: - AddAttribute(XML_NAMESPACE_MATH,XML_FONTSTYLE, - XML_WEIGHT_NORMAL); - break; - case TBLACK: - AddAttribute(XML_NAMESPACE_MATH,XML_COLOR, - XML_BLACK); - break; - case TWHITE: - AddAttribute(XML_NAMESPACE_MATH,XML_COLOR, - XML_WHITE); - break; - case TRED: - AddAttribute(XML_NAMESPACE_MATH,XML_COLOR, - XML_RED); - break; - case TGREEN: - AddAttribute(XML_NAMESPACE_MATH,XML_COLOR, - XML_GREEN); - break; - case TBLUE: - AddAttribute(XML_NAMESPACE_MATH,XML_COLOR, - XML_BLUE); - break; - case TCYAN: - AddAttribute(XML_NAMESPACE_MATH,XML_COLOR, - XML_AQUA); - break; - case TMAGENTA: - AddAttribute(XML_NAMESPACE_MATH,XML_COLOR, - XML_FUCHSIA); - break; - case TYELLOW: - AddAttribute(XML_NAMESPACE_MATH,XML_COLOR, - XML_YELLOW); - break; - case TSIZE: - { - const SmFontNode *pFontNode = static_cast<const SmFontNode *> - (pNode); - const Fraction &aFrac = pFontNode->GetSizeParameter(); - - OUStringBuffer sStrBuf; - switch(pFontNode->GetSizeType()) - { - case FNTSIZ_MULTIPLY: - SvXMLUnitConverter::convertDouble(sStrBuf, - static_cast<double>(aFrac*Fraction(100.00))); - sStrBuf.append(static_cast<sal_Unicode>('%')); - break; - case FNTSIZ_DIVIDE: - SvXMLUnitConverter::convertDouble(sStrBuf, - static_cast<double>(Fraction(100.00)/aFrac)); - sStrBuf.append(static_cast<sal_Unicode>('%')); - break; - case FNTSIZ_ABSOLUT: - SvXMLUnitConverter::convertDouble(sStrBuf, - static_cast<double>(aFrac)); - sStrBuf.append( - GetXMLToken(XML_UNIT_PT)); - break; - default: - { - //The problem here is that the wheels fall off because - //font size is stored in 100th's of a mm not pts, and - //rounding errors take their toll on the original - //value specified in points. - - //Must fix StarMath to retain the original pt values - Fraction aTemp = Sm100th_mmToPts(pFontNode->GetFont(). - GetSize().Height()); - - if (pFontNode->GetSizeType() == FNTSIZ_MINUS) - aTemp-=aFrac; - else - aTemp+=aFrac; - - double mytest = static_cast<double>(aTemp); - - mytest = ::rtl::math::round(mytest,1); - SvXMLUnitConverter::convertDouble(sStrBuf,mytest); - sStrBuf.append(GetXMLToken(XML_UNIT_PT)); - } - break; - } - - OUString sStr(sStrBuf.makeStringAndClear()); - AddAttribute(XML_NAMESPACE_MATH,XML_FONTSIZE,sStr); - } - break; - case TFIXED: - case TSANS: - case TSERIF: - AddAttribute(XML_NAMESPACE_MATH,XML_FONTFAMILY, - OUString(pNode->GetToken().aText.GetBuffer())); - break; - default: - break; - - } -#if 0 - if (pNode->GetNumSubNodes() > 1) //or in the future is a node that - //cannot take the currently supported - //properties -#endif - //for now we will just always export with a style and not worry about - //anyone else for the moment. - { - //wrap a style around it - SvXMLElementExport aStyle(*this,XML_NAMESPACE_MATH, - XML_MSTYLE, sal_True,sal_True); - ExportExpression(pNode,nLevel); - } -#if 0 - else - ExportNodes(pNode->GetSubNode(0),nLevel+1); -#endif - - delete pElement; -} - - -void SmXMLExport::ExportVerticalBrace(const SmNode *pNode, int nLevel) -{ - //Place the overbrace value OVER a vertical brace and then place that - //expression OVER the overbrace value, If someone can find a - //dedicated term in MathML to handle this overbrace/underbrace concept - //let me know. C. - XMLTokenEnum which; - - switch (pNode->GetToken().eType) - { - case TOVERBRACE: - default: - which = XML_MOVER; - break; - case TUNDERBRACE: - which = XML_MUNDER; - break; - } - - DBG_ASSERT(pNode->GetNumSubNodes()==3,"Bad Vertical Brace"); - SvXMLElementExport aOver1(*this,XML_NAMESPACE_MATH,which, sal_True, - sal_True); - {//Scoping - AddAttribute(XML_NAMESPACE_MATH,XML_ACCENT,XML_TRUE); - SvXMLElementExport aOver2(*this,XML_NAMESPACE_MATH,which, sal_True, - sal_True); - ExportNodes(pNode->GetSubNode(0),nLevel); - ExportNodes(pNode->GetSubNode(1),nLevel); - } - ExportNodes(pNode->GetSubNode(2),nLevel); -} - -void SmXMLExport::ExportMatrix(const SmNode *pNode, int nLevel) -{ - SvXMLElementExport aTable(*this,XML_NAMESPACE_MATH,XML_MTABLE, - sal_True, sal_True); - const SmMatrixNode *pMatrix = static_cast<const SmMatrixNode *>(pNode); - USHORT i=0; - for (ULONG y = 0; y < pMatrix->GetNumRows(); y++) - { - SvXMLElementExport aRow(*this,XML_NAMESPACE_MATH,XML_MTR, - sal_True, sal_True); - for (ULONG x = 0; x < pMatrix->GetNumCols(); x++) - if (const SmNode *pTemp = pNode->GetSubNode(i++)) - { - SvXMLElementExport aCell(*this,XML_NAMESPACE_MATH, - XML_MTD, sal_True, sal_True); - ExportNodes(pTemp,nLevel+1); - } - } -} - -void SmXMLExport::ExportNodes(const SmNode *pNode, int nLevel) -{ - if (!pNode) - return; - switch(pNode->GetType()) - { - case NTABLE: - ExportTable(pNode,nLevel); - break; - case NALIGN: - case NBRACEBODY: - case NEXPRESSION: - ExportExpression(pNode,nLevel); - break; - case NLINE: - ExportLine(pNode,nLevel); - break; - case NTEXT: - ExportText(pNode,nLevel); - break; - case NSPECIAL: //NSPECIAL requires some sort of Entity preservation in - //the XML engine. - case NMATH: - { - //To fully handle generic MathML we need to implement the full - //operator dictionary, we will generate MathML with explicit - //stretchiness for now. - sal_Int16 nLength = GetAttrList().getLength(); - sal_Bool bAddStretch=sal_True; - for( sal_Int16 i = 0; i < nLength; i++ ) - { - OUString sLocalName; - sal_uInt16 nPrefix = GetNamespaceMap().GetKeyByAttrName( - GetAttrList().getNameByIndex(i), &sLocalName ); - - if ( ( XML_NAMESPACE_MATH == nPrefix ) && - IsXMLToken(sLocalName, XML_STRETCHY) ) - { - bAddStretch = sal_False; - break; - } - } - if (bAddStretch) - { - AddAttribute(XML_NAMESPACE_MATH,XML_STRETCHY,XML_FALSE); - } - ExportMath(pNode,nLevel); - } - break; - case NBINHOR: - ExportBinaryHorizontal(pNode,nLevel); - break; - case NUNHOR: - ExportUnaryHorizontal(pNode,nLevel); - break; - case NBRACE: - ExportBrace(pNode,nLevel); - break; - case NBINVER: - ExportBinaryVertical(pNode,nLevel); - break; - case NSUBSUP: - ExportSubSupScript(pNode,nLevel); - break; - case NROOT: - ExportRoot(pNode,nLevel); - break; - case NOPER: - ExportOperator(pNode,nLevel); - break; - case NATTRIBUT: - ExportAttributes(pNode,nLevel); - break; - case NFONT: - ExportFont(pNode,nLevel); - break; - case NVERTICAL_BRACE: - ExportVerticalBrace(pNode,nLevel); - break; - case NMATRIX: - ExportMatrix(pNode,nLevel); - break; - case NBLANK: - ExportBlank(pNode,nLevel); - break; - default: - break; - -#if 0 - default: - { - ULONG nSize = pNode->GetNumSubNodes(); - for (ULONG i = 0; i < nSize; i++) - if (SmNode *pTemp = pNode->GetSubNode(i)) - ExportNodes(pTemp,nLevel+1); - } - break; -#endif - } -} +/*************************************************************************
+ *
+ * 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: x $
+ * $Revision: 1.00 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_starmath.hxx"
+
+/*todo: Change characters and tcharacters to accumulate the characters together
+into one string, xml parser hands them to us line by line rather than all in
+one go*/
+
+#include <com/sun/star/xml/sax/XErrorHandler.hpp>
+#include <com/sun/star/xml/sax/XEntityResolver.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XDTDHandler.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/uno/Any.h>
+
+#include <rtl/math.hxx>
+#include <sfx2/frame.hxx>
+#include <sfx2/docfile.hxx>
+#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/processfactory.hxx>
+#include <unotools/streamwrap.hxx>
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmltoken.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/attrlist.hxx>
+#include <xmloff/xmluconv.hxx>
+#include <xmloff/xmlmetai.hxx>
+#include <osl/mutex.hxx>
+#include <comphelper/genericpropertyset.hxx>
+
+#include <memory>
+
+#include "mathmlimport.hxx"
+#include "mathtype.hxx"
+#include <starmath.hrc>
+#include <unomodel.hxx>
+#include <document.hxx>
+#include <utility.hxx>
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::xmloff::token;
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+#define IMPORT_SVC_NAME RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.XMLImportFilter")
+
+#undef WANTEXCEPT
+
+////////////////////////////////////////////////////////////
+
+ULONG SmXMLImportWrapper::Import(SfxMedium &rMedium)
+{
+ ULONG nError = ERRCODE_SFX_DOLOADFAILED;
+
+ uno::Reference<lang::XMultiServiceFactory> xServiceFactory(
+ utl::getProcessServiceFactory());
+ DBG_ASSERT(xServiceFactory.is(), "XMLReader::Read: got no service manager");
+ if ( !xServiceFactory.is() )
+ return nError;
+
+ //Make a model component from our SmModel
+ uno::Reference< lang::XComponent > xModelComp( xModel, uno::UNO_QUERY );
+ DBG_ASSERT( xModelComp.is(), "XMLReader::Read: got no model" );
+
+ // try to get an XStatusIndicator from the Medium
+ uno::Reference<task::XStatusIndicator> xStatusIndicator;
+
+ sal_Bool bEmbedded = sal_False;
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ SmDocShell *pDocShell = pModel ?
+ static_cast<SmDocShell*>(pModel->GetObjectShell()) : 0;
+ if (pDocShell)
+ {
+// if (pDocShell->GetMedium())
+ {
+ DBG_ASSERT( pDocShell->GetMedium() == &rMedium,
+ "different SfxMedium found" );
+
+ SfxItemSet* pSet = rMedium.GetItemSet();
+ if (pSet)
+ {
+ const SfxUnoAnyItem* pItem = static_cast<const SfxUnoAnyItem*>(
+ pSet->GetItem(SID_PROGRESS_STATUSBAR_CONTROL) );
+ if (pItem)
+ pItem->GetValue() >>= xStatusIndicator;
+ }
+ }
+
+ if ( SFX_CREATE_MODE_EMBEDDED == pDocShell->GetCreateMode() )
+ bEmbedded = sal_True;
+ }
+
+ comphelper::PropertyMapEntry aInfoMap[] =
+ {
+ { "PrivateData", sizeof("PrivateData")-1, 0,
+ &::getCppuType( (Reference<XInterface> *)0 ),
+ beans::PropertyAttribute::MAYBEVOID, 0 },
+ { "BaseURI", sizeof("BaseURI")-1, 0,
+ &::getCppuType( (OUString *)0 ),
+ beans::PropertyAttribute::MAYBEVOID, 0 },
+ { "StreamRelPath", sizeof("StreamRelPath")-1, 0,
+ &::getCppuType( (OUString *)0 ),
+ beans::PropertyAttribute::MAYBEVOID, 0 },
+ { "StreamName", sizeof("StreamName")-1, 0,
+ &::getCppuType( (OUString *)0 ),
+ beans::PropertyAttribute::MAYBEVOID, 0 },
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
+ uno::Reference< beans::XPropertySet > xInfoSet(
+ comphelper::GenericPropertySet_CreateInstance(
+ new comphelper::PropertySetInfo( aInfoMap ) ) );
+
+ // Set base URI
+ OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("BaseURI") );
+ xInfoSet->setPropertyValue( sPropName, makeAny( rMedium.GetBaseURL() ) );
+
+ sal_Int32 nSteps=3;
+ if ( !(rMedium.IsStorage()))
+ nSteps = 1;
+
+ sal_Int32 nProgressRange(nSteps);
+ if (xStatusIndicator.is())
+ {
+ xStatusIndicator->start(String(SmResId(STR_STATSTR_READING)),
+ nProgressRange);
+ }
+
+ nSteps=0;
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ if ( rMedium.IsStorage())
+ {
+ // TODO/LATER: handle the case of embedded links gracefully
+ if ( bEmbedded ) // && !rMedium.GetStorage()->IsRoot() )
+ {
+ OUString aName( RTL_CONSTASCII_USTRINGPARAM( "dummyObjName" ) );
+ if ( rMedium.GetItemSet() )
+ {
+ const SfxStringItem* pDocHierarchItem = static_cast<const SfxStringItem*>(
+ rMedium.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME) );
+ if ( pDocHierarchItem )
+ aName = pDocHierarchItem->GetValue();
+ }
+
+ if ( aName.getLength() )
+ {
+ sPropName = OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath"));
+ xInfoSet->setPropertyValue( sPropName, makeAny( aName ) );
+ }
+ }
+
+ sal_Bool bOASIS = ( SotStorage::GetVersion( rMedium.GetStorage() ) > SOFFICE_FILEFORMAT_60 );
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ ULONG nWarn = ReadThroughComponent(
+ rMedium.GetStorage(), xModelComp, "meta.xml", "Meta.xml",
+ xServiceFactory, xInfoSet,
+ (bOASIS ? "com.sun.star.comp.Math.XMLOasisMetaImporter"
+ : "com.sun.star.comp.Math.XMLMetaImporter") );
+
+ if ( nWarn != ERRCODE_IO_BROKENPACKAGE )
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ nWarn = ReadThroughComponent(
+ rMedium.GetStorage(), xModelComp, "settings.xml", 0,
+ xServiceFactory, xInfoSet,
+ (bOASIS ? "com.sun.star.comp.Math.XMLOasisSettingsImporter"
+ : "com.sun.star.comp.Math.XMLSettingsImporter" ) );
+
+ if ( nWarn != ERRCODE_IO_BROKENPACKAGE )
+ {
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ nError = ReadThroughComponent(
+ rMedium.GetStorage(), xModelComp, "content.xml", "Content.xml",
+ xServiceFactory, xInfoSet, "com.sun.star.comp.Math.XMLImporter" );
+ }
+ else
+ nError = ERRCODE_IO_BROKENPACKAGE;
+ }
+ else
+ nError = ERRCODE_IO_BROKENPACKAGE;
+ }
+ else
+ {
+ Reference<io::XInputStream> xInputStream =
+ new utl::OInputStreamWrapper(rMedium.GetInStream());
+
+ if (xStatusIndicator.is())
+ xStatusIndicator->setValue(nSteps++);
+
+ nError = ReadThroughComponent( xInputStream, xModelComp,
+ xServiceFactory, xInfoSet, "com.sun.star.comp.Math.XMLImporter", FALSE );
+ }
+
+ if (xStatusIndicator.is())
+ xStatusIndicator->end();
+ return nError;
+}
+
+
+/// read a component (file + filter version)
+ULONG SmXMLImportWrapper::ReadThroughComponent(
+ Reference<io::XInputStream> xInputStream,
+ Reference<XComponent> xModelComponent,
+ Reference<lang::XMultiServiceFactory> & rFactory,
+ Reference<beans::XPropertySet> & rPropSet,
+ const sal_Char* pFilterName,
+ sal_Bool bEncrypted )
+{
+ ULONG nError = ERRCODE_SFX_DOLOADFAILED;
+ DBG_ASSERT(xInputStream.is(), "input stream missing");
+ DBG_ASSERT(xModelComponent.is(), "document missing");
+ DBG_ASSERT(rFactory.is(), "factory missing");
+ DBG_ASSERT(NULL != pFilterName,"I need a service name for the component!");
+
+ // prepare ParserInputSrouce
+ xml::sax::InputSource aParserInput;
+ aParserInput.aInputStream = xInputStream;
+
+ // get parser
+ Reference< xml::sax::XParser > xParser(
+ rFactory->createInstance(
+ OUString::createFromAscii("com.sun.star.xml.sax.Parser") ),
+ UNO_QUERY );
+ DBG_ASSERT( xParser.is(), "Can't create parser" );
+ if ( !xParser.is() )
+ return nError;
+
+ Sequence<Any> aArgs( 1 );
+ aArgs[0] <<= rPropSet;
+
+ // get filter
+ Reference< xml::sax::XDocumentHandler > xFilter(
+ rFactory->createInstanceWithArguments(
+ OUString::createFromAscii(pFilterName), aArgs ),
+ UNO_QUERY );
+ DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." );
+ if ( !xFilter.is() )
+ return nError;
+
+ // connect parser and filter
+ xParser->setDocumentHandler( xFilter );
+
+ // connect model and filter
+ Reference < XImporter > xImporter( xFilter, UNO_QUERY );
+ xImporter->setTargetDocument( xModelComponent );
+
+ // finally, parser the stream
+ try
+ {
+ xParser->parseStream( aParserInput );
+
+ uno::Reference<lang::XUnoTunnel> xFilterTunnel;
+ xFilterTunnel = uno::Reference<lang::XUnoTunnel>
+ ( xFilter, uno::UNO_QUERY );
+ SmXMLImport *pFilter = reinterpret_cast< SmXMLImport * >(
+ sal::static_int_cast< sal_uIntPtr >(
+ xFilterTunnel->getSomething( SmXMLImport::getUnoTunnelId() )));
+ if ( pFilter && pFilter->GetSuccess() )
+ nError = 0;
+ }
+ catch( xml::sax::SAXParseException& )
+ {
+ if ( bEncrypted )
+ nError = ERRCODE_SFX_WRONGPASSWORD;
+ }
+ catch( xml::sax::SAXException& )
+ {
+ if ( bEncrypted )
+ nError = ERRCODE_SFX_WRONGPASSWORD;
+ }
+ catch( packages::zip::ZipIOException& )
+ {
+ nError = ERRCODE_IO_BROKENPACKAGE;
+ }
+ catch( io::IOException& )
+ {
+ }
+
+ return nError;
+}
+
+
+ULONG SmXMLImportWrapper::ReadThroughComponent(
+ const uno::Reference< embed::XStorage >& xStorage,
+ Reference<XComponent> xModelComponent,
+ const sal_Char* pStreamName,
+ const sal_Char* pCompatibilityStreamName,
+ Reference<lang::XMultiServiceFactory> & rFactory,
+ Reference<beans::XPropertySet> & rPropSet,
+ const sal_Char* pFilterName )
+{
+ DBG_ASSERT(xStorage.is(), "Need storage!");
+ DBG_ASSERT(NULL != pStreamName, "Please, please, give me a name!");
+
+ // open stream (and set parser input)
+ OUString sStreamName = OUString::createFromAscii(pStreamName);
+ uno::Reference < container::XNameAccess > xAccess( xStorage, uno::UNO_QUERY );
+ if ( !xAccess->hasByName(sStreamName) || !xStorage->isStreamElement(sStreamName) )
+ {
+ // stream name not found! Then try the compatibility name.
+ // do we even have an alternative name?
+ if ( pCompatibilityStreamName )
+ sStreamName = OUString::createFromAscii(pCompatibilityStreamName);
+ }
+
+ // get input stream
+ try
+ {
+ uno::Reference < io::XStream > xEventsStream = xStorage->openStreamElement( sStreamName, embed::ElementModes::READ );
+
+ // determine if stream is encrypted or not
+ uno::Reference < beans::XPropertySet > xProps( xEventsStream, uno::UNO_QUERY );
+ Any aAny = xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Encrypted") ) );
+ sal_Bool bEncrypted = sal_False;
+ if ( aAny.getValueType() == ::getBooleanCppuType() )
+ aAny >>= bEncrypted;
+
+ // set Base URL
+ if ( rPropSet.is() )
+ {
+ OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("StreamName") );
+ rPropSet->setPropertyValue( sPropName, makeAny( sStreamName ) );
+ }
+
+
+ Reference < io::XInputStream > xStream = xEventsStream->getInputStream();
+ return ReadThroughComponent( xStream, xModelComponent, rFactory, rPropSet, pFilterName, bEncrypted );
+ }
+ catch ( packages::WrongPasswordException& )
+ {
+ return ERRCODE_SFX_WRONGPASSWORD;
+ }
+ catch( packages::zip::ZipIOException& )
+ {
+ return ERRCODE_IO_BROKENPACKAGE;
+ }
+ catch ( uno::Exception& )
+ {
+ }
+
+ return ERRCODE_SFX_DOLOADFAILED;
+}
+
+////////////////////////////////////////////////////////////
+
+SmXMLImport::SmXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ sal_uInt16 nImportFlags)
+: SvXMLImport( xServiceFactory, nImportFlags ),
+ pPresLayoutElemTokenMap(0),
+ pPresLayoutAttrTokenMap(0),
+ pFencedAttrTokenMap(0),
+ pOperatorAttrTokenMap(0),
+ pAnnotationAttrTokenMap(0),
+ pPresElemTokenMap(0),
+ pPresScriptEmptyElemTokenMap(0),
+ pPresTableElemTokenMap(0),
+ pColorTokenMap(0),
+ bSuccess(sal_False)
+{
+}
+
+const uno::Sequence< sal_Int8 > & SmXMLImport::getUnoTunnelId() throw()
+{
+ static uno::Sequence< sal_Int8 > * pSeq = 0;
+ if ( !pSeq )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if ( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+OUString SAL_CALL SmXMLImport_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLImporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLImport_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( IMPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLImport_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLImport(IMPORT_ALL);
+ return (cppu::OWeakObject*)new SmXMLImport(rSMgr, IMPORT_ALL);
+}
+
+////////////////////////////////////////////////////////////
+
+OUString SAL_CALL SmXMLImportMeta_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLOasisMetaImporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLImportMeta_getSupportedServiceNames()
+throw()
+{
+ const OUString aServiceName( IMPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLImportMeta_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLImport( IMPORT_META );
+ return (cppu::OWeakObject*)new SmXMLImport( rSMgr, IMPORT_META );
+}
+
+////////////////////////////////////////////////////////////
+
+OUString SAL_CALL SmXMLImportSettings_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Math.XMLOasisSettingsImporter" ) );
+}
+
+uno::Sequence< OUString > SAL_CALL SmXMLImportSettings_getSupportedServiceNames()
+ throw()
+{
+ const OUString aServiceName( IMPORT_SVC_NAME );
+ const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SmXMLImportSettings_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr)
+ throw( uno::Exception )
+{
+ // #110680#
+ // return (cppu::OWeakObject*)new SmXMLImport( IMPORT_SETTINGS );
+ return (cppu::OWeakObject*)new SmXMLImport( rSMgr, IMPORT_SETTINGS );
+}
+
+////////////////////////////////////////////////////////////
+
+// XServiceInfo
+// override empty method from parent class
+rtl::OUString SAL_CALL SmXMLImport::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ OUString aTxt;
+ switch( getImportFlags() )
+ {
+ case IMPORT_META:
+ aTxt = SmXMLImportMeta_getImplementationName();
+ break;
+ case IMPORT_SETTINGS:
+ aTxt = SmXMLImportSettings_getImplementationName();
+ break;
+ case IMPORT_ALL:
+ default:
+ aTxt = SmXMLImport_getImplementationName();
+ break;
+ }
+ return aTxt;
+}
+
+
+sal_Int64 SAL_CALL SmXMLImport::getSomething(
+ const uno::Sequence< sal_Int8 >&rId )
+throw(uno::RuntimeException)
+{
+ if ( rId.getLength() == 16 &&
+ 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this));
+
+ return SvXMLImport::getSomething( rId );
+}
+
+void SmXMLImport::endDocument(void)
+ throw(xml::sax::SAXException, uno::RuntimeException)
+{
+ //Set the resulted tree into the SmDocShell where it belongs
+ SmNode *pTree;
+ if (NULL != (pTree = GetTree()))
+ {
+ uno::Reference <frame::XModel> xModel = GetModel();
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ if (pModel)
+ {
+ SmDocShell *pDocShell =
+ static_cast<SmDocShell*>(pModel->GetObjectShell());
+ pDocShell->SetFormulaTree(pTree);
+ if (0 == aText.Len()) //If we picked up no annotation text
+ {
+ //Make up some editable text
+ aText = pDocShell->GetText();
+ pTree->CreateTextFromNode(aText);
+ aText.EraseTrailingChars();
+ if ((aText.GetChar(0) == '{') &&
+ (aText.GetChar(aText.Len()-1) == '}'))
+ {
+ aText.Erase(0,1);
+ aText.Erase(aText.Len()-1,1);
+ }
+ }
+ pDocShell->SetText( String() );
+
+ // Convert symbol names
+ SmParser &rParser = pDocShell->GetParser();
+ BOOL bVal = rParser.IsImportSymbolNames();
+ rParser.SetImportSymbolNames( TRUE );
+ SmNode *pTmpTree = rParser.Parse( aText );
+ aText = rParser.GetText();
+ delete pTmpTree;
+ rParser.SetImportSymbolNames( bVal );
+
+ pDocShell->SetText( aText );
+ }
+ DBG_ASSERT(pModel,"So there *was* a uno problem after all");
+
+ bSuccess = sal_True;
+ }
+
+ SvXMLImport::endDocument();
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLImportContext: public SvXMLImportContext
+{
+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*/);
+};
+
+void SmXMLImportContext::TCharacters(const OUString & /*rChars*/)
+{
+}
+
+void SmXMLImportContext::Characters(const OUString &rChars)
+{
+ /*
+ Whitespace occurring within the content of token elements is "trimmed"
+ from the ends (i.e. all whitespace at the beginning and end of the
+ content is removed), and "collapsed" internally (i.e. each sequence of
+ 1 or more whitespace characters is replaced with one blank character).
+ */
+ //collapsing not done yet!
+ const OUString &rChars2 = rChars.trim();
+ if (rChars2.getLength())
+ TCharacters(rChars2/*.collapse()*/);
+}
+
+SvXMLImportContext * SmXMLImportContext::CreateChildContext(sal_uInt16 /*nPrefix*/,
+ const OUString& /*rLocalName*/,
+ const uno::Reference< xml::sax::XAttributeList > & /*xAttrList*/)
+{
+ return 0;
+}
+
+////////////////////////////////////////////////////////////
+
+struct SmXMLContext_Helper
+{
+ sal_Int8 nIsBold;
+ sal_Int8 nIsItalic;
+ double nFontSize;
+ sal_Bool bFontNodeNeeded;
+ OUString sFontFamily;
+ OUString sColor;
+
+ SmXMLImportContext rContext;
+
+ SmXMLContext_Helper(SmXMLImportContext &rImport) :
+ nIsBold(-1), nIsItalic(-1), nFontSize(0.0), rContext(rImport) {}
+
+ void RetrieveAttrs(const uno::Reference< xml::sax::XAttributeList > &xAttrList );
+ void ApplyAttrs();
+};
+
+void SmXMLContext_Helper::RetrieveAttrs(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+ sal_Int8 nOldIsBold=nIsBold;
+ sal_Int8 nOldIsItalic=nIsItalic;
+ double nOldFontSize=nFontSize;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ OUString sOldFontFamily = sFontFamily;
+ for (sal_Int16 i=0;i<nAttrCount;i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rContext.GetSmImport().GetNamespaceMap().
+ GetKeyByAttrName(sAttrName,&aLocalName);
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap &rAttrTokenMap =
+ rContext.GetSmImport().GetPresLayoutAttrTokenMap();
+ switch(rAttrTokenMap.Get(nPrefix,aLocalName))
+ {
+ case XML_TOK_FONTWEIGHT:
+ nIsBold = sValue.equals(GetXMLToken(XML_BOLD));
+ break;
+ case XML_TOK_FONTSTYLE:
+ nIsItalic = sValue.equals(GetXMLToken(XML_ITALIC));
+ break;
+ case XML_TOK_FONTSIZE:
+ SvXMLUnitConverter::convertDouble(nFontSize,sValue);
+ rContext.GetSmImport().GetMM100UnitConverter().
+ setXMLMeasureUnit(MAP_POINT);
+ if (-1 == sValue.indexOf(GetXMLToken(XML_UNIT_PT)))
+ {
+ if (-1 == sValue.indexOf('%'))
+ nFontSize=0.0;
+ else
+ {
+ rContext.GetSmImport().GetMM100UnitConverter().
+ setXMLMeasureUnit(MAP_RELATIVE);
+ }
+ }
+ break;
+ case XML_TOK_FONTFAMILY:
+ sFontFamily = sValue;
+ break;
+ case XML_TOK_COLOR:
+ sColor = sValue;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if ((nOldIsBold!=nIsBold) || (nOldIsItalic!=nIsItalic) ||
+ (nOldFontSize!=nFontSize) || (sOldFontFamily!=sFontFamily)
+ || sColor.getLength())
+ bFontNodeNeeded=sal_True;
+ else
+ bFontNodeNeeded=sal_False;
+}
+
+void SmXMLContext_Helper::ApplyAttrs()
+{
+ SmNodeStack &rNodeStack = rContext.GetSmImport().GetNodeStack();
+
+ if (bFontNodeNeeded)
+ {
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+
+ if (nIsBold != -1)
+ {
+ if (nIsBold)
+ aToken.eType = TBOLD;
+ else
+ aToken.eType = TNBOLD;
+ SmStructureNode *pFontNode = static_cast<SmStructureNode *>
+ (new SmFontNode(aToken));
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (nIsItalic != -1)
+ {
+ if (nIsItalic)
+ aToken.eType = TITALIC;
+ else
+ aToken.eType = TNITALIC;
+ SmStructureNode *pFontNode = static_cast<SmStructureNode *>
+ (new SmFontNode(aToken));
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (nFontSize != 0.0)
+ {
+ aToken.eType = TSIZE;
+ SmFontNode *pFontNode = new SmFontNode(aToken);
+
+ if (MAP_RELATIVE == rContext.GetSmImport().GetMM100UnitConverter().
+ getXMLMeasureUnit())
+ {
+ if (nFontSize < 100.00)
+ pFontNode->SetSizeParameter(Fraction(100.00/nFontSize),
+ FNTSIZ_DIVIDE);
+ else
+ pFontNode->SetSizeParameter(Fraction(nFontSize/100.00),
+ FNTSIZ_MULTIPLY);
+ }
+ else
+ pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT);
+
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (sFontFamily.getLength())
+ {
+ if (sFontFamily.equalsIgnoreAsciiCase(GetXMLToken(XML_FIXED)))
+ aToken.eType = TFIXED;
+ else if (sFontFamily.equalsIgnoreAsciiCase(OUString(
+ RTL_CONSTASCII_USTRINGPARAM("sans"))))
+ aToken.eType = TSANS;
+ else if (sFontFamily.equalsIgnoreAsciiCase(OUString(
+ RTL_CONSTASCII_USTRINGPARAM("serif"))))
+ aToken.eType = TSERIF;
+ else //Just give up, we need to extend our font mechanism to be
+ //more general
+ return;
+
+ aToken.aText = sFontFamily;
+ SmFontNode *pFontNode = new SmFontNode(aToken);
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (sColor.getLength())
+ {
+ //Again we can only handle a small set of colours in
+ //StarMath for now.
+ const SvXMLTokenMap& rTokenMap =
+ rContext.GetSmImport().GetColorTokenMap();
+ aToken.eType = static_cast<SmTokenType>(rTokenMap.Get(
+ XML_NAMESPACE_MATH, sColor));
+ if (aToken.eType != -1)
+ {
+ SmFontNode *pFontNode = new SmFontNode(aToken);
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ }
+
+ }
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLDocContext_Impl : public SmXMLImportContext
+{
+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();
+};
+
+////////////////////////////////////////////////////////////
+
+/*avert thy gaze from the proginator*/
+class SmXMLRowContext_Impl : public SmXMLDocContext_Impl
+{
+protected:
+ ULONG nElementCount;
+
+public:
+ SmXMLRowContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ 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();
+};
+
+////////////////////////////////////////////////////////////
+
+class SmXMLFracContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLFracContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+
+ void EndElement();
+};
+
+////////////////////////////////////////////////////////////
+
+class SmXMLSqrtContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLSqrtContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+
+ void EndElement();
+};
+
+////////////////////////////////////////////////////////////
+
+class SmXMLRootContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLRootContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+
+ void EndElement();
+};
+
+////////////////////////////////////////////////////////////
+
+class SmXMLStyleContext_Impl : public SmXMLRowContext_Impl
+{
+protected:
+ SmXMLContext_Helper aStyleHelper;
+
+public:
+ /*Right now the style tag is completely ignored*/
+ 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 );
+};
+
+void SmXMLStyleContext_Impl::StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+#if 1
+ aStyleHelper.RetrieveAttrs(xAttrList);
+#else
+ sal_Int8 nOldIsBold=nIsBold;
+ sal_Int8 nOldIsItalic=nIsItalic;
+ double nOldFontSize=nFontSize;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ OUString sOldFontFamily = sFontFamily;
+ for (sal_Int16 i=0;i<nAttrCount;i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName(sAttrName,&aLocalName);
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap &rAttrTokenMap =
+ GetSmImport().GetPresLayoutAttrTokenMap();
+ switch(rAttrTokenMap.Get(nPrefix,aLocalName))
+ {
+ case XML_TOK_FONTWEIGHT:
+ nIsBold = sValue.equals(GetXMLToken(XML_BOLD));
+ break;
+ case XML_TOK_FONTSTYLE:
+ nIsItalic = sValue.equals(GetXMLToken(XML_ITALIC));
+ break;
+ case XML_TOK_FONTSIZE:
+ SvXMLUnitConverter::convertDouble(nFontSize,sValue);
+ GetSmImport().GetMM100UnitConverter().
+ setXMLMeasureUnit(MAP_POINT);
+ if (-1 == sValue.indexOf(GetXMLToken(XML_UNIT_PT)))
+ if (-1 == sValue.indexOf('%'))
+ nFontSize=0.0;
+ else
+ {
+ GetSmImport().GetMM100UnitConverter().
+ setXMLMeasureUnit(MAP_RELATIVE);
+ }
+ break;
+ case XML_TOK_FONTFAMILY:
+ sFontFamily = sValue;
+ break;
+ case XML_TOK_COLOR:
+ sColor = sValue;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if ((nOldIsBold!=nIsBold) || (nOldIsItalic!=nIsItalic) ||
+ (nOldFontSize!=nFontSize) || (sOldFontFamily!=sFontFamily)
+ || sColor.getLength())
+ bFontNodeNeeded=sal_True;
+ else
+ bFontNodeNeeded=sal_False;
+#endif
+}
+
+
+void SmXMLStyleContext_Impl::EndElement()
+{
+ /*
+ <mstyle> accepts any number of arguments; if this number is not 1, its
+ contents are treated as a single "inferred <mrow>" containing its
+ arguments
+ */
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ if (rNodeStack.Count() - nElementCount > 1)
+ SmXMLRowContext_Impl::EndElement();
+#if 1
+ aStyleHelper.ApplyAttrs();
+#else
+ if (bFontNodeNeeded)
+ {
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+
+ if (nIsBold != -1)
+ {
+ if (nIsBold)
+ aToken.eType = TBOLD;
+ else
+ aToken.eType = TNBOLD;
+ SmStructureNode *pFontNode = static_cast<SmStructureNode *>
+ (new SmFontNode(aToken));
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (nIsItalic != -1)
+ {
+ if (nIsItalic)
+ aToken.eType = TITALIC;
+ else
+ aToken.eType = TNITALIC;
+ SmStructureNode *pFontNode = static_cast<SmStructureNode *>
+ (new SmFontNode(aToken));
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (nFontSize != 0.0)
+ {
+ aToken.eType = TSIZE;
+ SmFontNode *pFontNode = new SmFontNode(aToken);
+
+ if (MAP_RELATIVE == GetSmImport().GetMM100UnitConverter().
+ getXMLMeasureUnit())
+ {
+ if (nFontSize < 100.00)
+ pFontNode->SetSizeParameter(Fraction(100.00/nFontSize),
+ FNTSIZ_DIVIDE);
+ else
+ pFontNode->SetSizeParameter(Fraction(nFontSize/100.00),
+ FNTSIZ_MULTIPLY);
+ }
+ else
+ pFontNode->SetSizeParameter(Fraction(nFontSize),FNTSIZ_ABSOLUT);
+
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (sFontFamily.getLength())
+ {
+ if (sFontFamily.equalsIgnoreCase(GetXMLToken(XML_FIXED)))
+ aToken.eType = TFIXED;
+ else if (sFontFamily.equalsIgnoreCase(OUString(
+ RTL_CONSTASCII_USTRINGPARAM("sans"))))
+ aToken.eType = TSANS;
+ else if (sFontFamily.equalsIgnoreCase(OUString(
+ RTL_CONSTASCII_USTRINGPARAM("serif"))))
+ aToken.eType = TSERIF;
+ else //Just give up, we need to extend our font mechanism to be
+ //more general
+ return;
+
+ aToken.aText = sFontFamily;
+ SmFontNode *pFontNode = new SmFontNode(aToken);
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ if (sColor.getLength())
+ {
+ //Again we can only handle a small set of colours in
+ //StarMath for now.
+ const SvXMLTokenMap& rTokenMap =
+ GetSmImport().GetColorTokenMap();
+ aToken.eType = static_cast<SmTokenType>(rTokenMap.Get(
+ XML_NAMESPACE_MATH, sColor));
+ if (aToken.eType != -1)
+ {
+ SmFontNode *pFontNode = new SmFontNode(aToken);
+ pFontNode->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pFontNode);
+ }
+ }
+
+ }
+#endif
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLPaddedContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ /*Right now the style tag is completely ignored*/
+ SmXMLPaddedContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+
+ void EndElement();
+};
+
+void SmXMLPaddedContext_Impl::EndElement()
+{
+ /*
+ <mpadded> accepts any number of arguments; if this number is not 1, its
+ contents are treated as a single "inferred <mrow>" containing its
+ arguments
+ */
+ if (GetSmImport().GetNodeStack().Count() - nElementCount > 1)
+ SmXMLRowContext_Impl::EndElement();
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLPhantomContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ /*Right now the style tag is completely ignored*/
+ SmXMLPhantomContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+
+ void EndElement();
+};
+
+void SmXMLPhantomContext_Impl::EndElement()
+{
+ /*
+ <mphantom> accepts any number of arguments; if this number is not 1, its
+ contents are treated as a single "inferred <mrow>" containing its
+ arguments
+ */
+ if (GetSmImport().GetNodeStack().Count() - nElementCount > 1)
+ SmXMLRowContext_Impl::EndElement();
+
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+ aToken.eType = TPHANTOM;
+
+ SmStructureNode *pPhantom = static_cast<SmStructureNode *>
+ (new SmFontNode(aToken));
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ pPhantom->SetSubNodes(0,rNodeStack.Pop());
+ rNodeStack.Push(pPhantom);
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLFencedContext_Impl : public SmXMLRowContext_Impl
+{
+protected:
+ sal_Unicode cBegin;
+ sal_Unicode cEnd;
+
+public:
+ SmXMLFencedContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName),
+ cBegin('('), cEnd(')') {}
+
+ void StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList );
+ void EndElement();
+};
+
+
+void SmXMLFencedContext_Impl::StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for (sal_Int16 i=0;i<nAttrCount;i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName(sAttrName,&aLocalName);
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap &rAttrTokenMap =
+ GetSmImport().GetFencedAttrTokenMap();
+ switch(rAttrTokenMap.Get(nPrefix,aLocalName))
+ {
+ //temp, starmath cannot handle multichar brackets (I think)
+ case XML_TOK_OPEN:
+ cBegin = sValue[0];
+ break;
+ case XML_TOK_CLOSE:
+ cEnd = sValue[0];
+ break;
+ default:
+ /*Go to superclass*/
+ break;
+ }
+ }
+}
+
+
+void SmXMLFencedContext_Impl::EndElement()
+{
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.aText = ',';
+ aToken.eType = TLEFT;
+ aToken.nLevel = 5;
+
+ aToken.eType = TLPARENT;
+ aToken.cMathChar = cBegin;
+ SmStructureNode *pSNode = new SmBraceNode(aToken);
+ SmNode *pLeft = new SmMathSymbolNode(aToken);
+
+ aToken.cMathChar = cEnd;
+ aToken.eType = TRPARENT;
+ SmNode *pRight = new SmMathSymbolNode(aToken);
+
+ SmNodeArray aRelationArray;
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+
+ aToken.cMathChar = '\0';
+ aToken.aText = ',';
+ aToken.eType = TIDENT;
+
+ ULONG i = rNodeStack.Count() - nElementCount;
+ if (rNodeStack.Count() - nElementCount > 1)
+ i += rNodeStack.Count() - 1 - nElementCount;
+ aRelationArray.resize(i);
+ while (rNodeStack.Count() > nElementCount)
+ {
+ aRelationArray[--i] = rNodeStack.Pop();
+ if (i > 1 && rNodeStack.Count() > 1)
+ aRelationArray[--i] = new SmGlyphSpecialNode(aToken);
+ }
+
+ SmToken aDummy;
+ SmStructureNode *pBody = new SmExpressionNode(aDummy);
+ pBody->SetSubNodes(aRelationArray);
+
+
+ pSNode->SetSubNodes(pLeft,pBody,pRight);
+ pSNode->SetScaleMode(SCALE_HEIGHT);
+ GetSmImport().GetNodeStack().Push(pSNode);
+}
+
+
+////////////////////////////////////////////////////////////
+
+class SmXMLErrorContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLErrorContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+
+ void EndElement();
+};
+
+void SmXMLErrorContext_Impl::EndElement()
+{
+ /*Right now the error tag is completely ignored, what
+ can I do with it in starmath, ?, maybe we need a
+ report window ourselves, do a test for validity of
+ the xml input, use merrors, and then generate
+ the markup inside the merror with a big red colour
+ of something. For now just throw them all away.
+ */
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ while (rNodeStack.Count() > nElementCount)
+ {
+ SmNode *pNode = rNodeStack.Pop();
+ delete pNode;
+ }
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLNumberContext_Impl : public SmXMLImportContext
+{
+protected:
+ SmToken aToken;
+
+public:
+ SmXMLNumberContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName)
+ {
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+ aToken.eType = TNUMBER;
+ }
+
+ virtual void TCharacters(const OUString &rChars);
+
+ void EndElement();
+};
+
+void SmXMLNumberContext_Impl::TCharacters(const OUString &rChars)
+{
+ aToken.aText = rChars;
+}
+
+void SmXMLNumberContext_Impl::EndElement()
+{
+ GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_NUMBER));
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLAnnotationContext_Impl : public SmXMLImportContext
+{
+ sal_Bool bIsStarMath;
+
+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 );
+};
+
+void SmXMLAnnotationContext_Impl::StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for (sal_Int16 i=0;i<nAttrCount;i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName(sAttrName,&aLocalName);
+
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap &rAttrTokenMap =
+ GetSmImport().GetAnnotationAttrTokenMap();
+ switch(rAttrTokenMap.Get(nPrefix,aLocalName))
+ {
+ case XML_TOK_ENCODING:
+ bIsStarMath= sValue.equals(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("StarMath 5.0")));
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void SmXMLAnnotationContext_Impl::Characters(const OUString &rChars)
+{
+ if (bIsStarMath)
+ GetSmImport().GetText().Append(String(rChars));
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLTextContext_Impl : public SmXMLImportContext
+{
+protected:
+ SmToken aToken;
+
+public:
+ SmXMLTextContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName)
+ {
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+ aToken.eType = TTEXT;
+ }
+
+ virtual void TCharacters(const OUString &rChars);
+
+ void EndElement();
+};
+
+void SmXMLTextContext_Impl::TCharacters(const OUString &rChars)
+{
+ aToken.aText = rChars;
+}
+
+void SmXMLTextContext_Impl::EndElement()
+{
+ GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_TEXT));
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLStringContext_Impl : public SmXMLImportContext
+{
+protected:
+ SmToken aToken;
+
+public:
+ SmXMLStringContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName)
+ {
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+ aToken.eType = TTEXT;
+ }
+
+ virtual void TCharacters(const OUString &rChars);
+
+ void EndElement();
+};
+
+void SmXMLStringContext_Impl::TCharacters(const OUString &rChars)
+{
+ /*
+ The content of <ms> elements should be rendered with visible "escaping" of
+ certain characters in the content, including at least "double quote"
+ itself, and preferably whitespace other than individual blanks. The intent
+ is for the viewer to see that the expression is a string literal, and to
+ see exactly which characters form its content. For example, <ms>double
+ quote is "</ms> might be rendered as "double quote is \"".
+
+ Obviously this isn't fully done here.
+ */
+ aToken.aText.Erase();
+ aToken.aText += '\"';
+ aToken.aText += String(rChars);
+ aToken.aText += '\"';
+}
+
+void SmXMLStringContext_Impl::EndElement()
+{
+ GetSmImport().GetNodeStack().Push(new SmTextNode(aToken,FNT_FIXED));
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLIdentifierContext_Impl : public SmXMLImportContext
+{
+protected:
+ SmXMLContext_Helper aStyleHelper;
+ SmToken aToken;
+
+public:
+ SmXMLIdentifierContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName),aStyleHelper(*this)
+ {
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+ aToken.eType = TIDENT;
+ }
+
+ void TCharacters(const OUString &rChars);
+ void StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+ {
+ aStyleHelper.RetrieveAttrs(xAttrList);
+ };
+ void EndElement();
+};
+
+void SmXMLIdentifierContext_Impl::EndElement()
+{
+ SmTextNode *pNode = 0;
+ //we will handle identifier italic/normal here instead of with a standalone
+ //font node
+ if (((aStyleHelper.nIsItalic == -1) && (aToken.aText.Len() > 1))
+ || ((aStyleHelper.nIsItalic == 0) && (aToken.aText.Len() == 1)))
+ {
+ pNode = new SmTextNode(aToken,FNT_FUNCTION);
+ pNode->GetFont().SetItalic(ITALIC_NONE);
+ aStyleHelper.nIsItalic = -1;
+ }
+ else
+ pNode = new SmTextNode(aToken,FNT_VARIABLE);
+ if (aStyleHelper.bFontNodeNeeded && aStyleHelper.nIsItalic != -1)
+ {
+ if (aStyleHelper.nIsItalic)
+ pNode->GetFont().SetItalic(ITALIC_NORMAL);
+ else
+ pNode->GetFont().SetItalic(ITALIC_NONE);
+ }
+
+ if ((-1!=aStyleHelper.nIsBold) || (0.0!=aStyleHelper.nFontSize) ||
+ (aStyleHelper.sFontFamily.getLength()) ||
+ aStyleHelper.sColor.getLength())
+ aStyleHelper.bFontNodeNeeded=sal_True;
+ else
+ aStyleHelper.bFontNodeNeeded=sal_False;
+ if (aStyleHelper.bFontNodeNeeded)
+ aStyleHelper.ApplyAttrs();
+ GetSmImport().GetNodeStack().Push(pNode);
+}
+
+void SmXMLIdentifierContext_Impl::TCharacters(const OUString &rChars)
+{
+ aToken.aText = rChars;
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLOperatorContext_Impl : public SmXMLImportContext
+{
+ sal_Bool bIsStretchy;
+
+protected:
+ SmToken aToken;
+
+public:
+ SmXMLOperatorContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName), bIsStretchy(sal_False)
+ {
+ aToken.nGroup = 0;
+ aToken.eType = TSPECIAL;
+ aToken.nLevel = 5;
+ }
+
+ void TCharacters(const OUString &rChars);
+ void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList );
+ void EndElement();
+};
+
+void SmXMLOperatorContext_Impl::TCharacters(const OUString &rChars)
+{
+ aToken.cMathChar = rChars[0];
+}
+
+void SmXMLOperatorContext_Impl::EndElement()
+{
+ SmMathSymbolNode *pNode = new SmMathSymbolNode(aToken);
+ //For stretchy scaling the scaling must be retrieved from this node
+ //and applied to the expression itself so as to get the expression
+ //to scale the operator to the height of the expression itself
+ if (bIsStretchy)
+ pNode->SetScaleMode(SCALE_HEIGHT);
+ GetSmImport().GetNodeStack().Push(pNode);
+}
+
+
+
+void SmXMLOperatorContext_Impl::StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for (sal_Int16 i=0;i<nAttrCount;i++)
+ {
+ OUString sAttrName = xAttrList->getNameByIndex(i);
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().
+ GetKeyByAttrName(sAttrName,&aLocalName);
+
+ OUString sValue = xAttrList->getValueByIndex(i);
+ const SvXMLTokenMap &rAttrTokenMap =
+ GetSmImport().GetOperatorAttrTokenMap();
+ switch(rAttrTokenMap.Get(nPrefix,aLocalName))
+ {
+ case XML_TOK_STRETCHY:
+ bIsStretchy = sValue.equals(
+ GetXMLToken(XML_TRUE));
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+
+////////////////////////////////////////////////////////////
+
+class SmXMLSpaceContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLSpaceContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName) {}
+
+ void StartElement(const uno::Reference< xml::sax::XAttributeList >& xAttrList );
+};
+
+void SmXMLSpaceContext_Impl::StartElement(
+ const uno::Reference<xml::sax::XAttributeList > & /*xAttrList*/ )
+{
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.eType = TBLANK;
+ aToken.nLevel = 5;
+ SmBlankNode *pBlank = new SmBlankNode(aToken);
+ pBlank->IncreaseBy(aToken);
+ GetSmImport().GetNodeStack().Push(pBlank);
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLSubContext_Impl : public SmXMLRowContext_Impl
+{
+protected:
+ void GenericEndElement(SmTokenType eType,SmSubSup aSubSup);
+
+public:
+ SmXMLSubContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+
+ void EndElement()
+ {
+ GenericEndElement(TRSUB,RSUB);
+ }
+};
+
+
+void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup)
+{
+ /*The <msub> element requires exactly 2 arguments.*/
+ DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2,
+ "Sub has not two arguments");
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = eType;
+ SmSubSupNode *pNode = new SmSubSupNode(aToken);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+
+ // initialize subnodes array
+ SmNodeArray aSubNodes;
+ aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES);
+ for (ULONG i = 1; i < aSubNodes.size(); i++)
+ aSubNodes[i] = NULL;
+
+ aSubNodes[eSubSup+1] = rNodeStack.Pop();
+ aSubNodes[0] = rNodeStack.Pop();
+ pNode->SetSubNodes(aSubNodes);
+ rNodeStack.Push(pNode);
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLSupContext_Impl : public SmXMLSubContext_Impl
+{
+public:
+ SmXMLSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLSubContext_Impl(rImport,nPrefix,rLName) {}
+
+ void EndElement()
+ {
+ GenericEndElement(TRSUP,RSUP);
+ }
+};
+
+////////////////////////////////////////////////////////////
+
+class SmXMLSubSupContext_Impl : public SmXMLRowContext_Impl
+{
+protected:
+ void GenericEndElement(SmTokenType eType, SmSubSup aSub,SmSubSup aSup);
+
+public:
+ SmXMLSubSupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLRowContext_Impl(rImport,nPrefix,rLName) {}
+
+ void EndElement()
+ {
+ GenericEndElement(TRSUB,RSUB,RSUP);
+ }
+};
+
+void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType,
+ SmSubSup aSub,SmSubSup aSup)
+{
+ /*The <msub> element requires exactly 3 arguments.*/
+ DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 3,
+ "SubSup has not three arguments");
+
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = eType;
+ SmSubSupNode *pNode = new SmSubSupNode(aToken);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+
+ // initialize subnodes array
+ SmNodeArray aSubNodes;
+ aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES);
+ for (ULONG i = 1; i < aSubNodes.size(); i++)
+ aSubNodes[i] = NULL;
+
+ aSubNodes[aSup+1] = rNodeStack.Pop();
+ aSubNodes[aSub+1] = rNodeStack.Pop();
+ aSubNodes[0] = rNodeStack.Pop();
+ pNode->SetSubNodes(aSubNodes);
+ rNodeStack.Push(pNode);
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLUnderContext_Impl : public SmXMLSubContext_Impl
+{
+protected:
+ sal_Int16 nAttrCount;
+
+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();
+};
+
+void SmXMLUnderContext_Impl::StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+ nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+}
+
+void SmXMLUnderContext_Impl::HandleAccent()
+{
+ DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2,
+ "Sub has not two arguments");
+
+ /*Just one special case for the underline thing*/
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ SmNode *pTest = rNodeStack.Pop();
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TUNDERLINE;
+
+
+ SmNodeArray aSubNodes;
+ aSubNodes.resize(2);
+
+ SmStructureNode *pNode = new SmAttributNode(aToken);
+ if ((pTest->GetToken().cMathChar & 0x0FFF) == 0x0332)
+ {
+ aSubNodes[0] = new SmRectangleNode(aToken);
+ delete pTest;
+ }
+ else
+ aSubNodes[0] = pTest;
+
+ aSubNodes[1] = rNodeStack.Pop();
+ pNode->SetSubNodes(aSubNodes);
+ pNode->SetScaleMode(SCALE_WIDTH);
+ rNodeStack.Push(pNode);
+}
+
+
+void SmXMLUnderContext_Impl::EndElement()
+{
+ if (!nAttrCount)
+ GenericEndElement(TCSUB,CSUB);
+ else
+ HandleAccent();
+#if 0
+ //UnderBrace trick
+ SmStructureNode *pNode = rNodeStack.Pop();
+ if (pNode->GetSubNode(1)->GetToken().cMathChar == (0x0332|0xf000))
+ if (pNode->GetSubNode(0)->GetToken().cMathChar == (0x0332|0xf000))
+#endif
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLOverContext_Impl : public SmXMLSubContext_Impl
+{
+protected:
+ sal_Int16 nAttrCount;
+
+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();
+};
+
+
+void SmXMLOverContext_Impl::StartElement(const uno::Reference<
+ xml::sax::XAttributeList > & xAttrList )
+{
+ nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+}
+
+
+void SmXMLOverContext_Impl::EndElement()
+{
+ if (!nAttrCount)
+ GenericEndElement(TCSUP,CSUP);
+ else
+ HandleAccent();
+}
+
+
+void SmXMLOverContext_Impl::HandleAccent()
+{
+ DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2,
+ "Sub has not two arguments");
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TACUTE;
+
+ SmAttributNode *pNode = new SmAttributNode(aToken);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+
+ SmNodeArray aSubNodes;
+ aSubNodes.resize(2);
+ aSubNodes[0] = rNodeStack.Pop();
+ aSubNodes[1] = rNodeStack.Pop();
+ pNode->SetSubNodes(aSubNodes);
+ pNode->SetScaleMode(SCALE_WIDTH);
+ rNodeStack.Push(pNode);
+
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLUnderOverContext_Impl : public SmXMLSubSupContext_Impl
+{
+public:
+ SmXMLUnderOverContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLSubSupContext_Impl(rImport,nPrefix,rLName) {}
+
+ void EndElement()
+ {
+ GenericEndElement(TCSUB,CSUB,CSUP);
+ }
+};
+
+////////////////////////////////////////////////////////////
+
+class SmXMLMultiScriptsContext_Impl : public SmXMLSubSupContext_Impl
+{
+ sal_Bool bHasPrescripts;
+
+public:
+ SmXMLMultiScriptsContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) :
+ SmXMLSubSupContext_Impl(rImport,nPrefix,rLName),
+ bHasPrescripts(FALSE) {}
+
+ void EndElement();
+ void MiddleElement();
+ SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList);
+};
+
+////////////////////////////////////////////////////////////
+
+class SmXMLNoneContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLNoneContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName) {}
+
+ void EndElement();
+};
+
+
+void SmXMLNoneContext_Impl::EndElement(void)
+{
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.aText.Erase();
+ aToken.nLevel = 5;
+ aToken.eType = TIDENT;
+ GetSmImport().GetNodeStack().Push(
+ new SmTextNode(aToken,FNT_VARIABLE));
+}
+
+////////////////////////////////////////////////////////////
+
+class SmXMLPrescriptsContext_Impl : public SmXMLImportContext
+{
+public:
+ SmXMLPrescriptsContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName)
+ : SmXMLImportContext(rImport,nPrefix,rLName) {}
+};
+
+////////////////////////////////////////////////////////////
+
+class SmXMLTableRowContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLTableRowContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) :
+ SmXMLRowContext_Impl(rImport,nPrefix,rLName)
+ {}
+
+ SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList);
+};
+
+
+////////////////////////////////////////////////////////////
+
+class SmXMLTableContext_Impl : public SmXMLTableRowContext_Impl
+{
+public:
+ SmXMLTableContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) :
+ SmXMLTableRowContext_Impl(rImport,nPrefix,rLName)
+ {}
+
+ void EndElement();
+ SvXMLImportContext *CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList);
+};
+
+
+////////////////////////////////////////////////////////////
+
+class SmXMLTableCellContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLTableCellContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) :
+ SmXMLRowContext_Impl(rImport,nPrefix,rLName)
+ {}
+};
+
+////////////////////////////////////////////////////////////
+
+class SmXMLAlignGroupContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLAlignGroupContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) :
+ SmXMLRowContext_Impl(rImport,nPrefix,rLName)
+ {}
+
+ /*Don't do anything with alignment for now*/
+ void EndElement()
+ {
+ }
+};
+
+////////////////////////////////////////////////////////////
+
+class SmXMLActionContext_Impl : public SmXMLRowContext_Impl
+{
+public:
+ SmXMLActionContext_Impl(SmXMLImport &rImport,sal_uInt16 nPrefix,
+ const OUString& rLName) :
+ SmXMLRowContext_Impl(rImport,nPrefix,rLName)
+ {}
+
+ void EndElement();
+};
+
+////////////////////////////////////////////////////////////
+
+// NB: virtually inherit so we can multiply inherit properly
+// in SmXMLFlatDocContext_Impl
+class SmXMLOfficeContext_Impl : public virtual SvXMLImportContext
+{
+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);
+};
+
+SvXMLImportContext *SmXMLOfficeContext_Impl::CreateChildContext(sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > &xAttrList)
+{
+ SvXMLImportContext *pContext = 0;
+ if ( XML_NAMESPACE_OFFICE == nPrefix &&
+ 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) )
+ {
+ pContext = new XMLDocumentSettingsContext( GetImport(),
+ XML_NAMESPACE_OFFICE, rLocalName,
+ xAttrList );
+ }
+ else
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+
+ return pContext;
+}
+
+////////////////////////////////////////////////////////////
+
+// context for flat file xml format
+class SmXMLFlatDocContext_Impl
+ : public SmXMLOfficeContext_Impl, public SvXMLMetaDocumentContext
+{
+public:
+ SmXMLFlatDocContext_Impl( SmXMLImport& i_rImport,
+ USHORT i_nPrefix, const OUString & i_rLName,
+ const uno::Reference<document::XDocumentProperties>& i_xDocProps,
+ const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder);
+
+ virtual ~SmXMLFlatDocContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext(USHORT i_nPrefix, const OUString& i_rLocalName, const uno::Reference<xml::sax::XAttributeList>& i_xAttrList);
+};
+
+SmXMLFlatDocContext_Impl::SmXMLFlatDocContext_Impl( SmXMLImport& i_rImport,
+ USHORT i_nPrefix, const OUString & i_rLName,
+ const uno::Reference<document::XDocumentProperties>& i_xDocProps,
+ const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) :
+ SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
+ SmXMLOfficeContext_Impl(i_rImport, i_nPrefix, i_rLName),
+ SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
+ i_xDocProps, i_xDocBuilder)
+{
+}
+
+SmXMLFlatDocContext_Impl::~SmXMLFlatDocContext_Impl()
+{
+}
+
+SvXMLImportContext *SmXMLFlatDocContext_Impl::CreateChildContext(
+ USHORT i_nPrefix, const OUString& i_rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& i_xAttrList)
+{
+ // behave like meta base class iff we encounter office:meta
+ if ( XML_NAMESPACE_OFFICE == i_nPrefix &&
+ i_rLocalName == GetXMLToken(XML_META) )
+ {
+ return SvXMLMetaDocumentContext::CreateChildContext(
+ i_nPrefix, i_rLocalName, i_xAttrList );
+ }
+ else
+ {
+ return SmXMLOfficeContext_Impl::CreateChildContext(
+ i_nPrefix, i_rLocalName, i_xAttrList );
+ }
+}
+
+////////////////////////////////////////////////////////////
+
+static __FAR_DATA SvXMLTokenMapEntry aPresLayoutElemTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_SEMANTICS, XML_TOK_SEMANTICS },
+ { XML_NAMESPACE_MATH, XML_MATH, XML_TOK_MATH },
+ { XML_NAMESPACE_MATH, XML_MSTYLE, XML_TOK_MSTYLE },
+ { XML_NAMESPACE_MATH, XML_MERROR, XML_TOK_MERROR },
+ { XML_NAMESPACE_MATH, XML_MPHANTOM, XML_TOK_MPHANTOM },
+ { XML_NAMESPACE_MATH, XML_MROW, XML_TOK_MROW },
+ { XML_NAMESPACE_MATH, XML_MFRAC, XML_TOK_MFRAC },
+ { XML_NAMESPACE_MATH, XML_MSQRT, XML_TOK_MSQRT },
+ { XML_NAMESPACE_MATH, XML_MROOT, XML_TOK_MROOT },
+ { XML_NAMESPACE_MATH, XML_MSUB, XML_TOK_MSUB },
+ { XML_NAMESPACE_MATH, XML_MSUP, XML_TOK_MSUP },
+ { XML_NAMESPACE_MATH, XML_MSUBSUP, XML_TOK_MSUBSUP },
+ { XML_NAMESPACE_MATH, XML_MUNDER, XML_TOK_MUNDER },
+ { XML_NAMESPACE_MATH, XML_MOVER, XML_TOK_MOVER },
+ { XML_NAMESPACE_MATH, XML_MUNDEROVER, XML_TOK_MUNDEROVER },
+ { XML_NAMESPACE_MATH, XML_MMULTISCRIPTS, XML_TOK_MMULTISCRIPTS },
+ { XML_NAMESPACE_MATH, XML_MTABLE, XML_TOK_MTABLE },
+ { XML_NAMESPACE_MATH, XML_MACTION, XML_TOK_MACTION },
+ { XML_NAMESPACE_MATH, XML_MFENCED, XML_TOK_MFENCED },
+ { XML_NAMESPACE_MATH, XML_MPADDED, XML_TOK_MPADDED },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aPresLayoutAttrTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_FONTWEIGHT, XML_TOK_FONTWEIGHT },
+ { XML_NAMESPACE_MATH, XML_FONTSTYLE, XML_TOK_FONTSTYLE },
+ { XML_NAMESPACE_MATH, XML_FONTSIZE, XML_TOK_FONTSIZE },
+ { XML_NAMESPACE_MATH, XML_FONTFAMILY, XML_TOK_FONTFAMILY },
+ { XML_NAMESPACE_MATH, XML_COLOR, XML_TOK_COLOR },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aFencedAttrTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_OPEN, XML_TOK_OPEN },
+ { XML_NAMESPACE_MATH, XML_CLOSE, XML_TOK_CLOSE },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aOperatorAttrTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_STRETCHY, XML_TOK_STRETCHY },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aAnnotationAttrTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_ENCODING, XML_TOK_ENCODING },
+ XML_TOKEN_MAP_END
+};
+
+
+static __FAR_DATA SvXMLTokenMapEntry aPresElemTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_ANNOTATION, XML_TOK_ANNOTATION },
+ { XML_NAMESPACE_MATH, XML_MI, XML_TOK_MI },
+ { XML_NAMESPACE_MATH, XML_MN, XML_TOK_MN },
+ { XML_NAMESPACE_MATH, XML_MO, XML_TOK_MO },
+ { XML_NAMESPACE_MATH, XML_MTEXT, XML_TOK_MTEXT },
+ { XML_NAMESPACE_MATH, XML_MSPACE,XML_TOK_MSPACE },
+ { XML_NAMESPACE_MATH, XML_MS, XML_TOK_MS },
+ { XML_NAMESPACE_MATH, XML_MALIGNGROUP, XML_TOK_MALIGNGROUP },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aPresScriptEmptyElemTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_MPRESCRIPTS, XML_TOK_MPRESCRIPTS },
+ { XML_NAMESPACE_MATH, XML_NONE, XML_TOK_NONE },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aPresTableElemTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_MTR, XML_TOK_MTR },
+ { XML_NAMESPACE_MATH, XML_MTD, XML_TOK_MTD },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aColorTokenMap[] =
+{
+ { XML_NAMESPACE_MATH, XML_BLACK, TBLACK},
+ { XML_NAMESPACE_MATH, XML_WHITE, TWHITE},
+ { XML_NAMESPACE_MATH, XML_RED, TRED},
+ { XML_NAMESPACE_MATH, XML_GREEN, TGREEN},
+ { XML_NAMESPACE_MATH, XML_BLUE, TBLUE},
+ { XML_NAMESPACE_MATH, XML_AQUA, TCYAN},
+ { XML_NAMESPACE_MATH, XML_FUCHSIA, TMAGENTA},
+ { XML_NAMESPACE_MATH, XML_YELLOW, TYELLOW},
+ XML_TOKEN_MAP_END
+};
+
+
+////////////////////////////////////////////////////////////
+
+const SvXMLTokenMap& SmXMLImport::GetPresLayoutElemTokenMap()
+{
+ if (!pPresLayoutElemTokenMap)
+ pPresLayoutElemTokenMap = new SvXMLTokenMap(aPresLayoutElemTokenMap);
+ return *pPresLayoutElemTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetPresLayoutAttrTokenMap()
+{
+ if (!pPresLayoutAttrTokenMap)
+ pPresLayoutAttrTokenMap = new SvXMLTokenMap(aPresLayoutAttrTokenMap);
+ return *pPresLayoutAttrTokenMap;
+}
+
+
+const SvXMLTokenMap& SmXMLImport::GetFencedAttrTokenMap()
+{
+ if (!pFencedAttrTokenMap)
+ pFencedAttrTokenMap = new SvXMLTokenMap(aFencedAttrTokenMap);
+ return *pFencedAttrTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetOperatorAttrTokenMap()
+{
+ if (!pOperatorAttrTokenMap)
+ pOperatorAttrTokenMap = new SvXMLTokenMap(aOperatorAttrTokenMap);
+ return *pOperatorAttrTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetAnnotationAttrTokenMap()
+{
+ if (!pAnnotationAttrTokenMap)
+ pAnnotationAttrTokenMap = new SvXMLTokenMap(aAnnotationAttrTokenMap);
+ return *pAnnotationAttrTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetPresElemTokenMap()
+{
+ if (!pPresElemTokenMap)
+ pPresElemTokenMap = new SvXMLTokenMap(aPresElemTokenMap);
+ return *pPresElemTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetPresScriptEmptyElemTokenMap()
+{
+ if (!pPresScriptEmptyElemTokenMap)
+ pPresScriptEmptyElemTokenMap = new
+ SvXMLTokenMap(aPresScriptEmptyElemTokenMap);
+ return *pPresScriptEmptyElemTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetPresTableElemTokenMap()
+{
+ if (!pPresTableElemTokenMap)
+ pPresTableElemTokenMap = new SvXMLTokenMap(aPresTableElemTokenMap);
+ return *pPresTableElemTokenMap;
+}
+
+const SvXMLTokenMap& SmXMLImport::GetColorTokenMap()
+{
+ if (!pColorTokenMap)
+ pColorTokenMap = new SvXMLTokenMap(aColorTokenMap);
+ return *pColorTokenMap;
+}
+
+////////////////////////////////////////////////////////////
+
+SvXMLImportContext *SmXMLDocContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetSmImport().GetPresLayoutElemTokenMap();
+
+ //UINT32 nTest = rTokenMap.Get(nPrefix, rLocalName);
+
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ //Consider semantics a dummy except for any starmath annotations
+ case XML_TOK_SEMANTICS:
+ pContext = GetSmImport().CreateRowContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ /*General Layout Schemata*/
+ case XML_TOK_MROW:
+ pContext = GetSmImport().CreateRowContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MFRAC:
+ pContext = GetSmImport().CreateFracContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MSQRT:
+ pContext = GetSmImport().CreateSqrtContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MROOT:
+ pContext = GetSmImport().CreateRootContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MSTYLE:
+ pContext = GetSmImport().CreateStyleContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MERROR:
+ pContext = GetSmImport().CreateErrorContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MPADDED:
+ pContext = GetSmImport().CreatePaddedContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MPHANTOM:
+ pContext = GetSmImport().CreatePhantomContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MFENCED:
+ pContext = GetSmImport().CreateFencedContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ /*Script and Limit Schemata*/
+ case XML_TOK_MSUB:
+ pContext = GetSmImport().CreateSubContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MSUP:
+ pContext = GetSmImport().CreateSupContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MSUBSUP:
+ pContext = GetSmImport().CreateSubSupContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MUNDER:
+ pContext = GetSmImport().CreateUnderContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MOVER:
+ pContext = GetSmImport().CreateOverContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MUNDEROVER:
+ pContext = GetSmImport().CreateUnderOverContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MMULTISCRIPTS:
+ pContext = GetSmImport().CreateMultiScriptsContext(nPrefix,
+ rLocalName, xAttrList);
+ break;
+ case XML_TOK_MTABLE:
+ pContext = GetSmImport().CreateTableContext(nPrefix,
+ rLocalName, xAttrList);
+ break;
+ case XML_TOK_MACTION:
+ pContext = GetSmImport().CreateActionContext(nPrefix,
+ rLocalName, xAttrList);
+ break;
+ default:
+ /*Basically theres an implicit mrow around certain bare
+ *elements, use a RowContext to see if this is one of
+ *those ones*/
+ SmXMLRowContext_Impl aTempContext(GetSmImport(),nPrefix,
+ GetXMLToken(XML_MROW));
+
+ pContext = aTempContext.StrictCreateChildContext(nPrefix,
+ rLocalName, xAttrList);
+ break;
+ }
+ return pContext;
+}
+
+void SmXMLDocContext_Impl::EndElement()
+{
+ SmNodeArray ContextArray;
+ ContextArray.resize(1);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+
+ for (ULONG i=0;i< 1;i++)
+ ContextArray[i] = rNodeStack.Pop();
+
+ SmToken aDummy;
+ SmStructureNode *pSNode = new SmLineNode(aDummy);
+ pSNode->SetSubNodes(ContextArray);
+ rNodeStack.Push(pSNode);
+
+ SmNodeArray LineArray;
+ ULONG n = rNodeStack.Count();
+ LineArray.resize(n);
+ for (ULONG j = 0; j < n; j++)
+ LineArray[n - (j + 1)] = rNodeStack.Pop();
+ SmStructureNode *pSNode2 = new SmTableNode(aDummy);
+ pSNode2->SetSubNodes(LineArray);
+ rNodeStack.Push(pSNode2);
+}
+
+void SmXMLFracContext_Impl::EndElement()
+{
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TOVER;
+ SmStructureNode *pSNode = new SmBinVerNode(aToken);
+ SmNode *pOper = new SmRectangleNode(aToken);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ DBG_ASSERT(rNodeStack.Count() - nElementCount == 2,
+ "Fraction (mfrac) tag is missing component");
+ if (rNodeStack.Count() - nElementCount == 2)
+ {
+ SmNode *pSecond = rNodeStack.Pop();
+ SmNode *pFirst = rNodeStack.Pop();
+ pSNode->SetSubNodes(pFirst,pOper,pSecond);
+ rNodeStack.Push(pSNode);
+ }
+}
+
+void SmXMLRootContext_Impl::EndElement()
+{
+ /*The <mroot> element requires exactly 2 arguments.*/
+ DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2,
+ "Root tag is missing component");
+
+ SmToken aToken;
+ aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TNROOT;
+ SmStructureNode *pSNode = new SmRootNode(aToken);
+ SmNode *pOper = new SmRootSymbolNode(aToken);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ SmNode *pIndex = rNodeStack.Pop();
+ SmNode *pBase = rNodeStack.Pop();
+ pSNode->SetSubNodes(pIndex,pOper,pBase);
+ rNodeStack.Push(pSNode);
+}
+
+void SmXMLSqrtContext_Impl::EndElement()
+{
+ /*
+ <msqrt> accepts any number of arguments; if this number is not 1, its
+ contents are treated as a single "inferred <mrow>" containing its
+ arguments
+ */
+ if (GetSmImport().GetNodeStack().Count() - nElementCount > 1)
+ SmXMLRowContext_Impl::EndElement();
+
+ SmToken aToken;
+ aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TSQRT;
+ SmStructureNode *pSNode = new SmRootNode(aToken);
+ SmNode *pOper = new SmRootSymbolNode(aToken);
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ pSNode->SetSubNodes(0,pOper,rNodeStack.Pop());
+ rNodeStack.Push(pSNode);
+}
+
+void SmXMLRowContext_Impl::EndElement()
+{
+ SmNodeArray aRelationArray;
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ ULONG nSize = rNodeStack.Count()-nElementCount;
+
+ if (nSize > 0)
+ {
+ aRelationArray.resize(nSize);
+ for (ULONG j=rNodeStack.Count()-nElementCount;j > 0;j--)
+ aRelationArray[j-1] = rNodeStack.Pop();
+
+
+ //If the first or last element is an operator with stretchyness
+ //set then we must create a brace node here from those elements,
+ //removing the stretchness from the operators and applying it to
+ //ourselves, and creating the appropiate dummy StarMath none bracket
+ //to balance the arrangement
+ if (((aRelationArray[0]->GetScaleMode() == SCALE_HEIGHT)
+ && (aRelationArray[0]->GetType() == NMATH))
+ || ((aRelationArray[nSize-1]->GetScaleMode() == SCALE_HEIGHT)
+ && (aRelationArray[nSize-1]->GetType() == NMATH)))
+ {
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+
+ int nLeft=0,nRight=0;
+ if ((aRelationArray[0]->GetScaleMode() == SCALE_HEIGHT)
+ && (aRelationArray[0]->GetType() == NMATH))
+ {
+ aToken = aRelationArray[0]->GetToken();
+ nLeft=1;
+ }
+ else
+ aToken.cMathChar = '\0';
+
+ aToken.eType = TLPARENT;
+ SmNode *pLeft = new SmMathSymbolNode(aToken);
+
+ if ((aRelationArray[nSize-1]->GetScaleMode() == SCALE_HEIGHT)
+ && (aRelationArray[nSize-1]->GetType() == NMATH))
+ {
+ aToken = aRelationArray[nSize-1]->GetToken();
+ nRight=1;
+ }
+ else
+ aToken.cMathChar = '\0';
+
+ aToken.eType = TRPARENT;
+ SmNode *pRight = new SmMathSymbolNode(aToken);
+
+ SmNodeArray aRelationArray2;
+
+ //!! nSize-nLeft-nRight may be < 0 !!
+ int nRelArrSize = nSize-nLeft-nRight;
+ if (nRelArrSize > 0)
+ {
+ aRelationArray2.resize(nRelArrSize);
+ for (int i=0;i < nRelArrSize;i++)
+ aRelationArray2[i] = aRelationArray[i+nLeft];
+ }
+
+ SmToken aDummy;
+ SmStructureNode *pSNode = new SmBraceNode(aToken);
+ SmStructureNode *pBody = new SmExpressionNode(aDummy);
+ pBody->SetSubNodes(aRelationArray2);
+
+ pSNode->SetSubNodes(pLeft,pBody,pRight);
+ pSNode->SetScaleMode(SCALE_HEIGHT);
+ rNodeStack.Push(pSNode);
+ return;
+ }
+ }
+ else //Multiple newlines result in empty row elements
+ {
+ aRelationArray.resize(1);
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 5;
+ aToken.eType = TNEWLINE;
+ aRelationArray[0] = new SmLineNode(aToken);
+ }
+
+ SmToken aDummy;
+ SmStructureNode *pSNode = new SmExpressionNode(aDummy);
+ pSNode->SetSubNodes(aRelationArray);
+ rNodeStack.Push(pSNode);
+}
+
+
+SvXMLImportContext *SmXMLRowContext_Impl::StrictCreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetSmImport().GetPresElemTokenMap();
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ /*Note that these should accept malignmark subelements, but do not*/
+ case XML_TOK_MN:
+ pContext = GetSmImport().CreateNumberContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MI:
+ pContext = GetSmImport().CreateIdentifierContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MO:
+ pContext = GetSmImport().CreateOperatorContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MTEXT:
+ pContext = GetSmImport().CreateTextContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MSPACE:
+ pContext = GetSmImport().CreateSpaceContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ case XML_TOK_MS:
+ pContext = GetSmImport().CreateStringContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+
+ /*Note: The maligngroup should only be seen when the row
+ * (or decendants) are in a table*/
+ case XML_TOK_MALIGNGROUP:
+ pContext = GetSmImport().CreateAlignGroupContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+
+ case XML_TOK_ANNOTATION:
+ pContext = GetSmImport().CreateAnnotationContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+
+ default:
+ break;
+ }
+ return pContext;
+}
+
+
+SvXMLImportContext *SmXMLRowContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = StrictCreateChildContext(nPrefix,
+ rLocalName, xAttrList);
+
+ if (!pContext)
+ {
+ //Hmm, unrecognized for this level, check to see if its
+ //an element that can have an implicit schema around it
+ pContext = SmXMLDocContext_Impl::CreateChildContext(nPrefix,
+ rLocalName,xAttrList);
+ }
+ return pContext;
+}
+
+
+SvXMLImportContext *SmXMLMultiScriptsContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetSmImport().
+ GetPresScriptEmptyElemTokenMap();
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_MPRESCRIPTS:
+ MiddleElement();
+ pContext = GetSmImport().CreatePrescriptsContext(nPrefix,
+ rLocalName, xAttrList);
+ break;
+ case XML_TOK_NONE:
+ pContext = GetSmImport().CreateNoneContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ default:
+ pContext = SmXMLRowContext_Impl::CreateChildContext(nPrefix,
+ rLocalName,xAttrList);
+ break;
+ }
+ return pContext;
+}
+
+void SmXMLMultiScriptsContext_Impl::MiddleElement()
+{
+ bHasPrescripts=sal_True;
+
+ DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount > 0,
+ "Sub has no arguments");
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ if (rNodeStack.Count()-nElementCount > 1)
+ {
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TRSUB;
+ ULONG nFinalCount = rNodeStack.Count()-nElementCount-1;
+
+ SmNodeStack aReverseStack;
+ while (rNodeStack.Count()-nElementCount)
+ {
+ SmNode *pThing = rNodeStack.Pop();
+ aReverseStack.Push(pThing);
+ }
+
+ for (ULONG nCount=0;nCount < nFinalCount;nCount+=2)
+ {
+ SmSubSupNode *pNode = new SmSubSupNode(aToken);
+
+ // initialize subnodes array
+ SmNodeArray aSubNodes;
+ aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES);
+ for (ULONG i = 1; i < aSubNodes.size(); i++)
+ aSubNodes[i] = NULL;
+
+ /*On each loop the base and its sub sup pair becomes the
+ base for the next loop to which the next sub sup pair is
+ attached, i.e. wheels within wheels*/
+ //if (nCount == 0)
+ aSubNodes[0] = aReverseStack.Pop();
+
+ SmNode *pScriptNode = aReverseStack.Pop();
+
+ if (pScriptNode && ((pScriptNode->GetToken().eType != TIDENT) ||
+ (pScriptNode->GetToken().aText.Len())))
+ aSubNodes[RSUB+1] = pScriptNode;
+ pScriptNode = aReverseStack.Pop();
+ if (pScriptNode && ((pScriptNode->GetToken().eType != TIDENT) ||
+ (pScriptNode->GetToken().aText.Len())))
+ aSubNodes[RSUP+1] = pScriptNode;
+
+ pNode->SetSubNodes(aSubNodes);
+ aReverseStack.Push(pNode);
+ }
+ rNodeStack.Push(aReverseStack.Pop());
+ }
+}
+
+
+void SmXMLTableContext_Impl::EndElement()
+{
+ SmNodeArray aExpressionArray;
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ SmNodeStack aReverseStack;
+ aExpressionArray.resize(rNodeStack.Count()-nElementCount);
+
+ ULONG nRows = rNodeStack.Count()-nElementCount;
+ USHORT nCols = 0;
+
+ SmStructureNode *pArray;
+ for (ULONG i=rNodeStack.Count()-nElementCount;i > 0;i--)
+ {
+ pArray = (SmStructureNode *)rNodeStack.Pop();
+ if (pArray->GetNumSubNodes() == 0)
+ {
+ //This is a little tricky, it is possible that there was
+ //be elements that were not inside a <mtd> pair, in which
+ //case they will not be in a row, i.e. they will not have
+ //SubNodes, so we have to wait until here before we can
+ //resolve the situation. Implicitsurrounding tags are
+ //surprisingly difficult to get right within this
+ //architecture
+
+ SmNodeArray aRelationArray;
+ aRelationArray.resize(1);
+ aRelationArray[0] = pArray;
+ SmToken aDummy;
+ pArray = new SmExpressionNode(aDummy);
+ pArray->SetSubNodes(aRelationArray);
+ }
+
+ if (pArray->GetNumSubNodes() > nCols)
+ nCols = pArray->GetNumSubNodes();
+ aReverseStack.Push(pArray);
+ }
+ aExpressionArray.resize(nCols*nRows);
+ ULONG j=0;
+ while (aReverseStack.Count())
+ {
+ pArray = (SmStructureNode *)aReverseStack.Pop();
+ for (USHORT i=0;i<pArray->GetNumSubNodes();i++)
+ aExpressionArray[j++] = pArray->GetSubNode(i);
+ }
+
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = TRGROUP;
+ aToken.nLevel = 0;
+ aToken.eType = TMATRIX;
+ SmMatrixNode *pSNode = new SmMatrixNode(aToken);
+ pSNode->SetSubNodes(aExpressionArray);
+ pSNode->SetRowCol(static_cast<USHORT>(nRows),nCols);
+ rNodeStack.Push(pSNode);
+}
+
+SvXMLImportContext *SmXMLTableRowContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetSmImport().
+ GetPresTableElemTokenMap();
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_MTD:
+ pContext = GetSmImport().CreateTableCellContext(nPrefix,
+ rLocalName, xAttrList);
+ break;
+ default:
+ pContext = SmXMLRowContext_Impl::CreateChildContext(nPrefix,
+ rLocalName,xAttrList);
+ break;
+ }
+ return pContext;
+}
+
+SvXMLImportContext *SmXMLTableContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList)
+{
+ SvXMLImportContext* pContext = 0L;
+
+ const SvXMLTokenMap& rTokenMap = GetSmImport().
+ GetPresTableElemTokenMap();
+ switch(rTokenMap.Get(nPrefix, rLocalName))
+ {
+ case XML_TOK_MTR:
+ pContext = GetSmImport().CreateTableRowContext(nPrefix,rLocalName,
+ xAttrList);
+ break;
+ default:
+ pContext = SmXMLTableRowContext_Impl::CreateChildContext(nPrefix,
+ rLocalName,xAttrList);
+ break;
+ }
+ return pContext;
+}
+
+void SmXMLMultiScriptsContext_Impl::EndElement()
+{
+ if (!bHasPrescripts)
+ MiddleElement();
+
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ if (rNodeStack.Count()-nElementCount > 1)
+ {
+ SmToken aToken;
+ aToken.cMathChar = '\0';
+ aToken.nGroup = 0;
+ aToken.nLevel = 0;
+ aToken.eType = TLSUB;
+ ULONG nFinalCount = rNodeStack.Count()-nElementCount-1;
+
+ SmNodeStack aReverseStack;
+ while (rNodeStack.Count()-nElementCount)
+ aReverseStack.Push(rNodeStack.Pop());
+ for (ULONG nCount=0;nCount < nFinalCount;nCount+=2)
+ {
+ SmSubSupNode *pNode = new SmSubSupNode(aToken);
+
+ // initialize subnodes array
+ SmNodeArray aSubNodes;
+ aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES);
+ for (ULONG i = 1; i < aSubNodes.size(); i++)
+ aSubNodes[i] = NULL;
+
+ /*On each loop the base and its sub sup pair becomes the
+ base for the next loop to which the next sub sup pair is
+ attached, i.e. wheels within wheels*/
+ //if (nCount == 0)
+ aSubNodes[0] = aReverseStack.Pop();
+
+ SmNode *pScriptNode = aReverseStack.Pop();
+ if (pScriptNode->GetToken().aText.Len())
+ aSubNodes[LSUB+1] = pScriptNode;
+ pScriptNode = aReverseStack.Pop();
+ if (pScriptNode->GetToken().aText.Len())
+ aSubNodes[LSUP+1] = pScriptNode;
+
+ pNode->SetSubNodes(aSubNodes);
+ aReverseStack.Push(pNode);
+ }
+ rNodeStack.Push(aReverseStack.Pop());
+ }
+
+}
+void SmXMLActionContext_Impl::EndElement()
+{
+ /*For now we will just assume that the
+ selected attribute is one, and then just display
+ that expression alone, i.e. remove all expect the
+ first pushed one*/
+
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ for (ULONG i=rNodeStack.Count()-nElementCount;i > 1;i--)
+ {
+ delete rNodeStack.Pop();
+ }
+}
+
+SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ if ( XML_NAMESPACE_OFFICE == nPrefix )
+ {
+ if ( (IsXMLToken(rLocalName, XML_DOCUMENT) ||
+ IsXMLToken(rLocalName, XML_DOCUMENT_META)))
+ {
+ uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
+ mxServiceFactory->createInstance(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.xml.dom.SAXDocumentBuilder")),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetModel(), uno::UNO_QUERY_THROW);
+ return IsXMLToken(rLocalName, XML_DOCUMENT_META)
+ ? new SvXMLMetaDocumentContext(*this,
+ XML_NAMESPACE_OFFICE, rLocalName,
+ xDPS->getDocumentProperties(), xDocBuilder)
+ // flat OpenDocument file format -- this has not been tested...
+ : new SmXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
+ xDPS->getDocumentProperties(), xDocBuilder);
+ }
+ else
+ {
+ return new SmXMLOfficeContext_Impl( *this,nPrefix,rLocalName);
+ }
+ }
+ else
+ return new SmXMLDocContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateRowContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLRowContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateTextContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLTextContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateAnnotationContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLAnnotationContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateStringContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLStringContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateNumberContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLNumberContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateIdentifierContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLIdentifierContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateOperatorContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLOperatorContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateSpaceContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLSpaceContext_Impl(*this,nPrefix,rLocalName);
+}
+
+
+SvXMLImportContext *SmXMLImport::CreateFracContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLFracContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateSqrtContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLSqrtContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateRootContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLRootContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateStyleContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLStyleContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreatePaddedContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLPaddedContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreatePhantomContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLPhantomContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateFencedContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLFencedContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateErrorContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLErrorContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateSubContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLSubContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateSubSupContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLSubSupContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateSupContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLSupContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateUnderContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLUnderContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateOverContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLOverContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateUnderOverContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLUnderOverContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateMultiScriptsContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLMultiScriptsContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateTableContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLTableContext_Impl(*this,nPrefix,rLocalName);
+}
+SvXMLImportContext *SmXMLImport::CreateTableRowContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLTableRowContext_Impl(*this,nPrefix,rLocalName);
+}
+SvXMLImportContext *SmXMLImport::CreateTableCellContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLTableCellContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateNoneContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLNoneContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreatePrescriptsContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLPrescriptsContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateAlignGroupContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLAlignGroupContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SvXMLImportContext *SmXMLImport::CreateActionContext(sal_uInt16 nPrefix,
+ const OUString &rLocalName,
+ const uno::Reference <xml::sax::XAttributeList> & /*xAttrList*/)
+{
+ return new SmXMLActionContext_Impl(*this,nPrefix,rLocalName);
+}
+
+SmXMLImport::~SmXMLImport() throw ()
+{
+ delete pPresLayoutElemTokenMap;
+ delete pPresElemTokenMap;
+ delete pPresScriptEmptyElemTokenMap;
+ delete pPresTableElemTokenMap;
+ delete pPresLayoutAttrTokenMap;
+ delete pFencedAttrTokenMap;
+ delete pColorTokenMap;
+ delete pOperatorAttrTokenMap;
+ delete pAnnotationAttrTokenMap;
+}
+
+void SmXMLImport::SetViewSettings(const Sequence<PropertyValue>& aViewProps)
+{
+ uno::Reference <frame::XModel> xModel = GetModel();
+ if ( !xModel.is() )
+ return;
+
+ uno::Reference <lang::XUnoTunnel> xTunnel;
+ xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
+ SmModel *pModel = reinterpret_cast<SmModel *>
+ (xTunnel->getSomething(SmModel::getUnoTunnelId()));
+
+ if ( !pModel )
+ return;
+
+ SmDocShell *pDocShell =
+ static_cast<SmDocShell*>(pModel->GetObjectShell());
+ if ( !pDocShell )
+ return;
+
+ Rectangle aRect( pDocShell->GetVisArea() );
+
+ sal_Int32 nCount = aViewProps.getLength();
+ const PropertyValue *pValue = aViewProps.getConstArray();
+
+ long nTmp = 0;
+ //sal_Bool bShowDeletes = sal_False, bShowInserts = sal_False, bShowFooter = sal_False, bShowHeader = sal_False;
+
+ for (sal_Int32 i = 0; i < nCount ; i++)
+ {
+ if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaTop" ) ) )
+ {
+ pValue->Value >>= nTmp;
+ aRect.setY( nTmp );
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaLeft" ) ) )
+ {
+ pValue->Value >>= nTmp;
+ aRect.setX( nTmp );
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaWidth" ) ) )
+ {
+ pValue->Value >>= nTmp;
+ Size aSize( aRect.GetSize() );
+ aSize.Width() = nTmp;
+ aRect.SetSize( aSize );
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "ViewAreaHeight" ) ) )
+ {
+ pValue->Value >>= nTmp;
+ Size aSize( aRect.GetSize() );
+ aSize.Height() = nTmp;
+ aRect.SetSize( aSize );
+ }
+ pValue++;
+ }
+
+ pDocShell->SetVisArea ( aRect );
+}
+
+void SmXMLImport::SetConfigurationSettings(const Sequence<PropertyValue>& aConfProps)
+{
+ uno::Reference < XPropertySet > xProps ( GetModel(), UNO_QUERY );
+ if ( xProps.is() )
+ {
+ Reference < XPropertySetInfo > xInfo ( xProps->getPropertySetInfo() );
+ if (xInfo.is() )
+ {
+ sal_Int32 nCount = aConfProps.getLength();
+ const PropertyValue* pValues = aConfProps.getConstArray();
+
+ const OUString sFormula ( RTL_CONSTASCII_USTRINGPARAM ( "Formula" ) );
+ const OUString sBasicLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "BasicLibraries" ) );
+ const OUString sDialogLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "DialogLibraries" ) );
+ while ( nCount-- )
+ {
+ if (pValues->Name != sFormula &&
+ pValues->Name != sBasicLibraries &&
+ pValues->Name != sDialogLibraries)
+ {
+ try
+ {
+ if ( xInfo->hasPropertyByName( pValues->Name ) )
+ xProps->setPropertyValue( pValues->Name, pValues->Value );
+ }
+ catch( Exception& )
+ {
+ DBG_ERROR( "SmXMLImport::SetConfigurationSettings: Exception!" );
+ }
+ }
+
+ pValues++;
+ }
+ }
+ }
+}
+
+
+////////////////////////////////////////////////////////////
+
diff --git a/starmath/source/mathml.hxx b/starmath/source/mathmlimport.hxx index ed53029c6e7f..ed46efa823fc 100644 --- a/starmath/source/mathml.hxx +++ b/starmath/source/mathmlimport.hxx @@ -1,441 +1,350 @@ -/************************************************************************* - * - * 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: mathml.hxx,v $ - * $Revision: 1.30 $ - * - * 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 MATHML_HXX -#define MATHML_HXX -#ifndef _SDXMLIMP_HXX -#include <xmloff/xmlimp.hxx> -#endif -#ifndef _SDXMLEXP_HXX -#include <xmloff/xmlexp.hxx> -#endif -#include <xmloff/DocumentSettingsContext.hxx> -#include <xmloff/xmltoken.hxx> -#include <node.hxx> - -class SfxMedium; -namespace com { namespace sun { namespace star { - namespace io { - class XInputStream; - class XOutputStream; } - namespace beans { - class XPropertySet; } -} } } - - -class SmXMLWrapper -{ -public: - SmXMLWrapper(com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rRef) - : xModel(rRef), bFlat(sal_True) {} - ULONG Import(SfxMedium &rMedium); - sal_Bool Export(SfxMedium &rMedium); - void SetFlat(sal_Bool bIn) {bFlat = bIn;} -private: - com::sun::star::uno::Reference<com::sun::star::frame::XModel> xModel; - sal_Bool bFlat; //set true for export to flat .mml, set false for - //export to a .sxm (or whatever) package - - ULONG ReadThroughComponent( - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModelComponent, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rFactory, - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > & rPropSet, - const sal_Char* pFilterName, - sal_Bool bEncrypted ); - - ULONG ReadThroughComponent( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModelComponent, - const sal_Char* pStreamName, - const sal_Char* pCompatibilityStreamName, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rFactory, - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > & rPropSet, - const sal_Char* pFilterName ); - - sal_Bool WriteThroughComponent( - ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > - xOutputStream, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > - xComponent, - ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory > & rFactory, - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > & rPropSet, - const sal_Char* pComponentName ); - sal_Bool WriteThroughComponent( - const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > - xComponent, - const sal_Char* pStreamName, - ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory > & rFactory, - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > & rPropSet, - const sal_Char* pComponentName, - sal_Bool bCompress=sal_True ); -}; - - -class SmXMLImport : public SvXMLImport -{ -public: - // #110680# - SmXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, - sal_uInt16 nImportFlags=IMPORT_ALL); - -#ifdef TL_NOT_USED_YET - // #110680# - SmXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, - com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel, - const rtl::OUString &rFileName); -#endif //TL_NOT_USED_YET - - // XServiceInfo (override parent method) - ::rtl::OUString SAL_CALL getImplementationName() - throw( ::com::sun::star::uno::RuntimeException ); - - void SAL_CALL endDocument(void) - throw( ::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException ); - sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< - sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException); - static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() - throw(); - SvXMLImportContext *CreateContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateMathContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateRowContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateFracContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateNumberContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateTextContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateAnnotationContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateStringContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateIdentifierContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateOperatorContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateSpaceContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateSqrtContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateRootContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateStyleContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreatePaddedContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreatePhantomContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateFencedContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateErrorContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateSubContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateSupContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateSubSupContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateUnderContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateOverContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateUnderOverContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateMultiScriptsContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateNoneContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreatePrescriptsContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateTableContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateTableRowContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateTableCellContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateAlignGroupContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - SvXMLImportContext *CreateActionContext(sal_uInt16 nPrefix, - const rtl::OUString &rLocalName, - const com::sun::star::uno::Reference < - com::sun::star::xml::sax::XAttributeList> &xAttrList); - - const SvXMLTokenMap &GetPresLayoutElemTokenMap(); - const SvXMLTokenMap &GetPresLayoutAttrTokenMap(); - const SvXMLTokenMap &GetFencedAttrTokenMap(); - const SvXMLTokenMap &GetOperatorAttrTokenMap(); - const SvXMLTokenMap &GetAnnotationAttrTokenMap(); - const SvXMLTokenMap &GetPresElemTokenMap(); - const SvXMLTokenMap &GetPresScriptEmptyElemTokenMap(); - const SvXMLTokenMap &GetPresTableElemTokenMap(); - const SvXMLTokenMap &GetColorTokenMap(); - virtual ~SmXMLImport() throw (); - SmNodeStack & GetNodeStack() {return aNodeStack;} - SmNode *GetTree() { return aNodeStack.Pop();} - sal_Bool GetSuccess() { return bSuccess; } - String &GetText() { return aText;} - - virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps); - virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps); - -private: - SvXMLTokenMap *pPresLayoutElemTokenMap; - SvXMLTokenMap *pPresLayoutAttrTokenMap; - SvXMLTokenMap *pFencedAttrTokenMap; - SvXMLTokenMap *pOperatorAttrTokenMap; - SvXMLTokenMap *pAnnotationAttrTokenMap; - SvXMLTokenMap *pPresElemTokenMap; - SvXMLTokenMap *pPresScriptEmptyElemTokenMap; - SvXMLTokenMap *pPresTableElemTokenMap; - SvXMLTokenMap *pColorTokenMap; - - SmNodeStack aNodeStack; - sal_Bool bSuccess; - String aText; -}; - -enum SmXMLMathElemTokenMap -{ - XML_TOK_MATH -}; - -enum SmXMLPresLayoutElemTokenMap -{ - XML_TOK_SEMANTICS, - XML_TOK_MSTYLE, - XML_TOK_MERROR, - XML_TOK_MPHANTOM, - XML_TOK_MROW, - XML_TOK_MFRAC, - XML_TOK_MSQRT, - XML_TOK_MROOT, - XML_TOK_MSUB, - XML_TOK_MSUP, - XML_TOK_MSUBSUP, - XML_TOK_MMULTISCRIPTS, - XML_TOK_MUNDER, - XML_TOK_MOVER, - XML_TOK_MUNDEROVER, - XML_TOK_MTABLE, - XML_TOK_MACTION, - XML_TOK_MFENCED, - XML_TOK_MPADDED -}; - -enum SmXMLPresLayoutAttrTokenMap -{ - XML_TOK_FONTWEIGHT, - XML_TOK_FONTSTYLE, - XML_TOK_FONTSIZE, - XML_TOK_FONTFAMILY, - XML_TOK_COLOR -}; - - -enum SmXMLFencedAttrTokenMap -{ - XML_TOK_OPEN, - XML_TOK_CLOSE -}; - - -enum SmXMLPresTableElemTokenMap -{ - XML_TOK_MTR, - XML_TOK_MTD -}; - -enum SmXMLPresElemTokenMap -{ - XML_TOK_ANNOTATION, - XML_TOK_MI, - XML_TOK_MN, - XML_TOK_MO, - XML_TOK_MTEXT, - XML_TOK_MSPACE, - XML_TOK_MS, - XML_TOK_MALIGNGROUP -}; - -enum SmXMLPresScriptEmptyElemTokenMap -{ - XML_TOK_MPRESCRIPTS, - XML_TOK_NONE -}; - -enum SmXMLOperatorAttrTokenMap -{ - XML_TOK_STRETCHY -}; - -enum SmXMLAnnotationAttrTokenMap -{ - XML_TOK_ENCODING -}; - - -class SmXMLExport : public SvXMLExport -{ -public: - // #110680# - SmXMLExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, - sal_uInt16 nExportFlags=EXPORT_ALL); - -#ifdef TL_NOT_USED_YET - // #110680# - SmXMLExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, - const SmNode *pIn, - const rtl::OUString &rFileName, - com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler); -#endif //TL_NOT_USED_YET - - virtual ~SmXMLExport() {}; - - // XServiceInfo (override parent method) - ::rtl::OUString SAL_CALL getImplementationName() - throw( ::com::sun::star::uno::RuntimeException ); - - void _ExportAutoStyles() {} - void _ExportMasterStyles() {} - void _ExportContent(); - sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum eClass); - - virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps); - virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps); - - sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< - sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException); - static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() - throw(); - - sal_Bool GetSuccess() {return bSuccess;} - -protected: - void ExportNodes(const SmNode *pIn,int nLevel); - void ExportTable(const SmNode *pIn,int nLevel); - void ExportLine(const SmNode *pNode,int nLevel); - void ExportExpression(const SmNode *pNode,int nLevel); - void ExportText(const SmNode *pNode, int nLevel); - void ExportMath(const SmNode *pNode, int nLevel); - void ExportPolygon(const SmNode *pNode, int nLevel); - void ExportBinaryHorizontal(const SmNode *pNode,int nLevel); - void ExportUnaryHorizontal(const SmNode *pNode,int nLevel); - void ExportBrace(const SmNode *pNode, int nLevel); - void ExportBinaryVertical(const SmNode *pNode,int nLevel); - void ExportSubSupScript(const SmNode *pNode,int nLevel); - void ExportRoot(const SmNode *pNode, int nLevel); - void ExportOperator(const SmNode *pNode, int nLevel); - void ExportAttributes(const SmNode *pNode, int nLevel); - void ExportFont(const SmNode *pNode, int nLevel); - void ExportVerticalBrace(const SmNode *pNode, int nLevel); - void ExportMatrix(const SmNode *pNode, int nLevel); - void ExportBlank(const SmNode *pNode, int nLevel); -private: - const SmNode *pTree; - String aText; - sal_Bool bSuccess; -}; -#endif +/*************************************************************************
+ *
+ * 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: x $
+ * $Revision: 1.00 $
+ *
+ * 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 _MATHMLIMPORT_HXX_
+#define _MATHMLIMPORT_HXX_
+
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlexp.hxx>
+#include <xmloff/DocumentSettingsContext.hxx>
+#include <xmloff/xmltoken.hxx>
+
+#include <node.hxx>
+
+class SfxMedium;
+namespace com { namespace sun { namespace star {
+ namespace io {
+ class XInputStream;
+ class XOutputStream; }
+ namespace beans {
+ class XPropertySet; }
+} } }
+
+////////////////////////////////////////////////////////////
+
+class SmXMLImportWrapper
+{
+ com::sun::star::uno::Reference<com::sun::star::frame::XModel> xModel;
+
+public:
+ SmXMLImportWrapper(com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rRef)
+ : xModel(rRef) {}
+
+ ULONG Import(SfxMedium &rMedium);
+
+ ULONG ReadThroughComponent(
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModelComponent,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const sal_Char* pFilterName,
+ sal_Bool bEncrypted );
+
+ ULONG ReadThroughComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModelComponent,
+ const sal_Char* pStreamName,
+ const sal_Char* pCompatibilityStreamName,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rFactory,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet,
+ const sal_Char* pFilterName );
+};
+
+////////////////////////////////////////////////////////////
+
+class SmXMLImport : public SvXMLImport
+{
+ SvXMLTokenMap *pPresLayoutElemTokenMap;
+ SvXMLTokenMap *pPresLayoutAttrTokenMap;
+ SvXMLTokenMap *pFencedAttrTokenMap;
+ SvXMLTokenMap *pOperatorAttrTokenMap;
+ SvXMLTokenMap *pAnnotationAttrTokenMap;
+ SvXMLTokenMap *pPresElemTokenMap;
+ SvXMLTokenMap *pPresScriptEmptyElemTokenMap;
+ SvXMLTokenMap *pPresTableElemTokenMap;
+ SvXMLTokenMap *pColorTokenMap;
+
+ SmNodeStack aNodeStack;
+ sal_Bool bSuccess;
+ String aText;
+
+public:
+ // #110680#
+ SmXMLImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+ sal_uInt16 nImportFlags=IMPORT_ALL);
+ virtual ~SmXMLImport() throw ();
+
+ // XServiceInfo (override parent method)
+ ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+
+ // XUnoTunnel
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException);
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+
+ void SAL_CALL endDocument(void)
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ SvXMLImportContext *CreateContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateMathContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateRowContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateFracContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateNumberContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateTextContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateAnnotationContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateStringContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateIdentifierContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateOperatorContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateSpaceContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateSqrtContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateRootContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateStyleContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreatePaddedContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreatePhantomContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateFencedContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateErrorContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateSubContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateSupContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateSubSupContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateUnderContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateOverContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateUnderOverContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateMultiScriptsContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateNoneContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreatePrescriptsContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateTableContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateTableRowContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateTableCellContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateAlignGroupContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+ SvXMLImportContext *CreateActionContext(sal_uInt16 nPrefix,
+ const rtl::OUString &rLocalName,
+ const com::sun::star::uno::Reference <
+ com::sun::star::xml::sax::XAttributeList> &xAttrList);
+
+ const SvXMLTokenMap &GetPresLayoutElemTokenMap();
+ const SvXMLTokenMap &GetPresLayoutAttrTokenMap();
+ const SvXMLTokenMap &GetFencedAttrTokenMap();
+ const SvXMLTokenMap &GetOperatorAttrTokenMap();
+ const SvXMLTokenMap &GetAnnotationAttrTokenMap();
+ const SvXMLTokenMap &GetPresElemTokenMap();
+ const SvXMLTokenMap &GetPresScriptEmptyElemTokenMap();
+ const SvXMLTokenMap &GetPresTableElemTokenMap();
+ const SvXMLTokenMap &GetColorTokenMap();
+
+ SmNodeStack & GetNodeStack() {return aNodeStack;}
+ SmNode *GetTree() { return aNodeStack.Pop();}
+ sal_Bool GetSuccess() { return bSuccess; }
+ String &GetText() { return aText;}
+
+ virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
+ virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
+};
+
+////////////////////////////////////////////////////////////
+
+enum SmXMLMathElemTokenMap
+{
+ XML_TOK_MATH
+};
+
+enum SmXMLPresLayoutElemTokenMap
+{
+ XML_TOK_SEMANTICS,
+ XML_TOK_MSTYLE,
+ XML_TOK_MERROR,
+ XML_TOK_MPHANTOM,
+ XML_TOK_MROW,
+ XML_TOK_MFRAC,
+ XML_TOK_MSQRT,
+ XML_TOK_MROOT,
+ XML_TOK_MSUB,
+ XML_TOK_MSUP,
+ XML_TOK_MSUBSUP,
+ XML_TOK_MMULTISCRIPTS,
+ XML_TOK_MUNDER,
+ XML_TOK_MOVER,
+ XML_TOK_MUNDEROVER,
+ XML_TOK_MTABLE,
+ XML_TOK_MACTION,
+ XML_TOK_MFENCED,
+ XML_TOK_MPADDED
+};
+
+enum SmXMLPresLayoutAttrTokenMap
+{
+ XML_TOK_FONTWEIGHT,
+ XML_TOK_FONTSTYLE,
+ XML_TOK_FONTSIZE,
+ XML_TOK_FONTFAMILY,
+ XML_TOK_COLOR
+};
+
+
+enum SmXMLFencedAttrTokenMap
+{
+ XML_TOK_OPEN,
+ XML_TOK_CLOSE
+};
+
+
+enum SmXMLPresTableElemTokenMap
+{
+ XML_TOK_MTR,
+ XML_TOK_MTD
+};
+
+enum SmXMLPresElemTokenMap
+{
+ XML_TOK_ANNOTATION,
+ XML_TOK_MI,
+ XML_TOK_MN,
+ XML_TOK_MO,
+ XML_TOK_MTEXT,
+ XML_TOK_MSPACE,
+ XML_TOK_MS,
+ XML_TOK_MALIGNGROUP
+};
+
+enum SmXMLPresScriptEmptyElemTokenMap
+{
+ XML_TOK_MPRESCRIPTS,
+ XML_TOK_NONE
+};
+
+enum SmXMLOperatorAttrTokenMap
+{
+ XML_TOK_STRETCHY
+};
+
+enum SmXMLAnnotationAttrTokenMap
+{
+ XML_TOK_ENCODING
+};
+
+////////////////////////////////////////////////////////////
+
+#endif
+
diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index 3e672225cc98..3f122d5c3e0a 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -1801,8 +1801,8 @@ int MathType::HandleRecords(int nLevel,sal_uInt8 nSelector, rRet.Erase(); newline--; } - else if ((nPart == 2) || (((nPart == 1) && - (nVariation == 0) || (nVariation == 1)))) + else if ((nPart == 2) || ((((nPart == 1) && + (nVariation == 0)) || (nVariation == 1)))) { sPush+=rRet; rRet = sPush; diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 114d6437bb62..ad3987549c0f 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -579,16 +579,16 @@ SmStructureNode::SmStructureNode( const SmStructureNode &rNode ) : SmNode( rNode.GetType(), rNode.GetToken() ) { ULONG i; - for (i = 0; i < aSubNodes.GetSize(); i++) - delete aSubNodes.Get(i); - aSubNodes.Clear(); + for (i = 0; i < aSubNodes.size(); i++) + delete aSubNodes[i]; + aSubNodes.resize(0); - ULONG nSize = rNode.aSubNodes.GetSize(); - aSubNodes.SetSize( nSize ); + ULONG nSize = rNode.aSubNodes.size(); + aSubNodes.resize( nSize ); for (i = 0; i < nSize; ++i) { - SmNode *pNode = rNode.aSubNodes.Get(i); - aSubNodes.Put( i, pNode ? new SmNode( *pNode ) : 0 ); + SmNode *pNode = rNode.aSubNodes[i]; + aSubNodes[i] = pNode ? new SmNode( *pNode ) : 0; } } @@ -608,16 +608,16 @@ SmStructureNode & SmStructureNode::operator = ( const SmStructureNode &rNode ) SmNode::operator = ( rNode ); ULONG i; - for (i = 0; i < aSubNodes.GetSize(); i++) - delete aSubNodes.Get(i); - aSubNodes.Clear(); + for (i = 0; i < aSubNodes.size(); i++) + delete aSubNodes[i]; + aSubNodes.resize(0); - ULONG nSize = rNode.aSubNodes.GetSize(); - aSubNodes.SetSize( nSize ); + ULONG nSize = rNode.aSubNodes.size(); + aSubNodes.resize( nSize ); for (i = 0; i < nSize; ++i) { - SmNode *pNode = rNode.aSubNodes.Get(i); - aSubNodes.Put( i, pNode ? new SmNode( *pNode ) : 0 ); + SmNode *pNode = rNode.aSubNodes[i]; + aSubNodes[i] = pNode ? new SmNode( *pNode ) : 0; } return *this; @@ -626,12 +626,14 @@ SmStructureNode & SmStructureNode::operator = ( const SmStructureNode &rNode ) void SmStructureNode::SetSubNodes(SmNode *pFirst, SmNode *pSecond, SmNode *pThird) { + size_t nSize = pThird ? 3 : (pSecond ? 2 : (pFirst ? 1 : 0)); + aSubNodes.resize( nSize ); if (pFirst) - aSubNodes.Put(0, pFirst); + aSubNodes[0] = pFirst; if (pSecond) - aSubNodes.Put(1, pSecond); + aSubNodes[1] = pSecond; if (pThird) - aSubNodes.Put(2, pThird); + aSubNodes[2] = pThird; } @@ -649,13 +651,13 @@ BOOL SmStructureNode::IsVisible() const USHORT SmStructureNode::GetNumSubNodes() const { - return (USHORT) aSubNodes.GetSize(); + return (USHORT) aSubNodes.size(); } SmNode * SmStructureNode::GetSubNode(USHORT nIndex) { - return aSubNodes.Get(nIndex); + return aSubNodes[nIndex]; } @@ -857,8 +859,6 @@ void SmLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) void SmExpressionNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) // as 'SmLineNode::Arrange' but keeps alignment of leftmost subnode { - DBG_ASSERT(GetNumSubNodes() > 0, "Sm: keine subnodes"); - SmLineNode::Arrange(rDev, rFormat); // copy alignment of leftmost subnode if any diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index 9e6f3581485e..83662e50b123 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -420,7 +420,7 @@ const sal_Int32 coStartFlags = // Continuing characters may be any alphanumeric or dot. const sal_Int32 coContFlags = - ( coStartFlags | KParseTokens::ASC_DOT ) & ~KParseTokens::IGNORE_LEADING_WS + ((coStartFlags | KParseTokens::ASC_DOT) & ~KParseTokens::IGNORE_LEADING_WS) | KParseTokens::TWO_DOUBLE_QUOTES_BREAK_STRING; // First character for numbers, may be any numeric or dot @@ -430,7 +430,7 @@ const sal_Int32 coNumStartFlags = KParseTokens::IGNORE_LEADING_WS; // Continuing characters for numbers, may be any numeric or dot. const sal_Int32 coNumContFlags = - ( coNumStartFlags | KParseTokens::ASC_DOT ) & ~KParseTokens::IGNORE_LEADING_WS; + (coNumStartFlags | KParseTokens::ASC_DOT) & ~KParseTokens::IGNORE_LEADING_WS; void SmParser::NextToken() { @@ -1037,10 +1037,10 @@ void SmParser::Table() ULONG n = NodeStack.Count(); - LineArray.SetSize(n); + LineArray.resize(n); for (ULONG i = 0; i < n; i++) - LineArray.Put(n - (i + 1), NodeStack.Pop()); + LineArray[n - (i + 1)] = NodeStack.Pop(); SmStructureNode *pSNode = new SmTableNode(CurToken); pSNode->SetSubNodes(LineArray); @@ -1107,15 +1107,15 @@ void SmParser::Line() USHORT n = 0; SmNodeArray ExpressionArray; - ExpressionArray.SetSize(n); + ExpressionArray.resize(n); // start with single expression that may have an alignment statement // (and go on with expressions that must not have alignment // statements in 'while' loop below. See also 'Expression()'.) if (CurToken.eType != TEND && CurToken.eType != TNEWLINE) { Align(); - ExpressionArray.SetSize(++n); - ExpressionArray.Put(n - 1, NodeStack.Pop()); + ExpressionArray.resize(++n); + ExpressionArray[n - 1] = NodeStack.Pop(); } while (CurToken.eType != TEND && CurToken.eType != TNEWLINE) @@ -1123,8 +1123,8 @@ void SmParser::Line() Expression(); else Align(); - ExpressionArray.SetSize(++n); - ExpressionArray.Put(n - 1, NodeStack.Pop()); + ExpressionArray.resize(++n); + ExpressionArray[n - 1] = NodeStack.Pop(); } SmStructureNode *pSNode = new SmLineNode(CurToken); @@ -1138,16 +1138,16 @@ void SmParser::Expression() USHORT n = 0; SmNodeArray RelationArray; - RelationArray.SetSize(n); + RelationArray.resize(n); Relation(); - RelationArray.SetSize(++n); - RelationArray.Put(n - 1, NodeStack.Pop()); + RelationArray.resize(++n); + RelationArray[n - 1] = NodeStack.Pop(); while (CurToken.nLevel >= 4) { Relation(); - RelationArray.SetSize(++n); - RelationArray.Put(n - 1, NodeStack.Pop()); + RelationArray.resize(++n); + RelationArray[n - 1] = NodeStack.Pop(); } SmStructureNode *pSNode = new SmExpressionNode(CurToken); @@ -1282,10 +1282,10 @@ void SmParser::SubSup(ULONG nActiveGroup) // initialize subnodes array SmNodeArray aSubNodes; - aSubNodes.SetSize(1 + SUBSUP_NUM_ENTRIES); - aSubNodes.Put(0, NodeStack.Pop()); - for (USHORT i = 1; i < aSubNodes.GetSize(); i++) - aSubNodes.Put(i, NULL); + aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES); + aSubNodes[0] = NodeStack.Pop(); + for (USHORT i = 1; i < aSubNodes.size(); i++) + aSubNodes[i] = NULL; // process all sub-/supscripts int nIndex = 0; @@ -1321,9 +1321,9 @@ void SmParser::SubSup(ULONG nActiveGroup) "SmParser::Power() : sub-/supscript index falsch"); // set sub-/supscript if not already done - if (aSubNodes.Get(nIndex) != NULL) + if (aSubNodes[nIndex] != NULL) Error(PE_DOUBLE_SUBSUPSCRIPT); - aSubNodes.Put(nIndex, NodeStack.Pop()); + aSubNodes[nIndex] = NodeStack.Pop(); } pNode->SetSubNodes(aSubNodes); @@ -1364,9 +1364,11 @@ void SmParser::Blank() } // Blanks am Zeilenende ignorieren wenn die entsprechende Option gesetzt ist - if (CurToken.eType == TNEWLINE || CurToken.eType == TEND - && SM_MOD1()->GetConfig()->IsIgnoreSpacesRight()) + if ( CurToken.eType == TNEWLINE || + (CurToken.eType == TEND && SM_MOD1()->GetConfig()->IsIgnoreSpacesRight()) ) + { pBlankNode->Clear(); + } NodeStack.Push(pBlankNode); } @@ -1499,7 +1501,7 @@ void SmParser::Term() USHORT n = 0; while (TRUE == (bIsAttr = TokenInGroup(TGATTRIBUT)) || TokenInGroup(TGFONTATTR)) - { aArray.SetSize(n + 1); + { aArray.resize(n + 1); if (bIsAttr) Attribut(); @@ -1509,7 +1511,7 @@ void SmParser::Term() // check if casting in following line is ok DBG_ASSERT(!NodeStack.Top()->IsVisible(), "Sm : Ooops..."); - aArray.Put(n, (SmStructureNode *) NodeStack.Pop()); + aArray[n] = (SmStructureNode *) NodeStack.Pop(); n++; } @@ -1517,8 +1519,8 @@ void SmParser::Term() SmNode *pFirstNode = NodeStack.Pop(); while (n > 0) - { aArray.Get(n - 1)->SetSubNodes(0, pFirstNode); - pFirstNode = aArray.Get(n - 1); + { aArray[n - 1]->SetSubNodes(0, pFirstNode); + pFirstNode = aArray[n - 1]; n--; } NodeStack.Push(pFirstNode); @@ -2111,9 +2113,9 @@ void SmParser::Bracebody(BOOL bIsLeftRight) } // build argument vector in parsing order - aNodes.SetSize(nNum); + aNodes.resize(nNum); for (USHORT i = 0; i < nNum; i++) - aNodes.Put(nNum - 1 - i, NodeStack.Pop()); + aNodes[nNum - 1 - i] = NodeStack.Pop(); pBody->SetSubNodes(aNodes); pBody->SetScaleMode(bIsLeftRight ? SCALE_HEIGHT : SCALE_NONE); @@ -2168,10 +2170,10 @@ void SmParser::Binom() Sum(); Sum(); - ExpressionArray.SetSize(2); + ExpressionArray.resize(2); for (int i = 0; i < 2; i++) - ExpressionArray.Put(2 - (i + 1), NodeStack.Pop()); + ExpressionArray[2 - (i + 1)] = NodeStack.Pop(); pSNode->SetSubNodes(ExpressionArray); NodeStack.Push(pSNode); @@ -2194,10 +2196,10 @@ void SmParser::Stack() } while (CurToken.eType == TPOUND); - ExpressionArray.SetSize(n); + ExpressionArray.resize(n); for (USHORT i = 0; i < n; i++) - ExpressionArray.Put(n - (i + 1), NodeStack.Pop()); + ExpressionArray[n - (i + 1)] = NodeStack.Pop(); if (CurToken.eType != TRGROUP) Error(PE_RGROUP_EXPECTED); @@ -2254,10 +2256,10 @@ void SmParser::Matrix() long nRC = r * c; - ExpressionArray.SetSize(nRC); + ExpressionArray.resize(nRC); for (USHORT i = 0; i < (nRC); i++) - ExpressionArray.Put((nRC) - (i + 1), NodeStack.Pop()); + ExpressionArray[(nRC) - (i + 1)] = NodeStack.Pop(); if (CurToken.eType != TRGROUP) Error(PE_RGROUP_EXPECTED); diff --git a/starmath/source/smres.src b/starmath/source/smres.src index c77cf57e7431..6939bd328283 100644 --- a/starmath/source/smres.src +++ b/starmath/source/smres.src @@ -29,8 +29,6 @@ ************************************************************************/ - - #include <sfx2/sfx.hrc> #include <svx/globlmn.hrc> #include "starmath.hrc" @@ -1576,7 +1574,7 @@ FloatingWindow RID_TOOLBOXWINDOW OutputSize = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 0 , 0 ) ; - Text [ en-US ] = "Selection" ; + Text [ en-US ] = "Formula Elements" ; ToolBox 1 { diff --git a/starmath/source/types.cxx b/starmath/source/types.cxx index fe3ddd521de3..6a4fe919ae95 100644 --- a/starmath/source/types.cxx +++ b/starmath/source/types.cxx @@ -80,6 +80,7 @@ static MathConversionEntry aMathConvTbl[] = { MS_LEFTARROW, 0x2190, 0 }, { MS_UPARROW, 0x2191, 0 }, { MS_DOWNARROW, 0x2193, 0 }, + { MS_PLACE, 0x2751, 0 }, // predefined-user-defined symbols // (code-points on the left as defined in 'officecfg' for SO8, @@ -201,7 +202,6 @@ sal_Unicode ConvertMathToMathType( sal_Unicode cChar ) } return cRes; } -#endif //TL_NOT_YET_USED sal_Unicode ConvertMathTypeToMath( sal_Unicode cChar ) { @@ -217,6 +217,7 @@ sal_Unicode ConvertMathTypeToMath( sal_Unicode cChar ) } return cRes; } +#endif //TL_NOT_YET_USED sal_Unicode ConvertMathToMathML( sal_Unicode cChar ) { diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 29a8164c1309..3491044e35b5 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -1,3 +1,4 @@ +<<<<<<< local
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1124,3 +1125,1033 @@ void SAL_CALL SmModel::setParent( const uno::Reference< uno::XInterface >& xPare }
}
+=======
+/************************************************************************* + * + * 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: unomodel.cxx,v $ + * $Revision: 1.49 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_starmath.hxx" + + +#include <vos/mutex.hxx> +#include <osl/mutex.hxx> +#include <sfx2/printer.hxx> +#include <vcl/svapp.hxx> +#include <svtools/ctrltool.hxx> +#include <svtools/itemprop.hxx> +#include <unotools/localedatawrapper.hxx> +#include <unotools/processfactory.hxx> +#include <svx/paperinf.hxx> +#include <vcl/settings.hxx> +#include <toolkit/awt/vclxdevice.hxx> +#include <com/sun/star/beans/PropertyState.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/formula/SymbolDescriptor.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/script/XLibraryContainer.hpp> +#include <xmloff/xmluconv.hxx> +#include <rtl/ustrbuf.hxx> +#include <comphelper/propertysetinfo.hxx> +#include <unomodel.hxx> +#include <document.hxx> +#include <view.hxx> +#include <symbol.hxx> +#ifndef STARMATH_HRC +#include <starmath.hrc> +#endif +#include <config.hxx> + +#include <smdll.hxx> + +using namespace ::vos; +using namespace ::rtl; +using namespace ::cppu; +using namespace ::std; +using namespace ::comphelper; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::formula; +using namespace ::com::sun::star::view; +using namespace ::com::sun::star::script; + +#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) +#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) + + +//////////////////////////////////////// +// +// class SmModel +// +#define PROPERTY_NONE 0 +enum SmModelPropertyHandles +{ + HANDLE_FORMULA, + HANDLE_FONT_NAME_VARIABLES, + HANDLE_FONT_NAME_FUNCTIONS, + HANDLE_FONT_NAME_NUMBERS, + HANDLE_FONT_NAME_TEXT, + HANDLE_CUSTOM_FONT_NAME_SERIF, + HANDLE_CUSTOM_FONT_NAME_SANS, + HANDLE_CUSTOM_FONT_NAME_FIXED, + HANDLE_CUSTOM_FONT_FIXED_POSTURE, + HANDLE_CUSTOM_FONT_FIXED_WEIGHT, + HANDLE_CUSTOM_FONT_SANS_POSTURE, + HANDLE_CUSTOM_FONT_SANS_WEIGHT, + HANDLE_CUSTOM_FONT_SERIF_POSTURE, + HANDLE_CUSTOM_FONT_SERIF_WEIGHT, + HANDLE_FONT_VARIABLES_POSTURE, + HANDLE_FONT_VARIABLES_WEIGHT, + HANDLE_FONT_FUNCTIONS_POSTURE, + HANDLE_FONT_FUNCTIONS_WEIGHT, + HANDLE_FONT_NUMBERS_POSTURE, + HANDLE_FONT_NUMBERS_WEIGHT, + HANDLE_FONT_TEXT_POSTURE, + HANDLE_FONT_TEXT_WEIGHT, + HANDLE_BASE_FONT_HEIGHT, + HANDLE_RELATIVE_FONT_HEIGHT_TEXT, + HANDLE_RELATIVE_FONT_HEIGHT_INDICES, + HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS, + HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS, + HANDLE_RELATIVE_FONT_HEIGHT_LIMITS, + HANDLE_IS_TEXT_MODE, + HANDLE_ALIGNMENT, + HANDLE_RELATIVE_SPACING, + HANDLE_RELATIVE_LINE_SPACING, + HANDLE_RELATIVE_ROOT_SPACING, + HANDLE_RELATIVE_INDEX_SUPERSCRIPT, + HANDLE_RELATIVE_INDEX_SUBSCRIPT, + HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT, + HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH, + HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH, + HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT, + HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE, + HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE, + HANDLE_RELATIVE_BRACKET_EXCESS_SIZE, + HANDLE_RELATIVE_BRACKET_DISTANCE, + HANDLE_IS_SCALE_ALL_BRACKETS, + HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE, + HANDLE_RELATIVE_MATRIX_LINE_SPACING, + HANDLE_RELATIVE_MATRIX_COLUMN_SPACING, + HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT, + HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT, + HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE, + HANDLE_RELATIVE_OPERATOR_SPACING, + HANDLE_LEFT_MARGIN, + HANDLE_RIGHT_MARGIN, + HANDLE_TOP_MARGIN, + HANDLE_BOTTOM_MARGIN, + HANDLE_PRINTER_NAME, + HANDLE_PRINTER_SETUP, + HANDLE_SYMBOLS, + HANDLE_BASIC_LIBRARIES, /* #93295# */ + HANDLE_RUNTIME_UID, + // --> PB 2004-08-25 #i33095# Security Options + HANDLE_LOAD_READONLY, + // <-- + HANDLE_DIALOG_LIBRARIES // #i73329# +}; + +PropertySetInfo * lcl_createModelPropertyInfo () +{ + static PropertyMapEntry aModelPropertyInfoMap[] = + { + { RTL_CONSTASCII_STRINGPARAM( "Alignment" ), HANDLE_ALIGNMENT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, + { RTL_CONSTASCII_STRINGPARAM( "BaseFontHeight" ), HANDLE_BASE_FONT_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, + { RTL_CONSTASCII_STRINGPARAM( "BasicLibraries" ), HANDLE_BASIC_LIBRARIES , &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), PropertyAttribute::READONLY, 0}, + { RTL_CONSTASCII_STRINGPARAM( "BottomMargin" ), HANDLE_BOTTOM_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BOTTOMSPACE }, + { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameFixed" ), HANDLE_CUSTOM_FONT_NAME_FIXED , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_FIXED }, + { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameSans" ), HANDLE_CUSTOM_FONT_NAME_SANS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_SANS }, + { RTL_CONSTASCII_STRINGPARAM( "CustomFontNameSerif" ), HANDLE_CUSTOM_FONT_NAME_SERIF , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_SERIF }, + { RTL_CONSTASCII_STRINGPARAM( "DialogLibraries" ), HANDLE_DIALOG_LIBRARIES , &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), PropertyAttribute::READONLY, 0}, + { RTL_CONSTASCII_STRINGPARAM( "FontFixedIsBold"), HANDLE_CUSTOM_FONT_FIXED_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FIXED}, + { RTL_CONSTASCII_STRINGPARAM( "FontFixedIsItalic"), HANDLE_CUSTOM_FONT_FIXED_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FIXED}, + { RTL_CONSTASCII_STRINGPARAM( "FontFunctionsIsBold"), HANDLE_FONT_FUNCTIONS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FUNCTION}, + { RTL_CONSTASCII_STRINGPARAM( "FontFunctionsIsItalic"), HANDLE_FONT_FUNCTIONS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_FUNCTION}, + { RTL_CONSTASCII_STRINGPARAM( "FontNameFunctions" ), HANDLE_FONT_NAME_FUNCTIONS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_FUNCTION }, + { RTL_CONSTASCII_STRINGPARAM( "FontNameNumbers" ), HANDLE_FONT_NAME_NUMBERS , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_NUMBER }, + { RTL_CONSTASCII_STRINGPARAM( "FontNameText" ), HANDLE_FONT_NAME_TEXT , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_TEXT }, + { RTL_CONSTASCII_STRINGPARAM( "FontNameVariables" ), HANDLE_FONT_NAME_VARIABLES , &::getCppuType((const OUString*)0), PROPERTY_NONE, FNT_VARIABLE }, + { RTL_CONSTASCII_STRINGPARAM( "FontNumbersIsBold"), HANDLE_FONT_NUMBERS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_NUMBER}, + { RTL_CONSTASCII_STRINGPARAM( "FontNumbersIsItalic"), HANDLE_FONT_NUMBERS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_NUMBER}, + { RTL_CONSTASCII_STRINGPARAM( "FontSansIsBold"), HANDLE_CUSTOM_FONT_SANS_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SANS}, + { RTL_CONSTASCII_STRINGPARAM( "FontSansIsItalic"), HANDLE_CUSTOM_FONT_SANS_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SANS}, + { RTL_CONSTASCII_STRINGPARAM( "FontSerifIsBold"), HANDLE_CUSTOM_FONT_SERIF_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SERIF}, + { RTL_CONSTASCII_STRINGPARAM( "FontSerifIsItalic"), HANDLE_CUSTOM_FONT_SERIF_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_SERIF}, + { RTL_CONSTASCII_STRINGPARAM( "FontTextIsBold"), HANDLE_FONT_TEXT_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_TEXT}, + { RTL_CONSTASCII_STRINGPARAM( "FontTextIsItalic"), HANDLE_FONT_TEXT_POSTURE , &::getBooleanCppuType(), PROPERTY_NONE, FNT_TEXT}, + { RTL_CONSTASCII_STRINGPARAM( "FontVariablesIsBold"), HANDLE_FONT_VARIABLES_WEIGHT , &::getBooleanCppuType(), PROPERTY_NONE, FNT_VARIABLE}, + { RTL_CONSTASCII_STRINGPARAM( "FontVariablesIsItalic"), HANDLE_FONT_VARIABLES_POSTURE, &::getBooleanCppuType(), PROPERTY_NONE, FNT_VARIABLE}, + { RTL_CONSTASCII_STRINGPARAM( "Formula" ), HANDLE_FORMULA , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, + { RTL_CONSTASCII_STRINGPARAM( "IsScaleAllBrackets" ), HANDLE_IS_SCALE_ALL_BRACKETS , &::getBooleanCppuType(), PROPERTY_NONE, 0}, + { RTL_CONSTASCII_STRINGPARAM( "IsTextMode" ), HANDLE_IS_TEXT_MODE , &::getBooleanCppuType(), PROPERTY_NONE, 0}, + { RTL_CONSTASCII_STRINGPARAM( "LeftMargin" ), HANDLE_LEFT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_LEFTSPACE }, + { RTL_CONSTASCII_STRINGPARAM( "PrinterName" ), HANDLE_PRINTER_NAME , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0 }, + { RTL_CONSTASCII_STRINGPARAM( "PrinterSetup" ), HANDLE_PRINTER_SETUP , &::getCppuType((const Sequence < sal_Int8 >*)0), PROPERTY_NONE, 0 }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeBracketDistance" ), HANDLE_RELATIVE_BRACKET_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BRACKETSPACE }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeBracketExcessSize" ), HANDLE_RELATIVE_BRACKET_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_BRACKETSIZE }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightFunctions" ), HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_FUNCTION}, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightIndices" ), HANDLE_RELATIVE_FONT_HEIGHT_INDICES , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_INDEX }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightLimits" ), HANDLE_RELATIVE_FONT_HEIGHT_LIMITS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_LIMITS }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightOperators" ), HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_OPERATOR}, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFontHeightText" ), HANDLE_RELATIVE_FONT_HEIGHT_TEXT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, SIZ_TEXT }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionBarExcessLength"), HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_FRACTION }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionBarLineWeight" ), HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_STROKEWIDTH }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionDenominatorDepth"), HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_DENOMINATOR }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeFractionNumeratorHeight" ), HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_NUMERATOR }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeIndexSubscript" ), HANDLE_RELATIVE_INDEX_SUBSCRIPT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_SUBSCRIPT }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeIndexSuperscript" ), HANDLE_RELATIVE_INDEX_SUPERSCRIPT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_SUPERSCRIPT }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeLineSpacing" ), HANDLE_RELATIVE_LINE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_VERTICAL }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeLowerLimitDistance" ), HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_LOWERLIMIT }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeMatrixColumnSpacing" ), HANDLE_RELATIVE_MATRIX_COLUMN_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_MATRIXCOL}, + { RTL_CONSTASCII_STRINGPARAM( "RelativeMatrixLineSpacing" ), HANDLE_RELATIVE_MATRIX_LINE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_MATRIXROW}, + { RTL_CONSTASCII_STRINGPARAM( "RelativeOperatorExcessSize" ), HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_OPERATORSIZE }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeOperatorSpacing" ), HANDLE_RELATIVE_OPERATOR_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_OPERATORSPACE}, + { RTL_CONSTASCII_STRINGPARAM( "RelativeRootSpacing" ), HANDLE_RELATIVE_ROOT_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ROOT }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeScaleBracketExcessSize" ), HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_NORMALBRACKETSIZE}, + { RTL_CONSTASCII_STRINGPARAM( "RelativeSpacing" ), HANDLE_RELATIVE_SPACING , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_HORIZONTAL }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeSymbolMinimumHeight" ), HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ORNAMENTSPACE }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeSymbolPrimaryHeight" ), HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_ORNAMENTSIZE }, + { RTL_CONSTASCII_STRINGPARAM( "RelativeUpperLimitDistance" ), HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_UPPERLIMIT }, + { RTL_CONSTASCII_STRINGPARAM( "RightMargin" ), HANDLE_RIGHT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_RIGHTSPACE }, + { RTL_CONSTASCII_STRINGPARAM( "RuntimeUID" ), HANDLE_RUNTIME_UID , &::getCppuType(static_cast< const rtl::OUString * >(0)), PropertyAttribute::READONLY, 0 }, + { RTL_CONSTASCII_STRINGPARAM( "Symbols" ), HANDLE_SYMBOLS , &::getCppuType((const Sequence < SymbolDescriptor > *)0), PROPERTY_NONE, 0 }, + { RTL_CONSTASCII_STRINGPARAM( "TopMargin" ), HANDLE_TOP_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_TOPSPACE }, + // --> PB 2004-08-25 #i33095# Security Options + { RTL_CONSTASCII_STRINGPARAM( "LoadReadonly" ), HANDLE_LOAD_READONLY, &::getBooleanCppuType(), PROPERTY_NONE, 0 }, + // <-- + { NULL, 0, 0, NULL, 0, 0 } + }; + PropertySetInfo *pInfo = new PropertySetInfo ( aModelPropertyInfoMap ); + return pInfo; +} +//----------------------------------------------------------------------- +SmModel::SmModel( SfxObjectShell *pObjSh ) +: SfxBaseModel(pObjSh) +, PropertySetHelper ( lcl_createModelPropertyInfo () ) +{ +} +//----------------------------------------------------------------------- +SmModel::~SmModel() throw () +{ +} +/*-- 28.03.00 14:18:17--------------------------------------------------- + + -----------------------------------------------------------------------*/ +uno::Any SAL_CALL SmModel::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException) +{ + uno::Any aRet = ::cppu::queryInterface ( rType, + // OWeakObject interfaces + dynamic_cast< XInterface* > ( static_cast< XUnoTunnel* > ( this )), + static_cast< XWeak* > ( this ), + // PropertySetHelper interfaces + static_cast< XPropertySet* > ( this ), + static_cast< XMultiPropertySet* > ( this ), + //static_cast< XPropertyState* > ( this ), + // my own interfaces + static_cast< XServiceInfo* > ( this ), + static_cast< XRenderable* > ( this ) ); + if (!aRet.hasValue()) + aRet = SfxBaseModel::queryInterface ( rType ); + return aRet; +} +/*-- 28.03.00 14:18:18--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SAL_CALL SmModel::acquire() throw() +{ + OWeakObject::acquire(); +} +/*-- 28.03.00 14:18:18--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SAL_CALL SmModel::release() throw() +{ + OWeakObject::release(); +} +/*-- 28.03.00 14:18:19--------------------------------------------------- + + -----------------------------------------------------------------------*/ +uno::Sequence< uno::Type > SAL_CALL SmModel::getTypes( ) throw(uno::RuntimeException) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes(); + sal_Int32 nLen = aTypes.getLength(); + aTypes.realloc(nLen + 4); + uno::Type* pTypes = aTypes.getArray(); + pTypes[nLen++] = ::getCppuType((Reference<XServiceInfo>*)0); + pTypes[nLen++] = ::getCppuType((Reference<XPropertySet>*)0); + pTypes[nLen++] = ::getCppuType((Reference<XMultiPropertySet>*)0); + pTypes[nLen++] = ::getCppuType((Reference<XRenderable>*)0); + + // XPropertyState not supported?? (respective virtual functions from + // PropertySetHelper not overloaded) + //pTypes[nLen++] = ::getCppuType((Reference<XPropertyState>*)0); + + return aTypes; +} +/* -----------------------------28.03.00 14:23-------------------------------- + + ---------------------------------------------------------------------------*/ +const uno::Sequence< sal_Int8 > & SmModel::getUnoTunnelId() +{ + static osl::Mutex aCreateMutex; + osl::Guard<osl::Mutex> aGuard( aCreateMutex ); + + static uno::Sequence< sal_Int8 > aSeq; + if(!aSeq.getLength()) + { + aSeq.realloc( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + } + return aSeq; +} /* -----------------------------28.03.00 14:23-------------------------------- + + ---------------------------------------------------------------------------*/ +sal_Int64 SAL_CALL SmModel::getSomething( const uno::Sequence< sal_Int8 >& rId ) + throw(uno::RuntimeException) +{ + if( rId.getLength() == 16 + && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); + } + + return SfxBaseModel::getSomething( rId ); +} +/*-- 07.01.00 16:32:59--------------------------------------------------- + + -----------------------------------------------------------------------*/ +/*-- 07.01.00 16:33:00--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Int16 lcl_AnyToINT16(const uno::Any& rAny) +{ + uno::TypeClass eType = rAny.getValueType().getTypeClass(); + + sal_Int16 nRet = 0; + if( eType == uno::TypeClass_DOUBLE ) + nRet = (sal_Int16)*(double*)rAny.getValue(); + else if( eType == uno::TypeClass_FLOAT ) + nRet = (sal_Int16)*(float*)rAny.getValue(); + else + rAny >>= nRet; + return nRet; +} +//----------------------------------------------------------------------------- + +OUString SmModel::getImplementationName(void) throw( uno::RuntimeException ) +{ + return getImplementationName_Static(); +} + + +::rtl::OUString SmModel::getImplementationName_Static() +{ + return rtl::OUString::createFromAscii("com.sun.star.comp.math.FormulaDocument"); +} + +/*-- 20.01.04 11:21:00--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Bool SmModel::supportsService(const OUString& rServiceName) throw( uno::RuntimeException ) +{ + return ( + rServiceName == A2OU("com.sun.star.document.OfficeDocument" ) || + rServiceName == A2OU("com.sun.star.formula.FormulaProperties") + ); +} +/*-- 20.01.04 11:21:00--------------------------------------------------- + + -----------------------------------------------------------------------*/ +uno::Sequence< OUString > SmModel::getSupportedServiceNames(void) throw( uno::RuntimeException ) +{ + return getSupportedServiceNames_Static(); +} + +uno::Sequence< OUString > SmModel::getSupportedServiceNames_Static(void) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + + uno::Sequence< OUString > aRet(2); + OUString* pArray = aRet.getArray(); + pArray[0] = A2OU("com.sun.star.document.OfficeDocument"); + pArray[1] = A2OU("com.sun.star.formula.FormulaProperties"); + return aRet; +} + +void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any* pValues) + throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + + SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell()); + + if ( NULL == pDocSh ) + throw UnknownPropertyException(); + + SmFormat aFormat = pDocSh->GetFormat(); + + for (; *ppEntries; ppEntries++, pValues++ ) + { + if ((*ppEntries)->mnAttributes & PropertyAttribute::READONLY) + throw PropertyVetoException(); + + switch ( (*ppEntries)->mnHandle ) + { + case HANDLE_FORMULA: + { + OUString aText; + *pValues >>= aText; + pDocSh->SetText(aText); + } + break; + case HANDLE_FONT_NAME_VARIABLES : + case HANDLE_FONT_NAME_FUNCTIONS : + case HANDLE_FONT_NAME_NUMBERS : + case HANDLE_FONT_NAME_TEXT : + case HANDLE_CUSTOM_FONT_NAME_SERIF : + case HANDLE_CUSTOM_FONT_NAME_SANS : + case HANDLE_CUSTOM_FONT_NAME_FIXED : + { + OUString aText; + *pValues >>= aText; + String sFontName = aText; + if(!sFontName.Len()) + throw IllegalArgumentException(); + + if(aFormat.GetFont((*ppEntries)->mnMemberId).GetName() != sFontName) + { + const SmFace rOld = aFormat.GetFont((*ppEntries)->mnMemberId); + + SmFace aSet( sFontName, rOld.GetSize() ); + aSet.SetBorderWidth( rOld.GetBorderWidth() ); + aSet.SetAlign( ALIGN_BASELINE ); + aFormat.SetFont( (*ppEntries)->mnMemberId, aSet ); + } + } + break; + case HANDLE_CUSTOM_FONT_FIXED_POSTURE: + case HANDLE_CUSTOM_FONT_SANS_POSTURE : + case HANDLE_CUSTOM_FONT_SERIF_POSTURE: + case HANDLE_FONT_VARIABLES_POSTURE : + case HANDLE_FONT_FUNCTIONS_POSTURE : + case HANDLE_FONT_NUMBERS_POSTURE : + case HANDLE_FONT_TEXT_POSTURE : + { + if((*pValues).getValueType() != ::getBooleanCppuType()) + throw IllegalArgumentException(); + BOOL bVal = *(sal_Bool*)(*pValues).getValue(); + Font aNewFont(aFormat.GetFont((*ppEntries)->mnMemberId)); + aNewFont.SetItalic((bVal) ? ITALIC_NORMAL : ITALIC_NONE); + aFormat.SetFont((*ppEntries)->mnMemberId, aNewFont); + } + break; + case HANDLE_CUSTOM_FONT_FIXED_WEIGHT : + case HANDLE_CUSTOM_FONT_SANS_WEIGHT : + case HANDLE_CUSTOM_FONT_SERIF_WEIGHT : + case HANDLE_FONT_VARIABLES_WEIGHT : + case HANDLE_FONT_FUNCTIONS_WEIGHT : + case HANDLE_FONT_NUMBERS_WEIGHT : + case HANDLE_FONT_TEXT_WEIGHT : + { + if((*pValues).getValueType() != ::getBooleanCppuType()) + throw IllegalArgumentException(); + BOOL bVal = *(sal_Bool*)(*pValues).getValue(); + Font aNewFont(aFormat.GetFont((*ppEntries)->mnMemberId)); + aNewFont.SetWeight((bVal) ? WEIGHT_BOLD : WEIGHT_NORMAL); + aFormat.SetFont((*ppEntries)->mnMemberId, aNewFont); + } + break; + case HANDLE_BASE_FONT_HEIGHT : + { + // Point! + sal_Int16 nVal = lcl_AnyToINT16(*pValues); + if(nVal < 1) + throw IllegalArgumentException(); + Size aSize = aFormat.GetBaseSize(); + nVal *= 20; + nVal = static_cast < sal_Int16 > ( TWIP_TO_MM100(nVal) ); + aSize.Height() = nVal; + aFormat.SetBaseSize(aSize); + + // apply base size to fonts + const Size aTmp( aFormat.GetBaseSize() ); + for (USHORT i = FNT_BEGIN; i <= FNT_END; i++) + aFormat.SetFontSize(i, aTmp); + } + break; + case HANDLE_RELATIVE_FONT_HEIGHT_TEXT : + case HANDLE_RELATIVE_FONT_HEIGHT_INDICES : + case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS : + case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS : + case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS : + { + sal_Int16 nVal = 0; + *pValues >>= nVal; + if(nVal < 1) + throw IllegalArgumentException(); + aFormat.SetRelSize((*ppEntries)->mnMemberId, nVal); + } + break; + + case HANDLE_IS_TEXT_MODE : + { + aFormat.SetTextmode(*(sal_Bool*)(*pValues).getValue()); + } + break; + + case HANDLE_ALIGNMENT : + { + // SmHorAlign uses the same values as HorizontalAlignment + sal_Int16 nVal = 0; + *pValues >>= nVal; + if(nVal < 0 || nVal > 2) + throw IllegalArgumentException(); + aFormat.SetHorAlign((SmHorAlign)nVal); + } + break; + + case HANDLE_RELATIVE_SPACING : + case HANDLE_RELATIVE_LINE_SPACING : + case HANDLE_RELATIVE_ROOT_SPACING : + case HANDLE_RELATIVE_INDEX_SUPERSCRIPT : + case HANDLE_RELATIVE_INDEX_SUBSCRIPT : + case HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT : + case HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH: + case HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH: + case HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT : + case HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE : + case HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE : + case HANDLE_RELATIVE_BRACKET_EXCESS_SIZE : + case HANDLE_RELATIVE_BRACKET_DISTANCE : + case HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE : + case HANDLE_RELATIVE_MATRIX_LINE_SPACING : + case HANDLE_RELATIVE_MATRIX_COLUMN_SPACING : + case HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT : + case HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT : + case HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE : + case HANDLE_RELATIVE_OPERATOR_SPACING : + case HANDLE_LEFT_MARGIN : + case HANDLE_RIGHT_MARGIN : + case HANDLE_TOP_MARGIN : + case HANDLE_BOTTOM_MARGIN : + { + sal_Int16 nVal = 0; + *pValues >>= nVal; + if(nVal < 0) + throw IllegalArgumentException(); + aFormat.SetDistance((*ppEntries)->mnMemberId, nVal); + } + break; + case HANDLE_IS_SCALE_ALL_BRACKETS : + aFormat.SetScaleNormalBrackets(*(sal_Bool*)(*pValues).getValue()); + break; + case HANDLE_PRINTER_NAME: + { + // embedded documents just ignore this property for now + if ( pDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + { + SfxPrinter *pPrinter = pDocSh->GetPrinter ( ); + if (pPrinter) + { + OUString sPrinterName; + if (*pValues >>= sPrinterName ) + { + if ( sPrinterName.getLength() ) + { + SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName ); + if (pNewPrinter->IsKnown()) + pDocSh->SetPrinter ( pNewPrinter ); + else + delete pNewPrinter; + } + } + else + throw IllegalArgumentException(); + } + } + } + break; + case HANDLE_PRINTER_SETUP: + { + Sequence < sal_Int8 > aSequence; + if ( *pValues >>= aSequence ) + { + sal_uInt32 nSize = aSequence.getLength(); + SvMemoryStream aStream ( aSequence.getArray(), nSize, STREAM_READ ); + aStream.Seek ( STREAM_SEEK_TO_BEGIN ); + static sal_uInt16 __READONLY_DATA nRange[] = + { + SID_PRINTSIZE, SID_PRINTSIZE, + SID_PRINTZOOM, SID_PRINTZOOM, + SID_PRINTTITLE, SID_PRINTTITLE, + SID_PRINTTEXT, SID_PRINTTEXT, + SID_PRINTFRAME, SID_PRINTFRAME, + SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES, + 0 + }; + SfxItemSet *pItemSet = new SfxItemSet( pDocSh->GetPool(), nRange ); + SmModule *pp = SM_MOD1(); + pp->GetConfig()->ConfigToItemSet(*pItemSet); + SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet ); + + pDocSh->SetPrinter( pPrinter ); + } + else + throw IllegalArgumentException(); + } + break; + case HANDLE_SYMBOLS: + { + // this is set + Sequence < SymbolDescriptor > aSequence; + if ( *pValues >>= aSequence ) + { + sal_uInt32 nSize = aSequence.getLength(); + SmModule *pp = SM_MOD1(); + SmSymSetManager &rManager = pp->GetSymSetManager(); + SymbolDescriptor *pDescriptor = aSequence.getArray(); + for (sal_uInt32 i = 0; i < nSize ; i++, pDescriptor++) + { + Font aFont; + aFont.SetName ( pDescriptor->sFontName ); + aFont.SetCharSet ( static_cast < rtl_TextEncoding > (pDescriptor->nCharSet) ); + aFont.SetFamily ( static_cast < FontFamily > (pDescriptor->nFamily ) ); + aFont.SetPitch ( static_cast < FontPitch > (pDescriptor->nPitch ) ); + aFont.SetWeight ( static_cast < FontWeight > (pDescriptor->nWeight ) ); + aFont.SetItalic ( static_cast < FontItalic > (pDescriptor->nItalic ) ); + SmSym aSymbol ( pDescriptor->sName, aFont, static_cast < sal_Unicode > (pDescriptor->nCharacter), + pDescriptor->sSymbolSet ); + aSymbol.SetExportName ( pDescriptor->sExportName ); + aSymbol.SetDocSymbol( TRUE ); + rManager.AddReplaceSymbol ( aSymbol ); + } + } + else + throw IllegalArgumentException(); + } + break; + // --> PB 2004-08-25 #i33095# Security Options + case HANDLE_LOAD_READONLY : + { + if ( (*pValues).getValueType() != ::getBooleanCppuType() ) + throw IllegalArgumentException(); + sal_Bool bReadonly = FALSE; + if ( *pValues >>= bReadonly ) + pDocSh->SetLoadReadonly( bReadonly ); + break; + } + // <-- + } + } + + pDocSh->SetFormat( aFormat ); + + // #i67283# since about all of the above changes are likely to change + // the formula size we have to recalculate the vis-area now + pDocSh->SetVisArea( Rectangle( Point(0, 0), pDocSh->GetSize() ) ); +} + +void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValue ) + throw( UnknownPropertyException, WrappedTargetException ) +{ + SmDocShell *pDocSh = static_cast < SmDocShell * > (GetObjectShell()); + + if ( NULL == pDocSh ) + throw UnknownPropertyException(); + + const SmFormat & aFormat = pDocSh->GetFormat(); + + for (; *ppEntries; ppEntries++, pValue++ ) + { + switch ( (*ppEntries)->mnHandle ) + { + case HANDLE_FORMULA: + *pValue <<= OUString(pDocSh->GetText()); + break; + case HANDLE_FONT_NAME_VARIABLES : + case HANDLE_FONT_NAME_FUNCTIONS : + case HANDLE_FONT_NAME_NUMBERS : + case HANDLE_FONT_NAME_TEXT : + case HANDLE_CUSTOM_FONT_NAME_SERIF : + case HANDLE_CUSTOM_FONT_NAME_SANS : + case HANDLE_CUSTOM_FONT_NAME_FIXED : + { + const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); + *pValue <<= OUString(rFace.GetName()); + } + break; + case HANDLE_CUSTOM_FONT_FIXED_POSTURE: + case HANDLE_CUSTOM_FONT_SANS_POSTURE : + case HANDLE_CUSTOM_FONT_SERIF_POSTURE: + case HANDLE_FONT_VARIABLES_POSTURE : + case HANDLE_FONT_FUNCTIONS_POSTURE : + case HANDLE_FONT_NUMBERS_POSTURE : + case HANDLE_FONT_TEXT_POSTURE : + { + const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); + BOOL bVal = IsItalic( rFace ); + (*pValue).setValue(&bVal, *(*ppEntries)->mpType); + } + break; + case HANDLE_CUSTOM_FONT_FIXED_WEIGHT : + case HANDLE_CUSTOM_FONT_SANS_WEIGHT : + case HANDLE_CUSTOM_FONT_SERIF_WEIGHT : + case HANDLE_FONT_VARIABLES_WEIGHT : + case HANDLE_FONT_FUNCTIONS_WEIGHT : + case HANDLE_FONT_NUMBERS_WEIGHT : + case HANDLE_FONT_TEXT_WEIGHT : + { + const SmFace & rFace = aFormat.GetFont((*ppEntries)->mnMemberId); + BOOL bVal = IsBold( rFace ); // bold? + (*pValue).setValue(&bVal, *(*ppEntries)->mpType); + } + break; + case HANDLE_BASE_FONT_HEIGHT : + { + // Point! + sal_Int16 nVal = static_cast < sal_Int16 > (aFormat.GetBaseSize().Height()); + nVal = static_cast < sal_Int16 > (MM100_TO_TWIP(nVal)); + nVal = (nVal + 10) / 20; + *pValue <<= nVal; + } + break; + case HANDLE_RELATIVE_FONT_HEIGHT_TEXT : + case HANDLE_RELATIVE_FONT_HEIGHT_INDICES : + case HANDLE_RELATIVE_FONT_HEIGHT_FUNCTIONS : + case HANDLE_RELATIVE_FONT_HEIGHT_OPERATORS : + case HANDLE_RELATIVE_FONT_HEIGHT_LIMITS : + *pValue <<= (sal_Int16) aFormat.GetRelSize((*ppEntries)->mnMemberId); + break; + + case HANDLE_IS_TEXT_MODE : + { + sal_Bool bVal = aFormat.IsTextmode(); + (*pValue).setValue(&bVal, ::getBooleanCppuType()); + } + break; + + case HANDLE_ALIGNMENT : + // SmHorAlign uses the same values as HorizontalAlignment + *pValue <<= (sal_Int16)aFormat.GetHorAlign(); + break; + + case HANDLE_RELATIVE_SPACING : + case HANDLE_RELATIVE_LINE_SPACING : + case HANDLE_RELATIVE_ROOT_SPACING : + case HANDLE_RELATIVE_INDEX_SUPERSCRIPT : + case HANDLE_RELATIVE_INDEX_SUBSCRIPT : + case HANDLE_RELATIVE_FRACTION_NUMERATOR_HEIGHT : + case HANDLE_RELATIVE_FRACTION_DENOMINATOR_DEPTH: + case HANDLE_RELATIVE_FRACTION_BAR_EXCESS_LENGTH: + case HANDLE_RELATIVE_FRACTION_BAR_LINE_WEIGHT : + case HANDLE_RELATIVE_UPPER_LIMIT_DISTANCE : + case HANDLE_RELATIVE_LOWER_LIMIT_DISTANCE : + case HANDLE_RELATIVE_BRACKET_EXCESS_SIZE : + case HANDLE_RELATIVE_BRACKET_DISTANCE : + case HANDLE_RELATIVE_SCALE_BRACKET_EXCESS_SIZE : + case HANDLE_RELATIVE_MATRIX_LINE_SPACING : + case HANDLE_RELATIVE_MATRIX_COLUMN_SPACING : + case HANDLE_RELATIVE_SYMBOL_PRIMARY_HEIGHT : + case HANDLE_RELATIVE_SYMBOL_MINIMUM_HEIGHT : + case HANDLE_RELATIVE_OPERATOR_EXCESS_SIZE : + case HANDLE_RELATIVE_OPERATOR_SPACING : + case HANDLE_LEFT_MARGIN : + case HANDLE_RIGHT_MARGIN : + case HANDLE_TOP_MARGIN : + case HANDLE_BOTTOM_MARGIN : + *pValue <<= (sal_Int16)aFormat.GetDistance((*ppEntries)->mnMemberId); + break; + case HANDLE_IS_SCALE_ALL_BRACKETS : + { + sal_Bool bVal = aFormat.IsScaleNormalBrackets(); + (*pValue).setValue(&bVal, ::getBooleanCppuType()); + } + break; + case HANDLE_PRINTER_NAME: + { + SfxPrinter *pPrinter = pDocSh->GetPrinter ( ); + *pValue <<= pPrinter ? OUString ( pPrinter->GetName()) : OUString(); + } + break; + case HANDLE_PRINTER_SETUP: + { + SfxPrinter *pPrinter = pDocSh->GetPrinter (); + if (pPrinter) + { + SvMemoryStream aStream; + pPrinter->Store( aStream ); + aStream.Seek ( STREAM_SEEK_TO_END ); + sal_uInt32 nSize = aStream.Tell(); + aStream.Seek ( STREAM_SEEK_TO_BEGIN ); + Sequence < sal_Int8 > aSequence ( nSize ); + aStream.Read ( aSequence.getArray(), nSize ); + *pValue <<= aSequence; + } + } + break; + case HANDLE_SYMBOLS: + { + // this is get + SmModule *pp = SM_MOD1(); + const SmSymSetManager &rManager = pp->GetSymSetManager(); + vector < const SmSym * > aVector; + + USHORT nCount = 0; + for (USHORT i = 0, nEnd = rManager.GetSymbolCount(); i < nEnd; i++) + { + const SmSym * pSymbol = rManager.GetSymbolByPos( i ); + if (pSymbol && !pSymbol->IsPredefined () ) + { + aVector.push_back ( pSymbol ); + nCount++; + } + } + Sequence < SymbolDescriptor > aSequence ( nCount ); + SymbolDescriptor * pDescriptor = aSequence.getArray(); + + vector <const SmSym * >::const_iterator aIter = aVector.begin(), aEnd = aVector.end(); + for(; aIter != aEnd; pDescriptor++, aIter++) + { + pDescriptor->sName = (*aIter)->GetName(); + pDescriptor->sExportName = (*aIter)->GetExportName(); + pDescriptor->sSymbolSet = (*aIter)->GetSetName(); + pDescriptor->nCharacter = static_cast < sal_Int32 > ((*aIter)->GetCharacter()); + + Font rFont = (*aIter)->GetFace(); + pDescriptor->sFontName = rFont.GetName(); + pDescriptor->nCharSet = sal::static_int_cast< sal_Int16 >(rFont.GetCharSet()); + pDescriptor->nFamily = sal::static_int_cast< sal_Int16 >(rFont.GetFamily()); + pDescriptor->nPitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch()); + pDescriptor->nWeight = sal::static_int_cast< sal_Int16 >(rFont.GetWeight()); + pDescriptor->nItalic = sal::static_int_cast< sal_Int16 >(rFont.GetItalic()); + } + *pValue <<= aSequence; + } + break; + case HANDLE_BASIC_LIBRARIES: + *pValue <<= pDocSh->GetBasicContainer(); + break; + case HANDLE_DIALOG_LIBRARIES: + *pValue <<= pDocSh->GetDialogContainer(); + break; + case HANDLE_RUNTIME_UID: + *pValue <<= getRuntimeUID(); + break; + // --> PB 2004-08-25 #i33095# Security Options + case HANDLE_LOAD_READONLY : + { + *pValue <<= pDocSh->IsLoadReadonly(); + break; + } + // <-- + } + } +} + +////////////////////////////////////////////////////////////////////// + +sal_Int32 SAL_CALL SmModel::getRendererCount( + const uno::Any& /*rSelection*/, + const uno::Sequence< beans::PropertyValue >& /*xOptions*/ ) + throw (IllegalArgumentException, RuntimeException) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + return 1; +} + + +static Size lcl_GuessPaperSize() +{ + Size aRes; + Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() ); + LocaleDataWrapper aLocWrp( xMgr, AllSettings().GetLocale() ); + if( MEASURE_METRIC == aLocWrp.getMeasurementSystemEnum() ) + { + // in Twip + aRes.Width() = lA4Width; + aRes.Height() = lA4Height; + } + else + { + // in Twip + aRes.Width() = lLetterWidth; + aRes.Height() = lLetterHeight; + } + aRes = OutputDevice::LogicToLogic( aRes, MapMode(MAP_TWIP), + MapMode(MAP_100TH_MM) ); + return aRes; +} + + +uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer( + sal_Int32 nRenderer, + const uno::Any& /*rSelection*/, + const uno::Sequence< beans::PropertyValue >& /*xOptions*/ ) + throw (IllegalArgumentException, RuntimeException) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + + if (0 != nRenderer) + throw IllegalArgumentException(); + + SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() ); + if (!pDocSh) + throw RuntimeException(); + + SmPrinterAccess aPrinterAccess( *pDocSh ); + Printer *pPrinter = aPrinterAccess.GetPrinter(); + //Point aPrtPageOffset( pPrinter->GetPageOffset() ); + Size aPrtPaperSize ( pPrinter->GetPaperSize() ); + + // if paper size is 0 (usually if no 'real' printer is found), + // guess the paper size + if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0) + aPrtPaperSize = lcl_GuessPaperSize(); + awt::Size aPageSize( aPrtPaperSize.Width(), aPrtPaperSize.Height() ); + + uno::Sequence< beans::PropertyValue > aRenderer(1); + PropertyValue &rValue = aRenderer.getArray()[0]; + rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); + rValue.Value <<= aPageSize; + + return aRenderer; +} + +void SAL_CALL SmModel::render( + sal_Int32 nRenderer, + const uno::Any& rSelection, + const uno::Sequence< beans::PropertyValue >& rxOptions ) + throw (IllegalArgumentException, RuntimeException) +{ + ::vos::OGuard aGuard(Application::GetSolarMutex()); + + if (0 != nRenderer) + throw IllegalArgumentException(); + + SmDocShell *pDocSh = static_cast < SmDocShell * >( GetObjectShell() ); + if (!pDocSh) + throw RuntimeException(); + + // get device to be rendered in + uno::Reference< awt::XDevice > xRenderDevice; + for (sal_Int32 i = 0, nCount = rxOptions.getLength(); i < nCount; ++i) + { + if( rxOptions[i].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) + rxOptions[i].Value >>= xRenderDevice; + } + + if (xRenderDevice.is()) + { + VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); + OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL; + + if (!pOut) + throw RuntimeException(); + + pOut->SetMapMode( MAP_100TH_MM ); + + uno::Reference< frame::XModel > xModel; + rSelection >>= xModel; + if (xModel == pDocSh->GetModel()) + { + //!! when called via API we may not have an active view + //!! thus we go and look for a view that can be used. + const TypeId aTypeId = TYPE( SmViewShell ); + SfxViewShell* pViewSh = SfxViewShell::GetFirst( &aTypeId, sal_False /* search non-visible views as well*/ ); + while (pViewSh && pViewSh->GetObjectShell() != pDocSh) + pViewSh = SfxViewShell::GetNext( *pViewSh, &aTypeId, sal_False /* search non-visible views as well*/ ); + SmViewShell *pView = PTR_CAST( SmViewShell, pViewSh ); + DBG_ASSERT( pView, "SmModel::render : no SmViewShell found" ); + + if (pView) + { + SmPrinterAccess aPrinterAccess( *pDocSh ); + Printer *pPrinter = aPrinterAccess.GetPrinter(); + + Size aPrtPaperSize ( pPrinter->GetPaperSize() ); + Size aOutputSize ( pPrinter->GetOutputSize() ); + Point aPrtPageOffset( pPrinter->GetPageOffset() ); + + // no real printer ?? + if (aPrtPaperSize.Height() == 0 || aPrtPaperSize.Width() == 0) + { + aPrtPaperSize = lcl_GuessPaperSize(); + // factors from Windows DIN A4 + aOutputSize = Size( (long)(aPrtPaperSize.Width() * 0.941), + (long)(aPrtPaperSize.Height() * 0.961)); + aPrtPageOffset = Point( (long)(aPrtPaperSize.Width() * 0.0250), + (long)(aPrtPaperSize.Height() * 0.0214)); + } + Point aZeroPoint; + Rectangle OutputRect( aZeroPoint, aOutputSize ); + + + // set minimum top and bottom border + if (aPrtPageOffset.Y() < 2000) + OutputRect.Top() += 2000 - aPrtPageOffset.Y(); + if ((aPrtPaperSize.Height() - (aPrtPageOffset.Y() + OutputRect.Bottom())) < 2000) + OutputRect.Bottom() -= 2000 - (aPrtPaperSize.Height() - + (aPrtPageOffset.Y() + OutputRect.Bottom())); + + // set minimum left and right border + if (aPrtPageOffset.X() < 2500) + OutputRect.Left() += 2500 - aPrtPageOffset.X(); + if ((aPrtPaperSize.Width() - (aPrtPageOffset.X() + OutputRect.Right())) < 1500) + OutputRect.Right() -= 1500 - (aPrtPaperSize.Width() - + (aPrtPageOffset.X() + OutputRect.Right())); + + pView->Impl_Print( *pOut, PRINT_SIZE_NORMAL, + Rectangle( OutputRect ), Point() ); + } + } + } +} + +void SAL_CALL SmModel::setParent( const uno::Reference< uno::XInterface >& xParent) + throw( lang::NoSupportException, uno::RuntimeException ) +{ + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SfxBaseModel::setParent( xParent ); + uno::Reference< lang::XUnoTunnel > xParentTunnel( xParent, uno::UNO_QUERY ); + if ( xParentTunnel.is() ) + { + SvGlobalName aSfxIdent( SFX_GLOBAL_CLASSID ); + SfxObjectShell* pDoc = reinterpret_cast<SfxObjectShell *>(xParentTunnel->getSomething( + uno::Sequence< sal_Int8 >( aSfxIdent.GetByteSequence() ) ) ); + if ( pDoc ) + GetObjectShell()->OnDocumentPrinterChanged( pDoc->GetDocumentPrinter() ); + } +} + +>>>>>>> other
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index 97a93bc6bb61..2b84c4dfc424 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -32,52 +32,52 @@ #include "precompiled_starmath.hxx" -#include <com/sun/star/accessibility/XAccessible.hpp> -#include <com/sun/star/accessibility/AccessibleEventObject.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleEventObject.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/beans/XPropertySet.hpp> + +#include <comphelper/processfactory.hxx> +#include <comphelper/storagehelper.hxx> #include <rtl/logfile.hxx> -#include <vcl/menu.hxx> -#include <vcl/decoview.hxx> -#include <vcl/msgbox.hxx> -#include <svtools/whiter.hxx> -#include <svtools/undo.hxx> -#include <svtools/intitem.hxx> -#include <svtools/ptitem.hxx> -#include <svtools/stritem.hxx> -#include <svtools/eitem.hxx> -#include <svtools/itemset.hxx> -#include <svtools/poolitem.hxx> -#include <svtools/transfer.hxx> -#include <sfx2/msg.hxx> -#include <sfx2/dispatch.hxx> #include <sfx2/app.hxx> -#include <sfx2/printer.hxx> -#include <sfx2/request.hxx> +#include <sfx2/dispatch.hxx> #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> #include <sfx2/docinsert.hxx> #include <sfx2/filedlghelper.hxx> +#include <sfx2/msg.hxx> #include <sfx2/objface.hxx> -#include <svx/svxdlg.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 <svtools/transfer.hxx> +#include <svtools/undo.hxx> +#include <svtools/whiter.hxx> #include <svx/dialogs.hrc> -#include <svx/zoomitem.hxx> #include <svx/editeng.hxx> +#include <svx/svxdlg.hxx> +#include <svx/zoomitem.hxx> +#include <vcl/decoview.hxx> +#include <vcl/menu.hxx> +#include <vcl/msgbox.hxx> #include <vcl/wrkwin.hxx> -#include <comphelper/storagehelper.hxx> -#include <comphelper/processfactory.hxx> - - #include "unomodel.hxx" #include "mathml.hxx" #include "view.hxx" -#include "document.hxx" #include "config.hxx" -#include "toolbox.hxx" #include "dialog.hxx" +#include "document.hxx" #include "starmath.hrc" +#include "toolbox.hxx" +#include "mathmlimport.hxx" #define MINWIDTH 200 @@ -91,10 +91,8 @@ #define SmViewShell #include "smslots.hxx" -#define A2OU(cChar) rtl::OUString::createFromAscii(cChar) - -using namespace com::sun::star::accessibility; using namespace com::sun::star; +using namespace com::sun::star::accessibility; using namespace com::sun::star::uno; ////////////////////////////////////////////////////////////////////// @@ -1292,7 +1290,7 @@ BOOL SmViewShell::Insert( SfxMedium& rMedium ) bChkOldVersion = FALSE; // is this a fabulous math package ? Reference<com::sun::star::frame::XModel> xModel(pDoc->GetModel()); - SmXMLWrapper aEquation(xModel); //!! modifies the result of pDoc->GetText() !! + SmXMLImportWrapper aEquation(xModel); //!! modifies the result of pDoc->GetText() !! bRet = 0 == aEquation.Import(rMedium); } } @@ -1337,7 +1335,7 @@ BOOL SmViewShell::InsertFrom(SfxMedium &rMedium) if ( rFltName.EqualsAscii(MATHML_XML) ) { Reference<com::sun::star::frame::XModel> xModel( pDoc->GetModel() ); - SmXMLWrapper aEquation(xModel); //!! modifies the result of pDoc->GetText() !! + SmXMLImportWrapper aEquation(xModel); //!! modifies the result of pDoc->GetText() !! bSuccess = 0 == aEquation.Import(rMedium); } else diff --git a/sw/inc/IDocumentBookmarkAccess.hxx b/sw/inc/IDocumentBookmarkAccess.hxx deleted file mode 100644 index 539fb594852b..000000000000 --- a/sw/inc/IDocumentBookmarkAccess.hxx +++ /dev/null @@ -1,282 +0,0 @@ -/************************************************************************* - * - * 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: IDocumentBookmarkAccess.hxx,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. - * - ************************************************************************/ - -#ifndef IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED -#define IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED - -#include <sal/types.h> - -class SwBookmark; -class SwFieldBookmark; -class SwBookmarks; -class SwPaM; -class KeyCode; -class String; -struct SwPosition; -class SwTxtNode; - -/** Provides access to the bookmarks of a document. -*/ -class IDocumentBookmarkAccess -{ -public: - enum BookmarkType - { - BOOKMARK, - MARK, - DDE_BOOKMARK, - UNO_BOOKMARK, - // --> OD 2007-10-11 #i81002# - bookmark type for cross-references - CROSSREF_BOOKMARK, - // <-- - // FIELDMARK, // for future use... - FORM_FIELDMARK_TEXT, - FORM_FIELDMARK_NO_TEXT - }; - - // --> OD 2007-11-16 #i83479# - enum CrossReferenceBookmarkSubType - { - HEADING, - NUMITEM - }; - // <-- - -public: - /** Returns all bookmarks set at the document. - - @returns - the bookmarks set at the document. - */ - virtual const SwBookmarks& getBookmarks() const = 0; - - /** Generates a new bookmark in the document. - - @param rPaM - [in] the location of the new bookmark. - - @param rKC - [in] ??? - - @param rName - [in] the name of the new bookmark. - - @param rShortName - [in] the short name of the new bookmark. - - @param eMark - [in] the type of the new bookmark. - - @returns - a pointer to the new bookmark. - */ - virtual SwBookmark* makeBookmark( /*[in]*/const SwPaM& rPaM, /*[in]*/const KeyCode& rKC, - /*[in]*/const String& rName, /*[in]*/const String& rShortName, - /*[in]*/BookmarkType eMark ) = 0; - - /** Deletes a bookmark. - - @param nPos - [in] the position of the bookmark to be deleted. - */ - virtual void deleteBookmark( /*[in]*/sal_uInt16 nPos ) = 0; - - /** Deletes a bookmark. - - @param rName - [in] the name of the bookmark to be deleted. - */ - virtual void deleteBookmark( /*[in]*/const String& rName ) = 0; - - /** Checks, if the given name fits to the cross-reference bookmark - name schema - - OD 2007-10-24 #i81002# - - @author OD - - @param rName - [in] the name to be checked. - - @returns - boolean indicating , if the name fits or not - */ - virtual bool isCrossRefBookmarkName( /*[in]*/const String& rName ) = 0; - - /** Find a bookmark. - - @param rName - [in] the name of the bookmark to be found. - - @returns - the position of the bookmark in the bookmark container. - */ - virtual sal_uInt16 findBookmark( /*[in]*/const String& rName ) = 0; - - /** Generates a unique bookmark name. The name has to be passed to the - function, a number will be added to the name if the name is already - used. - - @param rName - [in/out] the name of the bookmark. - */ - virtual void makeUniqueBookmarkName( /*[in/out]*/String& rName ) = 0; - - /** Get the number of ::com::sun::star::text::Bookmarks. - - @param bBkmrk - [in] if set, only "real" bookmarks are considered. - - @returns - the number of bookmarks. - */ - virtual sal_uInt16 getBookmarkCount( /*[in]*/bool bBkmrk) const = 0; - - /** Get a bookmark. - - @param nPos - [in] the position of the bookmark in the bookmark container. - - @param bBkmrk - [in] if set, only "real" bookmarks are considered. - - @returns - the bookmark. - */ - virtual SwBookmark& getBookmark( /*[in]*/sal_uInt16 nPos, /*[in]*/bool bBkmrk) = 0; - - /** Get cross-reference bookmark name for certain text node - - OD 2007-11-16 #i83479# - - @author OD - - @param rTxtNode - [in] reference to text node, whose cross-reference bookmark name has to be returned. - - @param nCrossRefType - [in] sub type of cross-reference bookmark, whose name has to be returned. - - @returns - name of cross-reference bookmark of given cross-reference sub type, - if such a cross-reference bookmark exists at given textnode. - otherwise, empty string - */ - virtual String getCrossRefBookmarkName( - /*[in]*/const SwTxtNode& rTxtNode, - /*[in]*/const CrossReferenceBookmarkSubType nCrossRefType ) const = 0; - - /** Generates new cross-reference bookmark for given text node of given sub type - - OD 2007-11-16 #i83479# - - @author OD - - @param rTxtNode - [in] reference to text node, at which the cross-reference bookmark has to be generated. - - @param nCrossRefType - [in] sub type of cross-reference bookmark. - - @returns - name of generated cross-reference bookmark. - If empty, cross-reference bookmark is not generated. - */ - virtual String makeCrossRefBookmark( - /*[in]*/const SwTxtNode& rTxtNode, - /*[in]*/const CrossReferenceBookmarkSubType nCrossRefType ) = 0; - - virtual SwBookmark* getFieldBookmarkFor(const SwPosition &pos) const = 0; - virtual SwFieldBookmark* getFormFieldBookmarkFor(const SwPosition &pos) const = 0; - virtual SwBookmark* getNextFieldBookmarkFor(const SwPosition &pos) const = 0; - virtual SwBookmark* getPrevFieldBookmarkFor(const SwPosition &pos) const = 0; - -protected: - virtual ~IDocumentBookmarkAccess() {}; -}; - -namespace bookmarkfunc -{ - /** return the prefix used for cross-reference bookmark for headings - - OD 2007-11-16 #i83479# - - @author OD - */ - const String getHeadingCrossRefBookmarkNamePrefix(); - - /** return the prefix used for cross-reference bookmark for numbered items - - OD 2007-11-16 #i83479# - - @author OD - */ - const String getNumItemCrossRefBookmarkNamePrefix(); - - /** Checks, if the given name fits to the heading cross-reference bookmark - name schema - - OD 2007-11-09 #i81002# - - @author OD - - @param rName - [in] the name to be checked. - - @returns - boolean indicating , if the name fits or not - */ - bool isHeadingCrossRefBookmarkName( /*[in]*/const String& rName ); - - /** Checks, if the given name fits to the numbered item cross-reference - bookmark name schema - - OD 2007-11-09 #i81002# - - @author OD - - @param rName - [in] the name to be checked. - - @returns - boolean indicating , if the name fits or not - */ - bool isNumItemCrossRefBookmarkName( /*[in]*/const String& rName ); - - /** generate new name for a cross-reference bookmark of given sub type - - OD 2007-11-16 #i83479# - - @author OD - */ - String generateNewCrossRefBookmarkName( - /*[in]*/const IDocumentBookmarkAccess::CrossReferenceBookmarkSubType nSubType ); -} -#endif // IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx new file mode 100644 index 000000000000..56a6050c09c6 --- /dev/null +++ b/sw/inc/IDocumentMarkAccess.hxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * 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: IDocumentMarkAccess.hxx,v $ + * $Revision: 1.4.42.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 IDOCUMENTMARKACCESS_HXX_INCLUDED +#define IDOCUMENTMARKACCESS_HXX_INCLUDED + +#include <sal/types.h> +#include <IMark.hxx> +#include <boost/shared_ptr.hpp> + +class SwPaM; +class KeyCode; +class String; +struct SwPosition; +class SwTxtNode; + +namespace sw { namespace mark { + class SaveBookmark; // FIXME: Ugly: SaveBookmark is a core-internal class, and should not be used in the interface +}} + +/** Provides access to the marks of a document. +*/ +class IDocumentMarkAccess +{ + public: + enum MarkType + { + UNO_BOOKMARK, + DDE_BOOKMARK, + BOOKMARK, + CROSSREF_HEADING_BOOKMARK, + CROSSREF_NUMITEM_BOOKMARK, + TEXT_FIELDMARK, + CHECKBOX_FIELDMARK, + NAVIGATOR_REMINDER + }; + + typedef ::boost::shared_ptr< ::sw::mark::IMark> pMark_t; + typedef ::std::vector< pMark_t > container_t; + typedef container_t::iterator iterator_t; + typedef container_t::const_iterator const_iterator_t; + typedef container_t::const_reverse_iterator const_reverse_iterator_t; + + /** Generates a new mark in the document for a certain selection. + + @param rPaM + [in] the selection being marked. + + @param rProposedName + [in] the proposed name of the new mark. + + @param eMark + [in] the type of the new mark. + + @returns + a pointer to the new mark (name might have changed). + */ + virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM, + const ::rtl::OUString& rProposedName, + MarkType eMark) =0; + + /** Returns a mark in the document for a paragraph. + If there is none, a mark will be created. + + @param rTxtNode + [in] the paragraph being marked (a selection over the paragraph is marked) + + @param eMark + [in] the type of the new mark. + + @returns + a pointer to the new mark (name might have changed). + */ + virtual ::sw::mark::IMark* getMarkForTxtNode(const SwTxtNode& rTxtNode, + MarkType eMark) =0; + + /** Moves an existing mark to a new selection and performs needed updates. + @param io_pMark + [in/out] the mark to be moved + + @param rPaM + [in] new selection to be marked + */ + + virtual void repositionMark(::sw::mark::IMark* io_pMark, + const SwPaM& rPaM) =0; + + /** Renames an existing Mark, if possible. + @param io_pMark + [in/out] the mark to be renamed + + @param rNewName + [in] new name for the mark + + @returns false, if renaming failed (because the name is already in use) + */ + virtual bool renameMark(::sw::mark::IMark* io_pMark, + const ::rtl::OUString& rNewName) =0; + + /** Corrects marks (absolute) + This method ignores the previous position of the mark in the paragraph + + @param rOldNode + [in] the node from which nodes should be moved + + @param rNewPos + [in] new position to which marks will be moved, if nOffset == 0 + + @param nOffset + [in] the offset by which the mark gets positioned of rNewPos + */ + virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, + const SwPosition& rNewPos, + const xub_StrLen nOffset) =0; + + /** Corrects marks (relative) + This method uses the previous position of the mark in the paragraph as offset + + @param rOldNode + [in] the node from which nodes should be moved + + @param rNewPos + [in] new position to which marks from the start of the paragraph will be + moved, if nOffset == 0 + + @param nOffset + [in] the offset by which the mark gets positioned of rNewPos in addition to + its old position in the paragraph + */ + virtual void correctMarksRelative(const SwNodeIndex& rOldNode, + const SwPosition& rNewPos, + const xub_StrLen nOffset) =0; + + /** Deletes marks in a range + */ + virtual void deleteMarks( + const SwNodeIndex& rStt, + const SwNodeIndex& rEnd, + ::std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, // Ugly: SaveBookmark is core-internal + const SwIndex* pSttIdx, + const SwIndex* pEndIdx) =0; + + /** Deletes a mark. + + @param ppMark + [in] an iterator pointing to the Mark to be deleted. + */ + virtual void deleteMark(const IDocumentMarkAccess::const_iterator_t ppMark) =0; + + /** Deletes a mark. + + @param ppMark + [in] the name of the mark to be deleted. + */ + virtual void deleteMark(const ::sw::mark::IMark* const pMark) =0; + + /** Clear (deletes) all marks. + */ + virtual void clearAllMarks() =0; + + /** returns a STL-like random access iterator to the begin of the sequence of marks. + */ + virtual const_iterator_t getMarksBegin() const =0; + + /** returns a STL-like random access iterator to the end of the sequence of marks. + */ + virtual const_iterator_t getMarksEnd() const =0; + + /** returns the number of marks. + */ + virtual sal_Int32 getMarksCount() const =0; + + /** Finds a mark by name. + + @param rName + [in] the name of the mark to find. + + @returns + an iterator pointing to the mark, or pointing to getMarksEnd() if nothing was found. + */ + virtual const_iterator_t findMark(const ::rtl::OUString& rMark) const =0; + + + // interface IBookmarks (BOOKMARK, CROSSREF_NUMITEM_BOOKMARK, CROSSREF_HEADING_BOOKMARK) + + /** returns a STL-like random access iterator to the begin of the sequence the IBookmarks. + */ + virtual const_iterator_t getBookmarksBegin() const =0; + + /** returns a STL-like random access iterator to the end of the sequence of IBookmarks. + */ + virtual const_iterator_t getBookmarksEnd() const =0; + + /** returns the number of IBookmarks. + */ + virtual sal_Int32 getBookmarksCount() const =0; + + /** Finds a bookmark by name. + + @param rName + [in] the name of the bookmark to find. + + @returns + an iterator pointing to the bookmark, or getBookmarksEnd() if nothing was found. + */ + virtual const_iterator_t findBookmark(const ::rtl::OUString& rMark) const =0; + + + // Fieldmarks + virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& pos) const =0; + virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& pos) const =0; + virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos) const =0; + + // Returns the MarkType used to create the mark + static MarkType SAL_DLLPUBLIC_EXPORT GetType(const ::sw::mark::IMark& rMark); + protected: + virtual ~IDocumentMarkAccess() {}; +}; + +#endif // IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED diff --git a/sw/inc/IMark.hxx b/sw/inc/IMark.hxx new file mode 100644 index 000000000000..81317d69a369 --- /dev/null +++ b/sw/inc/IMark.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * 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: bookmrk.hxx,v $ + * $Revision: 1.11 $ + * + * 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 _IMARK_HXX +#define _IMARK_HXX + +#include <vcl/keycod.hxx> +#include <calbck.hxx> +#include <pam.hxx> +#include <boost/operators.hpp> + +#ifndef SW_DECL_SWSERVEROBJECT_DEFINED +#define SW_DECL_SWSERVEROBJECT_DEFINED +SV_DECL_REF( SwServerObject ) +#endif + + +struct SwPosition; + +namespace sw { namespace mark +{ + class IMark + : virtual public SwModify // inherited as interface + , public ::boost::totally_ordered<IMark> + { + public: + //getters + virtual const SwPosition& GetMarkPos() const =0; + // GetOtherMarkPos() is only guaranteed to return a valid + // reference if IsExpanded() returned true + virtual const SwPosition& GetOtherMarkPos() const =0; + virtual const SwPosition& GetMarkStart() const =0; + virtual const SwPosition& GetMarkEnd() const =0; + virtual const ::rtl::OUString& GetName() const =0; + virtual bool IsExpanded() const =0; + virtual bool IsCoveringPosition(const SwPosition& rPos) const =0; + + //setters + // not available in IMark + // inside core, you can cast to MarkBase and use its setters, + // make sure to update the sortings in Markmanager in this case + + //operators and comparisons (non-virtual) + bool operator<(const IMark& rOther) const + { return GetMarkStart() < rOther.GetMarkStart(); } + bool operator==(const IMark& rOther) const + { return GetMarkStart() == rOther.GetMarkStart(); } + bool StartsBefore(const SwPosition& rPos) const + { return GetMarkStart() < rPos; } + bool StartsAfter(const SwPosition& rPos) const + { return GetMarkStart() > rPos; } + bool EndsBefore(const SwPosition& rPos) const + { return GetMarkEnd() < rPos; } + bool EndsAfter(const SwPosition& rPos) const + { return GetMarkEnd() > rPos; } + }; + + class IBookmark + : virtual public IMark + { + public: + virtual const ::rtl::OUString& GetShortName() const =0; + virtual const KeyCode& GetKeyCode() const =0; + virtual void SetShortName(const ::rtl::OUString&) =0; + virtual void SetKeyCode(const KeyCode&) =0; + }; + + class IFieldmark + : virtual public IMark + { + public: + //getters + virtual ::rtl::OUString GetFieldname() const =0; + virtual ::rtl::OUString GetFieldHelptext() const =0; + + //setters + virtual void SetFieldname(const ::rtl::OUString& rFieldname) =0; + virtual void SetFieldHelptext(const ::rtl::OUString& rFieldHelptext) =0; + }; + + class ICheckboxFieldmark + : virtual public IFieldmark + { + public: + virtual bool IsChecked() const =0; + virtual void SetChecked(bool checked) =0; + }; +}} +#endif diff --git a/sw/inc/SwAppletImpl.hxx b/sw/inc/SwAppletImpl.hxx index 29607aa34b99..fcf9d727f05e 100644 --- a/sw/inc/SwAppletImpl.hxx +++ b/sw/inc/SwAppletImpl.hxx @@ -40,7 +40,6 @@ #include <tools/string.hxx> -#include <svtools/htmlkywd.hxx> #include <sfx2/frmhtml.hxx> #include <sfx2/frmhtmlw.hxx> #ifndef _WRKWIN_HXX //autogen @@ -53,12 +52,7 @@ class SfxItemSet; -extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sHTML_O_archive, "ARCHIVE" ); - -extern sal_Char const SVTOOLS_CONSTASCII_DECL( sHTML_O_Hidden, "HIDDEN" ); -extern sal_Char const SVTOOLS_CONSTASCII_DECL( sHTML_O_Hidden_False, "FALSE" ); -extern sal_Char const SVTOOLS_CONSTASCII_DECL( sHTML_O_Archives, "ARCHIVES" ); -extern sal_Char const SVTOOLS_CONSTASCII_DECL( sHTML_O_Object, "OBJECT" ); +#define OOO_STRING_SW_HTML_O_Hidden "HIDDEN" class SwApplet_Impl { diff --git a/sw/inc/SwBitArray.hxx b/sw/inc/SwBitArray.hxx deleted file mode 100644 index f5647019ec61..000000000000 --- a/sw/inc/SwBitArray.hxx +++ /dev/null @@ -1,185 +0,0 @@ -/************************************************************************* - * - * 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: SwBitArray.hxx,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. - * - ************************************************************************/ -#ifndef _SW_BIT_ARRAY_HXX -#define _SW_BIT_ARRAY_HXX - -#include <swtypes.hxx> -#if OSL_DEBUG_LEVEL > 1 -#include <iostream> -#endif - -/** - a bit array -*/ -class SwBitArray -{ - /** - size of a group of bits - */ - static const size_t mGroupSize = sizeof(sal_uInt32); - - /** - Returns number of groups. - - @return number of groups - */ - size_t calcSize() const { return (nSize - 1)/ mGroupSize + 1; } - - /** - array of group of bits - */ - sal_uInt32 * mArray; - - /** - number of groups - */ - sal_uInt32 nSize; - - /** - Returns group of bits according to an index. - - @param n index to search for - - @return group of bits according to given index - */ - sal_uInt32 * GetGroup(sal_uInt32 n) const { return &mArray[n/mGroupSize]; } - -public: - SwBitArray(sal_uInt32 _nSize); - SwBitArray(const SwBitArray & rArray); - ~SwBitArray(); - - /** - Returns if an index is valid. - - @retval TRUE the index is valid - @retval FALSE else - */ - BOOL IsValid(sal_uInt32 n) const; - - /** - Returns the number of bits stored in the array. - - @return number of bits in the array - */ - sal_uInt32 Size() const { return nSize; } - - /** - Sets/unsets a bit. - - @param n index of bit to set/unset - @param nValue -TRUE set the bit - -FALSE unset the bit - */ - void Set(sal_uInt32 n, BOOL nValue); - - /** - Unsets all bits of the array. - */ - void Reset(); - - /** - Returns if a certain bit in the array is set. - - @param n index of the bit in question - - @retval TRUE the bit is set - @retval FALSE else - */ - BOOL Get(sal_uInt32 n) const; - - /** - Assigns a bit array to this bit array. - - @param rArray array to assign - - rArray must have the same size as this array. Otherwise this - array will not be altered. - */ - SwBitArray & operator = (const SwBitArray & rArray); - - /** - Returns the bitwise AND of two bit arrays. - - @param rA - @param rB the arrays to combine - - @return bitwise AND of rA and rB - */ - friend SwBitArray operator & (const SwBitArray & rA, - const SwBitArray & rB); - - /** - Returns the bitwise OR of two bit arrays. - - @param rA - @param rB the arrays to combine - - @return bitwise OR of rA and rB - */ - friend SwBitArray operator | (const SwBitArray & rA, - const SwBitArray & rB); - - /** - Returns the bitwise XOR of two bit arrays. - - @param rA - @param rB the arrays to combine - - @return bitwise XOR of rA and rB - */ - friend SwBitArray operator ^ (const SwBitArray & rA, - const SwBitArray & rB); - - /** - Returns the bitwise NOT of an arrays. - - @param rA the array to negate - - @return bitwise NOT of rA - */ - friend SwBitArray operator ~ (const SwBitArray & rA); - -#if OSL_DEBUG_LEVEL > 1 - /** - output operator - - @param o output stream - @param rBitArray bit array to output - - @return o after the output - */ - friend std::ostream & operator << - (std::ostream & o, const SwBitArray & rBitArray); -#endif -}; - - -#endif // _SW_BIT_ARRAY_HXX diff --git a/sw/inc/bookmrk.hxx b/sw/inc/bookmrk.hxx deleted file mode 100644 index 3b459f61c081..000000000000 --- a/sw/inc/bookmrk.hxx +++ /dev/null @@ -1,218 +0,0 @@ -/************************************************************************* - * - * 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: bookmrk.hxx,v $ - * $Revision: 1.11 $ - * - * 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 _BOOKMRK_HXX -#define _BOOKMRK_HXX - -#include "hintids.hxx" //die Ids der Attribute, vor macitem damit die - //die Attribut richtig angezogen werden. -#include <svtools/macitem.hxx> - -#ifndef _KEYCOD_HXX //autogen -#include <vcl/keycod.hxx> -#endif -#ifndef _TOOLS_REF_HXX -#include <tools/ref.hxx> -#endif -#include <IDocumentBookmarkAccess.hxx> -#include <calbck.hxx> -#include <pam.hxx> - -#ifndef SW_DECL_SWSERVEROBJECT_DEFINED -#define SW_DECL_SWSERVEROBJECT_DEFINED -SV_DECL_REF( SwServerObject ) -#endif - - -struct SwPosition; // fwd Decl. wg. UI - -class SwBookmark : public SwModify -{ - SwPosition *pPos1, *pPos2; // wird im CTOR gesetzt, im DTOR geloescht - // pPos1 is always != 0, pPos2 may be 0 - SwServerObjectRef refObj; // falls DataServer -> Pointer gesetzt - -protected: - String aName; - String aShortName; - KeyCode aCode; - IDocumentBookmarkAccess::BookmarkType eMarkType; - - SwBookmark( const SwPosition& aPos, - const KeyCode& rCode, - const String& rName, const String& rShortName); - -public: - TYPEINFO(); - - SwBookmark( const SwPosition& aPos ); - // --> OD 2007-09-26 #i81002# - SwBookmark( const SwPaM& aPaM, - const KeyCode& rCode, - const String& rName, const String& rShortName); - // <-- - - // Beim Loeschen von Text werden Bookmarks mitgeloescht! - virtual ~SwBookmark(); - - // --> OD 2007-10-10 #i81002# - // made virtual and thus no longer inline - virtual const SwPosition& GetBookmarkPos() const; - virtual const SwPosition* GetOtherBookmarkPos() const; - // <-- - - // nicht undofaehig - const String& GetName() const { return aName; } - // nicht undofaehig - const String& GetShortName() const { return aShortName; } - // nicht undofaehig - const KeyCode& GetKeyCode() const { return aCode; } - - // Vergleiche auf Basis der Dokumentposition - BOOL operator < (const SwBookmark &) const; - BOOL operator ==(const SwBookmark &) const; - // falls man wirklich auf gleiche Position abfragen will. - BOOL IsEqualPos( const SwBookmark &rBM ) const; - - BOOL IsFormFieldMark() const { return IDocumentBookmarkAccess::FORM_FIELDMARK_TEXT == eMarkType || IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT == eMarkType; } - BOOL IsBookMark() const { return IDocumentBookmarkAccess::BOOKMARK == eMarkType || IDocumentBookmarkAccess::FORM_FIELDMARK_TEXT == eMarkType || IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT == eMarkType; } -// // --> OD 2007-10-17 #TESTING# -// BOOL IsBookMark() const -// { -// return IDocumentBookmarkAccess::BOOKMARK == eMarkType || -// IsCrossRefMark(); -// } -// // <-- - BOOL IsMark() const { return IDocumentBookmarkAccess::MARK == eMarkType; } - BOOL IsUNOMark() const { return IDocumentBookmarkAccess::UNO_BOOKMARK == eMarkType; } - // --> OD 2007-10-11 #i81002# - bookmark type for cross-references - BOOL IsCrossRefMark() const { return IDocumentBookmarkAccess::CROSSREF_BOOKMARK == eMarkType; } - // <-- - void SetType( IDocumentBookmarkAccess::BookmarkType eNewType ) { eMarkType = eNewType; } - IDocumentBookmarkAccess::BookmarkType GetType() const { return eMarkType; } - - // Daten Server-Methoden - void SetRefObject( SwServerObject* pObj ); - const SwServerObject* GetObject() const { return &refObj; } - SwServerObject* GetObject() { return &refObj; } - BOOL IsServer() const { return refObj.Is(); } - - // --> OD 2007-10-10 #i81002# - // made virtual and thus no longer inline - // to access start and end of a bookmark. - // start and end may be the same - virtual const SwPosition* BookmarkStart() const; - virtual const SwPosition* BookmarkEnd() const; - // <-- - - // --> OD 2007-09-26 #i81002# - virtual void SetBookmarkPos( const SwPosition* pNewPos1 ); - virtual void SetOtherBookmarkPos( const SwPosition* pNewPos2 ); - // <-- - -private: - // fuer METWARE: - // es wird (vorerst) nicht kopiert und nicht zugewiesen - SwBookmark(const SwBookmark &); - SwBookmark &operator=(const SwBookmark &); -}; - -class SwMark: public SwBookmark -{ -public: - SwMark( const SwPosition& aPos, - const KeyCode& rCode, - const String& rName, const String& rShortName); -}; - -class SW_DLLPUBLIC SwFieldBookmark : public SwBookmark -{ -private: - int fftype; // Type: 0 = Text, 1 = Check Box, 2 = List - int ffres; - bool ffprot; - bool ffsize; // 0 = Auto, 1=Exact (see ffhps) - int fftypetxt; // Type of text field: 0 = Regular text, 1 = Number, 2 = Date, 3 = Current date, 4 = Current time, 5 = Calculation - bool ffrecalc; - int ffmaxlen; // Number of characters for text field. Zero means unlimited. - int ffhps; // Check box size (half-point sizes). - - String ffname; - String ffhelptext; - -public: - SwFieldBookmark(const SwPosition& aPos, - const KeyCode& rCode, - const String& rName, const String& rShortName, - IDocumentBookmarkAccess::BookmarkType eMark); - - void SetFieldType(int fftype); - int GetFieldType(); - - void SetChecked(bool checked); - bool IsChecked(); - - void SetFFName(String aNewName) { - this->ffname=aNewName; - } - - String GetFFName() - { - return ffname; - } - - int GetFFRes() { - return ffres; - } - - void SetFFRes(int nNew) { - this->ffres=nNew; - } - - void SetFFHelpText(String newffhelptext) { - this->ffhelptext=newffhelptext; - } - - String GetFFHelpText() { - return ffhelptext; - } -}; - -class SwUNOMark: public SwBookmark -{ -public: - // --> OD 2007-09-26 #i81002# - SwUNOMark( const SwPaM& aPaM, - const KeyCode& rCode, - const String& rName, const String& rShortName); - // <-- -}; - - -#endif diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 04808bd1a8fc..ac64dcb85510 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -911,6 +911,7 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr #define FN_UNO_PARA_CONT_PREV_SUBTREE (FN_EXTRA2 + 109) #define FN_UNO_PARA_NUM_STRING (FN_EXTRA2 + 110) +#define FN_UNO_TABLE_NAME (FN_EXTRA2 + 111) /*-------------------------------------------------------------------- Bereich: Hilfe diff --git a/sw/inc/crossrefbookmark.hxx b/sw/inc/crossrefbookmark.hxx deleted file mode 100644 index a8b1f78923b4..000000000000 --- a/sw/inc/crossrefbookmark.hxx +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************* - * - * 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: crossrefbookmark.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 _CROSSREFBOOKMRK_HXX -#define _CROSSREFBOOKMRK_HXX - -#include <bookmrk.hxx> - -/** Bookmark for cross-references - - OD 2007-10-11 #i81002# - Bookmark, which bookmarks a complete text node (heading or numbered paragraph) - for cross-referencing. - <GetBookmarkPos()> is always at the beginning of this text node and - <GetOtherBookmarkPos()> is always NULL. - - @author OD -*/ -class SwCrossRefBookmark : public SwBookmark -{ -public: - TYPEINFO(); - - SwCrossRefBookmark( const SwPosition& aPos, - const KeyCode& rCode, - const String& rName, - const String& rShortName ); - - virtual ~SwCrossRefBookmark(); - - virtual const SwPosition* GetOtherBookmarkPos() const; - - virtual void SetBookmarkPos( const SwPosition* pNewPos1 ); - virtual void SetOtherBookmarkPos( const SwPosition* /*pNewPos2*/ ); - - IDocumentBookmarkAccess::CrossReferenceBookmarkSubType GetSubType() const; -private: - // --> OD 2007-11-16 #i83479# - IDocumentBookmarkAccess::CrossReferenceBookmarkSubType mnSubType; - // <-- - - // no copy-constructor and no assignment-operator - SwCrossRefBookmark(const SwCrossRefBookmark &); - SwCrossRefBookmark &operator=(const SwCrossRefBookmark &); -}; -#endif diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 2a66b9a63ca0..4fae1ca69a6b 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -44,7 +44,7 @@ #include <viscrs.hxx> #include <node.hxx> #include <tblsel.hxx> -#include <IDocumentBookmarkAccess.hxx> +#include <IDocumentMarkAccess.hxx> // einige Forward Deklarationen @@ -52,8 +52,6 @@ class KeyCode; class SfxItemSet; class SfxPoolItem; -class SwBookmark; -class SwFieldBookmark; class SwCntntFrm; class SwCrsrShell; class SwCursor; @@ -583,28 +581,22 @@ public: // gehe zur vorherigen Selection BOOL GoPrevCrsr(); - // am CurCrsr.SPoint - BOOL SetBookmark( const KeyCode&, const String& rName, - const String& rShortName, IDocumentBookmarkAccess::BookmarkType eMark = IDocumentBookmarkAccess::BOOKMARK); - BOOL GotoBookmark( USHORT ); // setzt CurCrsr.SPoint - BOOL GotoBookmark( USHORT nPos, BOOL bAtStart ); // - BOOL GoNextBookmark(); // TRUE, wenn's noch eine gab - BOOL GoPrevBookmark(); - USHORT GetBookmarkCnt(BOOL bBkmrk = FALSE) const; - SwBookmark& GetBookmark( USHORT, BOOL bBkmrk = FALSE ); - void DelBookmark( USHORT ); - void DelBookmark( const String& rName ); - USHORT FindBookmark( const String& rName ); - // erzeugt einen eindeutigen Namen. Der Name selbst muss vorgegeben - // werden, es wird dann bei gleichen Namen nur durchnumeriert. - void MakeUniqueBookmarkName( String& rNm ); - - bool IsFormProtected(); - SwBookmark* IsInFieldBookmark(); - SwFieldBookmark* IsInFormFieldBookmark(); - SwBookmark* GetNextFieldBookmark(); - SwBookmark* GetPrevFieldBookmark(); - bool GotoFieldBookmark(SwBookmark *pBkmk); + // at CurCrsr.SPoint + ::sw::mark::IMark* SetBookmark( + const KeyCode&, + const ::rtl::OUString& rName, + const ::rtl::OUString& rShortName, + IDocumentMarkAccess::MarkType eMark = IDocumentMarkAccess::BOOKMARK); + bool GotoMark( const ::sw::mark::IMark* const pMark ); // sets CurCrsr.SPoint + bool GotoMark( const ::sw::mark::IMark* const pMark, bool bAtStart ); + bool GoNextBookmark(); // true, if there was one + bool GoPrevBookmark(); + + bool IsFormProtected(); + ::sw::mark::IFieldmark* GetCurrentFieldmark(); + ::sw::mark::IFieldmark* GetFieldmarkAfter(); + ::sw::mark::IFieldmark* GetFieldmarkBefore(); + bool GotoFieldmark( const ::sw::mark::IFieldmark* const pMark ); // aktualisiere den Crsrs, d.H. setze ihn wieder in den Content. // Das sollte nur aufgerufen werden, wenn der Cursor z.B. beim diff --git a/sw/inc/dialog.hrc b/sw/inc/dialog.hrc index 7e9b8b3389b9..deed99451d94 100644 --- a/sw/inc/dialog.hrc +++ b/sw/inc/dialog.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dialog.hrc,v $ - * $Revision: 1.7 $ + * $Revision: 1.7.240.1 $ * * This file is part of OpenOffice.org. * @@ -54,8 +54,7 @@ #define STR_LINKEDIT_TEXT (RC_DIALOG_BEGIN + 1) #define STR_CLOSELINKMSG (RC_DIALOG_BEGIN + 3) -#define STR_PATH_NOT_FOUND1 (RC_DIALOG_BEGIN + 4) -#define STR_PATH_NOT_FOUND2 (RC_DIALOG_BEGIN + 5) +#define STR_PATH_NOT_FOUND (RC_DIALOG_BEGIN + 4) #define STR_FLT_SGV (RC_DIALOG_BEGIN + 8) diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 8fe60d0fb8c7..a82ea0235359 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -39,7 +39,7 @@ #ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED #include <IDocumentDeviceAccess.hxx> #endif -#include <IDocumentBookmarkAccess.hxx> +#include <IDocumentMarkAccess.hxx> #ifndef IREDLINEACCESS_HXX_INCLUDED #include <IDocumentRedlineAccess.hxx> #endif @@ -114,6 +114,8 @@ class SwList; #include <svtools/embedhlp.hxx> #include <vector> +#include <boost/scoped_ptr.hpp> + class SfxObjectShell; class SfxObjectShellRef; class SvxForbiddenCharactersTable; @@ -142,8 +144,6 @@ class SvxMacroTableDtor; class SvxBorderLine; class SwAutoCompleteWord; class SwAutoCorrExceptWord; -class SwBookmark; -class SwBookmarks; class SwCalc; class SwCellFrm; class SwCharFmt; @@ -240,6 +240,9 @@ class SwChartDataProvider; class SwChartLockController_Helper; class IGrammarContact; +namespace sw { namespace mark { + class MarkManager; +}} namespace com { namespace sun { namespace star { namespace i18n { @@ -265,14 +268,13 @@ SV_DECL_PTRARR_DEL( SwPageDescs, SwPageDescPtr, 4, 4 ) void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem ); // global function to start grammar checking in the document -void StartGrammarChecking( SwDoc &rDoc, SwRootFrm &rRootFrame ); +void StartGrammarChecking( SwDoc &rDoc ); class SW_DLLPUBLIC SwDoc : public IInterface, public IDocumentSettingAccess, public IDocumentDeviceAccess, public IDocumentRedlineAccess, - public IDocumentBookmarkAccess, public IDocumentUndoRedo, public IDocumentLinksAdministration, public IDocumentFieldsAccess, @@ -319,6 +321,8 @@ class SW_DLLPUBLIC SwDoc : xXForms; // container with XForms models mutable com::sun::star::uno::Reference< com::sun::star::linguistic2::XProofreadingIterator > m_xGCIterator; + const ::boost::scoped_ptr< ::sw::mark::MarkManager> pMarkManager; + // ------------------------------------------------------------------- // die Pointer //Defaultformate @@ -337,8 +341,6 @@ class SW_DLLPUBLIC SwDoc : SwTxtFmtColls *pTxtFmtCollTbl; // FormatCollections SwGrfFmtColls *pGrfFmtCollTbl; - SwBookmarks *pBookmarkTbl; //Bookmarks - SwTOXTypes *pTOXTypes; // Verzeichnisse SwDefTOXBase_Impl * pDefTOXBases; // defaults of SwTOXBase's @@ -755,10 +757,6 @@ public: virtual void setFieldUpdateFlags( /*[in]*/ SwFldUpdateFlags eMode ); virtual SwCharCompressType getCharacterCompressionType() const; virtual void setCharacterCompressionType( /*[in]*/SwCharCompressType nType ); - SwBookmark* getFieldBookmarkFor(const SwPosition &pos) const; - SwBookmark* getNextFieldBookmarkFor(const SwPosition &pos) const; - SwBookmark* getPrevFieldBookmarkFor(const SwPosition &pos) const; - SwFieldBookmark* getFormFieldBookmarkFor(const SwPosition &pos) const; /** IDocumentDeviceAccess */ @@ -773,25 +771,10 @@ public: virtual SwPrintData* getPrintData() const; virtual void setPrintData(/*[in]*/ const SwPrintData& rPrtData); - /** IDocumentBookmarkAccess + /** IDocumentMarkAccess */ - virtual const SwBookmarks& getBookmarks() const; - virtual SwBookmark* makeBookmark( /*[in]*/const SwPaM& rPaM, /*[in]*/const KeyCode& rKC, - /*[in]*/ const String& rName, /*[in]*/const String& rShortName, - /*[in]*/BookmarkType eMark ); - virtual void deleteBookmark( /*[in]*/sal_uInt16 nPos ); - virtual void deleteBookmark( /*[in]*/const String& rName ); - virtual bool isCrossRefBookmarkName( /*[in]*/const String& rName ); - virtual sal_uInt16 findBookmark( /*[in]*/const String& rName ); - virtual void makeUniqueBookmarkName( /*[in/out]*/String& rName ); - virtual sal_uInt16 getBookmarkCount( /*[in]*/ bool bBkmrk ) const; - virtual SwBookmark& getBookmark( /*[in]*/sal_uInt16 nPos, /*[in]*/bool bBkmrk ); - virtual String getCrossRefBookmarkName( - /*[in]*/const SwTxtNode& rTxtNode, - /*[in]*/const CrossReferenceBookmarkSubType nCrossRefType ) const; - virtual String makeCrossRefBookmark( - /*[in]*/const SwTxtNode& rTxtNode, - /*[in]*/const CrossReferenceBookmarkSubType nCrossRefType ); + IDocumentMarkAccess* getIDocumentMarkAccess(); + const IDocumentMarkAccess* getIDocumentMarkAccess() const; /** IDocumentRedlineAccess */ @@ -1420,7 +1403,7 @@ public: // Methoden fuer die Verzeichnisse: // - Verzeichnismarke einfuegen loeschen travel sal_uInt16 GetCurTOXMark( const SwPosition& rPos, SwTOXMarks& ) const; - void Delete( SwTOXMark* pTOXMark ); + void Delete( const SwTOXMark* pTOXMark ); const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark, SwTOXSearch eDir, sal_Bool bInReadOnly ); diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx index 649d7b4e650d..c8ffcba549ab 100644 --- a/sw/inc/docary.hxx +++ b/sw/inc/docary.hxx @@ -35,7 +35,6 @@ class SwFieldType; class SwFrmFmt; class SwCharFmt; -class SwBookmark; class SwTOXType; class SwUndo; class SwSectionFmt; @@ -72,10 +71,6 @@ SV_DECL_PTRARR_DEL(SwCharFmts,SwCharFmtPtr,4,4) SV_DECL_PTRARR_DEL( SwFldTypes, SwFldTypePtr, INIT_FLDTYPES, GROW_FLDTYPES ) -//Bookmarks (nach Dokumentpositionen sortiertes Array) -typedef SwBookmark* SwBookmarkPtr; -SV_DECL_PTRARR_SORT(SwBookmarks, SwBookmarkPtr,0,1) - typedef SwTOXType* SwTOXTypePtr; SV_DECL_PTRARR_DEL( SwTOXTypes, SwTOXTypePtr, 0, 1 ) diff --git a/sw/inc/dochdl.hrc b/sw/inc/dochdl.hrc index 29beaa022c92..1ee4b68efe10 100644 --- a/sw/inc/dochdl.hrc +++ b/sw/inc/dochdl.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dochdl.hrc,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.240.1 $ * * This file is part of OpenOffice.org. * @@ -33,8 +33,7 @@ #include "rcid.hrc" -#define STR_NOGLOS1 (RC_DOCHDL_BEGIN + 1) -#define STR_NOGLOS2 (RC_DOCHDL_BEGIN + 2) +#define STR_NOGLOS (RC_DOCHDL_BEGIN + 1) #define MSG_ERR_INSERT_GLOS (RC_DOCHDL_BEGIN + 3) #define MSG_CLPBRD_FORMAT_ERROR (RC_DOCHDL_BEGIN + 4) #define MSG_UPDATE_NEW_GLOS_FMT (RC_DOCHDL_BEGIN + 5) diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx index 31df17358a77..babf6c91436a 100644 --- a/sw/inc/mdiexp.hxx +++ b/sw/inc/mdiexp.hxx @@ -32,6 +32,7 @@ #include <tools/solar.h> #include <tblenum.hxx> +#include <layout/layout.hxx> #include <swdllapi.h> class UniString; @@ -63,7 +64,7 @@ void RescheduleProgress( SwDocShell *pDocShell ); void EnableCmdInterface(BOOL bEnable = TRUE); -Dialog* GetSearchDialog(); +LAYOUT_NS Dialog* GetSearchDialog(); void RepaintPagePreview( ViewShell* pVwSh, const SwRect& rRect ); diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index 6bbce692d4ec..5aa259b68c06 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -71,7 +71,7 @@ struct SwPosition; class IStyleAccess; class IDocumentSettingAccess; class IDocumentDeviceAccess; -class IDocumentBookmarkAccess; +class IDocumentMarkAccess; class IDocumentRedlineAccess; class IDocumentStylePoolAccess; class IDocumentLineNumberAccess; @@ -223,7 +223,7 @@ public: /** Provides access to the document bookmark interface */ - const IDocumentBookmarkAccess* getIDocumentBookmarkAccess() const; + const IDocumentMarkAccess* getIDocumentMarkAccess() const; /** Provides access to the document redline interface */ diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index 78c658ebf616..fc62291e85c7 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -717,7 +717,6 @@ #include "svx/acorrcfg.hxx" #include "svx/anchorid.hxx" #include "svx/asiancfg.hxx" -#include "svx/charmap.hxx" #include "svx/checklbx.hxx" #include "svx/clipboardctl.hxx" #include "svx/clipfmtitem.hxx" diff --git a/sw/inc/rolbck.hxx b/sw/inc/rolbck.hxx index 84d89d4e6161..f137b8b73e6c 100644 --- a/sw/inc/rolbck.hxx +++ b/sw/inc/rolbck.hxx @@ -44,7 +44,6 @@ class SwDoc; class SwFmt; class SwFmtColl; class SwHstryHint; -class SwBookmark; class SwTxtAttr; class SfxPoolItem; class SwTxtNode; @@ -70,7 +69,7 @@ class SwCharFmt; #include <SwNumberTreeTypes.hxx> // --> OD 2007-10-17 #i81002# -#include <IDocumentBookmarkAccess.hxx> +#include <IDocumentMarkAccess.hxx> // <-- #ifndef PRODUCT @@ -256,22 +255,25 @@ public: class SwHstryBookmark : public SwHstryHint { - String aName, aShortName; - ULONG nNode1, nNode2; - xub_StrLen nCntnt1, nCntnt2; - USHORT nKeyCode; - BYTE nTyp; - // --> OD 2007-10-17 #i81002# - const IDocumentBookmarkAccess::BookmarkType eBkmkType; - // <-- -public: - enum { BKMK_POS = 1, BKMK_OTHERPOS = 2 }; - SwHstryBookmark( const SwBookmark&, BYTE nTyp ); - virtual void SetInDoc( SwDoc* pDoc, BOOL bTmpSet ); - OUT_HSTR_HINT(Bookmark) - - BOOL IsEqualBookmark( const SwBookmark& ); - const String & GetName() const; + public: + SwHstryBookmark(const ::sw::mark::IMark& rBkmk, bool bSavePos, bool bSaveOtherPos); + virtual void SetInDoc(SwDoc * pDoc, BOOL); + OUT_HSTR_HINT(Bookmark) + + BOOL IsEqualBookmark(const ::sw::mark::IMark& rBkmk); + const ::rtl::OUString& GetName() const; + private: + const ::rtl::OUString m_aName; + ::rtl::OUString m_aShortName; + KeyCode m_aKeycode; + const ULONG m_nNode; + const ULONG m_nOtherNode; + const xub_StrLen m_nCntnt; + const xub_StrLen m_nOtherCntnt; + const bool m_bSavePos; + const bool m_bSaveOtherPos; + const bool m_bHadOtherPos; + const IDocumentMarkAccess::MarkType m_eBkmkType; }; class SwHstrySetAttrSet : public SwHstryHint @@ -371,7 +373,7 @@ public: void Add( const SwTxtAttr* pTxtHt, ULONG nNodeIdx, BOOL bNewAttr = TRUE ); void Add( const SwFmtColl*, ULONG nNodeIdx, BYTE nWhichNd ); - void Add( const SwBookmark&, BYTE ); + void Add( const ::sw::mark::IMark&, bool bSavePos, bool bSaveOtherPos ); void Add( const SwFrmFmt& rFmt ); void Add( const SwFlyFrmFmt&, USHORT& rSetPos ); void Add( const SwTxtFtn& ); diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index bc1453b561df..497426e83b4d 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -504,7 +504,7 @@ public: const String& GetBaseURL() const { return sBaseURL;} // suche die naechste Bookmark-Position aus der Bookmark-Tabelle - USHORT FindPos_Bkmk( const SwPosition& rPos ) const; + sal_Int32 FindPos_Bkmk( const SwPosition& rPos ) const; // build a bookmark table, which is sort by the node position. The // OtherPos of the bookmarks also inserted. void CreateBookmarkTbl(); diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 3218a0b57008..78f05d419d0b 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -35,6 +35,7 @@ #include <tools/solar.h> #include <tools/string.hxx> #include <sfx2/sfxdlg.hxx> +#include <svx/svxdlg.hxx> #include <vcl/syswin.hxx> #ifndef _GLOBALS_HRC #include <globals.hrc> @@ -346,9 +347,13 @@ class SwAbstractDialogFactory public: static SwAbstractDialogFactory* Create(); + virtual SfxAbstractDialog* CreateSfxDialog( Window* pParent, //add for SvxMeasureDialog & SvxConnectionDialog + const SfxItemSet& rAttr, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame, + sal_uInt32 nResId + ) = 0; virtual AbstractSwWordCountDialog* CreateSwWordCountDialog( Window* pWindow ) = 0; virtual AbstractSwInsertAbstractDlg * CreateSwInsertAbstractDlg ( Window* pParent, int nResId) = 0; // add for SwInsertAbstractDlg - virtual AbstractSfxSingleTabDialog* CreateSfxSingleTabDialog ( Window* pParent, SfxItemSet& rSet, int nResId ) = 0; // add for SwAddrDlg SwDropCapsDlg, SwBackgroundDlg,SwNumFmtDlg, virtual AbstractSwAsciiFilterDlg* CreateSwAsciiFilterDlg ( Window* pParent, SwDocShell& rDocSh, SvStream* pStream, int nResId ) = 0;// add for SwAsciiFilterDlg virtual VclAbstractDialog * CreateSwInsertBookmarkDlg( Window *pParent, SwWrtShell &rSh, SfxRequest& rReq, int nResId ) = 0;// add for SwInsertBookmarkDlg @@ -394,15 +399,15 @@ public: int nResId, BOOL bSetAutoFmt = TRUE, const SwTableAutoFmt* pSelFmt = 0 ) = 0; - virtual AbstractSfxSingleTabDialog * CreateSwBorderDlg ( Window* pParent, SfxItemSet& rSet, USHORT nType,int nResId ) = 0;//add for SwBorderDlg - virtual AbstractSfxSingleTabDialog * CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, BOOL bDrawMode, int nResId ) = 0; //add for SwWrapDlg + virtual SfxAbstractDialog * CreateSwBorderDlg ( Window* pParent, SfxItemSet& rSet, USHORT nType, int nResId ) = 0;//add for SwBorderDlg + virtual SfxAbstractDialog * CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, BOOL bDrawMode, int nResId ) = 0; //add for SwWrapDlg virtual VclAbstractDialog * CreateSwTableWidthDlg ( Window *pParent, SwTableFUNC &rFnc , int nResId ) = 0; //add for SwTableWidthDlg virtual SfxAbstractTabDialog* CreateSwTableTabDlg( Window* pParent, SfxItemPool& Pool, const SfxItemSet* pItemSet, SwWrtShell* pSh,int nResId ) = 0; //add for SwTableTabDlg virtual AbstractSwFldDlg * CreateSwFldDlg ( SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent, int nResId ) = 0; //add for SwFldDlg - virtual AbstractSfxSingleTabDialog* CreateSwFldEditDlg ( SwView& rVw, int nResId ) = 0; //add for SwFldEditDlg + virtual SfxAbstractDialog* CreateSwFldEditDlg ( SwView& rVw, int nResId ) = 0; //add for SwFldEditDlg virtual AbstractSwRenameXNamedDlg * CreateSwRenameXNamedDlg( Window* pParent, //add for SwRenameXNamedDlg STAR_REFERENCE( container::XNamed ) & xNamed, STAR_REFERENCE( container::XNameAccess ) & xNameAccess, int nResId ) = 0; diff --git a/sw/inc/swserv.hxx b/sw/inc/swserv.hxx index 2f410ac391d5..b421bee29af9 100644 --- a/sw/inc/swserv.hxx +++ b/sw/inc/swserv.hxx @@ -31,8 +31,8 @@ #define _SWSERV_HXX #include <sfx2/linksrc.hxx> +#include <IMark.hxx> -class SwBookmark; class SwSectionNode; class SwBaseLink; class SwTableNode; @@ -46,7 +46,7 @@ class SwServerObject : public ::sfx2::SvLinkSource protected: enum ServerModes { BOOKMARK_SERVER, TABLE_SERVER, SECTION_SERVER, NONE_SERVER } eType; union { - SwBookmark* pBkmk; + ::sw::mark::IMark* pBkmk; SwTableNode* pTblNd; SwSectionNode* pSectNd; } CNTNT_TYPE; @@ -54,7 +54,7 @@ protected: SwServerObject(); public: - SwServerObject( SwBookmark& rBookmark ) + SwServerObject( ::sw::mark::IMark& rBookmark ) : eType( BOOKMARK_SERVER ) { CNTNT_TYPE.pBkmk = &rBookmark; @@ -72,8 +72,8 @@ public: virtual ~SwServerObject(); virtual BOOL GetData( ::com::sun::star::uno::Any & rData, - const String & rMimeType, - BOOL bSynchron = FALSE ); + const String & rMimeType, + BOOL bSynchron = FALSE ); BOOL SetData( const String & rMimeType, const ::com::sun::star::uno::Any& rData ); @@ -83,7 +83,8 @@ public: BOOL IsLinkInServer( const SwBaseLink* ) const; - void SetNoServer() { CNTNT_TYPE.pBkmk = 0, eType = NONE_SERVER; } + void SetNoServer(); + void SetDdeBookmark( ::sw::mark::IMark& rBookmark); }; #ifndef SW_DECL_SWSERVEROBJECT_DEFINED diff --git a/sw/inc/swunohelper.hxx b/sw/inc/swunohelper.hxx index 2a23f487bc0e..ebf27999b0aa 100644 --- a/sw/inc/swunohelper.hxx +++ b/sw/inc/swunohelper.hxx @@ -75,7 +75,7 @@ BOOL UCB_GetFileListOfFolder( const String& rURL, SvStrings& rList, SvPtrarr* pDateTimeList = 0 ); // is the URL an existing file? -BOOL UCB_IsFile( const String& rURL ); +SW_DLLPUBLIC BOOL UCB_IsFile( const String& rURL ); // is the URL a existing directory? BOOL UCB_IsDirectory( const String& rURL ); diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx index f1490eeb6d5d..00053210553a 100644 --- a/sw/inc/undobj.hxx +++ b/sw/inc/undobj.hxx @@ -48,7 +48,7 @@ #include <swundo.hxx> - +#include <IMark.hxx> // --> OD 2006-11-01 #130889# #include <vector> // <-- @@ -63,7 +63,6 @@ class SwFmt; class SwFmtColl; class SwTxtFmtColl; class SwTxtNode; -class SwBookmark; class SwTableNode; class SwTable; class SwTableBox; @@ -1084,7 +1083,7 @@ class SwUndoBookmark : public SwUndo { SwHstryBookmark* pHBookmark; protected: - SwUndoBookmark( SwUndoId nUndoId, const SwBookmark& ); + SwUndoBookmark( SwUndoId nUndoId, const ::sw::mark::IMark& ); void SetInDoc( SwDoc* ); void ResetInDoc( SwDoc* ); @@ -1112,7 +1111,7 @@ public: class SwUndoDelBookmark : public SwUndoBookmark { public: - SwUndoDelBookmark( const SwBookmark& ); + SwUndoDelBookmark( const ::sw::mark::IMark& ); virtual void Undo( SwUndoIter& ); virtual void Redo( SwUndoIter& ); OUT_UNDOBJ( DelBookmark ) @@ -1121,7 +1120,7 @@ public: class SwUndoInsBookmark : public SwUndoBookmark { public: - SwUndoInsBookmark( const SwBookmark& ); + SwUndoInsBookmark( const ::sw::mark::IMark& ); virtual void Undo( SwUndoIter& ); virtual void Redo( SwUndoIter& ); OUT_UNDOBJ( InsBookmark ) diff --git a/sw/inc/unoatxt.hxx b/sw/inc/unoatxt.hxx index 8122cdb5dc09..b115919a5623 100644 --- a/sw/inc/unoatxt.hxx +++ b/sw/inc/unoatxt.hxx @@ -120,7 +120,7 @@ class SwXAutoTextGroup : public cppu::WeakImplHelper6 ::com::sun::star::lang::XUnoTunnel > { - SfxItemPropertySet aPropSet; + const SfxItemPropertySet* pPropSet; SwGlossaries* pGlossaries; rtl::OUString sName; String m_sGroupName; // prefix m_ to disambiguate from some local vars in the implementation diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx index a3936fbe6bb5..955030cbada8 100644 --- a/sw/inc/unochart.hxx +++ b/sw/inc/unochart.hxx @@ -281,7 +281,7 @@ class SwChartDataSequence : SwUnoCrsr* pTblCrsr; // cursor spanned over cells to use SwDepend aCursorDepend; //the cursor is removed after the doc has been removed - const SfxItemPropertyMap* pMap; + const SfxItemPropertySet* _pPropSet; sal_Bool bDisposed; diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx index 596b8e682838..99a089f1194e 100644 --- a/sw/inc/unocoll.hxx +++ b/sw/inc/unocoll.hxx @@ -33,6 +33,7 @@ #include <flyenum.hxx> #include <vcl/timer.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XIndexAccess.hpp> #include <tools/string.hxx> @@ -40,6 +41,8 @@ #include <cppuhelper/implbase2.hxx> // helper for implementations #include <cppuhelper/implbase3.hxx> // helper for implementations #include <cppuhelper/implbase4.hxx> // helper for implementations +#include <IMark.hxx> +#include <unobaseclass.hxx> /*************************************************** *************************************************** * @@ -58,7 +61,6 @@ class SwFmtFtn; class XBookmark; class SwXReferenceMark; class SwSectionFmt; -class SwBookmark; class SwFmtRefMark; class SwXReferenceMark; class SwXBookmark; @@ -304,17 +306,23 @@ public: virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); //XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); +virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); static ::com::sun::star::text::XTextTable* GetObject( SwFrmFmt& rFmt ); }; -/*-----------------11.12.97 10:14------------------- +typedef +cppu::WeakImplHelper4 +< + ::com::sun::star::container::XEnumerationAccess, + ::com::sun::star::container::XNameAccess, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::lang::XServiceInfo +> SwXFramesBaseClass; ---------------------------------------------------*/ -class SwXFrames : public SwCollectionBaseClass, +class SwXFrames : public SwXFramesBaseClass, public SwUnoCollection { const FlyCntType eType; @@ -323,6 +331,9 @@ protected: public: SwXFrames(SwDoc* pDoc, FlyCntType eSet); + //XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException ); + //XIndexAccess virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException ); virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); @@ -444,31 +455,31 @@ public: class SwXBookmarks : public SwCollectionBaseClass, public SwUnoCollection { -protected: - virtual ~SwXBookmarks(); -public: - SwXBookmarks(SwDoc* pDoc); + protected: + virtual ~SwXBookmarks(); + public: + SwXBookmarks(SwDoc* pDoc); - //XIndexAccess - virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); - //XNameAccess - virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException ); + //XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException ); - //XElementAccess - virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); + //XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); - //XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); - static SwXBookmark* GetObject( SwBookmark& rBkm, SwDoc* pDoc ); + static SwXBookmark* GetObject( ::sw::mark::IMark& rBkm, SwDoc* pDoc); }; class SwXNumberingRulesCollection : public cppu::WeakImplHelper1 diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx index 6a74498cf724..7133f6edba46 100644 --- a/sw/inc/unocrsrhelper.hxx +++ b/sw/inc/unocrsrhelper.hxx @@ -32,9 +32,9 @@ #include <com/sun/star/beans/XPropertyState.hpp> #include <unocrsr.hxx> +#include <map> - -struct SfxItemPropertyMap; +struct SfxItemPropertySimpleEntry; class SwPaM; class SwDoc; @@ -46,12 +46,23 @@ namespace com{ namespace sun{ namespace star{ struct PropertyValue; } }}} + /* -----------------------------14.12.00 15:06-------------------------------- ---------------------------------------------------------------------------*/ namespace SwUnoCursorHelper { - sal_Bool getCrsrPropertyValue(const SfxItemPropertyMap* pMap + // keep Any's mapped by (WhichId << 16 ) + (MemberId) + typedef std::map< sal_uInt32, com::sun::star::uno::Any *> AnyMapHelper_t; + class SwAnyMapHelper : public AnyMapHelper_t + { + public: + ~SwAnyMapHelper(); + + void SetValue( USHORT nWhichId, USHORT nMemberId, const com::sun::star::uno::Any& rAny ); + bool FillValue( USHORT nWhichId, USHORT nMemberId, const com::sun::star::uno::Any*& pAny ); + }; + sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry , SwPaM& rPam , com::sun::star::uno::Any *pAny , com::sun::star::beans::PropertyState& eState @@ -65,7 +76,7 @@ namespace SwUnoCursorHelper { return rUnoCrsr.GetCntntNode() && rUnoCrsr.GetPoint()->nContent == rUnoCrsr.GetCntntNode()->Len();} - void resetCrsrPropertyValue(const SfxItemPropertyMap* pMap, SwPaM& rPam); + void resetCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPam); void InsertFile(SwUnoCrsr* pUnoCrsr, const String& rURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rOptions diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx index 0103e969e8be..05857bbc6fe1 100644 --- a/sw/inc/unodraw.hxx +++ b/sw/inc/unodraw.hxx @@ -42,8 +42,10 @@ #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/drawing/XShapes.hpp> #include <cppuhelper/implbase3.hxx> // helper for implementations +#include <cppuhelper/implbase4.hxx> // helper for implementations // --> OD 2004-07-22 #i31698# #include <cppuhelper/implbase6.hxx> // helper for implementations +#include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/drawing/HomogenMatrix3.hpp> // <-- #include <svtools/itemprop.hxx> @@ -83,11 +85,9 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > _CreateShape( SdrObject *pObj ) const throw (); }; -/* -----------------09.12.98 08:57------------------- - * - * --------------------------------------------------*/ -typedef cppu::WeakAggImplHelper3 +typedef cppu::WeakAggImplHelper4 < + ::com::sun::star::container::XEnumerationAccess, ::com::sun::star::drawing::XDrawPage, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::drawing::XShapeGrouper @@ -102,6 +102,9 @@ public: SwXDrawPage(SwDoc* pDoc); ~SwXDrawPage(); + //XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); @@ -162,8 +165,8 @@ class SwXShape : public SwXShapeBaseClass, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape; // <-- - SfxItemPropertySet aPropSet; - const SfxItemPropertyMap* _pMap; + const SfxItemPropertySet* m_pPropSet; + const SfxItemPropertyMapEntry* m_pPropertyMapEntries; com::sun::star::uno::Sequence< sal_Int8 >* pImplementationId; SwShapeDescriptor_Impl* pImpl; @@ -315,6 +318,9 @@ public: SwShapeDescriptor_Impl* GetDescImpl() {return pImpl;} ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > GetAggregationInterface() {return xShapeAgg;} + + // helper + static void AddExistingShapeToFmt( SdrObject& _rObj ); }; /* -----------------------------31.05.01 09:54-------------------------------- diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx index 417caf0290f5..a02999c8ca3d 100644 --- a/sw/inc/unoframe.hxx +++ b/sw/inc/unoframe.hxx @@ -43,6 +43,7 @@ */ class SwDoc; +class SfxItemPropertSet; /*-----------------12.02.98 11:21------------------- --------------------------------------------------*/ @@ -59,9 +60,8 @@ class SwXFrame : public cppu::WeakImplHelper6 public SwClient { SwEventListenerContainer aLstnrCntnr; - SfxItemPropertySet aPropSet; - const SfxItemPropertyMap* _pMap; - SwDoc* mpDoc; + const SfxItemPropertySet* m_pPropSet; + SwDoc* m_pDoc; const FlyCntType eType; @@ -79,10 +79,10 @@ protected: virtual ~SwXFrame(); public: SwXFrame(FlyCntType eSet, - const SfxItemPropertyMap* pMap, + const SfxItemPropertySet* pPropSet, SwDoc *pDoc ); //Descriptor-If SwXFrame(SwFrmFmt& rFrmFmt, FlyCntType eSet, - const SfxItemPropertyMap* pMap); + const SfxItemPropertySet* pPropSet); static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId(); @@ -166,7 +166,7 @@ class SwXTextFrame : public SwXTextFrameBaseClass, public SwXText, public SwXFrame { - const SfxItemPropertyMap* _pMap; + const SfxItemPropertSet* _pPropSet; protected: virtual const SwStartNode *GetStartNode() const; diff --git a/sw/inc/unoidx.hxx b/sw/inc/unoidx.hxx index 3832f3376aea..5ea20f65c89d 100644 --- a/sw/inc/unoidx.hxx +++ b/sw/inc/unoidx.hxx @@ -60,7 +60,7 @@ class SwXDocumentIndex : public cppu::WeakImplHelper5 friend class SwXIndexTokenAccess_Impl; SwEventListenerContainer aLstnrCntnr; - const SfxItemPropertyMap* _pMap; + const SfxItemPropertySet* m_pPropSet; SwDoc* m_pDoc; const SwTOXBaseSection* pBase; TOXTypes eTOXType; @@ -153,7 +153,7 @@ class SwXDocumentIndexMark : public cppu::WeakImplHelper4 SwDepend aTypeDepend; SwDoc* m_pDoc; const SwTOXMark* m_pTOXMark; - const SfxItemPropertyMap* _pMap; + const SfxItemPropertySet* m_pPropSet; sal_Bool bIsDescriptor; sal_Bool bMainEntry; diff --git a/sw/inc/unomailmerge.hxx b/sw/inc/unomailmerge.hxx index cb940dcb0ced..3dbe497b2e3c 100644 --- a/sw/inc/unomailmerge.hxx +++ b/sw/inc/unomailmerge.hxx @@ -109,7 +109,7 @@ class SwXMailMerge : OPropertyListenerContainerHelper aPropListeners; //SfxItemPropertySet aPropSet; - const SfxItemPropertyMap* pMap; + const SfxItemPropertySet* pPropSet; SfxObjectShellRef xDocSh; // the document diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx index 7b1b90cce3b2..9de2db4f493c 100644 --- a/sw/inc/unomap.hxx +++ b/sw/inc/unomap.hxx @@ -134,18 +134,6 @@ #define PROPERTY_MAP_END 98 -#define PROPERTY_SET_CHAR_STYLE 1 -#define PROPERTY_SET_PARA_STYLE 2 -#define PROPERTY_SET_FRAME_STYLE 3 -#define PROPERTY_SET_PAGE_STYLE 4 -#define PROPERTY_SET_NUM_STYLE 5 -// basically the same as PROPERTY_SET_PARA_STYLE with additional property -// that is only available for conditional para styles -#define PROPERTY_SET_CONDITIONAL_PARA_STYLE 6 -#define PROPERTY_SET_CHAR_AUTO_STYLE 7 -#define PROPERTY_SET_RUBY_AUTO_STYLE 8 -#define PROPERTY_SET_PARA_AUTO_STYLE 9 - //S&E #define WID_WORDS 0 #define WID_BACKWARDS 1 @@ -337,7 +325,7 @@ class SwItemPropertySet : public SfxItemPropertySet protected: virtual sal_Bool FillItem(SfxItemSet& rSet, sal_uInt16 nWhich, sal_Bool bGetProperty) const; public: - SwItemPropertySet( const SfxItemPropertyMap *pMap ) : + SwItemPropertySet( const SfxItemPropertyMapEntry *pMap ) : SfxItemPropertySet( pMap ){} }; /* -----------------04.07.98 11:41------------------- @@ -345,26 +333,16 @@ public: * --------------------------------------------------*/ class SwUnoPropertyMapProvider { - SfxItemPropertyMap* aMapArr[PROPERTY_MAP_END]; - - SfxItemPropertySet* pCharStyleMap; - SfxItemPropertySet* pParaStyleMap; - SfxItemPropertySet* pFrameStyleMap; - SfxItemPropertySet* pPageStyleMap; - SfxItemPropertySet* pNumStyleMap; - SfxItemPropertySet* pConditionalParaStyleMap; - SfxItemPropertySet* pCharAutoStyleMap; - SfxItemPropertySet* pParaAutoStyleMap; - SfxItemPropertySet* pRubyAutoStyleMap; + SfxItemPropertyMapEntry* aMapEntriesArr[PROPERTY_MAP_END]; + SfxItemPropertySet* aPropertySetArr[PROPERTY_MAP_END]; - void Sort(sal_uInt16 nId); public: SwUnoPropertyMapProvider(); ~SwUnoPropertyMapProvider(); - const SfxItemPropertyMap* GetPropertyMap(sal_uInt16 PropertyId); + const SfxItemPropertyMapEntry* GetPropertyMapEntries(sal_uInt16 PropertyId); + const SfxItemPropertySet* GetPropertySet( sal_uInt16 PropertyId ); - SfxItemPropertySet& GetPropertySet(sal_Int8 nPropSetId); }; extern SwUnoPropertyMapProvider aSwMapProvider; diff --git a/sw/inc/unoobj.hxx b/sw/inc/unoobj.hxx index 7893d198309c..74a67295d23e 100644 --- a/sw/inc/unoobj.hxx +++ b/sw/inc/unoobj.hxx @@ -59,9 +59,7 @@ #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XMultiPropertySet.hpp> -//#ifndef _COM_SUN_STAR_BEANS_XTOLERANTMULTIPROPERTYSET_HPP_ -//#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp> -//#endif +#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/beans/XMultiPropertyStates.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -91,11 +89,10 @@ #include <unomid.h> #include <tools/link.hxx> -#include <IDocumentBookmarkAccess.hxx> +#include <IDocumentMarkAccess.hxx> class SwUnoCrsr; class SwCursor; -class SwBookmark; class SwFmtFtn; class SwFmtRefMark; class GetCurTxtFmtColl; @@ -217,7 +214,7 @@ class SwXText : public ::com::sun::star::lang::XTypeProvider, SwDoc* pDoc; BOOL bObjectValid; CursorType eCrsrType; - const SfxItemPropertyMap* _pMap; + const SfxItemPropertySet* m_pPropSet; virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL finishOrAppendParagraph( bool bFinish, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > & CharacterAndParagraphProperties ) @@ -318,7 +315,8 @@ enum SwGetPropertyStatesCaller { SW_PROPERTY_STATE_CALLER_DEFAULT, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION, - SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY + SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY, + SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT }; #define CRSR_ATTR_MODE_TABLE 1 //attributes should be applied to a table selection #define CRSR_ATTR_MODE_DONTREPLACE 2 //attributes should be added, not replaced @@ -342,7 +340,7 @@ class SwXTextCursor : public SwXTextCursor_Base, public OTextCursorHelper { SwEventListenerContainer aLstnrCntnr; - SfxItemPropertySet aPropSet; + const SfxItemPropertySet* m_pPropSet; ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText; SwSortOptions* pLastSortOptions; @@ -439,7 +437,6 @@ public: const SfxItemPropertySet& rPropSet, const rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue, - const SfxItemPropertyMap* pMap = 0, USHORT nAttrMode = 0) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, @@ -447,8 +444,8 @@ public: ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); static ::com::sun::star::uno::Any GetPropertyValue( SwPaM& rPaM, const SfxItemPropertySet& rPropSet, const ::rtl::OUString& rPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > GetPropertyStates( SwPaM& rPaM, SfxItemPropertySet& rPropSet, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames, SwGetPropertyStatesCaller eCaller = SW_PROPERTY_STATE_CALLER_DEFAULT) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - static ::com::sun::star::beans::PropertyState GetPropertyState( SwPaM& rPaM, SfxItemPropertySet& rPropSet, const ::rtl::OUString& rPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > GetPropertyStates( SwPaM& rPaM, const SfxItemPropertySet& rPropSet, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames, SwGetPropertyStatesCaller eCaller = SW_PROPERTY_STATE_CALLER_DEFAULT) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + static ::com::sun::star::beans::PropertyState GetPropertyState( SwPaM& rPaM, const SfxItemPropertySet& rPropSet, const ::rtl::OUString& rPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); static void SetPropertyToDefault( SwPaM& rPaM, const SfxItemPropertySet& rPropSet, const rtl::OUString& rPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); static ::com::sun::star::uno::Any GetPropertyDefault( SwPaM& rPaM, const SfxItemPropertySet& rPropSet, const ::rtl::OUString& rPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); @@ -568,11 +565,7 @@ public: }; */ -/*-----------------20.02.98 08:45------------------- - ---------------------------------------------------*/ -typedef -cppu::WeakImplHelper5 +typedef cppu::WeakImplHelper5 < ::com::sun::star::text::XTextContent, ::com::sun::star::beans::XPropertySet, @@ -580,84 +573,98 @@ cppu::WeakImplHelper5 ::com::sun::star::container::XNamed, ::com::sun::star::lang::XUnoTunnel > -SwRefBookmarkBaseClass; -class SwXBookmark : public SwRefBookmarkBaseClass, - public SwClient +SwRefMarkBaseClass; + +class SwXBookmark + : public SwRefMarkBaseClass + , private SwClient { -protected: - SwEventListenerContainer aLstnrCntnr; - SwDoc* pDoc; - String m_aName; - BOOL bIsDescriptor; -protected: - virtual ~SwXBookmark(); -public: - SwXBookmark(SwBookmark* pBkm = 0, SwDoc* pDoc = 0); + private: + SwEventListenerContainer m_aLstnrCntnr; + SwDoc* m_pDoc; + String m_aName; + ::sw::mark::IMark* m_pRegisteredBookmark; + + void registerInMark(::sw::mark::IMark* const pBkmk) + { + if(pBkmk) + pBkmk->Add(this); + else if(m_pRegisteredBookmark) + { + m_aName = m_pRegisteredBookmark->GetName(); + m_pRegisteredBookmark->Remove(this); + } + m_pRegisteredBookmark = pBkmk; + } + + protected: + virtual ~SwXBookmark(); + public: + SwXBookmark(::sw::mark::IMark* pMark = 0, SwDoc* pDoc = 0); - TYPEINFO(); + TYPEINFO(); - static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId(); - //XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + //XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); - //XTextContent - virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException); + //XTextContent + virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException); - //XComponent - virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException ); + //XComponent + virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException ); - //XNamed - virtual rtl::OUString SAL_CALL getName(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL setName(const rtl::OUString& Name_) throw( ::com::sun::star::uno::RuntimeException ); + //XNamed + virtual rtl::OUString SAL_CALL getName(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setName(const rtl::OUString& rName) throw( ::com::sun::star::uno::RuntimeException ); - //XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); + //XServiceInfo + virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); - //XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + //XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - void attachToRangeEx(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange, IDocumentBookmarkAccess::BookmarkType eMark)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); - virtual void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + void attachToRangeEx(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange, IDocumentMarkAccess::MarkType eType) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + virtual void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); - //SwClient - virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew); + //SwClient + virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ); - SwBookmark* GetBookmark() const { return (SwBookmark*)GetRegisteredIn(); } - SwDoc* GetDoc(){return pDoc;} + const ::sw::mark::IMark* GetBookmark() const + { return m_pRegisteredBookmark; } + SwDoc* GetDoc() + { return m_pDoc; } }; typedef cppu::ImplInheritanceHelper1< SwXBookmark, ::com::sun::star::text::XFormField > SwXFieldmark_BASE; class SwXFieldmark : public SwXFieldmark_BASE { -private: - bool isReplacementObject; -public: - SwXFieldmark(bool isReplacementObject, SwBookmark* pBkm = 0, SwDoc* pDoc = 0); - - virtual void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); - virtual ::rtl::OUString SAL_CALL getDescription(void) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::sal_Int16 SAL_CALL getType( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int16 SAL_CALL getRes( ) throw (::com::sun::star::uno::RuntimeException); - - virtual void SAL_CALL setType( ::sal_Int16 fieldType ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setRes( ::sal_Int16 res ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDescription( const ::rtl::OUString& description ) throw (::com::sun::star::uno::RuntimeException); + private: + bool isReplacementObject; + public: + SwXFieldmark(bool isReplacementObject, ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0); -// virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException); + virtual void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getDescription(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::sal_Int16 SAL_CALL getType( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getRes( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setType( ::sal_Int16 fieldType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRes( ::sal_Int16 res ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDescription( const ::rtl::OUString& description ) throw (::com::sun::star::uno::RuntimeException); }; /*-----------------23.02.98 10:45------------------- @@ -707,9 +714,7 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > CreateTextCursor(BOOL bIgnoreTables = sal_False); }; -/*-----------------23.02.98 12:05------------------- ---------------------------------------------------*/ class SW_DLLPUBLIC SwXTextRange : public cppu::WeakImplHelper8 < ::com::sun::star::text::XTextRange, @@ -720,7 +725,7 @@ class SW_DLLPUBLIC SwXTextRange : public cppu::WeakImplHelper8 ::com::sun::star::beans::XPropertyState, ::com::sun::star::container::XEnumerationAccess, ::com::sun::star::text::XRedline ->, public SwClient +>, private SwClient { friend class SwXText; enum RangePosition @@ -736,10 +741,10 @@ class SW_DLLPUBLIC SwXTextRange : public cppu::WeakImplHelper8 SwTableBox* pBox; const SwStartNode* pBoxStartNode; SwDepend aObjectDepend; //Format der Tabelle oder des Rahmens anmelden - SfxItemPropertySet aPropSet; + const SfxItemPropertySet* m_pPropSet; //SwDepend aFrameDepend; ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText; - + ::sw::mark::IMark* pMark; void _CreateNewBookmark(SwPaM& rPam); //TODO: new exception type for protected content @@ -803,18 +808,20 @@ public: virtual void SAL_CALL makeRedline( const ::rtl::OUString& RedlineType, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& RedlineProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); //SwClient - virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew); - - BOOL GetPositions(SwPaM& rToFill) const; - const SwDoc* GetDoc()const {return pDoc;} - SwDoc* GetDoc(){return pDoc;} - - SwBookmark* GetBookmark() const { return (SwBookmark*)GetRegisteredIn(); } - - static BOOL XTextRangeToSwPaM( SwUnoInternalPaM& rToFill, - const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange); - static ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > CreateTextRangeFromPosition(SwDoc* pDoc, - const SwPosition& rPos, const SwPosition* pMark); + virtual void Modify(SfxPoolItem *pOld, SfxPoolItem *pNew); + BOOL GetPositions(SwPaM& rToFill) const; + const SwDoc* GetDoc() const + { return pDoc; } + SwDoc* GetDoc() + { return pDoc; } + const ::sw::mark::IMark * GetBookmark() const + { return pMark; } + + static BOOL XTextRangeToSwPaM(SwUnoInternalPaM& rToFill, + const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange); + static ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > CreateTextRangeFromPosition( + SwDoc* pDoc, + const SwPosition& rPos, const SwPosition* pMark); }; /* -----------------15.05.98 08:29------------------- @@ -913,7 +920,7 @@ class SwXTextSection : public cppu::WeakImplHelper7 { friend class SwXTextSectionClient; SwEventListenerContainer aLstnrCntnr; - SfxItemPropertySet aPropSet; + const SfxItemPropertySet* m_pPropSet; BOOL m_bIsDescriptor; BOOL m_bIndexHeader; @@ -1139,9 +1146,9 @@ public: /*-----------------07.04.98 08:15------------------- --------------------------------------------------*/ -class SwXParagraph : public cppu::WeakImplHelper9 +class SwXParagraph : public cppu::WeakImplHelper10 < -// ::com::sun::star::beans::XTolerantMultiPropertySet, + ::com::sun::star::beans::XTolerantMultiPropertySet, ::com::sun::star::beans::XMultiPropertySet, ::com::sun::star::text::XTextRange, ::com::sun::star::beans::XPropertySet, @@ -1156,7 +1163,7 @@ class SwXParagraph : public cppu::WeakImplHelper9 { ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText; SwEventListenerContainer aLstnrCntnr; - SfxItemPropertySet aPropSet; + const SfxItemPropertySet* m_pPropSet; rtl::OUString m_sText; sal_Int32 nSelectionStartPos; sal_Int32 nSelectionEndPos; @@ -1167,9 +1174,9 @@ protected: void SAL_CALL SetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL GetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); -// ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL GetPropertyValuesTolerant_Impl( -// const ::com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames, -// sal_Bool bDirectValuesOnly ) throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL GetPropertyValuesTolerant_Impl( + const ::com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames, + sal_Bool bDirectValuesOnly ) throw (::com::sun::star::uno::RuntimeException); virtual ~SwXParagraph(); public: @@ -1183,9 +1190,9 @@ public: virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); //XTolerantMultiPropertySet -// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL setPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); -// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL getPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException); -// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL getDirectPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL setPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL getPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL getDirectPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException); //XMultiPropertySet // virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); @@ -1428,7 +1435,7 @@ public: /* -----------------27.08.98 15:11------------------- * * --------------------------------------------------*/ -class SwXReferenceMark : public SwRefBookmarkBaseClass, +class SwXReferenceMark : public SwRefMarkBaseClass, public SwClient { SwEventListenerContainer aLstnrCntnr; diff --git a/sw/inc/unoport.hxx b/sw/inc/unoport.hxx index 1d6b60436a7b..ed29a995dfe3 100644 --- a/sw/inc/unoport.hxx +++ b/sw/inc/unoport.hxx @@ -38,9 +38,7 @@ #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/beans/XMultiPropertySet.hpp> -//#ifndef _COM_SUN_STAR_BEANS_XTOLERANTMULTIPROPERTYSET_HPP_ -//#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp> -//#endif +#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp> #include <com/sun/star/text/XTextField.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -80,9 +78,9 @@ enum SwTextPortionType class SwXRubyPortion; -class SwXTextPortion : public cppu::WeakImplHelper8 +class SwXTextPortion : public cppu::WeakImplHelper9 < -// ::com::sun::star::beans::XTolerantMultiPropertySet, + ::com::sun::star::beans::XTolerantMultiPropertySet, ::com::sun::star::beans::XMultiPropertySet, ::com::sun::star::beans::XPropertySet, ::com::sun::star::text::XTextRange, @@ -96,7 +94,7 @@ class SwXTextPortion : public cppu::WeakImplHelper8 { friend class SwXRubyPortion; SwEventListenerContainer aLstnrCntnr; - SfxItemPropertySet aPropSet; + const SfxItemPropertySet* m_pPropSet; ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText; ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xRefMark; ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xTOXMark; @@ -117,10 +115,15 @@ class SwXTextPortion : public cppu::WeakImplHelper8 SwFmtFld* GetFldFmt(BOOL bInit = sal_False); protected: - SfxItemPropertySet& GetPropSet() { return aPropSet; } + //SfxItemPropertySet& GetPropSet() { return aPropSet; } - void SAL_CALL SetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL GetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + void SAL_CALL SetPropertyValues_Impl( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL GetPropertyValues_Impl( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); // ::com::sun::star::uno::Any GetPropertyValue( const SfxItemPropertyMap *pEntry, // SwUnoCrsr *pUnoCrsr, @@ -130,11 +133,11 @@ protected: sal_Int32 nLength ); void GetPropertyValue( ::com::sun::star::uno::Any &rVal, - const SfxItemPropertyMap *pEntry, SwUnoCrsr *pUnoCrsr, SfxItemSet *&pSet ); + const SfxItemPropertySimpleEntry& rEntry, SwUnoCrsr *pUnoCrsr, SfxItemSet *&pSet ); -// ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL GetPropertyValuesTolerant_Impl( -// const ::com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames, -// sal_Bool bDirectValuesOnly ) throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL GetPropertyValuesTolerant_Impl( + const ::com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames, + sal_Bool bDirectValuesOnly ) throw (::com::sun::star::uno::RuntimeException); virtual ~SwXTextPortion(); public: @@ -150,9 +153,9 @@ public: virtual void SAL_CALL setString(const rtl::OUString& aString) throw( ::com::sun::star::uno::RuntimeException ); //XTolerantMultiPropertySet -// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL setPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); -// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL getPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException); -// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL getDirectPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL setPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL getPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL getDirectPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException); //XMultiPropertySet // virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx index 0fe1705c9988..bc9cd02a3ac7 100644 --- a/sw/inc/unosett.hxx +++ b/sw/inc/unosett.hxx @@ -44,13 +44,12 @@ #include <cppuhelper/implbase4.hxx> #include <cppuhelper/implbase5.hxx> #include <tools/string.hxx> +#include <svtools/itemprop.hxx> class SwDoc; class SwFmtCol; class SwDocShell; class SwNumRule; -struct SfxItemPropertyMap; - /****************************************************************************** * ******************************************************************************/ @@ -64,7 +63,7 @@ class SwXFootnoteProperties : public cppu::WeakAggImplHelper2 > { SwDoc* pDoc; - const SfxItemPropertyMap* _pMap; + const SfxItemPropertySet* m_pPropertySet; protected: virtual ~SwXFootnoteProperties(); public: @@ -98,7 +97,7 @@ class SwXEndnoteProperties : public cppu::WeakAggImplHelper2 > { SwDoc* pDoc; - const SfxItemPropertyMap* _pMap; + const SfxItemPropertySet* m_pPropertySet; protected: virtual ~SwXEndnoteProperties(); public: @@ -132,7 +131,7 @@ class SwXLineNumberingProperties : public cppu::WeakAggImplHelper2 > { SwDoc* pDoc; - const SfxItemPropertyMap* _pMap; + const SfxItemPropertySet* m_pPropertySet; protected: virtual ~SwXLineNumberingProperties(); public: @@ -175,7 +174,7 @@ class SwXNumberingRules : public cppu::WeakAggImplHelper5 SwDoc* pDoc; // wird nur fuers anmelden gebraucht SwDocShell* pDocShell; //nur, wenn als ChapterNumbering verwendet SwNumRule* pNumRule; - const SfxItemPropertyMap* _pMap; + const SfxItemPropertySet* m_pPropertySet; sal_Bool bOwnNumRuleCreated; static String sInvalidStyle; protected: @@ -275,7 +274,7 @@ class SwXTextColumns : public cppu::WeakAggImplHelper4 sal_Bool bIsAutomaticWidth; sal_Int32 nAutoDistance; - const SfxItemPropertyMap* _pMap; + const SfxItemPropertySet* m_pPropSet; //separator line sal_Int32 nSepLineWidth; diff --git a/sw/inc/unosrch.hxx b/sw/inc/unosrch.hxx index 47b287d6c697..f03048f240b6 100644 --- a/sw/inc/unosrch.hxx +++ b/sw/inc/unosrch.hxx @@ -39,7 +39,7 @@ /****************************************************************************** * ******************************************************************************/ -struct SfxItemPropertyMap; +class SfxItemPropertySet; class SwXTextDocument; class SwSearchProperties_Impl; class SfxItemSet; @@ -68,7 +68,7 @@ class SwXTextSearch : public cppu::WeakImplHelper3 SwSearchProperties_Impl* pReplaceProperties; - const SfxItemPropertyMap* _pMap; + const SfxItemPropertySet* m_pPropSet; sal_Bool bAll : 1; sal_Bool bWord : 1; sal_Bool bBack : 1; diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx index 6d5b5a5db3fb..7c9e00f6671f 100644 --- a/sw/inc/unostyle.hxx +++ b/sw/inc/unostyle.hxx @@ -55,7 +55,7 @@ #include <istyleaccess.hxx> class SwDocShell; -struct SfxItemPropertyMap; +class SfxItemPropertySet; class SwXStyle; class SwStyleProperties_Impl; class SwAutoStylesEnumImpl; diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx index 1d0fc4c7372d..0ad2b3c494c8 100644 --- a/sw/inc/unotbl.hxx +++ b/sw/inc/unotbl.hxx @@ -84,8 +84,8 @@ class SwXCell : public SwXCellBaseClass, friend void lcl_setValue( SwXCell &rCell, double nVal ); - SfxItemPropertySet aPropSet; - SwTableBox* pBox; // only set in non-XML import + const SfxItemPropertySet* m_pPropSet; + SwTableBox* pBox; // only set in non-XML import const SwStartNode* pStartNode; // only set in XML import // table position where pBox was found last @@ -174,7 +174,7 @@ class SwXTextTableRow : public cppu::WeakImplHelper2 >, public SwClient { - SfxItemPropertySet aPropSet; + const SfxItemPropertySet* m_pPropSet; SwTableLine* pLine; SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); } @@ -219,7 +219,7 @@ class SwXTextTableCursor : public SwXTextTableCursor_Base ,public OTextCursorHelper { SwDepend aCrsrDepend; - SfxItemPropertySet aPropSet; + const SfxItemPropertySet* m_pPropSet; SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); } // SwUnoCrsr* GetCrsr() const { return (SwUnoCrsr*)aCrsrDepend.GetRegisteredIn(); } @@ -304,8 +304,7 @@ class SwXTextTable : public cppu::WeakImplHelper10 { SwEventListenerContainer aLstnrCntnr; SwChartEventListenerContainer aChartLstnrCntnr; - SfxItemPropertySet aPropSet; - const SfxItemPropertyMap* _pMap; + const SfxItemPropertySet* m_pPropSet; // Descriptor-interface SwTableProperties_Impl* pTableProps; @@ -431,10 +430,9 @@ class SwXCellRange : public cppu::WeakImplHelper7 SwChartEventListenerContainer aChartLstnrCntnr; SwRangeDescriptor aRgDesc; - SfxItemPropertySet aPropSet; + const SfxItemPropertySet* m_pPropSet; SwUnoCrsr* pTblCrsr; - const SfxItemPropertyMap* _pMap; sal_Bool bFirstRowAsLabel :1; sal_Bool bFirstColumnAsLabel :1; diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 77369c7a4840..50851a31e945 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -176,7 +176,7 @@ class SwXTextDocument : public SwXTextDocumentBaseClass, ActionContextArr aActionArr; SwRefreshListenerContainer aRefreshCont; - SfxItemPropertySet aPropSet; + const SfxItemPropertySet* pPropSet; SwDocShell* pDocShell; sal_Bool bObjectValid; @@ -477,7 +477,7 @@ class SwXLinkNameAccessWrapper : public cppu::WeakImplHelper4 > { ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xRealAccess; - SfxItemPropertySet aPropSet; + const SfxItemPropertySet* pPropSet; const String sLinkSuffix; const String sLinkDisplayName; ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > xDoc; @@ -527,8 +527,8 @@ class SwXOutlineTarget : public cppu::WeakImplHelper2 ::com::sun::star::lang::XServiceInfo > { - SfxItemPropertySet aPropSet; - String sOutlineText; + const SfxItemPropertySet* pPropSet; + String sOutlineText; public: SwXOutlineTarget(const String& rOutlineText); diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index e531485bd6ad..5a249db26337 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -48,7 +48,7 @@ class SfxObjectShellRef; class SwDoc; class IDocumentSettingAccess; class IDocumentDeviceAccess; -class IDocumentBookmarkAccess; +class IDocumentMarkAccess; class IDocumentDrawModelAccess; class IDocumentRedlineAccess; class IDocumentLayoutAccess; @@ -306,8 +306,8 @@ public: /** Provides access to the document bookmark interface */ - const IDocumentBookmarkAccess* getIDocumentBookmarkAccess() const; - IDocumentBookmarkAccess* getIDocumentBookmarkAccess(); + const IDocumentMarkAccess* getIDocumentMarkAccess() const; + IDocumentMarkAccess* getIDocumentMarkAccess(); /** Provides access to the document draw model interface */ diff --git a/sw/qa/complex/writer/CheckBookmarks.java b/sw/qa/complex/writer/CheckBookmarks.java new file mode 100644 index 000000000000..c8f4a0355428 --- /dev/null +++ b/sw/qa/complex/writer/CheckBookmarks.java @@ -0,0 +1,280 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +package complex.writer; + +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XNamed; +import com.sun.star.container.XNameAccess; +import com.sun.star.frame.XStorable; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.text.XBookmarksSupplier; +import com.sun.star.text.XSimpleText; +import com.sun.star.text.XText; +import com.sun.star.text.XTextContent; +import com.sun.star.text.XTextCursor; +import com.sun.star.text.XTextDocument; +import com.sun.star.text.XTextRange; +import com.sun.star.uno.UnoRuntime; +import complexlib.ComplexTestCase; +import java.math.BigInteger; + +class BookmarkHashes { + public String m_sName; + public BigInteger m_nSetupHash; + public BigInteger m_nInsertRandomHash; + public BigInteger m_nDeleteRandomHash; + public BigInteger m_nLinebreakHash; + public BigInteger m_nOdfReloadHash; + public BigInteger m_nMsWordReloadHash; + + public BookmarkHashes(String sName) { + m_sName = sName; + } + + public String checkExpectationString(BookmarkHashes aExpectation) { + StringBuffer buffer = new StringBuffer(); + buffer.append("Comparing " + m_sName + " to expectations from " + aExpectation.m_sName + "\n"); + buffer.append(compareHashString("after setup", m_nSetupHash, aExpectation.m_nSetupHash)); + buffer.append(compareHashString("after insert random", m_nInsertRandomHash, aExpectation.m_nInsertRandomHash)); + buffer.append(compareHashString("after delete random", m_nDeleteRandomHash, aExpectation.m_nDeleteRandomHash)); + buffer.append(compareHashString("after line breaks", m_nLinebreakHash, aExpectation.m_nLinebreakHash)); + buffer.append(compareHashString("after ODF roundtrip", m_nOdfReloadHash, aExpectation.m_nOdfReloadHash)); + buffer.append(compareHashString("after MsWord roundtrip", m_nMsWordReloadHash, aExpectation.m_nMsWordReloadHash)); + return buffer.toString(); + }; + + public boolean meetsExpectation(BookmarkHashes aExpectation) { + return m_nSetupHash.equals(aExpectation.m_nSetupHash) + && m_nInsertRandomHash.equals(aExpectation.m_nInsertRandomHash) + && m_nDeleteRandomHash.equals(aExpectation.m_nDeleteRandomHash) + && m_nLinebreakHash.equals(aExpectation.m_nLinebreakHash) + && m_nOdfReloadHash.equals(aExpectation.m_nOdfReloadHash) + && m_nMsWordReloadHash.equals(aExpectation.m_nMsWordReloadHash); + } + + private String compareHashString(String sCheckName, BigInteger nActual, BigInteger nExpectation) { + StringBuffer buffer = new StringBuffer(sCheckName); + buffer.append(": "); + if(nActual.equals(nExpectation)) + buffer.append("good (" + nActual.toString(16) + ")"); + else + buffer.append("bad (actual:" + nActual.toString(16) + ", expected: " + nExpectation.toString(16) + ")"); + buffer.append("\n"); + return buffer.toString(); + } + + static public java.math.BigInteger getBookmarksHash(XTextDocument xDoc) + throws com.sun.star.uno.Exception, java.security.NoSuchAlgorithmException + { + StringBuffer buffer = new StringBuffer(""); + XBookmarksSupplier xBookmarksSupplier = (XBookmarksSupplier)UnoRuntime.queryInterface( + XBookmarksSupplier.class, + xDoc); + XNameAccess xBookmarks = xBookmarksSupplier.getBookmarks(); + for(String sBookmarkname : xBookmarks.getElementNames()) { + Object xBookmark = xBookmarks.getByName(sBookmarkname); + XTextContent xBookmarkAsContent = (XTextContent)UnoRuntime.queryInterface( + XTextContent.class, + xBookmark); + buffer.append(sBookmarkname); + buffer.append(":"); + buffer.append(xBookmarkAsContent.getAnchor().getString()); + buffer.append(";"); + } + java.security.MessageDigest sha1 = java.security.MessageDigest.getInstance("SHA-1"); + sha1.reset(); + sha1.update(buffer.toString().getBytes()); + return new java.math.BigInteger(sha1.digest()); + } +} + +public class CheckBookmarks extends ComplexTestCase { + private XMultiServiceFactory m_xMsf = null; + private XTextDocument m_xDoc = null; + private XTextDocument m_xOdfReloadedDoc = null; + private XTextDocument m_xMsWordReloadedDoc = null; + + public String[] getTestMethodNames() { + return new String[]{"checkBookmarks"}; + } + + private BookmarkHashes getDEV300m41Expectations() { + BookmarkHashes result = new BookmarkHashes("DEV300m41"); + result.m_nSetupHash = new BigInteger("-4b0706744e8452fe1ae9d5e1c28cf70fb6194795",16); + result.m_nInsertRandomHash = new BigInteger("25aa0fad3f4881832dcdfe658ec2efa8a1a02bc5",16); + result.m_nDeleteRandomHash = new BigInteger("-3ec87e810b46d734677c351ad893bbbf9ea10f55",16); + result.m_nLinebreakHash = new BigInteger("3ae08c284ea0d6e738cb43c0a8105e718a633550",16); + result.m_nOdfReloadHash = new BigInteger("3ae08c284ea0d6e738cb43c0a8105e718a633550",16); + result.m_nMsWordReloadHash = new BigInteger("3ae08c284ea0d6e738cb43c0a8105e718a633550",16); + return result; + } + + public void checkBookmarks() + throws com.sun.star.uno.Exception, + com.sun.star.io.IOException, + java.security.NoSuchAlgorithmException + { + try { + m_xMsf = (XMultiServiceFactory)param.getMSF(); + m_xDoc = util.WriterTools.createTextDoc(m_xMsf); + BookmarkHashes actualHashes = new BookmarkHashes("actual"); + BookmarkHashes expectedHashes = getDEV300m41Expectations(); + setupBookmarks(); + actualHashes.m_nSetupHash = BookmarkHashes.getBookmarksHash(m_xDoc); + insertRandomParts(200177); + actualHashes.m_nInsertRandomHash = BookmarkHashes.getBookmarksHash(m_xDoc); + deleteRandomParts(4711); + actualHashes.m_nDeleteRandomHash = BookmarkHashes.getBookmarksHash(m_xDoc); + insertLinebreaks(007); + actualHashes.m_nLinebreakHash = BookmarkHashes.getBookmarksHash(m_xDoc); + m_xOdfReloadedDoc = reloadFrom("StarOffice XML (Writer)", "odf"); + actualHashes.m_nOdfReloadHash = BookmarkHashes.getBookmarksHash(m_xOdfReloadedDoc); + m_xMsWordReloadedDoc = reloadFrom("MS Word 97", "doc"); + actualHashes.m_nMsWordReloadHash = BookmarkHashes.getBookmarksHash(m_xMsWordReloadedDoc); + log.println(actualHashes.checkExpectationString(expectedHashes)); + if(!actualHashes.meetsExpectation(expectedHashes)) + failed("CheckBookmark did not meet expectations (" + expectedHashes.m_sName + ")."); + } finally { + // closing test document + if(m_xDoc != null) + util.DesktopTools.closeDoc(m_xDoc); + if(m_xOdfReloadedDoc!= null) + util.DesktopTools.closeDoc(m_xOdfReloadedDoc); + if(m_xMsWordReloadedDoc!= null) + util.DesktopTools.closeDoc(m_xMsWordReloadedDoc); + } + } + + private void setupBookmarks() + throws com.sun.star.uno.Exception + { + XText xText = m_xDoc.getText(); + XSimpleText xSimpleText = (XSimpleText)UnoRuntime.queryInterface( + XSimpleText.class, + xText); + for(int nPara=0; nPara<10; ++nPara) { + for(int nBookmark=0; nBookmark<100; ++nBookmark){ + insertBookmark( + xText.createTextCursor(), + "P" + nPara + "word" + nBookmark, + "P" + nPara + "word" + nBookmark); + XTextCursor xWordCrsr = xText.createTextCursor(); + xWordCrsr.setString(" "); + } + XTextCursor xParaCrsr = xText.createTextCursor(); + XTextRange xParaCrsrAsRange = (XTextRange)UnoRuntime.queryInterface( + XTextRange.class, + xParaCrsr); + xText.insertControlCharacter(xParaCrsrAsRange, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false); + } + } + + private void insertRandomParts(long seed) + throws com.sun.star.uno.Exception + { + java.util.Random rnd = new java.util.Random(seed); + XTextCursor xCrsr = m_xDoc.getText().createTextCursor(); + for(int i=0; i<600; i++) { + xCrsr.goRight((short)rnd.nextInt(100), false); + xCrsr.setString(Long.toString(rnd.nextLong())); + } + } + + private void deleteRandomParts(long seed) + throws com.sun.star.uno.Exception + { + java.util.Random rnd = new java.util.Random(seed); + XTextCursor xCrsr = m_xDoc.getText().createTextCursor(); + for(int i=0; i<600; i++) { + xCrsr.goRight((short)rnd.nextInt(100), false); + xCrsr.goRight((short)rnd.nextInt(20), true); + xCrsr.setString(""); + } + } + + private void insertLinebreaks(long seed) + throws com.sun.star.uno.Exception + { + XText xText = m_xDoc.getText(); + java.util.Random rnd = new java.util.Random(seed); + XTextCursor xCrsr = m_xDoc.getText().createTextCursor(); + for(int i=0; i<30; i++) { + xCrsr.goRight((short)rnd.nextInt(300), false); + XTextRange xCrsrAsRange = (XTextRange)UnoRuntime.queryInterface( + XTextRange.class, + xCrsr); + xText.insertControlCharacter(xCrsrAsRange, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false); + } + } + + private void insertBookmark(XTextCursor crsr, String name, String content) + throws com.sun.star.uno.Exception + { + XMultiServiceFactory xDocFactory = (XMultiServiceFactory)UnoRuntime.queryInterface( + XMultiServiceFactory.class, + m_xDoc); + + Object xBookmark = xDocFactory.createInstance("com.sun.star.text.Bookmark"); + XTextContent xBookmarkAsTextContent = (XTextContent)UnoRuntime.queryInterface( + XTextContent.class, + xBookmark); + crsr.setString(content); + XNamed xBookmarkAsNamed = (XNamed)UnoRuntime.queryInterface( + XNamed.class, + xBookmark); + xBookmarkAsNamed.setName(name); + m_xDoc.getText().insertTextContent(crsr, xBookmarkAsTextContent, true); + } + + private XTextDocument reloadFrom(String sFilter, String sExtension) + throws com.sun.star.io.IOException + { + String sFileUrl = util.utils.getOfficeTemp(m_xMsf) + "/Bookmarktest." + sExtension; + try { + PropertyValue[] aStoreProperties = new PropertyValue[2]; + aStoreProperties[0] = new PropertyValue(); + aStoreProperties[1] = new PropertyValue(); + aStoreProperties[0].Name = "Override"; + aStoreProperties[0].Value = true; + aStoreProperties[1].Name = "FilterName"; + aStoreProperties[1].Value = sFilter; + XStorable xStorable = (XStorable)UnoRuntime.queryInterface( + XStorable.class, + m_xDoc); + xStorable.storeToURL(sFileUrl, aStoreProperties); + return util.WriterTools.loadTextDoc(m_xMsf, sFileUrl); + } finally { + if(util.utils.fileExists(m_xMsf, sFileUrl)) + util.utils.deleteFile(m_xMsf, sFileUrl); + } + } +} diff --git a/sw/qa/complex/writer/CheckCrossReferences.java b/sw/qa/complex/writer/CheckCrossReferences.java index f740155fa412..7b469c0a4afc 100644 --- a/sw/qa/complex/writer/CheckCrossReferences.java +++ b/sw/qa/complex/writer/CheckCrossReferences.java @@ -267,9 +267,12 @@ public class CheckCrossReferences extends ComplexTestCase { try { xParaTextRange = (com.sun.star.text.XTextRange)UnoRuntime.queryInterface( com.sun.star.text.XTextRange.class, xParaEnum.nextElement()); - if ( xParaTextRange.getString().equals( "*i*J" ) ) { + if ( xParaTextRange.getString().equals( "J" ) ) { break; } + else { + xParaTextRange = null; + } } catch (com.sun.star.container.NoSuchElementException e) { System.out.println("Cannot find paragraph to insert cross-reference bookmark."); e.printStackTrace(); diff --git a/sw/qa/complex/writer/CheckFlies.java b/sw/qa/complex/writer/CheckFlies.java new file mode 100644 index 000000000000..a54b02a3b58b --- /dev/null +++ b/sw/qa/complex/writer/CheckFlies.java @@ -0,0 +1,236 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +package complex.writer; + +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XNamed; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XIndexAccess; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.UnoRuntime; +import complexlib.ComplexTestCase; +import java.math.BigInteger; +import java.util.Collection; +import java.util.ArrayList; + +public class CheckFlies extends ComplexTestCase { + private XMultiServiceFactory m_xMsf = null; + private XTextDocument m_xDoc = null; + + public String[] getTestMethodNames() { + return new String[]{"checkFlies"}; + } + + public void checkFlies() + throws com.sun.star.uno.Exception, + com.sun.star.io.IOException + { + try { + m_xMsf = (XMultiServiceFactory)param.getMSF(); + m_xDoc = util.WriterTools.loadTextDoc(m_xMsf, util.utils.getFullTestURL("CheckFlies.odt")); + com.sun.star.text.XTextFramesSupplier xTFS = (com.sun.star.text.XTextFramesSupplier)UnoRuntime.queryInterface( + com.sun.star.text.XTextFramesSupplier.class, + m_xDoc); + checkTextFrames(xTFS); + com.sun.star.text.XTextGraphicObjectsSupplier xTGOS = (com.sun.star.text.XTextGraphicObjectsSupplier)UnoRuntime.queryInterface( + com.sun.star.text.XTextGraphicObjectsSupplier.class, + m_xDoc); + checkGraphicFrames(xTGOS); + com.sun.star.text.XTextEmbeddedObjectsSupplier xTEOS = (com.sun.star.text.XTextEmbeddedObjectsSupplier)UnoRuntime.queryInterface( + com.sun.star.text.XTextEmbeddedObjectsSupplier.class, + m_xDoc); + checkEmbeddedFrames(xTEOS); + } finally { + // closing test document + if(m_xDoc != null) + util.DesktopTools.closeDoc(m_xDoc); + } + } + + private void checkEmbeddedFrames(com.sun.star.text.XTextEmbeddedObjectsSupplier xTGOS) + throws com.sun.star.lang.WrappedTargetException + { + Collection<String> vExpectedEmbeddedFrames = new ArrayList<String>(); + vExpectedEmbeddedFrames.add("Object1"); + int nEmbeddedFrames = vExpectedEmbeddedFrames.size(); + com.sun.star.container.XNameAccess xEmbeddedFrames = xTGOS.getEmbeddedObjects(); + for(String sFrameName : xEmbeddedFrames.getElementNames()) + { + if(!vExpectedEmbeddedFrames.remove(sFrameName)) + failed("Unexpected frame name"); + try + { + xEmbeddedFrames.getByName(sFrameName); + } + catch(com.sun.star.container.NoSuchElementException e) + { + failed("Could not get embedded frame by name."); + } + if(!xEmbeddedFrames.hasByName(sFrameName)) + failed("Could not find embedded frame by name."); + } + if(!vExpectedEmbeddedFrames.isEmpty()) + failed("Missing expected embedded frames."); + try + { + xEmbeddedFrames.getByName("Nonexisting embedded frame"); + failed("Got nonexisting embedded frame"); + } + catch(com.sun.star.container.NoSuchElementException e) + {} + if(xEmbeddedFrames.hasByName("Nonexisting embedded frame")) + failed("Has nonexisting embedded frame"); + + com.sun.star.container.XIndexAccess xEmbeddedFramesIdx = (com.sun.star.container.XIndexAccess)UnoRuntime.queryInterface( + com.sun.star.container.XIndexAccess.class, + xEmbeddedFrames); + if(xEmbeddedFramesIdx.getCount() != nEmbeddedFrames) + failed("Unexpected number of embedded frames reported."); + for(int nCurrentFrameIdx = 0; nCurrentFrameIdx < xEmbeddedFramesIdx.getCount(); nCurrentFrameIdx++) + { + try + { + xEmbeddedFramesIdx.getByIndex(nCurrentFrameIdx); + } + catch(com.sun.star.lang.IndexOutOfBoundsException e) + { + failed("Could not get embedded frame by index."); + } + } + } + + private void checkGraphicFrames(com.sun.star.text.XTextGraphicObjectsSupplier xTGOS) + throws com.sun.star.lang.WrappedTargetException + { + Collection<String> vExpectedGraphicFrames = new ArrayList<String>(); + vExpectedGraphicFrames.add("graphics1"); + int nGraphicFrames = vExpectedGraphicFrames.size(); + com.sun.star.container.XNameAccess xGraphicFrames = xTGOS.getGraphicObjects(); + for(String sFrameName : xGraphicFrames.getElementNames()) + { + if(!vExpectedGraphicFrames.remove(sFrameName)) + failed("Unexpected frame name"); + try + { + xGraphicFrames.getByName(sFrameName); + } + catch(com.sun.star.container.NoSuchElementException e) + { + failed("Could not get graphics frame by name."); + } + if(!xGraphicFrames.hasByName(sFrameName)) + failed("Could not find graphics frame by name."); + } + if(!vExpectedGraphicFrames.isEmpty()) + failed("Missing expected graphics frames."); + try + { + xGraphicFrames.getByName("Nonexisting graphics frame"); + failed("Got nonexisting graphics frame"); + } + catch(com.sun.star.container.NoSuchElementException e) + {} + if(xGraphicFrames.hasByName("Nonexisting graphics frame")) + failed("Has nonexisting graphics frame"); + + com.sun.star.container.XIndexAccess xGraphicFramesIdx = (com.sun.star.container.XIndexAccess)UnoRuntime.queryInterface( + com.sun.star.container.XIndexAccess.class, + xGraphicFrames); + if(xGraphicFramesIdx.getCount() != nGraphicFrames) + failed("Unexpected number of graphics frames reported."); + for(int nCurrentFrameIdx = 0; nCurrentFrameIdx < xGraphicFramesIdx.getCount(); nCurrentFrameIdx++) + { + try + { + xGraphicFramesIdx.getByIndex(nCurrentFrameIdx); + } + catch(com.sun.star.lang.IndexOutOfBoundsException e) + { + failed("Could not get graphics frame by index."); + } + } + } + + private void checkTextFrames(com.sun.star.text.XTextFramesSupplier xTFS) + throws com.sun.star.lang.WrappedTargetException + { + Collection<String> vExpectedTextFrames = new ArrayList<String>(); + vExpectedTextFrames.add("Frame1"); + vExpectedTextFrames.add("Frame2"); + + int nTextFrames = vExpectedTextFrames.size(); + com.sun.star.container.XNameAccess xTextFrames = xTFS.getTextFrames(); + for(String sFrameName : xTextFrames.getElementNames()) + { + if(!vExpectedTextFrames.remove(sFrameName)) + failed("Unexpected frame name"); + try + { + xTextFrames.getByName(sFrameName); + } + catch(com.sun.star.container.NoSuchElementException e) + { + failed("Could not get text frame by name."); + } + if(!xTextFrames.hasByName(sFrameName)) + failed("Could not find text frame by name."); + } + if(!vExpectedTextFrames.isEmpty()) + failed("Missing expected text frames."); + try + { + xTextFrames.getByName("Nonexisting Textframe"); + failed("Got nonexisting text frame."); + } + catch(com.sun.star.container.NoSuchElementException e) + {} + if(xTextFrames.hasByName("Nonexisting text frame")) + failed("Has nonexisting text frame."); + + com.sun.star.container.XIndexAccess xTextFramesIdx = (com.sun.star.container.XIndexAccess)UnoRuntime.queryInterface( + com.sun.star.container.XIndexAccess.class, + xTextFrames); + if(xTextFramesIdx.getCount() != nTextFrames) + failed("Unexpected number of text frames reported."); + for(int nCurrentFrameIdx = 0; nCurrentFrameIdx < xTextFramesIdx.getCount(); nCurrentFrameIdx++) + { + try + { + xTextFramesIdx.getByIndex(nCurrentFrameIdx); + } + catch(com.sun.star.lang.IndexOutOfBoundsException e) + { + failed("Could not get text frame by index."); + } + } + } +} diff --git a/sw/qa/complex/writer/makefile.mk b/sw/qa/complex/writer/makefile.mk index 31466555f50b..7bcc7fe934c9 100755 --- a/sw/qa/complex/writer/makefile.mk +++ b/sw/qa/complex/writer/makefile.mk @@ -41,8 +41,8 @@ PACKAGE = complex$/writer #----- compile .java files ----------------------------------------- JARFILES = mysql.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = CheckIndexedPropertyValues.java CheckNamedPropertyValues.java CheckCrossReferences.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) +JAVAFILES = CheckIndexedPropertyValues.java CheckNamedPropertyValues.java CheckCrossReferences.java CheckBookmarks.java CheckFlies.java +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) #----- make a jar from compiled files ------------------------------ @@ -50,7 +50,7 @@ MAXLINELENGTH = 100000 JARCLASSDIRS = $(PACKAGE) JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE +JARCOMPRESS = TRUE # --- Parameters for the test -------------------------------------- @@ -81,9 +81,11 @@ ALL: ALLDEP .INCLUDE : target.mk run: \ + CheckBookmarks \ + CheckCrossReferences \ CheckIndexedPropertyValues \ CheckNamedPropertyValues \ - CheckCrossReferences + CheckFlies RUN: run @@ -97,3 +99,9 @@ CheckNamedPropertyValues: CheckCrossReferences: +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) -tdoc $(PWD)$/testdocuments $(CT_PACKAGE).CheckCrossReferences +CheckBookmarks: + +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) -tdoc $(PWD)$/testdocuments $(CT_PACKAGE).CheckBookmarks + +CheckFlies: + +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) -tdoc $(PWD)$/testdocuments $(CT_PACKAGE).CheckFlies + diff --git a/sw/qa/complex/writer/testdocuments/CheckFlies.odt b/sw/qa/complex/writer/testdocuments/CheckFlies.odt Binary files differnew file mode 100644 index 000000000000..8f42989b3a0d --- /dev/null +++ b/sw/qa/complex/writer/testdocuments/CheckFlies.odt diff --git a/sw/sdi/_annotsh.sdi b/sw/sdi/_annotsh.sdi index e7f9208b7e7c..9b5f411ffd28 100755 --- a/sw/sdi/_annotsh.sdi +++ b/sw/sdi/_annotsh.sdi @@ -188,7 +188,7 @@ interface _Annotation ExecMethod = Exec ; ] - FN_INSERT_SYMBOL // api: + SID_CHARMAP // api: [ ExecMethod = Exec ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi index 062c2e19eb58..3ce311a4d7c2 100644 --- a/sw/sdi/_textsh.sdi +++ b/sw/sdi/_textsh.sdi @@ -177,7 +177,7 @@ interface BaseText StateMethod = GetState ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] - FN_INSERT_SYMBOL // status(final|play|rec) + SID_CHARMAP // status(final|play|rec) [ ExecMethod = Execute ; StateMethod = GetState ; diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi index 2e00907c7a2d..8f6eb837af86 100644 --- a/sw/sdi/drwtxtsh.sdi +++ b/sw/sdi/drwtxtsh.sdi @@ -114,7 +114,7 @@ interface TextDrawText DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] - FN_INSERT_SYMBOL // api: + SID_CHARMAP // api: [ ExecMethod = ExecDraw ; DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 69a2e80639f8..784100694d4a 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -4750,31 +4750,6 @@ SfxVoidItem InsertScript FN_JAVAEDIT ] //-------------------------------------------------------------------------- -SfxVoidItem InsertSymbol FN_INSERT_SYMBOL -(SfxStringItem Symbols FN_INSERT_SYMBOL,SfxStringItem FontName FN_PARAM_1) -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_INSERT; -] - -//-------------------------------------------------------------------------- SfxVoidItem InsertTable FN_INSERT_TABLE (SfxStringItem TableName FN_INSERT_TABLE,SfxUInt16Item Columns SID_ATTR_TABLE_COLUMN,SfxUInt16Item Rows SID_ATTR_TABLE_ROW,SfxInt32Item Flags FN_PARAM_1,SfxStringItem AutoFormat FN_PARAM_2) [ diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 6f68da38068f..42b164185fbb 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1347,27 +1347,27 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl( // build-up sequence containing the run attributes <rDefAttrSeq> tAccParaPropValMap aDefAttrSeq; { - const SfxItemPropertySet& rPropSet = - aSwMapProvider.GetPropertyMap( PROPERTY_MAP_TEXT_CURSOR ); - const SfxItemPropertyMap* pPropMap( rPropSet.getPropertyMap() ); - while ( pPropMap->pName ) + const SfxItemPropertyMap* pPropMap = + aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_CURSOR )->getPropertyMap(); + PropertyEntryVector_t aPropertyEntries = pPropMap->getPropertyEntries(); + PropertyEntryVector_t::const_iterator aPropIt = aPropertyEntries.begin(); + while ( aPropIt != aPropertyEntries.end() ) { - const SfxPoolItem* pItem = pSet->GetItem( pPropMap->nWID ); + const SfxPoolItem* pItem = pSet->GetItem( aPropIt->nWID ); if ( pItem ) { Any aVal; - pItem->QueryValue( aVal, pPropMap->nMemberId ); + pItem->QueryValue( aVal, aPropIt->nMemberId ); PropertyValue rPropVal; - rPropVal.Name = OUString::createFromAscii( pPropMap->pName ); + rPropVal.Name = aPropIt->sName; rPropVal.Value = aVal; rPropVal.Handle = -1; rPropVal.State = beans::PropertyState_DEFAULT_VALUE; aDefAttrSeq[rPropVal.Name] = rPropVal; } - - ++pPropMap; + ++aPropIt; } // --> OD 2007-01-15 #i72800# @@ -1546,22 +1546,24 @@ void SwAccessibleParagraph::_getRunAttributesImpl( uno::Sequence< ::rtl::OUString > aDummy; _getDefaultAttributesImpl( aDummy, aDefAttrSeq, true ); // <-- - const SfxItemPropertySet& rPropSet = - aSwMapProvider.GetPropertyMap( PROPERTY_MAP_TEXT_CURSOR ); - const SfxItemPropertyMap* pPropMap( rPropSet.getPropertyMap() ); - while ( pPropMap->pName ) + + const SfxItemPropertyMap* pPropMap = + aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_CURSOR )->getPropertyMap(); + PropertyEntryVector_t aPropertyEntries = pPropMap->getPropertyEntries(); + PropertyEntryVector_t::const_iterator aPropIt = aPropertyEntries.begin(); + while ( aPropIt != aPropertyEntries.end() ) { const SfxPoolItem* pItem( 0 ); // --> OD 2007-11-12 #i82637# // Found character attributes, whose value equals the value of // the corresponding default character attributes, are excluded. - if ( aSet.GetItemState( pPropMap->nWID, TRUE, &pItem ) == SFX_ITEM_SET ) + if ( aSet.GetItemState( aPropIt->nWID, TRUE, &pItem ) == SFX_ITEM_SET ) { Any aVal; - pItem->QueryValue( aVal, pPropMap->nMemberId ); + pItem->QueryValue( aVal, aPropIt->nMemberId ); PropertyValue rPropVal; - rPropVal.Name = OUString::createFromAscii( pPropMap->pName ); + rPropVal.Name = aPropIt->sName; rPropVal.Value = aVal; rPropVal.Handle = -1; rPropVal.State = PropertyState_DIRECT_VALUE; @@ -1575,7 +1577,7 @@ void SwAccessibleParagraph::_getRunAttributesImpl( } } - ++pPropMap; + ++aPropIt; } } diff --git a/sw/source/core/bastyp/SwBitArray.cxx b/sw/source/core/bastyp/SwBitArray.cxx deleted file mode 100644 index 8c3cd8f7ea48..000000000000 --- a/sw/source/core/bastyp/SwBitArray.cxx +++ /dev/null @@ -1,175 +0,0 @@ -/************************************************************************* - * - * 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: SwBitArray.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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sw.hxx" - -#include <string.h> -#include "SwBitArray.hxx" - -using namespace std; - -SwBitArray::SwBitArray(sal_uInt32 _nSize) -{ - nSize = _nSize; - mArray = new sal_uInt32[(nSize - 1)/ mGroupSize + 1]; - Reset(); -} - -SwBitArray::SwBitArray(const SwBitArray & rArray) - : nSize(rArray.nSize) -{ - mArray = new sal_uInt32[calcSize()]; - memcpy(mArray, rArray.mArray, calcSize()); -} - -SwBitArray::~SwBitArray() -{ - delete [] mArray; -} - -BOOL SwBitArray::IsValid(sal_uInt32 n) const -{ - return n < nSize; -} - -void SwBitArray::Set(sal_uInt32 n, BOOL nValue) -{ - sal_uInt32 * pGroup = NULL; - - if (IsValid(n)) - { - pGroup = GetGroup(n); - - if (nValue) - *pGroup |= 1 << (n % mGroupSize); - else - *pGroup &= ~(1 << (n % mGroupSize)); - } -} - -void SwBitArray::Reset() -{ - memset(mArray, 0, mGroupSize * (nSize / mGroupSize + 1)); -} - -BOOL SwBitArray::Get(sal_uInt32 n) const -{ - BOOL bResult = FALSE; - sal_uInt32 * pGroup = NULL; - - if (IsValid(n)) - { - pGroup = GetGroup(n); - - bResult = 0 != (*pGroup & (1 << (n % mGroupSize))); - } - - return bResult; -} - -SwBitArray & SwBitArray::operator = (const SwBitArray & rArray) -{ - if (Size() == rArray.Size()) - { - memcpy(mArray, rArray.mArray, calcSize()); - } - - return *this; -} - -SwBitArray operator & (const SwBitArray & rA, const SwBitArray & rB) -{ - SwBitArray aResult(rA); - - if (rA.Size() == rB.Size()) - { - for (size_t i = 0; i < rA.calcSize(); i++) - aResult.mArray[i] &= rB.mArray[i]; - } - - return aResult; -} - -SwBitArray operator | (const SwBitArray & rA, const SwBitArray & rB) -{ - SwBitArray aResult(rA); - - if (rA.Size() == rB.Size()) - { - for (size_t i = 0; i < rA.calcSize(); i++) - aResult.mArray[i] |= rB.mArray[i]; - } - - return aResult; -} - -SwBitArray operator ^ (const SwBitArray & rA, const SwBitArray & rB) -{ - SwBitArray aResult(rA); - - if (rA.Size() == rB.Size()) - { - for (size_t i = 0; i < rA.calcSize(); i++) - aResult.mArray[i] ^= rB.mArray[i]; - } - - return aResult; -} - -SwBitArray operator ~ (const SwBitArray & rA) -{ - SwBitArray aResult(rA); - - for (size_t i = 0; i < rA.calcSize(); i++) - aResult.mArray[i] = ~ rA.mArray[i]; - - return aResult; -} - -#if OSL_DEBUG_LEVEL > 1 -ostream & operator << (ostream & o, const SwBitArray & rBitArray) -{ - char buffer[256]; - - sprintf(buffer, "%p", &rBitArray); - o << "[ " << buffer << " "; - for (sal_uInt32 n = 0; n < rBitArray.Size(); n++) - { - if (rBitArray.Get(n)) - o << "1"; - else - o << "0"; - } - o << " ]"; - - return o; -} -#endif diff --git a/sw/source/core/bastyp/makefile.mk b/sw/source/core/bastyp/makefile.mk index 0fb79b92883b..ab4fcbd2f010 100644 --- a/sw/source/core/bastyp/makefile.mk +++ b/sw/source/core/bastyp/makefile.mk @@ -45,11 +45,10 @@ AUTOSEG=true # --- Files -------------------------------------------------------- CXXFILES = \ - SwBitArray.cxx \ bparr.cxx \ breakit.cxx \ calc.cxx \ - checkit.cxx \ + checkit.cxx \ index.cxx \ init.cxx \ ring.cxx \ @@ -60,12 +59,11 @@ CXXFILES = \ tabcol.cxx \ SwSmartTagMgr.cxx -SLOFILES = \ - $(SLO)$/SwBitArray.obj \ +SLOFILES = \ $(SLO)$/bparr.obj \ $(SLO)$/breakit.obj \ $(SLO)$/calc.obj \ - $(SLO)$/checkit.obj \ + $(SLO)$/checkit.obj \ $(SLO)$/index.obj \ $(SLO)$/init.obj \ $(SLO)$/ring.obj \ @@ -77,7 +75,6 @@ SLOFILES = \ $(SLO)$/SwSmartTagMgr.obj EXCEPTIONSFILES = \ - $(SLO)$/SwBitArray.obj \ $(SLO)$/tabcol.obj # --- Tagets ------------------------------------------------------- diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index cb197d822baf..3179e3fb3330 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -33,205 +33,209 @@ #include <bookmrk.hxx> -#include <swtypes.hxx> +#include <IDocumentMarkAccess.hxx> +#include <doc.hxx> +#include <errhdl.hxx> +#include <ndtxt.hxx> #include <pam.hxx> #include <swserv.hxx> -#include <errhdl.hxx> -#include <IDocumentBookmarkAccess.hxx> -#include "ndtxt.hxx" +#include <svx/linkmgr.hxx> +#include <swtypes.hxx> +#include <undobj.hxx> +#include <rtl/random.h> SV_IMPL_REF( SwServerObject ) -TYPEINIT1( SwBookmark, SwModify ); //rtti +using namespace ::sw::mark; -void lcl_FixPosition( SwPosition& rPos ) +namespace { - // make sure the position has 1) the proper node, and 2) a proper index - SwTxtNode* pTxtNode = rPos.nNode.GetNode().GetTxtNode(); + static void lcl_FixPosition(SwPosition& rPos) + { + // make sure the position has 1) the proper node, and 2) a proper index + SwTxtNode* pTxtNode = rPos.nNode.GetNode().GetTxtNode(); + if(pTxtNode == NULL && rPos.nContent.GetIndex() > 0) + { + OSL_TRACE( + "bookmrk.cxx::lcl_FixPosition" + " - illegal position: %d without proper TxtNode", rPos.nContent.GetIndex()); + rPos.nContent.Assign(NULL, 0); + } + else if(pTxtNode != NULL && rPos.nContent.GetIndex() > pTxtNode->Len()) + { + OSL_TRACE( + "bookmrk.cxx::lcl_FixPosition" + " - illegal position: %d is beyond %d", rPos.nContent.GetIndex(), pTxtNode->Len()); + rPos.nContent.Assign(pTxtNode, pTxtNode->Len()); + } + }; - if( rPos.nContent.GetIndex() > ( pTxtNode == NULL ? 0 : pTxtNode->Len() ) ) + static void lcl_AssureFieldMarksSet(Fieldmark* const pField, + SwDoc* const io_pDoc, + const sal_Unicode aStartMark, + const sal_Unicode aEndMark) { - DBG_ERROR( "illegal position" ); - xub_StrLen nLen = rPos.nContent.GetIndex(); - if( pTxtNode == NULL ) - nLen = 0; - else if( nLen >= pTxtNode->Len() ) - nLen = pTxtNode->Len(); - rPos.nContent.Assign( pTxtNode, nLen ); + const SwPosition& rStart = pField->GetMarkStart(); + const SwPosition& rEnd = pField->GetMarkEnd(); + SwTxtNode const * const pStartTxtNode = io_pDoc->GetNodes()[rStart.nNode]->GetTxtNode(); + SwTxtNode const * const pEndTxtNode = io_pDoc->GetNodes()[rEnd.nNode]->GetTxtNode(); + const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex()); + const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar(rEnd.nContent.GetIndex()-1); + const SwPaM aStartPaM(rStart); + const SwPaM aEndPaM(rEnd); + io_pDoc->StartUndo(UNDO_UI_REPLACE, NULL); + if(ch_start != aStartMark) + io_pDoc->Insert(aStartPaM, aStartMark); + if(aEndMark && ch_end != aEndMark) + io_pDoc->Insert(aEndPaM, aEndMark); + io_pDoc->EndUndo(UNDO_UI_REPLACE, NULL); + }; +} + +namespace sw { namespace mark +{ + MarkBase::MarkBase(const SwPaM& aPaM, + const ::rtl::OUString& rName) + : SwModify(0) + , m_pPos1(new SwPosition(*(aPaM.GetPoint()))) + , m_aName(rName) + { + lcl_FixPosition(*m_pPos1); + if(aPaM.HasMark()) + { + MarkBase::SetOtherMarkPos(*(aPaM.GetMark())); + lcl_FixPosition(*m_pPos2); + } } -} -SwBookmark::SwBookmark(const SwPosition& aPos ) - : SwModify( 0 ), - pPos2( 0 ), - eMarkType( IDocumentBookmarkAccess::BOOKMARK ) -{ - pPos1 = new SwPosition( aPos ); -} - - -SwBookmark::SwBookmark(const SwPosition& aPos, const KeyCode& rCode, - const String& rName, const String& rShortName ) - : SwModify( 0 ), - pPos2( 0 ), - aName(rName), - aShortName(rShortName), - aCode(rCode), - eMarkType( IDocumentBookmarkAccess::BOOKMARK ) -{ - pPos1 = new SwPosition(aPos); - // --> OD 2007-09-26 #i81002# - lcl_FixPosition( *pPos1 ); - // <-- -} - -SwBookmark::SwBookmark( const SwPaM& aPaM, - const KeyCode& rCode, - const String& rName, const String& rShortName) - : SwModify( 0 ), - pPos1( 0 ), - pPos2( 0 ), - refObj(), - aName(rName), - aShortName(rShortName), - aCode(rCode), - eMarkType( IDocumentBookmarkAccess::BOOKMARK ) -{ - pPos1 = new SwPosition( *(aPaM.GetPoint()) ); - lcl_FixPosition( *pPos1 ); - if ( aPaM.HasMark() ) + void MarkBase::SetMarkPos(const SwPosition& rNewPos) { - pPos2 = new SwPosition( *(aPaM.GetMark()) ); - lcl_FixPosition( *pPos2 ); + ::boost::scoped_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos1); + //lcl_FixPosition(*m_pPos1); } -} -// Beim Loeschen von Text werden Bookmarks mitgeloescht! + void MarkBase::SetOtherMarkPos(const SwPosition& rNewPos) + { + ::boost::scoped_ptr<SwPosition>(new SwPosition(rNewPos)).swap(m_pPos2); + //lcl_FixPosition(*m_pPos2); + } + MarkBase::~MarkBase() + { } -SwBookmark::~SwBookmark() -{ - // falls wir noch der DDE-Bookmark sind, dann muss der aus dem - // Clipboard ausgetragen werden. Wird automatisch ueber DataChanged - // ausgeloest. - if( refObj.Is() ) + ::rtl::OUString MarkBase::GenerateNewName(const ::rtl::OUString& rPrefix) { - if( IDocumentBookmarkAccess::DDE_BOOKMARK == eMarkType && refObj->HasDataLinks() ) + static rtlRandomPool aPool = rtl_random_createPool(); + static ::rtl::OUString sUniquePostfix; + static sal_Int32 nCount = SAL_MAX_INT32; + ::rtl::OUStringBuffer aResult(rPrefix); + if(nCount == SAL_MAX_INT32) { - ::sfx2::SvLinkSource* p = &refObj; - p->SendDataChanged(); + sal_Int32 nRandom; + ::rtl::OUStringBuffer sUniquePostfixBuffer; + rtl_random_getBytes(aPool, &nRandom, sizeof(nRandom)); + sUniquePostfix = ::rtl::OUStringBuffer(13).appendAscii("_").append(static_cast<sal_Int32>(abs(nRandom))).makeStringAndClear(); + nCount = 0; } - refObj->SetNoServer(); + // putting the counter in front of the random parts will speed up string comparisons + return aResult.append(nCount++).append(sUniquePostfix).makeStringAndClear(); } - delete pPos1; - if( pPos2 ) - delete pPos2; -} -// Vergleiche auf Basis der Dokumentposition + NavigatorReminder::NavigatorReminder(const SwPaM& rPaM) + : MarkBase(rPaM, our_sNamePrefix) + { } -BOOL SwBookmark::operator<(const SwBookmark &rBM) const -{ - // --> OD 2007-10-11 #i81002# - refactoring - // simplification by using <BookmarkStart()> -// const SwPosition* pThisPos = ( !pPos2 || *pPos1 <= *pPos2 ) ? pPos1 : pPos2; -// const SwPosition* pBMPos = ( !rBM.pPos2 || *rBM.pPos1 <= *rBM.pPos2 ) -// ? rBM.pPos1 : rBM.pPos2; - -// return *pThisPos < *pBMPos; - return *(BookmarkStart()) < *(rBM.BookmarkStart()); -} - -BOOL SwBookmark::operator==(const SwBookmark &rBM) const -{ - return (this == &rBM); -} + const ::rtl::OUString NavigatorReminder::our_sNamePrefix = ::rtl::OUString::createFromAscii("__NavigatorReminder__"); -BOOL SwBookmark::IsEqualPos( const SwBookmark &rBM ) const -{ - // --> OD 2007-10-11 #i81002# - refactoring - // simplification by using <BookmarkStart()> -// const SwPosition* pThisPos = ( !pPos2 || *pPos1 <= *pPos2 ) ? pPos1 : pPos2; -// const SwPosition* pBMPos = ( !rBM.pPos2 || *rBM.pPos1 <= *rBM.pPos2 ) -// ? rBM.pPos1 : rBM.pPos2; - -// return *pThisPos == *pBMPos; - return *(BookmarkStart()) == *(rBM.BookmarkStart()); -} + UnoMark::UnoMark(const SwPaM& aPaM) + : MarkBase(aPaM, MarkBase::GenerateNewName(our_sNamePrefix)) + { } -void SwBookmark::SetRefObject( SwServerObject* pObj ) -{ - refObj = pObj; -} + const ::rtl::OUString UnoMark::our_sNamePrefix = ::rtl::OUString::createFromAscii("__UnoMark__"); -// --> OD 2007-10-10 #i81002# -const SwPosition& SwBookmark::GetBookmarkPos() const -{ - return *pPos1; -} + DdeBookmark::DdeBookmark(const SwPaM& aPaM) + : MarkBase(aPaM, MarkBase::GenerateNewName(our_sNamePrefix)) + , m_aRefObj(NULL) + { } -const SwPosition* SwBookmark::GetOtherBookmarkPos() const -{ - return pPos2; -} + void DdeBookmark::SetRefObject(SwServerObject* pObj) + { + m_aRefObj = pObj; + } -const SwPosition* SwBookmark::BookmarkStart() const -{ - return pPos2 ? (*pPos1 <= *pPos2 ? pPos1 : pPos2) : pPos1; -} + const ::rtl::OUString DdeBookmark::our_sNamePrefix = ::rtl::OUString::createFromAscii("__DdeLink__"); -const SwPosition* SwBookmark::BookmarkEnd() const -{ - return pPos2 ? (*pPos1 >= *pPos2 ? pPos1 : pPos2) : pPos1; -} -// <-- + void DdeBookmark::DeregisterFromDoc(SwDoc* const pDoc) + { + if(m_aRefObj.Is()) + pDoc->GetLinkManager().RemoveServer(m_aRefObj); + } -// --> OD 2007-09-26 #i81002# -void SwBookmark::SetBookmarkPos( const SwPosition* pNewPos1 ) -{ - ASSERT( pNewPos1 != 0, - "<SwBookmark::SetBookmarkPos(..)> - Bookmark position 1 can't be NULL --> crash." ); - *pPos1 = *pNewPos1; -} -void SwBookmark::SetOtherBookmarkPos( const SwPosition* pNewPos2 ) -{ - if ( pNewPos2 != 0 ) + DdeBookmark::~DdeBookmark() { - if ( pPos2 != 0 ) + if( m_aRefObj.Is() ) { - *pPos2 = *pNewPos2; + if(m_aRefObj->HasDataLinks()) + { + ::sfx2::SvLinkSource* p = &m_aRefObj; + p->SendDataChanged(); + } + m_aRefObj->SetNoServer(); } - else + } + + Bookmark::Bookmark(const SwPaM& aPaM, + const KeyCode& rCode, + const ::rtl::OUString& rName, + const ::rtl::OUString& rShortName) + : DdeBookmark(aPaM) + , m_aCode(rCode) + , m_sShortName(rShortName) + { + m_aName = rName; + } + + void Bookmark::InitDoc(SwDoc* const io_pDoc) + { + if(io_pDoc->DoesUndo()) { - pPos2 = new SwPosition( *pNewPos2 ); + io_pDoc->ClearRedo(); + io_pDoc->AppendUndo(new SwUndoInsBookmark(*this)); } + io_pDoc->SetModified(); } - else + + Fieldmark::Fieldmark(const SwPaM& rPaM) + : MarkBase(rPaM, MarkBase::GenerateNewName(our_sNamePrefix)) { - delete pPos2; - pPos2 = 0; + if(!IsExpanded()) + SetOtherMarkPos(GetMarkPos()); } -} -// <-- -SwMark::SwMark( const SwPosition& aPos, - const KeyCode& rCode, - const String& rName, - const String& rShortName ) - : SwBookmark( aPos, rCode, rName, rShortName ) -{ - eMarkType = IDocumentBookmarkAccess::MARK; -} + const ::rtl::OUString Fieldmark::our_sNamePrefix = ::rtl::OUString::createFromAscii("__Fieldmark__"); -// --> OD 2007-09-26 #i81002# -SwUNOMark::SwUNOMark( const SwPaM& aPaM, - const KeyCode& rCode, - const String& rName, - const String& rShortName ) - : SwBookmark( aPaM, rCode, rName, rShortName ) -{ - eMarkType = IDocumentBookmarkAccess::UNO_BOOKMARK; -} -// <-- + TextFieldmark::TextFieldmark(const SwPaM& rPaM) + : Fieldmark(rPaM) + { } + + void TextFieldmark::InitDoc(SwDoc* const io_pDoc) + { + lcl_AssureFieldMarksSet(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND); + } + + CheckboxFieldmark::CheckboxFieldmark(const SwPaM& rPaM) + : Fieldmark(rPaM) + { } + + void CheckboxFieldmark::InitDoc(SwDoc* const io_pDoc) + { + lcl_AssureFieldMarksSet(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND); + } + + void CheckboxFieldmark::SetChecked(bool checked) + { m_isChecked = checked; } + bool CheckboxFieldmark::IsChecked() const + { return m_isChecked; } +}} diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx index 0714701517df..1d7f019fbe98 100644 --- a/sw/source/core/crsr/crbm.cxx +++ b/sw/source/core/crsr/crbm.cxx @@ -35,299 +35,229 @@ #include "crsrsh.hxx" #include "ndtxt.hxx" #include <docary.hxx> +#include <boost/bind.hpp> -#include "bookmrk.hxx" +#include "IMark.hxx" #include "callnk.hxx" #include "swcrsr.hxx" -#include <IDocumentBookmarkAccess.hxx> +#include <IDocumentMarkAccess.hxx> #include <IDocumentSettingAccess.hxx> -/* - * Methoden der SwCrsrShell fuer Bookmark - */ +using namespace std; - -// am CurCrsr.SPoint -BOOL SwCrsrShell::SetBookmark( const KeyCode& rCode, const String& rName, - const String& rShortName, IDocumentBookmarkAccess::BookmarkType eMark ) +namespace { - StartAction(); - BOOL bRet = 0 != getIDocumentBookmarkAccess()->makeBookmark( *GetCrsr(), rCode, rName, - rShortName, eMark); - EndAction(); - return bRet; -} -// setzt CurCrsr.SPoint + struct CrsrStateHelper + { + CrsrStateHelper(SwCrsrShell& rShell) + : m_aLink(rShell) + , m_pCrsr(rShell.GetSwCrsr()) + , m_aSaveState(*m_pCrsr) + { } + void SetCrsrToMark(::sw::mark::IMark const * const pMark) + { + *(m_pCrsr->GetPoint()) = pMark->GetMarkStart(); + if(pMark->IsExpanded()) + { + m_pCrsr->SetMark(); + *(m_pCrsr->GetMark()) = pMark->GetMarkEnd(); + } + } -BOOL SwCrsrShell::GotoBookmark(USHORT nPos, BOOL bAtStart) -{ - // Crsr-Moves ueberwachen, evt. Link callen - BOOL bRet = TRUE; - SwCallLink aLk( *this ); + // returns true if the Cursor had been rolled back + bool RollbackIfIllegal() + { + if(m_pCrsr->IsSelOvr(nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION + | nsSwCursorSelOverFlags::SELOVER_TOGGLE)) + { + m_pCrsr->DeleteMark(); + m_pCrsr->RestoreSavePos(); + return true; + } + return false; + } - SwBookmark* pBkmk = getIDocumentBookmarkAccess()->getBookmarks()[ nPos ]; - SwCursor* pCrsr = GetSwCrsr(); - SwCrsrSaveState aSaveState( *pCrsr ); + SwCallLink m_aLink; + SwCursor* m_pCrsr; + SwCrsrSaveState m_aSaveState; + }; - // --> OD 2007-09-27 #i81002# - refactoring - // simplify by using <SwBookmark::BookmarkStart()/BookmarkEnd()> -// if( pBkmk->GetOtherBookmarkPos() ) -// { -// if( bAtStart ) -// *pCrsr->GetPoint() = *pBkmk->GetOtherBookmarkPos() < pBkmk->GetBookmarkPos() -// ? *pBkmk->GetOtherBookmarkPos() -// : pBkmk->GetBookmarkPos(); -// else -// *pCrsr->GetPoint() = *pBkmk->GetOtherBookmarkPos() > pBkmk->GetBookmarkPos() -// ? *pBkmk->GetOtherBookmarkPos() -// : pBkmk->GetBookmarkPos(); -// } -// else -// *pCrsr->GetPoint() = pBkmk->GetBookmarkPos(); - if ( bAtStart ) - { - *pCrsr->GetPoint() = *pBkmk->BookmarkStart(); - } - else + + static bool lcl_ReverseMarkOrderingByEnd(const IDocumentMarkAccess::pMark_t& rpFirst, + const IDocumentMarkAccess::pMark_t& rpSecond) { - *pCrsr->GetPoint() = *pBkmk->BookmarkEnd(); + return rpFirst->GetMarkEnd() > rpSecond->GetMarkEnd(); } - // <-- - if( pCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | - nsSwCursorSelOverFlags::SELOVER_TOGGLE ) ) + static bool lcl_IsInvisibleBookmark(IDocumentMarkAccess::pMark_t pMark) { - pCrsr->DeleteMark(); - pCrsr->RestoreSavePos(); - bRet = FALSE; + return IDocumentMarkAccess::GetType(*pMark) != IDocumentMarkAccess::BOOKMARK; } - else - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); - return bRet; } - -BOOL SwCrsrShell::GotoBookmark(USHORT nPos) +// at CurCrsr.SPoint +::sw::mark::IMark* SwCrsrShell::SetBookmark( + const KeyCode& rCode, + const ::rtl::OUString& rName, + const ::rtl::OUString& rShortName, + IDocumentMarkAccess::MarkType eMark) { - // Crsr-Moves ueberwachen, evt. Link callen - BOOL bRet = TRUE; - SwCallLink aLk( *this ); - SwBookmark* pBkmk = getIDocumentBookmarkAccess()->getBookmarks()[ nPos ]; - SwCursor* pCrsr = GetSwCrsr(); - SwCrsrSaveState aSaveState( *pCrsr ); - - // --> OD 2007-09-27 #i81002# - refactoring - // simplify by using <SwBookmark::GetBookmarkStart()/GetBookmarkEnd()> -// *pCrsr->GetPoint() = pBkmk->GetBookmarkPos(); - *pCrsr->GetPoint() = *pBkmk->BookmarkStart(); - if( pBkmk->GetOtherBookmarkPos() ) - { - pCrsr->SetMark(); -// *pCrsr->GetMark() = *pBkmk->GetOtherBookmarkPos(); - *pCrsr->GetMark() = *pBkmk->BookmarkEnd(); -// if( *pCrsr->GetMark() > *pCrsr->GetPoint() ) -// pCrsr->Exchange(); - } - // <-- - - if( pCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | - nsSwCursorSelOverFlags::SELOVER_TOGGLE ) ) + StartAction(); + ::sw::mark::IMark* pMark = getIDocumentMarkAccess()->makeMark( + *GetCrsr(), + rName, + eMark); + ::sw::mark::IBookmark* pBookmark = dynamic_cast< ::sw::mark::IBookmark* >(pMark); + if(pBookmark) { - pCrsr->DeleteMark(); - pCrsr->RestoreSavePos(); - bRet = FALSE; + pBookmark->SetKeyCode(rCode); + pBookmark->SetShortName(rShortName); } - else - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); - return bRet; + EndAction(); + return pMark; } -// TRUE, wenn's noch eine gab - +// setzt CurCrsr.SPoint -BOOL SwCrsrShell::GoNextBookmark() +bool SwCrsrShell::GotoMark(const ::sw::mark::IMark* const pMark, bool bAtStart) { - SwBookmark aBM(*GetCrsr()->GetPoint()); - USHORT nPos; - const SwBookmarks& rBkmks = getIDocumentBookmarkAccess()->getBookmarks(); - rBkmks.Seek_Entry( &aBM, &nPos ); - if ( nPos == rBkmks.Count() ) - return FALSE; - - // alle die Inhaltlich auf der gleichen Position stehen, ueberspringen - while( aBM.IsEqualPos( *rBkmks[ nPos ] )) - if( ++nPos == rBkmks.Count() ) - return FALSE; - - while( !GotoBookmark( nPos )) - if( ++nPos == rBkmks.Count() ) - return FALSE; + // watch Crsr-Moves + CrsrStateHelper aCrsrSt(*this); + if ( bAtStart ) + *(aCrsrSt.m_pCrsr)->GetPoint() = pMark->GetMarkStart(); + else + *(aCrsrSt.m_pCrsr)->GetPoint() = pMark->GetMarkEnd(); + if(aCrsrSt.RollbackIfIllegal()) return false; - return TRUE; + UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + return true; } - -bool SwCrsrShell::IsFormProtected() +bool SwCrsrShell::GotoMark(const ::sw::mark::IMark* const pMark) { - return getIDocumentSettingAccess()->get(IDocumentSettingAccess::PROTECT_FORM); -} + // watch Crsr-Moves + CrsrStateHelper aCrsrSt(*this); + aCrsrSt.SetCrsrToMark(pMark); -SwBookmark* SwCrsrShell::IsInFieldBookmark() -{ - // TODO: Refactor - SwPosition pos(*GetCrsr()->GetPoint()); - return getIDocumentBookmarkAccess()->getFieldBookmarkFor(pos); -} + if(aCrsrSt.RollbackIfIllegal()) return false; -SwFieldBookmark* SwCrsrShell::IsInFormFieldBookmark() -{ - // TODO: Refactor - SwPosition pos(*GetCrsr()->GetPoint()); - return (SwFieldBookmark*)getIDocumentBookmarkAccess()->getFormFieldBookmarkFor(pos); + UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + return true; } -SwBookmark* SwCrsrShell::GetNextFieldBookmark() +bool SwCrsrShell::GoNextBookmark() { - SwPosition pos(*GetCrsr()->GetPoint()); - return getIDocumentBookmarkAccess()->getNextFieldBookmarkFor(pos); -} - -SwBookmark* SwCrsrShell::GetPrevFieldBookmark() -{ - SwPosition pos(*GetCrsr()->GetPoint()); - return getIDocumentBookmarkAccess()->getPrevFieldBookmarkFor(pos); -} - -bool SwCrsrShell::GotoFieldBookmark(SwBookmark *pBkmk) -{ - if(pBkmk==NULL) return false; - // Crsr-Moves ueberwachen, evt. Link callen - bool bRet = true; - SwCallLink aLk( *this ); - SwCursor* pCrsr = GetSwCrsr(); - SwCrsrSaveState aSaveState( *pCrsr ); - - *pCrsr->GetPoint() = pBkmk->GetBookmarkPos(); - if( pBkmk->GetOtherBookmarkPos() ) + IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess(); + IDocumentMarkAccess::container_t vCandidates; + remove_copy_if( + upper_bound( + pMarkAccess->getBookmarksBegin(), + pMarkAccess->getBookmarksEnd(), + *GetCrsr()->GetPoint(), + bind(&::sw::mark::IMark::StartsAfter, _2, _1)), // finds the first that is starting after + pMarkAccess->getBookmarksEnd(), + back_inserter(vCandidates), + &lcl_IsInvisibleBookmark); + + // watch Crsr-Moves + CrsrStateHelper aCrsrSt(*this); + IDocumentMarkAccess::const_iterator_t ppMark = vCandidates.begin(); + for(; ppMark!=vCandidates.end(); ++ppMark) { - pCrsr->SetMark(); - *pCrsr->GetMark() = *pBkmk->GetOtherBookmarkPos(); - if( *pCrsr->GetMark() > *pCrsr->GetPoint() ) - pCrsr->Exchange(); + aCrsrSt.SetCrsrToMark(ppMark->get()); + if(!aCrsrSt.RollbackIfIllegal()) + break; // found legal move } - pCrsr->GetPoint()->nContent--; - pCrsr->GetMark()->nContent++; - - - if( pCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE ) ) + if(ppMark==vCandidates.end()) { - pCrsr->DeleteMark(); - pCrsr->RestoreSavePos(); - bRet = false; + SttEndDoc(false); + return false; } - else - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); - return bRet; + UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + return true; } -BOOL SwCrsrShell::GoPrevBookmark() +bool SwCrsrShell::GoPrevBookmark() { - const SwBookmarks& rBkmks = getIDocumentBookmarkAccess()->getBookmarks(); - if ( !rBkmks.Count() ) - return FALSE; - - USHORT nPos; - SwCursor* pCrsr = GetSwCrsr(); - SwBookmark aBM( *pCrsr->GetPoint() ); - rBkmks.Seek_Entry( &aBM, &nPos ); - - const SwBookmark* pBkmk; - // alle die Inhaltlich auf der gleichen Position stehen, ueberspringen - do - { - if ( nPos == 0 ) - return FALSE; - } while( aBM < *(pBkmk = rBkmks[--nPos]) || aBM.IsEqualPos( *pBkmk )); - - SwCallLink aLk( *this ); - SwCrsrSaveState aSaveState( *pCrsr ); - - BOOL bRet = FALSE; - do + IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess(); + // candidates from which to choose the mark before + // no need to consider marks starting after rPos + IDocumentMarkAccess::container_t vCandidates; + remove_copy_if( + pMarkAccess->getBookmarksBegin(), + upper_bound( + pMarkAccess->getBookmarksBegin(), + pMarkAccess->getBookmarksEnd(), + *GetCrsr()->GetPoint(), + bind(&::sw::mark::IMark::StartsAfter, _2, _1)), + back_inserter(vCandidates), + &lcl_IsInvisibleBookmark); + sort( + vCandidates.begin(), + vCandidates.end(), + &lcl_ReverseMarkOrderingByEnd); + + // watch Crsr-Moves + CrsrStateHelper aCrsrSt(*this); + IDocumentMarkAccess::const_iterator_t ppMark = vCandidates.begin(); + for(; ppMark!=vCandidates.end(); ++ppMark) { - pBkmk = rBkmks[ nPos ]; - - // --> OD 2007-09-27 #i81002# - refactoring - // simplify by using <SwBookmark::BookmarkStart()/BookmarkEnd()> - *pCrsr->GetPoint() = *pBkmk->BookmarkStart(); -// *pCrsr->GetPoint() = pBkmk->GetBookmarkPos(); - if( pBkmk->GetOtherBookmarkPos() ) - { - pCrsr->SetMark(); -// *pCrsr->GetMark() = *pBkmk->GetOtherBookmarkPos(); - *pCrsr->GetMark() = *pBkmk->BookmarkEnd(); -// if( *pCrsr->GetMark() < *pCrsr->GetPoint() ) -// pCrsr->Exchange(); - } - // <-- - if( !pCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | - nsSwCursorSelOverFlags::SELOVER_TOGGLE ) ) - { - UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); - bRet = TRUE; - } - - } while( !bRet && nPos-- ); - - if( !bRet ) + // ignoring those not ending before the Crsr + // (we were only able to eliminate those starting + // behind the Crsr by the upper_bound(..) + // above) + if(!(**ppMark).EndsBefore(*GetCrsr()->GetPoint())) + continue; + aCrsrSt.SetCrsrToMark(ppMark->get()); + if(!aCrsrSt.RollbackIfIllegal()) + break; // found legal move + } + if(ppMark==vCandidates.end()) { - pCrsr->DeleteMark(); - pCrsr->RestoreSavePos(); + SttEndDoc(true); + return false; } - return bRet; + UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + return true; } - - -USHORT SwCrsrShell::GetBookmarkCnt(BOOL bBkmrk) const +bool SwCrsrShell::IsFormProtected() { - return getIDocumentBookmarkAccess()->getBookmarkCount(bBkmrk); + return getIDocumentSettingAccess()->get(IDocumentSettingAccess::PROTECT_FORM); } - -SwBookmark& SwCrsrShell::GetBookmark(USHORT nPos, BOOL bBkmrk) +::sw::mark::IFieldmark* SwCrsrShell::GetCurrentFieldmark() { - return getIDocumentBookmarkAccess()->getBookmark(nPos, bBkmrk); + // TODO: Refactor + SwPosition pos(*GetCrsr()->GetPoint()); + return getIDocumentMarkAccess()->getFieldmarkFor(pos); } - -void SwCrsrShell::DelBookmark(USHORT nPos) +::sw::mark::IFieldmark* SwCrsrShell::GetFieldmarkAfter() { - StartAction(); - getIDocumentBookmarkAccess()->deleteBookmark(nPos); - EndAction(); + SwPosition pos(*GetCrsr()->GetPoint()); + return getIDocumentMarkAccess()->getFieldmarkAfter(pos); } - -void SwCrsrShell::DelBookmark( const String& rName ) +::sw::mark::IFieldmark* SwCrsrShell::GetFieldmarkBefore() { - StartAction(); - getIDocumentBookmarkAccess()->deleteBookmark( rName ); - EndAction(); + SwPosition pos(*GetCrsr()->GetPoint()); + return getIDocumentMarkAccess()->getFieldmarkBefore(pos); } - -USHORT SwCrsrShell::FindBookmark( const String& rName ) +bool SwCrsrShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark) { - return getIDocumentBookmarkAccess()->findBookmark( rName ); -} + if(pMark==NULL) return false; + // watch Crsr-Moves + CrsrStateHelper aCrsrSt(*this); + aCrsrSt.SetCrsrToMark(pMark); + //aCrsrSt.m_pCrsr->GetPoint()->nContent--; + //aCrsrSt.m_pCrsr->GetMark()->nContent++; + if(aCrsrSt.RollbackIfIllegal()) return false; -// erzeugt einen eindeutigen Namen. Der Name selbst muss vorgegeben -// werden, es wird dann bei gleichen Namen nur durchnumeriert. -void SwCrsrShell::MakeUniqueBookmarkName( String& rName ) -{ - getIDocumentBookmarkAccess()->makeUniqueBookmarkName( rName ); + UpdateCrsr(SwCrsrShell::SCROLLWIN|SwCrsrShell::CHKRANGE|SwCrsrShell::READONLY); + return true; } diff --git a/sw/source/core/crsr/crossrefbookmark.cxx b/sw/source/core/crsr/crossrefbookmark.cxx index 6841abaafb81..38b502caee75 100644 --- a/sw/source/core/crsr/crossrefbookmark.cxx +++ b/sw/source/core/crsr/crossrefbookmark.cxx @@ -32,62 +32,79 @@ #include "precompiled_sw.hxx" #include <crossrefbookmark.hxx> - #include <ndtxt.hxx> -TYPEINIT1( SwCrossRefBookmark, SwBookmark ); //rtti +using namespace rtl; -SwCrossRefBookmark::SwCrossRefBookmark( const SwPosition& aPos, - const KeyCode& rCode, - const String& rName, - const String& rShortName ) - : SwBookmark( SwPosition( aPos ), rCode, rName, rShortName ), - // --> OD 2007-11-16 #i83479# - mnSubType( bookmarkfunc::isHeadingCrossRefBookmarkName( rName ) - ? IDocumentBookmarkAccess::HEADING - : IDocumentBookmarkAccess::NUMITEM ) - // <-- +namespace sw { namespace mark { - eMarkType = IDocumentBookmarkAccess::CROSSREF_BOOKMARK; + CrossRefBookmark::CrossRefBookmark(const SwPaM& rPaM, + const KeyCode& rCode, + const OUString& rName, + const OUString& rShortName, + const OUString& rPrefix) + : Bookmark(rPaM, rCode, rName, rShortName) + { + if(rPaM.HasMark()) + OSL_ENSURE((rPaM.GetMark()->nNode == rPaM.GetPoint()->nNode && + rPaM.Start()->nContent.GetIndex() == 0 && + rPaM.End()->nContent.GetIndex() == rPaM.GetPoint()->nNode.GetNode().GetTxtNode()->Len()), + "<CrossRefBookmark::CrossRefBookmark(..)>" + "- creation of cross-reference bookmark with an expanded PaM that does not expand over exactly one whole paragraph."); + SetMarkPos(*rPaM.Start()); + if(!rName.getLength()) + m_aName = MarkBase::GenerateNewName(rPrefix); + } - ASSERT( GetBookmarkPos().nNode.GetNode().GetTxtNode(), - "<SwCrossRefBookmark::SwCrossRefBookmark(..)> - cross-reference bookmark doesn't mark text node." ) - ASSERT( GetBookmarkPos().nContent.GetIndex() == 0, - "<SwCrossRefBookmark::SwCrossRefBookmark(..)> - cross-reference bookmark doesn't mark start of text node." ) - ASSERT( mnSubType == IDocumentBookmarkAccess::HEADING || - bookmarkfunc::isNumItemCrossRefBookmarkName( rName ), - "<SwCrossRefBookmark::SwCrossRefBookmark(..)> - name doesn't fit. Serious issue, please inform OD!" ); -} + void CrossRefBookmark::SetMarkPos(const SwPosition& rNewPos) + { + OSL_PRECOND(rNewPos.nNode.GetNode().GetTxtNode(), + "<SwCrossRefBookmark::SetMarkPos(..)>" + " - new bookmark position for cross-reference bookmark doesn't mark text node"); + OSL_PRECOND(rNewPos.nContent.GetIndex() == 0, + "<SwCrossRefBookmark::SetMarkPos(..)>" + " - new bookmark position for cross-reference bookmark doesn't mark start of text node"); + MarkBase::SetMarkPos(rNewPos); + } -SwCrossRefBookmark::~SwCrossRefBookmark() -{ -} + const SwPosition& CrossRefBookmark::GetOtherMarkPos() const + { + OSL_PRECOND(false, + "<SwCrossRefBookmark::GetOtherMarkPos(..)>" + " - this should never be called!"); + return *static_cast<SwPosition*>(NULL); + } -IDocumentBookmarkAccess::CrossReferenceBookmarkSubType SwCrossRefBookmark::GetSubType() const -{ - return mnSubType; -} + bool CrossRefBookmark::IsLegalName(const ::rtl::OUString& rName) + { + return CrossRefNumItemBookmark::IsLegalName(rName) || CrossRefHeadingBookmark::IsLegalName(rName); + } -const SwPosition* SwCrossRefBookmark::GetOtherBookmarkPos() const -{ - return 0; -} + CrossRefHeadingBookmark::CrossRefHeadingBookmark(const SwPaM& rPaM, + const KeyCode& rCode, + const OUString& rName, + const OUString& rShortName) + : CrossRefBookmark(rPaM, rCode, rName, rShortName, our_sNamePrefix) + { } -void SwCrossRefBookmark::SetBookmarkPos( const SwPosition* pNewPos1 ) -{ - ASSERT( pNewPos1->nNode.GetNode().GetTxtNode(), - "<SwCrossRefBookmark::SetBookmarkPos(..)> - new bookmark position for cross-reference bookmark doesn't mark text node" ); - ASSERT( pNewPos1->nContent.GetIndex() == 0, - "<SwCrossRefBookmark::SetBookmarkPos(..)> - new bookmark position for cross-reference bookmark doesn't mark start of text node" ); + const ::rtl::OUString CrossRefHeadingBookmark::our_sNamePrefix = ::rtl::OUString::createFromAscii("__RefHeading__"); - SwBookmark::SetBookmarkPos( pNewPos1 ); -} + bool CrossRefHeadingBookmark::IsLegalName(const ::rtl::OUString& rName) + { + return rName.match(our_sNamePrefix); + } -void SwCrossRefBookmark::SetOtherBookmarkPos( const SwPosition* /*pNewPos2*/ ) -{ - // the other bookmark position for a cross-reference bookmark is allowed - // to be set. - ASSERT( false, - "<SwCrossRefBookmark::SetOtherBookmarkPos(..)> - misusage of SwCrossRefBookmark: other bookmark position isn't allowed to be set." ); -} + CrossRefNumItemBookmark::CrossRefNumItemBookmark(const SwPaM& rPaM, + const KeyCode& rCode, + const OUString& rName, + const OUString& rShortName) + : CrossRefBookmark(rPaM, rCode, rName, rShortName, our_sNamePrefix) + { } + + const ::rtl::OUString CrossRefNumItemBookmark::our_sNamePrefix = ::rtl::OUString::createFromAscii("__RefNumPara__"); + bool CrossRefNumItemBookmark::IsLegalName(const ::rtl::OUString& rName) + { + return rName.match(our_sNamePrefix); + } +}} diff --git a/sw/source/core/crsr/makefile.mk b/sw/source/core/crsr/makefile.mk index 5e31d44f5f79..57cb499dec66 100644 --- a/sw/source/core/crsr/makefile.mk +++ b/sw/source/core/crsr/makefile.mk @@ -49,6 +49,7 @@ CDEFS+=-Dmydebug # --- Files -------------------------------------------------------- EXCEPTIONSFILES= \ + $(SLO)$/crbm.obj \ $(SLO)$/crsrsh.obj \ $(SLO)$/viscrs.obj diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index b49c5adae400..860117babcc0 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -55,7 +55,7 @@ // <-- #include <ndtxt.hxx> // #111827# -#include <bookmrk.hxx> +#include <IMark.hxx> // fuer den dummen ?MSC-? Compiler inline xub_StrLen GetSttOrEnd( BOOL bCondition, const SwCntntNode& rNd ) @@ -767,12 +767,13 @@ BOOL SwPaM::HasReadonlySel( bool bFormView ) const } } } -// TODO: Form Protection when Enhanced Fields are enabled + //FIXME FieldBk + // TODO: Form Protection when Enhanced Fields are enabled // if( !bRet ) // { // const SwDoc *pDoc=GetDoc(); -// SwBookmark *pA = ( pDoc && pPoint ? pDoc->getFieldBookmarkFor( *pPoint ) : NULL ); -// SwBookmark *pB = ( pDoc && pMark ? pDoc->getFieldBookmarkFor( *pMark ) : pA ); +// SwBookmark *pA = ( pDoc && pPoint ? pDoc->getFieldmarkFor( *pPoint ) : NULL ); +// SwBookmark *pB = ( pDoc && pMark ? pDoc->getFieldmarkFor( *pMark ) : pA ); // bRet = ( pA != pB ); // bool bProtectForm = pDoc->get( IDocumentSettingAccess::PROTECT_FORM ); // if( bProtectForm ) diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index dd6d1e24fdc4..c1e095f38dd9 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -86,94 +86,94 @@ MapMode* SwSelPaintRects::pMapMode = 0; #ifdef SHOW_BOOKMARKS -#include <bookmrk.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()->getIDocumentBookmarkAccess()->getBookmarks(); - SwShellCrsr* pCrsr = 0; - for( USHORT n = 0; n < rBkmkTbl.Count(); ++n ) - { - const SwBookmark& rBkmk = *rBkmkTbl[ n ]; - if( rBkmk.IsBookMark() && rBkmk.GetOtherPos() ) - { - if( !pCrsr ) - { - pCrsr = new SwShellCrsr( *GetShell(), rBkmk.GetPos() ); - pCrsr->SetMark(); - } - else - *pCrsr->GetPoint() = rBkmk.GetPos(); - *pCrsr->GetMark() = *rBkmk.GetOtherPos(); - 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->getIDocumentBookmarkAccess()->getBookmarks().Count() ) - pBookMarkRects = new SwBookmarkRects( *pSh ); - - if( pBookMarkRects ) - { - switch( nAction ) - { - case 1: pBookMarkRects->Show(); break; - 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 ); +// #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 ) +// { +// const SwBookmark& rBkmk = *rBkmkTbl[ n ]; +// if( rBkmk.IsBookMark() && rBkmk.GetOtherPos() ) +// { +// if( !pCrsr ) +// { +// pCrsr = new SwShellCrsr( *GetShell(), rBkmk.GetPos() ); +// pCrsr->SetMark(); +// } +// else +// *pCrsr->GetPoint() = rBkmk.GetPos(); +// *pCrsr->GetMark() = *rBkmk.GetOtherPos(); +// 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 ) +// { +// case 1: pBookMarkRects->Show(); break; +// 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 ); #else @@ -996,7 +996,7 @@ SwCursor* SwShellCrsr::Create( SwPaM* pRing ) const short SwShellCrsr::MaxReplaceArived() { short nRet = RET_YES; - Window* pDlg = ::GetSearchDialog(); + Window* pDlg = LAYOUT_THIS_WINDOW (::GetSearchDialog()); if( pDlg ) { // alte Actions beenden; die Tabellen-Frames werden angelegt und diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index 0e995f8cbe23..aee5a3cd5550 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -90,7 +90,7 @@ String lcl_dbg_out_SvPtrArr(const T & rArr) return aStr; } -const char * dbg_out(const void * pVoid) +SW_DLLPUBLIC const char * dbg_out(const void * pVoid) { char sBuffer[1024]; @@ -101,7 +101,7 @@ const char * dbg_out(const void * pVoid) return dbg_out(aTmpStr); } -const char * dbg_out(const String & aStr) +SW_DLLPUBLIC const char * dbg_out(const String & aStr) { aDbgOutResult = ByteString(aStr, RTL_TEXTENCODING_ASCII_US); @@ -269,18 +269,18 @@ const String lcl_dbg_out(const SfxPoolItem & rItem) return aStr; } -const char * dbg_out(const SfxPoolItem & rItem) +SW_DLLPUBLIC const char * dbg_out(const SfxPoolItem & rItem) { return dbg_out(lcl_dbg_out(rItem)); } -const char * dbg_out(const SfxPoolItem * pItem) +SW_DLLPUBLIC const char * dbg_out(const SfxPoolItem * pItem) { return dbg_out(pItem ? lcl_dbg_out(*pItem) : String("(nil)", RTL_TEXTENCODING_ASCII_US)); } -const String lcl_dbg_out(const SfxItemSet & rSet) +SW_DLLPUBLIC const String lcl_dbg_out(const SfxItemSet & rSet) { SfxItemIter aIter(rSet); const SfxPoolItem * pItem; @@ -309,7 +309,7 @@ const String lcl_dbg_out(const SfxItemSet & rSet) return aStr; } -const char * dbg_out(const SfxItemSet & rSet) +SW_DLLPUBLIC const char * dbg_out(const SfxItemSet & rSet) { return dbg_out(lcl_dbg_out(rSet)); } @@ -329,7 +329,7 @@ const String lcl_dbg_out(const SwTxtAttr & rAttr) return aStr; } -const char * dbg_out(const SwTxtAttr & rAttr) +SW_DLLPUBLIC const char * dbg_out(const SwTxtAttr & rAttr) { return dbg_out(lcl_dbg_out(rAttr)); } @@ -350,7 +350,7 @@ const String lcl_dbg_out(const SwpHints & rHints) return aStr; } -const char * dbg_out(const SwpHints &rHints) +SW_DLLPUBLIC const char * dbg_out(const SwpHints &rHints) { return dbg_out(lcl_dbg_out(rHints)); } @@ -371,7 +371,7 @@ String lcl_dbg_out(const SwPosition & rPos) return aStr; } -const char * dbg_out(const SwPosition & rPos) +SW_DLLPUBLIC const char * dbg_out(const SwPosition & rPos) { return dbg_out(lcl_dbg_out(rPos)); } @@ -393,7 +393,7 @@ String lcl_dbg_out(const SwPaM & rPam) return aStr; } -const char * dbg_out(const SwPaM & rPam) +SW_DLLPUBLIC const char * dbg_out(const SwPaM & rPam) { return dbg_out(lcl_dbg_out(rPam)); } @@ -403,7 +403,7 @@ String lcl_dbg_out(const SwNodeNum & ) return String();/*rNum.ToString();*/ } -const char * dbg_out(const SwNodeNum & rNum) +SW_DLLPUBLIC const char * dbg_out(const SwNodeNum & rNum) { return dbg_out(lcl_dbg_out(rNum)); } @@ -425,7 +425,7 @@ String lcl_dbg_out(const SwRect & rRect) return aResult; } -const char * dbg_out(const SwRect & rRect) +SW_DLLPUBLIC const char * dbg_out(const SwRect & rRect) { return dbg_out(lcl_dbg_out(rRect)); } @@ -452,7 +452,7 @@ String lcl_dbg_out(const SwFrmFmt & rFrmFmt) return aResult; } -const char * dbg_out(const SwFrmFmt & rFrmFmt) +SW_DLLPUBLIC const char * dbg_out(const SwFrmFmt & rFrmFmt) { return dbg_out(lcl_dbg_out(rFrmFmt)); } @@ -677,12 +677,12 @@ String lcl_dbg_out(const SwNode & rNode) return aTmpStr; } -const char * dbg_out(const SwNode & rNode) +SW_DLLPUBLIC const char * dbg_out(const SwNode & rNode) { return dbg_out(lcl_dbg_out(rNode)); } -const char * dbg_out(const SwNode * pNode) +SW_DLLPUBLIC const char * dbg_out(const SwNode * pNode) { if (NULL != pNode) return dbg_out(*pNode); @@ -690,7 +690,7 @@ const char * dbg_out(const SwNode * pNode) return NULL; } -const char * dbg_out(const SwCntntNode * pNode) +SW_DLLPUBLIC const char * dbg_out(const SwCntntNode * pNode) { if (NULL != pNode) return dbg_out(*pNode); @@ -698,7 +698,7 @@ const char * dbg_out(const SwCntntNode * pNode) return NULL; } -const char * dbg_out(const SwTxtNode * pNode) +SW_DLLPUBLIC const char * dbg_out(const SwTxtNode * pNode) { if (NULL != pNode) return dbg_out(*pNode); @@ -741,7 +741,7 @@ String lcl_dbg_out(SwNodes & rNodes) return aStr; } -const char * dbg_out(SwNodes & rNodes) +SW_DLLPUBLIC const char * dbg_out(SwNodes & rNodes) { return dbg_out(lcl_dbg_out(rNodes)); } @@ -793,7 +793,7 @@ String lcl_dbg_out(const SwUndo & rUndo) return aStr; } -const char * dbg_out(const SwUndo & rUndo) +SW_DLLPUBLIC const char * dbg_out(const SwUndo & rUndo) { return dbg_out(lcl_dbg_out(rUndo)); } @@ -813,7 +813,7 @@ String lcl_dbg_out(SwOutlineNodes & rNodes) return aStr; } -const char * dbg_out(SwOutlineNodes & rNodes) +SW_DLLPUBLIC const char * dbg_out(SwOutlineNodes & rNodes) { return dbg_out(lcl_dbg_out(rNodes)); } @@ -846,7 +846,7 @@ String lcl_dbg_out(const SwUndos & rUndos) return aStr; } -const char * dbg_out(const SwUndos & rUndos) +SW_DLLPUBLIC const char * dbg_out(const SwUndos & rUndos) { return dbg_out(lcl_dbg_out(rUndos)); } @@ -861,7 +861,7 @@ String lcl_dbg_out(const SwRewriter & rRewriter) return aResult; } -const char * dbg_out(const SwRewriter & rRewriter) +SW_DLLPUBLIC const char * dbg_out(const SwRewriter & rRewriter) { return dbg_out(lcl_dbg_out(rRewriter)); } @@ -897,7 +897,7 @@ String lcl_dbg_out(const SwNumRule & rRule) return aResult; } -const char * dbg_out(const SwNumRule & rRule) +SW_DLLPUBLIC const char * dbg_out(const SwNumRule & rRule) { return dbg_out(lcl_dbg_out(rRule)); } @@ -913,7 +913,7 @@ String lcl_dbg_out(const SwTxtFmtColl & rFmt) return aResult; } -const char * dbg_out(const SwTxtFmtColl & rFmt) +SW_DLLPUBLIC const char * dbg_out(const SwTxtFmtColl & rFmt) { return dbg_out(lcl_dbg_out(rFmt)); } @@ -923,7 +923,7 @@ String lcl_dbg_out(const SwFrmFmts & rFrmFmts) return lcl_dbg_out_SvPtrArr<SwFrmFmts>(rFrmFmts); } -const char * dbg_out(const SwFrmFmts & rFrmFmts) +SW_DLLPUBLIC const char * dbg_out(const SwFrmFmts & rFrmFmts) { return dbg_out(lcl_dbg_out(rFrmFmts)); } @@ -949,7 +949,7 @@ String lcl_dbg_out(const SwNumRuleTbl & rTbl) return aResult; } -const char * dbg_out(const SwNumRuleTbl & rTbl) +SW_DLLPUBLIC const char * dbg_out(const SwNumRuleTbl & rTbl) { return dbg_out(lcl_dbg_out(rTbl)); } @@ -994,7 +994,7 @@ String lcl_dbg_out(const SwFormToken & rToken) return rToken.GetString(); } -const char * dbg_out(const SwFormToken & rToken) +SW_DLLPUBLIC const char * dbg_out(const SwFormToken & rToken) { return dbg_out(lcl_dbg_out(rToken)); } @@ -1020,7 +1020,7 @@ String lcl_dbg_out(const SwFormTokens & rTokens) return aStr; } -const char * dbg_out(const SwFormTokens & rTokens) +SW_DLLPUBLIC const char * dbg_out(const SwFormTokens & rTokens) { return dbg_out(lcl_dbg_out(rTokens)); } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 1bb32049c16a..ae48966e31b8 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -81,7 +81,6 @@ #include <ndole.hxx> #include <ndgrf.hxx> #include <rolbck.hxx> // Undo-Attr -#include <bookmrk.hxx> // fuer die Bookmarks #include <doctxm.hxx> // fuer die Verzeichnisse #include <grfatr.hxx> #include <poolfmt.hxx> // PoolVorlagen-Id's diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index fb74d4026bb6..f4c3d3017972 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -33,715 +33,1042 @@ #include "precompiled_sw.hxx" -#include <tools/pstm.hxx> -#include <svx/linkmgr.hxx> +#include <MarkManager.hxx> +#include <bookmrk.hxx> +#include <boost/bind.hpp> +#include <cntfrm.hxx> +#include <crossrefbookmark.hxx> +#include <dcontact.hxx> +#include <doc.hxx> +#include <docary.hxx> +#include <editsh.hxx> +#include <errhdl.hxx> #include <fmtanchr.hxx> #include <frmfmt.hxx> +#include <functional> +#include <hintids.hxx> +#include <mvsave.hxx> +#include <ndtxt.hxx> #include <node.hxx> -#include <doc.hxx> -#include <errhdl.hxx> -#include <cntfrm.hxx> -#include <dcontact.hxx> -#include <bookmrk.hxx> -// --> OD 2007-10-16 #i81002# -#include <crossrefbookmark.hxx> -// <-- -#include <undobj.hxx> -#include <rolbck.hxx> #include <pam.hxx> -#include <mvsave.hxx> -#include <swserv.hxx> #include <redline.hxx> -#include <docary.hxx> -#include <editsh.hxx> +#include <rolbck.hxx> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> +#include <sortedobjs.hxx> +#include <svx/linkmgr.hxx> +#include <swserv.hxx> +#include <swundo.hxx> +#include <tools/pstm.hxx> +#include <undobj.hxx> #include <unocrsr.hxx> #include <viscrs.hxx> -// OD 2004-05-24 #i28701# -#include <sortedobjs.hxx> -#include "swundo.hxx" -#include "hintids.hxx" -// --> OD 2007-10-23 #i81002# -#include <ndtxt.hxx> -// <-- #include <stdio.h> -SV_IMPL_OP_PTRARR_SORT(SwBookmarks, SwBookmarkPtr) -#define PCURCRSR (_pCurrCrsr) -#define FOREACHPAM_START(pSttCrsr) \ - {\ - SwPaM *_pStartCrsr = pSttCrsr, *_pCurrCrsr = pSttCrsr; \ - do { +using namespace ::std; +using namespace ::boost; +using namespace ::sw::mark; -#define FOREACHPAM_END() \ - } while( (_pCurrCrsr=(SwPaM *)_pCurrCrsr->GetNext()) != _pStartCrsr ); \ +namespace +{ + static bool lcl_GreaterThan( const SwPosition& rPos, const SwNodeIndex& rNdIdx, const SwIndex* pIdx ) + { + return pIdx ? ( rPos.nNode > rNdIdx || ( rPos.nNode == rNdIdx && rPos.nContent >= pIdx->GetIndex() )) : rPos.nNode >= rNdIdx; } -#define PCURSH ((SwCrsrShell*)_pStartShell) -#define FOREACHSHELL_START( pEShell ) \ - {\ - ViewShell *_pStartShell = pEShell; \ - do { \ - if( _pStartShell->IsA( TYPE( SwCrsrShell )) ) \ - { -#define FOREACHSHELL_END( pEShell ) \ - } \ - } while((_pStartShell=(ViewShell*)_pStartShell->GetNext())!= pEShell ); \ + static bool lcl_Lower( const SwPosition& rPos, const SwNodeIndex& rNdIdx, const SwIndex* pIdx ) + { + return rPos.nNode < rNdIdx || ( pIdx && rPos.nNode == rNdIdx && rPos.nContent < pIdx->GetIndex() ); } + static bool lcl_MarkOrderingByStart(const IDocumentMarkAccess::pMark_t& rpFirst, + const IDocumentMarkAccess::pMark_t& rpSecond) + { + return rpFirst->GetMarkStart() < rpSecond->GetMarkStart(); + } -/** IDocumentBookmarkAccess ssc -*/ -const SwBookmarks& SwDoc::getBookmarks() const -{ - return *pBookmarkTbl; -} + static bool lcl_MarkOrderingByEnd(const IDocumentMarkAccess::pMark_t& rpFirst, + const IDocumentMarkAccess::pMark_t& rpSecond) + { + return rpFirst->GetMarkEnd() < rpSecond->GetMarkEnd(); + } -SwBookmark* SwDoc::makeBookmark( /*[in]*/const SwPaM& rPaM, /*[in]*/const KeyCode& rCode, - /*[in]*/ const String& rName, /*[in]*/const String& rShortName, - /*[in]*/IDocumentBookmarkAccess::BookmarkType eMark ) -{ - SwBookmark *pBM( 0 ); - if (FORM_FIELDMARK_TEXT == eMark || FORM_FIELDMARK_NO_TEXT == eMark /* rName.CompareToAscii(FIELD_BOOKMARK_PREFIX, strlen(FIELD_BOOKMARK_PREFIX))==0 */) + static void lcl_InsertMarkSorted(IDocumentMarkAccess::container_t& io_vMarks, + const IDocumentMarkAccess::pMark_t& pMark) { - pBM = new SwFieldBookmark(*rPaM.GetPoint(), rCode, rName, rShortName, eMark); - if( rPaM.HasMark() ) - pBM->SetOtherBookmarkPos( rPaM.GetMark() ); - else - pBM->SetOtherBookmarkPos( &pBM->GetBookmarkPos() ); + io_vMarks.insert( + lower_bound( + io_vMarks.begin(), + io_vMarks.end(), + pMark, + &lcl_MarkOrderingByStart), + pMark); + } + + static inline auto_ptr<SwPosition> lcl_PositionFromCntntNode(SwCntntNode * const pCntntNode, const bool bAtEnd=false) + { + auto_ptr<SwPosition> pResult(new SwPosition(*pCntntNode)); + pResult->nContent.Assign(pCntntNode, bAtEnd ? pCntntNode->Len() : 0); + return pResult; + } - // TODO: lcl_FixPosition( *pBM->pPos1 ); - // TODO: lcl_FixPosition( *pBM->pPos2 ); - if( *pBM->GetOtherBookmarkPos() < pBM->GetBookmarkPos() ) + // return a position at the begin of rEnd, if it is a CntntNode + // else set it to the begin of the Node after rEnd, if there is one + // else set it to the end of the node before rStt + // else set it to the CntntNode of the Pos outside the Range + static inline auto_ptr<SwPosition> lcl_FindExpelPosition(const SwNodeIndex& rStt, + const SwNodeIndex& rEnd, + const SwPosition& rOtherPosition) + { + SwCntntNode * pNode = rEnd.GetNode().GetCntntNode(); + SwNodeIndex aStt = SwNodeIndex(rStt); + SwNodeIndex aEnd = SwNodeIndex(rEnd); + bool bAtEnd = false; + if(!pNode) + pNode = rEnd.GetNodes().GoNext(&aEnd), bAtEnd = false; + if(!pNode) + pNode = rStt.GetNodes().GoPrevious(&aStt), bAtEnd = true; + if(pNode) + return lcl_PositionFromCntntNode(pNode, bAtEnd); + return auto_ptr<SwPosition>(new SwPosition(rOtherPosition)); + }; + + static IMark* lcl_getMarkAfter(const IDocumentMarkAccess::container_t& rMarks, const SwPosition& rPos) + { + IDocumentMarkAccess::const_iterator_t pMarkAfter = upper_bound( + rMarks.begin(), + rMarks.end(), + rPos, + bind(&IMark::StartsAfter, _2, _1)); // finds the first that is starting after + if(pMarkAfter == rMarks.end()) return NULL; + return pMarkAfter->get(); + }; + + static IMark* lcl_getMarkBefore(const IDocumentMarkAccess::container_t& rMarks, const SwPosition& rPos) + { + // candidates from which to choose the mark before + IDocumentMarkAccess::container_t vCandidates; + // no need to consider marks starting after rPos + IDocumentMarkAccess::const_iterator_t pCandidatesEnd = upper_bound( + rMarks.begin(), + rMarks.end(), + rPos, + bind(&IMark::StartsAfter, _2, _1)); + vCandidates.reserve(pCandidatesEnd - rMarks.begin()); + // only marks ending before are candidates + remove_copy_if( + rMarks.begin(), + pCandidatesEnd, + back_inserter(vCandidates), + bind(logical_not<bool>(), bind(&IMark::EndsBefore, _1, rPos))); + // no candidate left => we are in front of the first mark or there are none + if(!vCandidates.size()) return NULL; + // return the highest (last) candidate using mark end ordering + return max_element(vCandidates.begin(), vCandidates.end(), &lcl_MarkOrderingByEnd)->get(); + } + + static bool lcl_FixCorrectedMark(bool bChangedPos, bool bChangedOPos, MarkBase* io_pMark) + { + if( (bChangedPos || bChangedOPos) && io_pMark->IsExpanded() && + io_pMark->GetOtherMarkPos().nNode.GetNode().FindTableBoxStartNode() != + io_pMark->GetMarkPos().nNode.GetNode().FindTableBoxStartNode() ) { - SwPosition _pos( pBM->GetBookmarkPos() ); - pBM->SetBookmarkPos( pBM->GetOtherBookmarkPos() ); - pBM->SetOtherBookmarkPos( &_pos ); + if(!bChangedOPos) + io_pMark->SetMarkPos(io_pMark->GetOtherMarkPos()); + io_pMark->ClearOtherMarkPos(); + DdeBookmark * const pDdeBkmk = dynamic_cast< DdeBookmark*>(io_pMark); + if(pDdeBkmk && pDdeBkmk->IsServer()) + pDdeBkmk->SetRefObject(NULL); + return true; } - //ASSERT(*pBM->pPos1<=*pBM->pPos2, ""); + return false; } - else if( MARK == eMark ) + + static IDocumentMarkAccess::iterator_t lcl_FindMark( + IDocumentMarkAccess::container_t& rMarks, + const IDocumentMarkAccess::pMark_t& rpMarkToFind) { - pBM = new SwMark( *rPaM.GetPoint(), rCode, rName, rShortName ); + IDocumentMarkAccess::iterator_t ppCurrentMark = lower_bound( + rMarks.begin(), rMarks.end(), + rpMarkToFind, &lcl_MarkOrderingByStart); + // since there are usually not too many marks on the same start + // position, we are not doing a bisect search for the upper bound + // but instead start to iterate from pMarkLow directly + while(ppCurrentMark != rMarks.end() && **ppCurrentMark == *rpMarkToFind) + { + if(ppCurrentMark->get() == rpMarkToFind.get()) + { + //OSL_TRACE("found mark named '%s'", + // ::rtl::OUStringToOString(ppCurrentMark->get()->GetName(), RTL_TEXTENCODING_UTF8).getStr()); + return ppCurrentMark; + } + ++ppCurrentMark; + } + // reached a mark starting on a later start pos or the end of the + // vector => not found + return rMarks.end(); + }; + + static IDocumentMarkAccess::iterator_t lcl_FindMarkAtPos( + IDocumentMarkAccess::container_t& rMarks, + const SwPosition& rPos, + const IDocumentMarkAccess::MarkType eType) + { + for(IDocumentMarkAccess::iterator_t ppCurrentMark = lower_bound( + rMarks.begin(), rMarks.end(), + rPos, + bind(&IMark::StartsBefore, _1, _2)); + ppCurrentMark != rMarks.end(); + ++ppCurrentMark) + { + // Once we reach a mark starting after the target pos + // we do not need to continue + if(ppCurrentMark->get()->StartsAfter(rPos)) + break; + if(IDocumentMarkAccess::GetType(**ppCurrentMark) == eType) + { + //OSL_TRACE("found mark named '%s'", + // ::rtl::OUStringToOString(ppCurrentMark->get()->GetName(), RTL_TEXTENCODING_UTF8).getStr()); + return ppCurrentMark; + } + } + // reached a mark starting on a later start pos or the end of the + // vector => not found + return rMarks.end(); + }; + + static IDocumentMarkAccess::const_iterator_t lcl_FindMarkByName( + const ::rtl::OUString& rName, + IDocumentMarkAccess::const_iterator_t ppMarksBegin, + IDocumentMarkAccess::const_iterator_t ppMarksEnd) + { + return find_if( + ppMarksBegin, + ppMarksEnd, + bind(&::rtl::OUString::equals, bind(&IMark::GetName, _1), rName)); } -// // --> OD 2007-10-16 #TESTING# -// else if ( BOOKMARK == eMark ) -// { -// if ( ( !rPaM.HasMark() && -// rPaM.GetPoint()->nNode.GetNode().GetTxtNode() && -// rPaM.GetPoint()->nContent.GetIndex() == 0 ) || -// ( rPaM.HasMark() && -// rPaM.GetMark()->nNode == rPaM.GetPoint()->nNode && -// rPaM.GetPoint()->nNode.GetNode().GetTxtNode() && -// rPaM.Start()->nContent.GetIndex() == 0 && -// rPaM.End()->nContent.GetIndex() == -// rPaM.GetPoint()->nNode.GetNode().GetTxtNode()->Len() ) ) -// { -// pBM = new SwCrossRefBookmark( *(rPaM.Start()), rCode, rName, rShortName); -// } -// else -// { -// ASSERT( false, -// "<SwDoc::makeBookmark(..)> - creation of cross-reference bookmark with invalid PaM" ); -// } -// } -// // <-- - else if( BOOKMARK == eMark || DDE_BOOKMARK == eMark) + +#if FALSE + static void lcl_DebugMarks(IDocumentMarkAccess::container_t vMarks) { - // --> OD 2007-09-26 #i81002# - pBM = new SwBookmark( rPaM, rCode, rName, rShortName); - if ( eMark == DDE_BOOKMARK ) + OSL_TRACE("%d Marks", vMarks.size()); + for(IDocumentMarkAccess::iterator_t ppMark = vMarks.begin(); + ppMark != vMarks.end(); + ppMark++) { - pBM->SetType( eMark ); + IMark* pMark = ppMark->get(); + ::rtl::OString sName = ::rtl::OUStringToOString(pMark->GetName(), RTL_TEXTENCODING_UTF8); + const SwPosition* const pStPos = &pMark->GetMarkStart(); + const SwPosition* const pEndPos = &pMark->GetMarkEnd(); + OSL_TRACE("%s %s %d,%d %d,%d", + typeid(*pMark).name(), + sName.getStr(), + pStPos->nNode.GetIndex(), + pStPos->nContent.GetIndex(), + pEndPos->nNode.GetIndex(), + pEndPos->nContent.GetIndex()); } - // <-- + }; +#endif +} + +IDocumentMarkAccess::MarkType IDocumentMarkAccess::GetType(const IMark& rBkmk) +{ + const std::type_info* const pMarkTypeInfo = &typeid(rBkmk); + // not using dynamic_cast<> here for performance + if(*pMarkTypeInfo == typeid(UnoMark)) + return UNO_BOOKMARK; + else if(*pMarkTypeInfo == typeid(DdeBookmark)) + return DDE_BOOKMARK; + else if(*pMarkTypeInfo == typeid(Bookmark)) + return BOOKMARK; + else if(*pMarkTypeInfo == typeid(CrossRefHeadingBookmark)) + return CROSSREF_HEADING_BOOKMARK; + else if(*pMarkTypeInfo == typeid(CrossRefNumItemBookmark)) + return CROSSREF_NUMITEM_BOOKMARK; + else if(*pMarkTypeInfo == typeid(TextFieldmark)) + return TEXT_FIELDMARK; + else if(*pMarkTypeInfo == typeid(CheckboxFieldmark)) + return CHECKBOX_FIELDMARK; + else if(*pMarkTypeInfo == typeid(NavigatorReminder)) + return NAVIGATOR_REMINDER; + else + { + OSL_ENSURE(false, + "IDocumentMarkAccess::GetType(..)" + " - unknown MarkType. This needs to be fixed!"); + return UNO_BOOKMARK; } - // --> OD 2007-10-17 #i81002# - else if ( eMark == CROSSREF_BOOKMARK ) +} + +namespace sw { namespace mark +{ + MarkManager::MarkManager(SwDoc& rDoc) + : m_pDoc(&rDoc) + { } + + ::sw::mark::IMark* MarkManager::makeMark(const SwPaM& rPaM, + const ::rtl::OUString& rName, + const IDocumentMarkAccess::MarkType eType) { - if ( ( !rPaM.HasMark() && - rPaM.GetPoint()->nNode.GetNode().GetTxtNode() && - rPaM.GetPoint()->nContent.GetIndex() == 0 ) || - ( rPaM.HasMark() && - rPaM.GetMark()->nNode == rPaM.GetPoint()->nNode && - rPaM.GetPoint()->nNode.GetNode().GetTxtNode() && - rPaM.Start()->nContent.GetIndex() == 0 && - rPaM.End()->nContent.GetIndex() == - rPaM.GetPoint()->nNode.GetNode().GetTxtNode()->Len() ) ) +#if FALSE { - pBM = new SwCrossRefBookmark( *(rPaM.Start()), rCode, rName, rShortName); + ::rtl::OString sName = ::rtl::OUStringToOString(rName, RTL_TEXTENCODING_UTF8); + const SwPosition* const pPos1 = rPaM.GetPoint(); + const SwPosition* pPos2 = pPos1; + if(rPaM.HasMark()) + pPos2 = rPaM.GetMark(); + OSL_TRACE("%s %d,%d %d,%d", + sName.getStr(), + pPos1->nNode.GetIndex(), + pPos1->nContent.GetIndex(), + pPos2->nNode.GetIndex(), + pPos2->nContent.GetIndex()); } +#endif + // see for example _SaveCntntIdx, Shells + OSL_PRECOND(m_vMarks.size() < USHRT_MAX, + "MarkManager::makeMark(..)" + " - more than USHRT_MAX marks are not supported correctly"); + // There should only be one CrossRefBookmark per Textnode per Type + OSL_PRECOND( + (eType != CROSSREF_NUMITEM_BOOKMARK && eType != CROSSREF_HEADING_BOOKMARK) + || (lcl_FindMarkAtPos(m_vBookmarks, *rPaM.GetPoint(), eType) == m_vBookmarks.end()), + "MarkManager::makeMark(..)" + " - creating duplicate CrossRefBookmark"); + + // create mark + pMark_t pMark; + switch(eType) + { + case IDocumentMarkAccess::TEXT_FIELDMARK: + pMark = shared_ptr<IMark>(new TextFieldmark(rPaM)); + break; + case IDocumentMarkAccess::CHECKBOX_FIELDMARK: + pMark = shared_ptr<IMark>(new CheckboxFieldmark(rPaM)); + break; + case IDocumentMarkAccess::NAVIGATOR_REMINDER: + pMark = shared_ptr<IMark>(new NavigatorReminder(rPaM)); + break; + case IDocumentMarkAccess::BOOKMARK: + pMark = shared_ptr<IMark>(new Bookmark(rPaM, KeyCode(), rName, ::rtl::OUString())); + break; + case IDocumentMarkAccess::DDE_BOOKMARK: + pMark = shared_ptr<IMark>(new DdeBookmark(rPaM)); + break; + case IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK: + pMark = shared_ptr<IMark>(new CrossRefHeadingBookmark(rPaM, KeyCode(), rName, ::rtl::OUString())); + break; + case IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK: + pMark = shared_ptr<IMark>(new CrossRefNumItemBookmark(rPaM, KeyCode(), rName, ::rtl::OUString())); + break; + case IDocumentMarkAccess::UNO_BOOKMARK: + pMark = shared_ptr<IMark>(new UnoMark(rPaM)); + break; + } + OSL_ENSURE(pMark.get(), + "MarkManager::makeMark(..)" + " - Mark was not created."); + MarkBase* pMarkBase = dynamic_cast<MarkBase*>(pMark.get()); + + if(pMark->GetMarkPos() != pMark->GetMarkStart()) + pMarkBase->Swap(); + + // for performance reasons, we trust UnoMarks to have a (generated) unique name + if(eType != IDocumentMarkAccess::UNO_BOOKMARK) + pMarkBase->SetName(getUniqueMarkName(pMarkBase->GetName())); + + // register mark + lcl_InsertMarkSorted(m_vMarks, pMark); + switch(eType) + { + case IDocumentMarkAccess::BOOKMARK: + case IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK: + case IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK: + // if(dynamic_cast<IBookmark*>) + lcl_InsertMarkSorted(m_vBookmarks, pMark); + break; + case IDocumentMarkAccess::TEXT_FIELDMARK: + case IDocumentMarkAccess::CHECKBOX_FIELDMARK: + // if(dynamic_cast<IFieldmark*> + lcl_InsertMarkSorted(m_vFieldmarks, pMark); + break; + case IDocumentMarkAccess::NAVIGATOR_REMINDER: + case IDocumentMarkAccess::DDE_BOOKMARK: + case IDocumentMarkAccess::UNO_BOOKMARK: + // no special array for these + break; + } + pMarkBase->InitDoc(m_pDoc); +#if FALSE + OSL_TRACE("--- makeType ---"); + OSL_TRACE("Marks"); + lcl_DebugMarks(m_vMarks); + OSL_TRACE("Bookmarks"); + lcl_DebugMarks(m_vBookmarks); + OSL_TRACE("Fieldmarks"); + lcl_DebugMarks(m_vFieldmarks); +#endif + return pMark.get(); + } + + ::sw::mark::IMark* MarkManager::getMarkForTxtNode(const SwTxtNode& rTxtNode, + const IDocumentMarkAccess::MarkType eType) + { + SwPosition aPos(rTxtNode); + aPos.nContent.Assign(&(const_cast<SwTxtNode&>(rTxtNode)), 0); + const iterator_t ppExistingMark = lcl_FindMarkAtPos(m_vBookmarks, aPos, eType); + if(ppExistingMark != m_vBookmarks.end()) + return ppExistingMark->get(); + const SwPaM aPaM(aPos); + return makeMark(aPaM, ::rtl::OUString(), eType); + } + + void MarkManager::repositionMark( ::sw::mark::IMark* const io_pMark, + const SwPaM& rPaM) + { + OSL_PRECOND(io_pMark->GetMarkPos().GetDoc() == m_pDoc, + "<MarkManager::repositionMark(..)>" + " - Mark is not in my doc."); + MarkBase* const pMarkBase = dynamic_cast< MarkBase* >(io_pMark); + pMarkBase->SetMarkPos(*(rPaM.GetPoint())); + if(rPaM.HasMark()) + pMarkBase->SetOtherMarkPos(*(rPaM.GetMark())); else + pMarkBase->ClearOtherMarkPos(); + + if(pMarkBase->GetMarkPos() != pMarkBase->GetMarkStart()) + pMarkBase->Swap(); + + sortMarks(); + } + + bool MarkManager::renameMark(::sw::mark::IMark* io_pMark, const ::rtl::OUString& rNewName) + { + OSL_PRECOND(io_pMark->GetMarkPos().GetDoc() == m_pDoc, + "<MarkManager::repositionMark(..)>" + " - Mark is not in my doc."); + if(io_pMark->GetName() == rNewName) + return true; + if(findMark(rNewName) != getMarksEnd()) + return false; + dynamic_cast< ::sw::mark::MarkBase* >(io_pMark)->SetName(rNewName); + return true; + } + + void MarkManager::correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset) + { + const SwNode* const pOldNode = &rOldNode.GetNode(); + SwPosition aNewPos(rNewPos); + aNewPos.nContent += nOffset; + bool isSortingNeeded = false; + for(iterator_t ppMark = m_vMarks.begin(); + ppMark != m_vMarks.end(); + ppMark++) { - ASSERT( false, - "<SwDoc::makeBookmark(..)> - creation of cross-reference bookmark with invalid PaM" ); + // is on position ?? + bool bChangedPos = false, bChangedOPos = false; + ::sw::mark::MarkBase* pMark = dynamic_cast< ::sw::mark::MarkBase* >(ppMark->get()); + if(&pMark->GetMarkPos().nNode.GetNode() == pOldNode) + { + pMark->SetMarkPos(aNewPos); + bChangedPos = true; + } + if (pMark->IsExpanded() && + &pMark->GetOtherMarkPos().nNode.GetNode() == pOldNode) + { + pMark->SetMarkPos(aNewPos); + bChangedOPos= true; + } + // illegal selection? collapse the mark and restore sorting later + isSortingNeeded |= lcl_FixCorrectedMark(bChangedPos, bChangedOPos, pMark); } + // restore sorting if needed + if(isSortingNeeded) + sortMarks(); +#if FALSE + OSL_TRACE("correctMarksAbsolute"); + lcl_DebugMarks(m_vMarks); +#endif } - else + + void MarkManager::correctMarksRelative(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset) { - // --> OD 2007-09-26 #i81002# - pBM = new SwUNOMark( rPaM, rCode, rName, rShortName); - // <-- + const SwNode* const pOldNode = &rOldNode.GetNode(); + SwPosition aNewPos(rNewPos); + aNewPos.nContent += nOffset; + bool isSortingNeeded = false; + for(iterator_t ppMark = m_vMarks.begin(); + ppMark != m_vMarks.end(); + ppMark++) + { + // is on position ?? + bool bChangedPos = false, bChangedOPos = false; + ::sw::mark::MarkBase* const pMark = dynamic_cast< ::sw::mark::MarkBase* >(ppMark->get()); + if(&pMark->GetMarkPos().nNode.GetNode() == pOldNode) + { + SwPosition aNewPosRel(aNewPos); + aNewPosRel.nContent += pMark->GetMarkPos().nContent.GetIndex(); + pMark->SetMarkPos(aNewPosRel); + bChangedPos = true; + } + if(pMark->IsExpanded() && + &pMark->GetOtherMarkPos().nNode.GetNode() == pOldNode) + { + SwPosition aNewPosRel(aNewPos); + aNewPosRel.nContent += pMark->GetOtherMarkPos().nContent.GetIndex(); + pMark->SetOtherMarkPos(aNewPosRel); + bChangedOPos = true; + } + // illegal selection? collapse the mark and restore sorting later + isSortingNeeded |= lcl_FixCorrectedMark(bChangedPos, bChangedOPos, pMark); + } + // restore sorting if needed + if(isSortingNeeded) + sortMarks(); +#if FALSE + OSL_TRACE("correctMarksRelative"); + lcl_DebugMarks(m_vMarks); +#endif } - // --> OD 2007-10-18 #i81002# - if ( pBM ) + void MarkManager::deleteMarks( + const SwNodeIndex& rStt, + const SwNodeIndex& rEnd, + ::std::vector<SaveBookmark>* pSaveBkmk, + const SwIndex* pSttIdx, + const SwIndex* pEndIdx) { - if (FORM_FIELDMARK_TEXT == eMark || FORM_FIELDMARK_NO_TEXT == eMark /* pBM->GetName().CompareToAscii(FIELD_BOOKMARK_PREFIX, strlen(FIELD_BOOKMARK_PREFIX))==0 */) + vector<const_iterator_t> vMarksToDelete; + bool isSortingNeeded = false; + // copy all bookmarks in the move area to a vector storing all position data as offset + // reassignment is performed after the move + for(iterator_t ppMark = m_vMarks.begin(); + ppMark != m_vMarks.end(); + ppMark++) { - StartUndo(UNDO_UI_REPLACE, NULL); - //ASSERT(*PBM->pPos1<=*pBM->pPos2, "Bookmark positions not normalized!!!!"); - const SwTxtNode* pStartTxtNode=this->GetNodes()[pBM->GetBookmarkPos().nNode]->GetTxtNode(); - const SwTxtNode* pEndTxtNode=this->GetNodes()[pBM->GetOtherBookmarkPos()->nNode]->GetTxtNode(); - sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(pBM->GetBookmarkPos().nContent.GetIndex()); - sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar(pBM->GetOtherBookmarkPos()->nContent.GetIndex()-1); - bool form=(IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT==eMark); /*(pBM->GetName().CompareToAscii(FIELD_FORM_BOOKMARK_PREFIX, strlen(FIELD_FORM_BOOKMARK_PREFIX))==0);*/ - if (form) + // navigator marks should not be moved + // TODO: Check if this might make them invalid + if(IDocumentMarkAccess::GetType(**ppMark) == NAVIGATOR_REMINDER) + continue; + + ::sw::mark::MarkBase* pMark = dynamic_cast< ::sw::mark::MarkBase* >(ppMark->get()); + // on position ?? + bool isPosInRange = (lcl_GreaterThan(pMark->GetMarkPos(), rStt, pSttIdx) && + lcl_Lower(pMark->GetMarkPos(), rEnd, pEndIdx)); + bool isOtherPosInRange = (pMark->IsExpanded() && + lcl_GreaterThan(pMark->GetOtherMarkPos(), rStt, pSttIdx) && + lcl_Lower(pMark->GetOtherMarkPos(), rEnd, pEndIdx)); + // special case: completely in range, touching the end? + if(pEndIdx && + ((isOtherPosInRange + && pMark->GetMarkPos().nNode == rEnd + && pMark->GetMarkPos().nContent == *pEndIdx) + || (isPosInRange + && pMark->IsExpanded() + && pMark->GetOtherMarkPos().nNode == rEnd + && pMark->GetOtherMarkPos().nContent == *pEndIdx))) { - if (ch_start!=CH_TXT_ATR_FORMELEMENT) - { - const SwPaM rRg(pBM->GetBookmarkPos()); - Insert(rRg, CH_TXT_ATR_FORMELEMENT); - SwPosition aTmp( pBM->GetBookmarkPos() ); - aTmp.nContent--; - pBM->SetBookmarkPos( &aTmp ); - } + isPosInRange = true, isOtherPosInRange = true; } - else + + if(isPosInRange && isOtherPosInRange) { - if (ch_start!=CH_TXT_ATR_FIELDSTART) - { - const SwPaM rRg(pBM->GetBookmarkPos()); - Insert(rRg, CH_TXT_ATR_FIELDSTART); - SwPosition aTmp( pBM->GetBookmarkPos() ); - aTmp.nContent--; - pBM->SetBookmarkPos( &aTmp ); - } - if (ch_end!=CH_TXT_ATR_FIELDEND) - { - const SwPaM rRg(*pBM->GetOtherBookmarkPos()); - Insert(rRg, CH_TXT_ATR_FIELDEND); - } + // completely in range + if(pSaveBkmk) + pSaveBkmk->push_back(SaveBookmark(true, true, *pMark, rStt, pSttIdx)); + vMarksToDelete.push_back(ppMark); + } + else if(isPosInRange ^ isOtherPosInRange) + { + // the bookmark is partitially in the range + // move position of that is in the range out of it + auto_ptr<SwPosition> pNewPos; + if(pEndIdx) + pNewPos = auto_ptr<SwPosition>(new SwPosition( + rEnd, + *pEndIdx)); + else + pNewPos = lcl_FindExpelPosition( + rStt, + rEnd, + isPosInRange ? pMark->GetOtherMarkPos() : pMark->GetMarkPos()); + + if(isPosInRange) + pMark->SetMarkPos(*pNewPos); + else + pMark->SetOtherMarkPos(*pNewPos); + + // illegal selection? collapse the mark and restore sorting later + isSortingNeeded |= lcl_FixCorrectedMark(isPosInRange, isOtherPosInRange, pMark); } } - if ( !pBookmarkTbl->Insert( pBM ) ) - delete pBM, pBM = 0; - else + + // we just remembered the iterators to delete, so we do not need to search + // for the shared_ptr<> (the entry in m_vMarks) again + // reverse iteration, since erasing an entry invalidates iterators + // behind it (the iterators in vMarksToDelete are sorted) + for(vector<const_iterator_t>::reverse_iterator pppMark = vMarksToDelete.rbegin(); + pppMark != vMarksToDelete.rend(); + pppMark++) + deleteMark(*pppMark); + if(isSortingNeeded) + sortMarks(); +#if FALSE + OSL_TRACE("deleteMarks"); + lcl_DebugMarks(m_vMarks); +#endif + } + + void MarkManager::deleteMark(const const_iterator_t ppMark) + { + if(ppMark == m_vMarks.end()) return; + + switch(IDocumentMarkAccess::GetType(**ppMark)) { - if( BOOKMARK == eMark && DoesUndo() ) + case IDocumentMarkAccess::BOOKMARK: + case IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK: + case IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK: + // if(dynamic_cast<IBookmark*>) { - ClearRedo(); - AppendUndo( new SwUndoInsBookmark( *pBM )); + IDocumentMarkAccess::iterator_t ppBookmark = lcl_FindMark(m_vBookmarks, *ppMark); + OSL_ENSURE(ppBookmark != m_vBookmarks.end(), + "<MarkManager::deleteMark(..)>" + " - Bookmark not found."); + m_vBookmarks.erase(ppBookmark); + break; } - switch( eMark ) + case IDocumentMarkAccess::TEXT_FIELDMARK: + case IDocumentMarkAccess::CHECKBOX_FIELDMARK: + // if(dynamic_cast<IFieldmark*> { - case UNO_BOOKMARK: - case DDE_BOOKMARK: + IDocumentMarkAccess::iterator_t ppFieldmark = lcl_FindMark(m_vFieldmarks, *ppMark); + OSL_ENSURE(ppFieldmark != m_vFieldmarks.end(), + "<MarkManager::deleteMark(..)>" + " - Bookmark not found."); + m_vFieldmarks.erase(ppFieldmark); break; - default: - SetModified(); } + case IDocumentMarkAccess::NAVIGATOR_REMINDER: + case IDocumentMarkAccess::DDE_BOOKMARK: + case IDocumentMarkAccess::UNO_BOOKMARK: + // no special array for these + break; } - if (FORM_FIELDMARK_TEXT == eMark || FORM_FIELDMARK_NO_TEXT == eMark /*pBM->GetName().CompareToAscii(FIELD_BOOKMARK_PREFIX, strlen(FIELD_BOOKMARK_PREFIX))==0*/) - EndUndo(UNDO_UI_REPLACE, NULL); + DdeBookmark* const pDdeBookmark = dynamic_cast<DdeBookmark*>(ppMark->get()); + if(pDdeBookmark) + pDdeBookmark->DeregisterFromDoc(m_pDoc); + m_vMarks.erase(m_vMarks.begin() + (ppMark - m_vMarks.begin())); // clumsy const-cast } - return pBM; -} -SwBookmark* SwDoc::getFieldBookmarkFor(const SwPosition &pos) const -{ - //@TODO make impl recursive - int nCount=pBookmarkTbl->Count(); - while(--nCount>=0) + void MarkManager::deleteMark(const IMark* const pMark) { - SwBookmark *pBM=(*pBookmarkTbl)[static_cast<USHORT>(nCount)]; - if (pBM->GetOtherBookmarkPos()!=NULL - && FORM_FIELDMARK_TEXT==pBM->GetType() /* pBM->GetName().CompareToAscii(FIELD_BOOKMARK_PREFIX, strlen(FIELD_BOOKMARK_PREFIX))==0 */ - && pBM->GetBookmarkPos()<pos - && pos < *(pBM->GetOtherBookmarkPos())) - return pBM; + OSL_PRECOND(pMark->GetMarkPos().GetDoc() == m_pDoc, + "<MarkManager::repositionMark(..)>" + " - Mark is not in my doc."); + // finds the last Mark that is starting before pMark + // (pMarkLow < pMark) + iterator_t pMarkLow = lower_bound( + m_vMarks.begin(), m_vMarks.end(), + pMark->GetMarkStart(), + bind(&IMark::StartsBefore, _1, _2)); + // finds the first Mark that pMark is starting before + // (pMark < pMarkHigh) + //iterator_t pMarkHigh = upper_bound( + // pMarkLow, m_vMarks.end(), + // pMark->GetMarkStart(), + // bind(&IMark::StartsBefore, _2, _1)); + // since it should be rare that pMark isnt found at all + // we skip the bisect search on the upper bound + iterator_t pMarkHigh = m_vMarks.end(); + iterator_t pMarkFound = find_if( + pMarkLow, pMarkHigh, + bind(equal_to<const IMark*>(), bind(&shared_ptr<IMark>::get, _1), pMark)); + if(pMarkFound != pMarkHigh) + deleteMark(pMarkFound); } - return NULL; -} -SwFieldBookmark* SwDoc::getFormFieldBookmarkFor(const SwPosition &pos) const -{ - //@TODO make impl recursive - int nCount=pBookmarkTbl->Count(); - while(--nCount>=0) + void MarkManager::clearAllMarks() { - SwBookmark *pBM=(*pBookmarkTbl)[static_cast<USHORT>(nCount)]; - if (pBM->GetOtherBookmarkPos()!=NULL - && FORM_FIELDMARK_NO_TEXT==pBM->GetType() /* pBM->GetName().CompareToAscii(FIELD_FORM_BOOKMARK_PREFIX, strlen(FIELD_FORM_BOOKMARK_PREFIX))==0 */ - && pBM->GetBookmarkPos()<=pos - && pos <= *(pBM->GetOtherBookmarkPos())) - return (SwFieldBookmark*)pBM; + m_vFieldmarks.clear(); + m_vBookmarks.clear(); +#ifdef DEBUG + for(iterator_t pBkmk = m_vMarks.begin(); + pBkmk != m_vMarks.end(); + ++pBkmk) + OSL_ENSURE(pBkmk->unique(), + "<MarkManager::clearAllMarks(..)>" + " - a Bookmark is still in use."); +#endif + m_vMarks.clear(); } - return NULL; -} -SwBookmark* SwDoc::getNextFieldBookmarkFor(const SwPosition &pos) const -{ - USHORT i=0; - USHORT nCount=pBookmarkTbl->Count(); - SwBookmark *pBM=NULL; - while(i<nCount - && ((pBM=(*pBookmarkTbl)[i])==NULL - || !pBM->IsFormFieldMark() /* pBM->GetName().CompareToAscii(FIELD_BOOKMARK_PREFIX, strlen(FIELD_BOOKMARK_PREFIX))!=0 */ - || pos >= pBM->GetBookmarkPos() )) - i++; - - if (i<nCount) - return pBM; - else + IDocumentMarkAccess::const_iterator_t MarkManager::findMark(const ::rtl::OUString& rName) const { - i=0; - while(i<nCount - && ((pBM=(*pBookmarkTbl)[i])==NULL || !pBM->IsFormFieldMark() /*pBM->GetName().CompareToAscii(FIELD_BOOKMARK_PREFIX, strlen(FIELD_BOOKMARK_PREFIX))!=0*/ )) - i++; - return (i<nCount?pBM:NULL); + return lcl_FindMarkByName(rName, m_vMarks.begin(), m_vMarks.end()); } -} -SwBookmark* SwDoc::getPrevFieldBookmarkFor(const SwPosition &pos) const -{ - int nCount=pBookmarkTbl->Count(); - int i=nCount-1; - SwBookmark *pBM=NULL; - while(i>=0 - && ((pBM=(*pBookmarkTbl)[static_cast<USHORT>(i)])==NULL - || !pBM->IsFormFieldMark() /*pBM->GetName().CompareToAscii(FIELD_BOOKMARK_PREFIX, strlen(FIELD_BOOKMARK_PREFIX))!=0*/ - || pBM->GetOtherBookmarkPos()==NULL - || pos <= *pBM->GetOtherBookmarkPos())) - i--; - - if (i>=0) - return pBM; - else + IDocumentMarkAccess::const_iterator_t MarkManager::findBookmark(const ::rtl::OUString& rName) const { - i=nCount-1; - while(i>=0 - && ((pBM=(*pBookmarkTbl)[static_cast<USHORT>(i)])==NULL || !pBM->IsFormFieldMark() /*pBM->GetName().CompareToAscii(FIELD_BOOKMARK_PREFIX, strlen(FIELD_BOOKMARK_PREFIX))!=0*/ )) - i--; - return (i>=0?pBM:NULL); + return lcl_FindMarkByName(rName, m_vBookmarks.begin(), m_vBookmarks.end()); } -} -/* -bool SwDoc::isValidSelectionWrtFieldBookmarks(const SwPosition &posA, const SwPostion &posB) { -//@TODO optimize this - SwBookmark *pA=getFieldBookmarkFor(posA); - SwBookmark *pB=getFieldBookmarkFor(posB); - return pA==pB; -} -*/ + IDocumentMarkAccess::const_iterator_t MarkManager::getMarksBegin() const + { return m_vMarks.begin(); } -// TODO not finished yet, still neet to add this check -bool _checkFieldBookmarkSanity(const SwDoc *pDoc) -{ - int nCount=pDoc->getBookmarks().Count(); - while(--nCount>=0) + IDocumentMarkAccess::const_iterator_t MarkManager::getMarksEnd() const + { return m_vMarks.end(); } + + sal_Int32 MarkManager::getMarksCount() const + { return m_vMarks.size(); } + + IDocumentMarkAccess::const_iterator_t MarkManager::getBookmarksBegin() const + { return m_vBookmarks.begin(); } + + IDocumentMarkAccess::const_iterator_t MarkManager::getBookmarksEnd() const + { return m_vBookmarks.end(); } + + sal_Int32 MarkManager::getBookmarksCount() const + { return m_vBookmarks.size(); } + + IFieldmark* MarkManager::getFieldmarkFor(const SwPosition& rPos) const { - SwBookmark *pBM=pDoc->getBookmarks()[static_cast<USHORT>(nCount)]; - if (pBM->IsFormFieldMark() /* pBM->GetName().CompareToAscii(FIELD_BOOKMARK_PREFIX, strlen(FIELD_BOOKMARK_PREFIX))==0 */) + const_iterator_t pFieldmark = find_if( + m_vFieldmarks.begin(), + // we do not need to check marks starting behind the positon + lower_bound( + m_vFieldmarks.begin(), + m_vFieldmarks.end(), + rPos, + bind(&IMark::StartsAfter, _1, _2)), + bind(&IMark::IsCoveringPosition, _1, rPos)); + if(pFieldmark == m_vFieldmarks.end()) return NULL; + return dynamic_cast<IFieldmark*>(pFieldmark->get()); + } + + IFieldmark* MarkManager::getFieldmarkAfter(const SwPosition& rPos) const + { return dynamic_cast<IFieldmark*>(lcl_getMarkAfter(m_vFieldmarks, rPos)); } + + IFieldmark* MarkManager::getFieldmarkBefore(const SwPosition& rPos) const + { return dynamic_cast<IFieldmark*>(lcl_getMarkBefore(m_vFieldmarks, rPos)); } + + ::rtl::OUString MarkManager::getUniqueMarkName(const ::rtl::OUString& rName) const + { + OSL_ENSURE(rName.getLength(), + "<MarkManager::getUniqueMarkName(..)>" + " - a name should be proposed"); + if(findMark(rName) == getMarksEnd()) return rName; + ::rtl::OUStringBuffer sBuf; + ::rtl::OUString sTmp; + for(sal_Int32 nCnt = 1; nCnt < SAL_MAX_INT32; nCnt++) { - rtl::OUString s(pBM->GetName()); - rtl::OString aOString = ::rtl::OUStringToOString (s, RTL_TEXTENCODING_UTF8); - const SwTxtNode* pStartTxtNode=pDoc->GetNodes()[pBM->GetBookmarkPos().nNode]->GetTxtNode(); - const SwTxtNode* pEndTxtNode=pDoc->GetNodes()[pBM->GetOtherBookmarkPos()->nNode]->GetTxtNode(); - sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(pBM->GetBookmarkPos().nContent.GetIndex()); - sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar(pBM->GetOtherBookmarkPos()->nContent.GetIndex()-1); - printf("CHECK(%s %p[%i/'%c'] %p[%i/'%c']);\n", aOString.getStr(), pStartTxtNode, ch_start, ch_start, pEndTxtNode, ch_end, ch_end); + sTmp = sBuf.append(rName).append(nCnt).makeStringAndClear(); + if(findMark(sTmp) == getMarksEnd()) break; } + return sTmp; } - return true; -} -void SwDoc::deleteBookmark( /*[in]*/sal_uInt16 nPos ) -{ - SwBookmark *pBM = (*pBookmarkTbl)[nPos]; - if( DoesUndo() && !pBM->IsUNOMark()) + void MarkManager::sortMarks() { - ClearRedo(); - AppendUndo( new SwUndoDelBookmark( *pBM )); + sort(m_vMarks.begin(), m_vMarks.end(), &lcl_MarkOrderingByStart); + sort(m_vBookmarks.begin(), m_vBookmarks.end(), &lcl_MarkOrderingByStart); + sort(m_vFieldmarks.begin(), m_vFieldmarks.end(), &lcl_MarkOrderingByStart); } - // #108964# UNO bookmark don't contribute to the document state, - // and hence changing them shouldn't set the document modified - if( !pBM->IsUNOMark() ) - SetModified(); +}} // namespace ::sw::mark - pBookmarkTbl->Remove(nPos); - SwServerObject* pServObj = pBM->GetObject(); - if( pServObj ) // dann aus der Liste entfernen - GetLinkManager().RemoveServer( pServObj ); +// old implementation - delete pBM; -} +//SV_IMPL_OP_PTRARR_SORT(SwBookmarks, SwBookmarkPtr) -void SwDoc::deleteBookmark( /*[in]*/const String& rName ) -{ - USHORT nFnd = findBookmark( rName ); - if( USHRT_MAX != nFnd ) - deleteBookmark( nFnd ); -} - -// --> OD 2007-10-24 #i81002# -bool SwDoc::isCrossRefBookmarkName( /*[in]*/const String& rName ) -{ - return bookmarkfunc::isHeadingCrossRefBookmarkName( rName ) || - bookmarkfunc::isNumItemCrossRefBookmarkName( rName ); -} -// <-- +#define PCURCRSR (_pCurrCrsr) +#define FOREACHPAM_START(pSttCrsr) \ + {\ + SwPaM *_pStartCrsr = pSttCrsr, *_pCurrCrsr = pSttCrsr; \ + do { -sal_uInt16 SwDoc::findBookmark( /*[in]*/const String& rName ) -{ - ASSERT( rName.Len(), "wo ist der Name?" ); - for( USHORT n = pBookmarkTbl->Count(); n ; ) - if( rName.Equals( (*pBookmarkTbl)[ --n ]->GetName() ) ) - return n; - return USHRT_MAX; -} +#define FOREACHPAM_END() \ + } while( (_pCurrCrsr=(SwPaM *)_pCurrCrsr->GetNext()) != _pStartCrsr ); \ + } +#define PCURSH ((SwCrsrShell*)_pStartShell) +#define FOREACHSHELL_START( pEShell ) \ + {\ + ViewShell *_pStartShell = pEShell; \ + do { \ + if( _pStartShell->IsA( TYPE( SwCrsrShell )) ) \ + { -// Zur Vereinfachung gibt es auch den direkten Zugriff -// auf die "echten" Bookmarks +#define FOREACHSHELL_END( pEShell ) \ + } \ + } while((_pStartShell=(ViewShell*)_pStartShell->GetNext())!= pEShell ); \ + } -sal_uInt16 SwDoc::getBookmarkCount( /*[in]*/bool bBkmrk) const +namespace { - USHORT nRet = pBookmarkTbl->Count(); - if(bBkmrk) + // Aufbau vom Array: 2 longs, + // 1. Long enthaelt Type und Position im DocArray, + // 2. die ContentPosition + // + // CntntType -- + // 0x8000 = Bookmark Pos1 + // 0x8001 = Bookmark Pos2 + // 0x2000 = Absatzgebundener Rahmen + // 0x2001 = Auto-Absatzgebundener Rahmen, der umgehaengt werden soll + // 0x1000 = Redline Mark + // 0x1001 = Redline Point + // 0x0800 = Crsr aus der CrsrShell Mark + // 0x0801 = Crsr aus der CrsrShell Point + // 0x0400 = UnoCrsr Mark + // 0x0401 = UnoCrsr Point + // + + class _SwSaveTypeCountContent { - for( USHORT i = nRet; i; --i ) + union { + struct { USHORT nType, nCount; } TC; + ULONG nTypeCount; + } TYPECOUNT; + xub_StrLen nContent; + + public: + _SwSaveTypeCountContent() { TYPECOUNT.nTypeCount = 0; nContent = 0; } + _SwSaveTypeCountContent( USHORT nType ) + { + SetTypeAndCount( nType, 0 ); + nContent = 0; + } + _SwSaveTypeCountContent( const SvULongs& rArr, USHORT& rPos ) + { + TYPECOUNT.nTypeCount = rArr[ rPos++ ]; + nContent = static_cast<xub_StrLen>(rArr[ rPos++ ]); + } + void Add( SvULongs& rArr ) { - if(!(*pBookmarkTbl)[i - 1]->IsBookMark()) - nRet--; + rArr.Insert( TYPECOUNT.nTypeCount, rArr.Count() ); + rArr.Insert( nContent, rArr.Count() ); } - } - return nRet; -} + void SetType( USHORT n ) { TYPECOUNT.TC.nType = n; } + USHORT GetType() const { return TYPECOUNT.TC.nType; } + void IncType() { ++TYPECOUNT.TC.nType; } + void DecType() { --TYPECOUNT.TC.nType; } -SwBookmark& SwDoc::getBookmark( /*[in]*/sal_uInt16 nPos, /*[in]*/bool bBkmrk) -{ - if( bBkmrk ) - { - USHORT i = 0; - do { - if(!(*pBookmarkTbl)[i]->IsBookMark()) - nPos++; + void SetCount( USHORT n ) { TYPECOUNT.TC.nCount = n; } + USHORT GetCount() const { return TYPECOUNT.TC.nCount; } + USHORT IncCount() { return ++TYPECOUNT.TC.nCount; } + USHORT DecCount() { return --TYPECOUNT.TC.nCount; } - i++; - } - while( i < nPos || !(*pBookmarkTbl)[nPos]->IsBookMark() ); - } - return *(*pBookmarkTbl)[nPos]; -} + void SetTypeAndCount( USHORT nT, USHORT nC ) + { TYPECOUNT.TC.nCount = nC; TYPECOUNT.TC.nType = nT; } -void SwDoc::makeUniqueBookmarkName( String& rNm ) -{ - ASSERT( rNm.Len(), "es sollte ein Name vorgegeben werden!" ); - - // wir erzeugen uns eine temp. Bookmark - String sTmp; - USHORT nCnt = 0, n; - USHORT nBookCnt = pBookmarkTbl->Count(); - do { - sTmp = rNm; - // #i35726# try without number extension first - if(nCnt) - sTmp += String::CreateFromInt32( nCnt ); - nCnt++; - for( n = 0; n < nBookCnt; ++n ) - if( (*pBookmarkTbl)[ n ]->GetName().Equals( sTmp )) - break; - } while( n < nBookCnt ); + void SetContent( xub_StrLen n ) { nContent = n; } + xub_StrLen GetContent() const { return nContent; } + }; - // --> OD 2007-10-24 #i81002# - // a cross-reference bookmark name still have to be a cross-reference - // bookmark name after renaming due to duplicate names and vice versa. - // Thus, consider this, when changing the renaming algorithm - ASSERT( isCrossRefBookmarkName( rNm ) == isCrossRefBookmarkName( sTmp ), - "<SwDoc::makeUniqueBookmarkName(..)> - change of the bookmark name causes change of bookmark name type" ); - // <-- + // #i59534: If a paragraph will be splitted we have to restore some redline positions + // This help function checks a position compared with a node and an content index - rNm = sTmp; -} + static const int BEFORE_NODE = 0; // Position before the given node index + static const int BEFORE_SAME_NODE = 1; // Same node index but content index before given content index + static const int SAME_POSITION = 2; // Same node index and samecontent index + static const int BEHIND_SAME_NODE = 3; // Same node index but content index behind given content index + static const int BEHIND_NODE = 4; // Position behind the given node index -// --> OD 2007-11-16 #i83479# -String SwDoc::getCrossRefBookmarkName( - /*[in]*/const SwTxtNode& rTxtNode, - /*[in]*/const CrossReferenceBookmarkSubType nCrossRefType ) const -{ - for( USHORT n = pBookmarkTbl->Count(); n ; ) + static int lcl_RelativePosition( const SwPosition& rPos, ULONG nNode, xub_StrLen nCntnt ) { - const SwCrossRefBookmark* pCrossRefBkmk( - dynamic_cast<SwCrossRefBookmark*>((*pBookmarkTbl)[ --n ]) ); - if ( pCrossRefBkmk && - pCrossRefBkmk->GetBookmarkPos().nNode.GetNode().GetTxtNode() == - &rTxtNode && - pCrossRefBkmk->GetSubType() == nCrossRefType ) + ULONG nIndex = rPos.nNode.GetIndex(); + int nReturn = BEFORE_NODE; + if( nIndex == nNode ) { - return pCrossRefBkmk->GetName(); + xub_StrLen nCntIdx = rPos.nContent.GetIndex(); + if( nCntIdx < nCntnt ) + nReturn = BEFORE_SAME_NODE; + else if( nCntIdx == nCntnt ) + nReturn = SAME_POSITION; + else + nReturn = BEHIND_SAME_NODE; } + else if( nIndex > nNode ) + nReturn = BEHIND_NODE; + return nReturn; } - return String(); -} -String SwDoc::makeCrossRefBookmark( - /*[in]*/const SwTxtNode& rTxtNode, - /*[in]*/const CrossReferenceBookmarkSubType nCrossRefType ) -{ - SwPosition aPos( rTxtNode ); - aPos.nContent.Assign( &(const_cast<SwTxtNode&>(rTxtNode)), 0 ); - SwPaM aPaM( aPos ); - KeyCode rKeyCodeDummy; - String sBkmkName( bookmarkfunc::generateNewCrossRefBookmarkName( nCrossRefType ) ); - makeUniqueBookmarkName( sBkmkName ); - SwBookmark* pCrossRefBk = - makeBookmark( aPaM, rKeyCodeDummy, sBkmkName, sBkmkName, CROSSREF_BOOKMARK ); - if ( pCrossRefBk ) + static inline int lcl_Greater( const SwPosition& rPos, const SwNodeIndex& rNdIdx, const SwIndex* pIdx ) { - return pCrossRefBk->GetName(); + return rPos.nNode > rNdIdx || ( pIdx && rPos.nNode == rNdIdx && rPos.nContent > pIdx->GetIndex() ); } - else + + static void lcl_ChkPaM( SvULongs& rSaveArr, ULONG nNode, xub_StrLen nCntnt, + const SwPaM& rPam, _SwSaveTypeCountContent& rSave, + BOOL bChkSelDirection ) { - return String(); + // SelektionsRichtung beachten + bool bBound1IsStart = !bChkSelDirection ? TRUE : + ( *rPam.GetPoint() < *rPam.GetMark() + ? rPam.GetPoint() == &rPam.GetBound() + : rPam.GetMark() == &rPam.GetBound()); + + const SwPosition* pPos = &rPam.GetBound( TRUE ); + if( pPos->nNode.GetIndex() == nNode && + ( bBound1IsStart ? pPos->nContent.GetIndex() < nCntnt + : pPos->nContent.GetIndex() <= nCntnt )) + { + rSave.SetContent( pPos->nContent.GetIndex() ); + rSave.Add( rSaveArr ); + } + + pPos = &rPam.GetBound( FALSE ); + if( pPos->nNode.GetIndex() == nNode && + ( (bBound1IsStart && bChkSelDirection) + ? pPos->nContent.GetIndex() <= nCntnt + : pPos->nContent.GetIndex() < nCntnt )) + { + rSave.SetContent( pPos->nContent.GetIndex() ); + rSave.IncType(); + rSave.Add( rSaveArr ); + rSave.DecType(); + } } + } -/* */ -SaveBookmark::SaveBookmark( int eType, const SwBookmark& rBkmk, - const SwNodeIndex & rMvPos, - const SwIndex* pIdx ) - : aName( rBkmk.GetName() ), - aShortName( rBkmk.GetShortName() ), - aCode( rBkmk.GetKeyCode() ), - eBkmkType( (SaveBookmarkType)eType ), - eOrigBkmType(rBkmk.GetType()) +// IDocumentMarkAccess for SwDoc + +IDocumentMarkAccess* SwDoc::getIDocumentMarkAccess() + { return static_cast< IDocumentMarkAccess* >(pMarkManager.get()); } + +const IDocumentMarkAccess* SwDoc::getIDocumentMarkAccess() const + { return static_cast< IDocumentMarkAccess* >(pMarkManager.get()); } + +// SaveBookmark + +SaveBookmark::SaveBookmark( + bool bSavePos, + bool bSaveOtherPos, + const IMark& rBkmk, + const SwNodeIndex & rMvPos, + const SwIndex* pIdx) + : m_aName(rBkmk.GetName()) + , m_aShortName() + , m_aCode() + , m_bSavePos(bSavePos) + , m_bSaveOtherPos(bSaveOtherPos) + , m_eOrigBkmType(IDocumentMarkAccess::GetType(rBkmk)) { - nNode1 = rBkmk.GetBookmarkPos().nNode.GetIndex(); - nCntnt1 = rBkmk.GetBookmarkPos().nContent.GetIndex(); + const IBookmark* const pBookmark = dynamic_cast< const IBookmark* >(&rBkmk); + if(pBookmark) + { + m_aShortName = pBookmark->GetShortName(); + m_aCode = pBookmark->GetKeyCode(); + } + m_nNode1 = rBkmk.GetMarkPos().nNode.GetIndex(); + m_nCntnt1 = rBkmk.GetMarkPos().nContent.GetIndex(); - if( nsSaveBookmarkType::BKMK_POS & eBkmkType ) + if(m_bSavePos) { - nNode1 -= rMvPos.GetIndex(); - if( pIdx && !nNode1 ) - nCntnt1 = nCntnt1 - pIdx->GetIndex(); + m_nNode1 -= rMvPos.GetIndex(); + if(pIdx && !m_nNode1) + m_nCntnt1 -= pIdx->GetIndex(); } - if( rBkmk.GetOtherBookmarkPos() ) + if(rBkmk.IsExpanded()) { - nNode2 = rBkmk.GetOtherBookmarkPos()->nNode.GetIndex(); - nCntnt2 = rBkmk.GetOtherBookmarkPos()->nContent.GetIndex(); + m_nNode2 = rBkmk.GetOtherMarkPos().nNode.GetIndex(); + m_nCntnt2 = rBkmk.GetOtherMarkPos().nContent.GetIndex(); - if( nsSaveBookmarkType::BKMK_POS_OTHER & eBkmkType ) + if(m_bSaveOtherPos) { - nNode2 -= rMvPos.GetIndex(); - if( pIdx && !nNode2 ) - nCntnt2 = nCntnt2 - pIdx->GetIndex(); + m_nNode2 -= rMvPos.GetIndex(); + if(pIdx && !m_nNode2) + m_nCntnt2 -= pIdx->GetIndex(); } } else - nNode2 = ULONG_MAX, nCntnt2 = STRING_NOTFOUND; + m_nNode2 = ULONG_MAX, m_nCntnt2 = STRING_NOTFOUND; } -void SaveBookmark::SetInDoc( SwDoc* pDoc, const SwNodeIndex& rNewPos, - const SwIndex* pIdx ) +void SaveBookmark::SetInDoc( + SwDoc* pDoc, + const SwNodeIndex& rNewPos, + const SwIndex* pIdx) { - SwPaM aPam( rNewPos.GetNode() ); - if( pIdx ) + SwPaM aPam(rNewPos.GetNode()); + if(pIdx) aPam.GetPoint()->nContent = *pIdx; - if( ULONG_MAX != nNode2 ) + if(ULONG_MAX != m_nNode2) { aPam.SetMark(); - if( nsSaveBookmarkType::BKMK_POS_OTHER & eBkmkType ) + if(m_bSaveOtherPos) { - aPam.GetMark()->nNode += nNode2; - if( pIdx && !nNode2 ) - aPam.GetMark()->nContent += nCntnt2; + aPam.GetMark()->nNode += m_nNode2; + if(pIdx && !m_nNode2) + aPam.GetMark()->nContent += m_nCntnt2; else - aPam.GetMark()->nContent.Assign( aPam.GetCntntNode( FALSE ), - nCntnt2 ); + aPam.GetMark()->nContent.Assign(aPam.GetCntntNode(FALSE), m_nCntnt2); } else { - aPam.GetMark()->nNode = nNode2; - aPam.GetMark()->nContent.Assign( aPam.GetCntntNode( FALSE ), - nCntnt2 ); + aPam.GetMark()->nNode = m_nNode2; + aPam.GetMark()->nContent.Assign(aPam.GetCntntNode(FALSE), m_nCntnt2); } } - if( nsSaveBookmarkType::BKMK_POS & eBkmkType ) + if(m_bSavePos) { - aPam.GetPoint()->nNode += nNode1; + aPam.GetPoint()->nNode += m_nNode1; - if( pIdx && !nNode1 ) - aPam.GetPoint()->nContent += nCntnt1; + if(pIdx && !m_nNode1) + aPam.GetPoint()->nContent += m_nCntnt1; else - aPam.GetPoint()->nContent.Assign( aPam.GetCntntNode(), nCntnt1 ); + aPam.GetPoint()->nContent.Assign(aPam.GetCntntNode(), m_nCntnt1); } else { - aPam.GetPoint()->nNode = nNode1; - aPam.GetPoint()->nContent.Assign( aPam.GetCntntNode(), nCntnt1 ); + aPam.GetPoint()->nNode = m_nNode1; + aPam.GetPoint()->nContent.Assign(aPam.GetCntntNode(), m_nCntnt1); } - if( !aPam.HasMark() || - CheckNodesRange( aPam.GetPoint()->nNode, aPam.GetMark()->nNode, TRUE )) - pDoc->makeBookmark( aPam, aCode, aName, aShortName, eOrigBkmType ); + if(!aPam.HasMark() + || CheckNodesRange(aPam.GetPoint()->nNode, aPam.GetMark()->nNode, TRUE)) + { + ::sw::mark::IBookmark* const pBookmark = dynamic_cast< ::sw::mark::IBookmark* >(pDoc->getIDocumentMarkAccess()->makeMark(aPam, m_aName, m_eOrigBkmType)); + if(pBookmark) + { + pBookmark->SetKeyCode(m_aCode); + pBookmark->SetShortName(m_aShortName); + } + } } +// _DelBookmarks, _{Save,Restore}CntntIdx -inline int GreaterThan( const SwPosition& rPos, const SwNodeIndex& rNdIdx, - const SwIndex* pIdx ) -{ - return pIdx ? ( rPos.nNode > rNdIdx || ( rPos.nNode == rNdIdx && - rPos.nContent >= pIdx->GetIndex() )) - : rPos.nNode >= rNdIdx; -} -inline int Lower( const SwPosition& rPos, const SwNodeIndex& rNdIdx, - const SwIndex* pIdx ) -{ - return rPos.nNode < rNdIdx || ( pIdx && rPos.nNode == rNdIdx && - rPos.nContent < pIdx->GetIndex() ); -} -inline int Greater( const SwPosition& rPos, const SwNodeIndex& rNdIdx, - const SwIndex* pIdx ) -{ - return rPos.nNode > rNdIdx || ( pIdx && rPos.nNode == rNdIdx && - rPos.nContent > pIdx->GetIndex() ); -} - -void _DelBookmarks( const SwNodeIndex& rStt, const SwNodeIndex& rEnd, - SaveBookmarks* pSaveBkmk, - const SwIndex* pSttIdx, const SwIndex* pEndIdx ) +void _DelBookmarks( + const SwNodeIndex& rStt, + const SwNodeIndex& rEnd, + ::std::vector<SaveBookmark> * pSaveBkmk, + const SwIndex* pSttIdx, + const SwIndex* pEndIdx) { - // kein gueltiger Bereich ?? - if( rStt.GetIndex() > rEnd.GetIndex() || ( rStt == rEnd && - (!pSttIdx || pSttIdx->GetIndex() >= pEndIdx->GetIndex())) ) + // illegal range ?? + if(rStt.GetIndex() > rEnd.GetIndex() + || (rStt == rEnd && (!pSttIdx || pSttIdx->GetIndex() >= pEndIdx->GetIndex()))) return; + SwDoc* const pDoc = rStt.GetNode().GetDoc(); - // kopiere alle Bookmarks, die im Move Bereich stehen in ein - // Array, das alle Angaben auf die Position als Offset speichert. - // Die neue Zuordung erfolgt nach dem Moven. - SwDoc* pDoc = rStt.GetNode().GetDoc(); - const SwBookmarks& rBkmks = pDoc->getBookmarks(); - USHORT nCnt; - - for( nCnt = 0; nCnt < rBkmks.Count(); ++nCnt ) - { - // liegt auf der Position ?? - int eType = nsSaveBookmarkType::BKMK_POS_NONE; - SwBookmark* pBkmk = rBkmks[ nCnt ]; - //simple marks should not be moved - if(pBkmk->IsMark()) - continue; - if( GreaterThan( pBkmk->GetBookmarkPos(), rStt, pSttIdx ) && - Lower( pBkmk->GetBookmarkPos(), rEnd, pEndIdx )) - eType = nsSaveBookmarkType::BKMK_POS; - if( pBkmk->GetOtherBookmarkPos() && - GreaterThan( *pBkmk->GetOtherBookmarkPos(), rStt, pSttIdx ) && - Lower( *pBkmk->GetOtherBookmarkPos(), rEnd, pEndIdx )) - eType |= nsSaveBookmarkType::BKMK_POS_OTHER; - - if( nsSaveBookmarkType::BKMK_POS_NONE == eType ) // auf zum naechsten - continue; - - if( pSaveBkmk ) - { - // Besonderheit: komplett eingeschlossen? dann mitnehmen - if( pEndIdx && (nsSaveBookmarkType::BKMK_POS_OTHER | nsSaveBookmarkType::BKMK_POS) != eType && - ( ( nsSaveBookmarkType::BKMK_POS_OTHER & eType && - pBkmk->GetBookmarkPos().nNode == rEnd && - pBkmk->GetBookmarkPos().nContent == *pEndIdx ) || - ( nsSaveBookmarkType::BKMK_POS & eType && pBkmk->GetOtherBookmarkPos() && - pBkmk->GetOtherBookmarkPos()->nNode == rEnd && - pBkmk->GetOtherBookmarkPos()->nContent == *pEndIdx ) ) ) - eType = nsSaveBookmarkType::BKMK_POS_OTHER | nsSaveBookmarkType::BKMK_POS; - - SaveBookmark * pSBkmk = new SaveBookmark( eType, *pBkmk, rStt, pSttIdx ); - pSaveBkmk->C40_INSERT( SaveBookmark, pSBkmk, pSaveBkmk->Count() ); - pDoc->deleteBookmark( nCnt-- ); - } - else if( (nsSaveBookmarkType::BKMK_POS_OTHER | nsSaveBookmarkType::BKMK_POS ) == eType || - ( nsSaveBookmarkType::BKMK_POS == eType && !pBkmk->GetOtherBookmarkPos() ) ) - pDoc->deleteBookmark( nCnt-- ); - else - { - // --> OD 2007-10-17 #i81002# - refactoring: - // no direct manipulation of <SwBookmark> member. -// SwPosition* pPos = (SwPosition*)(nsSaveBookmarkType::BKMK_POS & eType -// ? &pBkmk->GetBookmarkPos() -// : pBkmk->GetOtherBookmarkPos()); - SwPosition aNewPos( nsSaveBookmarkType::BKMK_POS & eType - ? pBkmk->GetBookmarkPos() - : *pBkmk->GetOtherBookmarkPos() ); - aNewPos.nNode = rEnd; - if( pEndIdx ) - aNewPos.nContent = *pEndIdx; - else - { - SwCntntNode* pCNd = aNewPos.nNode.GetNode().GetCntntNode(); - BOOL bStt = TRUE; - if( !pCNd && 0 == ( pCNd = pDoc->GetNodes().GoNext( &(aNewPos.nNode) )) ) - { - bStt = FALSE; - aNewPos.nNode = rStt; - if( 0 == ( pCNd = pDoc->GetNodes().GoPrevious( &(aNewPos.nNode) )) ) - { - aNewPos.nNode = nsSaveBookmarkType::BKMK_POS == eType - ? pBkmk->GetOtherBookmarkPos()->nNode - : pBkmk->GetBookmarkPos().nNode; - pCNd = aNewPos.nNode.GetNode().GetCntntNode(); - } - } - xub_StrLen nTmp = bStt ? 0 : pCNd->Len(); - aNewPos.nContent.Assign( pCNd, nTmp ); - } - if ( nsSaveBookmarkType::BKMK_POS & eType ) - { - pBkmk->SetBookmarkPos( &aNewPos ); - } - else - { - pBkmk->SetOtherBookmarkPos( &aNewPos ); - } - - // keine ungueltigen Selektionen zulassen! - if( pBkmk->GetOtherBookmarkPos() && - pBkmk->GetOtherBookmarkPos()->nNode.GetNode().FindTableBoxStartNode() != - pBkmk->GetBookmarkPos().nNode.GetNode().FindTableBoxStartNode() ) - { -// SwPaM aPam( pPos == pBkmk->GetOtherBookmarkPos() -// ? pBkmk->GetBookmarkPos() -// : *pBkmk->GetOtherBookmarkPos() ); - const SwPaM aPam( nsSaveBookmarkType::BKMK_POS & eType - ? *pBkmk->GetOtherBookmarkPos() - : pBkmk->GetBookmarkPos() ); - const String sNm( pBkmk->GetName() ); - const String sShortNm( pBkmk->GetShortName() ); - const KeyCode aKCode( pBkmk->GetKeyCode() ); - const IDocumentBookmarkAccess::BookmarkType eBkmkType( pBkmk->GetType() ); - - bool bMake = !pBkmk->IsUNOMark(); - pDoc->deleteBookmark( nCnt-- ); - if( bMake ) - pDoc->makeBookmark( aPam, aKCode, sNm, sShortNm, eBkmkType ); - } - // <-- - } - } + pDoc->getIDocumentMarkAccess()->deleteMarks(rStt, rEnd, pSaveBkmk, pSttIdx, pEndIdx); // kopiere alle Redlines, die im Move Bereich stehen in ein // Array, das alle Angaben auf die Position als Offset speichert. // Die neue Zuordung erfolgt nach dem Moven. SwRedlineTbl& rTbl = (SwRedlineTbl&)pDoc->GetRedlineTbl(); - for( nCnt = 0; nCnt < rTbl.Count(); ++nCnt ) + for(USHORT nCnt = 0; nCnt < rTbl.Count(); ++nCnt ) { // liegt auf der Position ?? SwRedline* pRedl = rTbl[ nCnt ]; @@ -753,7 +1080,7 @@ void _DelBookmarks( const SwNodeIndex& rStt, const SwNodeIndex& rEnd, SwPosition *pTmp = pRStt; pRStt = pREnd, pREnd = pTmp; } - if( Greater( *pRStt, rStt, pSttIdx ) && Lower( *pRStt, rEnd, pEndIdx )) + if( lcl_Greater( *pRStt, rStt, pSttIdx ) && lcl_Lower( *pRStt, rEnd, pEndIdx )) { pRStt->nNode = rEnd; if( pEndIdx ) @@ -776,7 +1103,7 @@ void _DelBookmarks( const SwNodeIndex& rStt, const SwNodeIndex& rEnd, pRStt->nContent.Assign( pCNd, nTmp ); } } - if( Greater( *pREnd, rStt, pSttIdx ) && Lower( *pREnd, rEnd, pEndIdx )) + if( lcl_Greater( *pREnd, rStt, pSttIdx ) && lcl_Lower( *pREnd, rEnd, pEndIdx )) { pREnd->nNode = rStt; if( pSttIdx ) @@ -802,172 +1129,50 @@ void _DelBookmarks( const SwNodeIndex& rStt, const SwNodeIndex& rEnd, } } - - - -/* */ - - -// Aufbau vom Array: 2 longs, -// 1. Long enthaelt Type und Position im DocArray, -// 2. die ContentPosition -// -// CntntType -- -// 0x8000 = Bookmark Pos1 -// 0x8001 = Bookmark Pos2 -// 0x2000 = Absatzgebundener Rahmen -// 0x2001 = Auto-Absatzgebundener Rahmen, der umgehaengt werden soll -// 0x1000 = Redline Mark -// 0x1001 = Redline Point -// 0x0800 = Crsr aus der CrsrShell Mark -// 0x0801 = Crsr aus der CrsrShell Point -// 0x0400 = UnoCrsr Mark -// 0x0401 = UnoCrsr Point -// - -class _SwSaveTypeCountContent -{ - union { - struct { USHORT nType, nCount; } TC; - ULONG nTypeCount; - } TYPECOUNT; - xub_StrLen nContent; - -public: - _SwSaveTypeCountContent() { TYPECOUNT.nTypeCount = 0; nContent = 0; } - _SwSaveTypeCountContent( USHORT nType ) - { - SetTypeAndCount( nType, 0 ); - nContent = 0; - } - _SwSaveTypeCountContent( const SvULongs& rArr, USHORT& rPos ) - { - TYPECOUNT.nTypeCount = rArr[ rPos++ ]; - nContent = static_cast<xub_StrLen>(rArr[ rPos++ ]); - } - void Add( SvULongs& rArr ) - { - rArr.Insert( TYPECOUNT.nTypeCount, rArr.Count() ); - rArr.Insert( nContent, rArr.Count() ); - } - - void SetType( USHORT n ) { TYPECOUNT.TC.nType = n; } - USHORT GetType() const { return TYPECOUNT.TC.nType; } - void IncType() { ++TYPECOUNT.TC.nType; } - void DecType() { --TYPECOUNT.TC.nType; } - - void SetCount( USHORT n ) { TYPECOUNT.TC.nCount = n; } - USHORT GetCount() const { return TYPECOUNT.TC.nCount; } - USHORT IncCount() { return ++TYPECOUNT.TC.nCount; } - USHORT DecCount() { return --TYPECOUNT.TC.nCount; } - - void SetTypeAndCount( USHORT nT, USHORT nC ) - { TYPECOUNT.TC.nCount = nC; TYPECOUNT.TC.nType = nT; } - - void SetContent( xub_StrLen n ) { nContent = n; } - xub_StrLen GetContent() const { return nContent; } -}; - - -void _ChkPaM( SvULongs& rSaveArr, ULONG nNode, xub_StrLen nCntnt, - const SwPaM& rPam, _SwSaveTypeCountContent& rSave, - BOOL bChkSelDirection ) -{ - // SelektionsRichtung beachten - bool bBound1IsStart = !bChkSelDirection ? TRUE : - ( *rPam.GetPoint() < *rPam.GetMark() - ? rPam.GetPoint() == &rPam.GetBound() - : rPam.GetMark() == &rPam.GetBound()); - - const SwPosition* pPos = &rPam.GetBound( TRUE ); - if( pPos->nNode.GetIndex() == nNode && - ( bBound1IsStart ? pPos->nContent.GetIndex() < nCntnt - : pPos->nContent.GetIndex() <= nCntnt )) - { - rSave.SetContent( pPos->nContent.GetIndex() ); - rSave.Add( rSaveArr ); - } - - pPos = &rPam.GetBound( FALSE ); - if( pPos->nNode.GetIndex() == nNode && - ( (bBound1IsStart && bChkSelDirection) - ? pPos->nContent.GetIndex() <= nCntnt - : pPos->nContent.GetIndex() < nCntnt )) - { - rSave.SetContent( pPos->nContent.GetIndex() ); - rSave.IncType(); - rSave.Add( rSaveArr ); - rSave.DecType(); - } -} - -// #i59534: If a paragraph will be splitted we have to restore some redline positions -// This help function checks a position compared with a node and an content index - -const int BEFORE_NODE = 0; // Position before the given node index -const int BEFORE_SAME_NODE = 1; // Same node index but content index before given content index -const int SAME_POSITION = 2; // Same node index and samecontent index -const int BEHIND_SAME_NODE = 3; // Same node index but content index behind given content index -const int BEHIND_NODE = 4; // Position behind the given node index - -int lcl_RelativePosition( const SwPosition& rPos, ULONG nNode, xub_StrLen nCntnt ) -{ - ULONG nIndex = rPos.nNode.GetIndex(); - int nReturn = BEFORE_NODE; - if( nIndex == nNode ) - { - xub_StrLen nCntIdx = rPos.nContent.GetIndex(); - if( nCntIdx < nCntnt ) - nReturn = BEFORE_SAME_NODE; - else if( nCntIdx == nCntnt ) - nReturn = SAME_POSITION; - else - nReturn = BEHIND_SAME_NODE; - } - else if( nIndex > nNode ) - nReturn = BEHIND_NODE; - return nReturn; -} - -void _SaveCntntIdx( SwDoc* pDoc, ULONG nNode, xub_StrLen nCntnt, - SvULongs& rSaveArr, BYTE nSaveFly ) +void _SaveCntntIdx(SwDoc* pDoc, + ULONG nNode, + xub_StrLen nCntnt, + SvULongs& rSaveArr, + BYTE nSaveFly) { // 1. Bookmarks _SwSaveTypeCountContent aSave; aSave.SetTypeAndCount( 0x8000, 0 ); - const SwBookmarks& rBkmks = pDoc->getBookmarks(); - for( ; aSave.GetCount() < rBkmks.Count(); aSave.IncCount() ) + IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + const sal_Int32 nBkmks = pMarkAccess->getMarksCount(); + for(; aSave.GetCount() < nBkmks; aSave.IncCount()) { bool bEqual = false; bool bLower = false; - const SwBookmark* pBkmk = rBkmks[ aSave.GetCount() ]; - if( pBkmk->GetBookmarkPos().nNode.GetIndex() == nNode && - pBkmk->GetBookmarkPos().nContent.GetIndex() <= nCntnt ) + const ::sw::mark::IMark* pBkmk = (pMarkAccess->getMarksBegin() + aSave.GetCount())->get(); + if(pBkmk->GetMarkPos().nNode.GetIndex() == nNode + && pBkmk->GetMarkPos().nContent.GetIndex() <= nCntnt) { - if( pBkmk->GetBookmarkPos().nContent.GetIndex() < nCntnt ) + if(pBkmk->GetMarkPos().nContent.GetIndex() < nCntnt) { bLower = true; // a hint for the other position... - aSave.SetContent( pBkmk->GetBookmarkPos().nContent.GetIndex() ); - aSave.Add( rSaveArr ); + aSave.SetContent(pBkmk->GetMarkPos().nContent.GetIndex()); + aSave.Add(rSaveArr); } else // if a bookmark position is equal nCntnt, the other position bEqual = true; // has to decide if it is added to the array } - if( pBkmk->GetOtherBookmarkPos() && pBkmk->GetOtherBookmarkPos()->nNode.GetIndex() == - nNode && pBkmk->GetOtherBookmarkPos()->nContent.GetIndex() <= nCntnt ) + if(pBkmk->IsExpanded() + && pBkmk->GetOtherMarkPos().nNode.GetIndex() == nNode + && pBkmk->GetOtherMarkPos().nContent.GetIndex() <= nCntnt) { - if( bLower || pBkmk->GetOtherBookmarkPos()->nContent.GetIndex() < nCntnt ) + if(bLower || pBkmk->GetOtherMarkPos().nContent.GetIndex() < nCntnt) { - if( bEqual ) + if(bEqual) { // the other position is before, the (main) position is equal - aSave.SetContent( pBkmk->GetBookmarkPos().nContent.GetIndex() ); - aSave.Add( rSaveArr ); + aSave.SetContent(pBkmk->GetMarkPos().nContent.GetIndex()); + aSave.Add(rSaveArr); } - aSave.SetContent( pBkmk->GetOtherBookmarkPos()->nContent.GetIndex() ); + aSave.SetContent(pBkmk->GetOtherMarkPos().nContent.GetIndex()); aSave.IncType(); - aSave.Add( rSaveArr ); + aSave.Add(rSaveArr); aSave.DecType(); } } @@ -1031,7 +1236,7 @@ void _SaveCntntIdx( SwDoc* pDoc, ULONG nNode, xub_StrLen nCntnt, aSave.SetType( 0x2000 ); aSave.SetContent( pAPos->nContent.GetIndex() ); - ASSERT( nNode == pAPos->nNode.GetIndex(), + OSL_ENSURE( nNode == pAPos->nNode.GetIndex(), "_SaveCntntIdx: Wrong Node-Index" ); if( FLY_AUTO_CNTNT == rAnchor.GetAnchorId() ) { @@ -1045,10 +1250,10 @@ void _SaveCntntIdx( SwDoc* pDoc, ULONG nNode, xub_StrLen nCntnt, } aSave.SetCount( pDoc->GetSpzFrmFmts()->Count() ); while( aSave.GetCount() && - &rFmt != (*pDoc->GetSpzFrmFmts())[ - aSave.DecCount() ] ) + &rFmt != (*pDoc->GetSpzFrmFmts())[ + aSave.DecCount() ] ) ; // nothing - ASSERT( &rFmt == (*pDoc->GetSpzFrmFmts())[ + OSL_ENSURE( &rFmt == (*pDoc->GetSpzFrmFmts())[ aSave.GetCount() ], "_SaveCntntIdx: Lost FrameFormat" ); aSave.Add( rSaveArr ); @@ -1101,14 +1306,14 @@ void _SaveCntntIdx( SwDoc* pDoc, ULONG nNode, xub_StrLen nCntnt, SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); if( _pStkCrsr ) do { - ::_ChkPaM( rSaveArr, nNode, nCntnt, *_pStkCrsr, + lcl_ChkPaM( rSaveArr, nNode, nCntnt, *_pStkCrsr, aSave, FALSE ); aSave.IncCount(); } while ( (_pStkCrsr != 0 ) && ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); FOREACHPAM_START( PCURSH->_GetCrsr() ) - ::_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, + lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, FALSE ); aSave.IncCount(); FOREACHPAM_END() @@ -1123,7 +1328,7 @@ void _SaveCntntIdx( SwDoc* pDoc, ULONG nNode, xub_StrLen nCntnt, for( USHORT n = 0; n < rTbl.Count(); ++n ) { FOREACHPAM_START( rTbl[ n ] ) - ::_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, FALSE ); + lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, FALSE ); aSave.IncCount(); FOREACHPAM_END() @@ -1131,7 +1336,7 @@ void _SaveCntntIdx( SwDoc* pDoc, ULONG nNode, xub_StrLen nCntnt, if( pUnoTblCrsr ) { FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() ) - ::_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, FALSE ); + lcl_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, FALSE ); aSave.IncCount(); FOREACHPAM_END() } @@ -1140,13 +1345,16 @@ void _SaveCntntIdx( SwDoc* pDoc, ULONG nNode, xub_StrLen nCntnt, } -void _RestoreCntntIdx( SwDoc* pDoc, SvULongs& rSaveArr, - ULONG nNode, xub_StrLen nOffset, BOOL bAuto ) +void _RestoreCntntIdx(SwDoc* pDoc, + SvULongs& rSaveArr, + ULONG nNode, + xub_StrLen nOffset, + BOOL bAuto) { SwCntntNode* pCNd = pDoc->GetNodes()[ nNode ]->GetCntntNode(); - const SwBookmarks& rBkmks = pDoc->getBookmarks(); const SwRedlineTbl& rRedlTbl = pDoc->GetRedlineTbl(); SwSpzFrmFmts* pSpz = pDoc->GetSpzFrmFmts(); + IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); USHORT n = 0; while( n < rSaveArr.Count() ) { @@ -1154,102 +1362,96 @@ void _RestoreCntntIdx( SwDoc* pDoc, SvULongs& rSaveArr, SwPosition* pPos = 0; switch( aSave.GetType() ) { - case 0x8000: - { - // --> OD 2007-09-27 #i81002# - refactoring - // Do not directly manipulate members of <SwBookmark> -// pPos = (SwPosition*)&rBkmks[ aSave.GetCount() ]->GetBookmarkPos(); - SwPosition aNewPos( rBkmks[ aSave.GetCount() ]->GetBookmarkPos() ); - aNewPos.nNode = *pCNd; - aNewPos.nContent.Assign( pCNd, aSave.GetContent() + nOffset ); - rBkmks[ aSave.GetCount() ]->SetBookmarkPos( &aNewPos ); - // <-- - } - break; - case 0x8001: - { - // --> OD 2007-09-27 #i81002# - refactoring - // Do not directly manipulate members of <SwBookmark> -// pPos = (SwPosition*)rBkmks[ aSave.GetCount() ]->GetOtherBookmarkPos(); - SwPosition aNewPos( *(rBkmks[ aSave.GetCount() ]->GetOtherBookmarkPos()) ); - aNewPos.nNode = *pCNd; - aNewPos.nContent.Assign( pCNd, aSave.GetContent() + nOffset ); - rBkmks[ aSave.GetCount() ]->SetOtherBookmarkPos( &aNewPos ); - // <-- - } - break; - case 0x1001: - pPos = (SwPosition*)rRedlTbl[ aSave.GetCount() ]->GetPoint(); - break; - case 0x1000: - pPos = (SwPosition*)rRedlTbl[ aSave.GetCount() ]->GetMark(); - break; - case 0x2000: + case 0x8000: { - SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.GetCount() ]; - const SwFmtAnchor& rFlyAnchor = pFrmFmt->GetAnchor(); - if( rFlyAnchor.GetCntntAnchor() ) - { - SwFmtAnchor aNew( rFlyAnchor ); - SwPosition aNewPos( *rFlyAnchor.GetCntntAnchor() ); - aNewPos.nNode = *pCNd; - if( FLY_AUTO_CNTNT == rFlyAnchor.GetAnchorId() ) - aNewPos.nContent.Assign( pCNd, - aSave.GetContent() + nOffset ); - else - aNewPos.nContent.Assign( 0, 0 ); - aNew.SetAnchor( &aNewPos ); - pFrmFmt->SetFmtAttr( aNew ); - } + MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getMarksBegin()[aSave.GetCount()].get()); + SwPosition aNewPos(pMark->GetMarkPos()); + aNewPos.nNode = *pCNd; + aNewPos.nContent.Assign(pCNd, aSave.GetContent() + nOffset); + pMark->SetMarkPos(aNewPos); } break; - case 0x2001: - if( bAuto ) + case 0x8001: { - SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.GetCount() ]; - SfxPoolItem *pAnchor = (SfxPoolItem*)&pFrmFmt->GetAnchor(); - pFrmFmt->SwModify::Modify( pAnchor, pAnchor ); + MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getMarksBegin()[aSave.GetCount()].get()); + SwPosition aNewPos(pMark->GetOtherMarkPos()); + aNewPos.nNode = *pCNd; + aNewPos.nContent.Assign(pCNd, aSave.GetContent() + nOffset); + pMark->SetOtherMarkPos(aNewPos); } break; + case 0x1001: + pPos = (SwPosition*)rRedlTbl[ aSave.GetCount() ]->GetPoint(); + break; + case 0x1000: + pPos = (SwPosition*)rRedlTbl[ aSave.GetCount() ]->GetMark(); + break; + case 0x2000: + { + SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.GetCount() ]; + const SwFmtAnchor& rFlyAnchor = pFrmFmt->GetAnchor(); + if( rFlyAnchor.GetCntntAnchor() ) + { + SwFmtAnchor aNew( rFlyAnchor ); + SwPosition aNewPos( *rFlyAnchor.GetCntntAnchor() ); + aNewPos.nNode = *pCNd; + if( FLY_AUTO_CNTNT == rFlyAnchor.GetAnchorId() ) + aNewPos.nContent.Assign( pCNd, + aSave.GetContent() + nOffset ); + else + aNewPos.nContent.Assign( 0, 0 ); + aNew.SetAnchor( &aNewPos ); + pFrmFmt->SetFmtAttr( aNew ); + } + } + break; + case 0x2001: + if( bAuto ) + { + SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.GetCount() ]; + SfxPoolItem *pAnchor = (SfxPoolItem*)&pFrmFmt->GetAnchor(); + pFrmFmt->SwModify::Modify( pAnchor, pAnchor ); + } + break; - case 0x0800: - case 0x0801: - { - USHORT nCnt = 0; - SwCrsrShell* pShell = pDoc->GetEditShell(); - if( pShell ) + case 0x0800: + case 0x0801: { - FOREACHSHELL_START( pShell ) - SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); - if( _pStkCrsr ) - do { - if( aSave.GetCount() == nCnt ) - { - pPos = &_pStkCrsr->GetBound( 0x0800 == - aSave.GetType() ); - break; - } - ++nCnt; - } while ( (_pStkCrsr != 0 ) && - ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); + USHORT nCnt = 0; + SwCrsrShell* pShell = pDoc->GetEditShell(); + if( pShell ) + { + FOREACHSHELL_START( pShell ) + SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); + if( _pStkCrsr ) + do { + if( aSave.GetCount() == nCnt ) + { + pPos = &_pStkCrsr->GetBound( 0x0800 == + aSave.GetType() ); + break; + } + ++nCnt; + } while ( (_pStkCrsr != 0 ) && + ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); - if( pPos ) - break; + if( pPos ) + break; - FOREACHPAM_START( PCURSH->_GetCrsr() ) - if( aSave.GetCount() == nCnt ) - { - pPos = &PCURCRSR->GetBound( 0x0800 == - aSave.GetType() ); + FOREACHPAM_START( PCURSH->_GetCrsr() ) + if( aSave.GetCount() == nCnt ) + { + pPos = &PCURCRSR->GetBound( 0x0800 == + aSave.GetType() ); + break; + } + ++nCnt; + FOREACHPAM_END() + if( pPos ) break; - } - ++nCnt; - FOREACHPAM_END() - if( pPos ) - break; - FOREACHSHELL_END( pShell ) - } + FOREACHSHELL_END( pShell ) + } } break; @@ -1300,52 +1502,15 @@ void _RestoreCntntIdx( SwDoc* pDoc, SvULongs& rSaveArr, } } -SwFieldBookmark::SwFieldBookmark(const SwPosition& aPos, - const KeyCode& rCode, - const String& rName, const String& rShortName, - IDocumentBookmarkAccess::BookmarkType eMark) - : SwBookmark(aPos, rCode, rName, rShortName), - fftype(0), // Type: 0 = Text, 1 = Check Box, 2 = List - ffres(0), - ffprot(0), - ffsize(0), // 0 = Auto, 1=Exact (see ffhps) - fftypetxt(0), // Type of text field: 0 = Regular text, 1 = Number, 2 = Date, 3 = Current date, 4 = Current time, 5 = Calculation - ffrecalc(0), - ffmaxlen(0), // Number of characters for text field. Zero means unlimited. - ffhps(24) // Check box size (half-point sizes). -{ - eMarkType = eMark; -} - -void SwFieldBookmark::SetChecked(bool checked) -{ - ASSERT(fftype==1, "This method is for checkboxes only..."); - ffres=(checked?1:0); -} - -bool SwFieldBookmark::IsChecked() -{ - ASSERT(fftype==1, "This method is for checkboxes only..."); - return ffres!=0; -} - -void SwFieldBookmark::SetFieldType(int newfftype) -{ - this->fftype=newfftype; -} - -int SwFieldBookmark::GetFieldType() -{ - return fftype; -} - -void _RestoreCntntIdx( SvULongs& rSaveArr, const SwNode& rNd, - xub_StrLen nLen, xub_StrLen nChkLen ) +void _RestoreCntntIdx(SvULongs& rSaveArr, + const SwNode& rNd, + xub_StrLen nLen, + xub_StrLen nChkLen) { const SwDoc* pDoc = rNd.GetDoc(); - const SwBookmarks& rBkmks = pDoc->getBookmarks(); const SwRedlineTbl& rRedlTbl = pDoc->GetRedlineTbl(); const SwSpzFrmFmts* pSpz = pDoc->GetSpzFrmFmts(); + const IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); SwCntntNode* pCNd = (SwCntntNode*)rNd.GetCntntNode(); USHORT n = 0; @@ -1361,26 +1526,20 @@ void _RestoreCntntIdx( SvULongs& rSaveArr, const SwNode& rNd, { case 0x8000: { - // --> OD 2007-09-27 #i81002# - refactoring - // Do not directly manipulate members of <SwBookmark> -// pPos = (SwPosition*)&rBkmks[ aSave.GetCount() ]->GetBookmarkPos(); - SwPosition aNewPos( rBkmks[ aSave.GetCount() ]->GetBookmarkPos() ); + MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getMarksBegin()[aSave.GetCount()].get()); + SwPosition aNewPos(pMark->GetMarkPos()); aNewPos.nNode = rNd; - aNewPos.nContent.Assign( pCNd, Min( aSave.GetContent(), nLen ) ); - rBkmks[ aSave.GetCount() ]->SetBookmarkPos( &aNewPos ); - // <-- + aNewPos.nContent.Assign(pCNd, Min(aSave.GetContent(), nLen)); + pMark->SetMarkPos(aNewPos); } break; case 0x8001: { - // --> OD 2007-09-27 #i81002# - refactoring - // Do not directly manipulate members of <SwBookmark> -// pPos = (SwPosition*)rBkmks[ aSave.GetCount() ]->GetOtherBookmarkPos(); - SwPosition aNewPos( *(rBkmks[ aSave.GetCount() ]->GetOtherBookmarkPos()) ); + MarkBase* pMark = dynamic_cast<MarkBase*>(pMarkAccess->getMarksBegin()[aSave.GetCount()].get()); + SwPosition aNewPos(pMark->GetOtherMarkPos()); aNewPos.nNode = rNd; - aNewPos.nContent.Assign( pCNd, Min( aSave.GetContent(), nLen ) ); - rBkmks[ aSave.GetCount() ]->SetOtherBookmarkPos( &aNewPos ); - // <-- + aNewPos.nContent.Assign(pCNd, Min(aSave.GetContent(), nLen)); + pMark->SetOtherMarkPos(aNewPos); } break; case 0x1001: @@ -1500,85 +1659,3 @@ void _RestoreCntntIdx( SvULongs& rSaveArr, const SwNode& rNd, } } } - -// --> OD 2007-11-09 #i81002# -namespace bookmarkfunc -{ - const String getHeadingCrossRefBookmarkNamePrefix() - { - static const String sPrefix( String::CreateFromAscii( "__RefHeading__" ) ); - - return sPrefix; - } - - const String getNumItemCrossRefBookmarkNamePrefix() - { - static String sPrefix( String::CreateFromAscii( "__RefNumPara__" ) ); - - return sPrefix; - } - - bool isHeadingCrossRefBookmarkName( /*[in]*/const String& rName ) - { - bool bRet( false ); - - const xub_StrLen cLenOfFixedFirstPart = - getHeadingCrossRefBookmarkNamePrefix().Len(); - if ( rName.Len() > cLenOfFixedFirstPart ) - { - const String aFirstPartOfName = rName.Copy( 0, cLenOfFixedFirstPart ); - const String aRestOfName = rName.Copy( cLenOfFixedFirstPart ); - if ( aRestOfName.ToInt64() > 0 && - aFirstPartOfName.Equals( getHeadingCrossRefBookmarkNamePrefix() ) ) - { - bRet = true; - } - } - - return bRet; - - } - - bool isNumItemCrossRefBookmarkName( /*[in]*/const String& rName ) - { - bool bRet( false ); - - const xub_StrLen cLenOfFixedFirstPart = - getNumItemCrossRefBookmarkNamePrefix().Len(); - if ( rName.Len() > cLenOfFixedFirstPart ) - { - const String aFirstPartOfName = rName.Copy( 0, cLenOfFixedFirstPart ); - const String aRestOfName = rName.Copy( cLenOfFixedFirstPart ); - if ( aRestOfName.ToInt64() > 0 && - aFirstPartOfName.Equals( getNumItemCrossRefBookmarkNamePrefix() ) ) - { - bRet = true; - } - } - - return bRet; - - } - - // --> OD 2007-11-16 #i83479# - String generateNewCrossRefBookmarkName( - /*[in]*/const IDocumentBookmarkAccess::CrossReferenceBookmarkSubType nSubType ) - { - String sNewName; - if ( nSubType == IDocumentBookmarkAccess::HEADING ) - { - sNewName = getHeadingCrossRefBookmarkNamePrefix(); - } - else if ( nSubType == IDocumentBookmarkAccess::NUMITEM ) - { - sNewName = getNumItemCrossRefBookmarkNamePrefix(); - } - - long n = Time().GetTime(); - n += Date().GetDate(); - sNewName.Append( String::CreateFromInt32( n ) ); - - return sNewName; - } -} -// <-- diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx index e48bdaca2f73..c7c3e4e69031 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -37,6 +37,7 @@ #include <rootfrm.hxx> #include <editsh.hxx> #include <viscrs.hxx> +#include <IMark.hxx> #include <bookmrk.hxx> #include <redline.hxx> #include <mvsave.hxx> @@ -73,17 +74,77 @@ } while( (_pCurrCrsr=(SwPaM *)_pCurrCrsr->GetNext()) != _pStartCrsr ); \ } -/* */ +namespace +{ + // find the relevant section in which the SwUnoCrsr may wander. returns NULL if + // no restrictions apply + const SwStartNode* lcl_FindUnoCrsrSection( const SwNode& rNode ) + { + const SwStartNode* pStartNode = rNode.StartOfSectionNode(); + while( ( pStartNode != NULL ) && + ( pStartNode->StartOfSectionNode() != pStartNode ) && + ( pStartNode->GetStartNodeType() == SwNormalStartNode ) ) + pStartNode = pStartNode->StartOfSectionNode(); -#define _PaMCorrAbs1( pPam ) \ - for( int nb = 0; nb < 2; ++nb ) \ - if( &((pPam)->GetBound( BOOL(nb) ).nNode.GetNode()) == pOldNode ) \ - { \ - (pPam)->GetBound( BOOL(nb) ) = aNewPos; \ - (pPam)->GetBound( BOOL(nb) ).nContent += nOffset; \ - } + return pStartNode; + } + static inline void lcl_PaMCorrAbs1(SwPaM * pPam, + SwNode const * const pOldNode, + const SwPosition& rNewPos, + const xub_StrLen nOffset) + { + for(int nb = 0; nb < 2; ++nb) + if(&((pPam)->GetBound(BOOL(nb)).nNode.GetNode()) == pOldNode) + { + (pPam)->GetBound(BOOL(nb)) = rNewPos; + (pPam)->GetBound(BOOL(nb)).nContent += nOffset; + } + }; + + static inline bool lcl_PaMCorrAbs2(SwPaM* pPam, + const SwPosition& rNewPos, + ULONG nSttNode, + ULONG nEndNode) + { + bool bRet = false; + for(int nb = 0; nb < 2; ++nb) + if((pPam)->GetBound(BOOL(nb)).nNode >= nSttNode && + (pPam)->GetBound(BOOL(nb)).nNode <= nEndNode) + { + (pPam)->GetBound(BOOL(nb)) = rNewPos; + bRet = true; + } + return bRet; + }; + + static inline void lcl_PaMCorrAbs3(SwPaM * pPam, + const SwPosition& rStart, + const SwPosition& rEnd, + const SwPosition& rNewPos) + { + for(int nb = 0; nb < 2; ++nb) + if(rStart <= (pPam)->GetBound(BOOL(nb)) && + (pPam)->GetBound(BOOL(nb)) <= rEnd ) + (pPam)->GetBound(BOOL(nb)) = rNewPos; + }; + + static inline void lcl_PaMCorrRel1(SwPaM * pPam, + SwNode const * const pOldNode, + const SwPosition& rNewPos, + const xub_StrLen nCntIdx) + { + for(int nb = 0; nb < 2; ++nb) + if(&((pPam)->GetBound(BOOL(nb)).nNode.GetNode()) == pOldNode) + { + (pPam)->GetBound(BOOL(nb)).nNode = rNewPos.nNode; + (pPam)->GetBound(BOOL(nb)).nContent.Assign( + const_cast<SwIndexReg*>(rNewPos.nContent.GetIdxReg()), + nCntIdx + (pPam)->GetBound(BOOL(nb)).nContent.GetIndex()); + } + } +} void PaMCorrAbs( const SwNodeIndex &rOldNode, const SwPosition &rNewPos, @@ -98,20 +159,18 @@ void PaMCorrAbs( const SwNodeIndex &rOldNode, { FOREACHSHELL_START( pShell ) SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); - // Alle ueberfluessigen Crsr sind vom Stack, oder ?? - // ASSERT( !_pStkCrsr, "Es stehen noch Crsr auf dem CrsrStack" ); if( _pStkCrsr ) do { - _PaMCorrAbs1( _pStkCrsr ) + lcl_PaMCorrAbs1( _pStkCrsr, pOldNode, aNewPos, nOffset ); } while ( (_pStkCrsr != 0 ) && ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); FOREACHPAM_START( PCURSH->_GetCrsr() ) - _PaMCorrAbs1( PCURCRSR ) + lcl_PaMCorrAbs1( PCURCRSR, pOldNode, aNewPos, nOffset ); FOREACHPAM_END() if( PCURSH->IsTableMode() ) - _PaMCorrAbs1( PCURSH->GetTblCrs() ) + lcl_PaMCorrAbs1( PCURSH->GetTblCrs(), pOldNode, aNewPos, nOffset ); FOREACHSHELL_END( pShell ) } @@ -121,14 +180,14 @@ void PaMCorrAbs( const SwNodeIndex &rOldNode, for( USHORT n = 0; n < rTbl.Count(); ++n ) { FOREACHPAM_START( rTbl[ n ] ) - _PaMCorrAbs1( PCURCRSR ) + lcl_PaMCorrAbs1( PCURCRSR, pOldNode, aNewPos, nOffset ); FOREACHPAM_END() SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ n ]; if( pUnoTblCrsr ) { FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() ) - _PaMCorrAbs1( PCURCRSR ) + lcl_PaMCorrAbs1( PCURCRSR, pOldNode, aNewPos, nOffset ); FOREACHPAM_END() } } @@ -136,113 +195,6 @@ void PaMCorrAbs( const SwNodeIndex &rOldNode, } -void SwDoc::CorrAbs( const SwNodeIndex& rOldNode, - const SwPosition& rNewPos, - const xub_StrLen nOffset, - BOOL bMoveCrsr ) -{ - const SwNode* pOldNode = &rOldNode.GetNode(); - SwPosition aNewPos( rNewPos ); - - { // erstmal die Bookmark korrigieren - SwBookmarks& rBkmks = *pBookmarkTbl; - SwBookmark* pBkmk; - for( USHORT n = 0; n < rBkmks.Count(); ++n ) - { - // liegt auf der Position ?? - int bChgd = 0; - if( &( pBkmk = (SwBookmark*)rBkmks[ n ])->GetBookmarkPos().nNode.GetNode() == pOldNode ) - { - // --> OD 2007-09-26 #i81002# - refactoring -// *pBkmk->pPos1 = aNewPos; -// pBkmk->pPos1->nContent += nOffset; - SwPosition aNewPos1( aNewPos ); - aNewPos1.nContent += nOffset; - pBkmk->SetBookmarkPos( &aNewPos1 ); - // <-- - bChgd = 1; - } - if ( pBkmk->GetOtherBookmarkPos() && - &pBkmk->GetOtherBookmarkPos()->nNode.GetNode() == pOldNode ) - { - // --> OD 2007-09-26 #i81002# - refactoring -// *pBkmk->pPos2 = aNewPos; -// pBkmk->pPos2->nContent += nOffset; - SwPosition aNewPos2( aNewPos ); - aNewPos2.nContent += nOffset; - pBkmk->SetOtherBookmarkPos( &aNewPos ); - // <-- - bChgd = 2; - } - // ungueltige Selektion? Dann die Klammerung aufheben - if( bChgd && pBkmk->GetOtherBookmarkPos() && - pBkmk->GetOtherBookmarkPos()->nNode.GetNode().FindTableBoxStartNode() != - pBkmk->GetBookmarkPos().nNode.GetNode().FindTableBoxStartNode() ) - { - if( 1 == bChgd ) - { - // --> OD 2007-09-26 #i81002# - refactoring -// *pBkmk->pPos1 = *pBkmk->pPos2; - pBkmk->SetBookmarkPos( pBkmk->GetOtherBookmarkPos() ); - // <-- - } - // --> OD 2007-09-26 #i81002# - refactoring -// delete pBkmk->pPos2, pBkmk->pPos2 = 0; - pBkmk->SetOtherBookmarkPos( 0 ); - // <-- - if( pBkmk->IsServer() ) - pBkmk->SetRefObject( 0 ); - // die Sortierung muss aufrecht erhalten bleiben! - rBkmks.Remove( n-- ); - rBkmks.Insert( pBkmk ); - } - } - } - { // dann die Redlines korrigieren - SwRedlineTbl& rTbl = *pRedlineTbl; - for( USHORT n = 0; n < rTbl.Count(); ++n ) - { - // liegt auf der Position ?? - _PaMCorrAbs1( rTbl[ n ] ) - } - } - - if( bMoveCrsr ) - ::PaMCorrAbs( rOldNode, rNewPos, nOffset ); -} - -/* */ - -bool _PaMCorrAbs2( SwPaM* pPam, - const SwPosition& rNewPos, - ULONG nSttNode, ULONG nEndNode ) -{ - bool bRet = false; - - for( int nb = 0; nb < 2; ++nb ) \ - if( (pPam)->GetBound( BOOL(nb) ).nNode >= nSttNode && - (pPam)->GetBound( BOOL(nb) ).nNode <= nEndNode ) - { - (pPam)->GetBound( BOOL(nb) ) = rNewPos; - bRet = true; - } - - return bRet; -} - -// find the relevant section in which the SwUnoCrsr may wander. returns NULL if -// no restrictions apply -const SwStartNode* lcl_FindUnoCrsrSection( const SwNode& rNode ) -{ - const SwStartNode* pStartNode = rNode.StartOfSectionNode(); - while( ( pStartNode != NULL ) && - ( pStartNode->StartOfSectionNode() != pStartNode ) && - ( pStartNode->GetStartNodeType() == SwNormalStartNode ) ) - pStartNode = pStartNode->StartOfSectionNode(); - - return pStartNode; -} - void PaMCorrAbs( const SwNodeIndex &rStartNode, const SwNodeIndex &rEndNode, const SwPosition &rNewPos ) @@ -257,20 +209,18 @@ void PaMCorrAbs( const SwNodeIndex &rStartNode, { FOREACHSHELL_START( pShell ) SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); - // Alle ueberfluessigen Crsr sind vom Stack, oder ?? - // ASSERT( !_pStkCrsr, "Es stehen noch Crsr auf dem CrsrStack" ); if( _pStkCrsr ) do { - _PaMCorrAbs2( _pStkCrsr, aNewPos, nSttNode, nEndNode ); + lcl_PaMCorrAbs2( _pStkCrsr, aNewPos, nSttNode, nEndNode ); } while ( (_pStkCrsr != 0 ) && ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); FOREACHPAM_START( PCURSH->_GetCrsr() ) - _PaMCorrAbs2( PCURCRSR, aNewPos, nSttNode, nEndNode ); + lcl_PaMCorrAbs2( PCURCRSR, aNewPos, nSttNode, nEndNode ); FOREACHPAM_END() if( PCURSH->IsTableMode() ) - _PaMCorrAbs2( PCURSH->GetTblCrs(), aNewPos, nSttNode, nEndNode ); + lcl_PaMCorrAbs2( PCURSH->GetTblCrs(), aNewPos, nSttNode, nEndNode ); FOREACHSHELL_END( pShell ) } @@ -292,7 +242,7 @@ void PaMCorrAbs( const SwNodeIndex &rStartNode, pUnoCursor->GetPoint()->nNode.GetNode() ) ); FOREACHPAM_START( pUnoCursor ) - bChange |= _PaMCorrAbs2(PCURCRSR, aNewPos, nSttNode, nEndNode); + bChange |= lcl_PaMCorrAbs2(PCURCRSR, aNewPos, nSttNode, nEndNode); FOREACHPAM_END() SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*pUnoCursor; @@ -300,7 +250,7 @@ void PaMCorrAbs( const SwNodeIndex &rStartNode, { FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() ) bChange |= - _PaMCorrAbs2( PCURCRSR, aNewPos, nSttNode, nEndNode ); + lcl_PaMCorrAbs2( PCURCRSR, aNewPos, nSttNode, nEndNode ); FOREACHPAM_END() } @@ -317,30 +267,6 @@ void PaMCorrAbs( const SwNodeIndex &rStartNode, } -void SwDoc::CorrAbs( const SwNodeIndex& rStartNode, - const SwNodeIndex& rEndNode, - const SwPosition& rNewPos, - BOOL bMoveCrsr ) -{ - SwPosition aNewPos( rNewPos ); - -// if( !DoesUndo() ) - // erstmal die Bookmarks/Redlines korrigieren - _DelBookmarks( rStartNode, rEndNode ); - - if( bMoveCrsr ) - ::PaMCorrAbs( rStartNode, rEndNode, rNewPos ); -} - - -/* */ - -#define _PaMCorrAbs3( pPam ) \ - for( int nb = 0; nb < 2; ++nb ) \ - if( aStart <= (pPam)->GetBound( BOOL(nb) ) && \ - (pPam)->GetBound( BOOL(nb) ) <= aEnd ) \ - (pPam)->GetBound( BOOL(nb) ) = aNewPos; - void PaMCorrAbs( const SwPaM& rRange, const SwPosition& rNewPos ) { @@ -354,20 +280,18 @@ void PaMCorrAbs( const SwPaM& rRange, { FOREACHSHELL_START( pShell ) SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); - // Alle ueberfluessigen Crsr sind vom Stack, oder ?? - // ASSERT( !_pStkCrsr, "Es stehen noch Crsr auf dem CrsrStack" ); if( _pStkCrsr ) do { - _PaMCorrAbs3( _pStkCrsr ) + lcl_PaMCorrAbs3( _pStkCrsr, aStart, aEnd, aNewPos ); } while ( (_pStkCrsr != 0 ) && ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); FOREACHPAM_START( PCURSH->_GetCrsr() ) - _PaMCorrAbs3( PCURCRSR ) + lcl_PaMCorrAbs3( PCURCRSR, aStart, aEnd, aNewPos ); FOREACHPAM_END() if( PCURSH->IsTableMode() ) - _PaMCorrAbs3( PCURSH->GetTblCrs() ) + lcl_PaMCorrAbs3( PCURSH->GetTblCrs(), aStart, aEnd, aNewPos ); FOREACHSHELL_END( pShell ) } @@ -376,50 +300,67 @@ void PaMCorrAbs( const SwPaM& rRange, for( USHORT n = 0; n < rTbl.Count(); ++n ) { FOREACHPAM_START( rTbl[ n ] ) - _PaMCorrAbs3( PCURCRSR ) + lcl_PaMCorrAbs3( PCURCRSR, aStart, aEnd, aNewPos ); FOREACHPAM_END() SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ n ]; if( pUnoTblCrsr ) { FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() ) - _PaMCorrAbs3( PCURCRSR ) + lcl_PaMCorrAbs3( PCURCRSR, aStart, aEnd, aNewPos ); FOREACHPAM_END() } } } } - -void SwDoc::CorrAbs( const SwPaM& rRange, - const SwPosition& rNewPos, - BOOL bMoveCrsr ) +void SwDoc::CorrAbs(const SwNodeIndex& rOldNode, + const SwPosition& rNewPos, + const xub_StrLen nOffset, + BOOL bMoveCrsr) { - SwPosition aStart( *rRange.Start() ); - SwPosition aEnd( *rRange.End() ); - SwPosition aNewPos( rNewPos ); + getIDocumentMarkAccess()->correctMarksAbsolute(rOldNode, rNewPos, nOffset); + { // fix readlines + SwRedlineTbl& rTbl = *pRedlineTbl; + for( USHORT n = 0; n < rTbl.Count(); ++n ) + { + // is on position ?? + lcl_PaMCorrAbs1( rTbl[ n ], &rOldNode.GetNode(), SwPosition(rNewPos), nOffset ); + } + } -// if( !DoesUndo() ) - // erstmal die Bookmarks/Redlines korrigieren - _DelBookmarks( aStart.nNode, aEnd.nNode, 0, - &aStart.nContent, &aEnd.nContent ); - if( bMoveCrsr ) - ::PaMCorrAbs( rRange, rNewPos ); + if(bMoveCrsr) + ::PaMCorrAbs(rOldNode, rNewPos, nOffset); } +void SwDoc::CorrAbs(const SwPaM& rRange, + const SwPosition& rNewPos, + BOOL bMoveCrsr) +{ + SwPosition aStart(*rRange.Start()); + SwPosition aEnd(*rRange.End()); + SwPosition aNewPos(rNewPos); + + _DelBookmarks(aStart.nNode, aEnd.nNode, NULL, + &aStart.nContent, &aEnd.nContent); + if(bMoveCrsr) + ::PaMCorrAbs(rRange, rNewPos); +} + +void SwDoc::CorrAbs(const SwNodeIndex& rStartNode, + const SwNodeIndex& rEndNode, + const SwPosition& rNewPos, + BOOL bMoveCrsr) +{ + SwPosition aNewPos(rNewPos); + + _DelBookmarks(rStartNode, rEndNode); + + if(bMoveCrsr) + ::PaMCorrAbs(rStartNode, rEndNode, rNewPos); +} -/* */ -#define _PaMCorrRel1( pPam ) \ - for( int nb = 0; nb < 2; ++nb ) \ - if( &((pPam)->GetBound( BOOL(nb) ).nNode.GetNode()) == pOldNode ) \ - { \ - (pPam)->GetBound( BOOL(nb) ).nNode = aNewPos.nNode; \ - (pPam)->GetBound( BOOL(nb) ).nContent.Assign( (SwIndexReg*) \ - aNewPos.nContent.GetIdxReg(), \ - nCntIdx + (pPam)->GetBound( BOOL(nb) ).nContent. \ - GetIndex() ); \ - } @@ -438,20 +379,18 @@ void PaMCorrRel( const SwNodeIndex &rOldNode, { FOREACHSHELL_START( pShell ) SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); - // Alle ueberfluessigen Crsr sind vom Stack, oder ?? - // ASSERT( !_pStkCrsr, "Es stehen noch Crsr auf dem CrsrStack" ); if( _pStkCrsr ) do { - _PaMCorrRel1( _pStkCrsr ) + lcl_PaMCorrRel1( _pStkCrsr, pOldNode, aNewPos, nCntIdx ); } while ( (_pStkCrsr != 0 ) && ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); FOREACHPAM_START( PCURSH->_GetCrsr() ) - _PaMCorrRel1( PCURCRSR ) + lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx); FOREACHPAM_END() if( PCURSH->IsTableMode() ) - _PaMCorrRel1( PCURSH->GetTblCrs() ) + lcl_PaMCorrRel1( PCURSH->GetTblCrs(), pOldNode, aNewPos, nCntIdx ); FOREACHSHELL_END( pShell ) } @@ -460,109 +399,42 @@ void PaMCorrRel( const SwNodeIndex &rOldNode, for( USHORT n = 0; n < rTbl.Count(); ++n ) { FOREACHPAM_START( rTbl[ n ] ) - _PaMCorrRel1( PCURCRSR ) + lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx ); FOREACHPAM_END() SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ n ]; if( pUnoTblCrsr ) { FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() ) - _PaMCorrRel1( PCURCRSR ) + lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx ); FOREACHPAM_END() } } } } -void SwDoc::CorrRel( const SwNodeIndex& rOldNode, - const SwPosition& rNewPos, - const xub_StrLen nOffset, - BOOL bMoveCrsr ) +void SwDoc::CorrRel(const SwNodeIndex& rOldNode, + const SwPosition& rNewPos, + const xub_StrLen nOffset, + BOOL bMoveCrsr) { - const SwNode* pOldNode = &rOldNode.GetNode(); - SwPosition aNewPos( rNewPos ); - xub_StrLen nCntIdx = aNewPos.nContent.GetIndex() + nOffset; + getIDocumentMarkAccess()->correctMarksRelative(rOldNode, rNewPos, nOffset); - { // erstmal die Bookmark korrigieren - SwBookmarks& rBkmks = *pBookmarkTbl; - SwBookmark* pBkmk; - for( USHORT n = 0; n < rBkmks.Count(); ++n ) - { - // liegt auf der Position ?? - int bChgd = FALSE; - if( &( pBkmk = (SwBookmark*)rBkmks[ n ])->GetBookmarkPos().nNode.GetNode() - == pOldNode ) - { - // --> OD 2007-09-26 #i81002# - refactoring -// pBkmk->pPos1->nNode = aNewPos.nNode; -// pBkmk->pPos1->nContent.Assign( (SwIndexReg*) -// aNewPos.nContent.GetIdxReg(), -// nCntIdx + pBkmk->pPos1->nContent.GetIndex() ); - SwPosition aNewPos1( pBkmk->GetBookmarkPos() ); - aNewPos1.nNode = aNewPos.nNode; - aNewPos1.nContent.Assign( (SwIndexReg*)aNewPos.nContent.GetIdxReg(), - nCntIdx + pBkmk->GetBookmarkPos().nContent.GetIndex() ); - pBkmk->SetBookmarkPos( &aNewPos1 ); - // <-- - bChgd = 1; - } - if ( pBkmk->GetOtherBookmarkPos() && - &pBkmk->GetOtherBookmarkPos()->nNode.GetNode() == pOldNode ) - { - // --> OD 2007-09-26 #i81002# - refactoring -// pBkmk->pPos2->nNode = aNewPos.nNode; -// pBkmk->pPos2->nContent.Assign( (SwIndexReg*) -// aNewPos.nContent.GetIdxReg(), -// nCntIdx + pBkmk->pPos2->nContent.GetIndex() ); - SwPosition aNewPos2( *(pBkmk->GetOtherBookmarkPos()) ); - aNewPos2.nNode = aNewPos.nNode; - aNewPos2.nContent.Assign( (SwIndexReg*)aNewPos.nContent.GetIdxReg(), - nCntIdx + pBkmk->GetOtherBookmarkPos()->nContent.GetIndex() ); - pBkmk->SetOtherBookmarkPos( &aNewPos2 ); - // <-- - bChgd = 2; - } - // ungueltige Selektion? Dann die Klammerung aufheben - if( bChgd && pBkmk->GetOtherBookmarkPos() && - pBkmk->GetOtherBookmarkPos()->nNode.GetNode().FindTableBoxStartNode() != - pBkmk->GetBookmarkPos().nNode.GetNode().FindTableBoxStartNode() ) - { - if( 1 == bChgd ) - { - // --> OD 2007-09-26 #i81002# - refactoring -// *pBkmk->pPos1 = *pBkmk->pPos2; - pBkmk->SetBookmarkPos( pBkmk->GetOtherBookmarkPos() ); - // <-- - } - // --> OD 2007-09-26 #i81002# - refactoring -// delete pBkmk->pPos2, pBkmk->pPos2 = 0; - pBkmk->SetOtherBookmarkPos( 0 ); - // <-- - if( pBkmk->IsServer() ) - pBkmk->SetRefObject( 0 ); - - // die Sortierung muss aufrecht erhalten bleiben! - rBkmks.Remove( n-- ); - rBkmks.Insert( pBkmk ); - } - } - } { // dann die Redlines korrigieren SwRedlineTbl& rTbl = *pRedlineTbl; + SwPosition aNewPos(rNewPos); for( USHORT n = 0; n < rTbl.Count(); ++n ) { // liegt auf der Position ?? - _PaMCorrRel1( rTbl[ n ] ) + lcl_PaMCorrRel1( rTbl[ n ], &rOldNode.GetNode(), aNewPos, aNewPos.nContent.GetIndex() + nOffset ); } } - if( bMoveCrsr ) - ::PaMCorrRel( rOldNode, rNewPos, nOffset ); + if(bMoveCrsr) + ::PaMCorrRel(rOldNode, rNewPos, nOffset); } -/* */ - SwEditShell* SwDoc::GetEditShell( ViewShell** ppSh ) const { // Layout und OLE-Shells sollten vorhanden sein! diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx index 59cc7cdc97fe..a7c042f51d88 100644 --- a/sw/source/core/doc/docdde.cxx +++ b/sw/source/core/doc/docdde.cxx @@ -47,54 +47,48 @@ #include <fmtcntnt.hxx> #include <doc.hxx> #include <swserv.hxx> // fuer Server-Funktionalitaet -#include <bookmrk.hxx> // fuer die Bookmarks +#include <IMark.hxx> +#include <bookmrk.hxx> #include <section.hxx> // fuer SwSectionFmt #include <swtable.hxx> // fuer SwTable #include <node.hxx> #include <ndtxt.hxx> #include <pam.hxx> #include <docary.hxx> +#include <MarkManager.hxx> using namespace ::com::sun::star; +namespace +{ + + static ::sw::mark::DdeBookmark* const lcl_FindDdeBookmark(const IDocumentMarkAccess& rMarkAccess, const String& rName) + { + //Iterating over all bookmarks, checking DdeBookmarks + const String sNameLc = GetAppCharClass().lower(rName); + for(IDocumentMarkAccess::const_iterator_t ppMark = rMarkAccess.getMarksBegin(); + ppMark != rMarkAccess.getMarksEnd(); + ppMark++) + { + ::sw::mark::DdeBookmark* const pBkmk = dynamic_cast< ::sw::mark::DdeBookmark*>(ppMark->get()); + if(pBkmk && GetAppCharClass().lower(pBkmk->GetName()) == sNameLc) + return pBkmk; + } + return NULL; + } +} + struct _FindItem { const String& rItem; - SwBookmark* pBkmk; SwTableNode* pTblNd; SwSectionNode* pSectNd; - _FindItem( const String& rS ) - : rItem( rS ), pBkmk( 0 ), pTblNd( 0 ), pSectNd( 0 ) + _FindItem(const String& rS) + : rItem(rS), pTblNd(0), pSectNd(0) {} - - void ClearObj() - { - if( pBkmk ) - pBkmk->SetRefObject( 0 ); - else if( pSectNd ) - pSectNd->GetSection().SetRefObject( 0 ); - else if( pTblNd ) - pTblNd->GetTable().SetRefObject( 0 ); - } }; - -BOOL lcl_FindBookmark( const SwBookmarkPtr& rpBkmk, void* pArgs ) -{ - BOOL bRet = TRUE; - String sNm( GetAppCharClass().lower( rpBkmk->GetName() )); - if( sNm.Equals( ((_FindItem*)pArgs)->rItem ) ) - { - ((_FindItem*)pArgs)->pBkmk = rpBkmk; - bRet = FALSE; - } - - return bRet; -} - - - BOOL lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs ) { SwSection* pSect = rpSectFmt->GetSection(); @@ -149,17 +143,12 @@ BOOL lcl_FindTable( const SwFrmFmtPtr& rpTableFmt, void* pArgs ) bool SwDoc::GetData( const String& rItem, const String& rMimeType, uno::Any & rValue ) const { + ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem); + if(pBkmk) return SwServerObject(*pBkmk).GetData(rValue, rMimeType); + // haben wir ueberhaupt das Item vorraetig? - String sItem( GetAppCharClass().lower( rItem )); + String sItem(GetAppCharClass().lower(rItem)); _FindItem aPara( sItem ); - ((SwBookmarks&)*pBookmarkTbl).ForEach( 0, pBookmarkTbl->Count(), - lcl_FindBookmark, &aPara ); - if( aPara.pBkmk ) - { - // gefunden, als erfrage die Daten - return SwServerObject( *aPara.pBkmk ).GetData( rValue, rMimeType ); - } - ((SwSectionFmts&)*pSectionFmtTbl).ForEach( 0, pSectionFmtTbl->Count(), lcl_FindSection, &aPara ); if( aPara.pSectNd ) @@ -183,16 +172,12 @@ bool SwDoc::GetData( const String& rItem, const String& rMimeType, bool SwDoc::SetData( const String& rItem, const String& rMimeType, const uno::Any & rValue ) { + ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem); + if(pBkmk) return SwServerObject(*pBkmk).SetData(rMimeType, rValue); + // haben wir ueberhaupt das Item vorraetig? - String sItem( GetAppCharClass().lower( rItem )); + String sItem(GetAppCharClass().lower(rItem)); _FindItem aPara( sItem ); - pBookmarkTbl->ForEach( 0, pBookmarkTbl->Count(), lcl_FindBookmark, &aPara ); - if( aPara.pBkmk ) - { - // gefunden, als erfrage die Daten - return SwServerObject( *aPara.pBkmk ).SetData( rMimeType, rValue ); - } - pSectionFmtTbl->ForEach( 0, pSectionFmtTbl->Count(), lcl_FindSection, &aPara ); if( aPara.pSectNd ) { @@ -211,73 +196,48 @@ bool SwDoc::SetData( const String& rItem, const String& rMimeType, -::sfx2::SvLinkSource* SwDoc::CreateLinkSource( const String& rItem ) +::sfx2::SvLinkSource* SwDoc::CreateLinkSource(const String& rItem) { - // haben wir ueberhaupt das Item vorraetig? - String sItem( GetAppCharClass().lower( rItem )); - _FindItem aPara( sItem ); + SwServerObject* pObj = NULL; - SwServerObject* pObj; - - do { // middle check Loop - ((SwBookmarks&)*pBookmarkTbl).ForEach( 0, pBookmarkTbl->Count(), - lcl_FindBookmark, &aPara ); - if( aPara.pBkmk && aPara.pBkmk->GetOtherBookmarkPos() ) - { - // gefunden, also Hotlink einrichten - // sollten wir schon einer sein? - if( 0 == (pObj = aPara.pBkmk->GetObject()) ) - { - pObj = new SwServerObject( *aPara.pBkmk ); - aPara.pBkmk->SetRefObject( pObj ); - } - else if( pObj->HasDataLinks() ) - return pObj; - break; - } - - ((SwSectionFmts&)*pSectionFmtTbl).ForEach( 0, pSectionFmtTbl->Count(), - lcl_FindSection, &aPara ); - if( aPara.pSectNd ) - { - // gefunden, also Hotlink einrichten - // sollten wir schon einer sein? - if( 0 == (pObj = aPara.pSectNd->GetSection().GetObject()) ) - { - pObj = new SwServerObject( *aPara.pSectNd ); - aPara.pSectNd->GetSection().SetRefObject( pObj ); - } - else if( pObj->HasDataLinks() ) - return pObj; - break; - } + // bookmarks + ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, rItem); + if(pBkmk && pBkmk->IsExpanded() + && (0 == (pObj = pBkmk->GetRefObject()))) + { + // mark found, but no link yet -> create hotlink + pObj = new SwServerObject(*pBkmk); + pBkmk->SetRefObject(pObj); + GetLinkManager().InsertServer(pObj); + } + if(pObj) return pObj; - ((SwFrmFmts*)pTblFrmFmtTbl)->ForEach( 0, pTblFrmFmtTbl->Count(), - lcl_FindTable, &aPara ); - if( aPara.pTblNd ) - { - // gefunden, also Hotlink einrichten - // sollten wir schon einer sein? - if( 0 == (pObj = aPara.pTblNd->GetTable().GetObject()) ) - { - pObj = new SwServerObject( *aPara.pTblNd ); - aPara.pTblNd->GetTable().SetRefObject( pObj ); - } - else if( pObj->HasDataLinks() ) - return pObj; - break; - } - // bis hierhin, also nicht vorhanden - return 0; - } while( FALSE ); + _FindItem aPara(GetAppCharClass().lower(rItem)); + // sections + ((SwSectionFmts&)*pSectionFmtTbl).ForEach(0, pSectionFmtTbl->Count(), lcl_FindSection, &aPara); + if(aPara.pSectNd + && (0 == (pObj = aPara.pSectNd->GetSection().GetObject()))) + { + // section found, but no link yet -> create hotlink + pObj = new SwServerObject( *aPara.pSectNd ); + aPara.pSectNd->GetSection().SetRefObject( pObj ); + GetLinkManager().InsertServer(pObj); + } + if(pObj) return pObj; - // neu angelegt also ab in die Verwaltung - GetLinkManager().InsertServer( pObj ); + // tables + ((SwFrmFmts*)pTblFrmFmtTbl)->ForEach(0, pTblFrmFmtTbl->Count(), lcl_FindTable, &aPara); + if(aPara.pTblNd + && (0 == (pObj = aPara.pTblNd->GetTable().GetObject()))) + { + // table found, but no link yet -> create hotlink + pObj = new SwServerObject(*aPara.pTblNd); + aPara.pTblNd->GetTable().SetRefObject(pObj); + GetLinkManager().InsertServer(pObj); + } return pObj; } - - BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, SwNodeRange*& rpRange ) const { @@ -369,23 +329,19 @@ BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam, return FALSE; } + ::sw::mark::DdeBookmark* const pBkmk = lcl_FindDdeBookmark(*pMarkManager, sItem); + if(pBkmk) + { + if(pBkmk->IsExpanded()) + rpPam = new SwPaM( + pBkmk->GetMarkPos(), + pBkmk->GetOtherMarkPos()); + return static_cast<bool>(rpPam); + } + // alte "Mechanik" rCC.toLower( sItem ); _FindItem aPara( sItem ); - if( pBookmarkTbl->Count() ) - { - ((SwBookmarks&)*pBookmarkTbl).ForEach( 0, pBookmarkTbl->Count(), - lcl_FindBookmark, &aPara ); - if( aPara.pBkmk ) - { - // gefunden, also erzeuge einen Bereich - if( aPara.pBkmk->GetOtherBookmarkPos() ) - // ein aufgespannter Bereich - rpPam = new SwPaM( aPara.pBkmk->GetBookmarkPos(), - *aPara.pBkmk->GetOtherBookmarkPos() ); - return 0 != rpPam; - } - } if( pSectionFmtTbl->Count() ) { diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index dc4c33e1c787..95e18a7e78af 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -637,6 +637,8 @@ void SwDoc::InitDrawModel() //Seite. pDrawModel = new SwDrawDocument( this ); + pDrawModel->EnableUndo( DoesUndo() ); + String sLayerNm; sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Hell" )); nHell = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID(); diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 81afd2e0547e..8b4ebe172b6f 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -50,7 +50,7 @@ #include <fmtpdsc.hxx> #include <txtftn.hxx> #include <acorrect.hxx> // Autokorrektur -#include <bookmrk.hxx> // fuer SwBookmark +#include <IMark.hxx> // fuer SwBookmark #include <cntfrm.hxx> // fuers Spell #include <crsrsh.hxx> #include <doc.hxx> @@ -165,7 +165,6 @@ struct _SaveRedline SV_DECL_PTRARR_DEL( _SaveRedlines, _SaveRedline*, 0, 4 ) SV_IMPL_VARARR( _SaveFlyArr, _SaveFly ) -SV_IMPL_PTRARR( SaveBookmarks, SaveBookmark* ) SV_IMPL_PTRARR( _SaveRedlines, _SaveRedline* ) sal_Bool lcl_MayOverwrite( const SwTxtNode *pNode, const xub_StrLen nPos ) @@ -754,7 +753,7 @@ void SwDoc::DeleteSection( SwNode *pNode ) // dann loesche mal alle Fly's, text::Bookmarks, ... DelFlyInRange( aSttIdx, aEndIdx ); DeleteRedline( *pSttNd, true, USHRT_MAX ); - _DelBookmarks( aSttIdx, aEndIdx ); + _DelBookmarks(aSttIdx, aEndIdx); { // alle Crsr/StkCrsr/UnoCrsr aus dem Loeschbereich verschieben @@ -1061,8 +1060,12 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) // here without undo. BOOL bDoesUndo = DoesUndo(); DoUndo( FALSE ); - _DelBookmarks( pStt->nNode, pEnd->nNode, NULL, - &pStt->nContent, &pEnd->nContent ); + _DelBookmarks( + pStt->nNode, + pEnd->nNode, + NULL, + &pStt->nContent, + &pEnd->nContent); DoUndo( bDoesUndo ); } @@ -1137,9 +1140,13 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) // kopiere alle Bookmarks, die im Move Bereich stehen in ein // Array, das alle Angaben auf die Position als Offset speichert. // Die neue Zuordung erfolgt nach dem Moven. - SaveBookmarks aSaveBkmk; - _DelBookmarks( pStt->nNode, pEnd->nNode, &aSaveBkmk, - &pStt->nContent, &pEnd->nContent ); + ::std::vector< ::sw::mark::SaveBookmark> aSaveBkmks; + _DelBookmarks( + pStt->nNode, + pEnd->nNode, + &aSaveBkmks, + &pStt->nContent, + &pEnd->nContent); // falls durch die vorherigen Loeschungen (z.B. der Fussnoten) kein // Bereich mehr existiert, ist das immernoch ein gueltiger Move! @@ -1241,9 +1248,14 @@ bool SwDoc::Move( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) // setze jetzt wieder die text::Bookmarks in das Dokument *rPaM.GetMark() = *pSavePam->Start(); - for( sal_uInt16 n = 0; n < aSaveBkmk.Count(); ++n ) - aSaveBkmk[n]->SetInDoc( this, rPaM.GetMark()->nNode, - &rPaM.GetMark()->nContent ); + for( + ::std::vector< ::sw::mark::SaveBookmark>::iterator pBkmk = aSaveBkmks.begin(); + pBkmk != aSaveBkmks.end(); + ++pBkmk) + pBkmk->SetInDoc( + this, + rPaM.GetMark()->nNode, + &rPaM.GetMark()->nContent); *rPaM.GetPoint() = *pSavePam->End(); // verschiebe die Flys an die neue Position @@ -1320,8 +1332,8 @@ bool SwDoc::Move( SwNodeRange& rRange, SwNodeIndex& rPos, SwMoveFlags eMvFlags ) // kopiere alle Bookmarks, die im Move Bereich stehen in ein // Array, das alle Angaben auf die Position als Offset speichert. // Die neue Zuordung erfolgt nach dem Moven. - SaveBookmarks aSaveBkmk; - _DelBookmarks( rRange.aStart, rRange.aEnd, &aSaveBkmk ); + ::std::vector< ::sw::mark::SaveBookmark> aSaveBkmks; + _DelBookmarks(rRange.aStart, rRange.aEnd, &aSaveBkmks); // sicher die absatzgebundenen Flys, damit verschoben werden koennen. _SaveFlyArr aSaveFlyArr; @@ -1354,8 +1366,11 @@ bool SwDoc::Move( SwNodeRange& rRange, SwNodeIndex& rPos, SwMoveFlags eMvFlags ) _RestFlyInRange( aSaveFlyArr, aIdx, NULL ); // setze jetzt wieder die text::Bookmarks in das Dokument - for( sal_uInt16 nCnt = 0; nCnt < aSaveBkmk.Count(); ++nCnt ) - aSaveBkmk[nCnt]->SetInDoc( this, aIdx ); + for( + ::std::vector< ::sw::mark::SaveBookmark>::iterator pBkmk = aSaveBkmks.begin(); + pBkmk != aSaveBkmks.end(); + ++pBkmk) + pBkmk->SetInDoc(this, aIdx); if( aSavRedlInsPosArr.Count() ) { @@ -1723,10 +1738,14 @@ bool SwDoc::Delete( SwPaM & rPam ) DeleteRedline( rPam, true, USHRT_MAX ); // loesche und verschiebe erstmal alle "Fly's am Absatz", die in der - // SSelection liegen - DelFlyInRange( rPam.GetMark()->nNode, rPam.GetPoint()->nNode ); - _DelBookmarks( pStt->nNode, pEnd->nNode, 0, - &pStt->nContent, &pEnd->nContent ); + // Selection liegen + DelFlyInRange(rPam.GetMark()->nNode, rPam.GetPoint()->nNode); + _DelBookmarks( + pStt->nNode, + pEnd->nNode, + NULL, + &pStt->nContent, + &pEnd->nContent); SwNodeIndex aSttIdx( pStt->nNode ); SwCntntNode * pCNd = aSttIdx.GetNode().GetCntntNode(); @@ -2224,16 +2243,16 @@ bool SwDoc::Replace( SwPaM& rPam, const String& rStr, bool bRegExpRplc ) StartUndo(UNDO_EMPTY, NULL); // Bug 68584 - if any Redline will change (split!) the node - String sNm; sNm = String::CreateFromInt32( (long)&aDelPam ); - SwBookmark* pBkmk = makeBookmark( aDelPam, KeyCode(), sNm, sNm, UNO_BOOKMARK ); + const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK ); - //JP 06.01.98: MUSS noch optimiert werden!!! - SetRedlineMode( - (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE )); + //JP 06.01.98: MUSS noch optimiert werden!!! + SetRedlineMode( + (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE )); - *aDelPam.GetPoint() = pBkmk->GetBookmarkPos(); - *aDelPam.GetMark() = *pBkmk->GetOtherBookmarkPos(); - deleteBookmark( getBookmarks().GetPos( pBkmk )); + *aDelPam.GetPoint() = pBkmk->GetMarkPos(); + if(pBkmk->IsExpanded()) + *aDelPam.GetMark() = pBkmk->GetOtherMarkPos(); + getIDocumentMarkAccess()->deleteMark(pBkmk); pStt = aDelPam.Start(); pTxtNd = pStt->nNode.GetNode().GetTxtNode(); nStt = pStt->nContent.GetIndex(); @@ -2306,8 +2325,7 @@ bool SwDoc::Replace( SwPaM& rPam, const String& rStr, bool bRegExpRplc ) EndUndo(UNDO_EMPTY, NULL); // Bug 68584 - if any Redline will change (split!) the node - String sNm; sNm = String::CreateFromInt32( (long)&aDelPam ); - SwBookmark* pBkmk = makeBookmark( aDelPam, KeyCode(), sNm, sNm, UNO_BOOKMARK ); + const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK ); SwIndex& rIdx = aDelPam.GetPoint()->nContent; rIdx.Assign( 0, 0 ); @@ -2318,9 +2336,10 @@ bool SwDoc::Replace( SwPaM& rPam, const String& rStr, bool bRegExpRplc ) //JP 06.01.98: MUSS noch optimiert werden!!! SetRedlineMode( eOld ); - *rPam.GetPoint() = pBkmk->GetBookmarkPos(); - *rPam.GetMark() = *pBkmk->GetOtherBookmarkPos(); - deleteBookmark( getBookmarks().GetPos( pBkmk )); + *rPam.GetPoint() = pBkmk->GetMarkPos(); + if(pBkmk->IsExpanded()) + *rPam.GetMark() = pBkmk->GetOtherMarkPos(); + getIDocumentMarkAccess()->deleteMark(pBkmk); } bJoinTxt = sal_False; } diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 917f78ee36cb..ace606ae86ac 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -120,6 +120,7 @@ USHORT SwDoc::GetFlyCount( FlyCntType eType ) const /*-----------------17.02.98 08:35------------------- --------------------------------------------------*/ +// If you change this, also update SwXFrameEnumeration in unocoll. SwFrmFmt* SwDoc::GetFlyNum( USHORT nIdx, FlyCntType eType ) { SwSpzFrmFmts& rFmts = *GetSpzFrmFmts(); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index c036bcbe28da..caa4987c6f04 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -2028,24 +2028,34 @@ void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr, // pDest->CopyAttrs( *pSrc, TRUE ); // kopiere Attribute //JP 19.02.96: ist so wohl optimaler - loest ggfs. kein Modify aus! pDest->DelDiffs( *pSrc ); - pDest->SetFmtAttr( pSrc->GetAttrSet() ); // kopiere Attribute - - //JP 18.08.98: Bug 55115 - PageDescAttribute in diesem Fall doch - // kopieren + // --> OD 2009-03-23 #i94285# + // copy existing <SwFmtPageDesc> instance, before copying attributes +// pDest->SetFmtAttr( pSrc->GetAttrSet() ); // kopiere Attribute + //JP 18.08.98: Bug 55115 - copy PageDescAttribute in this case const SfxPoolItem* pItem; if( &GetAttrPool() != pSrc->GetAttrSet().GetPool() && SFX_ITEM_SET == pSrc->GetAttrSet().GetItemState( RES_PAGEDESC, FALSE, &pItem ) && ((SwFmtPageDesc*)pItem)->GetPageDesc() ) { - SwFmtPageDesc aDesc( *(SwFmtPageDesc*)pItem ); - const String& rNm = aDesc.GetPageDesc()->GetName(); - SwPageDesc* pDesc = ::lcl_FindPageDesc( aPageDescs, rNm ); - if( !pDesc ) - pDesc = aPageDescs[ MakePageDesc( rNm ) ]; - pDesc->Add( &aDesc ); - pDest->SetFmtAttr( aDesc ); + SwFmtPageDesc aPageDesc( *(SwFmtPageDesc*)pItem ); + const String& rNm = aPageDesc.GetPageDesc()->GetName(); + SwPageDesc* pPageDesc = ::lcl_FindPageDesc( aPageDescs, rNm ); + if( !pPageDesc ) + { + pPageDesc = aPageDescs[ MakePageDesc( rNm ) ]; + } + pPageDesc->Add( &aPageDesc ); +// pDest->SetFmtAttr( aPageDesc ); + SwAttrSet aTmpAttrSet( pSrc->GetAttrSet() ); + aTmpAttrSet.Put( aPageDesc ); + pDest->SetFmtAttr( aTmpAttrSet ); } + else + { + pDest->SetFmtAttr( pSrc->GetAttrSet() ); + } + // <-- pDest->SetPoolFmtId( pSrc->GetPoolFmtId() ); pDest->SetPoolHelpId( pSrc->GetPoolHelpId() ); diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 77c4aad3b015..29258f9de72e 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -1855,12 +1855,11 @@ IMPL_LINK( SwDoc, DoIdleJobs, Timer *, pTimer ) { BOOL bIsOnlineSpell = pSh->GetViewOptions()->IsOnlineSpell(); - // right now we don't have view options for automatic grammar checking. Thus... sal_Bool bIsAutoGrammar = sal_False; SvtLinguConfig().GetProperty( C2U( UPN_IS_GRAMMAR_AUTO ) ) >>= bIsAutoGrammar; if (bIsOnlineSpell && bIsAutoGrammar) - StartGrammarChecking( *this, *GetRootFrm() ); + StartGrammarChecking( *this ); } sal_uInt16 nFldUpdFlag; diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index f469a03b5c24..a0348d84b352 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -105,6 +105,7 @@ #include <istyleaccess.hxx> #include <swstylemanager.hxx> #include <IGrammarContact.hxx> +#include <MarkManager.hxx> #include <unochart.hxx> @@ -172,24 +173,17 @@ SV_IMPL_PTRARR( SwGrfFmtColls, SwGrfFmtCollPtr) return m_xGCIterator; } -void StartGrammarChecking( SwDoc &rDoc, SwRootFrm &rRootFrame ) +void StartGrammarChecking( SwDoc &rDoc ) { -// if (rRootFrame.IsGrammarCheckActive()) -// return; - uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( rDoc.GetGCIterator() ); if ( xGCIterator.is() ) { uno::Reference< lang::XComponent > xDoc( rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY ); uno::Reference< text::XFlatParagraphIteratorProvider > xFPIP( xDoc, uno::UNO_QUERY ); - // start automatic background checking + // start automatic background checking if not active already if ( xFPIP.is() && !xGCIterator->isProofreading( xDoc ) ) - { - // rRootFrame.SetNeedGrammarCheck( false ); - rRootFrame.SetGrammarCheckActive( true ); xGCIterator->startProofreading( xDoc, xFPIP ); - } } } @@ -218,6 +212,7 @@ SwDoc::SwDoc() : aNodes( this ), aUndoNodes( this ), mpAttrPool(new SwAttrPool(this)), + pMarkManager(new ::sw::mark::MarkManager(*this)), pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ), pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ), pColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, pDfltFrmFmt ) ), @@ -231,7 +226,6 @@ SwDoc::SwDoc() : pTblFrmFmtTbl( new SwFrmFmts() ), pTxtFmtCollTbl( new SwTxtFmtColls() ), pGrfFmtCollTbl( new SwGrfFmtColls() ), - pBookmarkTbl( new SwBookmarks( 0, 16 ) ), pTOXTypes( new SwTOXTypes() ), pDefTOXBases( new SwDefTOXBase_Impl() ), pLayout( 0 ), // Rootframe des spezifischen Layouts. @@ -570,7 +564,7 @@ SwDoc::~SwDoc() // in den BookMarks sind Indizies auf den Content. Diese muessen vorm // loesche der Nodes geloescht werden. - pBookmarkTbl->DeleteAndDestroy( 0, pBookmarkTbl->Count() ); + pMarkManager->clearAllMarks(); DELETEZ( pMacroTable ); if( pExtInputRing ) @@ -695,7 +689,6 @@ SwDoc::~SwDoc() // <-- delete pPrtData; - delete pBookmarkTbl; delete pNumberFormatter; delete pFtnInfo; delete pEndNoteInfo; @@ -830,7 +823,7 @@ void SwDoc::ClearDoc() // in den BookMarks sind Indizies auf den Content. Diese muessen vorm // loesche der Nodes geloescht werden. - pBookmarkTbl->DeleteAndDestroy( 0, pBookmarkTbl->Count() ); + pMarkManager->clearAllMarks(); pTOXTypes->DeleteAndDestroy( 0, pTOXTypes->Count() ); // create a dummy pagedesc for the layout diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index cfe83500bed1..e23f56bab386 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -3588,6 +3588,9 @@ void SwRedline::MoveFromSection() } } + // --> OD 2009-03-17 #i95711# + const SwNode* pKeptCntntSectNode( &pCntntSect->GetNode() ); + // <-- { SwPaM aPam( pCntntSect->GetNode(), *pCntntSect->GetNode().EndOfSectionNode(), 1, @@ -3633,7 +3636,19 @@ void SwRedline::MoveFromSection() if( pColl && pCNd ) pCNd->ChgFmtColl( pColl ); } - pDoc->DeleteSection( &pCntntSect->GetNode() ); + // --> OD 2009-03-17 #i95771# + // Under certain conditions the previous <SwDoc::Move(..)> has already + // remove the change tracking section of this <SwRedline> instance from + // the change tracking nodes area. + // Thus, check, if <pCntntSect> still points to the change tracking section + // by comparing it with the "indexed" <SwNode> instance copied before + // perform the intrinsic move. + // Note: Such condition is e.g. a "delete" change tracking only containing a table. + if ( &pCntntSect->GetNode() == pKeptCntntSectNode ) + { + pDoc->DeleteSection( &pCntntSect->GetNode() ); + } + // <-- delete pCntntSect, pCntntSect = 0; // #100611# adjustment of redline table positions must take start and diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 48a47ab52e3e..ba65939c5a91 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -182,13 +182,13 @@ USHORT SwDoc::GetCurTOXMark( const SwPosition& rPos, Beschreibung: Marke loeschen --------------------------------------------------------------------*/ -void SwDoc::Delete( SwTOXMark* pTOXMark ) +void SwDoc::Delete( const SwTOXMark* pTOXMark ) { // hole den TextNode und - SwTxtTOXMark* pTxtTOXMark = pTOXMark->GetTxtTOXMark(); + const SwTxtTOXMark* pTxtTOXMark = pTOXMark->GetTxtTOXMark(); ASSERT( pTxtTOXMark, "Kein TxtTOXMark, kann nicht geloescht werden" ); - SwTxtNode& rTxtNd = (SwTxtNode&)pTxtTOXMark->GetTxtNode(); + SwTxtNode& rTxtNd = const_cast<SwTxtNode&>(pTxtTOXMark->GetTxtNode()); ASSERT( rTxtNd.GetpSwpHints(), "kann nicht geloescht werden" ); if( DoesUndo() ) @@ -202,12 +202,12 @@ void SwDoc::Delete( SwTOXMark* pTOXMark ) SwRegHistory aRHst( rTxtNd, pUndo->GetHistory() ); rTxtNd.GetpSwpHints()->Register( &aRHst ); - rTxtNd.Delete( pTxtTOXMark, TRUE ); + rTxtNd.Delete( const_cast<SwTxtTOXMark*>( pTxtTOXMark ), TRUE ); if( rTxtNd.GetpSwpHints() ) rTxtNd.GetpSwpHints()->DeRegister(); } else - rTxtNd.Delete( pTxtTOXMark, TRUE ); + rTxtNd.Delete( const_cast<SwTxtTOXMark*>( pTxtTOXMark ), TRUE ); SetModified(); } diff --git a/sw/source/core/doc/makefile.mk b/sw/source/core/doc/makefile.mk index 64509330398c..9e01f6ff1e80 100644 --- a/sw/source/core/doc/makefile.mk +++ b/sw/source/core/doc/makefile.mk @@ -46,6 +46,7 @@ EXCEPTIONSFILES = \ $(SLO)$/acmplwrd.obj \ $(SLO)$/dbgoutsw.obj \ $(SLO)$/doc.obj \ + $(SLO)$/docbm.obj \ $(SLO)$/doccomp.obj \ $(SLO)$/docdraw.obj \ $(SLO)$/docfmt.obj \ @@ -60,35 +61,34 @@ EXCEPTIONSFILES = \ $(SLO)$/number.obj \ $(SLO)$/swstylemanager.obj \ $(SLO)$/tblcpy.obj \ - $(SLO)$/tblrwcl.obj \ - $(SLO)$/list.obj + $(SLO)$/tblrwcl.obj \ + $(SLO)$/list.obj SLOFILES = $(EXCEPTIONSFILES) \ - $(SLO)$/docbasic.obj \ - $(SLO)$/docbm.obj \ - $(SLO)$/docchart.obj \ - $(SLO)$/doccorr.obj \ - $(SLO)$/docdde.obj \ - $(SLO)$/docdesc.obj \ - $(SLO)$/docedt.obj \ - $(SLO)$/docfld.obj \ - $(SLO)$/docfly.obj \ - $(SLO)$/docftn.obj \ - $(SLO)$/docredln.obj \ - $(SLO)$/docruby.obj \ - $(SLO)$/docstat.obj \ - $(SLO)$/extinput.obj \ - $(SLO)$/fmtcol.obj \ - $(SLO)$/ftnidx.obj \ - $(SLO)$/gctable.obj \ - $(SLO)$/lineinfo.obj \ - $(SLO)$/notxtfrm.obj \ - $(SLO)$/poolfmt.obj \ - $(SLO)$/sortopt.obj \ - $(SLO)$/swserv.obj \ - $(SLO)$/tblafmt.obj \ - $(SLO)$/visiturl.obj \ - $(SLO)$/htmltbl.obj + $(SLO)$/docbasic.obj \ + $(SLO)$/docchart.obj \ + $(SLO)$/doccorr.obj \ + $(SLO)$/docdde.obj \ + $(SLO)$/docdesc.obj \ + $(SLO)$/docedt.obj \ + $(SLO)$/docfld.obj \ + $(SLO)$/docfly.obj \ + $(SLO)$/docftn.obj \ + $(SLO)$/docredln.obj \ + $(SLO)$/docruby.obj \ + $(SLO)$/docstat.obj \ + $(SLO)$/extinput.obj \ + $(SLO)$/fmtcol.obj \ + $(SLO)$/ftnidx.obj \ + $(SLO)$/gctable.obj \ + $(SLO)$/lineinfo.obj \ + $(SLO)$/notxtfrm.obj \ + $(SLO)$/poolfmt.obj \ + $(SLO)$/sortopt.obj \ + $(SLO)$/swserv.obj \ + $(SLO)$/tblafmt.obj \ + $(SLO)$/visiturl.obj \ + $(SLO)$/htmltbl.obj # --- Tagets ------------------------------------------------------- diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index 9cc0cfb2c0a7..5df20bfa2a74 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -40,6 +40,7 @@ #include <swserv.hxx> #include <swbaslnk.hxx> #include <mvsave.hxx> +#include <IMark.hxx> #include <bookmrk.hxx> #include <pam.hxx> #include <shellio.hxx> @@ -57,7 +58,7 @@ SwServerObject::~SwServerObject() BOOL SwServerObject::GetData( uno::Any & rData, - const String & rMimeType, BOOL ) + const String & rMimeType, BOOL ) { BOOL bRet = FALSE; WriterRef xWrt; @@ -79,17 +80,17 @@ BOOL SwServerObject::GetData( uno::Any & rData, switch( eType ) { case BOOKMARK_SERVER: - if( CNTNT_TYPE.pBkmk->GetOtherBookmarkPos() ) + if( CNTNT_TYPE.pBkmk->IsExpanded() ) { // Bereich aufspannen - pPam = new SwPaM( CNTNT_TYPE.pBkmk->GetBookmarkPos(), - *CNTNT_TYPE.pBkmk->GetOtherBookmarkPos() ); + pPam = new SwPaM( CNTNT_TYPE.pBkmk->GetMarkPos(), + CNTNT_TYPE.pBkmk->GetOtherMarkPos() ); } break; case TABLE_SERVER: pPam = new SwPaM( *CNTNT_TYPE.pTblNd, - *CNTNT_TYPE.pTblNd->EndOfSectionNode() ); + *CNTNT_TYPE.pTblNd->EndOfSectionNode() ); break; case SECTION_SERVER: @@ -140,19 +141,17 @@ void SwServerObject::SendDataChanged( const SwPosition& rPos ) const SwStartNode* pNd = 0; switch( eType ) { - case BOOKMARK_SERVER: - if( CNTNT_TYPE.pBkmk->GetOtherBookmarkPos() ) - { - SwBookmark& rBkmk = *CNTNT_TYPE.pBkmk; - bCall = rBkmk.GetBookmarkPos() < *rBkmk.GetOtherBookmarkPos() - ? ( rBkmk.GetBookmarkPos() <= rPos && rPos < *rBkmk.GetOtherBookmarkPos() ) - : ( *rBkmk.GetOtherBookmarkPos() <= rPos && rPos < rBkmk.GetBookmarkPos() ); - } - break; + case BOOKMARK_SERVER: + if( CNTNT_TYPE.pBkmk->IsExpanded() ) + { + bCall = CNTNT_TYPE.pBkmk->GetMarkStart() <= rPos + && rPos < CNTNT_TYPE.pBkmk->GetMarkEnd(); + } + break; - case TABLE_SERVER: pNd = CNTNT_TYPE.pTblNd; break; - case SECTION_SERVER: pNd = CNTNT_TYPE.pSectNd; break; - case NONE_SERVER: break; + case TABLE_SERVER: pNd = CNTNT_TYPE.pTblNd; break; + case SECTION_SERVER: pNd = CNTNT_TYPE.pSectNd; break; + case NONE_SERVER: break; } if( pNd ) { @@ -185,18 +184,10 @@ void SwServerObject::SendDataChanged( const SwPaM& rRange ) switch( eType ) { case BOOKMARK_SERVER: - if( CNTNT_TYPE.pBkmk->GetOtherBookmarkPos() ) + if(CNTNT_TYPE.pBkmk->IsExpanded()) { - SwBookmark& rBkmk = *CNTNT_TYPE.pBkmk; - const SwPosition* pBkStt = &rBkmk.GetBookmarkPos(), - * pBkEnd = rBkmk.GetOtherBookmarkPos(); - if( *pBkStt > *pBkEnd ) - { - const SwPosition* pTmp = pBkStt; - pBkStt = pBkEnd; - pBkEnd = pTmp; - } - bCall = *pStt <= *pBkEnd && *pEnd > *pBkStt; + bCall = *pStt <= CNTNT_TYPE.pBkmk->GetMarkEnd() + && *pEnd > CNTNT_TYPE.pBkmk->GetMarkStart(); } break; @@ -236,17 +227,10 @@ BOOL SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const switch( eType ) { case BOOKMARK_SERVER: - if( CNTNT_TYPE.pBkmk->GetOtherBookmarkPos() ) + if( CNTNT_TYPE.pBkmk->IsExpanded() ) { - SwBookmark& rBkmk = *CNTNT_TYPE.pBkmk; - const SwPosition* pStt = &rBkmk.GetBookmarkPos(), - * pEnd = rBkmk.GetOtherBookmarkPos(); - if( *pStt > *pEnd ) - { - const SwPosition* pTmp = pStt; - pStt = pEnd; - pEnd = pTmp; - } + const SwPosition* pStt = &CNTNT_TYPE.pBkmk->GetMarkStart(), + * pEnd = &CNTNT_TYPE.pBkmk->GetMarkEnd(); nSttNd = pStt->nNode.GetIndex(); nStt = pStt->nContent.GetIndex(); @@ -310,6 +294,31 @@ if( !pChkLnk ) return FALSE; } +void SwServerObject::SetNoServer() +{ + if(eType == BOOKMARK_SERVER && CNTNT_TYPE.pBkmk) + { + ::sw::mark::DdeBookmark* const pDdeBookmark = dynamic_cast< ::sw::mark::DdeBookmark* >(CNTNT_TYPE.pBkmk); + if(pDdeBookmark) pDdeBookmark->SetRefObject(NULL); + } + CNTNT_TYPE.pBkmk = 0, eType = NONE_SERVER; +} + +void SwServerObject::SetDdeBookmark( ::sw::mark::IMark& rBookmark) +{ + ::sw::mark::DdeBookmark* const pDdeBookmark = dynamic_cast< ::sw::mark::DdeBookmark* >(&rBookmark); + if(pDdeBookmark) + { + eType = BOOKMARK_SERVER; + CNTNT_TYPE.pBkmk = &rBookmark; + pDdeBookmark->SetRefObject(this); + } + else + OSL_ENSURE(false, + "SwServerObject::SetNoServer(..)" + " - setting an bookmark that is not DDE-capable"); +} + /* */ @@ -328,7 +337,6 @@ SwDataChanged::SwDataChanged( SwDoc* pDc, const SwPosition& rPos, USHORT nTyp ) nCntnt = rPos.nContent.GetIndex(); } - SwDataChanged::~SwDataChanged() { // JP 09.04.96: nur wenn das Layout vorhanden ist ( also waehrend der @@ -361,7 +369,3 @@ SwDataChanged::~SwDataChanged() } } } - - - - diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index b0f183939cbe..3f8280070d37 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -47,7 +47,7 @@ #include <swtable.hxx> #include <ddefld.hxx> #include <undobj.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <mvsave.hxx> #include <cellatr.hxx> #include <swtblfmt.hxx> @@ -69,6 +69,144 @@ #endif #endif +namespace +{ + /* + The lcl_CopyBookmarks function has to copy bookmarks from the source to the destination nodes + array. It is called after a call of the _CopyNodes(..) function. But this function does not copy + every node (at least at the moment: 2/08/2006 ), section start and end nodes will not be copied if the corresponding end/start node is outside the copied pam. + The lcl_NonCopyCount function counts the number of these nodes, given the copied pam and a node + index inside the pam. + rPam is the original source pam, rLastIdx is the last calculated position, rDelCount the number + of "non-copy" nodes between rPam.Start() and rLastIdx. + nNewIdx is the new position of interest. + */ + + static void lcl_NonCopyCount( const SwPaM& rPam, SwNodeIndex& rLastIdx, const ULONG nNewIdx, ULONG& rDelCount ) + { + ULONG nStart = rPam.Start()->nNode.GetIndex(); + ULONG nEnd = rPam.End()->nNode.GetIndex(); + if( rLastIdx.GetIndex() < nNewIdx ) // Moving forward? + { + do // count "non-copy" nodes + { + SwNode& rNode = rLastIdx.GetNode(); + if( ( rNode.IsSectionNode() && rNode.EndOfSectionIndex() >= nEnd ) + || ( rNode.IsEndNode() && rNode.StartOfSectionNode()->GetIndex() < nStart ) ) + ++rDelCount; + rLastIdx++; + } + while( rLastIdx.GetIndex() < nNewIdx ); + } + else if( rDelCount ) // optimization: if there are no "non-copy" nodes until now, + // no move backward needed + { + while( rLastIdx.GetIndex() > nNewIdx ) + { + SwNode& rNode = rLastIdx.GetNode(); + if( ( rNode.IsSectionNode() && rNode.EndOfSectionIndex() >= nEnd ) + || ( rNode.IsEndNode() && rNode.StartOfSectionNode()->GetIndex() < nStart ) ) + --rDelCount; + rLastIdx--; + } + } + } + + static void lcl_SetCpyPos( const SwPosition& rOrigPos, + const SwPosition& rOrigStt, + const SwPosition& rCpyStt, + SwPosition& rChgPos, + ULONG nDelCount ) + { + ULONG nNdOff = rOrigPos.nNode.GetIndex(); + nNdOff -= rOrigStt.nNode.GetIndex(); + nNdOff -= nDelCount; + xub_StrLen nCntntPos = rOrigPos.nContent.GetIndex(); + + // --> OD, AMA 2008-07-07 #b6713815# + // Always adjust <nNode> at to be changed <SwPosition> instance <rChgPos> + rChgPos.nNode = nNdOff + rCpyStt.nNode.GetIndex(); + if( !nNdOff ) + // <-- + { + // dann nur den Content anpassen + if( nCntntPos > rOrigStt.nContent.GetIndex() ) + nCntntPos = nCntntPos - rOrigStt.nContent.GetIndex(); + else + nCntntPos = 0; + nCntntPos = nCntntPos + rCpyStt.nContent.GetIndex(); + } + rChgPos.nContent.Assign( rChgPos.nNode.GetNode().GetCntntNode(), nCntntPos ); + } + + // TODO: use SaveBookmark (from _DelBookmarks) + static void lcl_CopyBookmarks(const SwPaM& rPam, SwPaM& rCpyPam) + { + const SwDoc* pSrcDoc = rPam.GetDoc(); + SwDoc* pDestDoc = rCpyPam.GetDoc(); + const IDocumentMarkAccess* const pSrcMarkAccess = pSrcDoc->getIDocumentMarkAccess(); + bool bDoesUndo = pDestDoc->DoesUndo(); + pDestDoc->DoUndo(false); + + const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End(); + SwPosition* pCpyStt = rCpyPam.Start(); + + typedef ::std::vector< const ::sw::mark::IMark* > mark_vector_t; + mark_vector_t vMarksToCopy; + for(IDocumentMarkAccess::const_iterator_t ppMark = pSrcMarkAccess->getMarksBegin(); + ppMark != pSrcMarkAccess->getMarksEnd(); + ppMark++) + { + const ::sw::mark::IMark* const pMark = ppMark->get(); + const SwPosition& rMarkStart = pMark->GetMarkStart(); + const SwPosition& rMarkEnd = pMark->GetMarkEnd(); + // only include marks that are in the range and not touching + // both start and end + bool bIsNotOnBoundary = pMark->IsExpanded() + ? (rMarkStart != rStt || rMarkEnd != rEnd) // rMarkStart != rMarkEnd + : (rMarkStart != rStt && rMarkEnd != rEnd); // rMarkStart == rMarkEnd + if(rMarkStart >= rStt && rMarkEnd <= rEnd && bIsNotOnBoundary) + { + vMarksToCopy.push_back(pMark); + } + } + // We have to count the "non-copied" nodes.. + SwNodeIndex aCorrIdx(rStt.nNode); + ULONG nDelCount = 0; + for(mark_vector_t::const_iterator ppMark = vMarksToCopy.begin(); + ppMark != vMarksToCopy.end(); + ++ppMark) + { + const ::sw::mark::IMark* const pMark = *ppMark; + SwPaM aTmpPam(*pCpyStt); + lcl_NonCopyCount(rPam, aCorrIdx, pMark->GetMarkPos().nNode.GetIndex(), nDelCount); + lcl_SetCpyPos( pMark->GetMarkPos(), rStt, *pCpyStt, *aTmpPam.GetPoint(), nDelCount); + if(pMark->IsExpanded()) + { + aTmpPam.SetMark(); + lcl_NonCopyCount(rPam, aCorrIdx, pMark->GetOtherMarkPos().nNode.GetIndex(), nDelCount); + lcl_SetCpyPos(pMark->GetOtherMarkPos(), rStt, *pCpyStt, *aTmpPam.GetMark(), nDelCount); + } + + ::sw::mark::IMark* const pNewMark = pDestDoc->getIDocumentMarkAccess()->makeMark( + aTmpPam, + pMark->GetName(), + IDocumentMarkAccess::GetType(*pMark)); + // Explicitly try to get exactly the same name as in the source + // because NavigatorReminders, DdeBookmarks etc. ignore the proposed name + pDestDoc->getIDocumentMarkAccess()->renameMark(pNewMark, pMark->GetName()); + ::sw::mark::IBookmark* const pNewBookmark = + dynamic_cast< ::sw::mark::IBookmark* const >(pNewMark); + if(pNewBookmark) /* copying additional attributes for bookmarks */ + { + const ::sw::mark::IBookmark* const pOldBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(pMark); + pNewBookmark->SetKeyCode(pOldBookmark->GetKeyCode()); + pNewBookmark->SetShortName(pOldBookmark->GetShortName()); + } + } + pDestDoc->DoUndo(bDoesUndo); + } +} // Struktur fuer das Mappen von alten und neuen Frame-Formaten an den // Boxen und Lines einer Tabelle @@ -438,133 +576,6 @@ BOOL lcl_ChkFlyFly( SwDoc* pDoc, ULONG nSttNd, ULONG nEndNd, return FALSE; } -/* - The lcl_CopyBookmarks function has to copy bookmarks from the source to the destination nodes - array. It is called after a call of the _CopyNodes(..) function. But this function does not copy - every node (at least at the moment: 2/08/2006 ), section start and end nodes will not be copied if the corresponding end/start node is outside the copied pam. - The lcl_NonCopyCount function counts the number of these nodes, given the copied pam and a node - index inside the pam. - rPam is the original source pam, rLastIdx is the last calculated position, rDelCount the number - of "non-copy" nodes between rPam.Start() and rLastIdx. - nNewIdx is the new position of interest. -*/ - -void lcl_NonCopyCount( const SwPaM& rPam, SwNodeIndex& rLastIdx, const ULONG nNewIdx, ULONG& rDelCount ) -{ - ULONG nStart = rPam.Start()->nNode.GetIndex(); - ULONG nEnd = rPam.End()->nNode.GetIndex(); - if( rLastIdx.GetIndex() < nNewIdx ) // Moving forward? - { - do // count "non-copy" nodes - { - SwNode& rNode = rLastIdx.GetNode(); - if( ( rNode.IsSectionNode() && rNode.EndOfSectionIndex() >= nEnd ) - || ( rNode.IsEndNode() && rNode.StartOfSectionNode()->GetIndex() < nStart ) ) - ++rDelCount; - rLastIdx++; - } - while( rLastIdx.GetIndex() < nNewIdx ); - } - else if( rDelCount ) // optimization: if there are no "non-copy" nodes until now, - // no move backward needed - { - while( rLastIdx.GetIndex() > nNewIdx ) - { - SwNode& rNode = rLastIdx.GetNode(); - if( ( rNode.IsSectionNode() && rNode.EndOfSectionIndex() >= nEnd ) - || ( rNode.IsEndNode() && rNode.StartOfSectionNode()->GetIndex() < nStart ) ) - --rDelCount; - rLastIdx--; - } - } -} - -void lcl_SetCpyPos( const SwPosition& rOrigPos, - const SwPosition& rOrigStt, - const SwPosition& rCpyStt, - SwPosition& rChgPos, - ULONG nDelCount ) -{ - ULONG nNdOff = rOrigPos.nNode.GetIndex(); - nNdOff -= rOrigStt.nNode.GetIndex(); - nNdOff -= nDelCount; - xub_StrLen nCntntPos = rOrigPos.nContent.GetIndex(); - - // --> OD, AMA 2008-07-07 #b6713815# - // Always adjust <nNode> at to be changed <SwPosition> instance <rChgPos> - rChgPos.nNode = nNdOff + rCpyStt.nNode.GetIndex(); - if( !nNdOff ) - // <-- - { - // dann nur den Content anpassen - if( nCntntPos > rOrigStt.nContent.GetIndex() ) - nCntntPos = nCntntPos - rOrigStt.nContent.GetIndex(); - else - nCntntPos = 0; - nCntntPos = nCntntPos + rCpyStt.nContent.GetIndex(); - } - rChgPos.nContent.Assign( rChgPos.nNode.GetNode().GetCntntNode(), nCntntPos ); -} - -void lcl_CopyBookmarks( const SwPaM& rPam, SwPaM& rCpyPam ) -{ - const SwDoc* pSrcDoc = rPam.GetDoc(); - SwDoc* pDestDoc = rCpyPam.GetDoc(); - BOOL bDoesUndo = pDestDoc->DoesUndo(); - pDestDoc->DoUndo( FALSE ); - - const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End(); - SwPosition* pCpyStt = rCpyPam.Start(); - - const SwBookmark* pBkmk; - // We have to count the "non-copied" nodes.. - ULONG nDelCount = 0; - SwNodeIndex aCorrIdx( rStt.nNode ); - std::vector< const SwBookmark* > aNewBookmarks; - for( USHORT nCnt = pSrcDoc->getBookmarks().Count(); nCnt; ) - { - // liegt auf der Position ?? - if( ( pBkmk = pSrcDoc->getBookmarks()[ --nCnt ])->GetBookmarkPos() < rStt - || pBkmk->GetBookmarkPos() > rEnd ) - continue; - - if( pBkmk->GetOtherBookmarkPos() && ( *pBkmk->GetOtherBookmarkPos() < rStt || - *pBkmk->GetOtherBookmarkPos() > rEnd ) ) - continue; - - bool bMayBe = !pBkmk->GetOtherBookmarkPos() || *pBkmk->GetOtherBookmarkPos() == rEnd || - *pBkmk->GetOtherBookmarkPos() == rStt; - if( bMayBe && ( pBkmk->GetBookmarkPos() == rEnd || pBkmk->GetBookmarkPos() == rStt ) ) - continue; - - aNewBookmarks.push_back( pBkmk ); - } - std::vector< const SwBookmark* >::iterator pBookmark = aNewBookmarks.begin(); - while( pBookmark != aNewBookmarks.end() ) - { - SwPaM aTmpPam( *pCpyStt ); - pBkmk = *pBookmark; - lcl_NonCopyCount( rPam, aCorrIdx, pBkmk->GetBookmarkPos().nNode.GetIndex(), nDelCount ); - lcl_SetCpyPos( pBkmk->GetBookmarkPos(), rStt, *pCpyStt, *aTmpPam.GetPoint(), nDelCount ); - if( pBkmk->GetOtherBookmarkPos() ) - { - aTmpPam.SetMark(); - lcl_NonCopyCount( rPam, aCorrIdx, pBkmk->GetOtherBookmarkPos()->nNode.GetIndex(), nDelCount ); - lcl_SetCpyPos( *pBkmk->GetOtherBookmarkPos(), rStt, *pCpyStt, - *aTmpPam.GetMark(), nDelCount ); - } - - String sNewNm( pBkmk->GetName() ); - if( !pDestDoc->IsCopyIsMove() && - USHRT_MAX != pDestDoc->findBookmark( sNewNm ) ) - pDestDoc->makeUniqueBookmarkName( sNewNm ); - pDestDoc->makeBookmark( aTmpPam, pBkmk->GetKeyCode(), sNewNm, - pBkmk->GetShortName(), pBkmk->GetType() ); - ++pBookmark; - } - pDestDoc->DoUndo( bDoesUndo ); -} - void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam ) { const SwDoc* pSrcDoc = rPam.GetDoc(); @@ -1138,7 +1149,7 @@ BOOL SwDoc::_Copy( SwPaM& rPam, SwPosition& rPos, aCpyPam.Exchange(); // dann kopiere noch alle Bookmarks - if( bCopyBookmarks && getBookmarks().Count() ) + if( bCopyBookmarks && getIDocumentMarkAccess()->getMarksCount() ) lcl_CopyBookmarks( rPam, aCpyPam ); if( nsRedlineMode_t::REDLINE_DELETE_REDLINES & eOld ) @@ -1212,7 +1223,7 @@ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, SwNodeRange aCpyRange( aSavePos, rInsPos ); // dann kopiere noch alle Bookmarks - if( getBookmarks().Count() ) + if( getIDocumentMarkAccess()->getMarksCount() ) { SwPaM aRgTmp( rRg.aStart, rRg.aEnd ); SwPaM aCpyTmp( aCpyRange.aStart, aCpyRange.aEnd ); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 00b4a3ec869c..acd1ceabce9b 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -2112,7 +2112,7 @@ const SwTxtNode *SwNode::GetTxtNode() const */ const IDocumentSettingAccess* SwNode::getIDocumentSettingAccess() const { return GetDoc(); } const IDocumentDeviceAccess* SwNode::getIDocumentDeviceAccess() const { return GetDoc(); } -const IDocumentBookmarkAccess* SwNode::getIDocumentBookmarkAccess() const { return GetDoc(); } +const IDocumentMarkAccess* SwNode::getIDocumentMarkAccess() const { return GetDoc()->getIDocumentMarkAccess(); } const IDocumentRedlineAccess* SwNode::getIDocumentRedlineAccess() const { return GetDoc(); } const IDocumentStylePoolAccess* SwNode::getIDocumentStylePoolAccess() const { return GetDoc(); } const IDocumentLineNumberAccess* SwNode::getIDocumentLineNumberAccess() const { return GetDoc(); } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 57d87d6ae4f4..3ce045994b80 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -62,7 +62,6 @@ #include <swserv.hxx> #include <shellio.hxx> #include <poolfmt.hxx> -#include <bookmrk.hxx> #include <expfld.hxx> #include <swbaslnk.hxx> #include <mvsave.hxx> @@ -1322,7 +1321,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, //und alles dahinter liegende loeschen aIdx--; DelFlyInRange( aIdx, aEndIdx ); - _DelBookmarks( aIdx, aEndIdx ); + _DelBookmarks(aIdx, aEndIdx); aIdx++; pDoc->GetNodes().Delete( aIdx, aEndIdx.GetIndex() - aIdx.GetIndex() ); diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index cb3119d81c04..e75670aa9525 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -43,6 +43,7 @@ #include <svx/svdpagv.hxx> #include <svx/svdviter.hxx> #include <svx/svdview.hxx> +#include <svx/shapepropertynotifier.hxx> // AW, OD 2004-04-30 #i28501# #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> #include <svx/sdr/contact/displayinfo.hxx> @@ -59,6 +60,7 @@ #include <frmfmt.hxx> #include <dflyobj.hxx> #include <dcontact.hxx> +#include <unodraw.hxx> #ifndef IDOCUMENTDRAWMODELACCESS_HXX_INCLUDED #include <IDocumentDrawModelAccess.hxx> #endif @@ -810,6 +812,10 @@ SwDrawContact::SwDrawContact( SwFrmFmt* pToRegisterIn, SdrObject* pObj ) : // OD 2004-03-29 #i26791# pObj->SetUserCall( this ); maAnchoredDrawObj.SetDrawObj( *pObj ); + + // if there already exists an SwXShape for the object, ensure it knows about us, and the SdrObject + // FS 2009-04-07 #i99056# + SwXShape::AddExistingShapeToFmt( *pObj ); } SwDrawContact::~SwDrawContact() @@ -1578,6 +1584,25 @@ void SwDrawContact::_Changed( const SdrObject& rObj, } } +namespace +{ + static const SwFmtAnchor* lcl_getAnchorFmt( const SfxPoolItem& _rItem ) + { + USHORT nWhich = _rItem.Which(); + const SwFmtAnchor* pAnchorFmt = NULL; + if ( RES_ATTRSET_CHG == nWhich ) + { + static_cast<const SwAttrSetChg&>(_rItem).GetChgSet()-> + GetItemState( RES_ANCHOR, FALSE, (const SfxPoolItem**)&pAnchorFmt ); + } + else if ( RES_ANCHOR == nWhich ) + { + pAnchorFmt = &static_cast<const SwFmtAnchor&>(_rItem); + } + return pAnchorFmt; + } +} + /************************************************************************* |* |* SwDrawContact::Modify() @@ -1587,28 +1612,16 @@ void SwDrawContact::_Changed( const SdrObject& rObj, |* |*************************************************************************/ -void SwDrawContact::Modify( SfxPoolItem *, SfxPoolItem *pNew ) +void SwDrawContact::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ) { // OD 10.10.2003 #112299# ASSERT( !mbDisconnectInProgress, "<SwDrawContact::Modify(..)> called during disconnection."); USHORT nWhich = pNew ? pNew->Which() : 0; - SwFmtAnchor* pAnchorFmt = 0L; - if ( RES_ATTRSET_CHG == nWhich ) - { - if ( SFX_ITEM_SET == static_cast<SwAttrSetChg*>(pNew)->GetChgSet()-> - GetItemState( RES_ANCHOR, FALSE, (const SfxPoolItem**)&pAnchorFmt ) ) - { - // <pAnchorFmt> is set and will be handled below - } - } - else if ( RES_ANCHOR == nWhich ) - { - pAnchorFmt = static_cast<SwFmtAnchor*>(pNew); - } + const SwFmtAnchor* pNewAnchorFmt = pNew ? lcl_getAnchorFmt( *pNew ) : NULL; - if ( pAnchorFmt ) + if ( pNewAnchorFmt ) { // JP 10.04.95: nicht auf ein Reset Anchor reagieren !!!!! if ( SFX_ITEM_SET == @@ -1630,10 +1643,18 @@ void SwDrawContact::Modify( SfxPoolItem *, SfxPoolItem *pNew ) // <-- } // re-connect to layout due to anchor format change - ConnectToLayout( pAnchorFmt ); + ConnectToLayout( pNewAnchorFmt ); // notify background of drawing objects lcl_NotifyBackgroundOfObj( *this, *GetMaster(), pOldRect ); NotifyBackgrdOfAllVirtObjs( pOldRect ); + + const SwFmtAnchor* pOldAnchorFmt = pOld ? lcl_getAnchorFmt( *pOld ) : NULL; + if ( !pOldAnchorFmt || ( pOldAnchorFmt->GetAnchorId() != pNewAnchorFmt->GetAnchorId() ) ) + { + ASSERT( maAnchoredDrawObj.DrawObj(), "SwDrawContact::Modify: no draw object here?" ); + if ( maAnchoredDrawObj.DrawObj() ) + maAnchoredDrawObj.DrawObj()->getShapePropertyChangeNotifier().notifyPropertyChange( ::svx::eTextShapeAnchorType ); + } } } else diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index 6fbc5b0cb1df..7d8eeccb3159 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -39,7 +39,7 @@ #include <pam.hxx> #include <swundo.hxx> // fuer die UndoIds #include <edimp.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <docary.hxx> #include <SwRewriter.hxx> #ifndef _UNOBJ_HXX diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index 915117325385..50962cb36bb4 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -1161,8 +1161,8 @@ void SwTableFormula::_SplitMergeBoxNm( const SwTable& rTbl, String& rNewStr, nSttLnPos = SwTableFormula::GetLnPosInTbl( *pTbl, pSttBox ); if( USHRT_MAX != nSttLnPos && USHRT_MAX != nEndLnPos && - rTblUpd.nSplitLine <= nSttLnPos == - rTblUpd.nSplitLine <= nEndLnPos ) + ((rTblUpd.nSplitLine <= nSttLnPos) == + (rTblUpd.nSplitLine <= nEndLnPos)) ) { // bleiben in der gleichen Tabelle bInNewTbl = rTblUpd.nSplitLine <= nEndLnPos && diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index b031ab747ca1..cdb73706b3c2 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1951,6 +1951,12 @@ BOOL SwPostItField::PutValue( const uno::Any& rAny, USHORT nWhichId ) break; case FIELD_PROP_PAR2: ::GetString( rAny, sTxt ); + //#i100374# new string via api, delete complex text object so SwPostItNote picks up the new string + if (mpText) + { + delete mpText; + mpText = 0; + } break; case FIELD_PROP_TEXT: DBG_ERROR("Not implemented!"); diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 4ee023c85489..e9e8644c5eb3 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -59,7 +59,7 @@ #include <txtfrm.hxx> #include <flyfrm.hxx> #include <pagedesc.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> // --> OD 2007-10-18 #i81002# #include <crossrefbookmark.hxx> // <-- @@ -252,13 +252,13 @@ void SwGetRefField::SetSubType( USHORT n ) bool SwGetRefField::IsRefToHeadingCrossRefBookmark() const { return GetSubType() == REF_BOOKMARK && - bookmarkfunc::isHeadingCrossRefBookmarkName( sSetRefName ); + ::sw::mark::CrossRefHeadingBookmark::IsLegalName(sSetRefName); } bool SwGetRefField::IsRefToNumItemCrossRefBookmark() const { return GetSubType() == REF_BOOKMARK && - bookmarkfunc::isNumItemCrossRefBookmarkName( sSetRefName ); + ::sw::mark::CrossRefNumItemBookmark::IsLegalName(sSetRefName); } const SwTxtNode* SwGetRefField::GetReferencedTxtNode() const @@ -869,27 +869,21 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark, case REF_BOOKMARK: { - USHORT nPos = pDoc->findBookmark( rRefMark ); - if( USHRT_MAX != nPos ) + IDocumentMarkAccess::const_iterator_t ppMark = pDoc->getIDocumentMarkAccess()->findMark(rRefMark); + if(ppMark != pDoc->getIDocumentMarkAccess()->getMarksEnd()) { - const SwBookmark& rBkmk = *pDoc->getBookmarks()[ nPos ]; - // --> OD 2007-09-27 #i81002# - refactoring - // simplify by using <SwBookmark::GetBookmarkStart()> -// const SwPosition* pPos = &rBkmk.GetBookmarkPos(); -// if( rBkmk.GetOtherBookmarkPos() && *pPos > *rBkmk.GetOtherBookmarkPos() ) -// pPos = rBkmk.GetOtherBookmarkPos(); - const SwPosition* pPos = rBkmk.BookmarkStart(); - // <-- + const ::sw::mark::IMark* pBkmk = ppMark->get(); + const SwPosition* pPos = &pBkmk->GetMarkStart(); pTxtNd = pDoc->GetNodes()[ pPos->nNode ]->GetTxtNode(); *pStt = pPos->nContent.GetIndex(); - if( pEnd ) + if(pEnd) { - if( !rBkmk.GetOtherBookmarkPos() ) + if(!pBkmk->IsExpanded()) { *pEnd = *pStt; // --> OD 2007-10-18 #i81002# - if ( dynamic_cast<const SwCrossRefBookmark*>(&rBkmk) != 0 ) + if(dynamic_cast< ::sw::mark::CrossRefBookmark const *>(pBkmk)) { ASSERT( pTxtNd, "<SwGetRefFieldType::FindAnchor(..)> - node marked by cross-reference bookmark isn't a text node --> crash" ); @@ -897,16 +891,8 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark, } // <-- } - else if( rBkmk.GetOtherBookmarkPos()->nNode == rBkmk.GetBookmarkPos().nNode ) - { - // --> OD 2007-09-27 #i81002# - refactoring - // simplify by using <SwBookmark::GetBookmarkEnd()> -// *pEnd = rBkmk.GetOtherBookmarkPos() == pPos -// ? rBkmk.GetBookmarkPos().nContent.GetIndex() -// : rBkmk.GetOtherBookmarkPos()->nContent.GetIndex(); - *pEnd = rBkmk.BookmarkEnd()->nContent.GetIndex(); - // <-- - } + else if(pBkmk->GetOtherMarkPos().nNode == pBkmk->GetMarkPos().nNode) + *pEnd = pBkmk->GetMarkEnd().nContent.GetIndex(); else *pEnd = USHRT_MAX; } diff --git a/sw/source/core/fields/textapi.cxx b/sw/source/core/fields/textapi.cxx index 1f9fa5a399e9..2b0c95dd1698 100755 --- a/sw/source/core/fields/textapi.cxx +++ b/sw/source/core/fields/textapi.cxx @@ -43,9 +43,9 @@ using namespace com::sun::star; -const SfxItemPropertyMap* ImplGetSvxTextPortionPropertyMap() +static const SvxItemPropertySet* ImplGetSvxTextPortionPropertySet() { - static const SfxItemPropertyMap aSvxTextPortionPropertyMap[] = + static const SfxItemPropertyMapEntry aSvxTextPortionPropertyMap[] = { SVX_UNOEDIT_CHAR_PROPERTIES, SVX_UNOEDIT_FONT_PROPERTIES, @@ -57,12 +57,12 @@ const SfxItemPropertyMap* ImplGetSvxTextPortionPropertyMap() {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, {0,0,0,0,0,0} }; - - return aSvxTextPortionPropertyMap; + static SvxItemPropertySet aSvxTextPortionPropertySet( aSvxTextPortionPropertyMap ); + return &aSvxTextPortionPropertySet; } SwTextAPIObject::SwTextAPIObject( SwTextAPIEditSource* p ) -: SvxUnoText( p, ImplGetSvxTextPortionPropertyMap(), uno::Reference < text::XText >() ) +: SvxUnoText( p, ImplGetSvxTextPortionPropertySet(), uno::Reference < text::XText >() ) , pSource(p) { } diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx new file mode 100644 index 000000000000..d6d8fd63b9f5 --- /dev/null +++ b/sw/source/core/inc/MarkManager.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: $ + * $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_BOOKMARK_MARKMANAGER_HXX +#define _SW_BOOKMARK_MARKMANAGER_HXX + +#include <IMark.hxx> +#include <IDocumentMarkAccess.hxx> + +namespace sw { namespace mark +{ + class MarkManager + : private ::boost::noncopyable + , virtual public IDocumentMarkAccess + { + public: + MarkManager(/*[in/out]*/ SwDoc& rDoc); + + // IDocumentMarkAccess + virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM, const ::rtl::OUString& rName, IDocumentMarkAccess::MarkType eMark); + virtual ::sw::mark::IMark* getMarkForTxtNode(const SwTxtNode& rTxtNode, IDocumentMarkAccess::MarkType eMark); + + virtual void repositionMark(::sw::mark::IMark* io_pMark, const SwPaM& rPaM); + virtual bool renameMark(::sw::mark::IMark* io_pMark, const ::rtl::OUString& rNewName); + virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset); + virtual void correctMarksRelative(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset); + + virtual void deleteMarks(const SwNodeIndex& rStt, const SwNodeIndex& rEnd, ::std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, const SwIndex* pSttIdx, const SwIndex* pEndIdx); + + // deleters + virtual void deleteMark(const const_iterator_t ppMark); + virtual void deleteMark(const ::sw::mark::IMark* const pMark); + virtual void clearAllMarks(); + + // marks + virtual const_iterator_t getMarksBegin() const; + virtual const_iterator_t getMarksEnd() const; + virtual sal_Int32 getMarksCount() const; + virtual const_iterator_t findMark(const ::rtl::OUString& rName) const; + + // bookmarks + virtual const_iterator_t getBookmarksBegin() const; + virtual const_iterator_t getBookmarksEnd() const; + virtual sal_Int32 getBookmarksCount() const; + virtual const_iterator_t findBookmark(const ::rtl::OUString& rName) const; + + // Fieldmarks + virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& rPos) const; + virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos) const; + virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos) const; + + private: + // make names + ::rtl::OUString getUniqueMarkName(const ::rtl::OUString& rName) const; + void sortMarks(); + + container_t m_vMarks; + container_t m_vBookmarks; + container_t m_vFieldmarks; + SwDoc * const m_pDoc; + }; +}} +#endif diff --git a/sw/source/core/inc/SwXTextDefaults.hxx b/sw/source/core/inc/SwXTextDefaults.hxx index 268902261bee..6fb301c40ab8 100644 --- a/sw/source/core/inc/SwXTextDefaults.hxx +++ b/sw/source/core/inc/SwXTextDefaults.hxx @@ -47,8 +47,8 @@ class SwXTextDefaults : public cppu::WeakImplHelper3 com::sun::star::lang::XServiceInfo > { - SfxItemPropertySet aPropSet; - SwDoc * pDoc; + const SfxItemPropertySet* m_pPropSet; + SwDoc * m_pDoc; public: SwXTextDefaults ( SwDoc * pNewDoc ); ~SwXTextDefaults (); diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx new file mode 100644 index 000000000000..e1344138babf --- /dev/null +++ b/sw/source/core/inc/bookmrk.hxx @@ -0,0 +1,224 @@ +/************************************************************************* + * + * 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 _BOOKMRK_HXX +#define _BOOKMRK_HXX + +#include <IMark.hxx> +#include <boost/scoped_ptr.hpp> +#include <boost/noncopyable.hpp> + +struct SwPosition; // fwd Decl. wg. UI +class SwDoc; + +namespace sw { namespace mark +{ + class MarkBase + : virtual public IMark + , private ::boost::noncopyable + { + public: + //getters + virtual const SwPosition& GetMarkPos() const + { return *m_pPos1; } + virtual const ::rtl::OUString& GetName() const + { return m_aName; } + virtual bool IsCoveringPosition(const SwPosition& rPos) const + { return GetMarkStart() <= rPos && rPos <= GetMarkEnd(); }; + virtual const SwPosition& GetOtherMarkPos() const + { + OSL_PRECOND(IsExpanded(), "<SwPosition::GetOtherMarkPos(..)> - I have no other Pos set." ); + return *m_pPos2; + } + virtual const SwPosition& GetMarkStart() const + { + if(!m_pPos2 /* !IsExpanded()*/) return *m_pPos1; + return *m_pPos1 < *m_pPos2 ? *m_pPos1 : *m_pPos2; + } + virtual const SwPosition& GetMarkEnd() const + { + if(!m_pPos2 /* !IsExpanded()*/ ) return *m_pPos1; + return *m_pPos1 > *m_pPos2 ? *m_pPos1 : *m_pPos2; + } + virtual bool IsExpanded() const + { return m_pPos2; } + + //setters + virtual void SetName(const ::rtl::OUString& rName) + { m_aName = rName; } + virtual void SetMarkPos(const SwPosition& rNewPos); + virtual void SetOtherMarkPos(const SwPosition& rNewPos); + virtual void ClearOtherMarkPos() + { m_pPos2.reset(); } + + virtual void Swap() + { + if(m_pPos2) + m_pPos1.swap(m_pPos2); + } + + virtual void InitDoc(SwDoc* const) + {} + + virtual ~MarkBase(); + protected: + MarkBase(const SwPaM& rPaM, + const ::rtl::OUString& rName); + ::boost::scoped_ptr<SwPosition> m_pPos1; + ::boost::scoped_ptr<SwPosition> m_pPos2; + ::rtl::OUString m_aName; + static ::rtl::OUString GenerateNewName(const ::rtl::OUString& rPrefix); + }; + + class NavigatorReminder + : public MarkBase + , virtual public IMark + { + public: + NavigatorReminder(const SwPaM& rPaM); + private: + static const ::rtl::OUString our_sNamePrefix; + }; + + class UnoMark + : public MarkBase + { + public: + UnoMark(const SwPaM& rPaM); + private: + static const ::rtl::OUString our_sNamePrefix; + }; + + class DdeBookmark + : public MarkBase + { + public: + DdeBookmark(const SwPaM& rPaM); + + //getters + const SwServerObject* GetRefObject() const + { return &m_aRefObj; } + SwServerObject* GetRefObject() + { return &m_aRefObj; } + + bool IsServer() const + { return m_aRefObj.Is(); } + + //setters + void SetRefObject( SwServerObject* pObj ); + + void DeregisterFromDoc(SwDoc* const pDoc); + virtual ~DdeBookmark(); + private: + SwServerObjectRef m_aRefObj; + static const ::rtl::OUString our_sNamePrefix; + }; + + class Bookmark + : virtual public IBookmark + , public DdeBookmark + { + public: + Bookmark(const SwPaM& rPaM, + const KeyCode& rCode, + const ::rtl::OUString& rName, + const ::rtl::OUString& rShortName); + virtual void InitDoc(SwDoc* const io_Doc); + + virtual const ::rtl::OUString& GetShortName() const + { return m_sShortName; } + virtual const KeyCode& GetKeyCode() const + { return m_aCode; } + virtual void SetShortName(const ::rtl::OUString& rShortName) + { m_sShortName = rShortName; } + virtual void SetKeyCode(const KeyCode& rCode) + { m_aCode = rCode; } + private: + KeyCode m_aCode; + ::rtl::OUString m_sShortName; + }; + + class Fieldmark + : virtual public IFieldmark + , public MarkBase + { + public: + Fieldmark(const SwPaM& rPaM); + + // getters + ::rtl::OUString GetFieldname() const + { return m_aFieldname; } + ::rtl::OUString GetFieldHelptext() const + { return m_aFieldHelptext; } + + // setters + void SetFieldname(const ::rtl::OUString& aFieldname) + { m_aFieldname = aFieldname; } + void SetFieldHelptext(const ::rtl::OUString& aFieldHelptext) + { m_aFieldHelptext = aFieldHelptext; } + private: + //int fftype; // Type: 0 = Text, 1 = Check Box, 2 = List + //bool ffprot; + + ::rtl::OUString m_aFieldname; + ::rtl::OUString m_aFieldHelptext; + static const ::rtl::OUString our_sNamePrefix; + + }; + + class TextFieldmark + : public Fieldmark + { + public: + TextFieldmark(const SwPaM& rPaM); + virtual void InitDoc(SwDoc* const io_pDoc); + private: + //int fftypetxt; // Type of text field: 0 = Regular text, 1 = Number, 2 = Date, 3 = Current date, 4 = Current time, 5 = Calculation + //int ffmaxlen; // Number of characters for text field. Zero means unlimited. + }; + + class CheckboxFieldmark + : virtual public ICheckboxFieldmark + , public Fieldmark + { + public: + CheckboxFieldmark(const SwPaM& rPaM); + virtual void InitDoc(SwDoc* const io_pDoc); + bool IsChecked() const; + void SetChecked(bool checked); + private: + bool m_isChecked; + //bool ffsize; // 0 = Auto, 1=Exact (see ffhps) + //bool ffrecalc; + //int ffhps; // Check box size (half-point sizes). + }; + +}} +#endif diff --git a/sw/source/core/inc/crossrefbookmark.hxx b/sw/source/core/inc/crossrefbookmark.hxx new file mode 100644 index 000000000000..3712950fbb23 --- /dev/null +++ b/sw/source/core/inc/crossrefbookmark.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: crossrefbookmark.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 _CROSSREFBOOKMRK_HXX +#define _CROSSREFBOOKMRK_HXX + +#include <IMark.hxx> +#include <bookmrk.hxx> +#include <rtl/ustring.hxx> + + +namespace sw { namespace mark +{ + class CrossRefBookmark + : public Bookmark + { + public: + CrossRefBookmark(const SwPaM& rPaM, + const KeyCode& rCode, + const ::rtl::OUString& rName, + const ::rtl::OUString& rShortName, + const ::rtl::OUString& rPrefix); + + // getters + virtual const SwPosition& GetOtherMarkPos() const; + virtual const SwPosition& GetMarkStart() const + { return *m_pPos1; } + virtual const SwPosition& GetMarkEnd() const + { return *m_pPos1; } + virtual bool IsExpanded() const + { return false; } + + // setters + virtual void SetMarkPos(const SwPosition& rNewPos); + virtual void SetOtherMarkPos(const SwPosition&) + { + OSL_PRECOND(false, + "<CrossRefBookmark::SetOtherMarkPos(..)>" + " - misusage of CrossRefBookmark: other bookmark position isn't allowed to be set." ); + } + virtual void ClearOtherMarkPos() + { + OSL_PRECOND(false, + "<SwCrossRefBookmark::ClearOtherMarkPos(..)>" + " - misusage of CrossRefBookmark: other bookmark position isn't allowed to be set or cleared." ); + } + + static bool IsLegalName(const ::rtl::OUString& rName); + }; + + class CrossRefHeadingBookmark + : public CrossRefBookmark + { + public: + CrossRefHeadingBookmark(const SwPaM& rPaM, + const KeyCode& rCode, + const ::rtl::OUString& rName, + const ::rtl::OUString& rShortName); + static ::rtl::OUString GenerateNewName(); + static bool IsLegalName(const ::rtl::OUString& rName); + static const ::rtl::OUString our_sNamePrefix; + }; + + class CrossRefNumItemBookmark + : public CrossRefBookmark + { + public: + CrossRefNumItemBookmark(const SwPaM& rPaM, + const KeyCode& rCode, + const ::rtl::OUString& rName, + const ::rtl::OUString& rShortName); + static ::rtl::OUString GenerateNewName(); + static bool IsLegalName(const ::rtl::OUString& rName); + static const ::rtl::OUString our_sNamePrefix; + }; + +}} +#endif diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx index 8cfa17fd4ea7..b8704dac0166 100644 --- a/sw/source/core/inc/mvsave.hxx +++ b/sw/source/core/inc/mvsave.hxx @@ -36,11 +36,11 @@ #include <vcl/keycod.hxx> #endif #include <svtools/svarray.hxx> -#include <IDocumentBookmarkAccess.hxx> +#include <IDocumentMarkAccess.hxx> +#include <vector> class SvNumberFormatter; class SvULongs; -class SwBookmark; class SwDoc; class SwFmtAnchor; class SwFrmFmt; @@ -51,42 +51,46 @@ class SwPaM; class SwNode; struct SwPosition; -typedef USHORT SaveBookmarkType; -namespace nsSaveBookmarkType +namespace sw { namespace mark { - const SaveBookmarkType BKMK_POS_NONE = 0; - const SaveBookmarkType BKMK_POS = 1; - const SaveBookmarkType BKMK_POS_OTHER = 2; -} - -class SaveBookmark -{ - String aName, aShortName; - ULONG nNode1, nNode2; - xub_StrLen nCntnt1, nCntnt2; - KeyCode aCode; - SaveBookmarkType eBkmkType; - IDocumentBookmarkAccess::BookmarkType eOrigBkmType; - -public: - SaveBookmark( int, const SwBookmark&, const SwNodeIndex&, - const SwIndex* pIdx = 0 ); - void SetInDoc( SwDoc* pDoc, const SwNodeIndex&, const SwIndex* pIdx = 0); - IDocumentBookmarkAccess::BookmarkType GetOriginalBkmType() const {return eOrigBkmType;} -}; - -SV_DECL_PTRARR_DEL( SaveBookmarks, SaveBookmark*, 0, 10 ) - -void _DelBookmarks( const SwNodeIndex& rStt, - const SwNodeIndex& rEnd, - SaveBookmarks* pSaveBkmk = 0, - const SwIndex* pSttIdx = 0, - const SwIndex* pEndIdx = 0 ); + class IMark; + class SaveBookmark + { + public: + SaveBookmark(bool bSavePos, + bool bSaveOtherPos, + const ::sw::mark::IMark& rBkmk, + const SwNodeIndex& rMvPos, + const SwIndex* pIdx =0); + void SetInDoc(SwDoc* pDoc, + const SwNodeIndex&, + const SwIndex* pIdx =0); + IDocumentMarkAccess::MarkType GetOriginalBkmType() const + { return m_eOrigBkmType; } + + private: + ::rtl::OUString m_aName; + ::rtl::OUString m_aShortName; + KeyCode m_aCode; + bool m_bSavePos; + bool m_bSaveOtherPos; + IDocumentMarkAccess::MarkType m_eOrigBkmType; + ULONG m_nNode1; + ULONG m_nNode2; + xub_StrLen m_nCntnt1; + xub_StrLen m_nCntnt2; + }; +}} #define SAVEFLY 1 #define SAVEFLY_SPLIT 2 +void _DelBookmarks(const SwNodeIndex& rStt, + const SwNodeIndex& rEnd, + ::std::vector< ::sw::mark::SaveBookmark> * SaveBkmk =0, + const SwIndex* pSttIdx =0, + const SwIndex* pEndIdx =0); void _SaveCntntIdx( SwDoc* pDoc, ULONG nNode, xub_StrLen nCntnt, SvULongs& rSaveArr, BYTE nSaveFly = 0 ); void _RestoreCntntIdx( SwDoc* pDoc, SvULongs& rSaveArr, diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx index 0c9f6e0405e4..c04b30792b53 100644 --- a/sw/source/core/inc/rootfrm.hxx +++ b/sw/source/core/inc/rootfrm.hxx @@ -87,7 +87,6 @@ class SwRootFrm: public SwLayoutFrm // <-- bool mbNeedGrammarCheck; // true when sth needs to be checked (not necessarily started yet!) - bool mbGrammarCheckActive; // true when grammar checking has been started static SwLayVout *pVout; static BOOL bInPaint; //Schutz gegen doppelte Paints. @@ -221,8 +220,6 @@ public: bool IsNeedGrammarCheck() const { return mbNeedGrammarCheck; } void SetNeedGrammarCheck( bool bVal ) { mbNeedGrammarCheck = bVal; } - bool IsGrammarCheckActive() const { return mbGrammarCheckActive; } - void SetGrammarCheckActive( bool bVal ) { mbGrammarCheckActive = bVal; } //Sorgt dafuer, dass alle gewuenschten Seitengebunden Flys eine Seite finden void SetAssertFlyPages() { bAssertFlyPages = TRUE; } diff --git a/sw/source/core/inc/rvp_mark.hxx b/sw/source/core/inc/rvp_mark.hxx deleted file mode 100644 index 3c72a2ecfeb2..000000000000 --- a/sw/source/core/inc/rvp_mark.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * 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: rvp_mark.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 _RVP_MARK_HXX -#define _RVP_MARK_HXX - -class OutputDevice; -class SwRVPMarker -{ - const OutputDevice *pOutp; -public: - SwRVPMarker( const OutputDevice* pOut ) : pOutp( pOut ) - { SwRVPMarker::Mark( pOutp ); } - ~SwRVPMarker() { SwRVPMarker::Mark( pOutp ); } - static void Mark( const OutputDevice* pOut ); -}; - - -#endif //_RVP_MARK_HXX diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 5dd46ec14b83..76e877555fe9 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -450,13 +450,16 @@ SwLayoutFrm *SwFlowFrm::CutTree( SwFrm *pStart ) } if ( pLay->IsFtnFrm() ) - { if ( !pLay->Lower() && !pLay->IsColLocked() && + { + if ( !pLay->Lower() && !pLay->IsColLocked() && !((SwFtnFrm*)pLay)->IsBackMoveLocked() ) - { pLay->Cut(); + { + pLay->Cut(); delete pLay; } else - { BOOL bUnlock = !((SwFtnFrm*)pLay)->IsBackMoveLocked(); + { + BOOL bUnlock = !((SwFtnFrm*)pLay)->IsBackMoveLocked(); ((SwFtnFrm*)pLay)->LockBackMove(); pLay->InvalidateSize(); pLay->Calc(); @@ -509,7 +512,28 @@ BOOL SwFlowFrm::PasteTree( SwFrm *pStart, SwLayoutFrm *pParent, SwFrm *pSibling, if ( 0 == (pStart->pPrev = pParent->Lower()) ) pParent->pLower = pStart; else - pParent->Lower()->pNext = pStart; + //Modified for #i100782#,04/03/2009 + //If the pParent has more than 1 child nodes, former design will
+ //ignore them directly without any collection work. It will make some
+ //dangling pointers. This lead the crash...
+ //The new design will find the last child of pParent in loop way, and
+ //add the pStart after the last child. + // pParent->Lower()->pNext = pStart; + { + SwFrm* pTemp = pParent->pLower; + while (pTemp) + { + if (pTemp->pNext) + pTemp = pTemp->pNext; + else + { + pStart->pPrev = pTemp; + pTemp->pNext = pStart; + break; + } + } + } + //End modification for #i100782#,04/03/2009 // #i27145# if ( pParent->IsSctFrm() ) diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index b6188caf8dd2..82a1ad0690ac 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -435,7 +435,6 @@ SwRootFrm::SwRootFrm( SwFrmFmt *pFmt, ViewShell * pSh ) : mbBookMode( false ), mbSidebarChanged( false ), mbNeedGrammarCheck( false ), - mbGrammarCheckActive( false ), // <-- nBrowseWidth( MM50*4 ), //2cm Minimum pTurbo( 0 ), diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 1e1e5e503e08..c6afe50b5826 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -217,9 +217,7 @@ void SwEmbedObjectLink::DataChanged( const String& , try { sal_Int32 nState = xObject->getCurrentState(); - if ( nState == embed::EmbedStates::LOADED ) - xObject->changeState( embed::EmbedStates::RUNNING ); - else + if ( nState != embed::EmbedStates::LOADED ) { // in some cases the linked file probably is not locked so it could be changed xObject->changeState( embed::EmbedStates::LOADED ); diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 4b9e9ec73cfe..614678d34978 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -86,7 +86,7 @@ #include <SwStyleNameMapper.hxx> #include <itrpaint.hxx> #include "i18npool/mslangid.hxx" -#include <bookmrk.hxx> +#include <IMark.hxx> #include <SwNodeNum.hxx> #include <stack> @@ -2053,21 +2053,22 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() if( pPDFExtOutDevData->GetIsExportNamedDestinations() ) { - //---> i56629 the iteration to convert the OOo bookmark (#bookmark) - // into PDF named destination, see section 8.2.1 in PDF 1.4 spec - // We need: - // 1. a name for the destination, formed from the standard OOo bookmark name - // 2. the destination, obtained from where the bookmark destination lies - const SwBookmarks& rBkmks = mrSh.GetDoc()->getBookmarks(); - //iterate trhrough bookmarks - sal_uInt16 nBkmks = rBkmks.Count(), nCnt; - for(nCnt = 0; nCnt < nBkmks; nCnt++) + //---> i56629 the iteration to convert the OOo bookmark (#bookmark) + // into PDF named destination, see section 8.2.1 in PDF 1.4 spec + // We need: + // 1. a name for the destination, formed from the standard OOo bookmark name + // 2. the destination, obtained from where the bookmark destination lies + IDocumentMarkAccess* const pMarkAccess = mrSh.GetDoc()->getIDocumentMarkAccess(); + for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin(); + ppMark != pMarkAccess->getBookmarksEnd(); + ppMark++) { -//get the name - SwBookmark* pBkmk = rBkmks[ nCnt ]; + //get the name + const ::sw::mark::IMark* pBkmk = ppMark->get(); mrSh.SwCrsrShell::ClearMark(); rtl::OUString sBkName = pBkmk->GetName(); -//jump to it + + //jump to it JumpToSwMark( &mrSh, sBkName ); // Destination Rectangle @@ -2081,8 +2082,8 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() pPDFExtOutDevData->CreateNamedDest( sBkName, rDestRect.SVRect(), nDestPageNum ); } mrSh.SwCrsrShell::ClearMark(); + //<--- i56629 } -//<--- i56629 } else { diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 33571e9e7d31..46e74abe1da3 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -1204,22 +1204,24 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const { SwRect aIntersect; CalcRect( rPor, &aIntersect, 0 ); - SwTxtNode *pNd = pFrm->GetTxtNode(); - SwBookmark *pBM=NULL; - if ( aIntersect.HasArea() ) + if(aIntersect.HasArea()) { - if (pNd) + SwTxtNode *pNd = pFrm->GetTxtNode(); + const ::sw::mark::IMark* pFieldmark = NULL; + if(pNd) { const SwDoc *doc=pNd->GetDoc(); - if (doc!=NULL) + if(doc) { - SwIndex aIndex( pNd, GetIdx() ); + SwIndex aIndex(pNd, GetIdx()); SwPosition aPosition(*pNd, aIndex); - pBM=doc->getFieldBookmarkFor(aPosition); + pFieldmark=doc->getIDocumentMarkAccess()->getFieldmarkFor(aPosition); } } bool bIsStartMark=(1==GetLen() && CH_TXT_ATR_FIELDSTART==GetTxt().GetChar(GetIdx())); - if (OnWin() && (pBM!=NULL || bIsStartMark)) + if(pFieldmark) OSL_TRACE("Found Fieldmark"); + if(bIsStartMark) OSL_TRACE("Found StartMark"); + if (OnWin() && (pFieldmark!=NULL || bIsStartMark)) { OutputDevice* pOutDev = (OutputDevice*)GetOut(); pOutDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 83eabfd699cb..17b4e6a5ec41 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -52,7 +52,7 @@ #include <IDocumentSettingAccess.hxx> #include <viewopt.hxx> // SwViewOptions -#include <bookmrk.hxx> +#include <IMark.hxx> #include <pam.hxx> #include <doc.hxx> @@ -769,9 +769,9 @@ void SwHolePortion::HandlePortion( SwPortionHandler& rPH ) const rPH.Text( GetLen(), GetWhichPor() ); } -void SwFieldMarkPortion::Paint( const SwTxtPaintInfo & ) const +void SwFieldMarkPortion::Paint( const SwTxtPaintInfo & rInf) const { -// SwTxtPortion::Paint(rInf); + SwTxtPortion::Paint(rInf); } sal_Bool SwFieldMarkPortion::Format( SwTxtFormatInfo & ) @@ -782,19 +782,21 @@ sal_Bool SwFieldMarkPortion::Format( SwTxtFormatInfo & ) } -void SwFieldFormPortion::Paint( const SwTxtPaintInfo &rInf ) const +//FIXME Fieldbk +//void SwFieldFormPortion::Paint( const SwTxtPaintInfo& rInf ) const +void SwFieldFormPortion::Paint( const SwTxtPaintInfo& ) const { -// SwTxtPortion::Paint(rInf); - SwTxtNode *pNd=const_cast<SwTxtNode*>(rInf.GetTxtFrm()->GetTxtNode()); - const SwDoc *doc=pNd->GetDoc(); - SwIndex aIndex( pNd, rInf.GetIdx() ); - SwPosition aPosition(*pNd, aIndex); - SwFieldBookmark *pBM=doc->getFormFieldBookmarkFor(aPosition); - ASSERT(pBM!=NULL, "Where is my form field bookmark???"); - bool checked=(pBM!=NULL?pBM->IsChecked():false); - rInf.DrawCheckBox( *this , checked); -// const XubString aTxt = XubString::CreateFromAscii("[ ]"); -// rInf.DrawText( aTxt, *this, 0, aTxt.Len(), false ); +// SwTxtNode *pNd=const_cast<SwTxtNode*>(rInf.GetTxtFrm()->GetTxtNode()); +// const SwDoc *doc=pNd->GetDoc(); +// SwIndex aIndex( pNd, rInf.GetIdx() ); +// SwPosition aPosition(*pNd, aIndex); +// pMark = dynamic_cast< doc->getFieldmarkFor(aPosition); +// OSL_ENSURE(pMark, +// "SwFieldFormPortion::Paint(..)" +// " - Where is my form field bookmark???"); + +// bool checked=(pBM!=NULL?pBM->IsChecked():false); +// rInf.DrawCheckBox(*this , checked); } sal_Bool SwFieldFormPortion::Format( SwTxtFormatInfo &rInf ) diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 641bc63484bd..56b8ec9afdf4 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -235,16 +235,18 @@ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf, bool bAuto ) } // <-- - // --> OD 2009-02-23 #i99384# + // --> OD 2009-04-03 #i100732# // correction of condition, when a tab stop at the left margin can // be applied: // If the paragraph is not inside a list having a list tab stop following - // the list label or no further tab stop found in such a paragraph, + // the list label or no further tab stop found in such a paragraph or + // the next tab stop position does not equal the list tab stop, // a tab stop at the left margin can be applied. If this condition is // not hold, it is overruled by compatibility option TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST. const bool bTabAtLeftMargin = ( !aLineInf.IsListTabStopIncluded() || - !pTabStop ) || + !pTabStop || + nNextPos != aLineInf.GetListTabStopPosition() ) || // compatibility option TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST: pFrm->GetTxtNode()->getIDocumentSettingAccess()-> get(IDocumentSettingAccess::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST); diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index c5512e43d08d..19b827d0b9f9 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -184,7 +184,7 @@ BOOL SwFmtAutoFmt::QueryValue( uno::Any& rVal, BYTE ) const BOOL SwFmtAutoFmt::PutValue( const uno::Any& , BYTE ) { - DBG_ERROR("ToDo!"); + //the format is not renameable via API
return FALSE; } diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index af0e0137af86..d58236da16b9 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -74,10 +74,6 @@ #ifndef _POOLFMT_HRC #include <poolfmt.hrc> #endif -// Enable this to use the helpclass SwRVPMark -#if OSL_DEBUG_LEVEL > 1 -#include <rvp_mark.hxx> -#endif using namespace ::com::sun::star; @@ -110,28 +106,6 @@ USHORT GetDefaultFontHeight( SwDrawTextInfo &rInf ) } -#ifdef _RVP_MARK_HXX - -void SwRVPMarker::Mark( const OutputDevice* pOut ) -{ - if( pOut ) - { - Color aOldCol = pOut->GetLineColor(); - Color aBlack = Color( COL_BLACK ); - if( aOldCol != aBlack ) - { - ((OutputDevice*)pOut)->SetLineColor( aBlack ); - ((OutputDevice*)pOut)->DrawChord( Rectangle(0,1,0,1), - Point(), Point() ); - ((OutputDevice*)pOut)->SetLineColor( aOldCol ); - } - else - ((OutputDevice*)pOut)->DrawChord( Rectangle(0,1,0,1), - Point(), Point() ); - } -} - -#endif /************************************************************************* |* @@ -938,10 +912,10 @@ static void lcl_DrawLineForWrongListData( if (rInf.GetOut().GetConnectMetaFile()) rInf.GetOut().Push(); - const Color aCol( rInf.GetOut().GetLineColor() ); + const Color aCol( rInf.GetOut().GetTextLineColor() ); const BOOL bColSave = aCol != aLineColor; if (bColSave) - rInf.GetOut().SetLineColor( aLineColor ); + rInf.GetOut().SetTextLineColor( aLineColor ); // iterate over all ranges stored in the respective SwWrongList do @@ -1012,7 +986,7 @@ static void lcl_DrawLineForWrongListData( while (nWrLen && pWList->Check( nStart, nWrLen )); if (bColSave) - rInf.GetOut().SetLineColor( aCol ); + rInf.GetOut().SetTextLineColor( aCol ); if (rInf.GetOut().GetConnectMetaFile()) rInf.GetOut().Pop(); @@ -1932,10 +1906,10 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) WRONG_SHOW_MEDIUM < nHght ? WAVE_NORMAL : ( WRONG_SHOW_SMALL < nHght ? WAVE_SMALL : WAVE_FLAT ); - Color aCol( rInf.GetOut().GetLineColor() ); + Color aCol( rInf.GetOut().GetTextLineColor() ); BOOL bColSave = aCol != *pWaveCol; if ( bColSave ) - rInf.GetOut().SetLineColor( *pWaveCol ); + rInf.GetOut().SetTextLineColor( *pWaveCol ); Point aEnd; long nKernVal = pKernArray[ USHORT( rInf.GetLen() - 1 ) ]; @@ -1982,7 +1956,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) rInf.GetOut().DrawWaveLine( aCurrPos, aEnd, nWave ); if ( bColSave ) - rInf.GetOut().SetLineColor( aCol ); + rInf.GetOut().SetTextLineColor( aCol ); if ( rInf.GetOut().GetConnectMetaFile() ) rInf.GetOut().Pop(); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 8e8abe79cefa..b9ff68e3d422 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -88,7 +88,7 @@ #include <dcontact.hxx> #include <redline.hxx> #include <doctxm.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <scriptinfo.hxx> #include <istyleaccess.hxx> #include <SwStyleNameMapper.hxx> @@ -1033,14 +1033,17 @@ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen, } } - const SwBookmarks& rBkmk = getIDocumentBookmarkAccess()->getBookmarks(); - for( USHORT i = 0; i < rBkmk.Count(); ++i ) + const IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess(); + for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin(); + ppMark != pMarkAccess->getMarksEnd(); + ppMark++) { // Bookmarks must never grow to either side, when // editing (directly) to the left or right (#i29942#)! // And a bookmark with same start and end must remain // to the left of the inserted text (used in XML import). - const SwPosition* pEnd = rBkmk[i]->BookmarkEnd(); + const ::sw::mark::IMark* const pMark = ppMark->get(); + const SwPosition* pEnd = &pMark->GetMarkEnd(); pIdx = (SwIndex*)&pEnd->nContent; if( this == &pEnd->nNode.GetNode() && aPos.GetIndex() == pIdx->GetIndex() ) diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index e52bf2ba8ff0..74bb3e87e87e 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -374,7 +374,13 @@ void SwpHints::BuildPortions( SwTxtNode& rNode, SwTxtAttr& rNewHint, USHORT nMod const bool bSameCharFmt = rOtherCharFmt.GetCharFmt() == rThisCharFmt.GetCharFmt(); // <-- - if ( !( nsSetAttrMode::SETATTR_DONTREPLACE & nMode ) || bNoLengthAttribute || bSameCharFmt ) + // --> OD 2009-03-24 #i90311# + // Do not remove existing character format hint during XML import + if ( !rNode.GetDoc()->IsInXMLImport() && + ( !( nsSetAttrMode::SETATTR_DONTREPLACE & nMode ) || + bNoLengthAttribute || + bSameCharFmt ) ) + // <-- { // Remove old hint Delete( *aIter ); diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index d8d1ea0245ed..07eb7182d717 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -31,6 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <svx/svdmodel.hxx> #include <vcl/wrkwin.hxx> #include <doc.hxx> @@ -112,6 +113,10 @@ bool SwDoc::IsUndoNoResetModified() const void SwDoc::DoUndo(bool bUn) { mbUndo = bUn; + + SdrModel* pSdrModel = GetDrawModel(); + if( pSdrModel ) + pSdrModel->EnableUndo(bUn); } bool SwDoc::DoesUndo() const diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index fcf13e06eedf..776dee62f443 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -60,7 +60,7 @@ #include <rolbck.hxx> #include <ndgrf.hxx> // SwGrfNode #include <undobj.hxx> // fuer UndoDelete -#include <bookmrk.hxx> // fuer SwBookmark +#include <IMark.hxx> // fuer SwBookmark #include <charfmt.hxx> // #i27615# #ifndef _COMCORE_HRC #include <comcore.hrc> @@ -70,6 +70,7 @@ #include <undo.hrc> #endif #include <svx/brkitem.hxx> +#include <bookmrk.hxx> SV_IMPL_PTRARR( SwpHstry, SwHstryHintPtr) @@ -550,166 +551,114 @@ void SwHstryTxtFlyCnt::SetInDoc( SwDoc* pDoc, BOOL ) -// JP 21.03.94: jetzt auch die Bookmarks in die History aufnehmen -SwHstryBookmark::SwHstryBookmark( const SwBookmark& rBkmk, BYTE nType ) - : SwHstryHint( HSTRY_BOOKMARK ), - nNode1( 0 ), - nNode2( rBkmk.GetOtherBookmarkPos() ? 0 : ULONG_MAX ), - nCntnt1( 0 ), - nCntnt2( 0 ), - nTyp( nType ), - // --> OD 2007-10-17 #i81002# - eBkmkType( rBkmk.GetType() ) - // <-- -{ - aName = rBkmk.GetName(); - aShortName = rBkmk.GetShortName(); - nKeyCode = rBkmk.GetKeyCode().GetCode() | rBkmk.GetKeyCode().GetModifier(); - - if( BKMK_POS & nTyp ) - { - nNode1 = rBkmk.GetBookmarkPos().nNode.GetIndex(); - nCntnt1 = rBkmk.GetBookmarkPos().nContent.GetIndex(); - } - if( BKMK_OTHERPOS & nTyp ) +SwHstryBookmark::SwHstryBookmark( + const ::sw::mark::IMark& rBkmk, + bool bSavePos, + bool bSaveOtherPos) + : SwHstryHint(HSTRY_BOOKMARK) + , m_aName(rBkmk.GetName()) + , m_aShortName() + , m_aKeycode() + , m_nNode(bSavePos ? + rBkmk.GetMarkPos().nNode.GetIndex() : 0) + , m_nOtherNode(bSaveOtherPos ? + rBkmk.GetOtherMarkPos().nNode.GetIndex() : 0) + , m_nCntnt(bSavePos ? + rBkmk.GetMarkPos().nContent.GetIndex() : 0) + , m_nOtherCntnt(bSaveOtherPos ? + rBkmk.GetOtherMarkPos().nContent.GetIndex() :0) + , m_bSavePos(bSavePos) + , m_bSaveOtherPos(bSaveOtherPos) + , m_bHadOtherPos(rBkmk.IsExpanded()) + , m_eBkmkType(IDocumentMarkAccess::GetType(rBkmk)) +{ + const ::sw::mark::IBookmark* const pBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(&rBkmk); + if(pBookmark) { - nNode2 = rBkmk.GetOtherBookmarkPos()->nNode.GetIndex(); - nCntnt2 = rBkmk.GetOtherBookmarkPos()->nContent.GetIndex(); + m_aKeycode = pBookmark->GetKeyCode(); + m_aShortName = pBookmark->GetShortName(); } } -void SwHstryBookmark::SetInDoc( SwDoc* pDoc, BOOL ) +void SwHstryBookmark::SetInDoc(SwDoc* pDoc, BOOL) { - BOOL bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool bDoesUndo = pDoc->DoesUndo(); + pDoc->DoUndo(false); SwNodes& rNds = pDoc->GetNodes(); + IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); + ::std::auto_ptr<SwPaM> pPam; + ::sw::mark::IMark* pMark = NULL; - if( ( BKMK_POS == nTyp && ULONG_MAX == nNode2 ) || - ( BKMK_POS | BKMK_OTHERPOS ) == nTyp ) + if(m_bSavePos) { - // voellig neu setzen - SwCntntNode * pCntntNd = rNds[ nNode1 ]->GetCntntNode(); - ASSERT( pCntntNd, "Falscher Node fuer den Bookmark" ); + SwCntntNode* const pCntntNd = rNds[m_nNode]->GetCntntNode(); + OSL_ENSURE(pCntntNd, + "<SwHstryBookmark::SetInDoc(..)>" + " - wrong node for a mark"); // #111660# don't crash when nNode1 doesn't point to content node. - if( pCntntNd != NULL ) - { - SwPaM aPam( *pCntntNd, nCntnt1 ); - if( ULONG_MAX != nNode2 ) - { - aPam.SetMark(); - aPam.GetMark()->nNode = nNode2; - pCntntNd = rNds[ aPam.GetMark()->nNode ]->GetCntntNode(); - ASSERT( pCntntNd, "Falscher Node fuer den Bookmark" ); - aPam.GetMark()->nContent.Assign( pCntntNd, nCntnt2 ); - } - // --> OD 2007-10-17 #i81002# - pDoc->makeBookmark( aPam, KeyCode( nKeyCode ), aName, aShortName, eBkmkType ); - // <-- - } + if(pCntntNd) + pPam = ::std::auto_ptr<SwPaM>(new SwPaM(*pCntntNd, m_nCntnt)); } else { - // dann muss das noch vorhandene manipuliert werden - SwBookmark* const* ppBkmks = pDoc->getBookmarks().GetData(); - for( USHORT n = pDoc->getBookmarks().Count(); n; --n, ++ppBkmks ) - if( (*ppBkmks)->GetName() == aName ) - { - ULONG nNd; - USHORT nCnt; - if( BKMK_POS == nTyp ) - { - if( !nNode2 && !(*ppBkmks)->GetOtherBookmarkPos() ) - { - // dann muss der neu angelegt werden. - SwPaM aPam( (*ppBkmks)->GetBookmarkPos() ); - aPam.SetMark(); - aPam.GetPoint()->nNode = nNode1; - aPam.GetPoint()->nContent.Assign( - rNds[ nNode1 ]->GetCntntNode(), nCntnt1 ); - - pDoc->deleteBookmark( pDoc->getBookmarks().Count() - n ); - // --> OD 2007-10-17 #i81002# - pDoc->makeBookmark( aPam, KeyCode( nKeyCode ), - aName, aShortName, - eBkmkType ); - // <-- - break; + pMark = pMarkAccess->findMark(m_aName)->get(); + pPam = ::std::auto_ptr<SwPaM>(new SwPaM(pMark->GetMarkPos())); + } - } - nNd = nNode1; - nCnt = nCntnt1; - // --> OD 2007-09-27 #i81002# - refactoring - // Do not directly manipulate member of <SwBookmark> -// pPos = (SwPosition*)&(*ppBkmks)->GetBookmarkPos(); - SwPosition aNewPos( (*ppBkmks)->GetBookmarkPos() ); - aNewPos.nNode = nNd; - aNewPos.nContent.Assign( rNds[ aNewPos.nNode ]->GetCntntNode(), - nCnt ); - (*ppBkmks)->SetBookmarkPos( &aNewPos ); - // <-- - } - else - { - if( !(*ppBkmks)->GetOtherBookmarkPos() ) - { - // dann muss der neu angelegt werden. - SwPaM aPam( (*ppBkmks)->GetBookmarkPos() ); - aPam.SetMark(); - aPam.GetMark()->nNode = nNode2; - aPam.GetMark()->nContent.Assign( - rNds[ nNode2 ]->GetCntntNode(), nCntnt2 ); - - pDoc->deleteBookmark( pDoc->getBookmarks().Count() - n ); - // --> OD 2007-10-17 #i81002# - pDoc->makeBookmark( aPam, KeyCode( nKeyCode ), - aName, aShortName, eBkmkType ); - // <-- - break; - } - nNd = nNode2; - nCnt = nCntnt2; - // --> OD 2007-09-27 #i81002# - refactoring - // Do not directly manipulate member of <SwBookmark> -// pPos = (SwPosition*)(*ppBkmks)->GetOtherBookmarkPos(); - SwPosition aNewPos( *((*ppBkmks)->GetOtherBookmarkPos()) ); - aNewPos.nNode = nNd; - aNewPos.nContent.Assign( rNds[ aNewPos.nNode ]->GetCntntNode(), - nCnt ); - (*ppBkmks)->SetOtherBookmarkPos( &aNewPos ); - // <-- - } + if(m_bSaveOtherPos) + { + SwCntntNode* const pCntntNd = rNds[m_nOtherNode]->GetCntntNode(); + OSL_ENSURE(pCntntNd, + "<SwHstryBookmark::SetInDoc(..)>" + " - wrong node for a mark"); - // --> OD 2007-10-10 #i81002# - refactoring - // Do not directly manipulate member of <SwBookmark> -// pPos->nNode = nNd; -// pPos->nContent.Assign( rNds[ pPos->nNode ]->GetCntntNode(), -// nCnt ); - // <-- - break; - } + if(pPam.get() != NULL && pCntntNd) + { + pPam->SetMark(); + pPam->GetMark()->nNode = m_nOtherNode; + pPam->GetMark()->nContent.Assign(pCntntNd, m_nOtherCntnt); + } + } + else if(m_bHadOtherPos) + { + if(!pMark) + pMark = pMarkAccess->findMark(m_aName)->get(); + OSL_ENSURE(pMark->IsExpanded(), + "<SwHstryBookmark::SetInDoc(..)>" + " - missing pos on old mark"); + pPam->SetMark(); + *pPam->GetMark() = pMark->GetOtherMarkPos(); } - pDoc->DoUndo( bDoesUndo ); + if(pPam.get()) + { + if(pMark) + pMarkAccess->deleteMark(pMark); + ::sw::mark::IBookmark* const pBookmark = dynamic_cast< ::sw::mark::IBookmark* >( + pMarkAccess->makeMark(*pPam, m_aName, m_eBkmkType)); + if(pBookmark) + { + pBookmark->SetKeyCode(m_aKeycode); + pBookmark->SetShortName(m_aShortName); + } + } + pDoc->DoUndo(bDoesUndo); } -BOOL SwHstryBookmark::IsEqualBookmark( const SwBookmark& rBkmk ) +BOOL SwHstryBookmark::IsEqualBookmark(const ::sw::mark::IMark& rBkmk) { - return nNode1 == rBkmk.GetBookmarkPos().nNode.GetIndex() && - nCntnt1 == rBkmk.GetBookmarkPos().nContent.GetIndex() && - aName == rBkmk.GetName() && - aShortName == rBkmk.GetShortName() && - nKeyCode == (rBkmk.GetKeyCode().GetCode() | - rBkmk.GetKeyCode().GetModifier()) - ? TRUE : FALSE; + return m_nNode == rBkmk.GetMarkPos().nNode.GetIndex() + && m_nCntnt == rBkmk.GetMarkPos().nContent.GetIndex() + && m_aName == rBkmk.GetName(); } -const String & SwHstryBookmark::GetName() const +const ::rtl::OUString& SwHstryBookmark::GetName() const { - return aName; + return m_aName; } /*************************************************************************/ @@ -1064,12 +1013,11 @@ void SwHistory::Add( const SwFmtColl* pColl, ULONG nNodeIdx, BYTE nWhichNd ) } -// JP 21.03.94: Bookmarks jetzt auch in die History mitaufnehmen -void SwHistory::Add( const SwBookmark& rBkmk, BYTE nTyp ) +void SwHistory::Add(const ::sw::mark::IMark& rBkmk, bool bSavePos, bool bSaveOtherPos) { - ASSERT( !nEndDiff, "nach REDO wurde die History noch nicht geloescht" ); - SwHstryHint * pHt = new SwHstryBookmark( rBkmk, nTyp ); - Insert( pHt, Count() ); + ASSERT(!nEndDiff, "nach REDO wurde die History noch nicht geloescht"); + SwHstryHint * pHt = new SwHstryBookmark(rBkmk, bSavePos, bSaveOtherPos); + Insert(pHt, Count()); } diff --git a/sw/source/core/undo/unbkmk.cxx b/sw/source/core/undo/unbkmk.cxx index d8733da445cc..86a7797fe494 100644 --- a/sw/source/core/undo/unbkmk.cxx +++ b/sw/source/core/undo/unbkmk.cxx @@ -38,7 +38,7 @@ #include "pam.hxx" #include "undobj.hxx" -#include "bookmrk.hxx" +#include "IMark.hxx" #include "rolbck.hxx" #include "SwRewriter.hxx" @@ -46,13 +46,10 @@ inline SwDoc& SwUndoIter::GetDoc() const { return *pAktPam->GetDoc(); } -SwUndoBookmark::SwUndoBookmark( SwUndoId nUndoId, const SwBookmark& rBkmk ) +SwUndoBookmark::SwUndoBookmark( SwUndoId nUndoId, const ::sw::mark::IMark& rBkmk ) : SwUndo( nUndoId ) { - BYTE nType = SwHstryBookmark::BKMK_POS; - if( rBkmk.GetOtherBookmarkPos() ) - nType |= SwHstryBookmark::BKMK_OTHERPOS; - pHBookmark = new SwHstryBookmark( rBkmk, nType ); + pHBookmark = new SwHstryBookmark(rBkmk, true, rBkmk.IsExpanded()); } @@ -71,11 +68,13 @@ void SwUndoBookmark::SetInDoc( SwDoc* pDoc ) void SwUndoBookmark::ResetInDoc( SwDoc* pDoc ) { - const SwBookmarks& rBkmkTbl = pDoc->getBookmarks(); - for( USHORT n = 0; n < rBkmkTbl.Count(); ++n ) - if( pHBookmark->IsEqualBookmark( *rBkmkTbl[ n ] ) ) + IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + for(IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->getMarksBegin(); + ppBkmk != pMarkAccess->getMarksEnd(); + ppBkmk++) + if( pHBookmark->IsEqualBookmark( **ppBkmk )) { - pDoc->deleteBookmark( n ); + pMarkAccess->deleteMark( ppBkmk ); break; } } @@ -89,7 +88,7 @@ SwRewriter SwUndoBookmark::GetRewriter() const return aResult; } -SwUndoDelBookmark::SwUndoDelBookmark( const SwBookmark& rBkmk ) +SwUndoDelBookmark::SwUndoDelBookmark( const ::sw::mark::IMark& rBkmk ) : SwUndoBookmark( UNDO_DELBOOKMARK, rBkmk ) { } @@ -107,7 +106,7 @@ void SwUndoDelBookmark::Redo( SwUndoIter& rUndoIter ) } -SwUndoInsBookmark::SwUndoInsBookmark( const SwBookmark& rBkmk ) +SwUndoInsBookmark::SwUndoInsBookmark( const ::sw::mark::IMark& rBkmk ) : SwUndoBookmark( UNDO_INSBOOKMARK, rBkmk ) { } diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index d33840b7370f..e3ad5aa726f3 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -152,7 +152,7 @@ SwUndoDelete::SwUndoDelete( SwPaM& rPam, BOOL bFullPara, BOOL bCalledByTblCpy ) BOOL bDoesUndo = pDoc->DoesUndo(); pDoc->DoUndo( FALSE ); - _DelBookmarks( pStt->nNode, pEnd->nNode ); + _DelBookmarks(pStt->nNode, pEnd->nNode); pDoc->DoUndo( bDoesUndo ); } else @@ -871,7 +871,7 @@ void SwUndoDelete::Redo( SwUndoIter& rUndoIter ) DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint(), DelCntntType(nsDelCntntType::DELCNT_ALL | nsDelCntntType::DELCNT_CHKNOCNTNT) ); - _DelBookmarks( rPam.GetMark()->nNode, rPam.GetPoint()->nNode ); + _DelBookmarks(rPam.GetMark()->nNode, rPam.GetPoint()->nNode); } else DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint() ); diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index a49e37ba706e..1b7f97b70a20 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -44,9 +44,10 @@ #include <undobj.hxx> #include <rolbck.hxx> #include <ndnotxt.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <mvsave.hxx> #include <redline.hxx> +#include <crossrefbookmark.hxx> #ifndef _UNDO_HRC #include <undo.hrc> #endif @@ -711,48 +712,46 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark, // 3. Bookmarks if( nsDelCntntType::DELCNT_BKM & nDelCntntType ) { - const SwBookmarks& rBkmkTbl = pDoc->getBookmarks(); - if( rBkmkTbl.Count() ) + IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + if( pMarkAccess->getMarksCount() ) { - const SwBookmark* pBkmk( 0 ); - for( USHORT n = 0; n < rBkmkTbl.Count(); ++n ) + for( USHORT n = 0; n < pMarkAccess->getMarksCount(); ++n ) { - BYTE nTyp = 0; // --> OD 2007-10-17 #i81002# - pBkmk = rBkmkTbl[ n ]; - const SwPosition& rBkmkPos( pBkmk->GetBookmarkPos() ); - const SwPosition* pOtherBkmkPos( pBkmk->GetOtherBookmarkPos() ); + bool bSavePos = false; + bool bSaveOtherPos = false; + const ::sw::mark::IMark* pBkmk = (pMarkAccess->getMarksBegin() + n)->get(); if( nsDelCntntType::DELCNT_CHKNOCNTNT & nDelCntntType ) { - if( pStt->nNode <= pBkmk->GetBookmarkPos().nNode && - pBkmk->GetBookmarkPos().nNode < pEnd->nNode ) - nTyp = SwHstryBookmark::BKMK_POS; - if( pBkmk->GetOtherBookmarkPos() && - pStt->nNode <= pBkmk->GetOtherBookmarkPos()->nNode && - pBkmk->GetOtherBookmarkPos()->nNode < pEnd->nNode ) - nTyp |= SwHstryBookmark::BKMK_OTHERPOS; + if( pStt->nNode <= pBkmk->GetMarkPos().nNode && + pBkmk->GetMarkPos().nNode < pEnd->nNode ) + bSavePos = true; + if( pBkmk->IsExpanded() && + pStt->nNode <= pBkmk->GetOtherMarkPos().nNode && + pBkmk->GetOtherMarkPos().nNode < pEnd->nNode ) + bSaveOtherPos = true; } else { - bool bMayBe = false; - if( *pStt <= pBkmk->GetBookmarkPos() && pBkmk->GetBookmarkPos() <= *pEnd ) + bool bMaybe = false; + if( *pStt <= pBkmk->GetMarkPos() && pBkmk->GetMarkPos() <= *pEnd ) { - if( pBkmk->GetBookmarkPos() == *pEnd || - ( *pStt == pBkmk->GetBookmarkPos() && pBkmk->GetOtherBookmarkPos() ) ) - bMayBe = true; + if( pBkmk->GetMarkPos() == *pEnd || + ( *pStt == pBkmk->GetMarkPos() && pBkmk->IsExpanded() ) ) + bMaybe = true; else - nTyp = SwHstryBookmark::BKMK_POS; + bSavePos = true; } - if( pBkmk->GetOtherBookmarkPos() && - *pStt <= *pBkmk->GetOtherBookmarkPos() && *pBkmk->GetOtherBookmarkPos() <= *pEnd ) + if( pBkmk->IsExpanded() && + *pStt <= pBkmk->GetOtherMarkPos() && pBkmk->GetOtherMarkPos() <= *pEnd ) { - if( nTyp || ( *pBkmk->GetOtherBookmarkPos() < *pEnd && - *pBkmk->GetOtherBookmarkPos() > *pStt ) ) + if( bSavePos || bSaveOtherPos || + ( pBkmk->GetOtherMarkPos() < *pEnd && pBkmk->GetOtherMarkPos() > *pStt ) ) { - if( bMayBe ) - nTyp = SwHstryBookmark::BKMK_POS; - nTyp |= SwHstryBookmark::BKMK_OTHERPOS; + if( bMaybe ) + bSavePos = true; + bSaveOtherPos = true; } } // delete cross-reference bookmark at <pStt>, if only part of @@ -763,35 +762,37 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark, rMark.nNode.GetNode().GetTxtNode() && rPoint.nNode.GetNode().GetTxtNode() ); // <-- - if( !nTyp && bDifferentTxtNodesAtMarkAndPoint && pBkmk->IsCrossRefMark() ) + if( !bSavePos && !bSaveOtherPos && bDifferentTxtNodesAtMarkAndPoint && + dynamic_cast< const ::sw::mark::CrossRefBookmark* >(pBkmk)) { - if( pStt->nNode == rBkmkPos.nNode && + if( pStt->nNode == pBkmk->GetMarkPos().nNode && pEnd->nContent.GetIndex() != pEnd->nNode.GetNode().GetTxtNode()->Len() ) { - nTyp = SwHstryBookmark::BKMK_POS; + bSavePos = true; + bSaveOtherPos = false; } // delete cross-reference bookmark at <pEnd>, if only part of // <pStt> text node content is deleted. - else if( pEnd->nNode == rBkmkPos.nNode && + else if( pEnd->nNode == pBkmk->GetMarkPos().nNode && pStt->nContent.GetIndex() != 0 ) { - nTyp = SwHstryBookmark::BKMK_POS; + bSavePos = true; + bSaveOtherPos = false; } } } - if( nTyp ) + if( bSavePos || bSaveOtherPos ) { if( !pHistory ) pHistory = new SwHistory; - pHistory->Add( *pBkmk, nTyp ); - if ( ( SwHstryBookmark::BKMK_OTHERPOS | - SwHstryBookmark::BKMK_POS ) == nTyp || - ( SwHstryBookmark::BKMK_POS == nTyp - && !pOtherBkmkPos ) ) + pHistory->Add( *pBkmk, bSavePos, bSaveOtherPos ); + if(bSavePos && + (bSaveOtherPos || !pBkmk->IsExpanded())) { - pDoc->deleteBookmark( n-- ); + pMarkAccess->deleteMark(pMarkAccess->getMarksBegin()+n); + n--; } } } diff --git a/sw/source/core/unocore/SwXTextDefaults.cxx b/sw/source/core/unocore/SwXTextDefaults.cxx index 0a21ef39956d..43c1743023d7 100644 --- a/sw/source/core/unocore/SwXTextDefaults.cxx +++ b/sw/source/core/unocore/SwXTextDefaults.cxx @@ -61,8 +61,8 @@ void lcl_setPageDesc(SwDoc*, const uno::Any&, SfxItemSet& ); // from unoobj.cxx SwXTextDefaults::SwXTextDefaults ( SwDoc * pNewDoc ) : - aPropSet( aSwMapProvider.GetPropertyMap ( PROPERTY_MAP_TEXT_DEFAULT ) ), - pDoc ( pNewDoc ) + m_pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_DEFAULT ) ), + m_pDoc ( pNewDoc ) { } @@ -75,7 +75,7 @@ SwXTextDefaults::~SwXTextDefaults () uno::Reference< XPropertySetInfo > SAL_CALL SwXTextDefaults::getPropertySetInfo( ) throw(RuntimeException) { - static uno::Reference < XPropertySetInfo > xRef = aPropSet.getPropertySetInfo(); + static uno::Reference < XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo(); return xRef; } @@ -84,21 +84,21 @@ void SAL_CALL SwXTextDefaults::setPropertyValue( const OUString& rPropertyName, throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { vos::OGuard aGuard( Application::GetSolarMutex()); - if (!pDoc) + if (!m_pDoc) throw RuntimeException(); - const SfxItemPropertyMap *pMap = SfxItemPropertyMap::GetByName( aPropSet.getPropertyMap(), rPropertyName); + const SfxItemPropertySimpleEntry *pMap = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); if (!pMap) throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); if ( pMap->nFlags & PropertyAttribute::READONLY) throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - const SfxPoolItem& rItem = pDoc->GetDefault(pMap->nWID); + const SfxPoolItem& rItem = m_pDoc->GetDefault(pMap->nWID); if (RES_PAGEDESC == pMap->nWID && MID_PAGEDESC_PAGEDESCNAME == pMap->nMemberId) { - SfxItemSet aSet( pDoc->GetAttrPool(), RES_PAGEDESC, RES_PAGEDESC ); + SfxItemSet aSet( m_pDoc->GetAttrPool(), RES_PAGEDESC, RES_PAGEDESC ); aSet.Put(rItem); - lcl_setPageDesc( pDoc, aValue, aSet ); - pDoc->SetDefault(aSet.Get(RES_PAGEDESC)); + lcl_setPageDesc( m_pDoc, aValue, aSet ); + m_pDoc->SetDefault(aSet.Get(RES_PAGEDESC)); } else if ((RES_PARATR_DROP == pMap->nWID && MID_DROPCAP_CHAR_STYLE_NAME == pMap->nMemberId) || (RES_TXTATR_CHARFMT == pMap->nWID)) @@ -109,7 +109,7 @@ void SAL_CALL SwXTextDefaults::setPropertyValue( const OUString& rPropertyName, String sStyle; SwStyleNameMapper::FillUIName(uStyle, sStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True ); SwDocStyleSheet* pStyle = - (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR); + (SwDocStyleSheet*)m_pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR); SwFmtDrop* pDrop = 0; SwFmtCharFmt *pCharFmt = 0; if(pStyle) @@ -119,13 +119,13 @@ void SAL_CALL SwXTextDefaults::setPropertyValue( const OUString& rPropertyName, { pDrop = (SwFmtDrop*)rItem.Clone(); // because rItem ist const... pDrop->SetCharFmt(xStyle->GetCharFmt()); - pDoc->SetDefault(*pDrop); + m_pDoc->SetDefault(*pDrop); } else // RES_TXTATR_CHARFMT == pMap->nWID { pCharFmt = (SwFmtCharFmt*)rItem.Clone(); // because rItem ist const... pCharFmt->SetCharFmt(xStyle->GetCharFmt()); - pDoc->SetDefault(*pCharFmt); + m_pDoc->SetDefault(*pCharFmt); } } else @@ -140,7 +140,7 @@ void SAL_CALL SwXTextDefaults::setPropertyValue( const OUString& rPropertyName, { SfxPoolItem * pNewItem = rItem.Clone(); pNewItem->PutValue( aValue, pMap->nMemberId); - pDoc->SetDefault(*pNewItem); + m_pDoc->SetDefault(*pNewItem); delete pNewItem; } } @@ -150,13 +150,13 @@ Any SAL_CALL SwXTextDefaults::getPropertyValue( const OUString& rPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { vos::OGuard aGuard( Application::GetSolarMutex()); - if (!pDoc) + if (!m_pDoc) throw RuntimeException(); - const SfxItemPropertyMap *pMap = SfxItemPropertyMap::GetByName( aPropSet.getPropertyMap(), rPropertyName); + const SfxItemPropertySimpleEntry *pMap = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); if (!pMap) throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); Any aRet; - const SfxPoolItem& rItem = pDoc->GetDefault(pMap->nWID); + const SfxPoolItem& rItem = m_pDoc->GetDefault(pMap->nWID); rItem.QueryValue( aRet, pMap->nMemberId ); return aRet; } @@ -196,13 +196,13 @@ PropertyState SAL_CALL SwXTextDefaults::getPropertyState( const OUString& rPrope { vos::OGuard aGuard( Application::GetSolarMutex()); PropertyState eRet = PropertyState_DIRECT_VALUE; - if (!pDoc) + if (!m_pDoc) throw RuntimeException(); - const SfxItemPropertyMap *pMap = SfxItemPropertyMap::GetByName( aPropSet.getPropertyMap(), rPropertyName); + const SfxItemPropertySimpleEntry *pMap = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); if (!pMap) throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - const SfxPoolItem& rItem = pDoc->GetDefault(pMap->nWID); + const SfxPoolItem& rItem = m_pDoc->GetDefault(pMap->nWID); if (IsStaticDefaultItem ( &rItem ) ) eRet = PropertyState_DEFAULT_VALUE; return eRet; @@ -227,14 +227,14 @@ Sequence< PropertyState > SAL_CALL SwXTextDefaults::getPropertyStates( const Seq void SAL_CALL SwXTextDefaults::setPropertyToDefault( const OUString& rPropertyName ) throw(UnknownPropertyException, RuntimeException) { - if (!pDoc) + if (!m_pDoc) throw RuntimeException(); - const SfxItemPropertyMap *pMap = SfxItemPropertyMap::GetByName( aPropSet.getPropertyMap(), rPropertyName); + const SfxItemPropertySimpleEntry *pMap = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); if (!pMap) throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); if ( pMap->nFlags & PropertyAttribute::READONLY) throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertyToDefault: property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - SfxItemPool& rSet (pDoc->GetAttrPool()); + SfxItemPool& rSet (m_pDoc->GetAttrPool()); rSet.ResetPoolDefaultItem ( pMap->nWID ); } @@ -242,13 +242,13 @@ void SAL_CALL SwXTextDefaults::setPropertyToDefault( const OUString& rPropertyNa Any SAL_CALL SwXTextDefaults::getPropertyDefault( const OUString& rPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { - if (!pDoc) + if (!m_pDoc) throw RuntimeException(); - const SfxItemPropertyMap *pMap = SfxItemPropertyMap::GetByName( aPropSet.getPropertyMap(), rPropertyName); + const SfxItemPropertySimpleEntry *pMap = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); if (!pMap) throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); Any aRet; - SfxItemPool& rSet (pDoc->GetAttrPool()); + SfxItemPool& rSet (m_pDoc->GetAttrPool()); const SfxPoolItem *pItem = rSet.GetPoolDefaultItem ( pMap->nWID ); pItem->QueryValue( aRet, pMap->nMemberId ); return aRet; diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index 62feb7f2d3d5..d58f7f86cab3 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -37,7 +37,8 @@ #include <unoobj.hxx> #include <unomap.hxx> #include <unoprnms.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> +#include <crossrefbookmark.hxx> #include <doc.hxx> #include <docary.hxx> #include <swundo.hxx> @@ -53,58 +54,58 @@ using namespace ::com::sun::star::text; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; using ::rtl::OUString; +using ::rtl::OUStringBuffer; + +namespace +{ + static OUString lcl_QuoteName(const OUString& rName) + { + static const OUString sStart = OUString(String(SW_RES(STR_START_QUOTE))); + static const OUString sEnd = OUString(String(SW_RES(STR_END_QUOTE))); + OUStringBuffer sBuf(64); + return sBuf.append(sStart).append(rName).append(sEnd).makeStringAndClear(); + } +} /****************************************************************** * SwXBookmark ******************************************************************/ TYPEINIT1(SwXBookmark, SwClient) -/* -----------------------------13.03.00 12:15-------------------------------- - ---------------------------------------------------------------------------*/ const uno::Sequence< sal_Int8 > & SwXBookmark::getUnoTunnelId() { static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); return aSeq; } -/* -----------------------------10.03.00 18:04-------------------------------- - ---------------------------------------------------------------------------*/ sal_Int64 SAL_CALL SwXBookmark::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException) { if( rId.getLength() == 16 - && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) + && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) { return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) ); } return 0; } -/* -----------------10.12.98 10:16------------------- - * - * --------------------------------------------------*/ -SwXBookmark::SwXBookmark(SwBookmark* pBkm, SwDoc* pDc) : - aLstnrCntnr( (text::XTextContent*)this ), - pDoc(pDc), - bIsDescriptor(0 == pBkm) + +SwXBookmark::SwXBookmark(::sw::mark::IMark* pBkmk, SwDoc* pDoc) + : m_aLstnrCntnr((text::XTextContent*)this) + , m_pDoc(pDoc) + , m_pRegisteredBookmark(NULL) { - if(pBkm) - pBkm->Add(this); + registerInMark(pBkmk); } -/*-- 10.12.98 10:14:29--------------------------------------------------- - -----------------------------------------------------------------------*/ SwXBookmark::~SwXBookmark() -{ - -} -/*-- 10.12.98 10:14:39--------------------------------------------------- +{ } - -----------------------------------------------------------------------*/ -void SwXBookmark::attachToRangeEx(const uno::Reference< text::XTextRange > & xTextRange, IDocumentBookmarkAccess::BookmarkType eMark) - throw( lang::IllegalArgumentException, uno::RuntimeException ) +void SwXBookmark::attachToRangeEx( + const uno::Reference< text::XTextRange > & xTextRange, + IDocumentMarkAccess::MarkType eType) + throw(lang::IllegalArgumentException, uno::RuntimeException) { - if(!bIsDescriptor) + if(m_pRegisteredBookmark) throw uno::RuntimeException(); uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY); @@ -114,50 +115,38 @@ void SwXBookmark::attachToRangeEx(const uno::Reference< text::XTextRange > & xTe { pRange = reinterpret_cast< SwXTextRange * >( - sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId() ))); + sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId() ))); pCursor = reinterpret_cast< OTextCursorHelper * >( - sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); + sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ))); } SwDoc* pDc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0; if(pDc) { - pDoc = pDc; - SwUnoInternalPaM aPam(*pDoc); - //das muss jetzt sal_True liefern + m_pDoc = pDc; + SwUnoInternalPaM aPam(*m_pDoc); SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange); - UnoActionContext aCont(pDoc); - SwBookmark* pBkm = 0; + UnoActionContext aCont(m_pDoc); + if(!m_aName.Len()) + m_aName = OUString::createFromAscii("Bookmark"); + if(eType == IDocumentMarkAccess::BOOKMARK && ::sw::mark::CrossRefNumItemBookmark::IsLegalName(m_aName)) + eType = IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK; + else if(eType == IDocumentMarkAccess::BOOKMARK && ::sw::mark::CrossRefHeadingBookmark::IsLegalName(m_aName)) + eType = IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK; + registerInMark(m_pDoc->getIDocumentMarkAccess()->makeMark(aPam, m_aName, eType)); + // --> OD 2007-10-23 #i81002# + // Check, if bookmark has been created. + // E.g., the creation of a cross-reference bookmark is suppress, + // if the PaM isn't a valid one for cross-reference bookmarks. + if(!m_pRegisteredBookmark) { - if(!m_aName.Len()) - m_aName = C2S("Bookmark"); - // --> OD 2007-10-23 #i81002# - // determine bookmark type due to its proposed name - if( eMark == IDocumentBookmarkAccess::BOOKMARK && - pDoc->isCrossRefBookmarkName( m_aName ) ) - eMark = IDocumentBookmarkAccess::CROSSREF_BOOKMARK; - // <-- - if( USHRT_MAX != pDoc->findBookmark(m_aName) ) - pDoc->makeUniqueBookmarkName( m_aName ); - KeyCode aCode; - pBkm = pDoc->makeBookmark( aPam, aCode, m_aName, aEmptyStr, eMark); - // --> OD 2007-10-23 #i81002# - // Check, if bookmark has been created. - // E.g., the creation of a cross-reference bookmark is suppress, - // if the PaM isn't a valid one for cross-reference bookmarks. - if ( pBkm ) - { - pBkm->Add(this); - } - else - { - ASSERT( false, - "<SwXBookmark::attachToRange(..)> - could not create <SwBookmark> instance." ); - } - // <-- - bIsDescriptor = sal_False; + OSL_ENSURE(false, + "<SwXBookmark::attachToRange(..)>" + " - could not create Mark."); + throw lang::IllegalArgumentException(); } + // <-- } else throw lang::IllegalArgumentException(); @@ -166,321 +155,155 @@ void SwXBookmark::attachToRangeEx(const uno::Reference< text::XTextRange > & xTe void SwXBookmark::attachToRange(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException ) { - attachToRangeEx(xTextRange, IDocumentBookmarkAccess::BOOKMARK); -} - -SwXFieldmark::SwXFieldmark(bool _isReplacementObject, SwBookmark* pBkm, SwDoc* pDc) - : SwXFieldmark_BASE(pBkm, pDc) - , isReplacementObject(_isReplacementObject) -{ } - - -void SwXFieldmark::attachToRange(const uno::Reference< text::XTextRange > & xTextRange) - throw( lang::IllegalArgumentException, uno::RuntimeException ) -{ - attachToRangeEx(xTextRange, (isReplacementObject?IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT:IDocumentBookmarkAccess::FORM_FIELDMARK_TEXT)); -} - -::rtl::OUString SwXFieldmark::getDescription(void) throw( ::com::sun::star::uno::RuntimeException ) -{ - vos::OGuard aGuard(Application::GetSolarMutex()); - SwFieldBookmark* pBkm = (SwFieldBookmark*)GetBookmark(); - OUString sRet; - if(pBkm) - sRet = pBkm->GetFFHelpText(); - /* //@TODO implement... - else if(bIsDescriptor) - sRet = m_aName; - */ - else - throw uno::RuntimeException(); - return sRet; -} - -::sal_Int16 SAL_CALL SwXFieldmark::getType( ) throw (::com::sun::star::uno::RuntimeException) -{ - vos::OGuard aGuard(Application::GetSolarMutex()); - SwFieldBookmark* pBkm = (SwFieldBookmark*)GetBookmark(); - ::sal_Int16 sRet; - if(pBkm) - sRet = static_cast<sal_Int16>(pBkm->GetFieldType()); - /* //@TODO implement... - else if(bIsDescriptor) - sRet = m_aName; - */ - else - throw uno::RuntimeException(); - return sRet; -} - -::sal_Int16 SAL_CALL SwXFieldmark::getRes( ) throw (::com::sun::star::uno::RuntimeException) -{ - vos::OGuard aGuard(Application::GetSolarMutex()); - SwFieldBookmark* pBkm = (SwFieldBookmark*)GetBookmark(); - ::sal_Int16 sRet; - if(pBkm) - sRet = static_cast<sal_Int16>(pBkm->GetFFRes()); - /* //@TODO implement... - else if(bIsDescriptor) - sRet = m_aName; - */ - else - throw uno::RuntimeException(); - return sRet; -} - - -void SAL_CALL SwXFieldmark::setType( ::sal_Int16 fieldType ) throw (::com::sun::star::uno::RuntimeException) -{ - vos::OGuard aGuard(Application::GetSolarMutex()); - SwFieldBookmark* pBkm = (SwFieldBookmark*)GetBookmark(); - if (pBkm) - pBkm->SetFieldType(fieldType); - else - throw uno::RuntimeException(); -} - -void SAL_CALL SwXFieldmark::setRes( ::sal_Int16 res ) throw (::com::sun::star::uno::RuntimeException) -{ - vos::OGuard aGuard(Application::GetSolarMutex()); - SwFieldBookmark* pBkm = (SwFieldBookmark*)GetBookmark(); - if (pBkm) - pBkm->SetFFRes(res); - else - throw uno::RuntimeException(); + attachToRangeEx(xTextRange, IDocumentMarkAccess::BOOKMARK); } -void SAL_CALL SwXFieldmark::setDescription( const ::rtl::OUString& description ) throw (::com::sun::star::uno::RuntimeException) -{ - vos::OGuard aGuard(Application::GetSolarMutex()); - SwFieldBookmark* pBkm = (SwFieldBookmark*)GetBookmark(); - if (pBkm) - pBkm->SetFFHelpText(description); - else - throw uno::RuntimeException(); -} - - - -/* - -::com::sun::star::uno::Any SAL_CALL SwXFieldmark::queryInterface( ::com::sun::star::uno::Type const & rType ) throw (::com::sun::star::uno::RuntimeException) -{ - return SwXBookmark::queryInterface(rType); -} -*/ - - -/* -----------------18.02.99 13:31------------------- - * - * --------------------------------------------------*/ void SwXBookmark::attach(const uno::Reference< text::XTextRange > & xTextRange) - throw( lang::IllegalArgumentException, uno::RuntimeException ) + throw( lang::IllegalArgumentException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); attachToRange( xTextRange ); } -/*-- 10.12.98 10:14:39--------------------------------------------------- - -----------------------------------------------------------------------*/ -uno::Reference< text::XTextRange > SwXBookmark::getAnchor(void) throw( uno::RuntimeException ) +uno::Reference< text::XTextRange > SwXBookmark::getAnchor(void) + throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - uno::Reference< text::XTextRange > aRet; - SwBookmark* pBkm = GetBookmark(); - - if(pBkm) - { - const SwPosition& rPos = pBkm->GetBookmarkPos(); - const SwPosition* pMarkPos = pBkm->GetOtherBookmarkPos(); - - aRet = SwXTextRange::CreateTextRangeFromPosition(pDoc, rPos, pMarkPos); - } + uno::Reference< text::XTextRange > aRet; + if(m_pRegisteredBookmark) + aRet = SwXTextRange::CreateTextRangeFromPosition( + m_pDoc, + m_pRegisteredBookmark->GetMarkPos(), + m_pRegisteredBookmark->IsExpanded() ? &m_pRegisteredBookmark->GetOtherMarkPos() : NULL); else throw uno::RuntimeException(); return aRet; - - } -/*-- 10.12.98 10:14:40--------------------------------------------------- - -----------------------------------------------------------------------*/ -void SwXBookmark::dispose(void) throw( uno::RuntimeException ) +void SwXBookmark::dispose(void) + throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - SwBookmark* pBkm = GetBookmark(); - if(pBkm) - GetDoc()->deleteBookmark(getName()); + if(m_pRegisteredBookmark) + GetDoc()->getIDocumentMarkAccess()->deleteMark(m_pRegisteredBookmark); else throw uno::RuntimeException(); } -/*-- 10.12.98 10:14:40--------------------------------------------------- - -----------------------------------------------------------------------*/ void SwXBookmark::addEventListener(const uno::Reference< lang::XEventListener > & aListener) - throw( uno::RuntimeException ) + throw( uno::RuntimeException ) { - if(!GetRegisteredIn()) + if(!m_pRegisteredBookmark) throw uno::RuntimeException(); - aLstnrCntnr.AddListener(aListener); + m_aLstnrCntnr.AddListener(aListener); } -/*-- 10.12.98 10:14:41--------------------------------------------------- - -----------------------------------------------------------------------*/ void SwXBookmark::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException ) { - if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener)) + if(!m_pRegisteredBookmark || !m_aLstnrCntnr.RemoveListener(aListener)) throw uno::RuntimeException(); } -/*-- 10.12.98 10:14:41--------------------------------------------------- - -----------------------------------------------------------------------*/ -OUString SwXBookmark::getName(void) throw( uno::RuntimeException ) +OUString SwXBookmark::getName(void) + throw(uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - SwBookmark* pBkm = GetBookmark(); OUString sRet; - if(pBkm) - sRet = pBkm->GetName(); - else if(bIsDescriptor) - sRet = m_aName; + if(m_pRegisteredBookmark) + sRet = m_pRegisteredBookmark->GetName(); else - throw uno::RuntimeException(); + sRet = m_aName; return sRet; } -/*-- 10.12.98 10:14:42--------------------------------------------------- - -----------------------------------------------------------------------*/ -void SwXBookmark::setName(const OUString& rName) throw( uno::RuntimeException ) +void SwXBookmark::setName(const OUString& rName) + throw(uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - SwBookmark* pBkm = GetBookmark(); - String sBkName(rName); - String sOldName = getName(); - if(sOldName != sBkName && pBkm && USHRT_MAX == pDoc->findBookmark(sBkName)) - { - KeyCode aCode; - String sShortName; - SwPaM aPam(pBkm->GetBookmarkPos()); - if(pBkm->GetOtherBookmarkPos()) - { - aPam.SetMark(); - *aPam.GetMark() = *pBkm->GetOtherBookmarkPos(); - } - - SwRewriter aRewriter; - - { - String aStr(SW_RES(STR_START_QUOTE)); - - aStr += sOldName; - aStr += String(SW_RES(STR_END_QUOTE)); - - aRewriter.AddRule(UNDO_ARG1, aStr); - } - - aRewriter.AddRule(UNDO_ARG2, SW_RES(STR_YIELDS)); - - { - String aStr(SW_RES(STR_START_QUOTE)); - - aStr += String(rName); - aStr += String(SW_RES(STR_END_QUOTE)); - aRewriter.AddRule(UNDO_ARG3, aStr); - } + if(!m_pRegisteredBookmark) + m_aName = rName; + if(!m_pRegisteredBookmark || getName() == rName) + return; + IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess(); + if(pMarkAccess->findMark(rName) != pMarkAccess->getMarksEnd()) + throw uno::RuntimeException(); - pDoc->StartUndo(UNDO_BOOKMARK_RENAME, &aRewriter); + SwPaM aPam(m_pRegisteredBookmark->GetMarkPos()); + if(m_pRegisteredBookmark->IsExpanded()) + { + aPam.SetMark(); + *aPam.GetMark() = m_pRegisteredBookmark->GetOtherMarkPos(); + } - // --> OD 2007-10-23 #i81002# - SwBookmark* pMark = pDoc->makeBookmark( aPam, aCode, - sBkName, sShortName, - pBkm->GetType() ); - // <-- - pMark->Add(this); - GetDoc()->deleteBookmark( sOldName ); + SwRewriter aRewriter; + aRewriter.AddRule(UNDO_ARG1, lcl_QuoteName(getName())); + aRewriter.AddRule(UNDO_ARG2, SW_RES(STR_YIELDS)); + aRewriter.AddRule(UNDO_ARG3, lcl_QuoteName(rName)); - pDoc->EndUndo(UNDO_BOOKMARK_RENAME, NULL); - } - else if(bIsDescriptor) - m_aName = sBkName; - else - throw uno::RuntimeException(); + m_pDoc->StartUndo(UNDO_BOOKMARK_RENAME, &aRewriter); + pMarkAccess->renameMark(m_pRegisteredBookmark, rName); + m_pDoc->EndUndo(UNDO_BOOKMARK_RENAME, NULL); } -/* -----------------02.11.99 11:30------------------- - - --------------------------------------------------*/ OUString SwXBookmark::getImplementationName(void) throw( uno::RuntimeException ) { - return C2U("SwXBookmark"); + return OUString::createFromAscii("SwXBookmark"); } -/* -----------------02.11.99 11:30------------------- - --------------------------------------------------*/ -sal_Bool SwXBookmark::supportsService(const OUString& rServiceName) throw( uno::RuntimeException ) +sal_Bool SwXBookmark::supportsService(const OUString& rServiceName) + throw( uno::RuntimeException ) { return !rServiceName.compareToAscii("com.sun.star.text.Bookmark") || !rServiceName.compareToAscii("com.sun.star.document.LinkTarget") || !rServiceName.compareToAscii("com.sun.star.text.TextContent"); -; } -/* -----------------02.11.99 11:30------------------- - --------------------------------------------------*/ -uno::Sequence< OUString > SwXBookmark::getSupportedServiceNames(void) throw( uno::RuntimeException ) +uno::Sequence< OUString > SwXBookmark::getSupportedServiceNames(void) + throw( uno::RuntimeException ) { uno::Sequence< OUString > aRet(3); - OUString* pArr = aRet.getArray(); - pArr[0] = C2U("com.sun.star.text.Bookmark"); - pArr[1] = C2U("com.sun.star.document.LinkTarget"); - pArr[2] = C2U("com.sun.star.text.TextContent"); + aRet[0] = OUString::createFromAscii("com.sun.star.text.Bookmark"); + aRet[1] = OUString::createFromAscii("com.sun.star.document.LinkTarget"); + aRet[2] = OUString::createFromAscii("com.sun.star.text.TextContent"); return aRet; } -/*-- 10.12.98 10:14:42--------------------------------------------------- - -----------------------------------------------------------------------*/ -void SwXBookmark::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) +void SwXBookmark::Modify(SfxPoolItem *pOld, SfxPoolItem *pNew) { ClientModify(this, pOld, pNew); - if(!GetBookmark()) + if(!GetRegisteredIn()) { - pDoc = 0; - aLstnrCntnr.Disposing(); + m_pRegisteredBookmark = NULL; + m_pDoc = NULL; + m_aLstnrCntnr.Disposing(); } } -/*-- 30.03.99 16:02:58--------------------------------------------------- - -----------------------------------------------------------------------*/ -uno::Reference< beans::XPropertySetInfo > SwXBookmark::getPropertySetInfo(void) throw( uno::RuntimeException ) +uno::Reference< beans::XPropertySetInfo > SwXBookmark::getPropertySetInfo(void) + throw( uno::RuntimeException ) { static uno::Reference< beans::XPropertySetInfo > aRef; if(!aRef.is()) { - const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_BOOKMARK); - uno::Reference< beans::XPropertySetInfo > xInfo = new SfxItemPropertySetInfo(pMap); - // extend PropertySetInfo! - const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties(); - aRef = new SfxExtItemPropertySetInfo( - aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH_EXTENSIONS), - aPropSeq ); + uno::Reference< beans::XPropertySetInfo > xInfo = aSwMapProvider.GetPropertySet(PROPERTY_MAP_BOOKMARK)->getPropertySetInfo(); } return aRef; } -/*-- 30.03.99 16:02:59--------------------------------------------------- - -----------------------------------------------------------------------*/ void SwXBookmark::setPropertyValue(const OUString& PropertyName, const uno::Any& /*aValue*/) - throw( beans::UnknownPropertyException, beans::PropertyVetoException, - lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException ) + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, + uno::RuntimeException ) { + // nothing to set here throw IllegalArgumentException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + PropertyName, static_cast < cppu::OWeakObject * > ( this ), 0 ); - //hier gibt es nichts zu setzen } -/*-- 30.03.99 16:02:59--------------------------------------------------- - -----------------------------------------------------------------------*/ -uno::Any SwXBookmark::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) +uno::Any SwXBookmark::getPropertyValue(const OUString& rPropertyName) + throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { uno::Any aRet; if(!SwXParagraph::getDefaultTextContentValue(aRet, rPropertyName)) @@ -490,33 +313,91 @@ uno::Any SwXBookmark::getPropertyValue(const OUString& rPropertyName) throw( bea } return aRet; } -/*-- 30.03.99 16:02:59--------------------------------------------------- - -----------------------------------------------------------------------*/ void SwXBookmark::addPropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) -{ -} -/*-- 30.03.99 16:02:59--------------------------------------------------- +{ } - -----------------------------------------------------------------------*/ void SwXBookmark::removePropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) -{ -} -/*-- 30.03.99 16:03:00--------------------------------------------------- +{ } - -----------------------------------------------------------------------*/ void SwXBookmark::addVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) + throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) +{ } + +void SwXBookmark::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) + throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) +{ } + +SwXFieldmark::SwXFieldmark(bool _isReplacementObject, ::sw::mark::IMark* pBkm, SwDoc* pDc) + : SwXFieldmark_BASE(pBkm, pDc) + , isReplacementObject(_isReplacementObject) +{ } + +void SwXFieldmark::attachToRange(const uno::Reference< text::XTextRange > & xTextRange) + throw( lang::IllegalArgumentException, uno::RuntimeException ) +{ + attachToRangeEx(xTextRange, (isReplacementObject?IDocumentMarkAccess::CHECKBOX_FIELDMARK:IDocumentMarkAccess::TEXT_FIELDMARK)); +} + +::rtl::OUString SwXFieldmark::getDescription(void) throw( ::com::sun::star::uno::RuntimeException ) { + vos::OGuard aGuard(Application::GetSolarMutex()); +// TODO implement... +// if(!GetBookmark()) + ::sw::mark::IFieldmark const * const pMark = + dynamic_cast< ::sw::mark::IFieldmark const * const>(GetBookmark()); + if(!pMark) + throw uno::RuntimeException(); + return pMark->GetFieldHelptext(); } -/*-- 30.03.99 16:03:00--------------------------------------------------- - -----------------------------------------------------------------------*/ -void SwXBookmark::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) +::sal_Int16 SAL_CALL SwXFieldmark::getType() throw (::com::sun::star::uno::RuntimeException) { + vos::OGuard aGuard(Application::GetSolarMutex()); + ::sw::mark::ICheckboxFieldmark const * const pAsCheckbox = + dynamic_cast< ::sw::mark::ICheckboxFieldmark const * const>(GetBookmark()); + if(pAsCheckbox) + return 1; + return 0; +} + +::sal_Int16 SAL_CALL SwXFieldmark::getRes() throw (::com::sun::star::uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + ::sw::mark::ICheckboxFieldmark const * const pAsCheckbox = + dynamic_cast< ::sw::mark::ICheckboxFieldmark const * const>(GetBookmark()); + if(pAsCheckbox && pAsCheckbox->IsChecked()) + return 1; + return 0; +} + +//FIXME Remove Method +void SAL_CALL SwXFieldmark::setType( ::sal_Int16 ) throw (::com::sun::star::uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + throw uno::RuntimeException(); +} + +//FIXME Remove Method +void SAL_CALL SwXFieldmark::setRes( ::sal_Int16 ) throw (::com::sun::star::uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + throw uno::RuntimeException(); +} + +void SAL_CALL SwXFieldmark::setDescription( const ::rtl::OUString& description ) + throw (::com::sun::star::uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + const ::sw::mark::IFieldmark* pMark = + dynamic_cast<const ::sw::mark::IFieldmark*>(GetBookmark()); + if(pMark) + const_cast< ::sw::mark::IFieldmark*>(pMark)->SetFieldHelptext(description); + else + throw uno::RuntimeException(); } diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 4d2306af6f7d..b89163f60a3e 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -2032,7 +2032,7 @@ SwChartDataSequence::SwChartDataSequence( pDataProvider( &rProvider ), pTblCrsr( pTableCursor ), aCursorDepend( this, pTableCursor ), - pMap( aSwMapProvider.GetPropertyMap( PROPERTY_MAP_CHART2_DATA_SEQUENCE ) ) + _pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_CHART2_DATA_SEQUENCE ) ) { bDisposed = sal_False; @@ -2083,7 +2083,7 @@ SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence &rObj ) : pDataProvider( rObj.pDataProvider ), pTblCrsr( rObj.pTblCrsr->Clone() ), aCursorDepend( this, pTblCrsr ), - pMap( rObj.pMap ) + _pPropSet( rObj._pPropSet ) { bDisposed = sal_False; @@ -2398,7 +2398,7 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL SwChartDataSequence::getPrope if (bDisposed) throw lang::DisposedException(); - static uno::Reference< beans::XPropertySetInfo > xRes = new SfxItemPropertySetInfo( pMap ); + static uno::Reference< beans::XPropertySetInfo > xRes = _pPropSet->getPropertySetInfo(); return xRes; } diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index c3d67474dce3..b17cf48f5d9f 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -48,7 +48,7 @@ #include <fmtanchr.hxx> #include <ndtxt.hxx> #include <section.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <ftnidx.hxx> #include <fmtftn.hxx> #include <txtftn.hxx> @@ -71,6 +71,10 @@ #include <authfld.hxx> #include <SwXTextDefaults.hxx> #include <unochart.hxx> +#include <comphelper/makesequence.hxx> +#include <comphelper/sequence.hxx> +#include <slist> +#include <iterator> #include "docsh.hxx" @@ -200,9 +204,9 @@ const ProvNamesId_Type __FAR_DATA aProvNamesId[] = { "com.sun.star.image.ImageMapCircleObject", SW_SERVICE_IMAP_CIRCLE }, { "com.sun.star.image.ImageMapPolygonObject", SW_SERVICE_IMAP_POLYGON }, { "com.sun.star.text.TextGraphicObject", SW_SERVICE_TYPE_TEXT_GRAPHIC }, + { "com.sun.star.chart2.data.DataProvider", SW_SERVICE_CHART2_DATA_PROVIDER }, { "com.sun.star.text.Fieldmark", SW_SERVICE_TYPE_FIELDMARK }, { "com.sun.star.text.FormFieldmark", SW_SERVICE_TYPE_FORMFIELDMARK }, - { "com.sun.star.chart2.data.DataProvider", SW_SERVICE_CHART2_DATA_PROVIDER }, // case-correct versions of the service names (see #i67811) { CSS_TEXT_TEXTFIELD_DATE_TIME, SW_SERVICE_FIELDTYPE_DATETIME }, @@ -795,268 +799,289 @@ XTextTable* SwXTextTables::GetObject( SwFrmFmt& rFmt ) pTbl = new SwXTextTable(rFmt); return pTbl ; } + + /****************************************************************** - * SwXFrames + * SwXFrameEnumeration ******************************************************************/ -/* -----------------------------06.04.00 12:41-------------------------------- +namespace +{ + template<FlyCntType T> struct SwXFrameEnumeration_traits {}; - ---------------------------------------------------------------------------*/ + template<> + struct SwXFrameEnumeration_traits<FLYCNTTYPE_FRM> + { + typedef SwXTextFrame core_frame_t; + typedef XTextFrame uno_frame_t; + static inline bool filter(const SwNode* const pNode) { return !pNode->IsNoTxtNode(); }; + }; + + template<> + struct SwXFrameEnumeration_traits<FLYCNTTYPE_GRF> + { + typedef SwXTextGraphicObject core_frame_t; + typedef XTextContent uno_frame_t; + static inline bool filter(const SwNode* const pNode) { return pNode->IsGrfNode(); }; + }; + + template<> + struct SwXFrameEnumeration_traits<FLYCNTTYPE_OLE> + { + typedef SwXTextEmbeddedObject core_frame_t; + typedef XEmbeddedObjectSupplier uno_frame_t; + static inline bool filter(const SwNode* const pNode) { return pNode->IsOLENode(); }; + }; + + template<FlyCntType T> + class SwXFrameEnumeration : public SwSimpleEnumerationBaseClass + { + private: + typedef ::std::slist< Any > frmcontainer_t; + frmcontainer_t m_aFrames; + protected: + virtual ~SwXFrameEnumeration() {}; + public: + SwXFrameEnumeration(const SwDoc* const pDoc); + + //XEnumeration + virtual BOOL SAL_CALL hasMoreElements(void) throw( RuntimeException ); + virtual Any SAL_CALL nextElement(void) throw( NoSuchElementException, WrappedTargetException, RuntimeException ); + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName(void) throw( RuntimeException ); + virtual BOOL SAL_CALL supportsService(const OUString& ServiceName) throw( RuntimeException ); + virtual Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( RuntimeException ); + }; +} + +template<FlyCntType T> +SwXFrameEnumeration<T>::SwXFrameEnumeration(const SwDoc* const pDoc) + : m_aFrames() +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + const SwSpzFrmFmts* const pFmts = pDoc->GetSpzFrmFmts(); + const USHORT nSize = pFmts->Count(); + ::std::insert_iterator<frmcontainer_t> pInserter = ::std::insert_iterator<frmcontainer_t>(m_aFrames, m_aFrames.begin()); + for( USHORT i=0; i < nSize; ++i ) + { + SwFrmFmt* pFmt = (*pFmts)[i]; + if(pFmt->Which() != RES_FLYFRMFMT) + continue; + const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); + if(!pIdx || !pIdx->GetNodes().IsDocNodes()) + continue; + const SwNode* pNd = pDoc->GetNodes()[ pIdx->GetIndex() + 1 ]; + if(SwXFrameEnumeration_traits<T>::filter(pNd)) + { + SwXFrame* pFrm = (SwXFrame*)SwClientIter( *pFmt ).First( TYPE( SwXFrame )); + if( !pFrm ) + pFrm = new typename SwXFrameEnumeration_traits<T>::core_frame_t(*pFmt); + Reference< typename SwXFrameEnumeration_traits<T>::uno_frame_t > xFrm = + static_cast< typename SwXFrameEnumeration_traits<T>::core_frame_t* >(pFrm); + *pInserter++ = uno::makeAny(xFrm); + } + } +} + +template<FlyCntType T> +BOOL SwXFrameEnumeration<T>::hasMoreElements(void) throw( RuntimeException ) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + return !m_aFrames.empty(); +} + +template<FlyCntType T> +Any SwXFrameEnumeration<T>::nextElement(void) throw( NoSuchElementException, WrappedTargetException, RuntimeException ) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + if(m_aFrames.empty()) + throw NoSuchElementException(); + Any aResult = *m_aFrames.begin(); + m_aFrames.pop_front(); + return aResult; +} + +template<FlyCntType T> +OUString SwXFrameEnumeration<T>::getImplementationName(void) throw( RuntimeException ) +{ + return C2U("SwXFrameEnumeration"); +} + +template<FlyCntType T> +BOOL SwXFrameEnumeration<T>::supportsService(const OUString& ServiceName) throw( RuntimeException ) +{ + return C2U("com.sun.star.container.XEnumeration") == ServiceName; +} + +template<FlyCntType T> +Sequence< OUString > SwXFrameEnumeration<T>::getSupportedServiceNames(void) throw( RuntimeException ) +{ + return ::comphelper::makeSequence(C2U("com.sun.star.container.XEnumeration")); +} + +/****************************************************************** + * SwXFrames + ******************************************************************/ OUString SwXFrames::getImplementationName(void) throw( RuntimeException ) { return C2U("SwXFrames"); } -/* -----------------------------06.04.00 12:41-------------------------------- - ---------------------------------------------------------------------------*/ BOOL SwXFrames::supportsService(const OUString& rServiceName) throw( RuntimeException ) { return C2U("com.sun.star.text.TextFrames") == rServiceName; } -/* -----------------------------06.04.00 12:41-------------------------------- - ---------------------------------------------------------------------------*/ -Sequence< OUString > SwXFrames::getSupportedServiceNames(void) throw( RuntimeException ) +Sequence<OUString> SwXFrames::getSupportedServiceNames(void) throw( RuntimeException ) { - Sequence< OUString > aRet(1); - OUString* pArray = aRet.getArray(); - pArray[0] = C2U("com.sun.star.text.TextFrames"); - return aRet; + return ::comphelper::makeSequence(C2U("com.sun.star.text.TextFrames")); } -/*-- 14.01.99 08:20:18--------------------------------------------------- - - -----------------------------------------------------------------------*/ SwXFrames::SwXFrames(SwDoc* _pDoc, FlyCntType eSet) : SwUnoCollection(_pDoc), eType(eSet) -{ -} - -/*-- 14.01.99 08:20:18--------------------------------------------------- +{} - -----------------------------------------------------------------------*/ SwXFrames::~SwXFrames() +{} + +uno::Reference<container::XEnumeration> SwXFrames::createEnumeration(void) throw(uno::RuntimeException) { + vos::OGuard aGuard(Application::GetSolarMutex()); + if(!IsValid()) + throw uno::RuntimeException(); + switch(eType) + { + case FLYCNTTYPE_FRM: + return uno::Reference< container::XEnumeration >( + new SwXFrameEnumeration<FLYCNTTYPE_FRM>(GetDoc())); + case FLYCNTTYPE_GRF: + return uno::Reference< container::XEnumeration >( + new SwXFrameEnumeration<FLYCNTTYPE_GRF>(GetDoc())); + case FLYCNTTYPE_OLE: + return uno::Reference< container::XEnumeration >( + new SwXFrameEnumeration<FLYCNTTYPE_OLE>(GetDoc())); + default: + throw uno::RuntimeException(); + } } -/*-- 14.01.99 08:25:47--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Int32 SwXFrames::getCount(void) throw( uno::RuntimeException ) +sal_Int32 SwXFrames::getCount(void) throw(uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - sal_Int32 nRet = 0; - if(IsValid()) - nRet = GetDoc()->GetFlyCount(eType); - else + if(!IsValid()) throw uno::RuntimeException(); - return nRet; + const Reference<XEnumeration> xEnum = createEnumeration(); + sal_Int32 nCount = 0; + while(xEnum->hasMoreElements()) + { + xEnum->nextElement(); + ++nCount; + } + return nCount; } -/*-- 14.01.99 08:25:47--------------------------------------------------- - -----------------------------------------------------------------------*/ uno::Any SwXFrames::getByIndex(sal_Int32 nIndex) - throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException ) + throw(IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - uno::Any aRet; - if(IsValid()) + if(!IsValid()) throw uno::RuntimeException(); + if(nIndex < 0 || nIndex >= USHRT_MAX) throw IndexOutOfBoundsException(); + const Reference<XEnumeration> xEnum = createEnumeration(); + while(xEnum->hasMoreElements()) { - sal_uInt16 nCount = GetDoc()->GetFlyCount(eType); - if( 0 <= nIndex && nIndex < USHRT_MAX && nCount > nIndex) - { - SwFrmFmt* pFmt = GetDoc()->GetFlyNum((sal_uInt16) nIndex, eType); - SwXFrame* pFrm = SwXFrames::GetObject(*pFmt, eType); - switch(eType) - { - case FLYCNTTYPE_FRM: - { - uno::Reference< XTextFrame > xRef = (SwXTextFrame*)pFrm; - aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextFrame>*)0)); - } - break; - case FLYCNTTYPE_GRF: - { - Reference< XTextContent > xRef = (SwXTextGraphicObject*)pFrm; - aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0)); - } - break; - case FLYCNTTYPE_OLE: - { - Reference< XEmbeddedObjectSupplier > xRef = (SwXTextEmbeddedObject*)pFrm; - aRet.setValue(&xRef, ::getCppuType((Reference<XEmbeddedObjectSupplier>*)0)); - } - break; - - default: - ; - } - } - else - throw IndexOutOfBoundsException(); + uno::Any aCurrent = xEnum->nextElement(); + if(nIndex-- == 0) + return aCurrent; } - else - throw uno::RuntimeException(); - return aRet; + throw IndexOutOfBoundsException(); } -/*-- 14.01.99 08:25:47--------------------------------------------------- - - -----------------------------------------------------------------------*/ uno::Any SwXFrames::getByName(const OUString& rName) - throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException ) + throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - SwXFrame* pFrm = 0; - if(IsValid()) - { - sal_uInt16 nCount = GetDoc()->GetFlyCount(eType); - for( sal_uInt16 i = 0; i < nCount; i++) - { - String aName(rName); - SwFrmFmt* pFmt = GetDoc()->GetFlyNum(i, eType); - if(aName == pFmt->GetName() ) - { - pFrm = SwXFrames::GetObject(*pFmt, eType); - break; - } - } - } - else - throw uno::RuntimeException(); - if(!pFrm) - throw NoSuchElementException(); - uno::Any aRet; - switch(eType) + if(!IsValid()) throw uno::RuntimeException(); + const Reference<XEnumeration> xEnum = createEnumeration(); + while(xEnum->hasMoreElements()) { - case FLYCNTTYPE_FRM: - { - uno::Reference< XTextFrame > xRef = (SwXTextFrame*)pFrm; - aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextFrame>*)0)); - } - break; - case FLYCNTTYPE_GRF: - { - uno::Reference< XTextContent > xRef = (SwXTextGraphicObject*)pFrm; - aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0)); - } - break; - case FLYCNTTYPE_OLE: - { - Reference< XEmbeddedObjectSupplier > xRef = (SwXTextEmbeddedObject*)pFrm; - aRet.setValue(&xRef, ::getCppuType((Reference<XEmbeddedObjectSupplier>*)0)); - } - break; - - default: - ; + uno::Any aCurrent = xEnum->nextElement(); + Reference<container::XNamed> xNamed; + aCurrent >>= xNamed; + if(xNamed.is() && xNamed->getName() == rName) + return aCurrent; } - return aRet; + throw NoSuchElementException(); } -/*-- 14.01.99 08:25:48--------------------------------------------------- - -----------------------------------------------------------------------*/ -uno::Sequence< OUString > SwXFrames::getElementNames(void) throw( uno::RuntimeException ) +uno::Sequence<OUString> SwXFrames::getElementNames(void) throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - if(!IsValid()) - throw uno::RuntimeException(); - sal_uInt16 nCount = IsValid() ? GetDoc()->GetFlyCount(eType) : 0; - uno::Sequence<OUString> aSeq(nCount); - if(nCount) + if(!IsValid()) throw uno::RuntimeException(); + const Reference<XEnumeration> xEnum = createEnumeration(); + ::std::vector<OUString> vNames; + while(xEnum->hasMoreElements()) { - OUString* pArray = aSeq.getArray(); - for( sal_uInt16 i = 0; i < nCount; i++) - { - SwFrmFmt* pFmt = GetDoc()->GetFlyNum(i, eType); - pArray[i] = pFmt->GetName(); - } + Reference<container::XNamed> xNamed; + xEnum->nextElement() >>= xNamed; + if(xNamed.is()) + vNames.push_back(xNamed->getName()); } - return aSeq; + return ::comphelper::containerToSequence(vNames); } -/*-- 14.01.99 08:25:48--------------------------------------------------- - -----------------------------------------------------------------------*/ sal_Bool SwXFrames::hasByName(const OUString& rName) throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - if(!IsValid()) - throw uno::RuntimeException(); - - BYTE nNodeType = ND_TEXTNODE; - switch( eType ) + if(!IsValid()) throw uno::RuntimeException(); + const Reference<XEnumeration> xEnum = createEnumeration(); + while(xEnum->hasMoreElements()) { - case FLYCNTTYPE_GRF: nNodeType = ND_GRFNODE; break; - case FLYCNTTYPE_OLE: nNodeType = ND_OLENODE; break; - default: - ; + Reference<XNamed> xNamed; + xEnum->nextElement() >>= xNamed; + if(xNamed.is() && xNamed->getName() == rName) + return true; } - - return 0 != GetDoc()->FindFlyByName( rName, nNodeType ); + return false; } -/*-- 14.01.99 08:25:48--------------------------------------------------- - - -----------------------------------------------------------------------*/ uno::Type SAL_CALL SwXFrames::getElementType() throw(uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - uno::Type aRet; switch(eType) { case FLYCNTTYPE_FRM: - aRet = ::getCppuType((uno::Reference<XTextFrame>*)0); - - break; + return ::getCppuType((uno::Reference<XTextFrame>*)0); case FLYCNTTYPE_GRF: - aRet = ::getCppuType((uno::Reference<XTextContent>*)0); - - break; + return ::getCppuType((uno::Reference<XTextContent>*)0); case FLYCNTTYPE_OLE: - aRet = ::getCppuType((uno::Reference<XEmbeddedObjectSupplier>*)0); - break; + return ::getCppuType((uno::Reference<XEmbeddedObjectSupplier>*)0); default: - ; + return uno::Type(); } - return aRet; } -/*-- 14.01.99 08:25:48--------------------------------------------------- - -----------------------------------------------------------------------*/ -sal_Bool SwXFrames::hasElements(void) throw( uno::RuntimeException ) +sal_Bool SwXFrames::hasElements(void) throw(uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - sal_uInt16 nRet = 0; - if(IsValid()) - nRet = GetDoc()->GetFlyCount(eType); - else - throw uno::RuntimeException(); - return nRet != 0; + if(IsValid()) throw uno::RuntimeException(); + return createEnumeration()->hasMoreElements(); } -/*-- 14.01.99 08:25:48--------------------------------------------------- - -----------------------------------------------------------------------*/ -SwXFrame* SwXFrames::GetObject( SwFrmFmt& rFmt, FlyCntType eType ) +SwXFrame* SwXFrames::GetObject(SwFrmFmt& rFmt, FlyCntType eType) { - SwXFrame* pFrm = (SwXFrame*)SwClientIter( rFmt ). - First( TYPE( SwXFrame )); - if( !pFrm ) + SwXFrame* pFrm = (SwXFrame*)SwClientIter(rFmt).First(TYPE(SwXFrame)); + if(pFrm) return pFrm; + switch(eType) { - switch(eType) - { - case FLYCNTTYPE_FRM: - pFrm = new SwXTextFrame(rFmt); - break; - case FLYCNTTYPE_GRF: - pFrm = new SwXTextGraphicObject(rFmt); - break; - case FLYCNTTYPE_OLE: - pFrm = new SwXTextEmbeddedObject(rFmt); - break; - default: - ; - } + case FLYCNTTYPE_FRM: + return new SwXTextFrame(rFmt); + case FLYCNTTYPE_GRF: + return new SwXTextGraphicObject(rFmt); + case FLYCNTTYPE_OLE: + return new SwXTextEmbeddedObject(rFmt); + default: + return NULL; } - return pFrm; } /****************************************************************** @@ -1410,190 +1435,138 @@ uno::Reference< XTextSection > SwXTextSections::GetObject( SwSectionFmt& rFmt ) xRet = SwXTextSectionClient::CreateXTextSection(&rFmt); return xRet; } -/****************************************************************** - * - ******************************************************************/ -/* -----------------------------06.04.00 12:44-------------------------------- - ---------------------------------------------------------------------------*/ OUString SwXBookmarks::getImplementationName(void) throw( RuntimeException ) { - return C2U("SwXBookmarks"); + return OUString::createFromAscii("SwXBookmarks"); } -/* -----------------------------06.04.00 12:44-------------------------------- - ---------------------------------------------------------------------------*/ BOOL SwXBookmarks::supportsService(const OUString& rServiceName) throw( RuntimeException ) { - return C2U("com.sun.star.text.Bookmarks") == rServiceName; + return OUString::createFromAscii("com.sun.star.text.Bookmarks") == rServiceName; } -/* -----------------------------06.04.00 12:44-------------------------------- - ---------------------------------------------------------------------------*/ Sequence< OUString > SwXBookmarks::getSupportedServiceNames(void) throw( RuntimeException ) { Sequence< OUString > aRet(1); - OUString* pArray = aRet.getArray(); - pArray[0] = C2U("com.sun.star.text.Bookmarks"); + aRet[0] = OUString::createFromAscii("com.sun.star.text.Bookmarks"); return aRet; } -/*-- 14.01.99 09:05:48--------------------------------------------------- - -----------------------------------------------------------------------*/ SwXBookmarks::SwXBookmarks(SwDoc* _pDoc) : SwUnoCollection(_pDoc) -{ -} -/*-- 14.01.99 09:05:48--------------------------------------------------- +{ } - -----------------------------------------------------------------------*/ SwXBookmarks::~SwXBookmarks() -{ -} -/*-- 14.01.99 09:05:49--------------------------------------------------- +{ } - -----------------------------------------------------------------------*/ -sal_Int32 SwXBookmarks::getCount(void) throw( uno::RuntimeException ) +sal_Int32 SwXBookmarks::getCount(void) + throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); if(!IsValid()) throw uno::RuntimeException(); - return GetDoc()->getBookmarkCount(sal_True); + return GetDoc()->getIDocumentMarkAccess()->getBookmarksCount(); } -/*-- 14.01.99 09:05:49--------------------------------------------------- - -----------------------------------------------------------------------*/ uno::Any SwXBookmarks::getByIndex(sal_Int32 nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - uno::Any aRet; - if(IsValid()) - { - if(0 <= nIndex && GetDoc()->getBookmarkCount(true) > nIndex) - { - SwBookmark& rBkm = GetDoc()->getBookmark((sal_uInt16) nIndex, true); - uno::Reference< XTextContent > xRef = GetObject(rBkm, GetDoc()); - aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0)); - } - else - throw IndexOutOfBoundsException(); - } - else + if(!IsValid()) throw uno::RuntimeException(); + IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess(); + if(nIndex < 0 || nIndex >= pMarkAccess->getBookmarksCount()) + throw IndexOutOfBoundsException(); + + uno::Any aRet; + ::sw::mark::IMark* pBkmk = pMarkAccess->getBookmarksBegin()[nIndex].get(); + uno::Reference< XTextContent > xRef = GetObject(*pBkmk, GetDoc()); + aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0)); return aRet; } -/*-- 14.01.99 09:05:49--------------------------------------------------- - -----------------------------------------------------------------------*/ uno::Any SwXBookmarks::getByName(const rtl::OUString& rName) throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - uno::Any aRet; - if(IsValid()) - { - String aName(rName); - sal_uInt16 nCount = GetDoc()->getBookmarkCount(true); - uno::Reference< XTextContent > xRef; - for( sal_uInt16 i = 0; i < nCount; i++) - { - SwBookmark& rBkMk = GetDoc()->getBookmark( i, true ); - if(rBkMk.GetName() == aName) - { - xRef = SwXBookmarks::GetObject(rBkMk, GetDoc()); - aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0)); - break; - } - } - if(!xRef.is()) - throw NoSuchElementException(); - } - else + if(!IsValid()) throw uno::RuntimeException(); + + IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess(); + IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findBookmark(rName); + if(ppBkmk == pMarkAccess->getBookmarksEnd()) + throw NoSuchElementException(); + + uno::Any aRet; + uno::Reference< XTextContent > xRef = SwXBookmarks::GetObject(*(ppBkmk->get()), GetDoc()); + aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0)); return aRet; } -/*-- 14.01.99 09:05:49--------------------------------------------------- - -----------------------------------------------------------------------*/ -uno::Sequence< OUString > SwXBookmarks::getElementNames(void) throw( uno::RuntimeException ) +uno::Sequence< OUString > SwXBookmarks::getElementNames(void) + throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); if(!IsValid()) throw uno::RuntimeException(); - sal_uInt16 nCount = GetDoc()->getBookmarkCount(true); - uno::Sequence<OUString> aSeq(nCount); - if(nCount) - { - OUString* pArray = aSeq.getArray(); - for( sal_uInt16 i = 0; i < nCount; i++) - { - SwBookmark& rBkMk = GetDoc()->getBookmark( i, true ); - pArray[i] = rBkMk.GetName(); - } - } + + IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess(); + uno::Sequence<OUString> aSeq(pMarkAccess->getBookmarksCount()); + sal_Int32 nCnt = 0; + for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin(); + ppMark != pMarkAccess->getBookmarksEnd();) + aSeq[nCnt++] = (*ppMark++)->GetName(); return aSeq; } -/*-- 14.01.99 09:05:49--------------------------------------------------- - -----------------------------------------------------------------------*/ -sal_Bool SwXBookmarks::hasByName(const OUString& rName) throw( uno::RuntimeException ) +sal_Bool SwXBookmarks::hasByName(const OUString& rName) + throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - sal_Bool bRet = sal_False; - if(IsValid()) - { - String aName(rName); - sal_uInt16 nCount = GetDoc()->getBookmarkCount(true); - for( sal_uInt16 i = 0; i < nCount; i++) - { - SwBookmark& rBkMk = GetDoc()->getBookmark( i,true); - if(rBkMk.GetName() == aName) - { - bRet = sal_True; - break; - } - } - } - else + if(!IsValid()) throw uno::RuntimeException(); - return bRet; + + IDocumentMarkAccess* const pMarkAccess = GetDoc()->getIDocumentMarkAccess(); + return pMarkAccess->findBookmark(rName) != pMarkAccess->getBookmarksEnd(); } -/*-- 14.01.99 09:05:50--------------------------------------------------- - -----------------------------------------------------------------------*/ -uno::Type SAL_CALL SwXBookmarks::getElementType() throw(uno::RuntimeException) +uno::Type SAL_CALL SwXBookmarks::getElementType() + throw(uno::RuntimeException) { return ::getCppuType((uno::Reference<XTextContent>*)0); } -/*-- 14.01.99 09:05:50--------------------------------------------------- - -----------------------------------------------------------------------*/ -sal_Bool SwXBookmarks::hasElements(void) throw( uno::RuntimeException ) +sal_Bool SwXBookmarks::hasElements(void) + throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); if(!IsValid()) throw uno::RuntimeException(); - return GetDoc()->getBookmarkCount(true) != 0; + return GetDoc()->getIDocumentMarkAccess()->getBookmarksCount() != 0; } -/*-- 14.01.99 09:05:50--------------------------------------------------- - -----------------------------------------------------------------------*/ -SwXBookmark* SwXBookmarks::GetObject( SwBookmark& rBkm, SwDoc* pDoc ) +SwXBookmark* SwXBookmarks::GetObject( ::sw::mark::IMark& rBkmk, SwDoc* pDoc) { - SwXBookmark* pBkm = (SwXBookmark*)SwClientIter( rBkm ). - First( TYPE( SwXBookmark )); - if( !pBkm ) + SwModify* const pModify = static_cast<SwModify*>(&rBkmk); + SwXBookmark* pXBkmk = (SwXBookmark*)SwClientIter(*pModify).First(TYPE(SwXBookmark)); + if(!pXBkmk) { - if (IDocumentBookmarkAccess::FORM_FIELDMARK_TEXT==rBkm.GetType()) - pBkm = new SwXFieldmark(false, &rBkm, pDoc); - else if (IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT==rBkm.GetType()) - pBkm = new SwXFieldmark(true, &rBkm, pDoc); - else - pBkm = new SwXBookmark(&rBkm, pDoc); + // FIXME: These belong in XTextFieldsSupplier + //if (dynamic_cast< ::sw::mark::TextFieldmark* >(&rBkmk)) + // pXBkmk = new SwXFieldmark(false, &rBkmk, pDoc); + //else if (dynamic_cast< ::sw::mark::CheckboxFieldmark* >(&rBkmk)) + // pXBkmk = new SwXFieldmark(true, &rBkmk, pDoc); + //else + OSL_ENSURE( + dynamic_cast< ::sw::mark::IBookmark* >(&rBkmk), + "<SwXBookmark::GetObject(..)>" + "SwXBookmark requested for non-bookmark mark."); + pXBkmk = new SwXBookmark(&rBkmk, pDoc); } - return pBkm; + return pXBkmk; } + /****************************************************************** * ******************************************************************/ diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 08f61b1341c0..0d3b493af2f5 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -103,7 +103,7 @@ namespace SwUnoCursorHelper /* -----------------16.09.98 12:27------------------- * Lesen spezieller Properties am Cursor * --------------------------------------------------*/ -sal_Bool getCrsrPropertyValue(const SfxItemPropertyMap* pMap +sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry , SwPaM& rPam , Any *pAny , PropertyState& eState @@ -113,7 +113,7 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertyMap* pMap // PropertyState_DEFAULT_VALUE // PropertyState_AMBIGUOUS_VALUE sal_Bool bDone = sal_True; - switch(pMap->nWID) + switch(rEntry.nWID) { // --> OD 2008-11-26 #158694# case FN_UNO_PARA_CONT_PREV_SUBTREE: @@ -190,10 +190,10 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertyMap* pMap { SwFmtColl* pFmt = 0; if(pNode) - pFmt = FN_UNO_PARA_CONDITIONAL_STYLE_NAME == pMap->nWID + pFmt = FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID ? pNode->GetFmtColl() : &pNode->GetAnyFmtColl(); else - pFmt = SwXTextCursor::GetCurTxtFmtColl(rPam, FN_UNO_PARA_CONDITIONAL_STYLE_NAME == pMap->nWID); + pFmt = SwXTextCursor::GetCurTxtFmtColl(rPam, FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID); if(pFmt) { if( pAny ) @@ -241,21 +241,21 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertyMap* pMap { if( pAny ) { - if(pMap->nWID == FN_UNO_NUM_LEVEL) + if(rEntry.nWID == FN_UNO_NUM_LEVEL) *pAny <<= (sal_Int16)(pTxtNd->GetActualListLevel()); - else if(pMap->nWID == FN_UNO_IS_NUMBER) + else if(rEntry.nWID == FN_UNO_IS_NUMBER) { BOOL bIsNumber = pTxtNd->IsCountedInList(); pAny->setValue(&bIsNumber, ::getBooleanCppuType()); } // --> OD 2008-07-14 #i91601# - else if ( pMap->nWID == FN_UNO_LIST_ID ) + else if ( rEntry.nWID == FN_UNO_LIST_ID ) { const String sListId = pTxtNd->GetListId(); *pAny <<= OUString(sListId); } // <-- - else /*if(pMap->nWID == UNO_NAME_PARA_IS_NUMBERING_RESTART)*/ + else /*if(rEntry.nWID == UNO_NAME_PARA_IS_NUMBERING_RESTART)*/ { BOOL bIsRestart = pTxtNd->IsListRestart(); pAny->setValue(&bIsRestart, ::getBooleanCppuType()); @@ -269,17 +269,17 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertyMap* pMap if( pAny ) { // #i30838# set default values for default properties - if(pMap->nWID == FN_UNO_NUM_LEVEL) + if(rEntry.nWID == FN_UNO_NUM_LEVEL) *pAny <<= static_cast<sal_Int16>( 0 ); - else if(pMap->nWID == FN_UNO_IS_NUMBER) + else if(rEntry.nWID == FN_UNO_IS_NUMBER) *pAny <<= false; // --> OD 2008-07-14 #i91601# - else if ( pMap->nWID == FN_UNO_LIST_ID ) + else if ( rEntry.nWID == FN_UNO_LIST_ID ) { *pAny <<= OUString(); } // <-- - else /*if(pMap->nWID == UNO_NAME_PARA_IS_NUMBERING_RESTART)*/ + else /*if(rEntry.nWID == UNO_NAME_PARA_IS_NUMBERING_RESTART)*/ *pAny <<= false; } } @@ -385,7 +385,7 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertyMap* pMap const SwTableNode* pTblNode = pSttNode->FindTableNode(); SwFrmFmt* pTableFmt = (SwFrmFmt*)pTblNode->GetTable().GetFrmFmt(); //SwTable& rTable = ((SwTableNode*)pSttNode)->GetTable(); - if(FN_UNO_TEXT_TABLE == pMap->nWID) + if(FN_UNO_TEXT_TABLE == rEntry.nWID) { uno::Reference< XTextTable > xTable = SwXTextTables::GetObject(*pTableFmt); pAny->setValue(&xTable, ::getCppuType((uno::Reference<XTextTable>*)0)); @@ -443,7 +443,7 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertyMap* pMap if(pTxtAttr) { const SwFmtFtn& rFtn = pTxtAttr->GetFtn(); - if(rFtn.IsEndNote() == (FN_UNO_ENDNOTE == pMap->nWID)) + if(rFtn.IsEndNote() == (FN_UNO_ENDNOTE == rEntry.nWID)) { if( pAny ) { @@ -527,8 +527,9 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertyMap* pMap } } - if(aCharStyles.getLength()) - eNewState = PropertyState_DIRECT_VALUE; + eNewState = + aCharStyles.getLength() ? + PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;;
if(pAny) (*pAny) <<= aCharStyles; } @@ -726,10 +727,10 @@ void GetCurPageStyle(SwPaM& rPaM, String &rString) /* -----------------30.03.99 10:52------------------- * spezielle Properties am Cursor zuruecksetzen * --------------------------------------------------*/ -void resetCrsrPropertyValue(const SfxItemPropertyMap* pMap, SwPaM& rPam) +void resetCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPam) { SwDoc* pDoc = rPam.GetDoc(); - switch(pMap->nWID) + switch(rEntry.nWID) { case FN_UNO_PARA_STYLE : // lcl_SetTxtFmtColl(aValue, pUnoCrsr); @@ -1026,5 +1027,47 @@ void makeRedline( SwPaM& rPaM, throw lang::IllegalArgumentException(); } +/*-- 19.02.2009 09:27:26--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwAnyMapHelper::~SwAnyMapHelper() +{ + AnyMapHelper_t::iterator aIt = begin(); + while( aIt != end() ) + { + delete ( aIt->second ); + ++aIt; + } +} +/*-- 19.02.2009 09:27:26--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwAnyMapHelper::SetValue( USHORT nWhichId, USHORT nMemberId, const uno::Any& rAny ) +{ + sal_uInt32 nKey = (nWhichId << 16) + nMemberId; + AnyMapHelper_t::iterator aIt = find( nKey ); + if( aIt != end() ) + { + *(aIt->second) = rAny; + } + else + insert( value_type(nKey, new uno::Any( rAny )) ); +} +/*-- 19.02.2009 09:27:26--------------------------------------------------- + + -----------------------------------------------------------------------*/ +bool SwAnyMapHelper::FillValue( USHORT nWhichId, USHORT nMemberId, const uno::Any*& pAny ) +{ + bool bRet = false; + sal_uInt32 nKey = (nWhichId << 16) + nMemberId; + AnyMapHelper_t::iterator aIt = find( nKey ); + if( aIt != end() ) + { + pAny = aIt->second; + bRet = true; + } + return bRet; +} + }//namespace SwUnoCursorHelper diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 19a1a84af546..1989c74df6ed 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -63,10 +63,12 @@ #include <rootfrm.hxx> #include <svx/lrspitem.hxx> #include <svx/ulspitem.hxx> +#include <svx/shapepropertynotifier.hxx> #include <crstate.hxx> #include <vos/mutex.hxx> #include <comphelper/extract.hxx> #include <comphelper/stl_types.hxx> +#include <comphelper/makesequence.hxx> #include <svx/scene3d.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> @@ -87,7 +89,10 @@ // <-- #include <vcl/svapp.hxx> +#include <slist> +#include <iterator> +using ::rtl::OUString; using namespace ::com::sun::star; DECLARE_STL_USTRINGACCESS_MAP( uno::Sequence< sal_Int8 > *, SwShapeImplementationIdMap ); @@ -116,6 +121,9 @@ class SwShapeDescriptor_Impl // <-- public: + bool bInitializedPropertyNotifier; + +public: SwShapeDescriptor_Impl() : // --> OD 2004-08-18 #i32349# - no defaults, in order to determine on // adding a shape, if positioning attributes are set or not. @@ -135,7 +143,8 @@ public: text::WrapInfluenceOnPosition::ONCE_CONCURRENT ) ), // <-- // --> OD 2004-08-06 #i28749# - mnPositionLayoutDir( text::PositionLayoutDir::PositionInLayoutDirOfAnchor ) + mnPositionLayoutDir( text::PositionLayoutDir::PositionInLayoutDirOfAnchor ), + bInitializedPropertyNotifier(false) {} ~SwShapeDescriptor_Impl() @@ -423,8 +432,83 @@ uno::Reference< drawing::XShape > SwFmDrawPage::_CreateShape( SdrObject *pObj ) } /**************************************************************************** + class SwXShapesEnumeration +****************************************************************************/ +namespace +{ + class SwXShapesEnumeration : public SwSimpleEnumerationBaseClass + { + private: + typedef ::std::slist< ::com::sun::star::uno::Any > shapescontainer_t; + shapescontainer_t m_aShapes; + protected: + virtual ~SwXShapesEnumeration() {}; + public: + SwXShapesEnumeration(SwXDrawPage* const pDrawPage); + + //XEnumeration + virtual BOOL SAL_CALL hasMoreElements(void) throw(uno::RuntimeException); + virtual uno::Any SAL_CALL nextElement(void) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName(void) throw(uno::RuntimeException); + virtual BOOL SAL_CALL supportsService(const OUString& ServiceName) throw(uno::RuntimeException); + virtual uno::Sequence<OUString> SAL_CALL getSupportedServiceNames(void) throw(uno::RuntimeException); + }; +} + +SwXShapesEnumeration::SwXShapesEnumeration(SwXDrawPage* const pDrawPage) + : m_aShapes() +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + ::std::insert_iterator<shapescontainer_t> pInserter = ::std::insert_iterator<shapescontainer_t>(m_aShapes, m_aShapes.begin()); + sal_Int32 nCount = pDrawPage->getCount(); + for(sal_Int32 nIdx = 0; nIdx < nCount; nIdx++) + { + uno::Reference<drawing::XShape> xShape = uno::Reference<drawing::XShape>(pDrawPage->getByIndex(nIdx), uno::UNO_QUERY); + *pInserter++ = uno::makeAny(xShape); + } +} + +BOOL SwXShapesEnumeration::hasMoreElements(void) throw(uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + return !m_aShapes.empty(); +} + +uno::Any SwXShapesEnumeration::nextElement(void) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + if(m_aShapes.empty()) + throw container::NoSuchElementException(); + uno::Any aResult = *m_aShapes.begin(); + m_aShapes.pop_front(); + return aResult; +} + +OUString SwXShapesEnumeration::getImplementationName(void) throw(uno::RuntimeException) +{ + return C2U("SwXShapeEnumeration"); +} + +BOOL SwXShapesEnumeration::supportsService(const OUString& ServiceName) throw(uno::RuntimeException) +{ + return C2U("com.sun.star.container.XEnumeration") == ServiceName; +} + +uno::Sequence< OUString > SwXShapesEnumeration::getSupportedServiceNames(void) throw(uno::RuntimeException) +{ + return ::comphelper::makeSequence(C2U("com.sun.star.container.XEnumeration")); +} +/**************************************************************************** class SwXDrawPage ****************************************************************************/ +uno::Reference< container::XEnumeration > SwXDrawPage::createEnumeration(void) throw( uno::RuntimeException ) +{ + vos::OGuard aGuard(Application::GetSolarMutex()); + return uno::Reference< container::XEnumeration >( + new SwXShapesEnumeration(this)); +} /* -----------------------------06.04.00 13:14-------------------------------- ---------------------------------------------------------------------------*/ @@ -895,14 +979,23 @@ sal_Int64 SAL_CALL SwXShape::getSomething( const uno::Sequence< sal_Int8 >& rId } return 0; } +namespace +{ + static void lcl_addShapePropertyEventFactories( SdrObject& _rObj, SwXShape& _rShape ) + { + ::svx::PPropertyValueProvider pProvider( new ::svx::PropertyValueProvider( _rShape, "AnchorType" ) ); + _rObj.getShapePropertyChangeNotifier().registerProvider( ::svx::eTextShapeAnchorType, pProvider ); + } +} + /* -----------------01.02.99 11:38------------------- * * --------------------------------------------------*/ SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) : - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_SHAPE)), - _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_SHAPE)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_SHAPE)), + m_pPropertyMapEntries(aSwMapProvider.GetPropertyMapEntries(PROPERTY_MAP_TEXT_SHAPE)), pImplementationId(0), - pImpl(new SwShapeDescriptor_Impl), + pImpl(new SwShapeDescriptor_Impl()), m_bDescriptor(sal_True) { if(xShape.is()) // default Ctor @@ -940,6 +1033,37 @@ SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) : SwFrmFmt* pFmt = ::FindFrmFmt( pObj ); if(pFmt) pFmt->Add(this); + + lcl_addShapePropertyEventFactories( *pObj, *this ); + pImpl->bInitializedPropertyNotifier = true; + } + } +} + +/*-- 09.04.09 15:06:13--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwXShape::AddExistingShapeToFmt( SdrObject& _rObj ) +{ + SwXShape* pSwShape = NULL; + uno::Reference< lang::XUnoTunnel > xShapeTunnel( _rObj.getWeakUnoShape(), uno::UNO_QUERY ); + if ( xShapeTunnel.is() ) + pSwShape = reinterpret_cast< SwXShape * >( + sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething( SwXShape::getUnoTunnelId() ) ) ); + if ( pSwShape ) + { + if ( pSwShape->m_bDescriptor ) + { + SwFrmFmt* pFmt = ::FindFrmFmt( &const_cast< SdrObject& >( _rObj ) ); + if ( pFmt ) + pFmt->Add( pSwShape ); + pSwShape->m_bDescriptor = sal_False; + } + + if ( !pSwShape->pImpl->bInitializedPropertyNotifier ) + { + lcl_addShapePropertyEventFactories( _rObj, *pSwShape ); + pSwShape->pImpl->bInitializedPropertyNotifier = true; } } } @@ -1063,11 +1187,11 @@ uno::Reference< beans::XPropertySetInfo > SwXShape::getPropertySetInfo(void) th uno::Reference< beans::XPropertySetInfo > xInfo = xPrSet->getPropertySetInfo(); // PropertySetInfo verlaengern! const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties(); - aRet = new SfxExtItemPropertySetInfo( _pMap, aPropSeq ); + aRet = new SfxExtItemPropertySetInfo( m_pPropertyMapEntries, aPropSeq ); } } if(!aRet.is()) - aRet = new SfxItemPropertySetInfo( _pMap ); + aRet = m_pPropSet->getPropertySetInfo(); return aRet; } /*-- 22.01.99 11:42:27--------------------------------------------------- @@ -1080,20 +1204,19 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A { vos::OGuard aGuard(Application::GetSolarMutex()); SwFrmFmt* pFmt = GetFrmFmt(); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); if(xShapeAgg.is()) { - if(pMap) + if(pEntry) { - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); //mit Layout kann der Anker umgesetzt werden, ohne dass sich die Position aendert if(pFmt) { SwAttrSet aSet(pFmt->GetAttrSet()); SwDoc* pDoc = pFmt->GetDoc(); - if(RES_ANCHOR == pMap->nWID && MID_ANCHOR_ANCHORFRAME == pMap->nMemberId) + if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORFRAME == pEntry->nMemberId) { sal_Bool bDone = sal_True; uno::Reference<text::XTextFrame> xFrame; @@ -1111,7 +1234,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A SfxItemSet aItemSet( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END - 1 ); aItemSet.SetParent(&pFmt->GetAttrSet()); - SwFmtAnchor aAnchor = (const SwFmtAnchor&)aItemSet.Get(pMap->nWID); + SwFmtAnchor aAnchor = (const SwFmtAnchor&)aItemSet.Get(pEntry->nWID); SwPosition aPos(*pFrame->GetFrmFmt()->GetCntnt().GetCntntIdx()); aAnchor.SetAnchor(&aPos); aAnchor.SetType(FLY_AT_FLY); @@ -1123,7 +1246,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A if(!bDone) throw lang::IllegalArgumentException(); } - else if(RES_OPAQUE == pMap->nWID) + else if(RES_OPAQUE == pEntry->nWID) { SvxShape* pSvxShape = GetSvxShape(); DBG_ASSERT(pSvxShape, "No SvxShape found!"); @@ -1148,7 +1271,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A } // OD 2004-04-22 #i26791# - special handling for property FN_TEXT_RANGE - else if ( FN_TEXT_RANGE == pMap->nWID ) + else if ( FN_TEXT_RANGE == pEntry->nWID ) { SwFmtAnchor aAnchor( static_cast<const SwFmtAnchor&>(aSet.Get( RES_ANCHOR )) ); if ( aAnchor.GetAnchorId() == FLY_PAGE ) @@ -1204,7 +1327,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A } } // --> OD 2004-08-06 #i28749# - else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pMap->nWID ) + else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pEntry->nWID ) { sal_Int16 nPositionLayoutDir = 0; aValue >>= nPositionLayoutDir; @@ -1214,7 +1337,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A else if( pDoc->GetRootFrm() ) { UnoActionContext aCtx(pDoc); - if(RES_ANCHOR == pMap->nWID && MID_ANCHOR_ANCHORTYPE == pMap->nMemberId) + if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId) { SdrObject* pObj = pFmt->FindSdrObject(); SdrMarkList aList; @@ -1227,15 +1350,15 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A } else { - aPropSet.setPropertyValue(*pMap, aValue, aSet); + m_pPropSet->setPropertyValue(*pEntry, aValue, aSet); pFmt->SetFmtAttr(aSet); } } else { - aPropSet.setPropertyValue(*pMap, aValue, aSet); + m_pPropSet->setPropertyValue( *pEntry, aValue, aSet ); - if(RES_ANCHOR == pMap->nWID && MID_ANCHOR_ANCHORTYPE == pMap->nMemberId) + if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId) { bool bSetAttr = true; sal_Int32 eNewAnchor = SWUnoHelper::GetEnumAsInt32( aValue ); @@ -1311,7 +1434,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A else { SfxPoolItem* pItem = 0; - switch(pMap->nWID) + switch(pEntry->nWID) { case RES_ANCHOR: pItem = pImpl->GetAnchor(sal_True); @@ -1368,7 +1491,7 @@ void SwXShape::setPropertyValue(const rtl::OUString& rPropertyName, const uno::A // <-- } if(pItem) - ((SfxPoolItem*)pItem)->PutValue(aValue, pMap->nMemberId); + ((SfxPoolItem*)pItem)->PutValue(aValue, pEntry->nMemberId); } } else @@ -1438,13 +1561,12 @@ uno::Any SwXShape::getPropertyValue(const rtl::OUString& rPropertyName) SwFrmFmt* pFmt = GetFrmFmt(); if(xShapeAgg.is()) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); + if(pEntry) { if(pFmt) { - if(RES_OPAQUE == pMap->nWID) + if(RES_OPAQUE == pEntry->nWID) { SvxShape* pSvxShape = GetSvxShape(); DBG_ASSERT(pSvxShape, "No SvxShape found!"); @@ -1458,7 +1580,7 @@ uno::Any SwXShape::getPropertyValue(const rtl::OUString& rPropertyName) aRet.setValue(&bOpaque, ::getBooleanCppuType()); } } - else if(FN_ANCHOR_POSITION == pMap->nWID) + else if(FN_ANCHOR_POSITION == pEntry->nWID) { SvxShape* pSvxShape = GetSvxShape(); DBG_ASSERT(pSvxShape, "No SvxShape found!"); @@ -1472,7 +1594,7 @@ uno::Any SwXShape::getPropertyValue(const rtl::OUString& rPropertyName) } } // OD 2004-04-22 #i26791# - special handling for FN_TEXT_RANGE - else if ( FN_TEXT_RANGE == pMap->nWID ) + else if ( FN_TEXT_RANGE == pEntry->nWID ) { const SwFmtAnchor aAnchor = pFmt->GetAnchor(); if ( aAnchor.GetAnchorId() == FLY_PAGE ) @@ -1502,25 +1624,25 @@ uno::Any SwXShape::getPropertyValue(const rtl::OUString& rPropertyName) } } // --> OD 2004-08-06 #i28749# - else if ( FN_SHAPE_TRANSFORMATION_IN_HORI_L2R == pMap->nWID ) + else if ( FN_SHAPE_TRANSFORMATION_IN_HORI_L2R == pEntry->nWID ) { // get property <::drawing::Shape::Transformation> // without conversion to layout direction as below aRet = _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")) ); } - else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pMap->nWID ) + else if ( FN_SHAPE_POSITION_LAYOUT_DIR == pEntry->nWID ) { aRet <<= pFmt->GetPositionLayoutDir(); } // <-- // --> OD 2004-10-28 #i36248# - else if ( FN_SHAPE_STARTPOSITION_IN_HORI_L2R == pMap->nWID ) + else if ( FN_SHAPE_STARTPOSITION_IN_HORI_L2R == pEntry->nWID ) { // get property <::drawing::Shape::StartPosition> // without conversion to layout direction as below aRet = _getPropAtAggrObj( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")) ); } - else if ( FN_SHAPE_ENDPOSITION_IN_HORI_L2R == pMap->nWID ) + else if ( FN_SHAPE_ENDPOSITION_IN_HORI_L2R == pEntry->nWID ) { // get property <::drawing::Shape::EndPosition> // without conversion to layout direction as below @@ -1530,13 +1652,13 @@ uno::Any SwXShape::getPropertyValue(const rtl::OUString& rPropertyName) else { const SwAttrSet& rSet = pFmt->GetAttrSet(); - aRet = aPropSet.getPropertyValue(*pMap, rSet); + m_pPropSet->getPropertyValue(*pEntry, rSet, aRet); } } else { SfxPoolItem* pItem = 0; - switch(pMap->nWID) + switch(pEntry->nWID) { case RES_ANCHOR: pItem = pImpl->GetAnchor(); @@ -1612,7 +1734,7 @@ uno::Any SwXShape::getPropertyValue(const rtl::OUString& rPropertyName) // <-- } if(pItem) - pItem->QueryValue(aRet, pMap->nMemberId); + pItem->QueryValue(aRet, pEntry->nMemberId); } } else @@ -1725,23 +1847,22 @@ uno::Sequence< beans::PropertyState > SwXShape::getPropertyStates( uno::Reference< XPropertyState > xShapePrState; for(sal_Int32 nProperty = 0; nProperty < aPropertyNames.getLength(); nProperty++) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, pNames[nProperty]); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( pNames[nProperty] ); + if(pEntry) { - if(RES_OPAQUE == pMap->nWID) + if(RES_OPAQUE == pEntry->nWID) pRet[nProperty] = bFormControl ? beans::PropertyState_DEFAULT_VALUE : beans::PropertyState_DIRECT_VALUE; - else if(FN_ANCHOR_POSITION == pMap->nWID) + else if(FN_ANCHOR_POSITION == pEntry->nWID) pRet[nProperty] = beans::PropertyState_DIRECT_VALUE; - else if(FN_TEXT_RANGE == pMap->nWID) + else if(FN_TEXT_RANGE == pEntry->nWID) pRet[nProperty] = beans::PropertyState_DIRECT_VALUE; else if(bGroupMember) pRet[nProperty] = beans::PropertyState_DEFAULT_VALUE; else if(pFmt) { const SwAttrSet& rSet = pFmt->GetAttrSet(); - SfxItemState eItemState = rSet.GetItemState(pMap->nWID, FALSE); + SfxItemState eItemState = rSet.GetItemState(pEntry->nWID, FALSE); if(SFX_ITEM_SET == eItemState) pRet[nProperty] = beans::PropertyState_DIRECT_VALUE; @@ -1753,7 +1874,7 @@ uno::Sequence< beans::PropertyState > SwXShape::getPropertyStates( else { SfxPoolItem* pItem = 0; - switch(pMap->nWID) + switch(pEntry->nWID) { case RES_ANCHOR: pItem = pImpl->GetAnchor(); @@ -1814,23 +1935,22 @@ void SwXShape::setPropertyToDefault( const rtl::OUString& rPropertyName ) SwFrmFmt* pFmt = GetFrmFmt(); if(xShapeAgg.is()) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); + if(pEntry) { - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); if(pFmt) { const SfxItemSet& rSet = pFmt->GetAttrSet(); - SfxItemSet aSet(pFmt->GetDoc()->GetAttrPool(), pMap->nWID, pMap->nWID); + SfxItemSet aSet(pFmt->GetDoc()->GetAttrPool(), pEntry->nWID, pEntry->nWID); aSet.SetParent(&rSet); - aSet.ClearItem(pMap->nWID); + aSet.ClearItem(pEntry->nWID); pFmt->GetDoc()->SetAttr(aSet, *pFmt); } else { - switch(pMap->nWID) + switch(pEntry->nWID) { case RES_ANCHOR: pImpl->RemoveAnchor(); break; case RES_HORI_ORIENT: pImpl->RemoveHOrient(); break; @@ -1881,15 +2001,14 @@ uno::Any SwXShape::getPropertyDefault( const rtl::OUString& rPropertyName ) uno::Any aRet; if(xShapeAgg.is()) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); + if(pEntry) { - if(pMap->nWID < RES_FRMATR_END && pFmt) + if(pEntry->nWID < RES_FRMATR_END && pFmt) { const SfxPoolItem& rDefItem = - pFmt->GetDoc()->GetAttrPool().GetDefaultItem(pMap->nWID); - rDefItem.QueryValue(aRet, pMap->nMemberId); + pFmt->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID); + rDefItem.QueryValue(aRet, pEntry->nMemberId); } else throw uno::RuntimeException(); @@ -1912,23 +2031,35 @@ uno::Any SwXShape::getPropertyDefault( const rtl::OUString& rPropertyName ) -----------------------------------------------------------------------*/ void SwXShape::addPropertyChangeListener( - const rtl::OUString& /*PropertyName*/, - const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) + const rtl::OUString& _propertyName, + const uno::Reference< beans::XPropertyChangeListener > & _listener ) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { - DBG_WARNING("not implemented"); + if ( !xShapeAgg.is() ) + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "no shape aggregate" ) ), *this ); + + // must be handled by the aggregate + uno::Reference< beans::XPropertySet > xShapeProps; + if ( xShapeAgg->queryAggregation( beans::XPropertySet::static_type() ) >>= xShapeProps ) + xShapeProps->addPropertyChangeListener( _propertyName, _listener ); } /*-- 22.01.99 11:42:27--------------------------------------------------- -----------------------------------------------------------------------*/ void SwXShape::removePropertyChangeListener( - const rtl::OUString& /*PropertyName*/, - const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) + const rtl::OUString& _propertyName, + const uno::Reference< beans::XPropertyChangeListener > & _listener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { - DBG_WARNING("not implemented"); + if ( !xShapeAgg.is() ) + throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "no shape aggregate" ) ), *this ); + + // must be handled by the aggregate + uno::Reference< beans::XPropertySet > xShapeProps; + if ( xShapeAgg->queryAggregation( beans::XPropertySet::static_type() ) >>= xShapeProps ) + xShapeProps->removePropertyChangeListener( _propertyName, _listener ); } /*-- 22.01.99 11:42:28--------------------------------------------------- @@ -2430,14 +2561,14 @@ awt::Point SwXShape::_GetAttrPosition() // <-- // --> OD 2004-11-10 #i35007# - If drawing object is anchored as-character, // it's x-position isn't sensible. Thus, return the x-position as zero in this case. - text::TextContentAnchorType eAnchorType = + text::TextContentAnchorType eTextAnchorType = text::TextContentAnchorType_AT_PARAGRAPH; { rtl::OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) ); uno::Any aAny = getPropertyValue( sAnchorType ); - aAny >>= eAnchorType; + aAny >>= eTextAnchorType; } - if ( eAnchorType == text::TextContentAnchorType_AS_CHARACTER ) + if ( eTextAnchorType == text::TextContentAnchorType_AS_CHARACTER ) { aAttrPos.X = 0; } @@ -2574,14 +2705,14 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition ) // handle x-position // --> OD 2004-11-10 #i35007# - no handling of x-position, if drawing // object is anchored as-character, because it doesn't make sense. - text::TextContentAnchorType eAnchorType = + text::TextContentAnchorType eTextAnchorType = text::TextContentAnchorType_AT_PARAGRAPH; { rtl::OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) ); uno::Any aAny = getPropertyValue( sAnchorType ); - aAny >>= eAnchorType; + aAny >>= eTextAnchorType; } - if ( eAnchorType != text::TextContentAnchorType_AS_CHARACTER ) + if ( eTextAnchorType != text::TextContentAnchorType_AS_CHARACTER ) // <-- { // determine current x-postion diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 96aa8a01f5d0..00b5a0ab88ae 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -75,9 +75,7 @@ #include <chpfld.hxx> #include <flddropdown.hxx> #include <poolfmt.hxx> -#ifndef _POOLFMT_HRC #include <poolfmt.hrc> -#endif #include <pagedesc.hxx> #include <docary.hxx> #include <reffld.hxx> @@ -297,23 +295,18 @@ sal_uInt16 lcl_GetPropMapIdForFieldType( USHORT nWhich ) } -BYTE GetFieldTypeMId( const OUString& rProperty, const SwFieldType& rTyp ) +USHORT GetFieldTypeMId( const OUString& rProperty, const SwFieldType& rTyp ) { USHORT nId = lcl_GetPropMapIdForFieldType( rTyp.Which() ); - const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap( nId ); - if( !pMap ) + const SfxItemPropertySet* pSet = aSwMapProvider.GetPropertySet( nId ); + if( !pSet ) nId = USHRT_MAX; else { - nId = USHRT_MAX; // in case of property not found - for( ; pMap->pName; ++pMap ) - if( rProperty.equalsAsciiL( pMap->pName, pMap->nNameLen ) ) - { - nId = pMap->nWID; - break; - } + const SfxItemPropertySimpleEntry* pEntry = pSet->getPropertyMap()->getByName(rProperty); + nId = pEntry ? pEntry->nWID : USHRT_MAX; } - return (BYTE)nId; + return nId; } USHORT lcl_GetPropertyMapOfService( USHORT nServiceId ) @@ -531,9 +524,9 @@ uno::Reference< beans::XPropertySetInfo > SwXFieldMaster::getPropertySetInfo(vo throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo( - aSwMapProvider.GetPropertyMap( - lcl_GetPropMapIdForFieldType( nResTypeId ) )); + uno::Reference< beans::XPropertySetInfo > aRef = + aSwMapProvider.GetPropertySet( + lcl_GetPropMapIdForFieldType( nResTypeId ) )->getPropertySetInfo(); return aRef; } /*-- 14.12.98 11:08:35--------------------------------------------------- @@ -577,8 +570,8 @@ void SwXFieldMaster::setPropertyValue( const OUString& rPropertyName, // We just call PutValue (empty string is allowed). // Thus the last property set will be used as Data Source. - BYTE nMId = GetFieldTypeMId( rPropertyName, *pType ); - if( UCHAR_MAX != nMId ) + USHORT nMId = GetFieldTypeMId( rPropertyName, *pType ); + if( USHRT_MAX != nMId ) pType->PutValue( rValue, nMId ); else throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); @@ -815,8 +808,8 @@ uno::Any SwXFieldMaster::getPropertyValue(const OUString& rPropertyName) else if(pType) { //TODO: Properties fuer die uebrigen Feldtypen einbauen - BYTE nMId = GetFieldTypeMId( rPropertyName, *pType ); - if( UCHAR_MAX != nMId ) + USHORT nMId = GetFieldTypeMId( rPropertyName, *pType ); + if( USHRT_MAX != nMId ) { pType->QueryValue( aRet, nMId ); @@ -1926,13 +1919,13 @@ uno::Reference< beans::XPropertySetInfo > SwXTextField::getPropertySetInfo(void uno::Reference< beans::XPropertySetInfo > aRef; if(m_nServiceId != USHRT_MAX) { - const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap( + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet( lcl_GetPropertyMapOfService( m_nServiceId )); - uno::Reference< beans::XPropertySetInfo > xInfo = new SfxItemPropertySetInfo(pMap); + uno::Reference< beans::XPropertySetInfo > xInfo = pPropSet->getPropertySetInfo(); // extend PropertySetInfo! const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties(); aRef = new SfxExtItemPropertySetInfo( - aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH_EXTENSIONS), + aSwMapProvider.GetPropertyMapEntries(PROPERTY_MAP_PARAGRAPH_EXTENSIONS), aPropSeq ); } else @@ -1948,13 +1941,13 @@ void SwXTextField::setPropertyValue(const OUString& rPropertyName, const uno::An { vos::OGuard aGuard(Application::GetSolarMutex()); SwField* pField = (SwField*)GetField(); - const SfxItemPropertyMap* _pMap = aSwMapProvider.GetPropertyMap( + const SfxItemPropertySet* _pPropSet = aSwMapProvider.GetPropertySet( lcl_GetPropertyMapOfService( m_nServiceId)); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(_pMap, rPropertyName); + const SfxItemPropertySimpleEntry* pEntry = _pPropSet->getPropertyMap()->getByName(rPropertyName); - if (!pMap) + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); if(pField) @@ -1981,25 +1974,38 @@ void SwXTextField::setPropertyValue(const OUString& rPropertyName, const uno::An SwPosition * pPos = GetPosition(); ASSERT(pPos, "no position"); - pDoc->PutValueToField( *pPos, rValue, pMap->nWID); + pDoc->PutValueToField( *pPos, rValue, pEntry->nWID); delete pPos; } // <- #111840# } - pField->PutValue( rValue, pMap->nWID ); + pField->PutValue( rValue, pEntry->nWID ); + + //#i100374# notify SwPostIt about new field content + if (RES_POSTITFLD== nWhich && pFmtFld) + { + const_cast<SwFmtFld*>(pFmtFld)->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED )); + } + //#114571# changes of the expanded string have to be notified //#to the SwTxtFld if(RES_DBFLD == nWhich && pFmtFld->GetTxtFld()) { pFmtFld->GetTxtFld()->Expand(); } + + //#i100374# changing a document field should set the modify flag + SwDoc* pDoc = GetDoc(); + if (pDoc) + pDoc->SetModified(); + } else if(m_pProps) { String* pStr = 0; BOOL* pBool = 0; - switch(pMap->nWID) + switch(pEntry->nWID) { case FIELD_PROP_PAR1: pStr = &m_pProps->sPar1; @@ -2049,7 +2055,7 @@ void SwXTextField::setPropertyValue(const OUString& rPropertyName, const uno::An { sal_Int16 nVal = 0; rValue >>= nVal; - if( FIELD_PROP_USHORT1 == pMap->nWID) + if( FIELD_PROP_USHORT1 == pEntry->nWID) m_pProps->nUSHORT1 = nVal; else m_pProps->nUSHORT2 = nVal; @@ -2098,18 +2104,18 @@ uno::Any SwXTextField::getPropertyValue(const OUString& rPropertyName) vos::OGuard aGuard(Application::GetSolarMutex()); uno::Any aRet; const SwField* pField = GetField(); - const SfxItemPropertyMap* _pMap = aSwMapProvider.GetPropertyMap( + const SfxItemPropertySet* _pPropSet = aSwMapProvider.GetPropertySet( lcl_GetPropertyMapOfService( m_nServiceId)); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(_pMap, rPropertyName); - if(!pMap ) + const SfxItemPropertySimpleEntry* pEntry = _pPropSet->getPropertyMap()->getByName(rPropertyName); + if(!pEntry ) { - _pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH_EXTENSIONS); - pMap = SfxItemPropertyMap::GetByName(_pMap, rPropertyName); + const SfxItemPropertySet* _pParaPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH_EXTENSIONS); + pEntry = _pParaPropSet->getPropertyMap()->getByName(rPropertyName); } - if (!pMap) + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - switch( pMap->nWID ) + switch( pEntry->nWID ) { case FN_UNO_TEXT_WRAP: aRet <<= text::WrapTextMode_NONE; @@ -2129,8 +2135,8 @@ uno::Any SwXTextField::getPropertyValue(const OUString& rPropertyName) default: if( pField ) { - if (FIELD_PROP_IS_FIELD_USED == pMap->nWID || - FIELD_PROP_IS_FIELD_DISPLAYED == pMap->nWID) + if (FIELD_PROP_IS_FIELD_USED == pEntry->nWID || + FIELD_PROP_IS_FIELD_DISPLAYED == pEntry->nWID) { sal_Bool bIsFieldUsed = sal_False; sal_Bool bIsFieldDisplayed = sal_False; @@ -2185,16 +2191,16 @@ uno::Any SwXTextField::getPropertyValue(const OUString& rPropertyName) bIsFieldUsed = bFrame || bHidden; bIsFieldDisplayed = bIsFieldUsed && !bHidden; } - sal_Bool bRetVal = (FIELD_PROP_IS_FIELD_USED == pMap->nWID) ? + sal_Bool bRetVal = (FIELD_PROP_IS_FIELD_USED == pEntry->nWID) ? bIsFieldUsed : bIsFieldDisplayed; aRet.setValue( &bRetVal, ::getCppuBooleanType() ); } else - pField->QueryValue( aRet, pMap->nWID ); + pField->QueryValue( aRet, pEntry->nWID ); } else if( m_pProps ) // currently just a descriptor... { - switch(pMap->nWID) + switch(pEntry->nWID) { case FIELD_PROP_TEXT: { diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index 3ef566127067..fcfb8eb135fd 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -406,15 +406,6 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getNextPara() m_aFlatParaList.insert( xRet ); } - // in case that grammar checking will be finished we now have to reset - // the flag at the root frame that indicated grammar checking was still active. - if (!xRet.is() && mnType == text::TextMarkupType::PROOFREADING) - { - SwRootFrm *pRootFrm = mpDoc? mpDoc->GetRootFrm() : NULL; - if (pRootFrm) - pRootFrm->SetGrammarCheckActive( false ); - } - return xRet; } diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 12d81b313cd8..f7b5fe716a59 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -55,6 +55,7 @@ #include <ndnotxt.hxx> #include <svx/unomid.hxx> #include <unocrsr.hxx> +#include <unocrsrhelper.hxx> #include <docstyle.hxx> #include <dcontact.hxx> #include <fmtcnct.hxx> @@ -134,23 +135,18 @@ const sal_Char __FAR_DATA sGraphicObjectProtocol[] = "vnd.sun.star.GraphicObject /**************************************************************************** Rahmenbeschreibung ****************************************************************************/ -DECLARE_TABLE(SwFrameAnyTable_Impl, uno::Any*) class BaseFrameProperties_Impl { - const SfxItemPropertyMap* _pMap; - SwFrameAnyTable_Impl aAnyTbl; + SwUnoCursorHelper::SwAnyMapHelper aAnyMap; public: - - BaseFrameProperties_Impl ( const SfxItemPropertyMap* pMap ) : - _pMap(pMap) {} virtual ~BaseFrameProperties_Impl(); - void SetProperty(USHORT nWID, BYTE nMemberId, uno::Any aVal); - sal_Bool GetProperty(USHORT nWID, BYTE nMemberId, uno::Any*& pAny ); - void GetProperty(const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any& rAny ); + void SetProperty(USHORT nWID, BYTE nMemberId, const uno::Any& rVal); + sal_Bool GetProperty(USHORT nWID, BYTE nMemberId, const uno::Any*& pAny ); +// void GetProperty(const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any& rAny ); - const SfxItemPropertyMap* GetMap() const {return _pMap;} +// const SfxItemPropertyMap* GetMap() const {return _pMap;} sal_Bool FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet &rFromSet, sal_Bool& rSizeFound); virtual sal_Bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound) = 0; @@ -161,41 +157,25 @@ public: ---------------------------------------------------------------------------*/ BaseFrameProperties_Impl::~BaseFrameProperties_Impl() { - uno::Any* pVal = aAnyTbl.First(); - while(pVal) - { - delete pVal; - pVal = aAnyTbl.Next(); - } } /* -----------------------------12.06.01 15:43-------------------------------- ---------------------------------------------------------------------------*/ -void BaseFrameProperties_Impl::SetProperty(USHORT nWID, BYTE nMemberId, uno::Any aVal) +void BaseFrameProperties_Impl::SetProperty(USHORT nWID, BYTE nMemberId, const uno::Any& rVal) { - ULONG nKey = (nWID << 16) + nMemberId; - uno::Any* pCurAny = aAnyTbl.Get(nKey); - if(!pCurAny) - { - pCurAny = new uno::Any; - aAnyTbl.Insert(nKey, pCurAny); - } - *pCurAny = aVal; + aAnyMap.SetValue( nWID, nMemberId, rVal ); } /* -----------------------------12.06.01 15:43-------------------------------- ---------------------------------------------------------------------------*/ -sal_Bool BaseFrameProperties_Impl::GetProperty(USHORT nWID, BYTE nMemberId, uno::Any*& pAny) -{ - ULONG nKey = (nWID << 16) + nMemberId; - uno::Any *pCurAny = aAnyTbl.Get(nKey); - pAny = pCurAny; - return pCurAny != 0; -} -void BaseFrameProperties_Impl::GetProperty( const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any & rAny ) +sal_Bool BaseFrameProperties_Impl::GetProperty(USHORT nWID, BYTE nMemberId, const uno::Any*& rpAny) { - rAny = rxPropertySet->getPropertyValue( rPropertyName ); + return aAnyMap.FillValue( nWID, nMemberId, rpAny ); } +//void BaseFrameProperties_Impl::GetProperty( const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any & rAny ) +//{ +// rAny = rxPropertySet->getPropertyValue( rPropertyName ); +//} /* -----------------29.06.98 09:55------------------- * * --------------------------------------------------*/ @@ -205,36 +185,36 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const //Anker kommt auf jeden Fall in den Set SwFmtAnchor aAnchor ( static_cast < const SwFmtAnchor & > ( rFromSet.Get ( RES_ANCHOR ) ) ); { - uno::Any* pAnchorPgNo; + const ::uno::Any* pAnchorPgNo; if(GetProperty(RES_ANCHOR, MID_ANCHOR_PAGENUM, pAnchorPgNo)) bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorPgNo, MID_ANCHOR_PAGENUM); - uno::Any* pAnchorType; + const ::uno::Any* pAnchorType; if(GetProperty(RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, pAnchorType)) bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorType, MID_ANCHOR_ANCHORTYPE); } rToSet.Put(aAnchor); { - uno::Any* pCol = 0; + const ::uno::Any* pCol = 0; GetProperty(RES_BACKGROUND, MID_BACK_COLOR, pCol ); - uno::Any* pRGBCol = 0; + const ::uno::Any* pRGBCol = 0; GetProperty(RES_BACKGROUND, MID_BACK_COLOR_R_G_B, pRGBCol ); - uno::Any* pColTrans = 0; + const ::uno::Any* pColTrans = 0; GetProperty(RES_BACKGROUND, MID_BACK_COLOR_TRANSPARENCY, pColTrans); - uno::Any* pTrans = 0; + const ::uno::Any* pTrans = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT, pTrans ); - uno::Any* pGrLoc = 0; + const ::uno::Any* pGrLoc = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION, pGrLoc ); - uno::Any* pGrURL = 0; + const ::uno::Any* pGrURL = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL, pGrURL ); - uno::Any* pGrFilter = 0; + const ::uno::Any* pGrFilter = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_FILTER, pGrFilter ); - uno::Any* pGrTranparency = 0; + const ::uno::Any* pGrTranparency = 0; GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENCY, pGrTranparency ); if(pCol || pTrans || pGrURL || pGrFilter || pGrLoc || pGrTranparency || pColTrans || pRGBCol) { - SvxBrushItem aBrush ( static_cast < const SvxBrushItem & > ( rFromSet.Get ( RES_BACKGROUND ) ) ); + SvxBrushItem aBrush ( static_cast < const :: SvxBrushItem & > ( rFromSet.Get ( RES_BACKGROUND ) ) ); if(pCol ) bRet &= ((SfxPoolItem&)aBrush).PutValue(*pCol,MID_BACK_COLOR ); if(pColTrans) @@ -260,15 +240,15 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const } } { - uno::Any* pCont = 0; + const ::uno::Any* pCont = 0; GetProperty(RES_PROTECT, MID_PROTECT_CONTENT, pCont ); - uno::Any* pPos = 0; + const ::uno::Any* pPos = 0; GetProperty(RES_PROTECT,MID_PROTECT_POSITION, pPos ); - uno::Any* pName = 0; + const ::uno::Any* pName = 0; GetProperty(RES_PROTECT, MID_PROTECT_SIZE, pName ); if(pCont||pPos||pName) { - SvxProtectItem aProt ( static_cast < const SvxProtectItem & > ( rFromSet.Get ( RES_PROTECT ) ) ); + SvxProtectItem aProt ( static_cast < const :: SvxProtectItem & > ( rFromSet.Get ( RES_PROTECT ) ) ); if(pCont) bRet &= ((SfxPoolItem&)aProt).PutValue(*pCont, MID_PROTECT_CONTENT); if(pPos ) @@ -279,17 +259,17 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const } } { - uno::Any* pHori = 0; + const ::uno::Any* pHori = 0; GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, pHori ); - uno::Any* pHoriP = 0; + const ::uno::Any* pHoriP = 0; GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_POSITION|CONVERT_TWIPS, pHoriP ); - uno::Any* pHoriR = 0; + const ::uno::Any* pHoriR = 0; GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_RELATION, pHoriR ); - uno::Any* pPageT = 0; + const ::uno::Any* pPageT = 0; GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_PAGETOGGLE, pPageT); if(pHori||pHoriP||pHoriR||pPageT) { - SwFmtHoriOrient aOrient ( static_cast < const SwFmtHoriOrient & > ( rFromSet.Get ( RES_HORI_ORIENT ) ) ); + SwFmtHoriOrient aOrient ( static_cast < const :: SwFmtHoriOrient & > ( rFromSet.Get ( RES_HORI_ORIENT ) ) ); if(pHori ) bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHori, MID_HORIORIENT_ORIENT); if(pHoriP) @@ -303,15 +283,15 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const } { - uno::Any* pVert = 0; + const ::uno::Any* pVert = 0; GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, pVert); - uno::Any* pVertP = 0; + const ::uno::Any* pVertP = 0; GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_POSITION|CONVERT_TWIPS, pVertP ); - uno::Any* pVertR = 0; + const ::uno::Any* pVertR = 0; GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_RELATION, pVertR ); if(pVert||pVertP||pVertR) { - SwFmtVertOrient aOrient ( static_cast < const SwFmtVertOrient & > ( rFromSet.Get ( RES_VERT_ORIENT ) ) ); + SwFmtVertOrient aOrient ( static_cast < const :: SwFmtVertOrient & > ( rFromSet.Get ( RES_VERT_ORIENT ) ) ); if(pVert ) bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVert, MID_VERTORIENT_ORIENT); if(pVertP) @@ -322,17 +302,17 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const } } { - uno::Any* pURL = 0; + const ::uno::Any* pURL = 0; GetProperty(RES_URL, MID_URL_URL, pURL ); - uno::Any* pTarget = 0; + const ::uno::Any* pTarget = 0; GetProperty(RES_URL, MID_URL_TARGET, pTarget ); - uno::Any* pHyLNm = 0; + const ::uno::Any* pHyLNm = 0; GetProperty(RES_URL, MID_URL_HYPERLINKNAME, pHyLNm ); - uno::Any* pHySMp = 0; + const ::uno::Any* pHySMp = 0; GetProperty(RES_URL, MID_URL_SERVERMAP, pHySMp ); if(pURL||pTarget||pHyLNm||pHySMp) { - SwFmtURL aURL ( static_cast < const SwFmtURL & > ( rFromSet.Get ( RES_URL ) ) ); + SwFmtURL aURL ( static_cast < const :: SwFmtURL & > ( rFromSet.Get ( RES_URL ) ) ); if(pURL) bRet &= ((SfxPoolItem&)aURL).PutValue(*pURL, MID_URL_URL); if(pTarget) @@ -344,88 +324,88 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const rToSet.Put(aURL); } } - uno::Any* pL = 0; + const ::uno::Any* pL = 0; GetProperty(RES_LR_SPACE, MID_L_MARGIN|CONVERT_TWIPS, pL ); - uno::Any* pR = 0; + const ::uno::Any* pR = 0; GetProperty(RES_LR_SPACE, MID_R_MARGIN|CONVERT_TWIPS, pR ); if(pL||pR) { - SvxLRSpaceItem aLR ( static_cast < const SvxLRSpaceItem & > ( rFromSet.Get ( RES_LR_SPACE ) ) ); + SvxLRSpaceItem aLR ( static_cast < const :: SvxLRSpaceItem & > ( rFromSet.Get ( RES_LR_SPACE ) ) ); if(pL) bRet &= ((SfxPoolItem&)aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS); if(pR) bRet &= ((SfxPoolItem&)aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS); rToSet.Put(aLR); } - uno::Any* pT = 0; + const ::uno::Any* pT = 0; GetProperty(RES_UL_SPACE, MID_UP_MARGIN|CONVERT_TWIPS, pT ); - uno::Any* pB = 0; + const ::uno::Any* pB = 0; GetProperty(RES_UL_SPACE, MID_LO_MARGIN|CONVERT_TWIPS, pB ); if(pT||pB) { - SvxULSpaceItem aTB ( static_cast < const SvxULSpaceItem &> ( rFromSet.Get ( RES_UL_SPACE ) ) ); + SvxULSpaceItem aTB ( static_cast < const :: SvxULSpaceItem &> ( rFromSet.Get ( RES_UL_SPACE ) ) ); if(pT) bRet &= ((SfxPoolItem&)aTB).PutValue(*pT, MID_UP_MARGIN|CONVERT_TWIPS); if(pB) bRet &= ((SfxPoolItem&)aTB).PutValue(*pB, MID_LO_MARGIN|CONVERT_TWIPS); rToSet.Put(aTB); } - uno::Any* pOp; + const ::uno::Any* pOp; if(GetProperty(RES_OPAQUE, 0, pOp)) { - SvxOpaqueItem aOp ( static_cast < const SvxOpaqueItem& > ( rFromSet.Get ( RES_OPAQUE ) ) ); + SvxOpaqueItem aOp ( static_cast < const :: SvxOpaqueItem& > ( rFromSet.Get ( RES_OPAQUE ) ) ); bRet &= ((SfxPoolItem&)aOp).PutValue(*pOp, 0); rToSet.Put(aOp); } - uno::Any* pPrt; + const ::uno::Any* pPrt; if(GetProperty(RES_PRINT, 0, pPrt)) { - SvxPrintItem aPrt ( static_cast < const SvxPrintItem & > ( rFromSet.Get ( RES_PRINT ) ) ); + SvxPrintItem aPrt ( static_cast < const :: SvxPrintItem & > ( rFromSet.Get ( RES_PRINT ) ) ); bRet &= ((SfxPoolItem&)aPrt).PutValue(*pPrt, 0); rToSet.Put(aPrt); } - uno::Any* pSh; + const ::uno::Any* pSh; if(GetProperty(RES_SHADOW, CONVERT_TWIPS, pSh)) { - SvxShadowItem aSh ( static_cast < const SvxShadowItem& > ( rFromSet.Get ( RES_SHADOW ) ) ); + SvxShadowItem aSh ( static_cast < const :: SvxShadowItem& > ( rFromSet.Get ( RES_SHADOW ) ) ); bRet &= ((SfxPoolItem&)aSh).PutValue(*pSh, CONVERT_TWIPS); rToSet.Put(aSh); } - uno::Any* pSur = 0; + const ::uno::Any* pSur = 0; GetProperty(RES_SURROUND, MID_SURROUND_SURROUNDTYPE, pSur); - uno::Any* pSurAnch = 0; + const ::uno::Any* pSurAnch = 0; GetProperty(RES_SURROUND, MID_SURROUND_ANCHORONLY, pSurAnch); if(pSur || pSurAnch) { - SwFmtSurround aSrnd ( static_cast < const SwFmtSurround & > ( rFromSet.Get ( RES_SURROUND ) ) ); + SwFmtSurround aSrnd ( static_cast < const :: SwFmtSurround & > ( rFromSet.Get ( RES_SURROUND ) ) ); if(pSur) bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE ); if(pSurAnch) bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY); rToSet.Put(aSrnd); } - uno::Any* pLeft = 0; + const ::uno::Any* pLeft = 0; GetProperty(RES_BOX, LEFT_BORDER |CONVERT_TWIPS, pLeft ); - uno::Any* pRight = 0; + const ::uno::Any* pRight = 0; GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER , pRight ); - uno::Any* pTop = 0; + const ::uno::Any* pTop = 0; GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER , pTop ); - uno::Any* pBottom = 0; + const ::uno::Any* pBottom = 0; GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER, pBottom); - uno::Any* pDistance = 0; + const ::uno::Any* pDistance = 0; GetProperty(RES_BOX, CONVERT_TWIPS|BORDER_DISTANCE, pDistance); - uno::Any* pLeftDistance = 0; + const ::uno::Any* pLeftDistance = 0; GetProperty(RES_BOX, CONVERT_TWIPS|LEFT_BORDER_DISTANCE, pLeftDistance); - uno::Any* pRightDistance = 0; + const ::uno::Any* pRightDistance = 0; GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE, pRightDistance); - uno::Any* pTopDistance = 0; + const ::uno::Any* pTopDistance = 0; GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER_DISTANCE, pTopDistance); - uno::Any* pBottomDistance = 0; + const ::uno::Any* pBottomDistance = 0; GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE, pBottomDistance); if( pLeft || pRight || pTop || pBottom || pDistance || pLeftDistance || pRightDistance || pTopDistance || pBottomDistance ) { - SvxBoxItem aBox ( static_cast < const SvxBoxItem & > ( rFromSet.Get ( RES_BOX ) ) ); + SvxBoxItem aBox ( static_cast < const :: SvxBoxItem & > ( rFromSet.Get ( RES_BOX ) ) ); if( pLeft ) bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeft, CONVERT_TWIPS|LEFT_BORDER ); if( pRight ) @@ -447,29 +427,29 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const rToSet.Put(aBox); } { - uno::Any* pRelH = 0; + const ::uno::Any* pRelH = 0; GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_HEIGHT, pRelH); - uno::Any* pRelW = 0; + const ::uno::Any* pRelW = 0; GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_WIDTH, pRelW); - uno::Any* pSyncWidth = 0; + const ::uno::Any* pSyncWidth = 0; GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT, pSyncWidth); - uno::Any* pSyncHeight = 0; + const ::uno::Any* pSyncHeight = 0; GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH, pSyncHeight); - uno::Any* pWidth = 0; + const ::uno::Any* pWidth = 0; GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS, pWidth); - uno::Any* pHeight = 0; + const ::uno::Any* pHeight = 0; GetProperty(RES_FRM_SIZE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS, pHeight); - uno::Any* pSize = 0; + const ::uno::Any* pSize = 0; GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE|CONVERT_TWIPS, pSize); - uno::Any* pSizeType = 0; + const ::uno::Any* pSizeType = 0; GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE_TYPE, pSizeType); - uno::Any* pWidthType = 0; + const ::uno::Any* pWidthType = 0; GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH_TYPE, pWidthType); if( pWidth || pHeight ||pRelH || pRelW || pSize ||pSizeType || pWidthType ||pSyncWidth || pSyncHeight ) { rSizeFound = sal_True; - SwFmtFrmSize aFrmSz ( static_cast < const SwFmtFrmSize& > ( rFromSet.Get ( RES_FRM_SIZE ) ) ); + SwFmtFrmSize aFrmSz ( static_cast < const :: SwFmtFrmSize& > ( rFromSet.Get ( RES_FRM_SIZE ) ) ); if(pWidth) bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH|CONVERT_TWIPS); if(pHeight) @@ -501,13 +481,13 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const awt::Size aSize; aSize.Width = 2 * MM50; aSize.Height = 2 * MM50; - uno::Any aSizeVal; + ::uno::Any aSizeVal; aSizeVal <<= aSize; ((SfxPoolItem&)aFrmSz).PutValue(aSizeVal, MID_FRMSIZE_SIZE|CONVERT_TWIPS); rToSet.Put(aFrmSz); } } - uno::Any* pFrameDirection = 0; + const ::uno::Any* pFrameDirection = 0; GetProperty(RES_FRAMEDIR, 0, pFrameDirection); if(pFrameDirection) { @@ -515,7 +495,7 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const aAttr.PutValue(*pFrameDirection, 0); rToSet.Put(aAttr); } - uno::Any* pUnknown = 0; + const ::uno::Any* pUnknown = 0; GetProperty(RES_UNKNOWNATR_CONTAINER, 0, pUnknown); if(pUnknown) { @@ -525,7 +505,7 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const } // DVO, OD 01.10.2003 #i18732# - uno::Any* pFollowTextFlow = 0; + const ::uno::Any* pFollowTextFlow = 0; GetProperty(RES_FOLLOW_TEXT_FLOW, 0, pFollowTextFlow); if ( pFollowTextFlow ) { @@ -535,7 +515,7 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const } // OD 2004-05-04 #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS - uno::Any* pWrapInfluenceOnObjPos = 0; + const ::uno::Any* pWrapInfluenceOnObjPos = 0; GetProperty(RES_WRAP_INFLUENCE_ON_OBJPOS, MID_WRAP_INFLUENCE, pWrapInfluenceOnObjPos); if ( pWrapInfluenceOnObjPos ) { @@ -553,8 +533,8 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const class SwFrameProperties_Impl : public BaseFrameProperties_Impl { protected: - SwFrameProperties_Impl(const SfxItemPropertyMap* pMap) : - BaseFrameProperties_Impl(pMap){} +// SwFrameProperties_Impl(/*const :: SfxItemPropertyMap* pMap*/) : +// BaseFrameProperties_Impl(/*pMap*/){} public: SwFrameProperties_Impl(); virtual ~SwFrameProperties_Impl(){} @@ -565,17 +545,17 @@ public: * * --------------------------------------------------*/ SwFrameProperties_Impl::SwFrameProperties_Impl(): - BaseFrameProperties_Impl(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME) ) + BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME)*/ ) { } /* -----------------22.06.98 11:27------------------- * * --------------------------------------------------*/ -inline void lcl_FillCol ( SfxItemSet &rToSet, const SfxItemSet &rFromSet, uno::Any *pAny) +inline void lcl_FillCol ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, const :: uno::Any *pAny) { if ( pAny ) { - SwFmtCol aCol ( static_cast < const SwFmtCol & > ( rFromSet.Get ( RES_COL ) ) ); + SwFmtCol aCol ( static_cast < const :: SwFmtCol & > ( rFromSet.Get ( RES_COL ) ) ); ((SfxPoolItem&)aCol).PutValue( *pAny, MID_COLUMNS); rToSet.Put(aCol); } @@ -583,7 +563,7 @@ inline void lcl_FillCol ( SfxItemSet &rToSet, const SfxItemSet &rFromSet, uno::A sal_Bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItemSet&, sal_Bool& rSizeFound) { //Properties fuer alle Frames - uno::Any *pStyleName; + const ::uno::Any *pStyleName; SwDocStyleSheet* pStyle = NULL; sal_Bool bRet; @@ -595,22 +575,22 @@ sal_Bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SFX_STYLE_FAMILY_FRAME); } - uno::Any* pColumns = NULL; + const ::uno::Any* pColumns = NULL; GetProperty (RES_COL, MID_COLUMNS, pColumns); if ( pStyle ) { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *pStyle ) ); - const SfxItemSet *pItemSet = &xStyle->GetItemSet(); + const :: SfxItemSet *pItemSet = &xStyle->GetItemSet(); bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); lcl_FillCol ( rSet, *pItemSet, pColumns ); } else { - const SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet(); + const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet(); bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); lcl_FillCol ( rSet, *pItemSet, pColumns ); } - uno::Any* pEdit; + const ::uno::Any* pEdit; if(GetProperty(RES_EDIT_IN_READONLY, 0, pEdit)) { SfxBoolItem aBool(RES_EDIT_IN_READONLY); @@ -634,18 +614,18 @@ public: * * --------------------------------------------------*/ SwGraphicProperties_Impl::SwGraphicProperties_Impl( ) : - BaseFrameProperties_Impl(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC) ) + BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC)*/ ) { } /* -----------------27.06.98 14:40------------------- * * --------------------------------------------------*/ -inline void lcl_FillMirror ( SfxItemSet &rToSet, const SfxItemSet &rFromSet, uno::Any *pHEvenMirror, uno::Any *pHOddMirror, uno::Any *pVMirror, sal_Bool &rRet ) +inline void lcl_FillMirror ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, const ::uno::Any *pHEvenMirror, const ::uno::Any *pHOddMirror, const ::uno::Any *pVMirror, sal_Bool &rRet ) { if(pHEvenMirror || pHOddMirror || pVMirror ) { - SwMirrorGrf aMirror ( static_cast < const SwMirrorGrf& > ( rFromSet.Get ( RES_GRFATR_MIRRORGRF ) ) ); + SwMirrorGrf aMirror ( static_cast < const :: SwMirrorGrf& > ( rFromSet.Get ( RES_GRFATR_MIRRORGRF ) ) ); if(pHEvenMirror) rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHEvenMirror, MID_MIRROR_HORZ_EVEN_PAGES); if(pHOddMirror) @@ -664,7 +644,7 @@ sal_Bool SwGraphicProperties_Impl::AnyToItemSet( { //Properties fuer alle Frames sal_Bool bRet; - uno::Any *pStyleName; + const ::uno::Any *pStyleName; SwDocStyleSheet* pStyle = NULL; if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) ) @@ -675,9 +655,9 @@ sal_Bool SwGraphicProperties_Impl::AnyToItemSet( SFX_STYLE_FAMILY_FRAME); } - uno::Any* pHEvenMirror = 0; - uno::Any* pHOddMirror = 0; - uno::Any* pVMirror = 0; + const ::uno::Any* pHEvenMirror = 0; + const ::uno::Any* pHOddMirror = 0; + const ::uno::Any* pVMirror = 0; GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_EVEN_PAGES, pHEvenMirror); GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_ODD_PAGES, pHOddMirror); GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_VERT, pVMirror); @@ -685,19 +665,19 @@ sal_Bool SwGraphicProperties_Impl::AnyToItemSet( if ( pStyle ) { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet(*pStyle) ); - const SfxItemSet *pItemSet = &xStyle->GetItemSet(); + const :: SfxItemSet *pItemSet = &xStyle->GetItemSet(); bRet = FillBaseProperties(rFrmSet, *pItemSet, rSizeFound); lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet ); } else { - const SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC )->GetAttrSet(); + const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC )->GetAttrSet(); bRet = FillBaseProperties(rFrmSet, *pItemSet, rSizeFound); lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet ); } - static const USHORT nIDs[] = + static const :: USHORT nIDs[] = { RES_GRFATR_CROPGRF, RES_GRFATR_ROTATION, @@ -712,7 +692,7 @@ sal_Bool SwGraphicProperties_Impl::AnyToItemSet( RES_GRFATR_DRAWMODE, 0 }; - uno::Any* pAny; + const ::uno::Any* pAny; for(sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++) { BYTE nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0; @@ -735,7 +715,7 @@ class SwOLEProperties_Impl : public SwFrameProperties_Impl { public: SwOLEProperties_Impl() : - SwFrameProperties_Impl(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT) ){} + SwFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT)*/ ){} virtual ~SwOLEProperties_Impl(){} virtual sal_Bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound); @@ -747,7 +727,7 @@ public: sal_Bool SwOLEProperties_Impl::AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound) { - uno::Any* pTemp; + const ::uno::Any* pTemp; if(!GetProperty(FN_UNO_CLSID, 0, pTemp) && !GetProperty(FN_UNO_STREAM_NAME, 0, pTemp) ) return FALSE; SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrmSet, rSet, rSizeFound); @@ -761,7 +741,7 @@ sal_Bool SwOLEProperties_Impl::AnyToItemSet( /* -----------------------------10.03.00 18:02-------------------------------- ---------------------------------------------------------------------------*/ -const uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId() +const :: uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId() { static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); return aSeq; @@ -769,7 +749,7 @@ const uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId() /* -----------------------------10.03.00 18:04-------------------------------- ---------------------------------------------------------------------------*/ -sal_Int64 SAL_CALL SwXFrame::getSomething( const uno::Sequence< sal_Int8 >& rId ) +sal_Int64 SAL_CALL SwXFrame::getSomething( const :: uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException) { if( rId.getLength() == 16 @@ -795,7 +775,7 @@ OUString SwXFrame::getImplementationName(void) throw( uno::RuntimeException ) /* -----------------------------06.04.00 14:20-------------------------------- ---------------------------------------------------------------------------*/ -BOOL SwXFrame::supportsService(const OUString& rServiceName) throw( uno::RuntimeException ) +BOOL SwXFrame::supportsService(const :: OUString& rServiceName) throw( uno::RuntimeException ) { return !rServiceName.compareToAscii("com.sun.star.text.BaseFrame")|| !rServiceName.compareToAscii("com.sun.star.text.TextContent") || @@ -818,11 +798,10 @@ uno::Sequence< OUString > SwXFrame::getSupportedServiceNames(void) throw( uno::R /*-- 14.01.99 11:31:52--------------------------------------------------- Dieser CTor legt den Frame als Descriptor an -----------------------------------------------------------------------*/ -SwXFrame::SwXFrame(FlyCntType eSet, const SfxItemPropertyMap* pMap, SwDoc *pDoc) : +SwXFrame::SwXFrame(FlyCntType eSet, const :: SfxItemPropertySet* pSet, SwDoc *pDoc) : aLstnrCntnr( (container::XNamed*)this), - aPropSet(pMap), - _pMap(pMap), - mpDoc ( pDoc ), + m_pPropSet(pSet), + m_pDoc ( pDoc ), eType(eSet), bIsDescriptor(sal_True), m_pCopySource( 0 ) @@ -837,7 +816,7 @@ SwXFrame::SwXFrame(FlyCntType eSet, const SfxItemPropertyMap* pMap, SwDoc *pDoc) // Get the style families uno::Reference < XNameAccess > xFamilies = xFamilySupplier->getStyleFamilies(); // Get the Frame family (and keep it for later) - uno::Any aAny = xFamilies->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "FrameStyles" ) ) ); + const ::uno::Any aAny = xFamilies->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "FrameStyles" ) ) ); aAny >>= mxStyleFamily; // In the derived class, we'll ask mxStyleFamily for the relevant default style // mxStyleFamily is initialised in the SwXFrame constructor @@ -873,12 +852,11 @@ SwXFrame::SwXFrame(FlyCntType eSet, const SfxItemPropertyMap* pMap, SwDoc *pDoc) /*-- 11.12.98 15:05:01--------------------------------------------------- -----------------------------------------------------------------------*/ -SwXFrame::SwXFrame(SwFrmFmt& rFrmFmt, FlyCntType eSet, const SfxItemPropertyMap* pMap) : +SwXFrame::SwXFrame(SwFrmFmt& rFrmFmt, FlyCntType eSet, const :: SfxItemPropertySet* pSet) : SwClient( &rFrmFmt ), aLstnrCntnr( (container::XNamed*)this), - aPropSet(pMap), - _pMap(pMap), - mpDoc( 0 ), + m_pPropSet(pSet), + m_pDoc( 0 ), eType(eSet), pProps(0), bIsDescriptor(sal_False), @@ -916,7 +894,7 @@ OUString SwXFrame::getName(void) throw( uno::RuntimeException ) /*-- 11.12.98 15:05:03--------------------------------------------------- -----------------------------------------------------------------------*/ -void SwXFrame::setName(const OUString& rName) throw( uno::RuntimeException ) +void SwXFrame::setName(const :: OUString& rName) throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); SwFrmFmt* pFmt = GetFrmFmt(); @@ -947,17 +925,17 @@ uno::Reference< beans::XPropertySetInfo > SwXFrame::getPropertySetInfo(void) th { case FLYCNTTYPE_FRM: if( !xFrmRef.is() ) - xFrmRef = aPropSet.getPropertySetInfo(); + xFrmRef = m_pPropSet->getPropertySetInfo(); xRef = xFrmRef; break; case FLYCNTTYPE_GRF: if( !xGrfRef.is() ) - xGrfRef = aPropSet.getPropertySetInfo(); + xGrfRef = m_pPropSet->getPropertySetInfo(); xRef = xGrfRef; break; case FLYCNTTYPE_OLE: if( !xOLERef.is() ) - xOLERef = aPropSet.getPropertySetInfo(); + xOLERef = m_pPropSet->getPropertySetInfo(); xRef = xOLERef; break; default: @@ -993,7 +971,7 @@ SdrObject *SwXFrame::GetOrCreateSdrObject( SwFlyFrmFmt *pFmt ) = new SwFlyDrawContact( pFmt, pDrawModel ); pObject = pContactObject->GetMaster(); - const SwFmtSurround& rSurround = pFmt->GetSurround(); + const :: SwFmtSurround& rSurround = pFmt->GetSurround(); pObject->SetLayer( ( SURROUND_THROUGHT == rSurround.GetSurround() && !pFmt->GetOpaque().GetValue() ) ? pDoc->GetHellId() @@ -1005,7 +983,7 @@ SdrObject *SwXFrame::GetOrCreateSdrObject( SwFlyFrmFmt *pFmt ) return pObject; } -SwFrmFmt *lcl_GetFrmFmt( const uno::Any& rValue, SwDoc *pDoc ) +SwFrmFmt *lcl_GetFrmFmt( const :: uno::Any& rValue, SwDoc *pDoc ) { SwFrmFmt *pRet = 0; SwDocShell* pDocSh = pDoc->GetDocShell(); @@ -1025,36 +1003,36 @@ SwFrmFmt *lcl_GetFrmFmt( const uno::Any& rValue, SwDoc *pDoc ) return pRet; } -void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue) +void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::Any& aValue) throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); SwFrmFmt* pFmt = GetFrmFmt(); - const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName(_pMap, rPropertyName); + const :: SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName); - if (!pCur) + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); if(pFmt) { sal_Bool bNextFrame = sal_False; - if ( pCur->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); SwDoc* pDoc = pFmt->GetDoc(); if( eType == FLYCNTTYPE_GRF && - (pCur->nWID >= RES_GRFATR_BEGIN && - pCur->nWID < RES_GRFATR_END)|| - pCur->nWID == FN_PARAM_COUNTOUR_PP || - pCur->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR || - pCur->nWID == FN_UNO_IS_PIXEL_CONTOUR ) + (pEntry->nWID >= RES_GRFATR_BEGIN && + pEntry->nWID < RES_GRFATR_END)|| + pEntry->nWID == FN_PARAM_COUNTOUR_PP || + pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR || + pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR ) { - const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); + const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); if(pIdx) { SwNodeIndex aIdx(*pIdx, 1); SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode(); - if(pCur->nWID == FN_PARAM_COUNTOUR_PP) + if(pEntry->nWID == FN_PARAM_COUNTOUR_PP) { drawing::PointSequenceSequence aParam; if(!aValue.hasValue()) @@ -1064,9 +1042,9 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a PolyPolygon aPoly((USHORT)aParam.getLength()); for(sal_Int32 i = 0; i < aParam.getLength(); i++) { - const drawing::PointSequence* pPointSeq = aParam.getConstArray(); + const :: drawing::PointSequence* pPointSeq = aParam.getConstArray(); sal_Int32 nPoints = pPointSeq[i].getLength(); - const awt::Point* pPoints = pPointSeq[i].getConstArray(); + const :: awt::Point* pPoints = pPointSeq[i].getConstArray(); Polygon aSet( (USHORT)nPoints ); for(sal_Int32 j = 0; j < nPoints; j++) { @@ -1082,11 +1060,11 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a else throw lang::IllegalArgumentException(); } - else if(pCur->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ) + else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ) { pNoTxt->SetAutomaticContour( *(sal_Bool *)aValue.getValue() ); } - else if(pCur->nWID == FN_UNO_IS_PIXEL_CONTOUR ) + else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR ) { // The IsPixelContour property can only be set if there // is no contour, or if the contour has been set by the @@ -1101,14 +1079,14 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a else { SfxItemSet aSet(pNoTxt->GetSwAttrSet()); - aPropSet.setPropertyValue(*pCur, aValue, aSet); + m_pPropSet->setPropertyValue(*pEntry, aValue, aSet); pNoTxt->SetAttr(aSet); } } } - else if( FN_UNO_ALTERNATIVE_TEXT == pCur->nWID && eType != FLYCNTTYPE_FRM ) + else if( FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID && eType != FLYCNTTYPE_FRM ) { - const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); + const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); if(pIdx) { SwNodeIndex aIdx(*pIdx, 1); @@ -1118,7 +1096,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a pNoTxt->SetAlternateText(uTemp); } } - else if(FN_UNO_FRAME_STYLE_NAME == pCur->nWID) + else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID) { SwFrmFmt *pFrmFmt = lcl_GetFrmFmt( aValue, pFmt->GetDoc() ); if( pFrmFmt ) @@ -1134,13 +1112,13 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a // see SwFEShell::SetFrmFmt( SwFrmFmt *pNewFmt, sal_Bool bKeepOrient, Point* pDocPos ) SwFlyFrm *pFly = 0; { - const SwFrmFmt* pFmtXX = pFmt; + const :: SwFrmFmt* pFmtXX = pFmt; if (PTR_CAST(SwFlyFrmFmt, pFmtXX)) pFly = ((SwFlyFrmFmt*)pFmtXX)->GetFrm(); } if ( pFly ) { - const SfxPoolItem* pItem; + const :: SfxPoolItem* pItem; if( SFX_ITEM_SET == pFrmFmt->GetItemState( RES_ANCHOR, sal_False, &pItem )) { pSet = new SfxItemSet( pDoc->GetAttrPool(), aFrmFmtSetRange ); @@ -1158,8 +1136,8 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a else throw lang::IllegalArgumentException(); } - else if( FN_UNO_GRAPHIC_U_R_L == pCur->nWID || - FN_UNO_GRAPHIC_FILTER == pCur->nWID) + else if( FN_UNO_GRAPHIC_U_R_L == pEntry->nWID || + FN_UNO_GRAPHIC_FILTER == pEntry->nWID) { String sGrfName, sFltName; GraphicObject *pGrfObj = 0; @@ -1168,7 +1146,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a aValue >>= uTemp; String sTmp(uTemp); UnoActionContext aAction(pFmt->GetDoc()); - if(FN_UNO_GRAPHIC_U_R_L == pCur->nWID) + if(FN_UNO_GRAPHIC_U_R_L == pEntry->nWID) { if( sTmp.EqualsAscii( sPackageProtocol, 0, sizeof( sPackageProtocol )-1 ) ) @@ -1196,7 +1174,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a sFltName = sTmp; } - const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); + const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); if(pIdx) { SwNodeIndex aIdx(*pIdx, 1); @@ -1213,13 +1191,13 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a } delete pGrfObj; } - else if( FN_UNO_GRAPHIC == pCur->nWID ) + else if( FN_UNO_GRAPHIC == pEntry->nWID ) { uno::Reference< graphic::XGraphic > xGraphic; aValue >>= xGraphic; if(xGraphic.is()) { - const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); + const :: SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); if(pIdx) { SwNodeIndex aIdx(*pIdx, 1); @@ -1234,9 +1212,9 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a } } } - else if( FN_UNO_REPLACEMENT_GRAPHIC_URL == pCur->nWID || FN_UNO_REPLACEMENT_GRAPHIC == pCur->nWID ) + else if( FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID || FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID ) { - bool bURL = FN_UNO_REPLACEMENT_GRAPHIC_URL == pCur->nWID; + bool bURL = FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID; bool bApply = false; Graphic aGraphic; if( bURL ) @@ -1269,7 +1247,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a if ( bApply ) { - const SwFmtCntnt* pCnt = &pFmt->GetCntnt(); + const :: SwFmtCntnt* pCnt = &pFmt->GetCntnt(); if ( pCnt->GetCntntIdx() && pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ] ) { SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetCntntIdx()->GetIndex() + 1 ]->GetOLENode(); @@ -1324,7 +1302,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a } } } - else if(FN_UNO_Z_ORDER == pCur->nWID) + else if(FN_UNO_Z_ORDER == pEntry->nWID) { sal_Int32 nZOrder = - 1; aValue >>= nZOrder; @@ -1337,7 +1315,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a SetObjectOrdNum(pObject->GetOrdNum(), nZOrder); } } - else if(RES_ANCHOR == pCur->nWID && MID_ANCHOR_ANCHORFRAME == pCur->nMemberId) + else if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORFRAME == pEntry->nMemberId) { sal_Bool bDone = sal_False; uno::Reference<text::XTextFrame> xFrame; @@ -1352,7 +1330,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a SfxItemSet aSet( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END - 1 ); aSet.SetParent(&pFmt->GetAttrSet()); - SwFmtAnchor aAnchor = (const SwFmtAnchor&)aSet.Get(pCur->nWID); + SwFmtAnchor aAnchor = (const :: SwFmtAnchor&)aSet.Get(pEntry->nWID); SwPosition aPos(*pFrame->GetFrmFmt()->GetCntnt().GetCntntIdx()); @@ -1374,13 +1352,13 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a 0L); aSet.SetParent(&pFmt->GetAttrSet()); - aPropSet.setPropertyValue(*pCur, aValue, aSet); - if(RES_ANCHOR == pCur->nWID && MID_ANCHOR_ANCHORTYPE == pCur->nMemberId) + m_pPropSet->setPropertyValue(*pEntry, aValue, aSet); + if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId) { - SwFmtAnchor aAnchor = (const SwFmtAnchor&)aSet.Get(pCur->nWID); + SwFmtAnchor aAnchor = (const :: SwFmtAnchor&)aSet.Get(pEntry->nWID); if(aAnchor.GetAnchorId() == FLY_AT_FLY) { - const SwPosition* pPosition = aAnchor.GetCntntAnchor(); + const :: SwPosition* pPosition = aAnchor.GetCntntAnchor(); SwFrmFmt* pFlyFmt = pPosition ? pPosition->nNode.GetNode().GetFlyFmt() : 0; if(!pFlyFmt || pFlyFmt->Which() == RES_DRAWFRMFMT) { @@ -1416,7 +1394,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a pFly = ((SwFlyFrmFmt*)pFmt)->GetFrm(); if (pFly) { - const SfxPoolItem* pItem; + const :: SfxPoolItem* pItem; if( SFX_ITEM_SET == aSet.GetItemState( RES_ANCHOR, sal_False, &pItem )) { aSet.Put( *pItem ); @@ -1428,7 +1406,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet ); } - else if(FN_UNO_CLSID == pCur->nWID || FN_UNO_STREAM_NAME == pCur->nWID) + else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_STREAM_NAME == pEntry->nWID) { throw lang::IllegalArgumentException(); } @@ -1438,8 +1416,8 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a } else if(IsDescriptor()) { - pProps->SetProperty(pCur->nWID, pCur->nMemberId, aValue); - if( FN_UNO_FRAME_STYLE_NAME == pCur->nWID ) + pProps->SetProperty(pEntry->nWID, pEntry->nMemberId, aValue); + if( FN_UNO_FRAME_STYLE_NAME == pEntry->nWID ) { OUString sStyleName; aValue >>= sStyleName; @@ -1451,7 +1429,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& a catch ( container::NoSuchElementException const & ) { } - catch ( lang::WrappedTargetException const & ) + catch ( lang::WrappedTargetException const & ) { } catch ( uno::RuntimeException const & ) @@ -1471,11 +1449,11 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) vos::OGuard aGuard(Application::GetSolarMutex()); uno::Any aAny; SwFrmFmt* pFmt = GetFrmFmt(); - const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName(_pMap, rPropertyName); - if (!pCur) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if(FN_UNO_ANCHOR_TYPES == pCur->nWID) + if(FN_UNO_ANCHOR_TYPES == pEntry->nWID) { uno::Sequence<text::TextContentAnchorType> aTypes(5); text::TextContentAnchorType* pArray = aTypes.getArray(); @@ -1489,19 +1467,19 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) else if(pFmt) { if( ((eType == FLYCNTTYPE_GRF) || (eType == FLYCNTTYPE_OLE)) && - pCur && - ((pCur->nWID >= RES_GRFATR_BEGIN && - pCur->nWID < RES_GRFATR_END )|| - pCur->nWID == FN_PARAM_COUNTOUR_PP || - pCur->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR || - pCur->nWID == FN_UNO_IS_PIXEL_CONTOUR )) + pEntry && + ((pEntry->nWID >= RES_GRFATR_BEGIN && + pEntry->nWID < RES_GRFATR_END )|| + pEntry->nWID == FN_PARAM_COUNTOUR_PP || + pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR || + pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR )) { const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); if(pIdx) { SwNodeIndex aIdx(*pIdx, 1); SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode(); - if(pCur->nWID == FN_PARAM_COUNTOUR_PP) + if(pEntry->nWID == FN_PARAM_COUNTOUR_PP) { PolyPolygon aContour; if( pNoTxt->GetContourAPI( aContour ) ) @@ -1523,12 +1501,12 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) aAny <<= aPtSeq; } } - else if(pCur->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ) + else if(pEntry->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ) { BOOL bValue = pNoTxt->HasAutomaticContour(); aAny.setValue( &bValue, ::getBooleanCppuType() ); } - else if(pCur->nWID == FN_UNO_IS_PIXEL_CONTOUR ) + else if(pEntry->nWID == FN_UNO_IS_PIXEL_CONTOUR ) { BOOL bValue = pNoTxt->IsPixelContour(); aAny.setValue( &bValue, ::getBooleanCppuType() ); @@ -1536,11 +1514,11 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) else { SfxItemSet aSet(pNoTxt->GetSwAttrSet()); - aAny = aPropSet.getPropertyValue(*pCur, aSet); + m_pPropSet->getPropertyValue(*pEntry, aSet, aAny); } } } - else if( FN_UNO_GRAPHIC_U_R_L == pCur->nWID) + else if( FN_UNO_GRAPHIC_U_R_L == pEntry->nWID) { String sGrfName; const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); @@ -1565,13 +1543,13 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) } aAny <<= OUString(sGrfName); } - else if( FN_UNO_GRAPHIC_FILTER == pCur->nWID ) + else if( FN_UNO_GRAPHIC_FILTER == pEntry->nWID ) { String sFltName; pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, 0, &sFltName ); aAny <<= OUString(sFltName); } - else if( FN_UNO_GRAPHIC == pCur->nWID ) + else if( FN_UNO_GRAPHIC == pEntry->nWID ) { const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); if(pIdx) @@ -1583,12 +1561,12 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) aAny <<= pGrfNode->GetGrf().GetXGraphic(); } } - else if(FN_UNO_FRAME_STYLE_NAME == pCur->nWID) + else if(FN_UNO_FRAME_STYLE_NAME == pEntry->nWID) { aAny <<= OUString(SwStyleNameMapper::GetProgName(pFmt->DerivedFrom()->GetName(), nsSwGetPoolIdFromName::GET_POOLID_FRMFMT ) ); } else if(eType != FLYCNTTYPE_FRM && - FN_UNO_ALTERNATIVE_TEXT == pCur->nWID) + FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID) { const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); if(pIdx) @@ -1613,11 +1591,11 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) aAny.setValue(&aTmp, ::getCppuType(static_cast<const awt::Size*>(0))); } } - else if(FN_PARAM_LINK_DISPLAY_NAME == pCur->nWID) + else if(FN_PARAM_LINK_DISPLAY_NAME == pEntry->nWID) { aAny <<= OUString(pFmt->GetName()); } - else if(FN_UNO_Z_ORDER == pCur->nWID) + else if(FN_UNO_Z_ORDER == pEntry->nWID) { const SdrObject* pObj = pFmt->FindRealSdrObject(); if( pObj ) @@ -1625,8 +1603,8 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) aAny <<= (sal_Int32)pObj->GetOrdNum(); } } - else if(FN_UNO_CLSID == pCur->nWID || FN_UNO_MODEL == pCur->nWID|| - FN_UNO_COMPONENT == pCur->nWID ||FN_UNO_STREAM_NAME == pCur->nWID) + else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_MODEL == pEntry->nWID|| + FN_UNO_COMPONENT == pEntry->nWID ||FN_UNO_STREAM_NAME == pEntry->nWID) { SwDoc* pDoc = pFmt->GetDoc(); const SwFmtCntnt* pCnt = &pFmt->GetCntnt(); @@ -1641,7 +1619,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) { SvGlobalName aClassName( xIP->getClassID() ); aHexCLSID = aClassName.GetHexName(); - if(FN_UNO_CLSID != pCur->nWID) + if(FN_UNO_CLSID != pEntry->nWID) { if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) ) { @@ -1649,20 +1627,20 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) uno::Reference < frame::XModel > xModel( xComp, uno::UNO_QUERY ); if ( xModel.is() ) aAny <<= xModel; - else if ( FN_UNO_COMPONENT == pCur->nWID ) + else if ( FN_UNO_COMPONENT == pEntry->nWID ) aAny <<= xComp; } } } - if(FN_UNO_CLSID == pCur->nWID) + if(FN_UNO_CLSID == pEntry->nWID) aAny <<= aHexCLSID; - else if(FN_UNO_STREAM_NAME == pCur->nWID) + else if(FN_UNO_STREAM_NAME == pEntry->nWID) { aAny <<= ::rtl::OUString(pOleNode->GetOLEObj().GetCurrentPersistName()); } } - else if(WID_LAYOUT_SIZE == pCur->nWID) + else if(WID_LAYOUT_SIZE == pEntry->nWID) { // format document completely in order to get correct value pFmt->GetDoc()->GetEditShell()->CalcLayout(); @@ -1683,18 +1661,18 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) else { const SwAttrSet& rSet = pFmt->GetAttrSet(); - aAny = aPropSet.getPropertyValue(*pCur, rSet); + m_pPropSet->getPropertyValue(*pEntry, rSet, aAny); } } else if(IsDescriptor()) { - if ( ! mpDoc ) + if ( ! m_pDoc ) throw uno::RuntimeException(); - if(WID_LAYOUT_SIZE != pCur->nWID) // there is no LayoutSize in a descriptor + if(WID_LAYOUT_SIZE != pEntry->nWID) // there is no LayoutSize in a descriptor { - uno::Any* pAny = 0; - if( !pProps->GetProperty( pCur->nWID, pCur->nMemberId, pAny ) ) - pProps->GetProperty( rPropertyName, mxStyleData, aAny ); + const uno::Any* pAny = 0; + if( !pProps->GetProperty( pEntry->nWID, pEntry->nMemberId, pAny ) ) + aAny = mxStyleData->getPropertyValue( rPropertyName ); else if ( pAny ) aAny = *pAny; } @@ -1769,24 +1747,24 @@ uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates( const SwAttrSet& rFmtSet = pFmt->GetAttrSet(); for(int i = 0; i < aPropertyNames.getLength(); i++) { - const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName(_pMap, pNames[i]); - if (!pCur) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(pNames[i]); + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) ); - if(pCur->nWID == FN_UNO_ANCHOR_TYPES|| - pCur->nWID == FN_PARAM_LINK_DISPLAY_NAME|| - FN_UNO_FRAME_STYLE_NAME == pCur->nWID|| - FN_UNO_GRAPHIC_U_R_L == pCur->nWID|| - FN_UNO_GRAPHIC_FILTER == pCur->nWID|| - FN_UNO_ACTUAL_SIZE == pCur->nWID|| - FN_UNO_ALTERNATIVE_TEXT == pCur->nWID) + if(pEntry->nWID == FN_UNO_ANCHOR_TYPES|| + pEntry->nWID == FN_PARAM_LINK_DISPLAY_NAME|| + FN_UNO_FRAME_STYLE_NAME == pEntry->nWID|| + FN_UNO_GRAPHIC_U_R_L == pEntry->nWID|| + FN_UNO_GRAPHIC_FILTER == pEntry->nWID|| + FN_UNO_ACTUAL_SIZE == pEntry->nWID|| + FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID) pStates[i] = beans::PropertyState_DIRECT_VALUE; else { if(eType == FLYCNTTYPE_GRF && - pCur && - (pCur->nWID >= RES_GRFATR_BEGIN && - pCur->nWID <= RES_GRFATR_END)) + pEntry && + (pEntry->nWID >= RES_GRFATR_BEGIN && + pEntry->nWID <= RES_GRFATR_END)) { const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); if(pIdx) @@ -1794,14 +1772,14 @@ uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates( SwNodeIndex aIdx(*pIdx, 1); SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode(); SfxItemSet aSet(pNoTxt->GetSwAttrSet()); - aSet.GetItemState(pCur->nWID); - if(SFX_ITEM_SET == aSet.GetItemState( pCur->nWID, FALSE )) + aSet.GetItemState(pEntry->nWID); + if(SFX_ITEM_SET == aSet.GetItemState( pEntry->nWID, FALSE )) pStates[i] = beans::PropertyState_DIRECT_VALUE; } } else { - if(SFX_ITEM_SET == rFmtSet.GetItemState( pCur->nWID, FALSE )) + if(SFX_ITEM_SET == rFmtSet.GetItemState( pEntry->nWID, FALSE )) pStates[i] = beans::PropertyState_DIRECT_VALUE; else pStates[i] = beans::PropertyState_DEFAULT_VALUE; @@ -1828,20 +1806,20 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName ) SwFrmFmt* pFmt = GetFrmFmt(); if(pFmt) { - const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName(_pMap, rPropertyName); - if (!pCur) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if ( pCur->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertyToDefault: property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); BOOL bNextFrame; - if( pCur->nWID && - pCur->nWID != FN_UNO_ANCHOR_TYPES && - pCur->nWID != FN_PARAM_LINK_DISPLAY_NAME) + if( pEntry->nWID && + pEntry->nWID != FN_UNO_ANCHOR_TYPES && + pEntry->nWID != FN_PARAM_LINK_DISPLAY_NAME) { if( eType == FLYCNTTYPE_GRF && - (pCur->nWID >= RES_GRFATR_BEGIN && - pCur->nWID < RES_GRFATR_END)) + (pEntry->nWID >= RES_GRFATR_BEGIN && + pEntry->nWID < RES_GRFATR_END)) { const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); if(pIdx) @@ -1850,12 +1828,12 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName ) SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode(); { SfxItemSet aSet(pNoTxt->GetSwAttrSet()); - aSet.ClearItem(pCur->nWID); + aSet.ClearItem(pEntry->nWID); pNoTxt->SetAttr(aSet); } } } - else if( eType != FLYCNTTYPE_FRM && FN_UNO_ALTERNATIVE_TEXT == pCur->nWID ) + else if( eType != FLYCNTTYPE_FRM && FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID ) { const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); if(pIdx) @@ -1871,7 +1849,7 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName ) SfxItemSet aSet( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END - 1 ); aSet.SetParent(&pFmt->GetAttrSet()); - aSet.ClearItem(pCur->nWID); + aSet.ClearItem(pEntry->nWID); if(!rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE))) pFmt->SetFmtAttr(aSet); } @@ -1906,14 +1884,14 @@ uno::Any SwXFrame::getPropertyDefault( const OUString& rPropertyName ) SwFrmFmt* pFmt = GetFrmFmt(); if(pFmt) { - const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName(_pMap, rPropertyName); - if(pCur) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if(pEntry) { - if ( pCur->nWID < RES_FRMATR_END ) + if ( pEntry->nWID < RES_FRMATR_END ) { const SfxPoolItem& rDefItem = - pFmt->GetDoc()->GetAttrPool().GetDefaultItem(pCur->nWID); - rDefItem.QueryValue(aRet, pCur->nMemberId); + pFmt->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID); + rDefItem.QueryValue(aRet, pEntry->nMemberId); } } else @@ -1950,7 +1928,7 @@ void SwXFrame::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) { mxStyleData.clear(); mxStyleFamily.clear(); - mpDoc = 0; + m_pDoc = 0; aLstnrCntnr.Disposing(); } } @@ -2098,7 +2076,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan } } - uno::Any* pStyle; + const ::uno::Any* pStyle; SwFrmFmt *pParentFrmFmt = 0; if(pProps->GetProperty(FN_UNO_FRAME_STYLE_NAME, 0, pStyle)) pParentFrmFmt = lcl_GetFrmFmt( *pStyle, pDoc ); @@ -2142,12 +2120,12 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, sName); } //den SwXText wecken - ((SwXTextFrame*)this)->SetDoc( bIsDescriptor ? mpDoc : GetFrmFmt()->GetDoc() ); + ((SwXTextFrame*)this)->SetDoc( bIsDescriptor ? m_pDoc : GetFrmFmt()->GetDoc() ); } else if( eType == FLYCNTTYPE_GRF) { UnoActionContext aCont(pDoc); - uno::Any* pGraphicURL; + const ::uno::Any* pGraphicURL; String sGraphicURL; GraphicObject *pGrfObj = 0; if(pProps->GetProperty(FN_UNO_GRAPHIC_U_R_L, 0, pGraphicURL)) @@ -2173,7 +2151,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan } } Graphic aGraphic; - uno::Any* pGraphic; + const ::uno::Any* pGraphic; if( pProps->GetProperty( FN_UNO_GRAPHIC, 0, pGraphic )) { uno::Reference< graphic::XGraphic > xGraphic; @@ -2182,7 +2160,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan } String sFltName; - uno::Any* pFilter; + const ::uno::Any* pFilter; if(pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilter)) { OUString uTemp; @@ -2206,29 +2184,29 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, sName); } - uno::Any* pSurroundContour; + const ::uno::Any* pSurroundContour; if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurroundContour)) setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SURROUND_CONTOUR)), *pSurroundContour); - uno::Any* pContourOutside; + const ::uno::Any* pContourOutside; if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUROUTSIDE, pContourOutside)) setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_CONTOUR_OUTSIDE)), *pContourOutside); - uno::Any* pContourPoly; + const ::uno::Any* pContourPoly; if(pProps->GetProperty(FN_PARAM_COUNTOUR_PP, 0, pContourPoly)) setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_CONTOUR_POLY_POLYGON)), *pContourPoly); - uno::Any* pPixelContour; + const ::uno::Any* pPixelContour; if(pProps->GetProperty(FN_UNO_IS_PIXEL_CONTOUR, 0, pPixelContour)) setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_PIXEL_CONTOUR)), *pPixelContour); - uno::Any* pAutoContour; + const ::uno::Any* pAutoContour; if(pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0, pAutoContour)) setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_AUTOMATIC_CONTOUR)), *pAutoContour); - uno::Any* pAltText; + const ::uno::Any* pAltText; if(pProps->GetProperty(FN_UNO_ALTERNATIVE_TEXT, 0, pAltText)) setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ALTERNATIVE_TEXT)), *pAltText); } else { - uno::Any* pCLSID = 0; - uno::Any* pStreamName = 0; + const ::uno::Any* pCLSID = 0; + const ::uno::Any* pStreamName = 0; if(!pProps->GetProperty(FN_UNO_CLSID, 0, pCLSID) && !pProps->GetProperty( FN_UNO_STREAM_NAME, 0, pStreamName )) throw uno::RuntimeException(); if(pCLSID) @@ -2326,10 +2304,10 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan } if( pFmt && pDoc->GetDrawModel() ) GetOrCreateSdrObject( pFmt ); - uno::Any* pOrder; + const ::uno::Any* pOrder; if( pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder) ) setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_Z_ORDER)), *pOrder); - uno::Any* pReplacement; + const ::uno::Any* pReplacement; if( pProps->GetProperty(FN_UNO_REPLACEMENT_GRAPHIC, 0, pReplacement) ) setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_GRAPHIC)), *pReplacement); } @@ -2400,7 +2378,7 @@ void SwXFrame::setPosition(const awt::Point& /*aPosition*/) throw( uno::RuntimeE -----------------------------------------------------------------------*/ awt::Size SwXFrame::getSize(void) throw( uno::RuntimeException ) { - uno::Any aVal = getPropertyValue(C2U("Size")); + const ::uno::Any aVal = getPropertyValue(C2U("Size")); awt::Size* pRet = (awt::Size*)aVal.getValue(); return *pRet; } @@ -2410,7 +2388,7 @@ awt::Size SwXFrame::getSize(void) throw( uno::RuntimeException ) void SwXFrame::setSize(const awt::Size& aSize) throw( beans::PropertyVetoException, uno::RuntimeException ) { - uno::Any aVal(&aSize, ::getCppuType(static_cast<const awt::Size*>(0))); + const ::uno::Any aVal(&aSize, ::getCppuType(static_cast<const awt::Size*>(0))); setPropertyValue(C2U("Size"), aVal); } /*-- 22.04.99 08:03:21--------------------------------------------------- @@ -2430,7 +2408,7 @@ OUString SwXFrame::getShapeType(void) throw( uno::RuntimeException ) -----------------------------------------------------------------------*/ SwXTextFrame::SwXTextFrame( SwDoc *_pDoc ) : SwXText(0, CURSOR_FRAME), - SwXFrame(FLYCNTTYPE_FRM, aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME), _pDoc ) + SwXFrame(FLYCNTTYPE_FRM, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_FRAME), _pDoc ) { } /*-- 11.12.98 15:23:01--------------------------------------------------- @@ -2438,7 +2416,7 @@ SwXTextFrame::SwXTextFrame( SwDoc *_pDoc ) : -----------------------------------------------------------------------*/ SwXTextFrame::SwXTextFrame(SwFrmFmt& rFmt) : SwXText(rFmt.GetDoc(), CURSOR_FRAME), - SwXFrame(rFmt, FLYCNTTYPE_FRM, aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME)) + SwXFrame(rFmt, FLYCNTTYPE_FRM, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_FRAME)) { } @@ -2465,10 +2443,10 @@ void SAL_CALL SwXTextFrame::release( )throw() /* -----------------------------15.03.00 16:30-------------------------------- ---------------------------------------------------------------------------*/ -uno::Any SAL_CALL SwXTextFrame::queryInterface( const uno::Type& aType ) +::uno::Any SAL_CALL SwXTextFrame::queryInterface( const uno::Type& aType ) throw (uno::RuntimeException) { - uno::Any aRet = SwXFrame::queryInterface(aType); + ::uno::Any aRet = SwXFrame::queryInterface(aType); if(aRet.getValueType() == ::getCppuVoidType()) aRet = SwXText::queryInterface(aType); if(aRet.getValueType() == ::getCppuVoidType()) @@ -2757,11 +2735,11 @@ sal_Int64 SAL_CALL SwXTextFrame::getSomething( const uno::Sequence< sal_Int8 >& /* -----------------------------19.03.2002 16:43------------------------------ ---------------------------------------------------------------------------*/ -uno::Any SwXTextFrame::getPropertyValue(const OUString& rPropertyName) +::uno::Any SwXTextFrame::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - uno::Any aRet; + ::uno::Any aRet; if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_START_REDLINE))|| rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_END_REDLINE))) { @@ -2780,14 +2758,14 @@ uno::Any SwXTextFrame::getPropertyValue(const OUString& rPropertyName) -----------------------------------------------------------------------*/ SwXTextGraphicObject::SwXTextGraphicObject( SwDoc *pDoc ) : - SwXFrame(FLYCNTTYPE_GRF, aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC), pDoc) + SwXFrame(FLYCNTTYPE_GRF, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC), pDoc) { } /*-- 11.12.98 16:02:25--------------------------------------------------- -----------------------------------------------------------------------*/ SwXTextGraphicObject::SwXTextGraphicObject(SwFrmFmt& rFmt) : - SwXFrame(rFmt, FLYCNTTYPE_GRF, aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC)) + SwXFrame(rFmt, FLYCNTTYPE_GRF, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC)) { } @@ -2815,10 +2793,10 @@ void SAL_CALL SwXTextGraphicObject::release( )throw() /* -----------------------------15.03.00 16:30-------------------------------- ---------------------------------------------------------------------------*/ -uno::Any SAL_CALL SwXTextGraphicObject::queryInterface( const uno::Type& aType ) +::uno::Any SAL_CALL SwXTextGraphicObject::queryInterface( const uno::Type& aType ) throw(uno::RuntimeException) { - uno::Any aRet = SwXFrame::queryInterface(aType); + ::uno::Any aRet = SwXFrame::queryInterface(aType); if(aRet.getValueType() == ::getCppuVoidType()) aRet = SwXTextGraphicObjectBaseClass::queryInterface(aType); return aRet; @@ -2957,14 +2935,14 @@ uno::Reference<container::XNameReplace> SAL_CALL -----------------------------------------------------------------------*/ SwXTextEmbeddedObject::SwXTextEmbeddedObject( SwDoc *pDoc ) : - SwXFrame(FLYCNTTYPE_OLE, aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT), pDoc) + SwXFrame(FLYCNTTYPE_OLE, aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT), pDoc) { } /*-- 11.12.98 16:16:53--------------------------------------------------- -----------------------------------------------------------------------*/ SwXTextEmbeddedObject::SwXTextEmbeddedObject(SwFrmFmt& rFmt) : - SwXFrame(rFmt, FLYCNTTYPE_OLE, aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT)) + SwXFrame(rFmt, FLYCNTTYPE_OLE, aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT)) { } @@ -2995,10 +2973,10 @@ void SAL_CALL SwXTextEmbeddedObject::release()throw() /* -----------------------------15.03.00 16:32-------------------------------- ---------------------------------------------------------------------------*/ -uno::Any SAL_CALL SwXTextEmbeddedObject::queryInterface( const uno::Type& aType ) +::uno::Any SAL_CALL SwXTextEmbeddedObject::queryInterface( const uno::Type& aType ) throw( uno::RuntimeException) { - uno::Any aRet = SwXFrame::queryInterface(aType);; + ::uno::Any aRet = SwXFrame::queryInterface(aType);; if(aRet.getValueType() == ::getCppuVoidType()) aRet = SwXTextEmbeddedObjectBaseClass::queryInterface(aType); return aRet; diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx index 003eccb8d101..aea52396f366 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -490,8 +490,7 @@ void SwXFootnote::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) uno::Reference< beans::XPropertySetInfo > SwXFootnote::getPropertySetInfo( ) throw(uno::RuntimeException) { - static uno::Reference< beans::XPropertySetInfo > xRef = - new SfxItemPropertySetInfo(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_FOOTNOTE)); + static uno::Reference< beans::XPropertySetInfo > xRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_FOOTNOTE)->getPropertySetInfo(); return xRef; } /*-- 11.09.00 13:12:04--------------------------------------------------- diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 47e4f3623d34..5fbec1e277a1 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -100,19 +100,6 @@ sal_Bool lcl_AnyToBool(uno::Any rVal) throw(lang::IllegalArgumentException) /****************************************************************************** * ******************************************************************************/ -SwTOXMark* lcl_GetMark(SwTOXType* pType, const SwTOXMark* pOwnMark) -{ - SwClientIter aIter(*pType); - SwTOXMark* pMark = (SwTOXMark*)aIter.First(TYPE(SwTOXMark)); - while( pMark ) - { - if(pMark == pOwnMark) - return pMark; - else - pMark = (SwTOXMark*)aIter.Next(); - } - return 0; -} //----------------------------------------------------------------------------- void lcl_ReAssignTOXType(SwDoc* pDoc, SwTOXBase& rTOXBase, const OUString& rNewName) { @@ -271,7 +258,7 @@ uno::Sequence< OUString > SwXDocumentIndex::getSupportedServiceNames(void) throw TYPEINIT1(SwXDocumentIndex, SwClient) SwXDocumentIndex::SwXDocumentIndex(const SwTOXBaseSection* pB, SwDoc* pDc) : aLstnrCntnr( (text::XTextContent*)this), - _pMap(0), + m_pPropSet(0), m_pDoc(pDc), pBase(pB), eTOXType(TOX_USER), @@ -297,7 +284,7 @@ SwXDocumentIndex::SwXDocumentIndex(const SwTOXBaseSection* pB, SwDoc* pDc) : default: PropertyId = PROPERTY_MAP_INDEX_USER; } - _pMap = aSwMapProvider.GetPropertyMap(PropertyId); + m_pPropSet = aSwMapProvider.GetPropertySet(PropertyId); } } /* -----------------15.01.99 14:59------------------- @@ -326,7 +313,7 @@ SwXDocumentIndex::SwXDocumentIndex(TOXTypes eType, SwDoc& rDoc) : default: PropertyId = PROPERTY_MAP_INDEX_USER; } - _pMap = aSwMapProvider.GetPropertyMap(PropertyId); + m_pPropSet = aSwMapProvider.GetPropertySet(PropertyId); } /*-- 14.12.98 09:35:04--------------------------------------------------- @@ -375,7 +362,7 @@ void SwXDocumentIndex::update(void) throw( uno::RuntimeException ) -----------------------------------------------------------------------*/ uno::Reference< beans::XPropertySetInfo > SwXDocumentIndex::getPropertySetInfo(void) throw( uno::RuntimeException ) { - uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo( _pMap ); + uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo(); return aRef; } /*-- 14.12.98 09:35:05--------------------------------------------------- @@ -387,11 +374,10 @@ void SwXDocumentIndex::setPropertyValue(const OUString& rPropertyName, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if (!pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); SwTOXBase* pTOXBase = 0; @@ -410,7 +396,7 @@ void SwXDocumentIndex::setPropertyValue(const OUString& rPropertyName, SwForm aForm(pTOXBase->GetTOXForm()); sal_Bool bForm = sal_False; SfxItemSet* pAttrSet = 0; - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_IDX_TITLE : { @@ -628,17 +614,16 @@ void SwXDocumentIndex::setPropertyValue(const OUString& rPropertyName, sal_uInt16 nLPos = pTOXBase->GetType() == TOX_INDEX ? 2 : 1; String aString; SwStyleNameMapper::FillUIName( lcl_AnyToString(aValue), aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True); - aForm.SetTemplate(nLPos + pMap->nWID - WID_PARA_LEV1, aString ); + aForm.SetTemplate(nLPos + pEntry->nWID - WID_PARA_LEV1, aString ); } break; default: //this is for items only - if(WID_PRIMARY_KEY > pMap->nWID) + if(WID_PRIMARY_KEY > pEntry->nWID) { - SfxItemPropertySet aPropSet(_pMap); const SwAttrSet& rSet = m_pDoc->GetTOXBaseAttrSet(*pTOXBase); pAttrSet = new SfxItemSet(rSet); - aPropSet.setPropertyValue(*pMap, aValue, *pAttrSet); + m_pPropSet->setPropertyValue(rPropertyName, aValue, *pAttrSet); const SwSectionFmts& rSects = m_pDoc->GetSections(); const SwSectionFmt* pOwnFmt = GetFmt(); @@ -673,9 +658,8 @@ uno::Any SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName) { vos::OGuard aGuard(Application::GetSolarMutex()); uno::Any aRet; - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if (!pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); SwTOXBase* pTOXBase = 0; if(GetFmt()) @@ -692,12 +676,12 @@ uno::Any SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName) const SwForm& rForm = pTOXBase->GetTOXForm(); sal_Bool bBOOL = sal_True; sal_Bool bRet = sal_False; - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_IDX_CONTENT_SECTION: case WID_IDX_HEADER_SECTION : bBOOL = sal_False; - if(WID_IDX_CONTENT_SECTION == pMap->nWID) + if(WID_IDX_CONTENT_SECTION == pEntry->nWID) { uno::Reference <text::XTextSection> xContentSect = SwXTextSections::GetObject( *GetFmt() ); aRet <<= xContentSect; @@ -921,7 +905,7 @@ uno::Any SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName) sal_uInt16 nLPos = pTOXBase->GetType() == TOX_INDEX ? 2 : 1; String aString; SwStyleNameMapper::FillProgName( - rForm.GetTemplate(nLPos + pMap->nWID - WID_PARA_LEV1), + rForm.GetTemplate(nLPos + pEntry->nWID - WID_PARA_LEV1), aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True); @@ -958,11 +942,10 @@ uno::Any SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName) default: //this is for items only bBOOL = sal_False; - if(WID_PRIMARY_KEY > pMap->nWID) + if(WID_PRIMARY_KEY > pEntry->nWID) { - SfxItemPropertySet aPropSet(_pMap); const SwAttrSet& rSet = m_pDoc->GetTOXBaseAttrSet(*pTOXBase); - aRet = aPropSet.getPropertyValue(*pMap, rSet); + aRet = m_pPropSet->getPropertyValue(rPropertyName, rSet); } } if(bBOOL) @@ -1344,7 +1327,7 @@ void SwXDocumentIndexMark::InitMap(TOXTypes eToxType) default: ; } - _pMap = aSwMapProvider.GetPropertyMap(nMapId); + m_pPropSet = aSwMapProvider.GetPropertySet(nMapId); } /*-- 14.12.98 10:25:45--------------------------------------------------- @@ -1354,11 +1337,9 @@ OUString SwXDocumentIndexMark::getMarkEntry(void) throw( uno::RuntimeException ) vos::OGuard aGuard(Application::GetSolarMutex()); SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType(); OUString sRet; - if(pType) + if(pType && m_pTOXMark) { - SwTOXMark* pCurMark = lcl_GetMark(pType, GetTOXMark()); - SwTOXMark aMark(*pCurMark); - sRet = OUString(aMark.GetAlternativeText()); + sRet = OUString(m_pTOXMark->GetAlternativeText()); } else if(bIsDescriptor) sRet = sAltText; @@ -1373,12 +1354,11 @@ void SwXDocumentIndexMark::setMarkEntry(const OUString& rIndexEntry) throw( uno: { vos::OGuard aGuard(Application::GetSolarMutex()); SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType(); - if(pType) + if(pType && m_pTOXMark) { - SwTOXMark* pCurMark = lcl_GetMark(pType, GetTOXMark()); - SwTOXMark aMark(*pCurMark); + SwTOXMark aMark(*m_pTOXMark); aMark.SetAlternativeText(rIndexEntry); - SwTxtTOXMark* pTxtMark = pCurMark->GetTxtTOXMark(); + const SwTxtTOXMark* pTxtMark = m_pTOXMark->GetTxtTOXMark(); SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart()); aPam.SetMark(); if(pTxtMark->GetEnd()) @@ -1389,8 +1369,8 @@ void SwXDocumentIndexMark::setMarkEntry(const OUString& rIndexEntry) throw( uno: aPam.GetPoint()->nContent++; //die alte Marke loeschen - m_pDoc->Delete(pCurMark); - m_pTOXMark = pCurMark = 0; + m_pDoc->Delete(m_pTOXMark); + m_pTOXMark = 0; SwTxtAttr* pTxtAttr = 0; sal_Bool bInsAtPos = aMark.IsAlternativeText(); @@ -1560,12 +1540,11 @@ uno::Reference< text::XTextRange > SwXDocumentIndexMark::getAnchor(void) throw( vos::OGuard aGuard(Application::GetSolarMutex()); uno::Reference< text::XTextRange > aRet; SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType(); - if(pType) + if(pType && m_pTOXMark) { - SwTOXMark* pCurMark = lcl_GetMark(pType, GetTOXMark()); - if(pCurMark && pCurMark->GetTxtTOXMark()) + if( m_pTOXMark->GetTxtTOXMark() ) { - SwTxtTOXMark* pTxtMark = pCurMark->GetTxtTOXMark(); + const SwTxtTOXMark* pTxtMark = m_pTOXMark->GetTxtTOXMark(); SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart()); aPam.SetMark(); if(pTxtMark->GetEnd()) @@ -1590,10 +1569,9 @@ void SwXDocumentIndexMark::dispose(void) throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType(); - if(pType) + if(pType && m_pTOXMark) { - SwTOXMark* pTMark = lcl_GetMark(pType, GetTOXMark()); - m_pDoc->Delete(pTMark); + m_pDoc->Delete(m_pTOXMark); } else throw uno::RuntimeException(); @@ -1635,11 +1613,11 @@ uno::Reference< beans::XPropertySetInfo > SwXDocumentIndexMark::getPropertySetI } if(!xInfos[nPos].is()) { - uno::Reference< beans::XPropertySetInfo > xInfo = new SfxItemPropertySetInfo(_pMap); + uno::Reference< beans::XPropertySetInfo > xInfo = m_pPropSet->getPropertySetInfo(); // extend PropertySetInfo! const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties(); xInfos[nPos] = new SfxExtItemPropertySetInfo( - aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH_EXTENSIONS), + aSwMapProvider.GetPropertyMapEntries(PROPERTY_MAP_PARAGRAPH_EXTENSIONS), aPropSeq ); } return xInfos[nPos]; @@ -1654,94 +1632,88 @@ void SwXDocumentIndexMark::setPropertyValue(const OUString& rPropertyName, { vos::OGuard aGuard(Application::GetSolarMutex()); SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType(); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if (!pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if(pType) + if(pType && m_pTOXMark) { SwDoc* pLocalDoc = m_pDoc; - SwTOXMark* pCurMark = lcl_GetMark(pType, GetTOXMark()); - if(pCurMark) - { - SwTOXMark aMark(*pCurMark); - switch(pMap->nWID) - { - case WID_ALT_TEXT: - aMark.SetAlternativeText(lcl_AnyToString(aValue)); - break; - case WID_LEVEL: - aMark.SetLevel(Min( (sal_Int8) ( MAXLEVEL ), - (sal_Int8)(lcl_AnyToInt16(aValue)+1))); - break; - case WID_PRIMARY_KEY : - aMark.SetPrimaryKey(lcl_AnyToString(aValue)); - break; - case WID_SECONDARY_KEY: - aMark.SetSecondaryKey(lcl_AnyToString(aValue)); - break; - case WID_MAIN_ENTRY: - aMark.SetMainEntry(lcl_AnyToBool(aValue)); - break; - case WID_TEXT_READING: - aMark.SetTextReading(lcl_AnyToString(aValue)); - break; - case WID_PRIMARY_KEY_READING: - aMark.SetPrimaryKeyReading(lcl_AnyToString(aValue)); - break; - case WID_SECONDARY_KEY_READING: - aMark.SetSecondaryKeyReading(lcl_AnyToString(aValue)); - break; - } - SwTxtTOXMark* pTxtMark = pCurMark->GetTxtTOXMark(); - SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart()); - aPam.SetMark(); - if(pTxtMark->GetEnd()) - { - aPam.GetPoint()->nContent = *pTxtMark->GetEnd(); - } - else - aPam.GetPoint()->nContent++; + SwTOXMark aMark(*m_pTOXMark); + switch(pEntry->nWID) + { + case WID_ALT_TEXT: + aMark.SetAlternativeText(lcl_AnyToString(aValue)); + break; + case WID_LEVEL: + aMark.SetLevel(Min( (sal_Int8) ( MAXLEVEL ), + (sal_Int8)(lcl_AnyToInt16(aValue)+1))); + break; + case WID_PRIMARY_KEY : + aMark.SetPrimaryKey(lcl_AnyToString(aValue)); + break; + case WID_SECONDARY_KEY: + aMark.SetSecondaryKey(lcl_AnyToString(aValue)); + break; + case WID_MAIN_ENTRY: + aMark.SetMainEntry(lcl_AnyToBool(aValue)); + break; + case WID_TEXT_READING: + aMark.SetTextReading(lcl_AnyToString(aValue)); + break; + case WID_PRIMARY_KEY_READING: + aMark.SetPrimaryKeyReading(lcl_AnyToString(aValue)); + break; + case WID_SECONDARY_KEY_READING: + aMark.SetSecondaryKeyReading(lcl_AnyToString(aValue)); + break; + } + const SwTxtTOXMark* pTxtMark = m_pTOXMark->GetTxtTOXMark(); + SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart()); + aPam.SetMark(); + if(pTxtMark->GetEnd()) + { + aPam.GetPoint()->nContent = *pTxtMark->GetEnd(); + } + else + aPam.GetPoint()->nContent++; - //die alte Marke loeschen - pLocalDoc->Delete(pCurMark); - m_pTOXMark = pCurMark = 0; + //delete the old mark + pLocalDoc->Delete(m_pTOXMark); + m_pTOXMark = 0; - sal_Bool bInsAtPos = aMark.IsAlternativeText(); - const SwPosition *pStt = aPam.Start(), - *pEnd = aPam.End(); + sal_Bool bInsAtPos = aMark.IsAlternativeText(); + const SwPosition *pStt = aPam.Start(), + *pEnd = aPam.End(); - SwTxtAttr* pTxtAttr = 0; - if( bInsAtPos ) - { - SwPaM aTmp( *pStt ); - pLocalDoc->Insert( aTmp, aMark, 0 ); - pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr( - pStt->nContent.GetIndex()-1, RES_TXTATR_TOXMARK ); - } - else if( *pEnd != *pStt ) - { - pLocalDoc->Insert( aPam, aMark, nsSetAttrMode::SETATTR_DONTEXPAND ); - pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr( - pStt->nContent, RES_TXTATR_TOXMARK ); - } - m_pDoc = pLocalDoc; - //und sonst - Marke geloescht? + SwTxtAttr* pTxtAttr = 0; + if( bInsAtPos ) + { + SwPaM aTmp( *pStt ); + pLocalDoc->Insert( aTmp, aMark, 0 ); + pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr( + pStt->nContent.GetIndex()-1, RES_TXTATR_TOXMARK ); + } + else if( *pEnd != *pStt ) + { + pLocalDoc->Insert( aPam, aMark, nsSetAttrMode::SETATTR_DONTEXPAND ); + pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr( + pStt->nContent, RES_TXTATR_TOXMARK ); + } + m_pDoc = pLocalDoc; - if(pTxtAttr) - { - m_pTOXMark = &pTxtAttr->GetTOXMark(); - m_pDoc->GetUnoCallBack()->Add(this); - pType->Add(&aTypeDepend); - } + if(pTxtAttr) + { + m_pTOXMark = &pTxtAttr->GetTOXMark(); + m_pDoc->GetUnoCallBack()->Add(this); + pType->Add(&aTypeDepend); } } else if(bIsDescriptor) { - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_ALT_TEXT: sAltText = lcl_AnyToString(aValue); @@ -1794,60 +1766,54 @@ uno::Any SwXDocumentIndexMark::getPropertyValue(const OUString& rPropertyName) vos::OGuard aGuard(Application::GetSolarMutex()); uno::Any aRet; SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType(); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - - if (!pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if(SwXParagraph::getDefaultTextContentValue(aRet, rPropertyName, pMap->nWID)) + if(SwXParagraph::getDefaultTextContentValue(aRet, rPropertyName, pEntry->nWID)) return aRet; - if(pType) + if(pType && m_pTOXMark) { - SwTOXMark* pCurMark = lcl_GetMark(pType, GetTOXMark()); - if(pCurMark) + switch(pEntry->nWID) { - switch(pMap->nWID) + case WID_ALT_TEXT: + aRet <<= OUString(m_pTOXMark->GetAlternativeText()); + break; + case WID_LEVEL: + aRet <<= (sal_Int16)(m_pTOXMark->GetLevel() - 1); + break; + case WID_PRIMARY_KEY : + aRet <<= OUString(m_pTOXMark->GetPrimaryKey()); + break; + case WID_SECONDARY_KEY: + aRet <<= OUString(m_pTOXMark->GetSecondaryKey()); + break; + case WID_TEXT_READING: + aRet <<= OUString(m_pTOXMark->GetTextReading()); + break; + case WID_PRIMARY_KEY_READING: + aRet <<= OUString(m_pTOXMark->GetPrimaryKeyReading()); + break; + case WID_SECONDARY_KEY_READING: + aRet <<= OUString(m_pTOXMark->GetSecondaryKeyReading()); + break; + case WID_USER_IDX_NAME : { - case WID_ALT_TEXT: - aRet <<= OUString(pCurMark->GetAlternativeText()); - break; - case WID_LEVEL: - aRet <<= (sal_Int16)(pCurMark->GetLevel() - 1); - break; - case WID_PRIMARY_KEY : - aRet <<= OUString(pCurMark->GetPrimaryKey()); - break; - case WID_SECONDARY_KEY: - aRet <<= OUString(pCurMark->GetSecondaryKey()); - break; - case WID_TEXT_READING: - aRet <<= OUString(pCurMark->GetTextReading()); - break; - case WID_PRIMARY_KEY_READING: - aRet <<= OUString(pCurMark->GetPrimaryKeyReading()); - break; - case WID_SECONDARY_KEY_READING: - aRet <<= OUString(pCurMark->GetSecondaryKeyReading()); - break; - case WID_USER_IDX_NAME : - { - OUString sTmp(pType->GetTypeName()); - lcl_ConvertTOUNameToProgrammaticName(sTmp); - aRet <<= sTmp; - } - break; - case WID_MAIN_ENTRY: - { - sal_Bool bTemp = pCurMark->IsMainEntry(); - aRet.setValue(&bTemp, ::getBooleanCppuType()); - } - break; + OUString sTmp(pType->GetTypeName()); + lcl_ConvertTOUNameToProgrammaticName(sTmp); + aRet <<= sTmp; } + break; + case WID_MAIN_ENTRY: + { + sal_Bool bTemp = m_pTOXMark->IsMainEntry(); + aRet.setValue(&bTemp, ::getBooleanCppuType()); + } + break; } } else if(bIsDescriptor) { - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_ALT_TEXT: aRet <<= OUString(sAltText); @@ -1923,7 +1889,7 @@ SwXDocumentIndexMark* SwXDocumentIndexMark::GetObject(SwTOXType* pType, aIter.First(TYPE(SwXDocumentIndexMark)); while( pxMark ) { - if(pxMark->GetTOXMark() == pMark) + if(pxMark->m_pTOXMark == pMark) return pxMark; pxMark = (SwXDocumentIndexMark*)aIter.Next(); } diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 8b22521276d5..74b794bd9308 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -83,11 +83,9 @@ SwUnoPropertyMapProvider::SwUnoPropertyMapProvider() { for( sal_uInt16 i = 0; i < PROPERTY_MAP_END; i++ ) { - aMapArr[i] = 0; + aMapEntriesArr[i] = 0; + aPropertySetArr[i] = 0; } - pCharStyleMap = pParaStyleMap = pFrameStyleMap = - pPageStyleMap = pNumStyleMap = pConditionalParaStyleMap = - pCharAutoStyleMap = pRubyAutoStyleMap = pParaAutoStyleMap = 0; } /* -----------------19.02.99 08:31------------------- @@ -95,117 +93,7 @@ SwUnoPropertyMapProvider::SwUnoPropertyMapProvider() * --------------------------------------------------*/ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider() { - delete pCharStyleMap; - delete pParaStyleMap; - delete pFrameStyleMap; - delete pPageStyleMap; - delete pNumStyleMap; - delete pConditionalParaStyleMap; - delete pCharAutoStyleMap; - delete pRubyAutoStyleMap; - delete pParaAutoStyleMap; } -/* -----------------19.02.99 08:31------------------- - * - * --------------------------------------------------*/ -SfxItemPropertySet& SwUnoPropertyMapProvider::GetPropertySet(sal_Int8 nPropSetId) -{ - SfxItemPropertySet** ppMap = 0; - sal_uInt16 nPropertyId = 0xFFFF; - switch(nPropSetId) - { - case PROPERTY_SET_CHAR_STYLE: - ppMap = &pCharStyleMap; - nPropertyId = PROPERTY_MAP_CHAR_STYLE; - break; - case PROPERTY_SET_PARA_STYLE: - ppMap = &pParaStyleMap; - nPropertyId = PROPERTY_MAP_PARA_STYLE; - break; - case PROPERTY_SET_FRAME_STYLE: - ppMap = &pFrameStyleMap; - nPropertyId = PROPERTY_MAP_FRAME_STYLE; - break; - case PROPERTY_SET_PAGE_STYLE: - ppMap = &pPageStyleMap; - nPropertyId = PROPERTY_MAP_PAGE_STYLE; - break; - case PROPERTY_SET_NUM_STYLE: - ppMap = &pNumStyleMap; - nPropertyId = PROPERTY_MAP_NUM_STYLE; - break; - case PROPERTY_SET_CONDITIONAL_PARA_STYLE: - ppMap = &pConditionalParaStyleMap; - nPropertyId = PROPERTY_MAP_CONDITIONAL_PARA_STYLE; - break; - case PROPERTY_SET_CHAR_AUTO_STYLE: - ppMap = &pCharAutoStyleMap; - nPropertyId = PROPERTY_MAP_CHAR_AUTO_STYLE; - break; - case PROPERTY_SET_RUBY_AUTO_STYLE: - ppMap = &pRubyAutoStyleMap; - nPropertyId = PROPERTY_MAP_RUBY_AUTO_STYLE; - break; - case PROPERTY_SET_PARA_AUTO_STYLE: - ppMap = &pParaAutoStyleMap; - nPropertyId = PROPERTY_MAP_PARA_AUTO_STYLE; - break; - default: - DBG_ERROR( "unexpected property set id" ); - } - - SfxItemPropertySet* pRet; - if( ppMap ) - { - if( !*ppMap ) - *ppMap = new SwItemPropertySet( GetPropertyMap( nPropertyId )); - pRet = *ppMap; - } - else - pRet = 0; - return *pRet; -} -/* -----------------25.06.98 07:19------------------- - * - * --------------------------------------------------*/ -EXTERN_C -#if defined( PM2 ) && (!defined( CSET ) && !defined ( MTW ) && !defined( WTC )) -int _stdcall -#else -#ifdef WNT -int _cdecl -#else -int -#endif -#endif -lcl_CompareMap(const void* pSmaller, const void* pBigger ) -{ - int nDiff = strcmp( ((const SfxItemPropertyMap*)pSmaller)->pName, - ((const SfxItemPropertyMap*)pBigger)->pName ); - return nDiff; - -} -/* -----------------24.06.98 18:12------------------- - * - * --------------------------------------------------*/ -void SwUnoPropertyMapProvider::Sort( sal_uInt16 nId ) -{ - SfxItemPropertyMap* p = aMapArr[nId]; - sal_uInt16 i = 0; - for( ; p->pName; ++p, ++i ) - { - // set the name - const SwPropNameLen& rPropNm = GetPropName( (USHORT)(long)p->pName ); - p->pName = rPropNm.pName; - p->nNameLen = rPropNm.nNameLen; - // get the cppu type from the comphelper - CppuTypes nTyp = (CppuTypes) (long) p->pType; - GenerateCppuType( nTyp, p->pType ); - DBG_ASSERT( nTyp != (CppuTypes) (long) p->pType, "unknown type" ); - } - qsort( aMapArr[nId], i, sizeof(SfxItemPropertyMap), lcl_CompareMap ); -} - #define _STANDARD_FONT_PROPERTIES \ { SW_PROP_NMID(UNO_NAME_CHAR_HEIGHT), RES_CHRATR_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_FONTHEIGHT|CONVERT_TWIPS}, \ @@ -607,26 +495,26 @@ void SwUnoPropertyMapProvider::Sort( sal_uInt16 nId ) { SW_PROP_NMID(UNO_NAME_IS_FIELD_DISPLAYED), FIELD_PROP_IS_FIELD_DISPLAYED, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::READONLY, 0},\ -const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nPropertyId) +const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(sal_uInt16 nPropertyId) { DBG_ASSERT(nPropertyId < PROPERTY_MAP_END, "Id ?" ); - if( !aMapArr[ nPropertyId ] ) + if( !aMapEntriesArr[ nPropertyId ] ) { switch(nPropertyId) { case PROPERTY_MAP_TEXT_CURSOR: { - static SfxItemPropertyMap aCharAndParaMap_Impl[] = + static SfxItemPropertyMapEntry aCharAndParaMap_Impl[] = { COMPLETE_TEXT_CURSOR_MAP {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aCharAndParaMap_Impl; + aMapEntriesArr[nPropertyId] = aCharAndParaMap_Impl; } break; case PROPERTY_MAP_PARAGRAPH: { - static SfxItemPropertyMap aParagraphMap_Impl[] = + static SfxItemPropertyMapEntry aParagraphMap_Impl[] = { COMMON_CRSR_PARA_PROPERTIES_2 TABSTOPS_MAP_ENTRY @@ -635,12 +523,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAMES), FN_UNO_CHARFMT_SEQUENCE, CPPU_E2T(CPPUTYPE_OUSTRINGS), PropertyAttribute::MAYBEVOID, 0},\ {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aParagraphMap_Impl; + aMapEntriesArr[nPropertyId] = aParagraphMap_Impl; } break; case PROPERTY_MAP_PARA_AUTO_STYLE : { - static SfxItemPropertyMap aAutoParaStyleMap [] = + static SfxItemPropertyMapEntry aAutoParaStyleMap [] = { { SW_PROP_NMID(UNO_NAME_PARA_STYLE_NAME), RES_FRMATR_STYLE_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0}, \ { SW_PROP_NMID(UNO_NAME_PAGE_STYLE_NAME), FN_UNO_PAGE_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0}, \ @@ -662,12 +550,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_PARA_AUTO_STYLE_NAME), RES_AUTO_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aAutoParaStyleMap; + aMapEntriesArr[nPropertyId] = aAutoParaStyleMap; } break; case PROPERTY_MAP_CHAR_STYLE : { - static SfxItemPropertyMap aCharStyleMap [] = + static SfxItemPropertyMapEntry aCharStyleMap [] = { { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_KERNING), RES_CHRATR_AUTOKERN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, { SW_PROP_NMID(UNO_NAME_CHAR_BACK_TRANSPARENT), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, @@ -708,13 +596,13 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_RELIEF }, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aCharStyleMap; + aMapEntriesArr[nPropertyId] = aCharStyleMap; } break; case PROPERTY_MAP_CHAR_AUTO_STYLE : { // same as PROPERTY_MAP_TEXTPORTION_EXTENSIONS - static SfxItemPropertyMap aAutoCharStyleMap [] = + static SfxItemPropertyMapEntry aAutoCharStyleMap [] = { { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_KERNING), RES_CHRATR_AUTOKERN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, { SW_PROP_NMID(UNO_NAME_CHAR_BACK_TRANSPARENT), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, @@ -756,44 +644,44 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_STYLE_NAME), RES_TXTATR_AUTOFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aAutoCharStyleMap; + aMapEntriesArr[nPropertyId] = aAutoCharStyleMap; } break; case PROPERTY_MAP_RUBY_AUTO_STYLE : { - static SfxItemPropertyMap aAutoRubyStyleMap [] = + static SfxItemPropertyMapEntry aAutoRubyStyleMap [] = { { SW_PROP_NMID(UNO_NAME_RUBY_ADJUST), RES_TXTATR_CJK_RUBY, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_RUBY_ADJUST }, { SW_PROP_NMID(UNO_NAME_RUBY_IS_ABOVE), RES_TXTATR_CJK_RUBY, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_RUBY_ABOVE }, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aAutoRubyStyleMap; + aMapEntriesArr[nPropertyId] = aAutoRubyStyleMap; } break; case PROPERTY_MAP_PARA_STYLE : { - static SfxItemPropertyMap aParaStyleMap [] = + static SfxItemPropertyMapEntry aParaStyleMap [] = { COMMON_PARA_STYLE_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aParaStyleMap; + aMapEntriesArr[nPropertyId] = aParaStyleMap; } break; case PROPERTY_MAP_CONDITIONAL_PARA_STYLE : { - static SfxItemPropertyMap aParaStyleMap [] = + static SfxItemPropertyMapEntry aParaStyleMap [] = { COMMON_PARA_STYLE_PROPERTIES { SW_PROP_NMID(UNO_NAME_PARA_STYLE_CONDITIONS), FN_UNO_PARA_STYLE_CONDITIONS, CPPU_E2T(CPPUTYPE_SEQNAMEDVALUE), PropertyAttribute::MAYBEVOID, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aParaStyleMap; + aMapEntriesArr[nPropertyId] = aParaStyleMap; } break; case PROPERTY_MAP_FRAME_STYLE: { - static SfxItemPropertyMap aFrameStyleMap [] = + static SfxItemPropertyMapEntry aFrameStyleMap [] = { { SW_PROP_NMID(UNO_NAME_ANCHOR_PAGE_NO), RES_ANCHOR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ANCHOR_PAGENUM }, { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), RES_ANCHOR, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PROPERTY_NONE, MID_ANCHOR_ANCHORTYPE}, @@ -870,12 +758,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 }, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aFrameStyleMap; + aMapEntriesArr[nPropertyId] = aFrameStyleMap; } break; case PROPERTY_MAP_PAGE_STYLE : { - static SfxItemPropertyMap aPageStyleMap [] = + static SfxItemPropertyMapEntry aPageStyleMap [] = { { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR }, // { SW_PROP_NMID(UNO_NAME_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC @@ -991,24 +879,24 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_GRID_STANDARD_PAGE_MODE), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_STANDARD_MODE}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aPageStyleMap; + aMapEntriesArr[nPropertyId] = aPageStyleMap; } break; case PROPERTY_MAP_NUM_STYLE : { - static SfxItemPropertyMap aNumStyleMap [] = + static SfxItemPropertyMapEntry aNumStyleMap [] = { { SW_PROP_NMID(UNO_NAME_NUMBERING_RULES), FN_UNO_NUM_RULES, CPPU_E2T(CPPUTYPE_REFIDXREPL), PROPERTY_NONE, CONVERT_TWIPS}, { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0}, { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aNumStyleMap; + aMapEntriesArr[nPropertyId] = aNumStyleMap; } break; case PROPERTY_MAP_TEXT_TABLE : { - static SfxItemPropertyMap aTablePropertyMap_Impl[] = + static SfxItemPropertyMapEntry aTablePropertyMap_Impl[] = { { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE,MID_BACK_COLOR }, { SW_PROP_NMID(UNO_NAME_BREAK_TYPE), RES_BREAK, CPPU_E2T(CPPUTYPE_BREAK), PROPERTY_NONE, 0}, @@ -1042,6 +930,8 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 }, { SW_PROP_NMID(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 }, + { SW_PROP_NMID(UNO_NAME_TABLE_NAME), FN_UNO_TABLE_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0 }, + { SW_PROP_NMID(UNO_NAME_PAGE_STYLE_NAME), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, // --> collapsing borders DVO, FME 2005-05-27 #i29550# { SW_PROP_NMID(UNO_NAME_COLLAPSING_BORDERS), RES_COLLAPSING_BORDERS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, // <-- collapsing @@ -1049,12 +939,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTablePropertyMap_Impl; + aMapEntriesArr[nPropertyId] = aTablePropertyMap_Impl; } break; case PROPERTY_MAP_TABLE_CELL : { - static SfxItemPropertyMap aCellMap_Impl[] = + static SfxItemPropertyMapEntry aCellMap_Impl[] = { { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_BACK_COLOR }, { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL }, @@ -1081,12 +971,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP _REDLINE_NODE_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aCellMap_Impl; + aMapEntriesArr[nPropertyId] = aCellMap_Impl; } break; case PROPERTY_MAP_TABLE_RANGE: { - static SfxItemPropertyMap aRangePropertyMap_Impl[] = + static SfxItemPropertyMapEntry aRangePropertyMap_Impl[] = { COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN_01 TABSTOPS_MAP_ENTRY @@ -1113,12 +1003,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aRangePropertyMap_Impl; + aMapEntriesArr[nPropertyId] = aRangePropertyMap_Impl; } break; case PROPERTY_MAP_SECTION: { - static SfxItemPropertyMap aSectionPropertyMap_Impl[] = + static SfxItemPropertyMapEntry aSectionPropertyMap_Impl[] = { { SW_PROP_NMID(UNO_NAME_CONDITION), WID_SECT_CONDITION, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0}, { SW_PROP_NMID(UNO_NAME_DDE_COMMAND_FILE), WID_SECT_DDE_TYPE, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0}, @@ -1168,12 +1058,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP /* <- #1097001# */ {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aSectionPropertyMap_Impl; + aMapEntriesArr[nPropertyId] = aSectionPropertyMap_Impl; } break; case PROPERTY_MAP_TEXT_SEARCH: { - static SfxItemPropertyMap aSearchPropertyMap_Impl[] = + static SfxItemPropertyMapEntry aSearchPropertyMap_Impl[] = { { SW_PROP_NMID(UNO_NAME_SEARCH_ALL), WID_SEARCH_ALL, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, { SW_PROP_NMID(UNO_NAME_SEARCH_BACKWARDS), WID_BACKWARDS, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, @@ -1189,12 +1079,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_SEARCH_WORDS), WID_WORDS, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aSearchPropertyMap_Impl; + aMapEntriesArr[nPropertyId] = aSearchPropertyMap_Impl; } break; case PROPERTY_MAP_TEXT_FRAME: { - static SfxItemPropertyMap aFramePropertyMap_Impl[] = + static SfxItemPropertyMapEntry aFramePropertyMap_Impl[] = { COMMON_FRAME_PROPERTIES _REDLINE_NODE_PROPERTIES @@ -1215,12 +1105,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 }, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aFramePropertyMap_Impl; + aMapEntriesArr[nPropertyId] = aFramePropertyMap_Impl; } break; case PROPERTY_MAP_TEXT_GRAPHIC: { - static SfxItemPropertyMap aGraphicPropertyMap_Impl[] = + static SfxItemPropertyMapEntry aGraphicPropertyMap_Impl[] = { COMMON_FRAME_PROPERTIES { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR }, @@ -1249,12 +1139,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_GRAPHIC_COLOR_MODE), RES_GRFATR_DRAWMODE, CPPU_E2T(CPPUTYPE_COLORMODE), 0, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aGraphicPropertyMap_Impl; + aMapEntriesArr[nPropertyId] = aGraphicPropertyMap_Impl; } break; case PROPERTY_MAP_EMBEDDED_OBJECT: { - static SfxItemPropertyMap aEmbeddedPropertyMap_Impl[] = + static SfxItemPropertyMapEntry aEmbeddedPropertyMap_Impl[] = { COMMON_FRAME_PROPERTIES { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR }, @@ -1271,12 +1161,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), FN_UNO_ALTERNATIVE_TEXT,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 }, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aEmbeddedPropertyMap_Impl; + aMapEntriesArr[nPropertyId] = aEmbeddedPropertyMap_Impl; } break; case PROPERTY_MAP_TEXT_SHAPE: { - static SfxItemPropertyMap aShapeMap_Impl[] = + static SfxItemPropertyMapEntry aShapeMap_Impl[] = { { SW_PROP_NMID(UNO_NAME_ANCHOR_PAGE_NO), RES_ANCHOR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_ANCHOR_PAGENUM }, { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), RES_ANCHOR, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_ANCHOR_ANCHORTYPE}, @@ -1329,12 +1219,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP // <-- {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aShapeMap_Impl; + aMapEntriesArr[nPropertyId] = aShapeMap_Impl; } break; case PROPERTY_MAP_INDEX_MARK: { - static SfxItemPropertyMap aIdxMarkMap_Impl[] = + static SfxItemPropertyMapEntry aIdxMarkMap_Impl[] = { { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), WID_ALT_TEXT, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0}, { SW_PROP_NMID(UNO_NAME_PRIMARY_KEY), WID_PRIMARY_KEY, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0}, @@ -1346,24 +1236,24 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_TEXT_CONTENT_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aIdxMarkMap_Impl; + aMapEntriesArr[nPropertyId] = aIdxMarkMap_Impl; } break; case PROPERTY_MAP_CNTIDX_MARK: { - static SfxItemPropertyMap aCntntMarkMap_Impl[] = + static SfxItemPropertyMapEntry aCntntMarkMap_Impl[] = { { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), WID_ALT_TEXT, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0}, { SW_PROP_NMID(UNO_NAME_LEVEL), WID_LEVEL , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0}, COMMON_TEXT_CONTENT_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aCntntMarkMap_Impl; + aMapEntriesArr[nPropertyId] = aCntntMarkMap_Impl; } break; case PROPERTY_MAP_USER_MARK: { - static SfxItemPropertyMap aUserMarkMap_Impl[] = + static SfxItemPropertyMapEntry aUserMarkMap_Impl[] = { { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), WID_ALT_TEXT, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0}, { SW_PROP_NMID(UNO_NAME_LEVEL ), WID_LEVEL , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0}, @@ -1371,12 +1261,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_TEXT_CONTENT_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aUserMarkMap_Impl; + aMapEntriesArr[nPropertyId] = aUserMarkMap_Impl; } break; case PROPERTY_MAP_INDEX_IDX: { - static SfxItemPropertyMap aTOXIndexMap_Impl[] = + static SfxItemPropertyMapEntry aTOXIndexMap_Impl[] = { _BASE_INDEX_PROPERTIES_ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, @@ -1409,12 +1299,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_SORT_ALGORITHM), WID_IDX_SORT_ALGORITHM, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},\ {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTOXIndexMap_Impl; + aMapEntriesArr[nPropertyId] = aTOXIndexMap_Impl; } break; case PROPERTY_MAP_INDEX_CNTNT: { - static SfxItemPropertyMap aTOXContentMap_Impl[] = + static SfxItemPropertyMapEntry aTOXContentMap_Impl[] = { _BASE_INDEX_PROPERTIES_ { SW_PROP_NMID(UNO_NAME_LEVEL), WID_LEVEL , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0}, @@ -1449,12 +1339,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX_MARKS), WID_INDEX_MARKS, CPPU_E2T(CPPUTYPE_DOCIDXMRK), PropertyAttribute::READONLY ,0 }, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTOXContentMap_Impl; + aMapEntriesArr[nPropertyId] = aTOXContentMap_Impl; } break; case PROPERTY_MAP_INDEX_USER: { - static SfxItemPropertyMap aTOXUserMap_Impl[] = + static SfxItemPropertyMapEntry aTOXUserMap_Impl[] = { _BASE_INDEX_PROPERTIES_ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_MARKS), WID_CREATE_FROM_MARKS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, @@ -1491,12 +1381,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_USER_INDEX_NAME), WID_USER_IDX_NAME, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTOXUserMap_Impl; + aMapEntriesArr[nPropertyId] = aTOXUserMap_Impl; } break; case PROPERTY_MAP_INDEX_TABLES: { - static SfxItemPropertyMap aTOXTablesMap_Impl[] = + static SfxItemPropertyMapEntry aTOXTablesMap_Impl[] = { _BASE_INDEX_PROPERTIES_ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, @@ -1516,12 +1406,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTOXTablesMap_Impl; + aMapEntriesArr[nPropertyId] = aTOXTablesMap_Impl; } break; case PROPERTY_MAP_INDEX_OBJECTS: { - static SfxItemPropertyMap aTOXObjectsMap_Impl[] = + static SfxItemPropertyMapEntry aTOXObjectsMap_Impl[] = { _BASE_INDEX_PROPERTIES_ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, @@ -1544,12 +1434,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTOXObjectsMap_Impl; + aMapEntriesArr[nPropertyId] = aTOXObjectsMap_Impl; } break; case PROPERTY_MAP_INDEX_ILLUSTRATIONS: { - static SfxItemPropertyMap aTOXIllustrationsMap_Impl[] = + static SfxItemPropertyMapEntry aTOXIllustrationsMap_Impl[] = { _BASE_INDEX_PROPERTIES_ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, @@ -1570,12 +1460,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTOXIllustrationsMap_Impl; + aMapEntriesArr[nPropertyId] = aTOXIllustrationsMap_Impl; } break; case PROPERTY_MAP_TEXT_TABLE_ROW: { - static SfxItemPropertyMap aTableRowPropertyMap_Impl[] = + static SfxItemPropertyMapEntry aTableRowPropertyMap_Impl[] = { { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR }, { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL }, @@ -1593,13 +1483,13 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = (SfxItemPropertyMap*)aTableRowPropertyMap_Impl; + aMapEntriesArr[nPropertyId] = (SfxItemPropertyMapEntry*)aTableRowPropertyMap_Impl; } break; case PROPERTY_MAP_TEXT_TABLE_CURSOR: { // das PropertySet entspricht dem Range ohne Chart-Properties - static SfxItemPropertyMap aTableCursorPropertyMap_Impl [] = + static SfxItemPropertyMapEntry aTableCursorPropertyMap_Impl [] = { COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN_01 TABSTOPS_MAP_ENTRY @@ -1628,34 +1518,34 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_ORIENT }, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTableCursorPropertyMap_Impl; + aMapEntriesArr[nPropertyId] = aTableCursorPropertyMap_Impl; } break; case PROPERTY_MAP_BOOKMARK: { - static SfxItemPropertyMap aBookmarkPropertyMap_Impl [] = + static SfxItemPropertyMapEntry aBookmarkPropertyMap_Impl [] = { { SW_PROP_NMID(UNO_LINK_DISPLAY_NAME), FN_PARAM_LINK_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0xff}, COMMON_TEXT_CONTENT_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aBookmarkPropertyMap_Impl; + aMapEntriesArr[nPropertyId] = aBookmarkPropertyMap_Impl; } break; case PROPERTY_MAP_PARAGRAPH_EXTENSIONS: { - static SfxItemPropertyMap aParagraphExtensionsMap_Impl[] = + static SfxItemPropertyMapEntry aParagraphExtensionsMap_Impl[] = { COMMON_TEXT_CONTENT_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aParagraphExtensionsMap_Impl; + aMapEntriesArr[nPropertyId] = aParagraphExtensionsMap_Impl; } break; case PROPERTY_MAP_BIBLIOGRAPHY : { - static SfxItemPropertyMap aBibliographyMap_Impl[] = + static SfxItemPropertyMapEntry aBibliographyMap_Impl[] = { _BASE_INDEX_PROPERTIES_ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0}, @@ -1672,12 +1562,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_SORT_ALGORITHM), WID_IDX_SORT_ALGORITHM, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},\ {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aBibliographyMap_Impl; + aMapEntriesArr[nPropertyId] = aBibliographyMap_Impl; } break; case PROPERTY_MAP_TEXT_DOCUMENT: { - static SfxItemPropertyMap aDocMap_Impl[] = + static SfxItemPropertyMapEntry aDocMap_Impl[] = { { SW_PROP_NMID(UNO_NAME_BASIC_LIBRARIES), WID_DOC_BASIC_LIBRARIES, CPPU_E2T(CPPUTYPE_REFLIBCONTAINER), PropertyAttribute::READONLY, 0}, { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME }, @@ -1720,34 +1610,34 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP // <-- {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDocMap_Impl; + aMapEntriesArr[nPropertyId] = aDocMap_Impl; } break; case PROPERTY_MAP_LINK_TARGET: { - static SfxItemPropertyMap aLinkTargetMap_Impl[] = + static SfxItemPropertyMapEntry aLinkTargetMap_Impl[] = { { SW_PROP_NMID(UNO_LINK_DISPLAY_BITMAP), 0, CPPU_E2T(CPPUTYPE_REFBITMAP), PropertyAttribute::READONLY, 0xff}, { SW_PROP_NMID(UNO_LINK_DISPLAY_NAME), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0xff}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aLinkTargetMap_Impl; + aMapEntriesArr[nPropertyId] = aLinkTargetMap_Impl; } break; case PROPERTY_MAP_AUTO_TEXT_GROUP : { - static SfxItemPropertyMap aAutoTextGroupMap_Impl[] = + static SfxItemPropertyMapEntry aAutoTextGroupMap_Impl[] = { { SW_PROP_NMID(UNO_NAME_FILE_PATH), WID_GROUP_PATH, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, PropertyAttribute::READONLY}, { SW_PROP_NMID(UNO_NAME_TITLE), WID_GROUP_TITLE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aAutoTextGroupMap_Impl; + aMapEntriesArr[nPropertyId] = aAutoTextGroupMap_Impl; } break; case PROPERTY_MAP_TEXTPORTION_EXTENSIONS: { - static SfxItemPropertyMap aTextPortionExtensionMap_Impl[] = + static SfxItemPropertyMapEntry aTextPortionExtensionMap_Impl[] = { COMPLETE_TEXT_CURSOR_MAP {SW_PROP_NMID(UNO_NAME_BOOKMARK), FN_UNO_BOOKMARK, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, @@ -1758,24 +1648,24 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {SW_PROP_NMID(UNO_NAME_TEXT_PORTION_TYPE), FN_UNO_TEXT_PORTION_TYPE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTextPortionExtensionMap_Impl; + aMapEntriesArr[nPropertyId] = aTextPortionExtensionMap_Impl; } break; case PROPERTY_MAP_FOOTNOTE: { - static SfxItemPropertyMap aFootnoteMap_Impl[] = + static SfxItemPropertyMapEntry aFootnoteMap_Impl[] = { {SW_PROP_NMID(UNO_NAME_REFERENCE_ID), 0, CPPU_E2T(CPPUTYPE_INT16),PropertyAttribute::READONLY|PropertyAttribute::MAYBEVOID, 0}, COMMON_TEXT_CONTENT_PROPERTIES _REDLINE_NODE_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aFootnoteMap_Impl; + aMapEntriesArr[nPropertyId] = aFootnoteMap_Impl; } break; case PROPERTY_MAP_TEXT_COLUMS : { - static SfxItemPropertyMap aTextColumns_Impl[] = + static SfxItemPropertyMapEntry aTextColumns_Impl[] = { {SW_PROP_NMID(UNO_NAME_IS_AUTOMATIC), WID_TXTCOL_IS_AUTOMATIC, CPPU_E2T(CPPUTYPE_BOOLEAN),PropertyAttribute::READONLY, 0}, {SW_PROP_NMID(UNO_NAME_AUTOMATIC_DISTANCE), WID_TXTCOL_AUTO_DISTANCE, CPPU_E2T(CPPUTYPE_INT32),PROPERTY_NONE, 0}, @@ -1786,12 +1676,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {SW_PROP_NMID(UNO_NAME_SEPARATOR_LINE_IS_ON), WID_TXTCOL_LINE_IS_ON, CPPU_E2T(CPPUTYPE_BOOLEAN),PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTextColumns_Impl; + aMapEntriesArr[nPropertyId] = aTextColumns_Impl; } break; case PROPERTY_MAP_REDLINE : { - static SfxItemPropertyMap aRedlineMap_Impl[] = + static SfxItemPropertyMapEntry aRedlineMap_Impl[] = { _REDLINE_PROPERTIES _REDLINE_NODE_PROPERTIES @@ -1799,12 +1689,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {SW_PROP_NMID(UNO_NAME_REDLINE_END), 0, CPPU_E2T(CPPUTYPE_REFINTERFACE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aRedlineMap_Impl; + aMapEntriesArr[nPropertyId] = aRedlineMap_Impl; } break; case PROPERTY_MAP_TEXT_DEFAULT : { - static SfxItemPropertyMap aTextDefaultMap_Impl[] = + static SfxItemPropertyMapEntry aTextDefaultMap_Impl[] = { { SW_PROP_NMID(UNO_NAME_TAB_STOP_DISTANCE), RES_PARATR_TABSTOP, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_STD_TAB | CONVERT_TWIPS}, COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN @@ -1820,8 +1710,8 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_GRID_STANDARD_PAGE_MODE), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_STANDARD_MODE}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTextDefaultMap_Impl; - for( SfxItemPropertyMap * pMap = aTextDefaultMap_Impl; + aMapEntriesArr[nPropertyId] = aTextDefaultMap_Impl; + for( SfxItemPropertyMapEntry * pMap = aTextDefaultMap_Impl; pMap->pName; ++pMap ) { // UNO_NAME_PAGE_DESC_NAME should keep its MAYBEVOID flag @@ -1832,7 +1722,7 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP break; case PROPERTY_MAP_REDLINE_PORTION : { - static SfxItemPropertyMap aRedlinePortionMap_Impl[] = + static SfxItemPropertyMapEntry aRedlinePortionMap_Impl[] = { COMPLETE_TEXT_CURSOR_MAP {SW_PROP_NMID(UNO_NAME_BOOKMARK), FN_UNO_BOOKMARK, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, @@ -1843,12 +1733,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {SW_PROP_NMID(UNO_NAME_TEXT_PORTION_TYPE), FN_UNO_TEXT_PORTION_TYPE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aRedlinePortionMap_Impl; + aMapEntriesArr[nPropertyId] = aRedlinePortionMap_Impl; } break; case PROPERTY_MAP_FLDTYP_DATETIME: { - static SfxItemPropertyMap aDateTimeFieldPropMap[] = + static SfxItemPropertyMapEntry aDateTimeFieldPropMap[] = { {SW_PROP_NMID(UNO_NAME_ADJUST), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DATE_TIME, CPPU_E2T(CPPUTYPE_DATETIME), PROPERTY_NONE, 0}, @@ -1859,12 +1749,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDateTimeFieldPropMap; + aMapEntriesArr[nPropertyId] = aDateTimeFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_USER : { - static SfxItemPropertyMap aUserFieldPropMap[] = + static SfxItemPropertyMapEntry aUserFieldPropMap[] = { {SW_PROP_NMID(UNO_NAME_IS_SHOW_FORMULA), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_IS_VISIBLE), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, @@ -1874,12 +1764,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aUserFieldPropMap; + aMapEntriesArr[nPropertyId] = aUserFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_SET_EXP : { - static SfxItemPropertyMap aSetExpFieldPropMap [] = + static SfxItemPropertyMapEntry aSetExpFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -1900,12 +1790,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aSetExpFieldPropMap; + aMapEntriesArr[nPropertyId] = aSetExpFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_GET_EXP : { - static SfxItemPropertyMap aGetExpFieldPropMap [] = + static SfxItemPropertyMapEntry aGetExpFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -1918,12 +1808,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aGetExpFieldPropMap; + aMapEntriesArr[nPropertyId] = aGetExpFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_FILE_NAME: { - static SfxItemPropertyMap aFileNameFieldPropMap [] = + static SfxItemPropertyMapEntry aFileNameFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_FILE_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0}, @@ -1931,12 +1821,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aFileNameFieldPropMap; + aMapEntriesArr[nPropertyId] = aFileNameFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_PAGE_NUM : { - static SfxItemPropertyMap aPageNumFieldPropMap [] = + static SfxItemPropertyMapEntry aPageNumFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_OFFSET), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0}, @@ -1945,12 +1835,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aPageNumFieldPropMap; + aMapEntriesArr[nPropertyId] = aPageNumFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_AUTHOR : { - static SfxItemPropertyMap aAuthorFieldPropMap [] = + static SfxItemPropertyMapEntry aAuthorFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -1959,24 +1849,24 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aAuthorFieldPropMap; + aMapEntriesArr[nPropertyId] = aAuthorFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_CHAPTER : { - static SfxItemPropertyMap aChapterFieldPropMap [] = + static SfxItemPropertyMapEntry aChapterFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CHAPTER_FORMAT),FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_LEVEL ),FIELD_PROP_BYTE1, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, 0}, COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aChapterFieldPropMap; + aMapEntriesArr[nPropertyId] = aChapterFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_GET_REFERENCE : { - static SfxItemPropertyMap aGetRefFieldPropMap [] = + static SfxItemPropertyMapEntry aGetRefFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_REFERENCE_FIELD_PART),FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0}, @@ -1986,12 +1876,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aGetRefFieldPropMap; + aMapEntriesArr[nPropertyId] = aGetRefFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_CONDITIONED_TEXT : { - static SfxItemPropertyMap aConditionedTxtFieldPropMap [] = + static SfxItemPropertyMapEntry aConditionedTxtFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CONDITION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_FALSE_CONTENT), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2001,12 +1891,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aConditionedTxtFieldPropMap; + aMapEntriesArr[nPropertyId] = aConditionedTxtFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_HIDDEN_TEXT : { - static SfxItemPropertyMap aHiddenTxtFieldPropMap [] = + static SfxItemPropertyMapEntry aHiddenTxtFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CONDITION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_CONTENT) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2015,12 +1905,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aHiddenTxtFieldPropMap; + aMapEntriesArr[nPropertyId] = aHiddenTxtFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_ANNOTATION : { - static SfxItemPropertyMap aAnnotationFieldPropMap [] = + static SfxItemPropertyMapEntry aAnnotationFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_AUTHOR), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2030,12 +1920,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aAnnotationFieldPropMap; + aMapEntriesArr[nPropertyId] = aAnnotationFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_INPUT: { - static SfxItemPropertyMap aInputFieldPropMap [] = + static SfxItemPropertyMapEntry aInputFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_HINT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2044,12 +1934,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aInputFieldPropMap; + aMapEntriesArr[nPropertyId] = aInputFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_MACRO : { - static SfxItemPropertyMap aMacroFieldPropMap [] = + static SfxItemPropertyMapEntry aMacroFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_HINT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_MACRO_NAME),FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2058,22 +1948,22 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aMacroFieldPropMap; + aMapEntriesArr[nPropertyId] = aMacroFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_DDE : { - static SfxItemPropertyMap aDDEFieldPropMap [] = + static SfxItemPropertyMapEntry aDDEFieldPropMap [] = { COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDDEFieldPropMap; + aMapEntriesArr[nPropertyId] = aDDEFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_DROPDOWN : { - static SfxItemPropertyMap aDropDownMap [] = + static SfxItemPropertyMapEntry aDropDownMap [] = { {SW_PROP_NMID(UNO_NAME_ITEMS), FIELD_PROP_STRINGS, CPPU_E2T(CPPUTYPE_OUSTRINGS), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_SELITEM), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2083,24 +1973,24 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDropDownMap; + aMapEntriesArr[nPropertyId] = aDropDownMap; } break; case PROPERTY_MAP_FLDTYP_HIDDEN_PARA : { - static SfxItemPropertyMap aHiddenParaFieldPropMap [] = + static SfxItemPropertyMapEntry aHiddenParaFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CONDITION),FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_IS_HIDDEN) , FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aHiddenParaFieldPropMap; + aMapEntriesArr[nPropertyId] = aHiddenParaFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_DOC_INFO : { - static SfxItemPropertyMap aDocInfoFieldPropMap [] = + static SfxItemPropertyMapEntry aDocInfoFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_INFO_FORMAT), FIELD_PROP_USHORT2, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0}, @@ -2108,23 +1998,23 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDocInfoFieldPropMap; + aMapEntriesArr[nPropertyId] = aDocInfoFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_TEMPLATE_NAME : { - static SfxItemPropertyMap aTmplNameFieldPropMap [] = + static SfxItemPropertyMapEntry aTmplNameFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_FILE_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0}, COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTmplNameFieldPropMap; + aMapEntriesArr[nPropertyId] = aTmplNameFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_USER_EXT : { - static SfxItemPropertyMap aUsrExtFieldPropMap [] = + static SfxItemPropertyMapEntry aUsrExtFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2133,36 +2023,36 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId]= aUsrExtFieldPropMap; + aMapEntriesArr[nPropertyId]= aUsrExtFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_REF_PAGE_SET : { - static SfxItemPropertyMap aRefPgSetFieldPropMap [] = + static SfxItemPropertyMapEntry aRefPgSetFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_OFFSET), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_ON), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aRefPgSetFieldPropMap; + aMapEntriesArr[nPropertyId] = aRefPgSetFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_REF_PAGE_GET : { - static SfxItemPropertyMap aRefPgGetFieldPropMap [] = + static SfxItemPropertyMapEntry aRefPgGetFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0}, COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aRefPgGetFieldPropMap; + aMapEntriesArr[nPropertyId] = aRefPgGetFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_JUMP_EDIT : { - static SfxItemPropertyMap aJumpEdtFieldPropMap [] = + static SfxItemPropertyMapEntry aJumpEdtFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_HINT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_PLACEHOLDER), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2170,12 +2060,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aJumpEdtFieldPropMap; + aMapEntriesArr[nPropertyId] = aJumpEdtFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_SCRIPT : { - static SfxItemPropertyMap aScriptFieldPropMap [] = + static SfxItemPropertyMapEntry aScriptFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_SCRIPT_TYPE), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2183,12 +2073,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aScriptFieldPropMap; + aMapEntriesArr[nPropertyId] = aScriptFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET : { - static SfxItemPropertyMap aDBNextSetFieldPropMap [] = + static SfxItemPropertyMapEntry aDBNextSetFieldPropMap [] = { // Note: DATA_BASE_NAME and DATA_BASE_URL // are mapped to the same nMId, because internally we only use @@ -2202,12 +2092,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDBNextSetFieldPropMap; + aMapEntriesArr[nPropertyId] = aDBNextSetFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_DATABASE_NUM_SET : { - static SfxItemPropertyMap aDBNumSetFieldPropMap [] = + static SfxItemPropertyMapEntry aDBNumSetFieldPropMap [] = { // Note: DATA_BASE_NAME and DATA_BASE_URL // are mapped to the same nMId, because internally we only use @@ -2222,12 +2112,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDBNumSetFieldPropMap; + aMapEntriesArr[nPropertyId] = aDBNumSetFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_DATABASE_SET_NUM : { - static SfxItemPropertyMap aDBSetNumFieldPropMap [] = + static SfxItemPropertyMapEntry aDBSetNumFieldPropMap [] = { // Note: DATA_BASE_NAME and DATA_BASE_URL // are mapped to the same nMId, because internally we only use @@ -2243,12 +2133,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDBSetNumFieldPropMap; + aMapEntriesArr[nPropertyId] = aDBSetNumFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_DATABASE : { - static SfxItemPropertyMap aDBFieldPropMap [] = + static SfxItemPropertyMapEntry aDBFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2259,12 +2149,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDBFieldPropMap; + aMapEntriesArr[nPropertyId] = aDBFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_DATABASE_NAME : { - static SfxItemPropertyMap aDBNameFieldPropMap [] = + static SfxItemPropertyMapEntry aDBNameFieldPropMap [] = { // Note: DATA_BASE_NAME and DATA_BASE_URL // are mapped to the same nMId, because internally we only use @@ -2278,24 +2168,24 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDBNameFieldPropMap; + aMapEntriesArr[nPropertyId] = aDBNameFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_DOCSTAT: { - static SfxItemPropertyMap aDocstatFieldPropMap [] = + static SfxItemPropertyMapEntry aDocstatFieldPropMap [] = { {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_USHORT2, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0}, // {UNO_NAME_STATISTIC_TYPE_ID,FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0}, COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDocstatFieldPropMap; + aMapEntriesArr[nPropertyId] = aDocstatFieldPropMap; } break; case PROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR: { - static SfxItemPropertyMap aDocInfoAuthorPropMap [] = + static SfxItemPropertyMapEntry aDocInfoAuthorPropMap [] = { {SW_PROP_NMID(UNO_NAME_AUTHOR), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2303,12 +2193,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDocInfoAuthorPropMap; + aMapEntriesArr[nPropertyId] = aDocInfoAuthorPropMap; } break; case PROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME: { - static SfxItemPropertyMap aDocInfoDateTimePropMap [] = + static SfxItemPropertyMapEntry aDocInfoDateTimePropMap [] = { {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DOUBLE, CPPU_E2T(CPPUTYPE_DOUBLE), PropertyAttribute::READONLY, 0}, @@ -2318,12 +2208,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDocInfoDateTimePropMap; + aMapEntriesArr[nPropertyId] = aDocInfoDateTimePropMap; } break; case PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME : { - static SfxItemPropertyMap aDocInfoEditTimePropMap [] = + static SfxItemPropertyMapEntry aDocInfoEditTimePropMap [] = { {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DOUBLE, CPPU_E2T(CPPUTYPE_DOUBLE), PropertyAttribute::READONLY, 0}, @@ -2333,12 +2223,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDocInfoEditTimePropMap; + aMapEntriesArr[nPropertyId] = aDocInfoEditTimePropMap; } break; case PROPERTY_MAP_FLDTYP_DOCINFO_MISC: { - static SfxItemPropertyMap aDocInfoStringContentPropMap [] = + static SfxItemPropertyMapEntry aDocInfoStringContentPropMap [] = { {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2346,12 +2236,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDocInfoStringContentPropMap; + aMapEntriesArr[nPropertyId] = aDocInfoStringContentPropMap; } break; case PROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM: { - static SfxItemPropertyMap aDocInfoCustomPropMap [] = + static SfxItemPropertyMapEntry aDocInfoCustomPropMap [] = { {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}, @@ -2359,12 +2249,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDocInfoCustomPropMap; + aMapEntriesArr[nPropertyId] = aDocInfoCustomPropMap; } break; case PROPERTY_MAP_FLDTYP_DOCINFO_REVISION : { - static SfxItemPropertyMap aDocInfoRevisionPropMap [] = + static SfxItemPropertyMapEntry aDocInfoRevisionPropMap [] = { {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_REVISION), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0}, @@ -2372,23 +2262,23 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDocInfoRevisionPropMap; + aMapEntriesArr[nPropertyId] = aDocInfoRevisionPropMap; } break; case PROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS: { - static SfxItemPropertyMap aCombinedCharactersPropMap[] = + static SfxItemPropertyMapEntry aCombinedCharactersPropMap[] = { {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aCombinedCharactersPropMap; + aMapEntriesArr[nPropertyId] = aCombinedCharactersPropMap; } break; case PROPERTY_MAP_FLDTYP_TABLE_FORMULA: { - static SfxItemPropertyMap aTableFormulaPropMap[] = + static SfxItemPropertyMapEntry aTableFormulaPropMap[] = { {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2397,22 +2287,22 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTableFormulaPropMap; + aMapEntriesArr[nPropertyId] = aTableFormulaPropMap; } break; case PROPERTY_MAP_FLDTYP_DUMMY_0: { - static SfxItemPropertyMap aEmptyPropMap [] = + static SfxItemPropertyMapEntry aEmptyPropMap [] = { COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aEmptyPropMap; + aMapEntriesArr[nPropertyId] = aEmptyPropMap; } break; case PROPERTY_MAP_FLDMSTR_USER : { - static SfxItemPropertyMap aUserFieldTypePropMap[] = + static SfxItemPropertyMapEntry aUserFieldTypePropMap[] = { {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0}, {SW_PROP_NMID(UNO_NAME_IS_EXPRESSION), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, @@ -2422,12 +2312,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aUserFieldTypePropMap; + aMapEntriesArr[nPropertyId] = aUserFieldTypePropMap; } break; case PROPERTY_MAP_FLDMSTR_DDE : { - static SfxItemPropertyMap aDDEFieldTypePropMap[] = + static SfxItemPropertyMapEntry aDDEFieldTypePropMap[] = { {SW_PROP_NMID(UNO_NAME_DDE_COMMAND_ELEMENT ), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_DDE_COMMAND_FILE ), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2439,12 +2329,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR5, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDDEFieldTypePropMap; + aMapEntriesArr[nPropertyId] = aDDEFieldTypePropMap; } break; case PROPERTY_MAP_FLDMSTR_SET_EXP : { - static SfxItemPropertyMap aSetExpFieldTypePropMap[] = + static SfxItemPropertyMapEntry aSetExpFieldTypePropMap[] = { {SW_PROP_NMID(UNO_NAME_CHAPTER_NUMBERING_LEVEL),FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0}, @@ -2454,12 +2344,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aSetExpFieldTypePropMap; + aMapEntriesArr[nPropertyId] = aSetExpFieldTypePropMap; } break; case PROPERTY_MAP_FLDMSTR_DATABASE : { - static SfxItemPropertyMap aDBFieldTypePropMap [] = + static SfxItemPropertyMapEntry aDBFieldTypePropMap [] = { // Note: DATA_BASE_NAME and DATA_BASE_URL // are mapped to the same nMId, because internally we only use @@ -2475,35 +2365,35 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aDBFieldTypePropMap; + aMapEntriesArr[nPropertyId] = aDBFieldTypePropMap; } break; case PROPERTY_MAP_FLDMSTR_DUMMY0 : { - static SfxItemPropertyMap aStandardFieldMasterMap[] = + static SfxItemPropertyMapEntry aStandardFieldMasterMap[] = { {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), 0, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0}, {SW_PROP_NMID(UNO_NAME_NAME), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aStandardFieldMasterMap; + aMapEntriesArr[nPropertyId] = aStandardFieldMasterMap; } break; case PROPERTY_MAP_FLDTYP_BIBLIOGRAPHY: { - static SfxItemPropertyMap aBibliographyFieldMap[] = + static SfxItemPropertyMapEntry aBibliographyFieldMap[] = { {SW_PROP_NMID(UNO_NAME_FIELDS ) , FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_PROPERTYVALUE),PROPERTY_NONE, 0}, COMMON_FLDTYP_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aBibliographyFieldMap; + aMapEntriesArr[nPropertyId] = aBibliographyFieldMap; } break; case PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY: { - static SfxItemPropertyMap aBibliographyFieldMasterMap[] = + static SfxItemPropertyMapEntry aBibliographyFieldMasterMap[] = { {SW_PROP_NMID(UNO_NAME_BRACKET_BEFORE ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {SW_PROP_NMID(UNO_NAME_BRACKET_AFTER ) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, @@ -2515,22 +2405,22 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aBibliographyFieldMasterMap; + aMapEntriesArr[nPropertyId] = aBibliographyFieldMasterMap; } break; case PROPERTY_MAP_TEXT : { - static SfxItemPropertyMap aTextMap[] = + static SfxItemPropertyMapEntry aTextMap[] = { _REDLINE_NODE_PROPERTIES {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aTextMap; + aMapEntriesArr[nPropertyId] = aTextMap; } break; case PROPERTY_MAP_MAILMERGE : { - static SfxItemPropertyMap aMailMergeMap[] = + static SfxItemPropertyMapEntry aMailMergeMap[] = { { SW_PROP_NMID(UNO_NAME_SELECTION), WID_SELECTION, CPPU_E2T(CPPUTYPE_SEQANY), PROPERTY_NONE, 0}, { SW_PROP_NMID(UNO_NAME_RESULT_SET), WID_RESULT_SET, CPPU_E2T(CPPUTYPE_REFRESULTSET), PROPERTY_NONE, 0}, @@ -2565,12 +2455,12 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP { SW_PROP_NMID(UNO_NAME_OUT_SERVER_PASSWORD), WID_OUT_SERVER_PASSWORD, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aMailMergeMap; + aMapEntriesArr[nPropertyId] = aMailMergeMap; } break; case PROPERTY_MAP_TEXT_VIEW : { - static SfxItemPropertyMap pTextViewMap[] = + static SfxItemPropertyMapEntry pTextViewMap[] = { {SW_PROP_NMID(UNO_NAME_PAGE_COUNT), WID_PAGE_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0}, {SW_PROP_NMID(UNO_NAME_LINE_COUNT), WID_LINE_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0}, @@ -2578,27 +2468,631 @@ const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nP {SW_PROP_NMID(UNO_NAME_IS_HIDE_SPELL_MARKS), WID_IS_HIDE_SPELL_MARKS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, // deprecated #i91949 {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = pTextViewMap; + aMapEntriesArr[nPropertyId] = pTextViewMap; } break; case PROPERTY_MAP_CHART2_DATA_SEQUENCE : { - static SfxItemPropertyMap aChart2DataSequenceMap[] = + static SfxItemPropertyMapEntry aChart2DataSequenceMap[] = { {SW_PROP_NMID(UNO_NAME_ROLE), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0 }, {0,0,0,0,0,0} }; - aMapArr[nPropertyId] = aChart2DataSequenceMap; + aMapEntriesArr[nPropertyId] = aChart2DataSequenceMap; } break; default: DBG_ERROR( "unexpected property map ID" ); } - Sort(nPropertyId); + //fill the character pointers and types into the arrays + SfxItemPropertyMapEntry* p = aMapEntriesArr[nPropertyId]; + sal_uInt16 i = 0; + for( ; p->pName; ++p, ++i ) + { + // set the name + const SwPropNameLen& rPropNm = GetPropName( (USHORT)(long)p->pName ); + p->pName = rPropNm.pName; + p->nNameLen = rPropNm.nNameLen; + // get the cppu type from the comphelper + CppuTypes nTyp = (CppuTypes) (long) p->pType; + GenerateCppuType( nTyp, p->pType ); + DBG_ASSERT( nTyp != (CppuTypes) (long) p->pType, "unknown type" ); + } + } + return aMapEntriesArr[nPropertyId]; +} +/*-- 17.02.2009 15:29:58--------------------------------------------------- + + -----------------------------------------------------------------------*/ +const SfxItemPropertySet* SwUnoPropertyMapProvider::GetPropertySet( sal_uInt16 nPropertyId) +{ + if( !aPropertySetArr[nPropertyId] ) + { + const SfxItemPropertyMapEntry* pEntries = GetPropertyMapEntries(nPropertyId); + switch( nPropertyId ) + { + case PROPERTY_MAP_TEXT_CURSOR: + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_CURSOR(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_CURSOR; + } + break; + case PROPERTY_MAP_CHAR_STYLE: + { + static SfxItemPropertySet aPROPERTY_MAP_CHAR_STYLE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_CHAR_STYLE; + } + break; + case PROPERTY_MAP_PARA_STYLE: + { + static SfxItemPropertySet aPROPERTY_MAP_PARA_STYLE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_PARA_STYLE; + } + break; + case PROPERTY_MAP_FRAME_STYLE: + { + static SfxItemPropertySet aPROPERTY_MAP_FRAME_STYLE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FRAME_STYLE; + } + break; + case PROPERTY_MAP_PAGE_STYLE: + { + static SfxItemPropertySet aPROPERTY_MAP_PAGE_STYLE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_PAGE_STYLE; + } + break; + case PROPERTY_MAP_NUM_STYLE: + { + static SfxItemPropertySet aPROPERTY_MAP_NUM_STYLE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_NUM_STYLE; + } + break; + case PROPERTY_MAP_SECTION: + { + static SfxItemPropertySet aPROPERTY_MAP_SECTION(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_SECTION; + } + break; + case PROPERTY_MAP_TEXT_TABLE: + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_TABLE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_TABLE; + } + break; + case PROPERTY_MAP_TABLE_CELL: + { + static SfxItemPropertySet aPROPERTY_MAP_TABLE_CELL(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TABLE_CELL; + } + break; + case PROPERTY_MAP_TABLE_RANGE: + { + static SfxItemPropertySet aPROPERTY_MAP_TABLE_RANGE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TABLE_RANGE; + } + break; + case PROPERTY_MAP_TEXT_SEARCH: + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_SEARCH(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_SEARCH; + } + break; + case PROPERTY_MAP_TEXT_FRAME: + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_FRAME(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_FRAME; + } + break; + case PROPERTY_MAP_TEXT_GRAPHIC: + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_GRAPHIC(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_GRAPHIC; + } + break; + case PROPERTY_MAP_TEXT_SHAPE: + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_SHAPE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_SHAPE; + } + break; + case PROPERTY_MAP_INDEX_USER: + { + static SfxItemPropertySet aPROPERTY_MAP_INDEX_USER(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_USER; + } + break; + case PROPERTY_MAP_INDEX_CNTNT: + { + static SfxItemPropertySet aPROPERTY_MAP_INDEX_CNTNT(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_CNTNT; + } + break; + case PROPERTY_MAP_INDEX_IDX: + { + static SfxItemPropertySet aPROPERTY_MAP_INDEX_IDX(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_IDX; + } + break; + case PROPERTY_MAP_USER_MARK: + { + static SfxItemPropertySet aPROPERTY_MAP_USER_MARK(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_USER_MARK; + } + break; + case PROPERTY_MAP_CNTIDX_MARK: + { + static SfxItemPropertySet aPROPERTY_MAP_CNTIDX_MARK(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_CNTIDX_MARK; + } + break; + case PROPERTY_MAP_INDEX_MARK: + { + static SfxItemPropertySet aPROPERTY_MAP_INDEX_MARK(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_MARK; + } + break; + case PROPERTY_MAP_TEXT_TABLE_ROW: + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_TABLE_ROW(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_TABLE_ROW; + } + break; + case PROPERTY_MAP_TEXT_SHAPE_DESCRIPTOR: + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_SHAPE_DESCRIPTOR(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_SHAPE_DESCRIPTOR; + } + break; + case PROPERTY_MAP_TEXT_TABLE_CURSOR: + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_TABLE_CURSOR(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_TABLE_CURSOR; + } + break; + case PROPERTY_MAP_BOOKMARK: + { + static SfxItemPropertySet aPROPERTY_MAP_BOOKMARK(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_BOOKMARK; + } + break; + case PROPERTY_MAP_PARAGRAPH_EXTENSIONS: + { + static SfxItemPropertySet aPROPERTY_MAP_PARAGRAPH_EXTENSIONS(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_PARAGRAPH_EXTENSIONS; + } + break; + case PROPERTY_MAP_INDEX_ILLUSTRATIONS: + { + static SfxItemPropertySet aPROPERTY_MAP_INDEX_ILLUSTRATIONS(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_ILLUSTRATIONS; + } + break; + case PROPERTY_MAP_INDEX_OBJECTS: + { + static SfxItemPropertySet aPROPERTY_MAP_INDEX_OBJECTS(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_OBJECTS; + } + break; + case PROPERTY_MAP_INDEX_TABLES: + { + static SfxItemPropertySet aPROPERTY_MAP_INDEX_TABLES(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_INDEX_TABLES; + } + break; + case PROPERTY_MAP_BIBLIOGRAPHY : + { + static SfxItemPropertySet aPROPERTY_MAP_BIBLIOGRAPHY(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_BIBLIOGRAPHY; + } + break; + case PROPERTY_MAP_TEXT_DOCUMENT: + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_DOCUMENT(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_DOCUMENT; + } + break; + case PROPERTY_MAP_LINK_TARGET : + { + static SfxItemPropertySet aPROPERTY_MAP_LINK_TARGET(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_LINK_TARGET; + } + break; + case PROPERTY_MAP_AUTO_TEXT_GROUP : + { + static SfxItemPropertySet aPROPERTY_MAP_AUTO_TEXT_GROUP(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_AUTO_TEXT_GROUP; + } + break; + case PROPERTY_MAP_TEXTPORTION_EXTENSIONS : + { + static SfxItemPropertySet aPROPERTY_MAP_TEXTPORTION_EXTENSIONS(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXTPORTION_EXTENSIONS; + } + break; + case PROPERTY_MAP_FOOTNOTE : + { + static SfxItemPropertySet aPROPERTY_MAP_FOOTNOTE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FOOTNOTE; + } + break; + case PROPERTY_MAP_TEXT_COLUMS : + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_COLUMS(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_COLUMS; + } + break; + case PROPERTY_MAP_PARAGRAPH : + { + static SfxItemPropertySet aPROPERTY_MAP_PARAGRAPH(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_PARAGRAPH; + } + break; + case PROPERTY_MAP_EMBEDDED_OBJECT : + { + static SfxItemPropertySet aPROPERTY_MAP_EMBEDDED_OBJECT(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_EMBEDDED_OBJECT; + } + break; + case PROPERTY_MAP_REDLINE : + { + static SfxItemPropertySet aPROPERTY_MAP_REDLINE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_REDLINE; + } + break; + case PROPERTY_MAP_TEXT_DEFAULT : + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_DEFAULT(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_DEFAULT; + } + break; + case PROPERTY_MAP_FLDTYP_DATETIME: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DATETIME(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DATETIME; + } + break; + case PROPERTY_MAP_FLDTYP_USER: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_USER(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_USER; + } + break; + case PROPERTY_MAP_FLDTYP_SET_EXP: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_SET_EXP(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_SET_EXP; + } + break; + case PROPERTY_MAP_FLDTYP_GET_EXP: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_GET_EXP(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_GET_EXP; + } + break; + case PROPERTY_MAP_FLDTYP_FILE_NAME: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_FILE_NAME(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_FILE_NAME; + } + break; + case PROPERTY_MAP_FLDTYP_PAGE_NUM: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_PAGE_NUM(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_PAGE_NUM; + } + break; + case PROPERTY_MAP_FLDTYP_AUTHOR: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_AUTHOR(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_AUTHOR; + } + break; + case PROPERTY_MAP_FLDTYP_CHAPTER: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_CHAPTER(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_CHAPTER; + } + break; + case PROPERTY_MAP_FLDTYP_GET_REFERENCE: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_GET_REFERENCE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_GET_REFERENCE; + } + break; + case PROPERTY_MAP_FLDTYP_CONDITIONED_TEXT: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_CONDITIONED_TEXT(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_CONDITIONED_TEXT; + } + break; + case PROPERTY_MAP_FLDTYP_HIDDEN_TEXT: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_HIDDEN_TEXT(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_HIDDEN_TEXT; + } + break; + case PROPERTY_MAP_FLDTYP_ANNOTATION : + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_ANNOTATION(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_ANNOTATION; + } + break; + case PROPERTY_MAP_FLDTYP_INPUT: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_INPUT(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_INPUT; + } + break; + case PROPERTY_MAP_FLDTYP_MACRO: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_MACRO(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_MACRO; + } + break; + case PROPERTY_MAP_FLDTYP_DDE: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DDE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DDE; + } + break; + case PROPERTY_MAP_FLDTYP_HIDDEN_PARA: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_HIDDEN_PARA(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_HIDDEN_PARA; + } + break; + case PROPERTY_MAP_FLDTYP_DOC_INFO : + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOC_INFO(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOC_INFO; + } + break; + case PROPERTY_MAP_FLDTYP_TEMPLATE_NAME: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_TEMPLATE_NAME(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_TEMPLATE_NAME; + } + break; + case PROPERTY_MAP_FLDTYP_USER_EXT : + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_USER_EXT(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_USER_EXT; + } + break; + case PROPERTY_MAP_FLDTYP_REF_PAGE_SET: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_REF_PAGE_SET(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_REF_PAGE_SET; + } + break; + case PROPERTY_MAP_FLDTYP_REF_PAGE_GET: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_REF_PAGE_GET(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_REF_PAGE_GET; + } + break; + case PROPERTY_MAP_FLDTYP_JUMP_EDIT: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_JUMP_EDIT(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_JUMP_EDIT; + } + break; + case PROPERTY_MAP_FLDTYP_SCRIPT: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_SCRIPT(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_SCRIPT; + } + break; + case PROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET; + } + break; + case PROPERTY_MAP_FLDTYP_DATABASE_NUM_SET: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DATABASE_NUM_SET(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DATABASE_NUM_SET; + } + break; + case PROPERTY_MAP_FLDTYP_DATABASE_SET_NUM: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DATABASE_SET_NUM(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DATABASE_SET_NUM; + } + break; + case PROPERTY_MAP_FLDTYP_DATABASE: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DATABASE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DATABASE; + } + break; + case PROPERTY_MAP_FLDTYP_DATABASE_NAME: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DATABASE_NAME(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DATABASE_NAME; + } + break; + case PROPERTY_MAP_FLDTYP_DOCSTAT: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCSTAT(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCSTAT; + } + break; + case PROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR; + } + break; + case PROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME; + } + break; + case PROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_DATE_TIME: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_DATE_TIME(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_DATE_TIME; + } + break; + case PROPERTY_MAP_FLDTYP_DOCINFO_CREATE_DATE_TIME: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_CREATE_DATE_TIME(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_CREATE_DATE_TIME; + } + break; + case PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME; + } + break; + case PROPERTY_MAP_FLDTYP_DOCINFO_MISC : + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_MISC(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_MISC; + } + break; + case PROPERTY_MAP_FLDTYP_DOCINFO_REVISION: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_REVISION(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_REVISION; + } + break; + case PROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS; + } + break; + case PROPERTY_MAP_FLDTYP_DUMMY_0: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DUMMY_0(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DUMMY_0; + } + break; + case PROPERTY_MAP_FLDTYP_TABLE_FORMULA: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_TABLE_FORMULA(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_TABLE_FORMULA; + } + break; + case PROPERTY_MAP_FLDMSTR_USER: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDMSTR_USER(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDMSTR_USER; + } + break; + case PROPERTY_MAP_FLDMSTR_DDE: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDMSTR_DDE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDMSTR_DDE; + } + break; + case PROPERTY_MAP_FLDMSTR_SET_EXP: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDMSTR_SET_EXP(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDMSTR_SET_EXP; + } + break; + case PROPERTY_MAP_FLDMSTR_DATABASE: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDMSTR_DATABASE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDMSTR_DATABASE; + } + break; + case PROPERTY_MAP_FLDMSTR_DUMMY0: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDMSTR_DUMMY0(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDMSTR_DUMMY0; + } + break; + case PROPERTY_MAP_FLDTYP_BIBLIOGRAPHY: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_BIBLIOGRAPHY(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_BIBLIOGRAPHY; + } + break; + case PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY; + } + break; + case PROPERTY_MAP_TEXT: + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT; + } + break; + case PROPERTY_MAP_REDLINE_PORTION: + { + static SfxItemPropertySet aPROPERTY_MAP_REDLINE_PORTION(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_REDLINE_PORTION; + } + break; + case PROPERTY_MAP_MAILMERGE: + { + static SfxItemPropertySet aPROPERTY_MAP_MAILMERGE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_MAILMERGE; + } + break; + case PROPERTY_MAP_FLDTYP_DROPDOWN: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DROPDOWN(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DROPDOWN; + } + break; + case PROPERTY_MAP_CHART2_DATA_SEQUENCE: + { + static SfxItemPropertySet aPROPERTY_MAP_CHART2_DATA_SEQUENCE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_CHART2_DATA_SEQUENCE; + } + break; + case PROPERTY_MAP_TEXT_VIEW: + { + static SfxItemPropertySet aPROPERTY_MAP_TEXT_VIEW(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TEXT_VIEW; + } + break; + case PROPERTY_MAP_CONDITIONAL_PARA_STYLE: + { + static SfxItemPropertySet aPROPERTY_MAP_CONDITIONAL_PARA_STYLE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_CONDITIONAL_PARA_STYLE; + } + break; + case PROPERTY_MAP_CHAR_AUTO_STYLE: + { + static SfxItemPropertySet aPROPERTY_MAP_CHAR_AUTO_STYLE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_CHAR_AUTO_STYLE; + } + break; + case PROPERTY_MAP_RUBY_AUTO_STYLE: + { + static SfxItemPropertySet aPROPERTY_MAP_RUBY_AUTO_STYLE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_RUBY_AUTO_STYLE; + } + break; + case PROPERTY_MAP_PARA_AUTO_STYLE: + { + static SfxItemPropertySet aPROPERTY_MAP_PARA_AUTO_STYLE(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_PARA_AUTO_STYLE; + } + break; + case PROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM: + { + static SfxItemPropertySet aPROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM(pEntries); + aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM; + } + break; + } } - return aMapArr[nPropertyId]; + return aPropertySetArr[nPropertyId]; } + /* -----------------04.07.98 11:42------------------- * * --------------------------------------------------*/ @@ -2612,3 +3106,4 @@ sal_Bool SwItemPropertySet::FillItem(SfxItemSet& /*rSet*/, sal_uInt16 /*nWhich*/ }*/ return bRet; } + diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 7a8a5ace32b1..00b907ad0674 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -38,7 +38,7 @@ #include <hintids.hxx> #include <cmdid.h> #include <hints.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <frmfmt.hxx> #include <doc.hxx> #include <istyleaccess.hxx> @@ -492,18 +492,18 @@ void lcl_SetNodeNumStart( SwPaM& rCrsr, uno::Any aValue ) /* -----------------17.09.98 09:44------------------- * * --------------------------------------------------*/ -sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertyMap* pMap, +sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertySimpleEntry* pEntry, SwPaM& rPam, SfxItemSet& rItemSet, const uno::Any& aValue ) throw (lang::IllegalArgumentException) { sal_Bool bRet = sal_True; - if(0 ==(pMap->nFlags&PropertyAttribute::MAYBEVOID) && + if(0 == ( pEntry->nFlags&PropertyAttribute::MAYBEVOID ) && aValue.getValueType() == ::getCppuVoidType()) bRet = sal_False; else { - switch(pMap->nWID) + switch(pEntry->nWID) { case RES_TXTATR_CHARFMT: lcl_setCharStyle(rPam.GetDoc(), aValue, rItemSet ); @@ -554,8 +554,8 @@ sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertyMap* pMap, SwTxtNode* pTxtNd = rPam.GetNode()->GetTxtNode(); // --> OD 2008-05-14 #refactorlists# - check on list style not needed // const SwNumRule* pRule = pTxtNd->GetNumRule(); -// if( FN_UNO_NUM_LEVEL == pMap->nWID && pRule != NULL ) - if ( FN_UNO_NUM_LEVEL == pMap->nWID ) +// if( FN_UNO_NUM_LEVEL == pEntry->nWID && pRule != NULL ) + if ( FN_UNO_NUM_LEVEL == pEntry->nWID ) // <-- { sal_Int16 nLevel = 0; @@ -565,14 +565,14 @@ sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertyMap* pMap, } // --> OD 2008-07-14 #i91601# - else if( FN_UNO_LIST_ID == pMap->nWID ) + else if( FN_UNO_LIST_ID == pEntry->nWID ) { ::rtl::OUString sListId; aValue >>= sListId; pTxtNd->SetListId( sListId ); } // <-- - else if( FN_UNO_IS_NUMBER == pMap->nWID ) + else if( FN_UNO_IS_NUMBER == pEntry->nWID ) { BOOL bIsNumber = *(sal_Bool*) aValue.getValue(); if(!bIsNumber) @@ -595,7 +595,7 @@ sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertyMap* pMap, break; case RES_PARATR_DROP: { - if( MID_DROPCAP_CHAR_STYLE_NAME == pMap->nMemberId) + if( MID_DROPCAP_CHAR_STYLE_NAME == pEntry->nMemberId) { OUString uStyle; if(aValue >>= uStyle) @@ -631,7 +631,7 @@ sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertyMap* pMap, } break; case RES_TXTATR_CJK_RUBY: - if(MID_RUBY_CHARSTYLE == pMap->nMemberId ) + if(MID_RUBY_CHARSTYLE == pEntry->nMemberId ) { OUString sTmp; if(aValue >>= sTmp) @@ -662,7 +662,7 @@ sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertyMap* pMap, bRet = sal_False; break; case RES_PAGEDESC : - if(MID_PAGEDESC_PAGEDESCNAME == pMap->nMemberId ) + if(MID_PAGEDESC_PAGEDESCNAME == pEntry->nMemberId ) { lcl_setPageDesc(rPam.GetDoc(), aValue, rItemSet); break; @@ -815,7 +815,7 @@ Sequence< OUString > SwXTextCursor::getSupportedServiceNames(void) throw( Runtim SwXTextCursor::SwXTextCursor(uno::Reference< XText > xParent, const SwPosition& rPos, CursorType eSet, SwDoc* pDoc, const SwPosition* pMark) : aLstnrCntnr(( util::XSortable*)this), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)), xParentText(xParent), pLastSortOptions(0), eType(eSet), @@ -836,7 +836,7 @@ SwXTextCursor::SwXTextCursor(uno::Reference< XText > xParent, const SwPosition& SwXTextCursor::SwXTextCursor(uno::Reference< XText > xParent, SwUnoCrsr* pSourceCrsr, CursorType eSet) : aLstnrCntnr( (util::XSortable*)this), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)), xParentText(xParent), pLastSortOptions(0), eType(eSet), @@ -1101,9 +1101,7 @@ void SwXTextCursor::gotoEnd(sal_Bool Expand) throw( uno::RuntimeException ) throw uno::RuntimeException(); } } -/* -----------------05.03.99 07:27------------------- - * - * --------------------------------------------------*/ + void SwXTextCursor::gotoRange(const uno::Reference< XTextRange > & xRange, sal_Bool bExpand ) throw( uno::RuntimeException ) { @@ -1148,8 +1146,8 @@ void SwXTextCursor::gotoRange(const uno::Reference< XTextRange > & xRange, sal_B } else if(pRange && pRange->GetBookmark()) { - SwBookmark* pBkm = pRange->GetBookmark(); - pSrcNode = &pBkm->GetBookmarkPos().nNode.GetNode(); + ::sw::mark::IMark const * const pBkmk = pRange->GetBookmark(); + pSrcNode = &pBkmk->GetMarkPos().nNode.GetNode(); } const SwStartNode* pTmp = pSrcNode ? pSrcNode->FindSttNodeByType(eSearchNodeType) : 0; @@ -1190,9 +1188,9 @@ void SwXTextCursor::gotoRange(const uno::Reference< XTextRange > & xRange, sal_B } else { - SwBookmark* pBkm = pRange->GetBookmark(); - pParamLeft = new SwPosition(pBkm->GetBookmarkPos()); - pParamRight = new SwPosition(pBkm->GetOtherBookmarkPos() ? *pBkm->GetOtherBookmarkPos() : *pParamLeft); + ::sw::mark::IMark const * const pBkmk = pRange->GetBookmark(); + pParamLeft = new SwPosition(pBkmk->GetMarkPos()); + pParamRight = new SwPosition(pBkmk->IsExpanded() ? pBkmk->GetOtherMarkPos() : *pParamLeft); } if(*pParamRight < *pParamLeft) { @@ -1230,12 +1228,12 @@ void SwXTextCursor::gotoRange(const uno::Reference< XTextRange > & xRange, sal_B } else { - SwBookmark* pBkm = pRange->GetBookmark(); - *pOwnCursor->GetPoint() = pBkm->GetBookmarkPos(); - if(pBkm->GetOtherBookmarkPos()) + ::sw::mark::IMark const * const pBkmk = pRange->GetBookmark(); + *pOwnCursor->GetPoint() = pBkmk->GetMarkPos(); + if(pBkmk->IsExpanded()) { pOwnCursor->SetMark(); - *pOwnCursor->GetMark() = *pBkm->GetOtherBookmarkPos(); + *pOwnCursor->GetMark() = pBkmk->GetOtherMarkPos(); } else pOwnCursor->DeleteMark(); @@ -1799,12 +1797,12 @@ Any SwXTextCursor::GetPropertyValue( throw( UnknownPropertyException, WrappedTargetException, RuntimeException) { Any aAny; - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - rPropSet.getPropertyMap(), rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = rPropSet.getPropertyMap()->getByName( + rPropertyName); + if(pEntry) { PropertyState eTemp; - BOOL bDone = SwUnoCursorHelper::getCrsrPropertyValue( pMap, rPaM, &aAny, eTemp ); + BOOL bDone = SwUnoCursorHelper::getCrsrPropertyValue( *pEntry, rPaM, &aAny, eTemp ); if(!bDone) { SfxItemSet aSet(rPaM.GetDoc()->GetAttrPool(), @@ -1814,7 +1812,7 @@ Any SwXTextCursor::GetPropertyValue( 0L); SwXTextCursor::GetCrsrAttr(rPaM, aSet); - aAny = rPropSet.getPropertyValue(*pMap, aSet); + rPropSet.getPropertyValue(*pEntry, aSet, aAny); } } else @@ -1827,23 +1825,22 @@ Any SwXTextCursor::GetPropertyValue( ---------------------------------------------------------------------------*/ void SwXTextCursor::SetPropertyValue( SwPaM& rPaM, const SfxItemPropertySet& rPropSet, const OUString& rPropertyName, - const Any& aValue, const SfxItemPropertyMap* _pMap, USHORT nAttrMode) + const Any& aValue, USHORT nAttrMode) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { SwDoc* pDoc = rPaM.GetDoc(); - const SfxItemPropertyMap* pMap = _pMap ? _pMap : SfxItemPropertyMap::GetByName( - rPropSet.getPropertyMap(), rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = rPropSet.getPropertyMap()->getByName(rPropertyName); + if(pEntry) { - if ( pMap->nFlags & PropertyAttribute::READONLY) + if( pEntry->nFlags & PropertyAttribute::READONLY) throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( 0 ) ); - SfxItemSet aItemSet( pDoc->GetAttrPool(), pMap->nWID, pMap->nWID ); + SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID ); SwXTextCursor::GetCrsrAttr( rPaM, aItemSet ); - if(!lcl_setCrsrPropertyValue( pMap, rPaM, aItemSet, aValue )) - rPropSet.setPropertyValue(*pMap, aValue, aItemSet ); + if(!lcl_setCrsrPropertyValue( pEntry, rPaM, aItemSet, aValue )) + rPropSet.setPropertyValue(*pEntry, aValue, aItemSet ); SwXTextCursor::SetCrsrAttr(rPaM, aItemSet, nAttrMode ); } else @@ -1853,7 +1850,7 @@ void SwXTextCursor::SetPropertyValue( ---------------------------------------------------------------------------*/ Sequence< PropertyState > SwXTextCursor::GetPropertyStates( - SwPaM& rPaM, SfxItemPropertySet& rPropSet, + SwPaM& rPaM, const SfxItemPropertySet& rPropSet, const Sequence< OUString >& PropertyNames, SwGetPropertyStatesCaller eCaller ) throw(UnknownPropertyException, RuntimeException) @@ -1863,47 +1860,52 @@ Sequence< PropertyState > SwXTextCursor::GetPropertyStates( PropertyState* pStates = aRet.getArray(); SfxItemSet *pSet = 0, *pSetParent = 0; - const SfxItemPropertyMap* pSaveMap, *pMap = rPropSet.getPropertyMap(); + const SfxItemPropertyMap *pMap = rPropSet.getPropertyMap(); for( INT32 i = 0, nEnd = PropertyNames.getLength(); i < nEnd; i++ ) { - pSaveMap = pMap; - pMap = SfxItemPropertyMap::GetByName( pMap, pNames[i] ); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[i] ); + if(!pEntry) { if(pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)) || pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT))) { pStates[i] = beans::PropertyState_DEFAULT_VALUE; - pMap = pSaveMap; + continue; + } + else if( SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT == eCaller ) + { + //this values marks the element as unknown property + pStates[i] = beans::PropertyState_MAKE_FIXED_SIZE; continue; } else throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( 0 ) ); } - if (eCaller == SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION && - pMap->nWID < FN_UNO_RANGE_BEGIN && - pMap->nWID > FN_UNO_RANGE_END && - pMap->nWID < RES_CHRATR_BEGIN && - pMap->nWID > RES_TXTATR_END ) + if ((eCaller == SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION || eCaller == SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT) && + pEntry->nWID < FN_UNO_RANGE_BEGIN && + pEntry->nWID > FN_UNO_RANGE_END && + pEntry->nWID < RES_CHRATR_BEGIN && + pEntry->nWID > RES_TXTATR_END ) pStates[i] = beans::PropertyState_DEFAULT_VALUE; else { - if ( pMap->nWID >= FN_UNO_RANGE_BEGIN && - pMap->nWID <= FN_UNO_RANGE_END ) - SwUnoCursorHelper::getCrsrPropertyValue(pMap, rPaM, 0, pStates[i] ); + if ( pEntry->nWID >= FN_UNO_RANGE_BEGIN && + pEntry->nWID <= FN_UNO_RANGE_END ) + SwUnoCursorHelper::getCrsrPropertyValue(*pEntry, rPaM, 0, pStates[i] ); else { if( !pSet ) { switch ( eCaller ) { + case SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT: case SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION: pSet = new SfxItemSet( rPaM.GetDoc()->GetAttrPool(), RES_CHRATR_BEGIN, RES_TXTATR_END ); break; case SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY: pSet = new SfxItemSet( rPaM.GetDoc()->GetAttrPool(), - pMap->nWID, pMap->nWID ); + pEntry->nWID, pEntry->nWID ); break; default: pSet = new SfxItemSet( rPaM.GetDoc()->GetAttrPool(), @@ -1918,7 +1920,7 @@ Sequence< PropertyState > SwXTextCursor::GetPropertyStates( } if( pSet->Count() ) - pStates[i] = rPropSet.getPropertyState( *pMap,*pSet ); + pStates[i] = rPropSet.getPropertyState( *pEntry, *pSet ); else pStates[i] = PropertyState_DEFAULT_VALUE; @@ -1934,13 +1936,12 @@ Sequence< PropertyState > SwXTextCursor::GetPropertyStates( } if( (pSetParent)->Count() ) - pStates[i] = rPropSet.getPropertyState( *pMap, *pSetParent ); + pStates[i] = rPropSet.getPropertyState( *pEntry, *pSetParent ); else pStates[i] = PropertyState_DEFAULT_VALUE; } } } - pMap++; } delete pSet; delete pSetParent; @@ -1950,7 +1951,7 @@ Sequence< PropertyState > SwXTextCursor::GetPropertyStates( ---------------------------------------------------------------------------*/ PropertyState SwXTextCursor::GetPropertyState( - SwPaM& rPaM, SfxItemPropertySet& rPropSet, const OUString& rPropertyName) + SwPaM& rPaM, const SfxItemPropertySet& rPropSet, const OUString& rPropertyName) throw(UnknownPropertyException, RuntimeException) { Sequence < OUString > aStrings ( 1 ); @@ -1985,23 +1986,22 @@ void SwXTextCursor::SetPropertyToDefault( { NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); SwDoc* pDoc = rPaM.GetDoc(); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - rPropSet.getPropertyMap(), rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = rPropSet.getPropertyMap()->getByName( rPropertyName); + if(pEntry) { - if ( pMap->nFlags & PropertyAttribute::READONLY) + if ( pEntry->nFlags & PropertyAttribute::READONLY) throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertyToDefault: property is read-only: " ) ) + rPropertyName, 0 ); - if(pMap->nWID < RES_FRMATR_END) + if(pEntry->nWID < RES_FRMATR_END) { SvUShortsSort aWhichIds; - aWhichIds.Insert(pMap->nWID); - if(pMap->nWID < RES_PARATR_BEGIN) + aWhichIds.Insert(pEntry->nWID); + if(pEntry->nWID < RES_PARATR_BEGIN) pDoc->ResetAttrs(rPaM, sal_True, &aWhichIds); else lcl_SelectParaAndReset ( rPaM, pDoc, &aWhichIds ); } else - SwUnoCursorHelper::resetCrsrPropertyValue(pMap, rPaM); + SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry, rPaM); } else throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( 0 ) ); @@ -2016,14 +2016,13 @@ Any SwXTextCursor::GetPropertyDefault( { Any aRet; SwDoc* pDoc = rPaM.GetDoc(); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - rPropSet.getPropertyMap(), rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = rPropSet.getPropertyMap()->getByName( rPropertyName); + if(pEntry) { - if(pMap->nWID < RES_FRMATR_END) + if(pEntry->nWID < RES_FRMATR_END) { - const SfxPoolItem& rDefItem = pDoc->GetAttrPool().GetDefaultItem(pMap->nWID); - rDefItem.QueryValue(aRet, pMap->nMemberId); + const SfxPoolItem& rDefItem = pDoc->GetAttrPool().GetDefaultItem(pEntry->nWID); + rDefItem.QueryValue(aRet, pEntry->nMemberId); } } else @@ -2038,13 +2037,13 @@ uno::Reference< beans::XPropertySetInfo > SwXTextCursor::getPropertySetInfo(voi static uno::Reference< beans::XPropertySetInfo > xRef; if(!xRef.is()) { - static SfxItemPropertyMap aCrsrExtMap_Impl[] = + static SfxItemPropertyMapEntry aCrsrExtMap_Impl[] = { { SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT), FN_SKIP_HIDDEN_TEXT, &::getBooleanCppuType(), PROPERTY_NONE, 0}, { SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT), FN_SKIP_PROTECTED_TEXT, &::getBooleanCppuType(), PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - uno::Reference< beans::XPropertySetInfo > xInfo = aPropSet.getPropertySetInfo(); + uno::Reference< beans::XPropertySetInfo > xInfo = m_pPropSet->getPropertySetInfo(); // PropertySetInfo verlaengern! const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties(); xRef = new SfxExtItemPropertySetInfo( @@ -2075,7 +2074,7 @@ void SwXTextCursor::setPropertyValue(const OUString& rPropertyName, const uno::A pUnoCrsr->SetSkipOverProtectSections(bSet); } else - SetPropertyValue(*pUnoCrsr, aPropSet, rPropertyName, aValue); + SetPropertyValue(*pUnoCrsr, *m_pPropSet, rPropertyName, aValue); } else throw uno::RuntimeException(); @@ -2103,7 +2102,7 @@ Any SwXTextCursor::getPropertyValue(const OUString& rPropertyName) aAny.setValue(&bSet, ::getBooleanCppuType()); } else - aAny = GetPropertyValue(*pUnoCrsr, aPropSet, rPropertyName); + aAny = GetPropertyValue(*pUnoCrsr, *m_pPropSet, rPropertyName); } else throw uno::RuntimeException(); @@ -2149,7 +2148,7 @@ beans::PropertyState SwXTextCursor::getPropertyState(const OUString& rPropertyNa SwUnoCrsr* pUnoCrsr = GetCrsr(); if(pUnoCrsr) { - eRet = GetPropertyState(*pUnoCrsr, aPropSet, rPropertyName); + eRet = GetPropertyState(*pUnoCrsr, *m_pPropSet, rPropertyName); } else throw RuntimeException(); @@ -2166,7 +2165,7 @@ uno::Sequence< beans::PropertyState > SwXTextCursor::getPropertyStates( SwUnoCrsr* pUnoCrsr = GetCrsr(); if(!pUnoCrsr) throw RuntimeException(); - return GetPropertyStates(*pUnoCrsr, aPropSet, PropertyNames); + return GetPropertyStates(*pUnoCrsr, *m_pPropSet, PropertyNames); } /*-- 05.03.99 11:36:12--------------------------------------------------- @@ -2247,36 +2246,33 @@ void SAL_CALL SwXTextCursor::setPropertiesToDefault( const Sequence< OUString >& if(pUnoCrsr) { SwDoc* pDoc = pUnoCrsr->GetDoc(); - const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap(), *pSaveMap; const OUString * pNames = aPropertyNames.getConstArray(); SvUShortsSort aWhichIds, aParaWhichIds; for ( sal_Int32 i = 0; i < nCount; i++ ) { - pSaveMap = pMap; - pMap = SfxItemPropertyMap::GetByName( pMap, pNames[i]); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( pNames[i] ); + if(!pEntry) { if(pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)) || pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT))) { - pMap = pSaveMap; continue; } else throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( 0 ) ); } - if ( pMap->nFlags & PropertyAttribute::READONLY) + if( pEntry->nFlags & PropertyAttribute::READONLY) throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertiesToDefault: property is read-only: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) ); - if( pMap->nWID < RES_FRMATR_END) + if( pEntry->nWID < RES_FRMATR_END) { - if(pMap->nWID < RES_PARATR_BEGIN) - aWhichIds.Insert(pMap->nWID); + if(pEntry->nWID < RES_PARATR_BEGIN) + aWhichIds.Insert(pEntry->nWID); else - aParaWhichIds.Insert (pMap->nWID); + aParaWhichIds.Insert (pEntry->nWID); } - else if ( pMap->nWID == FN_UNO_NUM_START_VALUE ) - SwUnoCursorHelper::resetCrsrPropertyValue(pMap, *pUnoCrsr); + else if ( pEntry->nWID == FN_UNO_NUM_START_VALUE ) + SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry, *pUnoCrsr); } if ( aParaWhichIds.Count() ) @@ -2300,28 +2296,25 @@ Sequence< Any > SAL_CALL SwXTextCursor::getPropertyDefaults( const Sequence< OUS if (pUnoCrsr) { SwDoc* pDoc = pUnoCrsr->GetDoc(); - const SfxItemPropertyMap *pSaveMap, *pMap = aPropSet.getPropertyMap(); const OUString *pNames = aPropertyNames.getConstArray(); Any *pAny = aRet.getArray(); for ( sal_Int32 i = 0; i < nCount; i++) { - pSaveMap = pMap; - pMap = SfxItemPropertyMap::GetByName( pMap, pNames[i]); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( pNames[i] ); + if(!pEntry) { if(pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)) || pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT))) { - pMap = pSaveMap; continue; } else throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( 0 ) ); } - if(pMap->nWID < RES_FRMATR_END) + if(pEntry->nWID < RES_FRMATR_END) { - const SfxPoolItem& rDefItem = pDoc->GetAttrPool().GetDefaultItem(pMap->nWID); - rDefItem.QueryValue(pAny[i], pMap->nMemberId); + const SfxPoolItem& rDefItem = pDoc->GetAttrPool().GetDefaultItem(pEntry->nWID); + rDefItem.QueryValue(pAny[i], pEntry->nMemberId); } } } diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 9b536dae7bc8..e49e69ea5cdf 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -37,6 +37,7 @@ #include <hintids.hxx> #include <cmdid.h> #include <hints.hxx> +#include <IMark.hxx> #include <bookmrk.hxx> #include <frmfmt.hxx> #include <doc.hxx> @@ -1119,18 +1120,13 @@ void SwXParagraphEnumeration::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) ******************************************************************/ TYPEINIT1(SwXTextRange, SwClient); -/* -----------------------------10.03.00 18:02-------------------------------- - - ---------------------------------------------------------------------------*/ const uno::Sequence< sal_Int8 > & SwXTextRange::getUnoTunnelId() { static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); return aSeq; } -/* -----------------------------10.03.00 18:02-------------------------------- - ---------------------------------------------------------------------------*/ - //XUnoTunnel +//XUnoTunnel sal_Int64 SAL_CALL SwXTextRange::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException) @@ -1143,193 +1139,142 @@ sal_Int64 SAL_CALL SwXTextRange::getSomething( } return 0; } -/* -----------------------------06.04.00 16:34-------------------------------- - ---------------------------------------------------------------------------*/ OUString SwXTextRange::getImplementationName(void) throw( RuntimeException ) { - return C2U("SwXTextRange"); + return OUString::createFromAscii("SwXTextRange"); } -/* -----------------------------06.04.00 16:34-------------------------------- - ---------------------------------------------------------------------------*/ BOOL SwXTextRange::supportsService(const OUString& rServiceName) throw( RuntimeException ) { String sServiceName(rServiceName); return sServiceName.EqualsAscii("com.sun.star.text.TextRange") || - sServiceName.EqualsAscii("com.sun.star.style.CharacterProperties")|| + sServiceName.EqualsAscii("com.sun.star.style.CharacterProperties")|| sServiceName.EqualsAscii("com.sun.star.style.CharacterPropertiesAsian")|| sServiceName.EqualsAscii("com.sun.star.style.CharacterPropertiesComplex")|| sServiceName.EqualsAscii("com.sun.star.style.ParagraphProperties") || sServiceName.EqualsAscii("com.sun.star.style.ParagraphPropertiesAsian") || sServiceName.EqualsAscii("com.sun.star.style.ParagraphPropertiesComplex"); } -/* -----------------------------06.04.00 16:34-------------------------------- - ---------------------------------------------------------------------------*/ Sequence< OUString > SwXTextRange::getSupportedServiceNames(void) throw( RuntimeException ) { Sequence< OUString > aRet(7); - OUString* pArray = aRet.getArray(); - pArray[0] = C2U("com.sun.star.text.TextRange"); - pArray[1] = C2U("com.sun.star.style.CharacterProperties"); - pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian"); - pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex"); - pArray[4] = C2U("com.sun.star.style.ParagraphProperties"); - pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian"); - pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex"); + aRet[0] = OUString::createFromAscii("com.sun.star.text.TextRange"); + aRet[1] = OUString::createFromAscii("com.sun.star.style.CharacterProperties"); + aRet[2] = OUString::createFromAscii("com.sun.star.style.CharacterPropertiesAsian"); + aRet[3] = OUString::createFromAscii("com.sun.star.style.CharacterPropertiesComplex"); + aRet[4] = OUString::createFromAscii("com.sun.star.style.ParagraphProperties"); + aRet[5] = OUString::createFromAscii("com.sun.star.style.ParagraphPropertiesAsian"); + aRet[6] = OUString::createFromAscii("com.sun.star.style.ParagraphPropertiesComplex"); return aRet; } -/*-- 10.12.98 12:54:43--------------------------------------------------- - - -----------------------------------------------------------------------*/ SwXTextRange::SwXTextRange(SwPaM& rPam, const uno::Reference< XText > & rxParent) : eRangePosition(RANGE_IN_TEXT), pDoc(rPam.GetDoc()), pBox(0), pBoxStartNode(0), aObjectDepend(this, 0), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)), - xParentText(rxParent) + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)), + xParentText(rxParent), + pMark(NULL) { //Bookmark an der anlegen _CreateNewBookmark(rPam); } -/*-- 10.12.98 12:54:43--------------------------------------------------- - -----------------------------------------------------------------------*/ SwXTextRange::SwXTextRange(SwFrmFmt& rFmt, SwPaM& rPam) : eRangePosition(RANGE_IN_FRAME), pDoc(rPam.GetDoc()), pBox(0), pBoxStartNode(0), aObjectDepend(this, &rFmt), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)) + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)), + pMark(NULL) { //Bookmark an der anlegen _CreateNewBookmark(rPam); } -/*-- 10.12.98 12:54:44--------------------------------------------------- - -----------------------------------------------------------------------*/ SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt, SwTableBox& rTblBox, SwPaM& rPam) : eRangePosition(RANGE_IN_CELL), pDoc(rPam.GetDoc()), pBox(&rTblBox), pBoxStartNode(0), aObjectDepend(this, &rTblFmt), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)) + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)), + pMark(NULL) { //Bookmark an der anlegen _CreateNewBookmark(rPam); } -/* -----------------------------09.08.00 16:07-------------------------------- - ---------------------------------------------------------------------------*/ SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt, const SwStartNode& rStartNode, SwPaM& rPam) : eRangePosition(RANGE_IN_CELL), pDoc(rPam.GetDoc()), pBox(0), pBoxStartNode(&rStartNode), aObjectDepend(this, &rTblFmt), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)) + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)), + pMark(NULL) { //Bookmark an der anlegen _CreateNewBookmark(rPam); } -/* -----------------19.02.99 11:39------------------- - * - * --------------------------------------------------*/ + SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt) : eRangePosition(RANGE_IS_TABLE), pDoc(rTblFmt.GetDoc()), pBox(0), pBoxStartNode(0), aObjectDepend(this, &rTblFmt), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)) + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)), + pMark(NULL) { } -/*-- 10.12.98 12:54:44--------------------------------------------------- - - -----------------------------------------------------------------------*/ SwXTextRange::~SwXTextRange() { vos::OGuard aGuard(Application::GetSolarMutex()); - if(GetBookmark()) - pDoc->deleteBookmark( GetBookmark()->GetName() ); + ::sw::mark::IMark const * const pBkmk = GetBookmark(); + if(pBkmk) + pDoc->getIDocumentMarkAccess()->deleteMark(pBkmk); } -/*-- 10.12.98 12:54:44--------------------------------------------------- - -----------------------------------------------------------------------*/ -void SwXTextRange::_CreateNewBookmark(SwPaM& rPam) +void SwXTextRange::_CreateNewBookmark(SwPaM& rPam) { - static sal_Int32 nBookmark = 0; - String sBookmarkName; + IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); - SwBookmark* pBkm = GetBookmark(); - if(pBkm) - { - // If a bookmark exists already its name can be resused - sBookmarkName = pBkm->GetName(); - pDoc->deleteBookmark( sBookmarkName ); - } - else - { - // Otherwise we have to create a new name. This is not done - // using SwDoc::MakeUniqueBookmarkName, because this method - // starts counting bookmarks beginning with 1. That's required - // for real bookmarks, but very slow in thsi case there lots - // of bookmarks requiere any unique name only. - String sPrefix(C2S("SwXTextPosition")); - const SwBookmarks& rBookmarks = pDoc->getBookmarks(); - sal_uInt16 nBookmarks = rBookmarks.Count(), i; - do - { - nBookmark++; - if( nBookmark < 1 ) // on overwflow restart with 1 - nBookmark = 1; - - sBookmarkName = sPrefix; - sBookmarkName += String::CreateFromInt32( nBookmark ); - for( i = 0; i < nBookmarks; i++ ) - if( rBookmarks[i]->GetName().Equals( sBookmarkName ) ) - break; - } - while( i < nBookmarks ); - } - - KeyCode aCode; - String sShortName; - SwBookmark* pMark = pDoc->makeBookmark(rPam, aCode, sBookmarkName, sShortName, IDocumentBookmarkAccess::UNO_BOOKMARK); + ::sw::mark::IMark const * const pBkmk = GetBookmark(); + if(pBkmk) + pMarkAccess->deleteMark(pBkmk); + pMark = pMarkAccess->makeMark(rPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK); pMark->Add(this); } -/*-- 10.12.98 12:54:45--------------------------------------------------- - -----------------------------------------------------------------------*/ -void SwXTextRange::DeleteAndInsert(const String& rText) throw( uno::RuntimeException ) +void SwXTextRange::DeleteAndInsert(const String& rText) + throw(uno::RuntimeException) { - SwBookmark* pBkm = GetBookmark(); - if(pBkm ) + ::sw::mark::IMark const * const pBkmk = GetBookmark(); + if(pBkmk) { - const SwPosition& rPoint = *pBkm->BookmarkStart(); - const SwPosition* pMark = pBkm->BookmarkEnd(); - SwCursor aNewCrsr( rPoint, 0, false ); - if(pMark) + const SwPosition& rPoint = pBkmk->GetMarkStart(); + SwCursor aNewCrsr(rPoint, 0, false); + if(pBkmk->IsExpanded()) { aNewCrsr.SetMark(); - *aNewCrsr.GetMark() = *pMark; + const SwPosition& rMark = pBkmk->GetMarkEnd(); + *aNewCrsr.GetMark() = rMark; } - - UnoActionContext aAction( pDoc ); + UnoActionContext aAction(pDoc); pDoc->StartUndo(UNDO_INSERT, NULL); if(aNewCrsr.HasMark()) pDoc->DeleteAndJoin(aNewCrsr); if(rText.Len()) { - SwUnoCursorHelper::DocInsertStringSplitCR( *pDoc, aNewCrsr, rText ); + SwUnoCursorHelper::DocInsertStringSplitCR(*pDoc, aNewCrsr, rText); SwXTextCursor::SelectPam(aNewCrsr, sal_True); aNewCrsr.Left(rText.Len(), CRSR_SKIP_CHARS, FALSE, FALSE); @@ -1337,12 +1282,8 @@ void SwXTextRange::DeleteAndInsert(const String& rText) throw( uno::RuntimeEx _CreateNewBookmark(aNewCrsr); pDoc->EndUndo(UNDO_INSERT, NULL); } - } -/*-- 10.12.98 12:54:46--------------------------------------------------- - - -----------------------------------------------------------------------*/ uno::Reference< XText > SwXTextRange::getText(void) throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); @@ -1394,91 +1335,69 @@ uno::Reference< XText > SwXTextRange::getText(void) throw( uno::RuntimeExceptio } return xParentText; } -/*-- 10.12.98 12:54:47--------------------------------------------------- - -----------------------------------------------------------------------*/ uno::Reference< XTextRange > SwXTextRange::getStart(void) throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); uno::Reference< XTextRange > xRet; - SwBookmark* pBkm = GetBookmark(); + + ::sw::mark::IMark const * const pBkmk = GetBookmark(); if(!xParentText.is()) getText(); - if(pBkm) + if(pBkmk) { - SwPaM aPam(*pBkm->BookmarkStart()); + SwPaM aPam(pBkmk->GetMarkStart()); xRet = new SwXTextRange(aPam, xParentText); } else if(eRangePosition == RANGE_IS_TABLE) { - //start und ende sind mit this identisch, wenn es eine Tabelle ist + //start and end are this, if its a table xRet = this; } else throw uno::RuntimeException(); return xRet; } -/*-- 10.12.98 12:54:47--------------------------------------------------- - -----------------------------------------------------------------------*/ uno::Reference< XTextRange > SwXTextRange::getEnd(void) throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); uno::Reference< XTextRange > xRet; - SwBookmark* pBkm = GetBookmark(); + ::sw::mark::IMark const * const pBkmk = GetBookmark(); if(!xParentText.is()) getText(); - if(pBkm) + if(pBkmk) { -// SwPaM aPam(pBkm->GetOtherPos()? *pBkm->GetOtherPos() : pBkm->GetPos()); - SwPaM aPam(*pBkm->BookmarkEnd()); + SwPaM aPam(pBkmk->GetMarkEnd()); xRet = new SwXTextRange(aPam, xParentText); } else if(eRangePosition == RANGE_IS_TABLE) { - //start und ende sind mit this identisch, wenn es eine Tabelle ist + //start and end are this, if its a table xRet = this; } else throw uno::RuntimeException(); return xRet; } -/*-- 10.12.98 12:54:47--------------------------------------------------- - -----------------------------------------------------------------------*/ OUString SwXTextRange::getString(void) throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - SwBookmark* pBkm = GetBookmark(); OUString sRet; - //fuer Tabellen gibt es keine Bookmark, also auch keinen Text - //evtl. koennte man hier die Tabelle als ASCII exportieren? - if(pBkm && pBkm->GetOtherBookmarkPos()) + ::sw::mark::IMark const * const pBkmk = GetBookmark(); + // for tables there is no bookmark, thus also no text + // one could export the table as ASCII here maybe? + if(pBkmk && pBkmk->IsExpanded()) { - const SwPosition& rPoint = pBkm->GetBookmarkPos(); - const SwPosition* pMark = pBkm->GetOtherBookmarkPos(); - SwPaM aCrsr(*pMark, rPoint); -/* if( rPoint.nNode.GetIndex() == - pMark->nNode.GetIndex() ) - { - SwTxtNode* pTxtNd = aCrsr.GetNode()->GetTxtNode(); - if( pTxtNd ) - { - sal_uInt16 nStt = aCrsr.Start()->nContent.GetIndex(); - sRet = pTxtNd->GetExpandTxt( nStt, - aCrsr.End()->nContent.GetIndex() - nStt ); - } - } - else -*/ { - SwXTextCursor::getTextFromPam(aCrsr, sRet); - } + const SwPosition& rPoint = pBkmk->GetMarkPos(); + const SwPosition& rMark = pBkmk->GetOtherMarkPos(); + SwPaM aCrsr(rMark, rPoint); + SwXTextCursor::getTextFromPam(aCrsr, sRet); } return sRet; } -/*-- 10.12.98 12:54:48--------------------------------------------------- - -----------------------------------------------------------------------*/ void SwXTextRange::setString(const OUString& aString) throw( uno::RuntimeException ) { @@ -1491,9 +1410,7 @@ void SwXTextRange::setString(const OUString& aString) else DeleteAndInsert(aString); } -/*-- 10.12.98 12:54:48--------------------------------------------------- - -----------------------------------------------------------------------*/ void SwXTextRange::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) { sal_Bool bAlreadyRegisterred = 0 != GetRegisteredIn(); @@ -1510,21 +1427,21 @@ void SwXTextRange::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) aObjectDepend.GetRegisteredIn()) ((SwModify*)aObjectDepend.GetRegisteredIn())->Remove(&aObjectDepend); } + if(!GetRegisteredIn()) + pMark = NULL; } -/*-- 10.12.98 12:54:49--------------------------------------------------- - -----------------------------------------------------------------------*/ -sal_Bool SwXTextRange::GetPositions(SwPaM& rToFill) const +sal_Bool SwXTextRange::GetPositions(SwPaM& rToFill) const { sal_Bool bRet = sal_False; - SwBookmark* pBkm = GetBookmark(); - if(pBkm) + ::sw::mark::IMark const * const pBkmk = GetBookmark(); + if(pBkmk) { - *rToFill.GetPoint() = pBkm->GetBookmarkPos(); - if(pBkm->GetOtherBookmarkPos()) + *rToFill.GetPoint() = pBkmk->GetMarkPos(); + if(pBkmk->IsExpanded()) { rToFill.SetMark(); - *rToFill.GetMark() = *pBkm->GetOtherBookmarkPos(); + *rToFill.GetMark() = pBkmk->GetOtherMarkPos(); } else rToFill.DeleteMark(); @@ -1532,10 +1449,8 @@ sal_Bool SwXTextRange::GetPositions(SwPaM& rToFill) const } return bRet; } -/*-- 10.12.98 12:54:49--------------------------------------------------- - -----------------------------------------------------------------------*/ -sal_Bool SwXTextRange::XTextRangeToSwPaM( SwUnoInternalPaM& rToFill, +sal_Bool SwXTextRange::XTextRangeToSwPaM( SwUnoInternalPaM& rToFill, const uno::Reference< XTextRange > & xTextRange) { sal_Bool bRet = sal_False; @@ -1614,9 +1529,7 @@ sal_Bool SwXTextRange::XTextRangeToSwPaM( SwUnoInternalPaM& rToFill, } return bRet; } -/* -----------------24.02.99 14:18------------------- - * Der StartNode muss in einem existierenden Header/Footen liegen - * --------------------------------------------------*/ + sal_Bool lcl_IsStartNodeInFormat(sal_Bool bHeader, SwStartNode* pSttNode, const SwFrmFmt* pFrmFmt, SwFrmFmt*& rpFormat) { @@ -1641,10 +1554,8 @@ sal_Bool lcl_IsStartNodeInFormat(sal_Bool bHeader, SwStartNode* pSttNode, } return bRet; } -/* -----------------03.11.98 15:58------------------- - * - * --------------------------------------------------*/ -uno::Reference< XTextRange > SwXTextRange::CreateTextRangeFromPosition(SwDoc* pDoc, + +uno::Reference< XTextRange > SwXTextRange::CreateTextRangeFromPosition(SwDoc* pDoc, const SwPosition& rPos, const SwPosition* pMark) { uno::Reference< XTextRange > aRet; @@ -1755,44 +1666,37 @@ uno::Reference< XTextRange > SwXTextRange::CreateTextRangeFromPosition(SwDoc* p delete pNewCrsr; return aRet; } -/* -----------------------------03.04.00 09:11-------------------------------- - ---------------------------------------------------------------------------*/ uno::Reference< XEnumeration > SAL_CALL SwXTextRange::createContentEnumeration( - const OUString& rServiceName) - throw( RuntimeException ) + const OUString& rServiceName) + throw(RuntimeException) { - SwBookmark* pBkm = GetBookmark(); - if( !pBkm || COMPARE_EQUAL != rServiceName.compareToAscii("com.sun.star.text.TextContent") ) + ::sw::mark::IMark const * const pBkmk = GetBookmark(); + if( !pBkmk || COMPARE_EQUAL != rServiceName.compareToAscii("com.sun.star.text.TextContent") ) throw RuntimeException(); - const SwPosition& rPoint = pBkm->GetBookmarkPos(); - const SwPosition* pMark = pBkm->GetOtherBookmarkPos(); + const SwPosition& rPoint = pBkmk->GetMarkPos(); SwUnoCrsr* pNewCrsr = pDoc->CreateUnoCrsr(rPoint, FALSE); - if(pMark && *pMark != rPoint) + if(pBkmk->IsExpanded() && pBkmk->GetOtherMarkPos() != rPoint) { pNewCrsr->SetMark(); - *pNewCrsr->GetMark() = *pMark; + *pNewCrsr->GetMark() = pBkmk->GetOtherMarkPos(); } uno::Reference< XEnumeration > xRet = new SwXParaFrameEnumeration(*pNewCrsr, PARAFRAME_PORTION_TEXTRANGE); delete pNewCrsr; return xRet; } -/* -----------------------------07.03.01 14:55-------------------------------- - ---------------------------------------------------------------------------*/ -uno::Reference< XEnumeration > SwXTextRange::createEnumeration(void) throw( RuntimeException ) +uno::Reference< XEnumeration > SwXTextRange::createEnumeration(void) throw( RuntimeException ) { - SwBookmark* pBkm = GetBookmark(); - if( !pBkm ) - throw RuntimeException(); - const SwPosition& rPoint = pBkm->GetBookmarkPos(); - const SwPosition* pMark = pBkm->GetOtherBookmarkPos(); + ::sw::mark::IMark const * const pBkmk = GetBookmark(); + if(!pBkmk) throw RuntimeException(); + const SwPosition& rPoint = pBkmk->GetMarkPos(); SwUnoCrsr* pNewCrsr = pDoc->CreateUnoCrsr(rPoint, FALSE); - if(pMark && *pMark != rPoint) + if(pBkmk->IsExpanded() && pBkmk->GetOtherMarkPos() != rPoint) { pNewCrsr->SetMark(); - *pNewCrsr->GetMark() = *pMark; + *pNewCrsr->GetMark() = pBkmk->GetOtherMarkPos(); } uno::Reference<XUnoTunnel> xTunnel(xParentText, UNO_QUERY); SwXText* pParentText = 0; @@ -1806,23 +1710,17 @@ uno::Reference< XEnumeration > SwXTextRange::createEnumeration(void) throw( Run uno::Reference< XEnumeration > xRet = new SwXParagraphEnumeration(pParentText, *pNewCrsr, eSetType); return xRet; } -/* -----------------------------07.03.01 15:43-------------------------------- - ---------------------------------------------------------------------------*/ uno::Type SwXTextRange::getElementType(void) throw( RuntimeException ) { return ::getCppuType((uno::Reference<XTextRange>*)0); } -/* -----------------------------07.03.01 15:43-------------------------------- - ---------------------------------------------------------------------------*/ sal_Bool SwXTextRange::hasElements(void) throw( RuntimeException ) { return sal_True; } -/* -----------------------------03.04.00 09:11-------------------------------- - ---------------------------------------------------------------------------*/ Sequence< OUString > SAL_CALL SwXTextRange::getAvailableServiceNames(void) throw( RuntimeException ) { Sequence< OUString > aRet(1); @@ -1830,19 +1728,14 @@ Sequence< OUString > SAL_CALL SwXTextRange::getAvailableServiceNames(void) throw pArray[0] = OUString::createFromAscii("com.sun.star.text.TextContent"); return aRet; } -/*-- 03.05.00 12:41:46--------------------------------------------------- - -----------------------------------------------------------------------*/ uno::Reference< XPropertySetInfo > SAL_CALL SwXTextRange::getPropertySetInfo( ) throw(RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); - static uno::Reference< XPropertySetInfo > xRef = - aPropSet.getPropertySetInfo(); + static uno::Reference< XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo(); return xRef; } -/*-- 03.05.00 12:41:47--------------------------------------------------- - -----------------------------------------------------------------------*/ void SAL_CALL SwXTextRange::setPropertyValue( const OUString& rPropertyName, const Any& rValue ) throw(UnknownPropertyException, PropertyVetoException, @@ -1853,11 +1746,9 @@ void SAL_CALL SwXTextRange::setPropertyValue( throw RuntimeException(); SwPaM aPaM(GetDoc()->GetNodes()); SwXTextRange::GetPositions(aPaM); - SwXTextCursor::SetPropertyValue(aPaM, aPropSet, rPropertyName, rValue); + SwXTextCursor::SetPropertyValue(aPaM, *m_pPropSet, rPropertyName, rValue); } -/*-- 03.05.00 12:41:47--------------------------------------------------- - -----------------------------------------------------------------------*/ Any SAL_CALL SwXTextRange::getPropertyValue( const OUString& rPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { @@ -1866,47 +1757,37 @@ Any SAL_CALL SwXTextRange::getPropertyValue( const OUString& rPropertyName ) throw RuntimeException(); SwPaM aPaM(((SwDoc*)GetDoc())->GetNodes()); SwXTextRange::GetPositions(aPaM); - return SwXTextCursor::GetPropertyValue(aPaM, aPropSet, rPropertyName); + return SwXTextCursor::GetPropertyValue(aPaM, *m_pPropSet, rPropertyName); } -/*-- 03.05.00 12:41:47--------------------------------------------------- - -----------------------------------------------------------------------*/ void SAL_CALL SwXTextRange::addPropertyChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { DBG_WARNING("not implemented"); } -/*-- 03.05.00 12:41:48--------------------------------------------------- - -----------------------------------------------------------------------*/ void SAL_CALL SwXTextRange::removePropertyChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { DBG_WARNING("not implemented"); } -/*-- 03.05.00 12:41:48--------------------------------------------------- - -----------------------------------------------------------------------*/ void SAL_CALL SwXTextRange::addVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { DBG_WARNING("not implemented"); } -/*-- 03.05.00 12:41:48--------------------------------------------------- - -----------------------------------------------------------------------*/ void SAL_CALL SwXTextRange::removeVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { DBG_WARNING("not implemented"); } -/*-- 03.05.00 12:41:48--------------------------------------------------- - -----------------------------------------------------------------------*/ PropertyState SAL_CALL SwXTextRange::getPropertyState( const OUString& rPropertyName ) throw(UnknownPropertyException, RuntimeException) { @@ -1915,11 +1796,9 @@ PropertyState SAL_CALL SwXTextRange::getPropertyState( const OUString& rProperty throw RuntimeException(); SwPaM aPaM(((SwDoc*)GetDoc())->GetNodes()); SwXTextRange::GetPositions(aPaM); - return SwXTextCursor::GetPropertyState(aPaM, aPropSet, rPropertyName); + return SwXTextCursor::GetPropertyState(aPaM, *m_pPropSet, rPropertyName); } -/*-- 03.05.00 12:41:49--------------------------------------------------- - -----------------------------------------------------------------------*/ Sequence< PropertyState > SAL_CALL SwXTextRange::getPropertyStates( const Sequence< OUString >& rPropertyName ) throw(UnknownPropertyException, RuntimeException) { @@ -1928,11 +1807,9 @@ Sequence< PropertyState > SAL_CALL SwXTextRange::getPropertyStates( throw RuntimeException(); SwPaM aPaM(((SwDoc*)GetDoc())->GetNodes()); SwXTextRange::GetPositions(aPaM); - return SwXTextCursor::GetPropertyStates(aPaM, aPropSet, rPropertyName); + return SwXTextCursor::GetPropertyStates(aPaM, *m_pPropSet, rPropertyName); } -/*-- 03.05.00 12:41:49--------------------------------------------------- - -----------------------------------------------------------------------*/ void SAL_CALL SwXTextRange::setPropertyToDefault( const OUString& rPropertyName ) throw(UnknownPropertyException, RuntimeException) { @@ -1941,11 +1818,9 @@ void SAL_CALL SwXTextRange::setPropertyToDefault( const OUString& rPropertyName throw RuntimeException(); SwPaM aPaM(((SwDoc*)GetDoc())->GetNodes()); SwXTextRange::GetPositions(aPaM); - SwXTextCursor::SetPropertyToDefault(aPaM, aPropSet, rPropertyName); + SwXTextCursor::SetPropertyToDefault(aPaM, *m_pPropSet, rPropertyName); } -/*-- 03.05.00 12:41:50--------------------------------------------------- - -----------------------------------------------------------------------*/ Any SAL_CALL SwXTextRange::getPropertyDefault( const OUString& rPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { @@ -1954,11 +1829,9 @@ Any SAL_CALL SwXTextRange::getPropertyDefault( const OUString& rPropertyName ) throw RuntimeException(); SwPaM aPaM(((SwDoc*)GetDoc())->GetNodes()); SwXTextRange::GetPositions(aPaM); - return SwXTextCursor::GetPropertyDefault(aPaM, aPropSet, rPropertyName); + return SwXTextCursor::GetPropertyDefault(aPaM, *m_pPropSet, rPropertyName); } -/*-- 10.03.2008 09:58:47--------------------------------------------------- - -----------------------------------------------------------------------*/ void SwXTextRange::makeRedline( const ::rtl::OUString& rRedlineType, const uno::Sequence< beans::PropertyValue >& rRedlineProperties ) diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index 06db11ac4da5..7662df99afed 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -50,15 +50,9 @@ #define _SVSTDARR_USHORTSSORT #include <svtools/svstdarr.hxx> -//#ifndef _COM_SUN_STAR_BEANS_SETPROPERTYTOLERANTFAILED_HPP_ -//#include <com/sun/star/beans/SetPropertyTolerantFailed.hpp> -//#endif -//#ifndef _COM_SUN_STAR_BEANS_GETPROPERTYTOLERANTRESULT_HPP_ -//#include <com/sun/star/beans/GetPropertyTolerantResult.hpp> -//#endif -//#ifndef _COM_SUN_STAR_BEANS_TOLERANTPROPERTYSETRESULTTYPE_HPP_ -//#include <com/sun/star/beans/TolerantPropertySetResultType.hpp> -//#endif +#include <com/sun/star/beans/SetPropertyTolerantFailed.hpp> +#include <com/sun/star/beans/GetPropertyTolerantResult.hpp> +#include <com/sun/star/beans/TolerantPropertySetResultType.hpp> #ifndef _COM_SUN_STAR_BEANS_PropertyAttribute_HPP_ #include <com/sun/star/beans/PropertyAttribute.hpp> #endif @@ -75,7 +69,7 @@ using ::rtl::OUString; beans::PropertyState lcl_SwXParagraph_getPropertyState( SwUnoCrsr& rUnoCrsr, const SwAttrSet** ppSet, - const SfxItemPropertyMap& rMap, + const SfxItemPropertySimpleEntry& rEntry, sal_Bool &rAttrSetFetched ) throw( beans::UnknownPropertyException); @@ -160,7 +154,7 @@ uno::Sequence< OUString > SwXParagraph::getSupportedServiceNames(void) throw( un SwXParagraph::SwXParagraph() : xParentText(0), aLstnrCntnr( (text::XTextRange*)this), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH)), nSelectionStartPos(-1), nSelectionEndPos(-1), m_bIsDescriptor(TRUE) @@ -174,7 +168,7 @@ SwXParagraph::SwXParagraph(SwXText* pParent, SwUnoCrsr* pCrsr, sal_Int32 nSelSta SwClient(pCrsr), xParentText(pParent), aLstnrCntnr( (text::XTextRange*)this), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH)), nSelectionStartPos(nSelStart), nSelectionEndPos(nSelEnd), m_bIsDescriptor(FALSE) @@ -215,7 +209,7 @@ void SwXParagraph::attachToText(SwXText* pParent, SwUnoCrsr* pCrsr) uno::Reference< beans::XPropertySetInfo > SwXParagraph::getPropertySetInfo(void) throw( uno::RuntimeException ) { - static uno::Reference< beans::XPropertySetInfo > xRef = aPropSet.getPropertySetInfo(); + static uno::Reference< beans::XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo(); return xRef; } /*-- 11.12.98 08:12:49--------------------------------------------------- @@ -258,22 +252,21 @@ void SAL_CALL SwXParagraph::SetPropertyValues_Impl( { const OUString* pPropertyNames = rPropertyNames.getConstArray(); const uno::Any* pValues = rValues.getConstArray(); - const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap(); + const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap(); OUString sTmp; SwParaSelection aParaSel(pUnoCrsr); for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { - pMap = SfxItemPropertyMap::GetByName(pMap, pPropertyNames[nProp]); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pPropertyNames[nProp] ); + if(!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); else { - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - SwXTextCursor::SetPropertyValue(*pUnoCrsr, aPropSet, - sTmp, pValues[nProp], pMap); - pMap++; + SwXTextCursor::SetPropertyValue(*pUnoCrsr, *m_pPropSet, + sTmp, pValues[nProp]); } } } @@ -316,25 +309,24 @@ uno::Sequence< uno::Any > SAL_CALL SwXParagraph::GetPropertyValues_Impl( { uno::Any* pValues = aValues.getArray(); const OUString* pPropertyNames = rPropertyNames.getConstArray(); - const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap(); + const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap(); SwNode& rTxtNode = pUnoCrsr->GetPoint()->nNode.GetNode(); const SwAttrSet& rAttrSet = ((SwTxtNode&)rTxtNode).GetSwAttrSet(); for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { - pMap = SfxItemPropertyMap::GetByName(pMap, pPropertyNames[nProp]); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pPropertyNames[nProp] ); + if(pEntry) { if(!SwXParagraph::getDefaultTextContentValue( - pValues[nProp], pPropertyNames[nProp], pMap->nWID)) + pValues[nProp], pPropertyNames[nProp], pEntry->nWID)) { BOOL bDone = FALSE; beans::PropertyState eTemp; bDone = SwUnoCursorHelper::getCrsrPropertyValue( - pMap, *pUnoCrsr, &(pValues[nProp]), eTemp, rTxtNode.GetTxtNode() ); + *pEntry, *pUnoCrsr, &(pValues[nProp]), eTemp, rTxtNode.GetTxtNode() ); if(!bDone) - pValues[nProp] = aPropSet.getPropertyValue(*pMap, rAttrSet); + m_pPropSet->getPropertyValue(*pEntry, rAttrSet, pValues[nProp]); } - ++pMap; } else throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); @@ -397,9 +389,9 @@ void SwXParagraph::firePropertiesChangeEvent( ---------------------------------------------------------------------------*/ -/* disabled for #i46921# +/* disabled for #i46921# */ -uno::Sequence< SetPropertyTolerantFailed > SAL_CALL SwXParagraph::setPropertyValuesTolerant( +uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXParagraph::setPropertyValuesTolerant( const uno::Sequence< OUString >& rPropertyNames, const uno::Sequence< uno::Any >& rValues ) throw (lang::IllegalArgumentException, uno::RuntimeException) @@ -412,22 +404,22 @@ uno::Sequence< SetPropertyTolerantFailed > SAL_CALL SwXParagraph::setPropertyVal if(!pUnoCrsr) throw uno::RuntimeException(); - SwNode& rTxtNode = pUnoCrsr->GetPoint()->nNode.GetNode(); - SwAttrSet& rAttrSet = ((SwTxtNode&)rTxtNode).GetSwAttrSet(); - USHORT nAttrCount = rAttrSet.Count(); + //SwNode& rTxtNode = pUnoCrsr->GetPoint()->nNode.GetNode(); + //const SwAttrSet& rAttrSet = ((SwTxtNode&)rTxtNode).GetSwAttrSet(); + //USHORT nAttrCount = rAttrSet.Count(); sal_Int32 nProps = rPropertyNames.getLength(); const OUString *pProp = rPropertyNames.getConstArray(); - sal_Int32 nVals = rValues.getLength(); + //sal_Int32 nVals = rValues.getLength(); const uno::Any *pValue = rValues.getConstArray(); sal_Int32 nFailed = 0; - uno::Sequence< SetPropertyTolerantFailed > aFailed( nProps ); - SetPropertyTolerantFailed *pFailed = aFailed.getArray(); + uno::Sequence< beans::SetPropertyTolerantFailed > aFailed( nProps ); + beans::SetPropertyTolerantFailed *pFailed = aFailed.getArray(); // get entry to start with - const SfxItemPropertyMap* pStartEntry = aPropSet.getPropertyMap(); + const SfxItemPropertyMap* pPropMap = m_pPropSet->getPropertyMap(); OUString sTmp; SwParaSelection aParaSel( pUnoCrsr ); @@ -435,46 +427,41 @@ uno::Sequence< SetPropertyTolerantFailed > SAL_CALL SwXParagraph::setPropertyVal { try { - pFailed[ nFailed ].Name = pProp[i]; + pFailed[ nFailed ].Name = pProp[i]; - const SfxItemPropertyMap* pEntry = - SfxItemPropertyMap::GetByName( pStartEntry, pProp[i] ); + const SfxItemPropertySimpleEntry* pEntry = pPropMap->getByName( pProp[i] ); if (!pEntry) - pFailed[ nFailed++ ].Result = TolerantPropertySetResultType::UNKNOWN_PROPERTY; + pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY; else { // set property value // (compare to SwXParagraph::setPropertyValues) if (pEntry->nFlags & beans::PropertyAttribute::READONLY) - pFailed[ nFailed++ ].Result = TolerantPropertySetResultType::PROPERTY_VETO; + pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO; else { SwXTextCursor::SetPropertyValue( - *pUnoCrsr, aPropSet, sTmp, pValue[i], pEntry ); + *pUnoCrsr, *m_pPropSet, pProp[i], pValue[i] ); } - - // continue with search for next property after current entry - // (property map and sequence of property names are sorted!) - pStartEntry = ++pEntry; } } catch (beans::UnknownPropertyException &) { // should not occur because property was searched for before DBG_ERROR( "unexpected exception catched" ); - pFailed[ nFailed++ ].Result = TolerantPropertySetResultType::UNKNOWN_PROPERTY; + pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY; } catch (lang::IllegalArgumentException &) { - pFailed[ nFailed++ ].Result = TolerantPropertySetResultType::ILLEGAL_ARGUMENT; + pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT; } catch (beans::PropertyVetoException &) { - pFailed[ nFailed++ ].Result = TolerantPropertySetResultType::PROPERTY_VETO; + pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO; } catch (lang::WrappedTargetException &) { - pFailed[ nFailed++ ].Result = TolerantPropertySetResultType::WRAPPED_TARGET; + pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET; } } @@ -483,27 +470,27 @@ uno::Sequence< SetPropertyTolerantFailed > SAL_CALL SwXParagraph::setPropertyVal } -uno::Sequence< GetPropertyTolerantResult > SAL_CALL SwXParagraph::getPropertyValuesTolerant( +uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL SwXParagraph::getPropertyValuesTolerant( const uno::Sequence< OUString >& rPropertyNames ) throw (uno::RuntimeException) { vos::OGuard aGuard( Application::GetSolarMutex() ); - uno::Sequence< GetDirectPropertyTolerantResult > aTmpRes( + uno::Sequence< beans::GetDirectPropertyTolerantResult > aTmpRes( GetPropertyValuesTolerant_Impl( rPropertyNames, sal_False ) ); - const GetDirectPropertyTolerantResult *pTmpRes = aTmpRes.getConstArray(); + const beans::GetDirectPropertyTolerantResult *pTmpRes = aTmpRes.getConstArray(); // copy temporary result to final result type sal_Int32 nLen = aTmpRes.getLength(); - uno::Sequence< GetPropertyTolerantResult > aRes( nLen ); - GetPropertyTolerantResult *pRes = aRes.getArray(); + uno::Sequence< beans::GetPropertyTolerantResult > aRes( nLen ); + beans::GetPropertyTolerantResult *pRes = aRes.getArray(); for (sal_Int32 i = 0; i < nLen; i++) *pRes++ = *pTmpRes++; return aRes; } -uno::Sequence< GetDirectPropertyTolerantResult > SAL_CALL SwXParagraph::getDirectPropertyValuesTolerant( +uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXParagraph::getDirectPropertyValuesTolerant( const uno::Sequence< OUString >& rPropertyNames ) throw (uno::RuntimeException) { @@ -512,7 +499,7 @@ uno::Sequence< GetDirectPropertyTolerantResult > SAL_CALL SwXParagraph::getDirec } -uno::Sequence< GetDirectPropertyTolerantResult > SAL_CALL SwXParagraph::GetPropertyValuesTolerant_Impl( +uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXParagraph::GetPropertyValuesTolerant_Impl( const uno::Sequence< OUString >& rPropertyNames, sal_Bool bDirectValuesOnly ) throw (uno::RuntimeException) @@ -521,7 +508,7 @@ uno::Sequence< GetDirectPropertyTolerantResult > SAL_CALL SwXParagraph::GetPrope SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr(); if (!pUnoCrsr) - throw RuntimeException(); + throw uno::RuntimeException(); SwTxtNode* pTxtNode = pUnoCrsr->GetPoint()->nNode.GetNode().GetTxtNode(); DBG_ASSERT( pTxtNode != NULL, "need text node" ); @@ -534,40 +521,39 @@ uno::Sequence< GetDirectPropertyTolerantResult > SAL_CALL SwXParagraph::GetPrope sal_Int32 nProps = rPropertyNames.getLength(); const OUString *pProp = rPropertyNames.getConstArray(); - uno::Sequence< GetDirectPropertyTolerantResult > aResult( nProps ); - GetDirectPropertyTolerantResult *pResult = aResult.getArray(); + uno::Sequence< beans::GetDirectPropertyTolerantResult > aResult( nProps ); + beans::GetDirectPropertyTolerantResult *pResult = aResult.getArray(); sal_Int32 nIdx = 0; // get entry to start with - const SfxItemPropertyMap *pStartEntry = aPropSet.getPropertyMap(); + const SfxItemPropertyMap *pPropMap = m_pPropSet->getPropertyMap(); for (sal_Int32 i = 0; i < nProps; ++i) { DBG_ASSERT( nIdx < nProps, "index out ouf bounds" ); - GetDirectPropertyTolerantResult &rResult = pResult[nIdx]; + beans::GetDirectPropertyTolerantResult &rResult = pResult[nIdx]; try { rResult.Name = pProp[i]; - const SfxItemPropertyMap *pEntry = - SfxItemPropertyMap::GetByName( pStartEntry, pProp[i] ); + const SfxItemPropertySimpleEntry* pEntry = pPropMap->getByName( pProp[i] ); if (!pEntry) // property available? - rResult.Result = TolerantPropertySetResultType::UNKNOWN_PROPERTY; + rResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY; else { // get property state // (compare to SwXParagraph::getPropertyState) sal_Bool bAttrSetFetched = sal_True; - PropertyState eState = lcl_SwXParagraph_getPropertyState( + beans::PropertyState eState = lcl_SwXParagraph_getPropertyState( *pUnoCrsr, &pAttrSet, *pEntry, bAttrSetFetched ); rResult.State = eState; // if (bDirectValuesOnly && PropertyState_DIRECT_VALUE != eState) -// rResult.Result = TolerantPropertySetResultType::NO_DIRECT_VALUE; +// rResult.Result = beans::TolerantPropertySetResultType::NO_DIRECT_VALUE; // else - rResult.Result = TolerantPropertySetResultType::UNKNOWN_FAILURE; - if (!bDirectValuesOnly || PropertyState_DIRECT_VALUE == eState) + rResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_FAILURE; + if (!bDirectValuesOnly || beans::PropertyState_DIRECT_VALUE == eState) { // get property value // (compare to SwXParagraph::getPropertyValue(s)) @@ -578,46 +564,43 @@ uno::Sequence< GetDirectPropertyTolerantResult > SAL_CALL SwXParagraph::GetPrope // handle properties that are not part of the attribute // and thus only pretendend to be paragraph attributes BOOL bDone = FALSE; - PropertyState eTemp; + beans::PropertyState eTemp; bDone = SwUnoCursorHelper::getCrsrPropertyValue( - pEntry, *pUnoCrsr, &aValue, eTemp, pTxtNode ); + *pEntry, *pUnoCrsr, &aValue, eTemp, pTxtNode ); // if not found try the real paragraph attributes... if (!bDone) - aValue = aPropSet.getPropertyValue( *pEntry, rValueAttrSet ); + m_pPropSet->getPropertyValue( *pEntry, rValueAttrSet, aValue ); } rResult.Value = aValue; - rResult.Result = TolerantPropertySetResultType::SUCCESS; + rResult.Result = beans::TolerantPropertySetResultType::SUCCESS; nIdx++; } // this assertion should never occur! - DBG_ASSERT( nIdx < 1 || pResult[nIdx - 1].Result != TolerantPropertySetResultType::UNKNOWN_FAILURE, + DBG_ASSERT( nIdx < 1 || pResult[nIdx - 1].Result != beans::TolerantPropertySetResultType::UNKNOWN_FAILURE, "unknown failure while retrieving property" ); - // continue with search for next property after current entry - // (property map and sequence of property names are sorted!) - pStartEntry = ++pEntry; } } catch (beans::UnknownPropertyException &) { // should not occur because property was searched for before - DBG_ERROR( "unexpected exception catched" ); - rResult.Result = TolerantPropertySetResultType::UNKNOWN_PROPERTY; + DBG_ERROR( "unexpected exception caught" ); + rResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY; } catch (lang::IllegalArgumentException &) { - rResult.Result = TolerantPropertySetResultType::ILLEGAL_ARGUMENT; + rResult.Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT; } catch (beans::PropertyVetoException &) { - rResult.Result = TolerantPropertySetResultType::PROPERTY_VETO; + rResult.Result = beans::TolerantPropertySetResultType::PROPERTY_VETO; } catch (lang::WrappedTargetException &) { - rResult.Result = TolerantPropertySetResultType::WRAPPED_TARGET; + rResult.Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET; } } @@ -627,9 +610,6 @@ uno::Sequence< GetDirectPropertyTolerantResult > SAL_CALL SwXParagraph::GetPrope return aResult; } - -*/ - /* -----------------------------12.09.00 11:09-------------------------------- ---------------------------------------------------------------------------*/ @@ -699,7 +679,7 @@ void SwXParagraph::removeVetoableChangeListener(const OUString& /*PropertyName*/ beans::PropertyState lcl_SwXParagraph_getPropertyState( SwUnoCrsr& rUnoCrsr, const SwAttrSet** ppSet, - const SfxItemPropertyMap& rMap, + const SfxItemPropertySimpleEntry& rEntry, sal_Bool &rAttrSetFetched ) throw( beans::UnknownPropertyException) { @@ -711,7 +691,7 @@ beans::PropertyState lcl_SwXParagraph_getPropertyState( (*ppSet) = ((SwTxtNode&)rTxtNode).GetpSwAttrSet(); rAttrSetFetched = sal_True; } - switch( rMap.nWID ) + switch( rEntry.nWID ) { case FN_UNO_NUM_RULES: //wenn eine Numerierung gesetzt ist, dann hier herausreichen, sonst nichts tun @@ -720,18 +700,18 @@ beans::PropertyState lcl_SwXParagraph_getPropertyState( case FN_UNO_ANCHOR_TYPES: break; case RES_ANCHOR: - if ( MID_SURROUND_SURROUNDTYPE != rMap.nMemberId ) + if ( MID_SURROUND_SURROUNDTYPE != rEntry.nMemberId ) goto lcl_SwXParagraph_getPropertyStateDEFAULT; break; case RES_SURROUND: - if ( MID_ANCHOR_ANCHORTYPE != rMap.nMemberId ) + if ( MID_ANCHOR_ANCHORTYPE != rEntry.nMemberId ) goto lcl_SwXParagraph_getPropertyStateDEFAULT; break; case FN_UNO_PARA_STYLE: case FN_UNO_PARA_CONDITIONAL_STYLE_NAME: { SwFmtColl* pFmt = SwXTextCursor::GetCurTxtFmtColl( - rUnoCrsr, rMap.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME); + rUnoCrsr, rEntry.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME); eRet = pFmt ? beans::PropertyState_DIRECT_VALUE : beans::PropertyState_AMBIGUOUS_VALUE; } @@ -746,7 +726,7 @@ beans::PropertyState lcl_SwXParagraph_getPropertyState( break; lcl_SwXParagraph_getPropertyStateDEFAULT: default: - if((*ppSet) && SFX_ITEM_SET == (*ppSet)->GetItemState(rMap.nWID, FALSE)) + if((*ppSet) && SFX_ITEM_SET == (*ppSet)->GetItemState(rEntry.nWID, FALSE)) eRet = beans::PropertyState_DIRECT_VALUE; break; } @@ -765,12 +745,11 @@ beans::PropertyState SwXParagraph::getPropertyState(const OUString& rPropertyNam if( pUnoCrsr ) { const SwAttrSet* pSet = 0; - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName ); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); + if(!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); sal_Bool bDummy = sal_False; - eRet = lcl_SwXParagraph_getPropertyState( *pUnoCrsr, &pSet, *pMap, + eRet = lcl_SwXParagraph_getPropertyState( *pUnoCrsr, &pSet, *pEntry, bDummy ); } else @@ -791,22 +770,22 @@ uno::Sequence< beans::PropertyState > SwXParagraph::getPropertyStates( beans::PropertyState* pStates = aRet.getArray(); SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr(); - const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap(); + const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap(); if( pUnoCrsr ) { const SwAttrSet* pSet = 0; sal_Bool bAttrSetFetched = sal_False; - for(sal_Int32 i = 0, nEnd = PropertyNames.getLength(); i < nEnd; i++,++pStates,++pMap,++pNames ) + for(sal_Int32 i = 0, nEnd = PropertyNames.getLength(); i < nEnd; i++,++pStates,++pNames ) { - pMap = SfxItemPropertyMap::GetByName( pMap, *pNames ); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( *pNames ); + if(!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + *pNames, static_cast < cppu::OWeakObject * > ( this ) ); if (bAttrSetFetched && !pSet && - pMap->nWID >= RES_CHRATR_BEGIN && - pMap->nWID <= RES_UNKNOWNATR_END ) + pEntry->nWID >= RES_CHRATR_BEGIN && + pEntry->nWID <= RES_UNKNOWNATR_END ) *pStates = beans::PropertyState_DEFAULT_VALUE; else - *pStates = lcl_SwXParagraph_getPropertyState( *pUnoCrsr, &pSet,*pMap, bAttrSetFetched ); + *pStates = lcl_SwXParagraph_getPropertyState( *pUnoCrsr, &pSet,*pEntry, bAttrSetFetched ); } } else @@ -831,18 +810,17 @@ void SwXParagraph::setPropertyToDefault(const OUString& rPropertyName) // Absatz selektieren SwParaSelection aParaSel(pUnoCrsr); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); + if(pEntry) { - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw uno::RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only:" ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if(pMap->nWID < RES_FRMATR_END) + if(pEntry->nWID < RES_FRMATR_END) { SvUShortsSort aWhichIds; - aWhichIds.Insert(pMap->nWID); - if(pMap->nWID < RES_PARATR_BEGIN) + aWhichIds.Insert(pEntry->nWID); + if(pEntry->nWID < RES_PARATR_BEGIN) pUnoCrsr->GetDoc()->ResetAttrs(*pUnoCrsr, sal_True, &aWhichIds); else { @@ -868,7 +846,7 @@ void SwXParagraph::setPropertyToDefault(const OUString& rPropertyName) } } else - SwUnoCursorHelper::resetCrsrPropertyValue(pMap, *pUnoCrsr); + SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry, *pUnoCrsr); } else throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); @@ -889,15 +867,14 @@ uno::Any SwXParagraph::getPropertyDefault(const OUString& rPropertyName) if(SwXParagraph::getDefaultTextContentValue(aRet, rPropertyName)) return aRet; - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); + if(pEntry) { - if(pMap->nWID < RES_FRMATR_END) + if(pEntry->nWID < RES_FRMATR_END) { const SfxPoolItem& rDefItem = - pUnoCrsr->GetDoc()->GetAttrPool().GetDefaultItem(pMap->nWID); - rDefItem.QueryValue(aRet, pMap->nMemberId); + pUnoCrsr->GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID); + rDefItem.QueryValue(aRet, pEntry->nMemberId); } } else diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index 980d7893229c..6fcff2505136 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -51,15 +51,9 @@ #include <fmtflcnt.hxx> #include <fmtfld.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> -//#ifndef _COM_SUN_STAR_BEANS_SETPROPERTYTOLERANTFAILED_HPP_ -//#include <com/sun/star/beans/SetPropertyTolerantFailed.hpp> -//#endif -//#ifndef _COM_SUN_STAR_BEANS_GETPROPERTYTOLERANTRESULT_HPP_ -//#include <com/sun/star/beans/GetPropertyTolerantResult.hpp> -//#endif -//#ifndef _COM_SUN_STAR_BEANS_TOLERANTPROPERTYSETRESULTTYPE_HPP_ -//#include <com/sun/star/beans/TolerantPropertySetResultType.hpp> -//#endif +#include <com/sun/star/beans/SetPropertyTolerantFailed.hpp> +#include <com/sun/star/beans/GetPropertyTolerantResult.hpp> +#include <com/sun/star/beans/TolerantPropertySetResultType.hpp> using namespace ::com::sun::star; using ::rtl::OUString; @@ -95,7 +89,7 @@ SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr, uno::Reference< text::XText > & rParent, SwTextPortionType eType) : aLstnrCntnr( (text::XTextRange*)this), - aPropSet(aSwMapProvider.GetPropertyMap( + m_pPropSet(aSwMapProvider.GetPropertySet( (PORTION_REDLINE_START == eType || PORTION_REDLINE_END == eType) ? PROPERTY_MAP_REDLINE_PORTION : PROPERTY_MAP_TEXTPORTION_EXTENSIONS)), @@ -130,7 +124,7 @@ SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr, SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr, uno::Reference< text::XText > & rParent, SwFrmFmt& rFmt ) : aLstnrCntnr( (text::XTextRange*)this), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXTPORTION_EXTENSIONS)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXTPORTION_EXTENSIONS)), xParentText(rParent), pRubyText(0), pRubyStyle(0), @@ -250,12 +244,12 @@ uno::Reference< beans::XPropertySetInfo > SwXTextPortion::getPropertySetInfo(vo { //! PropertySetInfo for text portion extensions static uno::Reference< beans::XPropertySetInfo > - xTxtPorExtRef = SfxItemPropertySet( aSwMapProvider.GetPropertyMap( - PROPERTY_MAP_TEXTPORTION_EXTENSIONS) ).getPropertySetInfo(); + xTxtPorExtRef = aSwMapProvider.GetPropertySet( + PROPERTY_MAP_TEXTPORTION_EXTENSIONS)->getPropertySetInfo(); //! PropertySetInfo for redline portions static uno::Reference< beans::XPropertySetInfo > - xRedlPorRef = SfxItemPropertySet( aSwMapProvider.GetPropertyMap( - PROPERTY_MAP_REDLINE_PORTION) ).getPropertySetInfo(); + xRedlPorRef = aSwMapProvider.GetPropertySet( + PROPERTY_MAP_REDLINE_PORTION)->getPropertySetInfo(); return (PORTION_REDLINE_START == ePortionType || PORTION_REDLINE_END == ePortionType) ? xRedlPorRef : xTxtPorExtRef; @@ -272,7 +266,7 @@ void SwXTextPortion::setPropertyValue(const OUString& rPropertyName, SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr(); if(pUnoCrsr) { - SwXTextCursor::SetPropertyValue(*pUnoCrsr, aPropSet, rPropertyName, aValue); + SwXTextCursor::SetPropertyValue(*pUnoCrsr, *m_pPropSet, rPropertyName, aValue); } else throw uno::RuntimeException(); @@ -282,16 +276,16 @@ void SwXTextPortion::setPropertyValue(const OUString& rPropertyName, -----------------------------------------------------------------------*/ void SwXTextPortion::GetPropertyValue( uno::Any &rVal, - const SfxItemPropertyMap *pEntry, + const SfxItemPropertySimpleEntry& rEntry, SwUnoCrsr *pUnoCrsr, SfxItemSet *&pSet ) { DBG_ASSERT( pUnoCrsr, "UNO cursor missing" ); if (!pUnoCrsr) return; - if (pEntry && pUnoCrsr) + if(pUnoCrsr) { - switch(pEntry->nWID) + switch(rEntry.nWID) { case FN_UNO_TEXT_PORTION_TYPE: { @@ -400,7 +394,7 @@ void SwXTextPortion::GetPropertyValue( case RES_TXTATR_CJK_RUBY: { uno::Any* pToSet = 0; - switch(pEntry->nMemberId) + switch(rEntry.nMemberId) { case MID_RUBY_TEXT : pToSet = pRubyText; break; case MID_RUBY_ADJUST : pToSet = pRubyAdjust; break; @@ -414,7 +408,7 @@ void SwXTextPortion::GetPropertyValue( default: beans::PropertyState eTemp; BOOL bDone = SwUnoCursorHelper::getCrsrPropertyValue( - pEntry, *pUnoCrsr, &(rVal), eTemp ); + rEntry, *pUnoCrsr, &(rVal), eTemp ); if(!bDone) { if(!pSet) @@ -426,7 +420,7 @@ void SwXTextPortion::GetPropertyValue( 0L); SwXTextCursor::GetCrsrAttr(*pUnoCrsr, *pSet); } - rVal = aPropSet.getPropertyValue(*pEntry, *pSet); + m_pPropSet->getPropertyValue(rEntry, *pSet, rVal); } } } @@ -447,14 +441,13 @@ uno::Sequence< uno::Any > SAL_CALL SwXTextPortion::GetPropertyValues_Impl( SfxItemSet *pSet = 0; // get startting pount fo the look-up, either the provided one or else // from the beginning of the map - const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap(); + const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap(); for(sal_Int32 nProp = 0; nProp < nLength; nProp++) { - pMap = SfxItemPropertyMap::GetByName(pMap, pPropertyNames[nProp]); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(pPropertyNames[nProp]); + if(pEntry) { - GetPropertyValue( pValues[nProp], pMap, pUnoCrsr, pSet ); - pMap++; + GetPropertyValue( pValues[nProp], *pEntry, pUnoCrsr, pSet ); } else throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); @@ -491,17 +484,16 @@ void SAL_CALL SwXTextPortion::SetPropertyValues_Impl( { const OUString* pPropertyNames = rPropertyNames.getConstArray(); const uno::Any* pValues = rValues.getConstArray(); - const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap(); - OUString sTmp; + const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap(); for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { - pMap = SfxItemPropertyMap::GetByName(pMap, pPropertyNames[nProp]); - if (!pMap) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(pPropertyNames[nProp]); + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - SwXTextCursor::SetPropertyValue( *pUnoCrsr, aPropSet, sTmp, pValues[nProp], pMap); + SwXTextCursor::SetPropertyValue( *pUnoCrsr, *m_pPropSet, pPropertyNames[nProp], pValues[nProp]); } } else @@ -560,9 +552,9 @@ uno::Sequence< uno::Any > SwXTextPortion::getPropertyValues( ---------------------------------------------------------------------------*/ -/* disabled for #i46921# +/* disabled for #i46921# */ -uno::Sequence< SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPropertyValuesTolerant( +uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPropertyValuesTolerant( const uno::Sequence< OUString >& rPropertyNames, const uno::Sequence< uno::Any >& rValues ) throw (lang::IllegalArgumentException, uno::RuntimeException) @@ -578,15 +570,14 @@ uno::Sequence< SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPropertyV sal_Int32 nProps = rPropertyNames.getLength(); const OUString *pProp = rPropertyNames.getConstArray(); - sal_Int32 nVals = rValues.getLength(); + //sal_Int32 nVals = rValues.getLength(); const uno::Any *pValue = rValues.getConstArray(); sal_Int32 nFailed = 0; - uno::Sequence< SetPropertyTolerantFailed > aFailed( nProps ); - SetPropertyTolerantFailed *pFailed = aFailed.getArray(); + uno::Sequence< beans::SetPropertyTolerantFailed > aFailed( nProps ); + beans::SetPropertyTolerantFailed *pFailed = aFailed.getArray(); - // get entry to start with - const SfxItemPropertyMap* pStartEntry = aPropSet.getPropertyMap(); + const SfxItemPropertyMap* pPropMap = m_pPropSet->getPropertyMap(); OUString sTmp; for (sal_Int32 i = 0; i < nProps; ++i) @@ -595,44 +586,39 @@ uno::Sequence< SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPropertyV { pFailed[ nFailed ].Name = pProp[i]; - const SfxItemPropertyMap *pEntry = - SfxItemPropertyMap::GetByName( pStartEntry, pProp[i] ); + const SfxItemPropertySimpleEntry* pEntry = pPropMap->getByName( pProp[i] ); if (!pEntry) - pFailed[ nFailed++ ].Result = TolerantPropertySetResultType::UNKNOWN_PROPERTY; + pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY; else { // set property value // (compare to SwXTextPortion::setPropertyValues) if (pEntry->nFlags & beans::PropertyAttribute::READONLY) - pFailed[ nFailed++ ].Result = TolerantPropertySetResultType::PROPERTY_VETO; + pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO; else { SwXTextCursor::SetPropertyValue( - *pUnoCrsr, aPropSet, sTmp, pValue[i], pEntry ); + *pUnoCrsr, *m_pPropSet, pProp[i], pValue[i] ); } - - // continue with search for next property after current entry - // (property map and sequence of property names are sorted!) - pStartEntry = ++pEntry; } } catch (beans::UnknownPropertyException &) { // should not occur because property was searched for before DBG_ERROR( "unexpected exception catched" ); - pFailed[ nFailed++ ].Result = TolerantPropertySetResultType::UNKNOWN_PROPERTY; + pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY; } catch (lang::IllegalArgumentException &) { - pFailed[ nFailed++ ].Result = TolerantPropertySetResultType::ILLEGAL_ARGUMENT; + pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT; } catch (beans::PropertyVetoException &) { - pFailed[ nFailed++ ].Result = TolerantPropertySetResultType::PROPERTY_VETO; + pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO; } catch (lang::WrappedTargetException &) { - pFailed[ nFailed++ ].Result = TolerantPropertySetResultType::WRAPPED_TARGET; + pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET; } } @@ -641,27 +627,27 @@ uno::Sequence< SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPropertyV } -uno::Sequence< GetPropertyTolerantResult > SAL_CALL SwXTextPortion::getPropertyValuesTolerant( +uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL SwXTextPortion::getPropertyValuesTolerant( const uno::Sequence< OUString >& rPropertyNames ) throw (uno::RuntimeException) { vos::OGuard aGuard( Application::GetSolarMutex() ); - uno::Sequence< GetDirectPropertyTolerantResult > aTmpRes( + uno::Sequence< beans::GetDirectPropertyTolerantResult > aTmpRes( GetPropertyValuesTolerant_Impl( rPropertyNames, sal_False ) ); - const GetDirectPropertyTolerantResult *pTmpRes = aTmpRes.getConstArray(); + const beans::GetDirectPropertyTolerantResult *pTmpRes = aTmpRes.getConstArray(); // copy temporary result to final result type sal_Int32 nLen = aTmpRes.getLength(); - uno::Sequence< GetPropertyTolerantResult > aRes( nLen ); - GetPropertyTolerantResult *pRes = aRes.getArray(); + uno::Sequence< beans::GetPropertyTolerantResult > aRes( nLen ); + beans::GetPropertyTolerantResult *pRes = aRes.getArray(); for (sal_Int32 i = 0; i < nLen; i++) *pRes++ = *pTmpRes++; return aRes; } -uno::Sequence< GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion::getDirectPropertyValuesTolerant( +uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion::getDirectPropertyValuesTolerant( const uno::Sequence< OUString >& rPropertyNames ) throw (uno::RuntimeException) { @@ -670,7 +656,7 @@ uno::Sequence< GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion::getDir } -uno::Sequence< GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion::GetPropertyValuesTolerant_Impl( +uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion::GetPropertyValuesTolerant_Impl( const uno::Sequence< OUString >& rPropertyNames, sal_Bool bDirectValuesOnly ) throw (uno::RuntimeException) @@ -684,93 +670,84 @@ uno::Sequence< GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion::GetPro sal_Int32 nProps = rPropertyNames.getLength(); const OUString *pProp = rPropertyNames.getConstArray(); - uno::Sequence< GetDirectPropertyTolerantResult > aResult( nProps ); - GetDirectPropertyTolerantResult *pResult = aResult.getArray(); - sal_Int32 nIdx = 0; - SfxItemSet *pSet = 0; - // get entry to start with - const SfxItemPropertyMap* pStartEntry = aPropSet.getPropertyMap(); + const SfxItemPropertyMap* pPropMap = m_pPropSet->getPropertyMap(); + + uno::Sequence< beans::PropertyState > aPropertyStates = SwXTextCursor::GetPropertyStates( + *pUnoCrsr, *m_pPropSet, + rPropertyNames, + SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT ); + const beans::PropertyState* pPropertyStates = aPropertyStates.getConstArray(); + std::vector< beans::GetDirectPropertyTolerantResult > aResultVector; for (sal_Int32 i = 0; i < nProps; ++i) { - DBG_ASSERT( nIdx < nProps, "index out ouf bounds" ); - beans::GetDirectPropertyTolerantResult &rResult = pResult[nIdx]; - + beans::GetDirectPropertyTolerantResult aResult; try { - rResult.Name = pProp[i]; - - const SfxItemPropertyMap *pEntry = - SfxItemPropertyMap::GetByName( pStartEntry, pProp[i] ); - if (!pEntry) // property available? - rResult.Result = TolerantPropertySetResultType::UNKNOWN_PROPERTY; - else + aResult.Name = pProp[i]; + if(pPropertyStates[i] == beans::PropertyState_MAKE_FIXED_SIZE) // property unknown? { - // get property state - // (compare to SwXTextPortion::getPropertyState) - beans::PropertyState eState; - if (GetTextPortionType() == PORTION_RUBY_START && - !pProp[i].compareToAscii( RTL_CONSTASCII_STRINGPARAM( "Ruby" ) )) - eState = beans::PropertyState_DIRECT_VALUE; + if( bDirectValuesOnly ) + continue; else - eState = SwXTextCursor::GetPropertyState( *pUnoCrsr, aPropSet, pProp[i] ); - rResult.State = eState; - -// if (bDirectValuesOnly && beans::PropertyState_DIRECT_VALUE != eState) -// rResult.Result = TolerantPropertySetResultType::NO_DIRECT_VALUE; -// else - rResult.Result = TolerantPropertySetResultType::UNKNOWN_FAILURE; - if (!bDirectValuesOnly || beans::PropertyState_DIRECT_VALUE == eState) + aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY; + } + else + { + const SfxItemPropertySimpleEntry* pEntry = pPropMap->getByName( pProp[i] ); + aResult.State = pPropertyStates[i]; + + aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_FAILURE; + if (!bDirectValuesOnly || beans::PropertyState_DIRECT_VALUE == aResult.State) { // get property value // (compare to SwXTextPortion::getPropertyValue(s)) - GetPropertyValue( rResult.Value, pEntry, pUnoCrsr, pSet ); - rResult.Result = TolerantPropertySetResultType::SUCCESS; - - nIdx++; + GetPropertyValue( aResult.Value, *pEntry, pUnoCrsr, pSet ); + aResult.Result = beans::TolerantPropertySetResultType::SUCCESS; + aResultVector.push_back( aResult ); } // this assertion should never occur! - DBG_ASSERT( nIdx < 1 || pResult[nIdx - 1].Result != TolerantPropertySetResultType::UNKNOWN_FAILURE, + DBG_ASSERT( !aResultVector.size() || aResult.Result != beans::TolerantPropertySetResultType::UNKNOWN_FAILURE, "unknown failure while retrieving property" ); - // continue with search for next property after current entry - // (property map and sequence of property names are sorted!) - pStartEntry = ++pEntry; } } catch (beans::UnknownPropertyException &) { // should not occur because property was searched for before DBG_ERROR( "unexpected exception catched" ); - rResult.Result = TolerantPropertySetResultType::UNKNOWN_PROPERTY; + aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY; } catch (lang::IllegalArgumentException &) { - rResult.Result = TolerantPropertySetResultType::ILLEGAL_ARGUMENT; + aResult.Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT; } catch (beans::PropertyVetoException &) { - rResult.Result = TolerantPropertySetResultType::PROPERTY_VETO; + aResult.Result = beans::TolerantPropertySetResultType::PROPERTY_VETO; } catch (lang::WrappedTargetException &) { - rResult.Result = TolerantPropertySetResultType::WRAPPED_TARGET; + aResult.Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET; } } delete pSet; - // resize to actually used size - aResult.realloc( nIdx ); + uno::Sequence< beans::GetDirectPropertyTolerantResult > aResult( aResultVector.size() ); + std::vector< beans::GetDirectPropertyTolerantResult >::const_iterator aIt = aResultVector.begin(); + beans::GetDirectPropertyTolerantResult *pResult = aResult.getArray(); + for( sal_Int32 nResult = 0; nResult < aResult.getLength(); ++nResult ) + { + pResult[nResult] = *aIt; + ++aIt; + } return aResult; } -*/ - - /* -----------------------------02.04.01 11:44-------------------------------- ---------------------------------------------------------------------------*/ @@ -840,7 +817,7 @@ beans::PropertyState SwXTextPortion::getPropertyState(const OUString& rPropertyN !rPropertyName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("Ruby") )) eRet = beans::PropertyState_DIRECT_VALUE; else - eRet = SwXTextCursor::GetPropertyState(*pUnoCrsr, aPropSet, rPropertyName); + eRet = SwXTextCursor::GetPropertyState(*pUnoCrsr, *m_pPropSet, rPropertyName); } else throw uno::RuntimeException(); @@ -857,7 +834,7 @@ uno::Sequence< beans::PropertyState > SwXTextPortion::getPropertyStates( SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr(); if(!pUnoCrsr) throw uno::RuntimeException(); - uno::Sequence< beans::PropertyState > aRet = SwXTextCursor::GetPropertyStates(*pUnoCrsr, aPropSet, rPropertyNames, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION); + uno::Sequence< beans::PropertyState > aRet = SwXTextCursor::GetPropertyStates(*pUnoCrsr, *m_pPropSet, rPropertyNames, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION); if(GetTextPortionType() == PORTION_RUBY_START) { @@ -881,7 +858,7 @@ void SwXTextPortion::setPropertyToDefault(const OUString& rPropertyName) SwUnoCrsr* pUnoCrsr = GetCrsr(); if(pUnoCrsr) { - SwXTextCursor::SetPropertyToDefault(*pUnoCrsr, aPropSet, rPropertyName); + SwXTextCursor::SetPropertyToDefault(*pUnoCrsr, *m_pPropSet, rPropertyName); } else throw uno::RuntimeException(); @@ -896,7 +873,7 @@ uno::Any SwXTextPortion::getPropertyDefault(const OUString& rPropertyName) SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr(); if(pUnoCrsr) { - aRet = SwXTextCursor::GetPropertyDefault(*pUnoCrsr, aPropSet, rPropertyName); + aRet = SwXTextCursor::GetPropertyDefault(*pUnoCrsr, *m_pPropSet, rPropertyName); } else throw uno::RuntimeException(); diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 30e476b9af25..eee230794051 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -32,7 +32,7 @@ #include "precompiled_sw.hxx" -#include <bookmrk.hxx> +#include <IMark.hxx> // --> OD 2007-10-23 #i81002# #include <crossrefbookmark.hxx> // <-- @@ -54,14 +54,117 @@ #include <vos/mutex.hxx> #include <vcl/svapp.hxx> #include <set> -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED #include <boost/shared_ptr.hpp> -#endif +#include <boost/bind.hpp> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::text; using ::rtl::OUString; using namespace ::std; + +namespace +{ + static const BYTE BKM_TYPE_START = 0; + static const BYTE BKM_TYPE_END = 1; + static const BYTE BKM_TYPE_START_END = 2; + + struct SwXBookmarkPortion_Impl + { + Reference<XTextContent> xBookmark; + BYTE nBkmType; + const SwPosition aPosition; + + SwXBookmarkPortion_Impl( SwXBookmark* pXMark, BYTE nType, const SwPosition &rPosition ) + : xBookmark ( pXMark ) + , nBkmType ( nType ) + , aPosition ( rPosition ) + { + } + ULONG getIndex () + { + return aPosition.nContent.GetIndex(); + } + }; + typedef boost::shared_ptr < SwXBookmarkPortion_Impl > SwXBookmarkPortion_ImplSharedPtr; + struct BookmarkCompareStruct + { + bool operator () ( const SwXBookmarkPortion_ImplSharedPtr &r1, + const SwXBookmarkPortion_ImplSharedPtr &r2 ) + { + // #i16896# for bookmark portions at the same position, the start should + // always precede the end. Hence compare positions, and use bookmark type + // as tie-breaker for same position. + // return ( r1->nIndex == r2->nIndex ) + // ? ( r1->nBkmType < r2->nBkmType ) + // : ( r1->nIndex < r2->nIndex ); + + // MTG: 25/11/05: Note that the above code does not correctly handle + // the case when one bookmark ends, and another begins in the same + // position. When this occurs, the above code will return the + // the start of the 2nd bookmark BEFORE the end of the first bookmark + // See bug #i58438# for more details. The below code is correct and + // fixes both #i58438 and #i16896# + return r1->aPosition < r2->aPosition; + } + }; + typedef std::multiset < SwXBookmarkPortion_ImplSharedPtr, BookmarkCompareStruct > SwXBookmarkPortion_ImplList; + + + static void lcl_FillBookmarkArray(SwDoc& rDoc, SwUnoCrsr& rUnoCrsr, SwXBookmarkPortion_ImplList& rBkmArr) + { + IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess(); + if(!pMarkAccess->getBookmarksCount()) + return; + + // no need to consider marks starting after aEndOfPara + SwPosition aEndOfPara(*rUnoCrsr.GetPoint()); + aEndOfPara.nContent = aEndOfPara.nNode.GetNode().GetTxtNode()->Len(); + const IDocumentMarkAccess::const_iterator_t pCandidatesEnd = upper_bound( + pMarkAccess->getBookmarksBegin(), + pMarkAccess->getBookmarksEnd(), + aEndOfPara, + bind(&::sw::mark::IMark::StartsAfter, _2, _1)); // finds the first that starts after + + // search for all bookmarks that start or end in this paragraph + const SwNodeIndex nOwnNode = rUnoCrsr.GetPoint()->nNode; + for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin(); + ppMark != pCandidatesEnd; + ++ppMark) + { + ::sw::mark::IMark* const pBkmk = ppMark->get(); + bool hasOther = pBkmk->IsExpanded(); + + const SwPosition& rStartPos = pBkmk->GetMarkStart(); + if(rStartPos.nNode == nOwnNode) + { + const BYTE nType = hasOther ? BKM_TYPE_START : BKM_TYPE_START_END; + rBkmArr.insert(SwXBookmarkPortion_ImplSharedPtr( + new SwXBookmarkPortion_Impl ( SwXBookmarks::GetObject(*pBkmk, &rDoc ), nType, rStartPos))); + } + + const SwPosition& rEndPos = pBkmk->GetMarkEnd(); + if(rEndPos.nNode == nOwnNode) + { + auto_ptr<SwPosition> pCrossRefEndPos; + const SwPosition* pEndPos = NULL; + if(hasOther) + pEndPos = &rEndPos; + else if(dynamic_cast< ::sw::mark::CrossRefBookmark*>(pBkmk)) + { + // Crossrefbookmarks only remember the start position but have to span the whole paragraph + pCrossRefEndPos = auto_ptr<SwPosition>(new SwPosition(rEndPos)); + pCrossRefEndPos->nContent = pCrossRefEndPos->nNode.GetNode().GetTxtNode()->Len(); + pEndPos = pCrossRefEndPos.get(); + } + if(pEndPos) + rBkmArr.insert(SwXBookmarkPortion_ImplSharedPtr( + new SwXBookmarkPortion_Impl ( SwXBookmarks::GetObject(*pBkmk, &rDoc ), BKM_TYPE_END, *pEndPos))); + } + } + } +} + /****************************************************************** * SwXTextPortionEnumeration ******************************************************************/ @@ -246,51 +349,6 @@ void lcl_InsertTOXMarkPortion( pPortion->SetTOXMark(xContent); } } -//----------------------------------------------------------------------------- -#define BKM_TYPE_START 0 -#define BKM_TYPE_END 1 -#define BKM_TYPE_START_END 2 -struct SwXBookmarkPortion_Impl -{ - Reference<XTextContent> xBookmark; - BYTE nBkmType; - const SwPosition aPosition; - - SwXBookmarkPortion_Impl( SwXBookmark* pXMark, BYTE nType, const SwPosition &rPosition ) - : xBookmark ( pXMark ) - , nBkmType ( nType ) - , aPosition ( rPosition ) - { - } - ULONG getIndex () - { - return aPosition.nContent.GetIndex(); - } -}; - -typedef boost::shared_ptr < SwXBookmarkPortion_Impl > SwXBookmarkPortion_ImplSharedPtr; -struct BookmarkCompareStruct -{ - bool operator () ( const SwXBookmarkPortion_ImplSharedPtr &r1, - const SwXBookmarkPortion_ImplSharedPtr &r2 ) - { - // #i16896# for bookmark portions at the same position, the start should - // always precede the end. Hence compare positions, and use bookmark type - // as tie-breaker for same position. - // return ( r1->nIndex == r2->nIndex ) - // ? ( r1->nBkmType < r2->nBkmType ) - // : ( r1->nIndex < r2->nIndex ); - - // MTG: 25/11/05: Note that the above code does not correctly handle - // the case when one bookmark ends, and another begins in the same - // position. When this occurs, the above code will return the - // the start of the 2nd bookmark BEFORE the end of the first bookmark - // See bug #i58438# for more details. The below code is correct and - // fixes both #i58438 and #i16896# - return r1->aPosition < r2->aPosition; - } -}; -typedef std::multiset < SwXBookmarkPortion_ImplSharedPtr, BookmarkCompareStruct > SwXBookmarkPortion_ImplList; //----------------------------------------------------------------------------- void lcl_ExportBookmark( @@ -641,79 +699,7 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints, } return xRef; } -//----------------------------------------------------------------------------- -void lcl_FillBookmarkArray(SwDoc& rDoc,SwUnoCrsr& rUnoCrsr, SwXBookmarkPortion_ImplList& rBkmArr ) -{ - const SwBookmarks& rMarks = rDoc.getBookmarks(); - sal_uInt16 nArrLen = rMarks.Count(); - if ( nArrLen > 0 ) - { - const SwNodeIndex nOwnNode = rUnoCrsr.GetPoint()->nNode; - //search for all bookmarks that start or end in this paragraph - for( sal_uInt16 n = 0; n < nArrLen; ++n ) - { - SwBookmark* pMark = rMarks.GetObject( n ); - /* - if (pMark!=NULL && pMark->GetName().CompareToAscii(FIELD_BOOKMARK_PREFIX, strlen(FIELD_BOOKMARK_PREFIX))==0) { - continue; - } - - if (pMark!=NULL && pMark->GetName().CompareToAscii(FIELD_FORM_BOOKMARK_PREFIX, strlen(FIELD_FORM_BOOKMARK_PREFIX))==0) { - continue; - } - */ - if (pMark!=NULL && pMark->IsFormFieldMark()) - { - continue; - } - // --> OD 2007-10-23 #i81002# - if ( !pMark->IsBookMark() && - !dynamic_cast<SwCrossRefBookmark*>(pMark) ) - continue; - - const SwPosition& rPos1 = pMark->GetBookmarkPos(); - // --> OD 2007-10-23 #i81002# -// const SwPosition* pPos2 = pMark->GetOtherBookmarkPos(); - const SwPosition* pPos2( 0 ); - SwPosition* pCrossRefBkmkPos2( 0 ); - if ( dynamic_cast<SwCrossRefBookmark*>(pMark) ) - { - pCrossRefBkmkPos2 = new SwPosition( pMark->GetBookmarkPos() ); - pCrossRefBkmkPos2->nContent = - pCrossRefBkmkPos2->nNode.GetNode().GetTxtNode()->Len(); - pPos2 = pCrossRefBkmkPos2; - } - else - { - pPos2 = pMark->GetOtherBookmarkPos(); - } - // <-- - BOOL bBackward = pPos2 ? rPos1 > *pPos2: FALSE; - if(rPos1.nNode == nOwnNode) - { - BYTE nType = bBackward ? BKM_TYPE_END : BKM_TYPE_START; - if(!pPos2) - { - nType = BKM_TYPE_START_END; - } - - rBkmArr.insert ( SwXBookmarkPortion_ImplSharedPtr ( - new SwXBookmarkPortion_Impl ( SwXBookmarks::GetObject( *pMark, &rDoc ), nType, rPos1 ))); - - } - if(pPos2 && pPos2->nNode == nOwnNode) - { - BYTE nType = bBackward ? BKM_TYPE_START : BKM_TYPE_END; - rBkmArr.insert( SwXBookmarkPortion_ImplSharedPtr ( - new SwXBookmarkPortion_Impl( SwXBookmarks::GetObject( *pMark, &rDoc ), nType, *pPos2 ) ) ); - } - // --> OD 2007-10-23 #i81002# - delete pCrossRefBkmkPos2; - // <-- - } - } -} //----------------------------------------------------------------------------- void lcl_FillRedlineArray(SwDoc& rDoc,SwUnoCrsr& rUnoCrsr, SwXRedlinePortion_ImplList& rRedArr ) { @@ -960,7 +946,6 @@ void SwXTextPortionEnumeration::CreatePortions() aRedArr, aBreakArr, nEndPos); - } else if(USHRT_MAX != nFirstFrameIndex) { @@ -1029,40 +1014,40 @@ void SwXTextPortionEnumeration::CreatePortions() } if (start+1==end && pTxtNode->GetTxt().GetChar(start)==CH_TXT_ATR_FIELDSTART) { - SwBookmark* pFieldmark=NULL; + ::sw::mark::IFieldmark* pFieldmark = NULL; if (pDoc && pUnoCrsr->GetPoint()) - pFieldmark=pDoc->getFieldBookmarkFor(*pUnoCrsr->GetPoint()); - SwXTextPortion* pPortion=NULL; - xRef = (pPortion=new SwXTextPortion(pUnoCrsr, xParent, PORTION_FIELD_START)); + pFieldmark = pDoc->getIDocumentMarkAccess()->getFieldmarkFor(*pUnoCrsr->GetPoint()); + SwXTextPortion* pPortion = NULL; + xRef = (pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_FIELD_START)); if (pPortion && pFieldmark && pDoc) - pPortion->SetBookmark(new SwXFieldmark(false, pFieldmark, pDoc)); + pPortion->SetBookmark(new SwXFieldmark(false, pFieldmark, pDoc)); } else if (start+1==end && pTxtNode->GetTxt().GetChar(start)==CH_TXT_ATR_FIELDEND) { - SwBookmark* pFieldmark=NULL; + ::sw::mark::IFieldmark* pFieldmark = NULL; if (pDoc && pUnoCrsr->GetPoint()) { SwPosition aPos(*pUnoCrsr->GetPoint()); - aPos.nContent=markerPos; - pFieldmark=pDoc->getFieldBookmarkFor(aPos); + aPos.nContent = markerPos; + pFieldmark = pDoc->getIDocumentMarkAccess()->getFieldmarkFor(aPos); } - SwXTextPortion* pPortion=NULL; + SwXTextPortion* pPortion = NULL; xRef = (pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_FIELD_END)); if (pPortion && pFieldmark && pDoc) pPortion->SetBookmark(new SwXFieldmark(false, pFieldmark, pDoc)); } else if (start+1==end && pTxtNode->GetTxt().GetChar(start)==CH_TXT_ATR_FORMELEMENT) { - SwFieldBookmark* pFieldmark=NULL; + ::sw::mark::IFieldmark* pFieldmark = NULL; if (pDoc && pUnoCrsr->GetPoint()) { SwPosition aPos(*pUnoCrsr->GetPoint()); aPos.nContent=markerPos; - pFieldmark=pDoc->getFormFieldBookmarkFor(aPos); + pFieldmark = pDoc->getIDocumentMarkAccess()->getFieldmarkFor(aPos); } SwXTextPortion* pPortion=NULL; xRef = (pPortion = new SwXTextPortion(pUnoCrsr, xParent, PORTION_FIELD_START_END)); - if (pPortion && pFieldmark && pDoc) + if(pPortion && pFieldmark && pDoc) pPortion->SetBookmark(new SwXFieldmark(true, pFieldmark, pDoc)); } else diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx index 69bfa91a24c9..b04b8f0fdeaf 100644 --- a/sw/source/core/unocore/unoredline.cxx +++ b/sw/source/core/unocore/unoredline.cxx @@ -466,7 +466,7 @@ SwXRedline::~SwXRedline() uno::Reference< beans::XPropertySetInfo > SwXRedline::getPropertySetInfo( ) throw(uno::RuntimeException) { static uno::Reference< beans::XPropertySetInfo > xRef = - SfxItemPropertySet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_REDLINE)).getPropertySetInfo(); + aSwMapProvider.GetPropertySet(PROPERTY_MAP_REDLINE)->getPropertySetInfo(); return xRef; } /*-- 11.01.01 17:06:08--------------------------------------------------- diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx index ba0b624506a1..f0cbd754e02a 100644 --- a/sw/source/core/unocore/unorefmk.cxx +++ b/sw/source/core/unocore/unorefmk.cxx @@ -368,8 +368,7 @@ void SwXReferenceMark::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) uno::Reference< beans::XPropertySetInfo > SwXReferenceMark::getPropertySetInfo( ) throw(uno::RuntimeException) { static uno::Reference< beans::XPropertySetInfo > xRef = - SfxItemPropertySet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH_EXTENSIONS)). - getPropertySetInfo(); + aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH_EXTENSIONS)->getPropertySetInfo(); return xRef; } /*-- 12.09.00 12:58:20--------------------------------------------------- diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index b318f2e47352..529f36294fca 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -278,7 +278,7 @@ sal_Int64 SAL_CALL SwXTextSection::getSomething( const uno::Sequence< sal_Int8 > SwXTextSection::SwXTextSection(sal_Bool bWithFormat, sal_Bool bIndexHeader) : // SwClient(pFmt), aLstnrCntnr( (text::XTextContent*)this), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_SECTION)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_SECTION)), m_bIsDescriptor(!bWithFormat), m_bIndexHeader(bIndexHeader), pProps(bWithFormat ? 0 : new SwTextSectionProperties_Impl()), @@ -569,7 +569,7 @@ void SwXTextSection::removeEventListener(const uno::Reference< lang::XEventListe -----------------------------------------------------------------------*/ uno::Reference< beans::XPropertySetInfo > SwXTextSection::getPropertySetInfo(void) throw( uno::RuntimeException ) { - static uno::Reference< beans::XPropertySetInfo > aRef = aPropSet.getPropertySetInfo(); + static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo(); return aRef; } /* -----------------------------12.02.01 10:29-------------------------------- @@ -610,15 +610,15 @@ void SAL_CALL SwXTextSection::SetPropertyValues_Impl( sal_Bool bLinkMode = sal_False; for(sal_Int16 nProperty = 0; nProperty < rPropertyNames.getLength(); nProperty++) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), pPropertyNames[nProperty]); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName( pPropertyNames[nProperty] ); + if(!pEntry) throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProperty], static_cast < cppu::OWeakObject * > ( this ) ); else { - if ( pMap->nFlags & PropertyAttribute::READONLY) + if ( pEntry->nFlags & PropertyAttribute::READONLY) throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProperty], static_cast < cppu::OWeakObject * > ( this ) ); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_SECT_CONDITION: { @@ -645,7 +645,7 @@ void SAL_CALL SwXTextSection::SetPropertyValues_Impl( pProps->sLinkFileName += sfx2::cTokenSeperator; pProps->bDDE = sal_True; } - pProps->sLinkFileName.SetToken(pMap->nWID - WID_SECT_DDE_TYPE,sfx2::cTokenSeperator,sTmp); + pProps->sLinkFileName.SetToken(pEntry->nWID - WID_SECT_DDE_TYPE,sfx2::cTokenSeperator,sTmp); } else { @@ -656,7 +656,7 @@ void SAL_CALL SwXTextSection::SetPropertyValues_Impl( sLinkFileName += sfx2::cTokenSeperator; aSection.SetType(DDE_LINK_SECTION); } - sLinkFileName.SetToken(pMap->nWID - WID_SECT_DDE_TYPE,sfx2::cTokenSeperator, sTmp); + sLinkFileName.SetToken(pEntry->nWID - WID_SECT_DDE_TYPE,sfx2::cTokenSeperator, sTmp); aSection.SetLinkFileName(sLinkFileName); } } @@ -793,56 +793,56 @@ void SAL_CALL SwXTextSection::SetPropertyValues_Impl( { const SfxItemSet& rOldAttrSet = pFmt->GetAttrSet(); aItemSet.pItemSet = new SfxItemSet(*rOldAttrSet.GetPool(), - pMap->nWID, pMap->nWID, 0); + pEntry->nWID, pEntry->nWID, 0); aItemSet.pItemSet->Put(rOldAttrSet); - aPropSet.setPropertyValue(*pMap, pValues[nProperty], *aItemSet.pItemSet); + m_pPropSet->setPropertyValue(*pEntry, pValues[nProperty], *aItemSet.pItemSet); } else { SfxPoolItem* pPutItem = 0; - if(RES_COL == pMap->nWID) + if(RES_COL == pEntry->nWID) { if(!pProps->pColItem) pProps->pColItem = new SwFmtCol; pPutItem = pProps->pColItem; } - else if(RES_BACKGROUND == pMap->nWID) + else if(RES_BACKGROUND == pEntry->nWID) { if(!pProps->pBrushItem) pProps->pBrushItem = new SvxBrushItem(RES_BACKGROUND); pPutItem = pProps->pBrushItem; } - else if(RES_FTN_AT_TXTEND == pMap->nWID) + else if(RES_FTN_AT_TXTEND == pEntry->nWID) { if(!pProps->pFtnItem) pProps->pFtnItem = new SwFmtFtnAtTxtEnd; pPutItem = pProps->pFtnItem; } - else if(RES_END_AT_TXTEND == pMap->nWID) + else if(RES_END_AT_TXTEND == pEntry->nWID) { if(!pProps->pEndItem) pProps->pEndItem = new SwFmtEndAtTxtEnd; pPutItem = pProps->pEndItem; } - else if(RES_UNKNOWNATR_CONTAINER== pMap->nWID) + else if(RES_UNKNOWNATR_CONTAINER== pEntry->nWID) { if(!pProps->pXMLAttr) pProps->pXMLAttr= new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER ); pPutItem = pProps->pXMLAttr; } - else if(RES_COLUMNBALANCE== pMap->nWID) + else if(RES_COLUMNBALANCE== pEntry->nWID) { if(!pProps->pNoBalanceItem) pProps->pNoBalanceItem= new SwFmtNoBalancedColumns( RES_COLUMNBALANCE ); pPutItem = pProps->pNoBalanceItem; } - else if(RES_FRAMEDIR == pMap->nWID) + else if(RES_FRAMEDIR == pEntry->nWID) { if(!pProps->pFrameDirItem) pProps->pFrameDirItem = new SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR ); pPutItem = pProps->pFrameDirItem; } - else if(RES_LR_SPACE == pMap->nWID) + else if(RES_LR_SPACE == pEntry->nWID) { // #109700# if(!pProps->pLRSpaceItem) @@ -850,7 +850,7 @@ void SAL_CALL SwXTextSection::SetPropertyValues_Impl( pPutItem = pProps->pLRSpaceItem; } if(pPutItem) - pPutItem->PutValue(pValues[nProperty], pMap->nMemberId); + pPutItem->PutValue(pValues[nProperty], pEntry->nMemberId); } } } @@ -946,11 +946,11 @@ uno::Sequence< Any > SAL_CALL SwXTextSection::GetPropertyValues_Impl( const OUString* pPropertyNames = rPropertyNames.getConstArray(); for(sal_Int32 nProperty = 0; nProperty < rPropertyNames.getLength(); nProperty++) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), pPropertyNames[nProperty]); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName( pPropertyNames[nProperty]); + if(pEntry) { - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_SECT_CONDITION: { @@ -973,7 +973,7 @@ uno::Sequence< Any > SAL_CALL SwXTextSection::GetPropertyValues_Impl( { sRet = pSect->GetLinkFileName(); } - sRet = sRet.GetToken(pMap->nWID - WID_SECT_DDE_TYPE, sfx2::cTokenSeperator); + sRet = sRet.GetToken(pEntry->nWID - WID_SECT_DDE_TYPE, sfx2::cTokenSeperator); pRet[nProperty] <<= OUString(sRet); } break; @@ -1084,7 +1084,7 @@ uno::Sequence< Any > SAL_CALL SwXTextSection::GetPropertyValues_Impl( case FN_UNO_ANCHOR_TYPES: case FN_UNO_TEXT_WRAP: case FN_UNO_ANCHOR_TYPE: - SwXParagraph::getDefaultTextContentValue(pRet[nProperty], OUString(), pMap->nWID); + SwXParagraph::getDefaultTextContentValue(pRet[nProperty], OUString(), pEntry->nWID); break; case FN_UNO_REDLINE_NODE_START: case FN_UNO_REDLINE_NODE_END: @@ -1092,7 +1092,7 @@ uno::Sequence< Any > SAL_CALL SwXTextSection::GetPropertyValues_Impl( if(!pFmt) break; // lijian i73247 SwNode* pSectNode = pFmt->GetSectionNode(); - if(FN_UNO_REDLINE_NODE_END == pMap->nWID) + if(FN_UNO_REDLINE_NODE_END == pEntry->nWID) pSectNode = pSectNode->EndOfSectionNode(); const SwRedlineTbl& rRedTbl = pFmt->GetDoc()->GetRedlineTbl(); for(USHORT nRed = 0; nRed < rRedTbl.Count(); nRed++) @@ -1118,54 +1118,54 @@ uno::Sequence< Any > SAL_CALL SwXTextSection::GetPropertyValues_Impl( break; default: if(pFmt) - pRet[nProperty] = aPropSet.getPropertyValue(*pMap, pFmt->GetAttrSet()); + m_pPropSet->getPropertyValue(*pEntry, pFmt->GetAttrSet(), pRet[nProperty]); else { const SfxPoolItem* pQueryItem = 0; - if(RES_COL == pMap->nWID) + if(RES_COL == pEntry->nWID) { if(!pProps->pColItem) pProps->pColItem = new SwFmtCol; pQueryItem = pProps->pColItem; } - else if(RES_BACKGROUND == pMap->nWID) + else if(RES_BACKGROUND == pEntry->nWID) { if(!pProps->pBrushItem) pProps->pBrushItem = new SvxBrushItem(RES_BACKGROUND); pQueryItem = pProps->pBrushItem; } - else if(RES_FTN_AT_TXTEND == pMap->nWID) + else if(RES_FTN_AT_TXTEND == pEntry->nWID) { if(!pProps->pFtnItem) pProps->pFtnItem = new SwFmtFtnAtTxtEnd; pQueryItem = pProps->pFtnItem; } - else if(RES_END_AT_TXTEND == pMap->nWID) + else if(RES_END_AT_TXTEND == pEntry->nWID) { if(!pProps->pEndItem) pProps->pEndItem = new SwFmtEndAtTxtEnd; pQueryItem = pProps->pEndItem; } - else if(RES_UNKNOWNATR_CONTAINER== pMap->nWID) + else if(RES_UNKNOWNATR_CONTAINER== pEntry->nWID) { if(!pProps->pXMLAttr) pProps->pXMLAttr= new SvXMLAttrContainerItem ; pQueryItem = pProps->pXMLAttr; } - else if(RES_COLUMNBALANCE== pMap->nWID) + else if(RES_COLUMNBALANCE== pEntry->nWID) { if(!pProps->pNoBalanceItem) pProps->pNoBalanceItem= new SwFmtNoBalancedColumns; pQueryItem = pProps->pNoBalanceItem; } - else if(RES_FRAMEDIR == pMap->nWID) + else if(RES_FRAMEDIR == pEntry->nWID) { if(!pProps->pFrameDirItem) pProps->pFrameDirItem = new SvxFrameDirectionItem(FRMDIR_ENVIRONMENT, RES_FRAMEDIR); pQueryItem = pProps->pFrameDirItem; } /* -> #109700# */ - else if(RES_LR_SPACE == pMap->nWID) + else if(RES_LR_SPACE == pEntry->nWID) { if(!pProps->pLRSpaceItem) pProps->pLRSpaceItem = new SvxLRSpaceItem( RES_LR_SPACE ); @@ -1173,7 +1173,7 @@ uno::Sequence< Any > SAL_CALL SwXTextSection::GetPropertyValues_Impl( } /* <- #109700# */ if(pQueryItem) - pQueryItem->QueryValue(pRet[nProperty], pMap->nMemberId); + pQueryItem->QueryValue(pRet[nProperty], pEntry->nMemberId); } } } @@ -1307,11 +1307,11 @@ Sequence< PropertyState > SwXTextSection::getPropertyStates( for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) { pStates[i] = PropertyState_DEFAULT_VALUE; - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), pNames[i]); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName( pNames[i]); + if(!pEntry) throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) ); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_SECT_CONDITION: case WID_SECT_DDE_TYPE : @@ -1333,17 +1333,17 @@ Sequence< PropertyState > SwXTextSection::getPropertyStates( break; default: if(pFmt) - pStates[i] = aPropSet.getPropertyState(pNames[i], pFmt->GetAttrSet()); + pStates[i] = m_pPropSet->getPropertyState(pNames[i], pFmt->GetAttrSet()); else { - if(RES_COL == pMap->nWID) + if(RES_COL == pEntry->nWID) { if(!pProps->pColItem) pStates[i] = PropertyState_DEFAULT_VALUE; else pStates[i] = PropertyState_DIRECT_VALUE; } - else //if(RES_BACKGROUND == pMap->nWID) + else //if(RES_BACKGROUND == pEntry->nWID) { if(!pProps->pBrushItem) pStates[i] = PropertyState_DEFAULT_VALUE; @@ -1372,14 +1372,14 @@ void SwXTextSection::setPropertyToDefault( const OUString& rPropertyName ) SwSection* pSect = pFmt ? pFmt->GetSection() : 0; if(pFmt) aSection = *pSect; - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName( rPropertyName ); + if(!pEntry) throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if ( pMap->nFlags & PropertyAttribute::READONLY) + if ( pEntry->nFlags & PropertyAttribute::READONLY) throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertyToDefault: property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); SfxItemSet* pNewAttrSet = 0; - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_SECT_CONDITION: { @@ -1431,20 +1431,20 @@ void SwXTextSection::setPropertyToDefault( const OUString& rPropertyName ) case FN_UNO_ANCHOR_TYPE: break; default: - if(pMap->nWID <= SFX_WHICH_MAX) + if(pEntry->nWID <= SFX_WHICH_MAX) { if(pFmt) { const SfxItemSet& rOldAttrSet = pFmt->GetAttrSet(); pNewAttrSet = new SfxItemSet(*rOldAttrSet.GetPool(), - pMap->nWID, pMap->nWID, 0); - pNewAttrSet->ClearItem(pMap->nWID); + pEntry->nWID, pEntry->nWID, 0); + pNewAttrSet->ClearItem(pEntry->nWID); } else { - if(RES_COL == pMap->nWID) + if(RES_COL == pEntry->nWID) DELETEZ(pProps->pColItem); - else if(RES_BACKGROUND == pMap->nWID) + else if(RES_BACKGROUND == pEntry->nWID) DELETEZ(pProps->pBrushItem); } } @@ -1483,12 +1483,12 @@ Any SwXTextSection::getPropertyDefault( const OUString& rPropertyName ) vos::OGuard aGuard(Application::GetSolarMutex()); uno::Any aRet; SwSectionFmt* pFmt = GetFmt(); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); - if (!pMap) + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName( rPropertyName ); + if (!pEntry) throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_SECT_CONDITION: case WID_SECT_DDE_TYPE : @@ -1520,15 +1520,15 @@ Any SwXTextSection::getPropertyDefault( const OUString& rPropertyName ) case FN_UNO_ANCHOR_TYPES: case FN_UNO_TEXT_WRAP: case FN_UNO_ANCHOR_TYPE: - SwXParagraph::getDefaultTextContentValue(aRet, OUString(), pMap->nWID); + SwXParagraph::getDefaultTextContentValue(aRet, OUString(), pEntry->nWID); break; default: - if(pFmt && pMap->nWID <= SFX_WHICH_MAX) + if(pFmt && pEntry->nWID <= SFX_WHICH_MAX) { SwDoc* pDoc = pFmt->GetDoc(); const SfxPoolItem& rDefItem = - pDoc->GetAttrPool().GetDefaultItem(pMap->nWID); - rDefItem.QueryValue(aRet, pMap->nMemberId); + pDoc->GetAttrPool().GetDefaultItem(pEntry->nWID); + rDefItem.QueryValue(aRet, pEntry->nMemberId); } } return aRet; diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index b75cfebd4d27..3b3347c16a4a 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -124,9 +124,9 @@ SV_IMPL_PTRARR(PropValDataArr, PropValDataPtr) #define WID_BEGIN_NOTICE 10 #define WID_ANCHOR_CHARACTER_STYLE 11 -const SfxItemPropertyMap* GetFootnoteMap() +const SfxItemPropertySet* GetFootnoteSet() { - static SfxItemPropertyMap aFootnoteMap_Impl[] = + static SfxItemPropertyMapEntry aFootnoteMap_Impl[] = { { SW_PROP_NAME(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, { SW_PROP_NAME(UNO_NAME_BEGIN_NOTICE), WID_BEGIN_NOTICE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, @@ -142,11 +142,12 @@ const SfxItemPropertyMap* GetFootnoteMap() { SW_PROP_NAME(UNO_NAME_SUFFIX), WID_SUFFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - return aFootnoteMap_Impl; + static SfxItemPropertySet aFootnoteSet_Impl(aFootnoteMap_Impl); + return &aFootnoteSet_Impl; } -const SfxItemPropertyMap* GetEndnoteMap() +const SfxItemPropertySet* GetEndnoteSet() { - static SfxItemPropertyMap aEndnoteMap_Impl[] = + static SfxItemPropertyMapEntry aEndnoteMap_Impl[] = { { SW_PROP_NAME(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, @@ -158,11 +159,12 @@ const SfxItemPropertyMap* GetEndnoteMap() { SW_PROP_NAME(UNO_NAME_SUFFIX), WID_SUFFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - return aEndnoteMap_Impl; + static SfxItemPropertySet aEndnoteSet_Impl(aEndnoteMap_Impl); + return &aEndnoteSet_Impl; } -const SfxItemPropertyMap* GetNumberingRulesMap() +const SfxItemPropertySet* GetNumberingRulesSet() { - static SfxItemPropertyMap aNumberingRulesMap_Impl[] = + static SfxItemPropertyMapEntry aNumberingRulesMap_Impl[] = { { SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS), WID_IS_ABS_MARGINS, &::getBooleanCppuType(), PROPERTY_NONE, 0}, { SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC), WID_IS_AUTOMATIC, &::getBooleanCppuType(), PROPERTY_NONE, 0}, @@ -172,7 +174,8 @@ const SfxItemPropertyMap* GetNumberingRulesMap() { SW_PROP_NAME(UNO_NAME_DEFAULT_LIST_ID), WID_DEFAULT_LIST_ID, &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0}, {0,0,0,0,0,0} }; - return aNumberingRulesMap_Impl; + static SfxItemPropertySet aNumberingRulesSet_Impl( aNumberingRulesMap_Impl ); + return &aNumberingRulesSet_Impl; } #define WID_NUM_ON 0 #define WID_SEPARATOR_INTERVAL 1 @@ -186,9 +189,9 @@ const SfxItemPropertyMap* GetNumberingRulesMap() #define WID_COUNT_LINES_IN_FRAMES 9 #define WID_RESTART_AT_EACH_PAGE 10 -const SfxItemPropertyMap* GetLineNumberingMap() +const SfxItemPropertySet* GetLineNumberingSet() { - static SfxItemPropertyMap aLineNumberingMap_Impl[] = + static SfxItemPropertyMapEntry aLineNumberingMap_Impl[] = { { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, { SW_PROP_NAME(UNO_NAME_COUNT_EMPTY_LINES), WID_COUNT_EMPTY_LINES , &::getBooleanCppuType(),PROPERTY_NONE, 0}, @@ -203,7 +206,8 @@ const SfxItemPropertyMap* GetLineNumberingMap() { SW_PROP_NAME(UNO_NAME_SEPARATOR_INTERVAL), WID_SEPARATOR_INTERVAL, &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0}, {0,0,0,0,0,0} }; - return aLineNumberingMap_Impl; + static SfxItemPropertySet aLineNumberingSet_Impl(aLineNumberingMap_Impl); + return &aLineNumberingSet_Impl; } /* -----------------05.05.98 08:30------------------- @@ -332,7 +336,7 @@ Sequence< OUString > SwXFootnoteProperties::getSupportedServiceNames(void) throw -----------------------------------------------------------------------*/ SwXFootnoteProperties::SwXFootnoteProperties(SwDoc* pDc) : pDoc(pDc), - _pMap(GetFootnoteMap()) + m_pPropertySet(GetFootnoteSet()) { } /*-- 14.12.98 14:03:20--------------------------------------------------- @@ -348,7 +352,7 @@ SwXFootnoteProperties::~SwXFootnoteProperties() uno::Reference< beans::XPropertySetInfo > SwXFootnoteProperties::getPropertySetInfo(void) throw( uno::RuntimeException ) { - static uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo( _pMap ); + static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo(); return aRef; } /*-- 14.12.98 14:03:20--------------------------------------------------- @@ -360,14 +364,13 @@ void SwXFootnoteProperties::setPropertyValue(const OUString& rPropertyName, cons vos::OGuard aGuard(Application::GetSolarMutex()); if(pDoc) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName ); + if(pEntry) { - if ( pMap->nFlags & PropertyAttribute::READONLY) + if ( pEntry->nFlags & PropertyAttribute::READONLY) throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); SwFtnInfo aFtnInfo(pDoc->GetFtnInfo()); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_PREFIX: { @@ -440,7 +443,7 @@ void SwXFootnoteProperties::setPropertyValue(const OUString& rPropertyName, cons SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue); if(pFmt) { - if(pMap->nWID == WID_ANCHOR_CHARACTER_STYLE) + if(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE) aFtnInfo.SetAnchorCharFmt(pFmt); else aFtnInfo.SetCharFmt(pFmt); @@ -486,12 +489,11 @@ uno::Any SwXFootnoteProperties::getPropertyValue(const OUString& rPropertyName) uno::Any aRet; if(pDoc) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName ); + if(pEntry) { const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo(); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_PREFIX: { @@ -558,7 +560,7 @@ uno::Any SwXFootnoteProperties::getPropertyValue(const OUString& rPropertyName) { String aString; const SwCharFmt* pCharFmt = 0; - if( pMap->nWID == WID_ANCHOR_CHARACTER_STYLE ) + if( pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE ) { if( rFtnInfo.GetAnchorCharFmtDep()->GetRegisteredIn() ) pCharFmt = rFtnInfo.GetAnchorCharFmt(*pDoc); @@ -669,7 +671,7 @@ Sequence< OUString > SwXEndnoteProperties::getSupportedServiceNames(void) throw( -----------------------------------------------------------------------*/ SwXEndnoteProperties::SwXEndnoteProperties(SwDoc* pDc) : pDoc(pDc), - _pMap(GetEndnoteMap()) + m_pPropertySet(GetEndnoteSet()) { } @@ -685,7 +687,7 @@ SwXEndnoteProperties::~SwXEndnoteProperties() -----------------------------------------------------------------------*/ uno::Reference< beans::XPropertySetInfo > SwXEndnoteProperties::getPropertySetInfo(void) throw( uno::RuntimeException ) { - static uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo( _pMap ); + static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo(); return aRef; } /*-- 14.12.98 14:27:40--------------------------------------------------- @@ -698,14 +700,13 @@ void SwXEndnoteProperties::setPropertyValue(const OUString& rPropertyName, const vos::OGuard aGuard(Application::GetSolarMutex()); if(pDoc) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName ); + if(pEntry) { - if ( pMap->nFlags & PropertyAttribute::READONLY) + if ( pEntry->nFlags & PropertyAttribute::READONLY) throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); SwEndNoteInfo aEndInfo(pDoc->GetEndNoteInfo()); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_PREFIX: { @@ -755,7 +756,7 @@ void SwXEndnoteProperties::setPropertyValue(const OUString& rPropertyName, const SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue); if(pFmt) { - if(pMap->nWID == WID_ANCHOR_CHARACTER_STYLE) + if(pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE) aEndInfo.SetAnchorCharFmt(pFmt); else aEndInfo.SetCharFmt(pFmt); @@ -779,12 +780,11 @@ uno::Any SwXEndnoteProperties::getPropertyValue(const OUString& rPropertyName) uno::Any aRet; if(pDoc) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName ); + if(pEntry) { const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo(); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_PREFIX: aRet <<= OUString(rEndInfo.GetPrefix()); @@ -832,7 +832,7 @@ uno::Any SwXEndnoteProperties::getPropertyValue(const OUString& rPropertyName) { String aString; const SwCharFmt* pCharFmt = 0; - if( pMap->nWID == WID_ANCHOR_CHARACTER_STYLE ) + if( pEntry->nWID == WID_ANCHOR_CHARACTER_STYLE ) { if( rEndInfo.GetAnchorCharFmtDep()->GetRegisteredIn() ) pCharFmt = rEndInfo.GetAnchorCharFmt(*pDoc); @@ -926,7 +926,7 @@ Sequence< OUString > SwXLineNumberingProperties::getSupportedServiceNames(void) -----------------------------------------------------------------------*/ SwXLineNumberingProperties::SwXLineNumberingProperties(SwDoc* pDc) : pDoc(pDc), - _pMap(GetLineNumberingMap()) + m_pPropertySet(GetLineNumberingSet()) { } @@ -942,7 +942,7 @@ SwXLineNumberingProperties::~SwXLineNumberingProperties() -----------------------------------------------------------------------*/ uno::Reference< beans::XPropertySetInfo > SwXLineNumberingProperties::getPropertySetInfo(void) throw( uno::RuntimeException ) { - static uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo( _pMap ); + static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo(); return aRef; } /*-- 14.12.98 14:33:37--------------------------------------------------- @@ -956,14 +956,13 @@ void SwXLineNumberingProperties::setPropertyValue( vos::OGuard aGuard(Application::GetSolarMutex()); if(pDoc) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName ); + if(pEntry) { - if ( pMap->nFlags & PropertyAttribute::READONLY) + if ( pEntry->nFlags & PropertyAttribute::READONLY) throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); SwLineNumberInfo aInfo(pDoc->GetLineNumberInfo()); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_NUM_ON: { @@ -1078,12 +1077,11 @@ Any SwXLineNumberingProperties::getPropertyValue(const OUString& rPropertyName) Any aRet; if(pDoc) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropertySet->getPropertyMap()->getByName( rPropertyName ); + if(pEntry) { const SwLineNumberInfo& rInfo = pDoc->GetLineNumberInfo(); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_NUM_ON: { @@ -1268,7 +1266,7 @@ SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule) : pDoc(0), pDocShell(0), pNumRule(new SwNumRule(rRule)), - _pMap(GetNumberingRulesMap()), + m_pPropertySet(GetNumberingRulesSet()), bOwnNumRuleCreated(TRUE) { sal_uInt16 i; @@ -1300,7 +1298,7 @@ SwXNumberingRules::SwXNumberingRules(SwDocShell& rDocSh) : pDoc(0), pDocShell(&rDocSh), pNumRule(0), - _pMap(GetNumberingRulesMap()), + m_pPropertySet(GetNumberingRulesSet()), bOwnNumRuleCreated(FALSE) { pDocShell->GetDoc()->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); @@ -1312,7 +1310,7 @@ SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) : pDoc(&rDoc), pDocShell(0), pNumRule(0), - _pMap(GetNumberingRulesMap()), + m_pPropertySet(GetNumberingRulesSet()), bOwnNumRuleCreated(FALSE) { rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); @@ -2256,7 +2254,7 @@ void SwXNumberingRules::SetNumberingRuleByIndex( uno::Reference< XPropertySetInfo > SwXNumberingRules::getPropertySetInfo() throw(RuntimeException) { - static uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo( _pMap ); + static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropertySet->getPropertySetInfo(); return aRef; } /*-- 19.07.00 07:49:17--------------------------------------------------- @@ -2536,7 +2534,7 @@ SwXTextColumns::SwXTextColumns(sal_uInt16 nColCount) : nReference(0), bIsAutomaticWidth(sal_True), nAutoDistance(0), - _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_COLUMS)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS)), nSepLineWidth(0), nSepLineColor(0), //black nSepLineHeightRelative(100),//full height @@ -2553,7 +2551,7 @@ SwXTextColumns::SwXTextColumns(const SwFmtCol& rFmtCol) : nReference(0), aTextColumns(rFmtCol.GetNumCols()), bIsAutomaticWidth(rFmtCol.IsOrtho()), - _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_COLUMS)) + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_COLUMS)) { USHORT nItemGutterWidth = rFmtCol.GetGutterWidth(); nAutoDistance = bIsAutomaticWidth ? @@ -2663,7 +2661,7 @@ void SwXTextColumns::setColumns(const uno::Sequence< TextColumn >& rColumns) -----------------------------------------------------------------------*/ uno::Reference< XPropertySetInfo > SwXTextColumns::getPropertySetInfo( ) throw(RuntimeException) { - static uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo( _pMap ); + static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo(); return aRef; } /*-- 25.10.00 10:15:39--------------------------------------------------- @@ -2673,14 +2671,13 @@ void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any& throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if (!pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); + if (!pEntry) throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if ( pMap->nFlags & PropertyAttribute::READONLY) + if ( pEntry->nFlags & PropertyAttribute::READONLY) throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_TXTCOL_LINE_WIDTH: { @@ -2746,13 +2743,12 @@ void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any& Any SwXTextColumns::getPropertyValue( const OUString& rPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if (!pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); + if (!pEntry) throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); Any aRet; - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_TXTCOL_LINE_WIDTH: aRet <<= static_cast < sal_Int32 >(TWIP_TO_MM100(nSepLineWidth)); diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx index 306f9ca9cff7..12cc91b1a3f5 100644 --- a/sw/source/core/unocore/unosrch.cxx +++ b/sw/source/core/unocore/unosrch.cxx @@ -58,7 +58,8 @@ using ::rtl::OUString; class SwSearchProperties_Impl { beans::PropertyValue** pValueArr; // - sal_uInt16 nArrLen; + sal_uInt32 nArrLen; + const PropertyEntryVector_t aPropertyEntries; public: SwSearchProperties_Impl(); ~SwSearchProperties_Impl(); @@ -74,17 +75,12 @@ public: --------------------------------------------------*/ SwSearchProperties_Impl::SwSearchProperties_Impl() : - nArrLen(0) + nArrLen(0), + aPropertyEntries( aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)->getPropertyMap()->getPropertyEntries()) { - const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR); - while(pMap->nWID) - { - if(pMap->nWID < RES_FRMATR_END) - nArrLen++; - pMap++; - } + nArrLen = aPropertyEntries.size(); pValueArr = new beans::PropertyValue*[nArrLen]; - for(sal_uInt16 i = 0; i < nArrLen; i++) + for(sal_uInt32 i = 0; i < nArrLen; i++) pValueArr[i] = 0; } /* -----------------23.06.99 13:08------------------- @@ -92,7 +88,7 @@ SwSearchProperties_Impl::SwSearchProperties_Impl() : --------------------------------------------------*/ SwSearchProperties_Impl::~SwSearchProperties_Impl() { - for(sal_uInt16 i = 0; i < nArrLen; i++) + for(sal_uInt32 i = 0; i < nArrLen; i++) delete pValueArr[i]; delete[] pValueArr; } @@ -102,10 +98,8 @@ SwSearchProperties_Impl::~SwSearchProperties_Impl() void SwSearchProperties_Impl::SetProperties(const uno::Sequence< beans::PropertyValue >& aSearchAttribs) throw( beans::UnknownPropertyException, lang::IllegalArgumentException, uno::RuntimeException ) { - const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR); - long nLen = aSearchAttribs.getLength(); const beans::PropertyValue* pProps = aSearchAttribs.getConstArray(); - long i; + sal_uInt32 i; //delete all existing values for( i = 0; i < nArrLen; i++) @@ -114,18 +108,18 @@ void SwSearchProperties_Impl::SetProperties(const uno::Sequence< beans::Prope pValueArr[i] = 0; } + sal_uInt32 nLen = aSearchAttribs.getLength(); for(i = 0; i < nLen; i++) { - String sPropertyName(pProps[i].Name); sal_uInt16 nIndex = 0; - const SfxItemPropertyMap* pTempMap = pMap; - while(pTempMap->nWID && !sPropertyName.EqualsAscii(pTempMap->pName)) + PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin(); + while(pProps[i].Name != aIt->sName) { - pTempMap++; + ++aIt; nIndex++; + if( aIt == aPropertyEntries.end() ) + throw beans::UnknownPropertyException(); } - if(!pTempMap->nWID) - throw beans::UnknownPropertyException(); pValueArr[nIndex] = new beans::PropertyValue(pProps[i]); } } @@ -134,8 +128,8 @@ void SwSearchProperties_Impl::SetProperties(const uno::Sequence< beans::Prope --------------------------------------------------*/ const uno::Sequence< beans::PropertyValue > SwSearchProperties_Impl::GetProperties() const { - sal_uInt16 nPropCount = 0; - sal_uInt16 i; + sal_uInt32 nPropCount = 0; + sal_uInt32 i; for( i = 0; i < nArrLen; i++) if(pValueArr[i]) nPropCount++; @@ -157,7 +151,6 @@ const uno::Sequence< beans::PropertyValue > SwSearchProperties_Impl::GetProperti --------------------------------------------------*/ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSearch) const { - const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR); // SfxPoolItem* pBoxItem = 0, @@ -196,187 +189,187 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSea *pCasemapItem = 0, *pBrushItem = 0; - for(sal_uInt16 i = 0; i < nArrLen; i++) + PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin(); + for(sal_uInt32 i = 0; i < nArrLen; i++, ++aIt) { if(pValueArr[i]) { - const SfxItemPropertyMap* pTempMap = pMap + i; SfxPoolItem* pTempItem = 0; - switch(pTempMap->nWID) + switch(aIt->nWID) { case RES_BOX: if(!pBoxItem) - pBoxItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pBoxItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pBoxItem; break; case RES_BREAK: if(!pBreakItem) - pBreakItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pBreakItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pBreakItem; break; case RES_CHRATR_AUTOKERN: if(!pAutoKernItem) - pAutoKernItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pAutoKernItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pAutoKernItem; break; case RES_CHRATR_BACKGROUND: if(!pBrushItem) - pBrushItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pBrushItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pBrushItem; break; case RES_CHRATR_CASEMAP: if(!pCasemapItem) - pCasemapItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pCasemapItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pCasemapItem; break; case RES_CHRATR_COLOR: if(!pCharColorItem) - pCharColorItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pCharColorItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pCharColorItem; break; case RES_CHRATR_CONTOUR: if(!pContourItem) - pContourItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pContourItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pContourItem; break; case RES_CHRATR_CROSSEDOUT: if(!pCrossedOutItem) - pCrossedOutItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pCrossedOutItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pCrossedOutItem; break; case RES_CHRATR_ESCAPEMENT: if(!pEscItem) - pEscItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pEscItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pEscItem; break; case RES_CHRATR_BLINK: if(!pBlinkItem) - pBlinkItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pBlinkItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pBlinkItem; break; case RES_CHRATR_FONT: if(!pFontItem) - pFontItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pFontItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pFontItem; break; case RES_CHRATR_FONTSIZE: if(!pFontSizeItem) - pFontSizeItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pFontSizeItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pFontSizeItem; break; case RES_CHRATR_KERNING: if(!pKernItem) - pKernItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pKernItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pKernItem; break; case RES_CHRATR_LANGUAGE: if(!pLangItem) - pLangItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pLangItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pLangItem; break; case RES_CHRATR_NOHYPHEN: if(!pNHyphItem) - pNHyphItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pNHyphItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pNHyphItem; break; case RES_CHRATR_POSTURE: if(!pPostItem) - pPostItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pPostItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pPostItem; break; case RES_CHRATR_SHADOWED: if(!pShadItem) - pShadItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pShadItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pShadItem; break; case RES_TXTATR_CHARFMT: if(!pCharFmtItem) - pCharFmtItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pCharFmtItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pCharFmtItem; break; case RES_CHRATR_UNDERLINE: if(!pULineItem) - pULineItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pULineItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pULineItem; break; case RES_CHRATR_OVERLINE: if(!pOLineItem) - pOLineItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pOLineItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pOLineItem; break; case RES_CHRATR_WEIGHT: if(!pWeightItem) - pWeightItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pWeightItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pWeightItem; break; case RES_PARATR_DROP: if(!pDropItem) - pDropItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pDropItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pDropItem; break; case RES_TXTATR_INETFMT: if(!pInetItem) - pInetItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pInetItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pInetItem; break; case RES_PAGEDESC: if(!pDescItem) - pDescItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pDescItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pDescItem; break; case RES_PARATR_ADJUST: if(!pAdjItem) - pAdjItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pAdjItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pAdjItem; break; case RES_BACKGROUND: if(!pBackItem) - pBackItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pBackItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pBackItem; break; case RES_UL_SPACE: if(!pULItem) - pULItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pULItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pULItem; break; case RES_LR_SPACE: if(!pLRItem) - pLRItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pLRItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pLRItem; break; case RES_KEEP: if(!pKeepItem) - pKeepItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pKeepItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pKeepItem; break; case RES_LINENUMBER: if(!pLineNumItem) - pLineNumItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pLineNumItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pLineNumItem; break; case RES_PARATR_LINESPACING: if(!pLineSpaceItem) - pLineSpaceItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pLineSpaceItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pLineSpaceItem; break; case RES_PARATR_REGISTER: if(!pRegItem) - pRegItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pRegItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pRegItem; break; case RES_PARATR_SPLIT: if(!pSplitItem) - pSplitItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pSplitItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pSplitItem; break; case RES_PARATR_TABSTOP: if(!pTabItem) - pTabItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pTabItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pTabItem; break; case RES_CHRATR_WORDLINEMODE: if(!pWLineItem) - pWLineItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone(); + pWLineItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pWLineItem; break; } @@ -384,7 +377,7 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSea { if(bIsValueSearch) { - pTempItem->PutValue(pValueArr[i]->Value, pTempMap->nMemberId); + pTempItem->PutValue(pValueArr[i]->Value, aIt->nMemberId); rSet.Put(*pTempItem); } else @@ -434,7 +427,7 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSea --------------------------------------------------*/ sal_Bool SwSearchProperties_Impl::HasAttributes() const { - for(sal_uInt16 i = 0; i < nArrLen; i++) + for(sal_uInt32 i = 0; i < nArrLen; i++) if(pValueArr[i]) return sal_True; return sal_False; @@ -446,7 +439,7 @@ sal_Bool SwSearchProperties_Impl::HasAttributes() const SwXTextSearch::SwXTextSearch() : pSearchProperties( new SwSearchProperties_Impl), pReplaceProperties( new SwSearchProperties_Impl), - _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_SEARCH)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_SEARCH)), bAll(sal_False), bWord(sal_False), bBack(sal_False), @@ -529,7 +522,7 @@ void SwXTextSearch::setReplaceString(const OUString& rReplaceString) throw( uno: -----------------------------------------------------------------------*/ uno::Reference< beans::XPropertySetInfo > SwXTextSearch::getPropertySetInfo(void) throw( uno::RuntimeException ) { - static uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo(_pMap); + static uno::Reference< beans::XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo(); return aRef; } /*-- 14.12.98 13:07:13--------------------------------------------------- @@ -540,16 +533,15 @@ void SwXTextSearch::setPropertyValue(const OUString& rPropertyName, const uno::A lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if(pEntry) { - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); sal_Bool bVal = FALSE; if(aValue.getValueType() == ::getBooleanCppuType()) bVal = *(sal_Bool*)aValue.getValue(); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_SEARCH_ALL : bAll = bVal; break; case WID_WORDS: bWord = bVal; break; @@ -576,13 +568,12 @@ uno::Any SwXTextSearch::getPropertyValue(const OUString& rPropertyName) throw( b vos::OGuard aGuard(Application::GetSolarMutex()); uno::Any aRet; - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName); sal_Bool bSet = sal_False; sal_Int16 nSet = 0; - if(pMap) + if(pEntry) { - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_SEARCH_ALL : bSet = bAll; goto SET_BOOL; case WID_WORDS: bSet = bWord; goto SET_BOOL; diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index baba996cbad5..120df01d0aa9 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1149,9 +1149,10 @@ SwXStyle* SwXStyleFamily::_FindStyle(const String& rStyleName)const for( sal_uInt16 i = 0; i < nLCount; i++) { pListener = pBasePool->GetListener( i ); - if(PTR_CAST(SwXStyle, pListener) && ((SwXStyle*)pListener)->GetFamily() == eFamily && ((SwXStyle*)pListener)->GetStyleName() == rStyleName) + SwXStyle* pTempStyle = dynamic_cast<SwXStyle*>( pListener ); + if(pTempStyle && pTempStyle->GetFamily() == eFamily && pTempStyle->GetStyleName() == rStyleName) { - return (SwXStyle*)pListener; + return pTempStyle; } } return 0; @@ -1161,34 +1162,35 @@ SwXStyle* SwXStyleFamily::_FindStyle(const String& rStyleName)const ******************************************************************/ class SwStyleProperties_Impl { - const SfxItemPropertyMap* _pMap; + const PropertyEntryVector_t aPropertyEntries; uno::Any** pAnyArr; - sal_uInt16 nArrLen; + sal_uInt32 nArrLen; public: SwStyleProperties_Impl(const SfxItemPropertyMap* _pMap); ~SwStyleProperties_Impl(); - sal_Bool SetProperty(const String& rName, uno::Any aVal); - sal_Bool GetProperty(const String& rName, uno::Any*& rpAny); - sal_Bool ClearProperty( const OUString& rPropertyName ); + sal_Bool SetProperty(const ::rtl::OUString& rName, uno::Any aVal); + sal_Bool GetProperty(const ::rtl::OUString& rName, uno::Any*& rpAny); + sal_Bool ClearProperty( const ::rtl::OUString& rPropertyName ); void ClearAllProperties( ); - void GetProperty(const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any& rAny ); + void GetProperty(const ::rtl::OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any& rAny ); + const PropertyEntryVector_t& GetPropertyVector() const {return aPropertyEntries; } - const SfxItemPropertyMap* GetPropertyMap() const {return _pMap;} }; //-------------------------------------------------------------------- //-------------------------------------------------------------------- SwStyleProperties_Impl::SwStyleProperties_Impl(const SfxItemPropertyMap* pMap) : - _pMap(pMap), +// _pMap(pMap), + aPropertyEntries( pMap->getPropertyEntries() ), nArrLen(0) { - const SfxItemPropertyMap* pTmp = _pMap; - while(pTmp[nArrLen].nWID) - nArrLen++; + nArrLen = aPropertyEntries.size(); + //const SfxItemPropertyMap* pTmp = _pMap; + pAnyArr = new uno::Any* [nArrLen]; - for ( sal_uInt16 i =0 ; i < nArrLen; i++ ) + for ( sal_uInt32 i =0 ; i < nArrLen; i++ ) pAnyArr[i] = 0; } //-------------------------------------------------------------------- @@ -1202,42 +1204,44 @@ SwStyleProperties_Impl::~SwStyleProperties_Impl() //-------------------------------------------------------------------- //-------------------------------------------------------------------- -sal_Bool SwStyleProperties_Impl::SetProperty(const String& rName, uno::Any aVal) +sal_Bool SwStyleProperties_Impl::SetProperty(const ::rtl::OUString& rName, uno::Any aVal) { sal_uInt16 nPos = 0; - const SfxItemPropertyMap* pTemp = _pMap; - while( pTemp->pName ) + sal_Bool bRet = sal_False; + PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin(); + while( aIt != aPropertyEntries.end() ) { - if(rName.EqualsAscii(pTemp->pName)) + if(rName == aIt->sName) + { + delete pAnyArr[nPos]; + pAnyArr[nPos] = new uno::Any ( aVal ); + bRet = sal_True; break; + } ++nPos; - ++pTemp; - } - if(nPos < nArrLen) - { - delete pAnyArr[nPos]; - pAnyArr[nPos] = new uno::Any ( aVal ); + ++aIt; } - return nPos < nArrLen; + return bRet; } sal_Bool SwStyleProperties_Impl::ClearProperty( const OUString& rName ) { + sal_Bool bRet = sal_False; sal_uInt16 nPos = 0; - const SfxItemPropertyMap* pTemp = _pMap; - while( pTemp->pName ) + PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin(); + while( aIt != aPropertyEntries.end() ) { - if( rName.equalsAsciiL ( pTemp->pName, pTemp->nNameLen ) ) + if( rName == aIt->sName ) + { + delete pAnyArr[nPos]; + pAnyArr[ nPos ] = 0; + bRet = sal_True; break; + } ++nPos; - ++pTemp; + ++aIt; } - if( nPos < nArrLen ) - { - delete pAnyArr[nPos]; - pAnyArr[ nPos ] = 0; - } - return nPos < nArrLen; + return bRet; } void SwStyleProperties_Impl::ClearAllProperties( ) { @@ -1249,20 +1253,23 @@ void SwStyleProperties_Impl::ClearAllProperties( ) } //-------------------------------------------------------------------- //-------------------------------------------------------------------- -sal_Bool SwStyleProperties_Impl::GetProperty(const String& rName, uno::Any*& rpAny ) +sal_Bool SwStyleProperties_Impl::GetProperty(const ::rtl::OUString& rName, uno::Any*& rpAny ) { + sal_Bool bRet = sal_False; sal_uInt16 nPos = 0; - const SfxItemPropertyMap* pTemp = _pMap; - while( pTemp->pName ) + PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin(); + while( aIt != aPropertyEntries.end() ) { - if(rName.EqualsAscii(pTemp->pName)) + if( rName == aIt->sName ) + { + rpAny = pAnyArr[nPos]; + bRet = sal_True; break; - ++nPos; - ++pTemp; + } + ++aIt; } - if(nPos < nArrLen) - rpAny = pAnyArr[nPos]; - return nPos < nArrLen; + + return bRet; } void SwStyleProperties_Impl::GetProperty( const OUString &rPropertyName, const uno::Reference < beans::XPropertySet > &rxPropertySet, uno::Any & rAny ) @@ -1439,7 +1446,7 @@ SwXStyle::SwXStyle( SwDoc *pDoc, SfxStyleFamily eFam, BOOL bConditional) : default: ; } - pPropImpl = new SwStyleProperties_Impl(aSwMapProvider.GetPropertyMap(nMapId)); + pPropImpl = new SwStyleProperties_Impl(aSwMapProvider.GetPropertySet(nMapId)->getPropertyMap()); } @@ -1655,9 +1662,7 @@ uno::Reference< beans::XPropertySetInfo > lcl_getPropertySetInfo( SfxStyleFamily static uno::Reference< beans::XPropertySetInfo > xCharRef; if(!xCharRef.is()) { - SfxItemPropertySet aPropSet( - aSwMapProvider.GetPropertyMap(PROPERTY_MAP_CHAR_STYLE)); - xCharRef = aPropSet.getPropertySetInfo(); + xCharRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_STYLE)->getPropertySetInfo(); } xRet = xCharRef; } @@ -1668,9 +1673,7 @@ uno::Reference< beans::XPropertySetInfo > lcl_getPropertySetInfo( SfxStyleFamily if(!xParaRef.is()) { sal_uInt16 nMapId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; - SfxItemPropertySet aPropSet( - aSwMapProvider.GetPropertyMap(nMapId)); - xParaRef = aPropSet.getPropertySetInfo(); + xParaRef = aSwMapProvider.GetPropertySet(nMapId)->getPropertySetInfo(); } xRet = xParaRef; } @@ -1680,9 +1683,7 @@ uno::Reference< beans::XPropertySetInfo > lcl_getPropertySetInfo( SfxStyleFamily static uno::Reference< beans::XPropertySetInfo > xPageRef; if(!xPageRef.is()) { - SfxItemPropertySet aPropSet( - aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PAGE_STYLE) ); - xPageRef = aPropSet.getPropertySetInfo(); + xPageRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE)->getPropertySetInfo(); } xRet = xPageRef; } @@ -1692,9 +1693,7 @@ uno::Reference< beans::XPropertySetInfo > lcl_getPropertySetInfo( SfxStyleFamily static uno::Reference< beans::XPropertySetInfo > xFrameRef; if(!xFrameRef.is()) { - SfxItemPropertySet aPropSet( - aSwMapProvider.GetPropertyMap(PROPERTY_MAP_FRAME_STYLE)); - xFrameRef = aPropSet.getPropertySetInfo(); + xFrameRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_FRAME_STYLE)->getPropertySetInfo(); } xRet = xFrameRef; } @@ -1704,9 +1703,7 @@ uno::Reference< beans::XPropertySetInfo > lcl_getPropertySetInfo( SfxStyleFamily static uno::Reference< beans::XPropertySetInfo > xNumRef; if(!xNumRef.is()) { - SfxItemPropertySet aPropSet( - aSwMapProvider.GetPropertyMap(PROPERTY_MAP_NUM_STYLE)); - xNumRef = aPropSet.getPropertySetInfo(); + xNumRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_NUM_STYLE)->getPropertySetInfo(); } xRet = xNumRef; } @@ -1732,16 +1729,15 @@ void SwXStyle::ApplyDescriptorProperties() mxStyleData.clear(); mxStyleFamily.clear(); - const SfxItemPropertyMap* pTemp = pPropImpl->GetPropertyMap(); - while(pTemp->nWID) + const PropertyEntryVector_t& rPropertyVector = pPropImpl->GetPropertyVector(); + PropertyEntryVector_t::const_iterator aIt = rPropertyVector.begin(); + while(aIt != rPropertyVector.end()) { uno::Any* pAny; - String sPropName(C2S(pTemp->pName)); - OUString sUPropName(sPropName); - pPropImpl->GetProperty(sPropName, pAny); + pPropImpl->GetProperty(aIt->sName, pAny); if(pAny) - setPropertyValue(sUPropName, *pAny); - pTemp++; + setPropertyValue(aIt->sName, *pAny); + ++aIt; } } @@ -1831,8 +1827,8 @@ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc() ---------------------------------------------------------------------------*/ -void lcl_SetStyleProperty(const SfxItemPropertyMap* pMap, - SfxItemPropertySet& rPropSet, +void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, + const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& rBase, SfxStyleSheetBasePool* pBasePool, @@ -1842,7 +1838,7 @@ void lcl_SetStyleProperty(const SfxItemPropertyMap* pMap, lang::WrappedTargetException, uno::RuntimeException) { - switch(pMap->nWID) + switch(rEntry.nWID) { case RES_PAPER_BIN: { @@ -1869,9 +1865,9 @@ void lcl_SetStyleProperty(const SfxItemPropertyMap* pMap, else { SfxItemSet& rStyleSet = rBase.GetItemSet(); - SfxItemSet aSet(*rStyleSet.GetPool(), pMap->nWID, pMap->nWID); + SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID); aSet.SetParent(&rStyleSet); - rPropSet.setPropertyValue(*pMap, uno::makeAny ( static_cast < sal_Int8 > ( nBin == USHRT_MAX-1 ? -1 : nBin ) ), aSet); + rPropSet.setPropertyValue(rEntry, uno::makeAny ( static_cast < sal_Int8 > ( nBin == USHRT_MAX-1 ? -1 : nBin ) ), aSet); rStyleSet.Put(aSet); } } @@ -1991,7 +1987,7 @@ void lcl_SetStyleProperty(const SfxItemPropertyMap* pMap, } break; case RES_PAGEDESC : - if( MID_PAGEDESC_PAGEDESCNAME != pMap->nMemberId) + if( MID_PAGEDESC_PAGEDESCNAME != rEntry.nMemberId) goto put_itemset; { // Sonderbehandlung RES_PAGEDESC @@ -2148,7 +2144,7 @@ void lcl_SetStyleProperty(const SfxItemPropertyMap* pMap, } break; case RES_TXTATR_CJK_RUBY: - if(MID_RUBY_CHARSTYLE == pMap->nMemberId ) + if(MID_RUBY_CHARSTYLE == rEntry.nMemberId ) { OUString sTmp; if(rValue >>= sTmp) @@ -2179,7 +2175,7 @@ void lcl_SetStyleProperty(const SfxItemPropertyMap* pMap, //break; case RES_PARATR_DROP: { - if( MID_DROPCAP_CHAR_STYLE_NAME == pMap->nMemberId) + if( MID_DROPCAP_CHAR_STYLE_NAME == rEntry.nMemberId) { if(rValue.getValueType() == ::getCppuType((const OUString*)0)) { @@ -2214,13 +2210,13 @@ void lcl_SetStyleProperty(const SfxItemPropertyMap* pMap, put_itemset: { SfxItemSet& rStyleSet = rBase.GetItemSet(); - SfxItemSet aSet(*rStyleSet.GetPool(), pMap->nWID, pMap->nWID); + SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID); aSet.SetParent(&rStyleSet); - rPropSet.setPropertyValue(*pMap, rValue, aSet); + rPropSet.setPropertyValue(rEntry, rValue, aSet); rStyleSet.Put(aSet); // --> OD 2006-10-18 #i70223# if ( SFX_STYLE_FAMILY_PARA == eFamily && - pMap->nWID == RES_PARATR_NUMRULE && + rEntry.nWID == RES_PARATR_NUMRULE && rBase.mxNewBase.is() && rBase.mxNewBase->GetCollection() && //rBase.mxNewBase->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) //#outline level,removed by zhaojianwei rBase.mxNewBase->GetCollection()->IsAssignedToListLevelOfOutlineStyle() ) ////<-end,add by zhaojianwei @@ -2251,18 +2247,18 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl( { if ( !m_pDoc ) throw uno::RuntimeException(); - sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE; + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; switch(eFamily) { - case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_SET_CONDITIONAL_PARA_STYLE : PROPERTY_SET_PARA_STYLE; break; - case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_SET_FRAME_STYLE ;break; - case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_SET_PAGE_STYLE ;break; - case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_SET_NUM_STYLE ;break; + case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; + case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break; + case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ;break; + case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE ;break; default: ; } - SfxItemPropertySet &rPropSet = aSwMapProvider.GetPropertySet(nPropSetId); - const SfxItemPropertyMap *pMap = rPropSet.getPropertyMap(); + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); + const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap(); if(rPropertyNames.getLength() != rValues.getLength()) throw lang::IllegalArgumentException(); @@ -2286,16 +2282,16 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl( for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { - pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp]); + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp]); - if(!pMap || + if(!pEntry || (!bIsConditional && pNames[nProp].equalsAsciiL(SW_PROP_NAME(UNO_NAME_PARA_STYLE_CONDITIONS)))) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); if(aBaseImpl.mxNewBase.is()) { - lcl_SetStyleProperty(pMap, rPropSet, pValues[nProp], aBaseImpl, + lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, pBasePool, m_pDoc, eFamily); } else if(bIsDescriptor) @@ -2334,15 +2330,15 @@ void SwXStyle::setPropertyValues( } -uno::Any lcl_GetStyleProperty(const SfxItemPropertyMap* pMap, - SfxItemPropertySet& rPropSet, +uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, + const SfxItemPropertySet& rPropSet, SwStyleBase_Impl& rBase, SfxStyleSheetBase* pBase, SfxStyleFamily eFamily, SwDoc *pDoc) throw(uno::RuntimeException) { uno::Any aRet; - if(FN_UNO_IS_PHYSICAL == pMap->nWID) + if(FN_UNO_IS_PHYSICAL == rEntry.nWID) { BOOL bPhys = pBase != 0; if(pBase) @@ -2360,12 +2356,12 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertyMap* pMap, { if(!rBase.mxNewBase.is()) rBase.mxNewBase = new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ); - switch(pMap->nWID) + switch(rEntry.nWID) { case RES_PAPER_BIN: { SfxItemSet& rSet = rBase.GetItemSet(); - aRet = rPropSet.getPropertyValue(*pMap, rSet); + rPropSet.getPropertyValue(rEntry, rSet, aRet); sal_Int8 nBin = 0; aRet >>= nBin; if ( nBin == -1 ) @@ -2411,7 +2407,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertyMap* pMap, } break; case RES_PAGEDESC : - if( MID_PAGEDESC_PAGEDESCNAME != pMap->nMemberId) + if( MID_PAGEDESC_PAGEDESCNAME != rEntry.nMemberId) goto query_itemset; { // Sonderbehandlung RES_PAGEDESC @@ -2520,7 +2516,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertyMap* pMap, query_itemset: { SfxItemSet& rSet = rBase.GetItemSet(); - aRet = rPropSet.getPropertyValue(*pMap, rSet); + rPropSet.getPropertyValue(rEntry, rSet, aRet); } } } @@ -2537,18 +2533,18 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( { if ( !m_pDoc ) throw uno::RuntimeException(); - sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE; + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; switch(eFamily) { - case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_SET_CONDITIONAL_PARA_STYLE : PROPERTY_SET_PARA_STYLE; break; - case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_SET_FRAME_STYLE ;break; - case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_SET_PAGE_STYLE ;break; - case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_SET_NUM_STYLE ;break; + case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; + case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break; + case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ;break; + case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE ;break; default: ; } - SfxItemPropertySet &rPropSet = aSwMapProvider.GetPropertySet(nPropSetId); - const SfxItemPropertyMap *pMap = rPropSet.getPropertyMap(); + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); + const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap(); const OUString* pNames = rPropertyNames.getConstArray(); uno::Sequence< uno::Any > aRet(rPropertyNames.getLength()); @@ -2557,8 +2553,8 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( SfxStyleSheetBase* pBase = 0; for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { - pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp]); - if(!pMap || + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp]); + if(!pEntry || (!bIsConditional && pNames[nProp].equalsAsciiL(SW_PROP_NAME(UNO_NAME_PARA_STYLE_CONDITIONS)))) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); if(pBasePool) @@ -2570,7 +2566,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( pBase = pBasePool->Find(sStyleName); pBasePool->SetSearchMask(eFamily, nSaveMask ); } - pRet[nProp] = lcl_GetStyleProperty(pMap, rPropSet, aBase, pBase, eFamily, GetDoc() ); + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, eFamily, GetDoc() ); } else if(bIsDescriptor) { @@ -2591,7 +2587,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( case SFX_STYLE_FAMILY_CHAR: case SFX_STYLE_FAMILY_FRAME : { - if (pMap->nWID >= POOLATTR_BEGIN && pMap->nWID < RES_UNKNOWNATR_END ) + if (pEntry->nWID >= POOLATTR_BEGIN && pEntry->nWID < RES_UNKNOWNATR_END ) { SwFmt * pFmt; if ( eFamily == SFX_STYLE_FAMILY_CHAR ) @@ -2599,8 +2595,8 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( else pFmt = m_pDoc->GetDfltFrmFmt(); const SwAttrPool * pPool = pFmt->GetAttrSet().GetPool(); - const SfxPoolItem & rItem = pPool->GetDefaultItem ( pMap->nWID ); - rItem.QueryValue ( pRet[nProp], pMap->nMemberId ); + const SfxPoolItem & rItem = pPool->GetDefaultItem ( pEntry->nWID ); + rItem.QueryValue ( pRet[nProp], pEntry->nMemberId ); } else bExcept = sal_True; @@ -2772,32 +2768,32 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( { const OUString* pNames = rPropertyNames.getConstArray(); rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); - sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE; + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; switch(eFamily) { - case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_SET_CONDITIONAL_PARA_STYLE : PROPERTY_SET_PARA_STYLE; break; - case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_SET_FRAME_STYLE ;break; - case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_SET_PAGE_STYLE; break; - case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_SET_NUM_STYLE ;break; + case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; + case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break; + case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break; + case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE ;break; default: ; } - SfxItemPropertySet &rPropSet = aSwMapProvider.GetPropertySet(nPropSetId); - const SfxItemPropertyMap *pMap = rPropSet.getPropertyMap(); + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); + const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap(); SfxItemSet aSet = xStyle->GetItemSet(); for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) { const String& rPropName = pNames[i]; - pMap = SfxItemPropertyMap::GetByName(pMap, rPropName); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( rPropName); + if(!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); - if( FN_UNO_NUM_RULES == pMap->nWID || - FN_UNO_FOLLOW_STYLE == pMap->nWID ) + if( FN_UNO_NUM_RULES == pEntry->nWID || + FN_UNO_FOLLOW_STYLE == pEntry->nWID ) { pStates[i] = beans::PropertyState_DIRECT_VALUE; } - // else if( FN_UNO_DEFAULT_OUTLINE_LEVEL == pMap->nWID ) //#outline level,removed by zahojianwei + // else if( FN_UNO_DEFAULT_OUTLINE_LEVEL == pEntry->nWID ) //#outline level,removed by zahojianwei // { // pStates[i] = // ( xStyle->GetCollection()->GetOutlineLevel() @@ -2809,7 +2805,7 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( (rPropName.EqualsAscii("Header", 0, 6) || rPropName.EqualsAscii("Footer", 0, 6))) { - sal_uInt16 nResId = lcl_ConvertFNToRES(pMap->nWID); + sal_uInt16 nResId = lcl_ConvertFNToRES(pEntry->nWID); BOOL bFooter = rPropName.EqualsAscii("Footer", 0, 6); const SvxSetItem* pSetItem; if(SFX_ITEM_SET == aSet.GetItemState( @@ -2828,15 +2824,15 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( } else { - pStates[i] = rPropSet.getPropertyState(*pMap, aSet); + pStates[i] = pPropSet->getPropertyState(*pEntry, aSet); if( SFX_STYLE_FAMILY_PAGE == eFamily && - SID_ATTR_PAGE_SIZE == pMap->nWID && + SID_ATTR_PAGE_SIZE == pEntry->nWID && beans::PropertyState_DIRECT_VALUE == pStates[i] ) { const SvxSizeItem& rSize = static_cast < const SvxSizeItem& >( aSet.Get(SID_ATTR_PAGE_SIZE) ); - sal_uInt8 nMemberId = pMap->nMemberId & 0x7f; + sal_uInt8 nMemberId = pEntry->nMemberId & 0x7f; if( ( LONG_MAX == rSize.GetSize().Width() && (MID_SIZE_WIDTH == nMemberId || MID_SIZE_SIZE == nMemberId ) ) || @@ -2901,18 +2897,18 @@ void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >& } } } - sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE; + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; switch(eFamily) { - case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_SET_CONDITIONAL_PARA_STYLE : PROPERTY_SET_PARA_STYLE; break; - case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_SET_FRAME_STYLE; break; - case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_SET_PAGE_STYLE; break; - case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_SET_NUM_STYLE; break; + case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; + case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE; break; + case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break; + case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE; break; default: ; } - SfxItemPropertySet &rPropSet = aSwMapProvider.GetPropertySet(nPropSetId); - const SfxItemPropertyMap *pMap = rPropSet.getPropertyMap(); + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); + const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap(); const OUString* pNames = aPropertyNames.getConstArray(); @@ -2920,22 +2916,22 @@ void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >& { for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ ) { - pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp] ); - if( !pMap ) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp] ); + if( !pEntry ) throw beans::UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is unknown: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - if ( pMap->nWID == FN_UNO_FOLLOW_STYLE || pMap->nWID == FN_UNO_NUM_RULES ) + if ( pEntry->nWID == FN_UNO_FOLLOW_STYLE || pEntry->nWID == FN_UNO_NUM_RULES ) throw uno::RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Cannot reset: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - if ( pMap->nFlags & beans::PropertyAttribute::READONLY ) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY ) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertiesToDefault: property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - //if( pMap->nWID == FN_UNO_DEFAULT_OUTLINE_LEVEL ) //#outline level, removed by zhaojianwei + //if( pEntry->nWID == FN_UNO_DEFAULT_OUTLINE_LEVEL ) //#outline level, removed by zhaojianwei // static_cast<SwTxtFmtColl*>(pTargetFmt)->SetOutlineLevel( NO_NUMBERING ); //else - // pTargetFmt->ResetFmtAttr( pMap->nWID ); - if( pMap->nWID == RES_PARATR_OUTLINELEVEL ) //add by zhaojianwei + // pTargetFmt->ResetFmtAttr( pEntry->nWID ); + if( pEntry->nWID == RES_PARATR_OUTLINELEVEL ) //add by zhaojianwei static_cast<SwTxtFmtColl*>(pTargetFmt)->DeleteAssignmentToListLevelOfOutlineStyle(); else - pTargetFmt->ResetFmtAttr( pMap->nWID ); //<-end,zhaojianwei + pTargetFmt->ResetFmtAttr( pEntry->nWID ); //<-end,zhaojianwei } } else if ( bIsDescriptor ) @@ -3089,35 +3085,34 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Seq if(pBase) { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); - sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE; + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; switch(eFamily) { - case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_SET_CONDITIONAL_PARA_STYLE : PROPERTY_SET_PARA_STYLE; break; - case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_SET_FRAME_STYLE; break; - case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_SET_PAGE_STYLE; break; - case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_SET_NUM_STYLE; break; + case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; + case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE; break; + case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break; + case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE; break; default: ; } - SfxItemPropertySet &rPropSet = aSwMapProvider.GetPropertySet(nPropSetId); - const SfxItemPropertyMap* pMap = rPropSet.getPropertyMap(); + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); + const SfxItemPropertyMap* pMap = pPropSet->getPropertyMap(); const SfxItemSet &rSet = xStyle->GetItemSet(), *pParentSet = rSet.GetParent(); const OUString *pNames = aPropertyNames.getConstArray(); uno::Any *pRet = aRet.getArray(); for ( sal_Int32 i = 0 ; i < nCount; i++) { - pMap = SfxItemPropertyMap::GetByName( pMap, pNames[i]); - - if ( !pMap ) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[i] ); + if ( !pEntry ) throw beans::UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) ); if( pParentSet ) - pRet[i] = aSwMapProvider.GetPropertySet(nPropSetId).getPropertyValue(pNames[i], *pParentSet); - else if( pMap->nWID != rSet.GetPool()->GetSlotId(pMap->nWID) ) + aSwMapProvider.GetPropertySet(nPropSetId)->getPropertyValue(pNames[i], *pParentSet, pRet[i]); + else if( pEntry->nWID != rSet.GetPool()->GetSlotId(pEntry->nWID) ) { - const SfxPoolItem& rItem = rSet.GetPool()->GetDefaultItem(pMap->nWID); - rItem.QueryValue(pRet[i], pMap->nMemberId); + const SfxPoolItem& rItem = rSet.GetPool()->GetDefaultItem(pEntry->nWID); + rItem.QueryValue(pRet[i], pEntry->nMemberId); } } } @@ -3217,14 +3212,14 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( { if(!GetDoc()) throw uno::RuntimeException(); - SfxItemPropertySet& aPropSet = aSwMapProvider.GetPropertySet(PROPERTY_SET_PAGE_STYLE); if(rPropertyNames.getLength() != rValues.getLength()) throw lang::IllegalArgumentException(); const OUString* pNames = rPropertyNames.getConstArray(); const uno::Any* pValues = rValues.getConstArray(); - const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap(); + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE); + const SfxItemPropertyMap* pMap = pPropSet->getPropertyMap(); SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName()); if(GetBasePool()) { @@ -3241,15 +3236,15 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { - pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp]); - if (!pMap) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp] ); + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); if(GetBasePool()) { - switch(pMap->nWID) + switch(pEntry->nWID) { case FN_UNO_HEADER_ON: case FN_UNO_HEADER_BACKGROUND: @@ -3277,7 +3272,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( sal_Bool bFooter = sal_False; sal_uInt16 nItemType = TYPE_BOOL; sal_uInt16 nRes = 0; - switch(pMap->nWID) + switch(pEntry->nWID) { case FN_UNO_FOOTER_ON: bFooter = sal_True; //kein break; @@ -3349,7 +3344,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( case TYPE_BOX: pNewItem = new SvxBoxItem(nRes); break; } } - bSetItem = pNewItem->PutValue(pValues[nProp], pMap->nMemberId); + bSetItem = pNewItem->PutValue(pValues[nProp], pEntry->nMemberId); rSetSet.Put(*pNewItem); aBaseImpl.GetItemSet().Put(*pNewSetItem); delete pNewItem; @@ -3386,7 +3381,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( { const SfxPoolItem& rItem = aBaseImpl.GetItemSet().Get(FN_PARAM_FTN_INFO); SfxPoolItem* pNewFtnItem = rItem.Clone(); - sal_Bool bPut = pNewFtnItem->PutValue(pValues[nProp], pMap->nMemberId); + sal_Bool bPut = pNewFtnItem->PutValue(pValues[nProp], pEntry->nMemberId); aBaseImpl.GetItemSet().Put(*pNewFtnItem); delete pNewFtnItem; if(!bPut) @@ -3402,7 +3397,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( throw lang::IllegalArgumentException(); //break; default: - lcl_SetStyleProperty(pMap, aPropSet, pValues[nProp], aBaseImpl, + lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); } } @@ -3460,18 +3455,18 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( throw uno::RuntimeException(); sal_Int32 nLength = rPropertyNames.getLength(); - SfxItemPropertySet& aPropSet = aSwMapProvider.GetPropertySet(PROPERTY_SET_PAGE_STYLE); const OUString* pNames = rPropertyNames.getConstArray(); uno::Sequence< uno::Any > aRet ( nLength ); uno::Any* pRet = aRet.getArray(); - const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap(); + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE); + const SfxItemPropertyMap* pMap = pPropSet->getPropertyMap(); SwStyleBase_Impl aBase(*GetDoc(), GetStyleName()); SfxStyleSheetBase* pBase = 0; for(sal_Int32 nProp = 0; nProp < nLength; nProp++) { - pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp]); - if (!pMap) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp] ); + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); if(GetBasePool()) @@ -3485,7 +3480,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( } sal_uInt16 nRes = 0; sal_Bool bHeader = sal_False, bAll = sal_False, bLeft = sal_False, bRight = sal_False; - switch(pMap->nWID) + switch(pEntry->nWID) { case FN_UNO_HEADER_ON: case FN_UNO_HEADER_BACKGROUND: @@ -3517,7 +3512,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); const SfxItemSet& rSet = xStyle->GetItemSet(); sal_Bool bFooter = sal_False; - switch(pMap->nWID) + switch(pEntry->nWID) { case FN_UNO_FOOTER_ON: bFooter = sal_True; @@ -3578,7 +3573,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( if(!pItem && nRes != rTmpSet.GetPool()->GetSlotId(nRes)) pItem = &rTmpSet.GetPool()->GetDefaultItem(nRes); if(pItem) - pItem->QueryValue(pRet[nProp], pMap->nMemberId); + pItem->QueryValue(pRet[nProp], pEntry->nMemberId); } } } @@ -3640,11 +3635,11 @@ MakeObject: rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); const SfxItemSet& rSet = xStyle->GetItemSet(); const SfxPoolItem& rItem = rSet.Get(FN_PARAM_FTN_INFO); - rItem.QueryValue(pRet[nProp], pMap->nMemberId); + rItem.QueryValue(pRet[nProp], pEntry->nMemberId); } break; default: - pRet[nProp] = lcl_GetStyleProperty(pMap, aPropSet, aBase, pBase, GetFamily(), GetDoc() ); + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); } } else if(IsDescriptor()) @@ -3912,25 +3907,25 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( if( !pDocShell ) throw uno::RuntimeException(); const USHORT* pRange = 0; - const SfxItemPropertyMap* pMap = 0; + const SfxItemPropertySet* pPropSet = 0; switch( eFamily ) { case IStyleAccess::AUTO_STYLE_CHAR: { pRange = aCharAutoFmtSetRange; - pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_CHAR_AUTO_STYLE); + pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE); } break; case IStyleAccess::AUTO_STYLE_RUBY: { pRange = 0;//aTxtNodeSetRange; - pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_RUBY_AUTO_STYLE); + pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_RUBY_AUTO_STYLE); } break; case IStyleAccess::AUTO_STYLE_PARA: { pRange = aTxtNodeSetRange; - pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARA_AUTO_STYLE); + pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARA_AUTO_STYLE); } break; @@ -3938,14 +3933,13 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( ; } SwAttrSet aSet( pDocShell->GetDoc()->GetAttrPool(), pRange ); - SfxItemPropertySet aPropSet( pMap ); const beans::PropertyValue* pSeq = Values.getConstArray(); sal_Int32 nLen = Values.getLength(); for( sal_Int32 i = 0; i < nLen; ++i ) { try { - aPropSet.setPropertyValue( pSeq[i].Name, pSeq[i].Value, aSet ); + pPropSet->setPropertyValue( pSeq[i].Name, pSeq[i].Value, aSet ); } catch (beans::UnknownPropertyException &) { @@ -4118,9 +4112,7 @@ uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( ) static uno::Reference< beans::XPropertySetInfo > xCharRef; if(!xCharRef.is()) { - SfxItemPropertySet aPropSet( - aSwMapProvider.GetPropertyMap(PROPERTY_MAP_CHAR_AUTO_STYLE)); - xCharRef = aPropSet.getPropertySetInfo(); + xCharRef = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE)->getPropertySetInfo(); } xRet = xCharRef; } @@ -4131,9 +4123,7 @@ uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( ) if(!xRubyRef.is()) { sal_uInt16 nMapId = PROPERTY_MAP_RUBY_AUTO_STYLE; - SfxItemPropertySet aPropSet( - aSwMapProvider.GetPropertyMap(nMapId)); - xRubyRef = aPropSet.getPropertySetInfo(); + xRubyRef = aSwMapProvider.GetPropertySet(nMapId)->getPropertySetInfo(); } xRet = xRubyRef; } @@ -4144,9 +4134,7 @@ uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( ) if(!xParaRef.is()) { sal_uInt16 nMapId = PROPERTY_MAP_PARA_AUTO_STYLE; - SfxItemPropertySet aPropSet( - aSwMapProvider.GetPropertyMap(nMapId)); - xParaRef = aPropSet.getPropertySetInfo(); + xParaRef = aSwMapProvider.GetPropertySet(nMapId)->getPropertySetInfo(); } xRet = xParaRef; } @@ -4250,18 +4238,18 @@ uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl( throw uno::RuntimeException(); // query_item - sal_Int8 nPropSetId = PROPERTY_SET_CHAR_AUTO_STYLE; + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; switch(eFamily) { - case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_SET_CHAR_AUTO_STYLE; break; - case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_SET_RUBY_AUTO_STYLE; break; - case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_SET_PARA_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break; default: ; } - SfxItemPropertySet &rPropSet = aSwMapProvider.GetPropertySet(nPropSetId); - const SfxItemPropertyMap *pMap = rPropSet.getPropertyMap(); + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); + const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap(); const OUString* pNames = rPropertyNames.getConstArray(); sal_Int32 nLen = rPropertyNames.getLength(); @@ -4273,16 +4261,16 @@ uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl( for( sal_Int32 i = 0; i < nLen; ++i ) { const String& rPropName = pNames[i]; - pMap = SfxItemPropertyMap::GetByName(pMap, rPropName); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(rPropName); + if(!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); - else if ( RES_TXTATR_AUTOFMT == pMap->nWID || RES_AUTO_STYLE == pMap->nWID ) + else if ( RES_TXTATR_AUTOFMT == pEntry->nWID || RES_AUTO_STYLE == pEntry->nWID ) { OUString sName(StylePool::nameOf( pSet )); pValues[i] <<= sName; } else - pValues[i] = rPropSet.getPropertyValue( *pMap, rSet ); + pPropSet->getPropertyValue( *pEntry, rSet, pValues[i] ); } return aRet; } @@ -4394,26 +4382,26 @@ uno::Sequence< beans::PropertyState > SwXAutoStyle::getPropertyStates( beans::PropertyState* pStates = aRet.getArray(); const OUString* pNames = rPropertyNames.getConstArray(); - sal_Int8 nPropSetId = PROPERTY_SET_CHAR_AUTO_STYLE; + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; switch(eFamily) { - case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_SET_CHAR_AUTO_STYLE; break; - case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_SET_RUBY_AUTO_STYLE; break; - case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_SET_PARA_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break; default: ; } - SfxItemPropertySet &rPropSet = aSwMapProvider.GetPropertySet(nPropSetId); - const SfxItemPropertyMap *pMap = rPropSet.getPropertyMap(); + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); + const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap(); SfxItemSet& rSet = *pSet.get(); for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) { const String& rPropName = pNames[i]; - pMap = SfxItemPropertyMap::GetByName(pMap, rPropName); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(rPropName); + if(!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); - pStates[i] = rPropSet.getPropertyState(*pMap, rSet); + pStates[i] = pPropSet->getPropertyState(*pEntry, rSet ); } return aRet; } @@ -4460,15 +4448,32 @@ uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno:: sal_Int8 nPropSetId = 0; switch(eFamily) { - case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_SET_CHAR_AUTO_STYLE; break; - case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_SET_RUBY_AUTO_STYLE; break; - case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_SET_PARA_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break; default: ; } - SfxItemPropertySet& rPropSet = aSwMapProvider.GetPropertySet(nPropSetId); - const SfxItemPropertyMap* pMap = rPropSet.getPropertyMap(); + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); + const SfxItemPropertyMap *pMap = pPropSet->getPropertyMap(); + PropertyEntryVector_t aPropVector = pMap->getPropertyEntries(); +// struct compareWhichIds +// { +// bool operator()(const USHORT w1, const USHORT w2) const +// { +// return w1 < w2; +// } +// }; +// typedef std::map<const USHORT, SfxItemPropertyNamedEntry, compareWhichIds> PropertyMap_t; +// PropertyMap_t aPropMap; +// aPropMap.reserve( aPropVector.size() ); +// PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin(); +// while( aIt != aPropertyEntries.end() ) +// { +// aPropMap[aIt->nWID] = *aIt; +// ++aIt; +// } SfxItemSet& rSet = *pSet.get(); SfxItemIter aIter(rSet); @@ -4478,8 +4483,29 @@ uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno:: { const USHORT nWID = pItem->Which(); - // TODO: Optimize - int i = 0; +// PropertyMap_t::const_iterator aMapIt = aPropMap[nWID]; +// if( aMapIt != aPropMap.getEnd() ) +// { +// beans::PropertyValue aPropertyValue; +// aPropertyValue.Name = aIt->sName; +// pItem->QueryValue( aPropertyValue.Value, aIt->nMemberId ); +// aPropertyVector.push_back( aPropertyValue ); +// } + // TODO: Optimize - and fix! the old iteration filled each WhichId + // only once but there are more properties than WhichIds + PropertyEntryVector_t::const_iterator aIt = aPropVector.begin(); + while( aIt != aPropVector.end() ) + { + if ( aIt->nWID == nWID ) + { + beans::PropertyValue aPropertyValue; + aPropertyValue.Name = aIt->sName; + pItem->QueryValue( aPropertyValue.Value, aIt->nMemberId ); + aPropertyVector.push_back( aPropertyValue ); + } + ++aIt; + } +/* int i = 0; while ( pMap[i].nWID != 0 ) { if ( pMap[i].nWID == nWID ) @@ -4492,7 +4518,7 @@ uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno:: break; } ++i; - } + }*/ pItem = aIter.NextItem(); } diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 4fbffb64ab54..e4aed674e7ae 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -69,6 +69,7 @@ #include <redline.hxx> #include <unoredline.hxx> #include <unoprnms.hxx> +#include <unocrsrhelper.hxx> #include <com/sun/star/text/WrapTextMode.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/text/TableColumnSeparator.hpp> @@ -149,11 +150,11 @@ sal_Bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLi /* -----------------11.12.98 14:22------------------- * * --------------------------------------------------*/ -void lcl_SetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertyMap* pMap, const uno::Any& aValue) +void lcl_SetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue) throw (lang::IllegalArgumentException) { //Sonderbehandlung fuer "Nicht-Items" - switch(pMap->nWID) + switch(pEntry->nWID) { case FN_TABLE_HEADLINE_REPEAT: case FN_TABLE_HEADLINE_COUNT: @@ -161,7 +162,7 @@ void lcl_SetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertyMap* pMap, cons SwTable* pTable = SwTable::FindTable( pFmt ); { UnoActionContext aAction(pFmt->GetDoc()); - if( pMap->nWID == FN_TABLE_HEADLINE_REPEAT) + if( pEntry->nWID == FN_TABLE_HEADLINE_REPEAT) { sal_Bool bVal = *(sal_Bool*)aValue.getValue(); pFmt->GetDoc()->SetRowsToRepeat( *pTable, bVal ? 1 : 0 ); @@ -182,20 +183,20 @@ void lcl_SetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertyMap* pMap, cons { sal_Int32 nWidth = 0; SwFmtFrmSize aSz( pFmt->GetFrmSize() ); - if(FN_TABLE_WIDTH == pMap->nWID) + if(FN_TABLE_WIDTH == pEntry->nWID) { aValue >>= nWidth; aSz.SetWidthPercent(0); aSz.SetWidth ( MM100_TO_TWIP ( nWidth ) ); } - else if(FN_TABLE_RELATIVE_WIDTH == pMap->nWID) + else if(FN_TABLE_RELATIVE_WIDTH == pEntry->nWID) { sal_Int16 nSet = 0; aValue >>= nSet; if(nSet && nSet <=100) aSz.SetWidthPercent( (BYTE)nSet ); } - else if(FN_TABLE_IS_RELATIVE_WIDTH == pMap->nWID) + else if(FN_TABLE_IS_RELATIVE_WIDTH == pEntry->nWID) { sal_Bool bPercent = *(sal_Bool*)aValue.getValue(); if(!bPercent) @@ -233,17 +234,17 @@ void lcl_SetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertyMap* pMap, cons /* -----------------27.04.98 08:50------------------- * * --------------------------------------------------*/ -uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertyMap* pMap ) +uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimpleEntry* pEntry ) { uno::Any aRet; - switch(pMap->nWID) + switch(pEntry->nWID) { case FN_TABLE_HEADLINE_REPEAT: case FN_TABLE_HEADLINE_COUNT: { SwTable* pTable = SwTable::FindTable( pFmt ); USHORT nRepeat = pTable->GetRowsToRepeat(); - if(pMap->nWID == FN_TABLE_HEADLINE_REPEAT) + if(pEntry->nWID == FN_TABLE_HEADLINE_REPEAT) { BOOL bTemp = nRepeat > 0; aRet.setValue(&bTemp, ::getCppuBooleanType()); @@ -257,9 +258,9 @@ uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertyMap* pMap ) case FN_TABLE_RELATIVE_WIDTH: { const SwFmtFrmSize& rSz = pFmt->GetFrmSize(); - if(FN_TABLE_WIDTH == pMap->nWID) + if(FN_TABLE_WIDTH == pEntry->nWID) rSz.QueryValue(aRet, MID_FRMSIZE_WIDTH|CONVERT_TWIPS); - else if(FN_TABLE_RELATIVE_WIDTH == pMap->nWID) + else if(FN_TABLE_RELATIVE_WIDTH == pEntry->nWID) rSz.QueryValue(aRet, MID_FRMSIZE_REL_WIDTH); else { @@ -308,7 +309,7 @@ uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertyMap* pMap ) { SwTable* pTable = SwTable::FindTable( pFmt ); SwNode* pTblNode = pTable->GetTableNode(); - if(FN_UNO_REDLINE_NODE_END == pMap->nWID) + if(FN_UNO_REDLINE_NODE_END == pEntry->nWID) pTblNode = pTblNode->EndOfSectionNode(); const SwRedlineTbl& rRedTbl = pFmt->GetDoc()->GetRedlineTbl(); for(USHORT nRed = 0; nRed < rRedTbl.Count(); nRed++) @@ -760,45 +761,6 @@ void lcl_setValue( SwXCell &rCell, double nVal ) pDoc->UpdateTblFlds( &aTblUpdate ); } } - -/****************************************************************************** - * - ******************************************************************************/ - -const SfxItemPropertyMap* GetTableDescPropertyMap() -{ - static SfxItemPropertyMap aTableDescPropertyMap_Impl[] = - { - { SW_PROP_NAME(UNO_NAME_BACK_COLOR ) , RES_BACKGROUND, &::getCppuType((const sal_Int32*)0), PROPERTY_NONE,MID_BACK_COLOR }, - { SW_PROP_NAME(UNO_NAME_BREAK_TYPE), RES_BREAK, &::getCppuType((const style::BreakType*)0), PROPERTY_NONE, 0}, - { SW_PROP_NAME(UNO_NAME_GRAPHIC_URL ), RES_BACKGROUND, &::getCppuType((const OUString*)0), PROPERTY_NONE ,MID_GRAPHIC_URL }, - { SW_PROP_NAME(UNO_NAME_GRAPHIC_FILTER ), RES_BACKGROUND, &::getCppuType((const OUString*)0), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, - { SW_PROP_NAME(UNO_NAME_GRAPHIC_LOCATION) , RES_BACKGROUND, &::getCppuType((const style::GraphicLocation*)0), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, - { SW_PROP_NAME(UNO_NAME_LEFT_MARGIN), RES_LR_SPACE, &::getCppuType((const sal_Int32*)0), PROPERTY_NONE, MID_L_MARGIN}, - { SW_PROP_NAME(UNO_NAME_RIGHT_MARGIN), RES_LR_SPACE, &::getCppuType((const sal_Int32*)0), PROPERTY_NONE, MID_R_MARGIN}, - { SW_PROP_NAME(UNO_NAME_HORI_ORIENT ), RES_HORI_ORIENT, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE ,MID_HORIORIENT_ORIENT }, - { SW_PROP_NAME(UNO_NAME_KEEP_TOGETHER), RES_KEEP, &::getBooleanCppuType() , PROPERTY_NONE, 0}, - { SW_PROP_NAME(UNO_NAME_SPLIT ), RES_LAYOUT_SPLIT, &::getBooleanCppuType() , PROPERTY_NONE, 0}, - { SW_PROP_NAME(UNO_NAME_PAGE_NUMBER_OFFSET), RES_PAGEDESC, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, MID_PAGEDESC_PAGENUMOFFSET}, - { SW_PROP_NAME(UNO_NAME_PAGE_STYLE_NAME), 0, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0}, - { SW_PROP_NAME(UNO_NAME_RELATIVE_WIDTH), FN_TABLE_RELATIVE_WIDTH,&::getCppuType((const sal_Int16*)0) , PROPERTY_NONE, 0 }, - { SW_PROP_NAME(UNO_NAME_REPEAT_HEADLINE) , FN_TABLE_HEADLINE_REPEAT,&::getBooleanCppuType(), PROPERTY_NONE, 0}, - { SW_PROP_NAME(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, &::getCppuType((const table::ShadowFormat*)0), PROPERTY_NONE, CONVERT_TWIPS}, - { SW_PROP_NAME(UNO_NAME_IS_WIDTH_RELATIVE), FN_TABLE_IS_RELATIVE_WIDTH, &::getBooleanCppuType() , PROPERTY_NONE, 0 }, - { SW_PROP_NAME(UNO_NAME_TABLE_NAME), 0, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0 }, - { SW_PROP_NAME(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, &::getCppuType((const sal_Int32*)0), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS}, - { SW_PROP_NAME(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, &::getCppuType((const sal_Int32*)0), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS}, - { SW_PROP_NAME(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, &::getBooleanCppuType(), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, - { SW_PROP_NAME(UNO_NAME_WIDTH), FN_TABLE_WIDTH, &::getCppuType((const sal_Int32*)0) , PROPERTY_NONE, 0}, - { SW_PROP_NAME(UNO_NAME_CHART_ROW_AS_LABEL), FN_UNO_RANGE_ROW_LABEL, &::getBooleanCppuType(), PROPERTY_NONE, 0}, - { SW_PROP_NAME(UNO_NAME_CHART_COLUMN_AS_LABEL), FN_UNO_RANGE_COL_LABEL, &::getBooleanCppuType() , PROPERTY_NONE, 0}, - { SW_PROP_NAME(UNO_NAME_TABLE_BORDER), FN_UNO_TABLE_BORDER, &::getCppuType((const table::TableBorder*)0), beans::PropertyAttribute::MAYBEVOID, CONVERT_TWIPS }, - { SW_PROP_NAME(UNO_NAME_TABLE_BORDER_DISTANCES), FN_UNO_TABLE_BORDER_DISTANCES, &::getCppuType((const table::TableBorderDistances*)0), beans::PropertyAttribute::MAYBEVOID, CONVERT_TWIPS }, - {0,0,0,0,0,0} - }; - #define TABLE_PROP_COUNT 25 - return aTableDescPropertyMap_Impl; -} /****************************************************************** * SwXCell ******************************************************************/ @@ -809,7 +771,7 @@ TYPEINIT1(SwXCell, SwClient); SwXCell::SwXCell(SwFrmFmt* pTblFmt, SwTableBox* pBx, sal_uInt16 nPos ) : SwXText(pTblFmt->GetDoc(), CURSOR_TBLTEXT), SwClient(pTblFmt), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TABLE_CELL)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)), pBox(pBx), pStartNode(0), nFndPos(nPos) @@ -821,7 +783,7 @@ SwXCell::SwXCell(SwFrmFmt* pTblFmt, SwTableBox* pBx, sal_uInt16 nPos ) : SwXCell::SwXCell(SwFrmFmt* pTblFmt, const SwStartNode& rStartNode) : SwXText(pTblFmt->GetDoc(), CURSOR_TBLTEXT), SwClient(pTblFmt), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TABLE_CELL)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)), pBox(0), pStartNode(&rStartNode), nFndPos(USHRT_MAX) @@ -1120,7 +1082,7 @@ uno::Reference< text::XTextCursor > SwXCell::createTextCursorByRange(const uno: -----------------------------------------------------------------------*/ uno::Reference< beans::XPropertySetInfo > SwXCell::getPropertySetInfo(void) throw( uno::RuntimeException ) { - static uno::Reference< beans::XPropertySetInfo > xRef = aPropSet.getPropertySetInfo(); + static uno::Reference< beans::XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo(); return xRef; } /*-- 11.12.98 10:56:34--------------------------------------------------- @@ -1132,15 +1094,15 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV vos::OGuard aGuard(Application::GetSolarMutex()); if(IsValid()) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); - if( !pMap ) + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if( !pEntry ) { beans::UnknownPropertyException aEx; aEx.Message = rPropertyName; throw( aEx ); } - if( pMap->nWID == FN_UNO_CELL_ROW_SPAN ) + if( pEntry->nWID == FN_UNO_CELL_ROW_SPAN ) { sal_Int32 nRowSpan = 0; if( aValue >>= nRowSpan ) @@ -1150,7 +1112,7 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV { SwFrmFmt* pBoxFmt = pBox->ClaimFrmFmt(); SwAttrSet aSet(pBoxFmt->GetAttrSet()); - aPropSet.setPropertyValue(rPropertyName, aValue, aSet); + m_pPropSet->setPropertyValue(rPropertyName, aValue, aSet); pBoxFmt->GetDoc()->SetAttr(aSet, *pBoxFmt); } } @@ -1165,15 +1127,15 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName) uno::Any aRet; if(IsValid()) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); - if( !pMap ) + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if( !pEntry ) { beans::UnknownPropertyException aEx; aEx.Message = rPropertyName; throw( aEx ); } - switch( pMap->nWID ) + switch( pEntry->nWID ) { case FN_UNO_CELL_ROW_SPAN: aRet <<= pBox->getRowSpan(); @@ -1207,7 +1169,7 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName) { const SwFrmFmt* pBoxFmt = pBox->GetFrmFmt(); const SwAttrSet& rSet = pBoxFmt->GetAttrSet(); - aRet = aPropSet.getPropertyValue(rPropertyName, rSet); + m_pPropSet->getPropertyValue(rPropertyName, rSet, aRet); } } } @@ -1405,7 +1367,7 @@ TYPEINIT1(SwXTextTableRow, SwClient); -----------------------------------------------------------------------*/ SwXTextTableRow::SwXTextTableRow(SwFrmFmt* pFmt, SwTableLine* pLn) : SwClient(pFmt), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE_ROW)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_ROW)), pLine(pLn) { @@ -1422,7 +1384,7 @@ SwXTextTableRow::~SwXTextTableRow() -----------------------------------------------------------------------*/ uno::Reference< beans::XPropertySetInfo > SwXTextTableRow::getPropertySetInfo(void) throw( uno::RuntimeException ) { - static uno::Reference< beans::XPropertySetInfo > xRef = aPropSet.getPropertySetInfo(); + static uno::Reference< beans::XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo(); return xRef; } /*-- 11.12.98 12:04:46--------------------------------------------------- @@ -1440,21 +1402,21 @@ void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName, SwTableLine* pLn = SwXTextTableRow::FindLine(pTable, pLine); if(pLn) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName(rPropertyName); SwDoc* pDoc = pFmt->GetDoc(); - if (!pMap) + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - switch(pMap->nWID) + switch(pEntry->nWID) { case FN_UNO_ROW_HEIGHT: case FN_UNO_ROW_AUTO_HEIGHT: { SwFmtFrmSize aFrmSize(pLn->GetFrmFmt()->GetFrmSize()); - if(FN_UNO_ROW_AUTO_HEIGHT== pMap->nWID) + if(FN_UNO_ROW_AUTO_HEIGHT== pEntry->nWID) { sal_Bool bSet = *(sal_Bool*)aValue.getValue(); aFrmSize.SetHeightSizeType(bSet ? ATT_VAR_SIZE : ATT_FIX_SIZE); @@ -1481,7 +1443,7 @@ void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName, { SwFrmFmt* pLnFmt = pLn->ClaimFrmFmt(); SwAttrSet aSet(pLnFmt->GetAttrSet()); - aPropSet.setPropertyValue(*pMap, aValue, aSet); + m_pPropSet->setPropertyValue(*pEntry, aValue, aSet); pDoc->SetAttr(aSet, *pLnFmt); } } @@ -1502,18 +1464,18 @@ uno::Any SwXTextTableRow::getPropertyValue(const OUString& rPropertyName) throw( SwTableLine* pLn = SwXTextTableRow::FindLine(pTable, pLine); if(pLn) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); - if (!pMap) + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - switch(pMap->nWID) + switch(pEntry->nWID) { case FN_UNO_ROW_HEIGHT: case FN_UNO_ROW_AUTO_HEIGHT: { const SwFmtFrmSize& rSize = pLn->GetFrmFmt()->GetFrmSize(); - if(FN_UNO_ROW_AUTO_HEIGHT== pMap->nWID) + if(FN_UNO_ROW_AUTO_HEIGHT== pEntry->nWID) { BOOL bTmp = ATT_VAR_SIZE == rSize.GetHeightSizeType(); aRet.setValue(&bTmp, ::getCppuBooleanType()); @@ -1530,7 +1492,7 @@ uno::Any SwXTextTableRow::getPropertyValue(const OUString& rPropertyName) throw( default: { const SwAttrSet& rSet = pLn->GetFrmFmt()->GetAttrSet(); - aRet = aPropSet.getPropertyValue(*pMap, rSet); + m_pPropSet->getPropertyValue(*pEntry, rSet, aRet); } } } @@ -1630,7 +1592,7 @@ uno::Sequence< OUString > SwXTextTableCursor::getSupportedServiceNames(void) thr SwXTextTableCursor::SwXTextTableCursor(SwFrmFmt* pFmt, SwTableBox* pBox) : SwClient(pFmt), aCrsrDepend(this, 0), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE_CURSOR)) + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR)) { SwDoc* pDoc = pFmt->GetDoc(); const SwStartNode* pSttNd = pBox->GetSttNd(); @@ -1647,7 +1609,7 @@ SwXTextTableCursor::SwXTextTableCursor(SwFrmFmt* pFmt, SwTableBox* pBox) : SwXTextTableCursor::SwXTextTableCursor(SwFrmFmt& rTableFmt, const SwTableCursor* pTableSelection) : SwClient(&rTableFmt), aCrsrDepend(this, 0), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE_CURSOR)) + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR)) { SwUnoCrsr* pUnoCrsr = pTableSelection->GetDoc()->CreateUnoCrsr(*pTableSelection->GetPoint(), sal_True); if(pTableSelection->HasMark()) @@ -1888,13 +1850,13 @@ sal_Bool SwXTextTableCursor::splitRange(sal_Int16 Count, sal_Bool Horizontal) th -----------------------------------------------------------------------*/ uno::Reference< beans::XPropertySetInfo > SwXTextTableCursor::getPropertySetInfo(void) throw( uno::RuntimeException ) { - static uno::Reference< beans::XPropertySetInfo > xRef = aPropSet.getPropertySetInfo(); + static uno::Reference< beans::XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo(); return xRef; } /*-- 11.12.98 12:16:17--------------------------------------------------- -----------------------------------------------------------------------*/ -extern sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertyMap* pMap, +extern sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertySimpleEntry* pEntry, SwPaM& rPam, SfxItemSet& rSet, const uno::Any& aValue ) throw (lang::IllegalArgumentException); @@ -1916,21 +1878,21 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const SwTableNode* pTblNode = pSttNode->FindTableNode(); lcl_FormatTable((SwFrmFmt*)pTblNode->GetTable().GetFrmFmt()); SwUnoTableCrsr* pTblCrsr = *pUnoCrsr; - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if(pEntry) { - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); pTblCrsr->MakeBoxSels(); SwDoc* pDoc = pUnoCrsr->GetDoc(); - switch(pMap->nWID ) + switch(pEntry->nWID ) { case FN_UNO_TABLE_CELL_BACKGROUND: { SvxBrushItem aBrush( RES_BACKGROUND ); pDoc->GetBoxAttr( *pUnoCrsr, aBrush ); - aBrush.PutValue(aValue, pMap->nMemberId); + aBrush.PutValue(aValue, pEntry->nMemberId); pDoc->SetBoxAttr( *pUnoCrsr, aBrush ); } @@ -1947,11 +1909,11 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, break; default: { - SfxItemSet aItemSet( pDoc->GetAttrPool(), pMap->nWID, pMap->nWID ); + SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID ); SwXTextCursor::GetCrsrAttr( pTblCrsr->GetSelRing(), aItemSet ); - if(!lcl_setCrsrPropertyValue( pMap, pTblCrsr->GetSelRing(), aItemSet, aValue )) - aPropSet.setPropertyValue( *pMap, aValue, aItemSet ); + if(!lcl_setCrsrPropertyValue( pEntry, pTblCrsr->GetSelRing(), aItemSet, aValue )) + m_pPropSet->setPropertyValue( *pEntry, aValue, aItemSet ); SwXTextCursor::SetCrsrAttr( pTblCrsr->GetSelRing(), aItemSet, CRSR_ATTR_MODE_TABLE ); } } @@ -1975,18 +1937,18 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName) const SwTableNode* pTblNode = pSttNode->FindTableNode(); lcl_FormatTable((SwFrmFmt*)pTblNode->GetTable().GetFrmFmt()); SwUnoTableCrsr* pTblCrsr = *pUnoCrsr; - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if(pEntry) { pTblCrsr->MakeBoxSels(); - switch(pMap->nWID ) + switch(pEntry->nWID ) { case FN_UNO_TABLE_CELL_BACKGROUND: { SvxBrushItem aBrush( RES_BACKGROUND ); if(pTblCrsr->GetDoc()->GetBoxAttr( *pUnoCrsr, aBrush )) - aBrush.QueryValue(aRet, pMap->nMemberId); + aBrush.QueryValue(aRet, pEntry->nMemberId); } break; @@ -2011,7 +1973,7 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName) 0L); // erstmal die Attribute des Cursors SwXTextCursor::GetCrsrAttr(pTblCrsr->GetSelRing(), aSet); - aRet = aPropSet.getPropertyValue(*pMap, aSet); + m_pPropSet->getPropertyValue(*pEntry, aSet, aRet); } } } @@ -2064,85 +2026,43 @@ void SwXTextTableCursor::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) class SwTableProperties_Impl { - const SfxItemPropertyMap* _pMap; - uno::Any* pAnyArr[TABLE_PROP_COUNT]; - sal_uInt16 nArrLen; - + SwUnoCursorHelper::SwAnyMapHelper aAnyMap; public: - SwTableProperties_Impl(const SfxItemPropertyMap* pMap); + SwTableProperties_Impl(); ~SwTableProperties_Impl(); - sal_Bool SetProperty(const char* pName , uno::Any aVal); - sal_Bool GetProperty(const char* pName, uno::Any*& rpAny); - - sal_Bool SetProperty(USHORT nId , uno::Any aVal) - { return SetProperty(SW_PROP_NAME_STR( nId ), aVal); } - sal_Bool GetProperty(USHORT nId, uno::Any*& rpAny) - { return GetProperty(SW_PROP_NAME_STR( nId ), rpAny); } + void SetProperty(USHORT nWhichId, USHORT nMemberId, const uno::Any& aVal); + sal_Bool GetProperty(USHORT nWhichId, USHORT nMemberId, const uno::Any*& rpAny); - const SfxItemPropertyMap* GetMap() const {return _pMap;} - void ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc); + void ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc); }; /* -----------------22.06.98 09:43------------------- * * --------------------------------------------------*/ -SwTableProperties_Impl::SwTableProperties_Impl(const SfxItemPropertyMap* pMap) : - _pMap(pMap), - nArrLen(TABLE_PROP_COUNT) +SwTableProperties_Impl::SwTableProperties_Impl() { - for(sal_uInt16 i = 0; i < nArrLen; i++) - pAnyArr[i] = 0; } /* -----------------22.06.98 09:51------------------- * * --------------------------------------------------*/ SwTableProperties_Impl::~SwTableProperties_Impl() { - for(sal_uInt16 i = 0; i < nArrLen; i++) - delete pAnyArr[i]; } /* -----------------22.06.98 09:51------------------- * * --------------------------------------------------*/ -sal_Bool SwTableProperties_Impl::SetProperty(const char* pName, uno::Any aVal) +void SwTableProperties_Impl::SetProperty(USHORT nWhichId, USHORT nMemberId, const uno::Any& rVal) { - sal_uInt16 nPos = 0; - const SfxItemPropertyMap* pTemp = _pMap; - String aName(C2S( pName )); - while( pTemp->pName ) - { - if( aName.EqualsAscii(pTemp->pName)) - break; - ++nPos; - ++pTemp; - } - if(nPos < nArrLen) - { - delete pAnyArr[nPos]; - pAnyArr[nPos] = new uno::Any(aVal); - } - return nPos < nArrLen; + aAnyMap.SetValue( nWhichId, nMemberId, rVal ); } /* -----------------22.06.98 09:51------------------- * * --------------------------------------------------*/ -sal_Bool SwTableProperties_Impl::GetProperty(const char* pName, uno::Any*& rpAny ) +sal_Bool SwTableProperties_Impl::GetProperty(USHORT nWhichId, USHORT nMemberId, const uno::Any*& rpAny ) { - sal_uInt16 nPos = 0; - const SfxItemPropertyMap* pTemp = _pMap; - String aName(C2S(pName)); - while( pTemp->pName ) - { - if(aName.EqualsAscii(pTemp->pName)) - break; - ++nPos; - ++pTemp; - } - if(nPos < nArrLen) - rpAny = pAnyArr[nPos]; - return rpAny && nPos < nArrLen; + return aAnyMap.FillValue( nWhichId, nMemberId, rpAny ); } /* -----------------13.01.99 15:42------------------- * @@ -2160,24 +2080,24 @@ void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc) RES_PAGEDESC, RES_PAGEDESC, 0 ); - uno::Any* pRepHead; + const uno::Any* pRepHead; const SwFrmFmt &rFrmFmt = *rTbl.GetFrmFmt(); - if(GetProperty(UNO_NAME_REPEAT_HEADLINE, pRepHead )) + if(GetProperty(FN_TABLE_HEADLINE_REPEAT, 0xff, pRepHead )) { sal_Bool bVal = *(sal_Bool*)pRepHead->getValue(); ((SwTable&)rTbl).SetRowsToRepeat( bVal ? 1 : 0 ); // TODO MULTIHEADER } - uno::Any* pBackColor = 0; - GetProperty(UNO_NAME_BACK_COLOR, pBackColor ); - uno::Any* pBackTrans = 0; - GetProperty(UNO_NAME_BACK_TRANSPARENT, pBackTrans ); - uno::Any* pGrLoc = 0; - GetProperty(UNO_NAME_GRAPHIC_LOCATION, pGrLoc ); - uno::Any* pGrURL = 0; - GetProperty(UNO_NAME_GRAPHIC_URL, pGrURL ); - uno::Any* pGrFilter = 0; - GetProperty(UNO_NAME_GRAPHIC_FILTER, pGrFilter ); + const uno::Any* pBackColor = 0; + GetProperty(RES_BACKGROUND, MID_BACK_COLOR, pBackColor ); + const uno::Any* pBackTrans = 0; + GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT, pBackTrans ); + const uno::Any* pGrLoc = 0; + GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION, pGrLoc ); + const uno::Any* pGrURL = 0; + GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL, pGrURL ); + const uno::Any* pGrFilter = 0; + GetProperty(RES_BACKGROUND, MID_GRAPHIC_FILTER, pGrFilter ); if(pBackColor||pBackTrans||pGrURL||pGrFilter||pGrLoc) { @@ -2196,8 +2116,8 @@ void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc) } sal_Bool bPutBreak = sal_True; - uno::Any* pPage; - if(GetProperty(UNO_NAME_PAGE_STYLE_NAME, pPage)) + const uno::Any* pPage; + if(GetProperty(FN_UNO_PAGE_STYLE, 0, pPage) || GetProperty(RES_PAGEDESC, 0xff, pPage)) { OUString uTmp; (*pPage) >>= uTmp; @@ -2209,8 +2129,8 @@ void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc) if(pDesc) { SwFmtPageDesc aDesc( pDesc ); - uno::Any* pPgNo; - if(GetProperty(UNO_NAME_PAGE_NUMBER_OFFSET, pPgNo )) + const uno::Any* pPgNo; + if(GetProperty(RES_PAGEDESC, MID_PAGEDESC_PAGENUMOFFSET, pPgNo )) { INT16 nTmp = 0; (*pPgNo) >>= nTmp; @@ -2222,22 +2142,22 @@ void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc) } } - uno::Any* pBreak; - if(bPutBreak && GetProperty(UNO_NAME_BREAK_TYPE, pBreak)) + const uno::Any* pBreak; + if(bPutBreak && GetProperty(RES_BREAK, 0, pBreak)) { SvxFmtBreakItem aBreak ( rFrmFmt.GetBreak() ); aBreak.PutValue(*pBreak, 0); aSet.Put(aBreak); } - uno::Any* pShadow; - if(GetProperty(UNO_NAME_SHADOW_FORMAT, pShadow)) + const uno::Any* pShadow; + if(GetProperty(RES_SHADOW, 0, pShadow)) { SvxShadowItem aShd ( rFrmFmt.GetShadow() ); aShd.PutValue(*pShadow, CONVERT_TWIPS); aSet.Put(aShd); } - uno::Any* pKeep; - if(GetProperty(UNO_NAME_KEEP_TOGETHER, pKeep)) + const uno::Any* pKeep; + if(GetProperty(RES_KEEP, 0, pKeep)) { SvxFmtKeepItem aKeep( rFrmFmt.GetKeep() ); aKeep.PutValue(*pKeep, 0); @@ -2245,8 +2165,8 @@ void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc) } sal_Bool bFullAlign = sal_True; - uno::Any* pHOrient; - if(GetProperty(UNO_NAME_HORI_ORIENT, pHOrient)) + const uno::Any* pHOrient; + if(GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, pHOrient)) { SwFmtHoriOrient aOrient ( rFrmFmt.GetHoriOrient() ); ((SfxPoolItem&)aOrient).PutValue(*pHOrient, MID_HORIORIENT_ORIENT|CONVERT_TWIPS); @@ -2255,12 +2175,12 @@ void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc) } - uno::Any* pSzRel = 0; - GetProperty(UNO_NAME_IS_WIDTH_RELATIVE, pSzRel ); - uno::Any* pRelWidth = 0; - GetProperty(UNO_NAME_RELATIVE_WIDTH, pRelWidth); - uno::Any* pWidth = 0; - GetProperty(UNO_NAME_WIDTH, pWidth ); + const uno::Any* pSzRel = 0; + GetProperty(FN_TABLE_IS_RELATIVE_WIDTH, 0xff, pSzRel ); + const uno::Any* pRelWidth = 0; + GetProperty(FN_TABLE_RELATIVE_WIDTH, 0xff, pRelWidth); + const uno::Any* pWidth = 0; + GetProperty(FN_TABLE_WIDTH, 0xff, pWidth ); sal_Bool bPutSize = pWidth != 0; SwFmtFrmSize aSz( ATT_VAR_SIZE); @@ -2281,10 +2201,10 @@ void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc) aSz.SetWidth(MINLAY); aSet.Put(aSz); } - uno::Any* pL = 0; - GetProperty(UNO_NAME_LEFT_MARGIN, pL); - uno::Any* pR = 0; - GetProperty(UNO_NAME_RIGHT_MARGIN, pR); + const uno::Any* pL = 0; + GetProperty(RES_LR_SPACE, MID_L_MARGIN|CONVERT_TWIPS, pL); + const uno::Any* pR = 0; + GetProperty(RES_LR_SPACE, MID_R_MARGIN|CONVERT_TWIPS, pR); if(pL||pR) { SvxLRSpaceItem aLR ( rFrmFmt.GetLRSpace() ); @@ -2294,10 +2214,10 @@ void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc) ((SfxPoolItem&)aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS); aSet.Put(aLR); } - uno::Any* pU = 0; - GetProperty(UNO_NAME_TOP_MARGIN, pU); - uno::Any* pLo = 0; - GetProperty(UNO_NAME_BOTTOM_MARGIN, pLo); + const uno::Any* pU = 0; + GetProperty(RES_UL_SPACE, MID_UP_MARGIN|CONVERT_TWIPS, pU); + const uno::Any* pLo = 0; + GetProperty(RES_UL_SPACE, MID_LO_MARGIN|CONVERT_TWIPS, pLo); if(pU||pLo) { SvxULSpaceItem aUL ( rFrmFmt.GetULSpace() ); @@ -2307,8 +2227,8 @@ void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc) ((SfxPoolItem&)aUL).PutValue(*pLo, MID_LO_MARGIN|CONVERT_TWIPS); aSet.Put(aUL); } - uno::Any* pSplit; - if(GetProperty(UNO_NAME_SPLIT, pSplit )) + const::uno::Any* pSplit; + if(GetProperty(RES_LAYOUT_SPLIT, 0, pSplit )) { sal_Bool bTmp = *(sal_Bool*)pSplit->getValue(); SwFmtLayoutSplit aSp(bTmp); @@ -2369,9 +2289,8 @@ TYPEINIT1(SwXTextTable, SwClient) SwXTextTable::SwXTextTable() : aLstnrCntnr( (text::XTextTable*)this), aChartLstnrCntnr( (text::XTextTable*)this), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE)), - _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE)), - pTableProps(new SwTableProperties_Impl(GetTableDescPropertyMap())), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE)), + pTableProps(new SwTableProperties_Impl), bIsDescriptor(sal_True), nRows(2), nColumns(2), @@ -2387,8 +2306,7 @@ SwXTextTable::SwXTextTable(SwFrmFmt& rFrmFmt) : SwClient( &rFrmFmt ), aLstnrCntnr( (text::XTextTable*)this), aChartLstnrCntnr( (text::XTextTable*)this), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE)), - _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE)), pTableProps(0), bIsDescriptor(sal_False), nRows(0), @@ -2607,8 +2525,8 @@ void SwXTextTable::attachToRange(const uno::Reference< text::XTextRange > & xTex pDoc->SetTableName( *pTblFmt, sTmpNameIndex); } - uno::Any* pName; - if(pTableProps->GetProperty(UNO_NAME_TABLE_NAME, pName)) + const::uno::Any* pName; + if(pTableProps->GetProperty(FN_UNO_TABLE_NAME, 0, pName)) { OUString sTmp; (*pName) >>= sTmp; @@ -3312,7 +3230,7 @@ void SwXTextTable::autoFormat(const OUString& aName) throw( lang::IllegalArgumen -----------------------------------------------------------------------*/ uno::Reference< beans::XPropertySetInfo > SwXTextTable::getPropertySetInfo(void) throw( uno::RuntimeException ) { - static uno::Reference< beans::XPropertySetInfo > xRef = aPropSet.getPropertySetInfo(); + static uno::Reference< beans::XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo(); return xRef; } /*-- 11.12.98 12:42:50--------------------------------------------------- @@ -3327,23 +3245,30 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, SwFrmFmt* pFmt = GetFrmFmt(); if(!aValue.hasValue()) throw lang::IllegalArgumentException(); + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if( !pEntry ) + throw lang::IllegalArgumentException(); if(pFmt) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if (!pMap) - throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if(0xFF == pMap->nMemberId) + if(0xFF == pEntry->nMemberId) { - lcl_SetSpecialProperty(pFmt, pMap, aValue); + lcl_SetSpecialProperty(pFmt, pEntry, aValue); } else { - switch(pMap->nWID) + switch(pEntry->nWID) { + case UNO_NAME_TABLE_NAME : + { + ::rtl::OUString sName; + aValue >>= sName; + setName( sName ); + } + break; case FN_UNO_RANGE_ROW_LABEL: { sal_Bool bTmp = *(sal_Bool*)aValue.getValue(); @@ -3506,7 +3431,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, default: { SwAttrSet aSet(pFmt->GetAttrSet()); - aPropSet.setPropertyValue(*pMap, aValue, aSet); + m_pPropSet->setPropertyValue(*pEntry, aValue, aSet); pFmt->GetDoc()->SetAttr(aSet, *pFmt); } } @@ -3515,10 +3440,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, else if(bIsDescriptor) { String aPropertyName(rPropertyName); - if(!pTableProps->SetProperty( - ByteString( aPropertyName, RTL_TEXTENCODING_ASCII_US).GetBuffer(), - aValue)) - throw lang::IllegalArgumentException(); + pTableProps->SetProperty( pEntry->nWID, pEntry->nMemberId, aValue); } else throw uno::RuntimeException(); @@ -3531,25 +3453,30 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( be vos::OGuard aGuard(Application::GetSolarMutex()); uno::Any aRet; SwFrmFmt* pFmt = GetFrmFmt(); + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName(rPropertyName); if(pFmt) { - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if (!pMap) + if (!pEntry) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if(0xFF == pMap->nMemberId) + if(0xFF == pEntry->nMemberId) { - aRet = lcl_GetSpecialProperty(pFmt, pMap ); + aRet = lcl_GetSpecialProperty(pFmt, pEntry ); } else { - switch(pMap->nWID) + switch(pEntry->nWID) { + case UNO_NAME_TABLE_NAME: + { + aRet <<= getName(); + } + break; case FN_UNO_ANCHOR_TYPES: case FN_UNO_TEXT_WRAP: case FN_UNO_ANCHOR_TYPE: - SwXParagraph::getDefaultTextContentValue(aRet, OUString(), pMap->nWID); + SwXParagraph::getDefaultTextContentValue(aRet, OUString(), pEntry->nWID); break; case FN_UNO_RANGE_ROW_LABEL: { @@ -3714,17 +3641,16 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( be default: { const SwAttrSet& rSet = pFmt->GetAttrSet(); - aRet = aPropSet.getPropertyValue(*pMap, rSet); + m_pPropSet->getPropertyValue(*pEntry, rSet, aRet); } } } } else if(bIsDescriptor) { - uno::Any* pAny = 0; + const uno::Any* pAny = 0; String aPropertyName(rPropertyName); - if(!pTableProps->GetProperty(ByteString(aPropertyName, RTL_TEXTENCODING_ASCII_US).GetBuffer(), - pAny)) + if(!pTableProps->GetProperty(pEntry->nWID, pEntry->nMemberId, pAny)) throw lang::IllegalArgumentException(); else if(pAny) aRet = *pAny; @@ -4004,9 +3930,8 @@ SwXCellRange::SwXCellRange(SwUnoCrsr* pCrsr, SwFrmFmt& rFrmFmt, aCursorDepend(this, pCrsr), aChartLstnrCntnr((cppu::OWeakObject*)this), aRgDesc(rDesc), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TABLE_RANGE)), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_RANGE)), pTblCrsr(pCrsr), - _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TABLE_RANGE)), bFirstRowAsLabel(sal_False), bFirstColumnAsLabel(sal_False) { @@ -4127,7 +4052,7 @@ uno::Reference< table::XCellRange > SwXCellRange::getCellRangeByName(const OUSt -----------------------------------------------------------------------*/ uno::Reference< beans::XPropertySetInfo > SwXCellRange::getPropertySetInfo(void) throw( uno::RuntimeException ) { - static uno::Reference< beans::XPropertySetInfo > xRef = aPropSet.getPropertySetInfo(); + static uno::Reference< beans::XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo(); return xRef; } /*-- 11.12.98 14:27:35--------------------------------------------------- @@ -4144,11 +4069,11 @@ void SwXCellRange::setPropertyValue(const OUString& rPropertyName, { /* ASK OLIVER lcl_FormatTable(pFmt);*/ - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if(pEntry) { - if ( pMap->nFlags & beans::PropertyAttribute::READONLY) + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); SwDoc* pDoc = pTblCrsr->GetDoc(); @@ -4158,13 +4083,13 @@ void SwXCellRange::setPropertyValue(const OUString& rPropertyName, } SwUnoTableCrsr* pCrsr = *pTblCrsr; pCrsr->MakeBoxSels(); - switch(pMap->nWID ) + switch(pEntry->nWID ) { case FN_UNO_TABLE_CELL_BACKGROUND: { SvxBrushItem aBrush( RES_BACKGROUND ); pDoc->GetBoxAttr( *pTblCrsr, aBrush ); - ((SfxPoolItem&)aBrush).PutValue(aValue, pMap->nMemberId); + ((SfxPoolItem&)aBrush).PutValue(aValue, pEntry->nMemberId); pDoc->SetBoxAttr( *pTblCrsr, aBrush ); } @@ -4178,7 +4103,7 @@ void SwXCellRange::setPropertyValue(const OUString& rPropertyName, SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER ); aBoxInfo.SetValid(0xff, FALSE); BYTE nValid = 0; - switch(pMap->nMemberId & ~CONVERT_TWIPS) + switch(pEntry->nMemberId & ~CONVERT_TWIPS) { case LEFT_BORDER : nValid = VALID_LEFT; break; case RIGHT_BORDER: nValid = VALID_RIGHT; break; @@ -4199,7 +4124,7 @@ void SwXCellRange::setPropertyValue(const OUString& rPropertyName, aSet.Put(aBoxInfo); SvxBoxItem aBoxItem((const SvxBoxItem&)aSet.Get(RES_BOX)); - ((SfxPoolItem&)aBoxItem).PutValue(aValue, pMap->nMemberId); + ((SfxPoolItem&)aBoxItem).PutValue(aValue, pEntry->nMemberId); aSet.Put(aBoxItem); pDoc->SetTabBorders( *pTblCrsr, aSet ); } @@ -4233,11 +4158,11 @@ void SwXCellRange::setPropertyValue(const OUString& rPropertyName, break; default: { - SfxItemSet aItemSet( pDoc->GetAttrPool(), pMap->nWID, pMap->nWID ); + SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID ); SwXTextCursor::GetCrsrAttr( pCrsr->GetSelRing(), aItemSet ); - if(!lcl_setCrsrPropertyValue( pMap, pCrsr->GetSelRing(), aItemSet, aValue )) - aPropSet.setPropertyValue(*pMap, aValue, aItemSet ); + if(!lcl_setCrsrPropertyValue( pEntry, pCrsr->GetSelRing(), aItemSet, aValue )) + m_pPropSet->setPropertyValue(*pEntry, aValue, aItemSet ); SwXTextCursor::SetCrsrAttr(pCrsr->GetSelRing(), aItemSet, CRSR_ATTR_MODE_TABLE ); } } @@ -4258,17 +4183,17 @@ uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName) throw( be { /* ASK OLIVER lcl_FormatTable(pFmt);*/ - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); - if(pMap) + const SfxItemPropertySimpleEntry* pEntry = + m_pPropSet->getPropertyMap()->getByName(rPropertyName); + if(pEntry) { - switch(pMap->nWID ) + switch(pEntry->nWID ) { case FN_UNO_TABLE_CELL_BACKGROUND: { SvxBrushItem aBrush( RES_BACKGROUND ); if(pTblCrsr->GetDoc()->GetBoxAttr( *pTblCrsr, aBrush )) - aBrush.QueryValue(aRet, pMap->nMemberId); + aBrush.QueryValue(aRet, pEntry->nMemberId); } break; @@ -4282,7 +4207,7 @@ uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName) throw( be aSet.Put(SvxBoxInfoItem( SID_ATTR_BORDER_INNER )); pDoc->GetTabBorders(*pTblCrsr, aSet); const SvxBoxItem& rBoxItem = ((const SvxBoxItem&)aSet.Get(RES_BOX)); - rBoxItem.QueryValue(aRet, pMap->nMemberId); + rBoxItem.QueryValue(aRet, pEntry->nMemberId); } break; case RES_BOXATR_FORMAT: @@ -4320,7 +4245,7 @@ uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName) throw( be // erstmal die Attribute des Cursors SwUnoTableCrsr* pCrsr = *pTblCrsr; SwXTextCursor::GetCrsrAttr(pCrsr->GetSelRing(), aSet); - aRet = aPropSet.getPropertyValue(*pMap, aSet); + m_pPropSet->getPropertyValue(*pEntry, aSet, aRet); } } } diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index aa87d98f05ed..7c921808b908 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -59,7 +59,7 @@ #include <redline.hxx> #include <swundo.hxx> #include <section.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <fmthbsh.hxx> #include <fmtanchr.hxx> #include <crsskip.hxx> @@ -104,7 +104,7 @@ SwXText::SwXText(SwDoc* pDc, CursorType eType) : pDoc(pDc), bObjectValid(0 != pDc), eCrsrType(eType), - _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT)) + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT)) { } /*-- 09.12.98 12:43:55--------------------------------------------------- @@ -235,12 +235,11 @@ uno::Sequence< uno::Type > SAL_CALL SwXText::getTypes() throw(uno::RuntimeExcept return aRet; } -/*-- 09.12.98 12:43:14--------------------------------------------------- - Gehoert der Range in den Text ? - dann einfuegen - -----------------------------------------------------------------------*/ -void SwXText::insertString(const uno::Reference< text::XTextRange > & xTextRange, - const OUString& aString, sal_Bool bAbsorb) - throw( uno::RuntimeException ) +// belongs the range in the text ? insert it then. +void SwXText::insertString(const uno::Reference< text::XTextRange >& xTextRange, + const OUString& aString, + sal_Bool bAbsorb) + throw( uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); if(GetDoc() && xTextRange.is()) @@ -274,16 +273,12 @@ void SwXText::insertString(const uno::Reference< text::XTextRange > & xTextRange } else //dann pRange { - SwBookmark* pBkm = pRange->GetBookmark(); - const SwStartNode* pTmp = pBkm->GetBookmarkPos().nNode.GetNode().StartOfSectionNode(); - while( pTmp && pTmp->IsSectionNode()) - { + ::sw::mark::IMark const * const pBkmk = pRange->GetBookmark(); + const SwStartNode* pTmp = pBkmk->GetMarkPos().nNode.GetNode().StartOfSectionNode(); + while(pTmp && pTmp->IsSectionNode()) pTmp = pTmp->StartOfSectionNode(); - } - if( !pOwnStartNode || pOwnStartNode != pTmp) - { + if(!pOwnStartNode || pOwnStartNode != pTmp) throw uno::RuntimeException(); - } } if(bAbsorb) { @@ -298,27 +293,23 @@ void SwXText::insertString(const uno::Reference< text::XTextRange > & xTextRange //Text davor eingefuegt wird UnoActionContext aContext(GetDoc()); const SwPosition* pPos = pCursor - ? pCursor->GetPaM()->Start() - : pRange->GetBookmark()->BookmarkStart(); + ? pCursor->GetPaM()->Start() + : &pRange->GetBookmark()->GetMarkStart(); SwPaM aInsertPam(*pPos); sal_Bool bGroupUndo = GetDoc()->DoesGroupUndo(); GetDoc()->DoGroupUndo(sal_False); - SwUnoCursorHelper::DocInsertStringSplitCR( *GetDoc(), aInsertPam, aString ); - + SwUnoCursorHelper::DocInsertStringSplitCR(*GetDoc(), aInsertPam, aString); GetDoc()->DoGroupUndo(bGroupUndo); } } else - { throw uno::RuntimeException(); - } } else - { throw uno::RuntimeException(); - } } + /*-- 09.12.98 12:43:16--------------------------------------------------- -----------------------------------------------------------------------*/ @@ -484,8 +475,8 @@ void SwXText::insertTextContent(const uno::Reference< text::XTextRange > & xRang } else if (pRange && pRange->GetBookmark()) { - SwBookmark* pBkm = pRange->GetBookmark(); - pSrcNode = &pBkm->GetBookmarkPos().nNode.GetNode(); + ::sw::mark::IMark const * const pBkmk = pRange->GetBookmark(); + pSrcNode = &pBkmk->GetMarkPos().nNode.GetNode(); } else if (pPortion && pPortion->GetCrsr()) { @@ -1002,11 +993,10 @@ void SwXText::setString(const OUString& aString) throw( uno::RuntimeException ) xRet->setString(aString); GetDoc()->EndUndo(UNDO_END, NULL); } -/* -----------------------------28.03.00 11:12-------------------------------- - Description: Checks if pRange/pCursor are member of the same text interface. - Only one of the pointers has to be set! - ---------------------------------------------------------------------------*/ -sal_Bool SwXText::CheckForOwnMember( + +// Description: Checks if pRange/pCursor are member of the same text interface. +// Only one of the pointers has to be set! +sal_Bool SwXText::CheckForOwnMember( const SwXTextRange* pRange, const OTextCursorHelper* pCursor) throw(lang::IllegalArgumentException, uno::RuntimeException) @@ -1039,37 +1029,30 @@ sal_Bool SwXText::CheckForOwnMember( const SwNode* pSrcNode; if(pCursor) - { pSrcNode = pCursor->GetPaM()->GetNode(); - } else //dann pRange { - SwBookmark* pBkm = pRange->GetBookmark(); - pSrcNode = &pBkm->GetBookmarkPos().nNode.GetNode(); + ::sw::mark::IMark const * const pBkmk = pRange->GetBookmark(); + pSrcNode = &pBkmk->GetMarkPos().nNode.GetNode(); } const SwStartNode* pTmp = pSrcNode->FindSttNodeByType(eSearchNodeType); //SectionNodes ueberspringen while(pTmp && pTmp->IsSectionNode()) - { pTmp = pTmp->StartOfSectionNode(); - } + //if the document starts with a section while(pOwnStartNode->IsSectionNode()) - { pOwnStartNode = pOwnStartNode->StartOfSectionNode(); - } + //this checks if (this) and xRange are in the same text::XText interface return(pOwnStartNode == pTmp); } -/* -----------------------------28.03.00 11:07-------------------------------- - - ---------------------------------------------------------------------------*/ sal_Int16 SwXText::ComparePositions( const uno::Reference<text::XTextRange>& xPos1, const uno::Reference<text::XTextRange>& xPos2) - throw(lang::IllegalArgumentException, uno::RuntimeException) + throw(lang::IllegalArgumentException, uno::RuntimeException) { sal_Int16 nCompare = 0; SwUnoInternalPaM aPam1(*GetDoc()); @@ -1109,12 +1092,12 @@ sal_Int16 SwXText::ComparePositions( const SwPosition *pStart2 = 0; if(pRange1) - pStart1 = pRange1->GetBookmark() ? pRange1->GetBookmark()->BookmarkStart() : 0; + pStart1 = pRange1->GetBookmark() ? &(pRange1->GetBookmark()->GetMarkStart()) : 0; else pStart1 = pCursor1->GetPaM() ? pCursor1->GetPaM()->Start() : 0; if(pRange2) - pStart2 = pRange2->GetBookmark() ? pRange2->GetBookmark()->BookmarkStart() : 0; + pStart2 = pRange2->GetBookmark() ? &(pRange2->GetBookmark()->GetMarkStart()) : 0; else pStart2 = pCursor2->GetPaM() ? pCursor2->GetPaM()->Start() : 0; @@ -1186,8 +1169,7 @@ sal_Int16 SwXText::compareRegionEnds( uno::Reference< beans::XPropertySetInfo > SwXText::getPropertySetInfo( ) throw(uno::RuntimeException) { - static uno::Reference< beans::XPropertySetInfo > xInfo = - new SfxItemPropertySetInfo(_pMap); + static uno::Reference< beans::XPropertySetInfo > xInfo = m_pPropSet->getPropertySetInfo(); return xInfo; } /*-- 15.03.2002 12:30:42--------------------------------------------------- @@ -1211,12 +1193,11 @@ uno::Any SwXText::getPropertyValue( vos::OGuard aGuard(Application::GetSolarMutex()); if(!IsValid()) throw uno::RuntimeException(); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - _pMap, rPropertyName); + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName(rPropertyName); uno::Any aRet; - if(pMap) + if(pEntry) { - switch(pMap->nWID) + switch(pEntry->nWID) { // no code necessary - the redline is always located at the end node // case FN_UNO_REDLINE_NODE_START: @@ -1376,26 +1357,22 @@ uno::Reference< text::XTextRange > SwXText::finishOrAppendParagraph( if(rProperties.getLength()) { // now set the properties - const SfxItemPropertyMap* pParagraphMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH); - SfxItemPropertySet aParaPropSet(pParagraphMap); + const SfxItemPropertySet* pParaPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH); + const SfxItemPropertyMap* pParagraphMap = pParaPropSet->getPropertyMap(); const beans::PropertyValue* pValues = rProperties.getConstArray(); for( sal_Int32 nProp = 0; nProp < rProperties.getLength(); ++nProp) { - // no sorting of property names required - results in performance issues as long as SfxItemPropertyMap::GetByName - // is not able to hash the maps - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( pParagraphMap, pValues[nProp].Name ); - if(pMap) + if(pParagraphMap->getByName( pValues[nProp].Name )) { try { SwXTextCursor::SetPropertyValue( aPam, - aParaPropSet, + *pParaPropSet, pValues[nProp].Name, - pValues[nProp].Value, - pMap, 0); + pValues[nProp].Value); } catch( lang::IllegalArgumentException& rIllegal ) { @@ -1481,25 +1458,21 @@ uno::Reference< text::XTextRange > SwXText::appendTextPortion( if(rCharacterAndParagraphProperties.getLength()) { - + const SfxItemPropertyMap* pCursorMap = aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)->getPropertyMap(); const beans::PropertyValue* pValues = rCharacterAndParagraphProperties.getConstArray(); + const SfxItemPropertySet* pCursorPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR); for( sal_Int32 nProp = 0; nProp < rCharacterAndParagraphProperties.getLength(); ++nProp) { - // no sorting of property names required - results in performance issues as long as SfxItemPropertyMap::GetByName - // is not able to hash the maps - const SfxItemPropertyMap* pCursorMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR); - SfxItemPropertySet aCursorPropSet(pCursorMap); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( pCursorMap, pValues[nProp].Name ); - if(pMap) + if( pCursorMap->getByName( pValues[nProp].Name ) ) { try { SwXTextCursor::SetPropertyValue( *pCursor, - aCursorPropSet, + *pCursorPropSet, pValues[nProp].Name, pValues[nProp].Value, - pMap, nsSetAttrMode::SETATTR_NOFORMATATTR); + nsSetAttrMode::SETATTR_NOFORMATATTR); } catch( lang::IllegalArgumentException& rIllegal ) { @@ -1598,10 +1571,9 @@ uno::Reference< text::XTextRange > SwXText::appendTextContent( } return xRet; } -/*-- 11.05.2006 15:46:26--------------------------------------------------- - move previously appended paragraphs into a text frames - to support import filters - -----------------------------------------------------------------------*/ + +// move previously appended paragraphs into a text frames +// to support import filters uno::Reference< text::XTextContent > SwXText::convertToTextFrame( const uno::Reference< text::XTextRange >& xStart, const uno::Reference< text::XTextRange >& xEnd, @@ -1623,18 +1595,18 @@ uno::Reference< text::XTextContent > SwXText::convertToTextFrame( uno::Reference<lang::XUnoTunnel> xEndRangeTunnel( xEnd, uno::UNO_QUERY); SwXTextRange* pEndRange = reinterpret_cast< SwXTextRange * >( sal::static_int_cast< sal_IntPtr >( xEndRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) )); - //bokmarks have to be removed before the referenced text node is deleted in DelFullPara - if( pStartRange ) + //bookmarks have to be removed before the referenced text node is deleted in DelFullPara + if(pStartRange) { - SwBookmark* pStartBookmark = pStartRange->GetBookmark(); - if( pStartBookmark ) - pDoc->deleteBookmark( pStartBookmark->GetName() ); + ::sw::mark::IMark const * const pStartBookmark = pStartRange->GetBookmark(); + if(pStartBookmark) + pDoc->getIDocumentMarkAccess()->deleteMark(pStartBookmark); } - if( pEndRange ) + if(pEndRange) { - SwBookmark* pEndBookmark = pEndRange->GetBookmark(); - if( pEndBookmark ) - pDoc->deleteBookmark( pEndBookmark->GetName() ); + ::sw::mark::IMark const * const pEndBookmark = pEndRange->GetBookmark(); + if(pEndBookmark) + pDoc->getIDocumentMarkAccess()->deleteMark(pEndBookmark); } pDoc->StartUndo( UNDO_START, NULL ); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index b63a32d03c5a..e5f901b43f30 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -2698,8 +2698,8 @@ const IDocumentSettingAccess* ViewShell::getIDocumentSettingAccess() const { ret IDocumentSettingAccess* ViewShell::getIDocumentSettingAccess() { return pDoc; } const IDocumentDeviceAccess* ViewShell::getIDocumentDeviceAccess() const { return pDoc; } IDocumentDeviceAccess* ViewShell::getIDocumentDeviceAccess() { return pDoc; } -const IDocumentBookmarkAccess* ViewShell::getIDocumentBookmarkAccess() const { return pDoc; } -IDocumentBookmarkAccess* ViewShell::getIDocumentBookmarkAccess() { return pDoc; } +const IDocumentMarkAccess* ViewShell::getIDocumentMarkAccess() const { return pDoc->getIDocumentMarkAccess(); } +IDocumentMarkAccess* ViewShell::getIDocumentMarkAccess() { return pDoc->getIDocumentMarkAccess(); } const IDocumentDrawModelAccess* ViewShell::getIDocumentDrawModelAccess() const { return pDoc; } IDocumentDrawModelAccess* ViewShell::getIDocumentDrawModelAccess() { return pDoc; } const IDocumentRedlineAccess* ViewShell::getIDocumentRedlineAccess() const { return pDoc; } diff --git a/sw/source/filter/html/SwAppletImpl.cxx b/sw/source/filter/html/SwAppletImpl.cxx index 2d58313dfc4b..2e8d395d72ca 100644 --- a/sw/source/filter/html/SwAppletImpl.cxx +++ b/sw/source/filter/html/SwAppletImpl.cxx @@ -31,6 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" #include <SwAppletImpl.hxx> +#include <svtools/htmlkywd.hxx> #include <svtools/urihelper.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/embed/EmbedStates.hpp> @@ -42,14 +43,13 @@ using namespace com::sun::star; -/* Some MIB magic...*/ +namespace { -//sal_Char SVT_DLLPUBLIC const SVTOOLS_CONSTASCII_DEF( sHTML_O_archive, "ARCHIVE" ); +static char const sHTML_O_archive[] = "ARCHIVE"; +static char const sHTML_O_Archives[] = "ARCHIVES"; +static char const sHTML_O_Object[] = "OBJECT"; -sal_Char const SVTOOLS_CONSTASCII_DEF( sHTML_O_Hidden, "HIDDEN" ); -sal_Char const SVTOOLS_CONSTASCII_DEF( sHTML_O_Hidden_False, "FALSE" ); -sal_Char const SVTOOLS_CONSTASCII_DEF( sHTML_O_Archives, "ARCHIVES" ); -sal_Char const SVTOOLS_CONSTASCII_DEF( sHTML_O_Object, "OBJECT" ); +} USHORT SwApplet_Impl::GetOptionType( const String& rName, BOOL bApplet ) { @@ -59,8 +59,8 @@ USHORT SwApplet_Impl::GetOptionType( const String& rName, BOOL bApplet ) { case 'A': case 'a': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_align ) || - rName.EqualsIgnoreCaseAscii( sHTML_O_alt ) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_align ) || + rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_alt ) ) nType = SWHTML_OPTTYPE_IGNORE; else if( bApplet && (rName.EqualsIgnoreCaseAscii( sHTML_O_archive ) || @@ -69,32 +69,32 @@ USHORT SwApplet_Impl::GetOptionType( const String& rName, BOOL bApplet ) break; case 'C': case 'c': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_class ) || - (bApplet && (rName.EqualsIgnoreCaseAscii( sHTML_O_code ) || - rName.EqualsIgnoreCaseAscii( sHTML_O_codebase ))) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_class ) || + (bApplet && (rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_code ) || + rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_codebase ))) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'H': case 'h': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_height ) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_height ) ) nType = SWHTML_OPTTYPE_SIZE; - else if( rName.EqualsIgnoreCaseAscii( sHTML_O_hspace ) || - (!bApplet && rName.EqualsIgnoreCaseAscii( sHTML_O_Hidden )) ) + else if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_hspace ) || + (!bApplet && rName.EqualsIgnoreCaseAscii( OOO_STRING_SW_HTML_O_Hidden )) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'I': case 'i': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_id ) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_id ) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'M': case 'm': - if( bApplet && rName.EqualsIgnoreCaseAscii( sHTML_O_mayscript ) ) + if( bApplet && rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_mayscript ) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'N': case 'n': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_name ) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_name ) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'O': @@ -104,23 +104,23 @@ USHORT SwApplet_Impl::GetOptionType( const String& rName, BOOL bApplet ) break; case 'S': case 's': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_style ) || - (!bApplet && rName.EqualsIgnoreCaseAscii( sHTML_O_src )) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_style ) || + (!bApplet && rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_src )) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'T': case 't': - if( !bApplet && rName.EqualsIgnoreCaseAscii( sHTML_O_type ) ) + if( !bApplet && rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_type ) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'V': case 'v': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_vspace ) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_vspace ) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'W': case 'w': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_width ) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_width ) ) nType = SWHTML_OPTTYPE_SIZE; break; } @@ -171,13 +171,13 @@ sal_Bool SwApplet_Impl::CreateApplet( const String& rBaseURL ) { const SvCommand& rArg = aCommandList[i]; const String& rName = rArg.GetCommand(); - if( rName.EqualsIgnoreCaseAscii( sHTML_O_code ) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_code ) ) aCode = rArg.GetArgument(); - else if( rName.EqualsIgnoreCaseAscii( sHTML_O_codebase ) ) + else if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_codebase ) ) aCodeBase = INetURLObject::GetAbsURL( rBaseURL, rArg.GetArgument() ); - else if( rName.EqualsIgnoreCaseAscii( sHTML_O_name ) ) + else if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_name ) ) aName = rArg.GetArgument(); - else if( rName.EqualsIgnoreCaseAscii( sHTML_O_mayscript ) ) + else if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_mayscript ) ) bMayScript = sal_True; } diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index e63f7c4b67b7..2020efd3288e 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -252,11 +252,11 @@ void SwHTMLWriter::OutCSS1_Property( const sal_Char *pProp, { bFirstCSS1Rule = FALSE; OutNewLine(); - ((((sOut += '<') += sHTML_style) += ' ') += sHTML_O_type) += "=\"text/css\">"; + ((((sOut += '<') += OOO_STRING_SVTOOLS_HTML_style) += ' ') += OOO_STRING_SVTOOLS_HTML_O_type) += "=\"text/css\">"; Strm() << sOut.GetBuffer(); sOut.Erase(); OutNewLine(); - Strm() << '<' << sHTML_comment; + Strm() << '<' << OOO_STRING_SVTOOLS_HTML_comment; IncIndentLevel(); } @@ -269,11 +269,11 @@ void SwHTMLWriter::OutCSS1_Property( const sal_Char *pProp, case CSS1_OUTMODE_SPAN_TAG1_ON: if( bTagOn ) { - ((((sOut += '<') += sHTML_span) += ' ') += sHTML_O_style) += "=\""; + ((((sOut += '<') += OOO_STRING_SVTOOLS_HTML_span) += ' ') += OOO_STRING_SVTOOLS_HTML_O_style) += "=\""; } else { - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_span, FALSE ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_span, FALSE ); return; } break; @@ -287,7 +287,7 @@ void SwHTMLWriter::OutCSS1_Property( const sal_Char *pProp, break; case CSS1_OUTMODE_STYLE_OPT_ON: - ((sOut = ' ') += sHTML_O_style) += "=\""; + ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_style) += "=\""; break; } bFirstCSS1Property = FALSE; @@ -715,7 +715,7 @@ void SwHTMLWriter::OutStyleSheet( const SwPageDesc& rPageDesc, BOOL bUsed ) Strm() << "-->"; OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_style, FALSE ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_style, FALSE ); } else { @@ -756,37 +756,37 @@ USHORT SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, ByteString& rToken, switch( rNm.GetChar(0) ) { // nicht mehr unterstuetzt: - // sHTML_author - // sHTML_acronym - // sHTML_abbreviation - // sHTML_deletedtext - // sHTML_insertedtext - // sHTML_language - // sHTML_person - case 'B': if( !bChrFmt && rNm.EqualsAscii(sHTML_blockquote) ) + // OOO_STRING_SVTOOLS_HTML_author + // OOO_STRING_SVTOOLS_HTML_acronym + // OOO_STRING_SVTOOLS_HTML_abbreviation + // OOO_STRING_SVTOOLS_HTML_deletedtext + // OOO_STRING_SVTOOLS_HTML_insertedtext + // OOO_STRING_SVTOOLS_HTML_language + // OOO_STRING_SVTOOLS_HTML_person + case 'B': if( !bChrFmt && rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_blockquote) ) { rRefPoolId = RES_POOLCOLL_HTML_BLOCKQUOTE; - rToken.Assign( sHTML_blockquote ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_blockquote ); } break; case 'C': if( bChrFmt ) { - if( rNm.EqualsAscii(sHTML_citiation) ) + if( rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_citiation) ) { rRefPoolId = RES_POOLCHR_HTML_CITIATION; - rToken.Assign( sHTML_citiation ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_citiation ); } - else if( rNm.EqualsAscii(sHTML_code) ) + else if( rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_code) ) { rRefPoolId = RES_POOLCHR_HTML_CODE; - rToken.Assign( sHTML_code ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_code ); } } break; - case 'D': if( bChrFmt && rNm.EqualsAscii(sHTML_definstance) ) + case 'D': if( bChrFmt && rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_definstance) ) { rRefPoolId = RES_POOLCHR_HTML_DEFINSTANCE; - rToken.Assign( sHTML_definstance); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_definstance); } else if( !bChrFmt ) { @@ -804,78 +804,78 @@ USHORT SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, ByteString& rToken, else if( nDefListLvl & HTML_DLCOLL_DD ) { rRefPoolId = RES_POOLCOLL_HTML_DD; - rToken.Assign( sHTML_dd ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_dd ); } else { rRefPoolId = RES_POOLCOLL_HTML_DT; - rToken.Assign( sHTML_dt ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_dt ); } } } break; - case 'E': if( bChrFmt && rNm.EqualsAscii( sHTML_emphasis ) ) + case 'E': if( bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_emphasis ) ) { rRefPoolId = RES_POOLCHR_HTML_EMPHASIS; - rToken.Assign( sHTML_emphasis ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_emphasis ); } break; - case 'H': if( !bChrFmt && rNm.EqualsAscii( sHTML_horzrule ) ) + case 'H': if( !bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_horzrule ) ) // HR nicht ausgeben! bStop = (nDeep==0); break; - case 'K': if( bChrFmt && rNm.EqualsAscii( sHTML_keyboard ) ) + case 'K': if( bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_keyboard ) ) { rRefPoolId = RES_POOLCHR_HTML_KEYBOARD; - rToken.Assign( sHTML_keyboard ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_keyboard ); } break; - case 'L': if( !bChrFmt && rNm.EqualsAscii( sHTML_listing ) ) + case 'L': if( !bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_listing ) ) { // Listing als PRE exportieren bzw. von // PRE abgeleitete Vorlage exportieren - rToken.Assign( sHTML_preformtxt ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_preformtxt ); rRefPoolId = RES_POOLCOLL_HTML_PRE; nDeep = CSS1_FMT_CMPREF; } break; - case 'P': if( !bChrFmt && rNm.EqualsAscii( sHTML_preformtxt ) ) + case 'P': if( !bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_preformtxt ) ) { rRefPoolId = RES_POOLCOLL_HTML_PRE; - rToken.Assign( sHTML_preformtxt ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_preformtxt ); } break; case 'S': if( bChrFmt ) { - if( rNm.EqualsAscii( sHTML_sample ) ) + if( rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_sample ) ) { rRefPoolId = RES_POOLCHR_HTML_SAMPLE; - rToken.Assign( sHTML_sample ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_sample ); } - else if( rNm.EqualsAscii( sHTML_strong ) ) + else if( rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_strong ) ) { rRefPoolId = RES_POOLCHR_HTML_STRONG; - rToken.Assign( sHTML_strong ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_strong ); } } break; - case 'T': if( bChrFmt && rNm.EqualsAscii( sHTML_teletype ) ) + case 'T': if( bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_teletype ) ) { rRefPoolId = RES_POOLCHR_HTML_TELETYPE; - rToken.Assign( sHTML_teletype ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_teletype ); } break; - case 'V': if( bChrFmt && rNm.EqualsAscii( sHTML_variable ) ) + case 'V': if( bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_variable ) ) { rRefPoolId = RES_POOLCHR_HTML_VARIABLE; - rToken.Assign( sHTML_variable ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_variable ); } break; - case 'X': if( !bChrFmt && rNm.EqualsAscii( sHTML_xmp ) ) + case 'X': if( !bChrFmt && rNm.EqualsAscii( OOO_STRING_SVTOOLS_HTML_xmp ) ) { // XMP als PRE exportieren (aber nicht die // Vorlage als Style) - rToken.Assign( sHTML_preformtxt ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_preformtxt ); rRefPoolId = RES_POOLCOLL_HTML_PRE; nDeep = CSS1_FMT_CMPREF; } @@ -899,62 +899,62 @@ USHORT SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, ByteString& rToken, bStop = (nDeep==0); break; case RES_POOLCOLL_TEXT: - rToken.Assign( sHTML_parabreak ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_parabreak ); break; case RES_POOLCOLL_HEADLINE1: - rToken.Assign( sHTML_head1 ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_head1 ); break; case RES_POOLCOLL_HEADLINE2: - rToken.Assign( sHTML_head2 ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_head2 ); break; case RES_POOLCOLL_HEADLINE3: - rToken.Assign( sHTML_head3 ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_head3 ); break; case RES_POOLCOLL_HEADLINE4: - rToken.Assign( sHTML_head4 ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_head4 ); break; case RES_POOLCOLL_HEADLINE5: - rToken.Assign( sHTML_head5 ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_head5 ); break; case RES_POOLCOLL_HEADLINE6: - rToken.Assign( sHTML_head6 ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_head6 ); break; case RES_POOLCOLL_SENDADRESS: - rToken.Assign( sHTML_address ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_address ); break; case RES_POOLCOLL_HTML_BLOCKQUOTE: - rToken.Assign( sHTML_blockquote ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_blockquote ); break; case RES_POOLCOLL_HTML_PRE: - rToken.Assign( sHTML_preformtxt ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_preformtxt ); break; case RES_POOLCOLL_HTML_DD: - rToken.Assign( sHTML_dd ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_dd ); break; case RES_POOLCOLL_HTML_DT: - rToken.Assign( sHTML_dt ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_dt ); break; case RES_POOLCOLL_TABLE: if( pPseudo ) { - rToken.Assign( sHTML_tabledata ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_tabledata ); rToken.Append( ' ' ); - rToken.Append( sHTML_parabreak ); + rToken.Append( OOO_STRING_SVTOOLS_HTML_parabreak ); } else - rToken.Assign( sHTML_parabreak ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_parabreak ); break; case RES_POOLCOLL_TABLE_HDLN: if( pPseudo ) { - rToken.Assign( sHTML_tableheader ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_tableheader ); rToken.Append( ' ' ); - rToken.Append( sHTML_parabreak ); + rToken.Append( OOO_STRING_SVTOOLS_HTML_parabreak ); } else - rToken.Assign( sHTML_parabreak ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_parabreak ); break; case RES_POOLCOLL_HTML_HR: // HR nicht ausgeben! @@ -963,8 +963,8 @@ USHORT SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, ByteString& rToken, case RES_POOLCOLL_FOOTNOTE: if( !nDeep ) { - rToken.Assign( sHTML_parabreak ); - rClass.AssignAscii( sHTML_sdfootnote ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_parabreak ); + rClass.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdfootnote ); rRefPoolId = RES_POOLCOLL_TEXT; nDeep = CSS1_FMT_CMPREF; } @@ -972,8 +972,8 @@ USHORT SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, ByteString& rToken, case RES_POOLCOLL_ENDNOTE: if( !nDeep ) { - rToken.Assign( sHTML_parabreak ); - rClass.AssignAscii( sHTML_sdendnote ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_parabreak ); + rClass.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdendnote ); rRefPoolId = RES_POOLCOLL_TEXT; nDeep = CSS1_FMT_CMPREF; } @@ -981,44 +981,44 @@ USHORT SwHTMLWriter::GetCSS1Selector( const SwFmt *pFmt, ByteString& rToken, // Zeichen-Vorlagen case RES_POOLCHR_HTML_EMPHASIS: - rToken.Assign( sHTML_emphasis ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_emphasis ); break; case RES_POOLCHR_HTML_CITIATION: - rToken.Assign( sHTML_citiation ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_citiation ); break; case RES_POOLCHR_HTML_STRONG: - rToken.Assign( sHTML_strong ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_strong ); break; case RES_POOLCHR_HTML_CODE: - rToken.Assign( sHTML_code ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_code ); break; case RES_POOLCHR_HTML_SAMPLE: - rToken.Assign( sHTML_sample ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_sample ); break; case RES_POOLCHR_HTML_KEYBOARD: - rToken.Assign( sHTML_keyboard ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_keyboard ); break; case RES_POOLCHR_HTML_VARIABLE: - rToken.Assign( sHTML_variable ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_variable ); break; case RES_POOLCHR_HTML_DEFINSTANCE: - rToken.Assign( sHTML_definstance ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_definstance ); break; case RES_POOLCHR_HTML_TELETYPE: - rToken.Assign( sHTML_teletype ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_teletype ); break; case RES_POOLCHR_INET_NORMAL: if( pPseudo ) { - rToken.Assign( sHTML_anchor ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_anchor ); pPseudo->AssignAscii( sCSS1_link ); } break; case RES_POOLCHR_INET_VISIT: if( pPseudo ) { - rToken.Assign( sHTML_anchor ); + rToken.Assign( OOO_STRING_SVTOOLS_HTML_anchor ); pPseudo->AssignAscii( sCSS1_visited ); } break; @@ -1735,13 +1735,13 @@ static Writer& OutCSS1_SwFmt( Writer& rWrt, const SwFmt& rFmt, case 'D': if( rNm.EqualsAscii("DD 1") || rNm.EqualsAscii("DT 1") ) rHTMLWrt.nDfltBottomMargin = 0; break; - case 'L': if(rNm.EqualsAscii(sHTML_listing) ) + case 'L': if(rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_listing) ) rHTMLWrt.nDfltBottomMargin = 0; break; - case 'P': if( rNm.EqualsAscii(sHTML_preformtxt) ) + case 'P': if( rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_preformtxt) ) rHTMLWrt.nDfltBottomMargin = 0; break; - case 'X': if( rNm.EqualsAscii(sHTML_xmp) ) + case 'X': if( rNm.EqualsAscii(OOO_STRING_SVTOOLS_HTML_xmp) ) rHTMLWrt.nDfltBottomMargin = 0; break; } @@ -1937,10 +1937,10 @@ static Writer& OutCSS1_SwFtnInfo( Writer& rWrt, const SwEndNoteInfo& rInfo, if( nNotes > 0 ) { - aSelector.AssignAscii( sHTML_anchor ); + aSelector.AssignAscii( OOO_STRING_SVTOOLS_HTML_anchor ); aSelector.Append( '.'); - aSelector.AppendAscii( bEndNote ? sHTML_sdendnote_anc - : sHTML_sdfootnote_anc ); + aSelector.AppendAscii( bEndNote ? OOO_STRING_SVTOOLS_HTML_sdendnote_anc + : OOO_STRING_SVTOOLS_HTML_sdfootnote_anc ); SwCSS1OutMode aMode( rHTMLWrt, CSS1_OUTMODE_RULE|CSS1_OUTMODE_TEMPLATE, TRUE, &aSelector ); rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_font_size, @@ -1969,10 +1969,10 @@ static Writer& OutCSS1_SwFtnInfo( Writer& rWrt, const SwEndNoteInfo& rInfo, } if( aItemSet.Count() ) { - aSelector.AssignAscii( sHTML_anchor ); + aSelector.AssignAscii( OOO_STRING_SVTOOLS_HTML_anchor ); aSelector.Append( '.'); - aSelector.AppendAscii( bEndNote ? sHTML_sdendnote_sym - : sHTML_sdfootnote_sym ); + aSelector.AppendAscii( bEndNote ? OOO_STRING_SVTOOLS_HTML_sdendnote_sym + : OOO_STRING_SVTOOLS_HTML_sdfootnote_sym ); if( OutCSS1Rule( rHTMLWrt, aSelector, aItemSet, sal_True, sal_False )) rHTMLWrt.aScriptTextStyles.Insert( new String( pSymCharFmt->GetName() ) ); } @@ -3079,7 +3079,7 @@ static Writer& OutCSS1_SwFmtDrop( Writer& rWrt, const SfxPoolItem& rHt ) } else { - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_span, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_span, FALSE ); } return rWrt; diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 030409c1e955..c4608a4907f2 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -140,9 +140,9 @@ using namespace ::com::sun::star; HTMLOutEvent __FAR_DATA aAnchorEventTable[] = { - { sHTML_O_SDonclick, sHTML_O_onclick, SFX_EVENT_MOUSECLICK_OBJECT }, - { sHTML_O_SDonmouseover, sHTML_O_onmouseover, SFX_EVENT_MOUSEOVER_OBJECT }, - { sHTML_O_SDonmouseout, sHTML_O_onmouseout, SFX_EVENT_MOUSEOUT_OBJECT }, + { OOO_STRING_SVTOOLS_HTML_O_SDonclick, OOO_STRING_SVTOOLS_HTML_O_onclick, SFX_EVENT_MOUSECLICK_OBJECT }, + { OOO_STRING_SVTOOLS_HTML_O_SDonmouseover, OOO_STRING_SVTOOLS_HTML_O_onmouseover, SFX_EVENT_MOUSEOVER_OBJECT }, + { OOO_STRING_SVTOOLS_HTML_O_SDonmouseout, OOO_STRING_SVTOOLS_HTML_O_onmouseout, SFX_EVENT_MOUSEOUT_OBJECT }, { 0, 0, 0 } }; @@ -161,9 +161,9 @@ static Writer& OutHTML_HoriSpacer( Writer& rWrt, INT16 nSize ) } ByteString sOut( '<' ); - (((((((((sOut += sHTML_spacer) - += ' ') += sHTML_O_type) += '=') += sHTML_SPTYPE_horizontal) - += ' ') += sHTML_O_size) += '=') + (((((((((sOut += OOO_STRING_SVTOOLS_HTML_spacer) + += ' ') += OOO_STRING_SVTOOLS_HTML_O_type) += '=') += OOO_STRING_SVTOOLS_HTML_SPTYPE_horizontal) + += ' ') += OOO_STRING_SVTOOLS_HTML_O_size) += '=') +=ByteString::CreateFromInt32(nSize)) += '>'; rWrt.Strm() << sOut.GetBuffer(); @@ -182,13 +182,13 @@ USHORT SwHTMLWriter::GetDefListLvl( const String& rNm, USHORT nPoolId ) return 1 | HTML_DLCOLL_DT; } - String sDTDD( String::CreateFromAscii(sHTML_dt) ); + String sDTDD( String::CreateFromAscii(OOO_STRING_SVTOOLS_HTML_dt) ); sDTDD += ' '; if( COMPARE_EQUAL == sDTDD.CompareTo( rNm, sDTDD.Len() ) ) // DefinitionList - term return (USHORT)rNm.Copy( sDTDD.Len() ).ToInt32() | HTML_DLCOLL_DT; - sDTDD.AssignAscii( sHTML_dd ); + sDTDD.AssignAscii( OOO_STRING_SVTOOLS_HTML_dd ); sDTDD += ' '; if( COMPARE_EQUAL == sDTDD.CompareTo( rNm, sDTDD.Len() ) ) // DefinitionList - definition @@ -215,7 +215,7 @@ void SwHTMLWriter::OutAndSetDefList( USHORT nNewLvl ) { if( bLFPossible ) OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_deflist, TRUE ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_deflist, TRUE ); IncIndentLevel(); bLFPossible = TRUE; } @@ -227,7 +227,7 @@ void SwHTMLWriter::OutAndSetDefList( USHORT nNewLvl ) DecIndentLevel(); if( bLFPossible ) OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_deflist, FALSE ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_deflist, FALSE ); bLFPossible = TRUE; } } @@ -240,7 +240,7 @@ void SwHTMLWriter::ChangeParaToken( USHORT nNew ) { if( nNew != nLastParaToken && HTML_PREFORMTXT_ON == nLastParaToken ) { - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_preformtxt, FALSE ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_preformtxt, FALSE ); bLFPossible = TRUE; } nLastParaToken = nNew; @@ -679,13 +679,13 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, // der erste Buchstabe reicht meistens switch( rInfo.aToken.GetChar( 0 ) ) { - case 'A': ASSERT( rInfo.aToken.Equals(sHTML_address), + case 'A': ASSERT( rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_address), "Doch kein ADDRESS?" ); rInfo.bParaPossible = TRUE; rHWrt.bNoAlign = TRUE; break; - case 'B': ASSERT( rInfo.aToken.Equals(sHTML_blockquote), + case 'B': ASSERT( rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_blockquote), "Doch kein BLOCKQUOTE?" ); rInfo.bParaPossible = TRUE; rHWrt.bNoAlign = TRUE; @@ -697,7 +697,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, } else { - ASSERT( rInfo.aToken.Equals(sHTML_preformtxt), + ASSERT( rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_preformtxt), "Doch kein PRE?" ); if( HTML_PREFORMTXT_ON == rHWrt.nLastParaToken ) { @@ -712,10 +712,10 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, } break; - case 'D': ASSERT( rInfo.aToken.Equals(sHTML_dt) || - rInfo.aToken.Equals(sHTML_dd), + case 'D': ASSERT( rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_dt) || + rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_dd), "Doch kein DD/DT?" ); - bDT = rInfo.aToken.Equals(sHTML_dt); + bDT = rInfo.aToken.Equals(OOO_STRING_SVTOOLS_HTML_dt); rInfo.bParaPossible = !bDT; rHWrt.bNoAlign = TRUE; bForceDL = TRUE; @@ -727,7 +727,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, // alle Vorlagen, die nicht einem HTML-Tag entsprechen oder von // diesem abgeleitet sind, werden als <P> exportiert - rInfo.aToken = sHTML_parabreak; + rInfo.aToken = OOO_STRING_SVTOOLS_HTML_parabreak; bPara = TRUE; } @@ -935,9 +935,9 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, if( rInfo.bInNumBulList && bNumbered ) { ByteString sOut( '<' ); - sOut += sHTML_li; + sOut += OOO_STRING_SVTOOLS_HTML_li; if( USHRT_MAX != nNumStart ) - (((sOut += ' ') += sHTML_O_value) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_value) += '=') += ByteString::CreateFromInt32(nNumStart); sOut += '>'; rWrt.Strm() << sOut.GetBuffer(); @@ -945,7 +945,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, if( rHWrt.nDefListLvl > 0 && !bForceDL ) { - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), bDT ? sHTML_dt : sHTML_dd ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), bDT ? OOO_STRING_SVTOOLS_HTML_dt : OOO_STRING_SVTOOLS_HTML_dd ); } if( pAdjItem && @@ -956,7 +956,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, // if there are controls in a paragraph, because the control and // all text behind the control does not recognize this attribute. ByteString sOut( '<' ); - sOut += sHTML_division; + sOut += OOO_STRING_SVTOOLS_HTML_division; rWrt.Strm() << sOut.GetBuffer(); rHWrt.bTxtAttr = FALSE; @@ -980,7 +980,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, (bHasParSpace || pAdjItem) ) { HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rInfo.aToken.GetBuffer() ); - aToken = sHTML_parabreak; + aToken = OOO_STRING_SVTOOLS_HTML_parabreak; bPara = TRUE; rHWrt.bNoAlign = FALSE; bNoStyle = FALSE; @@ -1057,7 +1057,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, if( rHWrt.bCfgOutStyles && (pFmtInfo->aClass.Len() || pFmtInfo->bScriptDependent) ) { - ((sOut += ' ') += sHTML_O_class) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_class) += "=\""; rWrt.Strm() << sOut.GetBuffer(); String aClass( pFmtInfo->aClass ); if( pFmtInfo->bScriptDependent ) @@ -1124,7 +1124,7 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt, ASSERT( nBulletGrfLvl < MAXLEVEL, "So viele Ebenen gibt's nicht" ); const SwNumFmt& rNumFmt = aNumInfo.GetNumRule()->Get(nBulletGrfLvl); - OutHTML_BulletImage( rWrt, sHTML_image, 0, + OutHTML_BulletImage( rWrt, OOO_STRING_SVTOOLS_HTML_image, 0, rHWrt.aBulletGrfs[nBulletGrfLvl], rNumFmt.GetGraphicSize(), rNumFmt.GetGraphicOrientation() ); } @@ -1177,20 +1177,20 @@ void OutHTML_SwFmtOff( Writer& rWrt, const SwHTMLTxtCollOutputInfo& rInfo ) // - keine Styles geschrieben werden, und // - ein untere Abstand existiert if( rInfo.bParaPossible && rInfo.bOutPara ) - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_parabreak, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_parabreak, FALSE ); HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rInfo.aToken.GetBuffer(), FALSE ); - rHWrt.bLFPossible = !rInfo.aToken.Equals( sHTML_dt ) && - !rInfo.aToken.Equals( sHTML_dd ) && - !rInfo.aToken.Equals( sHTML_li ); + rHWrt.bLFPossible = !rInfo.aToken.Equals( OOO_STRING_SVTOOLS_HTML_dt ) && + !rInfo.aToken.Equals( OOO_STRING_SVTOOLS_HTML_dd ) && + !rInfo.aToken.Equals( OOO_STRING_SVTOOLS_HTML_li ); } if( rInfo.bOutDiv ) { rHWrt.DecIndentLevel(); if( rHWrt.bLFPossible ) rHWrt.OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_division, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_division, FALSE ); rHWrt.bLFPossible = TRUE; } @@ -2192,7 +2192,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) USHORT nPoolId = pNd->GetAnyFmtColl().GetPoolFmtId(); if( !nEnde && (RES_POOLCOLL_HTML_HR==nPoolId || - pNd->GetAnyFmtColl().GetName().EqualsAscii( sHTML_horzrule) ) ) + pNd->GetAnyFmtColl().GetName().EqualsAscii( OOO_STRING_SVTOOLS_HTML_horzrule) ) ) { // dann die absatz-gebundenen Grafiken/OLE-Objekte im Absatz // MIB 8.7.97: Ein <PRE> spannen wir um die Linie auf. Dann stimmen @@ -2209,7 +2209,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) rHTMLWrt.bLFPossible = TRUE; ByteString sOut( '<' ); - sOut += sHTML_horzrule; + sOut += OOO_STRING_SVTOOLS_HTML_horzrule; const SfxItemSet* pItemSet = pNd->GetpSwAttrSet(); if( !pItemSet ) @@ -2245,17 +2245,17 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) nPageWidth = pBox->GetFrmFmt()->GetFrmSize().GetWidth(); } - ((sOut += ' ') += sHTML_O_width) += '='; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_width) += '='; rWrt.Strm() << sOut.GetBuffer(); rWrt.OutULong( rHTMLWrt.ToPixel(nPageWidth-nLeft-nRight) ); - ((sOut = ' ') += sHTML_O_align) += '='; + ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_align) += '='; if( !nLeft ) - sOut += sHTML_AL_left; + sOut += OOO_STRING_SVTOOLS_HTML_AL_left; else if( !nRight ) - sOut += sHTML_AL_right; + sOut += OOO_STRING_SVTOOLS_HTML_AL_right; else - sOut += sHTML_AL_center; + sOut += OOO_STRING_SVTOOLS_HTML_AL_center; } } rWrt.Strm() << sOut.GetBuffer(); @@ -2268,14 +2268,14 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) USHORT nWidth = pBorderLine->GetOutWidth() + pBorderLine->GetInWidth() + pBorderLine->GetDistance(); - ((sOut = ' ') += sHTML_O_size) += '='; + ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_size) += '='; rWrt.Strm() << sOut.GetBuffer(); rWrt.OutULong( rHTMLWrt.ToPixel(nWidth) ); const Color& rBorderColor = pBorderLine->GetColor(); if( !rBorderColor.IsRGBEqual( Color(COL_GRAY) ) ) { - ((sOut = ' ') += sHTML_O_color) += '='; + ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_color) += '='; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_Color( rWrt.Strm(), rBorderColor, rHTMLWrt.eDestEnc ); @@ -2283,7 +2283,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) if( !pBorderLine->GetInWidth() ) { - (sOut = ' ') += sHTML_O_noshade; + (sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_noshade; rWrt.Strm() << sOut.GetBuffer(); } } @@ -2670,7 +2670,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) if( 0x0a == c ) { HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext ); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_linebreak ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_linebreak ); } else HTMLOutFuncs::Out_Char( rWrt.Strm(), c, aContext, &rHTMLWrt.aNonConvertableCharacters ); @@ -2709,16 +2709,16 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) // Wenn der letzte Absatz einer Tabellezelle leer ist und // wir fuer den MS-IE exportieren, schreiben wir statt eines // <BR> ein - rWrt.Strm() << '&' << sHTML_S_nbsp << ';'; + rWrt.Strm() << '&' << OOO_STRING_SVTOOLS_HTML_S_nbsp << ';'; } else { - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_linebreak ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_linebreak ); const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem &)pNd->GetSwAttrSet().Get(RES_UL_SPACE); if( rULSpace.GetLower() > 0 && !bEndOfCell && !rHTMLWrt.IsHTMLMode(HTMLMODE_NO_BR_AT_PAREND) ) - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_linebreak ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_linebreak ); rHTMLWrt.bLFPossible = TRUE; } } @@ -2729,15 +2729,15 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) if( rHTMLWrt.bClearLeft ) { if( rHTMLWrt.bClearRight ) - pStr = sHTML_AL_all; + pStr = OOO_STRING_SVTOOLS_HTML_AL_all; else - pStr = sHTML_AL_left; + pStr = OOO_STRING_SVTOOLS_HTML_AL_left; } else - pStr = sHTML_AL_right; + pStr = OOO_STRING_SVTOOLS_HTML_AL_right; - ByteString sOut( sHTML_linebreak ); - (((sOut += ' ') += sHTML_O_clear) += '=') += pStr; + ByteString sOut( OOO_STRING_SVTOOLS_HTML_linebreak ); + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_clear) += '=') += pStr; HTMLOutFuncs::Out_AsciiTag( rHTMLWrt.Strm(), sOut.GetBuffer() ); rHTMLWrt.bClearLeft = FALSE; @@ -2817,12 +2817,12 @@ static Writer& OutHTML_SvxColor( Writer& rWrt, const SfxPoolItem& rHt ) aColor.SetColor( COL_BLACK ); ByteString sOut( '<' ); - (((sOut += sHTML_font) += ' ') += sHTML_O_color) += '='; + (((sOut += OOO_STRING_SVTOOLS_HTML_font) += ' ') += OOO_STRING_SVTOOLS_HTML_O_color) += '='; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_Color( rWrt.Strm(), aColor, rHTMLWrt.eDestEnc ) << '>'; } else - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_font, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_font, FALSE ); return rWrt; } @@ -2837,7 +2837,7 @@ static Writer& OutHTML_SwPosture( Writer& rWrt, const SfxPoolItem& rHt ) const FontItalic nPosture = ((const SvxPostureItem&)rHt).GetPosture(); if( ITALIC_NORMAL == nPosture ) { - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_italic, rHTMLWrt.bTagOn ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_italic, rHTMLWrt.bTagOn ); } else if( rHTMLWrt.bCfgOutStyles && rHTMLWrt.bTxtAttr ) { @@ -2860,13 +2860,13 @@ static Writer& OutHTML_SvxFont( Writer& rWrt, const SfxPoolItem& rHt ) SwHTMLWriter::PrepareFontList( ((const SvxFontItem&)rHt), aNames, 0, rHTMLWrt.IsHTMLMode(HTMLMODE_FONT_GENERIC) ); ByteString sOut( '<' ); - (((sOut += sHTML_font) += ' ') += sHTML_O_face) += "=\""; + (((sOut += OOO_STRING_SVTOOLS_HTML_font) += ' ') += OOO_STRING_SVTOOLS_HTML_O_face) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), aNames, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ) << "\">"; } else - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_font , FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_font , FALSE ); return rWrt; } @@ -2880,11 +2880,11 @@ static Writer& OutHTML_SvxFontHeight( Writer& rWrt, const SfxPoolItem& rHt ) if( rHTMLWrt.bTagOn ) { ByteString sOut( '<' ); - sOut += sHTML_font; + sOut += OOO_STRING_SVTOOLS_HTML_font; UINT32 nHeight = ((const SvxFontHeightItem&)rHt).GetHeight(); USHORT nSize = rHTMLWrt.GetHTMLFontSize( nHeight ); - (((sOut += ' ') += sHTML_O_size) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_size) += '=') += ByteString::CreateFromInt32( nSize ); rWrt.Strm() << sOut.GetBuffer(); @@ -2899,7 +2899,7 @@ static Writer& OutHTML_SvxFontHeight( Writer& rWrt, const SfxPoolItem& rHt ) } else { - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_font, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_font, FALSE ); } return rWrt; @@ -2918,14 +2918,14 @@ static Writer& OutHTML_SvxLanguage( Writer& rWrt, const SfxPoolItem& rHt ) if( rHTMLWrt.bTagOn ) { ByteString sOut( '<' ); - sOut += sHTML_span; + sOut += OOO_STRING_SVTOOLS_HTML_span; rWrt.Strm() << sOut.GetBuffer(); rHTMLWrt.OutLanguage( ((const SvxLanguageItem &)rHt).GetLanguage() ); rWrt.Strm() << '>'; } else { - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_span, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_span, FALSE ); } return rWrt; @@ -2939,7 +2939,7 @@ static Writer& OutHTML_SwWeight( Writer& rWrt, const SfxPoolItem& rHt ) const FontWeight nBold = ((const SvxWeightItem&)rHt).GetWeight(); if( WEIGHT_BOLD == nBold ) { - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_bold, rHTMLWrt.bTagOn ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_bold, rHTMLWrt.bTagOn ); } else if( rHTMLWrt.bCfgOutStyles && rHTMLWrt.bTxtAttr ) { @@ -2961,7 +2961,7 @@ static Writer& OutHTML_SwCrossedOut( Writer& rWrt, const SfxPoolItem& rHt ) const FontStrikeout nStrike = ((const SvxCrossedOutItem&)rHt).GetStrikeout(); if( STRIKEOUT_NONE != nStrike ) { - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_strike, rHTMLWrt.bTagOn ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_strike, rHTMLWrt.bTagOn ); } else if( rHTMLWrt.bCfgOutStyles && rHTMLWrt.bTxtAttr ) { @@ -2984,8 +2984,8 @@ static Writer& OutHTML_SvxEscapement( Writer& rWrt, const SfxPoolItem& rHt ) const sal_Char *pStr = 0; switch( eEscape ) { - case SVX_ESCAPEMENT_SUPERSCRIPT: pStr = sHTML_superscript; break; - case SVX_ESCAPEMENT_SUBSCRIPT: pStr = sHTML_subscript; break; + case SVX_ESCAPEMENT_SUPERSCRIPT: pStr = OOO_STRING_SVTOOLS_HTML_superscript; break; + case SVX_ESCAPEMENT_SUBSCRIPT: pStr = OOO_STRING_SVTOOLS_HTML_subscript; break; default: ; } @@ -3014,7 +3014,7 @@ static Writer& OutHTML_SwUnderline( Writer& rWrt, const SfxPoolItem& rHt ) const FontUnderline eUnder = ((const SvxUnderlineItem&)rHt).GetLineStyle(); if( UNDERLINE_NONE != eUnder ) { - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_underline, rHTMLWrt.bTagOn ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_underline, rHTMLWrt.bTagOn ); } else if( rHTMLWrt.bCfgOutStyles && rHTMLWrt.bTxtAttr ) { @@ -3061,7 +3061,7 @@ static Writer& OutHTML_SwBlink( Writer& rWrt, const SfxPoolItem& rHt ) if( ((const SvxBlinkItem&)rHt).GetValue() ) { - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_blink, rHTMLWrt.bTagOn ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_blink, rHTMLWrt.bTagOn ); } else if( rHTMLWrt.bCfgOutStyles && rHTMLWrt.bTxtAttr ) { @@ -3087,12 +3087,12 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, BOOL bOn ) // Tag aus? Dann nur ein </A> ausgeben. if( !bOn ) { - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_anchor, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_anchor, FALSE ); return rWrt; } ByteString sOut( '<' ); - sOut += sHTML_anchor; + sOut += OOO_STRING_SVTOOLS_HTML_anchor; sal_Bool bScriptDependent = sal_False; { @@ -3119,7 +3119,7 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, BOOL bOn ) if( bScriptDependent ) { - ((sOut += ' ') += sHTML_O_class) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_class) += "=\""; switch( rHTMLWrt.nCSS1Script ) { case CSS1_OUTMODE_WESTERN: @@ -3156,7 +3156,7 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, BOOL bOn ) #endif aURL.EraseLeadingChars().EraseTrailingChars(); - ((sOut = ' ') += sHTML_O_href) += "=\""; + ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_href) += "=\""; rWrt.Strm() << sOut.GetBuffer(); rHTMLWrt.OutHyperlinkHRefValue( aURL ); sOut = '\"'; @@ -3166,7 +3166,7 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, BOOL bOn ) if( rINetFmt.GetName().Len() ) { - ((sOut += ' ') += sHTML_O_name) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), rINetFmt.GetName(), rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); @@ -3176,7 +3176,7 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, BOOL bOn ) const String& rTarget = rINetFmt.GetTargetFrame(); if( rTarget.Len() ) { - ((sOut += ' ') += sHTML_O_target) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_target) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), rTarget, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); sOut = '\"'; @@ -3282,11 +3282,11 @@ static Writer& OutHTML_SwTxtCharFmt( Writer& rWrt, const SfxPoolItem& rHt ) if( pFmtInfo->aToken.Len() > 0 ) sOut += pFmtInfo->aToken; else - sOut += sHTML_span; + sOut += OOO_STRING_SVTOOLS_HTML_span; if( rHTMLWrt.bCfgOutStyles && (pFmtInfo->aClass.Len() || pFmtInfo->bScriptDependent) ) { - ((sOut += ' ') += sHTML_O_class) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_class) += "=\""; rWrt.Strm() << sOut.GetBuffer(); String aClass( pFmtInfo->aClass ); if( pFmtInfo->bScriptDependent ) @@ -3317,7 +3317,7 @@ static Writer& OutHTML_SwTxtCharFmt( Writer& rWrt, const SfxPoolItem& rHt ) { HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), pFmtInfo->aToken.Len() ? pFmtInfo->aToken.GetBuffer() - : sHTML_span, + : OOO_STRING_SVTOOLS_HTML_span, FALSE ); } @@ -3334,17 +3334,17 @@ static Writer& OutHTML_SvxAdjust( Writer& rWrt, const SfxPoolItem& rHt ) const sal_Char* pStr = 0; switch( rAdjust.GetAdjust() ) { - case SVX_ADJUST_CENTER: pStr = sHTML_AL_center; break; - case SVX_ADJUST_LEFT: pStr = sHTML_AL_left; break; - case SVX_ADJUST_RIGHT: pStr = sHTML_AL_right; break; - case SVX_ADJUST_BLOCK: pStr = sHTML_AL_justify; break; + case SVX_ADJUST_CENTER: pStr = OOO_STRING_SVTOOLS_HTML_AL_center; break; + case SVX_ADJUST_LEFT: pStr = OOO_STRING_SVTOOLS_HTML_AL_left; break; + case SVX_ADJUST_RIGHT: pStr = OOO_STRING_SVTOOLS_HTML_AL_right; break; + case SVX_ADJUST_BLOCK: pStr = OOO_STRING_SVTOOLS_HTML_AL_justify; break; default: ; } if( pStr ) { ByteString sOut( ' ' ); - ((sOut += sHTML_O_align) += '=') += pStr; + ((sOut += OOO_STRING_SVTOOLS_HTML_O_align) += '=') += pStr; rWrt.Strm() << sOut.GetBuffer(); } diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index bd877376883a..bb003d292ed8 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -65,10 +65,10 @@ using namespace ::com::sun::star::container; static HTMLOutEvent __FAR_DATA aBodyEventTable[] = { - { sHTML_O_SDonload, sHTML_O_onload, SFX_EVENT_OPENDOC }, - { sHTML_O_SDonunload, sHTML_O_onunload, SFX_EVENT_PREPARECLOSEDOC }, - { sHTML_O_SDonfocus, sHTML_O_onfocus, SFX_EVENT_ACTIVATEDOC }, - { sHTML_O_SDonblur, sHTML_O_onblur, SFX_EVENT_DEACTIVATEDOC }, + { OOO_STRING_SVTOOLS_HTML_O_SDonload, OOO_STRING_SVTOOLS_HTML_O_onload, SFX_EVENT_OPENDOC }, + { OOO_STRING_SVTOOLS_HTML_O_SDonunload, OOO_STRING_SVTOOLS_HTML_O_onunload, SFX_EVENT_PREPARECLOSEDOC }, + { OOO_STRING_SVTOOLS_HTML_O_SDonfocus, OOO_STRING_SVTOOLS_HTML_O_onfocus, SFX_EVENT_ACTIVATEDOC }, + { OOO_STRING_SVTOOLS_HTML_O_SDonblur, OOO_STRING_SVTOOLS_HTML_O_onblur, SFX_EVENT_DEACTIVATEDOC }, { 0, 0, 0 } }; @@ -208,22 +208,22 @@ void SwHTMLParser::AddScriptSource() xub_StrLen nPos = STRING_NOTFOUND; if( !aBasicLib.Len() ) { - nPos = aToken.SearchAscii( sHTML_SB_library ); + nPos = aToken.SearchAscii( OOO_STRING_SVTOOLS_HTML_SB_library ); if( nPos != STRING_NOTFOUND ) { aBasicLib = - aToken.Copy( nPos + sizeof(sHTML_SB_library) - 1 ); + aToken.Copy( nPos + sizeof(OOO_STRING_SVTOOLS_HTML_SB_library) - 1 ); aBasicLib.EraseLeadingChars().EraseTrailingChars(); } } if( !aBasicModule.Len() && nPos==STRING_NOTFOUND ) { - nPos = aToken.SearchAscii( sHTML_SB_module ); + nPos = aToken.SearchAscii( OOO_STRING_SVTOOLS_HTML_SB_module ); if( nPos != STRING_NOTFOUND ) { aBasicModule = - aToken.Copy( nPos + sizeof(sHTML_SB_module) - 1 ); + aToken.Copy( nPos + sizeof(OOO_STRING_SVTOOLS_HTML_SB_module) - 1 ); aBasicModule.EraseLeadingChars().EraseTrailingChars(); } } @@ -312,13 +312,13 @@ void SwHTMLWriter::OutBasic() { OutNewLine(); ByteString sOut( '<' ); - sOut.Append( sHTML_meta ); + sOut.Append( OOO_STRING_SVTOOLS_HTML_meta ); sOut.Append( ' ' ); - sOut.Append( sHTML_O_httpequiv ); + sOut.Append( OOO_STRING_SVTOOLS_HTML_O_httpequiv ); sOut.Append( "=\"" ); - sOut.Append( sHTML_META_content_script_type ); + sOut.Append( OOO_STRING_SVTOOLS_HTML_META_content_script_type ); sOut.Append( "\" " ); - sOut.Append( sHTML_O_content ); + sOut.Append( OOO_STRING_SVTOOLS_HTML_O_content ); sOut.Append( "=\"text/x-" ); Strm() << sOut.GetBuffer(); // Entities aren't welcome here diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index a71c69a8d8f0..7fb4fd8502af 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -252,7 +252,7 @@ void SwCSS1Parser::SetLinkCharFmts() ASSERT( !bLinkCharFmtsSet, "Aufruf von SetLinkCharFmts unnoetig" ); SvxCSS1MapEntry *pStyleEntry = - GetTag( String::CreateFromAscii(sHTML_anchor) ); + GetTag( String::CreateFromAscii(OOO_STRING_SVTOOLS_HTML_anchor) ); SwCharFmt *pUnvisited = 0, *pVisited = 0; if( pStyleEntry ) { @@ -268,7 +268,7 @@ void SwCSS1Parser::SetLinkCharFmts() bBodyVLinkSet |= bColorSet; } - String sTmp( String::CreateFromAscii(sHTML_anchor) ); + String sTmp( String::CreateFromAscii(OOO_STRING_SVTOOLS_HTML_anchor) ); sTmp.Append( ':' ); sTmp.AppendAscii( sCSS1_link ); pStyleEntry = GetTag( sTmp ); @@ -283,7 +283,7 @@ void SwCSS1Parser::SetLinkCharFmts() bBodyLinkSet |= bColorSet; } - sTmp.AssignAscii( sHTML_anchor ); + sTmp.AssignAscii( OOO_STRING_SVTOOLS_HTML_anchor ); sTmp.Assign( ':' ); sTmp.AppendAscii( sCSS1_visited ); pStyleEntry = GetTag( sTmp ); @@ -377,12 +377,12 @@ void SwCSS1Parser::SetTableTxtColl( BOOL bHeader ) if( bHeader ) { nPoolId = RES_POOLCOLL_TABLE_HDLN; - sTag.AssignAscii( sHTML_tableheader ); + sTag.AssignAscii( OOO_STRING_SVTOOLS_HTML_tableheader ); } else { nPoolId = RES_POOLCOLL_TABLE; - sTag.AssignAscii( sHTML_tabledata ); + sTag.AssignAscii( OOO_STRING_SVTOOLS_HTML_tabledata ); } SwTxtFmtColl *pColl = 0; @@ -398,7 +398,7 @@ void SwCSS1Parser::SetTableTxtColl( BOOL bHeader ) String sTmp( sTag ); sTmp.Append( ' ' ); - sTmp.AppendAscii( sHTML_parabreak ); + sTmp.AppendAscii( OOO_STRING_SVTOOLS_HTML_parabreak ); pStyleEntry = GetTag( sTmp ); if( pStyleEntry ) { @@ -893,9 +893,9 @@ BOOL SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, ('s' == aClass.GetChar(0) || 'S' == aClass.GetChar(0)) ) { USHORT nPoolFmtId = 0; - if( aClass.EqualsIgnoreCaseAscii(sHTML_sdendnote_sym) ) + if( aClass.EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_sdendnote_sym) ) nPoolFmtId = RES_POOLCHR_ENDNOTE; - else if( aClass.EqualsIgnoreCaseAscii(sHTML_sdfootnote_sym) ) + else if( aClass.EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_sdfootnote_sym) ) nPoolFmtId = RES_POOLCHR_FOOTNOTE; if( nPoolFmtId ) { @@ -941,9 +941,9 @@ BOOL SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, if( aClass.Len() >= 9 && ('s' == aClass.GetChar(0) || 'S' == aClass.GetChar(0)) ) { - if( aClass.EqualsIgnoreCaseAscii(sHTML_sdendnote) ) + if( aClass.EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_sdendnote) ) nPoolCollId = RES_POOLCOLL_ENDNOTE; - else if( aClass.EqualsIgnoreCaseAscii(sHTML_sdfootnote) ) + else if( aClass.EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_sdfootnote) ) nPoolCollId = RES_POOLCOLL_FOOTNOTE; if( nPoolCollId ) @@ -1001,7 +1001,7 @@ BOOL SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector, { String sTmp( aToken2 ); sTmp += ' '; - sTmp.AppendAscii( sHTML_parabreak ); + sTmp.AppendAscii( OOO_STRING_SVTOOLS_HTML_parabreak ); if( CSS1_SCRIPT_ALL == nScript ) { @@ -1207,14 +1207,14 @@ SwCharFmt* SwCSS1Parser::GetChrFmt( USHORT nToken2, const String& rClass ) const case HTML_DEFINSTANCE_ON: nPoolId = RES_POOLCHR_HTML_DEFINSTANCE; break; case HTML_TELETYPE_ON: nPoolId = RES_POOLCHR_HTML_TELETYPE; break; - case HTML_SHORTQUOTE_ON: sName = sHTML_shortquote; break; - case HTML_LANGUAGE_ON: sName = sHTML_language; break; - case HTML_AUTHOR_ON: sName = sHTML_author; break; - case HTML_PERSON_ON: sName = sHTML_person; break; - case HTML_ACRONYM_ON: sName = sHTML_acronym; break; - case HTML_ABBREVIATION_ON: sName = sHTML_abbreviation; break; - case HTML_INSERTEDTEXT_ON: sName = sHTML_insertedtext; break; - case HTML_DELETEDTEXT_ON: sName = sHTML_deletedtext; break; + case HTML_SHORTQUOTE_ON: sName = OOO_STRING_SVTOOLS_HTML_shortquote; break; + case HTML_LANGUAGE_ON: sName = OOO_STRING_SVTOOLS_HTML_language; break; + case HTML_AUTHOR_ON: sName = OOO_STRING_SVTOOLS_HTML_author; break; + case HTML_PERSON_ON: sName = OOO_STRING_SVTOOLS_HTML_person; break; + case HTML_ACRONYM_ON: sName = OOO_STRING_SVTOOLS_HTML_acronym; break; + case HTML_ABBREVIATION_ON: sName = OOO_STRING_SVTOOLS_HTML_abbreviation; break; + case HTML_INSERTEDTEXT_ON: sName = OOO_STRING_SVTOOLS_HTML_insertedtext; break; + case HTML_DELETEDTEXT_ON: sName = OOO_STRING_SVTOOLS_HTML_deletedtext; break; } // die Vorlage suchen oder anlegen (geht nur mit Namen) @@ -1317,12 +1317,12 @@ SwTxtFmtColl *SwCSS1Parser::GetTxtFmtColl( USHORT nTxtColl, if( RES_POOLCOLL_TEXT == nTxtColl && aClass.Len() >= 9 && ('s' == aClass.GetChar(0) || 'S' == aClass.GetChar(0) ) ) { - if( aClass.EqualsIgnoreCaseAscii(sHTML_sdendnote) ) + if( aClass.EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_sdendnote) ) { nTxtColl = RES_POOLCOLL_ENDNOTE; aClass = aEmptyStr; } - else if( aClass.EqualsIgnoreCaseAscii(sHTML_sdfootnote) ) + else if( aClass.EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_sdfootnote) ) { nTxtColl = RES_POOLCOLL_FOOTNOTE; aClass = aEmptyStr; diff --git a/sw/source/filter/html/htmldraw.cxx b/sw/source/filter/html/htmldraw.cxx index 88965c8b1179..328eb21be526 100644 --- a/sw/source/filter/html/htmldraw.cxx +++ b/sw/source/filter/html/htmldraw.cxx @@ -85,16 +85,16 @@ const sal_uInt32 HTML_FRMOPTS_MARQUEE_CSS1 = static HTMLOptionEnum __FAR_DATA aHTMLMarqBehaviorTable[] = { - { sHTML_BEHAV_scroll, SDRTEXTANI_SCROLL }, - { sHTML_BEHAV_alternate, SDRTEXTANI_ALTERNATE }, - { sHTML_BEHAV_slide, SDRTEXTANI_SLIDE }, + { OOO_STRING_SVTOOLS_HTML_BEHAV_scroll, SDRTEXTANI_SCROLL }, + { OOO_STRING_SVTOOLS_HTML_BEHAV_alternate, SDRTEXTANI_ALTERNATE }, + { OOO_STRING_SVTOOLS_HTML_BEHAV_slide, SDRTEXTANI_SLIDE }, { 0, 0 } }; static HTMLOptionEnum __FAR_DATA aHTMLMarqDirectionTable[] = { - { sHTML_AL_left, SDRTEXTANI_LEFT }, - { sHTML_AL_right, SDRTEXTANI_RIGHT }, + { OOO_STRING_SVTOOLS_HTML_AL_left, SDRTEXTANI_LEFT }, + { OOO_STRING_SVTOOLS_HTML_AL_right, SDRTEXTANI_RIGHT }, { 0, 0 } }; @@ -331,7 +331,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable ) case HTML_O_LOOP: if( pOption->GetString(). - EqualsIgnoreCaseAscii(sHTML_LOOP_infinite) ) + EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_LOOP_infinite) ) { nCount = 0; } @@ -703,7 +703,7 @@ Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt, return rWrt; ByteString sOut( '<' ); - sOut += sHTML_marquee; + sOut += OOO_STRING_SVTOOLS_HTML_marquee; // Die Attribute des Objektd holen const SfxItemSet& rItemSet = pTextObj->GetMergedItemSet(); @@ -718,29 +718,29 @@ Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt, const sal_Char *pStr = 0; switch( eAniKind ) { - case SDRTEXTANI_SCROLL: pStr = sHTML_BEHAV_scroll; break; - case SDRTEXTANI_SLIDE: pStr = sHTML_BEHAV_slide; break; - case SDRTEXTANI_ALTERNATE: pStr = sHTML_BEHAV_alternate; break; + case SDRTEXTANI_SCROLL: pStr = OOO_STRING_SVTOOLS_HTML_BEHAV_scroll; break; + case SDRTEXTANI_SLIDE: pStr = OOO_STRING_SVTOOLS_HTML_BEHAV_slide; break; + case SDRTEXTANI_ALTERNATE: pStr = OOO_STRING_SVTOOLS_HTML_BEHAV_alternate; break; default: ; } if( pStr ) - (((sOut += ' ') += sHTML_O_behavior) += '=') += pStr; + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_behavior) += '=') += pStr; // DIRECTION pStr = 0; SdrTextAniDirection eAniDir = pTextObj->GetTextAniDirection(); switch( eAniDir ) { - case SDRTEXTANI_LEFT: pStr = sHTML_AL_left; break; - case SDRTEXTANI_RIGHT: pStr = sHTML_AL_right; break; + case SDRTEXTANI_LEFT: pStr = OOO_STRING_SVTOOLS_HTML_AL_left; break; + case SDRTEXTANI_RIGHT: pStr = OOO_STRING_SVTOOLS_HTML_AL_right; break; default: ; } if( pStr ) - (((sOut += ' ') += sHTML_O_direction) += '=') += pStr; + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_direction) += '=') += pStr; // LOOP sal_Int32 nCount = @@ -748,14 +748,14 @@ Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt, .GetValue(); if( 0==nCount ) nCount = SDRTEXTANI_SLIDE==eAniKind ? 1 : -1; - (((sOut += ' ') += sHTML_O_loop) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_loop) += '=') += ByteString::CreateFromInt32( nCount ); // SCROLLDELAY sal_uInt16 nDelay = ((const SdrTextAniDelayItem&)rItemSet.Get( SDRATTR_TEXT_ANIDELAY )) .GetValue(); - (((sOut += ' ') += sHTML_O_scrolldelay) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_scrolldelay) += '=') += ByteString::CreateFromInt32( nDelay ); // SCROLLAMOUNT @@ -773,7 +773,7 @@ Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt, MapMode(MAP_TWIP) ).Width()); } if( nAmount ) - (((sOut += ' ') += sHTML_O_scrollamount) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_scrollamount) += '=') += ByteString::CreateFromInt32( nAmount ); Size aTwipSz( pTextObj->GetLogicRect().GetSize() ); @@ -803,11 +803,11 @@ Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt, aPixelSz.Height() = 1; if( aPixelSz.Width() ) - (((sOut += ' ') += sHTML_O_width) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_width) += '=') += ByteString::CreateFromInt32( aPixelSz.Width() ); if( aPixelSz.Height() ) - (((sOut += ' ') += sHTML_O_height) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_height) += '=') += ByteString::CreateFromInt32( aPixelSz.Height() ); } @@ -819,7 +819,7 @@ Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt, const Color& rFillColor = ((const XFillColorItem&)rItemSet.Get(XATTR_FILLCOLOR)).GetColorValue(); - ((sOut += ' ') += sHTML_O_bgcolor) += '='; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_bgcolor) += '='; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_Color( rWrt.Strm(), rFillColor, rHTMLWrt.eDestEnc ); sOut.Erase(); @@ -849,7 +849,7 @@ Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt, HTMLOutFuncs::Out_String( rWrt.Strm(), aText, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_marquee, sal_False ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_marquee, sal_False ); if( aEndTags.Len() ) rWrt.Strm() << aEndTags.GetBuffer(); diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 0d0b94bc1ed1..0049097a5178 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -62,96 +62,96 @@ struct HTMLNumFmtTblEntry static HTMLOptionEnum __FAR_DATA aHTMLFldTypeTable[] = { - { sHTML_FT_author, RES_AUTHORFLD }, - { sHTML_FT_sender, RES_EXTUSERFLD }, - { sHTML_FT_date, RES_DATEFLD }, - { sHTML_FT_time, RES_TIMEFLD }, - { sHTML_FT_datetime,RES_DATETIMEFLD }, - { sHTML_FT_page, RES_PAGENUMBERFLD }, - { sHTML_FT_docinfo, RES_DOCINFOFLD }, - { sHTML_FT_docstat, RES_DOCSTATFLD }, - { sHTML_FT_filename,RES_FILENAMEFLD }, + { OOO_STRING_SW_HTML_FT_author, RES_AUTHORFLD }, + { OOO_STRING_SW_HTML_FT_sender, RES_EXTUSERFLD }, + { "DATE", RES_DATEFLD }, + { "TIME", RES_TIMEFLD }, + { OOO_STRING_SW_HTML_FT_datetime,RES_DATETIMEFLD }, + { OOO_STRING_SW_HTML_FT_page, RES_PAGENUMBERFLD }, + { OOO_STRING_SW_HTML_FT_docinfo, RES_DOCINFOFLD }, + { OOO_STRING_SW_HTML_FT_docstat, RES_DOCSTATFLD }, + { OOO_STRING_SW_HTML_FT_filename,RES_FILENAMEFLD }, { 0, 0 } }; static HTMLNumFmtTblEntry __FAR_DATA aHTMLDateFldFmtTable[] = { - { sHTML_FF_ssys, NF_DATE_SYSTEM_SHORT }, - { sHTML_FF_lsys, NF_DATE_SYSTEM_LONG }, - { sHTML_FF_dmy, NF_DATE_SYS_DDMMYY, }, - { sHTML_FF_dmyy, NF_DATE_SYS_DDMMYYYY, }, - { sHTML_FF_dmmy, NF_DATE_SYS_DMMMYY, }, - { sHTML_FF_dmmyy, NF_DATE_SYS_DMMMYYYY, }, - { sHTML_FF_dmmmy, NF_DATE_DIN_DMMMMYYYY }, - { sHTML_FF_dmmmyy, NF_DATE_DIN_DMMMMYYYY }, - { sHTML_FF_ddmmy, NF_DATE_SYS_NNDMMMYY }, - { sHTML_FF_ddmmmy, NF_DATE_SYS_NNDMMMMYYYY }, - { sHTML_FF_ddmmmyy, NF_DATE_SYS_NNDMMMMYYYY }, - { sHTML_FF_dddmmmy, NF_DATE_SYS_NNNNDMMMMYYYY }, - { sHTML_FF_dddmmmyy, NF_DATE_SYS_NNNNDMMMMYYYY }, - { sHTML_FF_my, NF_DATE_SYS_MMYY }, - { sHTML_FF_md, NF_DATE_DIN_MMDD }, - { sHTML_FF_ymd, NF_DATE_DIN_YYMMDD }, - { sHTML_FF_yymd, NF_DATE_DIN_YYYYMMDD }, + { "SSYS", NF_DATE_SYSTEM_SHORT }, + { "LSYS", NF_DATE_SYSTEM_LONG }, + { "DMY", NF_DATE_SYS_DDMMYY, }, + { "DMYY", NF_DATE_SYS_DDMMYYYY, }, + { "DMMY", NF_DATE_SYS_DMMMYY, }, + { "DMMYY", NF_DATE_SYS_DMMMYYYY, }, + { "DMMMY", NF_DATE_DIN_DMMMMYYYY }, + { "DMMMYY", NF_DATE_DIN_DMMMMYYYY }, + { "DDMMY", NF_DATE_SYS_NNDMMMYY }, + { "DDMMMY", NF_DATE_SYS_NNDMMMMYYYY }, + { "DDMMMYY", NF_DATE_SYS_NNDMMMMYYYY }, + { "DDDMMMY", NF_DATE_SYS_NNNNDMMMMYYYY }, + { "DDDMMMYY", NF_DATE_SYS_NNNNDMMMMYYYY }, + { "MY", NF_DATE_SYS_MMYY }, + { "MD", NF_DATE_DIN_MMDD }, + { "YMD", NF_DATE_DIN_YYMMDD }, + { "YYMD", NF_DATE_DIN_YYYYMMDD }, { 0, NF_NUMERIC_START } }; static HTMLNumFmtTblEntry __FAR_DATA aHTMLTimeFldFmtTable[] = { - { sHTML_FF_sys, NF_TIME_HHMMSS }, - { sHTML_FF_ssmm24, NF_TIME_HHMM }, - { sHTML_FF_ssmm12, NF_TIME_HHMMAMPM }, + { "SYS", NF_TIME_HHMMSS }, + { "SSMM24", NF_TIME_HHMM }, + { "SSMM12", NF_TIME_HHMMAMPM }, { 0, NF_NUMERIC_START } }; static HTMLOptionEnum __FAR_DATA aHTMLPageNumFldFmtTable[] = { - { sHTML_FF_uletter, SVX_NUM_CHARS_UPPER_LETTER }, - { sHTML_FF_lletter, SVX_NUM_CHARS_LOWER_LETTER }, - { sHTML_FF_uroman, SVX_NUM_ROMAN_UPPER }, - { sHTML_FF_lroman, SVX_NUM_ROMAN_LOWER }, - { sHTML_FF_arabic, SVX_NUM_ARABIC }, - { sHTML_FF_none, SVX_NUM_NUMBER_NONE }, - { sHTML_FF_char, SVX_NUM_CHAR_SPECIAL }, - { sHTML_FF_page, SVX_NUM_PAGEDESC }, - { sHTML_FF_ulettern, SVX_NUM_CHARS_UPPER_LETTER_N }, - { sHTML_FF_llettern, SVX_NUM_CHARS_LOWER_LETTER_N }, + { OOO_STRING_SW_HTML_FF_uletter, SVX_NUM_CHARS_UPPER_LETTER }, + { OOO_STRING_SW_HTML_FF_lletter, SVX_NUM_CHARS_LOWER_LETTER }, + { OOO_STRING_SW_HTML_FF_uroman, SVX_NUM_ROMAN_UPPER }, + { OOO_STRING_SW_HTML_FF_lroman, SVX_NUM_ROMAN_LOWER }, + { OOO_STRING_SW_HTML_FF_arabic, SVX_NUM_ARABIC }, + { OOO_STRING_SW_HTML_FF_none, SVX_NUM_NUMBER_NONE }, + { OOO_STRING_SW_HTML_FF_char, SVX_NUM_CHAR_SPECIAL }, + { OOO_STRING_SW_HTML_FF_page, SVX_NUM_PAGEDESC }, + { OOO_STRING_SW_HTML_FF_ulettern, SVX_NUM_CHARS_UPPER_LETTER_N }, + { OOO_STRING_SW_HTML_FF_llettern, SVX_NUM_CHARS_LOWER_LETTER_N }, { 0, 0 } }; static HTMLOptionEnum __FAR_DATA aHTMLExtUsrFldSubTable[] = { - { sHTML_FS_company, EU_COMPANY }, - { sHTML_FS_firstname, EU_FIRSTNAME }, - { sHTML_FS_name, EU_NAME }, - { sHTML_FS_shortcut, EU_SHORTCUT }, - { sHTML_FS_street, EU_STREET }, - { sHTML_FS_country, EU_COUNTRY }, - { sHTML_FS_zip, EU_ZIP }, - { sHTML_FS_city, EU_CITY }, - { sHTML_FS_title, EU_TITLE }, - { sHTML_FS_position, EU_POSITION }, - { sHTML_FS_pphone, EU_PHONE_PRIVATE }, - { sHTML_FS_cphone, EU_PHONE_COMPANY }, - { sHTML_FS_fax, EU_FAX }, - { sHTML_FS_email, EU_EMAIL }, - { sHTML_FS_state, EU_STATE }, + { OOO_STRING_SW_HTML_FS_company, EU_COMPANY }, + { OOO_STRING_SW_HTML_FS_firstname, EU_FIRSTNAME }, + { OOO_STRING_SW_HTML_FS_name, EU_NAME }, + { OOO_STRING_SW_HTML_FS_shortcut, EU_SHORTCUT }, + { OOO_STRING_SW_HTML_FS_street, EU_STREET }, + { OOO_STRING_SW_HTML_FS_country, EU_COUNTRY }, + { OOO_STRING_SW_HTML_FS_zip, EU_ZIP }, + { OOO_STRING_SW_HTML_FS_city, EU_CITY }, + { OOO_STRING_SW_HTML_FS_title, EU_TITLE }, + { OOO_STRING_SW_HTML_FS_position, EU_POSITION }, + { OOO_STRING_SW_HTML_FS_pphone, EU_PHONE_PRIVATE }, + { OOO_STRING_SW_HTML_FS_cphone, EU_PHONE_COMPANY }, + { OOO_STRING_SW_HTML_FS_fax, EU_FAX }, + { OOO_STRING_SW_HTML_FS_email, EU_EMAIL }, + { OOO_STRING_SW_HTML_FS_state, EU_STATE }, { 0, 0 } }; static HTMLOptionEnum __FAR_DATA aHTMLAuthorFldFmtTable[] = { - { sHTML_FF_name, AF_NAME }, - { sHTML_FF_shortcut, AF_SHORTCUT }, + { OOO_STRING_SW_HTML_FF_name, AF_NAME }, + { OOO_STRING_SW_HTML_FF_shortcut, AF_SHORTCUT }, { 0, 0 } }; static HTMLOptionEnum __FAR_DATA aHTMLPageNumFldSubTable[] = { - { sHTML_FS_random, PG_RANDOM }, - { sHTML_FS_next, PG_NEXT }, - { sHTML_FS_prev, PG_PREV }, + { OOO_STRING_SW_HTML_FS_random, PG_RANDOM }, + { OOO_STRING_SW_HTML_FS_next, PG_NEXT }, + { OOO_STRING_SW_HTML_FS_prev, PG_PREV }, { 0, 0 } }; @@ -165,46 +165,46 @@ static HTMLOptionEnum __FAR_DATA aHTMLPageNumFldSubTable[] = static HTMLOptionEnum __FAR_DATA aHTMLDocInfoFldSubTable[] = { - { sHTML_FS_title, DI_TITEL }, - { sHTML_FS_theme, DI_THEMA }, - { sHTML_FS_keys, DI_KEYS }, - { sHTML_FS_comment, DI_COMMENT }, - { sHTML_FS_info1, DI_INFO1 }, - { sHTML_FS_info2, DI_INFO2 }, - { sHTML_FS_info3, DI_INFO3 }, - { sHTML_FS_info4, DI_INFO4 }, - { sHTML_FS_custom, DI_CUSTOM }, - { sHTML_FS_create, DI_CREATE }, - { sHTML_FS_change, DI_CHANGE }, + { OOO_STRING_SW_HTML_FS_title, DI_TITEL }, + { OOO_STRING_SW_HTML_FS_theme, DI_THEMA }, + { OOO_STRING_SW_HTML_FS_keys, DI_KEYS }, + { OOO_STRING_SW_HTML_FS_comment, DI_COMMENT }, + { "INFO1", DI_INFO1 }, + { "INFO2", DI_INFO2 }, + { "INFO3", DI_INFO3 }, + { "INFO4", DI_INFO4 }, + { OOO_STRING_SW_HTML_FS_custom, DI_CUSTOM }, + { OOO_STRING_SW_HTML_FS_create, DI_CREATE }, + { OOO_STRING_SW_HTML_FS_change, DI_CHANGE }, { 0, 0 } }; static HTMLOptionEnum __FAR_DATA aHTMLDocInfoFldFmtTable[] = { - { sHTML_FF_author, DI_SUB_AUTHOR }, - { sHTML_FF_time, DI_SUB_TIME }, - { sHTML_FF_date, DI_SUB_DATE }, + { OOO_STRING_SW_HTML_FF_author, DI_SUB_AUTHOR }, + { OOO_STRING_SW_HTML_FF_time, DI_SUB_TIME }, + { OOO_STRING_SW_HTML_FF_date, DI_SUB_DATE }, { 0, 0 } }; static HTMLOptionEnum __FAR_DATA aHTMLDocStatFldSubTable[] = { - { sHTML_FS_page, DS_PAGE }, - { sHTML_FS_para, DS_PARA }, - { sHTML_FS_word, DS_WORD }, - { sHTML_FS_char, DS_CHAR }, - { sHTML_FS_tbl, DS_TBL }, - { sHTML_FS_grf, DS_GRF }, - { sHTML_FS_ole, DS_OLE }, + { OOO_STRING_SW_HTML_FS_page, DS_PAGE }, + { OOO_STRING_SW_HTML_FS_para, DS_PARA }, + { OOO_STRING_SW_HTML_FS_word, DS_WORD }, + { OOO_STRING_SW_HTML_FS_char, DS_CHAR }, + { OOO_STRING_SW_HTML_FS_tbl, DS_TBL }, + { OOO_STRING_SW_HTML_FS_grf, DS_GRF }, + { OOO_STRING_SW_HTML_FS_ole, DS_OLE }, { 0, 0 } }; static HTMLOptionEnum __FAR_DATA aHTMLFileNameFldFmtTable[] = { - { sHTML_FF_name, FF_NAME }, - { sHTML_FF_pathname, FF_PATHNAME }, - { sHTML_FF_path, FF_PATH }, - { sHTML_FF_name_noext, FF_NAME_NOEXT }, + { OOO_STRING_SW_HTML_FF_name, FF_NAME }, + { OOO_STRING_SW_HTML_FF_pathname, FF_PATHNAME }, + { OOO_STRING_SW_HTML_FF_path, FF_PATH }, + { OOO_STRING_SW_HTML_FF_name_noext, FF_NAME_NOEXT }, { 0, 0 } }; diff --git a/sw/source/filter/html/htmlfld.hxx b/sw/source/filter/html/htmlfld.hxx index f9127f5cde80..9432a1a19904 100644 --- a/sw/source/filter/html/htmlfld.hxx +++ b/sw/source/filter/html/htmlfld.hxx @@ -31,103 +31,64 @@ #ifndef _HTMLFLD_HXX #define _HTMLFLD_HXX -#include <svtools/htmlkywd.hxx> - -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FT_author, "AUTHOR" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FT_sender, "SENDER" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FT_date, "DATE" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FT_time, "TIME" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FT_datetime, "DATETIME" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FT_page, "PAGE" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FT_docinfo, "DOCINFO" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FT_docstat, "DOCSTAT" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FT_filename, "FILENAME" ); - -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_company, "COMPANY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_firstname, "FIRSTNAME" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_name, "NAME" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_shortcut, "SHORTCUT" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_street, "STREET" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_country, "COUNTRY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_zip, "ZIP" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_city, "CITY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_title, "TITLE" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_position, "POSITION" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_pphone, "PPHONE" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_cphone, "CPHONE" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_fax, "FAX" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_email, "EMAIL" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_state, "STATE" ); - -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_random, "RANDOM" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_next, "NEXT" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_prev, "PREV" ); - -//sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_title, "TITLE" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_theme, "THEME" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_keys, "KEYS" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_comment, "COMMENT" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_info1, "INFO1" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_info2, "INFO2" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_info3, "INFO3" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_info4, "INFO4" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_custom, "CUSTOM" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_create, "CREATE" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_change, "CHANGE" ); - -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_page, "PAGE" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_para, "PARAGRAPH" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_word, "WORD" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_char, "CHAR" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_tbl, "TABLE" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_grf, "GRAPHIC" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FS_ole, "OLE" ); - -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_name, "NAME" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_shortcut, "SHORTCUT" ); - -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_ssys, "SSYS" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_lsys, "LSYS" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_dmy, "DMY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_dmyy, "DMYY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_dmmy, "DMMY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_dmmyy, "DMMYY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_dmmmy, "DMMMY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_dmmmyy, "DMMMYY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_ddmmy, "DDMMY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_ddmmmy, "DDMMMY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_ddmmmyy, "DDMMMYY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_dddmmmy, "DDDMMMY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_dddmmmyy, "DDDMMMYY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_my, "MY" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_md, "MD" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_ymd, "YMD" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_yymd, "YYMD" ); - -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_sys, "SYS" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_ssmm24, "SSMM24" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_ssmm12, "SSMM12" ); - -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_uletter, "ULETTER" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_lletter, "LLETTER" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_uroman, "UROMAN" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_lroman, "LROMAN" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_arabic, "ARABIC" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_none, "NONE" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_char, "CHAR" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_page, "PAGE" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_ulettern, "ULETTERN" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_llettern, "LLETTERN" ); - -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_author, "AUTHOR" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_time, "TIME" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_date, "DATE" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_all, "ALL" ); - -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_pathname, "PATHNAME" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_path, "PATH" ); -extern sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DECL( sHTML_FF_name_noext, "NAME-NOEXT" ); - +#include "sal/config.h" + +#define OOO_STRING_SW_HTML_FT_author "AUTHOR" +#define OOO_STRING_SW_HTML_FT_sender "SENDER" +#define OOO_STRING_SW_HTML_FT_datetime "DATETIME" +#define OOO_STRING_SW_HTML_FT_page "PAGE" +#define OOO_STRING_SW_HTML_FT_docinfo "DOCINFO" +#define OOO_STRING_SW_HTML_FT_docstat "DOCSTAT" +#define OOO_STRING_SW_HTML_FT_filename "FILENAME" +#define OOO_STRING_SW_HTML_FS_company "COMPANY" +#define OOO_STRING_SW_HTML_FS_firstname "FIRSTNAME" +#define OOO_STRING_SW_HTML_FS_name "NAME" +#define OOO_STRING_SW_HTML_FS_shortcut "SHORTCUT" +#define OOO_STRING_SW_HTML_FS_street "STREET" +#define OOO_STRING_SW_HTML_FS_country "COUNTRY" +#define OOO_STRING_SW_HTML_FS_zip "ZIP" +#define OOO_STRING_SW_HTML_FS_city "CITY" +#define OOO_STRING_SW_HTML_FS_title "TITLE" +#define OOO_STRING_SW_HTML_FS_position "POSITION" +#define OOO_STRING_SW_HTML_FS_pphone "PPHONE" +#define OOO_STRING_SW_HTML_FS_cphone "CPHONE" +#define OOO_STRING_SW_HTML_FS_fax "FAX" +#define OOO_STRING_SW_HTML_FS_email "EMAIL" +#define OOO_STRING_SW_HTML_FS_state "STATE" +#define OOO_STRING_SW_HTML_FS_random "RANDOM" +#define OOO_STRING_SW_HTML_FS_next "NEXT" +#define OOO_STRING_SW_HTML_FS_prev "PREV" +#define OOO_STRING_SW_HTML_FS_theme "THEME" +#define OOO_STRING_SW_HTML_FS_keys "KEYS" +#define OOO_STRING_SW_HTML_FS_comment "COMMENT" +#define OOO_STRING_SW_HTML_FS_custom "CUSTOM" +#define OOO_STRING_SW_HTML_FS_create "CREATE" +#define OOO_STRING_SW_HTML_FS_change "CHANGE" +#define OOO_STRING_SW_HTML_FS_page "PAGE" +#define OOO_STRING_SW_HTML_FS_para "PARAGRAPH" +#define OOO_STRING_SW_HTML_FS_word "WORD" +#define OOO_STRING_SW_HTML_FS_char "CHAR" +#define OOO_STRING_SW_HTML_FS_tbl "TABLE" +#define OOO_STRING_SW_HTML_FS_grf "GRAPHIC" +#define OOO_STRING_SW_HTML_FS_ole "OLE" +#define OOO_STRING_SW_HTML_FF_name "NAME" +#define OOO_STRING_SW_HTML_FF_shortcut "SHORTCUT" +#define OOO_STRING_SW_HTML_FF_uletter "ULETTER" +#define OOO_STRING_SW_HTML_FF_lletter "LLETTER" +#define OOO_STRING_SW_HTML_FF_uroman "UROMAN" +#define OOO_STRING_SW_HTML_FF_lroman "LROMAN" +#define OOO_STRING_SW_HTML_FF_arabic "ARABIC" +#define OOO_STRING_SW_HTML_FF_none "NONE" +#define OOO_STRING_SW_HTML_FF_char "CHAR" +#define OOO_STRING_SW_HTML_FF_page "PAGE" +#define OOO_STRING_SW_HTML_FF_ulettern "ULETTERN" +#define OOO_STRING_SW_HTML_FF_llettern "LLETTERN" +#define OOO_STRING_SW_HTML_FF_author "AUTHOR" +#define OOO_STRING_SW_HTML_FF_time "TIME" +#define OOO_STRING_SW_HTML_FF_date "DATE" +#define OOO_STRING_SW_HTML_FF_pathname "PATHNAME" +#define OOO_STRING_SW_HTML_FF_path "PATH" +#define OOO_STRING_SW_HTML_FF_name_noext "NAME-NOEXT" #endif diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 9d0f7da4c4b2..b3ef7f67d75e 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/i18n/ScriptType.hpp> #include <tools/string.hxx> +#include <svtools/htmlkywd.hxx> #include <svtools/htmlout.hxx> #include <svtools/htmltokn.h> #include <fmtfld.hxx> @@ -49,120 +50,22 @@ using namespace nsSwDocInfoSubType; -//----------------------------------------------------------------------- - -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FT_author, "AUTHOR" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FT_sender, "SENDER" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FT_date, "DATE" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FT_time, "TIME" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FT_datetime, "DATETIME" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FT_page, "PAGE" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FT_docinfo, "DOCINFO" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FT_docstat, "DOCSTAT" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FT_filename, "FILENAME" ); - -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_company, "COMPANY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_firstname, "FIRSTNAME" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_name, "NAME" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_shortcut, "SHORTCUT" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_street, "STREET" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_country, "COUNTRY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_zip, "ZIP" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_city, "CITY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_title, "TITLE" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_position, "POSITION" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_pphone, "PPHONE" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_cphone, "CPHONE" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_fax, "FAX" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_email, "EMAIL" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_state, "STATE" ); - -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_random, "RANDOM" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_next, "NEXT" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_prev, "PREV" ); - -//sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_title, "TITLE" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_theme, "THEME" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_keys, "KEYS" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_comment, "COMMENT" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_info1, "INFO1" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_info2, "INFO2" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_info3, "INFO3" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_info4, "INFO4" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_custom, "CUSTOM" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_create, "CREATE" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_change, "CHANGE" ); - -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_page, "PAGE" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_para, "PARAGRAPH" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_word, "WORD" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_char, "CHAR" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_tbl, "TABLE" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_grf, "GRAPHIC" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FS_ole, "OLE" ); - -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_name, "NAME" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_shortcut, "SHORTCUT" ); - -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_ssys, "SSYS" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_lsys, "LSYS" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_dmy, "DMY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_dmyy, "DMYY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_dmmy, "DMMY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_dmmyy, "DMMYY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_dmmmy, "DMMMY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_dmmmyy, "DMMMYY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_ddmmy, "DDMMY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_ddmmmy, "DDMMMY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_ddmmmyy, "DDMMMYY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_dddmmmy, "DDDMMMY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_dddmmmyy, "DDDMMMYY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_my, "MY" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_md, "MD" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_ymd, "YMD" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_yymd, "YYMD" ); - -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_sys, "SYS" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_ssmm24, "SSMM24" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_ssmm12, "SSMM12" ); - -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_uletter, "ULETTER" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_lletter, "LLETTER" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_uroman, "UROMAN" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_lroman, "LROMAN" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_arabic, "ARABIC" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_none, "NONE" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_char, "CHAR" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_page, "PAGE" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_ulettern, "ULETTERN" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_llettern, "LLETTERN" ); - -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_author, "AUTHOR" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_time, "TIME" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_date, "DATE" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_all, "ALL" ); - -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_pathname, "PATHNAME" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_path, "PATH" ); -sal_Char __FAR_DATA SVTOOLS_CONSTASCII_DEF( sHTML_FF_name_noext, "NAME-NOEXT" ); - - const sal_Char *SwHTMLWriter::GetNumFormat( USHORT nFmt ) { const sal_Char *pFmtStr = 0; switch( (SvxExtNumType)nFmt ) { - case SVX_NUM_CHARS_UPPER_LETTER: pFmtStr = sHTML_FF_uletter; break; - case SVX_NUM_CHARS_LOWER_LETTER: pFmtStr = sHTML_FF_lletter; break; - case SVX_NUM_ROMAN_UPPER: pFmtStr = sHTML_FF_uroman; break; - case SVX_NUM_ROMAN_LOWER: pFmtStr = sHTML_FF_lroman; break; - case SVX_NUM_ARABIC: pFmtStr = sHTML_FF_arabic; break; - case SVX_NUM_NUMBER_NONE: pFmtStr = sHTML_FF_none; break; - case SVX_NUM_CHAR_SPECIAL: pFmtStr = sHTML_FF_char; break; - case SVX_NUM_PAGEDESC: pFmtStr = sHTML_FF_page; break; - case SVX_NUM_CHARS_UPPER_LETTER_N: pFmtStr = sHTML_FF_ulettern; break; - case SVX_NUM_CHARS_LOWER_LETTER_N: pFmtStr = sHTML_FF_llettern; break; + case SVX_NUM_CHARS_UPPER_LETTER: pFmtStr = OOO_STRING_SW_HTML_FF_uletter; break; + case SVX_NUM_CHARS_LOWER_LETTER: pFmtStr = OOO_STRING_SW_HTML_FF_lletter; break; + case SVX_NUM_ROMAN_UPPER: pFmtStr = OOO_STRING_SW_HTML_FF_uroman; break; + case SVX_NUM_ROMAN_LOWER: pFmtStr = OOO_STRING_SW_HTML_FF_lroman; break; + case SVX_NUM_ARABIC: pFmtStr = OOO_STRING_SW_HTML_FF_arabic; break; + case SVX_NUM_NUMBER_NONE: pFmtStr = OOO_STRING_SW_HTML_FF_none; break; + case SVX_NUM_CHAR_SPECIAL: pFmtStr = OOO_STRING_SW_HTML_FF_char; break; + case SVX_NUM_PAGEDESC: pFmtStr = OOO_STRING_SW_HTML_FF_page; break; + case SVX_NUM_CHARS_UPPER_LETTER_N: pFmtStr = OOO_STRING_SW_HTML_FF_ulettern; break; + case SVX_NUM_CHARS_LOWER_LETTER_N: pFmtStr = OOO_STRING_SW_HTML_FF_llettern; break; default: ; } @@ -193,24 +96,24 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, switch( nField ) { case RES_EXTUSERFLD: - pTypeStr = sHTML_FT_sender; + pTypeStr = OOO_STRING_SW_HTML_FT_sender; switch( (SwExtUserSubType)pFld->GetSubType() ) { - case EU_COMPANY: pSubStr = sHTML_FS_company; break; - case EU_FIRSTNAME: pSubStr = sHTML_FS_firstname; break; - case EU_NAME: pSubStr = sHTML_FS_name; break; - case EU_SHORTCUT: pSubStr = sHTML_FS_shortcut; break; - case EU_STREET: pSubStr = sHTML_FS_street; break; - case EU_COUNTRY: pSubStr = sHTML_FS_country; break; - case EU_ZIP: pSubStr = sHTML_FS_zip; break; - case EU_CITY: pSubStr = sHTML_FS_city; break; - case EU_TITLE: pSubStr = sHTML_FS_title; break; - case EU_POSITION: pSubStr = sHTML_FS_position; break; - case EU_PHONE_PRIVATE: pSubStr = sHTML_FS_pphone; break; - case EU_PHONE_COMPANY: pSubStr = sHTML_FS_cphone; break; - case EU_FAX: pSubStr = sHTML_FS_fax; break; - case EU_EMAIL: pSubStr = sHTML_FS_email; break; - case EU_STATE: pSubStr = sHTML_FS_state; break; + case EU_COMPANY: pSubStr = OOO_STRING_SW_HTML_FS_company; break; + case EU_FIRSTNAME: pSubStr = OOO_STRING_SW_HTML_FS_firstname; break; + case EU_NAME: pSubStr = OOO_STRING_SW_HTML_FS_name; break; + case EU_SHORTCUT: pSubStr = OOO_STRING_SW_HTML_FS_shortcut; break; + case EU_STREET: pSubStr = OOO_STRING_SW_HTML_FS_street; break; + case EU_COUNTRY: pSubStr = OOO_STRING_SW_HTML_FS_country; break; + case EU_ZIP: pSubStr = OOO_STRING_SW_HTML_FS_zip; break; + case EU_CITY: pSubStr = OOO_STRING_SW_HTML_FS_city; break; + case EU_TITLE: pSubStr = OOO_STRING_SW_HTML_FS_title; break; + case EU_POSITION: pSubStr = OOO_STRING_SW_HTML_FS_position; break; + case EU_PHONE_PRIVATE: pSubStr = OOO_STRING_SW_HTML_FS_pphone; break; + case EU_PHONE_COMPANY: pSubStr = OOO_STRING_SW_HTML_FS_cphone; break; + case EU_FAX: pSubStr = OOO_STRING_SW_HTML_FS_fax; break; + case EU_EMAIL: pSubStr = OOO_STRING_SW_HTML_FS_email; break; + case EU_STATE: pSubStr = OOO_STRING_SW_HTML_FS_state; break; default: ; } @@ -219,18 +122,18 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, break; case RES_AUTHORFLD: - pTypeStr = sHTML_FT_author; + pTypeStr = OOO_STRING_SW_HTML_FT_author; switch( (SwAuthorFormat)nFmt & 0xff) { - case AF_NAME: pFmtStr = sHTML_FF_name; break; - case AF_SHORTCUT: pFmtStr = sHTML_FF_shortcut; break; + case AF_NAME: pFmtStr = OOO_STRING_SW_HTML_FF_name; break; + case AF_SHORTCUT: pFmtStr = OOO_STRING_SW_HTML_FF_shortcut; break; } ASSERT( pFmtStr, "ubekanntes Format fuer SwAuthorField" ); bFixed = ((const SwAuthorField*)pFld)->IsFixed(); break; case RES_DATETIMEFLD: - pTypeStr = sHTML_FT_datetime; + pTypeStr = OOO_STRING_SW_HTML_FT_datetime; bNumFmt = TRUE; if( ((SwDateTimeField*)pFld)->IsFixed() ) { @@ -241,13 +144,13 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, case RES_PAGENUMBERFLD: { - pTypeStr = sHTML_FT_page; + pTypeStr = OOO_STRING_SW_HTML_FT_page; SwPageNumSubType eSubType = (SwPageNumSubType)pFld->GetSubType(); switch( eSubType ) { - case PG_RANDOM: pSubStr = sHTML_FS_random; break; - case PG_NEXT: pSubStr = sHTML_FS_next; break; - case PG_PREV: pSubStr = sHTML_FS_prev; break; + case PG_RANDOM: pSubStr = OOO_STRING_SW_HTML_FS_random; break; + case PG_NEXT: pSubStr = OOO_STRING_SW_HTML_FS_next; break; + case PG_PREV: pSubStr = OOO_STRING_SW_HTML_FS_prev; break; } ASSERT( pSubStr, "ubekannter Subtyp fuer SwPageNumberField" ); pFmtStr = SwHTMLWriter::GetNumFormat( static_cast< sal_uInt16 >(nFmt) ); @@ -272,19 +175,19 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, case RES_DOCINFOFLD: { USHORT nSubType = pFld->GetSubType(); - pTypeStr = sHTML_FT_docinfo; + pTypeStr = OOO_STRING_SW_HTML_FT_docinfo; USHORT nExtSubType = nSubType & 0x0f00; nSubType &= 0x00ff; switch( nSubType ) { - case DI_TITEL: pSubStr = sHTML_FS_title; break; - case DI_THEMA: pSubStr = sHTML_FS_theme; break; - case DI_KEYS: pSubStr = sHTML_FS_keys; break; - case DI_COMMENT: pSubStr = sHTML_FS_comment; break; - case DI_CREATE: pSubStr = sHTML_FS_create; break; - case DI_CHANGE: pSubStr = sHTML_FS_change; break; - case DI_CUSTOM: pSubStr = sHTML_FS_custom; break; + case DI_TITEL: pSubStr = OOO_STRING_SW_HTML_FS_title; break; + case DI_THEMA: pSubStr = OOO_STRING_SW_HTML_FS_theme; break; + case DI_KEYS: pSubStr = OOO_STRING_SW_HTML_FS_keys; break; + case DI_COMMENT: pSubStr = OOO_STRING_SW_HTML_FS_comment; break; + case DI_CREATE: pSubStr = OOO_STRING_SW_HTML_FS_create; break; + case DI_CHANGE: pSubStr = OOO_STRING_SW_HTML_FS_change; break; + case DI_CUSTOM: pSubStr = OOO_STRING_SW_HTML_FS_custom; break; default: pTypeStr = 0; break; } @@ -297,14 +200,14 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, switch( nExtSubType ) { case DI_SUB_AUTHOR: - pFmtStr = sHTML_FF_author; + pFmtStr = OOO_STRING_SW_HTML_FF_author; break; case DI_SUB_TIME: - pFmtStr = sHTML_FF_time; + pFmtStr = OOO_STRING_SW_HTML_FF_time; bNumFmt = TRUE; break; case DI_SUB_DATE: - pFmtStr = sHTML_FF_date; + pFmtStr = OOO_STRING_SW_HTML_FF_date; bNumFmt = TRUE; break; } @@ -332,17 +235,17 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, case RES_DOCSTATFLD: { - pTypeStr = sHTML_FT_docstat; + pTypeStr = OOO_STRING_SW_HTML_FT_docstat; USHORT nSubType = pFld->GetSubType(); switch( nSubType ) { - case DS_PAGE: pSubStr = sHTML_FS_page; break; - case DS_PARA: pSubStr = sHTML_FS_para; break; - case DS_WORD: pSubStr = sHTML_FS_word; break; - case DS_CHAR: pSubStr = sHTML_FS_char; break; - case DS_TBL: pSubStr = sHTML_FS_tbl; break; - case DS_GRF: pSubStr = sHTML_FS_grf; break; - case DS_OLE: pSubStr = sHTML_FS_ole; break; + case DS_PAGE: pSubStr = OOO_STRING_SW_HTML_FS_page; break; + case DS_PARA: pSubStr = OOO_STRING_SW_HTML_FS_para; break; + case DS_WORD: pSubStr = OOO_STRING_SW_HTML_FS_word; break; + case DS_CHAR: pSubStr = OOO_STRING_SW_HTML_FS_char; break; + case DS_TBL: pSubStr = OOO_STRING_SW_HTML_FS_tbl; break; + case DS_GRF: pSubStr = OOO_STRING_SW_HTML_FS_grf; break; + case DS_OLE: pSubStr = OOO_STRING_SW_HTML_FS_ole; break; default: pTypeStr = 0; break; } pFmtStr = SwHTMLWriter::GetNumFormat( static_cast< sal_uInt16 >(nFmt) ); @@ -350,13 +253,13 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, break; case RES_FILENAMEFLD: - pTypeStr = sHTML_FT_filename; + pTypeStr = OOO_STRING_SW_HTML_FT_filename; switch( (SwFileNameFormat)(nFmt & ~FF_FIXED) ) { - case FF_NAME: pFmtStr = sHTML_FF_name; break; - case FF_PATHNAME: pFmtStr = sHTML_FF_pathname; break; - case FF_PATH: pFmtStr = sHTML_FF_path; break; - case FF_NAME_NOEXT: pFmtStr = sHTML_FF_name_noext; break; + case FF_NAME: pFmtStr = OOO_STRING_SW_HTML_FF_name; break; + case FF_PATHNAME: pFmtStr = OOO_STRING_SW_HTML_FF_pathname; break; + case FF_PATH: pFmtStr = OOO_STRING_SW_HTML_FF_path; break; + case FF_NAME_NOEXT: pFmtStr = OOO_STRING_SW_HTML_FF_name_noext; break; default: ; } @@ -369,22 +272,22 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, if( pTypeStr ) { ByteString sOut( '<' ); - ((((sOut += sHTML_sdfield) += ' ') += sHTML_O_type) += '=') + ((((sOut += OOO_STRING_SVTOOLS_HTML_sdfield) += ' ') += OOO_STRING_SVTOOLS_HTML_O_type) += '=') += pTypeStr; if( pSubStr ) - (((sOut += ' ') += sHTML_O_subtype) += '=') += pSubStr; + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_subtype) += '=') += pSubStr; if( pFmtStr ) - (((sOut += ' ') += sHTML_O_format) += '=') += pFmtStr; + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_format) += '=') += pFmtStr; if( aName.Len() ) { - (((sOut += ' ') += sHTML_O_name) += "=\""); + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\""); rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), aName, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); sOut = '\"'; } if( aValue.Len() ) { - ((sOut += ' ') += sHTML_O_value) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_value) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), aValue, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); sOut = '\"'; @@ -399,7 +302,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, } if( bFixed ) - (sOut += ' ') += sHTML_O_sdfixed; + (sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_sdfixed; sOut += '>'; rWrt.Strm() << sOut.GetBuffer(); } @@ -517,7 +420,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, // Off-Tag ausgeben if( pTypeStr ) - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_sdfield, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_sdfield, FALSE ); return rWrt; } @@ -557,7 +460,7 @@ Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt ) if( (rComment.Len() >= 6 && '<' == rComment.GetChar(0) && '>' == rComment.GetChar(rComment.Len()-1) && - rComment.Copy( 1, 4 ).EqualsIgnoreCaseAscii(sHTML_meta)) || + rComment.Copy( 1, 4 ).EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_meta)) || (rComment.Len() >= 7 && rComment.Copy( 0, 4 ).EqualsAscii( "<!--" ) && rComment.Copy( rComment.Len()-3, 3 ).EqualsAscii( "-->" )) ) @@ -597,7 +500,7 @@ Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt ) String sComment( rComment ); sComment.ConvertLineEnd( GetSystemLineEnd() ); // TODO: ??? - (((sOut += sHTML_comment) += ' ') + (((sOut += OOO_STRING_SVTOOLS_HTML_comment) += ' ') += ByteString( sComment, ((SwHTMLWriter&)rWrt).eDestEnc )) += " -->"; rWrt.Strm() << sOut.GetBuffer(); diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx index 80d37e28a613..e79016c96364 100644 --- a/sw/source/filter/html/htmlfly.cxx +++ b/sw/source/filter/html/htmlfly.cxx @@ -167,16 +167,16 @@ extern HTMLOutEvent __FAR_DATA aAnchorEventTable[]; static HTMLOutEvent __FAR_DATA aImageEventTable[] = { - { sHTML_O_SDonload, sHTML_O_onload, SVX_EVENT_IMAGE_LOAD }, - { sHTML_O_SDonabort, sHTML_O_onabort, SVX_EVENT_IMAGE_ABORT }, - { sHTML_O_SDonerror, sHTML_O_onerror, SVX_EVENT_IMAGE_ERROR }, + { OOO_STRING_SVTOOLS_HTML_O_SDonload, OOO_STRING_SVTOOLS_HTML_O_onload, SVX_EVENT_IMAGE_LOAD }, + { OOO_STRING_SVTOOLS_HTML_O_SDonabort, OOO_STRING_SVTOOLS_HTML_O_onabort, SVX_EVENT_IMAGE_ABORT }, + { OOO_STRING_SVTOOLS_HTML_O_SDonerror, OOO_STRING_SVTOOLS_HTML_O_onerror, SVX_EVENT_IMAGE_ERROR }, { 0, 0, 0 } }; static HTMLOutEvent __FAR_DATA aIMapEventTable[] = { - { sHTML_O_SDonmouseover, sHTML_O_onmouseover, SFX_EVENT_MOUSEOVER_OBJECT }, - { sHTML_O_SDonmouseout, sHTML_O_onmouseout, SFX_EVENT_MOUSEOUT_OBJECT }, + { OOO_STRING_SVTOOLS_HTML_O_SDonmouseover, OOO_STRING_SVTOOLS_HTML_O_onmouseover, SFX_EVENT_MOUSEOVER_OBJECT }, + { OOO_STRING_SVTOOLS_HTML_O_SDonmouseout, OOO_STRING_SVTOOLS_HTML_O_onmouseout, SFX_EVENT_MOUSEOUT_OBJECT }, { 0, 0, 0 } }; @@ -466,10 +466,10 @@ void SwHTMLWriter::OutFrmFmt( BYTE nMode, const SwFrmFmt& rFrmFmt, ByteString sOut( '<' ); pCntnrStr = (HTML_CNTNR_DIV == nCntnrMode) - ? sHTML_division - : sHTML_span; + ? OOO_STRING_SVTOOLS_HTML_division + : OOO_STRING_SVTOOLS_HTML_span; sOut += pCntnrStr; - ((((sOut += ' ') += sHTML_O_class) += "=\"") + ((((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_class) += "=\"") += sCSS1_class_abs_pos) += '\"'; Strm() << sOut.GetBuffer(); @@ -542,11 +542,11 @@ void SwHTMLWriter::OutFrmFmt( BYTE nMode, const SwFrmFmt& rFrmFmt, DecIndentLevel(); if( bLFPossible ) OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_division, FALSE ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_division, FALSE ); bLFPossible = TRUE; } else if( HTML_CNTNR_SPAN == nCntnrMode ) - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_span, FALSE ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_span, FALSE ); } @@ -564,7 +564,7 @@ void SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt, rFrmFmt.GetName().Len() ) { const sal_Char *pStr = - (nFrmOpts & HTML_FRMOPT_ID) ? sHTML_O_id : sHTML_O_name; + (nFrmOpts & HTML_FRMOPT_ID) ? OOO_STRING_SVTOOLS_HTML_O_id : OOO_STRING_SVTOOLS_HTML_O_name; ((sOut += ' ') += pStr) += "=\""; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), rFrmFmt.GetName(), eDestEnc, &aNonConvertableCharacters ); @@ -584,7 +584,7 @@ void SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt, // ALT if( (nFrmOpts & HTML_FRMOPT_ALT) && rAlternateTxt.Len() ) { - ((sOut += ' ') += sHTML_O_alt) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_alt) += "=\""; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), rAlternateTxt, eDestEnc, &aNonConvertableCharacters ); sOut = '\"'; @@ -605,8 +605,8 @@ void SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt, text::RelOrientation::PRINT_AREA == rHoriOri.GetRelationOrient() ) { pStr = text::HoriOrientation::RIGHT == rHoriOri.GetHoriOrient() - ? sHTML_AL_right - : sHTML_AL_left; + ? OOO_STRING_SVTOOLS_HTML_AL_right + : OOO_STRING_SVTOOLS_HTML_AL_left; } } if( (nFrmOpts & HTML_FRMOPT_ALIGN) && !pStr && @@ -616,20 +616,20 @@ void SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt, { switch( ((SwFmtVertOrient*)pItem)->GetVertOrient() ) { - case text::VertOrientation::LINE_TOP: pStr = sHTML_VA_top; break; + case text::VertOrientation::LINE_TOP: pStr = OOO_STRING_SVTOOLS_HTML_VA_top; break; case text::VertOrientation::CHAR_TOP: - case text::VertOrientation::BOTTOM: pStr = sHTML_VA_texttop; break; // geht nicht + case text::VertOrientation::BOTTOM: pStr = OOO_STRING_SVTOOLS_HTML_VA_texttop; break; // geht nicht case text::VertOrientation::LINE_CENTER: - case text::VertOrientation::CHAR_CENTER: pStr = sHTML_VA_absmiddle; break; // geht nicht - case text::VertOrientation::CENTER: pStr = sHTML_VA_middle; break; + case text::VertOrientation::CHAR_CENTER: pStr = OOO_STRING_SVTOOLS_HTML_VA_absmiddle; break; // geht nicht + case text::VertOrientation::CENTER: pStr = OOO_STRING_SVTOOLS_HTML_VA_middle; break; case text::VertOrientation::LINE_BOTTOM: - case text::VertOrientation::CHAR_BOTTOM: pStr = sHTML_VA_absbottom; break; // geht nicht - case text::VertOrientation::TOP: pStr = sHTML_VA_bottom; break; + case text::VertOrientation::CHAR_BOTTOM: pStr = OOO_STRING_SVTOOLS_HTML_VA_absbottom; break; // geht nicht + case text::VertOrientation::TOP: pStr = OOO_STRING_SVTOOLS_HTML_VA_bottom; break; case text::VertOrientation::NONE: break; } } if( pStr ) - (((sOut += ' ') += sHTML_O_align) += '=') += pStr; + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_align) += '=') += pStr; // HSPACE und VSPACE @@ -665,13 +665,13 @@ void SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt, if( aPixelSpc.Width() ) { - (((sOut += ' ') += sHTML_O_hspace) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_hspace) += '=') += ByteString::CreateFromInt32( aPixelSpc.Width() ); } if( aPixelSpc.Height() ) { - (((sOut += ' ') += sHTML_O_vspace) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_vspace) += '=') += ByteString::CreateFromInt32( aPixelSpc.Height() ); } } @@ -740,7 +740,7 @@ void SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt, if( (nFrmOpts & HTML_FRMOPT_WIDTH) && ((nPrcWidth && nPrcWidth!=255) || aPixelSz.Width()) ) { - ((sOut += ' ') += sHTML_O_width) += '='; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_width) += '='; if( nPrcWidth ) (sOut += ByteString::CreateFromInt32( nPrcWidth )) += '%'; else @@ -750,7 +750,7 @@ void SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt, if( (nFrmOpts & HTML_FRMOPT_HEIGHT) && ((nPrcHeight && nPrcHeight!=255) || aPixelSz.Height()) ) { - ((sOut += ' ') += sHTML_O_height) += '='; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_height) += '='; if( nPrcHeight ) (sOut += ByteString::CreateFromInt32( nPrcHeight )) += '%'; else @@ -781,7 +781,7 @@ void SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt, { case SURROUND_NONE: case SURROUND_RIGHT: - pStr = sHTML_AL_right; + pStr = OOO_STRING_SVTOOLS_HTML_AL_right; break; case SURROUND_LEFT: case SURROUND_PARALLEL: @@ -802,7 +802,7 @@ void SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt, { case SURROUND_NONE: case SURROUND_LEFT: - pStr = sHTML_AL_left; + pStr = OOO_STRING_SVTOOLS_HTML_AL_left; break; case SURROUND_RIGHT: case SURROUND_PARALLEL: @@ -819,8 +819,8 @@ void SwHTMLWriter::OutFrmFmtOptions( const SwFrmFmt &rFrmFmt, if( pStr ) { - (((((((sOut = '<') += sHTML_linebreak) += ' ') - += sHTML_O_clear) += '=') += pStr) += '>') += rEndTags; + (((((((sOut = '<') += OOO_STRING_SVTOOLS_HTML_linebreak) += ' ') + += OOO_STRING_SVTOOLS_HTML_O_clear) += '=') += pStr) += '>') += rEndTags; rEndTags = sOut; } } @@ -876,7 +876,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt, if( aIMapName.Len() ) aNameBase = aIMapName; else - aNameBase.AssignAscii( sHTML_map ); + aNameBase.AssignAscii( OOO_STRING_SVTOOLS_HTML_map ); if( !aIMapName.Len() ) (aIMapName = aNameBase) += String::CreateFromInt32( rHTMLWrt.nImgMapCnt ); @@ -1023,12 +1023,12 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt, if( aMapURL.Len() || aName.Len() || aTarget.Len() || bEvents ) { - (sOut = '<') += sHTML_anchor; + (sOut = '<') += OOO_STRING_SVTOOLS_HTML_anchor; // Ein HREF nur Ausgaben, wenn es einen Link oder Makros gibt if( aMapURL.Len() || bEvents ) { - ((sOut += ' ') += sHTML_O_href) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_href) += "=\""; rWrt.Strm() << sOut.GetBuffer(); rHTMLWrt.OutHyperlinkHRefValue( aMapURL ); sOut = '\"'; @@ -1036,7 +1036,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt, if( aName.Len() ) { - ((sOut += ' ') += sHTML_O_name) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), aName, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); @@ -1045,7 +1045,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt, if( aTarget.Len() ) { - ((sOut += ' ') += sHTML_O_target) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_target) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), aTarget, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); @@ -1069,7 +1069,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt, } rWrt.Strm() << ">"; - (((sOut = "</") += sHTML_anchor) += ">") += aEndTags; + (((sOut = "</") += OOO_STRING_SVTOOLS_HTML_anchor) += ">") += aEndTags; aEndTags = sOut; } } @@ -1135,18 +1135,18 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt, if( pColBorderLine ) { sOut = '<'; - (((sOut += sHTML_font) += ' ') += sHTML_O_color) += '='; + (((sOut += OOO_STRING_SVTOOLS_HTML_font) += ' ') += OOO_STRING_SVTOOLS_HTML_O_color) += '='; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_Color( rWrt.Strm(), pColBorderLine->GetColor(), rHTMLWrt.eDestEnc ) << '>'; - (((sOut = "</" ) += sHTML_font) += '>') += aEndTags; + (((sOut = "</" ) += OOO_STRING_SVTOOLS_HTML_font) += '>') += aEndTags; aEndTags = sOut; } } sOut = '<'; - (((sOut += sHTML_image) += ' ') += sHTML_O_src) += "=\""; + (((sOut += OOO_STRING_SVTOOLS_HTML_image) += ' ') += OOO_STRING_SVTOOLS_HTML_O_src) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), aGrfNm, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ) << '\"'; @@ -1170,19 +1170,19 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt, if( nFrmOpts & HTML_FRMOPT_BORDER ) { - (((sOut = ' ') += sHTML_O_border) += '=') + (((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_border) += '=') += ByteString::CreateFromInt32( nBorderWidth ); rWrt.Strm() << sOut.GetBuffer(); } if( pURLItem && pURLItem->IsServerMap() ) { - (sOut = ' ') += sHTML_O_ismap; + (sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_ismap; rWrt.Strm() << sOut.GetBuffer(); } if( aIMapName.Len() ) { - ((sOut = ' ') += sHTML_O_usemap) += "=\"#"; + ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_usemap) += "=\"#"; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), aIMapName, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ) << '\"'; } @@ -1270,7 +1270,7 @@ Writer& OutHTML_BulletImage( Writer& rWrt, String s( *pLink ); if( !HTMLOutFuncs::PrivateURLToInternalImg(s) ) s = URIHelper::simpleNormalizedMakeRelative( rWrt.GetBaseURL(), s); - (sOut += sHTML_O_src) += "=\""; + (sOut += OOO_STRING_SVTOOLS_HTML_O_src) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), s, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); sOut = '\"'; @@ -1289,11 +1289,11 @@ Writer& OutHTML_BulletImage( Writer& rWrt, } if( aPixelSz.Width() ) - (((sOut += ' ') += sHTML_O_width) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_width) += '=') += ByteString::CreateFromInt32( aPixelSz.Width() ); if( aPixelSz.Height() ) - (((sOut += ' ') += sHTML_O_height) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_height) += '=') += ByteString::CreateFromInt32( aPixelSz.Height() ); if( pVertOrient ) @@ -1301,19 +1301,19 @@ Writer& OutHTML_BulletImage( Writer& rWrt, const sal_Char *pStr = 0; switch( pVertOrient->GetVertOrient() ) { - case text::VertOrientation::LINE_TOP: pStr = sHTML_VA_top; break; + case text::VertOrientation::LINE_TOP: pStr = OOO_STRING_SVTOOLS_HTML_VA_top; break; case text::VertOrientation::CHAR_TOP: - case text::VertOrientation::BOTTOM: pStr = sHTML_VA_texttop; break; // geht nicht + case text::VertOrientation::BOTTOM: pStr = OOO_STRING_SVTOOLS_HTML_VA_texttop; break; // geht nicht case text::VertOrientation::LINE_CENTER: - case text::VertOrientation::CHAR_CENTER: pStr = sHTML_VA_absmiddle; break; // geht nicht - case text::VertOrientation::CENTER: pStr = sHTML_VA_middle; break; + case text::VertOrientation::CHAR_CENTER: pStr = OOO_STRING_SVTOOLS_HTML_VA_absmiddle; break; // geht nicht + case text::VertOrientation::CENTER: pStr = OOO_STRING_SVTOOLS_HTML_VA_middle; break; case text::VertOrientation::LINE_BOTTOM: - case text::VertOrientation::CHAR_BOTTOM: pStr = sHTML_VA_absbottom; break; // geht nicht - case text::VertOrientation::TOP: pStr = sHTML_VA_bottom; break; + case text::VertOrientation::CHAR_BOTTOM: pStr = OOO_STRING_SVTOOLS_HTML_VA_absbottom; break; // geht nicht + case text::VertOrientation::TOP: pStr = OOO_STRING_SVTOOLS_HTML_VA_bottom; break; case text::VertOrientation::NONE: break; } if( pStr ) - (((sOut += ' ') += sHTML_O_align) += '=') += pStr; + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_align) += '=') += pStr; } } @@ -1390,14 +1390,14 @@ static Writer & OutHTML_FrmFmtAsMulticol( Writer& rWrt, rHTMLWrt.OutNewLine(); ByteString sOut( '<' ); - sOut += sHTML_multicol; + sOut += OOO_STRING_SVTOOLS_HTML_multicol; const SwFmtCol& rFmtCol = rFrmFmt.GetCol(); // die Anzahl der Spalten als COLS ausgeben USHORT nCols = rFmtCol.GetNumCols(); if( nCols ) - (((sOut += ' ') += sHTML_O_cols) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_cols) += '=') += ByteString::CreateFromInt32( nCols ); // die Gutter-Breite (Minimalwert) als GUTTER @@ -1410,7 +1410,7 @@ static Writer & OutHTML_FrmFmtAsMulticol( Writer& rWrt, ->LogicToPixel( Size(nGutter,0), MapMode(MAP_TWIP) ).Width(); } - (((sOut += ' ') += sHTML_O_gutter) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_gutter) += '=') += ByteString::CreateFromInt32( nGutter ); } @@ -1451,7 +1451,7 @@ static Writer & OutHTML_FrmFmtAsMulticol( Writer& rWrt, rHTMLWrt.DecIndentLevel(); // den Inhalt von Multicol einruecken; if( rHTMLWrt.bLFPossible ) rHTMLWrt.OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_multicol, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_multicol, FALSE ); rHTMLWrt.bLFPossible = TRUE; return rWrt; @@ -1466,8 +1466,8 @@ static Writer& OutHTML_FrmFmtAsSpacer( Writer& rWrt, const SwFrmFmt& rFrmFmt ) rHTMLWrt.OutNewLine( TRUE ); ByteString sOut('<'); - ((((sOut += sHTML_spacer) += ' ') += sHTML_O_type) += '=') - += sHTML_SPTYPE_block; + ((((sOut += OOO_STRING_SVTOOLS_HTML_spacer) += ' ') += OOO_STRING_SVTOOLS_HTML_O_type) += '=') + += OOO_STRING_SVTOOLS_HTML_SPTYPE_block; rWrt.Strm() << sOut.GetBuffer(); // ALIGN, WIDTH, HEIGHT @@ -1494,10 +1494,10 @@ static Writer& OutHTML_FrmFmtAsDivOrSpan( Writer& rWrt, // Die aktulle <DL> beenden! rHTMLWrt.OutAndSetDefList( 0 ); - pStr = sHTML_division; + pStr = OOO_STRING_SVTOOLS_HTML_division; } else - pStr = sHTML_span; + pStr = OOO_STRING_SVTOOLS_HTML_span; // als DIV ausgeben if( rHTMLWrt.bLFPossible ) @@ -1686,8 +1686,8 @@ Writer& OutHTML_HeaderFooter( Writer& rWrt, const SwFrmFmt& rFrmFmt, // als Multicol ausgeben rHTMLWrt.OutNewLine(); - ByteString sOut( sHTML_division ); - ((sOut += ' ') += sHTML_O_type) += '='; + ByteString sOut( OOO_STRING_SVTOOLS_HTML_division ); + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_type) += '='; sOut += (bHeader ? "HEADER" : "FOOTER" ); HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sOut.GetBuffer() ); @@ -1708,9 +1708,9 @@ Writer& OutHTML_HeaderFooter( Writer& rWrt, const SwFrmFmt& rFrmFmt, nSize = (INT16)Application::GetDefaultDevice() ->LogicToPixel( Size(nSize,0), MapMode(MAP_TWIP) ).Width(); - ((((((((aSpacer = sHTML_spacer) += ' ') - += sHTML_O_type) += '=') += sHTML_SPTYPE_vertical) += ' ') - += sHTML_O_size) += '=') += ByteString::CreateFromInt32(nSize); + ((((((((aSpacer = OOO_STRING_SVTOOLS_HTML_spacer) += ' ') + += OOO_STRING_SVTOOLS_HTML_O_type) += '=') += OOO_STRING_SVTOOLS_HTML_SPTYPE_vertical) += ' ') + += OOO_STRING_SVTOOLS_HTML_O_size) += '=') += ByteString::CreateFromInt32(nSize); } const SwFmtCntnt& rFlyCntnt = rFrmFmt.GetCntnt(); @@ -1747,7 +1747,7 @@ Writer& OutHTML_HeaderFooter( Writer& rWrt, const SwFrmFmt& rFrmFmt, rHTMLWrt.DecIndentLevel(); // den Inhalt von Multicol einruecken; rHTMLWrt.OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_division, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_division, FALSE ); rHTMLWrt.nHeaderFooterSpace = 0; diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 06eb9675f038..21589c4283c7 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -101,16 +101,16 @@ const sal_uInt16 TABINDEX_MAX = 32767; static HTMLOptionEnum __FAR_DATA aHTMLFormMethodTable[] = { - { sHTML_METHOD_get, FormSubmitMethod_GET }, - { sHTML_METHOD_post, FormSubmitMethod_POST }, + { OOO_STRING_SVTOOLS_HTML_METHOD_get, FormSubmitMethod_GET }, + { OOO_STRING_SVTOOLS_HTML_METHOD_post, FormSubmitMethod_POST }, { 0, 0 } }; static HTMLOptionEnum __FAR_DATA aHTMLFormEncTypeTable[] = { - { sHTML_ET_url, FormSubmitEncoding_URL }, - { sHTML_ET_multipart, FormSubmitEncoding_MULTIPART }, - { sHTML_ET_text, FormSubmitEncoding_TEXT }, + { OOO_STRING_SVTOOLS_HTML_ET_url, FormSubmitEncoding_URL }, + { OOO_STRING_SVTOOLS_HTML_ET_multipart, FormSubmitEncoding_MULTIPART }, + { OOO_STRING_SVTOOLS_HTML_ET_text, FormSubmitEncoding_TEXT }, { 0, 0 } }; @@ -118,11 +118,11 @@ enum HTMLWordWrapMode { HTML_WM_OFF, HTML_WM_HARD, HTML_WM_SOFT }; static HTMLOptionEnum __FAR_DATA aHTMLTextAreaWrapTable[] = { - { sHTML_WW_off, HTML_WM_OFF }, - { sHTML_WW_hard, HTML_WM_HARD }, - { sHTML_WW_soft, HTML_WM_SOFT }, - { sHTML_WW_physical,HTML_WM_HARD }, - { sHTML_WW_virtual, HTML_WM_SOFT }, + { OOO_STRING_SVTOOLS_HTML_WW_off, HTML_WM_OFF }, + { OOO_STRING_SVTOOLS_HTML_WW_hard, HTML_WM_HARD }, + { OOO_STRING_SVTOOLS_HTML_WW_soft, HTML_WM_SOFT }, + { OOO_STRING_SVTOOLS_HTML_WW_physical,HTML_WM_HARD }, + { OOO_STRING_SVTOOLS_HTML_WW_virtual, HTML_WM_SOFT }, { 0, 0 } }; @@ -165,25 +165,25 @@ const sal_Char * __FAR_DATA aEventMethodTable[] = const sal_Char * __FAR_DATA aEventSDOptionTable[] = { - sHTML_O_SDonsubmit, - sHTML_O_SDonreset, - sHTML_O_SDonfocus, - sHTML_O_SDonblur, - sHTML_O_SDonclick, - sHTML_O_SDonclick, - sHTML_O_SDonchange, + OOO_STRING_SVTOOLS_HTML_O_SDonsubmit, + OOO_STRING_SVTOOLS_HTML_O_SDonreset, + OOO_STRING_SVTOOLS_HTML_O_SDonfocus, + OOO_STRING_SVTOOLS_HTML_O_SDonblur, + OOO_STRING_SVTOOLS_HTML_O_SDonclick, + OOO_STRING_SVTOOLS_HTML_O_SDonclick, + OOO_STRING_SVTOOLS_HTML_O_SDonchange, 0 }; const sal_Char * __FAR_DATA aEventOptionTable[] = { - sHTML_O_onsubmit, - sHTML_O_onreset, - sHTML_O_onfocus, - sHTML_O_onblur, - sHTML_O_onclick, - sHTML_O_onclick, - sHTML_O_onchange, + OOO_STRING_SVTOOLS_HTML_O_onsubmit, + OOO_STRING_SVTOOLS_HTML_O_onreset, + OOO_STRING_SVTOOLS_HTML_O_onfocus, + OOO_STRING_SVTOOLS_HTML_O_onblur, + OOO_STRING_SVTOOLS_HTML_O_onclick, + OOO_STRING_SVTOOLS_HTML_O_onclick, + OOO_STRING_SVTOOLS_HTML_O_onchange, 0 }; @@ -916,19 +916,19 @@ static void lcl_html_getEvents( const String& rOption, const String& rValue, SvStringsDtor& rUnoMacroTbl, SvStringsDtor& rUnoMacroParamTbl ) { - if( rOption.CompareIgnoreCaseToAscii( sHTML_O_sdevent, - sizeof(sHTML_O_sdevent)-1 ) == COMPARE_EQUAL ) + if( rOption.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_O_sdevent, + sizeof(OOO_STRING_SVTOOLS_HTML_O_sdevent)-1 ) == COMPARE_EQUAL ) { - String *pEvent = new String( rOption.Copy(sizeof(sHTML_O_sdevent)-1) ); + String *pEvent = new String( rOption.Copy(sizeof(OOO_STRING_SVTOOLS_HTML_O_sdevent)-1) ); *pEvent += '-'; *pEvent += rValue; rUnoMacroTbl.Insert( pEvent, rUnoMacroTbl.Count() ); } - else if( rOption.CompareIgnoreCaseToAscii( sHTML_O_sdaddparam, - sizeof(sHTML_O_sdaddparam)-1 ) == COMPARE_EQUAL ) + else if( rOption.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_O_sdaddparam, + sizeof(OOO_STRING_SVTOOLS_HTML_O_sdaddparam)-1 ) == COMPARE_EQUAL ) { String *pParam = - new String( rOption.Copy( sizeof(sHTML_O_sdaddparam)-1 ) ); + new String( rOption.Copy( sizeof(OOO_STRING_SVTOOLS_HTML_O_sdaddparam)-1 ) ); *pParam += '-'; *pParam += rValue; rUnoMacroParamTbl.Insert( pParam, rUnoMacroParamTbl.Count() ); @@ -1753,7 +1753,7 @@ void SwHTMLParser::InsertInput() case HTML_IT_RADIO: { if( !bValue ) - aTmp <<= OUString::createFromAscii( sHTML_on ); + aTmp <<= OUString::createFromAscii( OOO_STRING_SVTOOLS_HTML_on ); xPropSet->setPropertyValue( OUString::createFromAscii( "RefValue" ), aTmp ); aTmp <<= OUString(); @@ -1817,12 +1817,12 @@ void SwHTMLParser::InsertInput() case HTML_IT_SUBMIT: eButtonType = FormButtonType_SUBMIT; if( !sText.Len() ) - sText.AssignAscii( sHTML_IT_submit ); + sText.AssignAscii( OOO_STRING_SVTOOLS_HTML_IT_submit ); break; case HTML_IT_RESET: eButtonType = FormButtonType_RESET; if( !sText.Len() ) - sText.AssignAscii( sHTML_IT_reset ); + sText.AssignAscii( OOO_STRING_SVTOOLS_HTML_IT_reset ); break; default: ; diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index a8055a0709ab..147e736a4353 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -217,7 +217,7 @@ void lcl_html_outEvents( SvStream& rStrm, !pDescs[i].AddListenerParam.getLength()) ) sOut += pOpt; else - (((sOut += sHTML_O_sdevent) + (((sOut += OOO_STRING_SVTOOLS_HTML_O_sdevent) += ByteString( sListener, RTL_TEXTENCODING_ASCII_US)) += '-') += ByteString( sMethod, RTL_TEXTENCODING_ASCII_US); sOut += "=\""; @@ -227,7 +227,7 @@ void lcl_html_outEvents( SvStream& rStrm, if( EXTENDED_STYPE == eScriptType && pDescs[i].AddListenerParam.getLength() ) { - (((((sOut = ' ') += sHTML_O_sdaddparam) + (((((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_sdaddparam) += ByteString( sListener, RTL_TEXTENCODING_ASCII_US)) += '-') += ByteString( sMethod, RTL_TEXTENCODING_ASCII_US)) += "=\""; @@ -499,7 +499,7 @@ void SwHTMLWriter::OutForm( sal_Bool bOn, DecIndentLevel(); // Inhalt der Form einruecken if( bLFPossible ) OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_form, sal_False ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_form, sal_False ); bLFPossible = sal_True; return; @@ -509,7 +509,7 @@ void SwHTMLWriter::OutForm( sal_Bool bOn, if( bLFPossible ) OutNewLine(); ByteString sOut( '<' ); - sOut += sHTML_form; + sOut += OOO_STRING_SVTOOLS_HTML_form; uno::Reference< beans::XPropertySet > xFormPropSet( rFormComps, uno::UNO_QUERY ); @@ -518,7 +518,7 @@ void SwHTMLWriter::OutForm( sal_Bool bOn, if( aTmp.getValueType() == ::getCppuType((const OUString*)0) && ((OUString*)aTmp.getValue())->getLength() ) { - ((sOut += ' ') += sHTML_O_name) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\""; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), *(OUString*)aTmp.getValue(), eDestEnc, &aNonConvertableCharacters ); @@ -530,7 +530,7 @@ void SwHTMLWriter::OutForm( sal_Bool bOn, if( aTmp.getValueType() == ::getCppuType((const OUString*)0) && ((OUString*)aTmp.getValue())->getLength() ) { - ((sOut += ' ') += sHTML_O_action) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_action) += "=\""; Strm() << sOut.GetBuffer(); String aURL( *(OUString*)aTmp.getValue() ); aURL = URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), aURL); @@ -547,8 +547,8 @@ void SwHTMLWriter::OutForm( sal_Bool bOn, if( form::FormSubmitMethod_POST==eMethod ) { ((((sOut += ' ') - += sHTML_O_method) += "=\"") - += sHTML_METHOD_post) += '\"'; + += OOO_STRING_SVTOOLS_HTML_O_method) += "=\"") + += OOO_STRING_SVTOOLS_HTML_METHOD_post) += '\"'; } } aTmp = xFormPropSet->getPropertyValue( @@ -561,10 +561,10 @@ void SwHTMLWriter::OutForm( sal_Bool bOn, switch( eEncType ) { case form::FormSubmitEncoding_MULTIPART: - pStr = sHTML_ET_multipart; + pStr = OOO_STRING_SVTOOLS_HTML_ET_multipart; break; case form::FormSubmitEncoding_TEXT: - pStr = sHTML_ET_text; + pStr = OOO_STRING_SVTOOLS_HTML_ET_text; break; default: ; @@ -573,7 +573,7 @@ void SwHTMLWriter::OutForm( sal_Bool bOn, if( pStr ) { ((((sOut += ' ') - += sHTML_O_enctype) += "=\"") + += OOO_STRING_SVTOOLS_HTML_O_enctype) += "=\"") += pStr) += '\"'; } } @@ -583,7 +583,7 @@ void SwHTMLWriter::OutForm( sal_Bool bOn, if( aTmp.getValueType() == ::getCppuType((const OUString*)0)&& ((OUString*)aTmp.getValue())->getLength() ) { - ((sOut += ' ') += sHTML_O_target) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_target) += "=\""; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), *(OUString*)aTmp.getValue(), eDestEnc, &aNonConvertableCharacters ); @@ -649,15 +649,15 @@ void SwHTMLWriter::OutHiddenControls( if( bLFPossible ) OutNewLine( sal_True ); ByteString sOut( '<' ); - ((((sOut += sHTML_input) += ' ') += - sHTML_O_type) += '=') += sHTML_IT_hidden; + ((((sOut += OOO_STRING_SVTOOLS_HTML_input) += ' ') += + OOO_STRING_SVTOOLS_HTML_O_type) += '=') += OOO_STRING_SVTOOLS_HTML_IT_hidden; aTmp = xPropSet->getPropertyValue( OUString::createFromAscii( "Name" ) ); if( aTmp.getValueType() == ::getCppuType((const OUString*)0) && ((OUString*)aTmp.getValue())->getLength() ) { - (( sOut += ' ' ) += sHTML_O_name ) += "=\""; + (( sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_name ) += "=\""; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), *(OUString*)aTmp.getValue(), eDestEnc, &aNonConvertableCharacters ); @@ -668,7 +668,7 @@ void SwHTMLWriter::OutHiddenControls( if( aTmp.getValueType() == ::getCppuType((const OUString*)0) && ((OUString*)aTmp.getValue())->getLength() ) { - ((sOut += ' ') += sHTML_O_value) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_value) += "=\""; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), *(OUString*)aTmp.getValue(), eDestEnc, &aNonConvertableCharacters ); @@ -773,7 +773,21 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, //!!! rHTMLWrt.nWarn = 1; // Control wird falscher Form zugeordnet rHTMLWrt.nFormCntrlCnt++; - const sal_Char *pTag = sHTML_input, *pType = 0; + enum Tag { TAG_INPUT, TAG_SELECT, TAG_TEXTAREA, TAG_NONE }; + static char const * const TagNames[] = { + OOO_STRING_SVTOOLS_HTML_input, OOO_STRING_SVTOOLS_HTML_select, + OOO_STRING_SVTOOLS_HTML_textarea }; + Tag eTag = TAG_INPUT; + enum Type { + TYPE_TEXT, TYPE_PASSWORD, TYPE_CHECKBOX, TYPE_RADIO, TYPE_FILE, + TYPE_SUBMIT, TYPE_IMAGE, TYPE_RESET, TYPE_BUTTON, TYPE_NONE }; + static char const * const TypeNames[] = { + OOO_STRING_SVTOOLS_HTML_IT_text, OOO_STRING_SVTOOLS_HTML_IT_password, + OOO_STRING_SVTOOLS_HTML_IT_checkbox, OOO_STRING_SVTOOLS_HTML_IT_radio, + OOO_STRING_SVTOOLS_HTML_IT_file, OOO_STRING_SVTOOLS_HTML_IT_submit, + OOO_STRING_SVTOOLS_HTML_IT_image, OOO_STRING_SVTOOLS_HTML_IT_reset, + OOO_STRING_SVTOOLS_HTML_IT_button }; + Type eType = TYPE_NONE; OUString sValue; ByteString sOptions; sal_Bool bEmptyValue = sal_False; @@ -785,15 +799,14 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, { case form::FormComponentType::CHECKBOX: case form::FormComponentType::RADIOBUTTON: - pType = (form::FormComponentType::CHECKBOX == nClassId - ? sHTML_IT_checkbox - : sHTML_IT_radio); + eType = (form::FormComponentType::CHECKBOX == nClassId + ? TYPE_CHECKBOX : TYPE_RADIO); aTmp = xPropSet->getPropertyValue( OUString::createFromAscii( "DefaultState" ) ); if( aTmp.getValueType() == ::getCppuType((const sal_Int16*)0) && STATE_NOCHECK != *(sal_Int16*) aTmp.getValue() ) { - (sOptions += ' ') += sHTML_O_checked; + (sOptions += ' ') += OOO_STRING_SVTOOLS_HTML_O_checked; } aTmp = xPropSet->getPropertyValue( @@ -804,7 +817,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, const OUString& rVal = *(OUString*)aTmp.getValue(); if( !rVal.getLength() ) bEmptyValue = sal_True; - else if( rVal.compareToAscii( sHTML_on ) != 0 ) + else if( rVal.compareToAscii( OOO_STRING_SVTOOLS_HTML_on ) != 0 ) sValue = rVal; } break; @@ -821,14 +834,14 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, switch( eButtonType ) { case form::FormButtonType_RESET: - pType = sHTML_IT_reset; + eType = TYPE_RESET; break; case form::FormButtonType_SUBMIT: - pType = sHTML_IT_submit; + eType = TYPE_SUBMIT; break; case form::FormButtonType_PUSH: default: - pType = sHTML_IT_button; + eType = TYPE_BUTTON; } aTmp = xPropSet->getPropertyValue( @@ -844,7 +857,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, case form::FormComponentType::LISTBOX: if( rHTMLWrt.bLFPossible ) rHTMLWrt.OutNewLine( sal_True ); - pTag = sHTML_select; + eTag = TAG_SELECT; aTmp = xPropSet->getPropertyValue( OUString::createFromAscii( "Dropdown" ) ); if( aTmp.getValueType() == ::getBooleanCppuType() && @@ -855,7 +868,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, // wieviele sind sichtbar ?? if( aSz.Height() ) - (((sOptions += ' ' ) += sHTML_O_size ) += '=' ) + (((sOptions += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_size ) += '=' ) += ByteString::CreateFromInt32( aSz.Height() ); aTmp = xPropSet->getPropertyValue( @@ -863,7 +876,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, if( aTmp.getValueType() == ::getBooleanCppuType() && *(sal_Bool*)aTmp.getValue() ) { - (sOptions += ' ' ) += sHTML_O_multiple; + (sOptions += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_multiple; } } break; @@ -886,13 +899,13 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, { if( rHTMLWrt.bLFPossible ) rHTMLWrt.OutNewLine( sal_True ); - pTag = sHTML_textarea; + eTag = TAG_TEXTAREA; if( aSz.Height() ) - (((sOptions += ' ' ) += sHTML_O_rows ) += '=' ) + (((sOptions += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_rows ) += '=' ) += ByteString::CreateFromInt32( aSz.Height() ); if( aSz.Width() ) - (((sOptions += ' ' ) += sHTML_O_cols ) += '=' ) + (((sOptions += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_cols ) += '=' ) += ByteString::CreateFromInt32( aSz.Width() ); aTmp = xPropSet->getPropertyValue( @@ -906,25 +919,25 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, OUString::createFromAscii( "HardLineBreaks" ) ); pWrapStr = (aTmp.getValueType() == ::getBooleanCppuType() && - *(sal_Bool*)aTmp.getValue()) ? sHTML_WW_hard - : sHTML_WW_soft; - (((sOptions += ' ') += sHTML_O_wrap) += '=') += pWrapStr; + *(sal_Bool*)aTmp.getValue()) ? OOO_STRING_SVTOOLS_HTML_WW_hard + : OOO_STRING_SVTOOLS_HTML_WW_soft; + (((sOptions += ' ') += OOO_STRING_SVTOOLS_HTML_O_wrap) += '=') += pWrapStr; } } else { - pType = sHTML_IT_text; + eType = TYPE_TEXT; OUString sEchoChar( OUString::createFromAscii( "EchoChar" ) ); if( xPropSetInfo->hasPropertyByName( sEchoChar ) ) { aTmp = xPropSet->getPropertyValue( sEchoChar ); if( aTmp.getValueType() == ::getCppuType((const sal_Int16*)0) && *(sal_Int16*)aTmp.getValue() != 0 ) - pType = sHTML_IT_password; + eType = TYPE_PASSWORD; } if( aSz.Width() ) - (((sOptions += ' ' ) += sHTML_O_size ) += '=' ) + (((sOptions += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_size ) += '=' ) += ByteString::CreateFromInt32( aSz.Width() ); aTmp = xPropSet->getPropertyValue( @@ -932,7 +945,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, if( aTmp.getValueType() == ::getCppuType((const sal_Int16*)0) && *(sal_Int16*) aTmp.getValue() != 0 ) { - (((sOptions += ' ' ) += sHTML_O_maxlength ) += '=' ) + (((sOptions += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_maxlength ) += '=' ) += ByteString::CreateFromInt32( *(sal_Int16*) aTmp.getValue() ); } @@ -955,10 +968,10 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, { Size aSz( 0, 0 ); GetControlSize( rSdrObject, aSz, rWrt.pDoc ); - pType = sHTML_IT_file; + eType = TYPE_FILE; if( aSz.Width() ) - (((sOptions += ' ' ) += sHTML_O_size ) += '=' ) + (((sOptions += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_size ) += '=' ) += ByteString::CreateFromInt32( aSz.Width() ); // VALUE vim form aus Sicherheitsgruenden nicht exportieren @@ -967,28 +980,29 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, case form::FormComponentType::IMAGEBUTTON: - pType = sHTML_IT_image; + eType = TYPE_IMAGE; nFrmOpts = HTML_FRMOPTS_IMG_CONTROL; break; default: // kennt HTML nicht - pTag = 0; // also ueberspringen + eTag = TAG_NONE; // also ueberspringen break; } - if( !pTag ) + if( eTag == TAG_NONE ) return rWrt; ByteString sOut( '<' ); - sOut += pTag; - if( pType ) - (((sOut += ' ') += sHTML_O_type) += '=') += pType; + sOut += TagNames[eTag]; + if( eType != TYPE_NONE ) + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_type) += '=') += + TypeNames[eType]; aTmp = xPropSet->getPropertyValue( OUString::createFromAscii( "Name" ) ); if( aTmp.getValueType() == ::getCppuType((const OUString*)0) && ((OUString*)aTmp.getValue())->getLength() ) { - (( sOut += ' ' ) += sHTML_O_name ) += "=\""; + (( sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_name ) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), *(OUString*)aTmp.getValue(), rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); @@ -999,12 +1013,12 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, if( aTmp.getValueType() == ::getBooleanCppuType() && !*(sal_Bool*)aTmp.getValue() ) { - (( sOut += ' ' ) += sHTML_O_disabled ); + (( sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_disabled ); } if( sValue.getLength() || bEmptyValue ) { - ((sOut += ' ') += sHTML_O_value) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_value) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), sValue, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); sOut = '\"'; @@ -1012,14 +1026,14 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, sOut += sOptions; - if( (const sal_Char *)sHTML_IT_image == (const sal_Char *)pType ) + if( TYPE_IMAGE == eType ) { aTmp = xPropSet->getPropertyValue( OUString::createFromAscii( "ImageURL" ) ); if( aTmp.getValueType() == ::getCppuType((const OUString*)0) && ((OUString*)aTmp.getValue())->getLength() ) { - ((sOut += ' ') += sHTML_O_src) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_src) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), @@ -1043,11 +1057,11 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, } if( aPixelSz.Width() ) - (((sOut += ' ') += sHTML_O_width) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_width) += '=') += ByteString::CreateFromInt32( aPixelSz.Width() ); if( aPixelSz.Height() ) - (((sOut += ' ') += sHTML_O_height) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_height) += '=') += ByteString::CreateFromInt32( aPixelSz.Height() ); } @@ -1061,7 +1075,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, if( nTabIndex >= 32767 ) nTabIndex = 32767; - (((sOut += ' ') += sHTML_O_tabindex) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_tabindex) += '=') += ByteString::CreateFromInt32( nTabIndex ); } } @@ -1077,7 +1091,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, { // Wenn Zeichen-Objekte nicht absolut positioniert werden duerfen, // das entsprechende Flag loeschen. - nFrmOpts |= ((const sal_Char *)sHTML_IT_image == (const sal_Char *)pType + nFrmOpts |= (TYPE_IMAGE == eType ? HTML_FRMOPTS_IMG_CONTROL_CSS1 : HTML_FRMOPTS_CONTROL_CSS1); } @@ -1087,8 +1101,8 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, if( rHTMLWrt.bCfgOutStyles ) { - sal_Bool bEdit = sHTML_textarea == pTag || (const sal_Char *)sHTML_IT_file == (const sal_Char *)pType || - (const sal_Char *)sHTML_IT_text == (const sal_Char *)pType; + sal_Bool bEdit = TAG_TEXTAREA == eTag || TYPE_FILE == eType || + TYPE_TEXT == eType; SfxItemSet aItemSet( rHTMLWrt.pDoc->GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END ); @@ -1210,7 +1224,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, rWrt.Strm() << '>'; - if( sHTML_select == pTag ) + if( TAG_SELECT == eTag ) { aTmp = xPropSet->getPropertyValue( OUString::createFromAscii( "StringItemList" ) ); @@ -1265,17 +1279,17 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, nSel++; rHTMLWrt.OutNewLine(); // jede Option bekommt eine eigene Zeile - (sOut = '<') += sHTML_option; + (sOut = '<') += OOO_STRING_SVTOOLS_HTML_option; if( sVal.getLength() || bEmptyVal ) { - ((sOut += ' ') += sHTML_O_value) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_value) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), sVal, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); sOut = '\"'; } if( bSelected ) - (sOut += ' ') += sHTML_O_selected; + (sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_selected; sOut += '>'; rWrt.Strm() << sOut.GetBuffer(); @@ -1283,14 +1297,14 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, HTMLOutFuncs::Out_String( rWrt.Strm(), pStrings[i], rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); } - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_option, sal_False ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_option, sal_False ); rHTMLWrt.DecIndentLevel(); rHTMLWrt.OutNewLine();// das </SELECT> bekommt eine eigene Zeile } - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_select, sal_False ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_select, sal_False ); } - else if( sHTML_textarea == pTag ) + else if( TAG_TEXTAREA == eTag ) { // In TextAreas duerfen keine zusaetzlichen Spaces oder LF exportiert // werden! @@ -1315,9 +1329,9 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); } } - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_textarea, sal_False ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_textarea, sal_False ); } - else if( (const sal_Char *)sHTML_IT_checkbox == (const sal_Char *)pType || (const sal_Char *)sHTML_IT_radio == (const sal_Char *)pType ) + else if( TYPE_CHECKBOX == eType || TYPE_RADIO == eType ) { aTmp = xPropSet->getPropertyValue( OUString::createFromAscii("Label") ); if( aTmp.getValueType() == ::getCppuType((const OUString*)0) && diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx index 290a05d38c62..9e35f8e78768 100644 --- a/sw/source/filter/html/htmlftn.cxx +++ b/sw/source/filter/html/htmlftn.cxx @@ -307,15 +307,15 @@ Writer& OutHTML_SwFmtFtn( Writer& rWrt, const SfxPoolItem& rHt ) nPos = rHTMLWrt.pFootEndNotes ? rHTMLWrt.pFootEndNotes->Count() : 0; ASSERT( nPos == rHTMLWrt.nFootNote + rHTMLWrt.nEndNote, "OutHTML_SwFmtFtn: Position falsch" ); - sClass.AssignAscii( sHTML_sdendnote_anc ); - sFtnName.AssignAscii( sHTML_sdendnote ); + sClass.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdendnote_anc ); + sFtnName.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdendnote ); sFtnName += String::CreateFromInt32( (sal_Int32)(++rHTMLWrt.nEndNote) ); } else { nPos = rHTMLWrt.nFootNote; - sClass.AssignAscii( sHTML_sdfootnote_anc ); - sFtnName.AssignAscii( sHTML_sdfootnote); + sClass.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdfootnote_anc ); + sFtnName.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdfootnote); sFtnName += String::CreateFromInt32( (sal_Int32)(++rHTMLWrt.nFootNote)); } @@ -324,26 +324,26 @@ Writer& OutHTML_SwFmtFtn( Writer& rWrt, const SfxPoolItem& rHt ) rHTMLWrt.pFootEndNotes->Insert( pTxtFtn, nPos ); ByteString sOut( '<' ); - (((sOut += sHTML_anchor) += ' ') += sHTML_O_class) += "=\""; + (((sOut += OOO_STRING_SVTOOLS_HTML_anchor) += ' ') += OOO_STRING_SVTOOLS_HTML_O_class) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), sClass, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); - ((sOut = "\" ") += sHTML_O_name) += "=\""; + ((sOut = "\" ") += OOO_STRING_SVTOOLS_HTML_O_name) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), sFtnName, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); - (((sOut = sHTML_FTN_anchor) += "\" ") += sHTML_O_href) += "=\"#"; + (((sOut = OOO_STRING_SVTOOLS_HTML_FTN_anchor) += "\" ") += OOO_STRING_SVTOOLS_HTML_O_href) += "=\"#"; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), sFtnName, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); - (sOut = sHTML_FTN_symbol)+= '\"'; + (sOut = OOO_STRING_SVTOOLS_HTML_FTN_symbol)+= '\"'; if( rFmtFtn.GetNumStr().Len() ) - (sOut += ' ') += sHTML_O_sdfixed; + (sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_sdfixed; sOut += '>'; rWrt.Strm() << sOut.GetBuffer(); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_superscript, TRUE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_superscript, TRUE ); HTMLOutFuncs::Out_String( rWrt.Strm(), rFmtFtn.GetViewNumStr(*rWrt.pDoc), rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_superscript, FALSE ); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_anchor, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_superscript, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_anchor, FALSE ); return rWrt; } @@ -368,21 +368,21 @@ void SwHTMLWriter::OutFootEndNotes() String sFtnName, sClass; if( pFmtFtn->IsEndNote() ) { - sClass.AssignAscii( sHTML_sdendnote ); - sFtnName.AssignAscii( sHTML_sdendnote ); + sClass.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdendnote ); + sFtnName.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdendnote ); sFtnName.Append( String::CreateFromInt32((sal_Int32)(++nEndNote)) ); } else { - sClass.AssignAscii( sHTML_sdfootnote ); - sFtnName.AssignAscii( sHTML_sdfootnote ); + sClass.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdfootnote ); + sFtnName.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdfootnote ); sFtnName.Append( String::CreateFromInt32((sal_Int32)(++nFootNote))); } if( bLFPossible ) OutNewLine(); ByteString sOut( '<' ); - (((sOut += sHTML_division) += ' ') += sHTML_O_id) += "=\""; + (((sOut += OOO_STRING_SVTOOLS_HTML_division) += ' ') += OOO_STRING_SVTOOLS_HTML_O_id) += "=\""; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), sFtnName, eDestEnc, &aNonConvertableCharacters ); Strm() << "\">"; @@ -404,7 +404,7 @@ void SwHTMLWriter::OutFootEndNotes() DecIndentLevel(); // Inhalt von <DIV> einruecken if( bLFPossible ) OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_division, FALSE ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_division, FALSE ); bLFPossible = TRUE; ASSERT( !pFmtFtn, @@ -458,15 +458,15 @@ void SwHTMLWriter::OutFootEndNoteSym( const SwFmtFtn& rFmtFtn, String sFtnName, sClass, sPrefix, sSuffix; if( rFmtFtn.IsEndNote() ) { - sClass.AssignAscii( sHTML_sdendnote_sym ); - sFtnName.AssignAscii( sHTML_sdendnote ); + sClass.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdendnote_sym ); + sFtnName.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdendnote ); sFtnName.Append( String::CreateFromInt32((sal_Int32)nEndNote) ); pInfo = &pDoc->GetEndNoteInfo(); } else { - sClass.AssignAscii( sHTML_sdfootnote_sym ); - sFtnName.AssignAscii( sHTML_sdfootnote ); + sClass.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdfootnote_sym ); + sFtnName.AssignAscii( OOO_STRING_SVTOOLS_HTML_sdfootnote ); sFtnName.Append( String::CreateFromInt32((sal_Int32)nFootNote)); pInfo = &pDoc->GetFtnInfo(); } @@ -489,20 +489,20 @@ void SwHTMLWriter::OutFootEndNoteSym( const SwFmtFtn& rFmtFtn, } ByteString sOut( '<' ); - (((sOut += sHTML_anchor) += ' ') += sHTML_O_class) += "=\""; + (((sOut += OOO_STRING_SVTOOLS_HTML_anchor) += ' ') += OOO_STRING_SVTOOLS_HTML_O_class) += "=\""; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), sClass, eDestEnc, &aNonConvertableCharacters ); - ((sOut = "\" ") += sHTML_O_name) += "=\""; + ((sOut = "\" ") += OOO_STRING_SVTOOLS_HTML_O_name) += "=\""; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), sFtnName, eDestEnc, &aNonConvertableCharacters ); - (((sOut = sHTML_FTN_symbol) +="\" ") += sHTML_O_href) += "=\"#"; + (((sOut = OOO_STRING_SVTOOLS_HTML_FTN_symbol) +="\" ") += OOO_STRING_SVTOOLS_HTML_O_href) += "=\"#"; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), sFtnName, eDestEnc, &aNonConvertableCharacters ); - (sOut = sHTML_FTN_anchor) += "\">"; + (sOut = OOO_STRING_SVTOOLS_HTML_FTN_anchor) += "\">"; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), rNum, eDestEnc, &aNonConvertableCharacters ); - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_anchor, FALSE ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_anchor, FALSE ); } USHORT lcl_html_fillEndNoteInfo( const SwEndNoteInfo& rInfo, @@ -565,9 +565,9 @@ void lcl_html_outFootEndNoteInfo( Writer& rWrt, String *pParts, rHTMLWrt.OutNewLine(); ByteString sOut( '<' ); - (((((((sOut += sHTML_meta) += ' ') - += sHTML_O_name) += "=\"") += pName) += "\" ") - += sHTML_O_content) += "=\""; + (((((((sOut += OOO_STRING_SVTOOLS_HTML_meta) += ' ') + += OOO_STRING_SVTOOLS_HTML_O_name) += "=\"") += pName) += "\" ") + += OOO_STRING_SVTOOLS_HTML_O_content) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), aContent, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); rWrt.Strm() << "\">"; @@ -610,7 +610,7 @@ void SwHTMLWriter::OutFootEndNoteInfo() } if( nParts > 0 ) lcl_html_outFootEndNoteInfo( *this, aParts, nParts, - sHTML_META_sdfootnote ); + OOO_STRING_SVTOOLS_HTML_META_sdfootnote ); } { @@ -619,7 +619,7 @@ void SwHTMLWriter::OutFootEndNoteInfo() USHORT nParts = lcl_html_fillEndNoteInfo( rInfo, aParts, TRUE ); if( nParts > 0 ) lcl_html_outFootEndNoteInfo( *this, aParts, nParts, - sHTML_META_sdendnote ); + OOO_STRING_SVTOOLS_HTML_META_sdendnote ); } } diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index a29fd32237b1..48faa240cf7f 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -75,34 +75,35 @@ #include <ndtxt.hxx> #include <shellio.hxx> #include <poolfmt.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <ndgrf.hxx> #include <htmlnum.hxx> #include <swcss1.hxx> #include <swhtml.hxx> #include <numrule.hxx> +#include <boost/shared_ptr.hpp> using namespace ::com::sun::star; HTMLOptionEnum __FAR_DATA aHTMLImgHAlignTable[] = { - { sHTML_AL_left, text::HoriOrientation::LEFT }, - { sHTML_AL_right, text::HoriOrientation::RIGHT }, + { OOO_STRING_SVTOOLS_HTML_AL_left, text::HoriOrientation::LEFT }, + { OOO_STRING_SVTOOLS_HTML_AL_right, text::HoriOrientation::RIGHT }, { 0, 0 } }; HTMLOptionEnum __FAR_DATA aHTMLImgVAlignTable[] = { - { sHTML_VA_top, text::VertOrientation::LINE_TOP }, - { sHTML_VA_texttop, text::VertOrientation::CHAR_TOP }, - { sHTML_VA_middle, text::VertOrientation::CENTER }, - { sHTML_AL_center, text::VertOrientation::CENTER }, - { sHTML_VA_absmiddle, text::VertOrientation::LINE_CENTER }, - { sHTML_VA_bottom, text::VertOrientation::TOP }, - { sHTML_VA_baseline, text::VertOrientation::TOP }, - { sHTML_VA_absbottom, text::VertOrientation::LINE_BOTTOM }, + { OOO_STRING_SVTOOLS_HTML_VA_top, text::VertOrientation::LINE_TOP }, + { OOO_STRING_SVTOOLS_HTML_VA_texttop, text::VertOrientation::CHAR_TOP }, + { OOO_STRING_SVTOOLS_HTML_VA_middle, text::VertOrientation::CENTER }, + { OOO_STRING_SVTOOLS_HTML_AL_center, text::VertOrientation::CENTER }, + { OOO_STRING_SVTOOLS_HTML_VA_absmiddle, text::VertOrientation::LINE_CENTER }, + { OOO_STRING_SVTOOLS_HTML_VA_bottom, text::VertOrientation::TOP }, + { OOO_STRING_SVTOOLS_HTML_VA_baseline, text::VertOrientation::TOP }, + { OOO_STRING_SVTOOLS_HTML_VA_absbottom, text::VertOrientation::LINE_BOTTOM }, { 0, 0 } }; @@ -1186,12 +1187,12 @@ ANCHOR_SETEVENT: ('s' == aStrippedClass.GetChar(0) || 'S' == aStrippedClass.GetChar(0)) && ('d' == aStrippedClass.GetChar(1) || 'D' == aStrippedClass.GetChar(1)) ) { - if( aStrippedClass.EqualsIgnoreCaseAscii( sHTML_sdendnote_anc ) ) + if( aStrippedClass.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_sdendnote_anc ) ) bEnAnchor = TRUE; - else if( aStrippedClass.EqualsIgnoreCaseAscii( sHTML_sdfootnote_anc ) ) + else if( aStrippedClass.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_sdfootnote_anc ) ) bFtnAnchor = TRUE; - else if( aStrippedClass.EqualsIgnoreCaseAscii( sHTML_sdendnote_sym ) || - aStrippedClass.EqualsIgnoreCaseAscii( sHTML_sdfootnote_sym ) ) + else if( aStrippedClass.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_sdendnote_sym ) || + aStrippedClass.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_sdfootnote_sym ) ) bFtnEnSymbol = TRUE; if( bEnAnchor || bFtnAnchor || bFtnEnSymbol ) { @@ -1285,9 +1286,9 @@ BOOL SwHTMLParser::HasCurrentParaBookmarks( BOOL bIgnoreStack ) const BOOL bHasMarks = FALSE; ULONG nNodeIdx = pPam->GetPoint()->nNode.GetIndex(); - // 1. Schritt: befinden sich noch Bookmarks m Attribut-Stack? - // Bookmarks werden hinten in den Stack geschrieben. Wir muessen - // also nur die letzte Bookmark betrachten + // first step: are there still bookmark in the attribute-stack? + // bookmarks are added to the end of the stack - thus we only have + // to check the last bookmark if( !bIgnoreStack ) { _HTMLAttr* pAttr; @@ -1305,13 +1306,15 @@ BOOL SwHTMLParser::HasCurrentParaBookmarks( BOOL bIgnoreStack ) const if( !bHasMarks ) { - // 2. Schritt: Wenn wir keine Bookmark gefunden haben, schauen wir, - // ob schon eine gesetzt ist - const SwBookmarks& rBookmarks = pDoc->getBookmarks(); - for( USHORT i=0; i<rBookmarks.Count(); i++ ) + // second step: when we didnt find a bookmark, check if there is one + // set already + IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin(); + ppMark != pMarkAccess->getMarksEnd(); + ppMark++) { - const SwBookmark* pBookmark = rBookmarks[i]; - ULONG nBookNdIdx = pBookmark->GetBookmarkPos().nNode.GetIndex(); + const ::sw::mark::IMark* pBookmark = ppMark->get(); + ULONG nBookNdIdx = pBookmark->GetMarkPos().nNode.GetIndex(); if( nBookNdIdx==nNodeIdx ) { bHasMarks = TRUE; @@ -1377,33 +1380,30 @@ void SwHTMLParser::StripTrailingPara() // jetz muessen wir noch eventuell vorhandene Bookmarks // verschieben - const SwBookmarks& rBookmarks = pDoc->getBookmarks(); - for( i=0; i<rBookmarks.Count(); i++ ) + IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin(); + ppMark != pMarkAccess->getMarksEnd(); + ppMark++) { - SwBookmark* pBookmark = rBookmarks[i]; - ULONG nBookNdIdx = pBookmark->GetBookmarkPos().nNode.GetIndex(); - if( nBookNdIdx==nNodeIdx ) + ::sw::mark::IMark* pMark = ppMark->get(); + ULONG nBookNdIdx = pMark->GetMarkPos().nNode.GetIndex(); + if(nBookNdIdx==nNodeIdx) { - // --> OD 2007-09-27 #i81002# - refactoring - // Do not directly manipulate member of <SwBookmark> -// SwPosition &rBookmkPos = -// (SwPosition&)pBookmark->GetBookmarkPos(); - // <-- - - SwNodeIndex nNewNdIdx( pPam->GetPoint()->nNode ); - SwCntntNode* pNd = pDoc->GetNodes().GoPrevious( &nNewNdIdx ); - if( !pNd ) + SwNodeIndex nNewNdIdx(pPam->GetPoint()->nNode); + SwCntntNode* pNd = pDoc->GetNodes().GoPrevious(&nNewNdIdx); + if(!pNd) { - ASSERT( !this, "Hoppla, wo ist mein Vorgaenger-Node" ); + ASSERT(!this, "Hoppla, wo ist mein Vorgaenger-Node"); return; } - // --> OD 2007-09-27 #i81002# - refactoring // Do not directly manipulate member of <SwBookmark> - SwPosition aNewPos ( pBookmark->GetBookmarkPos() ); - aNewPos.nNode = nNewNdIdx; - aNewPos.nContent.Assign( pNd, pNd->Len() ); - pBookmark->SetBookmarkPos( &aNewPos ); + { + SwPosition aNewPos(*pNd); + aNewPos.nContent.Assign(pNd, pNd->Len()); + const SwPaM aPaM(aNewPos); + pMarkAccess->repositionMark(ppMark->get(), aPaM); + } // <-- } else if( nBookNdIdx > nNodeIdx ) diff --git a/sw/source/filter/html/htmlnum.cxx b/sw/source/filter/html/htmlnum.cxx index c917444c2ded..24045bdef1e2 100644 --- a/sw/source/filter/html/htmlnum.cxx +++ b/sw/source/filter/html/htmlnum.cxx @@ -67,9 +67,9 @@ using namespace ::com::sun::star; // <UL TYPE=...> static HTMLOptionEnum __FAR_DATA aHTMLULTypeTable[] = { - { sHTML_ULTYPE_disc, HTML_BULLETCHAR_DISC }, - { sHTML_ULTYPE_circle, HTML_BULLETCHAR_CIRCLE }, - { sHTML_ULTYPE_square, HTML_BULLETCHAR_SQUARE }, + { OOO_STRING_SVTOOLS_HTML_ULTYPE_disc, HTML_BULLETCHAR_DISC }, + { OOO_STRING_SVTOOLS_HTML_ULTYPE_circle, HTML_BULLETCHAR_CIRCLE }, + { OOO_STRING_SVTOOLS_HTML_ULTYPE_square, HTML_BULLETCHAR_SQUARE }, { 0, 0 } }; @@ -864,30 +864,30 @@ Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt, if( SVX_NUM_CHAR_SPECIAL == eType ) { // Aufzaehlungs-Liste: <OL> - sOut += sHTML_unorderlist; + sOut += OOO_STRING_SVTOOLS_HTML_unorderlist; // den Typ ueber das Bullet-Zeichen bestimmen const sal_Char *pStr = 0; switch( rNumFmt.GetBulletChar() ) { case HTML_BULLETCHAR_DISC: - pStr = sHTML_ULTYPE_disc; + pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_disc; break; case HTML_BULLETCHAR_CIRCLE: - pStr = sHTML_ULTYPE_circle; + pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_circle; break; case HTML_BULLETCHAR_SQUARE: - pStr = sHTML_ULTYPE_square; + pStr = OOO_STRING_SVTOOLS_HTML_ULTYPE_square; break; } if( pStr ) - (((sOut += ' ') += sHTML_O_type) += '=') += pStr; + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_type) += '=') += pStr; } else if( SVX_NUM_BITMAP == eType ) { // Aufzaehlungs-Liste: <OL> - sOut += sHTML_unorderlist; + sOut += OOO_STRING_SVTOOLS_HTML_unorderlist; rWrt.Strm() << sOut.GetBuffer(); sOut.Erase(); @@ -901,7 +901,7 @@ Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt, else { // Numerierungs-Liste: <UL> - sOut += sHTML_orderlist; + sOut += OOO_STRING_SVTOOLS_HTML_orderlist; // den Typ ueber das Format bestimmen sal_Char cType = 0; @@ -913,7 +913,7 @@ Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt, case SVX_NUM_ROMAN_LOWER: cType = 'i'; break; } if( cType ) - (((sOut += ' ') += sHTML_O_type) += '=') += cType; + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_type) += '=') += cType; sal_uInt16 nStartVal = rNumFmt.GetStart(); if( bStartValue && 1 == nStartVal && i == rInfo.GetDepth()-1 ) @@ -932,7 +932,7 @@ Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt, } if( nStartVal != 1 ) { - (((sOut += ' ') += sHTML_O_start) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_start) += '=') += ByteString::CreateFromInt32( nStartVal ); } } @@ -979,9 +979,9 @@ Writer& OutHTML_NumBulListEnd( SwHTMLWriter& rWrt, sal_Int16 eType = rInfo.GetNumRule()->Get( i-1 ).GetNumberingType(); const sal_Char *pStr; if( SVX_NUM_CHAR_SPECIAL == eType || SVX_NUM_BITMAP == eType) - pStr = sHTML_unorderlist; + pStr = OOO_STRING_SVTOOLS_HTML_unorderlist; else - pStr = sHTML_orderlist; + pStr = OOO_STRING_SVTOOLS_HTML_orderlist; HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), pStr, sal_False ); rWrt.bLFPossible = sal_True; } diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index ffadfb58e8fe..9dbcc420ebfd 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -49,6 +49,7 @@ #include <svx/xoutbmp.hxx> #include <svx/ulspitem.hxx> #include <svx/lrspitem.hxx> +#include <svtools/htmlkywd.hxx> #include <svtools/htmltokn.h> #include <SwAppletImpl.hxx> #include <fmtornt.hxx> @@ -82,6 +83,12 @@ using namespace com::sun::star; #define HTML_DFLT_APPLET_WIDTH ((MM50*5)/2) #define HTML_DFLT_APPLET_HEIGHT ((MM50*5)/2) +namespace { + +static char const sHTML_O_Hidden_False[] = "FALSE"; + +} + const ULONG HTML_FRMOPTS_EMBED_ALL = HTML_FRMOPT_ALT | HTML_FRMOPT_SIZE | @@ -377,7 +384,7 @@ void SwHTMLParser::InsertEmbed() aSpace.Height() = (long)pOption->GetNumber(); break; case HTML_O_UNKNOWN: - if( pOption->GetTokenString().EqualsIgnoreCaseAscii( sHTML_O_Hidden ) ) + if( pOption->GetTokenString().EqualsIgnoreCaseAscii( OOO_STRING_SW_HTML_O_Hidden ) ) bHidden = !pOption->GetString().EqualsIgnoreCaseAscii( sHTML_O_Hidden_False ); break; @@ -992,8 +999,8 @@ static USHORT GetOptionType( const String& rName, BOOL bApplet ) { case 'A': case 'a': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_align ) || - rName.EqualsIgnoreCaseAscii( sHTML_O_alt ) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_align ) || + rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_alt ) ) nType = SWHTML_OPTTYPE_IGNORE; else if( bApplet && (rName.EqualsIgnoreCaseAscii( sHTML_O_archive ) || @@ -1002,31 +1009,31 @@ static USHORT GetOptionType( const String& rName, BOOL bApplet ) break; case 'C': case 'c': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_class ) || - (bApplet && (rName.EqualsIgnoreCaseAscii( sHTML_O_code ) || - rName.EqualsIgnoreCaseAscii( sHTML_O_codebase ))) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_class ) || + (bApplet && (rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_code ) || + rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_codebase ))) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'H': case 'h': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_height ) || - rName.EqualsIgnoreCaseAscii( sHTML_O_hspace ) || - (!bApplet && rName.EqualsIgnoreCaseAscii( sHTML_O_Hidden )) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_height ) || + rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_hspace ) || + (!bApplet && rName.EqualsIgnoreCaseAscii( OOO_STRING_SW_HTML_O_Hidden )) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'I': case 'i': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_id ) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_id ) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'M': case 'm': - if( bApplet && rName.EqualsIgnoreCaseAscii( sHTML_O_mayscript ) ) + if( bApplet && rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_mayscript ) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'N': case 'n': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_name ) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_name ) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'O': @@ -1036,23 +1043,23 @@ static USHORT GetOptionType( const String& rName, BOOL bApplet ) break; case 'S': case 's': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_style ) || - (!bApplet && rName.EqualsIgnoreCaseAscii( sHTML_O_src )) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_style ) || + (!bApplet && rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_src )) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'T': case 't': - if( !bApplet && rName.EqualsIgnoreCaseAscii( sHTML_O_type ) ) + if( !bApplet && rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_type ) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'V': case 'v': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_vspace ) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_vspace ) ) nType = SWHTML_OPTTYPE_IGNORE; break; case 'W': case 'w': - if( rName.EqualsIgnoreCaseAscii( sHTML_O_width ) ) + if( rName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_O_width ) ) nType = SWHTML_OPTTYPE_IGNORE; break; } @@ -1131,7 +1138,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, if( aGlobName == SvGlobalName( SO3_PLUGIN_CLASSID ) ) { // erstmal das Plug-spezifische - sOut += sHTML_embed; + sOut += OOO_STRING_SVTOOLS_HTML_embed; ::rtl::OUString aStr; String aURL; @@ -1144,7 +1151,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, if( aURL.Len() ) { - ((sOut += ' ') += sHTML_O_src) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_src) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), aURL, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); sOut = '\"'; @@ -1154,7 +1161,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("PluginMimeType" ) ); if( (aAny >>= aType) && aType.getLength() ) { - ((sOut += ' ') += sHTML_O_type) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_type) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), aType, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); sOut = '\"'; @@ -1164,7 +1171,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, SURROUND_THROUGHT == rFrmFmt.GetSurround().GetSurround() ) { // Das Plugin ist HIDDEN - (sOut += ' ') += sHTML_O_Hidden; + (sOut += ' ') += OOO_STRING_SW_HTML_O_Hidden; nFrmOpts = HTML_FRMOPTS_HIDDEN_EMBED; bHiddenEmbed = TRUE; } @@ -1178,7 +1185,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, { // oder das Applet-Spezifische - sOut += sHTML_applet; + sOut += OOO_STRING_SVTOOLS_HTML_applet; // CODEBASE ::rtl::OUString aCd; @@ -1188,7 +1195,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, String sCodeBase( URIHelper::simpleNormalizedMakeRelative(rWrt.GetBaseURL(), aCd) ); if( sCodeBase.Len() ) { - ((sOut += ' ') += sHTML_O_codebase) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_codebase) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), sCodeBase, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); sOut = '\"'; @@ -1199,7 +1206,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, ::rtl::OUString aClass; aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletCode" ) ); aAny >>= aClass; - ((sOut += ' ') += sHTML_O_code) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_code) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), aClass, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); sOut = '\"'; @@ -1210,7 +1217,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, aAny >>= aAppletName; if( aAppletName.getLength() ) { - ((sOut += ' ') += sHTML_O_name) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), aAppletName, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); sOut = '\"'; @@ -1220,7 +1227,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("AppletIsScript" ) ); aAny >>= bScript; if( bScript ) - (sOut += ' ') += sHTML_O_mayscript; + (sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_mayscript; nFrmOpts = bInCntnr ? HTML_FRMOPTS_APPLET_CNTNR : HTML_FRMOPTS_APPLET; @@ -1229,7 +1236,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, { // oder das Flating-Frame spezifische - sOut += sHTML_iframe; + sOut += OOO_STRING_SVTOOLS_HTML_iframe; rWrt.Strm() << sOut.GetBuffer(); SfxFrameHTMLWriter::Out_FrameDescriptor( rWrt.Strm(), rWrt.GetBaseURL(), @@ -1295,11 +1302,11 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, const String& rName = rCommand.GetCommand(); const String& rValue = rCommand.GetArgument(); rHTMLWrt.OutNewLine(); - ((((sOut = '<') += sHTML_param) += ' ') += sHTML_O_name) + ((((sOut = '<') += OOO_STRING_SVTOOLS_HTML_param) += ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), rName, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); - ((sOut = "\" ") += sHTML_O_value) += "=\""; + ((sOut = "\" ") += OOO_STRING_SVTOOLS_HTML_O_value) += "=\""; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rWrt.Strm(), rValue, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ) << "\">"; } @@ -1307,7 +1314,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, rHTMLWrt.DecIndentLevel(); // Inhalt von Applet einruecken if( aCommands.Count() ) rHTMLWrt.OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_applet, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_applet, FALSE ); } else if( aGlobName == SvGlobalName( SO3_PLUGIN_CLASSID ) ) @@ -1342,7 +1349,7 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt, // ausgeben rHTMLWrt.Strm() << '>'; - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_iframe, FALSE ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_iframe, FALSE ); } if( aEndTags.Len() ) diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index 7e78ca96d78f..f1eb32d730a6 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -240,9 +240,9 @@ void SwHTMLParser::NewDivision( int nToken ) ('d' == aId.GetChar(1) || 'D' == aId.GetChar(1) ) ) { sal_Bool bEndNote = sal_False, bFootNote = sal_False; - if( aId.CompareIgnoreCaseToAscii( sHTML_sdendnote, 9 ) == COMPARE_EQUAL ) + if( aId.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_sdendnote, 9 ) == COMPARE_EQUAL ) bEndNote = sal_True; - else if( aId.CompareIgnoreCaseToAscii( sHTML_sdfootnote, 10 ) == COMPARE_EQUAL ) + else if( aId.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_sdfootnote, 10 ) == COMPARE_EQUAL ) bFootNote = sal_True; if( bFootNote || bEndNote ) { diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 7ff16864141a..cc83cbcd8605 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -88,9 +88,9 @@ using namespace ::com::sun::star; static HTMLOptionEnum __FAR_DATA aHTMLTblVAlignTable[] = { - { sHTML_VA_top, text::VertOrientation::NONE }, - { sHTML_VA_middle, text::VertOrientation::CENTER }, - { sHTML_VA_bottom, text::VertOrientation::BOTTOM }, + { OOO_STRING_SVTOOLS_HTML_VA_top, text::VertOrientation::NONE }, + { OOO_STRING_SVTOOLS_HTML_VA_middle, text::VertOrientation::CENTER }, + { OOO_STRING_SVTOOLS_HTML_VA_bottom, text::VertOrientation::BOTTOM }, { 0, 0 } }; @@ -4949,7 +4949,7 @@ void SwHTMLParser::BuildTableCaption( HTMLTable *pCurTable ) const HTMLOption *pOption = (*pHTMLOptions)[--i]; if( HTML_O_ALIGN == pOption->GetToken() ) { - if( pOption->GetString().EqualsIgnoreCaseAscii(sHTML_VA_bottom)) + if( pOption->GetString().EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_VA_bottom)) bTop = sal_False; } } @@ -5218,7 +5218,7 @@ HTMLTableOptions::HTMLTableOptions( const HTMLOptions *pOptions, case HTML_O_BORDER: // BORDER und BORDER=BORDER wie BORDER=1 behandeln if( pOption->GetString().Len() && - !pOption->GetString().EqualsIgnoreCaseAscii(sHTML_O_border) ) + !pOption->GetString().EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_O_border) ) nBorder = (sal_uInt16)pOption->GetNumber(); else nBorder = 1; diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index 375954942032..1150b044db5b 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -328,14 +328,14 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, rWrt.OutNewLine(); // <TH>/<TD> in neue Zeile ByteString sOut( '<' ); - sOut += (bHead ? sHTML_tableheader : sHTML_tabledata ); + sOut += (bHead ? OOO_STRING_SVTOOLS_HTML_tableheader : OOO_STRING_SVTOOLS_HTML_tabledata ); // ROW- und COLSPAN ausgeben if( nRowSpan>1 ) - (((sOut += ' ' ) += sHTML_O_rowspan ) += '=') + (((sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_rowspan ) += '=') += ByteString::CreateFromInt32( nRowSpan ); if( nColSpan > 1 ) - (((sOut += ' ' ) += sHTML_O_colspan ) += '=') + (((sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_colspan ) += '=') += ByteString::CreateFromInt32( nColSpan ); #ifndef PURE_HTML @@ -385,7 +385,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, // WIDTH ausgeben: Aus Layout oder berechnet if( bOutWidth ) { - ((sOut += ' ' ) += sHTML_O_width ) += '='; + ((sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_width ) += '='; if( nPrcWidth != USHRT_MAX ) (sOut += ByteString::CreateFromInt32(nPrcWidth)) += '%'; else @@ -396,7 +396,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, if( nHeight ) { - (((sOut += ' ') += sHTML_O_height) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_height) += '=') += ByteString::CreateFromInt32(aPixelSz.Height()); } #endif @@ -412,8 +412,8 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, sal_Int16 eVertOri = pCell->GetVertOri(); if( text::VertOrientation::TOP==eVertOri || text::VertOrientation::BOTTOM==eVertOri ) { - (((sOut += ' ') += sHTML_O_valign) += '=') - += (text::VertOrientation::TOP==eVertOri ? sHTML_VA_top : sHTML_VA_bottom); + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_valign) += '=') + += (text::VertOrientation::TOP==eVertOri ? OOO_STRING_SVTOOLS_HTML_VA_top : OOO_STRING_SVTOOLS_HTML_VA_bottom); } } @@ -499,8 +499,8 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, if( rWrt.bLFPossible ) rWrt.OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), bHead ? sHTML_tableheader - : sHTML_tabledata, + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), bHead ? OOO_STRING_SVTOOLS_HTML_tableheader + : OOO_STRING_SVTOOLS_HTML_tabledata, sal_False ); rWrt.bLFPossible = sal_True; } @@ -533,7 +533,7 @@ void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt, } rWrt.OutNewLine(); // <TR> in neuer Zeile - rWrt.Strm() << '<' << sHTML_tablerow; + rWrt.Strm() << '<' << OOO_STRING_SVTOOLS_HTML_tablerow; if( pBrushItem ) { String aDummy; @@ -548,8 +548,8 @@ void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt, if( text::VertOrientation::TOP==eRowVertOri || text::VertOrientation::BOTTOM==eRowVertOri ) { ByteString sOut( ' ' ); - ((sOut += sHTML_O_valign) += '=') - += (text::VertOrientation::TOP==eRowVertOri ? sHTML_VA_top : sHTML_VA_bottom); + ((sOut += OOO_STRING_SVTOOLS_HTML_O_valign) += '=') + += (text::VertOrientation::TOP==eRowVertOri ? OOO_STRING_SVTOOLS_HTML_VA_top : OOO_STRING_SVTOOLS_HTML_VA_bottom); rWrt.Strm() << sOut.GetBuffer(); } @@ -563,7 +563,7 @@ void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt, rWrt.DecIndentLevel(); // Inhalt von <TR>...</TR> einruecken rWrt.OutNewLine(); // </TR> in neuer Zeile - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_tablerow, sal_False ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_tablerow, sal_False ); } @@ -632,7 +632,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, if( rWrt.bLFPossible ) rWrt.OutNewLine(); // <TABLE> in neue Zeile ByteString sOut( '<' ); - sOut += sHTML_table; + sOut += OOO_STRING_SVTOOLS_HTML_table; sal_uInt16 nOldDirection = rWrt.nDirection; if( pFrmFmt ) @@ -647,21 +647,21 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, // COLS ausgeben: Nur bei Export ueber Layout, wenn es beim Import // vorhanden war. if( bColsOption ) - (((sOut += ' ') += sHTML_O_cols) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_cols) += '=') += ByteString::CreateFromInt32( aCols.Count() ); // ALIGN= ausgeben if( text::HoriOrientation::RIGHT == eAlign ) - (((sOut += ' ') += sHTML_O_align ) += '=') += sHTML_AL_right; + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_align ) += '=') += OOO_STRING_SVTOOLS_HTML_AL_right; else if( text::HoriOrientation::CENTER == eAlign ) - (((sOut += ' ') += sHTML_O_align ) += '=') += sHTML_AL_center; + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_align ) += '=') += OOO_STRING_SVTOOLS_HTML_AL_center; else if( text::HoriOrientation::LEFT == eAlign ) - (((sOut += ' ') += sHTML_O_align ) += '=') += sHTML_AL_left; + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_align ) += '=') += OOO_STRING_SVTOOLS_HTML_AL_left; // WIDTH ausgeben: Stammt aus Layout oder ist berechnet if( nTabWidth ) { - ((sOut += ' ') += sHTML_O_width ) += '='; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_width ) += '='; if( HasRelWidths() ) (sOut += ByteString::CreateFromInt32( nTabWidth )) += '%'; else if( Application::GetDefaultDevice() ) @@ -692,13 +692,13 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, if( aPixelSpc.Width() ) { - (((sOut += ' ') += sHTML_O_hspace) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_hspace) += '=') += ByteString::CreateFromInt32( aPixelSpc.Width() ); } if( aPixelSpc.Height() ) { - (((sOut += ' ') += sHTML_O_vspace) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_vspace) += '=') += ByteString::CreateFromInt32( aPixelSpc.Height() ); } } @@ -709,25 +709,25 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, // die genutzt wird, wenn gar kein sheet::Border angegeben ist. sal_Bool bHasAnyBorders = nFrameMask || bColsHaveBorder || bRowsHaveBorder; if( bCollectBorderWidth || nBorder==0 || bHasAnyBorders ) - (((sOut += ' ' ) += sHTML_O_border ) += '=') + (((sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_border ) += '=') += ByteString::CreateFromInt32( rWrt.ToPixel( nBorder ) ); // BORDERCOLOR ausgeben if( (sal_uInt32)-1 != nBorderColor && rWrt.bCfgOutStyles && bHasAnyBorders ) { - ((sOut += ' ' ) += sHTML_O_bordercolor ) += '='; + ((sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_bordercolor ) += '='; rWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_Color( rWrt.Strm(), nBorderColor, rWrt.eDestEnc ); sOut.Erase(); } // CELLPADDING ausgeben: Stammt aus Layout oder ist berechnet - (((sOut += ' ' ) += sHTML_O_cellpadding ) += '=') + (((sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_cellpadding ) += '=') += ByteString::CreateFromInt32( rWrt.ToPixel( nCellPadding ) ); // CELLSPACING ausgeben: Stammt aus Layout oder ist berechnet - (((sOut += ' ' ) += sHTML_O_cellspacing ) += '=') + (((sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_cellspacing ) += '=') += ByteString::CreateFromInt32( rWrt.ToPixel( nCellSpacing ) ); // FRAME/RULES ausgeben (nur sinnvoll, wenn border!=0) @@ -736,19 +736,19 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, const sal_Char *pFrame = 0; switch( nFrameMask ) { - case 0: pFrame = sHTML_TF_void ;break; - case 1: pFrame = sHTML_TF_above ;break; - case 2: pFrame = sHTML_TF_below ;break; - case 3: pFrame = sHTML_TF_hsides ;break; - case 4: pFrame = sHTML_TF_lhs ;break; - case 8: pFrame = sHTML_TF_rhs ;break; - case 12: pFrame = sHTML_TF_vsides ;break; + case 0: pFrame = OOO_STRING_SVTOOLS_HTML_TF_void ;break; + case 1: pFrame = OOO_STRING_SVTOOLS_HTML_TF_above ;break; + case 2: pFrame = OOO_STRING_SVTOOLS_HTML_TF_below ;break; + case 3: pFrame = OOO_STRING_SVTOOLS_HTML_TF_hsides ;break; + case 4: pFrame = OOO_STRING_SVTOOLS_HTML_TF_lhs ;break; + case 8: pFrame = OOO_STRING_SVTOOLS_HTML_TF_rhs ;break; + case 12: pFrame = OOO_STRING_SVTOOLS_HTML_TF_vsides ;break; //FRAME=BOX ist der default wenn BORDER>0 //case 15: - //default: pFrame = sHTML_TF_box ;break; // geht nicht + //default: pFrame = OOO_STRING_SVTOOLS_HTML_TF_box ;break; // geht nicht }; if( pFrame ) - (((sOut += ' ' ) += sHTML_O_frame ) += '=') += pFrame; + (((sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_frame ) += '=') += pFrame; const sal_Char *pRules = 0; if( aCols.Count() > 1 && aRows.Count() > 1 ) @@ -756,44 +756,44 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, if( !bColsHaveBorder ) { if( !bRowsHaveBorder ) - pRules = sHTML_TR_none; + pRules = OOO_STRING_SVTOOLS_HTML_TR_none; else if( bRowsHaveBorderOnly ) - pRules = sHTML_TR_rows; + pRules = OOO_STRING_SVTOOLS_HTML_TR_rows; else - pRules = sHTML_TR_groups; + pRules = OOO_STRING_SVTOOLS_HTML_TR_groups; } else if( bColsHaveBorderOnly ) { if( !bRowsHaveBorder || !bRowsHaveBorderOnly ) - pRules = sHTML_TR_cols; + pRules = OOO_STRING_SVTOOLS_HTML_TR_cols; } else { if( !bRowsHaveBorder ) - pRules = sHTML_TR_groups; + pRules = OOO_STRING_SVTOOLS_HTML_TR_groups; else if( bRowsHaveBorderOnly ) - pRules = sHTML_TR_rows; + pRules = OOO_STRING_SVTOOLS_HTML_TR_rows; else - pRules = sHTML_TR_groups; + pRules = OOO_STRING_SVTOOLS_HTML_TR_groups; } } else if( aRows.Count() > 1 ) { if( !bRowsHaveBorder ) - pRules = sHTML_TR_none; + pRules = OOO_STRING_SVTOOLS_HTML_TR_none; else if( !bRowsHaveBorderOnly ) - pRules = sHTML_TR_groups; + pRules = OOO_STRING_SVTOOLS_HTML_TR_groups; } else if( aCols.Count() > 1 ) { if( !bColsHaveBorder ) - pRules = sHTML_TR_none; + pRules = OOO_STRING_SVTOOLS_HTML_TR_none; else if( !bColsHaveBorderOnly ) - pRules = sHTML_TR_groups; + pRules = OOO_STRING_SVTOOLS_HTML_TR_groups; } if( pRules ) - (((sOut += ' ' ) += sHTML_O_rules ) += '=') += pRules; + (((sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_rules ) += '=') += pRules; } rWrt.Strm() << sOut.GetBuffer(); @@ -816,12 +816,12 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, if( pCaption && pCaption->Len() ) { rWrt.OutNewLine(); // <CAPTION> in neue Zeile - ByteString sOutStr( sHTML_caption ); - (((sOutStr += ' ') += sHTML_O_align) += '=') - += (bTopCaption ? sHTML_VA_top : sHTML_VA_bottom); + ByteString sOutStr( OOO_STRING_SVTOOLS_HTML_caption ); + (((sOutStr += ' ') += OOO_STRING_SVTOOLS_HTML_O_align) += '=') + += (bTopCaption ? OOO_STRING_SVTOOLS_HTML_VA_top : OOO_STRING_SVTOOLS_HTML_VA_bottom); HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sOutStr.GetBuffer(), sal_True ); HTMLOutFuncs::Out_String( rWrt.Strm(), *pCaption, rWrt.eDestEnc, &rWrt.aNonConvertableCharacters ); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_caption, sal_False ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_caption, sal_False ); } sal_uInt16 nCols = aCols.Count(); @@ -834,7 +834,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, if( bColGroups ) { rWrt.OutNewLine(); // <COLGRP> in neue Zeile - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_colgroup, sal_True ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_colgroup, sal_True ); rWrt.IncIndentLevel(); // Inhalt von <COLGRP> einruecken } @@ -846,7 +846,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, const SwWriteTableCol *pColumn = aCols[nCol]; ByteString sOutStr( '<' ); - sOutStr += sHTML_col; + sOutStr += OOO_STRING_SVTOOLS_HTML_col; sal_uInt16 nWidth; sal_Bool bRel; @@ -861,7 +861,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, nWidth = bRel ? GetRelWidth(nCol,1) : GetAbsWidth(nCol,1); } - ((sOutStr += ' ' ) += sHTML_O_width ) += '='; + ((sOutStr += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_width ) += '='; if( bRel ) { (sOutStr += ByteString::CreateFromInt32( nWidth ) ) += '*'; @@ -877,10 +877,10 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, { rWrt.DecIndentLevel(); // Inhalt von <COLGRP> einruecken rWrt.OutNewLine(); // </COLGRP> in neue Zeile - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_colgroup, + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_colgroup, sal_False ); rWrt.OutNewLine(); // <COLGRP> in neue Zeile - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_colgroup, + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_colgroup, sal_True ); rWrt.IncIndentLevel(); // Inhalt von <COLGRP> einruecken } @@ -890,7 +890,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, rWrt.DecIndentLevel(); // Inhalt von <COLGRP> einruecken rWrt.OutNewLine(); // </COLGRP> in neue Zeile - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_colgroup, + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_colgroup, sal_False ); } } @@ -915,7 +915,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, { rWrt.OutNewLine(); // <THEAD>/<TDATA> in neue Zeile HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), - bTHead ? sHTML_thead : sHTML_tbody, sal_True ); + bTHead ? OOO_STRING_SVTOOLS_HTML_thead : OOO_STRING_SVTOOLS_HTML_tbody, sal_True ); rWrt.IncIndentLevel(); // Inhalt von <THEAD>/<TDATA> einr. } @@ -932,9 +932,9 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, for( ; nCnt; nCnt-- ) { rWrt.OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_tablerow, + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_tablerow, sal_True ); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_tablerow, + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_tablerow, sal_False ); } } @@ -945,14 +945,14 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, rWrt.DecIndentLevel(); // Inhalt von <THEAD>/<TDATA> einr. rWrt.OutNewLine(); // </THEAD>/</TDATA> in neue Zeile HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), - bTHead ? sHTML_thead : sHTML_tbody, sal_False ); + bTHead ? OOO_STRING_SVTOOLS_HTML_thead : OOO_STRING_SVTOOLS_HTML_tbody, sal_False ); rWrt.OutNewLine(); // <THEAD>/<TDATA> in neue Zeile if( bTHead && nRow==nHeadEndRow ) bTHead = sal_False; HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), - bTHead ? sHTML_thead : sHTML_tbody, sal_True ); + bTHead ? OOO_STRING_SVTOOLS_HTML_thead : OOO_STRING_SVTOOLS_HTML_tbody, sal_True ); rWrt.IncIndentLevel(); // Inhalt von <THEAD>/<TDATA> einr. } } @@ -963,13 +963,13 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, rWrt.OutNewLine(); // </THEAD>/</TDATA> in neue Zeile HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), - bTHead ? sHTML_thead : sHTML_tbody, sal_False ); + bTHead ? OOO_STRING_SVTOOLS_HTML_thead : OOO_STRING_SVTOOLS_HTML_tbody, sal_False ); } rWrt.DecIndentLevel(); // Inhalt von <TABLE> einr. rWrt.OutNewLine(); // </TABLE> in neue Zeile - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_table, sal_False ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_table, sal_False ); rWrt.nDirection = nOldDirection; } @@ -1124,7 +1124,7 @@ Writer& OutHTML_SwTblNode( Writer& rWrt, SwTableNode & rNode, { if( rHTMLWrt.bLFPossible ) rHTMLWrt.OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_dd ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_dd ); } // eFlyHoriOri und eTabHoriOri besitzen nun nur noch die Werte @@ -1182,11 +1182,11 @@ Writer& OutHTML_SwTblNode( Writer& rWrt, SwTableNode & rNode, if( rHTMLWrt.bLFPossible ) rHTMLWrt.OutNewLine(); // <CENTER> in neuer Zeile if( text::HoriOrientation::CENTER==eDivHoriOri ) - HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sHTML_center, sal_True ); + HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_center, sal_True ); else { - ByteString sOut( sHTML_division ); - (((sOut += ' ') += sHTML_O_align) += '=') += sHTML_AL_right; + ByteString sOut( OOO_STRING_SVTOOLS_HTML_division ); + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_align) += '=') += OOO_STRING_SVTOOLS_HTML_AL_right; HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), sOut.GetBuffer(), sal_True ); } @@ -1232,8 +1232,8 @@ Writer& OutHTML_SwTblNode( Writer& rWrt, SwTableNode & rNode, rHTMLWrt.DecIndentLevel(); // Inhalt von <CENTER> einruecken rHTMLWrt.OutNewLine(); // </CENTER> in neue Teile HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), - text::HoriOrientation::CENTER==eDivHoriOri ? sHTML_center - : sHTML_division, sal_False ); + text::HoriOrientation::CENTER==eDivHoriOri ? OOO_STRING_SVTOOLS_HTML_center + : OOO_STRING_SVTOOLS_HTML_division, sal_False ); rHTMLWrt.bLFPossible = sal_True; } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index e39cd88abd88..70dbcb2d8949 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -98,7 +98,7 @@ #include <expfld.hxx> #include <poolfmt.hxx> #include <pagedesc.hxx> -#include <bookmrk.hxx> // fuer SwBookmark ... +#include <IMark.hxx> // fuer SwBookmark ... #ifndef _DOCSH_HXX #include <docsh.hxx> #endif @@ -143,21 +143,21 @@ using namespace ::com::sun::star; // <P ALIGN=xxx>, <Hn ALIGN=xxx>, <TD ALIGN=xxx> usw. HTMLOptionEnum __FAR_DATA aHTMLPAlignTable[] = { - { sHTML_AL_left, SVX_ADJUST_LEFT }, - { sHTML_AL_center, SVX_ADJUST_CENTER }, - { sHTML_AL_middle, SVX_ADJUST_CENTER }, // Netscape - { sHTML_AL_right, SVX_ADJUST_RIGHT }, - { sHTML_AL_justify, SVX_ADJUST_BLOCK }, - { sHTML_AL_char, SVX_ADJUST_LEFT }, + { OOO_STRING_SVTOOLS_HTML_AL_left, SVX_ADJUST_LEFT }, + { OOO_STRING_SVTOOLS_HTML_AL_center, SVX_ADJUST_CENTER }, + { OOO_STRING_SVTOOLS_HTML_AL_middle, SVX_ADJUST_CENTER }, // Netscape + { OOO_STRING_SVTOOLS_HTML_AL_right, SVX_ADJUST_RIGHT }, + { OOO_STRING_SVTOOLS_HTML_AL_justify, SVX_ADJUST_BLOCK }, + { OOO_STRING_SVTOOLS_HTML_AL_char, SVX_ADJUST_LEFT }, { 0, 0 } }; // <SPACER TYPE=...> static HTMLOptionEnum __FAR_DATA aHTMLSpacerTypeTable[] = { - { sHTML_SPTYPE_block, HTML_SPTYPE_BLOCK }, - { sHTML_SPTYPE_horizontal, HTML_SPTYPE_HORI }, - { sHTML_SPTYPE_vertical, HTML_SPTYPE_VERT }, + { OOO_STRING_SVTOOLS_HTML_SPTYPE_block, HTML_SPTYPE_BLOCK }, + { OOO_STRING_SVTOOLS_HTML_SPTYPE_horizontal, HTML_SPTYPE_HORI }, + { OOO_STRING_SVTOOLS_HTML_SPTYPE_vertical, HTML_SPTYPE_VERT }, { 0, 0 } }; @@ -1090,14 +1090,14 @@ void __EXPORT SwHTMLParser::NextToken( int nToken ) { case HTML_NOEMBED_OFF: aContents.ConvertLineEnd(); - InsertComment( aContents, sHTML_noembed ); + InsertComment( aContents, OOO_STRING_SVTOOLS_HTML_noembed ); aContents.Erase(); bCallNextToken = FALSE; bInNoEmbed = FALSE; break; case HTML_RAWDATA: - InsertCommentText( sHTML_noembed ); + InsertCommentText( OOO_STRING_SVTOOLS_HTML_noembed ); break; default: @@ -1518,7 +1518,7 @@ void __EXPORT SwHTMLParser::NextToken( int nToken ) case HTML_NOEMBED_ON: bInNoEmbed = TRUE; bCallNextToken = pTable!=0; - ReadRawData( sHTML_noembed ); + ReadRawData( OOO_STRING_SVTOOLS_HTML_noembed ); break; case HTML_DEFLIST_ON: @@ -2760,26 +2760,22 @@ void SwHTMLParser::_SetAttr( BOOL bChkEnd, BOOL bBeforeTable, switch( nWhich ) { - case RES_FLTR_BOOKMARK: // dann also ein Bookmark einfuegen + case RES_FLTR_BOOKMARK: // insert bookmark { - String aName( ((SfxStringItem*)pAttr->pItem)->GetValue() ); - USHORT nBookPos = pDoc->findBookmark( aName ); - if( nBookPos != USHRT_MAX ) - { - const SwBookmark *pBkMk = - pDoc->getBookmarks()[nBookPos]; - if( pBkMk->GetBookmarkPos() != *pAttrPam->GetPoint() ) - pDoc->makeUniqueBookmarkName( aName ); - else - break; // keine doppelte Bookmark an dieser Pos - } + const String sName( ((SfxStringItem*)pAttr->pItem)->GetValue() ); + IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findMark( sName ); + if( ppBkmk != pMarkAccess->getMarksEnd() && + ppBkmk->get()->GetMarkStart() == *pAttrPam->GetPoint() ) + break; // do not generate duplicates on this position pAttrPam->DeleteMark(); - pDoc->makeBookmark( *pAttrPam, KeyCode(), - aName, aEmptyStr, IDocumentBookmarkAccess::BOOKMARK ); + const ::sw::mark::IMark* const pNewMark = pMarkAccess->makeMark( + *pAttrPam, + sName, + IDocumentMarkAccess::BOOKMARK ); - // ggfs. ein Bookmark anspringen - if( JUMPTO_MARK == eJumpTo && - aName == sJmpMark ) + // jump to bookmark + if( JUMPTO_MARK == eJumpTo && pNewMark->GetName() == ::rtl::OUString(sJmpMark) ) { bChkJumpMark = TRUE; eJumpTo = JUMPTO_NONE; @@ -5050,14 +5046,14 @@ void SwHTMLParser::InsertLineBreak() case HTML_O_CLEAR: { const String &aClear = pOption->GetString(); - if( aClear.EqualsIgnoreCaseAscii( sHTML_AL_all ) ) + if( aClear.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_AL_all ) ) { bClearLeft = TRUE; bClearRight = TRUE; } - else if( aClear.EqualsIgnoreCaseAscii( sHTML_AL_left ) ) + else if( aClear.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_AL_left ) ) bClearLeft = TRUE; - else if( aClear.EqualsIgnoreCaseAscii( sHTML_AL_right ) ) + else if( aClear.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_AL_right ) ) bClearRight = TRUE; } break; @@ -5378,22 +5374,22 @@ void SwHTMLParser::ParseMoreMetaOptions() // nicht geaendert wurde. Deshalb genuegt es, auf Generator und // auf refresh abzufragen, um noch nicht verarbeitete Token zu finden, // denn das sind die einzigen, die die Dok-Info nicht modifizieren. - if( aName.EqualsIgnoreCaseAscii( sHTML_META_generator ) || - aName.EqualsIgnoreCaseAscii( sHTML_META_refresh ) || - aName.EqualsIgnoreCaseAscii( sHTML_META_content_type ) || - aName.EqualsIgnoreCaseAscii( sHTML_META_content_script_type ) ) + if( aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_generator ) || + aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_refresh ) || + aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ) || + aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_script_type ) ) return; aContent.EraseAllChars( _CR ); aContent.EraseAllChars( _LF ); - if( aName.EqualsIgnoreCaseAscii( sHTML_META_sdendnote ) ) + if( aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_sdendnote ) ) { FillEndNoteInfo( aContent ); return; } - if( aName.EqualsIgnoreCaseAscii( sHTML_META_sdfootnote ) ) + if( aName.EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_sdfootnote ) ) { FillFootNoteInfo( aContent ); return; @@ -5401,16 +5397,16 @@ void SwHTMLParser::ParseMoreMetaOptions() String sText( String::CreateFromAscii(TOOLS_CONSTASCII_STRINGPARAM("HTML: <")) ); - sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(sHTML_meta) ); + sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_meta) ); sText.Append( ' ' ); if( bHTTPEquiv ) - sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(sHTML_O_httpequiv) ); + sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_httpequiv) ); else - sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(sHTML_O_name) ); + sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_name) ); sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("=\"") ); sText.Append( aName ); sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("\" ") ); - sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(sHTML_O_content) ); + sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_content) ); sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("=\"") ); sText.Append( aContent ); sText.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("\">") ); diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 4453539ad602..29a5860e0b2f 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -76,7 +76,7 @@ #include <mdiexp.hxx> // ...Percent() #include <fltini.hxx> #include <viewopt.hxx> -#include <bookmrk.hxx> // fuer SwBookmark ... +#include <IMark.hxx> // fuer SwBookmark ... #include <poolfmt.hxx> #include <pagedesc.hxx> #include <section.hxx> @@ -111,7 +111,7 @@ SwHTMLWriter::SwHTMLWriter( const String& rBaseURL ) { SetBaseURL( rBaseURL ); bFirstLine = sal_True; - nBkmkTabPos = USHRT_MAX; + nBkmkTabPos = -1; pDfltColor = 0; nImgMapCnt = 1; pStartNdIdx = 0; @@ -320,8 +320,8 @@ ULONG SwHTMLWriter::WriteStream() aName, eDestEnc, &aNonConvertableCharacters ); ByteString sOut( '<' ); - (((((((sOut += sHTML_division) - += ' ') += sHTML_O_id) += "=\"") + (((((((sOut += OOO_STRING_SVTOOLS_HTML_division) + += ' ') += OOO_STRING_SVTOOLS_HTML_O_id) += "=\"") += aName) += '\"') += '>') += aStartTags; @@ -387,9 +387,9 @@ ULONG SwHTMLWriter::WriteStream() if( bLFPossible ) OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_body, sal_False ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_body, sal_False ); OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_html, sal_False ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_html, sal_False ); // loesche die Tabelle mit den freifliegenden Rahmen sal_uInt16 i; @@ -539,7 +539,7 @@ void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, if( rHTMLWrt.bLFPossible ) rHTMLWrt.OutNewLine(); - const sal_Char *pTag = pCol ? sHTML_multicol : sHTML_division; + const sal_Char *pTag = pCol ? OOO_STRING_SVTOOLS_HTML_multicol : OOO_STRING_SVTOOLS_HTML_division; ByteString sOut( '<' ); sOut += pTag; @@ -547,7 +547,7 @@ void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, const String& rName = rSection.GetName(); if( rName.Len() && !bContinued ) { - ((sOut += ' ') += sHTML_O_id) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_id) += "=\""; rHTMLWrt.Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), rName, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); sOut = '\"'; @@ -560,7 +560,7 @@ void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, if( FILE_LINK_SECTION == rSection.GetType() ) { - ((sOut += ' ') += sHTML_O_href) += "=\""; + ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_href) += "=\""; rHTMLWrt.Strm() << sOut.GetBuffer(); const String& aFName = rSection.GetLinkFileName(); @@ -607,7 +607,7 @@ void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, } else if( pCol ) { - (((sOut += ' ') += sHTML_O_cols) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_cols) += '=') += ByteString::CreateFromInt32( pCol->GetNumCols() ); // minumum gutter width @@ -620,7 +620,7 @@ void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, ->LogicToPixel( Size(nGutter,0), MapMode(MAP_TWIP) ).Width(); } - (((sOut += ' ') += sHTML_O_gutter) += '=') + (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_gutter) += '=') += ByteString::CreateFromInt32( nGutter ); } } @@ -641,7 +641,7 @@ void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, void lcl_html_OutSectionEndTag( SwHTMLWriter& rHTMLWrt, const SwFmtCol *pCol ) { - const sal_Char *pTag = pCol ? sHTML_multicol : sHTML_division; + const sal_Char *pTag = pCol ? OOO_STRING_SVTOOLS_HTML_multicol : OOO_STRING_SVTOOLS_HTML_division; rHTMLWrt.DecIndentLevel(); if( rHTMLWrt.bLFPossible ) @@ -744,7 +744,7 @@ void SwHTMLWriter::Out_SwDoc( SwPaM* pPam ) sal_Bool bSaveWriteAll = bWriteAll; // sichern // suche die naechste text::Bookmark-Position aus der text::Bookmark-Tabelle - nBkmkTabPos = bWriteAll ? FindPos_Bkmk( *pCurPam->GetPoint() ) : USHRT_MAX; + nBkmkTabPos = bWriteAll ? FindPos_Bkmk( *pCurPam->GetPoint() ) : -1; // gebe alle Bereiche des Pams in das HTML-File aus. do { @@ -774,12 +774,12 @@ void SwHTMLWriter::Out_SwDoc( SwPaM* pPam ) else if( pNd->IsTableNode() ) { OutHTML_SwTblNode( *this, *pNd->GetTableNode(), 0 ); - nBkmkTabPos = bWriteAll ? FindPos_Bkmk( *pCurPam->GetPoint() ) : USHRT_MAX; + nBkmkTabPos = bWriteAll ? FindPos_Bkmk( *pCurPam->GetPoint() ) : -1; } else if( pNd->IsSectionNode() ) { OutHTML_Section( *this, *pNd->GetSectionNode() ); - nBkmkTabPos = bWriteAll ? FindPos_Bkmk( *pCurPam->GetPoint() ) : USHRT_MAX; + nBkmkTabPos = bWriteAll ? FindPos_Bkmk( *pCurPam->GetPoint() ) : -1; } else if( pNd == &pDoc->GetNodes().GetEndOfContent() ) break; @@ -921,18 +921,18 @@ sal_uInt16 SwHTMLWriter::OutHeaderAttrs() const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs ) { - ByteString sOut( sHTML_doctype ); + ByteString sOut( OOO_STRING_SVTOOLS_HTML_doctype ); (sOut += ' ') += - (HTML_CFG_HTML32==nExportMode ? sHTML_doctype32 - : sHTML_doctype40); + (HTML_CFG_HTML32==nExportMode ? OOO_STRING_SVTOOLS_HTML_doctype32 + : OOO_STRING_SVTOOLS_HTML_doctype40); HTMLOutFuncs::Out_AsciiTag( Strm(), sOut.GetBuffer() ); // baue den Vorspann OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_html ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_html ); OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_head ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_head ); IncIndentLevel(); // Inhalt von <HEAD> einruecken @@ -1006,12 +1006,12 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs ) DecIndentLevel(); // Inhalt von <HEAD> einruecken OutNewLine(); - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_head, sal_False ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_head, sal_False ); // der Body wird nicht eingerueckt, weil sonst alles eingerueckt waere! OutNewLine(); sOut = '<'; - sOut += sHTML_body; + sOut += OOO_STRING_SVTOOLS_HTML_body; Strm() << sOut.GetBuffer(); sOut.Erase(); @@ -1020,15 +1020,15 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs ) // Textfarbe ausgeben, wenn sie an der Standard-Vorlage gesetzt ist // und sich geaendert hat. - OutBodyColor( sHTML_O_text, + OutBodyColor( OOO_STRING_SVTOOLS_HTML_O_text, pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false ), *this ); // Farben fuer (un)besuchte Links - OutBodyColor( sHTML_O_link, + OutBodyColor( OOO_STRING_SVTOOLS_HTML_O_link, pDoc->GetCharFmtFromPool( RES_POOLCHR_INET_NORMAL ), *this ); - OutBodyColor( sHTML_O_vlink, + OutBodyColor( OOO_STRING_SVTOOLS_HTML_O_vlink, pDoc->GetCharFmtFromPool( RES_POOLCHR_INET_VISIT ), *this ); @@ -1055,34 +1055,36 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs ) void SwHTMLWriter::OutAnchor( const String& rName ) { ByteString sOut( '<' ); - (((sOut += sHTML_anchor) += ' ') += sHTML_O_name) += "=\""; + (((sOut += OOO_STRING_SVTOOLS_HTML_anchor) += ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\""; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), rName, eDestEnc, &aNonConvertableCharacters ) << "\">"; - HTMLOutFuncs::Out_AsciiTag( Strm(), sHTML_anchor, sal_False ); + HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_anchor, sal_False ); } void SwHTMLWriter::OutBookmarks() { // hole das aktuelle Bookmark - const SwBookmark* pBookmark = USHRT_MAX != nBkmkTabPos ? - pDoc->getBookmarks()[ nBkmkTabPos ] : 0; + const ::sw::mark::IMark* pBookmark = NULL; + IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + if(nBkmkTabPos != -1) + pBookmark = (pMarkAccess->getMarksBegin() + nBkmkTabPos)->get(); // Ausgabe aller Bookmarks in diesem Absatz. Die Content-Position // wird vorerst nicht beruecksichtigt! sal_uInt32 nNode = pCurPam->GetPoint()->nNode.GetIndex(); - while( USHRT_MAX != nBkmkTabPos && - pBookmark->GetBookmarkPos().nNode.GetIndex() == nNode ) + while( nBkmkTabPos != -1 && + pBookmark->GetMarkPos().nNode.GetIndex() == nNode ) { // Der Bereich derBookmark wird erstam ignoriert, da er von uns // auch nicht eingelesen wird. // erst die SWG spezifischen Daten: - if( pBookmark->IsBookMark() && pBookmark->GetName().Len() ) + if(dynamic_cast< const ::sw::mark::IBookmark* >(pBookmark) && pBookmark->GetName().getLength() ) OutAnchor( pBookmark->GetName() ); - if( ++nBkmkTabPos >= pDoc->getBookmarks().Count() ) - nBkmkTabPos = USHRT_MAX; + if( ++nBkmkTabPos >= pMarkAccess->getMarksCount() ) + nBkmkTabPos = -1; else - pBookmark = pDoc->getBookmarks()[ nBkmkTabPos ]; + pBookmark = (pMarkAccess->getMarksBegin() + nBkmkTabPos)->get(); } sal_uInt16 nPos; @@ -1157,7 +1159,7 @@ void SwHTMLWriter::OutBackground( const SvxBrushItem *pBrushItem, if( rBackColor.GetColor() != COL_TRANSPARENT ) { ByteString sOut( ' ' ); - (sOut += sHTML_O_bgcolor) += '='; + (sOut += OOO_STRING_SVTOOLS_HTML_O_bgcolor) += '='; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_Color( Strm(), rBackColor, eDestEnc); } @@ -1207,7 +1209,7 @@ void SwHTMLWriter::OutBackground( const SvxBrushItem *pBrushItem, { ByteString sOut( ' ' ); String s( URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), *pLink)); - (sOut += sHTML_O_background) += "=\""; + (sOut += OOO_STRING_SVTOOLS_HTML_O_background) += "=\""; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), s, eDestEnc, &aNonConvertableCharacters ) << '\"'; } @@ -1247,7 +1249,7 @@ void SwHTMLWriter::OutLanguage( LanguageType nLang ) if( LANGUAGE_DONTKNOW != nLang ) { ByteString sOut( ' ' ); - (sOut += sHTML_O_lang) += "=\""; + (sOut += OOO_STRING_SVTOOLS_HTML_O_lang) += "=\""; Strm() << sOut.GetBuffer(); HTMLOutFuncs::Out_String( Strm(), MsLangId::convertLanguageToIsoString(nLang), eDestEnc, &aNonConvertableCharacters ) << '"'; @@ -1295,7 +1297,7 @@ void SwHTMLWriter::OutDirection( sal_uInt16 nDir ) if( pValue != 0 ) { ByteString sOut( ' ' ); - (((sOut += sHTML_O_dir) += "=\"") += pValue) += '\"'; + (((sOut += OOO_STRING_SVTOOLS_HTML_O_dir) += "=\"") += pValue) += '\"'; Strm() << sOut.GetBuffer(); } } @@ -1407,7 +1409,7 @@ HTMLSaveData::~HTMLSaveData() rWrt.pCurPam = pOldPam; rWrt.SetEndPaM( pOldEnd ); rWrt.bWriteAll = bOldWriteAll; - rWrt.nBkmkTabPos = bOldWriteAll ? rWrt.FindPos_Bkmk( *pOldPam->GetPoint() ) : USHRT_MAX; + rWrt.nBkmkTabPos = bOldWriteAll ? rWrt.FindPos_Bkmk( *pOldPam->GetPoint() ) : -1; rWrt.nLastParaToken = 0; rWrt.nDefListLvl = nOldDefListLvl; rWrt.nDirection = nOldDirection; diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 03041f538226..6118430d28f6 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -258,7 +258,7 @@ public: sal_uInt32 nLastLFPos; // letzte Position eines LF sal_uInt16 nLastParaToken; // fuers Absaetze zusammenhalten - sal_uInt16 nBkmkTabPos; // akt. Position in der Bookmark-Tabelle + sal_Int32 nBkmkTabPos; // akt. Position in der Bookmark-Tabelle sal_uInt16 nImgMapCnt; // zum eindeutig sal_uInt16 nFormCntrlCnt; sal_uInt16 nEndNote; diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx index 3c099fcd62a5..88dc0da19562 100644 --- a/sw/source/filter/rtf/rtfatr.cxx +++ b/sw/source/filter/rtf/rtfatr.cxx @@ -190,7 +190,7 @@ static Writer& OutRTF_SwFmtCol( Writer& rWrt, const SfxPoolItem& rHt ); SvStream& OutComment( Writer& rWrt, const sal_Char* pStr ) { - return (rWrt.Strm() << '{' << sRTF_IGNORE << pStr); + return (rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << pStr); } SvStream& OutComment( Writer& rWrt, const char* pStr, BOOL bSetFlag ) @@ -198,7 +198,7 @@ SvStream& OutComment( Writer& rWrt, const char* pStr, BOOL bSetFlag ) // setze Flag, damit bei der Ausgabe von Attributen zu erkennen, // ob ueberhaupt etwas ausgegeben wurde. ((SwRTFWriter&)rWrt).bOutFmtAttr = bSetFlag; - return (rWrt.Strm() << '{' << sRTF_IGNORE << pStr); + return (rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << pStr); } Writer& OutRTF_AsByteString( Writer& rWrt, const String& rStr, rtl_TextEncoding eEncoding) @@ -369,15 +369,15 @@ void OutRTF_SfxItemSet( SwRTFWriter& rWrt, const SfxItemSet& rSet, { if (bOutLTOR) { - rWrt.Strm() << sRTF_LTRCH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LTRCH; bOutLTOR = false; } if (bLowLTOR) - rWrt.Strm() << sRTF_LOCH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LOCH; else { - rWrt.Strm() << sRTF_HICH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_HICH; bLowLTOR = true; } } @@ -385,13 +385,13 @@ void OutRTF_SfxItemSet( SwRTFWriter& rWrt, const SfxItemSet& rSet, { if( bOutLTOR ) { - rWrt.Strm() << sRTF_LTRCH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LTRCH; bOutLTOR = false; } - rWrt.Strm() << sRTF_DBCH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_DBCH; } else - rWrt.Strm() << sRTF_RTLCH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_RTLCH; for (USHORT n = 0; n < pCurArr->Count(); ++n) { @@ -424,7 +424,7 @@ bool SwFmtToSet(SwRTFWriter& rWrt, const SwFmt& rFmt, SfxItemSet &rSet) if (0 == nId ) return false; // Default-TextStyle nicht ausgeben !! - rWrt.Strm() << sRTF_S; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_S; rWrt.OutULong( nId ); rWrt.bOutFmtAttr = TRUE; // BYTE nLvl = ((const SwTxtFmtColl&)rFmt).GetOutlineLevel(); //#outline level,zhaojianwei @@ -438,13 +438,13 @@ bool SwFmtToSet(SwRTFWriter& rWrt, const SwFmt& rFmt, SfxItemSet &rSet) if( USHRT_MAX != nNumId ) { BYTE nWWLvl = 8 >= nLvl ? static_cast<BYTE>(nLvl) : 8; - rWrt.Strm() << sRTF_LS; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LS; rWrt.OutULong( nNumId ); - rWrt.Strm() << sRTF_ILVL; rWrt.OutULong( nWWLvl ); - rWrt.Strm() << sRTF_OUTLINELEVEL; rWrt.OutULong( nWWLvl ); + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_ILVL; rWrt.OutULong( nWWLvl ); + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_OUTLINELEVEL; rWrt.OutULong( nWWLvl ); if( nWWLvl != nLvl ) // RTF-kennt nur 9 Ebenen { - OutComment( rWrt, sRTF_SOUTLVL ); + OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_SOUTLVL ); rWrt.OutULong( nLvl ) << '}'; } } @@ -473,7 +473,7 @@ bool SwFmtToSet(SwRTFWriter& rWrt, const SwFmt& rFmt, SfxItemSet &rSet) if (0 == nId) return false; // Default-CharStyle nicht ausgeben !! - rWrt.Strm() << sRTF_IGNORE << sRTF_CS; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_CS; rWrt.OutULong( nId ); rWrt.bOutFmtAttr = TRUE; } @@ -532,7 +532,7 @@ void OutRTF_SwFlyFrmFmt( SwRTFWriter& rRTFWrt ) if( aTmpStrm.GetSize() ) // gibt es SWG spezifische Attribute ?? { aTmpStrm.Seek( 0L ); - rRTFWrt.Strm() << '{' << sRTF_IGNORE << aTmpStrm << '}'; + rRTFWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << aTmpStrm << '}'; } } // rRTFWrt.pFlyFmt = 0; // wieder zuruecksetzen !! @@ -782,7 +782,7 @@ void RTFEndPosLst::OutFontAttrs(USHORT nScript, bool bRTL) /* You would have thought that - rWrt.Strm() << (bRTL ? sRTF_RTLCH : sRTF_LTRCH); would be sufficent here , + rWrt.Strm() << (bRTL ? OOO_STRING_SVTOOLS_RTF_RTLCH : OOO_STRING_SVTOOLS_RTF_LTRCH); would be sufficent here , but looks like word needs to see the other directional token to be satisified that all is kosher, otherwise it seems in ver 2003 to go and semi-randomlyly stick strike through about the place. Perhaps @@ -791,15 +791,15 @@ void RTFEndPosLst::OutFontAttrs(USHORT nScript, bool bRTL) */ if (bRTL) { - rWrt.Strm() << sRTF_LTRCH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LTRCH; rWrt.Strm() << ' '; - rWrt.Strm() << sRTF_RTLCH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_RTLCH; } else { - rWrt.Strm() << sRTF_RTLCH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_RTLCH; rWrt.Strm() << ' '; - rWrt.Strm() << sRTF_LTRCH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LTRCH; } // size/weight/posture optional @@ -810,11 +810,11 @@ void RTFEndPosLst::OutFontAttrs(USHORT nScript, bool bRTL) default: //fall through ASSERT(pIdArr, "unknown script, strange"); case i18n::ScriptType::LATIN: - rWrt.Strm() << sRTF_LOCH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LOCH; pIdArr = aLatinIds; break; case i18n::ScriptType::ASIAN: - rWrt.Strm() << sRTF_DBCH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_DBCH; pIdArr = aAsianIds; break; case i18n::ScriptType::COMPLEX: @@ -848,7 +848,7 @@ void RTFEndPosLst::EndAttrs( xub_StrLen nStrPos ) switch( rAttrs[ --nAttr ]->Which() ) { case RES_TXTATR_CJK_RUBY: - rWrt.Strm() << ")}{" << sRTF_FLDRSLT << " }}"; + rWrt.Strm() << ")}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << " }}"; break; } } @@ -995,7 +995,7 @@ static void OutSvxFrmDir(SwRTFWriter& rRTFWrt, const SfxPoolItem& rHt ) break; case FRMDIR_VERT_TOP_RIGHT: nVal = 1; - pStr = sRTF_FRMTXTBRLV; + pStr = OOO_STRING_SVTOOLS_RTF_FRMTXTBRLV; break; case FRMDIR_HORI_RIGHT_TOP: bRTL = true; @@ -1003,11 +1003,11 @@ static void OutSvxFrmDir(SwRTFWriter& rRTFWrt, const SfxPoolItem& rHt ) // A val of three isn't working as expected in word :-( so leave it // as normal ltr 0 textflow with rtl sect property, neither does // the frame textflow -// pStr = sRTF_FRMTXTBRL; +// pStr = OOO_STRING_SVTOOLS_RTF_FRMTXTBRL; break; case FRMDIR_VERT_TOP_LEFT: nVal = 4; - pStr = sRTF_FRMTXLRTBV; + pStr = OOO_STRING_SVTOOLS_RTF_FRMTXLRTBV; break; } @@ -1020,16 +1020,16 @@ static void OutSvxFrmDir(SwRTFWriter& rRTFWrt, const SfxPoolItem& rHt ) { if (nVal) { - rRTFWrt.Strm() << sRTF_STEXTFLOW; + rRTFWrt.Strm() << OOO_STRING_SVTOOLS_RTF_STEXTFLOW; rRTFWrt.OutULong( nVal ); } if (bRTL) - rRTFWrt.Strm() << sRTF_RTLSECT; + rRTFWrt.Strm() << OOO_STRING_SVTOOLS_RTF_RTLSECT; rRTFWrt.bOutFmtAttr = TRUE; } else if (!rRTFWrt.pFlyFmt && !rRTFWrt.bOutPageDesc) { - rRTFWrt.Strm() << (bRTL ? sRTF_RTLPAR : sRTF_LTRPAR); + rRTFWrt.Strm() << (bRTL ? OOO_STRING_SVTOOLS_RTF_RTLPAR : OOO_STRING_SVTOOLS_RTF_LTRPAR); rRTFWrt.bOutFmtAttr = TRUE; } } @@ -1059,8 +1059,8 @@ static Writer& OutRTF_SwTxtINetFmt( Writer& rWrt, const SfxPoolItem& rHt ) SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; if( rURL.GetValue().Len() ) { - rWrt.Strm() << '{' << sRTF_FIELD << '{' << sRTF_IGNORE - << sRTF_FLDINST << " HYPERLINK "; + rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_FIELD << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE + << OOO_STRING_SVTOOLS_RTF_FLDINST << " HYPERLINK "; String sURL( rURL.GetValue() ); if( INET_MARK_TOKEN != sURL.GetChar(0) ) @@ -1097,7 +1097,7 @@ static Writer& OutRTF_SwTxtINetFmt( Writer& rWrt, const SfxPoolItem& rHt ) rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ) << "\" "; } - rWrt.Strm() << "}{" << sRTF_FLDRSLT << ' '; + rWrt.Strm() << "}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << ' '; rRTFWrt.bOutFmtAttr = false; // und dann noch die Attributierung ausgeben @@ -1197,9 +1197,9 @@ static Writer& OutRTF_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) if( rRTFWrt.bWriteAll ) { - rRTFWrt.Strm() << sRTF_PARD << sRTF_PLAIN << ' '; // alle Attribute zuruecksetzen + rRTFWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN << ' '; // alle Attribute zuruecksetzen if( rRTFWrt.bOutTable ) - rRTFWrt.Strm() << sRTF_INTBL; + rRTFWrt.Strm() << OOO_STRING_SVTOOLS_RTF_INTBL; // ist der aktuelle Absatz in einem freifliegenden Rahmen ? Dann // muessen noch die Attribute dafuer ausgegeben werden. @@ -1395,7 +1395,7 @@ static Writer& OutRTF_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) } } - rRTFWrt.Strm() << SwRTFWriter::sNewLine << sRTF_PAR << ' '; + rRTFWrt.Strm() << SwRTFWriter::sNewLine << OOO_STRING_SVTOOLS_RTF_PAR << ' '; return rRTFWrt; } @@ -1437,10 +1437,10 @@ void ExportPICT(const Size &rOrig, const Size &rRendered, const Size &rMapped, const SwCropGrf &rCr, const char *pBLIPType, const sal_uInt8 *pGraphicAry, unsigned long nSize, SwRTFWriter &rWrt) { - bool bIsWMF = (const char *)pBLIPType == (const char *)sRTF_WMETAFILE ? true : false; + bool bIsWMF = (const char *)pBLIPType == (const char *)OOO_STRING_SVTOOLS_RTF_WMETAFILE ? true : false; if (pBLIPType && nSize && pGraphicAry) { - rWrt.Strm() << '{' << sRTF_PICT; + rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_PICT; long nXCroppedSize = rOrig.Width()-(rCr.GetLeft() + rCr.GetRight()); long nYCroppedSize = rOrig.Height()-(rCr.GetTop() + rCr.GetBottom()); @@ -1454,28 +1454,28 @@ void ExportPICT(const Size &rOrig, const Size &rRendered, const Size &rMapped, //Given the original size and taking cropping into account //first, how much has the original been scaled to get the //final rendered size - rWrt.Strm() << sRTF_PICSCALEX; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICSCALEX; rWrt.OutLong((100 * rRendered.Width()) / nXCroppedSize); - rWrt.Strm() << sRTF_PICSCALEY; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICSCALEY; rWrt.OutLong((100 * rRendered.Height()) / nYCroppedSize); - rWrt.Strm() << sRTF_PICCROPL; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICCROPL; rWrt.OutLong(rCr.GetLeft()); - rWrt.Strm() << sRTF_PICCROPR; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICCROPR; rWrt.OutLong(rCr.GetRight()); - rWrt.Strm() << sRTF_PICCROPT; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICCROPT; rWrt.OutLong(rCr.GetTop()); - rWrt.Strm() << sRTF_PICCROPB; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICCROPB; rWrt.OutLong(rCr.GetBottom()); - rWrt.Strm() << sRTF_PICW; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICW; rWrt.OutLong(rMapped.Width()); - rWrt.Strm() << sRTF_PICH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICH; rWrt.OutLong(rMapped.Height()); - rWrt.Strm() << sRTF_PICWGOAL; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICWGOAL; rWrt.OutLong(rOrig.Width()); - rWrt.Strm() << sRTF_PICHGOAL; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICHGOAL; rWrt.OutLong(rOrig.Height()); rWrt.Strm() << pBLIPType; @@ -1535,13 +1535,13 @@ static Writer& OutRTF_SwGrfNode(Writer& rWrt, SwCntntNode & rNode) switch (aGraphicLink.GetType()) { case GFX_LINK_TYPE_NATIVE_JPG: - pBLIPType = sRTF_JPEGBLIP; + pBLIPType = OOO_STRING_SVTOOLS_RTF_JPEGBLIP; break; case GFX_LINK_TYPE_NATIVE_PNG: - pBLIPType = sRTF_PNGBLIP; + pBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP; case GFX_LINK_TYPE_NATIVE_WMF: pBLIPType = - IsEMF(pGraphicAry, nSize) ? sRTF_EMFBLIP : sRTF_WMETAFILE; + IsEMF(pGraphicAry, nSize) ? OOO_STRING_SVTOOLS_RTF_EMFBLIP : OOO_STRING_SVTOOLS_RTF_WMETAFILE; break; default: break; @@ -1555,7 +1555,7 @@ static Writer& OutRTF_SwGrfNode(Writer& rWrt, SwCntntNode & rNode) (eGraphicType == GRAPHIC_BITMAP) ? CVT_PNG : CVT_WMF)) { pBLIPType = (eGraphicType == GRAPHIC_BITMAP) ? - sRTF_PNGBLIP : sRTF_WMETAFILE; + OOO_STRING_SVTOOLS_RTF_PNGBLIP : OOO_STRING_SVTOOLS_RTF_WMETAFILE; aStream.Seek(STREAM_SEEK_TO_END); nSize = aStream.Tell(); pGraphicAry = (sal_uInt8*)aStream.GetData(); @@ -1582,9 +1582,9 @@ static Writer& OutRTF_SwGrfNode(Writer& rWrt, SwCntntNode & rNode) the wmf format wrapped in nonshppict, so as to keep wordpad happy. If its a wmf already then we don't need any such wrapping */ - bool bIsWMF = (const sal_Char*)pBLIPType == (const sal_Char*)sRTF_WMETAFILE ? true : false; + bool bIsWMF = (const sal_Char*)pBLIPType == (const sal_Char*)OOO_STRING_SVTOOLS_RTF_WMETAFILE ? true : false; if (!bIsWMF) - OutComment(rRTFWrt, sRTF_SHPPICT); + OutComment(rRTFWrt, OOO_STRING_SVTOOLS_RTF_SHPPICT); if (pBLIPType) ExportPICT(aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, rRTFWrt); @@ -1592,7 +1592,7 @@ static Writer& OutRTF_SwGrfNode(Writer& rWrt, SwCntntNode & rNode) { aStream.Seek(0); GraphicConverter::Export(aStream, aGraphic, CVT_WMF); - pBLIPType = sRTF_WMETAFILE; + pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE; aStream.Seek(STREAM_SEEK_TO_END); nSize = aStream.Tell(); pGraphicAry = (sal_uInt8*)aStream.GetData(); @@ -1603,11 +1603,11 @@ static Writer& OutRTF_SwGrfNode(Writer& rWrt, SwCntntNode & rNode) if (!bIsWMF) { - rRTFWrt.Strm() << '}' << '{' << sRTF_NONSHPPICT; + rRTFWrt.Strm() << '}' << '{' << OOO_STRING_SVTOOLS_RTF_NONSHPPICT; aStream.Seek(0); GraphicConverter::Export(aStream, aGraphic, CVT_WMF); - pBLIPType = sRTF_WMETAFILE; + pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE; aStream.Seek(STREAM_SEEK_TO_END); nSize = aStream.Tell(); pGraphicAry = (sal_uInt8*)aStream.GetData(); @@ -1685,11 +1685,11 @@ static Writer& OutRTF_SwGrfNode(Writer& rWrt, SwCntntNode & rNode) aGrfNm = aUrl.PathToFileName(); // Bitmap als File-Referenz speichern - rRTFWrt.Strm() << sRTF_FIELD << sRTF_FLDPRIV; - OutComment( rRTFWrt, sRTF_FLDINST ) << "{\\\\import "; + rRTFWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FIELD << OOO_STRING_SVTOOLS_RTF_FLDPRIV; + OutComment( rRTFWrt, OOO_STRING_SVTOOLS_RTF_FLDINST ) << "{\\\\import "; RTFOutFuncs::Out_String( rWrt.Strm(), aGrfNm, rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); - rRTFWrt.Strm() << "}}{" << sRTF_FLDRSLT << " }}"; + rRTFWrt.Strm() << "}}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << " }}"; rRTFWrt.Strm() << '}' << SwRTFWriter::sNewLine; #endif return rRTFWrt; @@ -1704,7 +1704,7 @@ static Writer& OutRTF_SwOLENode( Writer& rWrt, SwCntntNode & /*rNode*/ ) if( rRTFWrt.pFlyFmt ) OutRTF_SwFlyFrmFmt( rRTFWrt ); - rWrt.Strm() << SwRTFWriter::sNewLine << sRTF_PAR; + rWrt.Strm() << SwRTFWriter::sNewLine << OOO_STRING_SVTOOLS_RTF_PAR; return rWrt; } @@ -1715,18 +1715,18 @@ static void OutTBLBorderLine(SwRTFWriter& rWrt, const SvxBorderLine* pLine, if( pLine->GetInWidth() ) { // doppelte Linie - sLineStr = sRTF_BRDRDB; + sLineStr = OOO_STRING_SVTOOLS_RTF_BRDRDB; switch( pLine->GetInWidth() ) { case DEF_LINE_WIDTH_0: - ( sLineStr += sRTF_BRDRW ) += "15"; + ( sLineStr += OOO_STRING_SVTOOLS_RTF_BRDRW ) += "15"; break; case DEF_LINE_WIDTH_1: - ( sLineStr += sRTF_BRDRW ) += "30"; + ( sLineStr += OOO_STRING_SVTOOLS_RTF_BRDRW ) += "30"; break; case DEF_LINE_WIDTH_2: case DEF_LINE_WIDTH_3: - ( sLineStr += sRTF_BRDRW ) += "45"; + ( sLineStr += OOO_STRING_SVTOOLS_RTF_BRDRW ) += "45"; break; } } @@ -1734,14 +1734,14 @@ static void OutTBLBorderLine(SwRTFWriter& rWrt, const SvxBorderLine* pLine, { // einfache Linie if( DEF_LINE_WIDTH_1 >= pLine->GetOutWidth() ) - (( sLineStr = sRTF_BRDRS ) += sRTF_BRDRW ) += + (( sLineStr = OOO_STRING_SVTOOLS_RTF_BRDRS ) += OOO_STRING_SVTOOLS_RTF_BRDRW ) += ByteString::CreateFromInt32( pLine->GetOutWidth() ); else - (( sLineStr = sRTF_BRDRTH ) += sRTF_BRDRW ) += + (( sLineStr = OOO_STRING_SVTOOLS_RTF_BRDRTH ) += OOO_STRING_SVTOOLS_RTF_BRDRW ) += ByteString::CreateFromInt32( pLine->GetOutWidth() / 2 ); } - rWrt.Strm() << pStr << sLineStr.GetBuffer() << sRTF_BRDRCF; + rWrt.Strm() << pStr << sLineStr.GetBuffer() << OOO_STRING_SVTOOLS_RTF_BRDRCF; rWrt.OutULong( rWrt.GetId( pLine->GetColor() ) ); } @@ -1749,7 +1749,7 @@ static void OutBorderLine(SwRTFWriter& rWrt, const SvxBorderLine* pLine, const sal_Char* pStr, USHORT nDist) { OutTBLBorderLine(rWrt, pLine, pStr); - rWrt.Strm() << sRTF_BRSP; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_BRSP; rWrt.OutULong( nDist ); } @@ -1762,17 +1762,17 @@ static void OutSwTblBorder(SwRTFWriter& rWrt, const SvxBoxItem& rBox, }; static const char* aBorderNames[] = { - sRTF_CLBRDRT, sRTF_CLBRDRL, sRTF_CLBRDRB, sRTF_CLBRDRR + OOO_STRING_SVTOOLS_RTF_CLBRDRT, OOO_STRING_SVTOOLS_RTF_CLBRDRL, OOO_STRING_SVTOOLS_RTF_CLBRDRB, OOO_STRING_SVTOOLS_RTF_CLBRDRR }; //Yes left and top are swapped with eachother for cell padding! Because //that's what the thunderingly annoying rtf export/import word xp does. static const char* aCellPadNames[] = { - sRTF_CLPADL, sRTF_CLPADT, sRTF_CLPADB, sRTF_CLPADR + OOO_STRING_SVTOOLS_RTF_CLPADL, OOO_STRING_SVTOOLS_RTF_CLPADT, OOO_STRING_SVTOOLS_RTF_CLPADB, OOO_STRING_SVTOOLS_RTF_CLPADR }; static const char* aCellPadUnits[] = { - sRTF_CLPADFL, sRTF_CLPADFT, sRTF_CLPADFB, sRTF_CLPADFR + OOO_STRING_SVTOOLS_RTF_CLPADFL, OOO_STRING_SVTOOLS_RTF_CLPADFT, OOO_STRING_SVTOOLS_RTF_CLPADFB, OOO_STRING_SVTOOLS_RTF_CLPADFR }; for (int i = 0; i < 4; ++i) { @@ -1793,7 +1793,7 @@ static void OutSwTblBackground( SwRTFWriter& rWrt, const SvxBrushItem& rBack ) { if( !rBack.GetColor().GetTransparency() ) { - rWrt.Strm() << sRTF_CLCBPAT; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CLCBPAT; rWrt.OutULong( rWrt.GetId( rBack.GetColor() ) ); } } @@ -1841,14 +1841,14 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode) SwTwips nTblSz = pFmt->GetFrmSize().GetWidth(); - ByteString aTblAdjust( sRTF_TRQL ); + ByteString aTblAdjust( OOO_STRING_SVTOOLS_RTF_TRQL ); switch (pFmt->GetHoriOrient().GetHoriOrient()) { case text::HoriOrientation::CENTER: - aTblAdjust = sRTF_TRQC; + aTblAdjust = OOO_STRING_SVTOOLS_RTF_TRQC; break; case text::HoriOrientation::RIGHT: - aTblAdjust = sRTF_TRQR; + aTblAdjust = OOO_STRING_SVTOOLS_RTF_TRQR; break; case text::HoriOrientation::NONE: case text::HoriOrientation::LEFT_AND_WIDTH: @@ -1856,7 +1856,7 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode) const SvxLRSpaceItem& rLRSp = pFmt->GetLRSpace(); nTblOffset = rLRSp.GetLeft(); nPageSize -= (nTblOffset + rLRSp.GetRight()); - aTblAdjust += sRTF_TRLEFT; + aTblAdjust += OOO_STRING_SVTOOLS_RTF_TRLEFT; aTblAdjust += ByteString::CreateFromInt32( nTblOffset ); } break; @@ -1865,7 +1865,7 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode) } if (rRTFWrt.TrueFrameDirection(*pFmt) == FRMDIR_HORI_RIGHT_TOP) - aTblAdjust += sRTF_RTLROW; + aTblAdjust += OOO_STRING_SVTOOLS_RTF_RTLROW; // ist die Tabelle wesentlich (PageSize + 10%) groesser als die Seite, // dann sind die Box-Breiten relative Angaben. @@ -1928,10 +1928,10 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode) nColCnt = rCols.Count(); // A wrong cellspan-value could cause a nColCnt > rCols.Count() // Start Tabellendefinition - rWrt.Strm() << sRTF_TROWD << aTblAdjust.GetBuffer(); + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TROWD << aTblAdjust.GetBuffer(); if( rTbl.GetRowsToRepeat() > nLine ) - rWrt.Strm() << sRTF_TRHDR; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TRHDR; const SwTableLine* pLine = pBoxArr[ 0 ]->GetBox()->GetUpper(); // Zeilenhoehe ausgeben @@ -1955,11 +1955,11 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode) //splittable export TRKEEP const SwFrmFmt *pLineFmt = pLine ? pLine->GetFrmFmt() : 0; if (!pLineFmt || pLineFmt->GetRowSplit().GetValue() == 0) - rWrt.Strm() << sRTF_TRKEEP; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TRKEEP; if( nHeight ) { - rWrt.Strm() << sRTF_TRRH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TRRH; rWrt.OutLong( nHeight ); } @@ -1974,11 +1974,11 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode) }; static const char* aRowPadNames[] = { - sRTF_TRPADDT, sRTF_TRPADDL, sRTF_TRPADDB, sRTF_TRPADDR + OOO_STRING_SVTOOLS_RTF_TRPADDT, OOO_STRING_SVTOOLS_RTF_TRPADDL, OOO_STRING_SVTOOLS_RTF_TRPADDB, OOO_STRING_SVTOOLS_RTF_TRPADDR }; static const char* aRowPadUnits[] = { - sRTF_TRPADDFT, sRTF_TRPADDFL, sRTF_TRPADDFB, sRTF_TRPADDFR + OOO_STRING_SVTOOLS_RTF_TRPADDFT, OOO_STRING_SVTOOLS_RTF_TRPADDFL, OOO_STRING_SVTOOLS_RTF_TRPADDFB, OOO_STRING_SVTOOLS_RTF_TRPADDFR }; for (int i = 0; i < 4; ++i) { @@ -2000,8 +2000,8 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode) const SwFrmFmt& rFmt = *pCell->GetBox()->GetFrmFmt(); if( 1 < pCell->GetRowSpan() || 0 == pCell->GetRowSpan() ) rWrt.Strm() << ( pCell->GetRowSpan() == pRowSpans[ nBox ] - ? sRTF_CLVMGF - : sRTF_CLVMRG ); + ? OOO_STRING_SVTOOLS_RTF_CLVMGF + : OOO_STRING_SVTOOLS_RTF_CLVMRG ); const SfxPoolItem* pItem; if (SFX_ITEM_SET == rFmt.GetAttrSet().GetItemState(RES_BOX, TRUE, @@ -2025,14 +2025,14 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode) RES_VERT_ORIENT, TRUE, &pItem ) ) switch( ((SwFmtVertOrient*)pItem)->GetVertOrient() ) { - case text::VertOrientation::CENTER: rWrt.Strm() << sRTF_CLVERTALC; break; - case text::VertOrientation::BOTTOM: rWrt.Strm() << sRTF_CLVERTALB; break; - default: rWrt.Strm() << sRTF_CLVERTALT; break; + case text::VertOrientation::CENTER: rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CLVERTALC; break; + case text::VertOrientation::BOTTOM: rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CLVERTALB; break; + default: rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CLVERTALT; break; } const SwFmtFrmSize& rLSz = rFmt.GetFrmSize(); nSz += rLSz.GetWidth(); - rWrt.Strm() << sRTF_CELLX; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CELLX; nCalc = nSz; if( bRelBoxSize ) @@ -2044,7 +2044,7 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode) } // Inhalt der Boxen ausgeben - rWrt.Strm() << SwRTFWriter::sNewLine << sRTF_PARD << sRTF_INTBL; + rWrt.Strm() << SwRTFWriter::sNewLine << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_INTBL; for( nBox = 0; nBox < nColCnt; ++nBox ) { if( nBox && pBoxArr[ nBox-1 ] == pBoxArr[ nBox ] ) @@ -2059,11 +2059,11 @@ Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode) rRTFWrt.bOutTable = TRUE; rRTFWrt.Out_SwDoc( rRTFWrt.pCurPam ); } - rWrt.Strm() << sRTF_CELL; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CELL; } // das wars mit der Line - rWrt.Strm() << sRTF_ROW << sRTF_PARD << ' '; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_ROW << OOO_STRING_SVTOOLS_RTF_PARD << ' '; for( nBox = 0; nBox < nColCnt; ++nBox ) --pRowSpans[ nBox ]; @@ -2118,11 +2118,11 @@ Writer& OutRTF_SwSectionNode( Writer& rWrt, SwSectionNode& rNode ) { // als fortlaufenden Abschnittwechsel heraus schreiben if( !bPgDscWrite ) - rWrt.Strm() << sRTF_SECT << sRTF_SBKNONE; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_SECT << OOO_STRING_SVTOOLS_RTF_SBKNONE; //JP 19.03.99 - es muss fuer den Import auf jedenfall das Cols // Token geschrieben werden. Sonst kann nicht erkannt // werden, wann ein PageDesc & eine Section gueltig ist - rWrt.Strm() << sRTF_COLS << '1'; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLS << '1'; rRTFWrt.bOutFmtAttr = TRUE; const SfxPoolItem* pItem; const SwFrmFmt *pFmt = rSect.GetFmt(); @@ -2132,18 +2132,18 @@ Writer& OutRTF_SwSectionNode( Writer& rWrt, SwSectionNode& rNode ) OutRTF_SwFmtCol( rWrt, *pItem ); else { - rWrt.Strm() << sRTF_COLS << '1' << sRTF_COLSX; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLS << '1' << OOO_STRING_SVTOOLS_RTF_COLSX; rWrt.OutULong(709); } if( SFX_ITEM_SET == rSet.GetItemState( RES_COLUMNBALANCE, false, &pItem ) && ((SwFmtNoBalancedColumns*)pItem)->GetValue() ) - OutComment( rWrt, sRTF_BALANCEDCOLUMN ) << '}'; + OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_BALANCEDCOLUMN ) << '}'; if (FRMDIR_HORI_RIGHT_TOP == rRTFWrt.TrueFrameDirection(*pFmt)) - rWrt.Strm() << sRTF_RTLSECT; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_RTLSECT; else - rWrt.Strm() << sRTF_LTRSECT; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LTRSECT; rWrt.Strm() << SwRTFWriter::sNewLine; } @@ -2178,10 +2178,10 @@ static Writer& OutRTF_SwFont( Writer& rWrt, const SfxPoolItem& rHt ) */ if (rRTFWrt.bTxtAttr && (rFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL)) { - const sal_Char* pCmd = !bAssoc ? sRTF_AF : sRTF_F; + const sal_Char* pCmd = !bAssoc ? OOO_STRING_SVTOOLS_RTF_AF : OOO_STRING_SVTOOLS_RTF_F; rWrt.Strm() << pCmd; } - const sal_Char* pCmd = bAssoc ? sRTF_AF : sRTF_F; + const sal_Char* pCmd = bAssoc ? OOO_STRING_SVTOOLS_RTF_AF : OOO_STRING_SVTOOLS_RTF_F; rWrt.Strm() << pCmd; rWrt.OutULong(rRTFWrt.GetId(rFont)); rRTFWrt.eCurrentEncoding = rtl_getTextEncodingFromWindowsCharset(sw::ms::rtl_TextEncodingToWinCharset(rFont.GetCharSet())); @@ -2213,7 +2213,7 @@ static Writer& OutRTF_SwPosture( Writer& rWrt, const SfxPoolItem& rHt ) if( ITALIC_NORMAL == nPosture || bTxtOut ) { rRTFWrt.bOutFmtAttr = TRUE; - const sal_Char* pCmd = rRTFWrt.IsAssociatedFlag() ? sRTF_AI : sRTF_I; + const sal_Char* pCmd = rRTFWrt.IsAssociatedFlag() ? OOO_STRING_SVTOOLS_RTF_AI : OOO_STRING_SVTOOLS_RTF_I; rWrt.Strm() << pCmd; } if( bTxtOut ) @@ -2246,7 +2246,7 @@ static Writer& OutRTF_SwWeight( Writer& rWrt, const SfxPoolItem& rHt ) if( WEIGHT_BOLD == nBold || bTxtOut ) { rRTFWrt.bOutFmtAttr = TRUE; - const sal_Char* pCmd = rRTFWrt.IsAssociatedFlag() ? sRTF_AB : sRTF_B; + const sal_Char* pCmd = rRTFWrt.IsAssociatedFlag() ? OOO_STRING_SVTOOLS_RTF_AB : OOO_STRING_SVTOOLS_RTF_B; rWrt.Strm() << pCmd; } if( bTxtOut ) @@ -2261,9 +2261,9 @@ static Writer& OutRTF_SwEmphasisMark( Writer& rWrt, const SfxPoolItem& rHt ) const sal_Char* pStr; switch( ((const SvxEmphasisMarkItem&)rHt).GetEmphasisMark()) { - case EMPHASISMARK_NONE: pStr = sRTF_ACCNONE; break; - case EMPHASISMARK_SIDE_DOTS: pStr = sRTF_ACCCOMMA; break; - default: pStr = sRTF_ACCDOT; break; + case EMPHASISMARK_NONE: pStr = OOO_STRING_SVTOOLS_RTF_ACCNONE; break; + case EMPHASISMARK_SIDE_DOTS: pStr = OOO_STRING_SVTOOLS_RTF_ACCCOMMA; break; + default: pStr = OOO_STRING_SVTOOLS_RTF_ACCDOT; break; } rRTFWrt.bOutFmtAttr = TRUE; @@ -2292,7 +2292,7 @@ static Writer& OutRTF_SwTwoInOne( Writer& rWrt, const SfxPoolItem& rHt ) else // all other kind of brackets nType = 1; - rWrt.Strm() << sRTF_TWOINONE; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TWOINONE; rWrt.OutULong( nType ); rRTFWrt.bOutFmtAttr = TRUE; } @@ -2303,7 +2303,7 @@ static Writer& OutRTF_SwCharRotate( Writer& rWrt, const SfxPoolItem& rHt ) { SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_HORZVERT; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_HORZVERT; rWrt.OutLong( ((SvxCharRotateItem&)rHt).IsFitToLine() ? 1 : 0 ); return rWrt; } @@ -2311,7 +2311,7 @@ static Writer& OutRTF_SwCharScaleW( Writer& rWrt, const SfxPoolItem& rHt ) { SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_CHARSCALEX; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CHARSCALEX; rWrt.OutLong( ((SvxCharScaleWidthItem&)rHt).GetValue() ); return rWrt; } @@ -2324,10 +2324,10 @@ static Writer& OutRTF_SwCharRelief(Writer& rWrt, const SfxPoolItem& rHt) switch (rAttr.GetValue()) { case RELIEF_EMBOSSED: - pStr = sRTF_EMBO; + pStr = OOO_STRING_SVTOOLS_RTF_EMBO; break; case RELIEF_ENGRAVED: - pStr = sRTF_IMPR; + pStr = OOO_STRING_SVTOOLS_RTF_IMPR; break; default: pStr = 0; @@ -2349,7 +2349,7 @@ static Writer& OutRTF_SwChrBckgrnd( Writer& rWrt, const SfxPoolItem& rHt ) const SvxBrushItem& rBack = (const SvxBrushItem&)rHt; if( !rBack.GetColor().GetTransparency() ) { - ByteString sOut( sRTF_CHCBPAT ); + ByteString sOut( OOO_STRING_SVTOOLS_RTF_CHCBPAT ); sOut += ByteString::CreateFromInt32( rRTFWrt.GetId( rBack.GetColor() )); @@ -2367,7 +2367,7 @@ static Writer& OutRTF_SwShadowed( Writer& rWrt, const SfxPoolItem& rHt ) if( bShadow || bTxtOut ) { rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_SHAD; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_SHAD; } if( bTxtOut ) rWrt.Strm() << '0'; @@ -2384,7 +2384,7 @@ static Writer& OutRTF_SwContour( Writer& rWrt, const SfxPoolItem& rHt ) if( bContour || bTxtOut ) { rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_OUTL; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_OUTL; } if( bTxtOut ) rWrt.Strm() << '0'; @@ -2402,12 +2402,12 @@ static Writer& OutRTF_SwCrossedOut( Writer& rWrt, const SfxPoolItem& rHt ) rRTFWrt.bOutFmtAttr = TRUE; if( STRIKEOUT_DOUBLE == nStrike ) { - rWrt.Strm() << sRTF_STRIKED; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_STRIKED; if( !bTxtOut ) rWrt.Strm() << '1'; } else - rWrt.Strm() << sRTF_STRIKE; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_STRIKE; } if( bTxtOut ) rWrt.Strm() << '0'; @@ -2422,15 +2422,15 @@ static Writer& OutRTF_SwCaseMap( Writer& rWrt, const SfxPoolItem& rHt ) switch( ((const SvxCaseMapItem&)rHt).GetValue() ) { case SVX_CASEMAP_KAPITAELCHEN: - rWrt.Strm() << sRTF_SCAPS; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_SCAPS; break; case SVX_CASEMAP_VERSALIEN: - rWrt.Strm() << sRTF_CAPS; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CAPS; break; case SVX_CASEMAP_NOT_MAPPED: - rWrt.Strm() << sRTF_CAPS << '0' << sRTF_SCAPS << '0'; // beide aus !! + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CAPS << '0' << OOO_STRING_SVTOOLS_RTF_SCAPS << '0'; // beide aus !! break; default: @@ -2448,55 +2448,55 @@ static Writer& OutRTF_SwUnderline( Writer& rWrt, const SfxPoolItem& rHt ) switch( ((const SvxUnderlineItem&)rHt).GetLineStyle() ) { case UNDERLINE_SINGLE: - pStr = sRTF_UL; + pStr = OOO_STRING_SVTOOLS_RTF_UL; break; case UNDERLINE_DOUBLE: - pStr = sRTF_ULDB; + pStr = OOO_STRING_SVTOOLS_RTF_ULDB; break; case UNDERLINE_NONE: - pStr = sRTF_ULNONE; + pStr = OOO_STRING_SVTOOLS_RTF_ULNONE; break; case UNDERLINE_DOTTED: - pStr = sRTF_ULD; + pStr = OOO_STRING_SVTOOLS_RTF_ULD; break; case UNDERLINE_DASH: - pStr = sRTF_ULDASH; + pStr = OOO_STRING_SVTOOLS_RTF_ULDASH; break; case UNDERLINE_DASHDOT: - pStr = sRTF_ULDASHD; + pStr = OOO_STRING_SVTOOLS_RTF_ULDASHD; break; case UNDERLINE_DASHDOTDOT: - pStr = sRTF_ULDASHDD; + pStr = OOO_STRING_SVTOOLS_RTF_ULDASHDD; break; case UNDERLINE_BOLD: - pStr = sRTF_ULTH; + pStr = OOO_STRING_SVTOOLS_RTF_ULTH; break; case UNDERLINE_WAVE: - pStr = sRTF_ULWAVE; + pStr = OOO_STRING_SVTOOLS_RTF_ULWAVE; break; case UNDERLINE_BOLDDOTTED: - pStr = sRTF_ULTHD; + pStr = OOO_STRING_SVTOOLS_RTF_ULTHD; break; case UNDERLINE_BOLDDASH: - pStr = sRTF_ULTHDASH; + pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASH; break; case UNDERLINE_LONGDASH: - pStr = sRTF_ULLDASH; + pStr = OOO_STRING_SVTOOLS_RTF_ULLDASH; break; case UNDERLINE_BOLDLONGDASH: - pStr = sRTF_ULTHLDASH; + pStr = OOO_STRING_SVTOOLS_RTF_ULTHLDASH; break; case UNDERLINE_BOLDDASHDOT: - pStr = sRTF_ULTHDASHD; + pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASHD; break; case UNDERLINE_BOLDDASHDOTDOT: - pStr = sRTF_ULTHDASHDD; + pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASHDD; break; case UNDERLINE_BOLDWAVE: - pStr = sRTF_ULHWAVE; + pStr = OOO_STRING_SVTOOLS_RTF_ULHWAVE; break; case UNDERLINE_DOUBLEWAVE: - pStr = sRTF_ULULDBWAVE; + pStr = OOO_STRING_SVTOOLS_RTF_ULULDBWAVE; break; default: break; @@ -2509,12 +2509,12 @@ static Writer& OutRTF_SwUnderline( Writer& rWrt, const SfxPoolItem& rHt ) if( UNDERLINE_SINGLE == ((const SvxUnderlineItem&)rHt).GetLineStyle() && ((SvxWordLineModeItem&)rRTFWrt.GetItem( RES_CHRATR_WORDLINEMODE )).GetValue() ) - pStr = sRTF_ULW; + pStr = OOO_STRING_SVTOOLS_RTF_ULW; rRTFWrt.Strm() << pStr; rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_ULC; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_ULC; rWrt.OutULong( rRTFWrt.GetId(((const SvxUnderlineItem&)rHt).GetColor()) ); } @@ -2530,55 +2530,55 @@ static Writer& OutRTF_SwOverline( Writer& rWrt, const SfxPoolItem& rHt ) switch( ((const SvxOverlineItem&)rHt).GetLineStyle() ) { case UNDERLINE_SINGLE: - pStr = sRTF_OL; + pStr = OOO_STRING_SVTOOLS_RTF_OL; break; case UNDERLINE_DOUBLE: - pStr = sRTF_OLDB; + pStr = OOO_STRING_SVTOOLS_RTF_OLDB; break; case UNDERLINE_NONE: - pStr = sRTF_OLNONE; + pStr = OOO_STRING_SVTOOLS_RTF_OLNONE; break; case UNDERLINE_DOTTED: - pStr = sRTF_OLD; + pStr = OOO_STRING_SVTOOLS_RTF_OLD; break; case UNDERLINE_DASH: - pStr = sRTF_OLDASH; + pStr = OOO_STRING_SVTOOLS_RTF_OLDASH; break; case UNDERLINE_DASHDOT: - pStr = sRTF_OLDASHD; + pStr = OOO_STRING_SVTOOLS_RTF_OLDASHD; break; case UNDERLINE_DASHDOTDOT: - pStr = sRTF_OLDASHDD; + pStr = OOO_STRING_SVTOOLS_RTF_OLDASHDD; break; case UNDERLINE_BOLD: - pStr = sRTF_OLTH; + pStr = OOO_STRING_SVTOOLS_RTF_OLTH; break; case UNDERLINE_WAVE: - pStr = sRTF_OLWAVE; + pStr = OOO_STRING_SVTOOLS_RTF_OLWAVE; break; case UNDERLINE_BOLDDOTTED: - pStr = sRTF_OLTHD; + pStr = OOO_STRING_SVTOOLS_RTF_OLTHD; break; case UNDERLINE_BOLDDASH: - pStr = sRTF_OLTHDASH; + pStr = OOO_STRING_SVTOOLS_RTF_OLTHDASH; break; case UNDERLINE_LONGDASH: - pStr = sRTF_OLLDASH; + pStr = OOO_STRING_SVTOOLS_RTF_OLLDASH; break; case UNDERLINE_BOLDLONGDASH: - pStr = sRTF_OLTHLDASH; + pStr = OOO_STRING_SVTOOLS_RTF_OLTHLDASH; break; case UNDERLINE_BOLDDASHDOT: - pStr = sRTF_OLTHDASHD; + pStr = OOO_STRING_SVTOOLS_RTF_OLTHDASHD; break; case UNDERLINE_BOLDDASHDOTDOT: - pStr = sRTF_OLTHDASHDD; + pStr = OOO_STRING_SVTOOLS_RTF_OLTHDASHDD; break; case UNDERLINE_BOLDWAVE: - pStr = sRTF_OLHWAVE; + pStr = OOO_STRING_SVTOOLS_RTF_OLHWAVE; break; case UNDERLINE_DOUBLEWAVE: - pStr = sRTF_OLOLDBWAVE; + pStr = OOO_STRING_SVTOOLS_RTF_OLOLDBWAVE; break; default: break; @@ -2592,12 +2592,12 @@ static Writer& OutRTF_SwOverline( Writer& rWrt, const SfxPoolItem& rHt ) if( UNDERLINE_SINGLE == ((const SvxOverlineItem&)rHt).GetLineStyle() && ((SvxWordLineModeItem&)rRTFWrt.GetItem( RES_CHRATR_WORDLINEMODE )).GetValue() ) - pStr = sRTF_OLW; + pStr = OOO_STRING_SVTOOLS_RTF_OLW; rRTFWrt.Strm() << pStr; rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_OLC; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_OLC; rWrt.OutULong( rRTFWrt.GetId(((const SvxOverlineItem&)rHt).GetColor()) ); } @@ -2618,7 +2618,7 @@ static Writer& OutRTF_SwLanguage( Writer& rWrt, const SfxPoolItem& rHt ) rRTFWrt.bOutFmtAttr = TRUE; const sal_Char* p = RES_CHRATR_CJK_LANGUAGE == rHt.Which() - ? sRTF_LANGFE : sRTF_LANG; + ? OOO_STRING_SVTOOLS_RTF_LANGFE : OOO_STRING_SVTOOLS_RTF_LANG; rWrt.Strm() << p; rWrt.OutULong( ((const SvxLanguageItem&)rHt).GetLanguage() ); } @@ -2637,10 +2637,10 @@ static Writer& OutRTF_SwEscapement( Writer& rWrt, const SfxPoolItem& rHt ) RES_CHRATR_FONTSIZE )).GetHeight(); if( 0 < rEsc.GetEsc() ) - pUpDn = sRTF_UP; + pUpDn = OOO_STRING_SVTOOLS_RTF_UP; else if( 0 > rEsc.GetEsc() ) { - pUpDn = sRTF_DN; + pUpDn = OOO_STRING_SVTOOLS_RTF_DN; nH = -nH; // den negativen Wert herrausrechnen } else @@ -2660,7 +2660,7 @@ static Writer& OutRTF_SwEscapement( Writer& rWrt, const SfxPoolItem& rHt ) ++nProp; } - OutComment( rWrt, sRTF_UPDNPROP, TRUE ); + OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_UPDNPROP, TRUE ); rWrt.OutULong( nProp ) << '}' << pUpDn; /* @@ -2702,7 +2702,7 @@ static Writer& OutRTF_SwSize( Writer& rWrt, const SfxPoolItem& rHt ) rRTFWrt.bOutFmtAttr = TRUE; - const sal_Char* pCmd = rRTFWrt.IsAssociatedFlag() ? sRTF_AFS : sRTF_FS; + const sal_Char* pCmd = rRTFWrt.IsAssociatedFlag() ? OOO_STRING_SVTOOLS_RTF_AFS : OOO_STRING_SVTOOLS_RTF_FS; rWrt.Strm() << pCmd; rWrt.OutULong( ((const SvxFontHeightItem&)rHt).GetHeight() / 10 ); } @@ -2719,7 +2719,7 @@ static Writer& OutRTF_SwColor( Writer& rWrt, const SfxPoolItem& rHt ) * Tabelle im RTF-Dokument referenziert. */ rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_CF; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CF; rWrt.OutULong( rRTFWrt.GetId( ((const SvxColorItem&)rHt).GetValue() )); return rWrt; } @@ -2728,7 +2728,7 @@ static Writer& OutRTF_SvxCharHiddenItem(Writer& rWrt, const SfxPoolItem& rHt) { SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; rRTFWrt.bOutFmtAttr = true; - rWrt.Strm() << sRTF_V; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_V; if (!((const SvxCharHiddenItem&)rHt).GetValue()) rWrt.OutULong(0); return rWrt; @@ -2745,7 +2745,7 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt ) const SwField* pFld = rFld.GetFld(); ByteString aFldStt( '{' ); - ((((aFldStt += sRTF_FIELD) += '{' ) += sRTF_IGNORE) += sRTF_FLDINST) += ' '; + ((((aFldStt += OOO_STRING_SVTOOLS_RTF_FIELD) += '{' ) += OOO_STRING_SVTOOLS_RTF_IGNORE) += OOO_STRING_SVTOOLS_RTF_FLDINST) += ' '; switch( pFld->GetTyp()->Which() ) { case RES_COMBINED_CHARS: @@ -2895,7 +2895,7 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt ) rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); else { - rWrt.Strm() << '{' << sRTF_V << ' '; + rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_V << ' '; OutRTF_AsByteString( rWrt, pFld->GetPar2(), rRTFWrt.eDefaultEncoding ).Strm() << '}' << SwRTFWriter::sNewLine; } @@ -2955,7 +2955,7 @@ static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt ) if( aFldStt.Len() ) { - rWrt.Strm() << "}{" << sRTF_FLDRSLT << ' '; + rWrt.Strm() << "}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << ' '; RTFOutFuncs::Out_String( rWrt.Strm(), pFld->Expand(), rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); rWrt.Strm() << "}}"; @@ -2993,21 +2993,21 @@ static Writer& OutRTF_SwFtn( Writer& rWrt, const SfxPoolItem& rHt ) if( nStart >= nEnd ) break; - rWrt.Strm() << '{' << sRTF_SUPER << ' '; + rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_SUPER << ' '; if( !rFtn.GetNumStr().Len() ) { - rWrt.Strm() << sRTF_CHFTN; - OutComment( rWrt, sRTF_FOOTNOTE ); + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CHFTN; + OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_FOOTNOTE ); if( rFtn.IsEndNote() ) - rWrt.Strm() << sRTF_FTNALT; - rWrt.Strm() << ' ' << sRTF_CHFTN; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FTNALT; + rWrt.Strm() << ' ' << OOO_STRING_SVTOOLS_RTF_CHFTN; } else { OutRTF_AsByteString( rWrt, rFtn.GetNumStr(), rRTFWrt.eDefaultEncoding ); - OutComment( rWrt, sRTF_FOOTNOTE ); + OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_FOOTNOTE ); if( rFtn.IsEndNote() ) - rWrt.Strm() << sRTF_FTNALT; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FTNALT; rWrt.Strm() << ' '; OutRTF_AsByteString( rWrt, rFtn.GetNumStr(), rRTFWrt.eDefaultEncoding ); } @@ -3116,7 +3116,7 @@ static Writer& OutRTF_SwTxtRuby( Writer& rWrt, const SfxPoolItem& rHt ) ( nHeight += 5 ) /= 10; // don't change " EQ " to any other without changing the code in RTFFLD.CXX - rWrt.Strm() << '{' << sRTF_FIELD << '{' << sRTF_IGNORE << sRTF_FLDINST + rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_FIELD << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_FLDINST << " EQ \\\\* jc" << cJC << " \\\\* \"Font:"; RTFOutFuncs::Out_String( rWrt.Strm(), pFont->GetFamilyName(), @@ -3172,7 +3172,7 @@ static Writer& OutRTF_SwFrmSize( Writer& rWrt, const SfxPoolItem& rHt ) if( rSz.GetWidth() ) { - rWrt.Strm() << sRTF_ABSW; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_ABSW; rWrt.OutLong( rSz.GetWidth() ); rRTFWrt.bOutFmtAttr = TRUE; } @@ -3182,16 +3182,16 @@ static Writer& OutRTF_SwFrmSize( Writer& rWrt, const SfxPoolItem& rHt ) long nH = rSz.GetHeight(); if( ATT_FIX_SIZE == rSz.GetHeightSizeType() ) nH = -nH; - rWrt.Strm() << sRTF_ABSH; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_ABSH; rWrt.OutLong( nH ); rRTFWrt.bOutFmtAttr = TRUE; } } else if( rRTFWrt.bOutPageDesc ) { - rWrt.Strm() << sRTF_PGWSXN; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PGWSXN; rWrt.OutLong( rSz.GetWidth() ); - rWrt.Strm() << sRTF_PGHSXN; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PGHSXN; rWrt.OutLong( rSz.GetHeight() ); rRTFWrt.bOutFmtAttr = TRUE; } @@ -3208,13 +3208,13 @@ static Writer& OutRTF_SwFmtLRSpace( Writer& rWrt, const SfxPoolItem& rHt ) { if( rLR.GetLeft() ) { - rWrt.Strm() << sRTF_MARGLSXN; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_MARGLSXN; rWrt.OutLong( rLR.GetLeft() ); rRTFWrt.bOutFmtAttr = TRUE; } if( rLR.GetRight() ) { - rWrt.Strm() << sRTF_MARGRSXN; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_MARGRSXN; rWrt.OutLong( rLR.GetRight() ); rRTFWrt.bOutFmtAttr = TRUE; } @@ -3222,20 +3222,20 @@ static Writer& OutRTF_SwFmtLRSpace( Writer& rWrt, const SfxPoolItem& rHt ) else { rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_LI; - rWrt.OutLong( rLR.GetTxtLeft() ) << sRTF_RI; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LI; + rWrt.OutLong( rLR.GetTxtLeft() ) << OOO_STRING_SVTOOLS_RTF_RI; rWrt.OutLong( rLR.GetRight() ); - rWrt.Strm() << sRTF_LIN; - rWrt.OutLong( rLR.GetTxtLeft() ) << sRTF_RIN; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LIN; + rWrt.OutLong( rLR.GetTxtLeft() ) << OOO_STRING_SVTOOLS_RTF_RIN; rWrt.OutLong( rLR.GetRight() ); - rWrt.Strm() << sRTF_FI; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FI; rWrt.OutLong( rLR.GetTxtFirstLineOfst() ); } } else if( rLR.GetLeft() == rLR.GetRight() && rRTFWrt.bRTFFlySyntax ) { rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_DFRMTXTX; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_DFRMTXTX; rWrt.OutLong( rLR.GetLeft() ); } return rWrt; @@ -3250,7 +3250,7 @@ static Writer& OutRTF_SwFmtULSpace( Writer& rWrt, const SfxPoolItem& rHt ) if( rUL.GetUpper() == rUL.GetLower() && rRTFWrt.bRTFFlySyntax ) { rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_DFRMTXTY; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_DFRMTXTY; rWrt.OutLong( rUL.GetLower() ); } } @@ -3260,7 +3260,7 @@ static Writer& OutRTF_SwFmtULSpace( Writer& rWrt, const SfxPoolItem& rHt ) USHORT nValue = rUL.GetUpper(); if( rRTFWrt.bOutPageDesc ) { - p = sRTF_MARGTSXN; + p = OOO_STRING_SVTOOLS_RTF_MARGTSXN; if( !rRTFWrt.bOutPageDescTbl ) { SwRect aRect; @@ -3285,7 +3285,7 @@ static Writer& OutRTF_SwFmtULSpace( Writer& rWrt, const SfxPoolItem& rHt ) } } else - p = sRTF_SB; + p = OOO_STRING_SVTOOLS_RTF_SB; if( rRTFWrt.bOutPageDesc || nValue ) { @@ -3298,7 +3298,7 @@ static Writer& OutRTF_SwFmtULSpace( Writer& rWrt, const SfxPoolItem& rHt ) nValue = rUL.GetLower(); if( rRTFWrt.bOutPageDesc ) { - p = sRTF_MARGBSXN; + p = OOO_STRING_SVTOOLS_RTF_MARGBSXN; if( !rRTFWrt.bOutPageDescTbl ) { SwRect aRect; @@ -3323,7 +3323,7 @@ static Writer& OutRTF_SwFmtULSpace( Writer& rWrt, const SfxPoolItem& rHt ) } } else - p = sRTF_SA; + p = OOO_STRING_SVTOOLS_RTF_SA; if( rRTFWrt.bOutPageDesc || nValue ) { @@ -3365,7 +3365,7 @@ Writer& OutRTF_SwFmtHeader( Writer& rWrt, const SfxPoolItem& rHt ) break; ASSERT( rRTFWrt.pAktPageDesc, "Header-Attribut ohne PageDesc" ); - const sal_Char * pHdNm = sRTF_HEADER; + const sal_Char * pHdNm = OOO_STRING_SVTOOLS_RTF_HEADER; rWrt.Strm() << pHdNm << 'y'; if( rRTFWrt.bOutPageDescTbl ) { @@ -3393,12 +3393,12 @@ Writer& OutRTF_SwFmtHeader( Writer& rWrt, const SfxPoolItem& rHt ) if( rRTFWrt.pAktPageDesc->GetFollow() && rRTFWrt.pAktPageDesc->GetFollow() != rRTFWrt.pAktPageDesc ) { - rWrt.Strm() << sRTF_TITLEPG; //i13107 + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TITLEPG; //i13107 cTyp = 'f'; // dann FirstPage-Header } else if( !rRTFWrt.pAktPageDesc->IsHeaderShared() ) { - rWrt.Strm() << sRTF_FACINGP; //i13107 + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FACINGP; //i13107 cTyp = rRTFWrt.bOutLeftHeadFoot ? 'l' : 'r'; } @@ -3445,7 +3445,7 @@ Writer& OutRTF_SwFmtFooter( Writer& rWrt, const SfxPoolItem& rHt ) break; ASSERT( rRTFWrt.pAktPageDesc, "Footer-Attribut ohne PageDesc" ); - const sal_Char * pFtNm = sRTF_FOOTER; + const sal_Char * pFtNm = OOO_STRING_SVTOOLS_RTF_FOOTER; rWrt.Strm() << pFtNm << 'y'; if( rRTFWrt.bOutPageDescTbl ) { @@ -3473,12 +3473,12 @@ Writer& OutRTF_SwFmtFooter( Writer& rWrt, const SfxPoolItem& rHt ) if( !rRTFWrt.bOutPageDesc && rRTFWrt.pAktPageDesc->GetFollow() && rRTFWrt.pAktPageDesc->GetFollow() != rRTFWrt.pAktPageDesc ) { - rWrt.Strm() << sRTF_TITLEPG; //i13107 + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TITLEPG; //i13107 cTyp = 'f'; // dann FirstPage-Header } else if( !rRTFWrt.pAktPageDesc->IsFooterShared() ) { - rWrt.Strm() << sRTF_FACINGP; //i13107 + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FACINGP; //i13107 cTyp = rRTFWrt.bOutLeftHeadFoot ? 'l' : 'r'; } @@ -3503,7 +3503,7 @@ static Writer& OutRTF_SwFmtPrint( Writer& rWrt, const SfxPoolItem& rHt ) if( !rRTFWrt.bRTFFlySyntax && !((const SvxPrintItem&)rHt).GetValue() ) { rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_FLYPRINT; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYPRINT; } return rWrt; } @@ -3515,7 +3515,7 @@ static Writer& OutRTF_SwFmtOpaque( Writer& rWrt, const SfxPoolItem& rHt ) if( !rRTFWrt.bRTFFlySyntax && !((const SvxOpaqueItem&)rHt).GetValue() ) { rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_FLYOPAQUE; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYOPAQUE; } return rWrt; } @@ -3531,7 +3531,7 @@ static Writer& OutRTF_SwFmtProtect( Writer& rWrt, const SfxPoolItem& rHt ) rFlyProtect.IsSizeProtected(), rFlyProtect.IsPosProtected() ); rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_FLYPRTCTD; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYPRTCTD; rWrt.OutULong( aP.GetValue() ); } return rWrt; @@ -3547,7 +3547,7 @@ static Writer& OutRTF_SwFmtSurround( Writer& rWrt, const SfxPoolItem& rHt ) if( SURROUND_NONE == rFlySurround.GetSurround() ) { rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_NOWRAP; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_NOWRAP; } } else @@ -3557,7 +3557,7 @@ static Writer& OutRTF_SwFmtSurround( Writer& rWrt, const SfxPoolItem& rHt ) if( bGold ) eSurround = SURROUND_PARALLEL; RTFSurround aMC( bGold, static_cast< BYTE >(eSurround) ); - rWrt.Strm() << sRTF_FLYMAINCNT; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYMAINCNT; rWrt.OutULong( aMC.GetValue() ); rRTFWrt.bOutFmtAttr = TRUE; } @@ -3579,30 +3579,30 @@ static Writer& OutRTF_SwFmtVertOrient ( Writer& rWrt, const SfxPoolItem& rHt ) if( FLY_PAGE == eAnchor ) { if( text::RelOrientation::PAGE_FRAME == eOrient || text::RelOrientation::FRAME == eOrient ) - pOrient = sRTF_PVPG; + pOrient = OOO_STRING_SVTOOLS_RTF_PVPG; else - pOrient = sRTF_PVMRG; + pOrient = OOO_STRING_SVTOOLS_RTF_PVMRG; } else - pOrient = sRTF_PVPARA; + pOrient = OOO_STRING_SVTOOLS_RTF_PVPARA; rWrt.Strm() << pOrient; switch (rFlyVert.GetVertOrient()) { case text::VertOrientation::TOP: case text::VertOrientation::LINE_TOP: - rWrt.Strm() << sRTF_POSYT; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_POSYT; break; case text::VertOrientation::BOTTOM: case text::VertOrientation::LINE_BOTTOM: - rWrt.Strm() << sRTF_POSYB; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_POSYB; break; case text::VertOrientation::CENTER: case text::VertOrientation::LINE_CENTER: - rWrt.Strm() << sRTF_POSYC; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_POSYC; break; case text::VertOrientation::NONE: - rWrt.Strm() << sRTF_POSY; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_POSY; rWrt.OutULong(rFlyVert.GetPos()); break; default: @@ -3612,7 +3612,7 @@ static Writer& OutRTF_SwFmtVertOrient ( Writer& rWrt, const SfxPoolItem& rHt ) else if( !rRTFWrt.bRTFFlySyntax ) { rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_FLYVERT; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYVERT; rWrt.OutULong( aVO.GetValue() ); } @@ -3635,28 +3635,28 @@ static Writer& OutRTF_SwFmtHoriOrient( Writer& rWrt, const SfxPoolItem& rHt ) if( FLY_PAGE == eAnchor ) { if( text::RelOrientation::PAGE_FRAME == eOrient || text::RelOrientation::FRAME == eOrient ) - pS = sRTF_PHPG; + pS = OOO_STRING_SVTOOLS_RTF_PHPG; else - pS = sRTF_PHMRG; + pS = OOO_STRING_SVTOOLS_RTF_PHMRG; } else - pS = sRTF_PHCOL; + pS = OOO_STRING_SVTOOLS_RTF_PHCOL; rWrt.Strm() << pS; pS = 0; switch(rFlyHori.GetHoriOrient()) { case text::HoriOrientation::RIGHT: - pS = rFlyHori.IsPosToggle() ? sRTF_POSXO : sRTF_POSXR; + pS = rFlyHori.IsPosToggle() ? OOO_STRING_SVTOOLS_RTF_POSXO : OOO_STRING_SVTOOLS_RTF_POSXR; break; case text::HoriOrientation::LEFT: - pS = rFlyHori.IsPosToggle() ? sRTF_POSXI : sRTF_POSXL; + pS = rFlyHori.IsPosToggle() ? OOO_STRING_SVTOOLS_RTF_POSXI : OOO_STRING_SVTOOLS_RTF_POSXL; break; case text::HoriOrientation::CENTER: - pS = sRTF_POSXC; + pS = OOO_STRING_SVTOOLS_RTF_POSXC; break; case text::HoriOrientation::NONE: - rWrt.Strm() << sRTF_POSX; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_POSX; rWrt.OutULong( rFlyHori.GetPos() ); break; default: @@ -3668,7 +3668,7 @@ static Writer& OutRTF_SwFmtHoriOrient( Writer& rWrt, const SfxPoolItem& rHt ) else { rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_FLYHORZ; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYHORZ; rWrt.OutULong( aHO.GetValue() ); } return rWrt; @@ -3681,18 +3681,18 @@ static Writer& OutRTF_SwFmtAnchor( Writer& rWrt, const SfxPoolItem& rHt ) { const SwFmtAnchor& rAnchor = (const SwFmtAnchor&) rHt; USHORT nId = static_cast< USHORT >(rAnchor.GetAnchorId()); - rWrt.Strm() << sRTF_FLYANCHOR; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYANCHOR; rWrt.OutULong( nId ); rRTFWrt.bOutFmtAttr = TRUE; switch( nId ) { case FLY_PAGE: - rWrt.Strm() << sRTF_FLYPAGE; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYPAGE; rWrt.OutULong( rAnchor.GetPageNum() ); break; case FLY_AT_CNTNT: case FLY_IN_CNTNT: - rWrt.Strm() << sRTF_FLYCNTNT; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYCNTNT; break; } } @@ -3711,7 +3711,7 @@ static Writer& OutRTF_SwFmtBackground( Writer& rWrt, const SfxPoolItem& rHt ) const SvxBrushItem& rBack = (const SvxBrushItem&)rHt; if( !rBack.GetColor().GetTransparency() ) { - ByteString sOut( sRTF_CBPAT ); + ByteString sOut( OOO_STRING_SVTOOLS_RTF_CBPAT ); sOut += ByteString::CreateFromInt32( rRTFWrt.GetId( rBack.GetColor() )); @@ -3740,12 +3740,12 @@ static Writer& OutRTF_SwFmtShadow( Writer& rWrt, const SfxPoolItem& rHt ) const SvxShadowItem& rShadow = (const SvxShadowItem&)rHt; // FALSE wegen schliessender Klammer !! - OutComment( rWrt, sRTF_SHADOW, FALSE ); - rWrt.OutULong( rShadow.GetLocation() ) << sRTF_SHDWDIST; - rWrt.OutULong( rShadow.GetWidth() ) << sRTF_SHDWSTYLE; + OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_SHADOW, FALSE ); + rWrt.OutULong( rShadow.GetLocation() ) << OOO_STRING_SVTOOLS_RTF_SHDWDIST; + rWrt.OutULong( rShadow.GetWidth() ) << OOO_STRING_SVTOOLS_RTF_SHDWSTYLE; const Color& rColor = rShadow.GetColor(); rWrt.OutULong( rColor.GetTransparency() ? SW_SV_BRUSH_NULL : SW_SV_BRUSH_SOLID ); - rWrt.OutULong( rRTFWrt.GetId( rColor ) ) << sRTF_SHDWFCOL; + rWrt.OutULong( rRTFWrt.GetId( rColor ) ) << OOO_STRING_SVTOOLS_RTF_SHDWFCOL; rWrt.OutULong( 0 ) << '}'; return rWrt; } @@ -3754,10 +3754,10 @@ static Writer& OutRTF_SwFmtShadow( Writer& rWrt, const SfxPoolItem& rHt ) static void OutBorderLine( SwRTFWriter& rWrt, const SvxBorderLine* pLine, const char* pStr ) { - rWrt.Strm() << pStr << sRTF_BRDLNCOL; - rWrt.OutULong( rWrt.GetId( pLine->GetColor() ) ) << sRTF_BRDLNIN; - rWrt.OutULong( pLine->GetInWidth() ) << sRTF_BRDLNOUT; - rWrt.OutULong( pLine->GetOutWidth() ) << sRTF_BRDLNDIST; + rWrt.Strm() << pStr << OOO_STRING_SVTOOLS_RTF_BRDLNCOL; + rWrt.OutULong( rWrt.GetId( pLine->GetColor() ) ) << OOO_STRING_SVTOOLS_RTF_BRDLNIN; + rWrt.OutULong( pLine->GetInWidth() ) << OOO_STRING_SVTOOLS_RTF_BRDLNOUT; + rWrt.OutULong( pLine->GetOutWidth() ) << OOO_STRING_SVTOOLS_RTF_BRDLNDIST; rWrt.OutULong( pLine->GetDistance() ); } @@ -3775,7 +3775,7 @@ static Writer& OutRTF_SwFmtBox( Writer& rWrt, const SfxPoolItem& rHt ) #else static const sal_Char* __READONLY_DATA aBorderNames[] = { #endif - sRTF_BRDRT, sRTF_BRDRL, sRTF_BRDRB, sRTF_BRDRR }; + OOO_STRING_SVTOOLS_RTF_BRDRT, OOO_STRING_SVTOOLS_RTF_BRDRL, OOO_STRING_SVTOOLS_RTF_BRDRB, OOO_STRING_SVTOOLS_RTF_BRDRR }; USHORT nDist = rBox.GetDistance(); @@ -3791,13 +3791,13 @@ RTF kennt keine Rahmen Umrandung! *rBox.GetTop() == *rBox.GetBottom() && *rBox.GetTop() == *rBox.GetLeft() && *rBox.GetTop() == *rBox.GetRight() ) - OutBorderLine( rRTFWrt, rBox.GetTop(), sRTF_BOX, nDist ); + OutBorderLine( rRTFWrt, rBox.GetTop(), OOO_STRING_SVTOOLS_RTF_BOX, nDist ); else { - OUT_BRDLINE( rBox.GetTop(), sRTF_BRDRT, nDist ); - OUT_BRDLINE( rBox.GetBottom(), sRTF_BRDRB, nDist ); - OUT_BRDLINE( rBox.GetLeft(), sRTF_BRDRL, nDist ); - OUT_BRDLINE( rBox.GetRight(), sRTF_BRDRR, nDist ); + OUT_BRDLINE( rBox.GetTop(), OOO_STRING_SVTOOLS_RTF_BRDRT, nDist ); + OUT_BRDLINE( rBox.GetBottom(), OOO_STRING_SVTOOLS_RTF_BRDRB, nDist ); + OUT_BRDLINE( rBox.GetLeft(), OOO_STRING_SVTOOLS_RTF_BRDRL, nDist ); + OUT_BRDLINE( rBox.GetRight(), OOO_STRING_SVTOOLS_RTF_BRDRR, nDist ); } */ return rWrt; @@ -3814,7 +3814,7 @@ RTF kennt keine Rahmen Umrandung! nDist == rBox.GetDistance( BOX_LINE_LEFT ) && nDist == rBox.GetDistance( BOX_LINE_BOTTOM ) && nDist == rBox.GetDistance( BOX_LINE_RIGHT )) - OutBorderLine( rRTFWrt, rBox.GetTop(), sRTF_BOX, nDist ); + OutBorderLine( rRTFWrt, rBox.GetTop(), OOO_STRING_SVTOOLS_RTF_BOX, nDist ); else { const USHORT* pBrd = aBorders; @@ -3837,9 +3837,9 @@ RTF kennt keine Rahmen Umrandung! const SvxBorderLine* pLn = rBox.GetLine( *pBrd ); if( pLn ) { - rWrt.Strm() << '{' << sRTF_IGNORE; + rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE; OutBorderLine( rRTFWrt, pLn, *pBrdNms ); - rWrt.Strm() << '}' << sRTF_BRSP; + rWrt.Strm() << '}' << OOO_STRING_SVTOOLS_RTF_BRSP; rWrt.OutULong( rBox.GetDistance( *pBrd )); } } @@ -3876,25 +3876,25 @@ static Writer& OutRTF_SwFmtCol( Writer& rWrt, const SfxPoolItem& rHt ) USHORT nPageSize = static_cast< USHORT >( pFmt->GetFrmSize().GetWidth() - rLR.GetLeft() - rLR.GetRight() ); - rWrt.Strm() << sRTF_COLS; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLS; rWrt.OutLong( nCols ); if( rCol.IsOrtho() ) { - rWrt.Strm() << sRTF_COLSX; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLSX; rWrt.OutLong( rCol.GetGutterWidth( TRUE ) ); } else for( USHORT n = 0; n < nCols; ) { - rWrt.Strm() << sRTF_COLNO; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLNO; rWrt.OutLong( n+1 ); - rWrt.Strm() << sRTF_COLW; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLW; rWrt.OutLong( rCol.CalcPrtColWidth( n, nPageSize ) ); if( ++n != nCols ) { - rWrt.Strm() << sRTF_COLSR; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLSR; rWrt.OutLong( rColumns[ n-1 ]->GetRight() + rColumns[ n ]->GetLeft() ); } @@ -3909,7 +3909,7 @@ static Writer& OutRTF_SvxFmtKeep( Writer& rWrt, const SfxPoolItem& rHt ) const SvxFmtKeepItem& rItem = (const SvxFmtKeepItem&)rHt; if( rItem.GetValue() ) { - rWrt.Strm() << sRTF_KEEPN; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_KEEPN; ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; } return rWrt; @@ -3932,7 +3932,7 @@ static Writer& OutRTF_SwMirrorGrf( Writer& rWrt, const SfxPoolItem& rHt ) return rWrt; ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_IGNORE << sRTF_GRFMIRROR; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_GRFMIRROR; rWrt.OutULong( rMirror.GetValue() ); return rWrt; } @@ -3942,16 +3942,16 @@ static Writer& OutRTF_SwCropGrf( Writer& rWrt, const SfxPoolItem& rHt ) const SwCropGrf & rCrop = (const SwCropGrf&)rHt; ByteString aStr; if( rCrop.GetLeft() ) - ( aStr += sRTF_PICCROPL ) += + ( aStr += OOO_STRING_SVTOOLS_RTF_PICCROPL ) += ByteString::CreateFromInt32( (short)rCrop.GetLeft() ); if( rCrop.GetRight() ) - ( aStr += sRTF_PICCROPR ) += + ( aStr += OOO_STRING_SVTOOLS_RTF_PICCROPR ) += ByteString::CreateFromInt32( (short)rCrop.GetRight() ); if( rCrop.GetTop() ) - ( aStr += sRTF_PICCROPT ) += + ( aStr += OOO_STRING_SVTOOLS_RTF_PICCROPT ) += ByteString::CreateFromInt32( (short)rCrop.GetTop() ); if( rCrop.GetBottom() ) - ( aStr += sRTF_PICCROPB ) += + ( aStr += OOO_STRING_SVTOOLS_RTF_PICCROPB ) += ByteString::CreateFromInt32( (short)rCrop.GetBottom() ); if( aStr.Len() ) { @@ -3978,7 +3978,7 @@ static Writer& OutRTF_SwLineSpacing( Writer& rWrt, const SfxPoolItem& rHt ) case SVX_LINE_SPACE_MIN: { ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; - rWrt.Strm() << sRTF_SL; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_SL; sal_Char cMult = '0'; switch (rLs.GetInterLineSpaceRule()) { @@ -3997,7 +3997,7 @@ static Writer& OutRTF_SwLineSpacing( Writer& rWrt, const SfxPoolItem& rHt ) rWrt.OutLong( rLs.GetLineHeight() ); break; } - rWrt.Strm() << sRTF_SLMULT << cMult; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_SLMULT << cMult; } break; } @@ -4029,7 +4029,7 @@ static Writer& OutRTF_SvxFmtSplit( Writer& rWrt, const SfxPoolItem& rHt ) const SvxFmtSplitItem& rItem = (const SvxFmtSplitItem&)rHt; if( !rItem.GetValue() ) { - rWrt.Strm() << sRTF_KEEP; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_KEEP; ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; } return rWrt; @@ -4052,14 +4052,14 @@ static Writer& OutRTF_SwTabStop( Writer& rWrt, const SfxPoolItem& rHt ) case cDfltFillChar: break; - case '.': pFill = sRTF_TLDOT; break; - case '_': pFill = sRTF_TLUL; break; - case '-': pFill = sRTF_TLTH; break; - case '=': pFill = sRTF_TLEQ; break; + case '.': pFill = OOO_STRING_SVTOOLS_RTF_TLDOT; break; + case '_': pFill = OOO_STRING_SVTOOLS_RTF_TLUL; break; + case '-': pFill = OOO_STRING_SVTOOLS_RTF_TLTH; break; + case '=': pFill = OOO_STRING_SVTOOLS_RTF_TLEQ; break; default: if( !rRTFWrt.bWriteHelpFmt ) { - OutComment( rWrt, sRTF_TLSWG, FALSE ); + OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_TLSWG, FALSE ); rWrt.OutULong( (((USHORT)rTS.GetFill()) << 8 ) + rTS.GetDecimal() ) << '}'; @@ -4073,7 +4073,7 @@ static Writer& OutRTF_SwTabStop( Writer& rWrt, const SfxPoolItem& rHt ) rTS.GetDecimal() != ((SvxTabStopItem&)*GetDfltAttr( RES_PARATR_TABSTOP ))[ 0 ].GetDecimal() ) { - OutComment( rWrt, sRTF_TLSWG, FALSE ); + OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_TLSWG, FALSE ); rWrt.OutULong( (((USHORT)rTS.GetFill()) << 8 ) + rTS.GetDecimal() ) << '}'; } @@ -4082,20 +4082,20 @@ static Writer& OutRTF_SwTabStop( Writer& rWrt, const SfxPoolItem& rHt ) switch (rTS.GetAdjustment()) { case SVX_TAB_ADJUST_RIGHT: - pAdjStr = sRTF_TQR; + pAdjStr = OOO_STRING_SVTOOLS_RTF_TQR; break; case SVX_TAB_ADJUST_DECIMAL: - pAdjStr = sRTF_TQDEC; + pAdjStr = OOO_STRING_SVTOOLS_RTF_TQDEC; break; case SVX_TAB_ADJUST_CENTER: - pAdjStr = sRTF_TQC; + pAdjStr = OOO_STRING_SVTOOLS_RTF_TQC; break; default: break; } if (pAdjStr) rWrt.Strm() << pAdjStr; - rWrt.Strm() << sRTF_TX; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TX; rWrt.OutLong(rTS.GetTabPos() + nOffset); } } @@ -4111,10 +4111,10 @@ static Writer& OutRTF_SwHypenZone( Writer& rWrt, const SfxPoolItem& rHt ) USHORT nFlags = rAttr.IsHyphen() ? 1 : 0; if( rAttr.IsPageEnd() ) nFlags += 2; - OutComment( rWrt, sRTF_HYPHEN, FALSE ); - rWrt.OutULong( nFlags ) << sRTF_HYPHLEAD; - rWrt.OutULong( rAttr.GetMinLead() ) << sRTF_HYPHTRAIL; - rWrt.OutULong( rAttr.GetMinTrail() ) << sRTF_HYPHMAX; + OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_HYPHEN, FALSE ); + rWrt.OutULong( nFlags ) << OOO_STRING_SVTOOLS_RTF_HYPHLEAD; + rWrt.OutULong( rAttr.GetMinLead() ) << OOO_STRING_SVTOOLS_RTF_HYPHTRAIL; + rWrt.OutULong( rAttr.GetMinTrail() ) << OOO_STRING_SVTOOLS_RTF_HYPHMAX; rWrt.OutULong( rAttr.GetMaxHyphens() ) << '}'; } return rWrt; @@ -4130,7 +4130,7 @@ static Writer& OutRTF_SwNumRule( Writer& rWrt, const SfxPoolItem& rHt ) if( rAttr.GetValue().Len() && USHRT_MAX != (nId = rRTFWrt.GetId( rAttr ) )) { - rWrt.Strm() << sRTF_LS; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LS; rWrt.OutULong( nId ); rRTFWrt.bOutFmtAttr = TRUE; } @@ -4142,7 +4142,7 @@ static Writer& OutRTF_SwScriptSpace( Writer& rWrt, const SfxPoolItem& rHt ) { if( ((const SvxScriptSpaceItem&)rHt).GetValue() ) { - rWrt.Strm() << sRTF_ASPALPHA; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_ASPALPHA; ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; } return rWrt; @@ -4151,7 +4151,7 @@ static Writer& OutRTF_SwHangPunctuation( Writer& rWrt, const SfxPoolItem& rHt ) { if( !((const SvxHangingPunctuationItem&)rHt).GetValue() ) { - rWrt.Strm() << sRTF_NOOVERFLOW; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_NOOVERFLOW; ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; } return rWrt; @@ -4160,7 +4160,7 @@ static Writer& OutRTF_SwForbiddenRule( Writer& rWrt, const SfxPoolItem& rHt ) { if( !((const SvxForbiddenRuleItem&)rHt).GetValue() ) { - rWrt.Strm() << sRTF_NOCWRAP; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_NOCWRAP; ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; } return rWrt; @@ -4173,13 +4173,13 @@ static Writer& OutRTF_SwFontAlign( Writer& rWrt, const SfxPoolItem& rHt ) const char* pStr; switch ( rAttr.GetValue() ) { - case SvxParaVertAlignItem::TOP: pStr = sRTF_FAHANG; break; - case SvxParaVertAlignItem::BOTTOM: pStr = sRTF_FAVAR; break; - case SvxParaVertAlignItem::CENTER: pStr = sRTF_FACENTER; break; - case SvxParaVertAlignItem::BASELINE: pStr = sRTF_FAROMAN; break; + case SvxParaVertAlignItem::TOP: pStr = OOO_STRING_SVTOOLS_RTF_FAHANG; break; + case SvxParaVertAlignItem::BOTTOM: pStr = OOO_STRING_SVTOOLS_RTF_FAVAR; break; + case SvxParaVertAlignItem::CENTER: pStr = OOO_STRING_SVTOOLS_RTF_FACENTER; break; + case SvxParaVertAlignItem::BASELINE: pStr = OOO_STRING_SVTOOLS_RTF_FAROMAN; break; // case SvxParaVertAlignItem::AUTOMATIC: - default: pStr = sRTF_FAAUTO; break; + default: pStr = OOO_STRING_SVTOOLS_RTF_FAAUTO; break; } rWrt.Strm() << pStr; rRTFWrt.bOutFmtAttr = TRUE; diff --git a/sw/source/filter/rtf/rtfnum.cxx b/sw/source/filter/rtf/rtfnum.cxx index 7259c4048584..2cab705fa8e0 100644 --- a/sw/source/filter/rtf/rtfnum.cxx +++ b/sw/source/filter/rtf/rtfnum.cxx @@ -1153,14 +1153,14 @@ void SwRTFWriter::OutRTFListTab() // mit der ersten Rule wird auch die ListTable geschrieben if( !sOverrideList.Len() ) - OutComment( *this, sRTF_LISTTABLE ); + OutComment( *this, OOO_STRING_SVTOOLS_RTF_LISTTABLE ); - Strm() << '{' << sRTF_LIST << sRTF_LISTTEMPLATEID; + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LIST << OOO_STRING_SVTOOLS_RTF_LISTTEMPLATEID; OutULong( nTmplId ); ByteString sTmp; if( pRule->IsContinusNum() ) - Strm() << sRTF_LISTSIMPLE; + Strm() << OOO_STRING_SVTOOLS_RTF_LISTSIMPLE; BYTE nLvl, nEnd; lcl_IsExportNumRule( *pRule, &nEnd ); @@ -1170,9 +1170,9 @@ void SwRTFWriter::OutRTFListTab() const SwNumFmt& rFmt = pRule->Get( nLvl ); Strm() << sNewLine; if( nLvl > 8 ) // RTF-kennt nur 9 Ebenen - OutComment( *this, sRTF_SOUTLVL ); + OutComment( *this, OOO_STRING_SVTOOLS_RTF_SOUTLVL ); - Strm() << '{' << sRTF_LISTLEVEL << sRTF_LEVELNFC; + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LISTLEVEL << OOO_STRING_SVTOOLS_RTF_LEVELNFC; USHORT nVal = 0; switch( rFmt.GetNumberingType() ) @@ -1187,7 +1187,7 @@ void SwRTFWriter::OutRTFListTab() case SVX_NUM_BITMAP: case SVX_NUM_CHAR_SPECIAL: nVal = 23; break; } - OutLong( nVal ) << sRTF_LEVELJC; + OutLong( nVal ) << OOO_STRING_SVTOOLS_RTF_LEVELJC; switch( rFmt.GetNumAdjust() ) { @@ -1195,9 +1195,9 @@ void SwRTFWriter::OutRTFListTab() case SVX_ADJUST_RIGHT: nVal = 2; break; default: nVal = 0; break; } - OutLong( nVal ) << sRTF_LEVELSTARTAT; + OutLong( nVal ) << OOO_STRING_SVTOOLS_RTF_LEVELSTARTAT; OutLong( rFmt.GetStart() ) - << sRTF_LEVELFOLLOW << "0{" << sRTF_LEVELTEXT << ' '; + << OOO_STRING_SVTOOLS_RTF_LEVELFOLLOW << "0{" << OOO_STRING_SVTOOLS_RTF_LEVELTEXT << ' '; BOOL bWriteBulletFont = FALSE; memset( aNumLvlPos, 0, MAXLEVEL ); @@ -1268,7 +1268,7 @@ void SwRTFWriter::OutRTFListTab() } // write the levelnumbers - Strm() << ";}{" << sRTF_LEVELNUMBERS; + Strm() << ";}{" << OOO_STRING_SVTOOLS_RTF_LEVELNUMBERS; for( BYTE i = 0; i <= nLvl && aNumLvlPos[ i ]; ++i ) { Strm() << "\\'"; OutHex( aNumLvlPos[ i ] ); @@ -1281,7 +1281,7 @@ void SwRTFWriter::OutRTFListTab() if( bWriteBulletFont ) { - Strm() << sRTF_F; + Strm() << OOO_STRING_SVTOOLS_RTF_F; const Font* pFont = rFmt.GetBulletFont(); if( !pFont ) // --> OD 2006-06-27 #b6440955# @@ -1290,8 +1290,8 @@ void SwRTFWriter::OutRTFListTab() OutULong( GetId( *pFont )); } - Strm() << sRTF_FI; - OutLong( rFmt.GetFirstLineOffset() ) << sRTF_LI; + Strm() << OOO_STRING_SVTOOLS_RTF_FI; + OutLong( rFmt.GetFirstLineOffset() ) << OOO_STRING_SVTOOLS_RTF_LI; OutLong( rFmt.GetAbsLSpace() ); Strm() << '}'; @@ -1302,25 +1302,25 @@ void SwRTFWriter::OutRTFListTab() if( !pRule->IsAutoRule() ) { - Strm() << '{' << sRTF_LISTNAME << ' '; + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LISTNAME << ' '; RTFOutFuncs::Out_String( Strm(), pRule->GetName(), eDefaultEncoding, bWriteHelpFmt ) << ";}" ; } - Strm() << sRTF_LISTID; + Strm() << OOO_STRING_SVTOOLS_RTF_LISTID; OutULong( nId ) << '}' << sNewLine; sTmp = '{'; - ((((((( sTmp += sRTF_LISTOVERRIDE ) += - sRTF_LISTID ) += ByteString::CreateFromInt32( nId )) += - sRTF_LISTOVERRIDECOUNT ) += '0' ) += - sRTF_LS ) += ByteString::CreateFromInt32( n )) += '}'; + ((((((( sTmp += OOO_STRING_SVTOOLS_RTF_LISTOVERRIDE ) += + OOO_STRING_SVTOOLS_RTF_LISTID ) += ByteString::CreateFromInt32( nId )) += + OOO_STRING_SVTOOLS_RTF_LISTOVERRIDECOUNT ) += '0' ) += + OOO_STRING_SVTOOLS_RTF_LS ) += ByteString::CreateFromInt32( n )) += '}'; sOverrideList += sTmp; ++nId, ++nTmplId; } if( sOverrideList.Len() ) - Strm() << "}{" << sRTF_LISTOVERRIDETABLE + Strm() << "}{" << OOO_STRING_SVTOOLS_RTF_LISTOVERRIDETABLE << sOverrideList.GetBuffer() << '}' << sNewLine; } @@ -1408,7 +1408,7 @@ BOOL SwRTFWriter::OutListNum( const SwTxtNode& rNd ) aLR.SetTxtFirstLineOfst( pFmt->GetFirstLineOffset() ); if ( bExportNumRule ) - Strm() << '{' << sRTF_LISTTEXT << sRTF_PARD << sRTF_PLAIN << ' '; + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LISTTEXT << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN << ' '; aSet.Put( aLR ); Out_SfxItemSet( aRTFAttrFnTab, *this, aSet, TRUE ); @@ -1440,11 +1440,11 @@ BOOL SwRTFWriter::OutListNum( const SwTxtNode& rNd ) { if( OUTLINE_RULE != pRule->GetRuleType() ) { - Strm() << sRTF_TAB << '}' << sRTF_ILVL; + Strm() << OOO_STRING_SVTOOLS_RTF_TAB << '}' << OOO_STRING_SVTOOLS_RTF_ILVL; if( nLvl > 8 ) // RTF-kennt nur 9 Ebenen { OutULong( 8 ); - OutComment( *this, sRTF_SOUTLVL ); + OutComment( *this, OOO_STRING_SVTOOLS_RTF_SOUTLVL ); OutULong( nLvl ) << '}'; } else @@ -1452,10 +1452,10 @@ BOOL SwRTFWriter::OutListNum( const SwTxtNode& rNd ) Strm() << ' '; } else - Strm() << sRTF_TAB << '}'; + Strm() << OOO_STRING_SVTOOLS_RTF_TAB << '}'; } else if( sTxt.Len() ) - Strm() << sRTF_TAB; + Strm() << OOO_STRING_SVTOOLS_RTF_TAB; } bOutListNumTxt = FALSE; } diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index fd9b8511b906..20d28499e796 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -1785,7 +1785,7 @@ void SwRTFParser::NextToken( int nToken ) aBookmarkEnd.maMkNode, aBookmarkEnd.mnMkCntnt); if (*mpBookmarkStart == aBookmarkEnd) aBookmarkRegion.DeleteMark(); - pDoc->makeBookmark(aBookmarkRegion, aEmptyKeyCode, sBookmark, aEmptyStr, IDocumentBookmarkAccess::BOOKMARK); + pDoc->getIDocumentMarkAccess()->makeMark(aBookmarkRegion, sBookmark, IDocumentMarkAccess::BOOKMARK); } delete mpBookmarkStart, mpBookmarkStart = 0; } diff --git a/sw/source/filter/rtf/wrtrtf.cxx b/sw/source/filter/rtf/wrtrtf.cxx index 84eb60cf3847..c10528f112ee 100644 --- a/sw/source/filter/rtf/wrtrtf.cxx +++ b/sw/source/filter/rtf/wrtrtf.cxx @@ -67,7 +67,7 @@ #include <ndtxt.hxx> #include <wrtrtf.hxx> #include <flypos.hxx> -#include <bookmrk.hxx> // fuer SwBookmark ... +#include <IMark.hxx> #include <pagedesc.hxx> // fuer SwPageDesc... #include <ftninfo.hxx> #include <charfmt.hxx> @@ -133,7 +133,7 @@ ULONG SwRTFWriter::WriteStream() pCurEndPosLst = 0; - nBkmkTabPos = USHRT_MAX; + nBkmkTabPos = -1; pAktPageDesc = 0; pAttrSet = 0; pFlyFmt = 0; // kein FlyFrmFormat gesetzt @@ -262,7 +262,7 @@ void SwRTFWriter::Out_SwDoc( SwPaM* pPam ) { BOOL bSaveWriteAll = bWriteAll; // sichern // suche die naechste Bookmark-Position aus der Bookmark-Tabelle - nBkmkTabPos = bWriteAll ? FindPos_Bkmk( *pCurPam->GetPoint() ) : USHRT_MAX; + nBkmkTabPos = bWriteAll ? FindPos_Bkmk( *pCurPam->GetPoint() ) : -1; // gebe alle Bereiche des Pams in das RTF-File aus. do { @@ -351,11 +351,11 @@ void SwRTFWriter::Out_SwDoc( SwPaM* pPam ) void SwRTFWriter::MakeHeader() { // baue den Vorspann wie Header, ColorTbl, FontTbl - Strm() << '{' << sRTF_RTF << '1' - << sRTF_ANSI; + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_RTF << '1' + << OOO_STRING_SVTOOLS_RTF_ANSI; if( bWriteAll ) { - Strm() << sRTF_DEFF; + Strm() << OOO_STRING_SVTOOLS_RTF_DEFF; OutULong( GetId( (SvxFontItem&)pDoc->GetAttrPool().GetDefaultItem( RES_CHRATR_FONT ) )); } @@ -382,10 +382,10 @@ void SwRTFWriter::MakeHeader() { // Default-TabSize const SvxTabStopItem& rTabs = (const SvxTabStopItem&) pDoc->GetAttrPool().GetDefaultItem( RES_PARATR_TABSTOP ); - Strm() << sRTF_DEFTAB; + Strm() << OOO_STRING_SVTOOLS_RTF_DEFTAB; OutLong( rTabs[0].GetTabPos() ); if ( !pDoc->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) ) - Strm() << sRTF_LYTPRTMET; + Strm() << OOO_STRING_SVTOOLS_RTF_LYTPRTMET; } // PageDescriptor ausgeben (??nur wenn das gesamte Dokument??) @@ -421,7 +421,7 @@ void SwRTFWriter::MakeHeader() GetPageDesc()->GetName(), &nPosInDoc )) { // FALSE wegen schliessender Klammer !! - OutComment( *this, sRTF_PGDSCNO, FALSE ); + OutComment( *this, OOO_STRING_SVTOOLS_RTF_PGDSCNO, FALSE ); OutULong( nPosInDoc ) << '}'; } } @@ -432,40 +432,40 @@ void SwRTFWriter::MakeHeader() { if( rPageDesc.GetLandscape() ) - Strm() << sRTF_LANDSCAPE; + Strm() << OOO_STRING_SVTOOLS_RTF_LANDSCAPE; const SwFmtFrmSize& rSz = rFmtPage.GetFrmSize(); // Clipboard-Dokument wird immer ohne Drucker angelegt, so ist // der Std.PageDesc immer aug LONG_MAX !! Mappe dann auf DIN A4 if( LONG_MAX == rSz.GetHeight() || LONG_MAX == rSz.GetWidth() ) { - Strm() << sRTF_PAPERH; - OutULong( lA4Height ) << sRTF_PAPERW; + Strm() << OOO_STRING_SVTOOLS_RTF_PAPERH; + OutULong( lA4Height ) << OOO_STRING_SVTOOLS_RTF_PAPERW; OutULong( lA4Width ); } else { - Strm() << sRTF_PAPERH; - OutULong( rSz.GetHeight() ) << sRTF_PAPERW; + Strm() << OOO_STRING_SVTOOLS_RTF_PAPERH; + OutULong( rSz.GetHeight() ) << OOO_STRING_SVTOOLS_RTF_PAPERW; OutULong( rSz.GetWidth() ); } } { const SvxLRSpaceItem& rLR = rFmtPage.GetLRSpace(); - Strm() << sRTF_MARGL; - OutLong( rLR.GetLeft() ) << sRTF_MARGR; + Strm() << OOO_STRING_SVTOOLS_RTF_MARGL; + OutLong( rLR.GetLeft() ) << OOO_STRING_SVTOOLS_RTF_MARGR; OutLong( rLR.GetRight() ); } { const SvxULSpaceItem& rUL = rFmtPage.GetULSpace(); - Strm() << sRTF_MARGT; - OutLong( rUL.GetUpper() ) << sRTF_MARGB; + Strm() << OOO_STRING_SVTOOLS_RTF_MARGT; + OutLong( rUL.GetUpper() ) << OOO_STRING_SVTOOLS_RTF_MARGB; OutLong( rUL.GetLower() ); } - Strm() << sRTF_SECTD << sRTF_SBKNONE; + Strm() << OOO_STRING_SVTOOLS_RTF_SECTD << OOO_STRING_SVTOOLS_RTF_SBKNONE; OutRTFPageDescription( rPageDesc, FALSE, TRUE ); // Changed bCheckForFirstPage to TRUE so headers // following title page are correctly added - i13107 if( pSttPgDsc ) @@ -481,52 +481,52 @@ void SwRTFWriter::MakeHeader() const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo(); const char* pOut = FTNPOS_CHAPTER == rFtnInfo.ePos - ? sRTF_ENDDOC - : sRTF_FTNBJ; - Strm() << pOut << sRTF_FTNSTART; + ? OOO_STRING_SVTOOLS_RTF_ENDDOC + : OOO_STRING_SVTOOLS_RTF_FTNBJ; + Strm() << pOut << OOO_STRING_SVTOOLS_RTF_FTNSTART; OutLong( rFtnInfo.nFtnOffset + 1 ); switch( rFtnInfo.eNum ) { - case FTNNUM_PAGE: pOut = sRTF_FTNRSTPG; break; - case FTNNUM_DOC: pOut = sRTF_FTNRSTCONT; break; + case FTNNUM_PAGE: pOut = OOO_STRING_SVTOOLS_RTF_FTNRSTPG; break; + case FTNNUM_DOC: pOut = OOO_STRING_SVTOOLS_RTF_FTNRSTCONT; break; // case FTNNUM_CHAPTER: - default: pOut = sRTF_FTNRESTART; break; + default: pOut = OOO_STRING_SVTOOLS_RTF_FTNRESTART; break; } Strm() << pOut; switch( rFtnInfo.aFmt.GetNumberingType() ) { case SVX_NUM_CHARS_LOWER_LETTER: - case SVX_NUM_CHARS_LOWER_LETTER_N: pOut = sRTF_FTNNALC; break; + case SVX_NUM_CHARS_LOWER_LETTER_N: pOut = OOO_STRING_SVTOOLS_RTF_FTNNALC; break; case SVX_NUM_CHARS_UPPER_LETTER: - case SVX_NUM_CHARS_UPPER_LETTER_N: pOut = sRTF_FTNNAUC; break; - case SVX_NUM_ROMAN_LOWER: pOut = sRTF_FTNNRLC; break; - case SVX_NUM_ROMAN_UPPER: pOut = sRTF_FTNNRUC; break; - case SVX_NUM_CHAR_SPECIAL: pOut = sRTF_FTNNCHI; break; + case SVX_NUM_CHARS_UPPER_LETTER_N: pOut = OOO_STRING_SVTOOLS_RTF_FTNNAUC; break; + case SVX_NUM_ROMAN_LOWER: pOut = OOO_STRING_SVTOOLS_RTF_FTNNRLC; break; + case SVX_NUM_ROMAN_UPPER: pOut = OOO_STRING_SVTOOLS_RTF_FTNNRUC; break; + case SVX_NUM_CHAR_SPECIAL: pOut = OOO_STRING_SVTOOLS_RTF_FTNNCHI; break; // case SVX_NUM_ARABIC: - default: pOut = sRTF_FTNNAR; break; + default: pOut = OOO_STRING_SVTOOLS_RTF_FTNNAR; break; } Strm() << pOut; const SwEndNoteInfo& rEndNoteInfo = pDoc->GetEndNoteInfo(); - Strm() << sRTF_AENDDOC << sRTF_AFTNRSTCONT - << sRTF_AFTNSTART; + Strm() << OOO_STRING_SVTOOLS_RTF_AENDDOC << OOO_STRING_SVTOOLS_RTF_AFTNRSTCONT + << OOO_STRING_SVTOOLS_RTF_AFTNSTART; OutLong( rEndNoteInfo.nFtnOffset + 1 ); switch( rEndNoteInfo.aFmt.GetNumberingType() ) { case SVX_NUM_CHARS_LOWER_LETTER: - case SVX_NUM_CHARS_LOWER_LETTER_N: pOut = sRTF_AFTNNALC; break; + case SVX_NUM_CHARS_LOWER_LETTER_N: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNALC; break; case SVX_NUM_CHARS_UPPER_LETTER: - case SVX_NUM_CHARS_UPPER_LETTER_N: pOut = sRTF_AFTNNAUC; break; - case SVX_NUM_ROMAN_LOWER: pOut = sRTF_AFTNNRLC; break; - case SVX_NUM_ROMAN_UPPER: pOut = sRTF_AFTNNRUC; break; - case SVX_NUM_CHAR_SPECIAL: pOut = sRTF_AFTNNCHI; break; + case SVX_NUM_CHARS_UPPER_LETTER_N: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNAUC; break; + case SVX_NUM_ROMAN_LOWER: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNRLC; break; + case SVX_NUM_ROMAN_UPPER: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNRUC; break; + case SVX_NUM_CHAR_SPECIAL: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNCHI; break; // case SVX_NUM_ARABIC: - default: pOut = sRTF_AFTNNAR; break; + default: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNAR; break; } Strm() << pOut; } @@ -539,15 +539,15 @@ void SwRTFWriter::MakeHeader() if( RES_DBFLD == (*pTypes)[ --nCnt ]->Which() && (*pTypes)[ nCnt ]->GetDepends() ) { - Strm() << '{' << sRTF_FIELD; - OutComment( *this, sRTF_FLDINST ) << " DATA "; + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_FIELD; + OutComment( *this, OOO_STRING_SVTOOLS_RTF_FLDINST ) << " DATA "; SwDBData aData = pDoc->GetDBData(); String sOut(aData.sDataSource); sOut += DB_DELIM; sOut += (String)aData.sCommand; RTFOutFuncs::Out_String( Strm(), sOut, eDefaultEncoding, bWriteHelpFmt ); - Strm() << "}{" << sRTF_FLDRSLT << " }}"; + Strm() << "}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << " }}"; break; } } @@ -560,11 +560,11 @@ void SwRTFWriter::MakeHeader() void SwRTFWriter::OutInfoDateTime( const sal_Char* i_pStr, const util::DateTime& i_rDT ) { - Strm() << '{' << i_pStr << sRTF_YR; - OutLong( Strm(), i_rDT.Year ) << sRTF_MO; - OutLong( Strm(), i_rDT.Month ) << sRTF_DY; - OutLong( Strm(), i_rDT.Day ) << sRTF_HR; - OutLong( Strm(), i_rDT.Hours ) << sRTF_MIN; + Strm() << '{' << i_pStr << OOO_STRING_SVTOOLS_RTF_YR; + OutLong( Strm(), i_rDT.Year ) << OOO_STRING_SVTOOLS_RTF_MO; + OutLong( Strm(), i_rDT.Month ) << OOO_STRING_SVTOOLS_RTF_DY; + OutLong( Strm(), i_rDT.Day ) << OOO_STRING_SVTOOLS_RTF_HR; + OutLong( Strm(), i_rDT.Hours ) << OOO_STRING_SVTOOLS_RTF_MIN; OutLong( Strm(), i_rDT.Minutes ) << '}'; } @@ -586,7 +586,7 @@ void SwRTFWriter::OutUnicodeSafeRecord(const sal_Char *pToken, bool bNeedUnicodeWrapper = !CharsetSufficient(rContent, eDefaultEncoding); if (bNeedUnicodeWrapper) - Strm() << '{' << sRTF_UPR; + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_UPR; Strm() << '{' << pToken << ' '; OutRTF_AsByteString(*this, rContent, eDefaultEncoding); @@ -594,7 +594,7 @@ void SwRTFWriter::OutUnicodeSafeRecord(const sal_Char *pToken, if (bNeedUnicodeWrapper) { - OutComment(*this, sRTF_UD); + OutComment(*this, OOO_STRING_SVTOOLS_RTF_UD); Strm() << '{' << pToken << ' '; RTFOutFuncs::Out_String(Strm(), rContent, eDefaultEncoding, bWriteHelpFmt); @@ -606,7 +606,7 @@ void SwRTFWriter::OutUnicodeSafeRecord(const sal_Char *pToken, void SwRTFWriter::OutDocInfoStat() { - Strm() << '{' << sRTF_INFO; + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_INFO; SwDocShell *pDocShell(pDoc->GetDocShell()); uno::Reference<document::XDocumentProperties> xDocProps; @@ -619,25 +619,25 @@ void SwRTFWriter::OutDocInfoStat() // may be null (in case of copying) if (xDocProps.is()) { - OutUnicodeSafeRecord(sRTF_TITLE, xDocProps->getTitle()); - OutUnicodeSafeRecord(sRTF_SUBJECT, xDocProps->getSubject()); + OutUnicodeSafeRecord(OOO_STRING_SVTOOLS_RTF_TITLE, xDocProps->getTitle()); + OutUnicodeSafeRecord(OOO_STRING_SVTOOLS_RTF_SUBJECT, xDocProps->getSubject()); - OutUnicodeSafeRecord(sRTF_KEYWORDS, + OutUnicodeSafeRecord(OOO_STRING_SVTOOLS_RTF_KEYWORDS, ::comphelper::string::convertCommaSeparated(xDocProps->getKeywords())); - OutUnicodeSafeRecord(sRTF_DOCCOMM, xDocProps->getDescription()); + OutUnicodeSafeRecord(OOO_STRING_SVTOOLS_RTF_DOCCOMM, xDocProps->getDescription()); - OutUnicodeSafeRecord(sRTF_AUTHOR, xDocProps->getAuthor() ); - OutInfoDateTime(sRTF_CREATIM, xDocProps->getCreationDate()); + OutUnicodeSafeRecord(OOO_STRING_SVTOOLS_RTF_AUTHOR, xDocProps->getAuthor() ); + OutInfoDateTime(OOO_STRING_SVTOOLS_RTF_CREATIM, xDocProps->getCreationDate()); - OutUnicodeSafeRecord(sRTF_AUTHOR, xDocProps->getModifiedBy() ); - OutInfoDateTime(sRTF_REVTIM, xDocProps->getModificationDate()); + OutUnicodeSafeRecord(OOO_STRING_SVTOOLS_RTF_AUTHOR, xDocProps->getModifiedBy() ); + OutInfoDateTime(OOO_STRING_SVTOOLS_RTF_REVTIM, xDocProps->getModificationDate()); - OutInfoDateTime(sRTF_PRINTIM, xDocProps->getPrintDate()); + OutInfoDateTime(OOO_STRING_SVTOOLS_RTF_PRINTIM, xDocProps->getPrintDate()); } // fuer interne Zwecke - Versionsnummer rausschreiben - Strm() << '{' << sRTF_COMMENT << " StarWriter}{" << sRTF_VERN; + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_COMMENT << " StarWriter}{" << OOO_STRING_SVTOOLS_RTF_VERN; OutLong( Strm(), SUPD*10 ) << '}'; Strm() << '}'; @@ -770,16 +770,16 @@ void SwRTFWriter::OutRTFColorTab() } // und raus damit - Strm() << SwRTFWriter::sNewLine << '{' << sRTF_COLORTBL; + Strm() << SwRTFWriter::sNewLine << '{' << OOO_STRING_SVTOOLS_RTF_COLORTBL; for( n = 0; n < pColTbl->Count(); n++ ) { const Color& rCol = (*pColTbl)[ n ]; if( n || COL_AUTO != rCol.GetColor() ) { - Strm() << sRTF_RED; - OutULong( rCol.GetRed() ) << sRTF_GREEN; - OutULong( rCol.GetGreen() ) << sRTF_BLUE; + Strm() << OOO_STRING_SVTOOLS_RTF_RED; + OutULong( rCol.GetRed() ) << OOO_STRING_SVTOOLS_RTF_GREEN; + OutULong( rCol.GetGreen() ) << OOO_STRING_SVTOOLS_RTF_BLUE; OutULong( rCol.GetBlue() ); } Strm() << ';'; @@ -798,30 +798,30 @@ bool FontCharsetSufficient(const String &rFntNm, const String &rAltNm, static void _OutFont( SwRTFWriter& rWrt, const SvxFontItem& rFont, USHORT nNo ) { - rWrt.Strm() << '{' << sRTF_F; + rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_F; - const char* pStr = sRTF_FNIL; + const char* pStr = OOO_STRING_SVTOOLS_RTF_FNIL; switch (rFont.GetFamily()) { case FAMILY_ROMAN: - pStr = sRTF_FROMAN; + pStr = OOO_STRING_SVTOOLS_RTF_FROMAN; break; case FAMILY_SWISS: - pStr = sRTF_FSWISS; + pStr = OOO_STRING_SVTOOLS_RTF_FSWISS; break; case FAMILY_MODERN: - pStr = sRTF_FMODERN; + pStr = OOO_STRING_SVTOOLS_RTF_FMODERN; break; case FAMILY_SCRIPT: - pStr = sRTF_FSCRIPT; + pStr = OOO_STRING_SVTOOLS_RTF_FSCRIPT; break; case FAMILY_DECORATIVE: - pStr = sRTF_FDECOR; + pStr = OOO_STRING_SVTOOLS_RTF_FDECOR; break; default: break; } - rWrt.OutULong(nNo) << pStr << sRTF_FPRQ; + rWrt.OutULong(nNo) << pStr << OOO_STRING_SVTOOLS_RTF_FPRQ; USHORT nVal = 0; switch (rFont.GetPitch()) @@ -856,14 +856,14 @@ static void _OutFont( SwRTFWriter& rWrt, const SvxFontItem& rFont, USHORT nNo ) eChrSet = rtl_getTextEncodingFromWindowsCharset(nChSet); } - rWrt.Strm() << sRTF_FCHARSET; + rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FCHARSET; rWrt.OutULong( nChSet ); rWrt.Strm() << ' '; if (aRes.HasDistinctSecondary()) { RTFOutFuncs::Out_Fontname(rWrt.Strm(), aRes.msPrimary, eChrSet, rWrt.bWriteHelpFmt); - OutComment(rWrt, sRTF_FALT) << ' '; + OutComment(rWrt, OOO_STRING_SVTOOLS_RTF_FALT) << ' '; RTFOutFuncs::Out_Fontname(rWrt.Strm(), aRes.msSecondary, eChrSet, rWrt.bWriteHelpFmt) << '}'; } @@ -881,7 +881,7 @@ void SwRTFWriter::OutRTFFontTab() const SfxItemPool& rPool = pDoc->GetAttrPool(); const SvxFontItem* pFont = (const SvxFontItem*)GetDfltAttr(RES_CHRATR_FONT); - Strm() << SwRTFWriter::sNewLine << '{' << sRTF_FONTTBL; + Strm() << SwRTFWriter::sNewLine << '{' << OOO_STRING_SVTOOLS_RTF_FONTTBL; _OutFont( *this, *pFont, n++ ); pFont = (const SvxFontItem*)rPool.GetPoolDefaultItem(RES_CHRATR_FONT); @@ -906,7 +906,7 @@ void RTF_WrtRedlineAuthor::Write(Writer &rWrt) { SwRTFWriter & rRTFWrt = (SwRTFWriter&)rWrt; - rRTFWrt.Strm() << '{' << sRTF_IGNORE << sRTF_REVTBL << ' '; + rRTFWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_REVTBL << ' '; typedef std::vector<String>::iterator myiter; for(std::vector<String>::iterator aIter = maAuthors.begin(); aIter != maAuthors.end(); ++aIter) @@ -1039,7 +1039,7 @@ void SwRTFWriter::OutRTFStyleTab() return; bOutStyleTab = TRUE; - Strm() << SwRTFWriter::sNewLine << '{' << sRTF_STYLESHEET; + Strm() << SwRTFWriter::sNewLine << '{' << OOO_STRING_SVTOOLS_RTF_STYLESHEET; // das Default-TextStyle wird nicht mit ausgegeben !! for( n = 1; n < nArrLen; ++n ) @@ -1058,14 +1058,14 @@ void SwRTFWriter::OutRTFStyleTab() pColl->DerivedFrom() ) { // die Ableitung vom Format - Strm() << sRTF_SBASEDON; + Strm() << OOO_STRING_SVTOOLS_RTF_SBASEDON; OutULong( nBasedOn ); break; } if( pColl == &pColl->GetNextTxtFmtColl() ) { - Strm() << sRTF_SNEXT; + Strm() << OOO_STRING_SVTOOLS_RTF_SNEXT; OutULong( n ); } else @@ -1075,7 +1075,7 @@ void SwRTFWriter::OutRTFStyleTab() &pColl->GetNextTxtFmtColl() ) { // die Ableitung vom Format - Strm() << sRTF_SNEXT; + Strm() << OOO_STRING_SVTOOLS_RTF_SNEXT; OutULong( nNext ); break; } @@ -1083,7 +1083,7 @@ void SwRTFWriter::OutRTFStyleTab() //if( NO_NUMBERING != pColl->GetOutlineLevel() )//#outline level,zhaojianwei if(pColl->IsAssignedToListLevelOfOutlineStyle())//<-end,zhaojianwei { - Strm() << '{' << sRTF_IGNORE << sRTF_SOUTLVL; + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_SOUTLVL; //OutULong( pColl->GetOutlineLevel() ) << '}';//#outline level,zhaojianwei OutULong( pColl->GetAssignedOutlineStyleLevel() ) << '}';//<-end,zhaojianwei } @@ -1110,7 +1110,7 @@ void SwRTFWriter::OutRTFStyleTab() pFmt->DerivedFrom() ) { // die Ableitung vom Format - Strm() << sRTF_SBASEDON; + Strm() << OOO_STRING_SVTOOLS_RTF_SBASEDON; OutULong( nArrLen + nBasedOn ); break; } @@ -1145,7 +1145,7 @@ void SwRTFWriter::OutRTFFlyFrms(const SwFlyFrmFmt& rFlyFrmFmt) return; if (!ExportAsInline(rFlyFrmFmt)) - Strm() << SwRTFWriter::sNewLine << sRTF_PARD << sRTF_PLAIN; + Strm() << SwRTFWriter::sNewLine << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN; //If we are only exporting an inline graphic/object then we //only need the its pFlyFmt for the duration of exporting it //for floating objects its a little more complex at the moment @@ -1158,7 +1158,7 @@ void SwRTFWriter::OutRTFFlyFrms(const SwFlyFrmFmt& rFlyFrmFmt) } if (!ExportAsInline(rFlyFrmFmt)) - Strm() << sRTF_PARD << SwRTFWriter::sNewLine; + Strm() << OOO_STRING_SVTOOLS_RTF_PARD << SwRTFWriter::sNewLine; //#i46098#: else pFlyFmt = pOldFlyFmt; } @@ -1198,21 +1198,21 @@ void SwRTFWriter::OutRedline( xub_StrLen nCntntPos ) Strm() << '{'; if(pCurRedline->GetType() == nsRedlineType_t::REDLINE_INSERT) { - Strm() << sRTF_REVISED; - Strm() << sRTF_REVAUTH; + Strm() << OOO_STRING_SVTOOLS_RTF_REVISED; + Strm() << OOO_STRING_SVTOOLS_RTF_REVAUTH; String sName = SW_MOD()->GetRedlineAuthor(pCurRedline->GetAuthor()); OutLong( pRedlAuthors->AddName(sName) ); - Strm() << sRTF_REVDTTM; + Strm() << OOO_STRING_SVTOOLS_RTF_REVDTTM; OutLong( sw::ms::DateTime2DTTM(pCurRedline->GetTimeStamp()) ); Strm() << ' '; } else if(pCurRedline->GetType() == nsRedlineType_t::REDLINE_DELETE) { - Strm() << sRTF_DELETED; - Strm() << sRTF_REVAUTHDEL; + Strm() << OOO_STRING_SVTOOLS_RTF_DELETED; + Strm() << OOO_STRING_SVTOOLS_RTF_REVAUTHDEL; String sDelName = SW_MOD()->GetRedlineAuthor(pCurRedline->GetAuthor()); OutLong( pRedlAuthors->AddName(sDelName) ); - Strm() << sRTF_REVDTTMDEL; + Strm() << OOO_STRING_SVTOOLS_RTF_REVDTTMDEL; OutLong( sw::ms::DateTime2DTTM(pCurRedline->GetTimeStamp()) ); Strm() << ' '; } @@ -1237,31 +1237,18 @@ void SwRTFWriter::OutRedline( xub_StrLen nCntntPos ) } } -void SwRTFWriter::OutBookmarks( xub_StrLen nCntntPos ) +void SwRTFWriter::OutBookmarks( xub_StrLen nCntntPos) { - if (USHRT_MAX == nBkmkTabPos) + IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + if (-1 == nBkmkTabPos) return; - const SwBookmark* pBookmark = pDoc->getBookmarks()[nBkmkTabPos]; - if (!pBookmark) + const ::sw::mark::IMark* pBookmark = (pMarkAccess->getMarksBegin() + nBkmkTabPos)->get(); + if(!pBookmark) return; - // hole das aktuelle Bookmark - const SwPosition* pStartPos = 0; - const SwPosition* pEndPos = 0; - - if (pBookmark->GetOtherBookmarkPos()) // this bookmark spans text - { - // the start and endpoints are different - SwPaM mPam(pBookmark->GetBookmarkPos(), *pBookmark->GetOtherBookmarkPos()); - pStartPos = mPam.Start(); - pEndPos = mPam.End(); - } - else // this bookmark is a point - { - // so the start and endpoints are the same - pStartPos = pEndPos = &pBookmark->GetBookmarkPos(); - } + const SwPosition* pStartPos = &pBookmark->GetMarkStart(); + const SwPosition* pEndPos = &pBookmark->GetMarkEnd(); ASSERT(pStartPos && pEndPos, "Impossible"); if (!(pStartPos && pEndPos)) @@ -1274,24 +1261,22 @@ void SwRTFWriter::OutBookmarks( xub_StrLen nCntntPos ) // es hier vollstaendig ausgegeben werden. // erst die SWG spezifischen Daten: - if ( - pBookmark->GetShortName().Len() || - pBookmark->GetKeyCode().GetCode() - ) + const ::sw::mark::IBookmark* const pAsBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(pBookmark); + if(pAsBookmark && (pAsBookmark->GetShortName().getLength() || pAsBookmark->GetKeyCode().GetCode())) { - OutComment( *this, sRTF_BKMKKEY ); - OutULong( ( pBookmark->GetKeyCode().GetCode() | - pBookmark->GetKeyCode().GetModifier() )); - if( !pBookmark->GetShortName().Len() ) + OutComment( *this, OOO_STRING_SVTOOLS_RTF_BKMKKEY ); + OutULong( ( pAsBookmark->GetKeyCode().GetCode() | + pAsBookmark->GetKeyCode().GetModifier() )); + if( !pAsBookmark->GetShortName().getLength() ) Strm() << " " ; else { Strm() << ' '; - OutRTF_AsByteString( *this, pBookmark->GetShortName(), eDefaultEncoding ); + OutRTF_AsByteString( *this, pAsBookmark->GetShortName(), eDefaultEncoding ); } Strm() << '}'; } - OutComment( *this, sRTF_BKMKSTART ) << ' '; + OutComment( *this, OOO_STRING_SVTOOLS_RTF_BKMKSTART ) << ' '; RTFOutFuncs::Out_String( Strm(), pBookmark->GetName(), eDefaultEncoding, bWriteHelpFmt ) << '}'; } @@ -1303,31 +1288,29 @@ void SwRTFWriter::OutBookmarks( xub_StrLen nCntntPos ) // es hier vollstaendig ausgegeben werden. // erst die SWG spezifischen Daten: - if ( - pBookmark->GetShortName().Len() || - pBookmark->GetKeyCode().GetCode() - ) + const ::sw::mark::IBookmark* const pAsBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(pBookmark); + if(pAsBookmark && (pAsBookmark->GetShortName().getLength() || pAsBookmark->GetKeyCode().GetCode())) { - OutComment( *this, sRTF_BKMKKEY ); - OutULong( ( pBookmark->GetKeyCode().GetCode() | - pBookmark->GetKeyCode().GetModifier() )); - if( !pBookmark->GetShortName().Len() ) + OutComment( *this, OOO_STRING_SVTOOLS_RTF_BKMKKEY ); + OutULong( ( pAsBookmark->GetKeyCode().GetCode() | + pAsBookmark->GetKeyCode().GetModifier() )); + if( !pAsBookmark->GetShortName().getLength() ) Strm() << " " ; else { Strm() << ' '; - OutRTF_AsByteString( *this, pBookmark->GetShortName(), eDefaultEncoding ); + OutRTF_AsByteString( *this, pAsBookmark->GetShortName(), eDefaultEncoding ); } Strm() << '}'; } - OutComment( *this, sRTF_BKMKEND ) << ' '; - RTFOutFuncs::Out_String( Strm(), pBookmark->GetName(), + OutComment( *this, OOO_STRING_SVTOOLS_RTF_BKMKEND ) << ' '; + RTFOutFuncs::Out_String( Strm(), pAsBookmark->GetName(), eDefaultEncoding, bWriteHelpFmt ) << '}'; - if( ++nBkmkTabPos >= pDoc->getBookmarks().Count() ) - nBkmkTabPos = USHRT_MAX; + if(++nBkmkTabPos >= pMarkAccess->getMarksCount()) + nBkmkTabPos = -1; else - pBookmark = pDoc->getBookmarks()[ nBkmkTabPos ]; + pBookmark = (pMarkAccess->getMarksBegin() + nBkmkTabPos)->get(); } } @@ -1438,14 +1421,14 @@ void SwRTFWriter::OutPageDesc() Strm() << SwRTFWriter::sNewLine; // ein Trenner bOutPageDesc = bOutPageDescTbl = TRUE; - OutComment( *this, sRTF_PGDSCTBL ); + OutComment( *this, OOO_STRING_SVTOOLS_RTF_PGDSCTBL ); for( USHORT n = 0; n < nSize; ++n ) { const SwPageDesc& rPageDesc = const_cast<const SwDoc*>(pDoc)->GetPageDesc( n ); - Strm() << SwRTFWriter::sNewLine << '{' << sRTF_PGDSC; - OutULong( n ) << sRTF_PGDSCUSE; + Strm() << SwRTFWriter::sNewLine << '{' << OOO_STRING_SVTOOLS_RTF_PGDSC; + OutULong( n ) << OOO_STRING_SVTOOLS_RTF_PGDSCUSE; OutULong( rPageDesc.ReadUseOn() ); OutRTFPageDescription( rPageDesc, FALSE, FALSE ); @@ -1456,7 +1439,7 @@ void SwRTFWriter::OutPageDesc() if( rPageDesc.GetFollow() == &const_cast<const SwDoc *>(pDoc)->GetPageDesc( --i ) ) break; - Strm() << sRTF_PGDSCNXT; + Strm() << OOO_STRING_SVTOOLS_RTF_PGDSCNXT; OutULong( i ) << ' '; RTFOutFuncs::Out_String( Strm(), XlateFmtName( rPageDesc.GetName(), nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC ), eDefaultEncoding, bWriteHelpFmt ) << ";}"; @@ -1476,20 +1459,20 @@ void SwRTFWriter::OutRTFBorder(const SvxBorderLine* aLine, const USHORT nSpace ) int nWidth = aLine->GetOutWidth(); if(nDistance == 0) // Single Line - Strm() << sRTF_BRDRS; + Strm() << OOO_STRING_SVTOOLS_RTF_BRDRS; else // Double Line { if(nOutWidth == nInWidth) - Strm() << sRTF_BRDRDB; + Strm() << OOO_STRING_SVTOOLS_RTF_BRDRDB; else if (nOutWidth > nInWidth) - Strm() << sRTF_BRDRTNTHSG; + Strm() << OOO_STRING_SVTOOLS_RTF_BRDRTNTHSG; else if (nOutWidth < nInWidth) - Strm() << sRTF_BRDRTHTNSG; + Strm() << OOO_STRING_SVTOOLS_RTF_BRDRTHTNSG; } - Strm() << sRTF_BRDRW; + Strm() << OOO_STRING_SVTOOLS_RTF_BRDRW; OutULong(nWidth); - Strm() << sRTF_BRSP; + Strm() << OOO_STRING_SVTOOLS_RTF_BRSP; OutULong(nSpace); } @@ -1498,28 +1481,28 @@ void SwRTFWriter::OutRTFBorders(SvxBoxItem aBox) const SvxBorderLine *pLine = aBox.GetTop(); if(pLine) { - Strm() << sRTF_PGBRDRT; + Strm() << OOO_STRING_SVTOOLS_RTF_PGBRDRT; OutRTFBorder(pLine, aBox.GetDistance(BOX_LINE_TOP)); } pLine = aBox.GetBottom(); if(pLine) { - Strm() << sRTF_PGBRDRB; + Strm() << OOO_STRING_SVTOOLS_RTF_PGBRDRB; OutRTFBorder(pLine, aBox.GetDistance(BOX_LINE_BOTTOM)); } pLine = aBox.GetRight(); if(pLine) { - Strm() << sRTF_PGBRDRR; + Strm() << OOO_STRING_SVTOOLS_RTF_PGBRDRR; OutRTFBorder(pLine, aBox.GetDistance(BOX_LINE_LEFT)); } pLine = aBox.GetLeft(); if(pLine) { - Strm() << sRTF_PGBRDRL; + Strm() << OOO_STRING_SVTOOLS_RTF_PGBRDRL; OutRTFBorder(pLine, aBox.GetDistance(BOX_LINE_RIGHT)); } } @@ -1546,13 +1529,13 @@ void SwRTFWriter::OutRTFPageDescription( const SwPageDesc& rPgDsc, { if( bFirstLine && bWriteAll && pCurPam->GetPoint()->nNode == pOrigPam->Start()->nNode ) - Strm() << sRTF_SECTD << sRTF_SBKNONE; + Strm() << OOO_STRING_SVTOOLS_RTF_SECTD << OOO_STRING_SVTOOLS_RTF_SBKNONE; else - Strm() << sRTF_SECT << sRTF_SECTD; + Strm() << OOO_STRING_SVTOOLS_RTF_SECT << OOO_STRING_SVTOOLS_RTF_SECTD; } if( pAktPageDesc->GetLandscape() ) - Strm() << sRTF_LNDSCPSXN; + Strm() << OOO_STRING_SVTOOLS_RTF_LNDSCPSXN; const SwFmt *pFmt = &pAktPageDesc->GetMaster(); //GetLeft(); OutRTF_SwFmt( *this, *pFmt ); @@ -1583,7 +1566,7 @@ void SwRTFWriter::OutRTFPageDescription( const SwPageDesc& rPgDsc, if( pAktPageDesc != &rPgDsc ) { pAktPageDesc = &rPgDsc; - Strm() << sRTF_TITLEPG; + Strm() << OOO_STRING_SVTOOLS_RTF_TITLEPG; // die Header/Footer der 1. Seite ausgeben const SfxPoolItem* pHt; @@ -1619,7 +1602,7 @@ BOOL SwRTFWriter::OutBreaks( const SfxItemSet& rSet ) { pAktPageDesc = ((SwFmtPageDesc*)pItem)->GetPageDesc(); // FALSE wegen schliessender Klammer !! - OutComment( *this, sRTF_PGDSCNO, FALSE ); + OutComment( *this, OOO_STRING_SVTOOLS_RTF_PGDSCNO, FALSE ); OutULong( nPos ) << '}'; // nicht weiter, in Styles gibts keine SectionControls !! @@ -1640,7 +1623,7 @@ BOOL SwRTFWriter::OutBreaks( const SfxItemSet& rSet ) SVX_BREAK_PAGE_BOTH == rBreak.GetBreak() ) { bOutFmtAttr = true; - Strm() << sRTF_PAGE; + Strm() << OOO_STRING_SVTOOLS_RTF_PAGE; } } else @@ -1653,13 +1636,13 @@ BOOL SwRTFWriter::OutBreaks( const SfxItemSet& rSet ) break; case SVX_BREAK_PAGE_BEFORE: bOutFmtAttr = true; - Strm() << sRTF_PAGE; + Strm() << OOO_STRING_SVTOOLS_RTF_PAGE; break; case SVX_BREAK_PAGE_AFTER: - OutComment(*this, sRTF_PGBRK, false) << "0}"; + OutComment(*this, OOO_STRING_SVTOOLS_RTF_PGBRK, false) << "0}"; break; case SVX_BREAK_PAGE_BOTH: - OutComment(*this, sRTF_PGBRK, false) << "1}"; + OutComment(*this, OOO_STRING_SVTOOLS_RTF_PGBRK, false) << "1}"; break; default: break; @@ -1700,7 +1683,7 @@ void SwRTFWriter::CheckEndNodeForSection( const SwNode& rNd ) { if (! bOutPageDesc) { - Strm() << sRTF_SECT << sRTF_SECTD << sRTF_SBKNONE; + Strm() << OOO_STRING_SVTOOLS_RTF_SECT << OOO_STRING_SVTOOLS_RTF_SECTD << OOO_STRING_SVTOOLS_RTF_SBKNONE; OutRTFPageDescription( ( pAktPageDesc ? *pAktPageDesc : const_cast<const SwDoc *>(pDoc) diff --git a/sw/source/filter/rtf/wrtrtf.hxx b/sw/source/filter/rtf/wrtrtf.hxx index 6ab30e4bd4b1..16dcb18ac558 100644 --- a/sw/source/filter/rtf/wrtrtf.hxx +++ b/sw/source/filter/rtf/wrtrtf.hxx @@ -112,7 +112,7 @@ public: const SwFlyFrmFmt* pFlyFmt; // liegt der Node in einem FlyFrame, // ist das Format gesetzt, sonst 0 const SwPageDesc* pAktPageDesc; // aktuell gesetzter PageDesc. - USHORT nBkmkTabPos; // akt. Position in der Bookmark-Tabelle + sal_Int32 nBkmkTabPos; // akt. Position in der Bookmark-Tabelle USHORT nCurScript; // actual scripttype rtl_TextEncoding eDefaultEncoding; rtl_TextEncoding eCurrentEncoding; diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index 12daf9e5dc85..b303147a3893 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -46,10 +46,10 @@ #include <pam.hxx> #include <doc.hxx> #include <docary.hxx> -#include <bookmrk.hxx> // fuer SwBookmark ... +#include <IMark.hxx> #include <numrule.hxx> #include <swerror.h> - +#include <boost/bind.hpp> using namespace ::com::sun::star; @@ -70,7 +70,7 @@ struct Writer_Impl ~Writer_Impl(); void RemoveFontList( SwDoc& rDoc ); - void InsertBkmk( const SwBookmark& rBkmk ); + void InsertBkmk( const ::sw::mark::IMark& rBkmk ); }; Writer_Impl::Writer_Impl( const SwDoc& /*rDoc*/ ) @@ -102,12 +102,12 @@ void Writer_Impl::RemoveFontList( SwDoc& rDoc ) } } -void Writer_Impl::InsertBkmk( const SwBookmark& rBkmk ) +void Writer_Impl::InsertBkmk(const ::sw::mark::IMark& rBkmk) { if( !pBkmkNodePos ) pBkmkNodePos = new SwBookmarkNodeTable; - ULONG nNd = rBkmk.GetBookmarkPos().nNode.GetIndex(); + ULONG nNd = rBkmk.GetMarkPos().nNode.GetIndex(); SvPtrarr* pArr = pBkmkNodePos->Get( nNd ); if( !pArr ) { @@ -118,9 +118,9 @@ void Writer_Impl::InsertBkmk( const SwBookmark& rBkmk ) void* p = (void*)&rBkmk; pArr->Insert( p, pArr->Count() ); - if( rBkmk.GetOtherBookmarkPos() && rBkmk.GetOtherBookmarkPos()->nNode != nNd ) + if(rBkmk.IsExpanded() && rBkmk.GetOtherMarkPos().nNode != nNd) { - nNd = rBkmk.GetOtherBookmarkPos()->nNode.GetIndex(); + nNd = rBkmk.GetOtherMarkPos().nNode.GetIndex(); pArr = pBkmkNodePos->Get( nNd ); if( !pArr ) { @@ -208,26 +208,17 @@ BOOL Writer::CopyNextPam( SwPaM ** ppPam ) // suche die naechste Bookmark-Position aus der Bookmark-Tabelle -USHORT Writer::FindPos_Bkmk( const SwPosition& rPos ) const +sal_Int32 Writer::FindPos_Bkmk(const SwPosition& rPos) const { - USHORT nRet = USHRT_MAX; - const SwBookmarks& rBkmks = pDoc->getBookmarks(); - - if( rBkmks.Count() ) - { - SwBookmark aBkmk( rPos ); - USHORT nPos; - if( rBkmks.Seek_Entry( &aBkmk, &nPos )) - { - // suche abwaerts nach weiteren Bookmarks auf der Cursor-Position - while( 0 < nPos && - rBkmks[ nPos-1 ]->IsEqualPos( aBkmk )) - --nPos; - } - else if( nPos < rBkmks.Count() ) - nRet = nPos; - } - return nRet; + const IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + const IDocumentMarkAccess::const_iterator_t ppBkmk = ::std::lower_bound( + pMarkAccess->getMarksBegin(), + pMarkAccess->getMarksEnd(), + rPos, + ::boost::bind(&::sw::mark::IMark::StartsBefore, _1, _2)); // find the first Mark that does not start before + if(ppBkmk != pMarkAccess->getMarksEnd()) + return ppBkmk - pMarkAccess->getMarksBegin(); + return -1; } @@ -542,19 +533,17 @@ void Writer::_AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont ) // OtherPos of the bookmarks also inserted. void Writer::CreateBookmarkTbl() { - const SwBookmarks& rBkmks = pDoc->getBookmarks(); - for( USHORT n = rBkmks.Count(); n; ) - { - const SwBookmark& rBkmk = *rBkmks[ --n ]; - if( rBkmk.IsBookMark() ) - pImpl->InsertBkmk( rBkmk ); - } + const IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + for(IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->getBookmarksBegin(); + ppBkmk != pMarkAccess->getBookmarksEnd(); + ++ppBkmk) + pImpl->InsertBkmk(**ppBkmk); } // search alle Bookmarks in the range and return it in the Array -USHORT Writer::GetBookmarks( const SwCntntNode& rNd, xub_StrLen nStt, - xub_StrLen nEnd, SvPtrarr& rArr ) +USHORT Writer::GetBookmarks(const SwCntntNode& rNd, xub_StrLen nStt, + xub_StrLen nEnd, SvPtrarr& rArr) { ASSERT( !rArr.Count(), "es sind noch Eintraege vorhanden" ); @@ -573,16 +562,16 @@ USHORT Writer::GetBookmarks( const SwCntntNode& rNd, xub_StrLen nStt, for( n = 0; n < pArr->Count(); ++n ) { void* p = (*pArr)[ n ]; - const SwBookmark& rBkmk = *(SwBookmark*)p; - if( rBkmk.GetBookmarkPos().nNode == nNd && - (nCntnt = rBkmk.GetBookmarkPos().nContent.GetIndex() ) >= nStt && + const ::sw::mark::IMark& rBkmk = *(::sw::mark::IMark *)p; + if( rBkmk.GetMarkPos().nNode == nNd && + (nCntnt = rBkmk.GetMarkPos().nContent.GetIndex() ) >= nStt && nCntnt < nEnd ) { rArr.Insert( p, rArr.Count() ); } - else if( rBkmk.GetOtherBookmarkPos() && nNd == - rBkmk.GetOtherBookmarkPos()->nNode.GetIndex() && (nCntnt = - rBkmk.GetOtherBookmarkPos()->nContent.GetIndex() ) >= nStt && + else if( rBkmk.IsExpanded() && nNd == + rBkmk.GetOtherMarkPos().nNode.GetIndex() && (nCntnt = + rBkmk.GetOtherMarkPos().nContent.GetIndex() ) >= nStt && nCntnt < nEnd ) { rArr.Insert( p, rArr.Count() ); diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index 754eb862a343..f1ca77e20a8e 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -510,7 +510,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, SwFltStackEntry* ( !IsFlagSet(HYPO) || IsFlagSet(BOOK_AND_REF) ) && !pEntry->bConsumedByField) { MakeBookRegionOrPoint(pEntry, pDoc, aRegion, TRUE); - pDoc->makeBookmark( aRegion, aEmptyKeyCode, rName, aEmptyStr, IDocumentBookmarkAccess::BOOKMARK); + pDoc->getIDocumentMarkAccess()->makeMark( aRegion, rName, IDocumentMarkAccess::BOOKMARK); } } break; diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index a066cea10ed4..eb3dfe80b5d0 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -160,7 +160,8 @@ string WW8TableNodeInfoInner::toString() const WW8TableNodeInfo::WW8TableNodeInfo(const SwNode * pNode) : mnDepth(0), - mpNode(pNode) + mpNode(pNode), + mpNext(NULL) { } @@ -241,6 +242,11 @@ void WW8TableNodeInfo::setTable(const SwTable * pTable) getInnerForDepth(mnDepth)->setTable(pTable); } +void WW8TableNodeInfo::setNext(WW8TableNodeInfo * pNext) +{ + mpNext = pNext; +} + void WW8TableNodeInfo::setCell(sal_uInt32 nCell) { getInnerForDepth(mnDepth)->setCell(nCell); @@ -274,6 +280,11 @@ const SwTable * WW8TableNodeInfo::getTable() const return getInnerForDepth(mnDepth)->getTable(); } +WW8TableNodeInfo * WW8TableNodeInfo::getNext() const +{ + return mpNext; +} + bool WW8TableNodeInfo::isEndOfLine() const { return getInnerForDepth(mnDepth)->isEndOfLine(); @@ -340,11 +351,13 @@ void WW8TableInfo::processSwTable(const SwTable * pTable) const SwTableLines & rLines = pTable->GetTabLines(); + WW8TableNodeInfo * pPrev = NULL; + for (USHORT n = 0; n < rLines.Count(); n++) { const SwTableLine * pLine = rLines[n]; - processTableLine(pTable, pLine, n, 1); + pPrev = processTableLine(pTable, pLine, n, 1, pPrev); } #ifdef DEBUG @@ -352,11 +365,11 @@ void WW8TableInfo::processSwTable(const SwTable * pTable) #endif } -void +WW8TableNodeInfo * WW8TableInfo::processTableLine(const SwTable * pTable, const SwTableLine * pTableLine, sal_uInt32 nRow, - sal_uInt32 nDepth) + sal_uInt32 nDepth, WW8TableNodeInfo * pPrev) { #ifdef DEBUG ::std::clog << "<processTableLine row=\"" << nRow << "\" depth=\"" @@ -371,12 +384,14 @@ WW8TableInfo::processTableLine(const SwTable * pTable, { const SwTableBox * pBox = rBoxes[n]; - processTableBox(pTable, pBox, nRow, n, nDepth, n == rBoxes.Count() - 1); + pPrev = processTableBox(pTable, pBox, nRow, n, nDepth, n == rBoxes.Count() - 1, pPrev); } #ifdef DEBUG ::std::clog << "</processTableLine>" << ::std::endl; #endif + + return pPrev; } WW8TableNodeInfo::Pointer_t @@ -435,13 +450,14 @@ WW8TableInfo::processTableBoxLines(const SwTableBox * pBox, } -void +WW8TableNodeInfo * WW8TableInfo::processTableBox(const SwTable * pTable, const SwTableBox * pBox, sal_uInt32 nRow, sal_uInt32 nCell, sal_uInt32 nDepth, - bool bEndOfLine) + bool bEndOfLine, + WW8TableNodeInfo * pPrev) { #ifdef DEBUG ::std::clog << "<processTableBox row=\"" << nRow << "\" cell=\"" << nCell @@ -464,7 +480,7 @@ WW8TableInfo::processTableBox(const SwTable * pTable, { const SwTableLine * pLine = rLines[n]; - processTableLine(pTable, pLine, n, 1); + pPrev = processTableLine(pTable, pLine, n, 1, pPrev); } } else @@ -488,6 +504,11 @@ WW8TableInfo::processTableBox(const SwTable * pTable, pNodeInfo = insertTableNodeInfo(&rNode, pTable, pBox, nRow, nCell, nDepth); + if (pPrev != NULL) + pPrev->setNext(pNodeInfo.get()); + + pPrev = pNodeInfo.get(); + if (nDepthInsideCell == 1 && rNode.IsTxtNode()) pEndOfCellInfo = pNodeInfo; @@ -520,6 +541,8 @@ WW8TableInfo::processTableBox(const SwTable * pTable, #ifdef DEBUG ::std::clog << "</processTableBox>" << ::std::endl; #endif + + return pPrev; } WW8TableNodeInfo::Pointer_t WW8TableInfo::insertTableNodeInfo @@ -566,4 +589,21 @@ WW8TableNodeInfo::Pointer_t WW8TableInfo::getTableNodeInfo return pResult; } +const SwNode * WW8TableInfo::getNextNode(const SwNode * pNode) +{ + const SwNode * pResult = NULL; + + WW8TableNodeInfo::Pointer_t pNodeInfo = getTableNodeInfo(pNode); + + if (pNodeInfo.get() != NULL) + { + WW8TableNodeInfo * pNextInfo = pNodeInfo->getNext(); + + if (pNextInfo != NULL) + pResult = pNextInfo->getNode(); + } + + return pResult; +} + } diff --git a/sw/source/filter/ww8/WW8TableInfo.hxx b/sw/source/filter/ww8/WW8TableInfo.hxx index b02ca2219007..a2d03337fb29 100644 --- a/sw/source/filter/ww8/WW8TableInfo.hxx +++ b/sw/source/filter/ww8/WW8TableInfo.hxx @@ -96,6 +96,7 @@ private: sal_uInt32 mnDepth; const SwNode * mpNode; Inners_t mInners; + WW8TableNodeInfo * mpNext; public: typedef boost::shared_ptr<WW8TableNodeInfo> Pointer_t; @@ -110,6 +111,7 @@ public: void setTable(const SwTable * pTable); void setCell(sal_uInt32 nCell); void setRow(sal_uInt32 nRow); + void setNext(WW8TableNodeInfo * pNext); sal_uInt32 getDepth() const; bool isEndOfLine() const; @@ -117,6 +119,7 @@ public: const SwNode * getNode() const; const SwTableBox * getTableBox() const; const SwTable * getTable() const; + WW8TableNodeInfo * getNext() const; const Inners_t & getInners() const; const WW8TableNodeInfoInner::Pointer_t getFirstInner() const; @@ -139,18 +142,18 @@ class WW8TableInfo typedef hash_map<const SwNode *, WW8TableNodeInfo::Pointer_t, hashNode > Map_t; Map_t mMap; - void + WW8TableNodeInfo * processTableLine(const SwTable * pTable, const SwTableLine * pTableLine, sal_uInt32 nRow, - sal_uInt32 nDepth); + sal_uInt32 nDepth, WW8TableNodeInfo * pPrev); - void + WW8TableNodeInfo * processTableBox(const SwTable * pTable, const SwTableBox * pTableBox, sal_uInt32 nRow, sal_uInt32 nCell, - sal_uInt32 nDepth, bool bEndOfLine); + sal_uInt32 nDepth, bool bEndOfLine, WW8TableNodeInfo * pPrev); WW8TableNodeInfo::Pointer_t processTableBoxLines(const SwTableBox * pBox, @@ -176,6 +179,7 @@ public: void processSwTable(const SwTable * pTable); WW8TableNodeInfo::Pointer_t getTableNodeInfo(const SwNode * pNode); + const SwNode * getNextNode(const SwNode * pNode); }; } diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index 8bc7c894d8d0..6aec829b8649 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -407,19 +407,6 @@ namespace sw } } #endif - - const OutlinerParaObject* GetOutlinerParaObject(const SdrTextObj &rObj) - { - /* - #i13885# - When the object is actively being edited, that text is not set into - the objects normal text object, but lives in a seperate object. - */ - if (rObj.IsTextEditActive()) - return rObj.GetEditOutlinerParaObject(); - else - return rObj.GetOutlinerParaObject(); - } } namespace util diff --git a/sw/source/filter/ww8/writerhelper.hxx b/sw/source/filter/ww8/writerhelper.hxx index 5add6ccec743..fa8a17fd5312 100644 --- a/sw/source/filter/ww8/writerhelper.hxx +++ b/sw/source/filter/ww8/writerhelper.hxx @@ -974,31 +974,6 @@ namespace sw DrawingOLEAdaptor(const DrawingOLEAdaptor &rDoc); }; - /** Get the Outliner Object from a SdrTextObj that contains the visible - text - - A SdrTextObj contains an object which describes its text, but - frustratingly if the object is being actively edited this new text - outliner object is stored seperately from the previous preedit - outliner. So objects being edited have to be handled differently - from those that are not to return the currently being edited - outliner if its exists, and the normal outliner if not. This method - just gives me the text outliner that contains the visible text, - which is all anyone could really care about. - - See OpenOffice.org issue 13885 - (http://www.openoffice.org/issues/show_bug.cgi?id=13885) - - @param SdrTextObj - The SdrTextObj from which we want to get the text content. - - @return the OutlinerParaObject that describes the user visible text - - @author - <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> - */ - const OutlinerParaObject* GetOutlinerParaObject(const SdrTextObj &rObj); - #ifdef DEBUGDUMP /** Create a SvStream to dump data to during debugging diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index a88f2ca4db22..bc0bd7806782 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1163,8 +1163,30 @@ void SwWW8Writer::WriteSdrTextObj(const SdrObject& rObj, BYTE nTyp) if (!pTxtObj) return; - if (const OutlinerParaObject* pParaObj = sw::hack::GetOutlinerParaObject(*pTxtObj)) + const OutlinerParaObject* pParaObj = 0; + bool bOwnParaObj = false; + + /* + #i13885# + When the object is actively being edited, that text is not set into + the objects normal text object, but lives in a seperate object. + */ + if (pTxtObj->IsTextEditActive()) + { + pParaObj = pTxtObj->GetEditOutlinerParaObject(); + bOwnParaObj = true; + } + else + { + pParaObj = pTxtObj->GetOutlinerParaObject(); + } + + if( pParaObj ) + { WriteOutliner(*pParaObj, nTyp); + if( bOwnParaObj ) + delete pParaObj; + } } void SwWW8Writer::WriteOutliner(const OutlinerParaObject& rParaObj, BYTE nTyp) diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index cb195989a1ea..2d6f3b73f5a3 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -104,7 +104,7 @@ #include <numrule.hxx> #include "wrtww8.hxx" #include "ww8par.hxx" -#include <bookmrk.hxx> +#include <IMark.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::i18n; @@ -1542,44 +1542,44 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) { sal_Unicode ch=aStr.GetChar(nAktPos); int ofs=(ch==CH_TXT_ATR_FIELDSTART || ch==CH_TXT_ATR_FIELDEND || ch==CH_TXT_ATR_FORMELEMENT?1:0); - - if (ch==CH_TXT_ATR_FIELDSTART) { - SwPosition aPosition( *pNd, SwIndex( (SwTxtNode*)pNd, nAktPos+1 ) ); - SwFieldBookmark* pFieldmark=(SwFieldBookmark*)rWW8Wrt.pDoc->getFieldBookmarkFor( aPosition ); - ASSERT(pFieldmark!=NULL, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??"); - - if (pFieldmark!=NULL) { - rWW8Wrt.AppendBookmark( pFieldmark->GetName(), 1); - } + IDocumentMarkAccess* const pMarkAccess = rWW8Wrt.pDoc->getIDocumentMarkAccess(); + if(ch==CH_TXT_ATR_FIELDSTART) + { + SwPosition aPosition(*pNd, SwIndex((SwTxtNode*)pNd, nAktPos+1)); + ::sw::mark::IFieldmark const * const pFieldmark=pMarkAccess->getFieldmarkFor(aPosition); + OSL_ENSURE(pFieldmark, + "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??"); + if(pFieldmark) + rWW8Wrt.AppendBookmark(pFieldmark->GetName(), 1); rWW8Wrt.OutField(NULL, ww::eFORMTEXT, String::CreateFromAscii(" FORMTEXT "), WRITEFIELD_START | WRITEFIELD_CMD_START); - if (pFieldmark!=NULL) { - rWW8Wrt.WriteFormData( *pFieldmark ); - } + if(pFieldmark) + rWW8Wrt.WriteFormData(*pFieldmark); rWW8Wrt.OutField(NULL, ww::eFORMTEXT, String(), WRITEFIELD_CMD_END); - } else if (ch==CH_TXT_ATR_FIELDEND) { - SwPosition aPosition( *pNd, SwIndex( (SwTxtNode*)pNd, nAktPos ) ); - SwFieldBookmark* pFieldmark=(SwFieldBookmark*)rWW8Wrt.pDoc->getFieldBookmarkFor( aPosition ); - ASSERT(pFieldmark!=NULL, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??"); + } + else if (ch==CH_TXT_ATR_FIELDEND) + { + SwPosition aPosition(*pNd, SwIndex((SwTxtNode*)pNd, nAktPos)); + ::sw::mark::IFieldmark const * const pFieldmark=pMarkAccess->getFieldmarkFor(aPosition); + OSL_ENSURE(pFieldmark, + "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??"); rWW8Wrt.OutField(NULL, ww::eFORMTEXT, String(), WRITEFIELD_CLOSE); - if (pFieldmark!=NULL) { - rWW8Wrt.AppendBookmark( pFieldmark->GetName(), 0); - } - } else if (ch==CH_TXT_ATR_FORMELEMENT) { - SwPosition aPosition( *pNd, SwIndex( (SwTxtNode*)pNd, nAktPos ) ); - SwFieldBookmark* pFieldmark=rWW8Wrt.pDoc->getFormFieldBookmarkFor( aPosition ); - ASSERT(pFieldmark!=NULL, "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??"); - if (pFieldmark!=NULL) { - rWW8Wrt.AppendBookmark( pFieldmark->GetName(), 1); - } + if (pFieldmark) + rWW8Wrt.AppendBookmark(pFieldmark->GetName(), 0); + } + else if (ch==CH_TXT_ATR_FORMELEMENT) + { + SwPosition aPosition(*pNd, SwIndex((SwTxtNode*)pNd, nAktPos)); + ::sw::mark::IFieldmark const * const pFieldmark=pMarkAccess->getFieldmarkFor(aPosition); + OSL_ENSURE(pFieldmark, + "Looks like this doc is broken...; where is the Fieldmark for the FIELDSTART??"); + if(pFieldmark) + rWW8Wrt.AppendBookmark(pFieldmark->GetName(), 1); rWW8Wrt.OutField(NULL, ww::eFORMCHECKBOX, String::CreateFromAscii(" FORMCHECKBOX "), WRITEFIELD_START | WRITEFIELD_CMD_START); - if (pFieldmark!=NULL) { - - rWW8Wrt.WriteFormData( *pFieldmark ); - } + if(pFieldmark) + rWW8Wrt.WriteFormData(*pFieldmark); rWW8Wrt.OutField(NULL, ww::eFORMCHECKBOX, String(), WRITEFIELD_CMD_END | WRITEFIELD_CLOSE); - if (pFieldmark!=NULL) { - rWW8Wrt.AppendBookmark( pFieldmark->GetName(), 0); - } + if(pFieldmark) + rWW8Wrt.AppendBookmark(pFieldmark->GetName(), 0); } nLen-=static_cast<USHORT>(ofs); String aSnippet(aAttrIter.GetSnippet(aStr, nAktPos+static_cast<USHORT>(ofs), nLen)); @@ -1592,7 +1592,7 @@ Writer& OutWW8_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) aSnippet.Insert(0x09,0); } } - rWW8Wrt.OutSwString(aSnippet, 0, nLen, bUnicode, eChrSet ); + rWW8Wrt.OutSwString(aSnippet, 0, nLen, bUnicode, eChrSet); } if (aAttrIter.IsDropCap(nNextAttr)) diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 0f5372b1f7a0..c77427c39c7f 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -77,7 +77,7 @@ #include <shellio.hxx> #include <docstat.hxx> #include <pagedesc.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <swtable.hxx> #include <wrtww8.hxx> #include <ww8par.hxx> @@ -100,7 +100,7 @@ #include "writerhelper.hxx" #include "writerwordglue.hxx" -#include <IDocumentBookmarkAccess.hxx> +#include <IDocumentMarkAccess.hxx> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> @@ -176,7 +176,7 @@ class WW8_WrtBookmarks { private: SvULongs aSttCps, aEndCps; // Array of Start- and End CPs - SvBools aFieldBookmarks; // If the bookmark is in a field result + SvBools aFieldMarks; // If the bookmark is in a field result std::vector<String> maSwBkmkNms; // Array of Sw - Bookmarknames typedef std::vector<String>::iterator myIter; @@ -189,9 +189,9 @@ public: WW8_WrtBookmarks(); ~WW8_WrtBookmarks(); - void Append( WW8_CP nStartCp, const String& rNm, const SwBookmark* pBkmk=NULL ); + void Append( WW8_CP nStartCp, const String& rNm, const ::sw::mark::IMark* pBkmk=NULL ); void Write( SwWW8Writer& rWrt ); - void MoveFieldBookmarks(ULONG nFrom,ULONG nTo); + void MoveFieldMarks(ULONG nFrom,ULONG nTo); // String GetWWBkmkName( const String& rName ) const; }; @@ -1228,7 +1228,7 @@ WW8_WrtBookmarks::~WW8_WrtBookmarks() { } -void WW8_WrtBookmarks::Append( WW8_CP nStartCp, const String& rNm, const SwBookmark* ) +void WW8_WrtBookmarks::Append( WW8_CP nStartCp, const String& rNm, const ::sw::mark::IMark* ) { USHORT nPos = GetPos( rNm ); if( USHRT_MAX == nPos ) @@ -1246,7 +1246,7 @@ void WW8_WrtBookmarks::Append( WW8_CP nStartCp, const String& rNm, const SwBook aSttCps.Insert(nStartCp, nPos); aEndCps.Insert(nStartCp, nPos); - aFieldBookmarks.Insert(BOOL(false), nPos); + aFieldMarks.Insert(BOOL(false), nPos); maSwBkmkNms.insert(aIter, rNm); } else @@ -1257,7 +1257,7 @@ void WW8_WrtBookmarks::Append( WW8_CP nStartCp, const String& rNm, const SwBook //If this bookmark was around a field in writer, then we want to move //it to the field result in word. The end is therefore one cp //backwards from the 0x15 end mark that was inserted. - if (aFieldBookmarks[nPos]) + if (aFieldMarks[nPos]) --nStartCp; aEndCps.Replace( nStartCp, nPos ); @@ -1330,7 +1330,7 @@ USHORT WW8_WrtBookmarks::GetPos( const String& rNm ) return nRet; } -void WW8_WrtBookmarks::MoveFieldBookmarks(ULONG nFrom, ULONG nTo) +void WW8_WrtBookmarks::MoveFieldMarks(ULONG nFrom, ULONG nTo) { for (USHORT nI=0;nI<aSttCps.Count();++nI) { @@ -1339,7 +1339,7 @@ void WW8_WrtBookmarks::MoveFieldBookmarks(ULONG nFrom, ULONG nTo) aSttCps[nI] = nTo; if (aEndCps[nI] == nFrom) { - aFieldBookmarks[nI] = true; + aFieldMarks[nI] = true; aEndCps[nI] = nTo; } } @@ -1347,7 +1347,7 @@ void WW8_WrtBookmarks::MoveFieldBookmarks(ULONG nFrom, ULONG nTo) } void SwWW8Writer::AppendBookmarks( const SwTxtNode& rNd, - xub_StrLen nAktPos, xub_StrLen nLen ) + xub_StrLen nAktPos, xub_StrLen nLen ) { SvPtrarr aArr( 8, 8 ); USHORT nCntnt; @@ -1357,19 +1357,19 @@ void SwWW8Writer::AppendBookmarks( const SwTxtNode& rNd, ULONG nNd = rNd.GetIndex(), nSttCP = Fc2Cp( Strm().Tell() ); for( USHORT n = 0; n < aArr.Count(); ++n ) { - const SwBookmark& rBkmk = *(SwBookmark*)aArr[ n ]; - - if (rBkmk.IsFormFieldMark()) { + ::sw::mark::IMark& rBkmk = *(::sw::mark::IMark*)aArr[ n ]; + if(dynamic_cast< ::sw::mark::IFieldmark *>(&rBkmk)) continue; - } - const SwPosition* pPos = &rBkmk.GetBookmarkPos(), - * pOPos = rBkmk.GetOtherBookmarkPos(); + const SwPosition* pPos = &rBkmk.GetMarkPos(); + const SwPosition* pOPos = 0; + if(rBkmk.IsExpanded()) + pOPos = &rBkmk.GetOtherMarkPos(); if( pOPos && pOPos->nNode == pPos->nNode && pOPos->nContent < pPos->nContent ) { - pOPos = pPos; - pPos = rBkmk.GetOtherBookmarkPos(); + pPos = pOPos; + pOPos = &rBkmk.GetMarkPos(); } if( !pOPos || ( nNd == pPos->nNode.GetIndex() && @@ -1390,15 +1390,15 @@ void SwWW8Writer::AppendBookmarks( const SwTxtNode& rNd, } } -void SwWW8Writer::MoveFieldBookmarks(ULONG nFrom, ULONG nTo) +void SwWW8Writer::MoveFieldMarks(ULONG nFrom, ULONG nTo) { - pBkmks->MoveFieldBookmarks(nFrom, nTo); + pBkmks->MoveFieldMarks(nFrom, nTo); } -void SwWW8Writer::AppendBookmark( const String& rName, USHORT nOffset ) +void SwWW8Writer::AppendBookmark(const String& rName, USHORT nOffset) { - ULONG nSttCP = Fc2Cp( Strm().Tell() ) + nOffset; - pBkmks->Append( nSttCP, rName ); + ULONG nSttCP = Fc2Cp(Strm().Tell()) + nOffset; + pBkmks->Append(nSttCP, rName); } @@ -2383,7 +2383,15 @@ void SwWW8Writer::WriteText() if( pNd == &pNd->GetNodes().GetEndOfContent() ) break; - ULONG nPos = pCurPam->GetPoint()->nNode++; // Bewegen + 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() ); // Wie weit ? } @@ -3177,19 +3185,25 @@ void WW8SHDLong::Write(SwWW8Writer & rWriter) rWriter.InsUInt16(m_ipat); } -void SwWW8Writer::WriteFormData(SwFieldBookmark &rFieldmark) +void SwWW8Writer::WriteFormData(const ::sw::mark::IFieldmark& rFieldmark) { ASSERT(bWrtWW8, "No 95 export yet"); if (!bWrtWW8) return; - int type=rFieldmark.GetFieldType(); - const String ffname=rFieldmark.GetFFName(); + const ::sw::mark::IFieldmark* pFieldmark = &rFieldmark; + const ::sw::mark::ICheckboxFieldmark* pAsCheckbox = dynamic_cast< const ::sw::mark::ICheckboxFieldmark* >(pFieldmark); + + int type=0; // TextFieldmark + if(pAsCheckbox) type=1; + + const ::rtl::OUString ffname = rFieldmark.GetFieldname(); ULONG nDataStt = pDataStrm->Tell(); - pChpPlc->AppendFkpEntry( Strm().Tell() ); + pChpPlc->AppendFkpEntry(Strm().Tell()); - WriteChar( 0x01 ); - static BYTE aArr1[] = { + WriteChar(0x01); + static BYTE aArr1[] = + { 0x03, 0x6a, 0,0,0,0, // sprmCPicLocation 0x06, 0x08, 0x01, // sprmCFData @@ -3197,10 +3211,9 @@ void SwWW8Writer::WriteFormData(SwFieldBookmark &rFieldmark) 0x02, 0x08, 0x01 // sprmCFFldVanish }; BYTE* pDataAdr = aArr1 + 2; - Set_UInt32( pDataAdr, nDataStt ); + Set_UInt32(pDataAdr, nDataStt); - pChpPlc->AppendFkpEntry(Strm().Tell(), - sizeof( aArr1 ), aArr1 ); + pChpPlc->AppendFkpEntry(Strm().Tell(), sizeof(aArr1), aArr1); sal_uInt8 aFldHeader[] = { @@ -3209,15 +3222,17 @@ void SwWW8Writer::WriteFormData(SwFieldBookmark &rFieldmark) }; aFldHeader[4] |= (type & 0x03); - int ffres=rFieldmark.GetFFRes(); + int ffres=0; // rFieldmark.GetFFRes(); + if(pAsCheckbox && pAsCheckbox->IsChecked()) + ffres=1; aFldHeader[4] |= ((ffres<<2) & 0x7C); - const String ffdeftext; - const String ffformat; - const String ffhelptext; - const String ffstattext; - const String ffentrymcr; - const String ffexitmcr; + const ::rtl::OUString ffdeftext; + const ::rtl::OUString ffformat; + const ::rtl::OUString ffhelptext; + const ::rtl::OUString ffstattext; + const ::rtl::OUString ffentrymcr; + const ::rtl::OUString ffexitmcr; const sal_uInt8 aFldData[] = { @@ -3231,43 +3246,45 @@ void SwWW8Writer::WriteFormData(SwFieldBookmark &rFieldmark) }; int slen=sizeof(aFldData) +sizeof(aFldHeader) - +2*ffname.Len()+4 - +2*ffdeftext.Len()+4 - +2*ffformat.Len()+4 - +2*ffhelptext.Len()+4 - +2*ffstattext.Len()+4 - +2*ffentrymcr.Len()+4 - +2*ffexitmcr.Len()+4; + +2*ffname.getLength()+4 + +2*ffdeftext.getLength()+4 + +2*ffformat.getLength()+4 + +2*ffhelptext.getLength()+4 + +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; - int len=sizeof(aFldData) ; - assert(len==0x44); - pDataStrm->Write( aFldData, len); + int len=sizeof(aFldData); + OSL_ENSURE(len==0x44, + "SwWW8Writer::WriteFormData(..)" + " - wrong aFldData length"); + pDataStrm->Write(aFldData, len); len=sizeof(aFldHeader); - assert(len==8); - pDataStrm->Write( aFldHeader, len); + OSL_ENSURE(len==8, + "SwWW8Writer::WriteFormData(..)" + " - wrong aFldHeader length"); + pDataStrm->Write(aFldHeader, len); - WriteString_xstz( *pDataStrm, ffname, true); // Form field name + WriteString_xstz(*pDataStrm, ffname, true); // Form field name - if (type==0) { - WriteString_xstz( *pDataStrm, ffdeftext, true); - } else { + if (type==0) + WriteString_xstz(*pDataStrm, ffdeftext, true); + else pDataStrm->WriteNumber((sal_uInt16)0); - } - WriteString_xstz( *pDataStrm, ffformat, true); - WriteString_xstz( *pDataStrm, ffhelptext, true); - WriteString_xstz( *pDataStrm, ffstattext, true); - WriteString_xstz( *pDataStrm, ffentrymcr, true); - WriteString_xstz( *pDataStrm, ffexitmcr, true); - if (type==2) { - // 0xFF, 0xFF - // sal_uInt32 number of strings - // (sal_uInt16 len; sal_uInt16 unicode char[len])*num of strings - } - + WriteString_xstz(*pDataStrm, String(ffformat), true); + WriteString_xstz(*pDataStrm, String(ffhelptext), true); + WriteString_xstz(*pDataStrm, String(ffstattext), true); + WriteString_xstz(*pDataStrm, String(ffentrymcr), true); + WriteString_xstz(*pDataStrm, String(ffexitmcr), true); +// if (type==2) { +// // 0xFF, 0xFF +// // sal_uInt32 number of strings +// // (sal_uInt16 len; sal_uInt16 unicode char[len])*num of strings +// } } void SwWW8Writer::OutWW8_TableNodeInfoInner(ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index b5c62dd057a5..87414259edbe 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -589,7 +589,7 @@ public: xub_StrLen nLen ); void AppendBookmark( const String& rName, USHORT nOffset = 0 ); String GetBookmarkName( USHORT nTyp, const String* pNm, USHORT nSeqNo ); - void MoveFieldBookmarks(ULONG nFrom, ULONG nTo); + void MoveFieldMarks(ULONG nFrom, ULONG nTo); bool HasRefToObject(USHORT nTyp, const String* pNm, USHORT nSeqNo); void WriteAsStringTable(const ::std::vector<String>&, INT32& rfcSttbf, @@ -730,7 +730,7 @@ public: void CollectOutlineBookmarks(const SwDoc &rDoc); void AddBookmark(String sBkmkName); - void WriteFormData(SwFieldBookmark &rFieldmark); + void WriteFormData(const ::sw::mark::IFieldmark& rFieldmark); WW8_WrPlcFld* CurrentFieldPlc() const; private: //No copying diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index d3c2648c9d87..1d608c1004fe 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2520,12 +2520,12 @@ static Writer& OutWW8_SwField( Writer& rWrt, const SfxPoolItem& rHt ) /* Is there a bookmark at the start position of this field, if so move it to the 0x14 of the result of the field. This is what word - does. MoveFieldBookmarks moves any bookmarks at this position to + does. MoveFieldMarks moves any bookmarks at this position to the beginning of the field result, and marks the bookmark as a fieldbookmark which is to be ended before the field end mark instead of after it like a normal bookmark. */ - rWW8Wrt.MoveFieldBookmarks(nFrom,rWW8Wrt.Fc2Cp(rWrt.Strm().Tell())); + rWW8Wrt.MoveFieldMarks(nFrom,rWW8Wrt.Fc2Cp(rWrt.Strm().Tell())); if (rVar.Len()) { diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index e93c3339bc73..b02ba42344eb 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -64,6 +64,7 @@ #include <svx/unoapi.hxx> #include <svx/svdoole2.hxx> #include <svx/msdffimp.hxx> +#include <svx/svdoashp.hxx> #include <svx/svxerr.hxx> #include <svx/mscodec.hxx> #include <svx/svdmodel.hxx> @@ -74,7 +75,7 @@ #include <fmtfld.hxx> #include <fmturl.hxx> #include <fmtinfmt.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <reffld.hxx> #include <fmthdft.hxx> #include <fmtcntnt.hxx> @@ -153,7 +154,7 @@ SwMSDffManager::SwMSDffManager( SwWW8ImplReader& rRdr ) rRdr.maTracer.GetTrace()), rReader(rRdr), pFallbackStream(0), pOldEscherBlipCache(0) { - SetSvxMSDffSettings( GetSvxMSDffSettings() | SVXMSDFF_SETTINGS_IMPORT_IAS ); // #i27541# + SetSvxMSDffSettings( GetSvxMSDffSettings() ); nSvxMSDffOLEConvFlags = SwMSDffManager::GetFilterFlags(); } @@ -275,7 +276,6 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, { SvxMSDffImportData& rImportData = *(SvxMSDffImportData*)pData; SvxMSDffImportRec* pImpRec = new SvxMSDffImportRec; - SvxMSDffImportRec* pTextImpRec = pImpRec; // fill Import Record with data pImpRec->nShapeId = rObjData.nShapeId; @@ -333,8 +333,6 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, } // Textrahmen, auch Title oder Outline - SdrObject* pOrgObj = pObj; - SdrRectObj* pTextObj = 0; UINT32 nTextId = GetPropertyValue( DFF_Prop_lTxid, 0 ); if( nTextId ) { @@ -361,12 +359,6 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, ); } - if (bIsSimpleDrawingTextBox) - { - SdrObject::Free( pObj ); - pObj = pOrgObj = 0; - } - // Distance of Textbox to it's surrounding Autoshape INT32 nTextLeft = GetPropertyValue( DFF_Prop_dxTextLeft, 91440L); INT32 nTextRight = GetPropertyValue( DFF_Prop_dxTextRight, 91440L ); @@ -450,8 +442,11 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, } } - pTextObj = new SdrRectObj(OBJ_TEXT, rTextRect); - pTextImpRec = new SvxMSDffImportRec(*pImpRec); + if (bIsSimpleDrawingTextBox) + { + SdrObject::Free( pObj ); + pObj = new SdrRectObj(OBJ_TEXT, rTextRect); + } // Die vertikalen Absatzeinrueckungen sind im BoundRect mit drin, // hier rausrechnen @@ -470,13 +465,13 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, if( GetShapeInfos()->Seek_Entry( &aTmpRec, &nFound ) ) { SvxMSDffShapeInfo& rInfo = *GetShapeInfos()->GetObject(nFound); - pTextImpRec->bReplaceByFly = rInfo.bReplaceByFly; - pTextImpRec->bLastBoxInChain = rInfo.bLastBoxInChain; + pImpRec->bReplaceByFly = rInfo.bReplaceByFly; + pImpRec->bLastBoxInChain = rInfo.bLastBoxInChain; } } - if( !pObj ) - ApplyAttributes( rSt, aSet, rObjData.eShapeType, rObjData.nSpFlags ); + if( bIsSimpleDrawingTextBox ) + ApplyAttributes( rSt, aSet, rObjData ); bool bFitText = false; if (GetPropertyValue(DFF_Prop_FitTextToShape) & 2) @@ -499,7 +494,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, { case mso_wrapNone : aSet.Put( SdrTextAutoGrowWidthItem( TRUE ) ); - pTextImpRec->bAutoWidth = true; + pImpRec->bAutoWidth = true; break; case mso_wrapByPoints : aSet.Put( SdrTextContourFrameItem( TRUE ) ); @@ -513,139 +508,124 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, aSet.Put( SdrTextRightDistItem( nTextRight ) ); aSet.Put( SdrTextUpperDistItem( nTextTop ) ); aSet.Put( SdrTextLowerDistItem( nTextBottom ) ); - pTextImpRec->nDxTextLeft = nTextLeft; - pTextImpRec->nDyTextTop = nTextTop; - pTextImpRec->nDxTextRight = nTextRight; - pTextImpRec->nDyTextBottom = nTextBottom; - - // Textverankerung lesen - if ( IsProperty( DFF_Prop_anchorText ) ) + pImpRec->nDxTextLeft = nTextLeft; + pImpRec->nDyTextTop = nTextTop; + pImpRec->nDxTextRight = nTextRight; + pImpRec->nDyTextBottom = nTextBottom; + + // --> SJ 2009-03-06 : taking the correct default (which is mso_anchorTop) + MSO_Anchor eTextAnchor = + (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop ); + + SdrTextVertAdjust eTVA = bVerticalText + ? SDRTEXTVERTADJUST_BLOCK + : SDRTEXTVERTADJUST_CENTER; + SdrTextHorzAdjust eTHA = bVerticalText + ? SDRTEXTHORZADJUST_CENTER + : SDRTEXTHORZADJUST_BLOCK; + + switch( eTextAnchor ) { - MSO_Anchor eTextAnchor = - (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText ); - - // --> OD 2005-02-17 #i42783#, #b6227886# - // consider vertical text and use correct defaults - SdrTextVertAdjust eTVA = bVerticalText - ? SDRTEXTVERTADJUST_BLOCK - : SDRTEXTVERTADJUST_CENTER; - SdrTextHorzAdjust eTHA = bVerticalText - ? SDRTEXTHORZADJUST_CENTER - : SDRTEXTHORZADJUST_BLOCK; - - switch( eTextAnchor ) + case mso_anchorTop: { - case mso_anchorTop: - { - if ( bVerticalText ) - eTHA = SDRTEXTHORZADJUST_RIGHT; - else - eTVA = SDRTEXTVERTADJUST_TOP; - } - break; - case mso_anchorTopCentered: - { - if ( bVerticalText ) - eTHA = SDRTEXTHORZADJUST_RIGHT; - else - eTVA = SDRTEXTVERTADJUST_TOP; - } - break; - case mso_anchorMiddle: - break; - case mso_anchorMiddleCentered: - break; - case mso_anchorBottom: - { - if ( bVerticalText ) - eTHA = SDRTEXTHORZADJUST_LEFT; - else - eTVA = SDRTEXTVERTADJUST_BOTTOM; - } - break; - case mso_anchorBottomCentered: - { - if ( bVerticalText ) - eTHA = SDRTEXTHORZADJUST_LEFT; - else - eTVA = SDRTEXTVERTADJUST_BOTTOM; - } - break; - /* - case mso_anchorTopBaseline: - case mso_anchorBottomBaseline: - case mso_anchorTopCenteredBaseline: - case mso_anchorBottomCenteredBaseline: - break; - */ - default: - ; + if ( bVerticalText ) + eTHA = SDRTEXTHORZADJUST_RIGHT; + else + eTVA = SDRTEXTVERTADJUST_TOP; } - // <-- - // Einsetzen - aSet.Put( SdrTextVertAdjustItem( eTVA ) ); - aSet.Put( SdrTextHorzAdjustItem( eTHA ) ); - } - // --> OD 2005-02-17 #i42783#, #b6227886# - apply own default values - else - { - if ( bVerticalText ) + break; + case mso_anchorTopCentered: { - aSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_BLOCK ) ); - aSet.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_CENTER ) ); + if ( bVerticalText ) + eTHA = SDRTEXTHORZADJUST_RIGHT; + else + eTVA = SDRTEXTVERTADJUST_TOP; } - else + break; + case mso_anchorMiddle: + break; + case mso_anchorMiddleCentered: + break; + case mso_anchorBottom: { - aSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) ); - aSet.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) ); + if ( bVerticalText ) + eTHA = SDRTEXTHORZADJUST_LEFT; + else + eTVA = SDRTEXTVERTADJUST_BOTTOM; } + break; + case mso_anchorBottomCentered: + { + if ( bVerticalText ) + eTHA = SDRTEXTHORZADJUST_LEFT; + else + eTVA = SDRTEXTVERTADJUST_BOTTOM; + } + break; +/* + case mso_anchorTopBaseline: + case mso_anchorBottomBaseline: + case mso_anchorTopCenteredBaseline: + case mso_anchorBottomCenteredBaseline: + break; +*/ + default: + ; } - // <-- - pTextObj->SetMergedItemSet(aSet); - pTextObj->SetModel(pSdrModel); + aSet.Put( SdrTextVertAdjustItem( eTVA ) ); + aSet.Put( SdrTextHorzAdjustItem( eTHA ) ); - if (bVerticalText) - pTextObj->SetVerticalWriting(sal_True); + pObj->SetMergedItemSet(aSet); + pObj->SetModel(pSdrModel); - if (nTextRotationAngle) - { - long nMinWH = rTextRect.GetWidth() < rTextRect.GetHeight() ? - rTextRect.GetWidth() : rTextRect.GetHeight(); - nMinWH /= 2; - Point aPivot(rTextRect.TopLeft()); - aPivot.X() += nMinWH; - aPivot.Y() += nMinWH; - double a = nTextRotationAngle * nPi180; - pTextObj->NbcRotate(aPivot, nTextRotationAngle, sin(a), cos(a)); - } + if (bVerticalText && dynamic_cast< SdrTextObj* >( pObj ) ) + dynamic_cast< SdrTextObj* >( pObj )->SetVerticalWriting(sal_True); - // rotate text with shape ? - if ( mnFix16Angle ) + if ( bIsSimpleDrawingTextBox ) { - double a = mnFix16Angle * nPi180; - pTextObj->NbcRotate( rObjData.rBoundRect.Center(), mnFix16Angle, - sin( a ), cos( a ) ); + if ( nTextRotationAngle ) + { + long nMinWH = rTextRect.GetWidth() < rTextRect.GetHeight() ? + rTextRect.GetWidth() : rTextRect.GetHeight(); + nMinWH /= 2; + Point aPivot(rTextRect.TopLeft()); + aPivot.X() += nMinWH; + aPivot.Y() += nMinWH; + double a = nTextRotationAngle * nPi180; + pObj->NbcRotate(aPivot, nTextRotationAngle, sin(a), cos(a)); + } } - if( !pObj ) + if ( ( mnFix16Angle || nTextRotationAngle ) && dynamic_cast< SdrObjCustomShape* >( pObj ) ) { - pObj = pTextObj; - } - else - { - if( pTextObj != pObj ) + SdrObjCustomShape* pCustomShape = dynamic_cast< SdrObjCustomShape* >( pObj ); + + double fExtraTextRotation = 0.0; + if ( mnFix16Angle && !( GetPropertyValue( DFF_Prop_FitTextToShape ) & 4 ) ) + { // text is already rotated, we have to take back the object rotation if DFF_Prop_RotateText is false + fExtraTextRotation = -mnFix16Angle; + } + fExtraTextRotation += nTextRotationAngle; + if ( !::basegfx::fTools::equalZero( fExtraTextRotation ) ) { - SdrObject* pGroup = new SdrObjGroup; - pGroup->GetSubList()->NbcInsertObject( pObj ); - pGroup->GetSubList()->NbcInsertObject( pTextObj ); - if (pOrgObj == pObj) - pOrgObj = pGroup; - else - pOrgObj = pObj; - pObj = pGroup; + fExtraTextRotation /= 100.0; + SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + const rtl::OUString sTextRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextRotateAngle" ) ); + com::sun::star::beans::PropertyValue aPropVal; + aPropVal.Name = sTextRotateAngle; + aPropVal.Value <<= fExtraTextRotation; + aGeometryItem.SetPropertyValue( aPropVal ); + pCustomShape->SetMergedItem( aGeometryItem ); } } + else if ( mnFix16Angle ) + { + // rotate text with shape ? + double a = mnFix16Angle * nPi180; + pObj->NbcRotate( rObjData.aBoundRect.Center(), mnFix16Angle, + sin( a ), cos( a ) ); + } } else if( !pObj ) { @@ -653,10 +633,9 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, // this is OK for Draw but not for Calc and Writer // cause here these objects have a default border pObj = new SdrRectObj(rTextRect); - pOrgObj = pObj; pObj->SetModel( pSdrModel ); SfxItemSet aSet( pSdrModel->GetItemPool() ); - ApplyAttributes( rSt, aSet, rObjData.eShapeType, rObjData.nSpFlags ); + ApplyAttributes( rSt, aSet, rObjData ); const SfxPoolItem* pPoolItem=NULL; SfxItemState eState = aSet.GetItemState( XATTR_FILLCOLOR, @@ -674,35 +653,32 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, pImpRec->bDrawHell = FALSE; if (GetPropertyValue(DFF_Prop_fPrint) & 0x02) pImpRec->bHidden = TRUE; - pTextImpRec->bDrawHell = pImpRec->bDrawHell; - pTextImpRec->bHidden = pImpRec->bHidden; pImpRec->nNextShapeId = GetPropertyValue( DFF_Prop_hspNext, 0 ); - pTextImpRec->nNextShapeId=pImpRec->nNextShapeId; if ( nTextId ) { - pTextImpRec->aTextId.nTxBxS = (UINT16)( nTextId >> 16 ); - pTextImpRec->aTextId.nSequence = (UINT16)nTextId; + pImpRec->aTextId.nTxBxS = (UINT16)( nTextId >> 16 ); + pImpRec->aTextId.nSequence = (UINT16)nTextId; } - pTextImpRec->nDxWrapDistLeft = GetPropertyValue( + pImpRec->nDxWrapDistLeft = GetPropertyValue( DFF_Prop_dxWrapDistLeft, 114935L ) / 635L; - pTextImpRec->nDyWrapDistTop = GetPropertyValue( + pImpRec->nDyWrapDistTop = GetPropertyValue( DFF_Prop_dyWrapDistTop, 0 ) / 635L; - pTextImpRec->nDxWrapDistRight = GetPropertyValue( + pImpRec->nDxWrapDistRight = GetPropertyValue( DFF_Prop_dxWrapDistRight, 114935L ) / 635L; - pTextImpRec->nDyWrapDistBottom = GetPropertyValue( + pImpRec->nDyWrapDistBottom = GetPropertyValue( DFF_Prop_dyWrapDistBottom, 0 ) / 635L; // 16.16 fraction times total image width or height, as appropriate. if (SeekToContent(DFF_Prop_pWrapPolygonVertices, rSt)) { - delete pTextImpRec->pWrapPolygon; + delete pImpRec->pWrapPolygon; sal_uInt16 nNumElemVert, nNumElemMemVert, nElemSizeVert; rSt >> nNumElemVert >> nNumElemMemVert >> nElemSizeVert; if (nNumElemVert && ((nElemSizeVert == 8) || (nElemSizeVert == 4))) { - pTextImpRec->pWrapPolygon = new Polygon(nNumElemVert); + pImpRec->pWrapPolygon = new Polygon(nNumElemVert); for (sal_uInt16 i = 0; i < nNumElemVert; ++i) { sal_Int32 nX, nY; @@ -715,8 +691,8 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, nX = nSmallX; nY = nSmallY; } - (*(pTextImpRec->pWrapPolygon))[i].X() = nX; - (*(pTextImpRec->pWrapPolygon))[i].Y() = nY; + (*(pImpRec->pWrapPolygon))[i].X() = nX; + (*(pImpRec->pWrapPolygon))[i].Y() = nY; } } } @@ -743,26 +719,14 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, DFF_Prop_lineStyle, mso_lineSimple ) : (MSO_LineStyle)USHRT_MAX; - pTextImpRec->eLineStyle = pImpRec->eLineStyle; pImpRec->nFlags = rObjData.nSpFlags; if( pImpRec->nShapeId ) { // Import-Record-Liste ergaenzen - if( pOrgObj ) - { - pImpRec->pObj = pOrgObj; - rImportData.aRecords.Insert( pImpRec ); - } - - if( pTextObj && (pOrgObj != pTextObj) ) - { - // Modify ShapeId (must be unique) - pImpRec->nShapeId |= 0x8000000; - pTextImpRec->pObj = pTextObj; - rImportData.aRecords.Insert( pTextImpRec ); - } + pImpRec->pObj = pObj; + rImportData.aRecords.Insert( pImpRec ); // Eintrag in Z-Order-Liste um Zeiger auf dieses Objekt ergaenzen /*Only store objects which are not deep inside the tree*/ @@ -1056,13 +1020,21 @@ bool SwWW8FltRefStack::IsFtnEdnBkmField(const SwFmtFld& rFmtFld, USHORT& rBkmNo) { const SwField* pFld = rFmtFld.GetFld(); USHORT nSubType; - return (pFld && (RES_GETREFFLD == pFld->Which()) - && ((REF_FOOTNOTE == (nSubType = pFld->GetSubType())) || - (REF_ENDNOTE == nSubType)) - && ((SwGetRefField*)pFld)->GetSetRefName().Len() - // find Sequence No of corresponding Foot-/Endnote - && (USHRT_MAX != (rBkmNo = pDoc->findBookmark( - ((SwGetRefField*)pFld)->GetSetRefName() )))); + if(pFld && (RES_GETREFFLD == pFld->Which()) + && ((REF_FOOTNOTE == (nSubType = pFld->GetSubType())) || (REF_ENDNOTE == nSubType)) + && ((SwGetRefField*)pFld)->GetSetRefName().Len()) + { + const IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findMark( + ((SwGetRefField*)pFld)->GetSetRefName()); + if(ppBkmk != pMarkAccess->getMarksEnd()) + { + // find Sequence No of corresponding Foot-/Endnote + rBkmNo = ppBkmk - pMarkAccess->getMarksBegin(); + return true; + } + } + return false; } void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos, @@ -1089,9 +1061,9 @@ void SwWW8FltRefStack::SetAttrInDoc(const SwPosition& rTmpPos, USHORT nBkmNo; if( IsFtnEdnBkmField(rFmtFld, nBkmNo) ) { - SwBookmark& rBkMrk = pDoc->getBookmark( nBkmNo, false ); + ::sw::mark::IMark const * const pMark = (pDoc->getIDocumentMarkAccess()->getMarksBegin() + nBkmNo)->get(); - const SwPosition& rBkMrkPos = rBkMrk.GetBookmarkPos(); + const SwPosition& rBkMrkPos = pMark->GetMarkPos(); SwTxtNode* pTxt = rBkMrkPos.nNode.GetNode().GetTxtNode(); if( pTxt && rBkMrkPos.nContent.GetIndex() ) @@ -2434,10 +2406,12 @@ bool SwWW8ImplReader::AddTextToParagraph(const String& rAddString) const SwTxtNode* pNd = pPaM->GetCntntNode()->GetTxtNode(); if (rAddString.Len()) { +/* #ifdef DEBUG ::std::clog << "<addTextToParagraph>" << dbg_out(rAddString) << "</addTextToParagraph>" << ::std::endl; #endif +*/ if ((pNd->GetTxt().Len() + rAddString.Len()) < STRING_MAXLEN -1) { rDoc.Insert (*pPaM, rAddString, true); @@ -2590,20 +2564,27 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs) case 0x15: if( !bSpec ) // Juristenparagraph cInsert = '\xa7'; - else { //0x15 is special --> so it's our field end mark...; hmmm what about field marks not handled by us??, maybe a problem with nested fields; probably an area of bugs... [well release quick and release often....] - if (!maNewFieldCtxStack.empty() && pPaM!=NULL && pPaM->GetPoint()!=NULL) { - WW8NewFieldCtx *pFieldCtx=maNewFieldCtxStack.back(); + else + { + // 0x15 is special --> so it's our field end mark...; + // hmmm what about field marks not handled by us??, maybe a problem with nested fields; + // probably an area of bugs... [well release quick and release often....] + if (!maNewFieldCtxStack.empty() && pPaM!=NULL && pPaM->GetPoint()!=NULL) + { + ::boost::scoped_ptr<WW8NewFieldCtx> pFieldCtx(maNewFieldCtxStack.back()); maNewFieldCtxStack.pop_back(); SwPosition aEndPos = *pPaM->GetPoint(); - SwPaM aFldPam( pFieldCtx->GetPtNode(), pFieldCtx->GetPtCntnt(), aEndPos.nNode, aEndPos.nContent.GetIndex()); - SwFieldBookmark *pFieldmark=(SwFieldBookmark*)rDoc.makeBookmark(aFldPam, KeyCode(), pFieldCtx->GetBookmarkName(), String(), IDocumentBookmarkAccess::FORM_FIELDMARK_TEXT); - ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); - if (pFieldmark!=NULL) { - pFieldmark->SetFieldType(0); // 0==Text - // set field data here... - pFieldCtx->SetCurrentFieldParamsTo(*pFieldmark); - } - delete pFieldCtx; + SwPaM aFldPam(pFieldCtx->GetPtNode(), pFieldCtx->GetPtCntnt(), aEndPos.nNode, aEndPos.nContent.GetIndex()); + IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess(); + ::sw::mark::IFieldmark* pFieldmark = + dynamic_cast< ::sw::mark::IFieldmark*>(pMarkAccess->makeMark( + aFldPam, + pFieldCtx->GetBookmarkName(), + IDocumentMarkAccess::TEXT_FIELDMARK)); + OSL_ENSURE(pFieldmark!=NULL, + "hmmm; why was the bookmark not created?"); + if (pFieldmark) + pFieldCtx->SetCurrentFieldParamsTo(pFieldmark); } } break; diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 69113966b5b6..15118e9abdb0 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -117,6 +117,7 @@ class SfxItemSet; class _ReadFieldParams; class wwZOrderer; class OutlinerParaObject; + namespace com{namespace sun {namespace star{ namespace beans{ class XPropertySet;} namespace form { class XFormComponent;} @@ -382,24 +383,23 @@ class WW8NewFieldCtx private: SwNodeIndex maPtNode; xub_StrLen mnPtCntnt; - ::rtl::OUString sBookmarkName; - ::rtl::OUString sBookmarkType; + ::rtl::OUString msBookmarkName; + ::rtl::OUString msMarkType; typedef ::std::pair< ::rtl::OUString, ::rtl::OUString> Param_t; typedef ::std::vector< Param_t > Params_t; Params_t maParams; SwPaM * mpPaM; public: - WW8NewFieldCtx(SwPosition &aStartPos, ::rtl::OUString sBookmarkName, ::rtl::OUString sBookmarkType); + WW8NewFieldCtx(SwPosition &aStartPos, ::rtl::OUString sBookmarkName, ::rtl::OUString sMarkType); ~WW8NewFieldCtx(); SwNodeIndex GetPtNode() { return maPtNode; }; xub_StrLen GetPtCntnt() { return mnPtCntnt; }; ::rtl::OUString GetBookmarkName(); - ::rtl::OUString GetBookmarkType(); + ::rtl::OUString GetMarkType(); void AddParam(::rtl::OUString name, ::rtl::OUString value); - void SetCurrentFieldParamsTo(SwFieldBookmark &rFieldBookmark); - + void SetCurrentFieldParamsTo(::sw::mark::IFieldmark* pFieldmark); }; diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 9b2fd0fe9205..e636a47a66f0 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2509,7 +2509,9 @@ void WW8TabDesc::CreateSwTable() //ability to set the margin. SvxLRSpaceItem aL( RES_LR_SPACE ); // set right to original DxaLeft (i28656) - aL.SetLeft( !bIsBiDi ? GetMinLeft() : pIo->maSectionManager.GetTextAreaWidth() - nPreferredWidth - nOrgDxaLeft); + aL.SetLeft( !bIsBiDi ? + static_cast<long>(GetMinLeft()) : + static_cast<long>(pIo->maSectionManager.GetTextAreaWidth() - nPreferredWidth - nOrgDxaLeft) ); aItemSet.Put(aL); } } @@ -3601,7 +3603,13 @@ void SwWW8ImplReader::StopTable() } bReadTable = true; - mpTableEndPaM.reset(new SwPaM(*pPaM)); + // --> OD 2009-04-16 #i101116# + // Keep PaM on table end only for nested tables + if ( nInTable > 1 ) + { + mpTableEndPaM.reset(new SwPaM(*pPaM)); + } + // <-- } // GetTableLeft() wird fuer absatzgebundene Grafikobjekte in Tabellen diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index cc524c68ae28..de912778c17a 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -94,7 +94,7 @@ #include "ww8par.hxx" #include "ww8par2.hxx" // wg. Listen-Attributen in Styles -#include <bookmrk.hxx> +#include <IMark.hxx> #include <svtools/fltrcfg.hxx> #include <stdio.h> @@ -103,10 +103,12 @@ using namespace com::sun::star; using namespace sw::util; using namespace sw::types; -WW8NewFieldCtx::WW8NewFieldCtx(SwPosition &aStartPos, ::rtl::OUString _sBookmarkName, ::rtl::OUString _sBookmarkType) -: maPtNode(aStartPos.nNode), mnPtCntnt(aStartPos.nContent.GetIndex()), - sBookmarkName(_sBookmarkName), - sBookmarkType(_sBookmarkType), mpPaM(NULL) +WW8NewFieldCtx::WW8NewFieldCtx(SwPosition &aStartPos, ::rtl::OUString sBookmarkName, ::rtl::OUString sMarkType) + : maPtNode(aStartPos.nNode) + , mnPtCntnt(aStartPos.nContent.GetIndex()) + , msBookmarkName(sBookmarkName) + , msMarkType(sMarkType) + , mpPaM(NULL) { } @@ -118,12 +120,12 @@ WW8NewFieldCtx::~WW8NewFieldCtx() ::rtl::OUString WW8NewFieldCtx::GetBookmarkName() { - return sBookmarkName; + return msBookmarkName; } -::rtl::OUString WW8NewFieldCtx::GetBookmarkType() +::rtl::OUString WW8NewFieldCtx::GetMarkType() { - return sBookmarkType; + return msMarkType; } void WW8NewFieldCtx::AddParam(::rtl::OUString name, ::rtl::OUString value) @@ -131,17 +133,26 @@ void WW8NewFieldCtx::AddParam(::rtl::OUString name, ::rtl::OUString value) maParams.push_back( Param_t(name, value) ); } -void WW8NewFieldCtx::SetCurrentFieldParamsTo(SwFieldBookmark &rFieldBookmark) +void WW8NewFieldCtx::SetCurrentFieldParamsTo(::sw::mark::IFieldmark* pFieldmark) { - for(Params_t::iterator i=maParams.begin();i!=maParams.end();i++) { + for(Params_t::iterator i=maParams.begin();i!=maParams.end();i++) + { ::rtl::OUString aName=i->first; ::rtl::OUString aValue=i->second; - if (aName.compareToAscii("Description")==0) { - rFieldBookmark.SetFFHelpText(aValue); - } else if (aName.compareToAscii("Name")==0) { - rFieldBookmark.SetFFName(aValue); - } else if (aName.compareToAscii("Result")==0) { - rFieldBookmark.SetFFRes( aValue.toInt32() ); + if(aName.compareToAscii("Description")==0) + { + pFieldmark->SetFieldHelptext(aValue); + } + else if(aName.compareToAscii("Name")==0) + { + pFieldmark->SetFieldname(aValue); + } + else if(aName.compareToAscii("Result")==0) + { + ::sw::mark::ICheckboxFieldmark* pAsCheckbox = + dynamic_cast< ::sw::mark::ICheckboxFieldmark* >(pFieldmark); + if(pAsCheckbox) + pAsCheckbox->SetChecked(aValue.toInt32()==0); } } } @@ -269,12 +280,17 @@ eF_ResT SwWW8ImplReader::Read_F_FormCheckBox( WW8FieldDesc* pF, String& rStr ) } if (aBookmarkName.Len()>0) { - SwFieldBookmark *pFieldmark=(SwFieldBookmark*)rDoc.makeBookmark(*pPaM, KeyCode(), aBookmarkName, String(), IDocumentBookmarkAccess::FORM_FIELDMARK_NO_TEXT); - ASSERT(pFieldmark!=NULL, "hmmm; why was the bookmark not created?"); - if (pFieldmark!=NULL) { - pFieldmark->SetFieldType(1); // 0==Checkbox - pFieldmark->SetFFName(aFormula.sTitle); - pFieldmark->SetFFHelpText(aFormula.sToolTip); + ::sw::mark::ICheckboxFieldmark* pFieldmark = + dynamic_cast< ::sw::mark::ICheckboxFieldmark*>(rDoc.getIDocumentMarkAccess()->makeMark( + *pPaM, + aBookmarkName, + IDocumentMarkAccess::CHECKBOX_FIELDMARK)); + OSL_ENSURE(pFieldmark, + "hmmm; why was the bookmark not created?"); + if(pFieldmark) + { + pFieldmark->SetFieldname(aFormula.sTitle); + pFieldmark->SetFieldHelptext(aFormula.sToolTip); pFieldmark->SetChecked(aFormula.nChecked!=0); // set field data here... } diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 5450b904c100..9f1cfade775e 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -69,7 +69,7 @@ #include <flddat.hxx> // class SwDateTimeField #include <docufld.hxx> // class SwPageNumberField #include <reffld.hxx> // class SwGetRefField -#include <bookmrk.hxx> +#include <IMark.hxx> #include <expfld.hxx> // class SwSetExpField #include <dbfld.hxx> // class SwDBField #include <usrfld.hxx> diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index b8a11b01c441..f4a4a676c9a2 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -209,17 +209,8 @@ void SwXMLExport::_ExportAutoStyles() // only master pages are exported => styles for frames bound // to frames (but none for frames bound to pages) need to be // collected. - GetTextParagraphExport()->collectFramesBoundToFrameAutoStyles(); + // TODO: exclude PageBoundFrames on export } - else - { - // content (and optional master pages) are exported => styles - // for frames bound to frame or to pages need to be - // collected. - GetTextParagraphExport()->collectFramesBoundToPageOrFrameAutoStyles( - bShowProgress ); - } - } // exported in _ExportMasterStyles diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index c774fe9f57bc..360f8349142e 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -986,13 +986,31 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine, nCPos = (sal_uInt16)rLines.GetWidth(); // Und ihren Index - sal_uInt16 nOldCol = nCol; - SwXMLTableColumn_Impl aCol( nCPos ); + const sal_uInt16 nOldCol = nCol; + { + SwXMLTableColumn_Impl aCol( nCPos ); #ifndef PRODUCT - sal_Bool bFound = + const sal_Bool bFound = #endif - rLines.GetColumns().Seek_Entry( &aCol, &nCol ); - ASSERT( bFound, "couldn't find column" ); + rLines.GetColumns().Seek_Entry( &aCol, &nCol ); + ASSERT( bFound, "couldn't find column" ); + } + + // --> OD 2009-03-19 #i95726# + // Some fault tolerance, if table is somehow corrupted. + if ( nCol < nOldCol ) + { + ASSERT( false, "table and/or table information seems to be corrupted." ); + if ( nBox == nBoxes - 1 ) + { + nCol = rLines.GetColumns().Count() - 1; + } + else + { + nCol = nOldCol; + } + } + // <-- sal_uInt16 nColSpan = nCol - nOldCol + 1U; diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 3dd40c7e56c1..6ae1bf52931c 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -336,7 +336,12 @@ inline SwXMLTableCell_Impl *SwXMLTableRow_Impl::GetCell( sal_uInt32 nCol ) const { ASSERT( nCol < USHRT_MAX, "SwXMLTableRow_Impl::GetCell: column number is to big" ); - return aCells[(sal_uInt16)nCol]; + // --> OD 2009-03-19 #i95726# - some fault tolerance +// return aCells[(sal_uInt16)nCol]; + ASSERT( nCol < aCells.Count(), + "SwXMLTableRow_Impl::GetCell: column number is out of bound" ); + return nCol < aCells.Count() ? aCells[(sal_uInt16)nCol] : 0; + // <-- } void SwXMLTableRow_Impl::Expand( sal_uInt32 nCells, sal_Bool bOneCell ) @@ -1751,8 +1756,14 @@ const SwStartNode *SwXMLTableContext::GetPrevStartNode( sal_uInt32 nRow, { if( pPrevCell->GetStartNode() ) pSttNd = pPrevCell->GetStartNode(); - else + // --> OD 2009-03-19 #i95726# - Some fault tolerance +// else + else if ( pPrevCell->GetSubTable() ) + // <-- pSttNd = pPrevCell->GetSubTable()->GetLastStartNode(); + + ASSERT( pSttNd != 0, + "table corrupt" ); } return pSttNd; @@ -2225,6 +2236,14 @@ SwTableLine *SwXMLTableContext::MakeTableLine( SwTableBox *pUpper, // No subtabels: We use the new table model. SwXMLTableCell_Impl *pCell = GetCell(nTopRow,nCol); + // --> OD 2009-03-19 #i95726# - some fault tolerance + if ( pCell == 0 ) + { + ASSERT( false, "table seems to be corrupt." ); + break; + } + // <-- + // Could the table fragment be splitted vertically behind the // current column (uptp the current line? bSplit = 1UL == pCell->GetColSpan(); @@ -2252,8 +2271,11 @@ SwTableLine *SwXMLTableContext::MakeTableLine( SwTableBox *pUpper, { SwTableBox* pBox = 0; SwXMLTableCell_Impl *pCell = GetCell( nTopRow, nStartCol ); + // --> OD 2009-03-19 #i95726# - some fault tolerance if( ( !bHasSubTables || ( pCell->GetRowSpan() == (nBottomRow-nTopRow) ) ) && - pCell->GetColSpan() == (nCol+1UL-nStartCol) ) + pCell->GetColSpan() == (nCol+1UL-nStartCol) && + ( pCell->GetStartNode() || pCell->GetSubTable() ) ) + // <-- { // insert new empty cell for covered cells: long nBoxRowSpan = 1; diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index 08b6510787a7..2aff6e0cf4d1 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -322,9 +322,16 @@ void SwCharURLPage::Reset(const SfxItemSet& rSet) BOOL SwCharURLPage::FillItemSet(SfxItemSet& rSet) { - String sURL = aURLED.GetText(); - if(sURL.Len()) + ::rtl::OUString sURL = aURLED.GetText(); + if(sURL.getLength()) + { sURL = URIHelper::SmartRel2Abs(INetURLObject(), sURL, Link(), false ); + // #i100683# file URLs should be normalized in the UI + static const sal_Char* pFile = "file:"; + sal_Int32 nLength = ((sal_Int32)sizeof(pFile)-1); + if( sURL.copy(0, nLength ).equalsAsciiL( pFile, nLength )) + sURL = URIHelper::simpleNormalizedMakeRelative(::rtl::OUString(), sURL); + } SwFmtINetFmt aINetFmt(sURL, aTargetFrmLB.GetText()); aINetFmt.SetName(aNameED.GetText()); diff --git a/sw/source/ui/chrdlg/tblnumfm.cxx b/sw/source/ui/chrdlg/tblnumfm.cxx index 2a1851ab1477..1024c8a6bff6 100644 --- a/sw/source/ui/chrdlg/tblnumfm.cxx +++ b/sw/source/ui/chrdlg/tblnumfm.cxx @@ -54,7 +54,7 @@ #include <svtools/itemset.hxx> #include <sfx2/tabdlg.hxx> -SwNumFmtDlg::SwNumFmtDlg(Window* pParent, SfxItemSet& rSet) +SwNumFmtDlg::SwNumFmtDlg(Window* pParent, const SfxItemSet& rSet) : SfxSingleTabDialog( pParent, rSet, 0 ) { // TabPage erzeugen diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index b68bdc0e923a..91248fa1e422 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -68,7 +68,7 @@ #include <swunohelper.hxx> #include <vcl/waitobj.hxx> #include <svtools/pathoptions.hxx> - +#include <svtools/urihelper.hxx> #include <addresslistdialog.hrc> #include <dbui.hrc> @@ -145,6 +145,8 @@ struct AddressUserData_Impl if(!sCharSet.compareToAscii( cUTF8 )) { sURL = String(sDBURL).Copy( 10 ); + //#i97577# at this point the 'URL' can also be a file name! + sURL = URIHelper::SmartRel2Abs( INetURLObject(), sURL ); sURL += C2U("/"); sURL += aFilters[0]; sURL += C2U("."); @@ -269,6 +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_IsReadOnlyFileName( pUserData->sURL ); } catch(const uno::Exception& ) @@ -553,6 +556,7 @@ IMPL_STATIC_LINK(SwAddressListDialog, StaticListBoxSelectHdl_Impl, SvLBoxEntry*, pThis->m_aListLB.SetEntryText(String(), pSelect, ITEMID_TABLE - 1); } pThis->m_aEditPB.Enable(pUserData && pUserData->sURL.getLength() && + SWUnoHelper::UCB_IsFile( pUserData->sURL ) && //#i97577# !SWUnoHelper::UCB_IsReadOnlyFileName( pUserData->sURL ) ); pThis->m_bInSelectHdl = false; pThis->LeaveWait(); @@ -638,11 +642,15 @@ void SwAddressListDialog::DetectTablesAndQueries( m_xDBContext->getByName(m_aDBData.sDataSource) >>= xSourceProperties; pUserData->sURL = lcl_getFlatURL( xSourceProperties ); - m_aListLB.SetEntryText(m_aDBData.sCommand, pSelect, ITEMID_TABLE - 1); pUserData->xColumnsSupplier = SwNewDBMgr::GetColumnSupplier(pUserData->xConnection, m_aDBData.sCommand, m_aDBData.nCommandType == CommandType::TABLE ? SW_DB_SELECT_TABLE : SW_DB_SELECT_QUERY ); + //#i97577# + if( pUserData->xColumnsSupplier.is() ) + m_aListLB.SetEntryText(m_aDBData.sCommand, pSelect, ITEMID_TABLE - 1); + else + m_aListLB.SetEntryText(String(), pSelect, ITEMID_TABLE - 1); } String sCommand = m_aListLB.GetEntryText(pSelect, ITEMID_TABLE - 1); m_aOK.Enable(pSelect && sCommand.Len()); diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 3048eac3de22..07e9b0a0eec0 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -131,6 +131,7 @@ #include "swabstdlg.hxx" #include "table.hrc" #include <unomid.h> +#include <IDocumentMarkAccess.hxx> namespace swui @@ -1334,6 +1335,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, BOOL bSetCrsr = TRUE; USHORT n = 0, nCols = aColArr.Count(); + ::sw::mark::IMark* pMark = NULL; for( sal_Int32 i = 0 ; ; ++i ) { BOOL bBreak = FALSE; @@ -1452,7 +1454,10 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, // rSh.SwCrsrShell::MovePara( fnParaCurr, fnParaStart ); rSh.SwCrsrShell::MovePara( GetfnParaCurr(), GetfnParaStart() ); - rSh.SetBookmark( KeyCode(), C2S("DB_Mark"), aEmptyStr, IDocumentBookmarkAccess::MARK ); + pMark = rSh.SetBookmark( + KeyCode(), + ::rtl::OUString(), + ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK ); // rSh.SwCrsrShell::MovePara( fnParaCurr, fnParaEnd ); rSh.SwCrsrShell::MovePara( GetfnParaCurr(), GetfnParaEnd() ); @@ -1479,11 +1484,12 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, pWait = ::std::auto_ptr<SwWait>(new SwWait( *pView->GetDocShell(), TRUE )); } - if( !bSetCrsr && USHRT_MAX != (n = rSh.FindBookmark( C2S("DB_Mark" ))) ) + if( !bSetCrsr && pMark != NULL) { rSh.SetMark(); - rSh.GotoBookmark( n ); - rSh.DelBookmark( n ); + rSh.GotoMark( pMark ); + rSh.getIDocumentMarkAccess()->deleteMark( pMark ); + break; } } } diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 17d2ad5ef31d..d123dec5e0dd 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -1332,7 +1332,6 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, pStoreToFilterOptions = &rMergeDescriptor.sSaveToFilterOptions; } } - String sAddress; bCancel = FALSE; // in case of creating a single resulting file this has to be created here @@ -1399,7 +1398,6 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, pViewFrm = SfxViewFrame::GetNext(*pViewFrm, pSourrceDocSh); } ULONG nDocNo = 1; - ULONG nCounter = 0; long nStartRow, nEndRow; // collect temporary files @@ -1410,6 +1408,7 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, { String sPath(sSubject); + String sAddress; if( !bEMail && bColumnName ) { SwDBFormatData aDBFormat; @@ -1419,14 +1418,18 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, if (!sAddress.Len()) sAddress = '_'; sPath += sAddress; - nCounter = 0; } // create a new temporary file name - only done once in case of bCreateSingleFile if( 1 == nDocNo || (!rMergeDescriptor.bCreateSingleFile && !bAsSingleFile) ) { INetURLObject aEntry(sPath); - String sLeading(aEntry.GetBase()); + String sLeading; + //#i97667# if the name is from a database field then it will be used _as is_ + if( sAddress.Len() ) + sLeading = sAddress; + else + sLeading = aEntry.GetBase(); aEntry.removeSegment(); sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE ); String sExt( pStoreToFilter->GetDefaultExtension() ); diff --git a/sw/source/ui/dbui/mailmergechildwindow.src b/sw/source/ui/dbui/mailmergechildwindow.src index fd0e59fb0623..6d9f0bc49272 100644 --- a/sw/source/ui/dbui/mailmergechildwindow.src +++ b/sw/source/ui/dbui/mailmergechildwindow.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: mailmergechildwindow.src,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.240.1 $ * * This file is part of OpenOffice.org. * @@ -251,7 +251,7 @@ ModalDialog DLG_MM_SENDWARNING Pos = MAP_APPFONT ( 40 , 6 ) ; Size = MAP_APPFONT ( 170 , 30 ) ; WordBreak = TRUE; - Text[ en-US ] = "The following error occured:"; + Text[ en-US ] = "The following error occurred:"; }; FixedText FT_DETAILS { diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 4a5884a9daeb..64fd024fab57 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -55,6 +55,8 @@ #include <svx/langitem.hxx> #include <svtools/itemset.hxx> #include <svtools/stritem.hxx> +#include <svtools/ehdl.hxx> +#include <svtools/sfxecode.hxx> #include <vcl/msgbox.hxx> #include <sfx2/dinfdlg.hxx> #include <sfx2/printer.hxx> @@ -752,7 +754,24 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) pValues[0].Value <<= ::rtl::OUString(sFilter); uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY); - xStore->storeToURL( sPath, aValues ); + sal_uInt32 nErrorCode = ERRCODE_NONE; + try + { + xStore->storeToURL( sPath, aValues ); + } + catch( task::ErrorCodeIOException& aErrorEx ) + { + nErrorCode = (sal_uInt32)aErrorEx.ErrCode; + } + catch( Exception& ) + { + nErrorCode = ERRCODE_IO_GENERAL; + } + if( nErrorCode != ERRCODE_NONE ) + { + SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC, pTargetView->GetDocShell()->GetTitle()); + ErrorHandler::HandleError( nErrorCode ); + } } else { @@ -787,7 +806,24 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) pValues[0].Value <<= ::rtl::OUString(pSfxFlt->GetFilterName()); uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY); - xStore->storeToURL( sTargetTempURL, aValues ); + sal_uInt32 nErrorCode = ERRCODE_NONE; + try + { + xStore->storeToURL( sTargetTempURL, aValues ); + } + catch( task::ErrorCodeIOException& aErrorEx ) + { + nErrorCode = (sal_uInt32)aErrorEx.ErrCode; + } + catch( Exception& ) + { + nErrorCode = ERRCODE_IO_GENERAL; + } + if( nErrorCode != ERRCODE_NONE ) + { + SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC, pTargetView->GetDocShell()->GetTitle()); + ErrorHandler::HandleError( nErrorCode ); + } SwView* pSourceView = rConfigItem.GetSourceView(); PrintMonitor aSaveMonitor(this, PrintMonitor::MONITOR_TYPE_SAVE); diff --git a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx index 92bba89b2c01..8dca8ef1abf0 100644 --- a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx @@ -63,7 +63,6 @@ #ifndef _DIALOG_HXX #include <dialog.hrc> #endif -#include <bookmrk.hxx> #include <cmdid.h> using namespace ::com::sun::star; diff --git a/sw/source/ui/dialog/addrdlg.cxx b/sw/source/ui/dialog/addrdlg.cxx index c56d372c982a..342946d357cd 100644 --- a/sw/source/ui/dialog/addrdlg.cxx +++ b/sw/source/ui/dialog/addrdlg.cxx @@ -44,7 +44,7 @@ Ctor ****************************************************************************/ -SwAddrDlg::SwAddrDlg(Window* pParent, SfxItemSet& rSet ) : +SwAddrDlg::SwAddrDlg(Window* pParent, const SfxItemSet& rSet ) : SfxSingleTabDialog(pParent, rSet, 0) diff --git a/sw/source/ui/dialog/dialog.src b/sw/source/ui/dialog/dialog.src index 985dccf842e7..5f323732dfd5 100644 --- a/sw/source/ui/dialog/dialog.src +++ b/sw/source/ui/dialog/dialog.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dialog.src,v $ - * $Revision: 1.30 $ + * $Revision: 1.30.240.1 $ * * This file is part of OpenOffice.org. * @@ -43,16 +43,9 @@ String STR_LINKEDIT_TEXT /* ### ACHTUNG: Neuer Text in Resource? Verknpfungen bearbeiten : Verknpfungen bearbeiten */ Text [ en-US ] = "Edit links" ; }; -String STR_PATH_NOT_FOUND1 +String STR_PATH_NOT_FOUND { - /* ### ACHTUNG: Neuer Text in Resource? Das Verzeichnis ' : Das Verzeichnis '' */ - Text [ en-US ] = "The directory '" ; -}; -String STR_PATH_NOT_FOUND2 -{ - /* ### ACHTUNG: Neuer Text in Resource? ' existiert nicht. : '' existiert nicht. */ - /* ### ACHTUNG: Neuer Text in Resource? ' existiert nicht. : '' existiert nicht. */ - Text [ en-US ] = "' does not exist." ; + Text [ en-US ] = "The directory '%1' does not exist." ; }; String STR_FLT_SGV { diff --git a/sw/source/ui/dialog/macassgn.cxx b/sw/source/ui/dialog/macassgn.cxx index 771b94dee155..0c052223abcf 100644 --- a/sw/source/ui/dialog/macassgn.cxx +++ b/sw/source/ui/dialog/macassgn.cxx @@ -54,32 +54,22 @@ #include "swevent.hxx" #include "docsh.hxx" #include "globals.hrc" +#include "view.hxx" +#include <sfx2/viewfrm.hxx> + +#include <svx/svxdlg.hxx> #include <doc.hxx> using ::com::sun::star::uno::Reference; using ::com::sun::star::frame::XFrame; -SvStringsDtor* __EXPORT _GetRangeHdl( _SfxMacroTabPage*, const String& ); - +// SvStringsDtor* __EXPORT _GetRangeHdl( _SfxMacroTabPage*, const String& ); -SwMacroAssignDlg::SwMacroAssignDlg( Window* pParent, SfxItemSet& rSet, const SwWrtShell& rSh, - DlgEventType eType ) - : SfxMacroAssignDlg( pParent, rSh.GetDoc() ? rSh.GetDoc()->GetDocShell() : NULL, rSet ) +SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType ) { - // TabPage holen - SwMacroAssignDlg::AddEvents( *(SfxMacroTabPage*) GetTabPage(), eType ); -} - - -SwMacroAssignDlg::~SwMacroAssignDlg() -{ -} - - -void SwMacroAssignDlg::AddEvents( SfxMacroTabPage& rPg, DlgEventType eType ) -{ - const SfxItemSet& rSet = rPg.GetItemSet(); + // const SfxItemSet& rSet = rPg.GetItemSet(); + SfxEventNamesItem aItem(SID_EVENTCONFIG); BOOL bHtmlMode = FALSE; USHORT nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current()); @@ -88,22 +78,22 @@ void SwMacroAssignDlg::AddEvents( SfxMacroTabPage& rPg, DlgEventType eType ) switch( eType ) { case MACASSGN_TEXTBAUST: // Textbausteine - rPg.SetGetRangeLink( &_GetRangeHdl ); - rPg.AddEvent( String( SW_RES(STR_EVENT_START_INS_GLOSSARY) ), + // rPg.SetGetRangeLink( &_GetRangeHdl ); + aItem.AddEvent( String( SW_RES(STR_EVENT_START_INS_GLOSSARY) ), String(), SW_EVENT_START_INS_GLOSSARY ); - rPg.AddEvent( String( SW_RES(STR_EVENT_END_INS_GLOSSARY) ), + aItem.AddEvent( String( SW_RES(STR_EVENT_END_INS_GLOSSARY) ), String(), SW_EVENT_END_INS_GLOSSARY); // damit der neue Handler aktiv wird! - rPg.Reset( rSet ); + // rPg.Reset( rSet ); break; case MACASSGN_ALLFRM: case MACASSGN_GRAPHIC: // Grafiken { - rPg.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ERROR) ), + aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ERROR) ), String(), SVX_EVENT_IMAGE_ERROR); - rPg.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ABORT) ), + aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ABORT) ), String(), SVX_EVENT_IMAGE_ABORT); - rPg.AddEvent( String( SW_RES(STR_EVENT_IMAGE_LOAD) ), + aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_LOAD) ), String(), SVX_EVENT_IMAGE_LOAD); } // kein break; @@ -112,13 +102,13 @@ void SwMacroAssignDlg::AddEvents( SfxMacroTabPage& rPg, DlgEventType eType ) if( !bHtmlMode && (MACASSGN_FRMURL == eType || MACASSGN_ALLFRM == eType)) { - rPg.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_A ) ), + aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_A ) ), String(), SW_EVENT_FRM_KEYINPUT_ALPHA ); - rPg.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_NOA ) ), + aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_NOA ) ), String(), SW_EVENT_FRM_KEYINPUT_NOALPHA ); - rPg.AddEvent( String( SW_RES( STR_EVENT_FRM_RESIZE ) ), + aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_RESIZE ) ), String(), SW_EVENT_FRM_RESIZE ); - rPg.AddEvent( String( SW_RES( STR_EVENT_FRM_MOVE ) ), + aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_MOVE ) ), String(), SW_EVENT_FRM_MOVE ); } } @@ -126,21 +116,23 @@ void SwMacroAssignDlg::AddEvents( SfxMacroTabPage& rPg, DlgEventType eType ) case MACASSGN_OLE: // OLE { if( !bHtmlMode ) - rPg.AddEvent( String( SW_RES(STR_EVENT_OBJECT_SELECT) ), + aItem.AddEvent( String( SW_RES(STR_EVENT_OBJECT_SELECT) ), String(), SW_EVENT_OBJECT_SELECT ); } // kein break; case MACASSGN_INETFMT: // INetFmt-Attribute { - rPg.AddEvent( String( SW_RES(STR_EVENT_MOUSEOVER_OBJECT) ), + aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSEOVER_OBJECT) ), String(), SFX_EVENT_MOUSEOVER_OBJECT ); - rPg.AddEvent( String( SW_RES(STR_EVENT_MOUSECLICK_OBJECT) ), + aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSECLICK_OBJECT) ), String(), SFX_EVENT_MOUSECLICK_OBJECT); - rPg.AddEvent( String( SW_RES(STR_EVENT_MOUSEOUT_OBJECT) ), + aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSEOUT_OBJECT) ), String(), SFX_EVENT_MOUSEOUT_OBJECT); } break; } + + return aItem; } @@ -148,7 +140,7 @@ BOOL SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh, SvxMacroItem*& rpINetItem ) { BOOL bRet = FALSE; - SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMMACRO, RES_FRMMACRO ); + SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 ); SvxMacroItem aItem( RES_FRMMACRO ); if( !rpINetItem ) rpINetItem = new SvxMacroItem( RES_FRMMACRO ); @@ -156,11 +148,15 @@ BOOL SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh, aItem.SetMacroTable( rpINetItem->GetMacroTable() ); aSet.Put( aItem ); + aSet.Put( AddEvents( MACASSGN_INETFMT ) ); - SwMacroAssignDlg aMacDlg( pParent, aSet, rSh, MACASSGN_INETFMT ); - if( aMacDlg.Execute() == RET_OK ) + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( pParent, aSet, + rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), + SID_EVENTCONFIG ); + if ( pMacroDlg && pMacroDlg->Execute() == RET_OK ) { - const SfxItemSet* pOutSet = aMacDlg.GetOutputItemSet(); + const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet(); const SfxPoolItem* pItem; if( SFX_ITEM_SET == pOutSet->GetItemState( RES_FRMMACRO, FALSE, &pItem )) { @@ -171,8 +167,8 @@ BOOL SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh, return bRet; } - -SvStringsDtor* __EXPORT _GetRangeHdl( _SfxMacroTabPage* /*pTbPg*/, const String& rLanguage ) +/* +SvStringsDtor* __EXPORT _GetRangeHdl( _SfxMacroTabPage* , const String& rLanguage ) { SvStringsDtor* pNew = new SvStringsDtor; @@ -197,7 +193,7 @@ SvStringsDtor* __EXPORT _GetRangeHdl( _SfxMacroTabPage* /*pTbPg*/, const String& return pNew; } - +*/ diff --git a/sw/source/ui/dialog/makefile.mk b/sw/source/ui/dialog/makefile.mk index dbdbdb6e9d6f..ce90d6a3a6e6 100644 --- a/sw/source/ui/dialog/makefile.mk +++ b/sw/source/ui/dialog/makefile.mk @@ -42,10 +42,6 @@ LIBTARGET=no .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/inc$/sw.mk -.IF "$(ENABLE_LAYOUT)" == "TRUE" -CFLAGS+= -DENABLE_LAYOUT=1 -I../$(PRJ)/layout/inc -I../$(PRJ)/layout/$(INPATH)/inc -.ENDIF # ENABLE_LAYOUT == TRUE - # --- Files -------------------------------------------------------- SRS1NAME=$(TARGET) diff --git a/sw/source/ui/dialog/regionsw.cxx b/sw/source/ui/dialog/regionsw.cxx index b0038a8311c8..47936697a20d 100644 --- a/sw/source/ui/dialog/regionsw.cxx +++ b/sw/source/ui/dialog/regionsw.cxx @@ -55,7 +55,6 @@ #endif #include <svx/htmlcfg.hxx> -#include <bookmrk.hxx> #include <section.hxx> #include <docary.hxx> #include <regionsw.hxx> diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 6f0397bc97e3..627676707214 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -119,7 +119,7 @@ using namespace ::com::sun::star; IMPL_ABSTDLG_BASE(AbstractSwWordCountDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractSfxSingleTabDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractSfxDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSwAsciiFilterDlg_Impl); IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl); IMPL_ABSTDLG_BASE(AbstractSplitTableDialog_Impl); @@ -198,10 +198,20 @@ BYTE AbstractSwInsertAbstractDlg_Impl::GetPara() const //add for SwInsertAbstractDlg end //add for SwAddrDlg, SwDropCapsDlg ,SwBackgroundDlg, SwNumFmtDlg SwBorderDlg SwWrapDlg SwFldEditDlg begin -const SfxItemSet* AbstractSfxSingleTabDialog_Impl::GetOutputItemSet() const +const SfxItemSet* AbstractSfxDialog_Impl::GetOutputItemSet() const { return pDlg->GetOutputItemSet(); } + +void AbstractSfxDialog_Impl::SetText( const XubString& rStr ) +{ + pDlg->SetText( rStr ); +} +String AbstractSfxDialog_Impl::GetText() const +{ + return pDlg->GetText(); +} + //add for SwAddrDlg, SwDropCapsDlg ,SwBackgroundDlg, SwNumFmtDlg SwBorderDlg SwWrapDlg SwFldEditDlg end //add for SwAsciiFilterDlg begin @@ -664,12 +674,13 @@ AbstractSwInsertAbstractDlg * SwAbstractDialogFactory_Impl::CreateSwInsertAbstra } //add for SwInsertAbstractDlg end -AbstractSfxSingleTabDialog* SwAbstractDialogFactory_Impl::CreateSfxSingleTabDialog( Window* pParent, - SfxItemSet& rSet, - int nResId - ) +SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSfxDialog( Window* pParent, + const SfxItemSet& rSet, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&, + sal_uInt32 nResId + ) { - SfxSingleTabDialog* pDlg=NULL; + SfxModalDialog* pDlg=NULL; switch ( nResId ) { case RC_DLG_ADDR : @@ -689,7 +700,7 @@ AbstractSfxSingleTabDialog* SwAbstractDialogFactory_Impl::CreateSfxSingleTabDial } if ( pDlg ) - return new AbstractSfxSingleTabDialog_Impl( pDlg ); + return new AbstractSfxDialog_Impl( pDlg ); return 0; } @@ -1070,9 +1081,9 @@ AbstractSwAutoFormatDlg * SwAbstractDialogFactory_Impl::CreateSwAutoFormatDlg( W //add for SwAutoFormatDlg end //add for SwBorderDlg begin -AbstractSfxSingleTabDialog * SwAbstractDialogFactory_Impl::CreateSwBorderDlg (Window* pParent, SfxItemSet& rSet, USHORT nType,int nResId ) +SfxAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwBorderDlg (Window* pParent, SfxItemSet& rSet, USHORT nType,int nResId ) { - SfxSingleTabDialog* pDlg=NULL; + SfxModalDialog* pDlg=NULL; switch ( nResId ) { case RC_DLG_SWBORDERDLG : @@ -1083,15 +1094,15 @@ AbstractSfxSingleTabDialog * SwAbstractDialogFactory_Impl::CreateSwBorderDlg (Wi } if ( pDlg ) - return new AbstractSfxSingleTabDialog_Impl( pDlg ); + return new AbstractSfxDialog_Impl( pDlg ); return 0; } //add for SwBorderDlg end //add for SwWrapDlg begin -AbstractSfxSingleTabDialog * SwAbstractDialogFactory_Impl::CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, BOOL bDrawMode, int nResId ) +SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, BOOL bDrawMode, int nResId ) { - SfxSingleTabDialog* pDlg=NULL; + SfxModalDialog* pDlg=NULL; switch ( nResId ) { case RC_DLG_SWWRAPDLG : @@ -1102,7 +1113,7 @@ AbstractSfxSingleTabDialog * SwAbstractDialogFactory_Impl::CreateSwWrapDlg ( Win } if ( pDlg ) - return new AbstractSfxSingleTabDialog_Impl( pDlg ); + return new AbstractSfxDialog_Impl( pDlg ); return 0; } //add for SwWrapDlg end @@ -1169,9 +1180,9 @@ AbstractSwFldDlg * SwAbstractDialogFactory_Impl::CreateSwFldDlg ( SfxBindings* p //add for SwFldDlg end //add for SwFldEditDlg begin -AbstractSfxSingleTabDialog* SwAbstractDialogFactory_Impl::CreateSwFldEditDlg ( SwView& rVw, int nResId ) +SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwFldEditDlg ( SwView& rVw, int nResId ) { - SfxSingleTabDialog* pDlg=NULL; + SfxModalDialog* pDlg=NULL; switch ( nResId ) { case RC_DLG_SWFLDEDITDLG : @@ -1182,7 +1193,7 @@ AbstractSfxSingleTabDialog* SwAbstractDialogFactory_Impl::CreateSwFldEditDlg ( } if ( pDlg ) - return new AbstractSfxSingleTabDialog_Impl( pDlg ); + return new AbstractSfxDialog_Impl( pDlg ); return 0; } //add for SwFldEditDlg diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 75b9bfefaf1f..da66ceb23db4 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -98,11 +98,12 @@ class AbstractSwInsertAbstractDlg_Impl : public AbstractSwInsertAbstractDlg // add for SwAddrDlg, SwDropCapsDlg, SwBackgroundDlg SwNumFmtDlg SwWrapDlg SwBorderDlg, SwFldEditDlg begin class SfxSingleTabDialog; -class AbstractSfxSingleTabDialog_Impl :public AbstractSfxSingleTabDialog +class AbstractSfxDialog_Impl :public SfxAbstractDialog { - DECL_ABSTDLG_BASE(AbstractSfxSingleTabDialog_Impl,SfxSingleTabDialog) + DECL_ABSTDLG_BASE(AbstractSfxDialog_Impl,SfxModalDialog) virtual const SfxItemSet* GetOutputItemSet() const; - + virtual void SetText( const XubString& rStr ); + virtual String GetText() const; }; // add for SwAddrDlg,SwDropCapsDlg , SwBackgroundDlg SwNumFmtDlg SwWrapDlg SwBorderDlg, SwFldEditDlg end @@ -430,9 +431,13 @@ class SwAbstractDialogFactory_Impl : public SwAbstractDialogFactory { public: + virtual SfxAbstractDialog* CreateSfxDialog( Window* pParent, //add for SvxMeasureDialog & SvxConnectionDialog + const SfxItemSet& rAttr, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame, + sal_uInt32 nResId + ); virtual AbstractSwWordCountDialog* CreateSwWordCountDialog(Window* pParent); virtual AbstractSwInsertAbstractDlg * CreateSwInsertAbstractDlg( Window* pParent,int nResId ); - virtual AbstractSfxSingleTabDialog* CreateSfxSingleTabDialog ( Window* pParent, SfxItemSet& rSet,int nResId );//add for SwAddrDlg SwDropCapsDlg, SwBackgroundDlg,SwNumFmtDlg, virtual AbstractSwAsciiFilterDlg* CreateSwAsciiFilterDlg ( Window* pParent, SwDocShell& rDocSh, SvStream* pStream, int nResId ); //add for SwAsciiFilterDlg virtual VclAbstractDialog * CreateSwInsertBookmarkDlg( Window *pParent, SwWrtShell &rSh, SfxRequest& rReq, int nResId );//add for SwInsertBookmarkDlg @@ -473,14 +478,14 @@ public: int nResId, BOOL bSetAutoFmt = TRUE, const SwTableAutoFmt* pSelFmt = 0 ); - virtual AbstractSfxSingleTabDialog * CreateSwBorderDlg (Window* pParent, SfxItemSet& rSet, USHORT nType,int nResId );//add for SwBorderDlg + virtual SfxAbstractDialog * CreateSwBorderDlg (Window* pParent, SfxItemSet& rSet, USHORT nType,int nResId );//add for SwBorderDlg - virtual AbstractSfxSingleTabDialog * CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, BOOL bDrawMode, int nResId ); //add for SwWrapDlg + virtual SfxAbstractDialog * CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, BOOL bDrawMode, int nResId ); //add for SwWrapDlg virtual VclAbstractDialog * CreateSwTableWidthDlg ( Window *pParent, SwTableFUNC &rFnc , int nResId ); //add for SwTableWidthDlg virtual SfxAbstractTabDialog* CreateSwTableTabDlg( Window* pParent, SfxItemPool& Pool, const SfxItemSet* pItemSet, SwWrtShell* pSh,int nResId ); //add for SwTableTabDlg virtual AbstractSwFldDlg * CreateSwFldDlg ( SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent, int nResId ); //add for SwFldDlg - virtual AbstractSfxSingleTabDialog* CreateSwFldEditDlg ( SwView& rVw, int nResId ); //add for SwFldEditDlg + virtual SfxAbstractDialog* CreateSwFldEditDlg ( SwView& rVw, int nResId ); //add for SwFldEditDlg virtual AbstractSwRenameXNamedDlg * CreateSwRenameXNamedDlg( Window* pParent, //add for SwRenameXNamedDlg STAR_REFERENCE( container::XNamed ) & xNamed, STAR_REFERENCE( container::XNameAccess ) & xNameAccess, int nResId ); diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index bae83e7df144..2f90c9fddef3 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -61,7 +61,7 @@ #include <comphelper/storagehelper.hxx> #include <uitool.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <section.hxx> #include <docary.hxx> #include <doc.hxx> // fuers SwSectionFmt-Array @@ -1588,9 +1588,7 @@ SwInsertSectionTabPage::~SwInsertSectionTabPage() { delete m_pDocInserter; } -/* -----------------21.05.99 12:58------------------- - * - * --------------------------------------------------*/ + void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh) { m_pWrtSh = &rSh; @@ -1606,12 +1604,14 @@ void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh) } FillList(); - USHORT nCnt = m_pWrtSh->GetBookmarkCnt(); - for( USHORT i = 0; i < nCnt; ++i ) - { - SwBookmark& rBm = m_pWrtSh->GetBookmark( i ); - if( rBm.GetOtherBookmarkPos() ) - aSubRegionED.InsertEntry( rBm.GetName() ); + IDocumentMarkAccess* const pMarkAccess = m_pWrtSh->getIDocumentMarkAccess(); + for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin(); + ppMark != pMarkAccess->getMarksEnd(); + ppMark++) + { + const ::sw::mark::IMark* pBkmk = ppMark->get(); + if( pBkmk->IsExpanded() ) + aSubRegionED.InsertEntry( pBkmk->GetName() ); } SwSection* pSect = ((SwInsertSectionTabDialog*)GetTabDialog())->GetSection(); diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx index 3fea2d721c3f..c5dbe60dd2f7 100644 --- a/sw/source/ui/dialog/wordcountdialog.cxx +++ b/sw/source/ui/dialog/wordcountdialog.cxx @@ -41,6 +41,15 @@ #include <layout/layout-pre.hxx> #include <wordcountdialog.hrc> +#if ENABLE_LAYOUT +#undef SW_RES +#define SW_RES(x) #x +#undef SfxModalDialog +#define SfxModalDialog( parent, id ) Dialog( parent, "wordcount.xml", id ) +#define SW_WORDCOUNTDIALOG_HRC +#include <helpid.h> +#endif /* ENABLE_LAYOUT */ + /*-- 06.04.2004 16:05:55--------------------------------------------------- -----------------------------------------------------------------------*/ @@ -67,6 +76,9 @@ SwWordCountDialog::SwWordCountDialog(Window* pParent) : #pragma warning (default : 4355) #endif { +#if ENABLE_LAYOUT + SetHelpId (HID_DLG_WORDCOUNT); +#endif /* ENABLE_LAYOUT */ FreeResource(); } /*-- 06.04.2004 16:05:56--------------------------------------------------- diff --git a/sw/source/ui/dochdl/dochdl.src b/sw/source/ui/dochdl/dochdl.src index a1c11627ff46..4c201bec02b9 100644 --- a/sw/source/ui/dochdl/dochdl.src +++ b/sw/source/ui/dochdl/dochdl.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dochdl.src,v $ - * $Revision: 1.48 $ + * $Revision: 1.48.240.1 $ * * This file is part of OpenOffice.org. * @@ -33,15 +33,10 @@ #include "globals.hrc" -String STR_NOGLOS1 +String STR_NOGLOS { - Text [ en-US ] = "AutoText for Shortcut '" ; + Text [ en-US ] = "AutoText for Shortcut '%1' not found." ; }; -String STR_NOGLOS2 -{ - Text [ en-US ] = "' not found." ; -}; - String STR_NO_TABLE { Text [ en-US ] = "A table cannot be inserted into another table. However, you can paste the data into the document when the cursor is not in a table."; diff --git a/sw/source/ui/dochdl/gloshdl.cxx b/sw/source/ui/dochdl/gloshdl.cxx index c98b76476c10..8d716d6420a9 100644 --- a/sw/source/ui/dochdl/gloshdl.cxx +++ b/sw/source/ui/dochdl/gloshdl.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: gloshdl.cxx,v $ - * $Revision: 1.32 $ + * $Revision: 1.32.240.1 $ * * This file is part of OpenOffice.org. * @@ -647,10 +647,10 @@ BOOL SwGlossaryHdl::Expand( const String& rShortName, } else { - String aTmp( SW_RES(STR_NOGLOS1)); - aTmp += aShortName; - aTmp += SW_RESSTR(STR_NOGLOS2); + String aTmp( SW_RES(STR_NOGLOS)); + aTmp.SearchAndReplaceAscii("%1", aShortName); InfoBox( pWrtShell->GetView().GetWindow(), aTmp ).Execute(); + } } diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 99f34e8db0bf..6539ad9d7284 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -98,7 +98,7 @@ #include <ddefld.hxx> #include <doc.hxx> #include <pagedesc.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <docary.hxx> #include <section.hxx> #include <ndtxt.hxx> @@ -159,6 +159,7 @@ #endif #include <vos/mutex.hxx> #include <vcl/svapp.hxx> +#include <swserv.hxx> extern BOOL bFrmDrag; extern BOOL bDDINetAttr; @@ -883,11 +884,21 @@ int SwTransferable::PrepareForCopy( BOOL bIsCut ) pWrtShell->Copy( pTmpDoc ); { + IDocumentMarkAccess* const pMarkAccess = pTmpDoc->getIDocumentMarkAccess(); + ::std::vector< ::sw::mark::IMark* > vDdeMarks; + // find all DDE-Bookmarks + for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin(); + ppMark != pMarkAccess->getMarksEnd(); + ppMark++) + { + if(IDocumentMarkAccess::DDE_BOOKMARK == IDocumentMarkAccess::GetType(**ppMark)) + vDdeMarks.push_back(ppMark->get()); + } // remove all DDE-Bookmarks, they are invalid inside the clipdoc! - const SwBookmarks& rBkmk = pTmpDoc->getBookmarks(); - for( USHORT n = rBkmk.Count(); n; ) - if( IDocumentBookmarkAccess::DDE_BOOKMARK == rBkmk[ --n ]->GetType() ) - pTmpDoc->deleteBookmark( n ); + for(::std::vector< ::sw::mark::IMark* >::iterator ppMark = vDdeMarks.begin(); + ppMark != vDdeMarks.end(); + ppMark++) + pMarkAccess->deleteMark(*ppMark); } // es wurde in der CORE eine neu angelegt (OLE-Objekte kopiert!) @@ -3634,24 +3645,25 @@ SwTrnsfrDdeLink::SwTrnsfrDdeLink( SwTransferable& rTrans, SwWrtShell& rSh ) } else { - // wir erzeugen uns eine temp. Bookmark (ohne UNDO!) + // creating a temp. bookmark without undo BOOL bUndo = rSh.DoesUndo(); rSh.DoUndo( FALSE ); BOOL bIsModified = rSh.IsModified(); - sName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDE_LINK" )); - rSh.MakeUniqueBookmarkName( sName ); - - //Ok, den eindeutigen Namen haben wir - if( !rSh.SetBookmark( KeyCode(), sName, aEmptyStr, IDocumentBookmarkAccess::DDE_BOOKMARK ) ) - sName.Erase(); - else + ::sw::mark::IMark* pMark = rSh.SetBookmark( + KeyCode(), + ::rtl::OUString(), + ::rtl::OUString(), + IDocumentMarkAccess::DDE_BOOKMARK); + if(pMark) { + sName = pMark->GetName(); bDelBookmrk = TRUE; if( !bIsModified ) rSh.ResetModified(); } - + else + sName.Erase(); rSh.DoUndo( bUndo ); } @@ -3725,23 +3737,46 @@ BOOL SwTrnsfrDdeLink::WriteData( SvStream& rStrm ) rStrm.Write( pMem, nLen ); delete[] pMem; - if( bDelBookmrk ) - { - // er wird das erstemal abgeholt, also ins Undo mitaufnehmen - // aber wie?? - } + //if( bDelBookmrk ) + //{ + // // er wird das erstemal abgeholt, also ins Undo mitaufnehmen + // // aber wie?? + //} - SwDoc* pDoc = pDocShell->GetDoc(); - USHORT nBookPos = pDoc->findBookmark( sName ); - if( USHRT_MAX != nBookPos ) + IDocumentMarkAccess* const pMarkAccess = pDocShell->GetDoc()->getIDocumentMarkAccess(); + IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(sName); + if(ppMark != pMarkAccess->getMarksEnd() + && IDocumentMarkAccess::GetType(**ppMark) != IDocumentMarkAccess::BOOKMARK) { - SwBookmark* pBookMk = pDoc->getBookmarks()[ nBookPos ]; - pBookMk->SetType( IDocumentBookmarkAccess::BOOKMARK ); - pDoc->SetModified(); + // the mark is still a DdeBookmark + // we replace it with a Bookmark, so it will get saved etc. + ::sw::mark::IMark* const pMark = ppMark->get(); + SwServerObject* const pServerObject = dynamic_cast<SwServerObject *>(&refObj); + + // collecting state of old mark + SwPaM aPaM(pMark->GetMarkStart()); + *aPaM.GetPoint() = pMark->GetMarkStart(); + if(pMark->IsExpanded()) + { + aPaM.SetMark(); + *aPaM.GetMark() = pMark->GetMarkEnd(); + } + ::rtl::OUString sMarkName = pMark->GetName(); + + // remove mark + pServerObject->SetNoServer(); // this removes the connection between SwServerObject and mark + pMarkAccess->deleteMark(ppMark); + + // recreate as Bookmark + ::sw::mark::IMark* const pNewMark = pMarkAccess->makeMark( + aPaM, + sMarkName, + IDocumentMarkAccess::BOOKMARK); + pServerObject->SetDdeBookmark(*pNewMark); } - bDelBookmrk = FALSE; - return TRUE; + bDelBookmrk = false; + return true; } // ----------------------------------------------------------------------- @@ -3768,7 +3803,8 @@ void SwTrnsfrDdeLink::Disconnect( BOOL bRemoveDataAdvise ) // <-- BOOL bIsModified = pDoc->IsModified(); - pDoc->deleteBookmark( sName ); + IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + pMarkAccess->deleteMark(pMarkAccess->findMark(sName)); if( !bIsModified ) pDoc->ResetModified(); diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 3d33d98de430..5166f0f01d5c 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -149,7 +149,7 @@ #include <vos/mutex.hxx> #include <vcl/svapp.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <doc.hxx> #include "PostItMgr.hxx" @@ -1475,8 +1475,8 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) KS_Fly_Change, KS_Draw_Change, KS_SpecialInsert, KS_EnterCharCell, - KS_GotoNextFieldBookmark, - KS_GotoPrevFieldBookmark, + KS_GotoNextFieldMark, + KS_GotoPrevFieldMark, KS_Ende }; @@ -1897,10 +1897,12 @@ KEYINPUT_CHECKTABLE_INSDEL: #ifdef SW_CRSR_TIMER BOOL bOld = rSh.ChgCrsrTimerFlag( FALSE ); #endif - if (rSh.IsFormProtected() || rSh.IsInFieldBookmark()!=NULL || rSh.GetChar(FALSE)==CH_TXT_ATR_FORMELEMENT) { - eKeyState=KS_GotoNextFieldBookmark; + if (rSh.IsFormProtected() || rSh.GetCurrentFieldmark() || rSh.GetChar(FALSE)==CH_TXT_ATR_FORMELEMENT) + { + eKeyState=KS_GotoNextFieldMark; } - else if( rSh.GetCurNumRule() && rSh.IsSttOfPara() && + else + if( rSh.GetCurNumRule() && rSh.IsSttOfPara() && !rSh.HasReadonlySel() ) { // --> OD 2007-10-02 #b660435# @@ -1951,8 +1953,8 @@ KEYINPUT_CHECKTABLE_INSDEL: #ifdef SW_CRSR_TIMER BOOL bOld = rSh.ChgCrsrTimerFlag( FALSE ); #endif - if (rSh.IsFormProtected() || rSh.IsInFieldBookmark()!=NULL || rSh.GetChar(FALSE)==CH_TXT_ATR_FORMELEMENT) { - eKeyState=KS_GotoPrevFieldBookmark; + if (rSh.IsFormProtected() || rSh.GetCurrentFieldmark()|| rSh.GetChar(FALSE)==CH_TXT_ATR_FORMELEMENT) { + eKeyState=KS_GotoPrevFieldMark; } else if( rSh.GetCurNumRule() && rSh.IsSttOfPara() && !rSh.HasReadonlySel() ) @@ -2222,84 +2224,93 @@ KEYINPUT_CHECKTABLE_INSDEL: aCh = '\t'; // kein break! case KS_InsChar: - if (rSh.GetChar(FALSE)==CH_TXT_ATR_FORMELEMENT) { - SwFieldBookmark *fieldBM=rSh.IsInFormFieldBookmark(); //$flr refactor!!! - ASSERT(fieldBM!=NULL, "Where is my FieldBookmark??"); - if (fieldBM!=NULL) { - fieldBM->SetChecked(!fieldBM->IsChecked()); - SwDocShell* pDocSh = rView.GetDocShell(); - SwDoc *pDoc=pDocSh->GetDoc(); - ASSERT(fieldBM->GetOtherBookmarkPos()!=NULL, "where is the otherpos?"); - if (fieldBM->GetOtherBookmarkPos()!=NULL) { - SwPaM aPaM(fieldBM->GetBookmarkPos(), *fieldBM->GetOtherBookmarkPos()); - if (0) { - rSh.StartAllAction(); //$flr TODO: understand why this not works - pDoc->SetModified(aPaM); - rSh.EndAllAction(); - } else { - rSh.CalcLayout(); // workaround + if (rSh.GetChar(FALSE)==CH_TXT_ATR_FORMELEMENT) + { + ::sw::mark::ICheckboxFieldmark* pFieldmark = + dynamic_cast< ::sw::mark::ICheckboxFieldmark* > + (rSh.GetCurrentFieldmark()); + OSL_ENSURE(pFieldmark, + "Where is my FieldMark??"); + if(pFieldmark) + { + pFieldmark->SetChecked(!pFieldmark->IsChecked()); + SwDocShell* pDocSh = rView.GetDocShell(); + SwDoc *pDoc=pDocSh->GetDoc(); + OSL_ENSURE(pFieldmark->IsExpanded(), + "where is the otherpos?"); + if (pFieldmark->IsExpanded()) + { + SwPaM aPaM(pFieldmark->GetMarkPos(), pFieldmark->GetOtherMarkPos()); + if(0) + { + rSh.StartAllAction(); //$flr TODO: understand why this not works + pDoc->SetModified(aPaM); + rSh.EndAllAction(); + } + else + { + rSh.CalcLayout(); // workaround + } + } } + eKeyState = KS_Ende; } - - } -// rSh.Overwrite(String('X')); - eKeyState = KS_Ende; - } else if( !rSh.HasReadonlySel() ) - { - BOOL bIsNormalChar = GetAppCharClass().isLetterNumeric( - String( aCh ), 0 ); - if( bChkInsBlank && bIsNormalChar && - (aInBuffer.Len() || !rSh.IsSttPara() || !rSh.IsEndPara() )) + else if(!rSh.HasReadonlySel()) { - // vor dem Zeichen noch ein Blank einfuegen. Dieses - // kommt zwischen den Expandierten Text und dem neuen - // "nicht Worttrenner". - aInBuffer.Expand( aInBuffer.Len() + 1, ' ' ); - } + BOOL bIsNormalChar = GetAppCharClass().isLetterNumeric( + String( aCh ), 0 ); + if( bChkInsBlank && bIsNormalChar && + (aInBuffer.Len() || !rSh.IsSttPara() || !rSh.IsEndPara() )) + { + // vor dem Zeichen noch ein Blank einfuegen. Dieses + // kommt zwischen den Expandierten Text und dem neuen + // "nicht Worttrenner". + aInBuffer.Expand( aInBuffer.Len() + 1, ' ' ); + } - BOOL bIsAutoCorrectChar = SvxAutoCorrect::IsAutoCorrectChar( aCh ); - if( !aKeyEvent.GetRepeat() && pACorr && bIsAutoCorrectChar && - pACfg->IsAutoFmtByInput() && - (( pACorr->IsAutoCorrFlag( ChgWeightUnderl ) && - ( '*' == aCh || '_' == aCh ) ) || - ( pACorr->IsAutoCorrFlag( ChgQuotes ) && ('\"' == aCh ))|| - ( pACorr->IsAutoCorrFlag( ChgSglQuotes ) && ( '\'' == aCh)))) - { - FlushInBuffer(); - rSh.AutoCorrect( *pACorr, aCh ); - if( '\"' != aCh && '\'' != aCh ) // nur bei "*_" rufen! - rSh.UpdateAttr(); - } - else if( !aKeyEvent.GetRepeat() && pACorr && bIsAutoCorrectChar && - pACfg->IsAutoFmtByInput() && - pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd | - ChgFractionSymbol | ChgOrdinalNumber | - ChgToEnEmDash | SetINetAttr | - Autocorrect ) && - '\"' != aCh && '\'' != aCh && '*' != aCh && '_' != aCh && - !bIsNormalChar - ) - { - FlushInBuffer(); - rSh.AutoCorrect( *pACorr, aCh ); + BOOL bIsAutoCorrectChar = SvxAutoCorrect::IsAutoCorrectChar( aCh ); + if( !aKeyEvent.GetRepeat() && pACorr && bIsAutoCorrectChar && + pACfg->IsAutoFmtByInput() && + (( pACorr->IsAutoCorrFlag( ChgWeightUnderl ) && + ( '*' == aCh || '_' == aCh ) ) || + ( pACorr->IsAutoCorrFlag( ChgQuotes ) && ('\"' == aCh ))|| + ( pACorr->IsAutoCorrFlag( ChgSglQuotes ) && ( '\'' == aCh)))) + { + FlushInBuffer(); + rSh.AutoCorrect( *pACorr, aCh ); + if( '\"' != aCh && '\'' != aCh ) // nur bei "*_" rufen! + rSh.UpdateAttr(); + } + else if( !aKeyEvent.GetRepeat() && pACorr && bIsAutoCorrectChar && + pACfg->IsAutoFmtByInput() && + pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd | + ChgFractionSymbol | ChgOrdinalNumber | + ChgToEnEmDash | SetINetAttr | + Autocorrect ) && + '\"' != aCh && '\'' != aCh && '*' != aCh && '_' != aCh && + !bIsNormalChar + ) + { + FlushInBuffer(); + rSh.AutoCorrect( *pACorr, aCh ); + } + else + { + aInBuffer.Expand( aInBuffer.Len() + aKeyEvent.GetRepeat() + 1,aCh ); + bFlushCharBuffer = Application::AnyInput( INPUT_KEYBOARD ); + bFlushBuffer = !bFlushCharBuffer; + if( bFlushCharBuffer ) + aKeyInputFlushTimer.Start(); + } + eKeyState = KS_Ende; } else { - aInBuffer.Expand( aInBuffer.Len() + aKeyEvent.GetRepeat() + 1,aCh ); - bFlushCharBuffer = Application::AnyInput( INPUT_KEYBOARD ); - bFlushBuffer = !bFlushCharBuffer; - if( bFlushCharBuffer ) - aKeyInputFlushTimer.Start(); + InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute(); + // ??? Window::KeyInput( aKeyEvent ); + eKeyState = KS_Ende; } - eKeyState = KS_Ende; - } - else - { - InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute(); -// ??? Window::KeyInput( aKeyEvent ); - eKeyState = KS_Ende; - } break; case KS_CheckAutoCorrect: @@ -2358,23 +2369,19 @@ KEYINPUT_CHECKTABLE_INSDEL: nKS_NUMINDENTINC_Count = 2; break; - case KS_GotoNextFieldBookmark: - { - SwBookmark *pBM=rSh.GetNextFieldBookmark(); - if (pBM!=NULL) { - rSh.GotoFieldBookmark(pBM); - } - } - break; + case KS_GotoNextFieldMark: + { + ::sw::mark::IFieldmark const * const pFieldmark = rSh.GetFieldmarkAfter(); + if(pFieldmark) rSh.GotoFieldmark(pFieldmark); + } + break; - case KS_GotoPrevFieldBookmark: - { - SwBookmark *pBM=rSh.GetPrevFieldBookmark(); - if (pBM!=NULL) { - rSh.GotoFieldBookmark(pBM); - } - } - break; + case KS_GotoPrevFieldMark: + { + ::sw::mark::IFieldmark const * const pFieldmark = rSh.GetFieldmarkBefore(); + if(pFieldmark) rSh.GotoFieldmark(pFieldmark); + } + break; case KS_NumIndentDec: // --> OD 2008-06-16 #i90078# @@ -5069,49 +5076,70 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) case COMMAND_SELECTIONCHANGE: { const CommandSelectionChangeData *pData = rCEvt.GetSelectionChangeData(); - rSh.HideCrsr(); + rSh.SttCrsrMove(); rSh.GoStartSentence(); rSh.GetCrsr()->GetPoint()->nContent += sal::static_int_cast<sal_uInt16, ULONG>(pData->GetStart()); rSh.SetMark(); - rSh.GetCrsr()->GetMark()->nContent += sal::static_int_cast<sal_uInt16, ULONG>( pData->GetEnd() - pData->GetStart() ); - rSh.ShowCrsr(); + rSh.GetCrsr()->GetMark()->nContent += sal::static_int_cast<sal_uInt16, ULONG>(pData->GetEnd() - pData->GetStart()); + rSh.EndCrsrMove( TRUE ); } break; case COMMAND_PREPARERECONVERSION: if( rSh.HasSelection() ) { - if ( rSh.IsMultiSelection() ) + SwPaM *pCrsr = (SwPaM*)rSh.GetCrsr(); + + if( rSh.IsMultiSelection() ) + { + if( pCrsr && !pCrsr->HasMark() && + pCrsr->GetPoint() == pCrsr->GetMark() ) + { + rSh.GoPrevCrsr(); + pCrsr = (SwPaM*)rSh.GetCrsr(); + } + + // Cancel all selections other than the last selected one. + while( rSh.GetCrsr()->GetNext() != rSh.GetCrsr() ) + delete rSh.GetCrsr()->GetNext(); + } + + if( pCrsr ) { - // Save the last selected area. - SwPaM *pCrsr = (SwPaM*)rSh.GetCrsr()->GetPrev(); - xub_StrLen nPosIdx = pCrsr->GetPoint()->nContent.GetIndex(); ULONG nPosNodeIdx = pCrsr->GetPoint()->nNode.GetIndex(); - xub_StrLen nMarkIdx = pCrsr->GetMark()->nContent.GetIndex(); + xub_StrLen nPosIdx = pCrsr->GetPoint()->nContent.GetIndex(); ULONG nMarkNodeIdx = pCrsr->GetMark()->nNode.GetIndex(); + xub_StrLen nMarkIdx = pCrsr->GetMark()->nContent.GetIndex(); - // ToDo: Deselect the text behind the first paragraph break, - // if the last selected area ranges from one paragraph - // to another. - if( nPosNodeIdx != nMarkNodeIdx ) - break; + if( !rSh.GetCrsr()->HasMark() ) + rSh.GetCrsr()->SetMark(); - // Cancel all selection. - while( rSh._GetCrsr()->GetNext() != rSh._GetCrsr() ) - delete rSh._GetCrsr()->GetNext(); + rSh.SttCrsrMove(); - // Restore the last selected area. + if( nPosNodeIdx < nMarkNodeIdx ) + { + rSh.GetCrsr()->GetPoint()->nNode = nPosNodeIdx; rSh.GetCrsr()->GetPoint()->nContent = nPosIdx; + rSh.GetCrsr()->GetMark()->nNode = nPosNodeIdx; + rSh.GetCrsr()->GetMark()->nContent = + rSh.GetCrsr()->GetCntntNode( TRUE )->Len(); + } + else if( nPosNodeIdx == nMarkNodeIdx ) + { rSh.GetCrsr()->GetPoint()->nNode = nPosNodeIdx; - rSh.SetMark(); + rSh.GetCrsr()->GetPoint()->nContent = nPosIdx; + rSh.GetCrsr()->GetMark()->nNode = nMarkNodeIdx; rSh.GetCrsr()->GetMark()->nContent = nMarkIdx; + } + else + { rSh.GetCrsr()->GetMark()->nNode = nMarkNodeIdx; - rSh.ShowCrsr(); - } - else - { - // Deselect the text behind the first paragraph break. - rSh.NormalizePam( FALSE ); - while( !rSh.IsSelOnePara() && rSh.MovePara( fnParaPrev, fnParaEnd )); + rSh.GetCrsr()->GetMark()->nContent = nMarkIdx; + rSh.GetCrsr()->GetPoint()->nNode = nMarkNodeIdx; + rSh.GetCrsr()->GetPoint()->nContent = + rSh.GetCrsr()->GetCntntNode( FALSE )->Len(); + } + + rSh.EndCrsrMove( TRUE ); } } break; @@ -5646,7 +5674,7 @@ XubString SwEditWin::GetSurroundingText() const String sReturn; SwWrtShell& rSh = rView.GetWrtShell(); if( rSh.HasSelection() && !rSh.IsMultiSelection() && rSh.IsSelOnePara() ) - rSh.GetSelectedText( sReturn ); + rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR ); else if( !rSh.HasSelection() ) { SwPosition *pPos = rSh.GetCrsr()->GetPoint(); @@ -5657,7 +5685,7 @@ XubString SwEditWin::GetSurroundingText() const rSh.GoStartSentence(); rSh.SetMark(); rSh.GoEndSentence(); - rSh.GetSelectedText( sReturn ); + rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR ); pPos->nContent = nPos; rSh.ClearMark(); @@ -5675,7 +5703,7 @@ Selection SwEditWin::GetSurroundingTextSelection() const if( rSh.HasSelection() ) { String sReturn; - rSh.GetSelectedText( sReturn ); + rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR ); return Selection( 0, sReturn.Len() ); } else diff --git a/sw/source/ui/docvw/edtwin3.cxx b/sw/source/ui/docvw/edtwin3.cxx index 62c6eb2d97f7..4e1cae03ea03 100644 --- a/sw/source/ui/docvw/edtwin3.cxx +++ b/sw/source/ui/docvw/edtwin3.cxx @@ -150,7 +150,7 @@ BOOL SwEditWin::RulerMarginDrag( const MouseEvent& rMEvt, } // <-- -Dialog* GetSearchDialog() +LAYOUT_NS Dialog* GetSearchDialog() { return SwView::GetSearchDialog(); } diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index c60859790db0..7b1170b35efe 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -768,6 +768,8 @@ bool SwMailMergeDlg::ExecQryShell() } else { + //#i97667# reset column name - otherwise it's remembered from the last run + pMgr->SetEMailColumn(::rtl::OUString()); //start save as dialog String sFilter; sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter); diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx index fbb25cdb9fce..c0ee8f2e0a98 100644 --- a/sw/source/ui/fldui/fldedt.cxx +++ b/sw/source/ui/fldui/fldedt.cxx @@ -409,7 +409,9 @@ IMPL_LINK( SwFldEditDlg, AddressHdl, PushButton *, EMPTYARG ) SwAbstractDialogFactory* pFact = swui::GetFactory(); DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); - AbstractSfxSingleTabDialog* pDlg = pFact->CreateSfxSingleTabDialog( this, aSet, RC_DLG_ADDR ); + SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aSet, + pSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), + RC_DLG_ADDR ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if(RET_OK == pDlg->Execute()) { diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index 5f3c1bc4fd72..24c025fb55d8 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -39,7 +39,7 @@ #include "swtypes.hxx" #include <view.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <expfld.hxx> #include <swmodule.hxx> #ifndef _FLDREF_HXX @@ -59,7 +59,8 @@ #endif // --> OD 2007-11-14 #i83479# #include <SwNodeNum.hxx> -#include <IDocumentBookmarkAccess.hxx> +#include <IDocumentMarkAccess.hxx> +#include <ndtxt.hxx> // <-- // sw/inc/expfld.hxx @@ -78,6 +79,8 @@ USHORT nFldDlgFmtSel = 0; #define USER_DATA_VERSION_1 "1" #define USER_DATA_VERSION USER_DATA_VERSION_1 + + /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ @@ -544,11 +547,14 @@ void SwFldRefPage::UpdateSubType() { aSelectionLB.SetStyle(aSelectionLB.GetStyle()|WB_SORT); // alle Textmarken besorgen - USHORT nCnt = pSh->GetBookmarkCnt(TRUE); - for( USHORT n = 0; n < nCnt; ++n ) + IDocumentMarkAccess* const pMarkAccess = pSh->getIDocumentMarkAccess(); + for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin(); + ppMark != pMarkAccess->getBookmarksEnd(); + ppMark++) { - const SwBookmark& rBkmk = pSh->GetBookmark( n, TRUE ); - aSelectionLB.InsertEntry( rBkmk.GetName() ); + const ::sw::mark::IMark* pBkmk = ppMark->get(); + if(IDocumentMarkAccess::BOOKMARK == IDocumentMarkAccess::GetType(*pBkmk)) + aSelectionLB.InsertEntry( pBkmk->GetName() ); } if (IsFldEdit()) sOldSel = pRefFld->GetSetRefName(); @@ -952,16 +958,10 @@ BOOL SwFldRefPage::FillItemSet(SfxItemSet& ) pSh->getIDocumentOutlineNodesAccess()->getOutlineNodes( maOutlineNodes ); if ( nOutlIdx < maOutlineNodes.size() ) { - IDocumentBookmarkAccess* pIDoc = pSh->getIDocumentBookmarkAccess(); - aName = pIDoc->getCrossRefBookmarkName( - *(maOutlineNodes[nOutlIdx]), - IDocumentBookmarkAccess::HEADING ); - if ( aName.Len() == 0 ) - { - aName = pIDoc->makeCrossRefBookmark( - *(maOutlineNodes[nOutlIdx]), - IDocumentBookmarkAccess::HEADING ); - } + ::sw::mark::IMark const * const pMark = pSh->getIDocumentMarkAccess()->getMarkForTxtNode( + *(maOutlineNodes[nOutlIdx]), + IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK); + aName = pMark->GetName(); nTypeId = TYP_GETREFFLD; nSubType = REF_BOOKMARK; } @@ -978,16 +978,10 @@ BOOL SwFldRefPage::FillItemSet(SfxItemSet& ) pSh->getIDocumentListItemsAccess()->getNumItems( maNumItems ); if ( nNumItemIdx < maNumItems.size() ) { - IDocumentBookmarkAccess* pIDoc = pSh->getIDocumentBookmarkAccess(); - aName = pIDoc->getCrossRefBookmarkName( + ::sw::mark::IMark const * const pMark = pSh->getIDocumentMarkAccess()->getMarkForTxtNode( *(maNumItems[nNumItemIdx]->GetTxtNode()), - IDocumentBookmarkAccess::NUMITEM ); - if ( aName.Len() == 0 ) - { - aName = pIDoc->makeCrossRefBookmark( - *(maNumItems[nNumItemIdx]->GetTxtNode()), - IDocumentBookmarkAccess::NUMITEM ); - } + IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK); + aName = pMark->GetName(); nTypeId = TYP_GETREFFLD; nSubType = REF_BOOKMARK; } diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index a87c2d24e3cb..4c6f35341e30 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -265,7 +265,7 @@ SwTemplateDlg::SwTemplateDlg(Window* pParent, AddTabPage(TP_COLUMN, SwColumnPage::Create, SwColumnPage::GetRanges ); - AddTabPage( TP_MACRO_ASSIGN, SfxMacroTabPage::Create, 0); + AddTabPage( TP_MACRO_ASSIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0); // Auskommentiert wegen Bug #45776 (per default keine Breite&Groesse in Rahmenvorlagen) /* SwFmtFrmSize aSize( (const SwFmtFrmSize&)rBase. @@ -566,11 +566,14 @@ void SwTemplateDlg::PageCreated( USHORT nId, SfxTabPage &rPage ) break; case TP_MACRO_ASSIGN: - SwMacroAssignDlg::AddEvents( (SfxMacroTabPage&)rPage, MACASSGN_ALLFRM); - if ( pWrtShell && pWrtShell->GetView().GetDocShell() - && pWrtShell->GetView().GetDocShell()->GetFrame() && pWrtShell->GetView().GetDocShell()->GetFrame()->GetFrame() ) - rPage.SetFrame( pWrtShell->GetView().GetDocShell()->GetFrame()->GetFrame()->GetFrameInterface() ); + { + SfxAllItemSet aNewSet(*aSet.GetPool()); + aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) ); + if ( pWrtShell ) + rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame()->GetFrameInterface() ); + rPage.PageCreated(aNewSet); break; + } case RID_SVXPAGE_PICK_NUM: { diff --git a/sw/source/ui/frmdlg/frmdlg.cxx b/sw/source/ui/frmdlg/frmdlg.cxx index 66c30ef85255..c4b463baa297 100644 --- a/sw/source/ui/frmdlg/frmdlg.cxx +++ b/sw/source/ui/frmdlg/frmdlg.cxx @@ -112,7 +112,7 @@ SwFrmDlg::SwFrmDlg( SfxViewFrame* pViewFrame, SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "Dialogdiet fail!"); AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 ); - AddTabPage( TP_MACRO_ASSIGN, SfxMacroTabPage::Create, 0); + AddTabPage( TP_MACRO_ASSIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0); AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 ); if(m_bHTMLMode) @@ -191,14 +191,15 @@ void SwFrmDlg::PageCreated( USHORT nId, SfxTabPage &rPage ) break; case TP_MACRO_ASSIGN: - SwMacroAssignDlg::AddEvents( (SfxMacroTabPage&)rPage, - DLG_FRM_GRF == m_nDlgType ? MACASSGN_GRAPHIC - : DLG_FRM_OLE == m_nDlgType ? MACASSGN_OLE - : MACASSGN_FRMURL ); - if ( m_pWrtShell && m_pWrtShell->GetView().GetDocShell() - && m_pWrtShell->GetView().GetDocShell()->GetFrame() && m_pWrtShell->GetView().GetDocShell()->GetFrame()->GetFrame() ) - rPage.SetFrame( m_pWrtShell->GetView().GetDocShell()->GetFrame()->GetFrame()->GetFrameInterface() ); + { + SfxAllItemSet aNewSet(*aSet.GetPool()); + aNewSet.Put( SwMacroAssignDlg::AddEvents( + DLG_FRM_GRF == m_nDlgType ? MACASSGN_GRAPHIC : DLG_FRM_OLE == m_nDlgType ? MACASSGN_OLE : MACASSGN_FRMURL ) ); + if ( m_pWrtShell ) + rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame()->GetFrameInterface() ); + rPage.PageCreated(aNewSet); break; + } case TP_BACKGROUND: if( DLG_FRM_STD == m_nDlgType ) diff --git a/sw/source/ui/frmdlg/frmpage.src b/sw/source/ui/frmdlg/frmpage.src index f44c84f3a2f0..eb1e06090a08 100644 --- a/sw/source/ui/frmdlg/frmpage.src +++ b/sw/source/ui/frmdlg/frmpage.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: frmpage.src,v $ - * $Revision: 1.67 $ + * $Revision: 1.67.240.1 $ * * This file is part of OpenOffice.org. * @@ -330,8 +330,8 @@ TabPage TP_FRM_STD }; PushButton BT_REALSIZE { - Pos = MAP_APPFONT ( 55 , 86 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; + Pos = MAP_APPFONT ( 35 , 86 ) ; + Size = MAP_APPFONT ( 70 , 14 ) ; TabStop = TRUE ; Hide = TRUE ; Text [ en-US ] = "~Original Size" ; diff --git a/sw/source/ui/inc/addrdlg.hxx b/sw/source/ui/inc/addrdlg.hxx index e89a22d93804..f36405c03142 100644 --- a/sw/source/ui/inc/addrdlg.hxx +++ b/sw/source/ui/inc/addrdlg.hxx @@ -36,7 +36,7 @@ class SwAddrDlg : public SfxSingleTabDialog { public: - SwAddrDlg( Window* pParent, SfxItemSet& rSet ); + SwAddrDlg( Window* pParent, const SfxItemSet& rSet ); ~SwAddrDlg(); }; diff --git a/sw/source/ui/inc/macassgn.hxx b/sw/source/ui/inc/macassgn.hxx index bff990d65222..7bc67ab98e93 100644 --- a/sw/source/ui/inc/macassgn.hxx +++ b/sw/source/ui/inc/macassgn.hxx @@ -30,7 +30,7 @@ #ifndef _MACASSGN_HXX #define _MACASSGN_HXX -#include <sfx2/macropg.hxx> +#include <sfx2/evntconf.hxx> class SwWrtShell; class SvxMacroItem; @@ -45,24 +45,13 @@ enum DlgEventType MACASSGN_ALLFRM }; -class SwMacroAssignDlg : public SfxMacroAssignDlg +class SwMacroAssignDlg { public: - SwMacroAssignDlg( - Window* pParent, - SfxItemSet& rSet, - const SwWrtShell& rSh, - DlgEventType eType - ); - virtual ~SwMacroAssignDlg(); - - static void AddEvents( SfxMacroTabPage& rPg, DlgEventType eType ); + static SfxEventNamesItem AddEvents( DlgEventType eType ); static BOOL INetFmtDlg( Window* pParent, SwWrtShell& rSh, SvxMacroItem*& rpINetItem ); }; - - - #endif diff --git a/sw/source/ui/inc/navipi.hxx b/sw/source/ui/inc/navipi.hxx index 339fe8d56ea6..479ed1329ea8 100644 --- a/sw/source/ui/inc/navipi.hxx +++ b/sw/source/ui/inc/navipi.hxx @@ -101,7 +101,6 @@ class SwNavigationPI : public Window, long nDocLBIniHeight; long nWishWidth; - USHORT nActMark; USHORT nAutoMarkIdx; USHORT nRegionMode; // 0 - URL, 1 - Bereich mit Link 2 - B. ohne Link short nZoomIn; diff --git a/sw/source/ui/inc/tblnumfm.hxx b/sw/source/ui/inc/tblnumfm.hxx index 4bcd036a1b27..2dc2f838e255 100644 --- a/sw/source/ui/inc/tblnumfm.hxx +++ b/sw/source/ui/inc/tblnumfm.hxx @@ -39,7 +39,7 @@ class SwNumFmtDlg : public SfxSingleTabDialog { public: - SwNumFmtDlg(Window* pParent, SfxItemSet& rSet); + SwNumFmtDlg(Window* pParent, const SfxItemSet& rSet); ~SwNumFmtDlg(); }; diff --git a/sw/source/ui/inc/unotxvw.hxx b/sw/source/ui/inc/unotxvw.hxx index 4a46dadd14c5..4db18720cf87 100644 --- a/sw/source/ui/inc/unotxvw.hxx +++ b/sw/source/ui/inc/unotxvw.hxx @@ -76,8 +76,8 @@ class SwXTextView : { SelectionChangeListenerArr aSelChangedListeners; - SwView* pView; - const SfxItemPropertyMap* pMap; // property map for SwXTextView properties + SwView* m_pView; + const SfxItemPropertySet* m_pPropSet; // property map for SwXTextView properties // (not related to pxViewSettings!) ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxViewSettings; @@ -155,7 +155,7 @@ public: void NotifySelChanged(); void NotifyDBChanged(); - SwView* GetView() {return pView;} + SwView* GetView() {return m_pView;} void Invalidate(); // temporary document used for PDF export of selections/multi-selections @@ -181,8 +181,8 @@ class SwXTextViewCursor : public SwXTextViewCursor_Base, public SwClient, public OTextCursorHelper { - SwView* pView; - SfxItemPropertySet aPropSet; + SwView* m_pView; + const SfxItemPropertySet* m_pPropSet; protected: sal_Bool IsTextSelection( sal_Bool bAllowTables = sal_True ) const; virtual ~SwXTextViewCursor(); @@ -264,7 +264,7 @@ public: //XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); - void Invalidate(){pView = 0;} + void Invalidate(){m_pView = 0;} // ITextCursorHelper virtual const SwPaM* GetPaM() const; diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index 9ff923ac3136..7ddfc2775299 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -41,6 +41,7 @@ #include "swdllapi.h" #include <swtypes.hxx> #include <shellid.hxx> +#include <layout/layout.hxx> class SwBaseShell; class Button; @@ -186,7 +187,7 @@ class SW_DLLPUBLIC SwView: public SfxViewShell static USHORT nInsertObjectCtrlState; static USHORT nInsertFieldCtrlState; static USHORT nMoveType; // fuer Buttons unter dem Scrollbar (viewmdi) - static USHORT nActMark; // aktuelle Sprungmarke fuer unbenannte Merker + static sal_Int32 nActMark; // aktuelle Sprungmarke fuer unbenannte Merker static BOOL bExtra; static BOOL bFound; @@ -490,12 +491,12 @@ public: void SetVisArea( const Point&, BOOL bUpdateScrollbar = TRUE); void CheckVisArea(); - static Dialog* GetSearchDialog(); + static LAYOUT_NS Dialog* GetSearchDialog(); static USHORT GetMoveType(); static void SetMoveType(USHORT nSet); DECL_STATIC_LINK( SwView, MoveNavigationHdl, bool* ); // #i75416# - static void SetActMark(BYTE nSet); + static void SetActMark(sal_Int32 nSet); BOOL HandleWheelCommands( const CommandEvent& ); diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx index fcccff415eb2..70e509972ddb 100644 --- a/sw/source/ui/inc/wrtsh.hxx +++ b/sw/source/ui/inc/wrtsh.hxx @@ -102,7 +102,7 @@ private: using SwCrsrShell::GotoPage; using SwFEShell::InsertObject; using SwEditShell::AutoCorrect; - using SwCrsrShell::GotoBookmark; + using SwCrsrShell::GotoMark; public: @@ -409,13 +409,13 @@ typedef BOOL (SwWrtShell:: *FNSimpleMove)(); virtual void DrawSelChanged( ); // springe zum Bookmark und setze die "Selections-Flags" wieder richtig - BOOL GotoBookmark( USHORT nPos ); - BOOL GotoBookmark( USHORT nPos, BOOL bSelect, BOOL bStart ); - BOOL GotoBookmark( const String& rName ); + BOOL GotoMark( const ::sw::mark::IMark* const pMark ); + BOOL GotoMark( const ::sw::mark::IMark* const pMark, BOOL bSelect, BOOL bStart ); + BOOL GotoMark( const ::rtl::OUString& rName ); BOOL GoNextBookmark(); // TRUE, wenn's noch eine gab BOOL GoPrevBookmark(); - bool GotoFieldBookmark(SwBookmark *pBkmk); + bool GotoFieldmark(::sw::mark::IFieldmark const * const pMark); BOOL GotoField( const SwFmtFld& rFld ); @@ -613,8 +613,7 @@ private: BOOKMARK_LAST_LAST_ENTRY }; - SW_DLLPRIVATE BOOL MoveBookMark( BookMarkMove eFuncId, - USHORT nPos = 0 ); + SW_DLLPRIVATE BOOL MoveBookMark(BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark=NULL); }; inline void SwWrtShell::ResetCursorStack() diff --git a/sw/source/ui/index/toxmgr.cxx b/sw/source/ui/index/toxmgr.cxx index 4e0cbe897ac9..686a134a67ec 100644 --- a/sw/source/ui/index/toxmgr.cxx +++ b/sw/source/ui/index/toxmgr.cxx @@ -312,7 +312,7 @@ BOOL SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc, TOXTypes eCurTOXType = rDesc.GetTOXType(); if(pCurTOX && !ppBase && pSh->HasSelection()) - pSh->DelRight(); + pSh->EnterStdMode(); switch(eCurTOXType) { diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 78d86551d593..f7eace73f06e 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -46,7 +46,7 @@ #include "wrtsh.hxx" // #include "cmdid.h" #include "bookmark.hxx" // SwInsertBookmarkDlg -#include "bookmrk.hxx" // SwBookmark +#include "IMark.hxx" #include "bookmark.hrc" #include "misc.hrc" @@ -121,7 +121,8 @@ void SwInsertBookmarkDlg::Apply() for (USHORT nCount = aBookmarkBox.GetRemovedCount(); nCount > 0; nCount--) { String sRemoved = aBookmarkBox.GetRemovedEntry( nCount -1 ).GetName(); - rSh.DelBookmark( sRemoved ); + IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); + pMarkAccess->deleteMark( pMarkAccess->findMark(sRemoved) ); SfxRequest aReq( rSh.GetView().GetViewFrame(), FN_DELETE_BOOKMARK ); aReq.AppendItem( SfxStringItem( FN_DELETE_BOOKMARK, sRemoved ) ); aReq.Done(); @@ -170,17 +171,17 @@ SwInsertBookmarkDlg::SwInsertBookmarkDlg( Window *pParent, SwWrtShell &rS, SfxRe aDeleteBtn.SetClickHdl(LINK(this, SwInsertBookmarkDlg, DeleteHdl)); // Combobox mit vorhandenen Bookmarks fuellen - USHORT nCount = rSh.GetBookmarkCnt(TRUE); - - for( USHORT nId = 0; nId < nCount; nId++ ) + IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); + USHORT nId = 0; + for( IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin(); + ppBookmark != pMarkAccess->getBookmarksEnd(); + ppBookmark++) { - SwBookmark& rBkmk = rSh.GetBookmark( nId, TRUE ); - aBookmarkBox.InsertEntry( SwBoxEntry( rBkmk.GetName(), nId ) ); + if(IDocumentMarkAccess::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark)) + aBookmarkBox.InsertEntry( SwBoxEntry( ppBookmark->get()->GetName(), nId++ ) ); } - FreeResource(); sRemoveWarning = String(SW_RES(STR_REMOVE_WARNING)); - } /*------------------------------------------------------------------------ diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 3399ecb4e752..ef368f680378 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -643,7 +643,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) break; case FN_GL_MACRO: { - SfxItemSet aSet( pSh->GetAttrPool(), RES_FRMMACRO, RES_FRMMACRO ); + SfxItemSet aSet( pSh->GetAttrPool(), RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 ); SvxMacro aStart(aEmptyStr, aEmptyStr, STARBASIC); SvxMacro aEnd(aEmptyStr, aEmptyStr, STARBASIC); @@ -656,19 +656,22 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) aItem.SetMacro( SW_EVENT_END_INS_GLOSSARY, aEnd ); aSet.Put( aItem ); + aSet.Put( SwMacroAssignDlg::AddEvents( MACASSGN_TEXTBAUST ) ); const SfxPoolItem* pItem; - SwMacroAssignDlg aMacDlg( this, aSet, *pSh, MACASSGN_TEXTBAUST ); - if( RET_OK == aMacDlg.Execute() && - SFX_ITEM_SET == aMacDlg.GetOutputItemSet()->GetItemState( - RES_FRMMACRO, sal_False, &pItem )) + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( this, aSet, + pSh->GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), SID_EVENTCONFIG ); + if ( pMacroDlg && pMacroDlg->Execute() == RET_OK && + SFX_ITEM_SET == pMacroDlg->GetOutputItemSet()->GetItemState( RES_FRMMACRO, sal_False, &pItem ) ) { const SvxMacroTableDtor& rTbl = ((SvxMacroItem*)pItem)->GetMacroTable(); - pGlossaryHdl->SetMacros( aShortNameEdit.GetText(), rTbl.Get( SW_EVENT_START_INS_GLOSSARY ), rTbl.Get( SW_EVENT_END_INS_GLOSSARY ) ); } + + delete pMacroDlg; } break; diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx index ad82cda4726d..d659ceb0b6f1 100644 --- a/sw/source/ui/misc/insfnote.cxx +++ b/sw/source/ui/misc/insfnote.cxx @@ -35,39 +35,25 @@ #undef SW_DLLIMPLEMENTATION #endif - #include <hintids.hxx> +#include <svtools/eitem.hxx> #include <svtools/stritem.hxx> #include <sfx2/request.hxx> -#include <svx/charmap.hxx> #include <svx/fontitem.hxx> #include <vcl/msgbox.hxx> - - #include <fmtftn.hxx> #include <swundo.hxx> -#ifndef _CMDID_H #include <cmdid.h> -#endif #include <wrtsh.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif -#ifndef _BASESH_HXX #include <basesh.hxx> -#endif #include <insfnote.hxx> #include <crsskip.hxx> - -#ifndef _MISC_HRC #include <misc.hrc> -#endif -#ifndef _INSFNOTE_HRC #include <insfnote.hrc> -#endif - #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> +#include <sfx2/viewfrm.hxx> static BOOL bFootnote = TRUE; @@ -184,26 +170,35 @@ IMPL_LINK( SwInsFootNoteDlg, NumberExtCharHdl, Button *, EMPTYARG ) rSh.GetCurAttr( aSet ); const SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT ); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxCharacterMap* pDlg = pFact->CreateSvxCharacterMap( this, RID_SVXDLG_CHARMAP, FALSE ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - - Font aDlgFont( pDlg->GetCharFont() ); - aDlgFont.SetName( rFont.GetFamilyName() ); - aDlgFont.SetCharSet( rFont.GetCharSet() ); + SfxAllItemSet aAllSet( rSh.GetAttrPool() ); + aAllSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) ); + aAllSet.Put( rFont ); - pDlg->SetCharFont( aDlgFont ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aAllSet, + rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); if (RET_OK == pDlg->Execute()) { - String sExtChars(pDlg->GetCharacters()); - - aFontName = pDlg->GetCharFont().GetName(); - eCharSet = pDlg->GetCharFont().GetCharSet(); - aNumberCharEdit.SetText( sExtChars ); - aNumberCharEdit.SetFont( pDlg->GetCharFont() ); - bExtCharAvailable = TRUE; - aOkBtn.Enable(0 != aNumberCharEdit.GetText().Len()); + SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pItem, SfxStringItem, SID_CHARMAP, FALSE ); + SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE ); + if ( pItem ) + { + String sExtChars(pItem->GetValue()); + aNumberCharEdit.SetText( sExtChars ); + + if ( pFontItem ) + { + aFontName = pFontItem->GetFamilyName(); + eCharSet = pFontItem->GetCharSet(); + Font aFont( aFontName, pFontItem->GetStyleName(), aNumberCharEdit.GetFont().GetSize() ); + aFont.SetCharSet( pFontItem->GetCharSet() ); + aFont.SetPitch( pFontItem->GetPitch() ); + aNumberCharEdit.SetFont( aFont ); + } + + bExtCharAvailable = TRUE; + aOkBtn.Enable(0 != aNumberCharEdit.GetText().Len()); + } } delete pDlg; diff --git a/sw/source/ui/misc/insrule.src b/sw/source/ui/misc/insrule.src index 006f745df269..9c0767f15eca 100644 --- a/sw/source/ui/misc/insrule.src +++ b/sw/source/ui/misc/insrule.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: insrule.src,v $ - * $Revision: 1.21 $ + * $Revision: 1.21.240.1 $ * * This file is part of OpenOffice.org. * @@ -76,7 +76,7 @@ ModalDialog DLG_INSERT_RULER { Text [ en-US ] = "Plain" ; }; - Text [ en-US ] = "Insert Horizontal Ruler" ; + Text [ en-US ] = "Insert Horizontal Rule" ; }; diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index 46ea0510cc63..c1e46a1b4dfb 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -50,7 +50,6 @@ #include <svx/brshitem.hxx> #include <svx/lrspitem.hxx> #include <svx/impgrf.hxx> -#include <svx/charmap.hxx> #include <svx/numitem.hxx> #include <swvset.hxx> #include <swmodule.hxx> diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index 1b52fe930c51..0b2ff55c7c41 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -42,34 +42,22 @@ #include <svtools/intitem.hxx> #include <svtools/eitem.hxx> #include <sfx2/dispatch.hxx> -#ifndef _SVX_SVXIDS_HRC //autogen #include <svx/svxids.hrc> -#endif #include <svx/unolingu.hxx> -#include <svx/charmap.hxx> #include <svx/svxdlg.hxx> -#ifndef _SVX_DIALOGS_HRC #include <svx/dialogs.hrc> -#endif #include <unotools/collatorwrapper.hxx> #include <svtools/collatorres.hxx> #include <swwait.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif -#ifndef _CMDID_H #include <cmdid.h> -#endif #include <wrtsh.hxx> -#ifndef _MISC_HRC #include <misc.hrc> -#endif -#ifndef _SRTDLG_HRC #include <srtdlg.hrc> -#endif #include <swtable.hxx> #include <node.hxx> #include <tblsel.hxx> +#include <sfx2/request.hxx> // sw/inc/tblsel.hxx SV_IMPL_PTRARR( _FndBoxes, _FndBox* ) @@ -405,11 +393,17 @@ IMPL_LINK( SwSortDlg, DelimCharHdl, PushButton*, EMPTYARG ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if(pFact) { - AbstractSvxCharacterMap* pMap = pFact->CreateSvxCharacterMap( &aDelimPB, RID_SVXDLG_CHARMAP); - DBG_ASSERT(pMap, "Dialogdiet fail!"); - pMap->SetChar( GetDelimChar() ); + SfxAllItemSet aSet( rSh.GetAttrPool() ); + aSet.Put( SfxInt32Item( SID_ATTR_CHAR, GetDelimChar() ) ); + SfxAbstractDialog* pMap = pFact->CreateSfxDialog( &aDelimPB, aSet, + rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); if( RET_OK == pMap->Execute() ) - aDelimEdt.SetText( pMap->GetChar() ); + { + SFX_ITEMSET_ARG( pMap->GetOutputItemSet(), pItem, SfxInt32Item, SID_ATTR_CHAR, FALSE ); + if ( pItem ) + aDelimEdt.SetText( sal_Unicode ( pItem->GetValue() ) ); + } + delete pMap; } return 0; diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 9dc28b6e442a..b4a4491c220d 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -351,7 +351,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) rReq.Done(); break; } - case FN_INSERT_SYMBOL: + case SID_CHARMAP: { if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED) InsertSymbol(rReq); @@ -1505,7 +1505,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) const SfxItemSet *pArgs = rReq.GetArgs(); const SfxPoolItem* pItem = 0; if( pArgs ) - pArgs->GetItemState(GetPool().GetWhich(FN_INSERT_SYMBOL), FALSE, &pItem); + pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), FALSE, &pItem); String sSym; String sFontName; @@ -1513,7 +1513,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) { sSym = ((const SfxStringItem*)pItem)->GetValue(); const SfxPoolItem* pFtItem = NULL; - pArgs->GetItemState( GetPool().GetWhich(FN_PARAM_1), FALSE, &pFtItem); + pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), FALSE, &pFtItem); const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); if ( pFontItem ) sFontName = pFontItem->GetValue(); @@ -1532,36 +1532,50 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( SID_ATTR_CHAR_FONT, GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ) )); + if (!sFontName.Len()) + sFontName = aSetDlgFont.GetFamilyName(); } - Font aFont(sFontName, Size(1,1)); - if(!sSym.Len()) + if( !sSym.Len() ) { - //CHINA001 SvxCharacterMap* pDlg = new SvxCharacterMap( NULL, FALSE ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001 - AbstractSvxCharacterMap* pDlg = pFact->CreateSvxCharacterMap( NULL, RID_SVXDLG_CHARMAP, FALSE ); - DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001 - Font aDlgFont( pDlg->GetCharFont() ); + SfxAllItemSet aAllSet( GetPool() ); + aAllSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) ); + SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions()); String sSymbolFont = aOpt.GetSymbolFont(); - if(sSymbolFont.Len()) - aDlgFont.SetName(sSymbolFont); + if( sSymbolFont.Len() ) + aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) ); else - aDlgFont.SetName( aSetDlgFont.GetFamilyName() ); + aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) ); // Wenn Zeichen selektiert ist kann es angezeigt werden - pDlg->SetFont( aDlgFont ); + SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet, + rView.GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); + USHORT nResult = pDlg->Execute(); if( nResult == RET_OK ) { - aFont = pDlg->GetCharFont(); - sSym = pDlg->GetCharacters(); - aOpt.SetSymbolFont(aFont.GetName()); - SW_MOD()->ApplyUsrPref(aOpt, &rView); + SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, FALSE ); + SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE ); + if ( pFontItem ) + { + aFont.SetName( pFontItem->GetFamilyName() ); + aFont.SetStyleName( pFontItem->GetStyleName() ); + aFont.SetCharSet( pFontItem->GetCharSet() ); + aFont.SetPitch( pFontItem->GetPitch() ); + } + + if ( pCItem ) + { + sSym = pCItem->GetValue(); + aOpt.SetSymbolFont(aFont.GetName()); + SW_MOD()->ApplyUsrPref(aOpt, &rView); + } } + delete( pDlg ); } @@ -1611,9 +1625,9 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) pOutliner->SetUpdateMode(TRUE); pOLV->ShowCursor(); - rReq.AppendItem( SfxStringItem( GetPool().GetWhich(FN_INSERT_SYMBOL), sSym ) ); + rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) ); if(aFont.GetName().Len()) - rReq.AppendItem( SfxStringItem( FN_PARAM_1, aFont.GetName() ) ); + rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetName() ) ); rReq.Done(); } } diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index e46fbe523f77..66276be3e4ff 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -102,7 +102,6 @@ #endif #include <viewopt.hxx> #include <fontcfg.hxx> -#include <bookmrk.hxx> #include <docstat.hxx> #include <usrfld.hxx> #include <expfld.hxx> @@ -2439,7 +2438,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) RES_BOX , RES_SHADOW, SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 ); - AbstractSfxSingleTabDialog * pDlg = 0; + SfxAbstractDialog * pDlg = 0; // Tabellenzelle(n) selektiert? if ( rSh.IsTableMode() ) { @@ -2505,7 +2504,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) SfxItemSet aSet( rSh.GetAttrPool(), RES_BACKGROUND, RES_BACKGROUND ); - AbstractSfxSingleTabDialog * pDlg = 0; + SfxAbstractDialog * pDlg = 0; SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); @@ -2516,7 +2515,9 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) //Hintergrundattribute der Tabelle holen und in den Set packen SvxBrushItem aBrush(RES_BACKGROUND); rSh.GetBoxBackground( aBrush ); - pDlg = pFact->CreateSfxSingleTabDialog( pMDI, aSet, RC_SWDLG_BACKGROUND ); + pDlg = pFact->CreateSfxDialog( pMDI, aSet, + rView.GetViewFrame()->GetFrame()->GetFrameInterface(), + RC_SWDLG_BACKGROUND ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); aSet.Put( aBrush ); if ( pDlg->Execute() == RET_OK ) @@ -2533,7 +2534,9 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) rSh.GetFlyFrmAttr( aSet ); - pDlg = pFact->CreateSfxSingleTabDialog( pMDI, aSet, RC_SWDLG_BACKGROUND ); + pDlg = pFact->CreateSfxDialog( pMDI, aSet, + rView.GetViewFrame()->GetFrame()->GetFrameInterface(), + RC_SWDLG_BACKGROUND ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if ( pDlg->Execute() == RET_OK ) { @@ -2546,7 +2549,9 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) // Umrandungsattribute ganz normal ueber Shell setzen rSh.GetCurAttr( aSet ); - pDlg = pFact->CreateSfxSingleTabDialog( pMDI, aSet, RC_SWDLG_BACKGROUND ); + pDlg = pFact->CreateSfxDialog( pMDI, aSet, + rView.GetViewFrame()->GetFrame()->GetFrameInterface(), + RC_SWDLG_BACKGROUND ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if ( pDlg->Execute() == RET_OK ) { diff --git a/sw/source/ui/shells/drwbassh.cxx b/sw/source/ui/shells/drwbassh.cxx index 1e9ea6189d97..725d5239e6fe 100644 --- a/sw/source/ui/shells/drwbassh.cxx +++ b/sw/source/ui/shells/drwbassh.cxx @@ -193,7 +193,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); - AbstractSfxSingleTabDialog* pDlg = pFact->CreateSwWrapDlg( GetView().GetWindow(), aSet, pSh, TRUE, RC_DLG_SWWRAPDLG ); + SfxAbstractDialog* pDlg = pFact->CreateSwWrapDlg( GetView().GetWindow(), aSet, pSh, TRUE, RC_DLG_SWWRAPDLG ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if (pDlg->Execute() == RET_OK) diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index e033f7c7c3f7..a0f38300fba2 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -38,7 +38,6 @@ #include <svx/langitem.hxx> #include <svx/svdview.hxx> #include <vcl/msgbox.hxx> -#include <svx/charmap.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/objface.hxx> #include <svx/svdotext.hxx> @@ -140,6 +139,9 @@ void SwDrawTextShell::Init() SwWrtShell &rSh = GetShell(); pSdrView = rSh.GetDrawView(); SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner(); + //#97471# mouse click _and_ key input at the same time + if( !pOutliner ) + return ; OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); ULONG nCtrl = pOutliner->GetControlWord(); nCtrl |= EE_CNTRL_AUTOCORRECT; @@ -526,7 +528,7 @@ void SwDrawTextShell::ExecDraw(SfxRequest &rReq) rReq.Done(); } break; - case FN_INSERT_SYMBOL: + case SID_CHARMAP: { // Sonderzeichen einfuegen InsertSymbol(rReq); break; @@ -776,7 +778,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) const SfxItemSet *pArgs = rReq.GetArgs(); const SfxPoolItem* pItem = 0; if( pArgs ) - pArgs->GetItemState(GetPool().GetWhich(FN_INSERT_SYMBOL), FALSE, &pItem); + pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), FALSE, &pItem); String sSym; String sFontName; @@ -784,7 +786,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) { sSym = ((const SfxStringItem*)pItem)->GetValue(); const SfxPoolItem* pFtItem = NULL; - pArgs->GetItemState( GetPool().GetWhich(FN_PARAM_1), FALSE, &pFtItem); + pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), FALSE, &pFtItem); const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); if ( pFontItem ) sFontName = pFontItem->GetValue(); @@ -803,35 +805,48 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( SID_ATTR_CHAR_FONT, GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ) )); + if (!sFontName.Len()) + sFontName = aSetDlgFont.GetFamilyName(); } - Font aFont(sFontName, Size(1,1)); if(!sSym.Len()) { - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxCharacterMap* pDlg = pFact->CreateSvxCharacterMap( NULL, RID_SVXDLG_CHARMAP, FALSE ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); + SfxAllItemSet aAllSet( GetPool() ); + aAllSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) ); - Font aDlgFont( pDlg->GetCharFont() ); - SwViewOption aOpt(*GetShell().GetViewOptions()); + SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions()); String sSymbolFont = aOpt.GetSymbolFont(); - if(sSymbolFont.Len()) - aDlgFont.SetName(sSymbolFont); + if( sSymbolFont.Len() ) + aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) ); else - aDlgFont.SetName( aSetDlgFont.GetFamilyName() ); + aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) ); // Wenn Zeichen selektiert ist kann es angezeigt werden - pDlg->SetFont( aDlgFont ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet, + rView.GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); USHORT nResult = pDlg->Execute(); if( nResult == RET_OK ) { - aFont = pDlg->GetCharFont(); - sSym = pDlg->GetCharacters(); - aOpt.SetSymbolFont(aFont.GetName()); - SW_MOD()->ApplyUsrPref(aOpt, &GetView()); + SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, FALSE ); + SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE ); + if ( pFontItem ) + { + aFont.SetName( pFontItem->GetFamilyName() ); + aFont.SetStyleName( pFontItem->GetStyleName() ); + aFont.SetCharSet( pFontItem->GetCharSet() ); + aFont.SetPitch( pFontItem->GetPitch() ); + } + + if ( pCItem ) + { + sSym = pCItem->GetValue(); + aOpt.SetSymbolFont(aFont.GetName()); + SW_MOD()->ApplyUsrPref(aOpt, &rView); + } } + delete( pDlg ); } @@ -881,9 +896,9 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) pOutliner->SetUpdateMode(TRUE); pOLV->ShowCursor(); - rReq.AppendItem( SfxStringItem( GetPool().GetWhich(FN_INSERT_SYMBOL), sSym ) ); + rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) ); if(aFont.GetName().Len()) - rReq.AppendItem( SfxStringItem( FN_PARAM_1, aFont.GetName() ) ); + rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetName() ) ); rReq.Done(); } } diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx index 9ef066f81953..3c1d84666c7a 100644 --- a/sw/source/ui/shells/tabsh.cxx +++ b/sw/source/ui/shells/tabsh.cxx @@ -749,7 +749,9 @@ void SwTableShell::Execute(SfxRequest &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); - AbstractSfxSingleTabDialog* pDlg = pFact->CreateSfxSingleTabDialog( GetView().GetWindow(),aCoreSet, RC_DLG_SWNUMFMTDLG ); + SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(),aCoreSet, + pView->GetViewFrame()->GetFrame()->GetFrameInterface(), + RC_DLG_SWNUMFMTDLG ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if (RET_OK == pDlg->Execute()) diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx index b64170ca89e8..599be5f1f1e1 100644 --- a/sw/source/ui/shells/textfld.cxx +++ b/sw/source/ui/shells/textfld.cxx @@ -156,7 +156,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); - AbstractSfxSingleTabDialog* pDlg = pFact->CreateSwFldEditDlg( GetView(),RC_DLG_SWFLDEDITDLG ); + SfxAbstractDialog* pDlg = pFact->CreateSwFldEditDlg( GetView(),RC_DLG_SWFLDEDITDLG ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); pDlg->Execute(); delete pDlg; diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index 415011de4d89..f0874a954b97 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -52,7 +52,6 @@ #include <sfx2/fcontnr.hxx> #include <svx/hlnkitem.hxx> #include <svx/srchitem.hxx> -#include <svx/charmap.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/docfile.hxx> #include <svtools/urihelper.hxx> @@ -1107,14 +1106,14 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) const SfxItemSet *pArgs = rReq.GetArgs(); const SfxPoolItem* pItem = 0; if( pArgs ) - pArgs->GetItemState(GetPool().GetWhich(FN_INSERT_SYMBOL), FALSE, &pItem); + pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), FALSE, &pItem); String aChars, aFontName; if ( pItem ) { aChars = ((const SfxStringItem*)pItem)->GetValue(); const SfxPoolItem* pFtItem = NULL; - pArgs->GetItemState( GetPool().GetWhich(FN_PARAM_1), FALSE, &pFtItem); + pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), FALSE, &pFtItem); const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); if ( pFontItem ) aFontName = pFontItem->GetValue(); @@ -1139,33 +1138,45 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) aFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( RES_CHRATR_FONT, GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ) )); + if (!aFontName.Len()) + aFontName = aFont.GetFamilyName(); } Font aNewFont(aFontName, Size(1,1)); // Size nur wg. CTOR if( !aChars.Len() ) { // Eingestellten Font als Default - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); - AbstractSvxCharacterMap* pDlg = pFact->CreateSvxCharacterMap( &GetView().GetViewFrame()->GetWindow(), RID_SVXDLG_CHARMAP, FALSE ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); + SfxAllItemSet aAllSet( rSh.GetAttrPool() ); + aAllSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) ); - Font aDlgFont( pDlg->GetCharFont() ); SwViewOption aOpt(*GetShell().GetViewOptions()); String sSymbolFont = aOpt.GetSymbolFont(); if( !aFontName.Len() && sSymbolFont.Len() ) - aDlgFont.SetName(sSymbolFont); + aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) ); else - aDlgFont.SetName( aFont.GetFamilyName() ); - - pDlg->SetCharFont( aDlgFont ); + aAllSet.Put( SfxStringItem( SID_FONT_NAME, aFont.GetFamilyName() ) ); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aAllSet, + GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), RID_SVXDLG_CHARMAP ); if( RET_OK == pDlg->Execute() ) { - aChars = pDlg->GetCharacters(); - aNewFont = pDlg->GetCharFont(); - aOpt.SetSymbolFont(aNewFont.GetName()); - SW_MOD()->ApplyUsrPref(aOpt, &GetView()); + SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, FALSE ); + SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE ); + if ( pFontItem ) + { + aNewFont.SetName( pFontItem->GetFamilyName() ); + aNewFont.SetStyleName( pFontItem->GetStyleName() ); + aNewFont.SetCharSet( pFontItem->GetCharSet() ); + aNewFont.SetPitch( pFontItem->GetPitch() ); + } + + if ( pCItem ) + { + aChars = pCItem->GetValue(); + aOpt.SetSymbolFont(aNewFont.GetName()); + SW_MOD()->ApplyUsrPref(aOpt, &GetView()); + } } delete pDlg; @@ -1257,8 +1268,8 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) if ( aChars.Len() ) { - rReq.AppendItem( SfxStringItem( GetPool().GetWhich(FN_INSERT_SYMBOL), aChars ) ); - rReq.AppendItem( SfxStringItem( FN_PARAM_1, aNewFont.GetName() ) ); + rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), aChars ) ); + rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aNewFont.GetName() ) ); rReq.Done(); } } diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index 92fee69b7bb6..8928a505dd87 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -78,7 +78,7 @@ #include <fmthdft.hxx> #include <pagedesc.hxx> #include <textsh.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <swdtflvr.hxx> #include <docstat.hxx> #include <outline.hxx> @@ -399,7 +399,7 @@ void SwTextShell::Execute(SfxRequest &rReq) break; } - case FN_INSERT_SYMBOL: + case SID_CHARMAP: { InsertSymbol( rReq ); } @@ -567,8 +567,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { if ( pItem ) { - String sName = ((SfxStringItem*)pItem)->GetValue(); - rWrtSh.MakeUniqueBookmarkName(sName); + ::rtl::OUString sName = ((SfxStringItem*)pItem)->GetValue(); rWrtSh.SetBookmark( KeyCode(), sName, aEmptyStr ); } else @@ -587,7 +586,10 @@ void SwTextShell::Execute(SfxRequest &rReq) case FN_DELETE_BOOKMARK: { if ( pItem ) - rWrtSh.DelBookmark( ((SfxStringItem*)pItem)->GetValue() ); + { + IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess(); + pMarkAccess->deleteMark( pMarkAccess->findMark(((SfxStringItem*)pItem)->GetValue()) ); + } break; } case FN_AUTOFORMAT_REDLINE_APPLY: @@ -1376,7 +1378,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) rSh.IsNumRuleStart())); break; case FN_EDIT_FORMULA: - case FN_INSERT_SYMBOL: + case SID_CHARMAP: { const int nType = rSh.GetSelectionType(); if (!(nType & nsSelectionType::SEL_TXT) && diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx index 3e6f7eed80b6..8e30123a192b 100644 --- a/sw/source/ui/shells/txtattr.cxx +++ b/sw/source/ui/shells/txtattr.cxx @@ -54,7 +54,6 @@ #include <svx/frmdiritem.hxx> #include "paratr.hxx" - #include <fmtinfmt.hxx> #ifndef _DOCSH_HXX #include <docsh.hxx> @@ -564,7 +563,8 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); - AbstractSfxSingleTabDialog* pDlg = pFact->CreateSfxSingleTabDialog( GetView().GetWindow(), aSet,DLG_SWDROPCAPS ); + SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aSet, + rSh.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(), DLG_SWDROPCAPS ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if (pDlg->Execute() == RET_OK) { diff --git a/sw/source/ui/shells/txtcrsr.cxx b/sw/source/ui/shells/txtcrsr.cxx index f7247baf0255..19b36367d49f 100644 --- a/sw/source/ui/shells/txtcrsr.cxx +++ b/sw/source/ui/shells/txtcrsr.cxx @@ -48,7 +48,6 @@ #include <textsh.hxx> #endif #include <num.hxx> -#include <bookmrk.hxx> #include <edtwin.hxx> #include <crsskip.hxx> diff --git a/sw/source/ui/table/convert.src b/sw/source/ui/table/convert.src index 2023263856c7..3eec84232ba1 100644 --- a/sw/source/ui/table/convert.src +++ b/sw/source/ui/table/convert.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: convert.src,v $ - * $Revision: 1.29 $ + * $Revision: 1.29.240.1 $ * * This file is part of OpenOffice.org. * @@ -111,7 +111,7 @@ ModalDialog DLG_CONV_TEXT_TABLE { Pos = MAP_APPFONT ( 125 , 113 ) ; Size = MAP_APPFONT ( 66 , 10 ) ; - Text [ en-US ] = "The first%POSITION_OF_CONTROLrows" ; + Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ; }; NumericField NF_REPEAT_HEADER { diff --git a/sw/source/ui/table/instable.src b/sw/source/ui/table/instable.src index 5a64b0b6df45..ca5680ebf494 100644 --- a/sw/source/ui/table/instable.src +++ b/sw/source/ui/table/instable.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: instable.src,v $ - * $Revision: 1.32 $ + * $Revision: 1.32.240.1 $ * * This file is part of OpenOffice.org. * @@ -122,7 +122,7 @@ ModalDialog DLG_INSERT_TABLE { Pos = MAP_APPFONT ( 30 , 105 ) ; Size = MAP_APPFONT ( 95 , 10 ) ; - Text [ en-US ] = "The first%POSITION_OF_CONTROLrows" ; + Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ; }; NumericField NF_REPEAT_HEADER { diff --git a/sw/source/ui/table/tabledlg.src b/sw/source/ui/table/tabledlg.src index 1511ebeaa619..4e6aec8bdb9f 100644 --- a/sw/source/ui/table/tabledlg.src +++ b/sw/source/ui/table/tabledlg.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: tabledlg.src,v $ - * $Revision: 1.38 $ + * $Revision: 1.38.66.1 $ * * This file is part of OpenOffice.org. * @@ -679,7 +679,7 @@ TabPage TP_TABLE_TEXTFLOW { Pos = MAP_APPFONT ( 31 , 114 ) ; Size = MAP_APPFONT ( 95 , 10 ) ; - Text [ en-US ] = "The first%POSITION_OF_CONTROLrows" ; + Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ; }; NumericField NF_REPEAT_HEADER { diff --git a/sw/source/ui/uiview/makefile.mk b/sw/source/ui/uiview/makefile.mk index cc0fa1ca1392..2aa5e12e2631 100644 --- a/sw/source/ui/uiview/makefile.mk +++ b/sw/source/ui/uiview/makefile.mk @@ -54,7 +54,8 @@ EXCEPTIONSFILES= \ $(SLO)$/uivwimp.obj \ $(SLO)$/view.obj \ $(SLO)$/view2.obj \ - $(SLO)$/viewling.obj + $(SLO)$/viewling.obj \ + $(SLO)$/viewmdi.obj \ SLOFILES = \ $(SLO)$/view0.obj \ diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index 0087471de8d0..f5e84ee1048b 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -674,7 +674,7 @@ void SwView::_CheckReadonlyState() SID_REDO, SID_REPEAT, SID_PASTE, FN_PASTESPECIAL, SID_SBA_BRW_INSERT, SID_BACKGROUND_COLOR, FN_INSERT_BOOKMARK, - FN_INSERT_SYMBOL, FN_INSERT_SOFT_HYPHEN, + SID_CHARMAP, FN_INSERT_SOFT_HYPHEN, FN_INSERT_HARDHYPHEN, FN_INSERT_HARD_SPACE, FN_INSERT_BREAK, FN_INSERT_LINEBREAK, FN_INSERT_COLUMN_BREAK, FN_INSERT_BREAK_DLG, FN_DELETE_SENT, FN_DELETE_BACK_SENT, FN_DELETE_WORD, diff --git a/sw/source/ui/uiview/view.hrc b/sw/source/ui/uiview/view.hrc index f3061d2e1b3f..2c6d31277f0e 100644 --- a/sw/source/ui/uiview/view.hrc +++ b/sw/source/ui/uiview/view.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: view.hrc,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.240.1 $ * * This file is part of OpenOffice.org. * @@ -39,8 +39,6 @@ // STR ------------------------------------------------------------------- -#define STR_NOGLOS1 (RC_VIEW_BEGIN + 1) -#define STR_NOGLOS2 (RC_VIEW_BEGIN + 2) #define STR_NUM_LEVEL (RC_VIEW_BEGIN + 3) #define STR_NUM_OUTLINE (RC_VIEW_BEGIN + 4) diff --git a/sw/source/ui/uiview/view.src b/sw/source/ui/uiview/view.src index 277cf8748d7a..beb4f423ba28 100644 --- a/sw/source/ui/uiview/view.src +++ b/sw/source/ui/uiview/view.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: view.src,v $ - * $Revision: 1.52 $ + * $Revision: 1.52.110.1 $ * * This file is part of OpenOffice.org. * @@ -136,18 +136,6 @@ InfoBox MSG_SCAN_NOSOURCE { Message [ en-US ] = "Source not specified." ; }; -String STR_NOGLOS1 -{ - Text [ en-US ] = "AutoText for Shortcut '" ; -}; -String STR_NOGLOS2 -{ - /* ### ACHTUNG: Neuer Text in Resource? ' nicht gefunden. : '' nicht gefunden. */ - /* ### ACHTUNG: Neuer Text in Resource? ' nicht gefunden. : '' nicht gefunden. */ - /* ### ACHTUNG: Neuer Text in Resource? ' nicht gefunden. : '' nicht gefunden. */ - /* ### ACHTUNG: Neuer Text in Resource? ' nicht gefunden. : '' nicht gefunden. */ - Text [ en-US ] = "' not found." ; -}; String STR_NUM_LEVEL { Text [ en-US ] = "Level " ; diff --git a/sw/source/ui/uiview/view0.cxx b/sw/source/ui/uiview/view0.cxx index 4936bcb28907..2e9a3bc783e7 100644 --- a/sw/source/ui/uiview/view0.cxx +++ b/sw/source/ui/uiview/view0.cxx @@ -497,14 +497,13 @@ void SwView::ExecViewOptions(SfxRequest &rReq) { SwDocShell *pDocSh = GetDocShell(); SwDoc *pDoc = pDocSh? pDocSh->GetDoc() : NULL; - SwRootFrm *pRootFrm = pDoc ? pDoc->GetRootFrm() : NULL; // right now we don't have view options for automatic grammar checking. Thus... sal_Bool bIsAutoGrammar = sal_False; aCfg.GetProperty( C2U( UPN_IS_GRAMMAR_AUTO ) ) >>= bIsAutoGrammar; - if (pDoc && pRootFrm && bIsAutoGrammar) - StartGrammarChecking( *pDoc, *pRootFrm ); + if (pDoc && bIsAutoGrammar) + StartGrammarChecking( *pDoc ); } } break; diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index c48ad073411e..c063c72c5892 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -119,7 +119,7 @@ #include <pagedesc.hxx> #include <section.hxx> #include <usrpref.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <navipi.hxx> #include <tox.hxx> #include <workctrl.hxx> @@ -1246,7 +1246,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) break; case SID_ATTR_ZOOM: { - if ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) { const SwViewOption* pVOpt = rShell.GetViewOptions(); SvxZoomType eZoom = (SvxZoomType) pVOpt->GetZoomType(); @@ -1268,7 +1268,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) break; case SID_ATTR_VIEWLAYOUT: { - if ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) { const SwViewOption* pVOpt = rShell.GetViewOptions(); const USHORT nColumns = pVOpt->GetViewLayoutColumns(); @@ -1282,7 +1282,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) break; case SID_ATTR_ZOOMSLIDER: { - if ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) { const SwViewOption* pVOpt = rShell.GetViewOptions(); const USHORT nCurrentZoom = pVOpt->GetZoom(); @@ -1566,10 +1566,18 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) { if (SFX_ITEM_SET == pArgs->GetItemState( nWhich, TRUE, &pItem)) { - USHORT nDest; - nDest = ((const SfxUInt16Item *)pItem)->GetValue(); - rSh.EnterStdMode(); - rSh.GotoBookmark( nDest ); + const IDocumentMarkAccess* pMarkAccess = rSh.getIDocumentMarkAccess(); + const sal_Int32 nIdx = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + if(nIdx < pMarkAccess->getBookmarksCount()) + { + const IDocumentMarkAccess::const_iterator_t ppBookmark = rSh.getIDocumentMarkAccess()->getBookmarksBegin() + nIdx; + rSh.EnterStdMode(); + rSh.GotoMark( ppBookmark->get() ); + } + else + OSL_ENSURE(false, + "SwView::ExecuteStatusLine(..)" + " - Ignoring out of range bookmark index"); } } break; @@ -1582,13 +1590,13 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) break; case SID_ATTR_ZOOM: { - if ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) { const SfxItemSet *pSet = 0; AbstractSvxZoomDialog *pDlg = 0; if ( pArgs ) pSet = pArgs; - else if ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + else { const SwViewOption& rViewOptions = *rSh.GetViewOptions(); SfxItemSet aCoreSet(pShell->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM, SID_ATTR_VIEWLAYOUT, SID_ATTR_VIEWLAYOUT, 0 ); @@ -1653,7 +1661,7 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) case SID_ATTR_VIEWLAYOUT: { if ( pArgs && !rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) && - GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) ) { // PAGES01 if ( SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_VIEWLAYOUT, TRUE, &pItem )) @@ -1676,7 +1684,7 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) case SID_ATTR_ZOOMSLIDER: { - if ( pArgs && GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) + if ( pArgs && ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) ) { // PAGES01 if ( SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_ZOOMSLIDER, TRUE, &pItem )) @@ -1871,6 +1879,8 @@ BOOL SwView::JumpToSwMark( const String& rMark ) sMark.Search( cMarkSeperator, nPos + 1 )) ) nPos = nLastPos; + IDocumentMarkAccess::const_iterator_t ppMark; + IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess(); if( STRING_NOTFOUND != nPos && ( sCmp = sMark.Copy( nPos + 1 ) ).EraseAllChars().Len() ) { @@ -1919,8 +1929,8 @@ BOOL SwView::JumpToSwMark( const String& rMark ) bRet = TRUE; } } - else if( USHRT_MAX != ( nPos = pWrtShell->FindBookmark( sMark ) )) - pWrtShell->GotoBookmark( nPos, FALSE, TRUE ), bRet = TRUE; + else if( pMarkAccess->getMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)) ) + pWrtShell->GotoMark( ppMark->get(), FALSE, TRUE ), bRet = TRUE; else if( 0 != ( pINet = pWrtShell->FindINetAttr( sMark ) )) bRet = pWrtShell->GotoINetAttr( *pINet->GetTxtINetFmt() ); @@ -1941,8 +1951,8 @@ BOOL SwView::JumpToSwMark( const String& rMark ) } } } - else if( USHRT_MAX != ( nPos = pWrtShell->FindBookmark( sMark ) )) - pWrtShell->GotoBookmark( nPos, FALSE, TRUE ), bRet = TRUE; + else if( pMarkAccess->getMarksEnd() != (ppMark = pMarkAccess->findMark(sMark))) + pWrtShell->GotoMark( ppMark->get(), FALSE, TRUE ), bRet = TRUE; else if( 0 != ( pINet = pWrtShell->FindINetAttr( sMark ) )) bRet = pWrtShell->GotoINetAttr( *pINet->GetTxtINetFmt() ); diff --git a/sw/source/ui/uiview/viewmdi.cxx b/sw/source/ui/uiview/viewmdi.cxx index 08067ee76807..702c0790012f 100644 --- a/sw/source/ui/uiview/viewmdi.cxx +++ b/sw/source/ui/uiview/viewmdi.cxx @@ -58,7 +58,7 @@ #include <uitool.hxx> #include <edtwin.hxx> #include <pagedesc.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <fldbas.hxx> #include <workctrl.hxx> #include <usrpref.hxx> @@ -88,7 +88,8 @@ #include <postit.hxx> USHORT SwView::nMoveType = NID_PGE; -USHORT SwView::nActMark = 0; +sal_Int32 SwView::nActMark = 0; + #define VIEW_IMAGECOLOR COL_LIGHTBLUE @@ -455,37 +456,37 @@ IMPL_STATIC_LINK( SwView, MoveNavigationHdl, bool *, pbNext ) break; case NID_MARK: { - // Selektionen aufheben + // unselect rSh.MoveCrsr(); rSh.EnterStdMode(); - const USHORT nBookCnt = rSh.GetBookmarkCnt(); - USHORT nMarkCount = 0; - USHORT nRealIdx[MAX_MARKS]; - for( USHORT nCount = 0; nCount < nBookCnt; ++nCount ) + + // collect navigator reminders + IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); + ::std::vector< const ::sw::mark::IMark* > vNavMarks; + for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin(); + ppMark != pMarkAccess->getMarksEnd(); + ppMark++) { - if( rSh.GetBookmark( nCount ).IsMark() ) - { - nRealIdx[nMarkCount] = nCount; - ++nMarkCount; - } + if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::NAVIGATOR_REMINDER ) + vNavMarks.push_back(ppMark->get()); } - if (nMarkCount) + + // move + if(vNavMarks.size()) { - if(!bNext) + if(bNext) { - if (nActMark > 1) - --nActMark; - else - nActMark = nMarkCount; + nActMark++; + if (nActMark >= MAX_MARKS || nActMark >= static_cast<sal_Int32>(vNavMarks.size())) + nActMark = 0; } else { - ++nActMark; - if (nActMark > MAX_MARKS || nActMark > nMarkCount) - nActMark = 1; + nActMark--; + if (nActMark < 0 || nActMark >= static_cast<sal_Int32>(vNavMarks.size())) + nActMark = vNavMarks.size()-1; } - - rSh.GotoBookmark( nRealIdx[nActMark - 1] ); + rSh.GotoMark(vNavMarks[nActMark]); } } break; @@ -701,7 +702,7 @@ void SwView::SetMoveType(USHORT nSet) /*-----------------20.06.97 11:18------------------- --------------------------------------------------*/ -void SwView::SetActMark(BYTE nSet) +void SwView::SetActMark(sal_Int32 nSet) { nActMark = nSet; } diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx index a6369123f5d0..c5602411f324 100644 --- a/sw/source/ui/uiview/viewsrch.cxx +++ b/sw/source/ui/uiview/viewsrch.cxx @@ -106,7 +106,7 @@ inline Window* GetParentWindow( SvxSearchDialog* pSrchDlg ) { Window* pWin; if( pSrchDlg && pSrchDlg->IsVisible() ) - pWin = pSrchDlg; + pWin = LAYOUT_THIS_WINDOW (pSrchDlg); else pWin = 0; return pWin; @@ -168,7 +168,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) if ( pWrp ) { - pSrchDlg = (SvxSearchDialog*)(pWrp->GetWindow()); + pSrchDlg = static_cast <SvxSearchDialog*> (pWrp->getDialog ()); // die Search / Replace -Items merken wir uns const SearchAttrItemList* pList = pSrchDlg->GetSearchItemList(); if( pList && pList->Count() ) @@ -189,7 +189,7 @@ void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) SwView::SetMoveType(NID_SRCH_REP); if ( pWrp ) { - pSrchDlg = (SvxSearchDialog*)(pWrp->GetWindow()); + pSrchDlg = static_cast <SvxSearchDialog*> (pWrp->getDialog ()); } else pSrchDlg = 0; @@ -493,7 +493,7 @@ BOOL SwView::SearchAndWrap(BOOL bApi) const USHORT nId = SvxSearchDialogWrapper::GetChildWindowId(); SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nId); - pSrchDlg = pWrp ? (SvxSearchDialog*)(pWrp->GetWindow()) : 0; + pSrchDlg = pWrp ? static_cast <SvxSearchDialog*> (pWrp->getDialog ()) : 0; // falls Startposition am Dokumentende / -anfang if (aOpts.bDontWrap) @@ -728,19 +728,17 @@ ULONG SwView::FUNC_Search( const SwSearchOptions& rOptions ) return nFound; } - -Dialog* SwView::GetSearchDialog() +LAYOUT_NS Dialog* SwView::GetSearchDialog() { const USHORT nId = SvxSearchDialogWrapper::GetChildWindowId(); SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)SfxViewFrame::Current()->GetChildWindow(nId); if ( pWrp ) - pSrchDlg = (SvxSearchDialog*)(pWrp->GetWindow()); + pSrchDlg = pWrp->getDialog (); else pSrchDlg = 0; return pSrchDlg; } - void SwView::StateSearch(SfxItemSet &rSet) { SfxWhichIter aIter(rSet); diff --git a/sw/source/ui/uno/unoatxt.cxx b/sw/source/ui/uno/unoatxt.cxx index ffae96e30010..dfdbacab354b 100644 --- a/sw/source/ui/uno/unoatxt.cxx +++ b/sw/source/ui/uno/unoatxt.cxx @@ -56,12 +56,13 @@ #include <swevent.hxx> #include <doc.hxx> #include <unocrsr.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <unoprnms.hxx> #include <docsh.hxx> #include <swunodef.hxx> #include <swmodule.hxx> #include <svtools/smplhint.hxx> +#include <svtools/macitem.hxx> #include <svx/acorrcfg.hxx> @@ -323,7 +324,7 @@ sal_Int64 SAL_CALL SwXAutoTextGroup::getSomething( const uno::Sequence< sal_Int8 -----------------------------------------------------------------------*/ SwXAutoTextGroup::SwXAutoTextGroup(const OUString& rName, SwGlossaries* pGlos) : - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_AUTO_TEXT_GROUP)), + pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_AUTO_TEXT_GROUP)), pGlossaries(pGlos), sName(rName), m_sGroupName(rName) @@ -398,10 +399,8 @@ void SwXAutoTextGroup::renameByName(const OUString& aElementName, else throw uno::RuntimeException(); } -/* -----------------04.05.99 11:57------------------- - * - * --------------------------------------------------*/ -sal_Bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTextRange* pxRange ) + +sal_Bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTextRange* pxRange) { ASSERT( pInsDoc, "kein Ins.Dokument" ); @@ -421,10 +420,10 @@ sal_Bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTextR } else { - SwBookmark* pBkm = pxRange->GetBookmark(); - if(pBkm && pBkm->GetOtherBookmarkPos()) + const ::sw::mark::IMark* const pBkmk = pxRange->GetBookmark(); + if(pBkmk && pBkmk->IsExpanded()) { - SwPaM aTmp(*pBkm->GetOtherBookmarkPos(), pBkm->GetBookmarkPos()); + SwPaM aTmp(pBkmk->GetOtherMarkPos(), pBkmk->GetMarkPos()); bRet |= (true == pxRange->GetDoc()->Copy(aTmp, aPos)); } } @@ -722,7 +721,7 @@ sal_Bool SwXAutoTextGroup::hasByName(const OUString& rName) uno::Reference< beans::XPropertySetInfo > SwXAutoTextGroup::getPropertySetInfo(void) throw( uno::RuntimeException ) { - static uno::Reference< beans::XPropertySetInfo > xRet = aPropSet.getPropertySetInfo(); + static uno::Reference< beans::XPropertySetInfo > xRet = pPropSet->getPropertySetInfo(); return xRet; } /*-- 09.02.00 15:33:31--------------------------------------------------- @@ -734,16 +733,15 @@ void SwXAutoTextGroup::setPropertyValue( lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); + const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName ); - if(!pMap) + if(!pEntry) throw beans::UnknownPropertyException(); SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0; if(!pGlosGroup || pGlosGroup->GetError()) throw uno::RuntimeException(); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_GROUP_TITLE: { @@ -767,17 +765,16 @@ uno::Any SwXAutoTextGroup::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); + const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName); - if(!pMap) + if(!pEntry) throw beans::UnknownPropertyException(); SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0; if(!pGlosGroup || pGlosGroup->GetError()) throw uno::RuntimeException(); uno::Any aAny; - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_GROUP_PATH: aAny <<= OUString(pGlosGroup->GetFileName()); @@ -1134,11 +1131,11 @@ void SwXAutoTextEntry::applyTo(const uno::Reference< text::XTextRange > & xTextR SwPaM* pInsertPaM = 0; if(pRange) { - SwBookmark* pBkm = pRange->GetBookmark(); - if(pBkm->GetOtherBookmarkPos()) - pInsertPaM = new SwPaM(*pBkm->GetOtherBookmarkPos(), pBkm->GetBookmarkPos()); + const ::sw::mark::IMark* const pBkmk = pRange->GetBookmark(); + if(pBkmk->IsExpanded()) + pInsertPaM = new SwPaM(pBkmk->GetOtherMarkPos(), pBkmk->GetMarkPos()); else - pInsertPaM = new SwPaM(pBkm->GetBookmarkPos()); + pInsertPaM = new SwPaM(pBkmk->GetMarkPos()); } else { diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx index 54da1ede78a8..3acb1e25bd31 100644 --- a/sw/source/ui/uno/unomailmerge.cxx +++ b/sw/source/ui/uno/unomailmerge.cxx @@ -418,7 +418,7 @@ SwXMailMerge::SwXMailMerge() : aEvtListeners ( GetMailMergeMutex() ), aMergeListeners ( GetMailMergeMutex() ), aPropListeners ( GetMailMergeMutex() ), - pMap( aSwMapProvider.GetPropertyMap( PROPERTY_MAP_MAILMERGE ) ), + pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_MAILMERGE ) ), bSendAsHTML(sal_False), bSendAsAttachment(sal_False), bSaveAsSingleFile(sal_False) @@ -887,7 +887,7 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXMailMerge::getPropertySetI throw (RuntimeException) { vos::OGuard aGuard( Application::GetSolarMutex() ); - static Reference< XPropertySetInfo > aRef = new SfxItemPropertySetInfo( pMap ); + static Reference< XPropertySetInfo > aRef = pPropSet->getPropertySetInfo(); return aRef; } @@ -897,8 +897,7 @@ void SAL_CALL SwXMailMerge::setPropertyValue( { vos::OGuard aGuard( Application::GetSolarMutex() ); - const SfxItemPropertyMap* pCur = - SfxItemPropertyMap::GetByName( pMap, rPropertyName ); + const SfxItemPropertySimpleEntry* pCur = pPropSet->getPropertyMap()->getByName( rPropertyName ); if (!pCur) throw UnknownPropertyException(); else if (pCur->nFlags & PropertyAttribute::READONLY) @@ -1055,7 +1054,7 @@ uno::Any SAL_CALL SwXMailMerge::getPropertyValue( Any aRet; - const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName( pMap, rPropertyName ); + const SfxItemPropertySimpleEntry* pCur = pPropSet->getPropertyMap()->getByName( rPropertyName ); if (!pCur) throw UnknownPropertyException(); else @@ -1109,8 +1108,7 @@ void SAL_CALL SwXMailMerge::addPropertyChangeListener( vos::OGuard aGuard( Application::GetSolarMutex() ); if (!bDisposing && rListener.is()) { - const SfxItemPropertyMap* pCur = - SfxItemPropertyMap::GetByName( pMap, rPropertyName ); + const SfxItemPropertySimpleEntry* pCur = pPropSet->getPropertyMap()->getByName( rPropertyName ); if (pCur) aPropListeners.addInterface( pCur->nWID, rListener ); else @@ -1126,8 +1124,7 @@ void SAL_CALL SwXMailMerge::removePropertyChangeListener( vos::OGuard aGuard( Application::GetSolarMutex() ); if (!bDisposing && rListener.is()) { - const SfxItemPropertyMap* pCur = - SfxItemPropertyMap::GetByName( pMap, rPropertyName ); + const SfxItemPropertySimpleEntry* pCur = pPropSet->getPropertyMap()->getByName( rPropertyName ); if (pCur) aPropListeners.removeInterface( pCur->nWID, rListener ); else diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 6cf2f20d7503..e1218b9c8d9e 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -529,7 +529,7 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) : aRefreshCont ( static_cast < XTextDocument* > ( this ) ), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_DOCUMENT)), + pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_DOCUMENT)), pDocShell(pShell), @@ -2144,7 +2144,7 @@ Reference< XIndexAccess > SwXTextDocument::getDocumentIndexes(void) throw( Runt -----------------------------------------------------------------------*/ Reference< XPropertySetInfo > SwXTextDocument::getPropertySetInfo(void) throw( RuntimeException ) { - static Reference< XPropertySetInfo > xRet = aPropSet.getPropertySetInfo(); + static Reference< XPropertySetInfo > xRet = pPropSet->getPropertySetInfo(); return xRet; } /*-- 10.05.99 13:58:58--------------------------------------------------- @@ -2158,14 +2158,13 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, ::vos::OGuard aGuard(Application::GetSolarMutex()); if(!IsValid()) throw RuntimeException(); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); + const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName); - if(!pMap) + if(!pEntry) throw UnknownPropertyException(); - if(pMap->nFlags & PropertyAttribute::READONLY) + if(pEntry->nFlags & PropertyAttribute::READONLY) throw PropertyVetoException(); - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_DOC_CHAR_COUNT : case WID_DOC_PARA_COUNT : @@ -2183,14 +2182,14 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, { sal_Bool bSet = *(sal_Bool*)aValue.getValue(); sal_uInt16 eMode = pDocShell->GetDoc()->GetRedlineMode(); - if(WID_DOC_CHANGES_SHOW == pMap->nWID) + if(WID_DOC_CHANGES_SHOW == pEntry->nWID) { eMode &= ~(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE); eMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT; if( bSet ) eMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE; } - else if(WID_DOC_CHANGES_RECORD == pMap->nWID) + else if(WID_DOC_CHANGES_RECORD == pEntry->nWID) { eMode = bSet ? eMode|nsRedlineMode_t::REDLINE_ON : eMode&~nsRedlineMode_t::REDLINE_ON; } @@ -2320,9 +2319,9 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, default: { - const SfxPoolItem& rItem = pDocShell->GetDoc()->GetDefault(pMap->nWID); + const SfxPoolItem& rItem = pDocShell->GetDoc()->GetDefault(pEntry->nWID); SfxPoolItem* pNewItem = rItem.Clone(); - pNewItem->PutValue(aValue, pMap->nMemberId); + pNewItem->PutValue(aValue, pEntry->nMemberId); pDocShell->GetDoc()->SetDefault(*pNewItem); delete pNewItem; } @@ -2337,13 +2336,12 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) ::vos::OGuard aGuard(Application::GetSolarMutex()); if(!IsValid()) throw RuntimeException(); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); + const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName); - if(!pMap) + if(!pEntry) throw UnknownPropertyException(); Any aAny; - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_DOC_CHAR_COUNT : case WID_DOC_PARA_COUNT : @@ -2353,7 +2351,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) if(aStat.bModified) pDocShell->GetDoc()->UpdateDocStat( aStat ); sal_Int32 nValue; - switch(pMap->nWID) + switch(pEntry->nWID) { case WID_DOC_CHAR_COUNT :nValue = aStat.nChar;break; case WID_DOC_PARA_COUNT :nValue = aStat.nPara;break; @@ -2372,12 +2370,12 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) { sal_uInt16 eMode = pDocShell->GetDoc()->GetRedlineMode(); sal_Bool bSet = sal_False; - if(WID_DOC_CHANGES_SHOW == pMap->nWID) + if(WID_DOC_CHANGES_SHOW == pEntry->nWID) { sal_uInt16 nMask = nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE; bSet = (eMode & nMask) == nMask; } - else if(WID_DOC_CHANGES_RECORD == pMap->nWID) + else if(WID_DOC_CHANGES_RECORD == pEntry->nWID) { bSet = (eMode& nsRedlineMode_t::REDLINE_ON) != 0; } @@ -2475,8 +2473,8 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) default: { - const SfxPoolItem& rItem = pDocShell->GetDoc()->GetDefault(pMap->nWID); - rItem.QueryValue(aAny, pMap->nMemberId); + const SfxPoolItem& rItem = pDocShell->GetDoc()->GetDefault(pEntry->nWID); + rItem.QueryValue(aAny, pEntry->nMemberId); } } return aAny; @@ -2599,13 +2597,12 @@ PropertyState SAL_CALL SwXTextDocument::getPropertyState( const OUString& rPrope PropertyState eRet = PropertyState_DIRECT_VALUE; if(!IsValid()) throw RuntimeException(); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); + const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName); - if(!pMap) + if(!pEntry) throw UnknownPropertyException(); Any aAny; - switch(pMap->nWID) + switch(pEntry->nWID) { case 0:default:break; } @@ -2630,11 +2627,10 @@ void SAL_CALL SwXTextDocument::setPropertyToDefault( const OUString& rPropertyNa ::vos::OGuard aGuard(Application::GetSolarMutex()); if(!IsValid()) throw RuntimeException(); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName); + if(!pEntry) throw UnknownPropertyException(); - switch(pMap->nWID) + switch(pEntry->nWID) { case 0:default:break; } @@ -2645,12 +2641,11 @@ Any SAL_CALL SwXTextDocument::getPropertyDefault( const OUString& rPropertyName ::vos::OGuard aGuard(Application::GetSolarMutex()); if(!IsValid()) throw RuntimeException(); - const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( - aPropSet.getPropertyMap(), rPropertyName); - if(!pMap) + const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName); + if(!pEntry) throw UnknownPropertyException(); Any aAny; - switch(pMap->nWID) + switch(pEntry->nWID) { case 0:default:break; } @@ -3530,7 +3525,7 @@ Sequence< OUString > SwXLinkTargetSupplier::getSupportedServiceNames(void) SwXLinkNameAccessWrapper::SwXLinkNameAccessWrapper( Reference< XNameAccess > xAccess, const String& rLinkDisplayName, String sSuffix ) : xRealAccess(xAccess), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_LINK_TARGET)), + pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)), sLinkSuffix(sSuffix), sLinkDisplayName(rLinkDisplayName), pxDoc(0) @@ -3541,7 +3536,7 @@ SwXLinkNameAccessWrapper::SwXLinkNameAccessWrapper( --------------------------------------------------*/ SwXLinkNameAccessWrapper::SwXLinkNameAccessWrapper(SwXTextDocument& rxDoc, const String& rLinkDisplayName, String sSuffix) : - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_LINK_TARGET)), + pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)), sLinkSuffix(sSuffix), sLinkDisplayName(rLinkDisplayName), xDoc(&rxDoc), @@ -3719,7 +3714,7 @@ sal_Bool SwXLinkNameAccessWrapper::hasElements(void) throw( RuntimeException ) Reference< XPropertySetInfo > SwXLinkNameAccessWrapper::getPropertySetInfo(void) throw( RuntimeException ) { - static Reference< XPropertySetInfo > xRet = aPropSet.getPropertySetInfo(); + static Reference< XPropertySetInfo > xRet = pPropSet->getPropertySetInfo(); return xRet; } /*-- 26.10.99 09:16:26--------------------------------------------------- @@ -3860,7 +3855,7 @@ Sequence< OUString > SwXLinkNameAccessWrapper::getSupportedServiceNames(void) --------------------------------------------------*/ SwXOutlineTarget::SwXOutlineTarget(const String& rOutlineText) : - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_LINK_TARGET)), + pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)), sOutlineText(rOutlineText) { } @@ -3875,7 +3870,7 @@ SwXOutlineTarget::~SwXOutlineTarget() -----------------------------------------------------------------------*/ Reference< XPropertySetInfo > SwXOutlineTarget::getPropertySetInfo(void) throw( RuntimeException ) { - static Reference< XPropertySetInfo > xRet = aPropSet.getPropertySetInfo(); + static Reference< XPropertySetInfo > xRet = pPropSet->getPropertySetInfo(); return xRet; } /*-- 26.10.99 15:51:46--------------------------------------------------- diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx index 42b0d699689a..eaba514a6e6a 100644 --- a/sw/source/ui/uno/unotxvw.cxx +++ b/sw/source/ui/uno/unotxvw.cxx @@ -66,7 +66,7 @@ #include <sfx2/request.hxx> #include <frmatr.hxx> #include <vos/mutex.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <unotxdoc.hxx> #include <unodraw.hxx> #include <svx/unoshcol.hxx> @@ -134,8 +134,8 @@ SwPaM* lcl_createPamCopy(const SwPaM& rPam) -----------------------------------------------------------------------*/ SwXTextView::SwXTextView(SwView* pSwView) : SfxBaseController(pSwView), - pView(pSwView), - pMap( aSwMapProvider.GetPropertyMap( PROPERTY_MAP_TEXT_VIEW ) ), + m_pView(pSwView), + m_pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_VIEW ) ), pxViewSettings(0), pxTextViewCursor(0) { @@ -188,7 +188,7 @@ void SwXTextView::Invalidate() } m_refCount--; - pView = 0; + m_pView = 0; } /* -----------------------------18.05.00 10:18-------------------------------- @@ -435,13 +435,12 @@ sal_Bool SwXTextView::select(const uno::Any& aInterface) throw( lang::IllegalArg xIfcTunnel->getSomething(SwXBookmark::getUnoTunnelId())); if(pBkm && pBkm->GetDoc() == pDoc) { - - sal_uInt16 nFndPos = rSh.FindBookmark(pBkm->getName()); - - if( USHRT_MAX != nFndPos ) + IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); + IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(pBkm->getName()); + if( ppMark != pMarkAccess->getMarksEnd() ) { rSh.EnterStdMode(); - rSh.GotoBookmark( nFndPos ); + rSh.GotoMark( ppMark->get() ); } return sal_True; } @@ -498,7 +497,7 @@ sal_Bool SwXTextView::select(const uno::Any& aInterface) throw( lang::IllegalArg SdrObject *pObj = pSvxShape->GetSdrObject(); if (pObj) { -// lcl_ShowObject( *pViewSh, *pDrawView, pObj ); +// lcl_ShowObject( *m_pViewSh, *pDrawView, pObj ); SdrPageView* pPV = pDrawView->GetSdrPageView(); if ( pPV && pObj->GetPage() == pPV->GetPage() ) { @@ -531,7 +530,7 @@ sal_Bool SwXTextView::select(const uno::Any& aInterface) throw( lang::IllegalArg { if (!pPV) // erstes Objekt { -// lcl_ShowObject( *pViewSh, *pDrawView, pObj ); +// lcl_ShowObject( *m_pViewSh, *pDrawView, pObj ); pPV = pDrawView->GetSdrPageView(); } if ( pPV && pObj->GetPage() == pPV->GetPage() ) @@ -561,10 +560,10 @@ uno::Any SwXTextView::getSelection(void) throw( uno::RuntimeException ) if(GetView()) { //force immediat shell update - pView->StopShellTimer(); + m_pView->StopShellTimer(); // ein interface aus der aktuellen Selektion erzeugen - SwWrtShell& rSh = pView->GetWrtShell(); - ShellModes eSelMode = pView->GetShellMode(); + SwWrtShell& rSh = m_pView->GetWrtShell(); + ShellModes eSelMode = m_pView->GetShellMode(); switch(eSelMode) { case SHELL_MODE_TABLE_TEXT : @@ -632,7 +631,7 @@ uno::Any SwXTextView::getSelection(void) throw( uno::RuntimeException ) case SHELL_MODE_BEZIER : { uno::Reference< drawing::XDrawPageSupplier > xPageSupp; - uno::Reference< frame::XModel > xModel = pView->GetDocShell()->GetBaseModel(); + uno::Reference< frame::XModel > xModel = m_pView->GetDocShell()->GetBaseModel(); uno::Reference< lang::XUnoTunnel > xModelTunnel(xModel, uno::UNO_QUERY); SwXTextDocument* pTextDoc = reinterpret_cast<SwXTextDocument*>(xModelTunnel-> getSomething(SwXTextDocument::getUnoTunnelId())); @@ -787,12 +786,12 @@ uno::Reference< text::XTextViewCursor > SwXTextView::getViewCursor(void) throw( uno::Reference< beans::XPropertySet > SwXTextView::getViewSettings(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if(pView) + if(m_pView) { if(!pxViewSettings) { ((SwXTextView*)this)->pxViewSettings = new uno::Reference< beans::XPropertySet > ; - *pxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( sal_False, pView ) ); + *pxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( sal_False, m_pView ) ); } } else @@ -808,15 +807,15 @@ Sequence< Sequence< PropertyValue > > SwXTextView::getRubyList( sal_Bool /*bAuto if(!GetView()) throw RuntimeException(); - SwWrtShell& rSh = pView->GetWrtShell(); - ShellModes eSelMode = pView->GetShellMode(); + SwWrtShell& rSh = m_pView->GetWrtShell(); + ShellModes eSelMode = m_pView->GetShellMode(); if (eSelMode != SHELL_MODE_LIST_TEXT && eSelMode != SHELL_MODE_TABLE_LIST_TEXT && eSelMode != SHELL_MODE_TABLE_TEXT && eSelMode != SHELL_MODE_TEXT ) return Sequence< Sequence< PropertyValue > > (); - SwDoc* pDoc = pView->GetDocShell()->GetDoc(); + SwDoc* pDoc = m_pView->GetDocShell()->GetDoc(); SwRubyList aList; USHORT nCount = pDoc->FillRubyList( *rSh.GetCrsr(), aList, 0 ); @@ -858,8 +857,8 @@ void SAL_CALL SwXTextView::setRubyList( if(!GetView() || !rRubyList.getLength()) throw RuntimeException(); - SwWrtShell& rSh = pView->GetWrtShell(); - ShellModes eSelMode = pView->GetShellMode(); + SwWrtShell& rSh = m_pView->GetWrtShell(); + ShellModes eSelMode = m_pView->GetShellMode(); if (eSelMode != SHELL_MODE_LIST_TEXT && eSelMode != SHELL_MODE_TABLE_LIST_TEXT && eSelMode != SHELL_MODE_TABLE_TEXT && @@ -919,7 +918,7 @@ void SAL_CALL SwXTextView::setRubyList( } aList.Insert(pEntry, (USHORT)nPos); } - SwDoc* pDoc = pView->GetDocShell()->GetDoc(); + SwDoc* pDoc = m_pView->GetDocShell()->GetDoc(); pDoc->SetRubyList( *rSh.GetCrsr(), aList, 0 ); } /*-- 29.12.02 15:45:29--------------------------------------------------- @@ -927,7 +926,7 @@ void SAL_CALL SwXTextView::setRubyList( -----------------------------------------------------------------------*/ SfxObjectShellRef SwXTextView::BuildTmpSelectionDoc( SfxObjectShellRef& /*rRef*/ ) { - SwWrtShell* pOldSh = &pView->GetWrtShell(); + SwWrtShell* pOldSh = &m_pView->GetWrtShell(); SfxPrinter *pPrt = pOldSh->getIDocumentDeviceAccess()->getPrinter( false ); SwDocShell* pDocSh; SfxObjectShellRef xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) ); @@ -965,14 +964,14 @@ SfxObjectShellRef SwXTextView::BuildTmpSelectionDoc( SfxObjectShellRef& /*rRef*/ -----------------------------------------------------------------------*/ void SwXTextView::NotifySelChanged() { - DBG_ASSERT( pView, "view is missing" ); + DBG_ASSERT( m_pView, "view is missing" ); // destroy temporary document with selected text that is used // in PDF export of (multi-)selections. - if (pView && pView->GetTmpSelectionDoc().Is()) + if (m_pView && m_pView->GetTmpSelectionDoc().Is()) { - pView->GetTmpSelectionDoc()->DoClose(); - pView->GetTmpSelectionDoc() = 0; + m_pView->GetTmpSelectionDoc()->DoClose(); + m_pView->GetTmpSelectionDoc() = 0; } uno::Reference< uno::XInterface > xInt = (cppu::OWeakObject*)(SfxBaseController*)this; @@ -1012,7 +1011,7 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXTextView::getPropertySetIn throw (uno::RuntimeException) { vos::OGuard aGuard( Application::GetSolarMutex() ); - static uno::Reference< XPropertySetInfo > aRef = new SfxItemPropertySetInfo( pMap ); + static uno::Reference< XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo(); return aRef; } @@ -1022,15 +1021,14 @@ void SAL_CALL SwXTextView::setPropertyValue( throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { vos::OGuard aGuard( Application::GetSolarMutex() ); - - const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName( pMap, rPropertyName ); - if (!pCur) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); + if (!pEntry) throw UnknownPropertyException(); - else if (pCur->nFlags & PropertyAttribute::READONLY) + else if (pEntry->nFlags & PropertyAttribute::READONLY) throw PropertyVetoException(); else { - switch (pCur->nWID) + switch (pEntry->nWID) { case WID_IS_HIDE_SPELL_MARKS : // deprecated #i91949 @@ -1038,13 +1036,13 @@ void SAL_CALL SwXTextView::setPropertyValue( case WID_IS_CONSTANT_SPELLCHECK : { sal_Bool bVal = sal_False; - const SwViewOption *pOpt = pView->GetWrtShell().GetViewOptions(); + const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions(); if (!pOpt || !(rValue >>= bVal)) throw RuntimeException(); SwViewOption aNewOpt( *pOpt ); - if (pCur->nWID == WID_IS_CONSTANT_SPELLCHECK) + if (pEntry->nWID == WID_IS_CONSTANT_SPELLCHECK) aNewOpt.SetOnlineSpell(bVal); - pView->GetWrtShell().ApplyViewOptions( aNewOpt ); + m_pView->GetWrtShell().ApplyViewOptions( aNewOpt ); } break; default : @@ -1062,12 +1060,12 @@ uno::Any SAL_CALL SwXTextView::getPropertyValue( Any aRet; - const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName( pMap, rPropertyName ); - if (!pCur) + const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName ); + if (!pEntry) throw UnknownPropertyException(); else { - sal_Int16 nWID = pCur->nWID; + sal_Int16 nWID = pEntry->nWID; switch (nWID) { case WID_PAGE_COUNT : @@ -1075,13 +1073,13 @@ uno::Any SAL_CALL SwXTextView::getPropertyValue( { // format document completely in order to get meaningful // values for page count and line count - pView->GetWrtShell().CalcLayout(); + m_pView->GetWrtShell().CalcLayout(); sal_Int32 nCount = -1; if (nWID == WID_PAGE_COUNT) - nCount = pView->GetDocShell()->GetDoc()->GetPageCount(); + nCount = m_pView->GetDocShell()->GetDoc()->GetPageCount(); else // WID_LINE_COUNT - nCount = pView->GetWrtShell().GetLineCount( FALSE /*of whole document*/ ); + nCount = m_pView->GetWrtShell().GetLineCount( FALSE /*of whole document*/ ); aRet <<= nCount; } break; @@ -1090,7 +1088,7 @@ uno::Any SAL_CALL SwXTextView::getPropertyValue( break; case WID_IS_CONSTANT_SPELLCHECK : { - const SwViewOption *pOpt = pView->GetWrtShell().GetViewOptions(); + const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions(); if (!pOpt) throw RuntimeException(); UINT32 nFlag = VIEWOPT_1_ONLINESPELL; @@ -1176,8 +1174,8 @@ Sequence< OUString > SwXTextView::getSupportedServiceNames(void) throw( RuntimeE -----------------------------------------------------------------------*/ SwXTextViewCursor::SwXTextViewCursor(SwView* pVw) : - pView(pVw), - aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)) + m_pView(pVw), + m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)) { } /*-- 17.12.98 09:36:24--------------------------------------------------- @@ -1203,12 +1201,12 @@ sal_Bool SwXTextViewCursor::IsTextSelection( sal_Bool bAllowTables ) const { sal_Bool bRes = sal_False; - DBG_ASSERT(pView, "pView is NULL ???"); - if(pView) + DBG_ASSERT(m_pView, "m_pView is NULL ???"); + if(m_pView) { - //! pView->GetShellMode() will only work after the shell + //! m_pView->GetShellMode() will only work after the shell //! has already changed and thus can not be used here! - SelectionType eSelType = pView->GetWrtShell().GetSelectionType(); + SelectionType eSelType = m_pView->GetWrtShell().GetSelectionType(); bRes = ( (nsSelectionType::SEL_TXT & eSelType) || (nsSelectionType::SEL_NUM & eSelType) ) && (!(nsSelectionType::SEL_TBL_CELLS & eSelType) || bAllowTables); @@ -1240,9 +1238,9 @@ awt::Point SwXTextViewCursor::getPosition(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); awt::Point aRet; - if(pView) + if(m_pView) { - const SwWrtShell& rSh = pView->GetWrtShell(); + const SwWrtShell& rSh = m_pView->GetWrtShell(); const SwRect aCharRect(rSh.GetCharRect()); const SwFrmFmt& rMaster = rSh.GetPageDesc( rSh.GetCurPageDesc() ).GetMaster(); @@ -1265,12 +1263,12 @@ awt::Point SwXTextViewCursor::getPosition(void) throw( uno::RuntimeException ) void SwXTextViewCursor::collapseToStart(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if(pView) + if(m_pView) { if (!IsTextSelection()) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); if(rSh.HasSelection()) { SwPaM* pShellCrsr = rSh.GetCrsr(); @@ -1290,12 +1288,12 @@ void SwXTextViewCursor::collapseToStart(void) throw( uno::RuntimeException ) void SwXTextViewCursor::collapseToEnd(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if(pView) + if(m_pView) { if (!IsTextSelection()) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); if(rSh.HasSelection()) { SwPaM* pShellCrsr = rSh.GetCrsr(); @@ -1316,12 +1314,12 @@ sal_Bool SwXTextViewCursor::isCollapsed(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) + if(m_pView) { if (!IsTextSelection()) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - const SwWrtShell& rSh = pView->GetWrtShell(); + const SwWrtShell& rSh = m_pView->GetWrtShell(); bRet = !rSh.HasSelection(); } else @@ -1336,13 +1334,13 @@ sal_Bool SwXTextViewCursor::goLeft(sal_Int16 nCount, sal_Bool bExpand) throw( un { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) + if(m_pView) { if (!IsTextSelection()) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); for( sal_uInt16 i = 0; i < nCount; i++ ) - bRet = pView->GetWrtShell().Left( CRSR_SKIP_CHARS, bExpand, 1, sal_True ); + bRet = m_pView->GetWrtShell().Left( CRSR_SKIP_CHARS, bExpand, 1, sal_True ); } else throw uno::RuntimeException(); @@ -1355,13 +1353,13 @@ sal_Bool SwXTextViewCursor::goRight(sal_Int16 nCount, sal_Bool bExpand) throw( u { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) + if(m_pView) { if (!IsTextSelection()) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); for( sal_uInt16 i = 0; i < nCount; i++ ) - bRet = pView->GetWrtShell().Right( CRSR_SKIP_CHARS, bExpand, 1, sal_True ); + bRet = m_pView->GetWrtShell().Right( CRSR_SKIP_CHARS, bExpand, 1, sal_True ); } else throw uno::RuntimeException(); @@ -1377,17 +1375,17 @@ void SwXTextViewCursor::gotoRange( throw(RuntimeException) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if(pView && xRange.is()) + if(m_pView && xRange.is()) { if (!IsTextSelection()) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - SwUnoInternalPaM rDestPam(*pView->GetDocShell()->GetDoc()); + SwUnoInternalPaM rDestPam(*m_pView->GetDocShell()->GetDoc()); if(!SwXTextRange::XTextRangeToSwPaM( rDestPam, xRange)) throw IllegalArgumentException(); - ShellModes eSelMode = pView->GetShellMode(); - SwWrtShell& rSh = pView->GetWrtShell(); + ShellModes eSelMode = m_pView->GetShellMode(); + SwWrtShell& rSh = m_pView->GetWrtShell(); // call EnterStdMode in non-text selections only if(!bExpand || (eSelMode != SHELL_MODE_TABLE_TEXT && @@ -1441,8 +1439,8 @@ void SwXTextViewCursor::gotoRange( } else if(pRange && pRange->GetBookmark()) { - SwBookmark* pBkm = pRange->GetBookmark(); - pSrcNode = &pBkm->GetBookmarkPos().nNode.GetNode(); + const ::sw::mark::IMark* const pBkmk = pRange->GetBookmark(); + pSrcNode = &(pBkmk->GetMarkPos().nNode.GetNode()); } else if (pPara && pPara->GetCrsr()) { @@ -1513,12 +1511,12 @@ void SwXTextViewCursor::gotoRange( void SwXTextViewCursor::gotoStart(sal_Bool bExpand) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if(pView) + if(m_pView) { if (!IsTextSelection()) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - pView->GetWrtShell().SttDoc( bExpand ); + m_pView->GetWrtShell().SttDoc( bExpand ); } else throw uno::RuntimeException(); @@ -1529,12 +1527,12 @@ void SwXTextViewCursor::gotoStart(sal_Bool bExpand) throw( uno::RuntimeException void SwXTextViewCursor::gotoEnd(sal_Bool bExpand) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if(pView) + if(m_pView) { if (!IsTextSelection()) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - pView->GetWrtShell().EndDoc( bExpand ); + m_pView->GetWrtShell().EndDoc( bExpand ); } else throw uno::RuntimeException(); @@ -1546,9 +1544,9 @@ sal_Bool SwXTextViewCursor::jumpToFirstPage(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) + if(m_pView) { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); if (rSh.IsSelFrmMode()) { rSh.UnSelectFrm(); @@ -1568,9 +1566,9 @@ sal_Bool SwXTextViewCursor::jumpToLastPage(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) + if(m_pView) { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); if (rSh.IsSelFrmMode()) { rSh.UnSelectFrm(); @@ -1591,8 +1589,8 @@ sal_Bool SwXTextViewCursor::jumpToPage(sal_Int16 nPage) throw( uno::RuntimeExcep { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) - bRet = pView->GetWrtShell().GotoPage(nPage, TRUE); + if(m_pView) + bRet = m_pView->GetWrtShell().GotoPage(nPage, TRUE); else throw uno::RuntimeException(); return bRet; @@ -1604,8 +1602,8 @@ sal_Bool SwXTextViewCursor::jumpToNextPage(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) - bRet = pView->GetWrtShell().SttNxtPg(); + if(m_pView) + bRet = m_pView->GetWrtShell().SttNxtPg(); else throw uno::RuntimeException(); return bRet; @@ -1617,8 +1615,8 @@ sal_Bool SwXTextViewCursor::jumpToPreviousPage(void) throw( uno::RuntimeExceptio { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) - bRet = pView->GetWrtShell().EndPrvPg(); + if(m_pView) + bRet = m_pView->GetWrtShell().EndPrvPg(); else throw uno::RuntimeException(); return bRet; @@ -1630,8 +1628,8 @@ sal_Bool SwXTextViewCursor::jumpToEndOfPage(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) - bRet = pView->GetWrtShell().EndPg(); + if(m_pView) + bRet = m_pView->GetWrtShell().EndPg(); else throw uno::RuntimeException(); return bRet; @@ -1643,8 +1641,8 @@ sal_Bool SwXTextViewCursor::jumpToStartOfPage(void) throw( uno::RuntimeException { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) - bRet = pView->GetWrtShell().SttPg(); + if(m_pView) + bRet = m_pView->GetWrtShell().SttPg(); else throw uno::RuntimeException(); return bRet; @@ -1656,9 +1654,9 @@ sal_Int16 SwXTextViewCursor::getPage(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); short nRet = 0; - if(pView) + if(m_pView) { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); SwPaM* pShellCrsr = rSh.GetCrsr(); nRet = (short)pShellCrsr->GetPageNum( TRUE, 0 ); } @@ -1673,10 +1671,10 @@ sal_Bool SwXTextViewCursor::screenDown(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) + if(m_pView) { - SfxRequest aReq(FN_PAGEDOWN, SFX_CALLMODE_SLOT, pView->GetPool()); - pView->Execute(aReq); + SfxRequest aReq(FN_PAGEDOWN, SFX_CALLMODE_SLOT, m_pView->GetPool()); + m_pView->Execute(aReq); const SfxPoolItem* pRet = aReq.GetReturnValue(); bRet = pRet && ((const SfxBoolItem*)pRet)->GetValue(); } @@ -1691,10 +1689,10 @@ sal_Bool SwXTextViewCursor::screenUp(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) + if(m_pView) { - SfxRequest aReq(FN_PAGEUP, SFX_CALLMODE_SLOT, pView->GetPool()); - pView->Execute(aReq); + SfxRequest aReq(FN_PAGEUP, SFX_CALLMODE_SLOT, m_pView->GetPool()); + m_pView->Execute(aReq); const SfxPoolItem* pRet = aReq.GetReturnValue(); bRet = pRet && ((const SfxBoolItem*)pRet)->GetValue(); } @@ -1709,14 +1707,14 @@ uno::Reference< text::XText > SwXTextViewCursor::getText(void) throw( uno::Runt { ::vos::OGuard aGuard(Application::GetSolarMutex()); uno::Reference< text::XText > xRet; - if(pView) + if(m_pView) { if (!IsTextSelection( sal_False )) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); SwPaM* pShellCrsr = rSh.GetCrsr(); - SwDoc* pDoc = pView->GetDocShell()->GetDoc(); + SwDoc* pDoc = m_pView->GetDocShell()->GetDoc(); uno::Reference< text::XTextRange > xRg = SwXTextRange::CreateTextRangeFromPosition(pDoc, *pShellCrsr->Start(), 0); xRet = xRg->getText(); @@ -1732,14 +1730,14 @@ uno::Reference< text::XTextRange > SwXTextViewCursor::getStart(void) throw( uno { ::vos::OGuard aGuard(Application::GetSolarMutex()); uno::Reference< text::XTextRange > xRet; - if(pView) + if(m_pView) { if (!IsTextSelection()) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); SwPaM* pShellCrsr = rSh.GetCrsr(); - SwDoc* pDoc = pView->GetDocShell()->GetDoc(); + SwDoc* pDoc = m_pView->GetDocShell()->GetDoc(); xRet = SwXTextRange::CreateTextRangeFromPosition(pDoc, *pShellCrsr->Start(), 0); } @@ -1754,14 +1752,14 @@ uno::Reference< text::XTextRange > SwXTextViewCursor::getEnd(void) throw( uno:: { ::vos::OGuard aGuard(Application::GetSolarMutex()); uno::Reference< text::XTextRange > xRet; - if(pView) + if(m_pView) { if (!IsTextSelection()) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); SwPaM* pShellCrsr = rSh.GetCrsr(); - SwDoc* pDoc = pView->GetDocShell()->GetDoc(); + SwDoc* pDoc = m_pView->GetDocShell()->GetDoc(); xRet = SwXTextRange::CreateTextRangeFromPosition(pDoc, *pShellCrsr->End(), 0); } @@ -1776,12 +1774,12 @@ OUString SwXTextViewCursor::getString(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); OUString uRet; - if(pView) + if(m_pView) { if (!IsTextSelection( sal_False )) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - ShellModes eSelMode = pView->GetShellMode(); + ShellModes eSelMode = m_pView->GetShellMode(); switch(eSelMode) { //! since setString for SEL_TABLE_TEXT (with possible @@ -1793,7 +1791,7 @@ OUString SwXTextViewCursor::getString(void) throw( uno::RuntimeException ) case SHELL_MODE_TABLE_LIST_TEXT: case SHELL_MODE_TEXT : { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); SwPaM* pShellCrsr = rSh.GetCrsr(); SwXTextCursor::getTextFromPam(*pShellCrsr, uRet); } @@ -1808,12 +1806,12 @@ OUString SwXTextViewCursor::getString(void) throw( uno::RuntimeException ) void SwXTextViewCursor::setString(const OUString& aString) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if(pView) + if(m_pView) { if (!IsTextSelection( sal_False )) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - ShellModes eSelMode = pView->GetShellMode(); + ShellModes eSelMode = m_pView->GetShellMode(); switch(eSelMode) { //! since setString for SEL_TABLE_TEXT (with possible @@ -1825,7 +1823,7 @@ void SwXTextViewCursor::setString(const OUString& aString) throw( uno::RuntimeEx case SHELL_MODE_TABLE_LIST_TEXT : case SHELL_MODE_TEXT : { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); SwCursor* pShellCrsr = rSh.GetSwCrsr(); SwXTextCursor::SetString( *pShellCrsr, aString ); } @@ -1839,7 +1837,7 @@ void SwXTextViewCursor::setString(const OUString& aString) throw( uno::RuntimeEx -----------------------------------------------------------------------*/ uno::Reference< XPropertySetInfo > SwXTextViewCursor::getPropertySetInfo( ) throw(RuntimeException) { - static uno::Reference< XPropertySetInfo > xRef = aPropSet.getPropertySetInfo(); + static uno::Reference< XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo(); return xRef; } /*-- 29.06.00 17:33:39--------------------------------------------------- @@ -1850,13 +1848,13 @@ void SwXTextViewCursor::setPropertyValue( const OUString& rPropertyName, const IllegalArgumentException, WrappedTargetException, RuntimeException) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if(pView) + if(m_pView) { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); SwPaM* pShellCrsr = rSh.GetCrsr(); SwNode *pNode = pShellCrsr->GetNode(); if (pNode && pNode->IsTxtNode()) - SwXTextCursor::SetPropertyValue(*pShellCrsr, aPropSet, rPropertyName, aValue ); + SwXTextCursor::SetPropertyValue(*pShellCrsr, *m_pPropSet, rPropertyName, aValue ); else throw RuntimeException(); } @@ -1871,11 +1869,11 @@ Any SwXTextViewCursor::getPropertyValue( const OUString& rPropertyName ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); Any aRet; - if(pView) + if(m_pView) { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); SwPaM* pShellCrsr = rSh.GetCrsr(); - aRet = SwXTextCursor::GetPropertyValue( *pShellCrsr, aPropSet, rPropertyName); + aRet = SwXTextCursor::GetPropertyValue( *pShellCrsr, *m_pPropSet, rPropertyName); } else throw RuntimeException(); @@ -1920,11 +1918,11 @@ PropertyState SwXTextViewCursor::getPropertyState( const OUString& rPropertyNam { ::vos::OGuard aGuard(Application::GetSolarMutex()); PropertyState eState; - if(pView) + if(m_pView) { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); SwPaM* pShellCrsr = rSh.GetCrsr(); - eState = SwXTextCursor::GetPropertyState( *pShellCrsr, aPropSet, rPropertyName); + eState = SwXTextCursor::GetPropertyState( *pShellCrsr, *m_pPropSet, rPropertyName); } else throw RuntimeException(); @@ -1938,11 +1936,11 @@ Sequence< PropertyState > SwXTextViewCursor::getPropertyStates( { ::vos::OGuard aGuard(Application::GetSolarMutex()); Sequence< PropertyState > aRet; - if(pView) + if(m_pView) { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); SwPaM* pShellCrsr = rSh.GetCrsr(); - aRet = SwXTextCursor::GetPropertyStates(*pShellCrsr, aPropSet, rPropertyNames); + aRet = SwXTextCursor::GetPropertyStates(*pShellCrsr, *m_pPropSet, rPropertyNames); } return aRet; } @@ -1953,11 +1951,11 @@ void SwXTextViewCursor::setPropertyToDefault( const OUString& rPropertyName ) throw(UnknownPropertyException, RuntimeException) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if(pView) + if(m_pView) { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); SwPaM* pShellCrsr = rSh.GetCrsr(); - SwXTextCursor::SetPropertyToDefault( *pShellCrsr, aPropSet, rPropertyName); + SwXTextCursor::SetPropertyToDefault( *pShellCrsr, *m_pPropSet, rPropertyName); } } /*-- 29.06.00 17:33:43--------------------------------------------------- @@ -1968,11 +1966,11 @@ Any SwXTextViewCursor::getPropertyDefault( const OUString& rPropertyName ) { Any aRet; ::vos::OGuard aGuard(Application::GetSolarMutex()); - if(pView) + if(m_pView) { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); SwPaM* pShellCrsr = rSh.GetCrsr(); - aRet = SwXTextCursor::GetPropertyDefault( *pShellCrsr, aPropSet, rPropertyName); + aRet = SwXTextCursor::GetPropertyDefault( *pShellCrsr, *m_pPropSet, rPropertyName); } return aRet; } @@ -1983,13 +1981,13 @@ sal_Bool SwXTextViewCursor::goDown(sal_Int16 nCount, sal_Bool bExpand) throw( un { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) + if(m_pView) { if (!IsTextSelection()) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); for( sal_uInt16 i = 0; i < nCount; i++ ) - bRet = pView->GetWrtShell().Down( bExpand, 1, sal_True ); + bRet = m_pView->GetWrtShell().Down( bExpand, 1, sal_True ); } else throw uno::RuntimeException(); @@ -2002,13 +2000,13 @@ sal_Bool SwXTextViewCursor::goUp(sal_Int16 nCount, sal_Bool bExpand) throw( uno: { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) + if(m_pView) { if (!IsTextSelection()) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); for( sal_uInt16 i = 0; i < nCount; i++ ) - bRet = pView->GetWrtShell().Up( bExpand, 1, sal_True ); + bRet = m_pView->GetWrtShell().Up( bExpand, 1, sal_True ); } else throw uno::RuntimeException(); @@ -2021,12 +2019,12 @@ sal_Bool SwXTextViewCursor::isAtStartOfLine(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) + if(m_pView) { if (!IsTextSelection( sal_False )) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - bRet = pView->GetWrtShell().IsAtLeftMargin(); + bRet = m_pView->GetWrtShell().IsAtLeftMargin(); } else throw uno::RuntimeException(); @@ -2039,12 +2037,12 @@ sal_Bool SwXTextViewCursor::isAtEndOfLine(void) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); sal_Bool bRet = sal_False; - if(pView) + if(m_pView) { if (!IsTextSelection( sal_False )) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - bRet = pView->GetWrtShell().IsAtRightMargin(sal_True); + bRet = m_pView->GetWrtShell().IsAtRightMargin(sal_True); } else throw uno::RuntimeException(); @@ -2056,12 +2054,12 @@ sal_Bool SwXTextViewCursor::isAtEndOfLine(void) throw( uno::RuntimeException ) void SwXTextViewCursor::gotoEndOfLine(sal_Bool bExpand) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if(pView) + if(m_pView) { if (!IsTextSelection( sal_False )) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - pView->GetWrtShell().RightMargin(bExpand, sal_True); + m_pView->GetWrtShell().RightMargin(bExpand, sal_True); } else throw uno::RuntimeException(); @@ -2072,12 +2070,12 @@ void SwXTextViewCursor::gotoEndOfLine(sal_Bool bExpand) throw( uno::RuntimeExcep void SwXTextViewCursor::gotoStartOfLine(sal_Bool bExpand) throw( uno::RuntimeException ) { ::vos::OGuard aGuard(Application::GetSolarMutex()); - if(pView) + if(m_pView) { if (!IsTextSelection( sal_False )) throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) ); - pView->GetWrtShell().LeftMargin(bExpand, sal_True); + m_pView->GetWrtShell().LeftMargin(bExpand, sal_True); } else throw uno::RuntimeException(); @@ -2147,25 +2145,25 @@ sal_Int64 SAL_CALL SwXTextViewCursor::getSomething( IMPLEMENT_FORWARD_XINTERFACE2(SwXTextViewCursor,SwXTextViewCursor_Base,OTextCursorHelper) const SwDoc* SwXTextViewCursor::GetDoc() const { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); return rSh.GetCrsr() ? rSh.GetCrsr()->GetDoc() : 0; } // ----------------------------------------------------------------------------- SwDoc* SwXTextViewCursor::GetDoc() { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); return rSh.GetCrsr() ? rSh.GetCrsr()->GetDoc() : 0; } // ----------------------------------------------------------------------------- const SwPaM* SwXTextViewCursor::GetPaM() const { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); return rSh.GetCrsr(); } // ----------------------------------------------------------------------------- SwPaM* SwXTextViewCursor::GetPaM() { - SwWrtShell& rSh = pView->GetWrtShell(); + SwWrtShell& rSh = m_pView->GetWrtShell(); return rSh.GetCrsr(); } diff --git a/sw/source/ui/utlui/bookctrl.cxx b/sw/source/ui/utlui/bookctrl.cxx index 20c1ca6f5515..1de7b99a2b66 100644 --- a/sw/source/ui/utlui/bookctrl.cxx +++ b/sw/source/ui/utlui/bookctrl.cxx @@ -53,8 +53,9 @@ #include "errhdl.hxx" #include "swmodule.hxx" #include "wrtsh.hxx" -#include "bookmrk.hxx" +#include "IMark.hxx" #include "bookctrl.hxx" +#include <map> SFX_IMPL_STATUSBAR_CONTROL( SwBookmarkControl, SfxStringItem ); @@ -134,25 +135,29 @@ void SwBookmarkControl::Command( const CommandEvent& rCEvt ) CaptureMouse(); BookmarkPopup_Impl aPop; SwWrtShell* pWrtShell = ::GetActiveWrtShell(); - USHORT nBookCnt; - if( pWrtShell && 0 != ( nBookCnt = pWrtShell->GetBookmarkCnt() ) ) + if( pWrtShell && pWrtShell->getIDocumentMarkAccess()->getMarksCount() > 0 ) { - SvUShorts aBookArr; - for( USHORT nCount = 0; nCount < nBookCnt; ++nCount ) + IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess(); + IDocumentMarkAccess::const_iterator_t ppBookmarkStart = pMarkAccess->getBookmarksBegin(); + USHORT nPopupId = 1; + ::std::map<sal_Int32, USHORT> aBookmarkIdx; + for(IDocumentMarkAccess::const_iterator_t ppBookmark = ppBookmarkStart; + ppBookmark != pMarkAccess->getBookmarksEnd(); + ppBookmark++) { - SwBookmark& rBkmk = pWrtShell->GetBookmark( nCount ); - if( rBkmk.IsBookMark() ) + if(IDocumentMarkAccess::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark)) { - aBookArr.Insert( nCount, aBookArr.Count() ); - aPop.InsertItem( aBookArr.Count(), rBkmk.GetName() ); + aPop.InsertItem( nPopupId, ppBookmark->get()->GetName() ); + aBookmarkIdx[nPopupId] = static_cast<USHORT>(ppBookmark - ppBookmarkStart); + nPopupId++; } } aPop.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel()); USHORT nCurrId = aPop.GetCurId(); if( nCurrId != USHRT_MAX) { - SfxUInt16Item aBookmark( FN_STAT_BOOKMARK, aBookArr[nCurrId-1] ); - SfxViewFrame::Current()->GetDispatcher()->Execute( FN_STAT_BOOKMARK, + SfxUInt16Item aBookmark( FN_STAT_BOOKMARK, aBookmarkIdx[nCurrId] ); + SfxViewFrame::Current()->GetDispatcher()->Execute( FN_STAT_BOOKMARK, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD, &aBookmark, 0L ); } @@ -160,5 +165,3 @@ void SwBookmarkControl::Command( const CommandEvent& rCEvt ) ReleaseMouse(); } } - - diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index b925fdb8bf83..ce02579370a9 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -61,7 +61,7 @@ #include <frmfmt.hxx> #include <fldbas.hxx> #include <txtatr.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <section.hxx> #include <tox.hxx> #define NAVIPI_CXX @@ -122,6 +122,7 @@ #define CTYPE_CNT 0 #define CTYPE_CTT 1 +using namespace ::std; using namespace ::com::sun::star; using namespace ::com::sun::star::text; using namespace ::com::sun::star::uno; @@ -141,37 +142,40 @@ SV_IMPL_OP_PTRARR_SORT(SwContentArr, SwContentPtr) sal_Bool SwContentTree::bIsInDrag = sal_False; -/*************************************************************************** - Beschreibung: Hilfsmethoden -***************************************************************************/ - - -sal_Bool lcl_IsContent(SvLBoxEntry* pEntry) +namespace { - return ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() == CTYPE_CNT; -} + static sal_Bool lcl_IsContent(SvLBoxEntry* pEntry) + { + return ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() == CTYPE_CNT; + } -sal_Bool lcl_IsContentType(SvLBoxEntry* pEntry) -{ - return ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() == CTYPE_CTT; -} + static sal_Bool lcl_IsContentType(SvLBoxEntry* pEntry) + { + return ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() == CTYPE_CTT; + } -sal_Bool lcl_FindShell(SwWrtShell* pShell) -{ - sal_Bool bFound = sal_False; - SwView *pView = SwModule::GetFirstView(); - while (pView) + static sal_Bool lcl_FindShell(SwWrtShell* pShell) { - if(pShell == &pView->GetWrtShell()) + sal_Bool bFound = sal_False; + SwView *pView = SwModule::GetFirstView(); + while (pView) { - bFound = sal_True; - break; + if(pShell == &pView->GetWrtShell()) + { + bFound = sal_True; + break; + } + pView = SwModule::GetNextView(pView); } - pView = SwModule::GetNextView(pView); + return bFound; + } + + static bool lcl_IsUiVisibleBookmark(const IDocumentMarkAccess::pMark_t& rpMark) + { + return IDocumentMarkAccess::GetType(*rpMark) == IDocumentMarkAccess::BOOKMARK; } - return bFound; } /*************************************************************************** @@ -300,9 +304,13 @@ void SwContentType::Init(sal_Bool* pbInvalidateWindow) bEdit = sal_True; } break; - case CONTENT_TYPE_BOOKMARK : + case CONTENT_TYPE_BOOKMARK: { - nMemberCount = pWrtShell->GetBookmarkCnt(sal_True); + IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess(); + nMemberCount = static_cast<USHORT>(count_if( + pMarkAccess->getBookmarksBegin(), + pMarkAccess->getBookmarksEnd(), + &lcl_IsUiVisibleBookmark)); sTypeToken = aEmptyStr; bEdit = sal_True; } @@ -663,16 +671,20 @@ void SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibiblityChanged) } } break; - case CONTENT_TYPE_BOOKMARK : + case CONTENT_TYPE_BOOKMARK: { - nMemberCount = pWrtShell->GetBookmarkCnt(sal_True); - for(sal_uInt16 i = 0; i < nMemberCount; i++) + IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess(); + for(IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin(); + ppBookmark != pMarkAccess->getBookmarksEnd(); + ppBookmark++) { - SwBookmark& rBkmk = pWrtShell->GetBookmark( i, sal_True ); - const String& rBkmName = rBkmk.GetName(); + if(lcl_IsUiVisibleBookmark(*ppBookmark)) + { + const String& rBkmName = ppBookmark->get()->GetName(); //nYPos von 0 -> text::Bookmarks werden nach Alphabet sortiert SwContent* pCnt = new SwContent(this, rBkmName, 0); pMember->Insert(pCnt);//, pMember->Count()); + } } } break; @@ -2885,7 +2897,8 @@ void SwContentTree::EditEntry(SvLBoxEntry* pEntry, sal_uInt8 nMode) case CONTENT_TYPE_BOOKMARK : if(nMode == EDIT_MODE_DELETE) { - pActiveShell->DelBookmark( pCnt->GetName() ); + IDocumentMarkAccess* const pMarkAccess = pActiveShell->getIDocumentMarkAccess(); + pMarkAccess->deleteMark( pMarkAccess->findMark(pCnt->GetName()) ); } else if(nMode == EDIT_MODE_RENAME) { @@ -3051,9 +3064,9 @@ void SwContentTree::GotoContent(SwContent* pCnt) bSel = sal_True; } break; - case CONTENT_TYPE_BOOKMARK : + case CONTENT_TYPE_BOOKMARK: { - pActiveShell->GotoBookmark(pCnt->GetName()); + pActiveShell->GotoMark(pCnt->GetName()); } break; case CONTENT_TYPE_REGION : diff --git a/sw/source/ui/utlui/makefile.mk b/sw/source/ui/utlui/makefile.mk index 5bf699505a88..9620f28c9748 100644 --- a/sw/source/ui/utlui/makefile.mk +++ b/sw/source/ui/utlui/makefile.mk @@ -54,17 +54,17 @@ SRC1FILES = \ utlui.src EXCEPTIONSFILES= \ - $(SLO)$/unotools.obj \ + $(SLO)$/bookctrl.obj \ + $(SLO)$/navipi.obj \ + $(SLO)$/unotools.obj \ $(SLO)$/swrenamexnameddlg.obj SLOFILES = $(EXCEPTIONSFILES) \ - $(SLO)$/bookctrl.obj \ $(SLO)$/condedit.obj \ $(SLO)$/content.obj \ $(SLO)$/gloslst.obj \ $(SLO)$/glbltree.obj \ $(SLO)$/initui.obj \ - $(SLO)$/navipi.obj \ $(SLO)$/navicfg.obj \ $(SLO)$/numfmtlb.obj \ $(SLO)$/prcntfld.obj \ diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx index 79555502034b..eb3500ea59c4 100644 --- a/sw/source/ui/utlui/navipi.cxx +++ b/sw/source/ui/utlui/navipi.cxx @@ -60,7 +60,7 @@ #include <docsh.hxx> #endif #include <actctrl.hxx> -#include <bookmrk.hxx> +#include <IMark.hxx> #include <navipi.hxx> #include <content.hxx> #include <workctrl.hxx> @@ -86,8 +86,6 @@ #include <unomid.h> -static const sal_Unicode cPrefix = '_'; - #define PAGE_CHANGE_TIMEOUT 1000 //Timeout fuer Seitenwechsel #define JUMP_TYPE_TBL 0 @@ -157,16 +155,6 @@ void SwNavigationPI::MoveOutline(USHORT nSource, USHORT nTarget, } } -/*------------------------------------------------------------------------ - Beschreibung: Erzeugen des automatischen Namens des unbenannten Merkers -------------------------------------------------------------------------*/ - -inline String &MakeAutoName(String &rToChange, USHORT i) -{ - rToChange = cPrefix; - rToChange += String::CreateFromInt32( i ); - return rToChange; -} /*------------------------------------------------------------------------ @@ -606,40 +594,30 @@ BOOL SwNavigationPI::Close() void SwNavigationPI::MakeMark() { SwView *pView = GetCreateView(); - if (!pView) - return; + if (!pView) return; SwWrtShell &rSh = pView->GetWrtShell(); - - const USHORT nBookCnt = rSh.GetBookmarkCnt(); - USHORT nMarkCount = 0; - USHORT nFirstFound = MAX_MARKS; - for (USHORT nCount = 0; nCount < nBookCnt; ++nCount) - { - SwBookmark& rBkmk = rSh.GetBookmark( nCount ); - if( rBkmk.IsMark() ) - { - String aBookmark( rBkmk.GetName() ); - aBookmark.Erase(0, 1); - nFirstFound = Min(nFirstFound, (USHORT)aBookmark.ToInt32()); - ++nMarkCount; - } - } - // maximale Anzahl Bookmarks vergeben - if (nAutoMarkIdx == MAX_MARKS) - nAutoMarkIdx = 1; - // erster freier neu vergeben - else if (nFirstFound != MAX_MARKS) - nAutoMarkIdx = Max(USHORT(1), USHORT(nFirstFound - 1)); - else - ++nAutoMarkIdx; - - String aMark; - MakeAutoName(aMark,nAutoMarkIdx); - if (nMarkCount >= MAX_MARKS) - rSh.DelBookmark( aMark ); - - rSh.SetBookmark(KeyCode(), aMark, aEmptyStr, IDocumentBookmarkAccess::MARK); - SwView::SetActMark( static_cast<BYTE>(nAutoMarkIdx) ); + IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); + + // collect and sort navigator reminder names + ::std::vector< ::rtl::OUString > vNavMarkNames; + for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin(); + ppMark != pMarkAccess->getMarksEnd(); + ppMark++) + if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::NAVIGATOR_REMINDER ) + vNavMarkNames.push_back(ppMark->get()->GetName()); + ::std::sort(vNavMarkNames.begin(), vNavMarkNames.end()); + + // we are maxed out and delete one + // nAutoMarkIdx rotates through the available MarkNames + // this assumes that IDocumentMarkAccess generates Names in ascending order + if(vNavMarkNames.size() == MAX_MARKS) + pMarkAccess->deleteMark(pMarkAccess->findMark(vNavMarkNames[nAutoMarkIdx])); + + rSh.SetBookmark(KeyCode(), ::rtl::OUString(), ::rtl::OUString(), IDocumentMarkAccess::NAVIGATOR_REMINDER); + SwView::SetActMark( nAutoMarkIdx ); + + if(++nAutoMarkIdx == MAX_MARKS) + nAutoMarkIdx = 0; } /*------------------------------------------------------------------------ @@ -806,8 +784,7 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, rBindings(*_pBindings), nWishWidth(0), - nActMark(0), - nAutoMarkIdx(0), + nAutoMarkIdx(1), nRegionMode(REGION_MODE_NONE), bSmallMode(FALSE), diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx index 3ccb08f6272f..38a4aa9a85e8 100644 --- a/sw/source/ui/utlui/numfmtlb.cxx +++ b/sw/source/ui/utlui/numfmtlb.cxx @@ -43,37 +43,22 @@ #include <svtools/zformat.hxx> #endif #include <svtools/eitem.hxx> -#ifndef _SVX_SVXIDS_HRC //autogen #include <svx/svxids.hrc> -#endif -#ifndef _SVX_NUMINF_HXX //autogen - #include <svx/numinf.hxx> -#endif #include <vcl/msgbox.hxx> #include <svx/flagsdef.hxx> #include <svtools/itemset.hxx> -#ifndef _DOCSH_HXX #include <docsh.hxx> -#endif #include <swtypes.hxx> #include <swmodule.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <wrtsh.hxx> -#ifndef _NUMFMTLB_HXX #include <numfmtlb.hxx> -#endif - -#ifndef _UTLUI_HRC #include <utlui.hrc> -#endif #include "swabstdlg.hxx" #include "dialog.hrc" - #include <unomid.h> - +#include <sfx2/viewfrm.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -452,7 +437,9 @@ IMPL_LINK( NumFormatListBox, SelectHdl, ListBox *, pBox ) SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); - AbstractSfxSingleTabDialog* pDlg = pFact->CreateSfxSingleTabDialog( this, aCoreSet, RC_DLG_SWNUMFMTDLG ); + SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aCoreSet, + GetView()->GetViewFrame()->GetFrame()->GetFrameInterface(), + RC_DLG_SWNUMFMTDLG ); DBG_ASSERT(pDlg, "Dialogdiet fail!"); if (RET_OK == pDlg->Execute()) diff --git a/sw/source/ui/utlui/utlui.src b/sw/source/ui/utlui/utlui.src index a476d35cb643..2882146a8986 100644 --- a/sw/source/ui/utlui/utlui.src +++ b/sw/source/ui/utlui/utlui.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: utlui.src,v $ - * $Revision: 1.53 $ + * $Revision: 1.53.240.1 $ * * This file is part of OpenOffice.org. * @@ -54,7 +54,7 @@ Resource RID_SHELLRES_AUTOFMTSTRS }; String STR_AUTOFMTREDL_TYPO+1 { - Text [ en-US ] = "Replace \"standard\" quotes with %1custom%2 quotes" ; + Text [ en-US ] = "Replace \"standard\" quotes with %1 \bcustom%2 quotes" ; }; String STR_AUTOFMTREDL_USER_STYLE+1 { diff --git a/sw/source/ui/wrtsh/move.cxx b/sw/source/ui/wrtsh/move.cxx index 65ea252f8543..e250b35e6a00 100644 --- a/sw/source/ui/wrtsh/move.cxx +++ b/sw/source/ui/wrtsh/move.cxx @@ -670,10 +670,10 @@ BOOL SwWrtShell::GotoPage(USHORT nPage, BOOL bRecord) -BOOL SwWrtShell::GotoBookmark( USHORT nPos, BOOL bSelect, BOOL bStart ) +BOOL SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark, BOOL bSelect, BOOL bStart ) { ShellMoveCrsr aTmp( this, bSelect ); - return SwCrsrShell::GotoBookmark( nPos, bStart ); + return SwCrsrShell::GotoMark( pMark, bStart ); } diff --git a/sw/source/ui/wrtsh/wrtsh3.cxx b/sw/source/ui/wrtsh/wrtsh3.cxx index ba85c0c07777..f7d2cdc2dad2 100644 --- a/sw/source/ui/wrtsh/wrtsh3.cxx +++ b/sw/source/ui/wrtsh/wrtsh3.cxx @@ -48,7 +48,7 @@ #include <tools/urlobj.hxx> #include "wrtsh.hxx" #include "view.hxx" -#include "bookmrk.hxx" +#include "IMark.hxx" #include "doc.hxx" #include "wrtsh.hrc" @@ -60,8 +60,7 @@ using ::rtl::OUString; extern sal_Bool bNoInterrupt; // in mainwn.cxx -BOOL SwWrtShell::MoveBookMark( BookMarkMove eFuncId, - sal_uInt16 nPos ) +BOOL SwWrtShell::MoveBookMark( BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark) { //JP 08.03.96: die Wizards brauchen die Selektion !! // EndSelect(); @@ -70,7 +69,7 @@ BOOL SwWrtShell::MoveBookMark( BookMarkMove eFuncId, BOOL bRet = sal_True; switch(eFuncId) { - case BOOKMARK_INDEX:bRet = SwCrsrShell::GotoBookmark( nPos );break; + case BOOKMARK_INDEX:bRet = SwCrsrShell::GotoMark( pMark );break; case BOOKMARK_NEXT: bRet = SwCrsrShell::GoNextBookmark();break; case BOOKMARK_PREV: bRet = SwCrsrShell::GoPrevBookmark();break; default:;//prevent warning @@ -109,11 +108,10 @@ BOOL SwWrtShell::GotoField( const SwFmtFld& rFld ) return bRet; } -bool SwWrtShell::GotoFieldBookmark(SwBookmark *pBkmk) +bool SwWrtShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark) { - (this->*fnKillSel)( 0, sal_False ); - - bool bRet = SwCrsrShell::GotoFieldBookmark(pBkmk); + (this->*fnKillSel)( 0, sal_False ); + bool bRet = SwCrsrShell::GotoFieldmark(pMark); if( bRet && IsSelFrmMode() ) { UnSelectFrm(); @@ -148,19 +146,17 @@ void SwWrtShell::DrawSelChanged( ) bNoInterrupt = bOldVal; } -BOOL SwWrtShell::GotoBookmark( const String& rName ) +BOOL SwWrtShell::GotoMark( const ::rtl::OUString& rName ) { - sal_uInt16 nPos = FindBookmark( rName ); - if( USHRT_MAX == nPos ) - return sal_False; - - return MoveBookMark( BOOKMARK_INDEX, nPos ); + IDocumentMarkAccess::const_iterator_t ppMark = getIDocumentMarkAccess()->findMark( rName ); + if(ppMark == getIDocumentMarkAccess()->getMarksEnd()) return false; + return MoveBookMark( BOOKMARK_INDEX, ppMark->get() ); } -BOOL SwWrtShell::GotoBookmark( sal_uInt16 nPos ) +BOOL SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark ) { - return MoveBookMark( BOOKMARK_INDEX, nPos ); + return MoveBookMark( BOOKMARK_INDEX, pMark ); } diff --git a/sw/uiconfig/swform/statusbar/statusbar.xml b/sw/uiconfig/swform/statusbar/statusbar.xml index 58d7b18fe483..24ec9032bb47 100644 --- a/sw/uiconfig/swform/statusbar/statusbar.xml +++ b/sw/uiconfig/swform/statusbar/statusbar.xml @@ -3,11 +3,12 @@ <statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink"> <statusbar:statusbaritem xlink:href=".uno:StatePageNumber" statusbar:align="left" statusbar:autosize="true" statusbar:width="54" statusbar:helpid="helpid:21181"/> <statusbar:statusbaritem xlink:href=".uno:PageStyleName" statusbar:align="left" statusbar:autosize="true" statusbar:width="79" statusbar:helpid="helpid:21182"/> - <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="35" statusbar:helpid="helpid:10000"/> + <statusbar:statusbaritem xlink:href=".uno:LanguageStatus" statusbar:align="center" statusbar:autosize="true" statusbar:width="100" /> <statusbar:statusbaritem xlink:href=".uno:InsertMode" statusbar:align="center" statusbar:width="37" statusbar:helpid="helpid:10221"/> <statusbar:statusbaritem xlink:href=".uno:SelectionMode" statusbar:align="center" statusbar:width="30" statusbar:helpid="helpid:21185"/> - <statusbar:statusbaritem xlink:href=".uno:ExecHyperlinks" statusbar:align="center" statusbar:width="22" statusbar:helpid="helpid:21186"/> <statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:width="9" statusbar:helpid="helpid:5584"/> <statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16" statusbar:helpid="helpid:5699"/> <statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="left" statusbar:autosize="true" statusbar:ownerdraw="true" statusbar:width="129" statusbar:helpid="helpid:10224"/> + <statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130" statusbar:helpid="helpid:11065"/> + <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="35" statusbar:helpid="helpid:10000"/> </statusbar:statusbar> diff --git a/sw/uiconfig/swreport/statusbar/statusbar.xml b/sw/uiconfig/swreport/statusbar/statusbar.xml index 58d7b18fe483..24ec9032bb47 100644 --- a/sw/uiconfig/swreport/statusbar/statusbar.xml +++ b/sw/uiconfig/swreport/statusbar/statusbar.xml @@ -3,11 +3,12 @@ <statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink"> <statusbar:statusbaritem xlink:href=".uno:StatePageNumber" statusbar:align="left" statusbar:autosize="true" statusbar:width="54" statusbar:helpid="helpid:21181"/> <statusbar:statusbaritem xlink:href=".uno:PageStyleName" statusbar:align="left" statusbar:autosize="true" statusbar:width="79" statusbar:helpid="helpid:21182"/> - <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="35" statusbar:helpid="helpid:10000"/> + <statusbar:statusbaritem xlink:href=".uno:LanguageStatus" statusbar:align="center" statusbar:autosize="true" statusbar:width="100" /> <statusbar:statusbaritem xlink:href=".uno:InsertMode" statusbar:align="center" statusbar:width="37" statusbar:helpid="helpid:10221"/> <statusbar:statusbaritem xlink:href=".uno:SelectionMode" statusbar:align="center" statusbar:width="30" statusbar:helpid="helpid:21185"/> - <statusbar:statusbaritem xlink:href=".uno:ExecHyperlinks" statusbar:align="center" statusbar:width="22" statusbar:helpid="helpid:21186"/> <statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:width="9" statusbar:helpid="helpid:5584"/> <statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16" statusbar:helpid="helpid:5699"/> <statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="left" statusbar:autosize="true" statusbar:ownerdraw="true" statusbar:width="129" statusbar:helpid="helpid:10224"/> + <statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130" statusbar:helpid="helpid:11065"/> + <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="35" statusbar:helpid="helpid:10000"/> </statusbar:statusbar> diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk index 902068836660..405604c9ee45 100644 --- a/sw/util/makefile.mk +++ b/sw/util/makefile.mk @@ -152,7 +152,6 @@ SHL2STDLIBS= \ $(SOTLIB) \ $(TOOLSLIB) \ $(UCBHELPERLIB) \ - $(UNOTOOLSLIB) \ $(COMPHELPERLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ @@ -182,7 +181,6 @@ SHL3STDLIBS= \ $(ISWLIB) \ $(SVXLIB) \ $(SFX2LIB) \ - $(BASICLIB) \ $(SVTOOLLIB) \ $(TKLIB) \ $(VCLLIB) \ |