20 #include <com/sun/star/container/XIndexReplace.hpp>
32 #include <osl/diagnose.h>
35 using namespace ::
std;
46 assert(_rxMapper.is());
48 OUString sDataStyleName;
49 _rProperty.
maValue >>= sDataStyleName;
50 assert(!sDataStyleName.isEmpty() &&
"xmloff::lcl_exportDataStyle: invalid property value for the data style name!");
54 _rxMapper->GetEntryNameSpace( _rProperty.
mnIndex ),
55 _rxMapper->GetEntryXMLName( _rProperty.
mnIndex ),
63 const vector< XMLPropertyState >& rProperties,
73 for (
const auto& rProp : rProperties)
75 if ( ( rProp.mnIndex > -1 )
79 lcl_exportDataStyle(
GetExport(), aPropertyMapper, rProp );
87 assert(aPropertyMapper.is());
89 bool bFoundControlShapeDataStyle =
false;
90 bool bFoundNumberingRulesName =
false;
92 for (
const auto& rProp : rProperties)
94 if (rProp.mnIndex > -1)
96 switch( aPropertyMapper->GetEntryContextId(rProp.mnIndex) )
101 if (bFoundControlShapeDataStyle)
103 OSL_FAIL(
"SvXMLAutoStylePoolP::exportStyleAttributes: found two properties with the ControlShapeDataStyle context id!");
108 lcl_exportDataStyle(
GetExport(), aPropertyMapper, rProp );
111 bFoundControlShapeDataStyle =
true;
116 if (bFoundNumberingRulesName)
118 OSL_FAIL(
"SvXMLAutoStylePoolP::exportStyleAttributes: found two properties with the numbering rules name context id!");
123 uno::Reference< container::XIndexReplace > xNumRule;
124 rProp.maValue >>= xNumRule;
125 if( xNumRule.is() && (xNumRule->getCount() > 0 ) )
127 const OUString
sName(const_cast<XMLTextListAutoStylePool*>(&
GetExport().GetTextParagraphExport()->GetListAutoStylePool())->
Add( xNumRule ));
132 bFoundNumberingRulesName =
true;
143 for(
const auto& rProp : rProperties )
145 if (rProp.mnIndex > -1)
148 sal_Int32
nIndex = rProp.mnIndex;
149 sal_Int16 nContextID = aPropMapper->GetEntryContextId( nIndex );
157 pPropHdl->
exportXML( sValue, rProp.maValue,
161 GetExport().
AddAttribute( aPropMapper->GetEntryNameSpace( nIndex ), aPropMapper->GetEntryXMLName( nIndex ), sValue );
171 const css::uno::Reference< css::xml::sax::XDocumentHandler > &,
173 const vector< XMLPropertyState >& rProperties,
182 sal_Int32 nHeaderStartIndex(-1);
183 sal_Int32 nHeaderEndIndex(-1);
184 sal_Int32 nFooterStartIndex(-1);
185 sal_Int32 nFooterEndIndex(-1);
186 bool bHeaderStartIndex(
false);
187 bool bHeaderEndIndex(
false);
188 bool bFooterStartIndex(
false);
189 bool bFooterEndIndex(
false);
194 while(nIndex < aPropMapper->GetEntryCount())
200 if (!bHeaderStartIndex)
202 nHeaderStartIndex = nIndex;
203 bHeaderStartIndex =
true;
205 if (bFooterStartIndex && !bFooterEndIndex)
207 nFooterEndIndex = nIndex;
208 bFooterEndIndex =
true;
214 if (!bFooterStartIndex)
216 nFooterStartIndex = nIndex;
217 bFooterStartIndex =
true;
219 if (bHeaderStartIndex && !bHeaderEndIndex)
221 nHeaderEndIndex = nIndex;
222 bHeaderEndIndex =
true;
229 if (!bHeaderEndIndex)
230 nHeaderEndIndex = nIndex;
231 if (!bFooterEndIndex)
232 nFooterEndIndex = nIndex;
269 return pImpl->GetExport();
275 const OUString& rStrName,
277 const OUString& aStrPrefix )
280 AddFamily( nFamily, rStrName, xTmp, aStrPrefix );
285 const OUString& rStrName,
287 const OUString& rStrPrefix,
290 pImpl->AddFamily( nFamily, rStrName, rMapper, rStrPrefix, bAsFamily );
297 pImpl->SetFamilyPropSetMapper( nFamily, rMapper );
301 const OUString& rName )
303 pImpl->RegisterName( nFamily, rName );
307 const OUString& rName )
309 pImpl->RegisterDefinedName( nFamily, rName );
313 uno::Sequence<sal_Int32>& rFamilies,
314 uno::Sequence<OUString>& rNames )
316 pImpl->GetRegisteredNames( rFamilies, rNames );
320 uno::Sequence<sal_Int32>
const & aFamilies,
321 uno::Sequence<OUString>
const & aNames )
323 assert(aFamilies.getLength() == aNames.getLength());
326 const sal_Int32* pFamilies = aFamilies.getConstArray();
327 const OUString* pNames = aNames.getConstArray();
328 sal_Int32
nCount =
min( aFamilies.getLength(), aNames.getLength() );
329 for( sal_Int32
n = 0;
n < nCount;
n++ )
330 RegisterName( static_cast<XmlStyleFamily>(pFamilies[
n]), pNames[n] );
334 vector< XMLPropertyState >&& rProperties )
337 pImpl->Add(sName, nFamily,
"", std::move(rProperties) );
342 const OUString& rParent,
343 vector< XMLPropertyState >&& rProperties,
bool bDontSeek )
346 pImpl->Add(sName, nFamily, rParent, std::move(rProperties), bDontSeek);
352 return pImpl->Add(rName, nFamily, rParent, std::move(rProperties));
356 std::vector< XMLPropertyState >&& rProperties )
359 return pImpl->AddNamed(rName, nFamily, rParent, std::move(rProperties));
363 const OUString& rParent,
364 const vector< XMLPropertyState >& rProperties )
const
366 return pImpl->Find( nFamily, rParent, rProperties );
371 pImpl->exportXML( nFamily,
this );
376 pImpl->ClearEntries();
381 return pImpl->GetAutoStyleEntries();
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
virtual void exportStyleAttributes(SvXMLAttributeList &rAttrList, XmlStyleFamily nFamily, const ::std::vector< XMLPropertyState > &rProperties, const SvXMLExportPropertyMapper &rPropExp, const SvXMLUnitConverter &rUnitConverter, const SvXMLNamespaceMap &rNamespaceMap) const
SvXMLExport & GetExport() const
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
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
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...
void RegisterName(XmlStyleFamily nFamily, const OUString &rName)
Register a name that must not be used as a generated name.
#define CTF_FORMS_DATA_STYLE
OUString Add(XmlStyleFamily nFamily,::std::vector< XMLPropertyState > &&rProperties)
Add an item set to the pool and return its generated name.
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
void RegisterNames(css::uno::Sequence< sal_Int32 > const &aFamilies, css::uno::Sequence< OUString > const &aNames)
register (families + names)
std::unique_ptr< SvXMLAutoStylePoolP_Impl > pImpl
#define CTF_SD_CONTROL_SHAPE_DATA_STYLE
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
void GetRegisteredNames(css::uno::Sequence< sal_Int32 > &aFamilies, css::uno::Sequence< OUString > &aNames)
retrieve the registered names (names + families)
std::vector< xmloff::AutoStyleEntry > GetAutoStyleEntries() const
void SetFamilyPropSetMapper(XmlStyleFamily nFamily, const rtl::Reference< SvXMLExportPropertyMapper > &rMapper)
virtual ~SvXMLAutoStylePoolP() override
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...
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...
void RegisterDefinedName(XmlStyleFamily nFamily, const OUString &rName)
Register a name that may only be used through AddNamed.
#define CTF_PM_HEADERFLAG
bool AddNamed(const OUString &rName, XmlStyleFamily nFamily, const OUString &rParent, std::vector< XMLPropertyState > &&rProperties)
Add an item set with a pre-defined name (needed for saving sheets separately in Calc).
Handling of tokens in XML:
void exportXML(XmlStyleFamily nFamily) const
Export all item sets ofs a certain class in the order in that they have been added.
Smart struct to transport an Any with an index to the appropriate property-name.
OUString Find(XmlStyleFamily nFamily, const OUString &rParent, const ::std::vector< XMLPropertyState > &rProperties) const
Find an item set's name.
Abstract base-class for different XML-types.
SvXMLAutoStylePoolP(SvXMLExport &rExport)
#define CTF_PM_FOOTERFLAG
constexpr sal_uInt16 XML_NAMESPACE_STYLE
#define CTF_SD_NUMBERINGRULES_NAME
const rtl::Reference< XMLPropertySetMapper > & getPropertySetMapper() const