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