Bump for 3.6-28
[LibreOffice.git] / xmloff / source / draw / sdxmlexp.cxx
blob8927e922d47096b57e47b1ed4e725a7a188374ec
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
30 #include <xmloff/nmspmap.hxx>
31 #include "xmloff/xmlnmspe.hxx"
32 #include <xmloff/xmluconv.hxx>
33 #include <xmloff/xmltoken.hxx>
34 #include <xmloff/xmlmetae.hxx>
35 #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
36 #include <com/sun/star/presentation/XPresentationSupplier.hpp>
37 #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
38 #include <com/sun/star/geometry/RealPoint2D.hpp>
39 #include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
40 #include <com/sun/star/office/XAnnotationAccess.hpp>
41 #include <com/sun/star/lang/Locale.hpp>
42 #include <com/sun/star/uno/Any.hxx>
43 #include "sdxmlexp_impl.hxx"
44 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
45 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
46 #include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
47 #include <com/sun/star/container/XIndexContainer.hpp>
48 #include <com/sun/star/view/PaperOrientation.hpp>
49 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
50 #include <com/sun/star/style/XStyle.hpp>
52 #include <com/sun/star/form/XFormsSupplier2.hpp>
53 #include <com/sun/star/presentation/XPresentationPage.hpp>
54 #include <com/sun/star/drawing/XMasterPageTarget.hpp>
55 #include <com/sun/star/text/XText.hpp>
56 #include <com/sun/star/chart/XChartDocument.hpp>
57 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
58 #include <com/sun/star/container/XNamed.hpp>
59 #include <com/sun/star/util/Duration.hpp>
60 #include <com/sun/star/util/MeasureUnit.hpp>
61 #include <rtl/ustrbuf.hxx>
62 #include <tools/gen.hxx>
63 #include <tools/debug.hxx>
64 #include <sax/tools/converter.hxx>
65 #include <xmloff/xmlaustp.hxx>
66 #include <xmloff/families.hxx>
67 #include <xmloff/styleexp.hxx>
68 #include <xmloff/settingsstore.hxx>
69 #include "sdpropls.hxx"
70 #include <xmloff/xmlexppr.hxx>
71 #include <com/sun/star/beans/XPropertyState.hpp>
72 #include "xexptran.hxx"
74 #include <cppuhelper/implbase1.hxx>
75 #include <comphelper/extract.hxx>
76 #include <com/sun/star/lang/XServiceInfo.hpp>
77 #include "PropertySetMerger.hxx"
78 #include "layerexp.hxx"
80 #include "XMLNumberStylesExport.hxx"
82 #include <xmloff/animationexport.hxx>
84 #include <com/sun/star/document/XDocumentProperties.hpp>
85 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
87 using ::rtl::OUString;
88 using ::rtl::OUStringBuffer;
90 using namespace ::com::sun::star;
91 using namespace ::com::sun::star::uno;
92 using namespace ::com::sun::star::beans;
93 using namespace ::com::sun::star::util;
94 using namespace ::com::sun::star::container;
95 using namespace ::com::sun::star::drawing;
96 using namespace ::com::sun::star::office;
97 using namespace ::com::sun::star::presentation;
98 using namespace ::com::sun::star::geometry;
99 using namespace ::com::sun::star::text;
100 using namespace ::xmloff::token;
103 //////////////////////////////////////////////////////////////////////////////
105 class ImpXMLEXPPageMasterInfo
107 sal_Int32 mnBorderBottom;
108 sal_Int32 mnBorderLeft;
109 sal_Int32 mnBorderRight;
110 sal_Int32 mnBorderTop;
111 sal_Int32 mnWidth;
112 sal_Int32 mnHeight;
113 view::PaperOrientation meOrientation;
114 OUString msName;
115 OUString msMasterPageName;
117 public:
118 ImpXMLEXPPageMasterInfo(const SdXMLExport& rExp, const Reference<XDrawPage>& xPage);
119 sal_Bool operator==(const ImpXMLEXPPageMasterInfo& rInfo) const;
120 void SetName(const OUString& rStr);
122 const OUString& GetName() const { return msName; }
123 const OUString& GetMasterPageName() const { return msMasterPageName; }
125 sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
126 sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
127 sal_Int32 GetBorderRight() const { return mnBorderRight; }
128 sal_Int32 GetBorderTop() const { return mnBorderTop; }
129 sal_Int32 GetWidth() const { return mnWidth; }
130 sal_Int32 GetHeight() const { return mnHeight; }
131 view::PaperOrientation GetOrientation() const { return meOrientation; }
134 ImpXMLEXPPageMasterInfo::ImpXMLEXPPageMasterInfo(
135 const SdXMLExport& rExp,
136 const Reference<XDrawPage>& xPage)
137 : mnBorderBottom(0),
138 mnBorderLeft(0),
139 mnBorderRight(0),
140 mnBorderTop(0),
141 mnWidth(0),
142 mnHeight(0),
143 meOrientation(rExp.IsDraw() ? view::PaperOrientation_PORTRAIT : view::PaperOrientation_LANDSCAPE)
145 Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY);
146 if(xPropSet.is())
148 Any aAny;
150 Reference< beans::XPropertySetInfo > xPropsInfo( xPropSet->getPropertySetInfo() );
151 if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom") )))
153 aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom")));
154 aAny >>= mnBorderBottom;
156 aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderLeft")));
157 aAny >>= mnBorderLeft;
159 aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderRight")));
160 aAny >>= mnBorderRight;
162 aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderTop")));
163 aAny >>= mnBorderTop;
166 if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("Width") )))
168 aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Width")));
169 aAny >>= mnWidth;
171 aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Height")));
172 aAny >>= mnHeight;
175 if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation") )))
177 aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation")));
178 aAny >>= meOrientation;
182 Reference <container::XNamed> xMasterNamed(xPage, UNO_QUERY);
183 if(xMasterNamed.is())
185 msMasterPageName = xMasterNamed->getName();
189 sal_Bool ImpXMLEXPPageMasterInfo::operator==(const ImpXMLEXPPageMasterInfo& rInfo) const
191 return ((mnBorderBottom == rInfo.mnBorderBottom)
192 && (mnBorderLeft == rInfo.mnBorderLeft)
193 && (mnBorderRight == rInfo.mnBorderRight)
194 && (mnBorderTop == rInfo.mnBorderTop)
195 && (mnWidth == rInfo.mnWidth)
196 && (mnHeight == rInfo.mnHeight)
197 && (meOrientation == rInfo.meOrientation));
200 void ImpXMLEXPPageMasterInfo::SetName(const OUString& rStr)
202 msName = rStr;
205 //////////////////////////////////////////////////////////////////////////////
207 #define IMP_AUTOLAYOUT_INFO_MAX (35L)
209 class ImpXMLAutoLayoutInfo
211 sal_uInt16 mnType;
212 ImpXMLEXPPageMasterInfo* mpPageMasterInfo;
213 OUString msLayoutName;
214 Rectangle maTitleRect;
215 Rectangle maPresRect;
216 sal_Int32 mnGapX;
217 sal_Int32 mnGapY;
219 public:
220 ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf);
222 sal_Bool operator==(const ImpXMLAutoLayoutInfo& rInfo) const;
224 sal_uInt16 GetLayoutType() const { return mnType; }
225 sal_Int32 GetGapX() const { return mnGapX; }
226 sal_Int32 GetGapY() const { return mnGapY; }
228 const OUString& GetLayoutName() const { return msLayoutName; }
229 void SetLayoutName(const OUString& rNew) { msLayoutName = rNew; }
231 const Rectangle& GetTitleRectangle() const { return maTitleRect; }
232 const Rectangle& GetPresRectangle() const { return maPresRect; }
234 static sal_Bool IsCreateNecessary(sal_uInt16 nTyp);
237 sal_Bool ImpXMLAutoLayoutInfo::IsCreateNecessary(sal_uInt16 nTyp)
239 if(nTyp == 5 /* AUTOLAYOUT_ORG */
240 || nTyp == 20 /* AUTOLAYOUT_NONE */
241 || nTyp >= IMP_AUTOLAYOUT_INFO_MAX)
242 return sal_False;
243 return sal_True;
246 sal_Bool ImpXMLAutoLayoutInfo::operator==(const ImpXMLAutoLayoutInfo& rInfo) const
248 return ((mnType == rInfo.mnType
249 && mpPageMasterInfo == rInfo.mpPageMasterInfo));
252 ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf)
253 : mnType(nTyp),
254 mpPageMasterInfo(pInf)
256 // create full info (initialze with typical values)
257 Point aPagePos(0,0);
258 Size aPageSize(28000, 21000);
259 Size aPageInnerSize(28000, 21000);
261 if(mpPageMasterInfo)
263 aPagePos = Point(mpPageMasterInfo->GetBorderLeft(), mpPageMasterInfo->GetBorderTop());
264 aPageSize = Size(mpPageMasterInfo->GetWidth(), mpPageMasterInfo->GetHeight());
265 aPageInnerSize = aPageSize;
266 aPageInnerSize.Width() -= mpPageMasterInfo->GetBorderLeft() + mpPageMasterInfo->GetBorderRight();
267 aPageInnerSize.Height() -= mpPageMasterInfo->GetBorderTop() + mpPageMasterInfo->GetBorderBottom();
270 // title rectangle aligning
271 Point aTitlePos(aPagePos);
272 Size aTitleSize(aPageInnerSize);
274 if(mnType == 21 /* AUTOLAYOUT_NOTES */)
276 aTitleSize.Height() = (long) (aTitleSize.Height() / 2.5);
277 Point aPos = aTitlePos;
278 aPos.Y() += long( aTitleSize.Height() * 0.083 );
279 Size aPartArea = aTitleSize;
280 Size aSize;
282 // tatsaechliche Seitengroesse in das Handout-Rechteck skalieren
283 double fH = (double) aPartArea.Width() / aPageSize.Width();
284 double fV = (double) aPartArea.Height() / aPageSize.Height();
286 if ( fH > fV )
287 fH = fV;
288 aSize.Width() = (long) (fH * aPageSize.Width());
289 aSize.Height() = (long) (fH * aPageSize.Height());
291 aPos.X() += (aPartArea.Width() - aSize.Width()) / 2;
292 aPos.Y() += (aPartArea.Height()- aSize.Height())/ 2;
294 aTitlePos = aPos;
295 aTitleSize = aSize;
297 else if(mnType == 27 || mnType == 28)
299 // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART or
300 // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
301 Point aClassicTPos(
302 aTitlePos.X() + long( aTitleSize.Width() * 0.0735 ),
303 aTitlePos.Y() + long( aTitleSize.Height() * 0.083 ));
304 Size aClassicTSize(
305 long( aTitleSize.Width() * 0.854 ),
306 long( aTitleSize.Height() * 0.167 ));
307 Point aLPos(aPagePos);
308 Size aLSize(aPageInnerSize);
309 Point aClassicLPos(
310 aLPos.X() + long( aLSize.Width() * 0.0735 ),
311 aLPos.Y() + long( aLSize.Height() * 0.472 ));
312 Size aClassicLSize(
313 long( aLSize.Width() * 0.854 ),
314 long( aLSize.Height() * 0.444 ));
316 aTitlePos.X() = (aClassicTPos.X() + aClassicTSize.Width()) - aClassicTSize.Height();
317 aTitlePos.Y() = aClassicTPos.Y();
318 aTitleSize.Width() = aClassicTSize.Height();
319 aTitleSize.Height() = (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y();
321 else
323 aTitlePos.X() += long( aTitleSize.Width() * 0.0735 );
324 aTitlePos.Y() += long( aTitleSize.Height() * 0.083 );
325 aTitleSize.Width() = long( aTitleSize.Width() * 0.854 );
326 aTitleSize.Height() = long( aTitleSize.Height() * 0.167 );
329 maTitleRect.SetPos(aTitlePos);
330 maTitleRect.SetSize(aTitleSize);
332 // layout rectangle aligning
333 Point aLayoutPos(aPagePos);
334 Size aLayoutSize(aPageInnerSize);
336 if(mnType == 21 /* AUTOLAYOUT_NOTES */)
338 aLayoutPos.X() += long( aLayoutSize.Width() * 0.0735 );
339 aLayoutPos.Y() += long( aLayoutSize.Height() * 0.472 );
340 aLayoutSize.Width() = long( aLayoutSize.Width() * 0.854 );
341 aLayoutSize.Height() = long( aLayoutSize.Height() * 0.444 );
343 else if((mnType >= 22 && mnType <= 26) || (mnType == 31)) // AUTOLAYOUT_HANDOUT
345 // keep info for inner area in maPresRect, put info for gap size
346 // to maTitleRect position
347 mnGapX = (aPageSize.Width() - aPageInnerSize.Width()) / 2;
348 mnGapY = (aPageSize.Height() - aPageInnerSize.Height()) / 2;
350 if(!mnGapX)
351 mnGapX = aPageSize.Width() / 10;
353 if(!mnGapY)
354 mnGapY = aPageSize.Height() / 10;
356 if(mnGapX < aPageInnerSize.Width() / 10)
357 mnGapX = aPageInnerSize.Width() / 10;
359 if(mnGapY < aPageInnerSize.Height() / 10)
360 mnGapY = aPageInnerSize.Height() / 10;
362 else if(mnType == 27 || mnType == 28)
364 // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART or
365 // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
366 Point aClassicTPos(
367 aTitlePos.X() + long( aTitleSize.Width() * 0.0735 ),
368 aTitlePos.Y() + long( aTitleSize.Height() * 0.083 ));
369 Size aClassicTSize(
370 long( aTitleSize.Width() * 0.854 ),
371 long( aTitleSize.Height() * 0.167 ));
372 Point aClassicLPos(
373 aLayoutPos.X() + long( aLayoutSize.Width() * 0.0735 ),
374 aLayoutPos.Y() + long( aLayoutSize.Height() * 0.472 ));
375 Size aClassicLSize(
376 long( aLayoutSize.Width() * 0.854 ),
377 long( aLayoutSize.Height() * 0.444 ));
379 aLayoutPos.X() = aClassicLPos.X();
380 aLayoutPos.Y() = aClassicTPos.Y();
381 aLayoutSize.Width() = (aClassicLPos.X() + aClassicLSize.Width())
382 - (aClassicTSize.Height() + (aClassicLPos.Y() - (aClassicTPos.Y() + aClassicTSize.Height())));
383 aLayoutSize.Height() = (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y();
385 else if( mnType == 32 )
387 // AUTOLAYOUT_ONLY_TEXT
388 aLayoutPos = aTitlePos;
389 aLayoutSize.Width() = aTitleSize.Width();
390 aLayoutSize.Height() = long( aLayoutSize.Height() * 0.825 );
392 else
394 aLayoutPos.X() += long( aLayoutSize.Width() * 0.0735 );
395 aLayoutPos.Y() += long( aLayoutSize.Height() * 0.278 );
396 aLayoutSize.Width() = long( aLayoutSize.Width() * 0.854 );
397 aLayoutSize.Height() = long( aLayoutSize.Height() * 0.630 );
400 maPresRect.SetPos(aLayoutPos);
401 maPresRect.SetSize(aLayoutSize);
404 //////////////////////////////////////////////////////////////////////////////
406 // #110680#
407 SdXMLExport::SdXMLExport(
408 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
409 sal_Bool bIsDraw, sal_uInt16 nExportFlags )
410 : SvXMLExport( util::MeasureUnit::CM, xServiceFactory,
411 (bIsDraw) ? XML_GRAPHICS : XML_PRESENTATION, nExportFlags ),
412 mnDocMasterPageCount(0L),
413 mnDocDrawPageCount(0L),
414 mnShapeStyleInfoIndex(0L),
415 mnObjectCount(0L),
416 mpPageMasterInfoList(new ImpXMLEXPPageMasterList()),
417 mpPageMasterUsageList(new ImpXMLEXPPageMasterList()),
418 mpNotesPageMasterUsageList(new ImpXMLEXPPageMasterList()),
419 mpHandoutPageMaster(NULL),
420 mpAutoLayoutInfoList(new ImpXMLAutoLayoutInfoList()),
421 mpSdPropHdlFactory(0L),
422 mpPropertySetMapper(0L),
423 mpPresPagePropsMapper(0L),
424 mbIsDraw(bIsDraw),
425 mbFamilyGraphicUsed(sal_False),
426 mbFamilyPresentationUsed(sal_False),
427 msZIndex( GetXMLToken(XML_ZINDEX) ),
428 msEmptyPres( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ),
429 msModel( RTL_CONSTASCII_USTRINGPARAM("Model") ),
430 msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
431 msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
432 msPageLayoutNames( RTL_CONSTASCII_USTRINGPARAM("PageLayoutNames") )
438 // XExporter
439 void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent >& xDoc )
440 throw(lang::IllegalArgumentException, uno::RuntimeException)
442 SvXMLExport::setSourceDocument( xDoc );
444 const OUString aEmpty;
446 // prepare factory parts
447 mpSdPropHdlFactory = new XMLSdPropHdlFactory( GetModel(), *this );
448 if(mpSdPropHdlFactory)
450 // set lock to avoid deletion
451 mpSdPropHdlFactory->acquire();
453 // build one ref
454 const UniReference< XMLPropertyHandlerFactory > aFactoryRef = mpSdPropHdlFactory;
456 // construct PropertySetMapper
457 UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( aFactoryRef);
459 mpPropertySetMapper = new XMLShapeExportPropertyMapper( xMapper, (XMLTextListAutoStylePool*)&GetTextParagraphExport()->GetListAutoStylePool(), *this );
460 // set lock to avoid deletion
461 mpPropertySetMapper->acquire();
463 // chain text attributes
464 mpPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this));
466 // construct PresPagePropsMapper
467 xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef);
469 mpPresPagePropsMapper = new XMLPageExportPropertyMapper( xMapper, *this );
470 if(mpPresPagePropsMapper)
472 // set lock to avoid deletion
473 mpPresPagePropsMapper->acquire();
477 // add family name
478 GetAutoStylePool()->AddFamily(
479 XML_STYLE_FAMILY_SD_GRAPHICS_ID,
480 OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)),
481 GetPropertySetMapper(),
482 OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX)));
483 GetAutoStylePool()->AddFamily(
484 XML_STYLE_FAMILY_SD_PRESENTATION_ID,
485 OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)),
486 GetPropertySetMapper(),
487 OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX)));
488 GetAutoStylePool()->AddFamily(
489 XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID,
490 OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)),
491 GetPresPagePropsMapper(),
492 OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX)));
493 // prepare access to styles
494 Reference< style::XStyleFamiliesSupplier > xFamSup( GetModel(), UNO_QUERY );
495 if(xFamSup.is())
497 mxDocStyleFamilies = xFamSup->getStyleFamilies();
500 // prepare access to master pages
501 Reference < drawing::XMasterPagesSupplier > xMasterPagesSupplier(GetModel(), UNO_QUERY);
502 if(xMasterPagesSupplier.is())
504 mxDocMasterPages = mxDocMasterPages.query( xMasterPagesSupplier->getMasterPages() );
505 if(mxDocMasterPages.is())
507 mnDocMasterPageCount = mxDocMasterPages->getCount();
508 maMasterPagesStyleNames.insert( maMasterPagesStyleNames.begin(), mnDocMasterPageCount, aEmpty );
512 // prepare access to draw pages
513 Reference <XDrawPagesSupplier> xDrawPagesSupplier(GetModel(), UNO_QUERY);
514 if(xDrawPagesSupplier.is())
516 mxDocDrawPages = mxDocDrawPages.query( xDrawPagesSupplier->getDrawPages() );
517 if(mxDocDrawPages.is())
519 mnDocDrawPageCount = mxDocDrawPages->getCount();
520 maDrawPagesStyleNames.insert( maDrawPagesStyleNames.begin(), mnDocDrawPageCount, aEmpty );
521 maDrawNotesPagesStyleNames.insert( maDrawNotesPagesStyleNames.begin(), mnDocDrawPageCount, aEmpty );
522 if( !mbIsDraw )
523 maDrawPagesAutoLayoutNames.realloc( mnDocDrawPageCount + 1 );
525 HeaderFooterPageSettingsImpl aEmptySettings;
526 maDrawPagesHeaderFooterSettings.insert( maDrawPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings );
527 maDrawNotesPagesHeaderFooterSettings.insert( maDrawNotesPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings );
531 // #82003# count all draw objects for use with progress bar.
532 // #88245# init mnObjectCount once, use counter itself as flag. It
533 // is initialized to 0.
534 if(!mnObjectCount)
536 if( IsImpress() )
538 // #91587# add handout master count
539 Reference<presentation::XHandoutMasterSupplier> xHandoutSupp(GetModel(), UNO_QUERY);
540 if(xHandoutSupp.is())
542 Reference<XDrawPage> xHandoutPage(xHandoutSupp->getHandoutMasterPage());
543 if(xHandoutPage.is())
545 Reference<drawing::XShapes> xShapes(xHandoutPage, UNO_QUERY);
546 if(xShapes.is() && xShapes->getCount())
548 mnObjectCount += ImpRecursiveObjectCount(xShapes);
554 if(mxDocMasterPages.is())
556 for(sal_Int32 a(0); a < mnDocMasterPageCount; a++)
558 Any aAny(mxDocMasterPages->getByIndex(a));
559 Reference< drawing::XShapes > xMasterPage;
561 if((aAny >>= xMasterPage) && xMasterPage.is())
563 mnObjectCount += ImpRecursiveObjectCount(xMasterPage);
566 if( IsImpress() )
568 // #91587# take notes pages from master pages into account
569 Reference<presentation::XPresentationPage> xPresPage;
570 if((aAny >>= xPresPage) && xPresPage.is())
572 Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage());
573 if(xNotesPage.is())
575 Reference<drawing::XShapes> xShapes(xNotesPage, UNO_QUERY);
576 if(xShapes.is() && xShapes->getCount())
578 mnObjectCount += ImpRecursiveObjectCount(xShapes);
586 if(mxDocDrawPages.is())
588 for(sal_Int32 a(0); a < mnDocDrawPageCount; a++)
590 Any aAny(mxDocDrawPages->getByIndex(a));
591 Reference< drawing::XShapes > xPage;
593 if((aAny >>= xPage) && xPage.is())
595 mnObjectCount += ImpRecursiveObjectCount(xPage);
598 if( IsImpress() )
600 // #91587# take notes pages from draw pages into account
601 Reference<presentation::XPresentationPage> xPresPage;
602 if((aAny >>= xPresPage) && xPresPage.is())
604 Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage());
605 if(xNotesPage.is())
607 Reference<drawing::XShapes> xShapes(xNotesPage, UNO_QUERY);
608 if(xShapes.is() && xShapes->getCount())
610 mnObjectCount += ImpRecursiveObjectCount(xShapes);
618 // #82003# init progress bar
619 GetProgressBarHelper()->SetReference(mnObjectCount);
622 // add namespaces
623 _GetNamespaceMap().Add(
624 GetXMLToken(XML_NP_PRESENTATION),
625 GetXMLToken(XML_N_PRESENTATION),
626 XML_NAMESPACE_PRESENTATION);
628 _GetNamespaceMap().Add(
629 GetXMLToken(XML_NP_SMIL),
630 GetXMLToken(XML_N_SMIL_COMPAT),
631 XML_NAMESPACE_SMIL);
633 _GetNamespaceMap().Add(
634 GetXMLToken(XML_NP_ANIMATION),
635 GetXMLToken(XML_N_ANIMATION),
636 XML_NAMESPACE_ANIMATION);
638 if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
640 _GetNamespaceMap().Add(
641 GetXMLToken(XML_NP_OFFICE_EXT),
642 GetXMLToken(XML_N_OFFICE_EXT),
643 XML_NAMESPACE_OFFICE_EXT);
646 GetShapeExport()->enableLayerExport();
648 // #88546# enable progress bar increments
649 GetShapeExport()->enableHandleProgressBar();
652 //////////////////////////////////////////////////////////////////////////////
653 // #82003# helper function for recursive object count
654 sal_uInt32 SdXMLExport::ImpRecursiveObjectCount(Reference< drawing::XShapes > xShapes)
656 sal_uInt32 nRetval(0L);
658 if(xShapes.is())
660 sal_Int32 nCount = xShapes->getCount();
662 for(sal_Int32 a(0L); a < nCount; a++)
664 Any aAny(xShapes->getByIndex(a));
665 Reference< drawing::XShapes > xGroup;
667 if((aAny >>= xGroup) && xGroup.is())
669 // #93180# count group objects, too.
670 nRetval += 1 + ImpRecursiveObjectCount(xGroup);
672 else
674 nRetval++;
679 return nRetval;
682 //////////////////////////////////////////////////////////////////////////////
684 SdXMLExport::~SdXMLExport()
686 // cleanup factory, decrease refcount. Should lead to destruction.
687 if(mpSdPropHdlFactory)
689 mpSdPropHdlFactory->release();
690 mpSdPropHdlFactory = 0L;
693 // cleanup mapper, decrease refcount. Should lead to destruction.
694 if(mpPropertySetMapper)
696 mpPropertySetMapper->release();
697 mpPropertySetMapper = 0L;
700 // cleanup presPage mapper, decrease refcount. Should lead to destruction.
701 if(mpPresPagePropsMapper)
703 mpPresPagePropsMapper->release();
704 mpPresPagePropsMapper = 0L;
707 // clear evtl. temporary page master infos
708 if(mpPageMasterUsageList)
710 // note: all items in this list are also in mpPageMasterInfoList
711 delete mpPageMasterUsageList;
712 mpPageMasterUsageList = 0L;
715 if(mpNotesPageMasterUsageList)
717 // note: all items in this list are also in mpPageMasterInfoList
718 delete mpNotesPageMasterUsageList;
719 mpNotesPageMasterUsageList = 0L;
722 if(mpPageMasterInfoList)
724 for ( size_t i = 0, n = mpPageMasterInfoList->size(); i < n; ++i )
725 delete mpPageMasterInfoList->at( i );
726 mpPageMasterInfoList->clear();
727 delete mpPageMasterInfoList;
728 mpPageMasterInfoList = 0L;
731 // clear auto-layout infos
732 if(mpAutoLayoutInfoList)
734 for ( size_t i = 0, n = mpAutoLayoutInfoList->size(); i < n; ++i )
735 delete mpAutoLayoutInfoList->at( i );
736 mpAutoLayoutInfoList->clear();
737 delete mpAutoLayoutInfoList;
738 mpAutoLayoutInfoList = 0L;
742 //////////////////////////////////////////////////////////////////////////////
744 void SdXMLExport::ImpPrepAutoLayoutInfos()
746 if(IsImpress())
748 OUString aStr;
750 Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
751 if( xHandoutSupp.is() )
753 Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
754 if( xHandoutPage.is() )
756 if(ImpPrepAutoLayoutInfo(xHandoutPage, aStr))
757 maDrawPagesAutoLayoutNames[0] = aStr;
761 // prepare name creation
762 for (sal_Int32 nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++)
764 Any aAny(mxDocDrawPages->getByIndex(nCnt));
765 Reference<XDrawPage> xDrawPage;
767 if((aAny >>= xDrawPage) && xDrawPage.is())
769 if(ImpPrepAutoLayoutInfo(xDrawPage, aStr))
770 maDrawPagesAutoLayoutNames[nCnt+1] = aStr;
776 sal_Bool SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, OUString& rName)
778 rName = OUString();
779 sal_Bool bRetval(sal_False);
781 Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY);
782 if(xPropSet.is())
784 sal_uInt16 nType = sal_uInt16();
785 Any aAny;
787 aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Layout")));
788 if(aAny >>= nType)
790 if(ImpXMLAutoLayoutInfo::IsCreateNecessary(nType))
792 ImpXMLEXPPageMasterInfo* pInfo = 0L;
794 // get master-page info
795 Reference < drawing::XMasterPageTarget > xMasterPageInt(xPage, UNO_QUERY);
796 if(xMasterPageInt.is())
798 Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
799 if(xUsedMasterPage.is())
801 Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
802 if(xMasterNamed.is())
804 OUString sMasterPageName = xMasterNamed->getName();
805 pInfo = ImpGetPageMasterInfoByName(sMasterPageName);
810 // create entry and look for existance
811 ImpXMLAutoLayoutInfo* pNew = new ImpXMLAutoLayoutInfo(nType, pInfo);
812 sal_Bool bDidExist(sal_False);
814 for( size_t nCnt = 0; !bDidExist && nCnt < mpAutoLayoutInfoList->size(); nCnt++)
816 if( *mpAutoLayoutInfoList->at( nCnt ) == *pNew)
818 delete pNew;
819 pNew = mpAutoLayoutInfoList->at( nCnt );
820 bDidExist = sal_True;
824 if(!bDidExist)
826 mpAutoLayoutInfoList->push_back( pNew );
827 OUString sNewName = OUString(RTL_CONSTASCII_USTRINGPARAM("AL"));
828 sNewName += OUString::valueOf(sal_Int32( mpAutoLayoutInfoList->size() - 1 ));
829 sNewName += OUString(RTL_CONSTASCII_USTRINGPARAM("T"));
830 sNewName += OUString::valueOf(sal_Int32(nType));
831 pNew->SetLayoutName(sNewName);
834 rName = pNew->GetLayoutName();
835 bRetval = sal_True;
840 return bRetval;
843 //////////////////////////////////////////////////////////////////////////////
845 void SdXMLExport::ImpWriteAutoLayoutInfos()
847 if( !mpAutoLayoutInfoList->empty() )
849 for(size_t nCnt = 0; nCnt < mpAutoLayoutInfoList->size(); nCnt++)
851 ImpXMLAutoLayoutInfo* pInfo = mpAutoLayoutInfoList->at( nCnt );
852 if(pInfo)
854 // prepare presentation-page layout attributes, style-name
855 AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, pInfo->GetLayoutName());
857 // write draw-style attributes
858 SvXMLElementExport aDSE(*this, XML_NAMESPACE_STYLE, XML_PRESENTATION_PAGE_LAYOUT, sal_True, sal_True);
860 // write presentation placeholders
861 switch(pInfo->GetLayoutType())
863 case 0 : // AUTOLAYOUT_TITLE
865 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
866 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle());
867 break;
869 case 1 : // AUTOLAYOUT_ENUM
871 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
872 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, pInfo->GetPresRectangle());
873 break;
875 case 2 : // AUTOLAYOUT_CHART
877 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
878 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, pInfo->GetPresRectangle());
879 break;
881 case 3 : // AUTOLAYOUT_2TEXT
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(XmlPlaceholderOutline, aRight);
891 break;
893 case 4 : // AUTOLAYOUT_TEXTCHART
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(XmlPlaceholderOutline, aLeft);
902 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aRight);
903 break;
905 case 6 : // AUTOLAYOUT_TEXTCLIP
907 Rectangle aLeft(pInfo->GetPresRectangle());
908 aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
909 Rectangle aRight(aLeft);
910 aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
912 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
913 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
914 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aRight);
915 break;
917 case 7 : // AUTOLAYOUT_CHARTTEXT
919 Rectangle aLeft(pInfo->GetPresRectangle());
920 aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
921 Rectangle aRight(aLeft);
922 aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
924 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
925 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aLeft);
926 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
927 break;
929 case 8 : // AUTOLAYOUT_TAB
931 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
932 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTable, pInfo->GetPresRectangle());
933 break;
935 case 9 : // AUTOLAYOUT_CLIPTEXT
937 Rectangle aLeft(pInfo->GetPresRectangle());
938 aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
939 Rectangle aRight(aLeft);
940 aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
942 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
943 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft);
944 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
945 break;
947 case 10 : // AUTOLAYOUT_TEXTOBJ
949 Rectangle aLeft(pInfo->GetPresRectangle());
950 aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
951 Rectangle aRight(aLeft);
952 aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
954 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
955 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
956 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRight);
957 break;
959 case 11 : // AUTOLAYOUT_OBJ
961 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
962 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, pInfo->GetPresRectangle());
963 break;
965 case 12 : // AUTOLAYOUT_TEXT2OBJ
967 Rectangle aLeft(pInfo->GetPresRectangle());
968 aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
969 Rectangle aRightTop(aLeft);
970 aRightTop.Left() = long(aRightTop.Left() + aRightTop.GetWidth() * 1.05);
971 aRightTop.setHeight(long(aRightTop.GetHeight() * 0.477));
972 Rectangle aRightBottom(aRightTop);
973 aRightBottom.Top() = long(aRightBottom.Top() + aRightBottom.GetHeight() * 1.095);
975 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
976 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
977 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightTop);
978 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightBottom);
979 break;
981 case 13 : // AUTOLAYOUT_OBJTEXT
983 Rectangle aLeft(pInfo->GetPresRectangle());
984 aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
985 Rectangle aRight(aLeft);
986 aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
988 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
989 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeft);
990 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
991 break;
993 case 14 : // AUTOLAYOUT_OBJOVERTEXT
995 Rectangle aTop(pInfo->GetPresRectangle());
996 aTop.setHeight(long(aTop.GetHeight() * 0.477));
997 Rectangle aBottom(aTop);
998 aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
1000 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1001 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTop);
1002 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom);
1003 break;
1005 case 15 : // AUTOLAYOUT_2OBJTEXT
1007 Rectangle aLeftTop(pInfo->GetPresRectangle());
1008 aLeftTop.setWidth(long(aLeftTop.GetWidth() * 0.488));
1009 Rectangle aRight(aLeftTop);
1010 aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
1011 aLeftTop.setHeight(long(aLeftTop.GetHeight() * 0.477));
1012 Rectangle aLeftBottom(aLeftTop);
1013 aLeftBottom.Top() = long(aLeftBottom.Top() + aLeftBottom.GetHeight() * 1.095);
1015 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1016 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftTop);
1017 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftBottom);
1018 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
1019 break;
1021 case 16 : // AUTOLAYOUT_2OBJOVERTEXT
1023 Rectangle aTopLeft(pInfo->GetPresRectangle());
1024 aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
1025 Rectangle aBottom(aTopLeft);
1026 aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
1027 aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
1028 Rectangle aTopRight(aTopLeft);
1029 aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
1031 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1032 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft);
1033 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight);
1034 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom);
1035 break;
1037 case 17 : // AUTOLAYOUT_TEXTOVEROBJ
1039 Rectangle aTop(pInfo->GetPresRectangle());
1040 aTop.setHeight(long(aTop.GetHeight() * 0.477));
1041 Rectangle aBottom(aTop);
1042 aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
1044 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1045 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aTop);
1046 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottom);
1047 break;
1049 case 18 : // AUTOLAYOUT_4OBJ
1051 Rectangle aTopLeft(pInfo->GetPresRectangle());
1052 aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
1053 aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
1054 Rectangle aBottomLeft(aTopLeft);
1055 aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
1056 Rectangle aTopRight(aTopLeft);
1057 aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
1058 Rectangle aBottomRight(aTopRight);
1059 aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
1061 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1062 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft);
1063 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight);
1064 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomLeft);
1065 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomRight);
1066 break;
1068 case 19 : // AUTOLAYOUT_ONLY_TITLE
1070 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1071 break;
1073 case 21 : // AUTOLAYOUT_NOTES
1075 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderPage, pInfo->GetTitleRectangle());
1076 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderNotes, pInfo->GetPresRectangle());
1077 break;
1079 case 22 : // AUTOLAYOUT_HANDOUT1
1080 case 23 : // AUTOLAYOUT_HANDOUT2
1081 case 24 : // AUTOLAYOUT_HANDOUT3
1082 case 25 : // AUTOLAYOUT_HANDOUT4
1083 case 26 : // AUTOLAYOUT_HANDOUT6
1084 case 31 : // AUTOLAYOUT_HANDOUT9
1086 sal_Int32 nColCnt, nRowCnt;
1087 sal_Int32 nGapX = pInfo->GetGapX();
1088 sal_Int32 nGapY = pInfo->GetGapY();
1090 switch(pInfo->GetLayoutType())
1092 case 22 : nColCnt = 1; nRowCnt = 1; break;
1093 case 23 : nColCnt = 1; nRowCnt = 2; break;
1094 case 24 : nColCnt = 1; nRowCnt = 3; break;
1095 case 25 : nColCnt = 2; nRowCnt = 2; break;
1096 case 26 : nColCnt = 3; nRowCnt = 2; break;
1097 case 31 : nColCnt = 3; nRowCnt = 3; break;
1098 default: nColCnt = 0; nRowCnt = 0; break; // FIXME - What is correct values?
1101 Size aPartSize(pInfo->GetTitleRectangle().GetSize());
1102 Point aPartPos(pInfo->GetTitleRectangle().TopLeft());
1104 if(aPartSize.Width() > aPartSize.Height())
1106 sal_Int32 nZwi(nColCnt);
1107 nColCnt = nRowCnt;
1108 nRowCnt = nZwi;
1111 aPartSize.Width() = (aPartSize.Width() - ((nColCnt - 1) * nGapX)) / nColCnt;
1112 aPartSize.Height() = (aPartSize.Height() - ((nRowCnt - 1) * nGapY)) / nRowCnt;
1114 Point aTmpPos(aPartPos);
1116 for (sal_Int32 a = 0; a < nRowCnt; a++)
1118 aTmpPos.X() = aPartPos.X();
1120 for (sal_Int32 b = 0; b < nColCnt; b++)
1122 Rectangle aTmpRect(aTmpPos, aPartSize);
1124 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderHandout, aTmpRect);
1125 aTmpPos.X() += aPartSize.Width() + nGapX;
1128 aTmpPos.Y() += aPartSize.Height() + nGapY;
1130 break;
1132 case 27 : // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
1134 Rectangle aTop(pInfo->GetPresRectangle());
1135 aTop.setHeight(long(aTop.GetHeight() * 0.488));
1136 Rectangle aBottom(aTop);
1137 aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.05);
1139 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle());
1140 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aTop);
1141 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aBottom);
1142 break;
1144 case 28 : // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
1146 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle());
1147 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle());
1148 break;
1150 case 29 : // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
1152 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1153 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle());
1154 break;
1156 case 30 : // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
1158 Rectangle aLeft(pInfo->GetPresRectangle());
1159 aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
1160 Rectangle aRight(aLeft);
1161 aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
1163 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1164 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft);
1165 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aRight);
1166 break;
1168 case 32 : // AUTOLAYOUT_TITLE
1170 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle());
1171 break;
1174 case 33 : // AUTOLAYOUT_4CLIPART
1176 Rectangle aTopLeft(pInfo->GetPresRectangle());
1177 aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
1178 aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
1179 Rectangle aBottomLeft(aTopLeft);
1180 aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
1181 Rectangle aTopRight(aTopLeft);
1182 aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
1183 Rectangle aBottomRight(aTopRight);
1184 aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
1186 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1187 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
1188 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
1189 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
1190 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
1191 break;
1194 case 34 : // AUTOLAYOUT_6CLIPART
1196 Rectangle aTopLeft(pInfo->GetPresRectangle());
1197 aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
1198 aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.322));
1199 Rectangle aTopCenter(aTopLeft);
1200 aTopCenter.Left() = long(aTopCenter.Left() + aTopCenter.GetWidth() * 1.05);
1201 Rectangle aTopRight(aTopLeft);
1202 aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 2 * 1.05);
1204 Rectangle aBottomLeft(aTopLeft);
1205 aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
1206 Rectangle aBottomCenter(aTopCenter);
1207 aBottomCenter.Top() = long(aBottomCenter.Top() + aBottomCenter.GetHeight() * 1.095);
1208 Rectangle aBottomRight(aTopRight);
1209 aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
1211 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1212 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
1213 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopCenter);
1214 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
1215 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
1216 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomCenter);
1217 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
1218 break;
1220 default:
1222 OSL_FAIL("XMLEXP: unknown autolayout export");
1223 break;
1231 //////////////////////////////////////////////////////////////////////////////
1233 void SdXMLExport::ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectangle& rRect)
1235 OUString aStr;
1236 OUStringBuffer sStringBuffer;
1238 // prepare presentation-placeholder attributes, presentation:object
1239 switch(ePl)
1241 case XmlPlaceholderTitle: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("title")); break;
1242 case XmlPlaceholderOutline: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("outline")); break;
1243 case XmlPlaceholderSubtitle: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("subtitle")); break;
1244 case XmlPlaceholderText: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("text")); break;
1245 case XmlPlaceholderGraphic: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("graphic")); break;
1246 case XmlPlaceholderObject: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("object")); break;
1247 case XmlPlaceholderChart: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("chart")); break;
1248 case XmlPlaceholderOrgchart: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("orgchart")); break;
1249 case XmlPlaceholderTable: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("table")); break;
1250 case XmlPlaceholderPage: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("page")); break;
1251 case XmlPlaceholderNotes: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("notes")); break;
1252 case XmlPlaceholderHandout: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("handout")); break;
1253 case XmlPlaceholderVerticalTitle: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_title")); break;
1254 case XmlPlaceholderVerticalOutline: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline")); break;
1257 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_OBJECT, aStr);
1259 // svg:x,y,width,height
1260 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, rRect.Left());
1261 aStr = sStringBuffer.makeStringAndClear();
1262 AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr);
1264 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, rRect.Top());
1265 aStr = sStringBuffer.makeStringAndClear();
1266 AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr);
1268 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1269 rRect.GetWidth());
1270 aStr = sStringBuffer.makeStringAndClear();
1271 AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
1273 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1274 rRect.GetHeight());
1275 aStr = sStringBuffer.makeStringAndClear();
1276 AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr);
1278 // write presentation-placeholder
1279 SvXMLElementExport aPPL(*this, XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, sal_True, sal_True);
1282 //////////////////////////////////////////////////////////////////////////////
1284 ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetOrCreatePageMasterInfo( Reference< XDrawPage > xMasterPage )
1286 bool bDoesExist = false;
1288 ImpXMLEXPPageMasterInfo* pNewInfo = new ImpXMLEXPPageMasterInfo(*this, xMasterPage);
1290 // compare with prev page-master infos
1291 for( size_t a = 0; !bDoesExist && a < mpPageMasterInfoList->size(); a++)
1293 if ( mpPageMasterInfoList->at(a)
1294 && *mpPageMasterInfoList->at(a) == *pNewInfo
1297 delete pNewInfo;
1298 pNewInfo = mpPageMasterInfoList->at(a);
1299 bDoesExist = true;
1302 // add entry when not found same page-master infos
1303 if(!bDoesExist)
1304 mpPageMasterInfoList->push_back( pNewInfo );
1306 return pNewInfo;
1309 void SdXMLExport::ImpPrepPageMasterInfos()
1311 if( IsImpress() )
1313 // create page master info for handout master page
1315 Reference< XHandoutMasterSupplier > xHMS( GetModel(), UNO_QUERY );
1316 if( xHMS.is() )
1318 Reference< XDrawPage > xMasterPage( xHMS->getHandoutMasterPage() );
1319 if( xMasterPage.is() )
1320 mpHandoutPageMaster = ImpGetOrCreatePageMasterInfo(xMasterPage);
1324 // create page master infos for master pages
1325 if(mnDocMasterPageCount)
1327 // look for needed page-masters, create these
1328 for (sal_Int32 nMPageId = 0; nMPageId < mnDocMasterPageCount; nMPageId++)
1330 Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
1331 ImpXMLEXPPageMasterInfo* pNewInfo = 0L;
1333 if(xMasterPage.is())
1334 pNewInfo = ImpGetOrCreatePageMasterInfo(xMasterPage);
1336 mpPageMasterUsageList->push_back( pNewInfo );
1338 // look for page master of handout page
1339 if(IsImpress())
1341 pNewInfo = NULL;
1342 Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
1343 if(xPresPage.is())
1345 Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
1346 if(xNotesPage.is())
1348 pNewInfo = ImpGetOrCreatePageMasterInfo(xNotesPage);
1351 mpNotesPageMasterUsageList->push_back( pNewInfo );
1357 //////////////////////////////////////////////////////////////////////////////
1359 void SdXMLExport::ImpWritePageMasterInfos()
1361 // write created page-masters, create names for these
1362 for( size_t nCnt = 0; nCnt < mpPageMasterInfoList->size(); nCnt++)
1364 ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->at(nCnt);
1365 if(pInfo)
1367 // create name
1368 OUString sNewName = OUString(RTL_CONSTASCII_USTRINGPARAM("PM"));
1370 sNewName += OUString::valueOf((sal_Int32)nCnt);
1371 pInfo->SetName(sNewName);
1373 // prepare page-master attributes
1374 OUString sString;
1375 OUStringBuffer sStringBuffer;
1377 sString = sNewName;
1378 AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sString);
1380 // write page-layout
1381 SvXMLElementExport aPME(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, sal_True, sal_True);
1383 // prepare style:properties inside page-master
1384 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1385 pInfo->GetBorderTop());
1386 sString = sStringBuffer.makeStringAndClear();
1387 AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_TOP, sString);
1389 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1390 pInfo->GetBorderBottom());
1391 sString = sStringBuffer.makeStringAndClear();
1392 AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, sString);
1394 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1395 pInfo->GetBorderLeft());
1396 sString = sStringBuffer.makeStringAndClear();
1397 AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_LEFT, sString);
1399 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1400 pInfo->GetBorderRight());
1401 sString = sStringBuffer.makeStringAndClear();
1402 AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_RIGHT, sString);
1404 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1405 pInfo->GetWidth());
1406 sString = sStringBuffer.makeStringAndClear();
1407 AddAttribute(XML_NAMESPACE_FO, XML_PAGE_WIDTH, sString);
1409 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1410 pInfo->GetHeight());
1411 sString = sStringBuffer.makeStringAndClear();
1412 AddAttribute(XML_NAMESPACE_FO, XML_PAGE_HEIGHT, sString);
1414 if(pInfo->GetOrientation() == view::PaperOrientation_PORTRAIT)
1415 AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PORTRAIT);
1416 else
1417 AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_LANDSCAPE);
1419 // write style:properties
1420 SvXMLElementExport aPMF(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_PROPERTIES, sal_True, sal_True);
1425 //////////////////////////////////////////////////////////////////////////////
1427 ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetPageMasterInfoByName(const OUString& rName)
1429 if(!rName.isEmpty() && !mpPageMasterInfoList->empty())
1431 for( size_t nCnt = 0; nCnt < mpPageMasterInfoList->size(); nCnt++)
1433 ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->at(nCnt);
1434 if(pInfo)
1436 if(!pInfo->GetMasterPageName().isEmpty() && rName.equals(pInfo->GetMasterPageName()))
1438 return pInfo;
1443 return 0L;
1446 //////////////////////////////////////////////////////////////////////////////
1448 void SdXMLExport::ImpPrepDrawPageInfos()
1450 // create draw:style-name entries for page export
1451 // containing presentation page attributes AND background attributes
1452 // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
1454 sal_Int32 nCnt;
1455 for(nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++)
1457 Reference<XDrawPage> xDrawPage;
1458 mxDocDrawPages->getByIndex(nCnt) >>= xDrawPage;
1459 maDrawPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage );
1461 Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
1462 if(xPresPage.is())
1464 maDrawNotesPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xPresPage->getNotesPage(), false );
1466 maDrawPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xDrawPage );
1467 maDrawNotesPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xPresPage->getNotesPage() );
1472 //////////////////////////////////////////////////////////////////////////////
1474 static OUString findOrAppendImpl( std::vector< OUString >& rVector, const OUString& rText, const sal_Char* pPrefix )
1476 // search rVector if there is already a string that equals rText
1477 std::vector< OUString >::iterator aIter;
1478 sal_Int32 nIndex;
1479 for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); ++aIter, ++nIndex )
1481 if( (*aIter) == rText )
1482 break;
1485 // if nothing is found, append the string at the end of rVector
1486 if( aIter == rVector.end() )
1487 rVector.push_back( rText );
1489 // create a reference string with pPrefix and the index of the
1490 // found or created rText
1491 OUString aStr( OUString::createFromAscii( pPrefix ) );
1492 aStr += OUString::valueOf( nIndex );
1493 return aStr;
1496 static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, const OUString& rText, sal_Bool bFixed, sal_Int32 nFormat, const sal_Char* pPrefix )
1498 // search rVector if there is already a DateTimeDeclImpl with rText,bFixed and nFormat
1499 std::vector< DateTimeDeclImpl >::iterator aIter;
1500 sal_Int32 nIndex;
1501 for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); ++aIter, ++nIndex )
1503 const DateTimeDeclImpl& rDecl = (*aIter);
1504 if( (rDecl.mbFixed == bFixed ) &&
1505 (!bFixed || rDecl.maStrText == rText) &&
1506 (bFixed || (rDecl.mnFormat == nFormat) ) )
1507 break;
1510 // if nothing is found, append a new DateTimeDeclImpl
1511 if( aIter == rVector.end() )
1513 DateTimeDeclImpl aDecl;
1514 aDecl.maStrText = rText;
1515 aDecl.mbFixed = bFixed;
1516 aDecl.mnFormat = nFormat;
1517 rVector.push_back( aDecl );
1520 // create a reference string with pPrefix and the index of the
1521 // found or created DateTimeDeclImpl
1522 OUString aStr( OUString::createFromAscii( pPrefix ) );
1523 aStr += OUString::valueOf( nIndex );
1524 return aStr;
1528 static const sal_Char* gpStrHeaderTextPrefix = "hdr";
1529 static const sal_Char* gpStrFooterTextPrefix = "ftr";
1530 static const sal_Char* gpStrDateTimeTextPrefix = "dtd";
1532 HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( const Reference<XDrawPage>& xDrawPage )
1534 HeaderFooterPageSettingsImpl aSettings;
1536 if( xDrawPage.is() ) try
1538 Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
1539 Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
1541 OUString aStrText;
1543 const OUString aStrHeaderTextProp( RTL_CONSTASCII_USTRINGPARAM( "HeaderText" ) );
1544 if( xInfo->hasPropertyByName( aStrHeaderTextProp ) )
1546 xSet->getPropertyValue( aStrHeaderTextProp ) >>= aStrText;
1547 if( !aStrText.isEmpty() )
1548 aSettings.maStrHeaderDeclName = findOrAppendImpl( maHeaderDeclsVector, aStrText, gpStrHeaderTextPrefix );
1551 const OUString aStrFooterTextProp( RTL_CONSTASCII_USTRINGPARAM( "FooterText" ) );
1552 if( xInfo->hasPropertyByName( aStrFooterTextProp ) )
1554 xSet->getPropertyValue( aStrFooterTextProp ) >>= aStrText;
1555 if( !aStrText.isEmpty() )
1556 aSettings.maStrFooterDeclName = findOrAppendImpl( maFooterDeclsVector, aStrText, gpStrFooterTextPrefix );
1559 const OUString aStrDateTimeTextProp( RTL_CONSTASCII_USTRINGPARAM( "DateTimeText" ) );
1560 if( xInfo->hasPropertyByName( aStrDateTimeTextProp ) )
1562 sal_Bool bFixed = false;
1563 sal_Int32 nFormat = 0;
1564 xSet->getPropertyValue( aStrDateTimeTextProp ) >>= aStrText;
1565 xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeFixed" ) ) ) >>= bFixed;
1566 xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DateTimeFormat" ) ) ) >>= nFormat;
1568 if( !bFixed || !aStrText.isEmpty() )
1570 aSettings.maStrDateTimeDeclName = findOrAppendImpl( maDateTimeDeclsVector, aStrText, bFixed, nFormat, gpStrDateTimeTextPrefix );
1571 if( !bFixed )
1572 addDataStyle( nFormat );
1576 catch(const Exception&)
1578 OSL_FAIL( "SdXMLExport::ImpPrepDrawPageHeaderFooterDecls(), unexpected exception cought!" );
1581 return aSettings;
1584 //////////////////////////////////////////////////////////////////////////////
1586 void SdXMLExport::ImpWriteHeaderFooterDecls()
1588 OUStringBuffer sBuffer;
1590 if( !maHeaderDeclsVector.empty() )
1592 // export header decls
1593 const OUString aPrefix( OUString::createFromAscii( gpStrHeaderTextPrefix ) );
1594 std::vector< OUString >::iterator aIter;
1595 sal_Int32 nIndex;
1596 for( nIndex = 1, aIter = maHeaderDeclsVector.begin(); aIter != maHeaderDeclsVector.end(); ++aIter, ++nIndex )
1598 sBuffer.append( aPrefix );
1599 sBuffer.append( nIndex );
1600 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
1602 SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_HEADER_DECL, sal_True, sal_True);
1603 Characters((*aIter));
1607 if( !maFooterDeclsVector.empty() )
1609 // export footer decls
1610 const OUString aPrefix( OUString::createFromAscii( gpStrFooterTextPrefix ) );
1611 std::vector< OUString >::iterator aIter;
1612 sal_Int32 nIndex;
1613 for( nIndex = 1, aIter = maFooterDeclsVector.begin(); aIter != maFooterDeclsVector.end(); ++aIter, ++nIndex )
1615 sBuffer.append( aPrefix );
1616 sBuffer.append( nIndex );
1617 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
1619 SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_FOOTER_DECL, sal_False, sal_False);
1620 Characters((*aIter));
1624 if( !maDateTimeDeclsVector.empty() )
1626 // export footer decls
1627 const OUString aPrefix( OUString::createFromAscii( gpStrDateTimeTextPrefix ) );
1628 std::vector< DateTimeDeclImpl >::iterator aIter;
1629 sal_Int32 nIndex;
1630 for( nIndex = 1, aIter = maDateTimeDeclsVector.begin(); aIter != maDateTimeDeclsVector.end(); ++aIter, ++nIndex )
1632 const DateTimeDeclImpl& rDecl = (*aIter);
1634 sBuffer.append( aPrefix );
1635 sBuffer.append( nIndex );
1636 AddAttribute( XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
1638 AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SOURCE, rDecl.mbFixed ? XML_FIXED : XML_CURRENT_DATE );
1640 if( !rDecl.mbFixed )
1641 AddAttribute( XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, getDataStyleName( rDecl.mnFormat ) );
1643 SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_DATE_TIME_DECL, sal_False, sal_False);
1644 if( rDecl.mbFixed )
1645 Characters(rDecl.maStrText);
1650 void SdXMLExport::ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings )
1652 if( !aSettings.maStrHeaderDeclName.isEmpty() )
1653 AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, aSettings.maStrHeaderDeclName );
1655 if( !aSettings.maStrFooterDeclName.isEmpty() )
1656 AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, aSettings.maStrFooterDeclName );
1658 if( !aSettings.maStrDateTimeDeclName.isEmpty() )
1659 AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, aSettings.maStrDateTimeDeclName );
1662 //////////////////////////////////////////////////////////////////////////////
1664 OUString SdXMLExport::ImpCreatePresPageStyleName( Reference<XDrawPage> xDrawPage, bool bExportBackground /* = true */ )
1666 // create name
1667 OUString sStyleName;
1669 // create style for this page and add to auto style pool
1671 Reference< beans::XPropertySet > xPropSet1(xDrawPage, UNO_QUERY);
1672 if(xPropSet1.is())
1674 Reference< beans::XPropertySet > xPropSet;
1676 if( bExportBackground )
1678 // since the background items are in a different propertyset
1679 // which itself is a property of the pages property set
1680 // we now merge these two propertysets if possible to simulate
1681 // a single propertyset with all draw page properties
1682 const OUString aBackground(RTL_CONSTASCII_USTRINGPARAM("Background"));
1683 Reference< beans::XPropertySet > xPropSet2;
1684 Reference< beans::XPropertySetInfo > xInfo( xPropSet1->getPropertySetInfo() );
1685 if( xInfo.is() && xInfo->hasPropertyByName( aBackground ) )
1687 Any aAny( xPropSet1->getPropertyValue( aBackground ) );
1688 aAny >>= xPropSet2;
1691 if( xPropSet2.is() )
1692 xPropSet = PropertySetMerger_CreateInstance( xPropSet1, xPropSet2 );
1693 else
1694 xPropSet = xPropSet1;
1696 else
1698 xPropSet = xPropSet1;
1701 const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPresPagePropsMapper() );
1703 std::vector< XMLPropertyState > xPropStates( aMapperRef->Filter( xPropSet ) );
1705 if( !xPropStates.empty() )
1707 // there are filtered properties -> hard attributes
1708 // try to find this style in AutoStylePool
1709 sStyleName = GetAutoStylePool()->Find(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sStyleName, xPropStates);
1711 if(sStyleName.isEmpty())
1713 // Style did not exist, add it to AutoStalePool
1714 sStyleName = GetAutoStylePool()->Add(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sStyleName, xPropStates);
1719 return sStyleName;
1722 //////////////////////////////////////////////////////////////////////////////
1724 void SdXMLExport::ImpPrepMasterPageInfos()
1726 // create draw:style-name entries for master page export
1727 // containing only background attributes
1728 // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
1730 sal_Int32 nCnt;
1731 for( nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++)
1733 Reference<XDrawPage> xDrawPage;
1734 mxDocMasterPages->getByIndex(nCnt) >>= xDrawPage;
1735 maMasterPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage );
1738 if( IsImpress() )
1740 Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
1741 if( xHandoutSupp.is() )
1743 Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
1744 if( xHandoutPage.is() )
1746 maHandoutPageHeaderFooterSettings = ImpPrepDrawPageHeaderFooterDecls( xHandoutPage );
1747 maHandoutMasterStyleName = ImpCreatePresPageStyleName( xHandoutPage, false );
1753 //////////////////////////////////////////////////////////////////////////////
1754 void SdXMLExport::ImpWritePresentationStyles()
1756 if(IsImpress())
1758 for (sal_Int32 nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++)
1760 Any aAny(mxDocMasterPages->getByIndex(nCnt));
1761 Reference<container::XNamed> xNamed;
1763 if(aAny >>= xNamed)
1765 // write presentation styles (ONLY if presentation)
1766 if(IsImpress() && mxDocStyleFamilies.is() && xNamed.is())
1768 XMLStyleExport aStEx(*this, OUString(), GetAutoStylePool().get());
1769 const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPropertySetMapper() );
1771 OUString aPrefix( xNamed->getName() );
1773 aPrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
1774 aStEx.exportStyleFamily(xNamed->getName(),
1775 OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)),
1776 aMapperRef, sal_False,
1777 XML_STYLE_FAMILY_SD_PRESENTATION_ID, &aPrefix);
1784 //////////////////////////////////////////////////////////////////////////////
1786 void SdXMLExport::SetProgress(sal_Int32 nProg)
1788 // set progress view
1789 if(GetStatusIndicator().is())
1790 GetStatusIndicator()->setValue(nProg);
1793 //////////////////////////////////////////////////////////////////////////////
1794 // #82003#
1796 void SdXMLExport::_ExportMeta()
1798 uno::Sequence<beans::NamedValue> stats(1);
1799 stats[0] = beans::NamedValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ObjectCount" )),
1800 uno::makeAny(mnObjectCount));
1802 // update document statistics at the model
1803 uno::Reference<document::XDocumentPropertiesSupplier> xPropSup(GetModel(),
1804 uno::UNO_QUERY_THROW);
1805 uno::Reference<document::XDocumentProperties> xDocProps(
1806 xPropSup->getDocumentProperties());
1807 if (xDocProps.is()) {
1808 xDocProps->setDocumentStatistics(stats);
1811 // call parent
1812 SvXMLExport::_ExportMeta();
1815 //////////////////////////////////////////////////////////////////////////////
1817 void SdXMLExport::_ExportContent()
1819 // export <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl> elements
1820 ImpWriteHeaderFooterDecls();
1822 // page export
1823 for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
1825 uno::Reference<drawing::XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), uno::UNO_QUERY );
1827 SetProgress(((nPageInd + 1) * 100) / mnDocDrawPageCount);
1829 if(xDrawPage.is())
1831 // prepare page attributes, name of page
1832 Reference < container::XNamed > xNamed(xDrawPage, UNO_QUERY);
1833 if(xNamed.is())
1834 AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, xNamed->getName());
1836 // draw:style-name (presentation page attributes AND background attributes)
1837 if( !maDrawPagesStyleNames[nPageInd].isEmpty() )
1838 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
1839 maDrawPagesStyleNames[nPageInd]);
1841 // draw:master-page-name
1842 Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY);
1843 if(xMasterPageInt.is())
1845 Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
1846 if(xUsedMasterPage.is())
1848 Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
1849 if(xMasterNamed.is())
1851 AddAttribute(XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME,
1852 EncodeStyleName( xMasterNamed->getName()) );
1857 // presentation:page-layout-name
1858 if( IsImpress() && !maDrawPagesAutoLayoutNames[nPageInd+1].isEmpty())
1860 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, maDrawPagesAutoLayoutNames[nPageInd+1] );
1863 Reference< beans::XPropertySet > xProps( xDrawPage, UNO_QUERY );
1864 if( xProps.is() )
1868 OUString aBookmarkURL;
1869 xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "BookmarkURL" ) ) ) >>= aBookmarkURL;
1871 if( !aBookmarkURL.isEmpty() )
1873 sal_Int32 nIndex = aBookmarkURL.lastIndexOf( (sal_Unicode)'#' );
1874 if( nIndex != -1 )
1876 OUString aFileName( aBookmarkURL.copy( 0, nIndex ) );
1877 OUString aBookmarkName( aBookmarkURL.copy( nIndex+1 ) );
1879 aBookmarkURL = GetRelativeReference( aFileName );
1880 aBookmarkURL += rtl::OUString(static_cast<sal_Unicode>('#'));
1881 aBookmarkURL += aBookmarkName;
1884 AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, aBookmarkURL);
1885 AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1886 AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_REPLACE );
1887 AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
1890 catch(const Exception&)
1892 OSL_FAIL(" no \"BookmarkURL\" property at page?" );
1896 if( IsImpress() )
1897 ImplExportHeaderFooterDeclAttributes( maDrawPagesHeaderFooterSettings[nPageInd] );
1900 OUString sNavigationOrder( getNavigationOrder( xDrawPage ) );
1901 if( !sNavigationOrder.isEmpty() )
1902 AddAttribute ( XML_NAMESPACE_DRAW, XML_NAV_ORDER, sNavigationOrder );
1904 UniReference< xmloff::AnimationsExporter > xAnimationsExporter;
1905 uno::Reference< ::com::sun::star::animations::XAnimationNodeSupplier > xAnimNodeSupplier;
1907 // prepare animation export
1908 if(IsImpress())
1910 if( getExportFlags() & EXPORT_OASIS )
1912 // export new animations for oasis format
1913 xAnimNodeSupplier.set( xDrawPage, UNO_QUERY );
1915 // prepare animations exporter if impress
1916 if(xAnimNodeSupplier.is())
1918 xAnimationsExporter = new xmloff::AnimationsExporter( *this, xProps );
1919 xAnimationsExporter->prepare( xAnimNodeSupplier->getAnimationNode() );
1922 else
1924 // export old animations for ooo format
1925 UniReference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter( GetShapeExport().get() );
1926 GetShapeExport()->setAnimationsExporter( xAnimExport );
1930 // write draw:id
1931 const OUString aPageId = getInterfaceToIdentifierMapper().getIdentifier( xDrawPage );
1932 if( !aPageId.isEmpty() )
1934 AddAttributeIdLegacy(XML_NAMESPACE_DRAW, aPageId);
1937 // write page
1938 SvXMLElementExport aDPG(*this, XML_NAMESPACE_DRAW, XML_PAGE, sal_True, sal_True);
1940 // write optional office:forms
1941 exportFormsElement( xDrawPage );
1943 // write graphic objects on this page (if any)
1944 Reference< drawing::XShapes > xExportShapes(xDrawPage, UNO_QUERY);
1945 if(xExportShapes.is() && xExportShapes->getCount())
1946 GetShapeExport()->exportShapes( xExportShapes );
1948 // write animations and presentation notes (ONLY if presentation)
1949 if(IsImpress())
1951 if(xAnimNodeSupplier.is())
1953 xAnimationsExporter->exportAnimations( xAnimNodeSupplier->getAnimationNode() );
1955 else
1957 // animations
1958 UniReference< XMLAnimationsExporter > xAnimExport( GetShapeExport()->getAnimationsExporter() );
1959 if( xAnimExport.is() )
1960 xAnimExport->exportAnimations( *this );
1962 xAnimExport = NULL;
1963 GetShapeExport()->setAnimationsExporter( xAnimExport );
1966 // presentations
1967 Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
1968 if(xPresPage.is())
1970 Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
1971 if(xNotesPage.is())
1973 Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
1974 if(xShapes.is())
1976 if( !maDrawNotesPagesStyleNames[nPageInd].isEmpty() )
1977 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maDrawNotesPagesStyleNames[nPageInd]);
1979 ImplExportHeaderFooterDeclAttributes( maDrawNotesPagesHeaderFooterSettings[nPageInd] );
1981 // write presentation notes
1982 SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, sal_True, sal_True);
1984 // write optional office:forms
1985 exportFormsElement( xNotesPage );
1987 // write shapes per se
1988 GetShapeExport()->exportShapes( xShapes );
1994 exportAnnotations( xDrawPage );
1998 if( IsImpress() )
1999 exportPresentationSettings();
2002 //////////////////////////////////////////////////////////////////////////////
2004 void SdXMLExport::exportPresentationSettings()
2008 Reference< XPresentationSupplier > xPresSupplier( GetModel(), UNO_QUERY );
2009 if( !xPresSupplier.is() )
2010 return;
2012 Reference< XPropertySet > xPresProps( xPresSupplier->getPresentation(), UNO_QUERY );
2013 if( !xPresProps.is() )
2014 return;
2016 sal_Bool bHasAttr = sal_False;
2018 sal_Bool bTemp = false;
2020 // export range
2021 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowAll" ) ) ) >>= bTemp;
2022 if( !bTemp )
2024 OUString aFirstPage;
2025 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ) ) >>= aFirstPage;
2026 if( !aFirstPage.isEmpty() )
2028 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_PAGE, aFirstPage );
2029 bHasAttr = sal_True;
2031 else
2033 OUString aCustomShow;
2034 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomShow" ) ) ) >>= aCustomShow;
2035 if( !aCustomShow.isEmpty() )
2037 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW, aCustomShow );
2038 bHasAttr = sal_True;
2043 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ) ) >>= bTemp;
2044 if( bTemp )
2046 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ENDLESS, XML_TRUE );
2047 bHasAttr = sal_True;
2049 sal_Int32 nPause = 0;
2050 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Pause" ) ) ) >>= nPause;
2052 util::Duration aDuration;
2053 aDuration.Seconds = static_cast<sal_uInt16>(nPause);
2055 OUStringBuffer aOut;
2056 ::sax::Converter::convertDuration(aOut, aDuration);
2057 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAUSE, aOut.makeStringAndClear() );
2060 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowAnimations" ) ) ) >>= bTemp;
2061 if( !bTemp )
2063 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ANIMATIONS, XML_DISABLED );
2064 bHasAttr = sal_True;
2067 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAlwaysOnTop" ) ) ) >>= bTemp;
2068 if( bTemp )
2070 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STAY_ON_TOP, XML_TRUE );
2071 bHasAttr = sal_True;
2074 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ) ) >>= bTemp;
2075 if( bTemp )
2077 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FORCE_MANUAL, XML_TRUE );
2078 bHasAttr = sal_True;
2081 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ) ) >>= bTemp;
2082 if( !bTemp )
2084 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FULL_SCREEN, XML_FALSE );
2085 bHasAttr = sal_True;
2088 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsMouseVisible" ) ) ) >>= bTemp;
2089 if( !bTemp )
2091 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, XML_FALSE );
2092 bHasAttr = sal_True;
2095 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "StartWithNavigator" ) ) ) >>= bTemp;
2096 if( bTemp )
2098 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_WITH_NAVIGATOR, XML_TRUE );
2099 bHasAttr = sal_True;
2102 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "UsePen" ) ) ) >>= bTemp;
2103 if( bTemp )
2105 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_AS_PEN, XML_TRUE );
2106 bHasAttr = sal_True;
2109 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTransitionOnClick" ) ) ) >>= bTemp;
2110 if( !bTemp )
2112 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_TRANSITION_ON_CLICK, XML_DISABLED );
2113 bHasAttr = sal_True;
2116 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowLogo" ) ) ) >>= bTemp;
2117 if( bTemp )
2119 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW_LOGO, XML_TRUE );
2120 bHasAttr = sal_True;
2123 Reference< container::XNameContainer > xShows;
2124 Sequence< OUString > aShowNames;
2125 const OUString* pShowNames = NULL;
2126 sal_Int32 nShowCount = 0;
2128 Reference< XCustomPresentationSupplier > xSup( GetModel(), UNO_QUERY );
2129 if( xSup.is() )
2131 xShows = xSup->getCustomPresentations();
2132 if( xShows.is() )
2134 aShowNames = xShows->getElementNames();
2135 pShowNames = aShowNames.getArray();
2136 nShowCount = aShowNames.getLength();
2140 if( bHasAttr || nShowCount != 0 )
2142 SvXMLElementExport aSettings(*this, XML_NAMESPACE_PRESENTATION, XML_SETTINGS, sal_True, sal_True);
2144 if( nShowCount == 0 )
2145 return;
2147 Reference< XIndexContainer > xShow;
2148 Reference< XNamed > xPageName;
2150 OUStringBuffer sTmp;
2152 for( sal_Int32 nIndex = 0; nIndex < nShowCount; nIndex++, pShowNames++ )
2154 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, *pShowNames );
2156 xShows->getByName( *pShowNames ) >>= xShow;
2157 DBG_ASSERT( xShow.is(), "invalid custom show!" );
2158 if( !xShow.is() )
2159 continue;
2161 const sal_Int32 nPageCount = xShow->getCount();
2162 for( sal_Int32 nPage = 0; nPage < nPageCount; nPage++ )
2164 xShow->getByIndex( nPage ) >>= xPageName;
2166 if( !xPageName.is() )
2167 continue;
2169 if( sTmp.getLength() != 0 )
2170 sTmp.append( sal_Unicode( ',' ) );
2171 sTmp.append( xPageName->getName() );
2175 if( sTmp.getLength() )
2176 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAGES, sTmp.makeStringAndClear() );
2178 SvXMLElementExport aShows(*this, XML_NAMESPACE_PRESENTATION, XML_SHOW, sal_True, sal_True);
2182 catch(const uno::Exception&)
2184 OSL_FAIL( "uno::Exception while exporting <presentation:settings>" );
2188 //////////////////////////////////////////////////////////////////////////////
2190 void SdXMLExport::_ExportStyles(sal_Bool bUsed)
2192 GetPropertySetMapper()->SetAutoStyles( sal_False );
2194 // export fill styles
2195 SvXMLExport::_ExportStyles( bUsed );
2197 // write draw:style-name for object graphic-styles
2198 GetShapeExport()->ExportGraphicDefaults();
2200 // do not export in ODF 1.1 or older
2201 if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
2202 GetShapeExport()->GetShapeTableExport()->exportTableStyles();
2204 // write presentation styles
2205 ImpWritePresentationStyles();
2207 // prepare draw:auto-layout-name for page export
2208 ImpPrepAutoLayoutInfos();
2210 // write draw:auto-layout-name for page export
2211 ImpWriteAutoLayoutInfos();
2213 Reference< beans::XPropertySet > xInfoSet( getExportInfo() );
2214 if( xInfoSet.is() )
2216 Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
2218 Any aAny;
2220 if( xInfoSetInfo->hasPropertyByName( msPageLayoutNames ) )
2222 aAny <<= maDrawPagesAutoLayoutNames;
2223 xInfoSet->setPropertyValue( msPageLayoutNames, aAny );
2228 //////////////////////////////////////////////////////////////////////////////
2230 void SdXMLExport::_ExportAutoStyles()
2232 Reference< beans::XPropertySet > xInfoSet( getExportInfo() );
2233 if( xInfoSet.is() )
2235 Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
2237 if( xInfoSetInfo->hasPropertyByName( msPageLayoutNames ) )
2239 xInfoSet->getPropertyValue( msPageLayoutNames ) >>= maDrawPagesAutoLayoutNames;
2243 GetPropertySetMapper()->SetAutoStyles( sal_True );
2245 if( getExportFlags() & EXPORT_STYLES )
2247 // #80012# PageMaster export moved from _ExportStyles
2248 // prepare page-master infos
2249 ImpPrepPageMasterInfos();
2251 // write page-master infos
2252 ImpWritePageMasterInfos();
2254 // prepare draw:style-name for master page export
2255 ImpPrepMasterPageInfos();
2258 if( getExportFlags() & EXPORT_CONTENT )
2260 // prepare draw:style-name for page export
2261 ImpPrepDrawPageInfos();
2264 // export draw-page styles
2265 GetAutoStylePool()->exportXML(
2266 XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID
2267 , GetDocHandler(),
2268 GetMM100UnitConverter(),
2269 GetNamespaceMap()
2272 if( getExportFlags() & EXPORT_STYLES )
2274 // create auto style infos for shapes on master handout page
2275 if( IsImpress() )
2277 Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
2278 if( xHandoutSupp.is() )
2280 Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
2281 if( xHandoutPage.is() )
2283 Reference< drawing::XShapes > xShapes(xHandoutPage, UNO_QUERY);
2284 if(xShapes.is() && xShapes->getCount())
2285 GetShapeExport()->collectShapesAutoStyles( xShapes );
2290 // create auto style infos for objects on master pages
2291 for(sal_Int32 nMPageId(0L); nMPageId < mnDocMasterPageCount; nMPageId++)
2293 Reference< XDrawPage > xMasterPage(mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
2295 if( xMasterPage.is() )
2297 // collect layer information
2298 GetFormExport()->examineForms( xMasterPage );
2300 // get MasterPage Name
2301 OUString aMasterPageNamePrefix;
2302 Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY);
2303 if(xNamed.is())
2305 aMasterPageNamePrefix = xNamed->getName();
2307 if(!aMasterPageNamePrefix.isEmpty())
2309 aMasterPageNamePrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
2311 GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
2313 Reference< drawing::XShapes > xMasterShapes(xMasterPage, UNO_QUERY);
2314 if(xMasterShapes.is() && xMasterShapes->getCount())
2315 GetShapeExport()->collectShapesAutoStyles( xMasterShapes );
2317 if(IsImpress())
2319 Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
2320 if(xPresPage.is())
2322 Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
2323 if(xNotesPage.is())
2325 // collect layer information
2326 GetFormExport()->examineForms( xNotesPage );
2328 Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
2329 if(xShapes.is() && xShapes->getCount())
2330 GetShapeExport()->collectShapesAutoStyles( xShapes );
2334 collectAnnotationAutoStyles(xMasterPage);
2339 if( getExportFlags() & EXPORT_CONTENT )
2341 // prepare animations exporter if impress
2342 if(IsImpress() && ((getExportFlags() & EXPORT_OASIS) == 0) )
2344 UniReference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter( GetShapeExport().get() );
2345 GetShapeExport()->setAnimationsExporter( xAnimExport );
2348 // create auto style infos for objects on pages
2349 for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
2351 Reference<XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), UNO_QUERY );
2352 if( xDrawPage.is() )
2354 // collect layer information
2355 GetFormExport()->examineForms( xDrawPage );
2357 // get MasterPage Name
2358 OUString aMasterPageNamePrefix;
2359 Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY);
2360 if(xMasterPageInt.is())
2362 Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
2363 if(xUsedMasterPage.is())
2365 Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
2366 if(xMasterNamed.is())
2368 aMasterPageNamePrefix = xMasterNamed->getName();
2372 if(!aMasterPageNamePrefix.isEmpty())
2374 aMasterPageNamePrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
2377 GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
2379 // prepare object infos
2380 Reference< drawing::XShapes > xDrawShapes(xDrawPage, UNO_QUERY);
2381 if(xDrawShapes.is() && xDrawShapes->getCount())
2382 GetShapeExport()->collectShapesAutoStyles( xDrawShapes );
2384 // prepare presentation notes page object infos (ONLY if presentation)
2385 if(IsImpress())
2387 Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
2388 if(xPresPage.is())
2390 Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
2391 if(xNotesPage.is())
2393 // collect layer information
2394 GetFormExport()->examineForms( xNotesPage );
2396 Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
2397 if(xShapes.is() && xShapes->getCount())
2398 GetShapeExport()->collectShapesAutoStyles( xShapes );
2403 collectAnnotationAutoStyles( xDrawPage );
2406 if(IsImpress())
2408 UniReference< XMLAnimationsExporter > xAnimExport;
2409 GetShapeExport()->setAnimationsExporter( xAnimExport );
2413 exportAutoDataStyles();
2415 GetShapeExport()->exportAutoStyles();
2417 sal_uInt16 nContentAutostyles = EXPORT_CONTENT | EXPORT_AUTOSTYLES;
2418 if ( ( getExportFlags() & nContentAutostyles ) == nContentAutostyles )
2419 GetFormExport()->exportAutoStyles( );
2421 // ...for text
2422 GetTextParagraphExport()->exportTextAutoStyles();
2425 //////////////////////////////////////////////////////////////////////////////
2427 void SdXMLExport::_ExportMasterStyles()
2429 // export layer
2430 SdXMLayerExporter::exportLayer( *this );
2432 // export handout master page if impress
2433 if( IsImpress() )
2435 Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
2436 if( xHandoutSupp.is() )
2438 Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
2439 if( xHandoutPage.is() )
2441 // presentation:page-layout-name
2442 if( IsImpress() && !maDrawPagesAutoLayoutNames[0].isEmpty())
2444 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, EncodeStyleName( maDrawPagesAutoLayoutNames[0] ));
2447 ImpXMLEXPPageMasterInfo* pInfo = mpHandoutPageMaster;
2448 if(pInfo)
2450 OUString sString = pInfo->GetName();
2451 AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
2454 // draw:style-name
2455 if( !maHandoutMasterStyleName.isEmpty() )
2456 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maHandoutMasterStyleName);
2458 ImplExportHeaderFooterDeclAttributes( maHandoutPageHeaderFooterSettings );
2460 // write masterpage
2461 SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_HANDOUT_MASTER, sal_True, sal_True);
2463 // write graphic objects on this master page (if any)
2464 Reference< drawing::XShapes > xShapes(xHandoutPage, UNO_QUERY);
2465 if(xShapes.is() && xShapes->getCount())
2466 GetShapeExport()->exportShapes( xShapes );
2471 // export MasterPages in master-styles section
2472 for (sal_Int32 nMPageId = 0; nMPageId < mnDocMasterPageCount; nMPageId++)
2474 Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
2475 if(xMasterPage.is())
2477 // prepare masterpage attributes
2478 OUString sMasterPageName;
2479 Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY);
2480 if(xNamed.is())
2482 sal_Bool bEncoded = sal_False;
2483 sMasterPageName = xNamed->getName();
2484 AddAttribute(XML_NAMESPACE_STYLE, XML_NAME,
2485 EncodeStyleName( sMasterPageName, &bEncoded ));
2486 if( bEncoded )
2487 AddAttribute(
2488 XML_NAMESPACE_STYLE, XML_DISPLAY_NAME,
2489 sMasterPageName );
2492 ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterUsageList->at( nMPageId );
2493 if(pInfo)
2495 OUString sString = pInfo->GetName();
2496 AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
2499 // draw:style-name (background attributes)
2500 if( !maMasterPagesStyleNames[nMPageId].isEmpty() )
2501 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
2502 maMasterPagesStyleNames[nMPageId]);
2504 // write masterpage
2505 SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_MASTER_PAGE, sal_True, sal_True);
2507 // write optional office:forms
2508 exportFormsElement( xMasterPage );
2510 // write graphic objects on this master page (if any)
2511 Reference< drawing::XShapes > xMasterShapes(xMasterPage, UNO_QUERY);
2512 if(xMasterShapes.is() && xMasterShapes->getCount())
2513 GetShapeExport()->exportShapes( xMasterShapes );
2515 // write presentation notes (ONLY if presentation)
2516 if(IsImpress())
2518 Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
2519 if(xPresPage.is())
2521 Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
2522 if(xNotesPage.is())
2524 Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
2525 if(xShapes.is())
2527 ImpXMLEXPPageMasterInfo* pMasterInfo = mpNotesPageMasterUsageList->at( nMPageId );
2528 if(pMasterInfo)
2530 OUString sString = pMasterInfo->GetName();
2531 AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString);
2534 // write presentation notes
2535 SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, sal_True, sal_True);
2537 // write optional office:forms
2538 exportFormsElement( xNotesPage );
2540 // write shapes per se
2541 GetShapeExport()->exportShapes( xShapes );
2546 exportAnnotations( xMasterPage );
2551 void SdXMLExport::exportFormsElement( Reference< XDrawPage > xDrawPage )
2553 if( xDrawPage.is() )
2555 Reference< form::XFormsSupplier2 > xFormsSupplier( xDrawPage, UNO_QUERY );
2556 if ( xFormsSupplier.is() && xFormsSupplier->hasForms() )
2558 // write masterpage
2559 ::xmloff::OOfficeFormsExport aForms(*this);
2560 GetFormExport()->exportForms( xDrawPage );
2563 if(! GetFormExport()->seekPage( xDrawPage ) )
2565 OSL_FAIL( "OFormLayerXMLExport::seekPage failed!" );
2570 void SdXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
2572 rProps.realloc(4);
2573 beans::PropertyValue* pProps = rProps.getArray();
2574 if(pProps)
2576 Reference< beans::XPropertySet > xPropSet( GetModel(), UNO_QUERY );
2577 if( !xPropSet.is() )
2578 return;
2580 awt::Rectangle aVisArea;
2581 xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ) ) >>= aVisArea;
2583 sal_uInt16 i = 0;
2584 pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaTop"));
2585 pProps[i++].Value <<= aVisArea.Y;
2586 pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaLeft"));
2587 pProps[i++].Value <<= aVisArea.X;
2588 pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaWidth"));
2589 pProps[i++].Value <<= aVisArea.Width;
2590 pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaHeight"));
2591 pProps[i++].Value <<= aVisArea.Height;
2595 void SdXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& rProps)
2597 Reference< lang::XMultiServiceFactory > xFac( GetModel(), UNO_QUERY );
2598 if( xFac.is() )
2600 Reference< beans::XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), UNO_QUERY );
2601 if( xProps.is() )
2602 SvXMLUnitConverter::convertPropertySet( rProps, xProps );
2603 DocumentSettingsSerializer *pFilter;
2604 pFilter = dynamic_cast<DocumentSettingsSerializer *>(xProps.get());
2605 if( pFilter )
2606 rProps = pFilter->filterStreamsToStorage( GetTargetStorage(), rProps );
2610 //////////////////////////////////////////////////////////////////////////////
2612 void SdXMLExport::addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat )
2614 sal_Int32 nFormat = nNumberFormat;
2615 if( (nNumberFormat > 1) && (nNumberFormat <= 0x0f) )
2616 nFormat -= 2;
2618 if( bTimeFormat )
2620 if( maUsedTimeStyles.count( nFormat ) == 0 )
2621 maUsedTimeStyles.insert( nFormat );
2623 else
2625 if( maUsedDateStyles.count( nFormat ) == 0 )
2626 maUsedDateStyles.insert( nFormat );
2630 //////////////////////////////////////////////////////////////////////////////
2632 void SdXMLExport::exportDataStyles()
2634 // there are no data styles to export in draw/impress yet
2637 //////////////////////////////////////////////////////////////////////////////
2639 void SdXMLExport::exportAutoDataStyles()
2641 SdXMLFormatMap::iterator aIter( maUsedDateStyles.begin() );
2642 SdXMLFormatMap::iterator aEnd( maUsedDateStyles.end() );
2644 while( aIter != aEnd )
2645 SdXMLNumberStylesExporter::exportDateStyle( *this, (*aIter++) );
2647 aIter = maUsedTimeStyles.begin();
2648 aEnd = maUsedTimeStyles.end();
2649 while( aIter != aEnd )
2650 SdXMLNumberStylesExporter::exportTimeStyle( *this, (*aIter++) );
2652 if(HasFormExport())
2653 GetFormExport()->exportAutoControlNumberStyles();
2656 //////////////////////////////////////////////////////////////////////////////
2658 OUString SdXMLExport::getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat ) const
2660 if( bTimeFormat )
2662 return SdXMLNumberStylesExporter::getTimeStyleName( nNumberFormat );
2664 else
2666 return SdXMLNumberStylesExporter::getDateStyleName( nNumberFormat );
2670 OUString SdXMLExport::getNavigationOrder( const Reference< XDrawPage >& xDrawPage )
2672 OUStringBuffer sNavOrder;
2675 Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
2676 Reference< XIndexAccess > xNavOrder( xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NavigationOrder" ) ) ), UNO_QUERY_THROW );
2678 Reference< XIndexAccess > xZOrderAccess( xDrawPage, UNO_QUERY );
2680 // only export navigation order if it is different from the z-order
2681 if( (xNavOrder.get() != xZOrderAccess.get()) && (xNavOrder->getCount() == xDrawPage->getCount()) )
2683 sal_Int32 nIndex;
2684 const sal_Int32 nCount = xNavOrder->getCount();
2685 for( nIndex = 0; nIndex < nCount; ++nIndex )
2687 OUString sId( getInterfaceToIdentifierMapper().registerReference( Reference< XInterface >( xNavOrder->getByIndex( nIndex ), UNO_QUERY ) ) );
2688 if( !sId.isEmpty() )
2690 if( sNavOrder.getLength() != 0 )
2691 sNavOrder.append( (sal_Unicode)' ' );
2692 sNavOrder.append( sId );
2697 catch(const Exception&)
2700 return sNavOrder.makeStringAndClear();
2703 //////////////////////////////////////////////////////////////////////////////
2705 void SdXMLExport::collectAnnotationAutoStyles( const Reference<XDrawPage>& xDrawPage )
2707 Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY );
2708 if( xAnnotationAccess.is() ) try
2710 Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
2711 if( xAnnotationEnumeration.is() )
2713 while( xAnnotationEnumeration->hasMoreElements() )
2715 Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_QUERY_THROW );
2716 Reference< XText > xText( xAnnotation->getTextRange() );
2717 if(xText.is() && !xText->getString().isEmpty())
2718 GetTextParagraphExport()->collectTextAutoStyles( xText );
2722 catch(const Exception&)
2724 OSL_FAIL("SdXMLExport::collectAnnotationAutoStyles(), exception caught during export of annotation auto styles");
2728 void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage )
2730 // do not export in ODF 1.2 or older
2731 if( getDefaultVersion() <= SvtSaveOptions::ODFVER_012 )
2732 return;
2734 Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY );
2735 if( xAnnotationAccess.is() ) try
2737 Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
2738 if( xAnnotationEnumeration.is() && xAnnotationEnumeration->hasMoreElements() )
2740 OUStringBuffer sStringBuffer;
2743 Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_QUERY_THROW );
2745 RealPoint2D aPosition( xAnnotation->getPosition() );
2747 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
2748 static_cast<sal_Int32>( aPosition.X * 100 ) );
2749 AddAttribute(XML_NAMESPACE_SVG, XML_X, sStringBuffer.makeStringAndClear());
2751 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
2752 static_cast<sal_Int32>( aPosition.Y * 100 ) );
2753 AddAttribute(XML_NAMESPACE_SVG, XML_Y, sStringBuffer.makeStringAndClear());
2755 RealSize2D aSize( xAnnotation->getSize() );
2757 if( aSize.Width || aSize.Height )
2759 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
2760 static_cast<sal_Int32>( aSize.Width * 100 ) );
2761 AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, sStringBuffer.makeStringAndClear());
2762 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
2763 static_cast<sal_Int32>( aSize.Height * 100 ) );
2764 AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, sStringBuffer.makeStringAndClear());
2767 // annotation element + content
2768 SvXMLElementExport aElem(*this, XML_NAMESPACE_OFFICE_EXT, XML_ANNOTATION, sal_False, sal_True);
2770 // author
2771 OUString aAuthor( xAnnotation->getAuthor() );
2772 if( !aAuthor.isEmpty() )
2774 SvXMLElementExport aCreatorElem( *this, XML_NAMESPACE_DC, XML_CREATOR, sal_True, sal_False );
2775 this->Characters(aAuthor);
2779 // date time
2780 DateTime aDate( xAnnotation->getDateTime() );
2781 ::sax::Converter::convertDateTime(sStringBuffer, aDate, true);
2782 SvXMLElementExport aDateElem( *this, XML_NAMESPACE_DC, XML_DATE, sal_True, sal_False );
2783 Characters(sStringBuffer.makeStringAndClear());
2786 com::sun::star::uno::Reference < com::sun::star::text::XText > xText( xAnnotation->getTextRange() );
2787 if( xText.is() )
2788 this->GetTextParagraphExport()->exportText( xText );
2790 while( xAnnotationEnumeration->hasMoreElements() );
2793 catch(const Exception&)
2795 OSL_FAIL("SdXMLExport::exportAnnotations(), exception caught during export of annotations");
2799 //////////////////////////////////////////////////////////////////////////////
2801 #define SERVICE( classname, servicename, implementationname, draw, flags )\
2802 uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw()\
2804 const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( servicename ) );\
2805 const uno::Sequence< OUString > aSeq( &aServiceName, 1 );\
2806 return aSeq;\
2808 OUString SAL_CALL classname##_getImplementationName() throw()\
2810 return OUString( RTL_CONSTASCII_USTRINGPARAM( implementationname ) );\
2812 uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )\
2814 return (cppu::OWeakObject*)new SdXMLExport( rSMgr, draw, flags );\
2817 SERVICE( XMLImpressExportOasis, "com.sun.star.comp.Impress.XMLOasisExporter", "XMLImpressExportOasis", sal_False, EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
2818 SERVICE( XMLImpressStylesExportOasis, "com.sun.star.comp.Impress.XMLOasisStylesExporter", "XMLImpressStylesExportOasis", sal_False, EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
2819 SERVICE( XMLImpressContentExportOasis, "com.sun.star.comp.Impress.XMLOasisContentExporter", "XMLImpressContentExportOasis", sal_False, EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
2820 SERVICE( XMLImpressMetaExportOasis, "com.sun.star.comp.Impress.XMLOasisMetaExporter", "XMLImpressMetaExportOasis", sal_False, EXPORT_OASIS|EXPORT_META );
2821 SERVICE( XMLImpressSettingsExportOasis, "com.sun.star.comp.Impress.XMLOasisSettingsExporter", "XMLImpressSettingsExportOasis", sal_False, EXPORT_OASIS|EXPORT_SETTINGS );
2823 SERVICE( XMLImpressExportOOO, "com.sun.star.comp.Impress.XMLExporter", "XMLImpressExportOOO", sal_False, EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
2824 SERVICE( XMLImpressStylesExportOOO, "com.sun.star.comp.Impress.XMLStylesExporter", "XMLImpressStylesExportOOO", sal_False, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
2825 SERVICE( XMLImpressContentExportOOO, "com.sun.star.comp.Impress.XMLContentExporter", "XMLImpressContentExportOOO", sal_False, EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
2826 SERVICE( XMLImpressMetaExportOOO, "com.sun.star.comp.Impress.XMLMetaExporter", "XMLImpressMetaExportOOO", sal_False, EXPORT_META );
2827 SERVICE( XMLImpressSettingsExportOOO, "com.sun.star.comp.Impress.XMLSettingsExporter", "XMLImpressSettingsExportOOO", sal_False, EXPORT_SETTINGS );
2829 SERVICE( XMLDrawExportOasis, "com.sun.star.comp.Draw.XMLOasisExporter", "XMLDrawExportOasis", sal_True, EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
2830 SERVICE( XMLDrawStylesExportOasis, "com.sun.star.comp.Draw.XMLOasisStylesExporter", "XMLDrawStylesExportOasis", sal_True, EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
2831 SERVICE( XMLDrawContentExportOasis, "com.sun.star.comp.Draw.XMLOasisContentExporter", "XMLDrawContentExportOasis", sal_True, EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
2832 SERVICE( XMLDrawMetaExportOasis, "com.sun.star.comp.Draw.XMLOasisMetaExporter", "XMLDrawMetaExportOasis", sal_True, EXPORT_OASIS|EXPORT_META );
2833 SERVICE( XMLDrawSettingsExportOasis, "com.sun.star.comp.Draw.XMLOasisSettingsExporter", "XMLDrawSettingsExportOasis", sal_True, EXPORT_OASIS|EXPORT_SETTINGS );
2835 SERVICE( XMLDrawExportOOO, "com.sun.star.comp.Draw.XMLExporter", "XMLDrawExportOOO", sal_True, EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
2836 SERVICE( XMLDrawStylesExportOOO, "com.sun.star.comp.Draw.XMLStylesExporter", "XMLDrawStylesExportOOO", sal_True, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
2837 SERVICE( XMLDrawContentExportOOO, "com.sun.star.comp.Draw.XMLContentExporter", "XMLDrawContentExportOOO", sal_True, EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
2838 SERVICE( XMLDrawMetaExportOOO, "com.sun.star.comp.Draw.XMLMetaExporter", "XMLDrawMetaExportOOO", sal_True, EXPORT_META );
2839 SERVICE( XMLDrawSettingsExportOOO, "com.sun.star.comp.Draw.XMLSettingsExporter", "XMLDrawSettingsExportOOO", sal_True, EXPORT_SETTINGS );
2841 SERVICE( XMLDrawingLayerExport, "com.sun.star.comp.DrawingLayer.XMLExporter", "XMLDrawingLayerExport", sal_True, EXPORT_OASIS|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
2842 SERVICE( XMLImpressClipboardExport, "com.sun.star.comp.Impress.XMLClipboardExporter", "XMLImpressClipboardExport", sal_False, EXPORT_OASIS|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
2844 // XServiceInfo
2845 OUString SAL_CALL SdXMLExport::getImplementationName() throw( uno::RuntimeException )
2847 if( IsDraw())
2849 // Draw
2851 switch( getExportFlags())
2853 case EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
2854 return XMLDrawExportOOO_getImplementationName();
2855 case EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
2856 return XMLDrawStylesExportOOO_getImplementationName();
2857 case EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
2858 return XMLDrawContentExportOOO_getImplementationName();
2859 case EXPORT_META:
2860 return XMLDrawMetaExportOOO_getImplementationName();
2861 case EXPORT_SETTINGS:
2862 return XMLDrawSettingsExportOOO_getImplementationName();
2864 case EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
2865 return XMLDrawExportOasis_getImplementationName();
2866 case EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
2867 return XMLDrawStylesExportOasis_getImplementationName();
2868 case EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
2869 return XMLDrawContentExportOasis_getImplementationName();
2870 case EXPORT_OASIS|EXPORT_META:
2871 return XMLDrawMetaExportOasis_getImplementationName();
2872 case EXPORT_OASIS|EXPORT_SETTINGS:
2873 return XMLDrawSettingsExportOasis_getImplementationName();
2875 default:
2876 return XMLDrawExportOOO_getImplementationName();
2879 else
2881 // Impress
2883 switch( getExportFlags())
2885 case EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
2886 return XMLImpressExportOOO_getImplementationName();
2887 case EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
2888 return XMLImpressStylesExportOOO_getImplementationName();
2889 case EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
2890 return XMLImpressContentExportOOO_getImplementationName();
2891 case EXPORT_META:
2892 return XMLImpressMetaExportOOO_getImplementationName();
2893 case EXPORT_SETTINGS:
2894 return XMLImpressSettingsExportOOO_getImplementationName();
2895 case EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
2896 return XMLImpressExportOasis_getImplementationName();
2897 case EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
2898 return XMLImpressStylesExportOasis_getImplementationName();
2899 case EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
2900 return XMLImpressContentExportOasis_getImplementationName();
2901 case EXPORT_OASIS|EXPORT_META:
2902 return XMLImpressMetaExportOasis_getImplementationName();
2903 case EXPORT_OASIS|EXPORT_SETTINGS:
2904 return XMLImpressSettingsExportOasis_getImplementationName();
2906 default:
2907 return XMLImpressExportOOO_getImplementationName();
2912 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */