1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
21 #include <xmloff/nmspmap.hxx>
22 #include <xmloff/xmlnmspe.hxx>
23 #include <xmloff/xmluconv.hxx>
24 #include <xmloff/xmltoken.hxx>
25 #include <xmloff/xmlmetae.hxx>
26 #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <com/sun/star/presentation/XPresentationSupplier.hpp>
29 #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
30 #include <com/sun/star/geometry/RealPoint2D.hpp>
31 #include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
32 #include <com/sun/star/office/XAnnotationAccess.hpp>
33 #include <com/sun/star/lang/Locale.hpp>
34 #include <com/sun/star/uno/Any.hxx>
35 #include "sdxmlexp_impl.hxx"
36 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
37 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
38 #include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
39 #include <com/sun/star/container/XIndexContainer.hpp>
40 #include <com/sun/star/view/PaperOrientation.hpp>
41 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
42 #include <com/sun/star/style/XStyle.hpp>
44 #include <com/sun/star/form/XFormsSupplier2.hpp>
45 #include <com/sun/star/presentation/XPresentationPage.hpp>
46 #include <com/sun/star/drawing/XMasterPageTarget.hpp>
47 #include <com/sun/star/text/XText.hpp>
48 #include <com/sun/star/chart/XChartDocument.hpp>
49 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
50 #include <com/sun/star/container/XNamed.hpp>
51 #include <com/sun/star/util/Duration.hpp>
52 #include <com/sun/star/util/MeasureUnit.hpp>
53 #include <rtl/ustrbuf.hxx>
54 #include <tools/gen.hxx>
55 #include <tools/debug.hxx>
56 #include <sax/tools/converter.hxx>
57 #include <xmloff/xmlaustp.hxx>
58 #include <xmloff/families.hxx>
59 #include <xmloff/styleexp.hxx>
60 #include <xmloff/settingsstore.hxx>
61 #include "sdpropls.hxx"
62 #include <xmloff/xmlexppr.hxx>
63 #include <com/sun/star/beans/XPropertyState.hpp>
65 #include "xexptran.hxx"
67 #include <cppuhelper/implbase1.hxx>
68 #include <comphelper/extract.hxx>
69 #include <comphelper/processfactory.hxx>
70 #include <com/sun/star/lang/XServiceInfo.hpp>
71 #include "PropertySetMerger.hxx"
72 #include "layerexp.hxx"
74 #include "XMLNumberStylesExport.hxx"
76 #include <xmloff/animationexport.hxx>
78 #include <com/sun/star/document/XDocumentProperties.hpp>
79 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
81 using namespace ::com::sun::star
;
82 using namespace ::com::sun::star::uno
;
83 using namespace ::com::sun::star::beans
;
84 using namespace ::com::sun::star::util
;
85 using namespace ::com::sun::star::container
;
86 using namespace ::com::sun::star::drawing
;
87 using namespace ::com::sun::star::office
;
88 using namespace ::com::sun::star::presentation
;
89 using namespace ::com::sun::star::geometry
;
90 using namespace ::com::sun::star::text
;
91 using namespace ::xmloff::token
;
93 class ImpXMLEXPPageMasterInfo
95 sal_Int32 mnBorderBottom
;
96 sal_Int32 mnBorderLeft
;
97 sal_Int32 mnBorderRight
;
98 sal_Int32 mnBorderTop
;
101 view::PaperOrientation meOrientation
;
103 OUString msMasterPageName
;
106 ImpXMLEXPPageMasterInfo(const SdXMLExport
& rExp
, const Reference
<XDrawPage
>& xPage
);
107 bool operator==(const ImpXMLEXPPageMasterInfo
& rInfo
) const;
108 void SetName(const OUString
& rStr
);
110 const OUString
& GetName() const { return msName
; }
111 const OUString
& GetMasterPageName() const { return msMasterPageName
; }
113 sal_Int32
GetBorderBottom() const { return mnBorderBottom
; }
114 sal_Int32
GetBorderLeft() const { return mnBorderLeft
; }
115 sal_Int32
GetBorderRight() const { return mnBorderRight
; }
116 sal_Int32
GetBorderTop() const { return mnBorderTop
; }
117 sal_Int32
GetWidth() const { return mnWidth
; }
118 sal_Int32
GetHeight() const { return mnHeight
; }
119 view::PaperOrientation
GetOrientation() const { return meOrientation
; }
122 ImpXMLEXPPageMasterInfo::ImpXMLEXPPageMasterInfo(
123 const SdXMLExport
& rExp
,
124 const Reference
<XDrawPage
>& xPage
)
131 meOrientation(rExp
.IsDraw() ? view::PaperOrientation_PORTRAIT
: view::PaperOrientation_LANDSCAPE
)
133 Reference
<beans::XPropertySet
> xPropSet(xPage
, UNO_QUERY
);
138 Reference
< beans::XPropertySetInfo
> xPropsInfo( xPropSet
->getPropertySetInfo() );
139 if( xPropsInfo
.is() && xPropsInfo
->hasPropertyByName("BorderBottom"))
141 aAny
= xPropSet
->getPropertyValue("BorderBottom");
142 aAny
>>= mnBorderBottom
;
144 aAny
= xPropSet
->getPropertyValue("BorderLeft");
145 aAny
>>= mnBorderLeft
;
147 aAny
= xPropSet
->getPropertyValue("BorderRight");
148 aAny
>>= mnBorderRight
;
150 aAny
= xPropSet
->getPropertyValue("BorderTop");
151 aAny
>>= mnBorderTop
;
154 if( xPropsInfo
.is() && xPropsInfo
->hasPropertyByName("Width"))
156 aAny
= xPropSet
->getPropertyValue("Width");
159 aAny
= xPropSet
->getPropertyValue("Height");
163 if( xPropsInfo
.is() && xPropsInfo
->hasPropertyByName("Orientation"))
165 aAny
= xPropSet
->getPropertyValue("Orientation");
166 aAny
>>= meOrientation
;
170 Reference
<container::XNamed
> xMasterNamed(xPage
, UNO_QUERY
);
171 if(xMasterNamed
.is())
173 msMasterPageName
= xMasterNamed
->getName();
177 bool ImpXMLEXPPageMasterInfo::operator==(const ImpXMLEXPPageMasterInfo
& rInfo
) const
179 return ((mnBorderBottom
== rInfo
.mnBorderBottom
)
180 && (mnBorderLeft
== rInfo
.mnBorderLeft
)
181 && (mnBorderRight
== rInfo
.mnBorderRight
)
182 && (mnBorderTop
== rInfo
.mnBorderTop
)
183 && (mnWidth
== rInfo
.mnWidth
)
184 && (mnHeight
== rInfo
.mnHeight
)
185 && (meOrientation
== rInfo
.meOrientation
));
188 void ImpXMLEXPPageMasterInfo::SetName(const OUString
& rStr
)
193 #define IMP_AUTOLAYOUT_INFO_MAX (35L)
195 class ImpXMLAutoLayoutInfo
198 ImpXMLEXPPageMasterInfo
* mpPageMasterInfo
;
199 OUString msLayoutName
;
200 Rectangle maTitleRect
;
201 Rectangle maPresRect
;
206 ImpXMLAutoLayoutInfo(sal_uInt16 nTyp
, ImpXMLEXPPageMasterInfo
* pInf
);
208 bool operator==(const ImpXMLAutoLayoutInfo
& rInfo
) const;
210 sal_uInt16
GetLayoutType() const { return mnType
; }
211 sal_Int32
GetGapX() const { return mnGapX
; }
212 sal_Int32
GetGapY() const { return mnGapY
; }
214 const OUString
& GetLayoutName() const { return msLayoutName
; }
215 void SetLayoutName(const OUString
& rNew
) { msLayoutName
= rNew
; }
217 const Rectangle
& GetTitleRectangle() const { return maTitleRect
; }
218 const Rectangle
& GetPresRectangle() const { return maPresRect
; }
220 static bool IsCreateNecessary(sal_uInt16 nTyp
);
223 bool ImpXMLAutoLayoutInfo::IsCreateNecessary(sal_uInt16 nTyp
)
225 if(nTyp
== 5 /* AUTOLAYOUT_ORG */
226 || nTyp
== 20 /* AUTOLAYOUT_NONE */
227 || nTyp
>= IMP_AUTOLAYOUT_INFO_MAX
)
232 bool ImpXMLAutoLayoutInfo::operator==(const ImpXMLAutoLayoutInfo
& rInfo
) const
234 return ((mnType
== rInfo
.mnType
235 && mpPageMasterInfo
== rInfo
.mpPageMasterInfo
));
238 ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp
, ImpXMLEXPPageMasterInfo
* pInf
)
240 , mpPageMasterInfo(pInf
)
244 // create full info (initialze with typical values)
246 Size
aPageSize(28000, 21000);
247 Size
aPageInnerSize(28000, 21000);
251 aPagePos
= Point(mpPageMasterInfo
->GetBorderLeft(), mpPageMasterInfo
->GetBorderTop());
252 aPageSize
= Size(mpPageMasterInfo
->GetWidth(), mpPageMasterInfo
->GetHeight());
253 aPageInnerSize
= aPageSize
;
254 aPageInnerSize
.Width() -= mpPageMasterInfo
->GetBorderLeft() + mpPageMasterInfo
->GetBorderRight();
255 aPageInnerSize
.Height() -= mpPageMasterInfo
->GetBorderTop() + mpPageMasterInfo
->GetBorderBottom();
258 // title rectangle aligning
259 Point
aTitlePos(aPagePos
);
260 Size
aTitleSize(aPageInnerSize
);
262 if(mnType
== 21 /* AUTOLAYOUT_NOTES */)
264 aTitleSize
.Height() = (long) (aTitleSize
.Height() / 2.5);
265 Point aPos
= aTitlePos
;
266 aPos
.Y() += long( aTitleSize
.Height() * 0.083 );
267 Size aPartArea
= aTitleSize
;
270 // scale handout rectangle using actual page size
271 double fH
= (double) aPartArea
.Width() / aPageSize
.Width();
272 double fV
= (double) aPartArea
.Height() / aPageSize
.Height();
276 aSize
.Width() = (long) (fH
* aPageSize
.Width());
277 aSize
.Height() = (long) (fH
* aPageSize
.Height());
279 aPos
.X() += (aPartArea
.Width() - aSize
.Width()) / 2;
280 aPos
.Y() += (aPartArea
.Height()- aSize
.Height())/ 2;
285 else if(mnType
== 27 || mnType
== 28)
287 // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART or
288 // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
290 aTitlePos
.X() + long( aTitleSize
.Width() * 0.0735 ),
291 aTitlePos
.Y() + long( aTitleSize
.Height() * 0.083 ));
293 long( aTitleSize
.Width() * 0.854 ),
294 long( aTitleSize
.Height() * 0.167 ));
295 Point
aLPos(aPagePos
);
296 Size
aLSize(aPageInnerSize
);
298 aLPos
.X() + long( aLSize
.Width() * 0.0735 ),
299 aLPos
.Y() + long( aLSize
.Height() * 0.472 ));
301 long( aLSize
.Width() * 0.854 ),
302 long( aLSize
.Height() * 0.444 ));
304 aTitlePos
.X() = (aClassicTPos
.X() + aClassicTSize
.Width()) - aClassicTSize
.Height();
305 aTitlePos
.Y() = aClassicTPos
.Y();
306 aTitleSize
.Width() = aClassicTSize
.Height();
307 aTitleSize
.Height() = (aClassicLPos
.Y() + aClassicLSize
.Height()) - aClassicTPos
.Y();
311 aTitlePos
.X() += long( aTitleSize
.Width() * 0.0735 );
312 aTitlePos
.Y() += long( aTitleSize
.Height() * 0.083 );
313 aTitleSize
.Width() = long( aTitleSize
.Width() * 0.854 );
314 aTitleSize
.Height() = long( aTitleSize
.Height() * 0.167 );
317 maTitleRect
.SetPos(aTitlePos
);
318 maTitleRect
.SetSize(aTitleSize
);
320 // layout rectangle aligning
321 Point
aLayoutPos(aPagePos
);
322 Size
aLayoutSize(aPageInnerSize
);
324 if(mnType
== 21 /* AUTOLAYOUT_NOTES */)
326 aLayoutPos
.X() += long( aLayoutSize
.Width() * 0.0735 );
327 aLayoutPos
.Y() += long( aLayoutSize
.Height() * 0.472 );
328 aLayoutSize
.Width() = long( aLayoutSize
.Width() * 0.854 );
329 aLayoutSize
.Height() = long( aLayoutSize
.Height() * 0.444 );
331 else if((mnType
>= 22 && mnType
<= 26) || (mnType
== 31)) // AUTOLAYOUT_HANDOUT
333 // keep info for inner area in maPresRect, put info for gap size
334 // to maTitleRect position
335 mnGapX
= (aPageSize
.Width() - aPageInnerSize
.Width()) / 2;
336 mnGapY
= (aPageSize
.Height() - aPageInnerSize
.Height()) / 2;
339 mnGapX
= aPageSize
.Width() / 10;
342 mnGapY
= aPageSize
.Height() / 10;
344 if(mnGapX
< aPageInnerSize
.Width() / 10)
345 mnGapX
= aPageInnerSize
.Width() / 10;
347 if(mnGapY
< aPageInnerSize
.Height() / 10)
348 mnGapY
= aPageInnerSize
.Height() / 10;
350 else if(mnType
== 27 || mnType
== 28)
352 // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART or
353 // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
355 aTitlePos
.X() + long( aTitleSize
.Width() * 0.0735 ),
356 aTitlePos
.Y() + long( aTitleSize
.Height() * 0.083 ));
358 long( aTitleSize
.Width() * 0.854 ),
359 long( aTitleSize
.Height() * 0.167 ));
361 aLayoutPos
.X() + long( aLayoutSize
.Width() * 0.0735 ),
362 aLayoutPos
.Y() + long( aLayoutSize
.Height() * 0.472 ));
364 long( aLayoutSize
.Width() * 0.854 ),
365 long( aLayoutSize
.Height() * 0.444 ));
367 aLayoutPos
.X() = aClassicLPos
.X();
368 aLayoutPos
.Y() = aClassicTPos
.Y();
369 aLayoutSize
.Width() = (aClassicLPos
.X() + aClassicLSize
.Width())
370 - (aClassicTSize
.Height() + (aClassicLPos
.Y() - (aClassicTPos
.Y() + aClassicTSize
.Height())));
371 aLayoutSize
.Height() = (aClassicLPos
.Y() + aClassicLSize
.Height()) - aClassicTPos
.Y();
373 else if( mnType
== 32 )
375 // AUTOLAYOUT_ONLY_TEXT
376 aLayoutPos
= aTitlePos
;
377 aLayoutSize
.Width() = aTitleSize
.Width();
378 aLayoutSize
.Height() = long( aLayoutSize
.Height() * 0.825 );
382 aLayoutPos
.X() += long( aLayoutSize
.Width() * 0.0735 );
383 aLayoutPos
.Y() += long( aLayoutSize
.Height() * 0.278 );
384 aLayoutSize
.Width() = long( aLayoutSize
.Width() * 0.854 );
385 aLayoutSize
.Height() = long( aLayoutSize
.Height() * 0.630 );
388 maPresRect
.SetPos(aLayoutPos
);
389 maPresRect
.SetSize(aLayoutSize
);
393 SdXMLExport::SdXMLExport(
394 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& xContext
,
395 OUString
const & implementationName
,
396 bool bIsDraw
, SvXMLExportFlags nExportFlags
)
397 : SvXMLExport( util::MeasureUnit::CM
, xContext
, implementationName
,
398 (bIsDraw
) ? XML_GRAPHICS
: XML_PRESENTATION
, nExportFlags
),
399 mnDocMasterPageCount(0L),
400 mnDocDrawPageCount(0L),
401 mnShapeStyleInfoIndex(0L),
403 mpPageMasterInfoList(new ImpXMLEXPPageMasterList()),
404 mpPageMasterUsageList(new ImpXMLEXPPageMasterList()),
405 mpNotesPageMasterUsageList(new ImpXMLEXPPageMasterList()),
406 mpHandoutPageMaster(NULL
),
407 mpAutoLayoutInfoList(new ImpXMLAutoLayoutInfoList()),
408 mpSdPropHdlFactory(0L),
409 mpPropertySetMapper(0L),
410 mpPresPagePropsMapper(0L),
412 mbFamilyGraphicUsed(false),
413 mbFamilyPresentationUsed(false),
414 msZIndex( GetXMLToken(XML_ZINDEX
) ),
415 msEmptyPres( "IsEmptyPresentationObject" ),
417 msStartShape( "StartShape" ),
418 msEndShape( "EndShape" ),
419 msPageLayoutNames( "PageLayoutNames" )
425 void SAL_CALL
SdXMLExport::setSourceDocument( const Reference
< lang::XComponent
>& xDoc
)
426 throw(lang::IllegalArgumentException
, uno::RuntimeException
, std::exception
)
428 SvXMLExport::setSourceDocument( xDoc
);
430 const OUString aEmpty
;
432 // prepare factory parts
433 mpSdPropHdlFactory
= new XMLSdPropHdlFactory( GetModel(), *this );
435 // set lock to avoid deletion
436 mpSdPropHdlFactory
->acquire();
439 const rtl::Reference
< XMLPropertyHandlerFactory
> aFactoryRef
= mpSdPropHdlFactory
;
441 // construct PropertySetMapper
442 rtl::Reference
< XMLPropertySetMapper
> xMapper
= new XMLShapePropertySetMapper( aFactoryRef
, true);
444 // get or create text paragraph export
445 GetTextParagraphExport();
446 mpPropertySetMapper
= new XMLShapeExportPropertyMapper( xMapper
, *this );
447 // set lock to avoid deletion
448 mpPropertySetMapper
->acquire();
450 // chain text attributes
451 mpPropertySetMapper
->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this));
453 // construct PresPagePropsMapper
454 xMapper
= new XMLPropertySetMapper(aXMLSDPresPageProps
, aFactoryRef
, true);
456 mpPresPagePropsMapper
= new XMLPageExportPropertyMapper( xMapper
, *this );
457 // set lock to avoid deletion
458 mpPresPagePropsMapper
->acquire();
461 GetAutoStylePool()->AddFamily(
462 XML_STYLE_FAMILY_SD_GRAPHICS_ID
,
463 OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME
),
464 GetPropertySetMapper(),
465 OUString(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX
));
466 GetAutoStylePool()->AddFamily(
467 XML_STYLE_FAMILY_SD_PRESENTATION_ID
,
468 OUString(XML_STYLE_FAMILY_SD_PRESENTATION_NAME
),
469 GetPropertySetMapper(),
470 OUString(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX
));
471 GetAutoStylePool()->AddFamily(
472 XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID
,
473 OUString(XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME
),
474 GetPresPagePropsMapper(),
475 OUString(XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX
));
476 // prepare access to styles
477 Reference
< style::XStyleFamiliesSupplier
> xFamSup( GetModel(), UNO_QUERY
);
480 mxDocStyleFamilies
= xFamSup
->getStyleFamilies();
483 // prepare access to master pages
484 Reference
< drawing::XMasterPagesSupplier
> xMasterPagesSupplier(GetModel(), UNO_QUERY
);
485 if(xMasterPagesSupplier
.is())
487 mxDocMasterPages
.set(xMasterPagesSupplier
->getMasterPages(), css::uno::UNO_QUERY
);
488 if(mxDocMasterPages
.is())
490 mnDocMasterPageCount
= mxDocMasterPages
->getCount();
491 maMasterPagesStyleNames
.insert( maMasterPagesStyleNames
.begin(), mnDocMasterPageCount
, aEmpty
);
495 // prepare access to draw pages
496 Reference
<XDrawPagesSupplier
> xDrawPagesSupplier(GetModel(), UNO_QUERY
);
497 if(xDrawPagesSupplier
.is())
499 mxDocDrawPages
.set(xDrawPagesSupplier
->getDrawPages(), css::uno::UNO_QUERY
);
500 if(mxDocDrawPages
.is())
502 mnDocDrawPageCount
= mxDocDrawPages
->getCount();
503 maDrawPagesStyleNames
.insert( maDrawPagesStyleNames
.begin(), mnDocDrawPageCount
, aEmpty
);
504 maDrawNotesPagesStyleNames
.insert( maDrawNotesPagesStyleNames
.begin(), mnDocDrawPageCount
, aEmpty
);
506 maDrawPagesAutoLayoutNames
.realloc( mnDocDrawPageCount
+ 1 );
508 HeaderFooterPageSettingsImpl aEmptySettings
;
509 maDrawPagesHeaderFooterSettings
.insert( maDrawPagesHeaderFooterSettings
.begin(), mnDocDrawPageCount
, aEmptySettings
);
510 maDrawNotesPagesHeaderFooterSettings
.insert( maDrawNotesPagesHeaderFooterSettings
.begin(), mnDocDrawPageCount
, aEmptySettings
);
514 // #82003# count all draw objects for use with progress bar.
515 // #88245# init mnObjectCount once, use counter itself as flag. It
516 // is initialized to 0.
521 // #91587# add handout master count
522 Reference
<presentation::XHandoutMasterSupplier
> xHandoutSupp(GetModel(), UNO_QUERY
);
523 if(xHandoutSupp
.is())
525 Reference
<XDrawPage
> xHandoutPage(xHandoutSupp
->getHandoutMasterPage());
526 if(xHandoutPage
.is())
528 Reference
<drawing::XShapes
> xShapes(xHandoutPage
, UNO_QUERY
);
529 if(xShapes
.is() && xShapes
->getCount())
531 mnObjectCount
+= ImpRecursiveObjectCount(xShapes
);
537 if(mxDocMasterPages
.is())
539 for(sal_Int32
a(0); a
< mnDocMasterPageCount
; a
++)
541 Any
aAny(mxDocMasterPages
->getByIndex(a
));
542 Reference
< drawing::XShapes
> xMasterPage
;
544 if((aAny
>>= xMasterPage
) && xMasterPage
.is())
546 mnObjectCount
+= ImpRecursiveObjectCount(xMasterPage
);
551 // #91587# take notes pages from master pages into account
552 Reference
<presentation::XPresentationPage
> xPresPage
;
553 if((aAny
>>= xPresPage
) && xPresPage
.is())
555 Reference
<XDrawPage
> xNotesPage(xPresPage
->getNotesPage());
558 Reference
<drawing::XShapes
> xShapes(xNotesPage
, UNO_QUERY
);
559 if(xShapes
.is() && xShapes
->getCount())
561 mnObjectCount
+= ImpRecursiveObjectCount(xShapes
);
569 if(mxDocDrawPages
.is())
571 for(sal_Int32
a(0); a
< mnDocDrawPageCount
; a
++)
573 Any
aAny(mxDocDrawPages
->getByIndex(a
));
574 Reference
< drawing::XShapes
> xPage
;
576 if((aAny
>>= xPage
) && xPage
.is())
578 mnObjectCount
+= ImpRecursiveObjectCount(xPage
);
583 // #91587# take notes pages from draw pages into account
584 Reference
<presentation::XPresentationPage
> xPresPage
;
585 if((aAny
>>= xPresPage
) && xPresPage
.is())
587 Reference
<XDrawPage
> xNotesPage(xPresPage
->getNotesPage());
590 Reference
<drawing::XShapes
> xShapes(xNotesPage
, UNO_QUERY
);
591 if(xShapes
.is() && xShapes
->getCount())
593 mnObjectCount
+= ImpRecursiveObjectCount(xShapes
);
601 // #82003# init progress bar
602 GetProgressBarHelper()->SetReference(mnObjectCount
);
606 _GetNamespaceMap().Add(
607 GetXMLToken(XML_NP_PRESENTATION
),
608 GetXMLToken(XML_N_PRESENTATION
),
609 XML_NAMESPACE_PRESENTATION
);
611 _GetNamespaceMap().Add(
612 GetXMLToken(XML_NP_SMIL
),
613 GetXMLToken(XML_N_SMIL_COMPAT
),
616 _GetNamespaceMap().Add(
617 GetXMLToken(XML_NP_ANIMATION
),
618 GetXMLToken(XML_N_ANIMATION
),
619 XML_NAMESPACE_ANIMATION
);
621 if( getDefaultVersion() > SvtSaveOptions::ODFVER_012
)
623 _GetNamespaceMap().Add(
624 GetXMLToken(XML_NP_OFFICE_EXT
),
625 GetXMLToken(XML_N_OFFICE_EXT
),
626 XML_NAMESPACE_OFFICE_EXT
);
629 GetShapeExport()->enableLayerExport();
631 // #88546# enable progress bar increments
632 GetShapeExport()->enableHandleProgressBar();
635 // #82003# helper function for recursive object count
636 sal_uInt32
SdXMLExport::ImpRecursiveObjectCount(Reference
< drawing::XShapes
> xShapes
)
638 sal_uInt32
nRetval(0L);
642 sal_Int32 nCount
= xShapes
->getCount();
644 for(sal_Int32
a(0L); a
< nCount
; a
++)
646 Any
aAny(xShapes
->getByIndex(a
));
647 Reference
< drawing::XShapes
> xGroup
;
649 if((aAny
>>= xGroup
) && xGroup
.is())
651 // #93180# count group objects, too.
652 nRetval
+= 1 + ImpRecursiveObjectCount(xGroup
);
664 SdXMLExport::~SdXMLExport()
666 // cleanup factory, decrease refcount. Should lead to destruction.
667 if(mpSdPropHdlFactory
)
669 mpSdPropHdlFactory
->release();
670 mpSdPropHdlFactory
= 0L;
673 // cleanup mapper, decrease refcount. Should lead to destruction.
674 if(mpPropertySetMapper
)
676 mpPropertySetMapper
->release();
677 mpPropertySetMapper
= 0L;
680 // cleanup presPage mapper, decrease refcount. Should lead to destruction.
681 if(mpPresPagePropsMapper
)
683 mpPresPagePropsMapper
->release();
684 mpPresPagePropsMapper
= 0L;
687 // clear evtl. temporary page master infos
688 if(mpPageMasterUsageList
)
690 // note: all items in this list are also in mpPageMasterInfoList
691 delete mpPageMasterUsageList
;
692 mpPageMasterUsageList
= 0L;
695 if(mpNotesPageMasterUsageList
)
697 // note: all items in this list are also in mpPageMasterInfoList
698 delete mpNotesPageMasterUsageList
;
699 mpNotesPageMasterUsageList
= 0L;
702 if(mpPageMasterInfoList
)
704 for ( size_t i
= 0, n
= mpPageMasterInfoList
->size(); i
< n
; ++i
)
705 delete mpPageMasterInfoList
->at( i
);
706 mpPageMasterInfoList
->clear();
707 delete mpPageMasterInfoList
;
708 mpPageMasterInfoList
= 0L;
711 // clear auto-layout infos
712 if(mpAutoLayoutInfoList
)
714 for ( size_t i
= 0, n
= mpAutoLayoutInfoList
->size(); i
< n
; ++i
)
715 delete mpAutoLayoutInfoList
->at( i
);
716 mpAutoLayoutInfoList
->clear();
717 delete mpAutoLayoutInfoList
;
718 mpAutoLayoutInfoList
= 0L;
722 void SdXMLExport::ImpPrepAutoLayoutInfos()
728 Reference
< presentation::XHandoutMasterSupplier
> xHandoutSupp( GetModel(), UNO_QUERY
);
729 if( xHandoutSupp
.is() )
731 Reference
< XDrawPage
> xHandoutPage( xHandoutSupp
->getHandoutMasterPage() );
732 if( xHandoutPage
.is() )
734 if(ImpPrepAutoLayoutInfo(xHandoutPage
, aStr
))
735 maDrawPagesAutoLayoutNames
[0] = aStr
;
739 // prepare name creation
740 for (sal_Int32 nCnt
= 0; nCnt
< mnDocDrawPageCount
; nCnt
++)
742 Any
aAny(mxDocDrawPages
->getByIndex(nCnt
));
743 Reference
<XDrawPage
> xDrawPage
;
745 if((aAny
>>= xDrawPage
) && xDrawPage
.is())
747 if(ImpPrepAutoLayoutInfo(xDrawPage
, aStr
))
748 maDrawPagesAutoLayoutNames
[nCnt
+1] = aStr
;
754 bool SdXMLExport::ImpPrepAutoLayoutInfo(const Reference
<XDrawPage
>& xPage
, OUString
& rName
)
759 Reference
<beans::XPropertySet
> xPropSet(xPage
, UNO_QUERY
);
762 sal_uInt16 nType
= sal_uInt16();
765 aAny
= xPropSet
->getPropertyValue("Layout");
768 if(ImpXMLAutoLayoutInfo::IsCreateNecessary(nType
))
770 ImpXMLEXPPageMasterInfo
* pInfo
= 0L;
772 // get master-page info
773 Reference
< drawing::XMasterPageTarget
> xMasterPageInt(xPage
, UNO_QUERY
);
774 if(xMasterPageInt
.is())
776 Reference
<XDrawPage
> xUsedMasterPage(xMasterPageInt
->getMasterPage());
777 if(xUsedMasterPage
.is())
779 Reference
< container::XNamed
> xMasterNamed(xUsedMasterPage
, UNO_QUERY
);
780 if(xMasterNamed
.is())
782 OUString sMasterPageName
= xMasterNamed
->getName();
783 pInfo
= ImpGetPageMasterInfoByName(sMasterPageName
);
788 // create entry and look for existence
789 ImpXMLAutoLayoutInfo
* pNew
= new ImpXMLAutoLayoutInfo(nType
, pInfo
);
790 bool bDidExist(false);
792 for( size_t nCnt
= 0; !bDidExist
&& nCnt
< mpAutoLayoutInfoList
->size(); nCnt
++)
794 if( *mpAutoLayoutInfoList
->at( nCnt
) == *pNew
)
797 pNew
= mpAutoLayoutInfoList
->at( nCnt
);
804 mpAutoLayoutInfoList
->push_back( pNew
);
805 OUString sNewName
= "AL";
806 sNewName
+= OUString::number(mpAutoLayoutInfoList
->size() - 1);
808 sNewName
+= OUString::number(nType
);
809 pNew
->SetLayoutName(sNewName
);
812 rName
= pNew
->GetLayoutName();
821 void SdXMLExport::ImpWriteAutoLayoutInfos()
823 if( !mpAutoLayoutInfoList
->empty() )
825 for(size_t nCnt
= 0; nCnt
< mpAutoLayoutInfoList
->size(); nCnt
++)
827 ImpXMLAutoLayoutInfo
* pInfo
= mpAutoLayoutInfoList
->at( nCnt
);
830 // prepare presentation-page layout attributes, style-name
831 AddAttribute(XML_NAMESPACE_STYLE
, XML_NAME
, pInfo
->GetLayoutName());
833 // write draw-style attributes
834 SvXMLElementExport
aDSE(*this, XML_NAMESPACE_STYLE
, XML_PRESENTATION_PAGE_LAYOUT
, true, true);
836 // write presentation placeholders
837 switch(pInfo
->GetLayoutType())
839 case 0 : // AUTOLAYOUT_TITLE
841 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
842 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle
, pInfo
->GetPresRectangle());
845 case 1 : // AUTOLAYOUT_ENUM
847 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
848 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, pInfo
->GetPresRectangle());
851 case 2 : // AUTOLAYOUT_CHART
853 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
854 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart
, pInfo
->GetPresRectangle());
857 case 3 : // AUTOLAYOUT_2TEXT
859 Rectangle
aLeft(pInfo
->GetPresRectangle());
860 aLeft
.setWidth(long(aLeft
.GetWidth() * 0.488));
861 Rectangle
aRight(aLeft
);
862 aRight
.Left() = long(aRight
.Left() + aRight
.GetWidth() * 1.05);
864 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
865 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aLeft
);
866 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aRight
);
869 case 4 : // AUTOLAYOUT_TEXTCHART
871 Rectangle
aLeft(pInfo
->GetPresRectangle());
872 aLeft
.setWidth(long(aLeft
.GetWidth() * 0.488));
873 Rectangle
aRight(aLeft
);
874 aRight
.Left() = long(aRight
.Left() + aRight
.GetWidth() * 1.05);
876 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
877 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aLeft
);
878 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart
, aRight
);
881 case 6 : // AUTOLAYOUT_TEXTCLIP
883 Rectangle
aLeft(pInfo
->GetPresRectangle());
884 aLeft
.setWidth(long(aLeft
.GetWidth() * 0.488));
885 Rectangle
aRight(aLeft
);
886 aRight
.Left() = long(aRight
.Left() + aRight
.GetWidth() * 1.05);
888 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
889 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aLeft
);
890 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aRight
);
893 case 7 : // AUTOLAYOUT_CHARTTEXT
895 Rectangle
aLeft(pInfo
->GetPresRectangle());
896 aLeft
.setWidth(long(aLeft
.GetWidth() * 0.488));
897 Rectangle
aRight(aLeft
);
898 aRight
.Left() = long(aRight
.Left() + aRight
.GetWidth() * 1.05);
900 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
901 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart
, aLeft
);
902 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aRight
);
905 case 8 : // AUTOLAYOUT_TAB
907 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
908 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTable
, pInfo
->GetPresRectangle());
911 case 9 : // AUTOLAYOUT_CLIPTEXT
913 Rectangle
aLeft(pInfo
->GetPresRectangle());
914 aLeft
.setWidth(long(aLeft
.GetWidth() * 0.488));
915 Rectangle
aRight(aLeft
);
916 aRight
.Left() = long(aRight
.Left() + aRight
.GetWidth() * 1.05);
918 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
919 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aLeft
);
920 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aRight
);
923 case 10 : // AUTOLAYOUT_TEXTOBJ
925 Rectangle
aLeft(pInfo
->GetPresRectangle());
926 aLeft
.setWidth(long(aLeft
.GetWidth() * 0.488));
927 Rectangle
aRight(aLeft
);
928 aRight
.Left() = long(aRight
.Left() + aRight
.GetWidth() * 1.05);
930 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
931 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aLeft
);
932 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aRight
);
935 case 11 : // AUTOLAYOUT_OBJ
937 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
938 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, pInfo
->GetPresRectangle());
941 case 12 : // AUTOLAYOUT_TEXT2OBJ
943 Rectangle
aLeft(pInfo
->GetPresRectangle());
944 aLeft
.setWidth(long(aLeft
.GetWidth() * 0.488));
945 Rectangle
aRightTop(aLeft
);
946 aRightTop
.Left() = long(aRightTop
.Left() + aRightTop
.GetWidth() * 1.05);
947 aRightTop
.setHeight(long(aRightTop
.GetHeight() * 0.477));
948 Rectangle
aRightBottom(aRightTop
);
949 aRightBottom
.Top() = long(aRightBottom
.Top() + aRightBottom
.GetHeight() * 1.095);
951 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
952 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aLeft
);
953 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aRightTop
);
954 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aRightBottom
);
957 case 13 : // AUTOLAYOUT_OBJTEXT
959 Rectangle
aLeft(pInfo
->GetPresRectangle());
960 aLeft
.setWidth(long(aLeft
.GetWidth() * 0.488));
961 Rectangle
aRight(aLeft
);
962 aRight
.Left() = long(aRight
.Left() + aRight
.GetWidth() * 1.05);
964 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
965 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aLeft
);
966 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aRight
);
969 case 14 : // AUTOLAYOUT_OBJOVERTEXT
971 Rectangle
aTop(pInfo
->GetPresRectangle());
972 aTop
.setHeight(long(aTop
.GetHeight() * 0.477));
973 Rectangle
aBottom(aTop
);
974 aBottom
.Top() = long(aBottom
.Top() + aBottom
.GetHeight() * 1.095);
976 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
977 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aTop
);
978 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aBottom
);
981 case 15 : // AUTOLAYOUT_2OBJTEXT
983 Rectangle
aLeftTop(pInfo
->GetPresRectangle());
984 aLeftTop
.setWidth(long(aLeftTop
.GetWidth() * 0.488));
985 Rectangle
aRight(aLeftTop
);
986 aRight
.Left() = long(aRight
.Left() + aRight
.GetWidth() * 1.05);
987 aLeftTop
.setHeight(long(aLeftTop
.GetHeight() * 0.477));
988 Rectangle
aLeftBottom(aLeftTop
);
989 aLeftBottom
.Top() = long(aLeftBottom
.Top() + aLeftBottom
.GetHeight() * 1.095);
991 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
992 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aLeftTop
);
993 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aLeftBottom
);
994 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aRight
);
997 case 16 : // AUTOLAYOUT_2OBJOVERTEXT
999 Rectangle
aTopLeft(pInfo
->GetPresRectangle());
1000 aTopLeft
.setHeight(long(aTopLeft
.GetHeight() * 0.477));
1001 Rectangle
aBottom(aTopLeft
);
1002 aBottom
.Top() = long(aBottom
.Top() + aBottom
.GetHeight() * 1.095);
1003 aTopLeft
.setWidth(long(aTopLeft
.GetWidth() * 0.488));
1004 Rectangle
aTopRight(aTopLeft
);
1005 aTopRight
.Left() = long(aTopRight
.Left() + aTopRight
.GetWidth() * 1.05);
1007 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
1008 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aTopLeft
);
1009 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aTopRight
);
1010 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aBottom
);
1013 case 17 : // AUTOLAYOUT_TEXTOVEROBJ
1015 Rectangle
aTop(pInfo
->GetPresRectangle());
1016 aTop
.setHeight(long(aTop
.GetHeight() * 0.477));
1017 Rectangle
aBottom(aTop
);
1018 aBottom
.Top() = long(aBottom
.Top() + aBottom
.GetHeight() * 1.095);
1020 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
1021 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline
, aTop
);
1022 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aBottom
);
1025 case 18 : // AUTOLAYOUT_4OBJ
1027 Rectangle
aTopLeft(pInfo
->GetPresRectangle());
1028 aTopLeft
.setHeight(long(aTopLeft
.GetHeight() * 0.477));
1029 aTopLeft
.setWidth(long(aTopLeft
.GetWidth() * 0.488));
1030 Rectangle
aBottomLeft(aTopLeft
);
1031 aBottomLeft
.Top() = long(aBottomLeft
.Top() + aBottomLeft
.GetHeight() * 1.095);
1032 Rectangle
aTopRight(aTopLeft
);
1033 aTopRight
.Left() = long(aTopRight
.Left() + aTopRight
.GetWidth() * 1.05);
1034 Rectangle
aBottomRight(aTopRight
);
1035 aBottomRight
.Top() = long(aBottomRight
.Top() + aBottomRight
.GetHeight() * 1.095);
1037 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
1038 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aTopLeft
);
1039 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aTopRight
);
1040 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aBottomLeft
);
1041 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject
, aBottomRight
);
1044 case 19 : // AUTOLAYOUT_ONLY_TITLE
1046 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
1049 case 21 : // AUTOLAYOUT_NOTES
1051 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderPage
, pInfo
->GetTitleRectangle());
1052 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderNotes
, pInfo
->GetPresRectangle());
1055 case 22 : // AUTOLAYOUT_HANDOUT1
1056 case 23 : // AUTOLAYOUT_HANDOUT2
1057 case 24 : // AUTOLAYOUT_HANDOUT3
1058 case 25 : // AUTOLAYOUT_HANDOUT4
1059 case 26 : // AUTOLAYOUT_HANDOUT6
1060 case 31 : // AUTOLAYOUT_HANDOUT9
1062 sal_Int32 nColCnt
, nRowCnt
;
1063 sal_Int32 nGapX
= pInfo
->GetGapX();
1064 sal_Int32 nGapY
= pInfo
->GetGapY();
1066 switch(pInfo
->GetLayoutType())
1068 case 22 : nColCnt
= 1; nRowCnt
= 1; break;
1069 case 23 : nColCnt
= 1; nRowCnt
= 2; break;
1070 case 24 : nColCnt
= 1; nRowCnt
= 3; break;
1071 case 25 : nColCnt
= 2; nRowCnt
= 2; break;
1072 case 26 : nColCnt
= 3; nRowCnt
= 2; break;
1073 case 31 : nColCnt
= 3; nRowCnt
= 3; break;
1074 default: nColCnt
= 0; nRowCnt
= 0; break; // FIXME - What is correct values?
1077 Size
aPartSize(pInfo
->GetTitleRectangle().GetSize());
1078 Point
aPartPos(pInfo
->GetTitleRectangle().TopLeft());
1080 if(aPartSize
.Width() > aPartSize
.Height())
1082 sal_Int32
nZwi(nColCnt
);
1087 if (nColCnt
== 0 || nRowCnt
== 0)
1090 aPartSize
.Width() = (aPartSize
.Width() - ((nColCnt
- 1) * nGapX
)) / nColCnt
;
1091 aPartSize
.Height() = (aPartSize
.Height() - ((nRowCnt
- 1) * nGapY
)) / nRowCnt
;
1093 Point
aTmpPos(aPartPos
);
1095 for (sal_Int32 a
= 0; a
< nRowCnt
; a
++)
1097 aTmpPos
.X() = aPartPos
.X();
1099 for (sal_Int32 b
= 0; b
< nColCnt
; b
++)
1101 Rectangle
aTmpRect(aTmpPos
, aPartSize
);
1103 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderHandout
, aTmpRect
);
1104 aTmpPos
.X() += aPartSize
.Width() + nGapX
;
1107 aTmpPos
.Y() += aPartSize
.Height() + nGapY
;
1111 case 27 : // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
1113 Rectangle
aTop(pInfo
->GetPresRectangle());
1114 aTop
.setHeight(long(aTop
.GetHeight() * 0.488));
1115 Rectangle
aBottom(aTop
);
1116 aBottom
.Top() = long(aBottom
.Top() + aBottom
.GetHeight() * 1.05);
1118 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle
, pInfo
->GetTitleRectangle());
1119 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline
, aTop
);
1120 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart
, aBottom
);
1123 case 28 : // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
1125 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle
, pInfo
->GetTitleRectangle());
1126 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline
, pInfo
->GetPresRectangle());
1129 case 29 : // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
1131 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
1132 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline
, pInfo
->GetPresRectangle());
1135 case 30 : // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
1137 Rectangle
aLeft(pInfo
->GetPresRectangle());
1138 aLeft
.setWidth(long(aLeft
.GetWidth() * 0.488));
1139 Rectangle
aRight(aLeft
);
1140 aRight
.Left() = long(aRight
.Left() + aRight
.GetWidth() * 1.05);
1142 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
1143 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aLeft
);
1144 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline
, aRight
);
1147 case 32 : // AUTOLAYOUT_TITLE
1149 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle
, pInfo
->GetPresRectangle());
1153 case 33 : // AUTOLAYOUT_4CLIPART
1155 Rectangle
aTopLeft(pInfo
->GetPresRectangle());
1156 aTopLeft
.setHeight(long(aTopLeft
.GetHeight() * 0.477));
1157 aTopLeft
.setWidth(long(aTopLeft
.GetWidth() * 0.488));
1158 Rectangle
aBottomLeft(aTopLeft
);
1159 aBottomLeft
.Top() = long(aBottomLeft
.Top() + aBottomLeft
.GetHeight() * 1.095);
1160 Rectangle
aTopRight(aTopLeft
);
1161 aTopRight
.Left() = long(aTopRight
.Left() + aTopRight
.GetWidth() * 1.05);
1162 Rectangle
aBottomRight(aTopRight
);
1163 aBottomRight
.Top() = long(aBottomRight
.Top() + aBottomRight
.GetHeight() * 1.095);
1165 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
1166 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aTopLeft
);
1167 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aTopRight
);
1168 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aBottomLeft
);
1169 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aBottomRight
);
1173 case 34 : // AUTOLAYOUT_6CLIPART
1175 Rectangle
aTopLeft(pInfo
->GetPresRectangle());
1176 aTopLeft
.setHeight(long(aTopLeft
.GetHeight() * 0.477));
1177 aTopLeft
.setWidth(long(aTopLeft
.GetWidth() * 0.322));
1178 Rectangle
aTopCenter(aTopLeft
);
1179 aTopCenter
.Left() = long(aTopCenter
.Left() + aTopCenter
.GetWidth() * 1.05);
1180 Rectangle
aTopRight(aTopLeft
);
1181 aTopRight
.Left() = long(aTopRight
.Left() + aTopRight
.GetWidth() * 2 * 1.05);
1183 Rectangle
aBottomLeft(aTopLeft
);
1184 aBottomLeft
.Top() = long(aBottomLeft
.Top() + aBottomLeft
.GetHeight() * 1.095);
1185 Rectangle
aBottomCenter(aTopCenter
);
1186 aBottomCenter
.Top() = long(aBottomCenter
.Top() + aBottomCenter
.GetHeight() * 1.095);
1187 Rectangle
aBottomRight(aTopRight
);
1188 aBottomRight
.Top() = long(aBottomRight
.Top() + aBottomRight
.GetHeight() * 1.095);
1190 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle
, pInfo
->GetTitleRectangle());
1191 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aTopLeft
);
1192 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aTopCenter
);
1193 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aTopRight
);
1194 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aBottomLeft
);
1195 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aBottomCenter
);
1196 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic
, aBottomRight
);
1201 OSL_FAIL("XMLEXP: unknown autolayout export");
1210 void SdXMLExport::ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl
, const Rectangle
& rRect
)
1213 OUStringBuffer sStringBuffer
;
1215 // prepare presentation-placeholder attributes, presentation:object
1218 case XmlPlaceholderTitle
: aStr
= "title"; break;
1219 case XmlPlaceholderOutline
: aStr
= "outline"; break;
1220 case XmlPlaceholderSubtitle
: aStr
= "subtitle"; break;
1221 case XmlPlaceholderText
: aStr
= "text"; break;
1222 case XmlPlaceholderGraphic
: aStr
= "graphic"; break;
1223 case XmlPlaceholderObject
: aStr
= "object"; break;
1224 case XmlPlaceholderChart
: aStr
= "chart"; break;
1225 case XmlPlaceholderOrgchart
: aStr
= "orgchart"; break;
1226 case XmlPlaceholderTable
: aStr
= "table"; break;
1227 case XmlPlaceholderPage
: aStr
= "page"; break;
1228 case XmlPlaceholderNotes
: aStr
= "notes"; break;
1229 case XmlPlaceholderHandout
: aStr
= "handout"; break;
1230 case XmlPlaceholderVerticalTitle
: aStr
= "vertical_title"; break;
1231 case XmlPlaceholderVerticalOutline
: aStr
= "vertical_outline"; break;
1234 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_OBJECT
, aStr
);
1236 // svg:x,y,width,height
1237 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
, rRect
.Left());
1238 aStr
= sStringBuffer
.makeStringAndClear();
1239 AddAttribute(XML_NAMESPACE_SVG
, XML_X
, aStr
);
1241 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
, rRect
.Top());
1242 aStr
= sStringBuffer
.makeStringAndClear();
1243 AddAttribute(XML_NAMESPACE_SVG
, XML_Y
, aStr
);
1245 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
,
1247 aStr
= sStringBuffer
.makeStringAndClear();
1248 AddAttribute(XML_NAMESPACE_SVG
, XML_WIDTH
, aStr
);
1250 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
,
1252 aStr
= sStringBuffer
.makeStringAndClear();
1253 AddAttribute(XML_NAMESPACE_SVG
, XML_HEIGHT
, aStr
);
1255 // write presentation-placeholder
1256 SvXMLElementExport
aPPL(*this, XML_NAMESPACE_PRESENTATION
, XML_PLACEHOLDER
, true, true);
1259 ImpXMLEXPPageMasterInfo
* SdXMLExport::ImpGetOrCreatePageMasterInfo( Reference
< XDrawPage
> xMasterPage
)
1261 bool bDoesExist
= false;
1263 ImpXMLEXPPageMasterInfo
* pNewInfo
= new ImpXMLEXPPageMasterInfo(*this, xMasterPage
);
1265 // compare with prev page-master infos
1266 for( size_t a
= 0; !bDoesExist
&& a
< mpPageMasterInfoList
->size(); a
++)
1268 if ( mpPageMasterInfoList
->at(a
)
1269 && *mpPageMasterInfoList
->at(a
) == *pNewInfo
1273 pNewInfo
= mpPageMasterInfoList
->at(a
);
1277 // add entry when not found same page-master infos
1279 mpPageMasterInfoList
->push_back( pNewInfo
);
1284 void SdXMLExport::ImpPrepPageMasterInfos()
1288 // create page master info for handout master page
1290 Reference
< XHandoutMasterSupplier
> xHMS( GetModel(), UNO_QUERY
);
1293 Reference
< XDrawPage
> xMasterPage( xHMS
->getHandoutMasterPage() );
1294 if( xMasterPage
.is() )
1295 mpHandoutPageMaster
= ImpGetOrCreatePageMasterInfo(xMasterPage
);
1299 // create page master infos for master pages
1300 if(mnDocMasterPageCount
)
1302 // look for needed page-masters, create these
1303 for (sal_Int32 nMPageId
= 0; nMPageId
< mnDocMasterPageCount
; nMPageId
++)
1305 Reference
< XDrawPage
> xMasterPage( mxDocMasterPages
->getByIndex(nMPageId
), UNO_QUERY
);
1306 ImpXMLEXPPageMasterInfo
* pNewInfo
= 0L;
1308 if(xMasterPage
.is())
1309 pNewInfo
= ImpGetOrCreatePageMasterInfo(xMasterPage
);
1311 mpPageMasterUsageList
->push_back( pNewInfo
);
1313 // look for page master of handout page
1317 Reference
< presentation::XPresentationPage
> xPresPage(xMasterPage
, UNO_QUERY
);
1320 Reference
< XDrawPage
> xNotesPage(xPresPage
->getNotesPage());
1323 pNewInfo
= ImpGetOrCreatePageMasterInfo(xNotesPage
);
1326 mpNotesPageMasterUsageList
->push_back( pNewInfo
);
1332 void SdXMLExport::ImpWritePageMasterInfos()
1334 // write created page-masters, create names for these
1335 for( size_t nCnt
= 0; nCnt
< mpPageMasterInfoList
->size(); nCnt
++)
1337 ImpXMLEXPPageMasterInfo
* pInfo
= mpPageMasterInfoList
->at(nCnt
);
1341 OUString
sNewName("PM");
1343 sNewName
+= OUString::number(nCnt
);
1344 pInfo
->SetName(sNewName
);
1346 // prepare page-master attributes
1348 OUStringBuffer sStringBuffer
;
1351 AddAttribute(XML_NAMESPACE_STYLE
, XML_NAME
, sString
);
1353 // write page-layout
1354 SvXMLElementExport
aPME(*this, XML_NAMESPACE_STYLE
, XML_PAGE_LAYOUT
, true, true);
1356 // prepare style:properties inside page-master
1357 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
,
1358 pInfo
->GetBorderTop());
1359 sString
= sStringBuffer
.makeStringAndClear();
1360 AddAttribute(XML_NAMESPACE_FO
, XML_MARGIN_TOP
, sString
);
1362 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
,
1363 pInfo
->GetBorderBottom());
1364 sString
= sStringBuffer
.makeStringAndClear();
1365 AddAttribute(XML_NAMESPACE_FO
, XML_MARGIN_BOTTOM
, sString
);
1367 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
,
1368 pInfo
->GetBorderLeft());
1369 sString
= sStringBuffer
.makeStringAndClear();
1370 AddAttribute(XML_NAMESPACE_FO
, XML_MARGIN_LEFT
, sString
);
1372 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
,
1373 pInfo
->GetBorderRight());
1374 sString
= sStringBuffer
.makeStringAndClear();
1375 AddAttribute(XML_NAMESPACE_FO
, XML_MARGIN_RIGHT
, sString
);
1377 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
,
1379 sString
= sStringBuffer
.makeStringAndClear();
1380 AddAttribute(XML_NAMESPACE_FO
, XML_PAGE_WIDTH
, sString
);
1382 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
,
1383 pInfo
->GetHeight());
1384 sString
= sStringBuffer
.makeStringAndClear();
1385 AddAttribute(XML_NAMESPACE_FO
, XML_PAGE_HEIGHT
, sString
);
1387 if(pInfo
->GetOrientation() == view::PaperOrientation_PORTRAIT
)
1388 AddAttribute(XML_NAMESPACE_STYLE
, XML_PRINT_ORIENTATION
, XML_PORTRAIT
);
1390 AddAttribute(XML_NAMESPACE_STYLE
, XML_PRINT_ORIENTATION
, XML_LANDSCAPE
);
1392 // write style:properties
1393 SvXMLElementExport
aPMF(*this, XML_NAMESPACE_STYLE
, XML_PAGE_LAYOUT_PROPERTIES
, true, true);
1398 ImpXMLEXPPageMasterInfo
* SdXMLExport::ImpGetPageMasterInfoByName(const OUString
& rName
)
1400 if(!rName
.isEmpty() && !mpPageMasterInfoList
->empty())
1402 for( size_t nCnt
= 0; nCnt
< mpPageMasterInfoList
->size(); nCnt
++)
1404 ImpXMLEXPPageMasterInfo
* pInfo
= mpPageMasterInfoList
->at(nCnt
);
1407 if(!pInfo
->GetMasterPageName().isEmpty() && rName
.equals(pInfo
->GetMasterPageName()))
1417 void SdXMLExport::ImpPrepDrawPageInfos()
1419 // create draw:style-name entries for page export
1420 // containing presentation page attributes AND background attributes
1421 // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
1424 for(nCnt
= 0; nCnt
< mnDocDrawPageCount
; nCnt
++)
1426 Reference
<XDrawPage
> xDrawPage
;
1427 mxDocDrawPages
->getByIndex(nCnt
) >>= xDrawPage
;
1428 maDrawPagesStyleNames
[nCnt
] = ImpCreatePresPageStyleName( xDrawPage
);
1430 Reference
< presentation::XPresentationPage
> xPresPage(xDrawPage
, UNO_QUERY
);
1433 maDrawNotesPagesStyleNames
[nCnt
] = ImpCreatePresPageStyleName( xPresPage
->getNotesPage(), false );
1435 maDrawPagesHeaderFooterSettings
[nCnt
] = ImpPrepDrawPageHeaderFooterDecls( xDrawPage
);
1436 maDrawNotesPagesHeaderFooterSettings
[nCnt
] = ImpPrepDrawPageHeaderFooterDecls( xPresPage
->getNotesPage() );
1441 static OUString
findOrAppendImpl( std::vector
< OUString
>& rVector
, const OUString
& rText
, const sal_Char
* pPrefix
)
1443 // search rVector if there is already a string that equals rText
1444 std::vector
< OUString
>::iterator aIter
;
1446 for( nIndex
= 1, aIter
= rVector
.begin(); aIter
!= rVector
.end(); ++aIter
, ++nIndex
)
1448 if( (*aIter
) == rText
)
1452 // if nothing is found, append the string at the end of rVector
1453 if( aIter
== rVector
.end() )
1454 rVector
.push_back( rText
);
1456 // create a reference string with pPrefix and the index of the
1457 // found or created rText
1458 OUString
aStr( OUString::createFromAscii( pPrefix
) );
1459 aStr
+= OUString::number( nIndex
);
1463 static OUString
findOrAppendImpl( std::vector
< DateTimeDeclImpl
>& rVector
, const OUString
& rText
, bool bFixed
, sal_Int32 nFormat
, const sal_Char
* pPrefix
)
1465 // search rVector if there is already a DateTimeDeclImpl with rText,bFixed and nFormat
1466 std::vector
< DateTimeDeclImpl
>::iterator aIter
;
1468 for( nIndex
= 1, aIter
= rVector
.begin(); aIter
!= rVector
.end(); ++aIter
, ++nIndex
)
1470 const DateTimeDeclImpl
& rDecl
= (*aIter
);
1471 if( (rDecl
.mbFixed
== bFixed
) &&
1472 (!bFixed
|| rDecl
.maStrText
== rText
) &&
1473 (bFixed
|| (rDecl
.mnFormat
== nFormat
) ) )
1477 // if nothing is found, append a new DateTimeDeclImpl
1478 if( aIter
== rVector
.end() )
1480 DateTimeDeclImpl aDecl
;
1481 aDecl
.maStrText
= rText
;
1482 aDecl
.mbFixed
= bFixed
;
1483 aDecl
.mnFormat
= nFormat
;
1484 rVector
.push_back( aDecl
);
1487 // create a reference string with pPrefix and the index of the
1488 // found or created DateTimeDeclImpl
1489 OUString
aStr( OUString::createFromAscii( pPrefix
) );
1490 aStr
+= OUString::number( nIndex
);
1495 static const sal_Char
* gpStrHeaderTextPrefix
= "hdr";
1496 static const sal_Char
* gpStrFooterTextPrefix
= "ftr";
1497 static const sal_Char
* gpStrDateTimeTextPrefix
= "dtd";
1499 HeaderFooterPageSettingsImpl
SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( const Reference
<XDrawPage
>& xDrawPage
)
1501 HeaderFooterPageSettingsImpl aSettings
;
1503 if( xDrawPage
.is() ) try
1505 Reference
< XPropertySet
> xSet( xDrawPage
, UNO_QUERY_THROW
);
1506 Reference
< XPropertySetInfo
> xInfo( xSet
->getPropertySetInfo() );
1510 const OUString
aStrHeaderTextProp( "HeaderText" );
1511 if( xInfo
->hasPropertyByName( aStrHeaderTextProp
) )
1513 xSet
->getPropertyValue( aStrHeaderTextProp
) >>= aStrText
;
1514 if( !aStrText
.isEmpty() )
1515 aSettings
.maStrHeaderDeclName
= findOrAppendImpl( maHeaderDeclsVector
, aStrText
, gpStrHeaderTextPrefix
);
1518 const OUString
aStrFooterTextProp( "FooterText" );
1519 if( xInfo
->hasPropertyByName( aStrFooterTextProp
) )
1521 xSet
->getPropertyValue( aStrFooterTextProp
) >>= aStrText
;
1522 if( !aStrText
.isEmpty() )
1523 aSettings
.maStrFooterDeclName
= findOrAppendImpl( maFooterDeclsVector
, aStrText
, gpStrFooterTextPrefix
);
1526 const OUString
aStrDateTimeTextProp( "DateTimeText" );
1527 if( xInfo
->hasPropertyByName( aStrDateTimeTextProp
) )
1529 bool bFixed
= false;
1530 sal_Int32 nFormat
= 0;
1531 xSet
->getPropertyValue( aStrDateTimeTextProp
) >>= aStrText
;
1532 xSet
->getPropertyValue("IsDateTimeFixed") >>= bFixed
;
1533 xSet
->getPropertyValue("DateTimeFormat") >>= nFormat
;
1535 if( !bFixed
|| !aStrText
.isEmpty() )
1537 aSettings
.maStrDateTimeDeclName
= findOrAppendImpl( maDateTimeDeclsVector
, aStrText
, bFixed
, nFormat
, gpStrDateTimeTextPrefix
);
1539 addDataStyle( nFormat
);
1543 catch(const Exception
&)
1545 OSL_FAIL( "SdXMLExport::ImpPrepDrawPageHeaderFooterDecls(), unexpected exception caught!" );
1551 void SdXMLExport::ImpWriteHeaderFooterDecls()
1553 OUStringBuffer sBuffer
;
1555 if( !maHeaderDeclsVector
.empty() )
1557 // export header decls
1558 const OUString
aPrefix( OUString::createFromAscii( gpStrHeaderTextPrefix
) );
1559 std::vector
< OUString
>::iterator aIter
;
1561 for( nIndex
= 1, aIter
= maHeaderDeclsVector
.begin(); aIter
!= maHeaderDeclsVector
.end(); ++aIter
, ++nIndex
)
1563 sBuffer
.append( aPrefix
);
1564 sBuffer
.append( nIndex
);
1565 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_NAME
, sBuffer
.makeStringAndClear());
1567 SvXMLElementExport
aElem(*this, XML_NAMESPACE_PRESENTATION
, XML_HEADER_DECL
, true, true);
1568 Characters((*aIter
));
1572 if( !maFooterDeclsVector
.empty() )
1574 // export footer decls
1575 const OUString
aPrefix( OUString::createFromAscii( gpStrFooterTextPrefix
) );
1576 std::vector
< OUString
>::iterator aIter
;
1578 for( nIndex
= 1, aIter
= maFooterDeclsVector
.begin(); aIter
!= maFooterDeclsVector
.end(); ++aIter
, ++nIndex
)
1580 sBuffer
.append( aPrefix
);
1581 sBuffer
.append( nIndex
);
1582 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_NAME
, sBuffer
.makeStringAndClear());
1584 SvXMLElementExport
aElem(*this, XML_NAMESPACE_PRESENTATION
, XML_FOOTER_DECL
, false, false);
1585 Characters((*aIter
));
1589 if( !maDateTimeDeclsVector
.empty() )
1591 // export footer decls
1592 const OUString
aPrefix( OUString::createFromAscii( gpStrDateTimeTextPrefix
) );
1593 std::vector
< DateTimeDeclImpl
>::iterator aIter
;
1595 for( nIndex
= 1, aIter
= maDateTimeDeclsVector
.begin(); aIter
!= maDateTimeDeclsVector
.end(); ++aIter
, ++nIndex
)
1597 const DateTimeDeclImpl
& rDecl
= (*aIter
);
1599 sBuffer
.append( aPrefix
);
1600 sBuffer
.append( nIndex
);
1601 AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_NAME
, sBuffer
.makeStringAndClear());
1603 AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_SOURCE
, rDecl
.mbFixed
? XML_FIXED
: XML_CURRENT_DATE
);
1605 if( !rDecl
.mbFixed
)
1606 AddAttribute( XML_NAMESPACE_STYLE
, XML_DATA_STYLE_NAME
, getDataStyleName( rDecl
.mnFormat
) );
1608 SvXMLElementExport
aElem(*this, XML_NAMESPACE_PRESENTATION
, XML_DATE_TIME_DECL
, false, false);
1610 Characters(rDecl
.maStrText
);
1615 void SdXMLExport::ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl
& aSettings
)
1617 if( !aSettings
.maStrHeaderDeclName
.isEmpty() )
1618 AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_USE_HEADER_NAME
, aSettings
.maStrHeaderDeclName
);
1620 if( !aSettings
.maStrFooterDeclName
.isEmpty() )
1621 AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_USE_FOOTER_NAME
, aSettings
.maStrFooterDeclName
);
1623 if( !aSettings
.maStrDateTimeDeclName
.isEmpty() )
1624 AddAttribute( XML_NAMESPACE_PRESENTATION
, XML_USE_DATE_TIME_NAME
, aSettings
.maStrDateTimeDeclName
);
1627 OUString
SdXMLExport::ImpCreatePresPageStyleName( Reference
<XDrawPage
> xDrawPage
, bool bExportBackground
/* = true */ )
1630 OUString sStyleName
;
1632 // create style for this page and add to auto style pool
1634 Reference
< beans::XPropertySet
> xPropSet1(xDrawPage
, UNO_QUERY
);
1637 Reference
< beans::XPropertySet
> xPropSet
;
1639 if( bExportBackground
)
1641 // since the background items are in a different propertyset
1642 // which itself is a property of the pages property set
1643 // we now merge these two propertysets if possible to simulate
1644 // a single propertyset with all draw page properties
1645 const OUString
aBackground("Background");
1646 Reference
< beans::XPropertySet
> xPropSet2
;
1647 Reference
< beans::XPropertySetInfo
> xInfo( xPropSet1
->getPropertySetInfo() );
1648 if( xInfo
.is() && xInfo
->hasPropertyByName( aBackground
) )
1650 Any
aAny( xPropSet1
->getPropertyValue( aBackground
) );
1654 if( xPropSet2
.is() )
1655 xPropSet
= PropertySetMerger_CreateInstance( xPropSet1
, xPropSet2
);
1657 xPropSet
= xPropSet1
;
1661 xPropSet
= xPropSet1
;
1664 const rtl::Reference
< SvXMLExportPropertyMapper
> aMapperRef( GetPresPagePropsMapper() );
1666 std::vector
< XMLPropertyState
> xPropStates( aMapperRef
->Filter( xPropSet
) );
1668 if( !xPropStates
.empty() )
1670 // there are filtered properties -> hard attributes
1671 // try to find this style in AutoStylePool
1672 sStyleName
= GetAutoStylePool()->Find(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID
, sStyleName
, xPropStates
);
1674 if(sStyleName
.isEmpty())
1676 // Style did not exist, add it to AutoStalePool
1677 sStyleName
= GetAutoStylePool()->Add(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID
, sStyleName
, xPropStates
);
1685 void SdXMLExport::ImpPrepMasterPageInfos()
1687 // create draw:style-name entries for master page export
1688 // containing only background attributes
1689 // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
1692 for( nCnt
= 0; nCnt
< mnDocMasterPageCount
; nCnt
++)
1694 Reference
<XDrawPage
> xDrawPage
;
1695 mxDocMasterPages
->getByIndex(nCnt
) >>= xDrawPage
;
1696 maMasterPagesStyleNames
[nCnt
] = ImpCreatePresPageStyleName( xDrawPage
);
1701 Reference
< presentation::XHandoutMasterSupplier
> xHandoutSupp( GetModel(), UNO_QUERY
);
1702 if( xHandoutSupp
.is() )
1704 Reference
< XDrawPage
> xHandoutPage( xHandoutSupp
->getHandoutMasterPage() );
1705 if( xHandoutPage
.is() )
1707 maHandoutPageHeaderFooterSettings
= ImpPrepDrawPageHeaderFooterDecls( xHandoutPage
);
1708 maHandoutMasterStyleName
= ImpCreatePresPageStyleName( xHandoutPage
, false );
1714 void SdXMLExport::ImpWritePresentationStyles()
1718 for (sal_Int32 nCnt
= 0; nCnt
< mnDocMasterPageCount
; nCnt
++)
1720 Any
aAny(mxDocMasterPages
->getByIndex(nCnt
));
1721 Reference
<container::XNamed
> xNamed
;
1725 // write presentation styles (ONLY if presentation)
1726 if(IsImpress() && mxDocStyleFamilies
.is() && xNamed
.is())
1728 XMLStyleExport
aStEx(*this, OUString(), GetAutoStylePool().get());
1729 const rtl::Reference
< SvXMLExportPropertyMapper
> aMapperRef( GetPropertySetMapper() );
1731 OUString
aPrefix( xNamed
->getName() );
1734 aStEx
.exportStyleFamily(xNamed
->getName(),
1735 OUString(XML_STYLE_FAMILY_SD_PRESENTATION_NAME
),
1737 XML_STYLE_FAMILY_SD_PRESENTATION_ID
, &aPrefix
);
1744 void SdXMLExport::SetProgress(sal_Int32 nProg
)
1746 // set progress view
1747 if(GetStatusIndicator().is())
1748 GetStatusIndicator()->setValue(nProg
);
1753 void SdXMLExport::_ExportMeta()
1755 uno::Sequence
<beans::NamedValue
> stats(1);
1756 stats
[0] = beans::NamedValue(OUString( "ObjectCount" ),
1757 uno::makeAny(mnObjectCount
));
1759 // update document statistics at the model
1760 uno::Reference
<document::XDocumentPropertiesSupplier
> xPropSup(GetModel(),
1761 uno::UNO_QUERY_THROW
);
1762 uno::Reference
<document::XDocumentProperties
> xDocProps(
1763 xPropSup
->getDocumentProperties());
1764 if (xDocProps
.is()) {
1765 xDocProps
->setDocumentStatistics(stats
);
1769 SvXMLExport::_ExportMeta();
1772 void SdXMLExport::_ExportFontDecls()
1774 GetFontAutoStylePool(); // make sure the pool is created
1775 SvXMLExport::_ExportFontDecls();
1778 void SdXMLExport::_ExportContent()
1780 // export <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl> elements
1781 ImpWriteHeaderFooterDecls();
1784 for(sal_Int32
nPageInd(0); nPageInd
< mnDocDrawPageCount
; nPageInd
++)
1786 uno::Reference
<drawing::XDrawPage
> xDrawPage( mxDocDrawPages
->getByIndex(nPageInd
), uno::UNO_QUERY
);
1788 SetProgress(((nPageInd
+ 1) * 100) / mnDocDrawPageCount
);
1792 // prepare page attributes, name of page
1793 Reference
< container::XNamed
> xNamed(xDrawPage
, UNO_QUERY
);
1795 AddAttribute(XML_NAMESPACE_DRAW
, XML_NAME
, xNamed
->getName());
1797 // draw:style-name (presentation page attributes AND background attributes)
1798 if( !maDrawPagesStyleNames
[nPageInd
].isEmpty() )
1799 AddAttribute(XML_NAMESPACE_DRAW
, XML_STYLE_NAME
,
1800 maDrawPagesStyleNames
[nPageInd
]);
1802 // draw:master-page-name
1803 Reference
< drawing::XMasterPageTarget
> xMasterPageInt(xDrawPage
, UNO_QUERY
);
1804 if(xMasterPageInt
.is())
1806 Reference
<XDrawPage
> xUsedMasterPage(xMasterPageInt
->getMasterPage());
1807 if(xUsedMasterPage
.is())
1809 Reference
< container::XNamed
> xMasterNamed(xUsedMasterPage
, UNO_QUERY
);
1810 if(xMasterNamed
.is())
1812 AddAttribute(XML_NAMESPACE_DRAW
, XML_MASTER_PAGE_NAME
,
1813 EncodeStyleName( xMasterNamed
->getName()) );
1818 // presentation:page-layout-name
1819 if( IsImpress() && !maDrawPagesAutoLayoutNames
[nPageInd
+1].isEmpty())
1821 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_PRESENTATION_PAGE_LAYOUT_NAME
, maDrawPagesAutoLayoutNames
[nPageInd
+1] );
1824 Reference
< beans::XPropertySet
> xProps( xDrawPage
, UNO_QUERY
);
1829 OUString aBookmarkURL
;
1830 xProps
->getPropertyValue("BookmarkURL") >>= aBookmarkURL
;
1832 if( !aBookmarkURL
.isEmpty() )
1834 sal_Int32 nIndex
= aBookmarkURL
.lastIndexOf( '#' );
1837 OUString
aFileName( aBookmarkURL
.copy( 0, nIndex
) );
1838 OUString
aBookmarkName( aBookmarkURL
.copy( nIndex
+1 ) );
1840 aBookmarkURL
= GetRelativeReference( aFileName
) + "#" + aBookmarkName
;
1843 AddAttribute ( XML_NAMESPACE_XLINK
, XML_HREF
, aBookmarkURL
);
1844 AddAttribute ( XML_NAMESPACE_XLINK
, XML_TYPE
, XML_SIMPLE
);
1845 AddAttribute ( XML_NAMESPACE_XLINK
, XML_SHOW
, XML_REPLACE
);
1846 AddAttribute ( XML_NAMESPACE_XLINK
, XML_ACTUATE
, XML_ONREQUEST
);
1849 catch(const Exception
&)
1851 OSL_FAIL(" no \"BookmarkURL\" property at page?" );
1856 ImplExportHeaderFooterDeclAttributes( maDrawPagesHeaderFooterSettings
[nPageInd
] );
1858 OUString
sNavigationOrder( getNavigationOrder( xDrawPage
) );
1859 if( !sNavigationOrder
.isEmpty() )
1860 AddAttribute ( XML_NAMESPACE_DRAW
, XML_NAV_ORDER
, sNavigationOrder
);
1862 rtl::Reference
< xmloff::AnimationsExporter
> xAnimationsExporter
;
1863 uno::Reference
< ::com::sun::star::animations::XAnimationNodeSupplier
> xAnimNodeSupplier
;
1865 // prepare animation export
1868 if( getExportFlags() & SvXMLExportFlags::OASIS
)
1870 // export new animations for oasis format
1871 xAnimNodeSupplier
.set( xDrawPage
, UNO_QUERY
);
1873 // prepare animations exporter if impress
1874 if(xAnimNodeSupplier
.is())
1876 xAnimationsExporter
= new xmloff::AnimationsExporter( *this, xProps
);
1877 xAnimationsExporter
->prepare( xAnimNodeSupplier
->getAnimationNode() );
1882 // export old animations for ooo format
1883 rtl::Reference
< XMLAnimationsExporter
> xAnimExport
= new XMLAnimationsExporter( GetShapeExport().get() );
1884 GetShapeExport()->setAnimationsExporter( xAnimExport
);
1889 const OUString aPageId
= getInterfaceToIdentifierMapper().getIdentifier( xDrawPage
);
1890 if( !aPageId
.isEmpty() )
1892 AddAttributeIdLegacy(XML_NAMESPACE_DRAW
, aPageId
);
1896 SvXMLElementExport
aDPG(*this, XML_NAMESPACE_DRAW
, XML_PAGE
, true, true);
1898 // write optional office:forms
1899 exportFormsElement( xDrawPage
);
1901 // write graphic objects on this page (if any)
1902 Reference
< drawing::XShapes
> xExportShapes(xDrawPage
, UNO_QUERY
);
1903 if(xExportShapes
.is() && xExportShapes
->getCount())
1904 GetShapeExport()->exportShapes( xExportShapes
);
1906 // write animations and presentation notes (ONLY if presentation)
1909 if(xAnimNodeSupplier
.is())
1911 xAnimationsExporter
->exportAnimations( xAnimNodeSupplier
->getAnimationNode() );
1916 rtl::Reference
< XMLAnimationsExporter
> xAnimExport( GetShapeExport()->getAnimationsExporter() );
1917 if( xAnimExport
.is() )
1918 xAnimExport
->exportAnimations( *this );
1921 GetShapeExport()->setAnimationsExporter( xAnimExport
);
1925 Reference
< presentation::XPresentationPage
> xPresPage(xDrawPage
, UNO_QUERY
);
1928 Reference
< XDrawPage
> xNotesPage(xPresPage
->getNotesPage());
1931 Reference
< drawing::XShapes
> xShapes(xNotesPage
, UNO_QUERY
);
1934 if( !maDrawNotesPagesStyleNames
[nPageInd
].isEmpty() )
1935 AddAttribute(XML_NAMESPACE_DRAW
, XML_STYLE_NAME
, maDrawNotesPagesStyleNames
[nPageInd
]);
1937 ImplExportHeaderFooterDeclAttributes( maDrawNotesPagesHeaderFooterSettings
[nPageInd
] );
1939 // write presentation notes
1940 SvXMLElementExport
aPSY(*this, XML_NAMESPACE_PRESENTATION
, XML_NOTES
, true, true);
1942 // write optional office:forms
1943 exportFormsElement( xNotesPage
);
1945 // write shapes per se
1946 GetShapeExport()->exportShapes( xShapes
);
1952 exportAnnotations( xDrawPage
);
1957 exportPresentationSettings();
1960 void SdXMLExport::exportPresentationSettings()
1964 Reference
< XPresentationSupplier
> xPresSupplier( GetModel(), UNO_QUERY
);
1965 if( !xPresSupplier
.is() )
1968 Reference
< XPropertySet
> xPresProps( xPresSupplier
->getPresentation(), UNO_QUERY
);
1969 if( !xPresProps
.is() )
1972 bool bHasAttr
= false;
1977 xPresProps
->getPropertyValue("IsShowAll") >>= bTemp
;
1980 OUString aFirstPage
;
1981 xPresProps
->getPropertyValue("FirstPage") >>= aFirstPage
;
1982 if( !aFirstPage
.isEmpty() )
1984 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_START_PAGE
, aFirstPage
);
1989 OUString aCustomShow
;
1990 xPresProps
->getPropertyValue("CustomShow") >>= aCustomShow
;
1991 if( !aCustomShow
.isEmpty() )
1993 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_SHOW
, aCustomShow
);
1999 xPresProps
->getPropertyValue("IsEndless") >>= bTemp
;
2002 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_ENDLESS
, XML_TRUE
);
2005 sal_Int32 nPause
= 0;
2006 xPresProps
->getPropertyValue("Pause") >>= nPause
;
2008 util::Duration aDuration
;
2009 aDuration
.Seconds
= static_cast<sal_uInt16
>(nPause
);
2011 OUStringBuffer aOut
;
2012 ::sax::Converter::convertDuration(aOut
, aDuration
);
2013 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_PAUSE
, aOut
.makeStringAndClear() );
2016 xPresProps
->getPropertyValue("AllowAnimations") >>= bTemp
;
2019 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_ANIMATIONS
, XML_DISABLED
);
2023 xPresProps
->getPropertyValue("IsAlwaysOnTop") >>= bTemp
;
2026 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_STAY_ON_TOP
, XML_TRUE
);
2030 xPresProps
->getPropertyValue("IsAutomatic") >>= bTemp
;
2033 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_FORCE_MANUAL
, XML_TRUE
);
2037 xPresProps
->getPropertyValue("IsFullScreen") >>= bTemp
;
2040 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_FULL_SCREEN
, XML_FALSE
);
2044 xPresProps
->getPropertyValue("IsMouseVisible") >>= bTemp
;
2047 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_MOUSE_VISIBLE
, XML_FALSE
);
2051 xPresProps
->getPropertyValue("StartWithNavigator") >>= bTemp
;
2054 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_START_WITH_NAVIGATOR
, XML_TRUE
);
2058 xPresProps
->getPropertyValue("UsePen") >>= bTemp
;
2061 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_MOUSE_AS_PEN
, XML_TRUE
);
2065 xPresProps
->getPropertyValue("IsTransitionOnClick") >>= bTemp
;
2068 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_TRANSITION_ON_CLICK
, XML_DISABLED
);
2072 xPresProps
->getPropertyValue("IsShowLogo") >>= bTemp
;
2075 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_SHOW_LOGO
, XML_TRUE
);
2079 Reference
< container::XNameContainer
> xShows
;
2080 Sequence
< OUString
> aShowNames
;
2081 const OUString
* pShowNames
= NULL
;
2082 sal_Int32 nShowCount
= 0;
2084 Reference
< XCustomPresentationSupplier
> xSup( GetModel(), UNO_QUERY
);
2087 xShows
= xSup
->getCustomPresentations();
2090 aShowNames
= xShows
->getElementNames();
2091 pShowNames
= aShowNames
.getArray();
2092 nShowCount
= aShowNames
.getLength();
2096 if( bHasAttr
|| nShowCount
!= 0 )
2098 SvXMLElementExport
aSettings(*this, XML_NAMESPACE_PRESENTATION
, XML_SETTINGS
, true, true);
2100 if( nShowCount
== 0 )
2103 Reference
< XIndexContainer
> xShow
;
2104 Reference
< XNamed
> xPageName
;
2106 OUStringBuffer sTmp
;
2108 for( sal_Int32 nIndex
= 0; nIndex
< nShowCount
; nIndex
++, pShowNames
++ )
2110 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_NAME
, *pShowNames
);
2112 xShows
->getByName( *pShowNames
) >>= xShow
;
2113 DBG_ASSERT( xShow
.is(), "invalid custom show!" );
2117 const sal_Int32 nPageCount
= xShow
->getCount();
2118 for( sal_Int32 nPage
= 0; nPage
< nPageCount
; nPage
++ )
2120 xShow
->getByIndex( nPage
) >>= xPageName
;
2122 if( !xPageName
.is() )
2125 if( !sTmp
.isEmpty() )
2127 sTmp
.append( xPageName
->getName() );
2131 if( !sTmp
.isEmpty() )
2132 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_PAGES
, sTmp
.makeStringAndClear() );
2134 SvXMLElementExport
aShows(*this, XML_NAMESPACE_PRESENTATION
, XML_SHOW
, true, true);
2138 catch(const uno::Exception
&)
2140 OSL_FAIL( "uno::Exception while exporting <presentation:settings>" );
2144 void SdXMLExport::_ExportStyles(bool bUsed
)
2146 GetPropertySetMapper()->SetAutoStyles( false );
2148 // export fill styles
2149 SvXMLExport::_ExportStyles( bUsed
);
2151 // write draw:style-name for object graphic-styles
2152 GetShapeExport()->ExportGraphicDefaults();
2154 // do not export in ODF 1.1 or older
2155 if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012
)
2156 GetShapeExport()->GetShapeTableExport()->exportTableStyles();
2158 // write presentation styles
2159 ImpWritePresentationStyles();
2161 // prepare draw:auto-layout-name for page export
2162 ImpPrepAutoLayoutInfos();
2164 // write draw:auto-layout-name for page export
2165 ImpWriteAutoLayoutInfos();
2167 Reference
< beans::XPropertySet
> xInfoSet( getExportInfo() );
2170 Reference
< beans::XPropertySetInfo
> xInfoSetInfo( xInfoSet
->getPropertySetInfo() );
2174 if( xInfoSetInfo
->hasPropertyByName( msPageLayoutNames
) )
2176 aAny
<<= maDrawPagesAutoLayoutNames
;
2177 xInfoSet
->setPropertyValue( msPageLayoutNames
, aAny
);
2182 void SdXMLExport::_ExportAutoStyles()
2184 Reference
< beans::XPropertySet
> xInfoSet( getExportInfo() );
2187 Reference
< beans::XPropertySetInfo
> xInfoSetInfo( xInfoSet
->getPropertySetInfo() );
2189 if( xInfoSetInfo
->hasPropertyByName( msPageLayoutNames
) )
2191 xInfoSet
->getPropertyValue( msPageLayoutNames
) >>= maDrawPagesAutoLayoutNames
;
2195 GetPropertySetMapper()->SetAutoStyles( true );
2197 if( getExportFlags() & SvXMLExportFlags::STYLES
)
2199 // #80012# PageMaster export moved from _ExportStyles
2200 // prepare page-master infos
2201 ImpPrepPageMasterInfos();
2203 // write page-master infos
2204 ImpWritePageMasterInfos();
2206 // prepare draw:style-name for master page export
2207 ImpPrepMasterPageInfos();
2210 if( getExportFlags() & SvXMLExportFlags::CONTENT
)
2212 // prepare draw:style-name for page export
2213 ImpPrepDrawPageInfos();
2216 // export draw-page styles
2217 GetAutoStylePool()->exportXML(
2218 XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID
2220 GetMM100UnitConverter(),
2224 if( getExportFlags() & SvXMLExportFlags::STYLES
)
2226 // create auto style infos for shapes on master handout page
2229 Reference
< presentation::XHandoutMasterSupplier
> xHandoutSupp( GetModel(), UNO_QUERY
);
2230 if( xHandoutSupp
.is() )
2232 Reference
< XDrawPage
> xHandoutPage( xHandoutSupp
->getHandoutMasterPage() );
2233 if( xHandoutPage
.is() )
2235 Reference
< drawing::XShapes
> xShapes(xHandoutPage
, UNO_QUERY
);
2236 if(xShapes
.is() && xShapes
->getCount())
2237 GetShapeExport()->collectShapesAutoStyles( xShapes
);
2242 // create auto style infos for objects on master pages
2243 for(sal_Int32
nMPageId(0L); nMPageId
< mnDocMasterPageCount
; nMPageId
++)
2245 Reference
< XDrawPage
> xMasterPage(mxDocMasterPages
->getByIndex(nMPageId
), UNO_QUERY
);
2247 if( xMasterPage
.is() )
2249 // collect layer information
2250 GetFormExport()->examineForms( xMasterPage
);
2252 // get MasterPage Name
2253 OUString aMasterPageNamePrefix
;
2254 Reference
< container::XNamed
> xNamed(xMasterPage
, UNO_QUERY
);
2257 aMasterPageNamePrefix
= xNamed
->getName();
2259 if(!aMasterPageNamePrefix
.isEmpty())
2261 aMasterPageNamePrefix
+= "-";
2263 GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix
);
2265 Reference
< drawing::XShapes
> xMasterShapes(xMasterPage
, UNO_QUERY
);
2266 if(xMasterShapes
.is() && xMasterShapes
->getCount())
2267 GetShapeExport()->collectShapesAutoStyles( xMasterShapes
);
2271 Reference
< presentation::XPresentationPage
> xPresPage(xMasterPage
, UNO_QUERY
);
2274 Reference
< XDrawPage
> xNotesPage(xPresPage
->getNotesPage());
2277 // collect layer information
2278 GetFormExport()->examineForms( xNotesPage
);
2280 Reference
< drawing::XShapes
> xShapes(xNotesPage
, UNO_QUERY
);
2281 if(xShapes
.is() && xShapes
->getCount())
2282 GetShapeExport()->collectShapesAutoStyles( xShapes
);
2286 collectAnnotationAutoStyles(xMasterPage
);
2291 if( getExportFlags() & SvXMLExportFlags::CONTENT
)
2293 // prepare animations exporter if impress
2294 if(IsImpress() && (!(getExportFlags() & SvXMLExportFlags::OASIS
)) )
2296 rtl::Reference
< XMLAnimationsExporter
> xAnimExport
= new XMLAnimationsExporter( GetShapeExport().get() );
2297 GetShapeExport()->setAnimationsExporter( xAnimExport
);
2300 // create auto style infos for objects on pages
2301 for(sal_Int32
nPageInd(0); nPageInd
< mnDocDrawPageCount
; nPageInd
++)
2303 Reference
<XDrawPage
> xDrawPage( mxDocDrawPages
->getByIndex(nPageInd
), UNO_QUERY
);
2304 if( xDrawPage
.is() )
2306 // collect layer information
2307 GetFormExport()->examineForms( xDrawPage
);
2309 // get MasterPage Name
2310 OUString aMasterPageNamePrefix
;
2311 Reference
< drawing::XMasterPageTarget
> xMasterPageInt(xDrawPage
, UNO_QUERY
);
2312 if(xMasterPageInt
.is())
2314 Reference
<XDrawPage
> xUsedMasterPage(xMasterPageInt
->getMasterPage());
2315 if(xUsedMasterPage
.is())
2317 Reference
< container::XNamed
> xMasterNamed(xUsedMasterPage
, UNO_QUERY
);
2318 if(xMasterNamed
.is())
2320 aMasterPageNamePrefix
= xMasterNamed
->getName();
2324 if(!aMasterPageNamePrefix
.isEmpty())
2326 aMasterPageNamePrefix
+= "-";
2329 GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix
);
2331 // prepare object infos
2332 Reference
< drawing::XShapes
> xDrawShapes(xDrawPage
, UNO_QUERY
);
2333 if(xDrawShapes
.is() && xDrawShapes
->getCount())
2334 GetShapeExport()->collectShapesAutoStyles( xDrawShapes
);
2336 // prepare presentation notes page object infos (ONLY if presentation)
2339 Reference
< presentation::XPresentationPage
> xPresPage(xDrawPage
, UNO_QUERY
);
2342 Reference
< XDrawPage
> xNotesPage(xPresPage
->getNotesPage());
2345 // collect layer information
2346 GetFormExport()->examineForms( xNotesPage
);
2348 Reference
< drawing::XShapes
> xShapes(xNotesPage
, UNO_QUERY
);
2349 if(xShapes
.is() && xShapes
->getCount())
2350 GetShapeExport()->collectShapesAutoStyles( xShapes
);
2355 collectAnnotationAutoStyles( xDrawPage
);
2360 rtl::Reference
< XMLAnimationsExporter
> xAnimExport
;
2361 GetShapeExport()->setAnimationsExporter( xAnimExport
);
2365 exportAutoDataStyles();
2367 GetShapeExport()->exportAutoStyles();
2369 SvXMLExportFlags nContentAutostyles
= SvXMLExportFlags::CONTENT
| SvXMLExportFlags::AUTOSTYLES
;
2370 if ( ( getExportFlags() & nContentAutostyles
) == nContentAutostyles
)
2371 GetFormExport()->exportAutoStyles( );
2374 GetTextParagraphExport()->exportTextAutoStyles();
2377 void SdXMLExport::_ExportMasterStyles()
2380 SdXMLayerExporter::exportLayer( *this );
2382 // export handout master page if impress
2385 Reference
< presentation::XHandoutMasterSupplier
> xHandoutSupp( GetModel(), UNO_QUERY
);
2386 if( xHandoutSupp
.is() )
2388 Reference
< XDrawPage
> xHandoutPage( xHandoutSupp
->getHandoutMasterPage() );
2389 if( xHandoutPage
.is() )
2391 // presentation:page-layout-name
2392 if( IsImpress() && !maDrawPagesAutoLayoutNames
[0].isEmpty())
2394 AddAttribute(XML_NAMESPACE_PRESENTATION
, XML_PRESENTATION_PAGE_LAYOUT_NAME
, EncodeStyleName( maDrawPagesAutoLayoutNames
[0] ));
2397 ImpXMLEXPPageMasterInfo
* pInfo
= mpHandoutPageMaster
;
2400 OUString sString
= pInfo
->GetName();
2401 AddAttribute(XML_NAMESPACE_STYLE
, XML_PAGE_LAYOUT_NAME
, sString
);
2405 if( !maHandoutMasterStyleName
.isEmpty() )
2406 AddAttribute(XML_NAMESPACE_DRAW
, XML_STYLE_NAME
, maHandoutMasterStyleName
);
2408 ImplExportHeaderFooterDeclAttributes( maHandoutPageHeaderFooterSettings
);
2411 SvXMLElementExport
aMPG(*this, XML_NAMESPACE_STYLE
, XML_HANDOUT_MASTER
, true, true);
2413 // write graphic objects on this master page (if any)
2414 Reference
< drawing::XShapes
> xShapes(xHandoutPage
, UNO_QUERY
);
2415 if(xShapes
.is() && xShapes
->getCount())
2416 GetShapeExport()->exportShapes( xShapes
);
2421 // export MasterPages in master-styles section
2422 for (sal_Int32 nMPageId
= 0; nMPageId
< mnDocMasterPageCount
; nMPageId
++)
2424 Reference
< XDrawPage
> xMasterPage( mxDocMasterPages
->getByIndex(nMPageId
), UNO_QUERY
);
2425 if(xMasterPage
.is())
2427 // prepare masterpage attributes
2428 OUString sMasterPageName
;
2429 Reference
< container::XNamed
> xNamed(xMasterPage
, UNO_QUERY
);
2432 bool bEncoded
= false;
2433 sMasterPageName
= xNamed
->getName();
2434 AddAttribute(XML_NAMESPACE_STYLE
, XML_NAME
,
2435 EncodeStyleName( sMasterPageName
, &bEncoded
));
2438 XML_NAMESPACE_STYLE
, XML_DISPLAY_NAME
,
2442 ImpXMLEXPPageMasterInfo
* pInfo
= mpPageMasterUsageList
->at( nMPageId
);
2445 OUString sString
= pInfo
->GetName();
2446 AddAttribute(XML_NAMESPACE_STYLE
, XML_PAGE_LAYOUT_NAME
, sString
);
2449 // draw:style-name (background attributes)
2450 if( !maMasterPagesStyleNames
[nMPageId
].isEmpty() )
2451 AddAttribute(XML_NAMESPACE_DRAW
, XML_STYLE_NAME
,
2452 maMasterPagesStyleNames
[nMPageId
]);
2455 SvXMLElementExport
aMPG(*this, XML_NAMESPACE_STYLE
, XML_MASTER_PAGE
, true, true);
2457 // write optional office:forms
2458 exportFormsElement( xMasterPage
);
2460 // write graphic objects on this master page (if any)
2461 Reference
< drawing::XShapes
> xMasterShapes(xMasterPage
, UNO_QUERY
);
2462 if(xMasterShapes
.is() && xMasterShapes
->getCount())
2463 GetShapeExport()->exportShapes( xMasterShapes
);
2465 // write presentation notes (ONLY if presentation)
2468 Reference
< presentation::XPresentationPage
> xPresPage(xMasterPage
, UNO_QUERY
);
2471 Reference
< XDrawPage
> xNotesPage(xPresPage
->getNotesPage());
2474 Reference
< drawing::XShapes
> xShapes(xNotesPage
, UNO_QUERY
);
2477 ImpXMLEXPPageMasterInfo
* pMasterInfo
= mpNotesPageMasterUsageList
->at( nMPageId
);
2480 OUString sString
= pMasterInfo
->GetName();
2481 AddAttribute(XML_NAMESPACE_STYLE
, XML_PAGE_LAYOUT_NAME
, sString
);
2484 // write presentation notes
2485 SvXMLElementExport
aPSY(*this, XML_NAMESPACE_PRESENTATION
, XML_NOTES
, true, true);
2487 // write optional office:forms
2488 exportFormsElement( xNotesPage
);
2490 // write shapes per se
2491 GetShapeExport()->exportShapes( xShapes
);
2496 exportAnnotations( xMasterPage
);
2501 void SdXMLExport::exportFormsElement( Reference
< XDrawPage
> xDrawPage
)
2503 if( xDrawPage
.is() )
2505 Reference
< form::XFormsSupplier2
> xFormsSupplier( xDrawPage
, UNO_QUERY
);
2506 if ( xFormsSupplier
.is() && xFormsSupplier
->hasForms() )
2509 ::xmloff::OOfficeFormsExport
aForms(*this);
2510 GetFormExport()->exportForms( xDrawPage
);
2513 if(! GetFormExport()->seekPage( xDrawPage
) )
2515 OSL_FAIL( "OFormLayerXMLExport::seekPage failed!" );
2520 void SdXMLExport::GetViewSettings(uno::Sequence
<beans::PropertyValue
>& rProps
)
2523 beans::PropertyValue
* pProps
= rProps
.getArray();
2526 Reference
< beans::XPropertySet
> xPropSet( GetModel(), UNO_QUERY
);
2527 if( !xPropSet
.is() )
2530 awt::Rectangle aVisArea
;
2531 xPropSet
->getPropertyValue("VisibleArea") >>= aVisArea
;
2534 pProps
[i
].Name
= "VisibleAreaTop";
2535 pProps
[i
++].Value
<<= aVisArea
.Y
;
2536 pProps
[i
].Name
= "VisibleAreaLeft";
2537 pProps
[i
++].Value
<<= aVisArea
.X
;
2538 pProps
[i
].Name
= "VisibleAreaWidth";
2539 pProps
[i
++].Value
<<= aVisArea
.Width
;
2540 pProps
[i
].Name
= "VisibleAreaHeight";
2541 pProps
[i
++].Value
<<= aVisArea
.Height
;
2545 void SdXMLExport::GetConfigurationSettings(uno::Sequence
<beans::PropertyValue
>& rProps
)
2547 Reference
< lang::XMultiServiceFactory
> xFac( GetModel(), UNO_QUERY
);
2550 Reference
< beans::XPropertySet
> xProps( xFac
->createInstance("com.sun.star.document.Settings"), UNO_QUERY
);
2552 SvXMLUnitConverter::convertPropertySet( rProps
, xProps
);
2553 DocumentSettingsSerializer
*pFilter(dynamic_cast<DocumentSettingsSerializer
*>(xProps
.get()));
2556 const uno::Reference
< embed::XStorage
> xStorage(GetTargetStorage());
2559 rProps
= pFilter
->filterStreamsToStorage(xStorage
, rProps
);
2563 void SdXMLExport::addDataStyle(const sal_Int32 nNumberFormat
, bool bTimeFormat
)
2565 sal_Int32 nFormat
= nNumberFormat
;
2566 if( (nNumberFormat
> 1) && (nNumberFormat
<= 0x0f) )
2571 if( maUsedTimeStyles
.count( nFormat
) == 0 )
2572 maUsedTimeStyles
.insert( nFormat
);
2576 if( maUsedDateStyles
.count( nFormat
) == 0 )
2577 maUsedDateStyles
.insert( nFormat
);
2581 void SdXMLExport::exportDataStyles()
2583 // there are no data styles to export in draw/impress yet
2586 void SdXMLExport::exportAutoDataStyles()
2588 SdXMLFormatMap::iterator
aIter( maUsedDateStyles
.begin() );
2589 SdXMLFormatMap::iterator
aEnd( maUsedDateStyles
.end() );
2591 while( aIter
!= aEnd
)
2592 SdXMLNumberStylesExporter::exportDateStyle( *this, (*aIter
++) );
2594 aIter
= maUsedTimeStyles
.begin();
2595 aEnd
= maUsedTimeStyles
.end();
2596 while( aIter
!= aEnd
)
2597 SdXMLNumberStylesExporter::exportTimeStyle( *this, (*aIter
++) );
2600 GetFormExport()->exportAutoControlNumberStyles();
2603 OUString
SdXMLExport::getDataStyleName(const sal_Int32 nNumberFormat
, bool bTimeFormat
) const
2607 return SdXMLNumberStylesExporter::getTimeStyleName( nNumberFormat
);
2611 return SdXMLNumberStylesExporter::getDateStyleName( nNumberFormat
);
2615 OUString
SdXMLExport::getNavigationOrder( const Reference
< XDrawPage
>& xDrawPage
)
2617 OUStringBuffer sNavOrder
;
2620 Reference
< XPropertySet
> xSet( xDrawPage
, UNO_QUERY_THROW
);
2621 Reference
< XIndexAccess
> xNavOrder( xSet
->getPropertyValue("NavigationOrder"), UNO_QUERY_THROW
);
2623 Reference
< XIndexAccess
> xZOrderAccess( xDrawPage
, UNO_QUERY
);
2625 // only export navigation order if it is different from the z-order
2626 if( (xNavOrder
.get() != xZOrderAccess
.get()) && (xNavOrder
->getCount() == xDrawPage
->getCount()) )
2629 const sal_Int32 nCount
= xNavOrder
->getCount();
2630 for( nIndex
= 0; nIndex
< nCount
; ++nIndex
)
2632 OUString
sId( getInterfaceToIdentifierMapper().registerReference( Reference
< XInterface
>( xNavOrder
->getByIndex( nIndex
), UNO_QUERY
) ) );
2633 if( !sId
.isEmpty() )
2635 if( !sNavOrder
.isEmpty() )
2636 sNavOrder
.append( ' ' );
2637 sNavOrder
.append( sId
);
2642 catch(const Exception
&)
2645 return sNavOrder
.makeStringAndClear();
2648 void SdXMLExport::collectAnnotationAutoStyles( const Reference
<XDrawPage
>& xDrawPage
)
2650 Reference
< XAnnotationAccess
> xAnnotationAccess( xDrawPage
, UNO_QUERY
);
2651 if( xAnnotationAccess
.is() ) try
2653 Reference
< XAnnotationEnumeration
> xAnnotationEnumeration( xAnnotationAccess
->createAnnotationEnumeration() );
2654 if( xAnnotationEnumeration
.is() )
2656 while( xAnnotationEnumeration
->hasMoreElements() )
2658 Reference
< XAnnotation
> xAnnotation( xAnnotationEnumeration
->nextElement(), UNO_QUERY_THROW
);
2659 Reference
< XText
> xText( xAnnotation
->getTextRange() );
2660 if(xText
.is() && !xText
->getString().isEmpty())
2661 GetTextParagraphExport()->collectTextAutoStyles( xText
);
2665 catch(const Exception
&)
2667 OSL_FAIL("SdXMLExport::collectAnnotationAutoStyles(), exception caught during export of annotation auto styles");
2671 void SdXMLExport::exportAnnotations( const Reference
<XDrawPage
>& xDrawPage
)
2673 // do not export in ODF 1.2 or older
2674 if( getDefaultVersion() <= SvtSaveOptions::ODFVER_012
)
2677 Reference
< XAnnotationAccess
> xAnnotationAccess( xDrawPage
, UNO_QUERY
);
2678 if( xAnnotationAccess
.is() ) try
2680 Reference
< XAnnotationEnumeration
> xAnnotationEnumeration( xAnnotationAccess
->createAnnotationEnumeration() );
2681 if( xAnnotationEnumeration
.is() && xAnnotationEnumeration
->hasMoreElements() )
2683 OUStringBuffer sStringBuffer
;
2686 Reference
< XAnnotation
> xAnnotation( xAnnotationEnumeration
->nextElement(), UNO_QUERY_THROW
);
2688 RealPoint2D
aPosition( xAnnotation
->getPosition() );
2690 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
,
2691 static_cast<sal_Int32
>( aPosition
.X
* 100 ) );
2692 AddAttribute(XML_NAMESPACE_SVG
, XML_X
, sStringBuffer
.makeStringAndClear());
2694 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
,
2695 static_cast<sal_Int32
>( aPosition
.Y
* 100 ) );
2696 AddAttribute(XML_NAMESPACE_SVG
, XML_Y
, sStringBuffer
.makeStringAndClear());
2698 RealSize2D
aSize( xAnnotation
->getSize() );
2700 if( aSize
.Width
|| aSize
.Height
)
2702 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
,
2703 static_cast<sal_Int32
>( aSize
.Width
* 100 ) );
2704 AddAttribute(XML_NAMESPACE_SVG
, XML_WIDTH
, sStringBuffer
.makeStringAndClear());
2705 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer
,
2706 static_cast<sal_Int32
>( aSize
.Height
* 100 ) );
2707 AddAttribute(XML_NAMESPACE_SVG
, XML_HEIGHT
, sStringBuffer
.makeStringAndClear());
2710 // annotation element + content
2711 SvXMLElementExport
aElem(*this, XML_NAMESPACE_OFFICE_EXT
, XML_ANNOTATION
, false, true);
2714 OUString
aAuthor( xAnnotation
->getAuthor() );
2715 if( !aAuthor
.isEmpty() )
2717 SvXMLElementExport
aCreatorElem( *this, XML_NAMESPACE_DC
, XML_CREATOR
, true, false );
2718 this->Characters(aAuthor
);
2723 com::sun::star::util::DateTime
aDate( xAnnotation
->getDateTime() );
2724 ::sax::Converter::convertDateTime(sStringBuffer
, aDate
, 0, true);
2725 SvXMLElementExport
aDateElem( *this, XML_NAMESPACE_DC
, XML_DATE
, true, false );
2726 Characters(sStringBuffer
.makeStringAndClear());
2729 com::sun::star::uno::Reference
< com::sun::star::text::XText
> xText( xAnnotation
->getTextRange() );
2731 this->GetTextParagraphExport()->exportText( xText
);
2733 while( xAnnotationEnumeration
->hasMoreElements() );
2736 catch(const Exception
&)
2738 OSL_FAIL("SdXMLExport::exportAnnotations(), exception caught during export of annotations");
2742 #define SERVICE( classname, servicename, implementationname, draw, flags )\
2743 uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw()\
2745 const OUString aServiceName( servicename );\
2746 const uno::Sequence< OUString > aSeq( &aServiceName, 1 );\
2749 OUString SAL_CALL classname##_getImplementationName() throw()\
2751 return OUString( implementationname );\
2753 uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )\
2755 return (cppu::OWeakObject*)new SdXMLExport( comphelper::getComponentContext(rSMgr), implementationname, draw, flags ); \
2758 SERVICE( XMLImpressExportOasis
, "com.sun.star.comp.Impress.XMLOasisExporter", "XMLImpressExportOasis", false, SvXMLExportFlags::OASIS
|SvXMLExportFlags::META
|SvXMLExportFlags::STYLES
|SvXMLExportFlags::MASTERSTYLES
|SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::CONTENT
|SvXMLExportFlags::SCRIPTS
|SvXMLExportFlags::SETTINGS
|SvXMLExportFlags::FONTDECLS
|SvXMLExportFlags::EMBEDDED
);
2759 SERVICE( XMLImpressStylesExportOasis
, "com.sun.star.comp.Impress.XMLOasisStylesExporter", "XMLImpressStylesExportOasis", false, SvXMLExportFlags::OASIS
|SvXMLExportFlags::STYLES
|SvXMLExportFlags::MASTERSTYLES
|SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::FONTDECLS
);
2760 SERVICE( XMLImpressContentExportOasis
, "com.sun.star.comp.Impress.XMLOasisContentExporter", "XMLImpressContentExportOasis", false, SvXMLExportFlags::OASIS
|SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::CONTENT
|SvXMLExportFlags::SCRIPTS
|SvXMLExportFlags::FONTDECLS
);
2761 SERVICE( XMLImpressMetaExportOasis
, "com.sun.star.comp.Impress.XMLOasisMetaExporter", "XMLImpressMetaExportOasis", false, SvXMLExportFlags::OASIS
|SvXMLExportFlags::META
);
2762 SERVICE( XMLImpressSettingsExportOasis
, "com.sun.star.comp.Impress.XMLOasisSettingsExporter", "XMLImpressSettingsExportOasis", false, SvXMLExportFlags::OASIS
|SvXMLExportFlags::SETTINGS
);
2764 SERVICE( XMLImpressExportOOO
, "com.sun.star.comp.Impress.XMLExporter", "XMLImpressExportOOO", false, SvXMLExportFlags::META
|SvXMLExportFlags::STYLES
|SvXMLExportFlags::MASTERSTYLES
|SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::CONTENT
|SvXMLExportFlags::SCRIPTS
|SvXMLExportFlags::SETTINGS
|SvXMLExportFlags::FONTDECLS
|SvXMLExportFlags::EMBEDDED
);
2765 SERVICE( XMLImpressStylesExportOOO
, "com.sun.star.comp.Impress.XMLStylesExporter", "XMLImpressStylesExportOOO", false, SvXMLExportFlags::STYLES
|SvXMLExportFlags::MASTERSTYLES
|SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::FONTDECLS
);
2766 SERVICE( XMLImpressContentExportOOO
, "com.sun.star.comp.Impress.XMLContentExporter", "XMLImpressContentExportOOO", false, SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::CONTENT
|SvXMLExportFlags::SCRIPTS
|SvXMLExportFlags::FONTDECLS
);
2767 SERVICE( XMLImpressMetaExportOOO
, "com.sun.star.comp.Impress.XMLMetaExporter", "XMLImpressMetaExportOOO", false, SvXMLExportFlags::META
);
2768 SERVICE( XMLImpressSettingsExportOOO
, "com.sun.star.comp.Impress.XMLSettingsExporter", "XMLImpressSettingsExportOOO", false, SvXMLExportFlags::SETTINGS
);
2770 SERVICE( XMLDrawExportOasis
, "com.sun.star.comp.Draw.XMLOasisExporter", "XMLDrawExportOasis", true, SvXMLExportFlags::OASIS
|SvXMLExportFlags::META
|SvXMLExportFlags::STYLES
|SvXMLExportFlags::MASTERSTYLES
|SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::CONTENT
|SvXMLExportFlags::SCRIPTS
|SvXMLExportFlags::SETTINGS
|SvXMLExportFlags::FONTDECLS
|SvXMLExportFlags::EMBEDDED
);
2771 SERVICE( XMLDrawStylesExportOasis
, "com.sun.star.comp.Draw.XMLOasisStylesExporter", "XMLDrawStylesExportOasis", true, SvXMLExportFlags::OASIS
|SvXMLExportFlags::STYLES
|SvXMLExportFlags::MASTERSTYLES
|SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::FONTDECLS
);
2772 SERVICE( XMLDrawContentExportOasis
, "com.sun.star.comp.Draw.XMLOasisContentExporter", "XMLDrawContentExportOasis", true, SvXMLExportFlags::OASIS
|SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::CONTENT
|SvXMLExportFlags::SCRIPTS
|SvXMLExportFlags::FONTDECLS
);
2773 SERVICE( XMLDrawMetaExportOasis
, "com.sun.star.comp.Draw.XMLOasisMetaExporter", "XMLDrawMetaExportOasis", true, SvXMLExportFlags::OASIS
|SvXMLExportFlags::META
);
2774 SERVICE( XMLDrawSettingsExportOasis
, "com.sun.star.comp.Draw.XMLOasisSettingsExporter", "XMLDrawSettingsExportOasis", true, SvXMLExportFlags::OASIS
|SvXMLExportFlags::SETTINGS
);
2776 SERVICE( XMLDrawExportOOO
, "com.sun.star.comp.Draw.XMLExporter", "XMLDrawExportOOO", true, SvXMLExportFlags::META
|SvXMLExportFlags::STYLES
|SvXMLExportFlags::MASTERSTYLES
|SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::CONTENT
|SvXMLExportFlags::SCRIPTS
|SvXMLExportFlags::SETTINGS
|SvXMLExportFlags::FONTDECLS
|SvXMLExportFlags::EMBEDDED
);
2777 SERVICE( XMLDrawStylesExportOOO
, "com.sun.star.comp.Draw.XMLStylesExporter", "XMLDrawStylesExportOOO", true, SvXMLExportFlags::STYLES
|SvXMLExportFlags::MASTERSTYLES
|SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::FONTDECLS
);
2778 SERVICE( XMLDrawContentExportOOO
, "com.sun.star.comp.Draw.XMLContentExporter", "XMLDrawContentExportOOO", true, SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::CONTENT
|SvXMLExportFlags::SCRIPTS
|SvXMLExportFlags::FONTDECLS
);
2779 SERVICE( XMLDrawMetaExportOOO
, "com.sun.star.comp.Draw.XMLMetaExporter", "XMLDrawMetaExportOOO", true, SvXMLExportFlags::META
);
2780 SERVICE( XMLDrawSettingsExportOOO
, "com.sun.star.comp.Draw.XMLSettingsExporter", "XMLDrawSettingsExportOOO", true, SvXMLExportFlags::SETTINGS
);
2782 SERVICE( XMLDrawingLayerExport
, "com.sun.star.comp.DrawingLayer.XMLExporter", "XMLDrawingLayerExport", true, SvXMLExportFlags::OASIS
|SvXMLExportFlags::STYLES
|SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::CONTENT
|SvXMLExportFlags::FONTDECLS
|SvXMLExportFlags::EMBEDDED
);
2783 SERVICE( XMLImpressClipboardExport
, "com.sun.star.comp.Impress.XMLClipboardExporter", "XMLImpressClipboardExport", false, SvXMLExportFlags::OASIS
|SvXMLExportFlags::STYLES
|SvXMLExportFlags::AUTOSTYLES
|SvXMLExportFlags::CONTENT
|SvXMLExportFlags::FONTDECLS
|SvXMLExportFlags::EMBEDDED
);
2785 XMLFontAutoStylePool
* SdXMLExport::CreateFontAutoStylePool()
2787 bool bEmbedFonts
= false;
2788 if (getExportFlags() & SvXMLExportFlags::CONTENT
)
2790 Reference
< lang::XMultiServiceFactory
> xFac( GetModel(), UNO_QUERY
);
2795 Reference
<beans::XPropertySet
> const xProps( xFac
->createInstance(
2796 "com.sun.star.document.Settings"), UNO_QUERY_THROW
);
2797 xProps
->getPropertyValue("EmbedFonts") >>= bEmbedFonts
;
2801 // clipboard document doesn't have shell so throws from getPropertyValue
2802 // gallery elements may not support com.sun.star.document.Settings so throws from createInstance
2807 XMLFontAutoStylePool
*pPool
= new XMLFontAutoStylePool( *this, bEmbedFonts
);
2809 Reference
< beans::XPropertySet
> xProps( GetModel(), UNO_QUERY
);
2810 if ( xProps
.is() ) {
2811 Sequence
<Any
> aAnySeq
;
2812 if( xProps
->getPropertyValue("Fonts") >>= aAnySeq
)
2814 if( aAnySeq
.getLength() % 5 == 0 )
2816 int nLen
= aAnySeq
.getLength() / 5;
2818 for( int i
= 0; i
< nLen
; i
++ )
2820 OUString sFamilyName
, sStyleName
;
2821 sal_Int16
eFamily(FAMILY_DONTKNOW
),
2822 ePitch(PITCH_DONTKNOW
),
2823 eCharSet(RTL_TEXTENCODING_DONTKNOW
);
2825 aAnySeq
[nSeqIndex
++] >>= sFamilyName
;
2826 aAnySeq
[nSeqIndex
++] >>= sStyleName
;
2827 aAnySeq
[nSeqIndex
++] >>= eFamily
;
2828 aAnySeq
[nSeqIndex
++] >>= ePitch
;
2829 aAnySeq
[nSeqIndex
++] >>= eCharSet
;
2831 pPool
->Add( sFamilyName
, sStyleName
, FontFamily( eFamily
), FontPitch( ePitch
), rtl_TextEncoding( eCharSet
) );
2840 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */