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