31#include <com/sun/star/beans/XPropertySet.hpp>
53struct XMLPropertySetMapperEntry_Impl
55 OUString sXMLAttributeName;
56 OUString sAPIPropertyName;
58 sal_uInt16 nXMLNameSpace;
64 XMLPropertySetMapperEntry_Impl(
73XMLPropertySetMapperEntry_Impl::XMLPropertySetMapperEntry_Impl(
76 sXMLAttributeName(
GetXMLToken(rMapEntry.meXMLName) ),
77 sAPIPropertyName( rMapEntry.getApiName() ),
79 nXMLNameSpace( rMapEntry.mnNameSpace ),
80 nContextId( rMapEntry.mnContextId ),
81 nEarliestODFVersionForExport( rMapEntry.mnEarliestODFVersionForExport ),
82 bImportOnly( rMapEntry.mbImportOnly),
102 mpImpl(new
Impl(bForExport))
104 mpImpl->maHdlFactories.push_back(rFactory);
110 if (
mpImpl->mbOnlyExportMappings)
112 while( !pIter->
IsEnd() )
116 XMLPropertySetMapperEntry_Impl aEntry( *pIter, rFactory );
117 mpImpl->maMapEntries.push_back( aEntry );
124 while( !pIter->
IsEnd() )
126 XMLPropertySetMapperEntry_Impl aEntry( *pIter, rFactory );
127 mpImpl->maMapEntries.push_back( aEntry );
140 for(
const auto& rHdlFactory : rMapper->mpImpl->maHdlFactories )
142 mpImpl->maHdlFactories.push_back(rHdlFactory);
145 for(
const auto& rMapEntry : rMapper->mpImpl->maMapEntries )
147 if (!
mpImpl->mbOnlyExportMappings || !rMapEntry.bImportOnly)
148 mpImpl->maMapEntries.push_back( rMapEntry );
154 return mpImpl->maMapEntries.size();
160 return mpImpl->maMapEntries[
nIndex].nType & ~MID_FLAG_MASK;
190 assert((-1 <=
nIndex) && (
nIndex <
static_cast<sal_Int32
>(
mpImpl->maMapEntries.size())));
198 return mpImpl->maMapEntries[
nIndex].nEarliestODFVersionForExport;
209 OUString& rStrExpValue,
227 const OUString& rStrImpValue,
246 sal_uInt16 nNamespace,
247 std::u16string_view rStrName,
248 sal_uInt32 nPropType,
249 sal_Int32 nStartAt )
const
252 sal_Int32
nIndex= nStartAt == - 1? 0 : nStartAt+1;
254 if ( nEntries &&
nIndex < nEntries )
258 const XMLPropertySetMapperEntry_Impl& rEntry =
mpImpl->maMapEntries[
nIndex];
259 if( (!nPropType || nPropType == rEntry.GetPropType()) &&
261 rStrName == rEntry.sXMLAttributeName )
266 }
while(
nIndex<nEntries );
277 sal_uInt32 nPropType,
278 sal_Int32 nStartAt )
const
281 sal_Int32
nIndex= nStartAt == - 1? 0 : nStartAt+1;
283 if ( nEntries &&
nIndex < nEntries )
286 const OUString& rStrName = SvXMLImport::getNameFromToken(nElement);
289 const XMLPropertySetMapperEntry_Impl& rEntry =
mpImpl->maMapEntries[
nIndex];
290 if( (!nPropType || nPropType == rEntry.GetPropType()) &&
292 rStrName == rEntry.sXMLAttributeName )
297 }
while(
nIndex<nEntries );
305 const char* sApiName,
306 sal_uInt16 nNameSpace,
307 std::u16string_view sXMLName )
const
314 const XMLPropertySetMapperEntry_Impl& rEntry =
mpImpl->maMapEntries[
nIndex];
315 if( rEntry.nXMLNameSpace == nNameSpace &&
316 rEntry.sXMLAttributeName == sXMLName &&
317 rEntry.sAPIPropertyName.equalsAscii( sApiName ) )
322 }
while(
nIndex < nEntries );
336 const XMLPropertySetMapperEntry_Impl& rEntry =
mpImpl->maMapEntries[
nIndex];
337 if( rEntry.nContextId == nContextId )
342 }
while(
nIndex < nEntries );
353 std::vector < XMLPropertySetMapperEntry_Impl >::iterator aEIter =
mpImpl->maMapEntries.begin();
354 std::advance(aEIter,
nIndex);
355 mpImpl->maMapEntries.erase( aEIter );
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Abstract base-class for different XML-types.
virtual bool exportXML(OUString &rStrExpValue, const css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const =0
Exports the given value according to the XML-data-type corresponding to the derived class.
virtual bool importXML(const OUString &rStrImpValue, css::uno::Any &rValue, const SvXMLUnitConverter &rUnitConverter) const =0
Imports the given value according to the XML-data-type corresponding to the derived class.
std::unique_ptr< Impl > mpImpl
void AddMapperEntry(const rtl::Reference< XMLPropertySetMapper > &rMapper)
const XMLPropertyHandler * GetPropertyHandler(sal_Int32 nIndex) const
Retrieves a PropertyHandler for that property which placed at nIndex in the XMLPropertyMapEntry-array...
sal_Int32 FindEntryIndex(const char *sApiName, sal_uInt16 nNameSpace, std::u16string_view sXMLName) const
searches for an entry that matches the given api name, namespace and local name or -1 if nothing foun...
SvtSaveOptions::ODFSaneDefaultVersion GetEarliestODFVersionForExport(sal_Int32 nIndex) const
returns the earliest ODF version for which this property should be exported as standard ODF element,...
sal_uInt32 GetEntryType(sal_Int32 nIndex) const
Returns the type of an entry.
sal_Int16 GetEntryContextId(sal_Int32 nIndex) const
returns the entry context id.
bool importXML(const OUString &rStrImpValue, XMLPropertyState &rProperty, const SvXMLUnitConverter &rUnitConverter) const
const OUString & GetEntryAPIName(sal_Int32 nIndex) const
Returns the entry API name.
sal_Int32 GetEntryCount() const
Return number of entries in input-array.
sal_uInt32 GetEntryFlags(sal_Int32 nIndex) const
Returns the flags of an entry.
const OUString & GetEntryXMLName(sal_Int32 nIndex) const
Returns the 'local' XML-name of the entry.
sal_Int32 GetEntryIndex(sal_uInt16 nNamespace, std::u16string_view rStrName, sal_uInt32 nPropType, sal_Int32 nStartAt=-1) const
Returns the index of an entry with the given XML-name and namespace If there is no matching entry the...
sal_uInt16 GetEntryNameSpace(sal_Int32 nIndex) const
Returns the namespace-key of an entry.
void RemoveEntry(sal_Int32 nIndex)
Remove an entry.
XMLPropertySetMapper(const XMLPropertySetMapper &)=delete
virtual ~XMLPropertySetMapper() override
bool exportXML(OUString &rStrExpValue, const XMLPropertyState &rProperty, const SvXMLUnitConverter &rUnitConverter) const
import/export This methods calls the respective im/export-method of the respective PropertyHandler.
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
OReadStatusBarDocumentHandler::StatusBar_XML_Namespace nNamespace
Represents a property with its API-name, its XML-name and the type of its value.
bool mbImportOnly
Flag to specify whether entry is only used during import.
std::vector< XMLPropertySetMapperEntry_Impl > maMapEntries
bool mbOnlyExportMappings
std::vector< rtl::Reference< XMLPropertyHandlerFactory > > maHdlFactories
Smart struct to transport an Any with an index to the appropriate property-name.
static const XMLPropertyHandler * GetPropertyHandler(sal_Int32 nType)
constexpr size_t NMSP_SHIFT
#define XML_TYPE_PROP_MASK