LibreOffice Module xmloff (master)  1
xmlstyle.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 <sal/config.h>
21 
22 #include <com/sun/star/frame/XModel.hpp>
23 #include <com/sun/star/xml/sax/XAttributeList.hpp>
24 #include <com/sun/star/container/XNameContainer.hpp>
25 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
26 #include <com/sun/star/style/XAutoStylesSupplier.hpp>
27 #include <com/sun/star/style/XAutoStyleFamily.hpp>
28 #include <PageMasterPropMapper.hxx>
29 #include <sal/log.hxx>
30 #include <svl/style.hxx>
31 #include <xmloff/namespacemap.hxx>
32 #include <xmloff/xmlnamespace.hxx>
33 #include <xmloff/xmltoken.hxx>
34 
35 #include <xmloff/families.hxx>
36 #include <xmloff/xmlimp.hxx>
37 #include <xmloff/xmlnumi.hxx>
38 #include <xmloff/xmlimppr.hxx>
39 #include <xmloff/xmlstyle.hxx>
40 #include <xmloff/txtstyli.hxx>
41 #include <xmloff/xmlnumfi.hxx>
42 #include <XMLChartStyleContext.hxx>
45 #include "FillStyleContext.hxx"
51 
52 #include <memory>
53 #include <set>
54 #include <string_view>
55 #include <vector>
56 
57 using namespace ::com::sun::star;
58 using namespace ::com::sun::star::uno;
59 using namespace ::com::sun::star::container;
60 using namespace ::com::sun::star::style;
61 using namespace ::xmloff::token;
62 
63 constexpr OUStringLiteral gsParaStyleServiceName( u"com.sun.star.style.ParagraphStyle" );
64 constexpr OUStringLiteral gsTextStyleServiceName( u"com.sun.star.style.CharacterStyle" );
65 
66 void SvXMLStyleContext::SetAttribute( sal_Int32 nElement,
67  const OUString& rValue )
68 {
69  switch (nElement)
70  {
72  {
73  if( IsXMLToken( rValue, XML_PARAGRAPH ) )
74  mnFamily = XmlStyleFamily(SfxStyleFamily::Para);
75  else if( IsXMLToken( rValue, XML_TEXT ) )
76  mnFamily = XmlStyleFamily(SfxStyleFamily::Char);
77  break;
78  }
79  case XML_ELEMENT(STYLE, XML_NAME):
80  maName = rValue;
81  break;
83  maDisplayName = rValue;
84  break;
86  maParentName = rValue;
87  break;
89  maFollow = rValue;
90  break;
91  case XML_ELEMENT(LO_EXT, XML_LINKED_STYLE_NAME):
92  maLinked = rValue;
93  break;
95  mbHidden = rValue.toBoolean();
96  break;
97  case XML_ELEMENT(LO_EXT, XML_HIDDEN):
98  mbHidden = rValue.toBoolean();
99  break;
100  }
101 }
102 
103 
105  SvXMLImport& rImp,
106  XmlStyleFamily nFam, bool bDefault ) :
107  SvXMLImportContext( rImp ),
108  mbHidden( false ),
109  mnFamily( nFam ),
110  mbValid( true ),
111  mbNew( true ),
112  mbDefaultStyle( bDefault )
113 {
114 }
115 
117 {
118 }
119 
121  sal_Int32 /*nElement*/,
122  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
123 {
124  for( auto &it : sax_fastparser::castToFastAttributeList( xAttrList ) )
125  SetAttribute( it.getToken(), it.toString() );
126 }
127 
129 {
130 }
131 
132 void SvXMLStyleContext::CreateAndInsert( bool /*bOverwrite*/ )
133 {
134 }
135 
136 void SvXMLStyleContext::CreateAndInsertLate( bool /*bOverwrite*/ )
137 {
138 }
139 
140 void SvXMLStyleContext::Finish( bool /*bOverwrite*/ )
141 {
142 }
143 
145 {
146  return false;
147 }
148 
149 namespace {
150 
151 class SvXMLStyleIndex_Impl
152 {
153  OUString sName;
154  XmlStyleFamily nFamily;
155  // we deliberately don't use a reference here, to avoid creating a ref-count-cycle
156  SvXMLStyleContext* mpStyle;
157 
158 public:
159 
160  SvXMLStyleIndex_Impl( XmlStyleFamily nFam, const OUString& rName ) :
161  sName( rName ),
162  nFamily( nFam ),
163  mpStyle(nullptr)
164  {
165  }
166 
167  SvXMLStyleIndex_Impl( const rtl::Reference<SvXMLStyleContext> &rStl ) :
168  sName( rStl->GetName() ),
169  nFamily( rStl->GetFamily() ),
170  mpStyle ( rStl.get() )
171  {
172  }
173 
174  const OUString& GetName() const { return sName; }
175  XmlStyleFamily GetFamily() const { return nFamily; }
176  const SvXMLStyleContext *GetStyle() const { return mpStyle; }
177 };
178 
179 struct SvXMLStyleIndexCmp_Impl
180 {
181  bool operator()(const SvXMLStyleIndex_Impl& r1, const SvXMLStyleIndex_Impl& r2) const
182  {
183  sal_Int32 nRet;
184 
185  if( r1.GetFamily() < r2.GetFamily() )
186  nRet = -1;
187  else if( r1.GetFamily() > r2.GetFamily() )
188  nRet = 1;
189  else
190  nRet = r1.GetName().compareTo( r2.GetName() );
191 
192  return nRet < 0;
193  }
194 };
195 
196 }
197 
199 {
200  typedef std::set<SvXMLStyleIndex_Impl, SvXMLStyleIndexCmp_Impl> IndicesType;
201 
202  std::vector<rtl::Reference<SvXMLStyleContext>> aStyles;
203  mutable std::unique_ptr<IndicesType> pIndices;
205 
206 #if OSL_DEBUG_LEVEL > 0
207  mutable sal_uInt32 m_nIndexCreated;
208 #endif
209 
210  void FlushIndex() { pIndices.reset(); }
211 
212 public:
213  explicit SvXMLStylesContext_Impl( bool bAuto );
214 
215  size_t GetStyleCount() const { return aStyles.size(); }
216 
218  {
219  return i < aStyles.size() ? aStyles[ i ].get() : nullptr;
220  }
221 
222  inline void AddStyle( SvXMLStyleContext *pStyle );
223  void dispose();
224 
226  const OUString& rName,
227  bool bCreateIndex ) const;
228  bool IsAutomaticStyle() const { return bAutomaticStyle; }
229 };
230 
232  bAutomaticStyle( bAuto )
233 #if OSL_DEBUG_LEVEL > 0
234  , m_nIndexCreated( 0 )
235 #endif
236 {}
237 
239 {
240 #if OSL_DEBUG_LEVEL > 0
241 // for (auto const & xStyle : aStyles)
242 // if (xStyle->GetFamily() == pStyle->GetFamily() && xStyle->GetName() == pStyle->GetName())
243 // assert(false && "duplicate style");
244 #endif
245  aStyles.emplace_back(pStyle );
246 
247  FlushIndex();
248 }
249 
251 {
252  FlushIndex();
253  aStyles.clear();
254 }
255 
257  const OUString& rName,
258  bool bCreateIndex ) const
259 {
260  const SvXMLStyleContext *pStyle = nullptr;
261 
262  if( !pIndices && bCreateIndex && !aStyles.empty() )
263  {
264  pIndices = std::make_unique<IndicesType>(aStyles.begin(), aStyles.end());
265  SAL_WARN_IF(pIndices->size() != aStyles.size(), "xmloff.style", "Here is a duplicate Style");
266 #if OSL_DEBUG_LEVEL > 0
267  SAL_WARN_IF(0 != m_nIndexCreated, "xmloff.style",
268  "Performance warning: sdbcx::Index created multiple times");
269  ++m_nIndexCreated;
270 #endif
271  }
272 
273  if( pIndices )
274  {
275  SvXMLStyleIndex_Impl aIndex( nFamily, rName );
276  IndicesType::iterator aFind = pIndices->find(aIndex);
277  if( aFind != pIndices->end() )
278  pStyle = aFind->GetStyle();
279  }
280  else
281  {
282  for( size_t i = 0; !pStyle && i < aStyles.size(); i++ )
283  {
284  const SvXMLStyleContext *pS = aStyles[ i ].get();
285  if( pS->GetFamily() == nFamily &&
286  pS->GetName() == rName )
287  pStyle = pS;
288  }
289  }
290  return pStyle;
291 }
292 
293 
295 {
296  return mpImpl->GetStyleCount();
297 }
298 
300 {
301  return mpImpl->GetStyle( i );
302 }
303 
305 {
306  return mpImpl->GetStyle( i );
307 }
308 
310 {
311  return mpImpl->IsAutomaticStyle();
312 }
313 
315  sal_Int32 nElement,
316  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
317 {
318  SvXMLStyleContext *pStyle = nullptr;
319 
320  if(GetImport().GetDataStylesImport())
321  {
322  pStyle = GetImport().GetDataStylesImport()->CreateChildContext(GetImport(), nElement,
323  xAttrList, *this);
324  if (pStyle)
325  return pStyle;
326  }
327 
328  switch (nElement)
329  {
330  case XML_ELEMENT(STYLE, XML_STYLE):
332  {
334  for( auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ) )
335  {
336  if( aIter.getToken() == XML_ELEMENT(STYLE, XML_FAMILY) )
337  {
338  nFamily = GetFamily( aIter.toString() );
339  break;
340  }
341  }
342  pStyle = XML_ELEMENT(STYLE, XML_STYLE)==nElement
343  ? CreateStyleStyleChildContext( nFamily, nElement, xAttrList )
344  : CreateDefaultStyleStyleChildContext( nFamily, nElement, xAttrList );
345  break;
346  }
349  break;
352  GetImport(), nElement, xAttrList);
353  break;
356  break;
359  {
360  //there is not page family in ODF now, so I specify one for it
361  bool bDefaultStyle = XML_ELEMENT(STYLE, XML_DEFAULT_PAGE_LAYOUT) == nElement;
362  pStyle = new PageStyleContext( GetImport(), *this, bDefaultStyle );
363  }
364  break;
366  pStyle = new SvxXMLListStyleContext( GetImport() );
367  break;
369  pStyle = new SvxXMLListStyleContext( GetImport(), true );
370  break;
371 
372  // FillStyles
373 
375  {
376  pStyle = new XMLGradientStyleContext( GetImport(), nElement, xAttrList );
377  break;
378  }
379  case XML_ELEMENT(DRAW, XML_HATCH):
380  {
381  pStyle = new XMLHatchStyleContext( GetImport(), nElement, xAttrList );
382  break;
383  }
385  {
386  pStyle = new XMLBitmapStyleContext( GetImport(), nElement, xAttrList );
387  break;
388  }
390  {
391  pStyle = new XMLTransGradientStyleContext( GetImport(), nElement, xAttrList );
392  break;
393  }
394  case XML_ELEMENT(DRAW, XML_MARKER):
395  {
396  pStyle = new XMLMarkerStyleContext( GetImport(), nElement, xAttrList );
397  break;
398  }
400  {
401  pStyle = new XMLDashStyleContext( GetImport(), nElement, xAttrList );
402  break;
403  }
404  }
405 
406  if (!pStyle)
407  SAL_WARN("xmloff", "Unknown element " << SvXMLImport::getPrefixAndNameFromToken(nElement));
408 
409  return pStyle;
410 }
411 
413  XmlStyleFamily nFamily, sal_Int32 /*nElement*/,
414  const uno::Reference< xml::sax::XFastAttributeList > & /*xAttrList*/ )
415 {
416  SvXMLStyleContext *pStyle = nullptr;
417 
418  switch( nFamily )
419  {
423  pStyle = new XMLTextStyleContext( GetImport(), *this, nFamily );
424  break;
425 
427  pStyle = new XMLPropStyleContext( GetImport(), *this, nFamily );
428  break;
430  pStyle = new XMLChartStyleContext( GetImport(), *this, nFamily );
431  break;
432 
436  pStyle = new XMLShapeStyleContext( GetImport(), *this, nFamily );
437  break;
438  default: break;
439  }
440 
441  return pStyle;
442 }
443 
445  XmlStyleFamily /*nFamily*/, sal_Int32 /*nElement*/,
446  const uno::Reference< xml::sax::XFastAttributeList > & )
447 {
448  return nullptr;
449 }
450 
452 {
453  return true;
454 }
455 
456 XmlStyleFamily SvXMLStylesContext::GetFamily( std::u16string_view rValue )
457 {
459  if( IsXMLToken( rValue, XML_PARAGRAPH ) )
460  {
462  }
463  else if( IsXMLToken( rValue, XML_TEXT ) )
464  {
465  nFamily = XmlStyleFamily::TEXT_TEXT;
466  }
467  else if( IsXMLToken( rValue, XML_DATA_STYLE ) )
468  {
469  nFamily = XmlStyleFamily::DATA_STYLE;
470  }
471  else if ( IsXMLToken( rValue, XML_SECTION ) )
472  {
474  }
475  else if( IsXMLToken( rValue, XML_TABLE ) )
476  {
477  nFamily = XmlStyleFamily::TABLE_TABLE;
478  }
479  else if( IsXMLToken( rValue, XML_TABLE_COLUMN ) )
481  else if( IsXMLToken( rValue, XML_TABLE_ROW ) )
482  nFamily = XmlStyleFamily::TABLE_ROW;
483  else if( IsXMLToken( rValue, XML_TABLE_CELL ) )
484  nFamily = XmlStyleFamily::TABLE_CELL;
485  else if ( rValue == XML_STYLE_FAMILY_SD_GRAPHICS_NAME )
486  {
488  }
489  else if ( rValue == XML_STYLE_FAMILY_SD_PRESENTATION_NAME )
490  {
492  }
493  else if ( rValue == XML_STYLE_FAMILY_SD_POOL_NAME )
494  {
495  nFamily = XmlStyleFamily::SD_POOL_ID;
496  }
497  else if ( rValue == XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME )
498  {
500  }
501  else if ( rValue == XML_STYLE_FAMILY_SCH_CHART_NAME )
502  {
504  }
505  else if ( IsXMLToken( rValue, XML_RUBY ) )
506  {
507  nFamily = XmlStyleFamily::TEXT_RUBY;
508  }
509 
510  return nFamily;
511 }
512 
514  XmlStyleFamily nFamily ) const
515 {
517 
518  switch( nFamily )
519  {
521  if( !mxParaImpPropMapper.is() )
522  {
523  SvXMLStylesContext * pThis = const_cast<SvXMLStylesContext *>(this);
524  pThis->mxParaImpPropMapper =
525  pThis->GetImport().GetTextImport()
526  ->GetParaImportPropertySetMapper();
527  }
528  xMapper = mxParaImpPropMapper;
529  break;
531  if( !mxTextImpPropMapper.is() )
532  {
533  SvXMLStylesContext * pThis = const_cast<SvXMLStylesContext *>(this);
534  pThis->mxTextImpPropMapper =
535  pThis->GetImport().GetTextImport()
536  ->GetTextImportPropertySetMapper();
537  }
538  xMapper = mxTextImpPropMapper;
539  break;
540 
542  // don't cache section mapper, as it's rarely used
543  // *sigh*, cast to non-const, because this is a const method,
544  // but SvXMLImport::GetTextImport() isn't.
545  xMapper = const_cast<SvXMLStylesContext*>(this)->GetImport().GetTextImport()->
546  GetSectionImportPropertySetMapper();
547  break;
548 
550  // don't cache section mapper, as it's rarely used
551  // *sigh*, cast to non-const, because this is a const method,
552  // but SvXMLImport::GetTextImport() isn't.
553  xMapper = const_cast<SvXMLStylesContext*>(this)->GetImport().GetTextImport()->
554  GetRubyImportPropertySetMapper();
555  break;
556 
560  if(!mxShapeImpPropMapper.is())
561  {
562  rtl::Reference< XMLShapeImportHelper > aImpHelper = const_cast<SvXMLImport&>(GetImport()).GetShapeImport();
563  const_cast<SvXMLStylesContext*>(this)->mxShapeImpPropMapper =
564  aImpHelper->GetPropertySetMapper();
565  }
566  xMapper = mxShapeImpPropMapper;
567  break;
569  if( ! mxChartImpPropMapper.is() )
570  {
571  XMLPropertySetMapper *const pPropMapper = new XMLChartPropertySetMapper(nullptr);
573  }
574  xMapper = mxChartImpPropMapper;
575  break;
577  if( ! mxPageImpPropMapper.is() )
578  {
579  XMLPropertySetMapper *pPropMapper =
582  new PageMasterImportPropertyMapper( pPropMapper,
583  const_cast<SvXMLStylesContext*>(this)->GetImport() );
584  }
585  xMapper = mxPageImpPropMapper;
586  break;
587  default: break;
588  }
589 
590  return xMapper;
591 }
592 
593 Reference < XAutoStyleFamily > SvXMLStylesContext::GetAutoStyles( XmlStyleFamily nFamily ) const
594 {
595  Reference < XAutoStyleFamily > xAutoStyles;
596  if( XmlStyleFamily::TEXT_TEXT == nFamily || XmlStyleFamily::TEXT_PARAGRAPH == nFamily)
597  {
598  bool bPara = XmlStyleFamily::TEXT_PARAGRAPH == nFamily;
599  if( !bPara && mxTextAutoStyles.is() )
600  xAutoStyles = mxTextAutoStyles;
601  else if( bPara && mxParaAutoStyles.is() )
602  xAutoStyles = mxParaAutoStyles;
603  else
604  {
605  OUString sName(bPara ? std::u16string_view( u"ParagraphStyles" ): std::u16string_view( u"CharacterStyles" ));
606  Reference< XAutoStylesSupplier > xAutoStylesSupp( GetImport().GetModel(), UNO_QUERY );
607  Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles();
608  if (xAutoStyleFamilies->hasByName(sName))
609  {
610  Any aAny = xAutoStyleFamilies->getByName( sName );
611  aAny >>= xAutoStyles;
612  if( bPara )
613  const_cast<SvXMLStylesContext *>(this)->mxParaAutoStyles = xAutoStyles;
614  else
615  const_cast<SvXMLStylesContext *>(this)->mxTextAutoStyles = xAutoStyles;
616  }
617  }
618  }
619  return xAutoStyles;
620 }
621 
622 Reference < XNameContainer > SvXMLStylesContext::GetStylesContainer(
623  XmlStyleFamily nFamily ) const
624 {
625  Reference < XNameContainer > xStyles;
626  OUString sName;
627  switch( nFamily )
628  {
630  if( mxParaStyles.is() )
631  xStyles = mxParaStyles;
632  else
633  sName = "ParagraphStyles";
634  break;
635 
637  if( mxTextStyles.is() )
638  xStyles = mxTextStyles;
639  else
640  sName = "CharacterStyles";
641  break;
642  default: break;
643  }
644  if( !xStyles.is() && !sName.isEmpty() )
645  {
646  Reference< XStyleFamiliesSupplier > xFamiliesSupp(
647  GetImport().GetModel(), UNO_QUERY );
648  if ( xFamiliesSupp.is() )
649  {
650  Reference< XNameAccess > xFamilies = xFamiliesSupp->getStyleFamilies();
651  if (xFamilies->hasByName(sName))
652  {
653  xStyles.set(xFamilies->getByName( sName ),uno::UNO_QUERY);
654 
655  switch( nFamily )
656  {
658  const_cast<SvXMLStylesContext *>(this)->mxParaStyles = xStyles;
659  break;
660 
662  const_cast<SvXMLStylesContext *>(this)->mxTextStyles = xStyles;
663  break;
664  default: break;
665  }
666  }
667  }
668  }
669 
670  return xStyles;
671 }
672 
674 {
675  OUString sServiceName;
676  switch( nFamily )
677  {
679  sServiceName = gsParaStyleServiceName;
680  break;
682  sServiceName = gsTextStyleServiceName;
683  break;
684  default: break;
685  }
686 
687  return sServiceName;
688 }
689 
691  SvXMLImportContext( rImport ),
692  mpImpl( new SvXMLStylesContext_Impl( bAuto ) )
693 {
694 }
695 
697 {
698 }
699 
700 css::uno::Reference< css::xml::sax::XFastContextHandler > SvXMLStylesContext::createFastChildContext(
701  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
702 {
703  SvXMLStyleContext *pStyle =
704  CreateStyleChildContext( nElement, xAttrList );
705  if( pStyle )
706  {
707  if( !pStyle->IsTransient() )
708  mpImpl->AddStyle( pStyle );
709  return pStyle;
710  }
711 
712  return nullptr;
713 }
714 
716 {
717  mpImpl->AddStyle( &rNew );
718 }
719 
721 {
722  mpImpl->dispose();
723 }
724 
726 {
727  sal_uInt32 nCount = GetStyleCount();
728  sal_uInt32 i;
729  for( i = 0; i < nCount; i++ )
730  {
731  SvXMLStyleContext *pStyle = GetStyle( i );
732  if( !pStyle || ( pStyle->GetFamily() != XmlStyleFamily::TEXT_TEXT &&
734  pStyle->GetFamily() != XmlStyleFamily::TABLE_CELL ) )
735  continue;
736  pStyle->CreateAndInsert( false );
737  }
738 }
739 
741  bool bFinish )
742 {
743  // pass 1: create text, paragraph and frame styles
744  sal_uInt32 nCount = GetStyleCount();
745  sal_uInt32 i;
746 
747  for( i = 0; i < nCount; i++ )
748  {
749  SvXMLStyleContext *pStyle = GetStyle( i );
750  if( !pStyle )
751  continue;
752 
753  if (pStyle->IsDefaultStyle())
754  {
755  if (bOverwrite) pStyle->SetDefaults();
756  }
757  else if( InsertStyleFamily( pStyle->GetFamily() ) )
758  pStyle->CreateAndInsert( bOverwrite );
759  }
760 
761  // pass 2: create list styles (they require char styles)
762  for( i=0; i<nCount; i++ )
763  {
764  SvXMLStyleContext *pStyle = GetStyle( i );
765  if( !pStyle || pStyle->IsDefaultStyle())
766  continue;
767 
768  if( InsertStyleFamily( pStyle->GetFamily() ) )
769  pStyle->CreateAndInsertLate( bOverwrite );
770  }
771 
772  // pass3: finish creation of styles
773  if( bFinish )
774  FinishStyles( bOverwrite );
775 }
776 
777 void SvXMLStylesContext::FinishStyles( bool bOverwrite )
778 {
779  sal_uInt32 nCount = GetStyleCount();
780  for( sal_uInt32 i=0; i<nCount; i++ )
781  {
782  SvXMLStyleContext *pStyle = GetStyle( i );
783  if( !pStyle || !pStyle->IsValid() || pStyle->IsDefaultStyle() )
784  continue;
785 
786  if( InsertStyleFamily( pStyle->GetFamily() ) )
787  pStyle->Finish( bOverwrite );
788  }
789 }
790 
792  XmlStyleFamily nFamily,
793  const OUString& rName,
794  bool bCreateIndex ) const
795 {
796  return mpImpl->FindStyleChildContext( nFamily, rName, bCreateIndex );
797 }
798 
799 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
css::uno::Reference< css::style::XAutoStyleFamily > mxTextAutoStyles
Definition: xmlstyle.hxx:134
virtual SvXMLStyleContext * CreateStyleChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: xmlstyle.cxx:314
XmlStyleFamily GetFamily() const
Definition: xmlstyle.hxx:85
std::set< SvXMLStyleIndex_Impl, SvXMLStyleIndexCmp_Impl > IndicesType
Definition: xmlstyle.cxx:200
bool IsAutomaticStyle() const
Definition: xmlstyle.cxx:228
void CopyAutoStylesToDoc()
Definition: xmlstyle.cxx:725
OUString maParentName
Definition: xmlstyle.hxx:45
std::vector< rtl::Reference< SvXMLStyleContext > > aStyles
Definition: xmlstyle.cxx:202
rtl::Reference< SvXMLImportPropertyMapper > mxParaImpPropMapper
Definition: xmlstyle.hxx:136
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex) const
Definition: xmlstyle.cxx:256
size_t GetStyleCount() const
Definition: xmlstyle.cxx:215
css::uno::Reference< css::container::XNameContainer > mxParaStyles
Definition: xmlstyle.hxx:128
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:59
SvXMLStyleContext * GetStyle(sal_uInt32 i)
Definition: xmlstyle.cxx:299
css::uno::Reference< css::style::XAutoStyleFamily > GetAutoStyles(XmlStyleFamily nFamily) const
Definition: xmlstyle.cxx:593
bool IsDefaultStyle() const
Definition: xmlstyle.hxx:110
bool IsXMLToken(std::u16string_view rString, enum XMLTokenEnum eToken)
compare eToken to the string
Definition: xmltoken.cxx:3511
SvXMLNumFmtHelper * GetDataStylesImport()
Definition: xmlimp.hxx:651
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
SvXMLStyleContext * CreateChildContext(SvXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, SvXMLStylesContext &rStyles)
Definition: xmlnumfi.cxx:2176
virtual ~SvXMLStyleContext() override
Definition: xmlstyle.cxx:116
void AddStyle(SvXMLStyleContext *pStyle)
Definition: xmlstyle.cxx:238
virtual ~SvXMLStylesContext() override
Definition: xmlstyle.cxx:696
rtl::Reference< XMLTextImportHelper > const & GetTextImport()
Definition: xmlimp.hxx:599
#define XML_STYLE_FAMILY_SCH_CHART_NAME
Definition: families.hxx:43
virtual void Finish(bool bOverwrite)
Definition: xmlstyle.cxx:140
static XmlStyleFamily GetFamily(std::u16string_view rFamily)
Definition: xmlstyle.cxx:456
SvXMLStyleContext * GetStyle(size_t i)
Definition: xmlstyle.cxx:217
#define XML_STYLE_FAMILY_SD_PRESENTATION_NAME
Definition: families.hxx:38
bool IsAutomaticStyle() const
Definition: xmlstyle.cxx:309
XmlStyleFamily
Definition: families.hxx:47
sal_uInt32 m_nIndexCreated
Definition: xmlstyle.cxx:207
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: xmlstyle.cxx:700
DRAW
bool IsValid() const
Definition: xmlstyle.hxx:87
constexpr OUStringLiteral sServiceName
int nCount
virtual OUString GetName() const override
static OUString getPrefixAndNameFromToken(sal_Int32 nToken)
Definition: xmlimp.cxx:1916
const char * sName
#define XML_STYLE_FAMILY_SD_GRAPHICS_NAME
Definition: families.hxx:36
const char * pS
OUString maDisplayName
Definition: xmlstyle.hxx:43
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const
Definition: xmlstyle.cxx:513
#define XML_STYLE_FAMILY_SD_POOL_NAME
Definition: families.hxx:40
int i
SvXMLStylesContext_Impl(bool bAuto)
Definition: xmlstyle.cxx:231
void CopyStylesToDoc(bool bOverwrite, bool bFinish=true)
Definition: xmlstyle.cxx:740
std::unique_ptr< IndicesType > pIndices
Definition: xmlstyle.cxx:203
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: xmlstyle.cxx:444
virtual void SetAttribute(sal_Int32 nElement, const OUString &rValue)
Definition: xmlstyle.cxx:66
virtual bool IsTransient() const
if this method returns true, its parent styles context should not add it to its container.
Definition: xmlstyle.cxx:144
constexpr OUStringLiteral gsParaStyleServiceName(u"com.sun.star.style.ParagraphStyle")
rtl::Reference< SvXMLImportPropertyMapper > mxChartImpPropMapper
Definition: xmlstyle.hxx:139
float u
virtual void SetDefaults()
Definition: xmlstyle.cxx:128
constexpr OUStringLiteral gsTextStyleServiceName(u"com.sun.star.style.CharacterStyle")
std::unique_ptr< SvXMLStylesContext_Impl > mpImpl
Definition: xmlstyle.hxx:125
import footnote and endnote configuration elements
virtual bool InsertStyleFamily(XmlStyleFamily nFamily) const
Definition: xmlstyle.cxx:451
#define XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME
Definition: families.hxx:41
virtual OUString GetServiceName(XmlStyleFamily nFamily) const
Definition: xmlstyle.cxx:673
virtual void SAL_CALL startFastElement(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &) override
Definition: xmlstyle.cxx:120
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
SvXMLStyleContext(SvXMLImport &rImport, XmlStyleFamily nFamily=XmlStyleFamily::DATA_STYLE, bool bDefaultStyle=false)
Definition: xmlstyle.cxx:104
virtual void CreateAndInsert(bool bOverwrite)
Definition: xmlstyle.cxx:132
std::deque< AttacherIndex_Impl > aIndex
SvXMLStylesContext(SvXMLStylesContext const &)=delete
#define SAL_WARN_IF(condition, area, stream)
rtl::Reference< SvXMLImportPropertyMapper > mxTextImpPropMapper
Definition: xmlstyle.hxx:137
const OUString & GetName() const
Definition: xmlstyle.hxx:78
OUString maName
Definition: xmlstyle.hxx:42
Handling of tokens in XML:
XmlStyleFamily mnFamily
Definition: xmlstyle.hxx:50
OUString maFollow
Definition: xmlstyle.hxx:46
OUString maLinked
Definition: xmlstyle.hxx:47
if(aStr!=aBuf) UpdateName_Impl(m_xFollowLb.get()
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:97
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: xmlstyle.cxx:412
void AddStyle(SvXMLStyleContext &rNew)
Definition: xmlstyle.cxx:715
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
Definition: xmlstyle.cxx:791
css::uno::Reference< css::style::XAutoStyleFamily > mxParaAutoStyles
Definition: xmlstyle.hxx:132
#define SAL_WARN(area, stream)
css::uno::Reference< css::container::XNameContainer > mxTextStyles
Definition: xmlstyle.hxx:130
virtual css::uno::Reference< css::container::XNameContainer > GetStylesContainer(XmlStyleFamily nFamily) const
Definition: xmlstyle.cxx:622
sal_uInt32 GetStyleCount() const
Definition: xmlstyle.cxx:294
rtl::Reference< SvXMLImportPropertyMapper > mxPageImpPropMapper
Definition: xmlstyle.hxx:140
rtl::Reference< SvXMLImportPropertyMapper > mxShapeImpPropMapper
Definition: xmlstyle.hxx:138
void FinishStyles(bool bOverwrite)
Definition: xmlstyle.cxx:777
TEXT
virtual void CreateAndInsertLate(bool bOverwrite)
Definition: xmlstyle.cxx:136
bool mbValid