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