1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 #include <rtl/ustrbuf.hxx>
24 #include <sal/log.hxx>
25 #include <tools/solar.h>
26 #include <PageMasterStyleMap.hxx>
27 #include <xmloff/families.hxx>
28 #include <xmloff/xmlaustp.hxx>
29 #include <xmloff/xmlexp.hxx>
30 #include <xmloff/xmlexppr.hxx>
31 #include <xmloff/xmlnamespace.hxx>
32 #include <xmloff/xmlprmap.hxx>
33 #include <xmloff/xmltoken.hxx>
35 #include "impastpl.hxx"
37 using namespace ::std
;
39 using namespace ::com::sun::star
;
40 using namespace ::xmloff::token
;
42 // Class XMLAutoStyleFamily
43 // ctor/dtor class XMLAutoStyleFamily
45 XMLAutoStyleFamily::XMLAutoStyleFamily(
46 XmlStyleFamily nFamily
,
47 const OUString
& rStrName
,
48 const rtl::Reference
< SvXMLExportPropertyMapper
> &rMapper
,
49 const OUString
& rStrPrefix
,
51 mnFamily( nFamily
), maStrFamilyName( rStrName
), mxMapper( rMapper
),
52 mnCount( 0 ), mnName( 0 ), maStrPrefix( rStrPrefix
), mbAsFamily( bAsFamily
)
55 XMLAutoStyleFamily::XMLAutoStyleFamily( XmlStyleFamily nFamily
) :
56 mnFamily(nFamily
), mnCount(0), mnName(0), mbAsFamily(false) {}
58 void XMLAutoStyleFamily::ClearEntries()
64 data2string(void *data
,
65 const typelib_TypeDescriptionReference
*type
);
68 struct2string(void *data
,
69 const typelib_TypeDescription
*type
)
71 assert(type
->eTypeClass
== typelib_TypeClass_STRUCT
);
73 OUStringBuffer result
;
77 const typelib_CompoundTypeDescription
*compoundType
=
78 &reinterpret_cast<const typelib_StructTypeDescription
*>(type
)->aBase
;
80 for (int i
= 0; i
< compoundType
->nMembers
; i
++)
84 result
.append(compoundType
->ppMemberNames
[i
]);
86 result
.append(data2string(static_cast<char *>(data
)+compoundType
->pMemberOffsets
[i
],
87 compoundType
->ppTypeRefs
[i
]));
92 return result
.makeStringAndClear();
96 data2string(void *data
,
97 const typelib_TypeDescriptionReference
*type
)
99 switch (type
->eTypeClass
)
101 case typelib_TypeClass_VOID
:
103 case typelib_TypeClass_BOOLEAN
:
104 return *static_cast<const sal_Bool
*>(data
) ? OUString("true") : OUString("false");
105 case typelib_TypeClass_BYTE
:
106 return OUString::number((*static_cast<const sal_Int8
*>(data
)));
107 case typelib_TypeClass_SHORT
:
108 return OUString::number((*static_cast<const sal_Int16
*>(data
)));
109 case typelib_TypeClass_LONG
:
110 return OUString::number((*static_cast<const sal_Int32
*>(data
)));
111 case typelib_TypeClass_HYPER
:
112 return OUString::number((*static_cast<const sal_Int64
*>(data
)));
113 case typelib_TypeClass_UNSIGNED_SHORT
:
114 return OUString::number((*static_cast<const sal_uInt16
*>(data
)));
115 case typelib_TypeClass_UNSIGNED_LONG
:
116 return OUString::number((*static_cast<const sal_uInt32
*>(data
)), 16);
117 case typelib_TypeClass_UNSIGNED_HYPER
:
118 return OUString::number((*static_cast<const sal_uInt64
*>(data
)), 16);
119 case typelib_TypeClass_FLOAT
:
120 return OUString::number(*static_cast<const float*>(data
));
121 case typelib_TypeClass_DOUBLE
:
122 return OUString::number(*static_cast<const double*>(data
));
123 case typelib_TypeClass_CHAR
:
124 return ("U+" + OUString::number((*static_cast<const sal_uInt16
*>(data
))));
125 case typelib_TypeClass_STRING
:
126 return *static_cast<OUString
*>(data
);
127 case typelib_TypeClass_TYPE
:
128 case typelib_TypeClass_SEQUENCE
:
129 case typelib_TypeClass_EXCEPTION
:
130 case typelib_TypeClass_INTERFACE
:
132 case typelib_TypeClass_STRUCT
:
133 return struct2string(data
, type
->pType
);
134 case typelib_TypeClass_ENUM
:
135 return OUString::number((*static_cast<const sal_Int32
*>(data
)));
137 assert(false); // this cannot happen I hope
143 static OUString
any2string(const uno::Any
& any
)
145 return data2string(const_cast<void*>(any
.getValue()), any
.pType
);
148 // Class SvXMLAutoStylePoolProperties_Impl
149 // ctor class SvXMLAutoStylePoolProperties_Impl
151 XMLAutoStylePoolProperties::XMLAutoStylePoolProperties( XMLAutoStyleFamily
& rFamilyData
, const vector
< XMLPropertyState
>& rProperties
, OUString
const & rParentName
)
152 : maProperties( rProperties
),
153 mnPos ( rFamilyData
.mnCount
)
155 static bool bHack
= (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != nullptr);
159 OUStringBuffer
aStemBuffer(32);
160 aStemBuffer
.append( rFamilyData
.maStrPrefix
);
162 if (!rParentName
.isEmpty())
164 aStemBuffer
.append("-");
165 aStemBuffer
.append(rParentName
);
168 // Create a name based on the properties used
169 for(XMLPropertyState
const & rState
: maProperties
)
171 if (rState
.mnIndex
== -1)
173 OUString
sXMLName(rFamilyData
.mxMapper
->getPropertySetMapper()->GetEntryXMLName(rState
.mnIndex
));
174 if (sXMLName
.isEmpty())
176 aStemBuffer
.append("-");
177 aStemBuffer
.append(OUString::number(rFamilyData
.mxMapper
->getPropertySetMapper()->GetEntryNameSpace(rState
.mnIndex
)));
178 aStemBuffer
.append(":");
179 aStemBuffer
.append(sXMLName
);
180 aStemBuffer
.append("=");
181 aStemBuffer
.append(any2string(rState
.maValue
));
185 // Finally append an incremental counter in an attempt to make identical
186 // styles always come out in the same order. Will see if this works.
187 aStemBuffer
.append("-z");
188 static sal_Int32 nCounter
= 0;
189 aStemBuffer
.append(OUString::number(nCounter
++));
192 // create a name that hasn't been used before. The created name has not
193 // to be added to the array, because it will never tried again
194 OUStringBuffer
aTry( aStemBuffer
);
196 msName
= aTry
.makeStringAndClear();
197 bool bWarned
= false;
198 while (rFamilyData
.maNameSet
.find(msName
) !=
199 rFamilyData
.maNameSet
.end())
202 SAL_WARN("xmloff", "Overlapping style name for " << msName
);
204 rFamilyData
.mnName
++;
205 aTry
.append( aStemBuffer
);
207 aTry
.append( OUString::number( rFamilyData
.mnName
) );
208 msName
= aTry
.makeStringAndClear();
210 rFamilyData
.maNameSet
.insert(msName
);
214 // create a name that hasn't been used before. The created name has not
215 // to be added to the array, because it will never tried again
216 OUStringBuffer
sBuffer( 7 );
219 rFamilyData
.mnName
++;
220 sBuffer
.append( rFamilyData
.maStrPrefix
);
221 sBuffer
.append( OUString::number( rFamilyData
.mnName
) );
222 msName
= sBuffer
.makeStringAndClear();
224 while (rFamilyData
.maNameSet
.find(msName
) != rFamilyData
.maNameSet
.end() || rFamilyData
.maReservedNameSet
.find(msName
) != rFamilyData
.maReservedNameSet
.end());
227 #if OSL_DEBUG_LEVEL > 0
228 std::set
<sal_Int32
> DebugProperties
;
229 for (XMLPropertyState
const & rPropState
: maProperties
)
231 sal_Int32
const property(rPropState
.mnIndex
);
232 // serious bug: will cause duplicate attributes to be exported
233 assert(DebugProperties
.find(property
) == DebugProperties
.end());
236 DebugProperties
.insert(property
);
242 bool operator<( const XMLAutoStyleFamily
& r1
, const XMLAutoStyleFamily
& r2
)
244 return r1
.mnFamily
< r2
.mnFamily
;
248 XMLAutoStylePoolParent::~XMLAutoStylePoolParent()
254 struct ComparePartial
256 const XMLAutoStyleFamily
& rFamilyData
;
258 bool operator()(const vector
< XMLPropertyState
>& lhs
,
259 const std::unique_ptr
<XMLAutoStylePoolProperties
>& rhs
) const
261 return rFamilyData
.mxMapper
->LessPartial(lhs
, rhs
->GetProperties());
263 bool operator()(const std::unique_ptr
<XMLAutoStylePoolProperties
>& lhs
,
264 const vector
< XMLPropertyState
>& rhs
) const
266 return rFamilyData
.mxMapper
->LessPartial(lhs
->GetProperties(), rhs
);
272 // Adds an array of XMLPropertyState ( vector< XMLPropertyState > ) to list
273 // if not added, yet.
275 bool XMLAutoStylePoolParent::Add( XMLAutoStyleFamily
& rFamilyData
, const vector
< XMLPropertyState
>& rProperties
, OUString
& rName
, bool bDontSeek
)
277 XMLAutoStylePoolProperties
*pProperties
= nullptr;
278 auto [itBegin
, itEnd
] = std::equal_range(m_PropertiesList
.begin(), m_PropertiesList
.end(), rProperties
, ComparePartial
{rFamilyData
});
280 for (auto it
= itBegin
; it
!= itEnd
; ++it
)
281 if (rFamilyData
.mxMapper
->Equals((*it
)->GetProperties(), rProperties
))
282 pProperties
= it
->get();
285 if( bDontSeek
|| !pProperties
)
287 pProperties
= new XMLAutoStylePoolProperties( rFamilyData
, rProperties
, msParent
);
288 m_PropertiesList
.insert(itBegin
, std::unique_ptr
<XMLAutoStylePoolProperties
>(pProperties
));
292 rName
= pProperties
->GetName();
298 // Adds an array of XMLPropertyState ( vector< XMLPropertyState > ) with a given name.
299 // If the name exists already, nothing is done. If a style with a different name and
300 // the same properties exists, a new one is added (like with bDontSeek).
303 bool XMLAutoStylePoolParent::AddNamed( XMLAutoStyleFamily
& rFamilyData
, const vector
< XMLPropertyState
>& rProperties
, const OUString
& rName
)
305 if (rFamilyData
.maNameSet
.find(rName
) != rFamilyData
.maNameSet
.end())
308 auto it
= std::lower_bound(m_PropertiesList
.begin(), m_PropertiesList
.end(), rProperties
, ComparePartial
{rFamilyData
});
310 std::unique_ptr
<XMLAutoStylePoolProperties
> pProperties(
311 new XMLAutoStylePoolProperties(rFamilyData
, rProperties
, msParent
));
312 // ignore the generated name
313 pProperties
->SetName( rName
);
314 m_PropertiesList
.insert(it
, std::move(pProperties
));
319 // Search for an array of XMLPropertyState ( vector< XMLPropertyState > ) in list
322 OUString
XMLAutoStylePoolParent::Find( const XMLAutoStyleFamily
& rFamilyData
, const vector
< XMLPropertyState
>& rProperties
) const
325 auto [itBegin
,itEnd
] = std::equal_range(m_PropertiesList
.begin(), m_PropertiesList
.end(), rProperties
, ComparePartial
{rFamilyData
});
326 for (auto it
= itBegin
; it
!= itEnd
; ++it
)
327 if (rFamilyData
.mxMapper
->Equals((*it
)->GetProperties(), rProperties
))
328 sName
= (*it
)->GetName();
333 bool XMLAutoStylePoolParent::operator< (const XMLAutoStylePoolParent
& rOther
) const
335 return msParent
< rOther
.msParent
;
338 // Class SvXMLAutoStylePool_Impl
339 // ctor/dtor class SvXMLAutoStylePool_Impl
341 SvXMLAutoStylePoolP_Impl::SvXMLAutoStylePoolP_Impl( SvXMLExport
& rExp
)
346 SvXMLAutoStylePoolP_Impl::~SvXMLAutoStylePoolP_Impl()
350 // Adds stylefamily-information to sorted list
352 void SvXMLAutoStylePoolP_Impl::AddFamily(
353 XmlStyleFamily nFamily
,
354 const OUString
& rStrName
,
355 const rtl::Reference
< SvXMLExportPropertyMapper
> & rMapper
,
356 const OUString
& rStrPrefix
,
359 // store family in a list if not already stored
360 SvXMLExportFlags nExportFlags
= GetExport().getExportFlags();
361 bool bStylesOnly
= (nExportFlags
& SvXMLExportFlags::STYLES
) && !(nExportFlags
& SvXMLExportFlags::CONTENT
);
363 OUString
aPrefix( rStrPrefix
);
366 aPrefix
= "M" + rStrPrefix
;
369 #if OSL_DEBUG_LEVEL > 0
370 std::unique_ptr
<XMLAutoStyleFamily
> pTemp(new XMLAutoStyleFamily(nFamily
));
371 auto const iter
= m_FamilySet
.find(pTemp
);
372 if (iter
!= m_FamilySet
.end())
374 // FIXME: do we really intend to replace the previous nFamily
375 // entry in this case ?
376 SAL_WARN_IF( (*iter
)->mxMapper
!= rMapper
, "xmloff",
377 "Adding duplicate family " << rStrName
<<
378 " with mismatching mapper ! " <<
379 typeid((*iter
)->mxMapper
.get()).name() << " " <<
380 typeid(*rMapper
).name() );
384 m_FamilySet
.insert(std::make_unique
<XMLAutoStyleFamily
>(nFamily
, rStrName
, rMapper
, aPrefix
, bAsFamily
));
387 void SvXMLAutoStylePoolP_Impl::SetFamilyPropSetMapper(
388 XmlStyleFamily nFamily
,
389 const rtl::Reference
< SvXMLExportPropertyMapper
> & rMapper
)
391 std::unique_ptr
<XMLAutoStyleFamily
> pTemp(new XMLAutoStyleFamily(nFamily
));
392 auto const iter
= m_FamilySet
.find(pTemp
);
393 if (iter
!= m_FamilySet
.end())
394 (*iter
)->mxMapper
= rMapper
;
397 // Adds a name to list
398 void SvXMLAutoStylePoolP_Impl::RegisterName( XmlStyleFamily nFamily
, const OUString
& rName
)
400 std::unique_ptr
<XMLAutoStyleFamily
> pTemp(new XMLAutoStyleFamily(nFamily
));
401 auto const iter
= m_FamilySet
.find(pTemp
);
402 assert(iter
!= m_FamilySet
.end()); // family must be known
403 // SAL_DEBUG("SvXMLAutoStylePoolP_Impl::RegisterName: " << nFamily << ", '" << rName << "'");
404 (*iter
)->maNameSet
.insert(rName
);
407 // Adds a name to list
408 void SvXMLAutoStylePoolP_Impl::RegisterDefinedName( XmlStyleFamily nFamily
, const OUString
& rName
)
410 std::unique_ptr
<XMLAutoStyleFamily
> pTemp(new XMLAutoStyleFamily(nFamily
));
411 auto const iter
= m_FamilySet
.find(pTemp
);
412 assert(iter
!= m_FamilySet
.end()); // family must be known
413 (*iter
)->maReservedNameSet
.insert(rName
);
417 // Retrieve the list of registered names
420 void SvXMLAutoStylePoolP_Impl::GetRegisteredNames(
421 uno::Sequence
<sal_Int32
>& rFamilies
,
422 uno::Sequence
<OUString
>& rNames
)
424 // collect registered names + families
425 vector
<sal_Int32
> aFamilies
;
426 vector
<OUString
> aNames
;
428 // iterate over families
429 for (auto const& aJ
: m_FamilySet
)
431 XMLAutoStyleFamily
&rFamily
= *aJ
;
433 // iterate over names
434 for (const auto& rName
: rFamily
.maNameSet
)
436 aFamilies
.push_back( static_cast<sal_Int32
>(rFamily
.mnFamily
) );
437 aNames
.push_back( rName
);
441 // copy the families + names into the sequence types
442 assert(aFamilies
.size() == aNames
.size());
444 rFamilies
.realloc( aFamilies
.size() );
445 std::copy( aFamilies
.begin(), aFamilies
.end(), rFamilies
.getArray() );
447 rNames
.realloc( aNames
.size() );
448 std::copy( aNames
.begin(), aNames
.end(), rNames
.getArray() );
451 // Adds an array of XMLPropertyState ( vector< XMLPropertyState > ) to list
452 // if not added, yet.
454 bool SvXMLAutoStylePoolP_Impl::Add(
455 OUString
& rName
, XmlStyleFamily nFamily
, const OUString
& rParentName
,
456 const ::std::vector
< XMLPropertyState
>& rProperties
, bool bDontSeek
)
458 std::unique_ptr
<XMLAutoStyleFamily
> pTemp(new XMLAutoStyleFamily(nFamily
));
459 auto const iter
= m_FamilySet
.find(pTemp
);
460 assert(iter
!= m_FamilySet
.end()); // family must be known
462 XMLAutoStyleFamily
&rFamily
= **iter
;
464 auto itPair
= rFamily
.m_ParentSet
.insert(std::make_unique
<XMLAutoStylePoolParent
>(
466 XMLAutoStylePoolParent
& rParent
= **itPair
.first
;
469 if (rParent
.Add(rFamily
, rProperties
, rName
, bDontSeek
))
478 bool SvXMLAutoStylePoolP_Impl::AddNamed(
479 const OUString
& rName
, XmlStyleFamily nFamily
, const OUString
& rParentName
,
480 const ::std::vector
< XMLPropertyState
>& rProperties
)
482 // get family and parent the same way as in Add()
484 std::unique_ptr
<XMLAutoStyleFamily
> pTemp(new XMLAutoStyleFamily(nFamily
));
485 auto const iter
= m_FamilySet
.find(pTemp
);
486 assert(iter
!= m_FamilySet
.end()); // family must be known
488 XMLAutoStyleFamily
&rFamily
= **iter
;
490 auto itPair
= rFamily
.m_ParentSet
.insert(std::make_unique
<XMLAutoStylePoolParent
>(
492 XMLAutoStylePoolParent
& rParent
= **itPair
.first
;
495 if (rParent
.AddNamed(rFamily
, rProperties
, rName
))
505 // Search for an array of XMLPropertyState ( vector< XMLPropertyState > ) in list
508 OUString
SvXMLAutoStylePoolP_Impl::Find( XmlStyleFamily nFamily
,
509 const OUString
& rParent
,
510 const vector
< XMLPropertyState
>& rProperties
) const
514 std::unique_ptr
<XMLAutoStyleFamily
> pTemp(new XMLAutoStyleFamily(nFamily
));
515 auto const iter
= m_FamilySet
.find(pTemp
);
516 assert(iter
!= m_FamilySet
.end()); // family must be known
518 XMLAutoStyleFamily
const& rFamily
= **iter
;
519 std::unique_ptr
<XMLAutoStylePoolParent
> pTmp(new XMLAutoStylePoolParent(rParent
));
520 auto const it2
= rFamily
.m_ParentSet
.find(pTmp
);
521 if (it2
!= rFamily
.m_ParentSet
.end())
523 sName
= (*it2
)->Find(rFamily
, rProperties
);
529 std::vector
<xmloff::AutoStyleEntry
> SvXMLAutoStylePoolP_Impl::GetAutoStyleEntries() const
531 std::vector
<xmloff::AutoStyleEntry
> rReturnVector
;
533 for (std::unique_ptr
<XMLAutoStyleFamily
> const & rFamily
: m_FamilySet
)
535 rtl::Reference
<XMLPropertySetMapper
> aPropertyMapper
= rFamily
->mxMapper
->getPropertySetMapper();
536 for (auto const & rParent
: rFamily
->m_ParentSet
)
538 for (auto const & rProperty
: rParent
->GetPropertiesList())
540 rReturnVector
.emplace_back();
541 xmloff::AutoStyleEntry
& rEntry
= rReturnVector
.back();
542 for (XMLPropertyState
const & rPropertyState
: rProperty
->GetProperties())
544 if (rPropertyState
.mnIndex
>= 0)
546 OUString sXmlName
= aPropertyMapper
->GetEntryXMLName(rPropertyState
.mnIndex
);
547 rEntry
.m_aXmlProperties
.emplace_back(sXmlName
, rPropertyState
.maValue
);
553 return rReturnVector
;
558 struct AutoStylePoolExport
560 const OUString
* mpParent
;
561 XMLAutoStylePoolProperties
* mpProperties
;
563 AutoStylePoolExport() : mpParent(nullptr), mpProperties(nullptr) {}
566 struct StyleComparator
568 bool operator() (const AutoStylePoolExport
& a
, const AutoStylePoolExport
& b
)
570 return (a
.mpProperties
->GetName() < b
.mpProperties
->GetName() ||
571 (a
.mpProperties
->GetName() == b
.mpProperties
->GetName() && *a
.mpParent
< *b
.mpParent
));
577 void SvXMLAutoStylePoolP_Impl::exportXML(
578 XmlStyleFamily nFamily
,
579 const SvXMLAutoStylePoolP
*pAntiImpl
) const
581 // Get list of parents for current family (nFamily)
582 std::unique_ptr
<XMLAutoStyleFamily
> pTemp(new XMLAutoStyleFamily(nFamily
));
583 auto const iter
= m_FamilySet
.find(pTemp
);
584 assert(iter
!= m_FamilySet
.end()); // family must be known
586 const XMLAutoStyleFamily
&rFamily
= **iter
;
587 sal_uInt32 nCount
= rFamily
.mnCount
;
592 // create, initialize and fill helper-structure (SvXMLAutoStylePoolProperties_Impl)
593 // which contains a parent-name and a SvXMLAutoStylePoolProperties_Impl
594 std::vector
<AutoStylePoolExport
> aExpStyles(nCount
);
596 for (auto const& it
: rFamily
.m_ParentSet
)
598 XMLAutoStylePoolParent
& rParent
= *it
;
599 size_t nProperties
= rParent
.GetPropertiesList().size();
600 for( size_t j
= 0; j
< nProperties
; j
++ )
602 XMLAutoStylePoolProperties
*const pProperties
=
603 rParent
.GetPropertiesList()[j
].get();
604 sal_uInt32 nPos
= pProperties
->GetPos();
605 assert(nPos
< nCount
);
606 assert(!aExpStyles
[nPos
].mpProperties
);
607 aExpStyles
[nPos
].mpProperties
= pProperties
;
608 aExpStyles
[nPos
].mpParent
= &rParent
.GetParent();
612 static bool bHack
= (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != nullptr);
617 std::sort(aExpStyles
.begin(), aExpStyles
.end(), StyleComparator());
619 for (size_t i
= 0; i
< nCount
; i
++)
621 OUString oldName
= aExpStyles
[i
].mpProperties
->GetName();
622 sal_Int32 dashIx
= oldName
.indexOf('-');
623 OUString newName
= (dashIx
> 0 ? oldName
.copy(0, dashIx
) : oldName
) + OUString::number(i
);
624 // SAL_DEBUG("renaming '" << oldName << "' -> '" << newName << "'");
625 aExpStyles
[i
].mpProperties
->SetName(newName
);
630 // create string to export for each XML-style. That means for each property-list
632 OUString aStrFamilyName
= rFamily
.maStrFamilyName
;
634 for( size_t i
= 0; i
< nCount
; i
++ )
636 assert(aExpStyles
[i
].mpProperties
);
638 if( aExpStyles
[i
].mpProperties
)
640 GetExport().AddAttribute(
641 XML_NAMESPACE_STYLE
, XML_NAME
,
642 aExpStyles
[i
].mpProperties
->GetName() );
644 bool bExtensionNamespace
= false;
645 if( rFamily
.mbAsFamily
)
647 GetExport().AddAttribute(
648 XML_NAMESPACE_STYLE
, XML_FAMILY
, aStrFamilyName
);
649 if(aStrFamilyName
!= "graphic" &&
650 aStrFamilyName
!= "drawing-page" &&
651 aStrFamilyName
!= "presentation" &&
652 aStrFamilyName
!= "chart" )
653 bExtensionNamespace
= true;
656 if( !aExpStyles
[i
].mpParent
->isEmpty() )
658 GetExport().AddAttribute(
659 XML_NAMESPACE_STYLE
, XML_PARENT_STYLE_NAME
,
660 GetExport().EncodeStyleName(
661 *aExpStyles
[i
].mpParent
) );
665 if( rFamily
.mbAsFamily
)
666 sName
= GetXMLToken(XML_STYLE
);
668 sName
= rFamily
.maStrFamilyName
;
670 pAntiImpl
->exportStyleAttributes(GetExport().GetAttrList(), nFamily
,
671 aExpStyles
[i
].mpProperties
->GetProperties(),
672 *rFamily
.mxMapper
, GetExport().GetMM100UnitConverter(),
673 GetExport().GetNamespaceMap());
675 SvXMLElementExport
aElem( GetExport(),
676 XML_NAMESPACE_STYLE
, sName
,
679 sal_Int32
nStart(-1);
681 if (nFamily
== XmlStyleFamily::PAGE_MASTER
)
684 sal_Int32 nIndex
= 0;
685 rtl::Reference
< XMLPropertySetMapper
> aPropMapper
=
686 rFamily
.mxMapper
->getPropertySetMapper();
687 sal_Int16 nContextID
;
688 while(nIndex
< aPropMapper
->GetEntryCount() && nEnd
== -1)
690 nContextID
= aPropMapper
->GetEntryContextId( nIndex
);
691 if (nContextID
&& ((nContextID
& CTF_PM_FLAGMASK
) != XML_PM_CTF_START
))
699 rFamily
.mxMapper
->exportXML(
701 aExpStyles
[i
].mpProperties
->GetProperties(),
702 nStart
, nEnd
, SvXmlExportFlags::IGN_WS
, bExtensionNamespace
);
704 pAntiImpl
->exportStyleContent(GetExport().GetDocHandler(), nFamily
,
705 aExpStyles
[i
].mpProperties
->GetProperties(),
706 *rFamily
.mxMapper
, GetExport().GetMM100UnitConverter(),
707 GetExport().GetNamespaceMap());
712 void SvXMLAutoStylePoolP_Impl::ClearEntries()
714 for (auto & aI
: m_FamilySet
)
718 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */