20#include <com/sun/star/container/XIndexReplace.hpp>
32#include <osl/diagnose.h>
44 assert(_rxMapper.is());
46 OUString sDataStyleName;
47 _rProperty.
maValue >>= sDataStyleName;
48 assert(!sDataStyleName.isEmpty() &&
"xmloff::lcl_exportDataStyle: invalid property value for the data style name!");
52 _rxMapper->GetEntryNameSpace( _rProperty.
mnIndex ),
53 _rxMapper->GetEntryXMLName( _rProperty.
mnIndex ),
61 const std::vector< XMLPropertyState >& rProperties,
71 for (
const auto& rProp : rProperties)
73 if ( ( rProp.mnIndex > -1 )
77 lcl_exportDataStyle(
GetExport(), aPropertyMapper, rProp );
85 assert(aPropertyMapper.is());
87 bool bFoundControlShapeDataStyle =
false;
88 bool bFoundNumberingRulesName =
false;
90 for (
const auto& rProp : rProperties)
92 if (rProp.mnIndex > -1)
94 switch( aPropertyMapper->GetEntryContextId(rProp.mnIndex) )
99 if (bFoundControlShapeDataStyle)
101 OSL_FAIL(
"SvXMLAutoStylePoolP::exportStyleAttributes: found two properties with the ControlShapeDataStyle context id!");
106 lcl_exportDataStyle(
GetExport(), aPropertyMapper, rProp );
109 bFoundControlShapeDataStyle =
true;
114 if (bFoundNumberingRulesName)
116 OSL_FAIL(
"SvXMLAutoStylePoolP::exportStyleAttributes: found two properties with the numbering rules name context id!");
121 uno::Reference< container::XIndexReplace > xNumRule;
122 rProp.maValue >>= xNumRule;
123 if( xNumRule.is() && (xNumRule->getCount() > 0 ) )
130 bFoundNumberingRulesName =
true;
141 for(
const auto& rProp : rProperties )
143 if (rProp.mnIndex > -1)
146 sal_Int32
nIndex = rProp.mnIndex;
147 sal_Int16 nContextID = aPropMapper->GetEntryContextId(
nIndex );
155 pPropHdl->
exportXML( sValue, rProp.maValue,
169 const css::uno::Reference< css::xml::sax::XDocumentHandler > &,
171 const std::vector< XMLPropertyState >& rProperties,
180 sal_Int32 nHeaderStartIndex(-1);
181 sal_Int32 nHeaderEndIndex(-1);
182 sal_Int32 nFooterStartIndex(-1);
183 sal_Int32 nFooterEndIndex(-1);
184 bool bHeaderStartIndex(
false);
185 bool bHeaderEndIndex(
false);
186 bool bFooterStartIndex(
false);
187 bool bFooterEndIndex(
false);
192 while(nIndex < aPropMapper->GetEntryCount())
198 if (!bHeaderStartIndex)
200 nHeaderStartIndex =
nIndex;
201 bHeaderStartIndex =
true;
203 if (bFooterStartIndex && !bFooterEndIndex)
206 bFooterEndIndex =
true;
212 if (!bFooterStartIndex)
214 nFooterStartIndex =
nIndex;
215 bFooterStartIndex =
true;
217 if (bHeaderStartIndex && !bHeaderEndIndex)
220 bHeaderEndIndex =
true;
227 if (!bHeaderEndIndex)
229 if (!bFooterEndIndex)
273 const OUString& rStrName,
275 const OUString& aStrPrefix )
278 AddFamily( nFamily, rStrName, xTmp, aStrPrefix );
283 const OUString& rStrName,
285 const OUString& rStrPrefix,
288 m_pImpl->AddFamily( nFamily, rStrName, rMapper, rStrPrefix, bAsFamily );
295 m_pImpl->SetFamilyPropSetMapper( nFamily, rMapper );
299 const OUString& rName )
301 m_pImpl->RegisterName( nFamily, rName );
305 const OUString& rName )
307 m_pImpl->RegisterDefinedName( nFamily, rName );
311 uno::Sequence<sal_Int32>& rFamilies,
312 uno::Sequence<OUString>& rNames )
314 m_pImpl->GetRegisteredNames( rFamilies, rNames );
318 uno::Sequence<sal_Int32>
const & aFamilies,
319 uno::Sequence<OUString>
const & aNames )
321 assert(aFamilies.getLength() == aNames.getLength());
324 const sal_Int32* pFamilies = aFamilies.getConstArray();
325 const OUString* pNames = aNames.getConstArray();
326 sal_Int32
nCount = std::min( aFamilies.getLength(), aNames.getLength() );
332 std::vector< XMLPropertyState >&& rProperties )
335 m_pImpl->Add(sName, nFamily,
"", std::move(rProperties) );
340 const OUString& rParent,
341 std::vector< XMLPropertyState >&& rProperties,
bool bDontSeek )
344 m_pImpl->Add(sName, nFamily, rParent, std::move(rProperties), bDontSeek);
350 return m_pImpl->Add(rName, nFamily, rParent, std::move(rProperties));
354 std::vector< XMLPropertyState > rProperties )
357 return m_pImpl->AddNamed(rName, nFamily, rParent, std::move(rProperties));
361 const OUString& rParent,
362 const std::vector< XMLPropertyState >& rProperties )
const
364 return m_pImpl->Find( nFamily, rParent, rProperties );
369 m_pImpl->exportXML( nFamily,
this );
379 return m_pImpl->GetAutoStyleEntries();
#define CTF_PM_HEADERFLAG
#define CTF_PM_FOOTERFLAG
void RegisterNames(css::uno::Sequence< sal_Int32 > const &aFamilies, css::uno::Sequence< OUString > const &aNames)
register (families + names)
SvXMLAutoStylePoolP(SvXMLExport &rExport)
void AddFamily(XmlStyleFamily nFamily, const OUString &rStrName, SvXMLExportPropertyMapper *pMapper, const OUString &aStrPrefix)
register a new family with its appropriate instance of a derivation of XMLPropertySetMapper for famil...
std::unique_ptr< SvXMLAutoStylePoolP_Impl > m_pImpl
OUString Find(XmlStyleFamily nFamily, const OUString &rParent, const ::std::vector< XMLPropertyState > &rProperties) const
Find an item set's name.
void RegisterName(XmlStyleFamily nFamily, const OUString &rName)
Register a name that must not be used as a generated name.
void GetRegisteredNames(css::uno::Sequence< sal_Int32 > &aFamilies, css::uno::Sequence< OUString > &aNames)
retrieve the registered names (names + families)
virtual ~SvXMLAutoStylePoolP() override
SvXMLExport & GetExport() const
virtual void exportStyleContent(const css::uno::Reference< css::xml::sax::XDocumentHandler > &rHandler, XmlStyleFamily nFamily, const ::std::vector< XMLPropertyState > &rProperties, const SvXMLExportPropertyMapper &rPropExp, const SvXMLUnitConverter &rUnitConverter, const SvXMLNamespaceMap &rNamespaceMap) const
std::vector< xmloff::AutoStyleEntry > GetAutoStyleEntries() const
OUString Add(XmlStyleFamily nFamily, ::std::vector< XMLPropertyState > &&rProperties)
Add an item set to the pool and return its generated name.
void exportXML(XmlStyleFamily nFamily) const
Export all item sets ofs a certain class in the order in that they have been added.
void RegisterDefinedName(XmlStyleFamily nFamily, const OUString &rName)
Register a name that may only be used through AddNamed.
virtual void exportStyleAttributes(comphelper::AttributeList &rAttrList, XmlStyleFamily nFamily, const ::std::vector< XMLPropertyState > &rProperties, const SvXMLExportPropertyMapper &rPropExp, const SvXMLUnitConverter &rUnitConverter, const SvXMLNamespaceMap &rNamespaceMap) const
void SetFamilyPropSetMapper(XmlStyleFamily nFamily, const rtl::Reference< SvXMLExportPropertyMapper > &rMapper)
bool AddNamed(const OUString &rName, XmlStyleFamily nFamily, const OUString &rParent, std::vector< XMLPropertyState > aProperties)
Add an item set with a pre-defined name (needed for saving sheets separately in Calc).
void exportXML(SvXMLExport &rExport, const ::std::vector< XMLPropertyState > &rProperties, SvXmlExportFlags nFlags, bool bUseExtensionNamespaceForGraphicProperties=false) const
fills the given attribute list with the items in the given set void SvXMLExportPropertyMapper::export...
const rtl::Reference< XMLPropertySetMapper > & getPropertySetMapper() const
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
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.
#define CTF_SD_CONTROL_SHAPE_DATA_STYLE
#define CTF_SD_NUMBERINGRULES_NAME
#define CTF_FORMS_DATA_STYLE
Handling of tokens in XML:
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
Smart struct to transport an Any with an index to the appropriate property-name.
constexpr sal_uInt16 XML_NAMESPACE_STYLE