LibreOffice Module xmloff (master) 1
impastpl.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <memory>
21#include <algorithm>
22
23#include <rtl/ustrbuf.hxx>
24#include <sal/log.hxx>
25#include <tools/solar.h>
27#include <utility>
28#include <xmloff/families.hxx>
29#include <xmloff/xmlaustp.hxx>
30#include <xmloff/xmlexp.hxx>
31#include <xmloff/xmlexppr.hxx>
33#include <xmloff/xmlprmap.hxx>
34#include <xmloff/xmltoken.hxx>
35
36#include "impastpl.hxx"
37
38using namespace ::com::sun::star;
39using namespace ::xmloff::token;
40
41// Class XMLAutoStyleFamily
42// ctor/dtor class XMLAutoStyleFamily
43
45 XmlStyleFamily nFamily,
46 OUString aStrName,
48 OUString aStrPrefix,
49 bool bAsFamily ) :
50 mnFamily( nFamily ), maStrFamilyName(std::move( aStrName)), mxMapper(std::move( xMapper )),
51 mnCount( 0 ), mnName( 0 ), maStrPrefix(std::move( aStrPrefix )), mbAsFamily( bAsFamily )
52{}
53
55 mnFamily(nFamily), mnCount(0), mnName(0), mbAsFamily(false) {}
56
58{
59 m_ParentSet.clear();
60}
61
62static OUString
63data2string(void *data,
64 const typelib_TypeDescriptionReference *type);
65
66static OUString
67struct2string(void *data,
68 const typelib_TypeDescription *type)
69{
70 assert(type->eTypeClass == typelib_TypeClass_STRUCT);
71
72 OUStringBuffer result("{");
73
74 const typelib_CompoundTypeDescription *compoundType =
75 &reinterpret_cast<const typelib_StructTypeDescription*>(type)->aBase;
76
77 for (int i = 0; i < compoundType->nMembers; i++)
78 {
79 if (i > 0)
80 result.append(":");
81 result.append(
82 OUString::unacquired(&compoundType->ppMemberNames[i])
83 + "="
84 + data2string(static_cast<char *>(data)+compoundType->pMemberOffsets[i],
85 compoundType->ppTypeRefs[i]));
86 }
87
88 result.append("}");
89
90 return result.makeStringAndClear();
91}
92
93static OUString
94data2string(void *data,
95 const typelib_TypeDescriptionReference *type)
96{
97 switch (type->eTypeClass)
98 {
99 case typelib_TypeClass_VOID:
100 return "";
101 case typelib_TypeClass_BOOLEAN:
102 return *static_cast<const sal_Bool*>(data) ? OUString("true") : OUString("false");
103 case typelib_TypeClass_BYTE:
104 return OUString::number(*static_cast<const sal_Int8*>(data));
105 case typelib_TypeClass_SHORT:
106 return OUString::number(*static_cast<const sal_Int16*>(data));
107 case typelib_TypeClass_LONG:
108 return OUString::number(*static_cast<const sal_Int32*>(data));
109 case typelib_TypeClass_HYPER:
110 return OUString::number(*static_cast<const sal_Int64*>(data));
111 case typelib_TypeClass_UNSIGNED_SHORT:
112 return OUString::number(*static_cast<const sal_uInt16*>(data));
113 case typelib_TypeClass_UNSIGNED_LONG:
114 return OUString::number((*static_cast<const sal_uInt32*>(data)), 16);
115 case typelib_TypeClass_UNSIGNED_HYPER:
116 return OUString::number((*static_cast<const sal_uInt64*>(data)), 16);
117 case typelib_TypeClass_FLOAT:
118 return OUString::number(*static_cast<const float*>(data));
119 case typelib_TypeClass_DOUBLE:
120 return OUString::number(*static_cast<const double*>(data));
121 case typelib_TypeClass_CHAR:
122 return ("U+" + OUString::number(*static_cast<const sal_uInt16*>(data)));
123 case typelib_TypeClass_STRING:
124 return *static_cast<OUString*>(data);
125 case typelib_TypeClass_TYPE:
126 case typelib_TypeClass_SEQUENCE:
127 case typelib_TypeClass_EXCEPTION:
128 case typelib_TypeClass_INTERFACE:
129 return "wtf";
130 case typelib_TypeClass_STRUCT:
131 return struct2string(data, type->pType);
132 case typelib_TypeClass_ENUM:
133 return OUString::number(*static_cast<const sal_Int32*>(data));
134 default:
135 assert(false); // this cannot happen I hope
136 break;
137 }
138 return "";
139}
140
141static OUString any2string(const uno::Any& any)
142{
143 return data2string(const_cast<void*>(any.getValue()), any.pType);
144}
145
146// Class SvXMLAutoStylePoolProperties_Impl
147// ctor class SvXMLAutoStylePoolProperties_Impl
148
149XMLAutoStylePoolProperties::XMLAutoStylePoolProperties( XMLAutoStyleFamily& rFamilyData, std::vector< XMLPropertyState >&& rProperties, OUString const & rParentName )
150: maProperties( std::move(rProperties) ),
151 mnPos ( rFamilyData.mnCount )
152{
153 static bool bHack = (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != nullptr);
154
155 if (bHack)
156 {
157 OUStringBuffer aStemBuffer(32);
158 aStemBuffer.append( rFamilyData.maStrPrefix );
159
160 if (!rParentName.isEmpty())
161 {
162 aStemBuffer.append("-" + rParentName);
163 }
164
165 // Create a name based on the properties used
166 for(XMLPropertyState const & rState : maProperties)
167 {
168 if (rState.mnIndex == -1)
169 continue;
170 OUString sXMLName(rFamilyData.mxMapper->getPropertySetMapper()->GetEntryXMLName(rState.mnIndex));
171 if (sXMLName.isEmpty())
172 continue;
173 aStemBuffer.append(
174 "-"
175 + OUString::number(static_cast<sal_Int32>(rFamilyData.mxMapper->getPropertySetMapper()->GetEntryNameSpace(rState.mnIndex)))
176 + ":"
177 + sXMLName
178 + "="
179 + any2string(rState.maValue));
180 }
181
182#if 0
183 // Finally append an incremental counter in an attempt to make identical
184 // styles always come out in the same order. Will see if this works.
185 aStemBuffer.append("-z");
186 static sal_Int32 nCounter = 0;
187 aStemBuffer.append(nCounter++));
188#endif
189
190 // create a name that hasn't been used before. The created name has not
191 // to be added to the array, because it will never tried again
192
193 msName = aStemBuffer;
194 bool bWarned = false;
195 while (rFamilyData.maNameSet.find(msName) !=
196 rFamilyData.maNameSet.end())
197 {
198 if (!bWarned)
199 SAL_WARN("xmloff", "Overlapping style name for " << msName);
200 bWarned = true;
201 rFamilyData.mnName++;
202 msName = aStemBuffer + "-" + OUString::number( static_cast<sal_Int64>(rFamilyData.mnName) );
203 }
204 rFamilyData.maNameSet.insert(msName);
205 }
206 else
207 {
208 // create a name that hasn't been used before. The created name has not
209 // to be added to the array, because it will never tried again
210 do
211 {
212 rFamilyData.mnName++;
213 msName = rFamilyData.maStrPrefix + OUString::number( static_cast<sal_Int64>(rFamilyData.mnName) );
214 }
215 while (rFamilyData.maNameSet.find(msName) != rFamilyData.maNameSet.end() || rFamilyData.maReservedNameSet.find(msName) != rFamilyData.maReservedNameSet.end());
216 }
217
218#if OSL_DEBUG_LEVEL > 0
219 std::set<sal_Int32> DebugProperties;
220 for (XMLPropertyState const & rPropState : maProperties)
221 {
222 sal_Int32 const property(rPropState.mnIndex);
223 // serious bug: will cause duplicate attributes to be exported
224 assert(DebugProperties.find(property) == DebugProperties.end());
225 if (-1 != property)
226 {
227 DebugProperties.insert(property);
228 }
229 }
230#endif
231}
232
234{
235 return r1.mnFamily < r2.mnFamily;
236}
237
238
240{
241}
242
243namespace {
244
245struct ComparePartial
246{
247 const XMLAutoStyleFamily& rFamilyData;
248
249 bool operator()(const std::vector< XMLPropertyState >& lhs,
250 const XMLAutoStylePoolProperties& rhs) const
251 {
252 return rFamilyData.mxMapper->LessPartial(lhs, rhs.GetProperties());
253 }
254 bool operator()(const XMLAutoStylePoolProperties& lhs,
255 const std::vector< XMLPropertyState >& rhs ) const
256 {
257 return rFamilyData.mxMapper->LessPartial(lhs.GetProperties(), rhs);
258 }
259};
260
261}
262
263// Adds an array of XMLPropertyState ( std::vector< XMLPropertyState > ) to list
264// if not added, yet.
265
266bool XMLAutoStylePoolParent::Add( XMLAutoStyleFamily& rFamilyData, std::vector< XMLPropertyState >&& rProperties, OUString& rName, bool bDontSeek )
267{
268 PropertiesListType::iterator pProperties = m_PropertiesList.end();;
269 auto [itBegin, itEnd] = std::equal_range(m_PropertiesList.begin(), m_PropertiesList.end(), rProperties, ComparePartial{rFamilyData});
270 if (!bDontSeek)
271 for (auto it = itBegin; it != itEnd; ++it)
272 if (rFamilyData.mxMapper->Equals(it->GetProperties(), rProperties))
273 pProperties = it;
274
275 bool bAdded = false;
276 if( bDontSeek || pProperties == m_PropertiesList.end() )
277 {
278 pProperties = m_PropertiesList.emplace(itBegin, rFamilyData, std::move(rProperties), msParent);
279 bAdded = true;
280 }
281
282 rName = pProperties->GetName();
283
284 return bAdded;
285}
286
287
288// Adds an array of XMLPropertyState ( std::vector< XMLPropertyState > ) with a given name.
289// If the name exists already, nothing is done. If a style with a different name and
290// the same properties exists, a new one is added (like with bDontSeek).
291
292
293bool XMLAutoStylePoolParent::AddNamed( XMLAutoStyleFamily& rFamilyData, std::vector< XMLPropertyState >&& rProperties, const OUString& rName )
294{
295 if (rFamilyData.maNameSet.find(rName) != rFamilyData.maNameSet.end())
296 return false;
297
298 auto it = std::lower_bound(m_PropertiesList.begin(), m_PropertiesList.end(), rProperties, ComparePartial{rFamilyData});
299
300 it = m_PropertiesList.emplace(it, rFamilyData, std::move(rProperties), msParent);
301 // ignore the generated name
302 it->SetName( rName );
303 return true;
304}
305
306
307// Search for an array of XMLPropertyState ( std::vector< XMLPropertyState > ) in list
308
309
310OUString XMLAutoStylePoolParent::Find( const XMLAutoStyleFamily& rFamilyData, const std::vector< XMLPropertyState >& rProperties ) const
311{
312 OUString sName;
313 auto [itBegin,itEnd] = std::equal_range(m_PropertiesList.begin(), m_PropertiesList.end(), rProperties, ComparePartial{rFamilyData});
314 for (auto it = itBegin; it != itEnd; ++it)
315 if (rFamilyData.mxMapper->Equals(it->GetProperties(), rProperties))
316 sName = it->GetName();
317
318 return sName;
319}
320
322{
323 return msParent < rOther.msParent;
324}
325
326// Class SvXMLAutoStylePool_Impl
327// ctor/dtor class SvXMLAutoStylePool_Impl
328
330 : rExport( rExp )
331{
332}
333
335{
336}
337
338// Adds stylefamily-information to sorted list
339
341 XmlStyleFamily nFamily,
342 const OUString& rStrName,
344 const OUString& rStrPrefix,
345 bool bAsFamily )
346{
347 // store family in a list if not already stored
348 SvXMLExportFlags nExportFlags = GetExport().getExportFlags();
349 bool bStylesOnly = (nExportFlags & SvXMLExportFlags::STYLES) && !(nExportFlags & SvXMLExportFlags::CONTENT);
350
351 OUString aPrefix( rStrPrefix );
352 if( bStylesOnly )
353 {
354 aPrefix = "M" + rStrPrefix;
355 }
356
357#if OSL_DEBUG_LEVEL > 0
358 XMLAutoStyleFamily aTemp(nFamily);
359 auto const iter = m_FamilySet.find(aTemp);
360 if (iter != m_FamilySet.end())
361 {
362 // FIXME: do we really intend to replace the previous nFamily
363 // entry in this case ?
364 SAL_WARN_IF( iter->mxMapper != rMapper, "xmloff",
365 "Adding duplicate family " << rStrName <<
366 " with mismatching mapper ! " <<
367 typeid(iter->mxMapper.get()).name() << " " <<
368 typeid(*rMapper).name() );
369 }
370#endif
371
372 m_FamilySet.emplace(nFamily, rStrName, rMapper, aPrefix, bAsFamily);
373}
374
376 XmlStyleFamily nFamily,
378{
379 XMLAutoStyleFamily aTemp(nFamily);
380 auto const iter = m_FamilySet.find(aTemp);
381 if (iter != m_FamilySet.end())
382 const_cast<XMLAutoStyleFamily&>(*iter).mxMapper = rMapper;
383}
384
385// Adds a name to list
386void SvXMLAutoStylePoolP_Impl::RegisterName( XmlStyleFamily nFamily, const OUString& rName )
387{
388 XMLAutoStyleFamily aTemp(nFamily);
389 auto const iter = m_FamilySet.find(aTemp);
390 assert(iter != m_FamilySet.end()); // family must be known
391 const_cast<XMLAutoStyleFamily&>(*iter).maNameSet.insert(rName);
392}
393
394// Adds a name to list
396{
397 XMLAutoStyleFamily aTemp(nFamily);
398 auto const iter = m_FamilySet.find(aTemp);
399 assert(iter != m_FamilySet.end()); // family must be known
400 const_cast<XMLAutoStyleFamily&>(*iter).maReservedNameSet.insert(rName);
401}
402
403
404// Retrieve the list of registered names
405
406
408 uno::Sequence<sal_Int32>& rFamilies,
409 uno::Sequence<OUString>& rNames )
410{
411 // collect registered names + families
412 std::vector<sal_Int32> aFamilies;
413 std::vector<OUString> aNames;
414
415 // iterate over families
416 for (XMLAutoStyleFamily const & rFamily : m_FamilySet)
417 {
418 // iterate over names
419 for (const auto& rName : rFamily.maNameSet)
420 {
421 aFamilies.push_back( static_cast<sal_Int32>(rFamily.mnFamily) );
422 aNames.push_back( rName );
423 }
424 }
425
426 // copy the families + names into the sequence types
427 assert(aFamilies.size() == aNames.size());
428
429 rFamilies.realloc( aFamilies.size() );
430 std::copy( aFamilies.begin(), aFamilies.end(), rFamilies.getArray() );
431
432 rNames.realloc( aNames.size() );
433 std::copy( aNames.begin(), aNames.end(), rNames.getArray() );
434}
435
436// Adds an array of XMLPropertyState ( vector< XMLPropertyState > ) to list
437// if not added, yet.
438
440 OUString& rName, XmlStyleFamily nFamily, const OUString& rParentName,
441 ::std::vector< XMLPropertyState >&& rProperties, bool bDontSeek )
442{
443 XMLAutoStyleFamily aTemp(nFamily);
444 auto const iter = m_FamilySet.find(aTemp);
445 assert(iter != m_FamilySet.end()); // family must be known
446
447 XMLAutoStyleFamily &rFamily = const_cast<XMLAutoStyleFamily&>(*iter);
448
449 auto itPair = rFamily.m_ParentSet.emplace(rParentName);
450 XMLAutoStylePoolParent& rParent = const_cast<XMLAutoStylePoolParent&>(*itPair.first);
451
452 bool bRet = false;
453 if (rParent.Add(rFamily, std::move(rProperties), rName, bDontSeek))
454 {
455 rFamily.mnCount++;
456 bRet = true;
457 }
458
459 return bRet;
460}
461
463 const OUString& rName, XmlStyleFamily nFamily, const OUString& rParentName,
464 std::vector< XMLPropertyState >&& rProperties )
465{
466 // get family and parent the same way as in Add()
467
468 XMLAutoStyleFamily aTemp(nFamily);
469 auto const iter = m_FamilySet.find(aTemp);
470 assert(iter != m_FamilySet.end()); // family must be known
471
472 XMLAutoStyleFamily &rFamily = const_cast<XMLAutoStyleFamily&>(*iter);
473
474 auto itPair = rFamily.m_ParentSet.emplace(rParentName);
475 XMLAutoStylePoolParent& rParent = const_cast<XMLAutoStylePoolParent&>(*itPair.first);
476
477 bool bRet = false;
478 if (rParent.AddNamed(rFamily, std::move(rProperties), rName))
479 {
480 rFamily.mnCount++;
481 bRet = true;
482 }
483
484 return bRet;
485}
486
487
488// Search for an array of XMLPropertyState ( std::vector< XMLPropertyState > ) in list
489
490
492 const OUString& rParent,
493 const std::vector< XMLPropertyState >& rProperties ) const
494{
495 OUString sName;
496
497 XMLAutoStyleFamily aTemp(nFamily);
498 auto const iter = m_FamilySet.find(aTemp);
499 assert(iter != m_FamilySet.end()); // family must be known
500
501 XMLAutoStyleFamily const& rFamily = *iter;
502 XMLAutoStylePoolParent aTmp(rParent);
503 auto const it2 = rFamily.m_ParentSet.find(aTmp);
504 if (it2 != rFamily.m_ParentSet.end())
505 {
506 sName = it2->Find(rFamily, rProperties);
507 }
508
509 return sName;
510}
511
512std::vector<xmloff::AutoStyleEntry> SvXMLAutoStylePoolP_Impl::GetAutoStyleEntries() const
513{
514 std::vector<xmloff::AutoStyleEntry> rReturnVector;
515
516 for (XMLAutoStyleFamily const & rFamily : m_FamilySet)
517 {
518 rtl::Reference<XMLPropertySetMapper> aPropertyMapper = rFamily.mxMapper->getPropertySetMapper();
519 for (XMLAutoStylePoolParent const & rParent : rFamily.m_ParentSet)
520 {
521 for (XMLAutoStylePoolProperties const & rProperty : rParent.GetPropertiesList())
522 {
523 rReturnVector.emplace_back();
524 xmloff::AutoStyleEntry & rEntry = rReturnVector.back();
525 for (XMLPropertyState const & rPropertyState : rProperty.GetProperties())
526 {
527 if (rPropertyState.mnIndex >= 0)
528 {
529 OUString sXmlName = aPropertyMapper->GetEntryXMLName(rPropertyState.mnIndex);
530 rEntry.m_aXmlProperties.emplace_back(sXmlName, rPropertyState.maValue);
531 }
532 }
533 }
534 }
535 }
536 return rReturnVector;
537}
538
539namespace {
540
541struct AutoStylePoolExport
542{
543 const OUString* mpParent;
544 XMLAutoStylePoolProperties* mpProperties;
545
546 AutoStylePoolExport() : mpParent(nullptr), mpProperties(nullptr) {}
547};
548
549struct StyleComparator
550{
551 bool operator() (const AutoStylePoolExport& a, const AutoStylePoolExport& b)
552 {
553 return (a.mpProperties->GetName() < b.mpProperties->GetName() ||
554 (a.mpProperties->GetName() == b.mpProperties->GetName() && *a.mpParent < *b.mpParent));
555 }
556};
557
558}
559
561 XmlStyleFamily nFamily,
562 const SvXMLAutoStylePoolP *pAntiImpl) const
563{
564 // Get list of parents for current family (nFamily)
565 XMLAutoStyleFamily aTemp(nFamily);
566 auto const iter = m_FamilySet.find(aTemp);
567 assert(iter != m_FamilySet.end()); // family must be known
568
569 const XMLAutoStyleFamily &rFamily = *iter;
570 sal_uInt32 nCount = rFamily.mnCount;
571
572 if (!nCount)
573 return;
574
575 // create, initialize and fill helper-structure (SvXMLAutoStylePoolProperties_Impl)
576 // which contains a parent-name and a SvXMLAutoStylePoolProperties_Impl
577 std::vector<AutoStylePoolExport> aExpStyles(nCount);
578
579 for (XMLAutoStylePoolParent const& rParent : rFamily.m_ParentSet)
580 {
581 size_t nProperties = rParent.GetPropertiesList().size();
582 for( size_t j = 0; j < nProperties; j++ )
583 {
584 const XMLAutoStylePoolProperties & rProperties =
585 rParent.GetPropertiesList()[j];
586 sal_uInt32 nPos = rProperties.GetPos();
587 assert(nPos < nCount);
588 assert(!aExpStyles[nPos].mpProperties);
589 aExpStyles[nPos].mpProperties = &const_cast<XMLAutoStylePoolProperties&>(rProperties);
590 aExpStyles[nPos].mpParent = &rParent.GetParent();
591 }
592 }
593
594 static bool bHack = (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != nullptr);
595
596 if (bHack)
597 {
598
599 std::sort(aExpStyles.begin(), aExpStyles.end(), StyleComparator());
600
601 for (size_t i = 0; i < nCount; i++)
602 {
603 OUString oldName = aExpStyles[i].mpProperties->GetName();
604 sal_Int32 dashIx = oldName.indexOf('-');
605 OUString newName = (dashIx > 0 ? oldName.copy(0, dashIx) : oldName) + OUString::number(i);
606 aExpStyles[i].mpProperties->SetName(newName);
607 }
608 }
609
610
611 // create string to export for each XML-style. That means for each property-list
612
613 OUString aStrFamilyName = rFamily.maStrFamilyName;
614
615 for( size_t i = 0; i < nCount; i++ )
616 {
617 assert(aExpStyles[i].mpProperties);
618
619 if( aExpStyles[i].mpProperties )
620 {
623 aExpStyles[i].mpProperties->GetName() );
624
625 bool bExtensionNamespace = false;
626 if( rFamily.mbAsFamily )
627 {
629 XML_NAMESPACE_STYLE, XML_FAMILY, aStrFamilyName );
630 if(aStrFamilyName != "graphic" &&
631 aStrFamilyName != "drawing-page" &&
632 aStrFamilyName != "presentation" &&
633 aStrFamilyName != "chart" )
634 bExtensionNamespace = true;
635 }
636
637 if( !aExpStyles[i].mpParent->isEmpty() )
638 {
641 GetExport().EncodeStyleName(
642 *aExpStyles[i].mpParent ) );
643 }
644
645 OUString sName;
646 if( rFamily.mbAsFamily )
648 else
649 sName = rFamily.maStrFamilyName;
650
651 pAntiImpl->exportStyleAttributes(GetExport().GetAttrList(), nFamily,
652 aExpStyles[i].mpProperties->GetProperties(),
653 *rFamily.mxMapper, GetExport().GetMM100UnitConverter(),
654 GetExport().GetNamespaceMap());
655
658 true, true );
659
660 sal_Int32 nStart(-1);
661 sal_Int32 nEnd(-1);
662 if (nFamily == XmlStyleFamily::PAGE_MASTER)
663 {
664 nStart = 0;
665 sal_Int32 nIndex = 0;
667 rFamily.mxMapper->getPropertySetMapper();
668 sal_Int16 nContextID;
669 while(nIndex < aPropMapper->GetEntryCount() && nEnd == -1)
670 {
671 nContextID = aPropMapper->GetEntryContextId( nIndex );
672 if (nContextID && ((nContextID & CTF_PM_FLAGMASK) != XML_PM_CTF_START))
673 nEnd = nIndex;
674 nIndex++;
675 }
676 if (nEnd == -1)
677 nEnd = nIndex;
678 }
679
680 rFamily.mxMapper->exportXML(
681 GetExport(),
682 aExpStyles[i].mpProperties->GetProperties(),
683 nStart, nEnd, SvXmlExportFlags::IGN_WS, bExtensionNamespace );
684
685 pAntiImpl->exportStyleContent(GetExport().GetDocHandler(), nFamily,
686 aExpStyles[i].mpProperties->GetProperties(),
687 *rFamily.mxMapper, GetExport().GetMM100UnitConverter(),
688 GetExport().GetNamespaceMap());
689 }
690 }
691}
692
694{
695 for (auto & aI : m_FamilySet)
696 const_cast<XMLAutoStyleFamily&>(aI).ClearEntries();
697}
698
699/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define CTF_PM_FLAGMASK
const Any & any
void RegisterDefinedName(XmlStyleFamily nFamily, const OUString &rName)
Definition: impastpl.cxx:395
OUString Find(XmlStyleFamily nFamily, const OUString &rParent, const ::std::vector< XMLPropertyState > &rProperties) const
Definition: impastpl.cxx:491
void exportXML(XmlStyleFamily nFamily, const SvXMLAutoStylePoolP *pAntiImpl) const
Definition: impastpl.cxx:560
void AddFamily(XmlStyleFamily nFamily, const OUString &rStrName, const rtl::Reference< SvXMLExportPropertyMapper > &rMapper, const OUString &rStrPrefix, bool bAsFamily)
Definition: impastpl.cxx:340
FamilySetType m_FamilySet
Definition: impastpl.hxx:134
void SetFamilyPropSetMapper(XmlStyleFamily nFamily, const rtl::Reference< SvXMLExportPropertyMapper > &rMapper)
Definition: impastpl.cxx:375
bool AddNamed(const OUString &rName, XmlStyleFamily nFamily, const OUString &rParentName, std::vector< XMLPropertyState > &&rProperties)
Definition: impastpl.cxx:462
SvXMLExport & GetExport() const
Definition: impastpl.hxx:141
void GetRegisteredNames(css::uno::Sequence< sal_Int32 > &aFamilies, css::uno::Sequence< OUString > &aNames)
Definition: impastpl.cxx:407
SvXMLAutoStylePoolP_Impl(SvXMLExport &rExport)
Definition: impastpl.cxx:329
bool Add(OUString &rName, XmlStyleFamily nFamily, const OUString &rParentName, std::vector< XMLPropertyState > &&rProperties, bool bDontSeek=false)
Definition: impastpl.cxx:439
std::vector< xmloff::AutoStyleEntry > GetAutoStyleEntries() const
Definition: impastpl.cxx:512
void RegisterName(XmlStyleFamily nFamily, const OUString &rName)
Definition: impastpl.cxx:386
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
Definition: xmlaustp.cxx:168
virtual void exportStyleAttributes(comphelper::AttributeList &rAttrList, XmlStyleFamily nFamily, const ::std::vector< XMLPropertyState > &rProperties, const SvXMLExportPropertyMapper &rPropExp, const SvXMLUnitConverter &rUnitConverter, const SvXMLNamespaceMap &rNamespaceMap) const
Definition: xmlaustp.cxx:58
void AddAttribute(sal_uInt16 nPrefix, const OUString &rName, const OUString &rValue)
Definition: xmlexp.cxx:907
SvXMLExportFlags getExportFlags() const
Definition: xmlexp.hxx:473
bool AddNamed(XMLAutoStyleFamily &rFamilyData, std::vector< XMLPropertyState > &&rProperties, const OUString &rName)
Definition: impastpl.cxx:293
bool Add(XMLAutoStyleFamily &rFamilyData, std::vector< XMLPropertyState > &&rProperties, OUString &rName, bool bDontSeek)
Definition: impastpl.cxx:266
const PropertiesListType & GetPropertiesList() const
Definition: impastpl.hxx:89
bool operator<(const XMLAutoStylePoolParent &rOther) const
Definition: impastpl.cxx:321
const OUString & GetParent() const
Definition: impastpl.hxx:87
PropertiesListType m_PropertiesList
Definition: impastpl.hxx:70
OUString Find(const XMLAutoStyleFamily &rFamilyData, const ::std::vector< XMLPropertyState > &rProperties) const
Definition: impastpl.cxx:310
const ::std::vector< XMLPropertyState > & GetProperties() const
Definition: impastpl.hxx:56
XMLAutoStylePoolProperties(XMLAutoStyleFamily &rFamilyData, std::vector< XMLPropertyState > &&rProperties, OUString const &rParentname)
Definition: impastpl.cxx:149
::std::vector< XMLPropertyState > maProperties
Definition: impastpl.hxx:48
sal_uInt32 GetPos() const
Definition: impastpl.hxx:57
#define XML_PM_CTF_START
Definition: contextid.hxx:30
int nCount
RegionData_Impl * mpParent
std::size_t mnCount
XmlStyleFamily
Definition: families.hxx:50
OUString sName
static OUString data2string(void *data, const typelib_TypeDescriptionReference *type)
Definition: impastpl.cxx:94
bool operator<(const XMLAutoStyleFamily &r1, const XMLAutoStyleFamily &r2)
Definition: impastpl.cxx:233
static OUString any2string(const uno::Any &any)
Definition: impastpl.cxx:141
static OUString struct2string(void *data, const typelib_TypeDescription *type)
Definition: impastpl.cxx:67
sal_Int32 nIndex
uno_Any a
sal_uInt16 nPos
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
struct _typelib_TypeDescription typelib_TypeDescription
SvGenericNameContainerMapImpl maProperties
OUString newName(std::u16string_view aNewPrefix, std::u16string_view aOldPrefix, std::u16string_view old_Name)
int i
Handling of tokens in XML:
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
return the OUString representation for eToken
Definition: xmltoken.cxx:3541
OUString maStrPrefix
Definition: impastpl.hxx:109
XmlStyleFamily mnFamily
Definition: impastpl.hxx:100
rtl::Reference< SvXMLExportPropertyMapper > mxMapper
Definition: impastpl.hxx:102
sal_uInt32 mnCount
Definition: impastpl.hxx:107
std::set< OUString > maReservedNameSet
Definition: impastpl.hxx:106
sal_uInt32 mnName
Definition: impastpl.hxx:108
std::set< OUString > maNameSet
Definition: impastpl.hxx:105
XMLAutoStyleFamily(XmlStyleFamily nFamily, OUString aStrName, rtl::Reference< SvXMLExportPropertyMapper > xMapper, OUString aStrPrefix, bool bAsFamily)
Definition: impastpl.cxx:44
ParentSetType m_ParentSet
Definition: impastpl.hxx:104
OUString maStrFamilyName
Definition: impastpl.hxx:101
Smart struct to transport an Any with an index to the appropriate property-name.
Definition: maptype.hxx:140
std::vector< std::pair< OUString, css::uno::Any > > m_aXmlProperties
unsigned char sal_Bool
signed char sal_Int8
Any result
ResultType type
sal_Int32 nProperties
SvXMLExportFlags
Definition: xmlexp.hxx:90
constexpr sal_uInt16 XML_NAMESPACE_STYLE