summaryrefslogtreecommitdiffstats
path: root/include/xmloff/xmlprmap.hxx
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/xmloff/xmlprmap.hxx
parentfdo#48065 SVG: correctly clamp fill-opacity (diff)
downloadcore-8a690c88a92c7e92c702cedf96851ae1eb929379.tar.gz
core-8a690c88a92c7e92c702cedf96851ae1eb929379.zip
Apply pimpl to XMLPropertySetMapper.
Let's hide its implementation for real this time. Change-Id: I18c82f4969f2e3560536a68e9bbd86b9282e2ace
Diffstat (limited to 'include/xmloff/xmlprmap.hxx')
-rw-r--r--include/xmloff/xmlprmap.hxx145
1 files changed, 36 insertions, 109 deletions
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;