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