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