summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-07-25 10:58:15 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-07-25 11:50:02 -0400
commit8a690c88a92c7e92c702cedf96851ae1eb929379 (patch)
treeb72472b0e9188e5ab524886d3486457f3892b14e /include
parent0198b3a9451700d875c1b389d30e1a0cc9ab4b47 (diff)
Apply pimpl to XMLPropertySetMapper.
Let's hide its implementation for real this time. Change-Id: I18c82f4969f2e3560536a68e9bbd86b9282e2ace
Diffstat (limited to 'include')
-rw-r--r--include/xmloff/xmlexppr.hxx32
-rw-r--r--include/xmloff/xmlprmap.hxx145
2 files changed, 50 insertions, 127 deletions
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;