diff options
33 files changed, 259 insertions, 178 deletions
diff --git a/dbaccess/source/filter/xml/xmlHelper.cxx b/dbaccess/source/filter/xml/xmlHelper.cxx index c604f0524c94..530b5ce8e189 100644 --- a/dbaccess/source/filter/xml/xmlHelper.cxx +++ b/dbaccess/source/filter/xml/xmlHelper.cxx @@ -18,14 +18,17 @@ */ #include "xmlHelper.hxx" +#include <xmloff/XMLConstantsPropertyHandler.hxx> +#include <xmloff/contextid.hxx> +#include <xmloff/xmlement.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/maptype.hxx> + #include <com/sun/star/awt/TextAlign.hpp> #include "xmlstrings.hrc" #include "xmlEnums.hxx" -#include <xmloff/contextid.hxx> -#include <xmloff/XMLConstantsPropertyHandler.hxx> -#include <xmloff/xmlement.hxx> #include <tools/debug.hxx> namespace dbaxml diff --git a/include/xmloff/xmlexppr.hxx b/include/xmloff/xmlexppr.hxx index 44fae061d040..97d050072f1a 100644 --- a/include/xmloff/xmlexppr.hxx +++ b/include/xmloff/xmlexppr.hxx @@ -26,12 +26,7 @@ #include <xmloff/xmlprmap.hxx> #include <salhelper/simplereferenceobject.hxx> - -class SvXMLUnitConverter; -class SvXMLAttributeList; -class SvXMLNamespaceMap; -class FilterPropertiesInfos_Impl; -class SvXMLExport; +#include <com/sun/star/beans/XPropertySet.hpp> #define XML_EXPORT_FLAG_DEFAULTS 0x0001 // export also default items #define XML_EXPORT_FLAG_DEEP 0x0002 // export also items from @@ -40,6 +35,12 @@ class SvXMLExport; // even if its empty #define XML_EXPORT_FLAG_IGN_WS 0x0008 +class SvXMLUnitConverter; +class SvXMLAttributeList; +class SvXMLNamespaceMap; +class FilterPropertiesInfos_Impl; +class SvXMLExport; + class XMLOFF_DLLPUBLIC SvXMLExportPropertyMapper : public salhelper::SimpleReferenceObject { struct Impl; @@ -53,10 +54,9 @@ protected: default and isn't inherited, apart from bDefault is true) After this process It'll called 'Contextfilter' for application-specific filter-processes. */ - ::std::vector< XMLPropertyState > _Filter( - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > rPropSet, - bool bDefault, bool bDisableFoFontFamily) const; + std::vector<XMLPropertyState> _Filter( + const css::uno::Reference<css::beans::XPropertySet>& rPropSet, + bool bDefault, bool bDisableFoFontFamily ) const; /** Application-specific filter. By default do nothing. */ virtual void ContextFilter( @@ -107,20 +107,16 @@ public: default and isn't inherited) After this process It'll called 'Contextfilter' for application-specific filter-processes. */ - ::std::vector< XMLPropertyState > Filter( - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > rPropSet, bool bEnableFoFontFamily = false) const - { return _Filter(rPropSet, false, bEnableFoFontFamily); } + std::vector<XMLPropertyState> Filter( + const css::uno::Reference<css::beans::XPropertySet>& rPropSet, bool bEnableFoFontFamily = false ) const; /** Like Filter(), except that: * - only properties that have the map flag MID_FLAG_DEFAULT_ITEM_EXPORT * set are exported, * - instead of the property's value, its default value is exported. */ - ::std::vector< XMLPropertyState > FilterDefaults( - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > rPropSet, bool bEnableFoFontFamily = false) const - { return _Filter(rPropSet, true, bEnableFoFontFamily); } + std::vector<XMLPropertyState> FilterDefaults( + const css::uno::Reference<css::beans::XPropertySet>& rPropSet, bool bEnableFoFontFamily = false ) const; /** Compare to arrays of XMLPropertyState */ bool Equals( const ::std::vector< XMLPropertyState >& aProperties1, diff --git a/include/xmloff/xmlprmap.hxx b/include/xmloff/xmlprmap.hxx index e0d4fdbbd778..037932dd114d 100644 --- a/include/xmloff/xmlprmap.hxx +++ b/include/xmloff/xmlprmap.hxx @@ -21,63 +21,26 @@ #define INCLUDED_XMLOFF_XMLPRMAP_HXX #include <rtl/ref.hxx> -#include <sal/config.h> #include <xmloff/dllapi.h> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/beans/XPropertySet.hpp> +#include <unotools/saveopt.hxx> +#include <rtl/ustring.hxx> -#include <vector> #include <salhelper/simplereferenceobject.hxx> -#include <xmloff/maptype.hxx> -#include <xmloff/xmltypes.hxx> -#include <xmloff/prhdlfac.hxx> - -#include <tools/debug.hxx> class SvXMLUnitConverter; class XMLPropertyHandler; - - - -/** Helper-class for XML-im/export: - - Holds a pointer to a given array of XMLPropertyMapEntry - - Provides several methods to access data from this array - - Holds a Sequence of XML-names (for properties) - - The filter takes all properties of the XPropertySet which are also - in the XMLPropertyMapEntry and which are have not a default value - and put them into a vector of XMLPropertyStae - - this class knows how to compare, im/export properties - - Attention: At all methods, which get an index as parameter, there is no - range validation to save runtime !! -*/ -struct XMLPropertySetMapperEntry_Impl -{ - OUString sXMLAttributeName; - OUString sAPIPropertyName; - sal_Int32 nType; - sal_uInt16 nXMLNameSpace; - sal_Int16 nContextId; - SvtSaveOptions::ODFDefaultVersion nEarliestODFVersionForExport; - bool bImportOnly; - const XMLPropertyHandler *pHdl; - - XMLPropertySetMapperEntry_Impl( - const XMLPropertyMapEntry& rMapEntry, - const rtl::Reference< XMLPropertyHandlerFactory >& rFactory ); - - XMLPropertySetMapperEntry_Impl( - const XMLPropertySetMapperEntry_Impl& rEntry ); - - sal_uInt32 GetPropType() const { return nType & XML_TYPE_PROP_MASK; } -}; +class XMLPropertyHandlerFactory; +struct XMLPropertyMapEntry; +struct XMLPropertyState; class XMLOFF_DLLPUBLIC XMLPropertySetMapper : public salhelper::SimpleReferenceObject { - ::std::vector< XMLPropertySetMapperEntry_Impl > aMapEntries; - ::std::vector< rtl::Reference < XMLPropertyHandlerFactory > > aHdlFactories; - bool mbOnlyExportMappings; + struct Impl; + + Impl* mpImpl; + + XMLPropertySetMapper( const XMLPropertySetMapper& ); // disabled. + XMLPropertySetMapper& operator= ( const XMLPropertySetMapper& ); // disabled. public: /** The last element of the XMLPropertyMapEntry-array must contain NULL-values. @@ -87,96 +50,60 @@ public: will be in the mappings. */ XMLPropertySetMapper( - const XMLPropertyMapEntry* pEntries, - const rtl::Reference< XMLPropertyHandlerFactory >& rFactory, - bool bForExport ); + const XMLPropertyMapEntry* pEntries, + const rtl::Reference<XMLPropertyHandlerFactory>& rFactory, + bool bForExport ); + virtual ~XMLPropertySetMapper(); void AddMapperEntry( const rtl::Reference < XMLPropertySetMapper >& rMapper ); /** Return number of entries in input-array */ - sal_Int32 GetEntryCount() const { return aMapEntries.size(); } + sal_Int32 GetEntryCount() const; /** Returns the flags of an entry */ - sal_uInt32 GetEntryFlags( sal_Int32 nIndex ) const - { - DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); - return aMapEntries[nIndex].nType & ~MID_FLAG_MASK; - } + sal_uInt32 GetEntryFlags( sal_Int32 nIndex ) const; /** Returns the type of an entry */ - sal_uInt32 GetEntryType( sal_Int32 nIndex, - bool bWithFlags = true ) const - { - DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); - sal_uInt32 nType = aMapEntries[nIndex].nType; - if( !bWithFlags ) - nType = nType & MID_FLAG_MASK; - return nType; - } + sal_uInt32 GetEntryType( sal_Int32 nIndex, bool bWithFlags = true ) const; /** Returns the namespace-key of an entry */ - sal_uInt16 GetEntryNameSpace( sal_Int32 nIndex ) const - { - DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); - return aMapEntries[nIndex].nXMLNameSpace; - } + sal_uInt16 GetEntryNameSpace( sal_Int32 nIndex ) const; /** Returns the 'local' XML-name of the entry */ - const OUString& GetEntryXMLName( sal_Int32 nIndex ) const - { - DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); - return aMapEntries[nIndex].sXMLAttributeName; - } + const OUString& GetEntryXMLName( sal_Int32 nIndex ) const; /** Returns the entry API name */ - const OUString& GetEntryAPIName( sal_Int32 nIndex ) const - { - DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); - return aMapEntries[nIndex].sAPIPropertyName; - } + const OUString& GetEntryAPIName( sal_Int32 nIndex ) const; /** returns the entry context id. -1 is a valid index here. */ - sal_Int16 GetEntryContextId( sal_Int32 nIndex ) const - { - DBG_ASSERT( (nIndex >= -1) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); - return nIndex == -1 ? 0 : aMapEntries[nIndex].nContextId; - } + sal_Int16 GetEntryContextId( sal_Int32 nIndex ) const; /** returns the earliest odf version for which this property should be exported. */ - SvtSaveOptions::ODFDefaultVersion GetEarliestODFVersionForExport( sal_Int32 nIndex ) const - { - DBG_ASSERT( (nIndex >= -1) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); - return nIndex == -1 ? SvtSaveOptions::ODFVER_UNKNOWN : aMapEntries[nIndex].nEarliestODFVersionForExport; - } + SvtSaveOptions::ODFDefaultVersion GetEarliestODFVersionForExport( sal_Int32 nIndex ) const; /** Returns the index of an entry with the given XML-name and namespace If there is no matching entry the method returns -1 */ - sal_Int32 GetEntryIndex( sal_uInt16 nNamespace, - const OUString& rStrName, - sal_uInt32 nPropType, - sal_Int32 nStartAt = -1 ) const; + sal_Int32 GetEntryIndex( + sal_uInt16 nNamespace, const OUString& rStrName, sal_uInt32 nPropType, + sal_Int32 nStartAt = -1 ) const; /** Retrieves a PropertyHandler for that property which placed at nIndex in the XMLPropertyMapEntry-array */ - const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nIndex ) const - { - DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); - return aMapEntries[nIndex].pHdl; - } + const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nIndex ) const; /** import/export This methods calls the respective im/export-method of the respective PropertyHandler. */ - virtual bool exportXML( OUString& rStrExpValue, - const XMLPropertyState& rProperty, - const SvXMLUnitConverter& rUnitConverter ) const; - virtual bool importXML( const OUString& rStrImpValue, - XMLPropertyState& rProperty, - const SvXMLUnitConverter& rUnitConverter ) const; + virtual bool exportXML( + OUString& rStrExpValue, const XMLPropertyState& rProperty, + const SvXMLUnitConverter& rUnitConverter ) const; + + virtual bool importXML( + const OUString& rStrImpValue, XMLPropertyState& rProperty, + const SvXMLUnitConverter& rUnitConverter ) const; /** searches for an entry that matches the given api name, namespace and local name or -1 if nothing found */ - sal_Int32 FindEntryIndex( const sal_Char* sApiName, - sal_uInt16 nNameSpace, - const OUString& sXMLName ) const; + sal_Int32 FindEntryIndex( + const sal_Char* sApiName, sal_uInt16 nNameSpace, const OUString& sXMLName ) const; /** searches for an entry that matches the given ContextId or gives -1 if nothing found */ sal_Int32 FindEntryIndex( const sal_Int16 nContextId ) const; diff --git a/reportdesign/source/filter/xml/xmlHelper.cxx b/reportdesign/source/filter/xml/xmlHelper.cxx index 51c8dbe11240..669e520c0bd5 100644 --- a/reportdesign/source/filter/xml/xmlHelper.cxx +++ b/reportdesign/source/filter/xml/xmlHelper.cxx @@ -43,6 +43,8 @@ #include <com/sun/star/report/GroupOn.hpp> #include <com/sun/star/report/KeepTogether.hpp> #include <xmloff/xmlement.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/maptype.hxx> #include <com/sun/star/report/XReportControlFormat.hpp> #include <com/sun/star/form/ListSourceType.hpp> #include <com/sun/star/sdb/CommandType.hpp> diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx index 0ac6d704eb23..119dac13c068 100644 --- a/sw/source/filter/xml/xmlexpit.cxx +++ b/sw/source/filter/xml/xmlexpit.cxx @@ -28,6 +28,8 @@ #include <xmloff/attrlist.hxx> #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> +#include <xmloff/prhdlfac.hxx> +#include <xmloff/xmltypes.hxx> #include <editeng/xmlcnitm.hxx> #include <xmloff/xmlexp.hxx> #include <editeng/memberids.hrc> diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index d3f023785273..5f7118640a73 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -28,6 +28,7 @@ #include <xmloff/txtprmap.hxx> #include <xmloff/xmlaustp.hxx> #include <xmloff/families.hxx> +#include <xmloff/maptype.hxx> #include <format.hxx> #include <fmtpdsc.hxx> #include <pagedesc.hxx> diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx index d7caca108f2e..43349f55f533 100644 --- a/sw/source/filter/xml/xmltexte.cxx +++ b/sw/source/filter/xml/xmltexte.cxx @@ -30,6 +30,7 @@ #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> #include <xmloff/txtprmap.hxx> +#include <xmloff/maptype.hxx> #include <svx/svdobj.hxx> #include <doc.hxx> diff --git a/xmloff/inc/XMLElementPropertyContext.hxx b/xmloff/inc/XMLElementPropertyContext.hxx index 00771eaa3a74..f89630badd08 100644 --- a/xmloff/inc/XMLElementPropertyContext.hxx +++ b/xmloff/inc/XMLElementPropertyContext.hxx @@ -22,6 +22,7 @@ #include <xmloff/xmlprmap.hxx> #include <xmloff/xmlictxt.hxx> +#include <xmloff/maptype.hxx> class SvXMLImport; diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 743db2a36d18..fc52354c459f 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -1178,18 +1178,15 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& { try { - Any aAny( xDocPropSet->getPropertyValue( - OUString( "HasMainTitle" ))); + Any aAny = xDocPropSet->getPropertyValue("HasMainTitle"); aAny >>= bHasMainTitle; - aAny = xDocPropSet->getPropertyValue( - OUString( "HasSubTitle" )); + aAny = xDocPropSet->getPropertyValue("HasSubTitle"); aAny >>= bHasSubTitle; - aAny = xDocPropSet->getPropertyValue( - OUString( "HasLegend" )); + aAny = xDocPropSet->getPropertyValue("HasLegend"); aAny >>= bHasLegend; if ( bIncludeTable ) { - OUString sNullDate( "NullDate" ); + OUString sNullDate("NullDate"); aAny = xDocPropSet->getPropertyValue(sNullDate); if ( !aAny.hasValue() ) { diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 05acf10f4607..891e7bded80f 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -29,6 +29,7 @@ #include <xmloff/xmlexp.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmlmetai.hxx> +#include <xmloff/maptype.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/uno/XComponentContext.hpp> diff --git a/xmloff/source/chart/XMLChartStyleContext.cxx b/xmloff/source/chart/XMLChartStyleContext.cxx index 52e6ea0812b0..cc7b285e1c21 100644 --- a/xmloff/source/chart/XMLChartStyleContext.cxx +++ b/xmloff/source/chart/XMLChartStyleContext.cxx @@ -22,6 +22,8 @@ #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmlnumfi.hxx> #include <xmloff/families.hxx> +#include <xmloff/xmltypes.hxx> +#include <tools/debug.hxx> #include "XMLChartPropertyContext.hxx" diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx index 64ca80cd4860..bcca5b8af057 100644 --- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx +++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx @@ -27,8 +27,10 @@ #include <xmloff/nmspmap.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> - #include <xmloff/families.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/maptype.hxx> + #include "XMLShapePropertySetContext.hxx" using namespace ::com::sun::star; diff --git a/xmloff/source/draw/ximpbody.cxx b/xmloff/source/draw/ximpbody.cxx index 530fa8758203..c1f8f0824faa 100644 --- a/xmloff/source/draw/ximpbody.cxx +++ b/xmloff/source/draw/ximpbody.cxx @@ -36,6 +36,7 @@ #include "ximpshow.hxx" #include "PropertySetMerger.hxx" #include "animationimport.hxx" +#include <tools/debug.hxx> using namespace ::com::sun::star; diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx index c30699d675e2..71128474db50 100644 --- a/xmloff/source/forms/elementexport.cxx +++ b/xmloff/source/forms/elementexport.cxx @@ -54,6 +54,7 @@ #include <xmloff/XMLEventExport.hxx> #include <xmloff/xmluconv.hxx> #include <xmloff/xmltoken.hxx> +#include <xmloff/maptype.hxx> #include <tools/time.hxx> #include <tools/diagnose_ex.h> #include <comphelper/extract.hxx> diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx index 9ccccf6065b2..8b13c07f4f5e 100644 --- a/xmloff/source/forms/layerexport.cxx +++ b/xmloff/source/forms/layerexport.cxx @@ -30,7 +30,9 @@ #include <xmloff/families.hxx> #include <xmloff/contextid.hxx> #include <xmloff/controlpropertyhdl.hxx> +#include <xmloff/maptype.hxx> #include <tools/diagnose_ex.h> +#include <tools/debug.hxx> #include "controlpropertymap.hxx" #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/form/XFormsSupplier2.hpp> diff --git a/xmloff/source/style/PageHeaderFooterContext.cxx b/xmloff/source/style/PageHeaderFooterContext.cxx index 8cb1e2f32189..155338cb335b 100644 --- a/xmloff/source/style/PageHeaderFooterContext.cxx +++ b/xmloff/source/style/PageHeaderFooterContext.cxx @@ -20,6 +20,7 @@ #include "PageHeaderFooterContext.hxx" #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> +#include <xmloff/xmltypes.hxx> #include "PagePropertySetContext.hxx" using namespace com::sun::star; diff --git a/xmloff/source/style/PageMasterPropMapper.cxx b/xmloff/source/style/PageMasterPropMapper.cxx index de1fecfc9917..fde6964f4247 100644 --- a/xmloff/source/style/PageMasterPropMapper.cxx +++ b/xmloff/source/style/PageMasterPropMapper.cxx @@ -22,6 +22,8 @@ #include <xmloff/PageMasterStyleMap.hxx> #include "PageMasterPropHdlFactory.hxx" +#include <com/sun/star/beans/XPropertySet.hpp> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx index 3dfbb37931bc..77a2fcffff5f 100644 --- a/xmloff/source/style/prstylei.cxx +++ b/xmloff/source/style/prstylei.cxx @@ -33,6 +33,8 @@ #include <xmloff/prstylei.hxx> #include <xmloff/attrlist.hxx> #include <xmloff/xmlerror.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/maptype.hxx> //UUUU #include <com/sun/star/drawing/FillStyle.hpp> diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index 03ac10749ed7..bba026359e13 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -38,6 +38,7 @@ #include <xmloff/styleexp.hxx> #include <xmloff/xmlexp.hxx> #include <xmloff/XMLEventExport.hxx> +#include <xmloff/maptype.hxx> #include <set> #include <boost/scoped_ptr.hpp> diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx index 67f26ec4a556..3358486d75d8 100644 --- a/xmloff/source/style/xmlaustp.cxx +++ b/xmloff/source/style/xmlaustp.cxx @@ -25,6 +25,7 @@ #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> #include <xmloff/xmlexp.hxx> +#include <xmloff/xmlprhdl.hxx> #include <xmloff/XMLTextListAutoStylePool.hxx> #include <xmloff/PageMasterStyleMap.hxx> diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index 11487677aced..6f62661696b3 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -19,7 +19,6 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/xml/AttributeData.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp> @@ -35,6 +34,9 @@ #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmlexp.hxx> #include <xmloff/xmlprmap.hxx> +#include <xmloff/maptype.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/xmlprhdl.hxx> using namespace ::std; using namespace ::com::sun::star; @@ -568,9 +570,20 @@ void SvXMLExportPropertyMapper::ChainExportMapper( } } -vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter( - const Reference< XPropertySet > xPropSet, - bool bDefault, bool bEnableFoFontFamily) const +std::vector<XMLPropertyState> SvXMLExportPropertyMapper::Filter( + const uno::Reference<beans::XPropertySet>& rPropSet, bool bEnableFoFontFamily ) const +{ + return _Filter(rPropSet, false, bEnableFoFontFamily); +} + +std::vector<XMLPropertyState> SvXMLExportPropertyMapper::FilterDefaults( + const uno::Reference<beans::XPropertySet>& rPropSet, bool bEnableFoFontFamily ) const +{ + return _Filter(rPropSet, true, bEnableFoFontFamily); +} + +vector<XMLPropertyState> SvXMLExportPropertyMapper::_Filter( + const Reference<XPropertySet>& xPropSet, bool bDefault, bool bEnableFoFontFamily ) const { vector< XMLPropertyState > aPropStateArray; diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx index 9b7f11a76251..9e2d07052800 100644 --- a/xmloff/source/style/xmlimppr.cxx +++ b/xmloff/source/style/xmlimppr.cxx @@ -35,6 +35,8 @@ #include <xmloff/xmltoken.hxx> #include <xmloff/xmlerror.hxx> #include <xmloff/contextid.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/maptype.hxx> #include <algorithm> #include <functional> diff --git a/xmloff/source/style/xmlprcon.cxx b/xmloff/source/style/xmlprcon.cxx index f8b12df73a54..b96bec798b6c 100644 --- a/xmloff/source/style/xmlprcon.cxx +++ b/xmloff/source/style/xmlprcon.cxx @@ -17,11 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <xmloff/xmlimp.hxx> - - #include <xmloff/xmlprcon.hxx> - +#include <xmloff/xmlimp.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/maptype.hxx> using namespace ::com::sun::star; using namespace ::std; diff --git a/xmloff/source/style/xmlprmap.cxx b/xmloff/source/style/xmlprmap.cxx index c0d98b6cc96e..dcc9c28e4be1 100644 --- a/xmloff/source/style/xmlprmap.cxx +++ b/xmloff/source/style/xmlprmap.cxx @@ -17,15 +17,22 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <tools/debug.hxx> -#include <xmloff/xmlprhdl.hxx> -#include "xmlbahdl.hxx" #include <xmloff/xmlprmap.hxx> +#include <xmloff/xmlprhdl.hxx> #include <xmloff/xmltypes.hxx> +#include <xmloff/xmltoken.hxx> +#include <xmloff/maptype.hxx> +#include <xmloff/prhdlfac.hxx> +#include <tools/debug.hxx> + +#include "xmlbahdl.hxx" + #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/uno/Any.hxx> -#include <xmloff/xmltoken.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +#include <vector> using namespace ::std; @@ -33,6 +40,39 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using ::xmloff::token::GetXMLToken; +/** Helper-class for XML-im/export: + - Holds a pointer to a given array of XMLPropertyMapEntry + - Provides several methods to access data from this array + - Holds a Sequence of XML-names (for properties) + - The filter takes all properties of the XPropertySet which are also + in the XMLPropertyMapEntry and which are have not a default value + and put them into a vector of XMLPropertyStae + - this class knows how to compare, im/export properties + + Attention: At all methods, which get an index as parameter, there is no + range validation to save runtime !! +*/ +struct XMLPropertySetMapperEntry_Impl +{ + OUString sXMLAttributeName; + OUString sAPIPropertyName; + sal_Int32 nType; + sal_uInt16 nXMLNameSpace; + sal_Int16 nContextId; + SvtSaveOptions::ODFDefaultVersion nEarliestODFVersionForExport; + bool bImportOnly; + const XMLPropertyHandler *pHdl; + + XMLPropertySetMapperEntry_Impl( + const XMLPropertyMapEntry& rMapEntry, + const rtl::Reference< XMLPropertyHandlerFactory >& rFactory ); + + XMLPropertySetMapperEntry_Impl( + const XMLPropertySetMapperEntry_Impl& rEntry ); + + sal_uInt32 GetPropType() const { return nType & XML_TYPE_PROP_MASK; } +}; + XMLPropertySetMapperEntry_Impl::XMLPropertySetMapperEntry_Impl( const XMLPropertyMapEntry& rMapEntry, const rtl::Reference< XMLPropertyHandlerFactory >& rFactory ) : @@ -62,27 +102,35 @@ XMLPropertySetMapperEntry_Impl::XMLPropertySetMapperEntry_Impl( DBG_ASSERT( pHdl, "Unknown XML property type handler!" ); } +struct XMLPropertySetMapper::Impl +{ + std::vector<XMLPropertySetMapperEntry_Impl> maMapEntries; + std::vector<rtl::Reference <XMLPropertyHandlerFactory> > maHdlFactories; + + bool mbOnlyExportMappings; + + Impl( bool bForExport ) : mbOnlyExportMappings(bForExport) {} +}; + // Ctor XMLPropertySetMapper::XMLPropertySetMapper( - const XMLPropertyMapEntry* pEntries, - const rtl::Reference< XMLPropertyHandlerFactory >& rFactory, - bool bForExport ) - : - mbOnlyExportMappings( bForExport) + const XMLPropertyMapEntry* pEntries, const rtl::Reference<XMLPropertyHandlerFactory>& rFactory, + bool bForExport ) : + mpImpl(new Impl(bForExport)) { - aHdlFactories.push_back( rFactory ); + mpImpl->maHdlFactories.push_back(rFactory); if( pEntries ) { const XMLPropertyMapEntry* pIter = pEntries; - if (mbOnlyExportMappings) + if (mpImpl->mbOnlyExportMappings) { while( pIter->msApiName ) { if (!pIter->mbImportOnly) { XMLPropertySetMapperEntry_Impl aEntry( *pIter, rFactory ); - aMapEntries.push_back( aEntry ); + mpImpl->maMapEntries.push_back( aEntry ); } pIter++; } @@ -92,7 +140,7 @@ XMLPropertySetMapper::XMLPropertySetMapper( while( pIter->msApiName ) { XMLPropertySetMapperEntry_Impl aEntry( *pIter, rFactory ); - aMapEntries.push_back( aEntry ); + mpImpl->maMapEntries.push_back( aEntry ); pIter++; } } @@ -101,29 +149,86 @@ XMLPropertySetMapper::XMLPropertySetMapper( XMLPropertySetMapper::~XMLPropertySetMapper() { + delete mpImpl; } void XMLPropertySetMapper::AddMapperEntry( const rtl::Reference < XMLPropertySetMapper >& rMapper ) { for( vector < rtl::Reference < XMLPropertyHandlerFactory > >::iterator - aFIter = rMapper->aHdlFactories.begin(); - aFIter != rMapper->aHdlFactories.end(); + aFIter = rMapper->mpImpl->maHdlFactories.begin(); + aFIter != rMapper->mpImpl->maHdlFactories.end(); ++aFIter ) { - aHdlFactories.push_back( *aFIter ); + mpImpl->maHdlFactories.push_back(*aFIter); } for( vector < XMLPropertySetMapperEntry_Impl >::iterator - aEIter = rMapper->aMapEntries.begin(); - aEIter != rMapper->aMapEntries.end(); + aEIter = rMapper->mpImpl->maMapEntries.begin(); + aEIter != rMapper->mpImpl->maMapEntries.end(); ++aEIter ) { - if (!mbOnlyExportMappings || !(*aEIter).bImportOnly) - aMapEntries.push_back( *aEIter ); + if (!mpImpl->mbOnlyExportMappings || !(*aEIter).bImportOnly) + mpImpl->maMapEntries.push_back( *aEIter ); } } +sal_Int32 XMLPropertySetMapper::GetEntryCount() const +{ + return mpImpl->maMapEntries.size(); +} + +sal_uInt32 XMLPropertySetMapper::GetEntryFlags( sal_Int32 nIndex ) const +{ + DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)mpImpl->maMapEntries.size() ), "illegal access to invalid entry!" ); + return mpImpl->maMapEntries[nIndex].nType & ~MID_FLAG_MASK; +} + +sal_uInt32 XMLPropertySetMapper::GetEntryType( sal_Int32 nIndex, bool bWithFlags ) const +{ + DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)mpImpl->maMapEntries.size() ), "illegal access to invalid entry!" ); + sal_uInt32 nType = mpImpl->maMapEntries[nIndex].nType; + if( !bWithFlags ) + nType = nType & MID_FLAG_MASK; + return nType; +} + +sal_uInt16 XMLPropertySetMapper::GetEntryNameSpace( sal_Int32 nIndex ) const +{ + DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)mpImpl->maMapEntries.size() ), "illegal access to invalid entry!" ); + return mpImpl->maMapEntries[nIndex].nXMLNameSpace; +} + +const OUString& XMLPropertySetMapper::GetEntryXMLName( sal_Int32 nIndex ) const +{ + DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)mpImpl->maMapEntries.size() ), "illegal access to invalid entry!" ); + return mpImpl->maMapEntries[nIndex].sXMLAttributeName; +} + +const OUString& XMLPropertySetMapper::GetEntryAPIName( sal_Int32 nIndex ) const +{ + DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)mpImpl->maMapEntries.size() ), "illegal access to invalid entry!" ); + return mpImpl->maMapEntries[nIndex].sAPIPropertyName; +} + +sal_Int16 XMLPropertySetMapper::GetEntryContextId( sal_Int32 nIndex ) const +{ + DBG_ASSERT( (nIndex >= -1) && (nIndex < (sal_Int32)mpImpl->maMapEntries.size() ), "illegal access to invalid entry!" ); + return nIndex == -1 ? 0 : mpImpl->maMapEntries[nIndex].nContextId; +} + +SvtSaveOptions::ODFDefaultVersion XMLPropertySetMapper::GetEarliestODFVersionForExport( sal_Int32 nIndex ) const +{ + DBG_ASSERT( (nIndex >= -1) && (nIndex < (sal_Int32)mpImpl->maMapEntries.size() ), "illegal access to invalid entry!" ); + return nIndex == -1 ? SvtSaveOptions::ODFVER_UNKNOWN : mpImpl->maMapEntries[nIndex].nEarliestODFVersionForExport; +} + +const XMLPropertyHandler* XMLPropertySetMapper::GetPropertyHandler( sal_Int32 nIndex ) const +{ + DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)mpImpl->maMapEntries.size() ), "illegal access to invalid entry!" ); + return mpImpl->maMapEntries[nIndex].pHdl; +} + // Export a Property bool XMLPropertySetMapper::exportXML( OUString& rStrExpValue, @@ -175,7 +280,7 @@ sal_Int32 XMLPropertySetMapper::GetEntryIndex( { do { - const XMLPropertySetMapperEntry_Impl& rEntry = aMapEntries[nIndex]; + const XMLPropertySetMapperEntry_Impl& rEntry = mpImpl->maMapEntries[nIndex]; if( (!nPropType || nPropType == rEntry.GetPropType()) && rEntry.nXMLNameSpace == nNamespace && rStrName == rEntry.sXMLAttributeName ) @@ -200,7 +305,7 @@ sal_Int32 XMLPropertySetMapper::FindEntryIndex( do { - const XMLPropertySetMapperEntry_Impl& rEntry = aMapEntries[nIndex]; + const XMLPropertySetMapperEntry_Impl& rEntry = mpImpl->maMapEntries[nIndex]; if( rEntry.nXMLNameSpace == nNameSpace && rEntry.sXMLAttributeName.equals( sXMLName ) && rEntry.sAPIPropertyName.equalsAscii( sApiName ) ) @@ -222,7 +327,7 @@ sal_Int32 XMLPropertySetMapper::FindEntryIndex( const sal_Int16 nContextId ) con sal_Int32 nIndex = 0; do { - const XMLPropertySetMapperEntry_Impl& rEntry = aMapEntries[nIndex]; + const XMLPropertySetMapperEntry_Impl& rEntry = mpImpl->maMapEntries[nIndex]; if( rEntry.nContextId == nContextId ) return nIndex; else @@ -239,10 +344,10 @@ void XMLPropertySetMapper::RemoveEntry( sal_Int32 nIndex ) const sal_Int32 nEntries = GetEntryCount(); if( nIndex>=nEntries || nIndex<0 ) return; - vector < XMLPropertySetMapperEntry_Impl >::iterator aEIter = aMapEntries.begin(); + vector < XMLPropertySetMapperEntry_Impl >::iterator aEIter = mpImpl->maMapEntries.begin(); for( sal_Int32 nN=0; nN<nIndex; nN++ ) ++aEIter; - aMapEntries.erase( aEIter ); + mpImpl->maMapEntries.erase( aEIter ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx index 5bbee2c47b67..7c5631d995e1 100644 --- a/xmloff/source/table/XMLTableExport.cxx +++ b/xmloff/source/table/XMLTableExport.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <xmloff/table/XMLTableExport.hxx> + #include <xmloff/dllapi.h> #include <sal/config.h> @@ -36,11 +38,14 @@ #include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> -#include <xmloff/table/XMLTableExport.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmlprmap.hxx> #include <xmloff/xmlexppr.hxx> #include <xmloff/xmlexp.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/maptype.hxx> +#include <xmloff/prhdlfac.hxx> +#include <tools/debug.hxx> #include "table.hxx" using namespace ::xmloff::token; diff --git a/xmloff/source/text/XMLTextShapeStyleContext.cxx b/xmloff/source/text/XMLTextShapeStyleContext.cxx index 0c341fe8a09f..4e29e07d6d2b 100644 --- a/xmloff/source/text/XMLTextShapeStyleContext.cxx +++ b/xmloff/source/text/XMLTextShapeStyleContext.cxx @@ -28,6 +28,8 @@ #include "XMLTextColumnsContext.hxx" #include "XMLBackgroundImageContext.hxx" #include <xmloff/txtprmap.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/maptype.hxx> #include <xmloff/XMLTextShapeStyleContext.hxx> diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index edc98a8fe57c..98638907015d 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -29,6 +29,7 @@ #include <tools/debug.hxx> #include <xmloff/txtprmap.hxx> #include <xmloff/xmlexp.hxx> +#include <xmloff/maptype.hxx> #include "XMLSectionFootnoteConfigExport.hxx" //UUUU diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index 607a1d211dad..36341bd01bc5 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -23,18 +23,19 @@ * export of all text fields */ #include "txtflde.hxx" +#include <xmloff/XMLEventExport.hxx> +#include <xmloff/families.hxx> +#include <xmloff/nmspmap.hxx> +#include <xmloff/numehelp.hxx> +#include <xmloff/xmlement.hxx> #include <xmloff/xmlexp.hxx> +#include <xmloff/xmlnume.hxx> #include <xmloff/xmlnumfe.hxx> #include <xmloff/xmltoken.hxx> -#include <xmloff/xmlement.hxx> #include <xmloff/xmluconv.hxx> -#include <xmloff/xmlnume.hxx> -#include <xmloff/numehelp.hxx> +#include <xmloff/maptype.hxx> -#include <xmloff/families.hxx> -#include <xmloff/XMLEventExport.hxx> #include "XMLTextCharStyleNamesElementExport.hxx" -#include <xmloff/nmspmap.hxx> #include <sax/tools/converter.hxx> #include <com/sun/star/util/DateTime.hpp> diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index ebefde2cfcae..297b871afd5c 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -33,6 +33,8 @@ #include <xmloff/xmlnmspe.hxx> #include <xmloff/txtstyli.hxx> #include <xmloff/xmlnumi.hxx> +#include <tools/debug.hxx> +#include <xmloff/maptype.hxx> #include "txtparai.hxx" #include <xmloff/txtprmap.hxx> diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx index 36fb328eabc7..b2007635a614 100644 --- a/xmloff/source/text/txtimppr.cxx +++ b/xmloff/source/text/txtimppr.cxx @@ -28,6 +28,7 @@ #include <xmloff/txtprmap.hxx> #include <xmloff/xmlimp.hxx> #include <xmloff/txtimppr.hxx> +#include <xmloff/maptype.hxx> #define XML_LINE_LEFT 0 #define XML_LINE_RIGHT 1 diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 30f3f303ebc2..6d0b2d8c2fb5 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -99,6 +99,7 @@ #include <xmloff/formlayerexport.hxx> #include "XMLTextCharStyleNamesElementExport.hxx" #include <xmloff/odffields.hxx> +#include <xmloff/maptype.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 7979d1a4f2db..7c043da983a2 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -21,6 +21,8 @@ #include <tools/debug.hxx> #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> +#include <xmloff/maptype.hxx> +#include <xmloff/xmltypes.hxx> #include "txtprhdl.hxx" //UUUU diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx index 04e073ab4b48..af0fba42c9fa 100644 --- a/xmloff/source/text/txtstyli.cxx +++ b/xmloff/source/text/txtstyli.cxx @@ -29,6 +29,7 @@ #include <xmloff/xmltkmap.hxx> #include <xmloff/xmltoken.hxx> #include <xmloff/xmluconv.hxx> +#include <xmloff/maptype.hxx> #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/container/XNameContainer.hpp> |