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