LibreOffice Module xmloff (master)  1
ximpstyl.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 "ximpstyl.hxx"
21 #include <xmloff/maptype.hxx>
24 #include <xmloff/xmlnamespace.hxx>
25 #include <xmloff/xmlprmap.hxx>
26 #include <xmloff/xmltoken.hxx>
27 #include <xmloff/xmluconv.hxx>
28 #include "ximpnote.hxx"
29 #include <xmlsdtypes.hxx>
30 #include <tools/debug.hxx>
31 #include <sal/log.hxx>
32 #include <tools/diagnose_ex.h>
33 #include <com/sun/star/frame/XModel.hpp>
34 #include <com/sun/star/style/XStyle.hpp>
35 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
36 #include <com/sun/star/presentation/XPresentationPage.hpp>
37 #include <com/sun/star/drawing/XDrawPages.hpp>
38 #include <com/sun/star/container/XNamed.hpp>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <com/sun/star/beans/XPropertyState.hpp>
41 #include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
43 #include <xmloff/autolayout.hxx>
44 #include <xmloff/xmlprcon.hxx>
45 #include <xmloff/families.hxx>
46 #include <com/sun/star/container/XNameContainer.hpp>
47 #include <svl/zforlist.hxx>
48 #include "layerimp.hxx"
51 #include <unotools/configmgr.hxx>
52 #include <xmloff/xmlerror.hxx>
54 
55 using namespace ::com::sun::star;
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::xml::sax;
58 using namespace ::xmloff::token;
59 
60 namespace {
61 
62 class SdXMLDrawingPagePropertySetContext : public SvXMLPropertySetContext
63 {
64 public:
65 
66  SdXMLDrawingPagePropertySetContext( SvXMLImport& rImport, sal_Int32 nElement,
67  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
68  ::std::vector< XMLPropertyState > &rProps,
70 
72  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext(
73  sal_Int32 nElement,
74  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
75  ::std::vector< XMLPropertyState > &rProperties,
76  const XMLPropertyState& rProp ) override;
77 };
78 
79 }
80 
81 SdXMLDrawingPagePropertySetContext::SdXMLDrawingPagePropertySetContext(
82  SvXMLImport& rImport, sal_Int32 nElement,
83  const uno::Reference< xml::sax::XFastAttributeList > & xAttrList,
84  ::std::vector< XMLPropertyState > &rProps,
86  SvXMLPropertySetContext( rImport, nElement, xAttrList,
87  XML_TYPE_PROP_DRAWING_PAGE, rProps, rMap )
88 {
89 }
90 
91 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLDrawingPagePropertySetContext::createFastChildContext(
92  sal_Int32 nElement,
93  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
94  ::std::vector< XMLPropertyState > &rProperties,
95  const XMLPropertyState& rProp )
96 {
97  switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
98  {
99  case CTF_PAGE_SOUND_URL:
100  {
101  for (auto &aIter : sax_fastparser::castToFastAttributeList(xAttrList))
102  {
103  if( aIter.getToken() == XML_ELEMENT(XLINK, XML_HREF) )
104  {
105  uno::Any aAny( GetImport().GetAbsoluteReference( aIter.toString() ) );
106  XMLPropertyState aPropState( rProp.mnIndex, aAny );
107  rProperties.push_back( aPropState );
108  }
109  else
110  XMLOFF_WARN_UNKNOWN("xmloff", aIter);
111  }
112  break;
113  }
114  }
115 
117  xAttrList,
118  rProperties, rProp );
119 }
120 
121 namespace {
122 
123 
124 class SdXMLDrawingPageStyleContext : public XMLDrawingPageStyleContext
125 {
126 public:
127 
128  SdXMLDrawingPageStyleContext(
129  SvXMLImport& rImport,
130  SvXMLStylesContext& rStyles);
131 
132  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
133  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
134 
135  virtual void Finish( bool bOverwrite ) override;
136 };
137 
138 const sal_uInt16 MAX_SPECIAL_DRAW_STYLES = 7;
139 ContextID_Index_Pair const g_ContextIDs[MAX_SPECIAL_DRAW_STYLES+1] =
140 {
141  { CTF_DASHNAME , -1 },
142  { CTF_LINESTARTNAME , -1 },
143  { CTF_LINEENDNAME , -1 },
144  { CTF_FILLGRADIENTNAME, -1 },
145  { CTF_FILLTRANSNAME , -1 },
146  { CTF_FILLHATCHNAME , -1 },
147  { CTF_FILLBITMAPNAME , -1 },
148  { -1, -1 }
149 };
150 XmlStyleFamily const g_Families[MAX_SPECIAL_DRAW_STYLES] =
151 {
159 };
160 
161 }
162 
164  SvXMLImport& rImport,
165  SvXMLStylesContext& rStyles,
166  ContextID_Index_Pair const pContextIDs[],
167  XmlStyleFamily const pFamilies[])
169  , m_pFamilies(pFamilies)
170 {
171  size_t size(1); // for the -1 entry
172  for (ContextID_Index_Pair const* pTemp(pContextIDs); pTemp->nContextID != -1; ++size, ++pTemp);
173  m_pContextIDs.reset(new ContextID_Index_Pair[size]);
174  std::memcpy(m_pContextIDs.get(), pContextIDs, size * sizeof(ContextID_Index_Pair));
175 }
176 
177 SdXMLDrawingPageStyleContext::SdXMLDrawingPageStyleContext(
178  SvXMLImport& rImport,
179  SvXMLStylesContext& rStyles)
180  : XMLDrawingPageStyleContext(rImport, rStyles, g_ContextIDs, g_Families)
181 {
182 }
183 
184 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLDrawingPageStyleContext::createFastChildContext(
185  sal_Int32 nElement,
186  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
187 {
188  if( nElement == XML_ELEMENT(STYLE, XML_DRAWING_PAGE_PROPERTIES) )
189  {
191  GetStyles()->GetImportPropertyMapper( GetFamily() );
192  if( xImpPrMap.is() )
193  return new SdXMLDrawingPagePropertySetContext( GetImport(), nElement,
194  xAttrList,
195  GetProperties(),
196  xImpPrMap );
197  }
198 
199  return XMLPropStyleContext::createFastChildContext( nElement, xAttrList );
200 }
201 
202 void SdXMLDrawingPageStyleContext::Finish( bool bOverwrite )
203 {
204  XMLPropStyleContext::Finish( bOverwrite );
205 
206  ::std::vector< XMLPropertyState > &rProperties = GetProperties();
207 
208  const rtl::Reference< XMLPropertySetMapper >& rImpPrMap = GetStyles()->GetImportPropertyMapper( GetFamily() )->getPropertySetMapper();
209 
210  for(auto& property : rProperties)
211  {
212  if( property.mnIndex == -1 )
213  continue;
214 
215  sal_Int16 nContextID = rImpPrMap->GetEntryContextId(property.mnIndex);
216  switch( nContextID )
217  {
219  {
220  OUString sStyleName;
221  property.maValue >>= sStyleName;
222 
223  sal_Int32 nStyle = 0;
224 
225  const SdXMLNumberFormatImportContext* pSdNumStyle =
226  dynamic_cast< const SdXMLNumberFormatImportContext*> (
227  GetStyles()->FindStyleChildContext( XmlStyleFamily::DATA_STYLE, sStyleName, true ) );
228 
229  if( pSdNumStyle )
230  nStyle = pSdNumStyle->GetDrawKey();
231 
232  property.maValue <<= nStyle;
233  }
234  break;
235  }
236  }
237 
238 }
239 
240 
241 // #i35918#
243  const Reference< beans::XPropertySet > & rPropSet )
244 {
247  SAL_WARN_IF( !xImpPrMap.is(), "xmloff", "There is the import prop mapper" );
248  if( xImpPrMap.is() )
249  xImpPrMap->FillPropertySet(GetProperties(), rPropSet, m_pContextIDs.get());
250 
252  for (size_t i=0; m_pContextIDs[i].nContextID != -1; ++i)
253  {
254  sal_Int32 nIndex = m_pContextIDs[i].nIndex;
255  if( nIndex != -1 )
256  {
257  struct XMLPropertyState& rState = GetProperties()[nIndex];
258  OUString sStyleName;
259  rState.maValue >>= sStyleName;
260  sStyleName = GetImport().GetStyleDisplayName( m_pFamilies[i],
261  sStyleName );
262  // get property set mapper
264  xImpPrMap->getPropertySetMapper();
265 
266  // set property
267  const OUString& rPropertyName =
268  rPropMapper->GetEntryAPIName(rState.mnIndex);
269  if( !xInfo.is() )
270  xInfo = rPropSet->getPropertySetInfo();
271  if ( xInfo->hasPropertyByName( rPropertyName ) )
272  {
273  rPropSet->setPropertyValue( rPropertyName, Any( sStyleName ) );
274  }
275  }
276  }
277 }
278 
279 
281  SdXMLImport& rImport,
282  sal_Int32 /*nElement*/,
283  const uno::Reference< xml::sax::XFastAttributeList>& xAttrList)
285  mnBorderBottom( 0 ),
286  mnBorderLeft( 0 ),
287  mnBorderRight( 0 ),
288  mnBorderTop( 0 ),
289  mnWidth( 0 ),
290  mnHeight( 0 ),
291  meOrientation(GetSdImport().IsDraw() ? view::PaperOrientation_PORTRAIT : view::PaperOrientation_LANDSCAPE)
292 {
293  // set family to something special at SvXMLStyleContext
294  // for differences in search-methods
295 
296  for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
297  {
298  switch(aIter.getToken())
299  {
300  case XML_ELEMENT(FO, XML_MARGIN_TOP):
301  case XML_ELEMENT(FO_COMPAT, XML_MARGIN_TOP):
302  {
304  mnBorderTop, aIter.toView());
305  break;
306  }
307  case XML_ELEMENT(FO, XML_MARGIN_BOTTOM):
308  case XML_ELEMENT(FO_COMPAT, XML_MARGIN_BOTTOM):
309  {
311  mnBorderBottom, aIter.toView());
312  break;
313  }
314  case XML_ELEMENT(FO, XML_MARGIN_LEFT):
315  case XML_ELEMENT(FO_COMPAT, XML_MARGIN_LEFT):
316  {
318  mnBorderLeft, aIter.toView());
319  break;
320  }
321  case XML_ELEMENT(FO, XML_MARGIN_RIGHT):
322  case XML_ELEMENT(FO_COMPAT, XML_MARGIN_RIGHT):
323  {
325  mnBorderRight, aIter.toView());
326  break;
327  }
328  case XML_ELEMENT(FO, XML_PAGE_WIDTH):
329  case XML_ELEMENT(FO_COMPAT, XML_PAGE_WIDTH):
330  {
332  mnWidth, aIter.toView());
333  break;
334  }
335  case XML_ELEMENT(FO, XML_PAGE_HEIGHT):
336  case XML_ELEMENT(FO_COMPAT, XML_PAGE_HEIGHT):
337  {
339  mnHeight, aIter.toView());
340  break;
341  }
343  {
344  if( IsXMLToken( aIter, XML_PORTRAIT ) )
345  meOrientation = view::PaperOrientation_PORTRAIT;
346  else
347  meOrientation = view::PaperOrientation_LANDSCAPE;
348  break;
349  }
350  default:
351  XMLOFF_WARN_UNKNOWN("xmloff", aIter);
352  }
353  }
354 }
355 
357 {
358 }
359 
360 
362  SdXMLImport& rImport,
363  sal_Int32 /*nElement*/,
364  const uno::Reference< xml::sax::XFastAttributeList>& /*xAttrList*/)
366 {
367  // set family to something special at SvXMLStyleContext
368  // for differences in search-methods
369 
370 }
371 
372 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLPageMasterContext::createFastChildContext(
373  sal_Int32 nElement,
374  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
375 {
377  {
378  DBG_ASSERT(!mxPageMasterStyle.is(), "PageMasterStyle is set, there seem to be two of them (!)");
379  mxPageMasterStyle.set(new SdXMLPageMasterStyleContext(GetSdImport(), nElement, xAttrList));
380  return mxPageMasterStyle;
381  }
382  else
383  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
384 
385  return nullptr;
386 }
387 
389  SdXMLImport& rImport,
390  sal_Int32 /*nElement*/,
391  const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/)
393  mnTypeId( AUTOLAYOUT_NONE )
394 {
395  // set family to something special at SvXMLStyleContext
396  // for differences in search-methods
397 }
398 
399 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLPresentationPageLayoutContext::createFastChildContext(
400  sal_Int32 nElement,
401  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
402 {
403  SvXMLImportContextRef xContext;
404 
405  if(nElement == XML_ELEMENT(PRESENTATION, XML_PLACEHOLDER))
406  {
408  new SdXMLPresentationPlaceholderContext(GetSdImport(), nElement, xAttrList)};
409  // presentation:placeholder inside style:presentation-page-layout context
410  xContext = xLclContext.get();
411 
412  // remember SdXMLPresentationPlaceholderContext for later evaluation
413  maList.push_back(xLclContext);
414  }
415  else
416  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
417 
418  return xContext;
419 }
420 
422 {
423  // build presentation page layout type here
424  // calc mnTpeId due to content of maList
425  // at the moment only use number of types used there
426  if( maList.empty() )
427  return;
428 
429  SdXMLPresentationPlaceholderContext* pObj0 = maList[ 0 ].get();
430  if( pObj0->GetName() == "handout" )
431  {
432  switch( maList.size() )
433  {
434  case 1:
436  break;
437  case 2:
439  break;
440  case 3:
442  break;
443  case 4:
445  break;
446  case 9:
448  break;
449  default:
451  }
452  }
453  else
454  {
455  switch( maList.size() )
456  {
457  case 1:
458  {
459  if( pObj0->GetName() == "title" )
460  {
462  }
463  else
464  {
466  }
467  break;
468  }
469  case 2:
470  {
471  SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ].get();
472 
473  if( pObj1->GetName() == "subtitle" )
474  {
476  }
477  else if( pObj1->GetName() == "outline" )
478  {
480  }
481  else if( pObj1->GetName() == "chart" )
482  {
484  }
485  else if( pObj1->GetName() == "table" )
486  {
488  }
489  else if( pObj1->GetName() == "object" )
490  {
492  }
493  else if( pObj1->GetName() == "vertical_outline" )
494  {
495  if( pObj0->GetName() == "vertical_title" )
496  {
498  }
499  else
500  {
502  }
503  }
504  else
505  {
507  }
508  break;
509  }
510  case 3:
511  {
512  SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ].get();
513  SdXMLPresentationPlaceholderContext* pObj2 = maList[ 2 ].get();
514 
515  if( pObj1->GetName() == "outline" )
516  {
517  if( pObj2->GetName() == "outline" )
518  {
520  }
521  else if( pObj2->GetName() == "chart" )
522  {
524  }
525  else if( pObj2->GetName() == "graphic" )
526  {
528  }
529  else
530  {
531  if(pObj1->GetX() < pObj2->GetX())
532  {
533  mnTypeId = AUTOLAYOUT_TEXTOBJ; // outline left, object right
534  }
535  else
536  {
537  mnTypeId = AUTOLAYOUT_TEXTOVEROBJ; // outline top, object right
538  }
539  }
540  }
541  else if( pObj1->GetName() == "chart" )
542  {
544  }
545  else if( pObj1->GetName() == "graphic" )
546  {
547  if( pObj2->GetName() == "vertical_outline" )
548  {
550  }
551  else
552  {
554  }
555  }
556  else if( pObj1->GetName() == "vertical_outline" )
557  {
559  }
560  else
561  {
562  if(pObj1->GetX() < pObj2->GetX())
563  {
564  mnTypeId = AUTOLAYOUT_OBJTEXT; // left, right
565  }
566  else
567  {
569  }
570  }
571  break;
572  }
573  case 4:
574  {
575  SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ].get();
576  SdXMLPresentationPlaceholderContext* pObj2 = maList[ 2 ].get();
577 
578  if( pObj1->GetName() == "object" )
579  {
580  if(pObj1->GetX() < pObj2->GetX())
581  {
583  }
584  else
585  {
587  }
588  }
589  else
590  {
592  }
593  break;
594  }
595  case 5:
596  {
597  SdXMLPresentationPlaceholderContext* pObj1 = maList[ 1 ].get();
598 
599  if( pObj1->GetName() == "object" )
600  {
602  }
603  else
604  {
606  }
607  break;
608 
609  }
610  case 7:
611  {
612  mnTypeId = AUTOLAYOUT_4CLIPART; // FIXME: not AUTOLAYOUT_TITLE_6CONTENT?
613  break;
614  }
615  default:
616  {
618  break;
619  }
620  }
621  }
622 
623  // release remembered contexts, they are no longer needed
624  maList.clear();
625 }
626 
628  SdXMLImport& rImport,
629  sal_Int32 /*nElement*/,
630  const uno::Reference< xml::sax::XFastAttributeList>& xAttrList)
631 : SvXMLImportContext( rImport ),
632  mnX(0)
633 {
634  for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
635  {
636  switch(aIter.getToken())
637  {
638  case XML_ELEMENT(PRESENTATION, XML_OBJECT):
639  {
640  msName = aIter.toString();
641  break;
642  }
643  case XML_ELEMENT(SVG, XML_X):
644  case XML_ELEMENT(SVG_COMPAT, XML_X):
645  {
647  mnX, aIter.toView());
648  break;
649  }
650  case XML_ELEMENT(SVG, XML_Y):
651  case XML_ELEMENT(SVG_COMPAT, XML_Y):
652  {
653  break;
654  }
655  case XML_ELEMENT(SVG, XML_WIDTH):
656  case XML_ELEMENT(SVG_COMPAT, XML_WIDTH):
657  {
658  break;
659  }
660  case XML_ELEMENT(SVG, XML_HEIGHT):
661  case XML_ELEMENT(SVG_COMPAT, XML_HEIGHT):
662  {
663  break;
664  }
665  default:
666  XMLOFF_WARN_UNKNOWN("xmloff", aIter);
667  }
668  }
669 }
670 
672 {
673 }
674 
675 
677  SdXMLImport& rImport,
678  sal_Int32 nElement,
679  const uno::Reference< xml::sax::XFastAttributeList>& xAttrList,
680  uno::Reference< drawing::XShapes > const & rShapes)
681 : SdXMLGenericPageContext( rImport, xAttrList, rShapes )
682 {
683  const bool bHandoutMaster = (nElement & TOKEN_MASK) == XML_HANDOUT_MASTER;
684  OUString sStyleName, sPageMasterName;
685 
686  for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
687  {
688  const OUString sValue = aIter.toString();
689  switch(aIter.getToken())
690  {
691  case XML_ELEMENT(STYLE, XML_NAME):
692  {
693  msName = sValue;
694  break;
695  }
697  {
698  msDisplayName = sValue;
699  break;
700  }
702  {
703  sPageMasterName = sValue;
704  break;
705  }
707  {
708  sStyleName = sValue;
709  break;
710  }
712  {
713  maPageLayoutName = sValue;
714  break;
715  }
716  case XML_ELEMENT(PRESENTATION, XML_USE_HEADER_NAME):
717  {
718  maUseHeaderDeclName = sValue;
719  break;
720  }
721  case XML_ELEMENT(PRESENTATION, XML_USE_FOOTER_NAME):
722  {
723  maUseFooterDeclName = sValue;
724  break;
725  }
726  case XML_ELEMENT(PRESENTATION, XML_USE_DATE_TIME_NAME):
727  {
728  maUseDateTimeDeclName = sValue;
729  break;
730  }
731  default:
732  XMLOFF_WARN_UNKNOWN("xmloff", aIter);
733  }
734  }
735 
736  if( msDisplayName.isEmpty() )
738  else if( msDisplayName != msName )
740 
741  GetImport().GetShapeImport()->startPage( GetLocalShapesContext() );
742 
743  // set page name?
744  if(!bHandoutMaster && !msDisplayName.isEmpty() && GetLocalShapesContext().is())
745  {
746  uno::Reference < container::XNamed > xNamed(GetLocalShapesContext(), uno::UNO_QUERY);
747  if(xNamed.is())
748  xNamed->setName(msDisplayName);
749  }
750 
751  // set page-master?
752  if(!sPageMasterName.isEmpty())
753  {
754  SetPageMaster( sPageMasterName );
755  }
756 
757  SetStyle( sStyleName );
758 
759  SetLayout();
760 
761  DeleteAllShapes();
762 }
763 
765 {
766 }
767 
769 {
770  // set styles on master-page
771  if(!msName.isEmpty() && GetSdImport().GetShapeImport()->GetStylesContext())
772  {
773  SvXMLImportContext* pContext = GetSdImport().GetShapeImport()->GetStylesContext();
774  if (SdXMLStylesContext* pSdContext = dynamic_cast<SdXMLStylesContext*>(pContext))
775  pSdContext->SetMasterPageStyles(*this);
776  }
777 
780 }
781 
782 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLMasterPageContext::createFastChildContext(
783  sal_Int32 nElement,
784  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
785 {
786  switch (nElement)
787  {
788  // some special objects inside style:masterpage context
789  case XML_ELEMENT(STYLE, XML_STYLE):
790  {
791  if(GetSdImport().GetShapeImport()->GetStylesContext())
792  {
793  // style:style inside master-page context -> presentation style
795  GetSdImport(),
796  *GetSdImport().GetShapeImport()->GetStylesContext(),
798 
799  // add this style to the outer StylesContext class for later processing
800  GetSdImport().GetShapeImport()->GetStylesContext()->AddStyle(*pNew);
801  return pNew;
802  }
803  break;
804  }
805  case XML_ELEMENT(PRESENTATION, XML_NOTES):
806  {
807  if( GetSdImport().IsImpress() )
808  {
809  // get notes page
810  uno::Reference< presentation::XPresentationPage > xPresPage(GetLocalShapesContext(), uno::UNO_QUERY);
811  if(xPresPage.is())
812  {
813  uno::Reference< drawing::XDrawPage > xNotesDrawPage = xPresPage->getNotesPage();
814  if(xNotesDrawPage.is())
815  {
816  // presentation:notes inside master-page context
817  return new SdXMLNotesContext( GetSdImport(), xAttrList, xNotesDrawPage);
818  }
819  }
820  }
821  }
822  }
823  return SdXMLGenericPageContext::createFastChildContext(nElement, xAttrList);
824 }
825 
827  SdXMLImport& rImport,
828  bool bIsAutoStyle)
829 : SvXMLStylesContext(rImport),
830  mbIsAutoStyle(bIsAutoStyle)
831 {
833  mpNumFormatter = std::make_unique<SvNumberFormatter>( xContext, LANGUAGE_SYSTEM );
834  mpNumFmtHelper = std::make_unique<SvXMLNumFmtHelper>( mpNumFormatter.get(), xContext );
835 }
836 
838  sal_Int32 nElement,
839  const uno::Reference< xml::sax::XFastAttributeList >& xAttrList)
840 {
841  switch (nElement)
842  {
844  {
845  auto pContext = GetImport().GetShapeImport()->GetShapeTableImport()->CreateTableTemplateContext(nElement, xAttrList );
846  if (pContext)
847  return pContext;
848  break;
849  }
851  // style:page-master inside office:styles context
852  return new SdXMLPageMasterContext(GetSdImport(), nElement, xAttrList);
854  // style:presentation-page-layout inside office:styles context
855  return new SdXMLPresentationPageLayoutContext(GetSdImport(), nElement, xAttrList);
857  // number:date-style or number:time-style
858  return new SdXMLNumberFormatImportContext( GetSdImport(), nElement, mpNumFmtHelper->getData(), SvXMLStylesTokens::DATE_STYLE, xAttrList, *this );
860  // number:date-style or number:time-style
861  return new SdXMLNumberFormatImportContext( GetSdImport(), nElement, mpNumFmtHelper->getData(), SvXMLStylesTokens::TIME_STYLE, xAttrList, *this );
863  return new SvXMLNumFormatContext( GetSdImport(), nElement,
864  mpNumFmtHelper->getData(), SvXMLStylesTokens::NUMBER_STYLE, xAttrList, *this );
866  return new SvXMLNumFormatContext( GetSdImport(), nElement,
867  mpNumFmtHelper->getData(), SvXMLStylesTokens::CURRENCY_STYLE, xAttrList, *this );
869  return new SvXMLNumFormatContext( GetSdImport(), nElement,
870  mpNumFmtHelper->getData(), SvXMLStylesTokens::PERCENTAGE_STYLE, xAttrList, *this );
872  return new SvXMLNumFormatContext( GetSdImport(), nElement,
873  mpNumFmtHelper->getData(), SvXMLStylesTokens::BOOLEAN_STYLE, xAttrList, *this );
875  return new SvXMLNumFormatContext( GetSdImport(), nElement,
876  mpNumFmtHelper->getData(), SvXMLStylesTokens::TEXT_STYLE, xAttrList, *this );
877  case XML_ELEMENT(PRESENTATION, XML_HEADER_DECL):
878  case XML_ELEMENT(PRESENTATION, XML_FOOTER_DECL):
879  case XML_ELEMENT(PRESENTATION, XML_DATE_TIME_DECL):
880  return new SdXMLHeaderFooterDeclContext( GetImport(), xAttrList );
881  case XML_ELEMENT(STYLE, XML_STYLE):
882  break; // ignore
883  default:
884  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
885  }
886 
887  // call base class
888  return SvXMLStylesContext::CreateStyleChildContext(nElement, xAttrList);
889 }
890 
892  XmlStyleFamily nFamily,
893  sal_Int32 nElement,
894  const uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
895 {
896  switch( nFamily )
897  {
899  return new SdXMLDrawingPageStyleContext(GetSdImport(), *this );
903  return new XMLShapeStyleContext( GetSdImport(), *this, nFamily );
904  default: break;
905  }
906 
907  // call base class
908  return SvXMLStylesContext::CreateStyleStyleChildContext(nFamily, nElement, xAttrList);
909 }
910 
912  XmlStyleFamily nFamily,
913  sal_Int32 nElement,
914  const Reference< XFastAttributeList > & xAttrList )
915 {
916  switch( nFamily )
917  {
919  return new XMLGraphicsDefaultStyle(GetSdImport(), *this );
920  default: break;
921  }
922 
923  // call base class
924  return SvXMLStylesContext::CreateDefaultStyleStyleChildContext(nFamily, nElement, xAttrList);
925 }
926 
928  XmlStyleFamily nFamily) const
929 {
931 
932  switch( nFamily )
933  {
935  {
936  if(!xPresImpPropMapper.is())
937  {
938  rtl::Reference< XMLShapeImportHelper > aImpHelper = const_cast<SvXMLImport&>(GetImport()).GetShapeImport();
939  const_cast<SdXMLStylesContext*>(this)->xPresImpPropMapper =
940  aImpHelper->GetPresPagePropsMapper();
941  }
942  xMapper = xPresImpPropMapper;
943  break;
944  }
945 
949  {
950  const rtl::Reference< XMLTableImport >& xTableImport( const_cast< SvXMLImport& >( GetImport() ).GetShapeImport()->GetShapeTableImport() );
951 
952  switch( nFamily )
953  {
954  case XmlStyleFamily::TABLE_COLUMN: xMapper = xTableImport->GetColumnImportPropertySetMapper().get(); break;
955  case XmlStyleFamily::TABLE_ROW: xMapper = xTableImport->GetRowImportPropertySetMapper().get(); break;
956  case XmlStyleFamily::TABLE_CELL: xMapper = xTableImport->GetCellImportPropertySetMapper().get(); break;
957  default: break;
958  }
959  break;
960  }
961  default: break;
962  }
963 
964  // call base class
965  if( !xMapper.is() )
967  return xMapper;
968 }
969 
970 // Process all style and object info
971 
973 {
974  if(mbIsAutoStyle)
975  {
976  // AutoStyles for text import
977  GetImport().GetTextImport()->SetAutoStyles( this );
978 
979  // AutoStyles for chart
980  GetImport().GetChartImport()->SetAutoStylesContext( this );
981 
982  // AutoStyles for forms
983  GetImport().GetFormImport()->setAutoStyleContext( this );
984 
985  // associate AutoStyles with styles in preparation to setting Styles on shapes
986  for(sal_uInt32 a(0); a < GetStyleCount(); a++)
987  {
988  const SvXMLStyleContext* pStyle = GetStyle(a);
989  if (const XMLShapeStyleContext* pDocStyle = dynamic_cast<const XMLShapeStyleContext*>(pStyle))
990  {
991  SvXMLStylesContext* pStylesContext = GetSdImport().GetShapeImport()->GetStylesContext();
992  if (pStylesContext)
993  {
994  pStyle = pStylesContext->FindStyleChildContext(pStyle->GetFamily(), pStyle->GetParentName());
995 
996  if (const XMLShapeStyleContext* pParentStyle = dynamic_cast<const XMLShapeStyleContext*>(pStyle))
997  {
998  if(pParentStyle->GetStyle().is())
999  {
1000  const_cast<XMLShapeStyleContext*>(pDocStyle)->SetStyle(pParentStyle->GetStyle());
1001  }
1002  }
1003  }
1004  }
1005  }
1006 
1007  FinishStyles( false );
1008  }
1009  else
1010  {
1011  // Process styles list
1013  ImpSetCellStyles();
1014  GetImport().GetShapeImport()->GetShapeTableImport()->finishStyles();
1015 
1016  // put style infos in the info set for other components ( content import f.e. )
1017  uno::Reference< beans::XPropertySet > xInfoSet( GetImport().getImportInfo() );
1018  if( xInfoSet.is() )
1019  {
1020  uno::Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
1021 
1022  if( xInfoSetInfo->hasPropertyByName("PageLayouts") )
1023  xInfoSet->setPropertyValue("PageLayouts", uno::makeAny( getPageLayouts() ) );
1024  }
1025 
1026  }
1027 }
1028 
1029 // set master-page styles (all with family="presentation" and a special
1030 // prefix) on given master-page.
1031 
1033 {
1034  const uno::Reference<container::XNameAccess>& rStyleFamilies =
1036 
1037  if (!rStyleFamilies.is())
1038  return;
1039 
1040  if (!rStyleFamilies->hasByName(rMaster.GetDisplayName()))
1041  return;
1042 
1043  try
1044  {
1045  uno::Reference< container::XNameAccess > xMasterPageStyles( rStyleFamilies->getByName(rMaster.GetDisplayName()), UNO_QUERY_THROW );
1046  OUString sPrefix(rMaster.GetDisplayName() + "-");
1048  }
1049  catch (const uno::Exception&)
1050  {
1051  TOOLS_WARN_EXCEPTION("xmloff.draw", "");
1052  }
1053 }
1054 
1055 // Process styles list:
1056 // set graphic styles (all with family="graphics"). Remember xStyle at list element.
1057 
1059 {
1060  if(GetSdImport().GetLocalDocStyleFamilies().is()) try
1061  {
1062  uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName("graphics"), uno::UNO_QUERY_THROW );
1063 
1064  ImpSetGraphicStyles(xGraphicPageStyles, XmlStyleFamily::SD_GRAPHICS_ID, OUString());
1065  }
1066  catch( uno::Exception& )
1067  {
1068  TOOLS_WARN_EXCEPTION("xmloff.draw", "");
1069  }
1070 }
1071 
1073 {
1074  if(GetSdImport().GetLocalDocStyleFamilies().is()) try
1075  {
1076  uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName("cell"), uno::UNO_QUERY_THROW );
1077 
1078  ImpSetGraphicStyles(xGraphicPageStyles, XmlStyleFamily::TABLE_CELL, OUString());
1079  }
1080  catch( uno::Exception& )
1081  {
1082  TOOLS_WARN_EXCEPTION("xmloff.draw", "");
1083  }
1084 }
1085 
1086 //Resolves: fdo#34987 if the style's auto height before and after is the same
1087 //then don't reset it back to the underlying default of true for the small
1088 //period before it's going to be reset to false again. Doing this avoids the
1089 //master page shapes from resizing themselves due to autoheight becoming
1090 //enabled before having autoheight turned off again and getting stuck on that
1091 //autosized height
1092 static bool canSkipReset(std::u16string_view rName, const XMLPropStyleContext* pPropStyle,
1093  const uno::Reference< beans::XPropertySet > &rPropSet, const rtl::Reference < XMLPropertySetMapper >& rPrMap)
1094 {
1095  bool bCanSkipReset = false;
1096  if (pPropStyle && rName == u"TextAutoGrowHeight")
1097  {
1098  bool bOldStyleTextAutoGrowHeight(false);
1099  rPropSet->getPropertyValue("TextAutoGrowHeight") >>= bOldStyleTextAutoGrowHeight;
1100 
1101  sal_Int32 nIndexStyle = rPrMap->GetEntryIndex(XML_NAMESPACE_DRAW, u"auto-grow-height", 0);
1102  if (nIndexStyle != -1)
1103  {
1104  const ::std::vector< XMLPropertyState > &rProperties = pPropStyle->GetProperties();
1105  auto property = std::find_if(rProperties.cbegin(), rProperties.cend(),
1106  [nIndexStyle](const XMLPropertyState& rProp) { return rProp.mnIndex == nIndexStyle; });
1107  if (property != rProperties.cend())
1108  {
1109  bool bNewStyleTextAutoGrowHeight(false);
1110  property->maValue >>= bNewStyleTextAutoGrowHeight;
1111  bCanSkipReset = (bNewStyleTextAutoGrowHeight == bOldStyleTextAutoGrowHeight);
1112  }
1113  }
1114  }
1115  return bCanSkipReset;
1116 }
1117 
1118 // help function used by ImpSetGraphicStyles() and ImpSetMasterPageStyles()
1119 
1120 void SdXMLStylesContext::ImpSetGraphicStyles( uno::Reference< container::XNameAccess > const & xPageStyles, XmlStyleFamily nFamily, const OUString& rPrefix) const
1121 {
1122  sal_Int32 nPrefLen(rPrefix.getLength());
1123 
1124  sal_uInt32 a;
1125 
1126  // set defaults
1127  for( a = 0; a < GetStyleCount(); a++)
1128  {
1129  const SvXMLStyleContext* pStyle = GetStyle(a);
1130 
1131  if(nFamily == pStyle->GetFamily() && pStyle->IsDefaultStyle())
1132  {
1133  const_cast<SvXMLStyleContext*>(pStyle)->SetDefaults();
1134  }
1135  }
1136 
1137  // create all styles and set properties
1138  for( a = 0; a < GetStyleCount(); a++)
1139  {
1140  try
1141  {
1142  const SvXMLStyleContext* pStyle = GetStyle(a);
1143  if(nFamily == pStyle->GetFamily() && !pStyle->IsDefaultStyle())
1144  {
1145  OUString aStyleName(pStyle->GetDisplayName());
1146 
1147  if( nPrefLen )
1148  {
1149  sal_Int32 nStylePrefLen = aStyleName.lastIndexOf( '-' ) + 1;
1150  if( (nPrefLen != nStylePrefLen) || !aStyleName.startsWith(rPrefix) )
1151  continue;
1152 
1153  aStyleName = aStyleName.copy( nPrefLen );
1154  }
1155 
1156  XMLPropStyleContext* pPropStyle = dynamic_cast< XMLPropStyleContext* >(const_cast< SvXMLStyleContext* >( pStyle ) );
1157 
1158  uno::Reference< style::XStyle > xStyle;
1159  if(xPageStyles->hasByName(aStyleName))
1160  {
1161  xPageStyles->getByName(aStyleName) >>= xStyle;
1162 
1163  // set properties of existing styles to default
1164  uno::Reference< beans::XPropertySet > xPropSet( xStyle, uno::UNO_QUERY );
1165  uno::Reference< beans::XPropertySetInfo > xPropSetInfo;
1166  if( xPropSet.is() )
1167  xPropSetInfo = xPropSet->getPropertySetInfo();
1168 
1169  uno::Reference< beans::XPropertyState > xPropState( xStyle, uno::UNO_QUERY );
1170 
1171  if( xPropState.is() )
1172  {
1175  SAL_WARN_IF( !xImpPrMap.is(), "xmloff", "There is the import prop mapper" );
1176  if( xImpPrMap.is() )
1177  xPrMap = xImpPrMap->getPropertySetMapper();
1178  if( xPrMap.is() )
1179  {
1180  const sal_Int32 nCount = xPrMap->GetEntryCount();
1181  for( sal_Int32 i = 0; i < nCount; i++ )
1182  {
1183  const OUString& rName = xPrMap->GetEntryAPIName( i );
1184  if( xPropSetInfo->hasPropertyByName( rName ) && beans::PropertyState_DIRECT_VALUE == xPropState->getPropertyState( rName ) )
1185  {
1186  bool bCanSkipReset = canSkipReset(rName, pPropStyle, xPropSet, xPrMap);
1187  if (bCanSkipReset)
1188  continue;
1189  xPropState->setPropertyToDefault( rName );
1190  }
1191  }
1192  }
1193  }
1194  }
1195  else
1196  {
1197  // graphics style does not exist, create and add it
1198  uno::Reference< lang::XSingleServiceFactory > xServiceFact(xPageStyles, uno::UNO_QUERY);
1199  if(xServiceFact.is())
1200  {
1201  uno::Reference< style::XStyle > xNewStyle( xServiceFact->createInstance(), uno::UNO_QUERY);
1202 
1203  if(xNewStyle.is())
1204  {
1205  // remember style
1206  xStyle = xNewStyle;
1207 
1208  // add new style to graphics style pool
1209  uno::Reference< container::XNameContainer > xInsertContainer(xPageStyles, uno::UNO_QUERY);
1210  if(xInsertContainer.is())
1211  xInsertContainer->insertByName(aStyleName, uno::Any( xStyle ) );
1212  }
1213  }
1214  }
1215 
1216  if(xStyle.is())
1217  {
1218  // set properties at style
1219  uno::Reference< beans::XPropertySet > xPropSet(xStyle, uno::UNO_QUERY);
1220  if(xPropSet.is() && pPropStyle)
1221  {
1222  pPropStyle->FillPropertySet(xPropSet);
1223  pPropStyle->SetStyle(xStyle);
1224  }
1225  }
1226  }
1227  }
1228  catch(const Exception& e)
1229  {
1230  const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, {}, e.Message, nullptr );
1231  }
1232  }
1233 
1234  // now set parents for all styles (when necessary)
1235  for(a = 0; a < GetStyleCount(); a++)
1236  {
1237  const SvXMLStyleContext* pStyle = GetStyle(a);
1238 
1239  if(pStyle && !pStyle->GetDisplayName().isEmpty() && (nFamily == pStyle->GetFamily())) try
1240  {
1241  OUString aStyleName(pStyle->GetDisplayName());
1242  if( nPrefLen )
1243  {
1244  sal_Int32 nStylePrefLen = aStyleName.lastIndexOf( '-' ) + 1;
1245  if( (nPrefLen != nStylePrefLen) || !aStyleName.startsWith( rPrefix ) )
1246  continue;
1247 
1248  aStyleName = aStyleName.copy( nPrefLen );
1249  }
1250 
1251  uno::Reference< style::XStyle > xStyle( xPageStyles->getByName(aStyleName), UNO_QUERY );
1252  if(xStyle.is())
1253  {
1254  // set parent style name
1255  OUString sParentStyleDisplayName( GetImport().GetStyleDisplayName( pStyle->GetFamily(), pStyle->GetParentName() ) );
1256  if( nPrefLen )
1257  {
1258  sal_Int32 nStylePrefLen = sParentStyleDisplayName.lastIndexOf( '-' ) + 1;
1259  if( (nPrefLen != nStylePrefLen) || !sParentStyleDisplayName.startsWith( rPrefix ) )
1260  continue;
1261 
1262  sParentStyleDisplayName = sParentStyleDisplayName.copy( nPrefLen );
1263  }
1264  xStyle->setParentStyle( sParentStyleDisplayName );
1265  }
1266  }
1267  catch( const Exception& e )
1268  {
1269  const_cast<SdXMLImport*>(&GetSdImport())->SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, {}, e.Message, nullptr );
1270  }
1271  }
1272 }
1273 
1274 // helper function to create the uno component that hold the mappings from
1275 // xml auto layout name to internal autolayout id
1276 
1277 uno::Reference< container::XNameAccess > SdXMLStylesContext::getPageLayouts() const
1278 {
1279  uno::Reference< container::XNameContainer > xLayouts( comphelper::NameContainer_createInstance( ::cppu::UnoType<sal_Int32>::get()) );
1280 
1281  for(sal_uInt32 a(0); a < GetStyleCount(); a++)
1282  {
1283  const SvXMLStyleContext* pStyle = GetStyle(a);
1284  if (const SdXMLPresentationPageLayoutContext* pContext = dynamic_cast<const SdXMLPresentationPageLayoutContext*>(pStyle))
1285  {
1286  xLayouts->insertByName(pStyle->GetName(), uno::makeAny(static_cast<sal_Int32>(pContext->GetTypeId())));
1287  }
1288  }
1289 
1290  return xLayouts;
1291 }
1292 
1293 
1295  SdXMLImport& rImport)
1296 : SvXMLImportContext( rImport )
1297 {
1298 }
1299 
1300 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLMasterStylesContext::createFastChildContext(
1301  sal_Int32 nElement,
1302  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
1303 {
1304  if( nElement == XML_ELEMENT(DRAW, XML_LAYER_SET) )
1305  {
1306  return new SdXMLLayerSetContext( GetImport() );
1307  }
1308  else if( nElement == XML_ELEMENT(STYLE, XML_MASTER_PAGE) )
1309  {
1310  // style:masterpage inside office:styles context
1311  uno::Reference< drawing::XDrawPage > xNewMasterPage;
1312  uno::Reference< drawing::XDrawPages > xMasterPages(GetSdImport().GetLocalMasterPages(), uno::UNO_QUERY);
1313 
1314  if( xMasterPages.is() )
1315  {
1316  sal_Int32 nNewMasterPageCount = GetSdImport().GetNewMasterPageCount();
1317  sal_Int32 nMasterPageCount = xMasterPages->getCount();
1318  if (nNewMasterPageCount + 1 > nMasterPageCount)
1319  {
1320  // arbitrary limit to master pages when fuzzing to avoid deadend timeouts
1321  if (nMasterPageCount >= 64 && utl::ConfigManager::IsFuzzing())
1322  return nullptr;
1323 
1324  // new page, create and insert
1325  xNewMasterPage = xMasterPages->insertNewByIndex(nMasterPageCount);
1326  }
1327  else
1328  {
1329  // existing page, use it
1330  xMasterPages->getByIndex(nNewMasterPageCount) >>= xNewMasterPage;
1331  }
1332 
1333  // increment global import page counter
1335 
1336  if(xNewMasterPage.is())
1337  {
1338  if(GetSdImport().GetShapeImport()->GetStylesContext())
1339  {
1340  const rtl::Reference<SdXMLMasterPageContext> xLclContext{
1342  nElement, xAttrList, xNewMasterPage)};
1343  maMasterPageList.push_back(xLclContext);
1344  return xLclContext;
1345  }
1346  }
1347  }
1348  }
1349  else if( nElement == XML_ELEMENT(STYLE, XML_HANDOUT_MASTER) )
1350  {
1351  uno::Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetSdImport().GetModel(), uno::UNO_QUERY );
1352  if( xHandoutSupp.is() )
1353  {
1354  uno::Reference< drawing::XShapes > xHandoutPage = xHandoutSupp->getHandoutMasterPage();
1355  if(xHandoutPage.is() && GetSdImport().GetShapeImport()->GetStylesContext())
1356  {
1357  return new SdXMLMasterPageContext(GetSdImport(),
1358  nElement, xAttrList, xHandoutPage);
1359  }
1360  }
1361  }
1362  else
1363  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
1364  return nullptr;
1365 }
1366 
1368  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList)
1369  : SvXMLStyleContext( rImport )
1370  , mbFixed(false)
1371 {
1372  for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
1373  {
1374  if( aIter.getToken() == XML_ELEMENT(PRESENTATION, XML_NAME) )
1375  {
1376  maStrName = aIter.toString();
1377  }
1378  else if( aIter.getToken() == XML_ELEMENT(PRESENTATION, XML_SOURCE) )
1379  {
1380  mbFixed = IsXMLToken( aIter, XML_FIXED );
1381  }
1382  else if( aIter.getToken() == XML_ELEMENT(STYLE, XML_DATA_STYLE_NAME) )
1383  {
1384  maStrDateTimeFormat = aIter.toString();
1385  }
1386  else
1387  {
1388  XMLOFF_WARN_UNKNOWN("xmloff", aIter);
1389  }
1390  }
1391 }
1392 
1394 {
1395  return true;
1396 }
1397 
1399 {
1400  SdXMLImport& rImport = dynamic_cast<SdXMLImport&>(GetImport());
1401  auto nElement = nToken & TOKEN_MASK;
1402  if( nElement == XML_HEADER_DECL )
1403  {
1404  rImport.AddHeaderDecl( maStrName, maStrText );
1405  }
1406  else if( nElement == XML_FOOTER_DECL )
1407  {
1408  rImport.AddFooterDecl( maStrName, maStrText );
1409  }
1410  else if( nElement == XML_DATE_TIME_DECL )
1411  {
1413  }
1414  else
1415  {
1416  XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nToken);
1417  }
1418 }
1419 
1420 void SdXMLHeaderFooterDeclContext::characters( const OUString& rChars )
1421 {
1422  maStrText += rChars;
1423 }
1424 
1425 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int16 nContextID
Definition: xmlimppr.hxx:58
double mnHeight
void SetLayout()
sets the presentation layout at this page.
Definition: ximppage.cxx:406
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
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: prstylei.cxx:175
std::vector< rtl::Reference< SdXMLMasterPageContext > > maMasterPageList
Definition: ximpstyl.hxx:215
Title, 2 Content and Content.
Definition: autolayout.hxx:42
Title, 4 Content.
Definition: autolayout.hxx:45
bool convertMeasureToCore(sal_Int32 &rValue, std::u16string_view rString, sal_Int32 nMin=SAL_MIN_INT32, sal_Int32 nMax=SAL_MAX_INT32) const
convert string to measure with meCoreMeasureUnit, using optional min and max values ...
Definition: xmluconv.cxx:186
sal_Int32 nIndex
void AddFooterDecl(const OUString &rName, const OUString &rText)
Definition: sdxmlimp.cxx:601
COMPHELPER_DLLPUBLIC css::uno::Reference< css::container::XNameContainer > NameContainer_createInstance(const css::uno::Type &aType)
const css::uno::Reference< css::container::XNameAccess > & GetLocalDocStyleFamilies() const
rtl::Reference< ::xmloff::OFormLayerXMLImport > const & GetFormImport()
Definition: xmlimp.hxx:623
int SetError()
void SetPageMaster(OUString const &rsPageMasterName)
sets the properties from a page master style with the given name on this contexts page ...
Definition: ximppage.cxx:468
rtl::Reference< SdXMLPageMasterStyleContext > mxPageMasterStyle
Definition: ximpstyl.hxx:72
OUString maUseHeaderDeclName
Definition: ximppage.hxx:37
Title, Content.
Definition: autolayout.hxx:28
#define CTF_LINEENDNAME
Definition: xmlsdtypes.hxx:136
sal_Int32 GetNewMasterPageCount() const
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:59
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpstyl.cxx:421
const SdXMLImport & GetSdImport() const
Definition: ximppage.hxx:51
SvXMLStyleContext * GetStyle(sal_uInt32 i)
Definition: xmlstyle.cxx:296
sal_Int32 mnIndex
Definition: maptype.hxx:124
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximppage.cxx:273
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
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
#define CTF_FILLGRADIENTNAME
Definition: xmlsdtypes.hxx:137
OUString maUseFooterDeclName
Definition: ximppage.hxx:38
#define CTF_FILLTRANSNAME
Definition: xmlsdtypes.hxx:140
rtl::Reference< XMLTextImportHelper > const & GetTextImport()
Definition: xmlimp.hxx:599
rtl::Reference< SchXMLImportHelper > const & GetChartImport()
Definition: xmlimp.hxx:615
#define XMLERROR_API
Definition: xmlerror.hxx:71
XmlStyleFamily
Definition: families.hxx:47
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: xmlprcon.cxx:55
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: ximpstyl.cxx:782
Title, Content and 2 Content.
Definition: autolayout.hxx:39
#define CTF_FILLBITMAPNAME
Definition: xmlsdtypes.hxx:139
XmlStyleFamily const *const m_pFamilies
DRAW
rtl::Reference< SvXMLImportPropertyMapper > xPresImpPropMapper
Definition: ximpstyl.hxx:167
const OUString & GetName() const
Definition: ximpstyl.hxx:133
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:48
static bool IsFuzzing()
int nCount
#define XMLOFF_WARN_UNKNOWN(area, rIter)
Definition: xmlictxt.hxx:113
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:74
Title, 2 Content over Content.
Definition: autolayout.hxx:43
SdXMLPageMasterStyleContext(SdXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:280
std::unique_ptr< ContextID_Index_Pair[]> m_pContextIDs
constexpr sal_uInt16 XML_NAMESPACE_DRAW
#define XMLERROR_FLAG_WARNING
Definition: xmlerror.hxx:35
Title and 2 Content.
Definition: autolayout.hxx:30
const OUString & GetDisplayName() const
Definition: ximpstyl.hxx:112
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:172
#define CTF_PAGE_SOUND_URL
Definition: xmlsdtypes.hxx:127
OUString sPrefix
std::unique_ptr< SvNumberFormatter > mpNumFormatter
Definition: ximpstyl.hxx:170
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const
Definition: xmlstyle.cxx:510
void SetMasterPageStyles(SdXMLMasterPageContext const &rMaster) const
Definition: ximpstyl.cxx:1032
#define TOOLS_WARN_EXCEPTION(area, stream)
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: ximpstyl.cxx:1300
#define DBG_ASSERT(sCon, aError)
const OUString & GetDisplayName() const
Definition: xmlstyle.hxx:78
virtual void SAL_CALL endFastElement(sal_Int32) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpstyl.cxx:1398
int i
void DeleteAllShapes()
deletes all shapes on this drawing page
Definition: ximppage.cxx:450
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
Definition: prstylei.cxx:222
uno_Any a
#define LANGUAGE_SYSTEM
Title, Content over Content.
Definition: autolayout.hxx:41
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: xmlstyle.cxx:441
::std::vector< XMLPropertyState > & GetProperties()
Definition: prstylei.hxx:79
exports com.sun.star. view
void SetStyle(const css::uno::Reference< css::style::XStyle > &xStl)
Definition: prstylei.hxx:107
std::vector< rtl::Reference< SdXMLPresentationPlaceholderContext > > maList
Definition: ximpstyl.hxx:142
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpstyl.cxx:891
OUString maUseDateTimeDeclName
Definition: ximppage.hxx:39
NUMBER
Vertical Title, Vertical Content over Vertical Content.
Definition: autolayout.hxx:55
SdXMLMasterStylesContext(SdXMLImport &rImport)
Definition: ximpstyl.cxx:1294
float u
void IncrementNewMasterPageCount()
size
void AddDateTimeDecl(const OUString &rName, const OUString &rText, bool bFixed, const OUString &rDateTimeFormat)
Definition: sdxmlimp.cxx:607
virtual ~SdXMLMasterPageContext() override
Definition: ximpstyl.cxx:764
void ImpSetCellStyles() const
Definition: ximpstyl.cxx:1072
void AddHeaderDecl(const OUString &rName, const OUString &rText)
Definition: sdxmlimp.cxx:595
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpstyl.cxx:911
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:123
#define CTF_FILLHATCHNAME
Definition: xmlsdtypes.hxx:138
virtual ~SdXMLPresentationPlaceholderContext() override
Definition: ximpstyl.cxx:671
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const override
Definition: ximpstyl.cxx:927
Blank Slide.
Definition: autolayout.hxx:47
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:145
#define CTF_LINESTARTNAME
Definition: xmlsdtypes.hxx:135
SdXMLHeaderFooterDeclContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:1367
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
virtual void Finish(bool bOverwrite) override
Definition: prstylei.cxx:446
XMLDrawingPageStyleContext(SvXMLImport &rImport, SvXMLStylesContext &rStyles, ContextID_Index_Pair const pContextIDs[], XmlStyleFamily const pFamilies[])
Definition: ximpstyl.cxx:163
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: ximpstyl.cxx:372
Title Slide.
Definition: autolayout.hxx:27
css::uno::Any maValue
Definition: maptype.hxx:125
const OUString & GetParentName() const
Definition: xmlstyle.hxx:80
css::uno::Reference< css::uno::XComponentContext > const & GetComponentContext() const
Definition: xmlimp.cxx:1789
SdXMLPageMasterContext(SdXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:361
OUString GetStyleDisplayName(XmlStyleFamily nFamily, const OUString &rName) const
Definition: xmlimp.cxx:1412
#define SAL_WARN_IF(condition, area, stream)
const OUString & GetName() const
Definition: xmlstyle.hxx:77
virtual SvXMLStyleContext * CreateStyleChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpstyl.cxx:837
css::view::PaperOrientation meOrientation
Definition: ximpstyl.hxx:46
Handling of tokens in XML:
Title, 2 Vertical Content.
Definition: autolayout.hxx:57
#define CTF_DASHNAME
Definition: xmlsdtypes.hxx:134
double mnWidth
const css::uno::Reference< css::drawing::XShapes > & GetLocalShapesContext() const
Definition: ximppage.hxx:71
#define XML_ELEMENT(prefix, name)
Definition: xmlimp.hxx:96
css::uno::Reference< css::container::XNameAccess > getPageLayouts() const
Definition: ximpstyl.cxx:1277
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: xmlstyle.cxx:409
Smart struct to transport an Any with an index to the appropriate property-name.
Definition: maptype.hxx:122
const SvXMLUnitConverter & GetMM100UnitConverter() const
Definition: xmlimp.hxx:399
SdXMLPresentationPlaceholderContext(SdXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:627
TABLE
#define CTF_DATE_TIME_FORMAT
Definition: xmlsdtypes.hxx:191
SvXMLStylesContext * GetStyles()
Definition: prstylei.hxx:78
#define XML_TYPE_PROP_DRAWING_PAGE
Definition: xmltypes.hxx:95
const SvXMLStyleContext * FindStyleChildContext(XmlStyleFamily nFamily, const OUString &rName, bool bCreateIndex=false) const
Definition: xmlstyle.cxx:788
void AddStyleDisplayName(XmlStyleFamily nFamily, const OUString &rName, const OUString &rDisplayName)
Definition: xmlimp.cxx:1381
This struct is used as an optional parameter to the static _FillPropertySet() methods.
Definition: xmlimppr.hxx:56
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: ximppage.cxx:244
constexpr sal_Int32 TOKEN_MASK
Definition: xmlimp.hxx:93
#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token)
Definition: xmlictxt.hxx:119
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: ximpstyl.cxx:399
SdXMLStylesContext(SdXMLImport &rImport, bool bIsAutoStyle)
Definition: ximpstyl.cxx:826
Title, Vertical Content.
Definition: autolayout.hxx:56
SdXMLPresentationPageLayoutContext(SdXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:388
virtual void FillPropertySet(css::uno::Reference< css::beans::XPropertySet > const &rPropSet) override
Definition: ximpstyl.cxx:242
sal_uInt32 GetStyleCount() const
Definition: xmlstyle.cxx:291
void SetStyle(OUString const &rStyleName)
sets the page style on this page
Definition: ximppage.cxx:349
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpstyl.cxx:768
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:217
virtual void SAL_CALL characters(const OUString &rChars) override
This method is called for all characters that are contained in the current element.
Definition: ximpstyl.cxx:1420
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpstyl.cxx:972
Centered Text.
Definition: autolayout.hxx:59
void FinishStyles(bool bOverwrite)
Definition: xmlstyle.cxx:774
std::unique_ptr< SvXMLNumFmtHelper > mpNumFmtHelper
Definition: ximpstyl.hxx:169
Vertical Title, Vertical Content over Vertical Content.
Definition: autolayout.hxx:54
void ImpSetGraphicStyles() const
Definition: ximpstyl.cxx:1058
virtual bool IsTransient() const override
if this method returns true, its parent styles context should not add it to its container.
Definition: ximpstyl.cxx:1393
rtl::Reference< XMLShapeImportHelper > const & GetShapeImport()
Definition: xmlimp.hxx:607
virtual ~SdXMLPageMasterStyleContext() override
Definition: ximpstyl.cxx:356
SdXMLMasterPageContext(SdXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
Definition: ximpstyl.cxx:676
static bool canSkipReset(std::u16string_view rName, const XMLPropStyleContext *pPropStyle, const uno::Reference< beans::XPropertySet > &rPropSet, const rtl::Reference< XMLPropertySetMapper > &rPrMap)
Definition: ximpstyl.cxx:1092