xref: /trunk/main/xmloff/source/draw/sdxmlexp.cxx (revision 91144cd0085a7583d2099b982122deb2184ab956) !
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmloff.hxx"
26 #include "unointerfacetouniqueidentifiermapper.hxx"
27 #include <xmloff/nmspmap.hxx>
28 #include "xmloff/xmlnmspe.hxx"
29 #include <xmloff/xmluconv.hxx>
30 #include <xmloff/xmltoken.hxx>
31 #include <xmloff/xmlmetae.hxx>
32 #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
33 #include <com/sun/star/presentation/XPresentationSupplier.hpp>
34 #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
35 #include <com/sun/star/geometry/RealPoint2D.hpp>
36 #include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
37 #include <com/sun/star/office/XAnnotationAccess.hpp>
38 #include <com/sun/star/lang/Locale.hpp>
39 #include <com/sun/star/uno/Any.hxx>
40 #include "sdxmlexp_impl.hxx"
41 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
42 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
43 #include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
44 #include <com/sun/star/container/XIndexContainer.hpp>
45 #include <com/sun/star/view/PaperOrientation.hpp>
46 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
47 #include <com/sun/star/style/XStyle.hpp>
48 
49 #include <com/sun/star/form/XFormsSupplier2.hpp>
50 #include <com/sun/star/presentation/XPresentationPage.hpp>
51 #include <com/sun/star/drawing/XMasterPageTarget.hpp>
52 #include <com/sun/star/text/XText.hpp>
53 #include <com/sun/star/chart/XChartDocument.hpp>
54 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
55 #include <com/sun/star/container/XNamed.hpp>
56 #include <rtl/ustrbuf.hxx>
57 #include <tools/gen.hxx>
58 #include <tools/debug.hxx>
59 #include <xmloff/xmlaustp.hxx>
60 #include <xmloff/families.hxx>
61 #include <xmloff/styleexp.hxx>
62 #include "sdpropls.hxx"
63 #include <xmloff/xmlexppr.hxx>
64 #include <com/sun/star/beans/XPropertyState.hpp>
65 #include "xexptran.hxx"
66 
67 #ifndef _CPPUHELPER_IMPLBASE1_HXX
68 #include <cppuhelper/implbase1.hxx>
69 #endif
70 #include <comphelper/extract.hxx>
71 #include <com/sun/star/lang/XServiceInfo.hpp>
72 #include "PropertySetMerger.hxx"
73 #include "layerexp.hxx"
74 
75 
76 #include "xmloff/VisAreaExport.hxx"
77 #include "XMLNumberStylesExport.hxx"
78 #include <tools/list.hxx>
79 #include <tools/string.hxx>
80 
81 #include "animationexport.hxx"
82 
83 #include <com/sun/star/document/XDocumentProperties.hpp>
84 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
85 
86 using ::rtl::OUString;
87 using ::rtl::OUStringBuffer;
88 
89 using namespace ::com::sun::star;
90 using namespace ::com::sun::star::uno;
91 using namespace ::com::sun::star::beans;
92 using namespace ::com::sun::star::util;
93 using namespace ::com::sun::star::container;
94 using namespace ::com::sun::star::drawing;
95 using namespace ::com::sun::star::office;
96 using namespace ::com::sun::star::presentation;
97 using namespace ::com::sun::star::geometry;
98 using namespace ::com::sun::star::text;
99 using namespace ::xmloff::token;
100 
101 
102 //////////////////////////////////////////////////////////////////////////////
103 
104 class ImpXMLEXPPageMasterInfo
105 {
106     sal_Int32                   mnBorderBottom;
107     sal_Int32                   mnBorderLeft;
108     sal_Int32                   mnBorderRight;
109     sal_Int32                   mnBorderTop;
110     sal_Int32                   mnWidth;
111     sal_Int32                   mnHeight;
112     view::PaperOrientation      meOrientation;
113     OUString                    msName;
114     OUString                    msMasterPageName;
115 
116 public:
117     ImpXMLEXPPageMasterInfo(const SdXMLExport& rExp, const Reference<XDrawPage>& xPage);
118     sal_Bool operator==(const ImpXMLEXPPageMasterInfo& rInfo) const;
119     void SetName(const OUString& rStr);
120 
GetName() const121     const OUString& GetName() const { return msName; }
GetMasterPageName() const122     const OUString& GetMasterPageName() const { return msMasterPageName; }
123 
GetBorderBottom() const124     sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
GetBorderLeft() const125     sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
GetBorderRight() const126     sal_Int32 GetBorderRight() const { return mnBorderRight; }
GetBorderTop() const127     sal_Int32 GetBorderTop() const { return mnBorderTop; }
GetWidth() const128     sal_Int32 GetWidth() const { return mnWidth; }
GetHeight() const129     sal_Int32 GetHeight() const { return mnHeight; }
GetOrientation() const130     view::PaperOrientation GetOrientation() const { return meOrientation; }
131 };
132 
ImpXMLEXPPageMasterInfo(const SdXMLExport & rExp,const Reference<XDrawPage> & xPage)133 ImpXMLEXPPageMasterInfo::ImpXMLEXPPageMasterInfo(
134     const SdXMLExport& rExp,
135     const Reference<XDrawPage>& xPage)
136 :   mnBorderBottom(0),
137     mnBorderLeft(0),
138     mnBorderRight(0),
139     mnBorderTop(0),
140     mnWidth(0),
141     mnHeight(0),
142     meOrientation(rExp.IsDraw() ? view::PaperOrientation_PORTRAIT : view::PaperOrientation_LANDSCAPE)
143 {
144     Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY);
145     if(xPropSet.is())
146     {
147         Any aAny;
148 
149         Reference< beans::XPropertySetInfo > xPropsInfo( xPropSet->getPropertySetInfo() );
150         if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom") )))
151         {
152             aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom")));
153             aAny >>= mnBorderBottom;
154 
155             aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderLeft")));
156             aAny >>= mnBorderLeft;
157 
158             aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderRight")));
159             aAny >>= mnBorderRight;
160 
161             aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderTop")));
162             aAny >>= mnBorderTop;
163         }
164 
165         if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("Width") )))
166         {
167             aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Width")));
168             aAny >>= mnWidth;
169 
170             aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Height")));
171             aAny >>= mnHeight;
172         }
173 
174         if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation") )))
175         {
176             aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation")));
177             aAny >>= meOrientation;
178         }
179     }
180 
181     Reference <container::XNamed> xMasterNamed(xPage, UNO_QUERY);
182     if(xMasterNamed.is())
183     {
184         msMasterPageName = xMasterNamed->getName();
185     }
186 }
187 
operator ==(const ImpXMLEXPPageMasterInfo & rInfo) const188 sal_Bool ImpXMLEXPPageMasterInfo::operator==(const ImpXMLEXPPageMasterInfo& rInfo) const
189 {
190     return ((mnBorderBottom == rInfo.mnBorderBottom)
191         && (mnBorderLeft == rInfo.mnBorderLeft)
192         && (mnBorderRight == rInfo.mnBorderRight)
193         && (mnBorderTop == rInfo.mnBorderTop)
194         && (mnWidth == rInfo.mnWidth)
195         && (mnHeight == rInfo.mnHeight)
196         && (meOrientation == rInfo.meOrientation));
197 }
198 
SetName(const OUString & rStr)199 void ImpXMLEXPPageMasterInfo::SetName(const OUString& rStr)
200 {
201     msName = rStr;
202 }
203 
204 DECLARE_LIST(ImpXMLEXPPageMasterList, ImpXMLEXPPageMasterInfo*)
205 
206 //////////////////////////////////////////////////////////////////////////////
207 
208 #define IMP_AUTOLAYOUT_INFO_MAX         (35L)
209 
210 class ImpXMLAutoLayoutInfo
211 {
212     sal_uInt16                  mnType;
213     ImpXMLEXPPageMasterInfo*    mpPageMasterInfo;
214     OUString                    msLayoutName;
215     Rectangle                   maTitleRect;
216     Rectangle                   maPresRect;
217     sal_Int32                   mnGapX;
218     sal_Int32                   mnGapY;
219 
220 public:
221     ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf);
222 
223     sal_Bool operator==(const ImpXMLAutoLayoutInfo& rInfo) const;
224 
GetLayoutType() const225     sal_uInt16 GetLayoutType() const { return mnType; }
GetGapX() const226     sal_Int32 GetGapX() const { return mnGapX; }
GetGapY() const227     sal_Int32 GetGapY() const { return mnGapY; }
228 
GetLayoutName() const229     const OUString& GetLayoutName() const { return msLayoutName; }
SetLayoutName(const OUString & rNew)230     void SetLayoutName(const OUString& rNew) { msLayoutName = rNew; }
231 
GetTitleRectangle() const232     const Rectangle& GetTitleRectangle() const { return maTitleRect; }
GetPresRectangle() const233     const Rectangle& GetPresRectangle() const { return maPresRect; }
234 
235     static sal_Bool IsCreateNecessary(sal_uInt16 nTyp);
236 };
237 
IsCreateNecessary(sal_uInt16 nTyp)238 sal_Bool ImpXMLAutoLayoutInfo::IsCreateNecessary(sal_uInt16 nTyp)
239 {
240     if(nTyp == 5 /* AUTOLAYOUT_ORG */
241         || nTyp == 20 /* AUTOLAYOUT_NONE */
242         || nTyp >= IMP_AUTOLAYOUT_INFO_MAX)
243         return sal_False;
244     return sal_True;
245 }
246 
operator ==(const ImpXMLAutoLayoutInfo & rInfo) const247 sal_Bool ImpXMLAutoLayoutInfo::operator==(const ImpXMLAutoLayoutInfo& rInfo) const
248 {
249     return ((mnType == rInfo.mnType
250         && mpPageMasterInfo == rInfo.mpPageMasterInfo));
251 }
252 
ImpXMLAutoLayoutInfo(sal_uInt16 nTyp,ImpXMLEXPPageMasterInfo * pInf)253 ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf)
254 :   mnType(nTyp),
255     mpPageMasterInfo(pInf)
256 {
257     // create full info (initialize with typical values)
258     Point aPagePos(0,0);
259     Size aPageSize(28000, 21000);
260     Size aPageInnerSize(28000, 21000);
261 
262     if(mpPageMasterInfo)
263     {
264         aPagePos = Point(mpPageMasterInfo->GetBorderLeft(), mpPageMasterInfo->GetBorderTop());
265         aPageSize = Size(mpPageMasterInfo->GetWidth(), mpPageMasterInfo->GetHeight());
266         aPageInnerSize = aPageSize;
267         aPageInnerSize.Width() -= mpPageMasterInfo->GetBorderLeft() + mpPageMasterInfo->GetBorderRight();
268         aPageInnerSize.Height() -= mpPageMasterInfo->GetBorderTop() + mpPageMasterInfo->GetBorderBottom();
269     }
270 
271     // title rectangle aligning
272     Point aTitlePos(aPagePos);
273     Size aTitleSize(aPageInnerSize);
274 
275     if(mnType == 21 /* AUTOLAYOUT_NOTES */)
276     {
277         aTitleSize.Height() = (long) (aTitleSize.Height() / 2.5);
278         Point aPos = aTitlePos;
279         aPos.Y() += long( aTitleSize.Height() * 0.083 );
280         Size aPartArea = aTitleSize;
281         Size aSize;
282 
283         // tatsaechliche Seitengroesse in das Handout-Rechteck skalieren
284         double fH = (double) aPartArea.Width()  / aPageSize.Width();
285         double fV = (double) aPartArea.Height() / aPageSize.Height();
286 
287         if ( fH > fV )
288             fH = fV;
289         aSize.Width()  = (long) (fH * aPageSize.Width());
290         aSize.Height() = (long) (fH * aPageSize.Height());
291 
292         aPos.X() += (aPartArea.Width() - aSize.Width()) / 2;
293         aPos.Y() += (aPartArea.Height()- aSize.Height())/ 2;
294 
295         aTitlePos = aPos;
296         aTitleSize = aSize;
297     }
298     else if(mnType == 27 || mnType == 28)
299     {
300         // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART or
301         // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
302         Point aClassicTPos(
303             aTitlePos.X() + long( aTitleSize.Width() * 0.0735 ),
304             aTitlePos.Y() + long( aTitleSize.Height() * 0.083 ));
305         Size aClassicTSize(
306             long( aTitleSize.Width() * 0.854 ),
307             long( aTitleSize.Height() * 0.167 ));
308         Point aLPos(aPagePos);
309         Size aLSize(aPageInnerSize);
310         Point aClassicLPos(
311             aLPos.X() + long( aLSize.Width() * 0.0735 ),
312             aLPos.Y() + long( aLSize.Height() * 0.472 ));
313         Size aClassicLSize(
314             long( aLSize.Width() * 0.854 ),
315             long( aLSize.Height() * 0.444 ));
316 
317         aTitlePos.X() = (aClassicTPos.X() + aClassicTSize.Width()) - aClassicTSize.Height();
318         aTitlePos.Y() = aClassicTPos.Y();
319         aTitleSize.Width() = aClassicTSize.Height();
320         aTitleSize.Height() = (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y();
321     }
322     else
323     {
324         aTitlePos.X() += long( aTitleSize.Width() * 0.0735 );
325         aTitlePos.Y() += long( aTitleSize.Height() * 0.083 );
326         aTitleSize.Width() = long( aTitleSize.Width() * 0.854 );
327         aTitleSize.Height() = long( aTitleSize.Height() * 0.167 );
328     }
329 
330     maTitleRect.SetPos(aTitlePos);
331     maTitleRect.SetSize(aTitleSize);
332 
333     // layout rectangle aligning
334     Point aLayoutPos(aPagePos);
335     Size aLayoutSize(aPageInnerSize);
336 
337     if(mnType == 21 /* AUTOLAYOUT_NOTES */)
338     {
339         aLayoutPos.X() += long( aLayoutSize.Width() * 0.0735 );
340         aLayoutPos.Y() += long( aLayoutSize.Height() * 0.472 );
341         aLayoutSize.Width() = long( aLayoutSize.Width() * 0.854 );
342         aLayoutSize.Height() = long( aLayoutSize.Height() * 0.444 );
343     }
344     else if((mnType >= 22 && mnType <= 26) || (mnType == 31)) // AUTOLAYOUT_HANDOUT
345     {
346         // keep info for inner area in maPresRect, put info for gap size
347         // to maTitleRect position
348         mnGapX = (aPageSize.Width() - aPageInnerSize.Width()) / 2;
349         mnGapY = (aPageSize.Height() - aPageInnerSize.Height()) / 2;
350 
351         if(!mnGapX)
352             mnGapX = aPageSize.Width() / 10;
353 
354         if(!mnGapY)
355             mnGapY = aPageSize.Height() / 10;
356 
357         if(mnGapX < aPageInnerSize.Width() / 10)
358             mnGapX = aPageInnerSize.Width() / 10;
359 
360         if(mnGapY < aPageInnerSize.Height() / 10)
361             mnGapY = aPageInnerSize.Height() / 10;
362     }
363     else if(mnType == 27 || mnType == 28)
364     {
365         // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART or
366         // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
367         Point aClassicTPos(
368             aTitlePos.X() + long( aTitleSize.Width() * 0.0735 ),
369             aTitlePos.Y() + long( aTitleSize.Height() * 0.083 ));
370         Size aClassicTSize(
371             long( aTitleSize.Width() * 0.854 ),
372             long( aTitleSize.Height() * 0.167 ));
373         Point aClassicLPos(
374             aLayoutPos.X() + long( aLayoutSize.Width() * 0.0735 ),
375             aLayoutPos.Y() + long( aLayoutSize.Height() * 0.472 ));
376         Size aClassicLSize(
377             long( aLayoutSize.Width() * 0.854 ),
378             long( aLayoutSize.Height() * 0.444 ));
379 
380         aLayoutPos.X() = aClassicLPos.X();
381         aLayoutPos.Y() = aClassicTPos.Y();
382         aLayoutSize.Width() = (aClassicLPos.X() + aClassicLSize.Width())
383             - (aClassicTSize.Height() + (aClassicLPos.Y() - (aClassicTPos.Y() + aClassicTSize.Height())));
384         aLayoutSize.Height() = (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y();
385     }
386     else if( mnType == 32 )
387     {
388         // AUTOLAYOUT_ONLY_TEXT
389         aLayoutPos = aTitlePos;
390         aLayoutSize.Width() = aTitleSize.Width();
391         aLayoutSize.Height() = long( aLayoutSize.Height() * 0.825 );
392     }
393     else
394     {
395         aLayoutPos.X() += long( aLayoutSize.Width() * 0.0735 );
396         aLayoutPos.Y() += long( aLayoutSize.Height() * 0.278 );
397         aLayoutSize.Width() = long( aLayoutSize.Width() * 0.854 );
398         aLayoutSize.Height() = long( aLayoutSize.Height() * 0.630 );
399     }
400 
401     maPresRect.SetPos(aLayoutPos);
402     maPresRect.SetSize(aLayoutSize);
403 }
404 
DECLARE_LIST(ImpXMLAutoLayoutInfoList,ImpXMLAutoLayoutInfo *)405 DECLARE_LIST(ImpXMLAutoLayoutInfoList, ImpXMLAutoLayoutInfo*)
406 
407 //////////////////////////////////////////////////////////////////////////////
408 
409 // #110680#
410 SdXMLExport::SdXMLExport(
411     const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
412     sal_Bool bIsDraw, sal_uInt16 nExportFlags )
413 :   SvXMLExport( xServiceFactory, MAP_CM, bIsDraw ? XML_DRAWING : XML_PRESENTATION, nExportFlags ),
414     mnDocMasterPageCount(0L),
415     mnDocDrawPageCount(0L),
416     mnShapeStyleInfoIndex(0L),
417     mnObjectCount(0L),
418     mpPageMasterInfoList(new ImpXMLEXPPageMasterList(1, 4, 4)),
419     mpPageMasterUsageList(new ImpXMLEXPPageMasterList(1, 4, 4)),
420     mpNotesPageMasterUsageList(new ImpXMLEXPPageMasterList(1, 4, 4)),
421     mpHandoutPageMaster(NULL),
422     mpAutoLayoutInfoList(new ImpXMLAutoLayoutInfoList(1, 4, 4)),
423     mpSdPropHdlFactory(0L),
424     mpPropertySetMapper(0L),
425     mpPresPagePropsMapper(0L),
426     mbIsDraw(bIsDraw),
427     mbFamilyGraphicUsed(sal_False),
428     mbFamilyPresentationUsed(sal_False),
429     msZIndex( GetXMLToken(XML_ZINDEX) ),
430     msEmptyPres( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ),
431     msModel( RTL_CONSTASCII_USTRINGPARAM("Model") ),
432     msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
433     msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
434     msPageLayoutNames( RTL_CONSTASCII_USTRINGPARAM("PageLayoutNames") )
435 {
436 
437 
438 }
439 
440 // XExporter
setSourceDocument(const Reference<lang::XComponent> & xDoc)441 void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent >& xDoc )
442 {
443     SvXMLExport::setSourceDocument( xDoc );
444 
445     const OUString aEmpty;
446 
447     // prepare factory parts
448     mpSdPropHdlFactory = new XMLSdPropHdlFactory( GetModel(), *this );
449     if(mpSdPropHdlFactory)
450     {
451         // set lock to avoid deletion
452         mpSdPropHdlFactory->acquire();
453 
454         // build one ref
455         const UniReference< XMLPropertyHandlerFactory > aFactoryRef = mpSdPropHdlFactory;
456 
457         // construct PropertySetMapper
458         UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( aFactoryRef);
459 
460         mpPropertySetMapper = new XMLShapeExportPropertyMapper( xMapper, (XMLTextListAutoStylePool*)&GetTextParagraphExport()->GetListAutoStylePool(), *this );
461         // set lock to avoid deletion
462         mpPropertySetMapper->acquire();
463 
464         // chain text attributes
465         mpPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this));
466 
467         // construct PresPagePropsMapper
468         xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef);
469 
470         mpPresPagePropsMapper = new XMLPageExportPropertyMapper( xMapper, *this  );
471         if(mpPresPagePropsMapper)
472         {
473             // set lock to avoid deletion
474             mpPresPagePropsMapper->acquire();
475         }
476     }
477 
478     // add family name
479     GetAutoStylePool()->AddFamily(
480         XML_STYLE_FAMILY_SD_GRAPHICS_ID,
481         OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)),
482         GetPropertySetMapper(),
483         OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX)));
484     GetAutoStylePool()->AddFamily(
485         XML_STYLE_FAMILY_SD_PRESENTATION_ID,
486         OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)),
487         GetPropertySetMapper(),
488         OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX)));
489     GetAutoStylePool()->AddFamily(
490         XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID,
491         OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)),
492         GetPresPagePropsMapper(),
493         OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX)));
494     // prepare access to styles
495     Reference< style::XStyleFamiliesSupplier > xFamSup( GetModel(), UNO_QUERY );
496     if(xFamSup.is())
497     {
498         mxDocStyleFamilies = xFamSup->getStyleFamilies();
499     }
500 
501     // prepare access to master pages
502     Reference < drawing::XMasterPagesSupplier > xMasterPagesSupplier(GetModel(), UNO_QUERY);
503     if(xMasterPagesSupplier.is())
504     {
505         mxDocMasterPages = mxDocMasterPages.query( xMasterPagesSupplier->getMasterPages() );
506         if(mxDocMasterPages.is())
507         {
508             mnDocMasterPageCount = mxDocMasterPages->getCount();
509             maMasterPagesStyleNames.insert( maMasterPagesStyleNames.begin(), mnDocMasterPageCount, aEmpty );
510         }
511     }
512 
513     // prepare access to draw pages
514     Reference <XDrawPagesSupplier> xDrawPagesSupplier(GetModel(), UNO_QUERY);
515     if(xDrawPagesSupplier.is())
516     {
517         mxDocDrawPages = mxDocDrawPages.query( xDrawPagesSupplier->getDrawPages() );
518         if(mxDocDrawPages.is())
519         {
520             mnDocDrawPageCount = mxDocDrawPages->getCount();
521             maDrawPagesStyleNames.insert( maDrawPagesStyleNames.begin(), mnDocDrawPageCount, aEmpty );
522             maDrawNotesPagesStyleNames.insert( maDrawNotesPagesStyleNames.begin(), mnDocDrawPageCount, aEmpty );
523             if( !mbIsDraw )
524                 maDrawPagesAutoLayoutNames.realloc( mnDocDrawPageCount + 1 );
525 
526             HeaderFooterPageSettingsImpl aEmptySettings;
527             maDrawPagesHeaderFooterSettings.insert( maDrawPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings );
528             maDrawNotesPagesHeaderFooterSettings.insert( maDrawNotesPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings );
529         }
530     }
531 
532     // #82003# count all draw objects for use with progress bar.
533     // #88245# init mnObjectCount once, use counter itself as flag. It
534     // is initialized to 0.
535     if(!mnObjectCount)
536     {
537         if( IsImpress() )
538         {
539             // #91587# add handout master count
540             Reference<presentation::XHandoutMasterSupplier> xHandoutSupp(GetModel(), UNO_QUERY);
541             if(xHandoutSupp.is())
542             {
543                 Reference<XDrawPage> xHandoutPage(xHandoutSupp->getHandoutMasterPage());
544                 if(xHandoutPage.is())
545                 {
546                     Reference<drawing::XShapes> xShapes(xHandoutPage, UNO_QUERY);
547                     if(xShapes.is() && xShapes->getCount())
548                     {
549                         mnObjectCount += ImpRecursiveObjectCount(xShapes);
550                     }
551                 }
552             }
553         }
554 
555         if(mxDocMasterPages.is())
556         {
557             for(sal_Int32 a(0); a < mnDocMasterPageCount; a++)
558             {
559                 Any aAny(mxDocMasterPages->getByIndex(a));
560                 Reference< drawing::XShapes > xMasterPage;
561 
562                 if((aAny >>= xMasterPage) && xMasterPage.is())
563                 {
564                     mnObjectCount += ImpRecursiveObjectCount(xMasterPage);
565                 }
566 
567                 if( IsImpress() )
568                 {
569                     // #91587# take notes pages from master pages into account
570                     Reference<presentation::XPresentationPage> xPresPage;
571                     if((aAny >>= xPresPage) && xPresPage.is())
572                     {
573                         Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage());
574                         if(xNotesPage.is())
575                         {
576                             Reference<drawing::XShapes> xShapes(xNotesPage, UNO_QUERY);
577                             if(xShapes.is() && xShapes->getCount())
578                             {
579                                 mnObjectCount += ImpRecursiveObjectCount(xShapes);
580                             }
581                         }
582                     }
583                 }
584             }
585         }
586 
587         if(mxDocDrawPages.is())
588         {
589             for(sal_Int32 a(0); a < mnDocDrawPageCount; a++)
590             {
591                 Any aAny(mxDocDrawPages->getByIndex(a));
592                 Reference< drawing::XShapes > xPage;
593 
594                 if((aAny >>= xPage) && xPage.is())
595                 {
596                     mnObjectCount += ImpRecursiveObjectCount(xPage);
597                 }
598 
599                 if( IsImpress() )
600                 {
601                     // #91587# take notes pages from draw pages into account
602                     Reference<presentation::XPresentationPage> xPresPage;
603                     if((aAny >>= xPresPage) && xPresPage.is())
604                     {
605                         Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage());
606                         if(xNotesPage.is())
607                         {
608                             Reference<drawing::XShapes> xShapes(xNotesPage, UNO_QUERY);
609                             if(xShapes.is() && xShapes->getCount())
610                             {
611                                 mnObjectCount += ImpRecursiveObjectCount(xShapes);
612                             }
613                         }
614                     }
615                 }
616             }
617         }
618 
619         // #82003# init progress bar
620         GetProgressBarHelper()->SetReference(mnObjectCount);
621     }
622 
623     // add namespaces
624     _GetNamespaceMap().Add(
625         GetXMLToken(XML_NP_PRESENTATION),
626         GetXMLToken(XML_N_PRESENTATION),
627         XML_NAMESPACE_PRESENTATION);
628 
629     _GetNamespaceMap().Add(
630         GetXMLToken(XML_NP_SMIL),
631         GetXMLToken(XML_N_SMIL_COMPAT),
632         XML_NAMESPACE_SMIL);
633 
634     _GetNamespaceMap().Add(
635         GetXMLToken(XML_NP_ANIMATION),
636         GetXMLToken(XML_N_ANIMATION),
637         XML_NAMESPACE_ANIMATION);
638 
639     if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
640     {
641         _GetNamespaceMap().Add(
642             GetXMLToken(XML_NP_OFFICE_EXT),
643             GetXMLToken(XML_N_OFFICE_EXT),
644             XML_NAMESPACE_OFFICE_EXT);
645 
646         _GetNamespaceMap().Add(
647             GetXMLToken(XML_NP_DRAW_EXT),
648             GetXMLToken(XML_N_DRAW_EXT),
649             XML_NAMESPACE_DRAW_EXT);
650     }
651 
652     GetShapeExport()->enableLayerExport();
653 
654     // #88546# enable progress bar increments
655     GetShapeExport()->enableHandleProgressBar();
656 }
657 
658 //////////////////////////////////////////////////////////////////////////////
659 // #82003# helper function for recursive object count
ImpRecursiveObjectCount(Reference<drawing::XShapes> xShapes)660 sal_uInt32 SdXMLExport::ImpRecursiveObjectCount(Reference< drawing::XShapes > xShapes)
661 {
662     sal_uInt32 nRetval(0L);
663 
664     if(xShapes.is())
665     {
666         sal_Int32 nCount = xShapes->getCount();
667 
668         for(sal_Int32 a(0L); a < nCount; a++)
669         {
670             Any aAny(xShapes->getByIndex(a));
671             Reference< drawing::XShapes > xGroup;
672 
673             if((aAny >>= xGroup) && xGroup.is())
674             {
675                 // #93180# count group objects, too.
676                 nRetval += 1 + ImpRecursiveObjectCount(xGroup);
677             }
678             else
679             {
680                 nRetval++;
681             }
682         }
683     }
684 
685     return nRetval;
686 }
687 
688 //////////////////////////////////////////////////////////////////////////////
689 
~SdXMLExport()690 __EXPORT SdXMLExport::~SdXMLExport()
691 {
692     // cleanup factory, decrease refcount. Should lead to destruction.
693     if(mpSdPropHdlFactory)
694     {
695         mpSdPropHdlFactory->release();
696         mpSdPropHdlFactory = 0L;
697     }
698 
699     // cleanup mapper, decrease refcount. Should lead to destruction.
700     if(mpPropertySetMapper)
701     {
702         mpPropertySetMapper->release();
703         mpPropertySetMapper = 0L;
704     }
705 
706     // cleanup presPage mapper, decrease refcount. Should lead to destruction.
707     if(mpPresPagePropsMapper)
708     {
709         mpPresPagePropsMapper->release();
710         mpPresPagePropsMapper = 0L;
711     }
712 
713     // clear evtl. temporary page master infos
714     if(mpPageMasterInfoList)
715     {
716         while(mpPageMasterInfoList->Count())
717             delete mpPageMasterInfoList->Remove(mpPageMasterInfoList->Count() - 1L);
718         delete mpPageMasterInfoList;
719         mpPageMasterInfoList = 0L;
720     }
721     if(mpPageMasterUsageList)
722     {
723         delete mpPageMasterUsageList;
724         mpPageMasterUsageList = 0L;
725     }
726     if(mpNotesPageMasterUsageList)
727     {
728         delete mpNotesPageMasterUsageList;
729         mpNotesPageMasterUsageList = 0L;
730     }
731 
732     // clear auto-layout infos
733     if(mpAutoLayoutInfoList)
734     {
735         while(mpAutoLayoutInfoList->Count())
736             delete mpAutoLayoutInfoList->Remove(mpAutoLayoutInfoList->Count() - 1L);
737         delete mpAutoLayoutInfoList;
738         mpAutoLayoutInfoList = 0L;
739     }
740 
741 // #82003# status indicator stop is called exclusively
742 // from SdXMLFilter::Export() now.
743 //
744 // stop progress view
745 //  if(GetStatusIndicator().is())
746 //  {
747 //      GetStatusIndicator()->end();
748 //      GetStatusIndicator()->reset();
749 //  }
750 }
751 
752 //////////////////////////////////////////////////////////////////////////////
753 // to get default values in XPropertySet use this wrapper class
754 
755 class ImpDefaultMapper : public ::cppu::WeakAggImplHelper1< beans::XPropertySet >
756 {
757     Reference< beans::XPropertyState >      mxState;
758     Reference< beans::XPropertySet >        mxSet;
759 
760 public:
761     ImpDefaultMapper( Reference< beans::XPropertyState >& rxState );
762 
763     // Methods
764     virtual Reference< beans::XPropertySetInfo > SAL_CALL getPropertySetInfo();
765     virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue );
766     virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName );
767 
768     // empty implementations
769     virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< beans::XPropertyChangeListener >& xListener );
770     virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference< beans::XPropertyChangeListener >& aListener );
771     virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const Reference< beans::XVetoableChangeListener >& aListener );
772     virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< beans::XVetoableChangeListener >& aListener );
773 };
774 
ImpDefaultMapper(Reference<beans::XPropertyState> & rxState)775 ImpDefaultMapper::ImpDefaultMapper( Reference< beans::XPropertyState >& rxState )
776 :   mxState( rxState ),
777     mxSet( rxState, UNO_QUERY )
778 {
779 }
780 
getPropertySetInfo()781 Reference< beans::XPropertySetInfo > SAL_CALL ImpDefaultMapper::getPropertySetInfo()
782 {
783     return mxSet->getPropertySetInfo();
784 }
785 
setPropertyValue(const OUString & aPropertyName,const Any &)786 void SAL_CALL ImpDefaultMapper::setPropertyValue( const OUString& aPropertyName, const Any& /*aValue*/ )
787 {
788     mxState->setPropertyToDefault( aPropertyName /*, aValue */ );
789 }
790 
getPropertyValue(const OUString & PropertyName)791 Any SAL_CALL ImpDefaultMapper::getPropertyValue( const OUString& PropertyName )
792 {
793     return mxState->getPropertyDefault(  PropertyName  );
794 }
795 
796 // empty implementations
addPropertyChangeListener(const OUString &,const Reference<beans::XPropertyChangeListener> &)797 void SAL_CALL ImpDefaultMapper::addPropertyChangeListener( const OUString&, const Reference< beans::XPropertyChangeListener >& ) {}
removePropertyChangeListener(const OUString &,const Reference<beans::XPropertyChangeListener> &)798 void SAL_CALL ImpDefaultMapper::removePropertyChangeListener( const OUString&, const Reference< beans::XPropertyChangeListener >& ) {}
addVetoableChangeListener(const OUString &,const Reference<beans::XVetoableChangeListener> &)799 void SAL_CALL ImpDefaultMapper::addVetoableChangeListener( const OUString&, const Reference< beans::XVetoableChangeListener >& ) {}
removeVetoableChangeListener(const OUString &,const Reference<beans::XVetoableChangeListener> &)800 void SAL_CALL ImpDefaultMapper::removeVetoableChangeListener( const OUString&, const Reference< beans::XVetoableChangeListener >& ) {}
801 
802 //////////////////////////////////////////////////////////////////////////////
803 
804 /* moved to shapeexport.cxx
805 void SdXMLExport::ImpWriteObjGraphicStyleInfos()
806 {
807     XMLStyleExport aStEx(*this, OUString(), GetAutoStylePool().get());
808     const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPropertySetMapper() );
809 
810     // write graphic family default style
811     Reference< lang::XMultiServiceFactory > xFact( GetModel(), UNO_QUERY );
812     if( xFact.is() )
813     {
814         try
815         {
816             Reference< beans::XPropertySet > xDefaults( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults") ) ), UNO_QUERY );
817             if( xDefaults.is() )
818             {
819                 aStEx.exportDefaultStyle( xDefaults, OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), aMapperRef );
820 
821                 // write graphic family styles
822                 aStEx.exportStyleFamily(XML_STYLE_FAMILY_SD_GRAPHICS_NAME, OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), aMapperRef, sal_False, XML_STYLE_FAMILY_SD_GRAPHICS_ID);
823             }
824         }
825         catch( lang::ServiceNotRegisteredException& )
826         {
827         }
828     }
829 }
830 */
831 //////////////////////////////////////////////////////////////////////////////
832 
ImpPrepAutoLayoutInfos()833 void SdXMLExport::ImpPrepAutoLayoutInfos()
834 {
835     if(IsImpress())
836     {
837         OUString aStr;
838 
839         Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
840         if( xHandoutSupp.is() )
841         {
842             Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
843             if( xHandoutPage.is() )
844             {
845                 if(ImpPrepAutoLayoutInfo(xHandoutPage, aStr))
846                     maDrawPagesAutoLayoutNames[0] = aStr;
847             }
848         }
849 
850         // prepare name creation
851         for (sal_Int32 nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++)
852         {
853             Any aAny(mxDocDrawPages->getByIndex(nCnt));
854             Reference<XDrawPage> xDrawPage;
855 
856             if((aAny >>= xDrawPage) && xDrawPage.is())
857             {
858                 if(ImpPrepAutoLayoutInfo(xDrawPage, aStr))
859                     maDrawPagesAutoLayoutNames[nCnt+1] = aStr;
860             }
861         }
862     }
863 }
864 
ImpPrepAutoLayoutInfo(const Reference<XDrawPage> & xPage,OUString & rName)865 sal_Bool SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, OUString& rName)
866 {
867     rName = OUString();
868     sal_Bool bRetval(sal_False);
869 
870     Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY);
871     if(xPropSet.is())
872     {
873         sal_uInt16 nType = sal_uInt16();
874         Any aAny;
875 
876         aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Layout")));
877         if(aAny >>= nType)
878         {
879             if(ImpXMLAutoLayoutInfo::IsCreateNecessary(nType))
880             {
881                 ImpXMLEXPPageMasterInfo* pInfo = 0L;
882 
883                 // get master-page info
884                 Reference < drawing::XMasterPageTarget > xMasterPageInt(xPage, UNO_QUERY);
885                 if(xMasterPageInt.is())
886                 {
887                     Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
888                     if(xUsedMasterPage.is())
889                     {
890                         Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
891                         if(xMasterNamed.is())
892                         {
893                             OUString sMasterPageName = xMasterNamed->getName();
894                             pInfo = ImpGetPageMasterInfoByName(sMasterPageName);
895                         }
896                     }
897                 }
898 
899                 // create entry and look for existence
900                 ImpXMLAutoLayoutInfo* pNew = new ImpXMLAutoLayoutInfo(nType, pInfo);
901                 sal_Bool bDidExist(sal_False);
902 
903                 for(sal_uInt32 nCnt = 0L; !bDidExist && nCnt < mpAutoLayoutInfoList->Count(); nCnt++)
904                 {
905                     if(*mpAutoLayoutInfoList->GetObject(nCnt) == *pNew)
906                     {
907                         delete pNew;
908                         pNew = mpAutoLayoutInfoList->GetObject(nCnt);
909                         bDidExist = sal_True;
910                     }
911                 }
912 
913                 if(!bDidExist)
914                 {
915                     mpAutoLayoutInfoList->Insert(pNew, LIST_APPEND);
916                     OUString sNewName = OUString(RTL_CONSTASCII_USTRINGPARAM("AL"));
917                     sNewName += OUString::valueOf(sal_Int32(mpAutoLayoutInfoList->Count() - 1));
918                     sNewName += OUString(RTL_CONSTASCII_USTRINGPARAM("T"));
919                     sNewName += OUString::valueOf(sal_Int32(nType));
920                     pNew->SetLayoutName(sNewName);
921                 }
922 
923                 rName = pNew->GetLayoutName();
924                 bRetval = sal_True;
925             }
926         }
927     }
928 
929     return bRetval;
930 }
931 
932 //////////////////////////////////////////////////////////////////////////////
933 
ImpWriteAutoLayoutInfos()934 void SdXMLExport::ImpWriteAutoLayoutInfos()
935 {
936     if(mpAutoLayoutInfoList->Count())
937     {
938         for(sal_uInt32 nCnt = 0L; nCnt < mpAutoLayoutInfoList->Count(); nCnt++)
939         {
940             ImpXMLAutoLayoutInfo* pInfo = mpAutoLayoutInfoList->GetObject(nCnt);
941             if(pInfo)
942             {
943                 // prepare presentation-page layout attributes, style-name
944                 AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, pInfo->GetLayoutName());
945 
946                 // write draw-style attributes
947                 SvXMLElementExport aDSE(*this, XML_NAMESPACE_STYLE, XML_PRESENTATION_PAGE_LAYOUT, sal_True, sal_True);
948 
949                 // write presentation placeholders
950                 switch(pInfo->GetLayoutType())
951                 {
952                     case 0 : // AUTOLAYOUT_TITLE
953                     {
954                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
955                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle());
956                         break;
957                     }
958                     case 1 : // AUTOLAYOUT_ENUM
959                     {
960                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
961                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, pInfo->GetPresRectangle());
962                         break;
963                     }
964                     case 2 : // AUTOLAYOUT_CHART
965                     {
966                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
967                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, pInfo->GetPresRectangle());
968                         break;
969                     }
970                     case 3 : // AUTOLAYOUT_2TEXT
971                     {
972                         Rectangle aLeft(pInfo->GetPresRectangle());
973                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
974                         Rectangle aRight(aLeft);
975                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
976 
977                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
978                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
979                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
980                         break;
981                     }
982                     case 4 : // AUTOLAYOUT_TEXTCHART
983                     {
984                         Rectangle aLeft(pInfo->GetPresRectangle());
985                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
986                         Rectangle aRight(aLeft);
987                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
988 
989                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
990                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
991                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aRight);
992                         break;
993                     }
994                     case 6 : // AUTOLAYOUT_TEXTCLIP
995                     {
996                         Rectangle aLeft(pInfo->GetPresRectangle());
997                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
998                         Rectangle aRight(aLeft);
999                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
1000 
1001                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1002                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
1003                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aRight);
1004                         break;
1005                     }
1006                     case 7 : // AUTOLAYOUT_CHARTTEXT
1007                     {
1008                         Rectangle aLeft(pInfo->GetPresRectangle());
1009                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
1010                         Rectangle aRight(aLeft);
1011                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
1012 
1013                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1014                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aLeft);
1015                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
1016                         break;
1017                     }
1018                     case 8 : // AUTOLAYOUT_TAB
1019                     {
1020                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1021                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTable, pInfo->GetPresRectangle());
1022                         break;
1023                     }
1024                     case 9 : // AUTOLAYOUT_CLIPTEXT
1025                     {
1026                         Rectangle aLeft(pInfo->GetPresRectangle());
1027                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
1028                         Rectangle aRight(aLeft);
1029                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
1030 
1031                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1032                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft);
1033                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
1034                         break;
1035                     }
1036                     case 10 : // AUTOLAYOUT_TEXTOBJ
1037                     {
1038                         Rectangle aLeft(pInfo->GetPresRectangle());
1039                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
1040                         Rectangle aRight(aLeft);
1041                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
1042 
1043                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1044                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
1045                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRight);
1046                         break;
1047                     }
1048                     case 11 : // AUTOLAYOUT_OBJ
1049                     {
1050                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1051                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, pInfo->GetPresRectangle());
1052                         break;
1053                     }
1054                     case 12 : // AUTOLAYOUT_TEXT2OBJ
1055                     {
1056                         Rectangle aLeft(pInfo->GetPresRectangle());
1057                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
1058                         Rectangle aRightTop(aLeft);
1059                         aRightTop.Left() = long(aRightTop.Left() + aRightTop.GetWidth() * 1.05);
1060                         aRightTop.setHeight(long(aRightTop.GetHeight() * 0.477));
1061                         Rectangle aRightBottom(aRightTop);
1062                         aRightBottom.Top() = long(aRightBottom.Top() + aRightBottom.GetHeight() * 1.095);
1063 
1064                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1065                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
1066                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightTop);
1067                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightBottom);
1068                         break;
1069                     }
1070                     case 13 : // AUTOLAYOUT_OBJTEXT
1071                     {
1072                         Rectangle aLeft(pInfo->GetPresRectangle());
1073                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
1074                         Rectangle aRight(aLeft);
1075                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
1076 
1077                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1078                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeft);
1079                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
1080                         break;
1081                     }
1082                     case 14 : // AUTOLAYOUT_OBJOVERTEXT
1083                     {
1084                         Rectangle aTop(pInfo->GetPresRectangle());
1085                         aTop.setHeight(long(aTop.GetHeight() * 0.477));
1086                         Rectangle aBottom(aTop);
1087                         aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
1088 
1089                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1090                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTop);
1091                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom);
1092                         break;
1093                     }
1094                     case 15 : // AUTOLAYOUT_2OBJTEXT
1095                     {
1096                         Rectangle aLeftTop(pInfo->GetPresRectangle());
1097                         aLeftTop.setWidth(long(aLeftTop.GetWidth() * 0.488));
1098                         Rectangle aRight(aLeftTop);
1099                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
1100                         aLeftTop.setHeight(long(aLeftTop.GetHeight() * 0.477));
1101                         Rectangle aLeftBottom(aLeftTop);
1102                         aLeftBottom.Top() = long(aLeftBottom.Top() + aLeftBottom.GetHeight() * 1.095);
1103 
1104                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1105                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftTop);
1106                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftBottom);
1107                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
1108                         break;
1109                     }
1110                     case 16 : // AUTOLAYOUT_2OBJOVERTEXT
1111                     {
1112                         Rectangle aTopLeft(pInfo->GetPresRectangle());
1113                         aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
1114                         Rectangle aBottom(aTopLeft);
1115                         aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
1116                         aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
1117                         Rectangle aTopRight(aTopLeft);
1118                         aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
1119 
1120                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1121                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft);
1122                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight);
1123                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom);
1124                         break;
1125                     }
1126                     case 17 : // AUTOLAYOUT_TEXTOVEROBJ
1127                     {
1128                         Rectangle aTop(pInfo->GetPresRectangle());
1129                         aTop.setHeight(long(aTop.GetHeight() * 0.477));
1130                         Rectangle aBottom(aTop);
1131                         aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
1132 
1133                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1134                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aTop);
1135                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottom);
1136                         break;
1137                     }
1138                     case 18 : // AUTOLAYOUT_4OBJ
1139                     {
1140                         Rectangle aTopLeft(pInfo->GetPresRectangle());
1141                         aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
1142                         aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
1143                         Rectangle aBottomLeft(aTopLeft);
1144                         aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
1145                         Rectangle aTopRight(aTopLeft);
1146                         aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
1147                         Rectangle aBottomRight(aTopRight);
1148                         aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
1149 
1150                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1151                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft);
1152                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight);
1153                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomLeft);
1154                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomRight);
1155                         break;
1156                     }
1157                     case 19 : // AUTOLAYOUT_ONLY_TITLE
1158                     {
1159                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1160                         break;
1161                     }
1162                     case 21 : // AUTOLAYOUT_NOTES
1163                     {
1164                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderPage, pInfo->GetTitleRectangle());
1165                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderNotes, pInfo->GetPresRectangle());
1166                         break;
1167                     }
1168                     case 22 : // AUTOLAYOUT_HANDOUT1
1169                     case 23 : // AUTOLAYOUT_HANDOUT2
1170                     case 24 : // AUTOLAYOUT_HANDOUT3
1171                     case 25 : // AUTOLAYOUT_HANDOUT4
1172                     case 26 : // AUTOLAYOUT_HANDOUT6
1173                     case 31 : // AUTOLAYOUT_HANDOUT9
1174                     {
1175                         sal_Int32 nColCnt, nRowCnt;
1176                         sal_Int32 nGapX = pInfo->GetGapX();
1177                         sal_Int32 nGapY = pInfo->GetGapY();
1178 
1179                         switch(pInfo->GetLayoutType())
1180                         {
1181                             case 22 : nColCnt = 1; nRowCnt = 1; break;
1182                             case 23 : nColCnt = 1; nRowCnt = 2; break;
1183                             case 24 : nColCnt = 1; nRowCnt = 3; break;
1184                             case 25 : nColCnt = 2; nRowCnt = 2; break;
1185                             case 26 : nColCnt = 3; nRowCnt = 2; break;
1186                             case 31 : nColCnt = 3; nRowCnt = 3; break;
1187                             default:  nColCnt = 0; nRowCnt = 0; break;  // FIXME - What is correct values?
1188                         }
1189 
1190                         Size aPartSize(pInfo->GetTitleRectangle().GetSize());
1191                         Point aPartPos(pInfo->GetTitleRectangle().TopLeft());
1192 
1193                         if(aPartSize.Width() > aPartSize.Height())
1194                         {
1195                             sal_Int32 nZwi(nColCnt);
1196                             nColCnt = nRowCnt;
1197                             nRowCnt = nZwi;
1198                         }
1199 
1200                         aPartSize.Width() = (aPartSize.Width() - ((nColCnt - 1) * nGapX)) / nColCnt;
1201                         aPartSize.Height() = (aPartSize.Height() - ((nRowCnt - 1) * nGapY)) / nRowCnt;
1202 
1203                         Point aTmpPos(aPartPos);
1204 
1205                         for (sal_Int32 a = 0; a < nRowCnt; a++)
1206                         {
1207                             aTmpPos.X() = aPartPos.X();
1208 
1209                             for (sal_Int32 b = 0; b < nColCnt; b++)
1210                             {
1211                                 Rectangle aTmpRect(aTmpPos, aPartSize);
1212 
1213                                 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderHandout, aTmpRect);
1214                                 aTmpPos.X() += aPartSize.Width() + nGapX;
1215                             }
1216 
1217                             aTmpPos.Y() += aPartSize.Height() + nGapY;
1218                         }
1219                         break;
1220                     }
1221                     case 27 : // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
1222                     {
1223                         Rectangle aTop(pInfo->GetPresRectangle());
1224                         aTop.setHeight(long(aTop.GetHeight() * 0.488));
1225                         Rectangle aBottom(aTop);
1226                         aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.05);
1227 
1228                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle());
1229                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aTop);
1230                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aBottom);
1231                         break;
1232                     }
1233                     case 28 : // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
1234                     {
1235                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle());
1236                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle());
1237                         break;
1238                     }
1239                     case 29 : // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
1240                     {
1241                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1242                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle());
1243                         break;
1244                     }
1245                     case 30 : // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
1246                     {
1247                         Rectangle aLeft(pInfo->GetPresRectangle());
1248                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
1249                         Rectangle aRight(aLeft);
1250                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
1251 
1252                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1253                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft);
1254                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aRight);
1255                         break;
1256                     }
1257                     case 32 : // AUTOLAYOUT_TITLE
1258                     {
1259                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle());
1260                         break;
1261                     }
1262 
1263                     case 33 : // AUTOLAYOUT_4CLIPART
1264                     {
1265                         Rectangle aTopLeft(pInfo->GetPresRectangle());
1266                         aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
1267                         aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
1268                         Rectangle aBottomLeft(aTopLeft);
1269                         aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
1270                         Rectangle aTopRight(aTopLeft);
1271                         aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
1272                         Rectangle aBottomRight(aTopRight);
1273                         aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
1274 
1275                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1276                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
1277                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
1278                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
1279                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
1280                         break;
1281                     }
1282 
1283                     case 34 : // AUTOLAYOUT_6CLIPART
1284                     {
1285                         Rectangle aTopLeft(pInfo->GetPresRectangle());
1286                         aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
1287                         aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.322));
1288                         Rectangle aTopCenter(aTopLeft);
1289                         aTopCenter.Left() = long(aTopCenter.Left() + aTopCenter.GetWidth() * 1.05);
1290                         Rectangle aTopRight(aTopLeft);
1291                         aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 2 * 1.05);
1292 
1293                         Rectangle aBottomLeft(aTopLeft);
1294                         aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
1295                         Rectangle aBottomCenter(aTopCenter);
1296                         aBottomCenter.Top() = long(aBottomCenter.Top() + aBottomCenter.GetHeight() * 1.095);
1297                         Rectangle aBottomRight(aTopRight);
1298                         aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
1299 
1300                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1301                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
1302                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopCenter);
1303                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
1304                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
1305                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomCenter);
1306                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
1307                         break;
1308                     }
1309                     default:
1310                     {
1311                         DBG_ERROR("XMLEXP: unknown autolayout export");
1312                         break;
1313                     }
1314                 }
1315             }
1316         }
1317     }
1318 }
1319 
1320 //////////////////////////////////////////////////////////////////////////////
1321 
ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl,const Rectangle & rRect)1322 void SdXMLExport::ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectangle& rRect)
1323 {
1324     OUString aStr;
1325     OUStringBuffer sStringBuffer;
1326 
1327     // prepare presentation-placeholder attributes, presentation:object
1328     switch(ePl)
1329     {
1330         case XmlPlaceholderTitle: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("title")); break;
1331         case XmlPlaceholderOutline: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("outline")); break;
1332         case XmlPlaceholderSubtitle: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("subtitle")); break;
1333         case XmlPlaceholderText: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("text")); break;
1334         case XmlPlaceholderGraphic: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("graphic")); break;
1335         case XmlPlaceholderObject: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("object")); break;
1336         case XmlPlaceholderChart: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("chart")); break;
1337         case XmlPlaceholderOrgchart: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("orgchart")); break;
1338         case XmlPlaceholderTable: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("table")); break;
1339         case XmlPlaceholderPage: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("page")); break;
1340         case XmlPlaceholderNotes: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("notes")); break;
1341         case XmlPlaceholderHandout: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("handout")); break;
1342         case XmlPlaceholderVerticalTitle: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_title")); break;
1343         case XmlPlaceholderVerticalOutline: aStr = OUString(RTL_CONSTASCII_USTRINGPARAM("vertical_outline")); break;
1344     }
1345 
1346     AddAttribute(XML_NAMESPACE_PRESENTATION, XML_OBJECT, aStr);
1347 
1348     // svg:x,y,width,height
1349     GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.Left());
1350     aStr = sStringBuffer.makeStringAndClear();
1351     AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr);
1352 
1353     GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.Top());
1354     aStr = sStringBuffer.makeStringAndClear();
1355     AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr);
1356 
1357     GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.GetWidth());
1358     aStr = sStringBuffer.makeStringAndClear();
1359     AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
1360 
1361     GetMM100UnitConverter().convertMeasure(sStringBuffer, rRect.GetHeight());
1362     aStr = sStringBuffer.makeStringAndClear();
1363     AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr);
1364 
1365     // write presentation-placeholder
1366     SvXMLElementExport aPPL(*this, XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, sal_True, sal_True);
1367 }
1368 
1369 //////////////////////////////////////////////////////////////////////////////
1370 
ImpGetOrCreatePageMasterInfo(Reference<XDrawPage> xMasterPage)1371 ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetOrCreatePageMasterInfo( Reference< XDrawPage > xMasterPage )
1372 {
1373     bool bDoesExist = false;
1374 
1375     ImpXMLEXPPageMasterInfo* pNewInfo = new ImpXMLEXPPageMasterInfo(*this, xMasterPage);
1376 
1377     // compare with prev page-master infos
1378     for(sal_uInt32 a = 0; !bDoesExist && a < mpPageMasterInfoList->Count(); a++)
1379     {
1380         if(mpPageMasterInfoList->GetObject(a)
1381             && *mpPageMasterInfoList->GetObject(a) == *pNewInfo)
1382         {
1383             delete pNewInfo;
1384             pNewInfo = mpPageMasterInfoList->GetObject(a);
1385             bDoesExist = true;
1386         }
1387     }
1388     // add entry when not found same page-master infos
1389     if(!bDoesExist)
1390         mpPageMasterInfoList->Insert(pNewInfo, LIST_APPEND);
1391 
1392     return pNewInfo;
1393 }
1394 
ImpPrepPageMasterInfos()1395 void SdXMLExport::ImpPrepPageMasterInfos()
1396 {
1397     if( IsImpress() )
1398     {
1399         // create page master info for handout master page
1400 
1401         Reference< XHandoutMasterSupplier > xHMS( GetModel(), UNO_QUERY );
1402         if( xHMS.is() )
1403         {
1404             Reference< XDrawPage > xMasterPage( xHMS->getHandoutMasterPage() );
1405             if( xMasterPage.is() )
1406                 mpHandoutPageMaster = ImpGetOrCreatePageMasterInfo(xMasterPage);
1407         }
1408     }
1409 
1410     // create page master infos for master pages
1411     if(mnDocMasterPageCount)
1412     {
1413         // look for needed page-masters, create these
1414         for (sal_Int32 nMPageId = 0; nMPageId < mnDocMasterPageCount; nMPageId++)
1415         {
1416             Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
1417             ImpXMLEXPPageMasterInfo* pNewInfo = 0L;
1418 
1419             if(xMasterPage.is())
1420                 pNewInfo = ImpGetOrCreatePageMasterInfo(xMasterPage);
1421 
1422             mpPageMasterUsageList->Insert(pNewInfo, LIST_APPEND);
1423 
1424             // look for page master of handout page
1425             if(IsImpress())
1426             {
1427                 pNewInfo = NULL;
1428                 Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
1429                 if(xPresPage.is())
1430                 {
1431                     Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
1432                     if(xNotesPage.is())
1433                     {
1434                         pNewInfo = ImpGetOrCreatePageMasterInfo(xNotesPage);
1435                     }
1436                 }
1437                 mpNotesPageMasterUsageList->Insert( pNewInfo, LIST_APPEND );
1438             }
1439         }
1440     }
1441 }
1442 
1443 //////////////////////////////////////////////////////////////////////////////
1444 
ImpWritePageMasterInfos()1445 void SdXMLExport::ImpWritePageMasterInfos()
1446 {
1447     // write created page-masters, create names for these
1448     for(sal_uInt32 nCnt = 0L; nCnt < mpPageMasterInfoList->Count(); nCnt++)
1449     {
1450         ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->GetObject(nCnt);
1451         if(pInfo)
1452         {
1453             // create name
1454             OUString sNewName = OUString(RTL_CONSTASCII_USTRINGPARAM("PM"));
1455 
1456             sNewName += OUString::valueOf((sal_Int32)nCnt);
1457             pInfo->SetName(sNewName);
1458 
1459             // prepare page-master attributes
1460             OUString sString;
1461             OUStringBuffer sStringBuffer;
1462 
1463             sString = sNewName;
1464             AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sString);
1465 
1466             // write page-layout
1467             SvXMLElementExport aPME(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, sal_True, sal_True);
1468 
1469             // prepare style:properties inside page-master
1470             GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderTop());
1471             sString = sStringBuffer.makeStringAndClear();
1472             AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_TOP, sString);
1473 
1474             GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderBottom());
1475             sString = sStringBuffer.makeStringAndClear();
1476             AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, sString);
1477 
1478             GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderLeft());
1479             sString = sStringBuffer.makeStringAndClear();
1480             AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_LEFT, sString);
1481 
1482             GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetBorderRight());
1483             sString = sStringBuffer.makeStringAndClear();
1484             AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_RIGHT, sString);
1485 
1486             GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetWidth());
1487             sString = sStringBuffer.makeStringAndClear();
1488             AddAttribute(XML_NAMESPACE_FO, XML_PAGE_WIDTH, sString);
1489 
1490             GetMM100UnitConverter().convertMeasure(sStringBuffer, pInfo->GetHeight());
1491             sString = sStringBuffer.makeStringAndClear();
1492             AddAttribute(XML_NAMESPACE_FO, XML_PAGE_HEIGHT, sString);
1493 
1494             if(pInfo->GetOrientation() == view::PaperOrientation_PORTRAIT)
1495                 AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PORTRAIT);
1496             else
1497                 AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_LANDSCAPE);
1498 
1499             // write style:properties
1500             SvXMLElementExport aPMF(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_PROPERTIES, sal_True, sal_True);
1501         }
1502     }
1503 }
1504 
1505 //////////////////////////////////////////////////////////////////////////////
1506 
ImpGetPageMasterInfoByName(const OUString & rName)1507 ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetPageMasterInfoByName(const OUString& rName)
1508 {
1509     if(rName.getLength() && mpPageMasterInfoList->Count())
1510     {
1511         for(sal_uInt32 nCnt = 0L; nCnt < mpPageMasterInfoList->Count(); nCnt++)
1512         {
1513             ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->GetObject(nCnt);
1514             if(pInfo)
1515             {
1516                 if(pInfo->GetMasterPageName().getLength() && rName.equals(pInfo->GetMasterPageName()))
1517                 {
1518                     return pInfo;
1519                 }
1520             }
1521         }
1522     }
1523     return 0L;
1524 }
1525 
1526 //////////////////////////////////////////////////////////////////////////////
1527 
ImpPrepDrawPageInfos()1528 void SdXMLExport::ImpPrepDrawPageInfos()
1529 {
1530     // create draw:style-name entries for page export
1531     // containing presentation page attributes AND background attributes
1532     // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
1533 
1534     sal_Int32 nCnt;
1535     for(nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++)
1536     {
1537         Reference<XDrawPage> xDrawPage;
1538         mxDocDrawPages->getByIndex(nCnt) >>= xDrawPage;
1539         maDrawPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage );
1540 
1541         Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
1542         if(xPresPage.is())
1543         {
1544             maDrawNotesPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xPresPage->getNotesPage(), false );
1545 
1546             maDrawPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xDrawPage );
1547             maDrawNotesPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xPresPage->getNotesPage() );
1548         }
1549     }
1550 }
1551 
1552 //////////////////////////////////////////////////////////////////////////////
1553 
findOrAppendImpl(std::vector<OUString> & rVector,const OUString & rText,const sal_Char * pPrefix)1554 static OUString findOrAppendImpl( std::vector< OUString >& rVector, const OUString& rText, const sal_Char* pPrefix )
1555 {
1556     // search rVector if there is already a string that equals rText
1557     std::vector< OUString >::iterator aIter;
1558     sal_Int32 nIndex;
1559     for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); aIter++, nIndex++ )
1560     {
1561         if( (*aIter) == rText )
1562             break;
1563     }
1564 
1565     // if nothing is found, append the string at the end of rVector
1566     if( aIter == rVector.end() )
1567         rVector.push_back( rText );
1568 
1569     // create a reference string with pPrefix and the index of the
1570     // found or created rText
1571     OUString aStr( OUString::createFromAscii( pPrefix ) );
1572     aStr += OUString::valueOf( nIndex );
1573     return aStr;
1574 }
1575 
findOrAppendImpl(std::vector<DateTimeDeclImpl> & rVector,const OUString & rText,sal_Bool bFixed,sal_Int32 nFormat,const sal_Char * pPrefix)1576 static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, const OUString& rText, sal_Bool bFixed, sal_Int32 nFormat, const sal_Char* pPrefix )
1577 {
1578     // search rVector if there is already a DateTimeDeclImpl with rText,bFixed and nFormat
1579     std::vector< DateTimeDeclImpl >::iterator aIter;
1580     sal_Int32 nIndex;
1581     for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); aIter++, nIndex++ )
1582     {
1583         const DateTimeDeclImpl& rDecl = (*aIter);
1584         if( (rDecl.mbFixed == bFixed ) &&
1585             (!bFixed || rDecl.maStrText == rText) &&
1586             (bFixed || (rDecl.mnFormat == nFormat) ) )
1587             break;
1588     }
1589 
1590     // if nothing is found, append a new DateTimeDeclImpl
1591     if( aIter == rVector.end() )
1592     {
1593         DateTimeDeclImpl aDecl;
1594         aDecl.maStrText = rText;
1595         aDecl.mbFixed = bFixed;
1596         aDecl.mnFormat = nFormat;
1597         rVector.push_back( aDecl );
1598     }
1599 
1600     // create a reference string with pPrefix and the index of the
1601     // found or created DateTimeDeclImpl
1602     OUString aStr( OUString::createFromAscii( pPrefix ) );
1603     aStr += OUString::valueOf( nIndex );
1604     return aStr;
1605 
1606 }
1607 
1608 static const sal_Char* gpStrHeaderTextPrefix = "hdr";
1609 static const sal_Char* gpStrFooterTextPrefix = "ftr";
1610 static const sal_Char* gpStrDateTimeTextPrefix = "dtd";
1611 
ImpPrepDrawPageHeaderFooterDecls(const Reference<XDrawPage> & xDrawPage)1612 HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( const Reference<XDrawPage>& xDrawPage )
1613 {
1614     HeaderFooterPageSettingsImpl aSettings;
1615 
1616     if( xDrawPage.is() ) try
1617     {
1618         Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
1619         Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
1620 
1621         OUString aStrText;
1622 
1623         const OUString aStrHeaderTextProp( RTL_CONSTASCII_USTRINGPARAM( "HeaderText" ) );
1624         if( xInfo->hasPropertyByName( aStrHeaderTextProp ) )
1625         {
1626             xSet->getPropertyValue( aStrHeaderTextProp  ) >>= aStrText;
1627             if( aStrText.getLength() )
1628                 aSettings.maStrHeaderDeclName = findOrAppendImpl( maHeaderDeclsVector, aStrText, gpStrHeaderTextPrefix );
1629         }
1630 
1631         const OUString aStrFooterTextProp( RTL_CONSTASCII_USTRINGPARAM( "FooterText" ) );
1632         if( xInfo->hasPropertyByName( aStrFooterTextProp ) )
1633         {
1634             xSet->getPropertyValue( aStrFooterTextProp ) >>= aStrText;
1635             if( aStrText.getLength() )
1636                 aSettings.maStrFooterDeclName = findOrAppendImpl( maFooterDeclsVector, aStrText, gpStrFooterTextPrefix );
1637         }
1638 
1639         const OUString aStrDateTimeTextProp( RTL_CONSTASCII_USTRINGPARAM( "DateTimeText" ) );
1640         if( xInfo->hasPropertyByName( aStrDateTimeTextProp ) )
1641         {
1642             sal_Bool bFixed = false;
1643             sal_Int32 nFormat = 0;
1644             xSet->getPropertyValue( aStrDateTimeTextProp ) >>= aStrText;
1645             xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeFixed" ) ) ) >>= bFixed;
1646             xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DateTimeFormat" ) ) ) >>= nFormat;
1647 
1648             if( !bFixed || aStrText.getLength() )
1649             {
1650                 aSettings.maStrDateTimeDeclName = findOrAppendImpl( maDateTimeDeclsVector, aStrText, bFixed, nFormat, gpStrDateTimeTextPrefix );
1651                 if( !bFixed )
1652                     addDataStyle( nFormat );
1653             }
1654         }
1655     }
1656     catch( Exception& e )
1657     {
1658         (void)e;
1659         DBG_ERROR( "SdXMLExport::ImpPrepDrawPageHeaderFooterDecls(), unexpected exception caught!" );
1660     }
1661 
1662     return aSettings;
1663 }
1664 
1665 //////////////////////////////////////////////////////////////////////////////
1666 
ImpWriteHeaderFooterDecls()1667 void SdXMLExport::ImpWriteHeaderFooterDecls()
1668 {
1669     OUStringBuffer sBuffer;
1670 
1671     if( !maHeaderDeclsVector.empty() )
1672     {
1673         // export header decls
1674         const OUString aPrefix( OUString::createFromAscii( gpStrHeaderTextPrefix ) );
1675         std::vector< OUString >::iterator aIter;
1676         sal_Int32 nIndex;
1677         for( nIndex = 1, aIter = maHeaderDeclsVector.begin(); aIter != maHeaderDeclsVector.end(); aIter++, nIndex++ )
1678         {
1679             sBuffer.append( aPrefix );
1680             sBuffer.append( nIndex );
1681             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
1682 
1683             SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_HEADER_DECL, sal_True, sal_True);
1684             Characters((*aIter));
1685         }
1686     }
1687 
1688     if( !maFooterDeclsVector.empty() )
1689     {
1690         // export footer decls
1691         const OUString aPrefix( OUString::createFromAscii( gpStrFooterTextPrefix ) );
1692         std::vector< OUString >::iterator aIter;
1693         sal_Int32 nIndex;
1694         for( nIndex = 1, aIter = maFooterDeclsVector.begin(); aIter != maFooterDeclsVector.end(); aIter++, nIndex++ )
1695         {
1696             sBuffer.append( aPrefix );
1697             sBuffer.append( nIndex );
1698             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
1699 
1700             SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_FOOTER_DECL, sal_False, sal_False);
1701             Characters((*aIter));
1702         }
1703     }
1704 
1705     if( !maDateTimeDeclsVector.empty() )
1706     {
1707         // export footer decls
1708         const OUString aPrefix( OUString::createFromAscii( gpStrDateTimeTextPrefix ) );
1709         std::vector< DateTimeDeclImpl >::iterator aIter;
1710         sal_Int32 nIndex;
1711         for( nIndex = 1, aIter = maDateTimeDeclsVector.begin(); aIter != maDateTimeDeclsVector.end(); aIter++, nIndex++ )
1712         {
1713             const DateTimeDeclImpl& rDecl = (*aIter);
1714 
1715             sBuffer.append( aPrefix );
1716             sBuffer.append( nIndex );
1717             AddAttribute( XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
1718 
1719             AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SOURCE, rDecl.mbFixed ? XML_FIXED : XML_CURRENT_DATE );
1720 
1721             if( !rDecl.mbFixed )
1722                 AddAttribute( XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, getDataStyleName( rDecl.mnFormat ) );
1723 
1724             SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_DATE_TIME_DECL, sal_False, sal_False);
1725             if( rDecl.mbFixed )
1726                 Characters(rDecl.maStrText);
1727         }
1728     }
1729 }
1730 
ImplExportHeaderFooterDeclAttributes(const HeaderFooterPageSettingsImpl & aSettings)1731 void SdXMLExport::ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings )
1732 {
1733     if( aSettings.maStrHeaderDeclName.getLength() )
1734         AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, aSettings.maStrHeaderDeclName );
1735 
1736     if( aSettings.maStrFooterDeclName.getLength() )
1737         AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, aSettings.maStrFooterDeclName );
1738 
1739     if( aSettings.maStrDateTimeDeclName.getLength() )
1740         AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, aSettings.maStrDateTimeDeclName );
1741 }
1742 
1743 //////////////////////////////////////////////////////////////////////////////
1744 
ImpCreatePresPageStyleName(Reference<XDrawPage> xDrawPage,bool bExportBackground)1745 OUString SdXMLExport::ImpCreatePresPageStyleName( Reference<XDrawPage> xDrawPage, bool bExportBackground /* = true */ )
1746 {
1747     // create name
1748     OUString sStyleName;
1749 
1750     // create style for this page and add to auto style pool
1751 
1752     Reference< beans::XPropertySet > xPropSet1(xDrawPage, UNO_QUERY);
1753     if(xPropSet1.is())
1754     {
1755         Reference< beans::XPropertySet > xPropSet;
1756 
1757         if( bExportBackground )
1758         {
1759             // since the background items are in a different propertyset
1760             // which itself is a property of the pages property set
1761             // we now merge these two propertysets if possible to simulate
1762             // a single propertyset with all draw page properties
1763             const OUString aBackground(RTL_CONSTASCII_USTRINGPARAM("Background"));
1764             Reference< beans::XPropertySet > xPropSet2;
1765             Reference< beans::XPropertySetInfo > xInfo( xPropSet1->getPropertySetInfo() );
1766             if( xInfo.is() && xInfo->hasPropertyByName( aBackground ) )
1767             {
1768                 Any aAny( xPropSet1->getPropertyValue( aBackground ) );
1769                 aAny >>= xPropSet2;
1770             }
1771 
1772             if( xPropSet2.is() )
1773                 xPropSet = PropertySetMerger_CreateInstance( xPropSet1, xPropSet2 );
1774             else
1775                 xPropSet = xPropSet1;
1776         }
1777         else
1778         {
1779             xPropSet = xPropSet1;
1780         }
1781 
1782         const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPresPagePropsMapper() );
1783 
1784         std::vector< XMLPropertyState > xPropStates( aMapperRef->Filter( xPropSet ) );
1785 
1786         if( !xPropStates.empty() )
1787         {
1788             // there are filtered properties -> hard attributes
1789             // try to find this style in AutoStylePool
1790             sStyleName = GetAutoStylePool()->Find(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sStyleName, xPropStates);
1791 
1792             if(!sStyleName.getLength())
1793             {
1794                 // Style did not exist, add it to AutoStalePool
1795                 sStyleName = GetAutoStylePool()->Add(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sStyleName, xPropStates);
1796             }
1797         }
1798     }
1799 
1800     return sStyleName;
1801 }
1802 
1803 //////////////////////////////////////////////////////////////////////////////
1804 
ImpPrepMasterPageInfos()1805 void SdXMLExport::ImpPrepMasterPageInfos()
1806 {
1807     // create draw:style-name entries for master page export
1808     // containing only background attributes
1809     // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
1810 
1811     sal_Int32 nCnt;
1812     for( nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++)
1813     {
1814         Reference<XDrawPage> xDrawPage;
1815         mxDocMasterPages->getByIndex(nCnt) >>= xDrawPage;
1816         maMasterPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage );
1817     }
1818 
1819     if( IsImpress() )
1820     {
1821         Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
1822         if( xHandoutSupp.is() )
1823         {
1824             Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
1825             if( xHandoutPage.is() )
1826             {
1827                 maHandoutPageHeaderFooterSettings = ImpPrepDrawPageHeaderFooterDecls( xHandoutPage );
1828                 maHandoutMasterStyleName = ImpCreatePresPageStyleName( xHandoutPage, false );
1829             }
1830         }
1831     }
1832 }
1833 
1834 //////////////////////////////////////////////////////////////////////////////
ImpWritePresentationStyles()1835 void SdXMLExport::ImpWritePresentationStyles()
1836 {
1837     if(IsImpress())
1838     {
1839         for (sal_Int32 nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++)
1840         {
1841             Any aAny(mxDocMasterPages->getByIndex(nCnt));
1842             Reference<container::XNamed> xNamed;
1843 
1844             if(aAny >>= xNamed)
1845             {
1846                 // write presentation styles (ONLY if presentation)
1847                 if(IsImpress() && mxDocStyleFamilies.is() && xNamed.is())
1848                 {
1849                     XMLStyleExport aStEx(*this, OUString(), GetAutoStylePool().get());
1850                     const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPropertySetMapper() );
1851 
1852                     OUString aPrefix( xNamed->getName() );
1853 
1854                     aPrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
1855                     aStEx.exportStyleFamily(xNamed->getName(),
1856                         OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)),
1857                         aMapperRef, sal_False,
1858                         XML_STYLE_FAMILY_SD_PRESENTATION_ID, &aPrefix);
1859                 }
1860             }
1861         }
1862     }
1863 }
1864 
1865 //////////////////////////////////////////////////////////////////////////////
1866 
SetProgress(sal_Int32 nProg)1867 void SdXMLExport::SetProgress(sal_Int32 nProg)
1868 {
1869     // set progress view
1870     if(GetStatusIndicator().is())
1871         GetStatusIndicator()->setValue(nProg);
1872 }
1873 
1874 //////////////////////////////////////////////////////////////////////////////
1875 // #82003#
1876 
_ExportMeta()1877 void SdXMLExport::_ExportMeta()
1878 {
1879     uno::Sequence<beans::NamedValue> stats(1);
1880     stats[0] = beans::NamedValue(::rtl::OUString::createFromAscii("ObjectCount"),
1881                 uno::makeAny(mnObjectCount));
1882 
1883     // update document statistics at the model
1884     uno::Reference<document::XDocumentPropertiesSupplier> xPropSup(GetModel(),
1885         uno::UNO_QUERY_THROW);
1886     uno::Reference<document::XDocumentProperties> xDocProps(
1887         xPropSup->getDocumentProperties());
1888     if (xDocProps.is()) {
1889         xDocProps->setDocumentStatistics(stats);
1890     }
1891 
1892     // call parent
1893     SvXMLExport::_ExportMeta();
1894 }
1895 
1896 //////////////////////////////////////////////////////////////////////////////
1897 
_ExportContent()1898 void SdXMLExport::_ExportContent()
1899 {
1900     // export <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl> elements
1901     ImpWriteHeaderFooterDecls();
1902 
1903     // page export
1904     for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
1905     {
1906         uno::Reference<drawing::XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), uno::UNO_QUERY );
1907 
1908         SetProgress(((nPageInd + 1) * 100) / mnDocDrawPageCount);
1909 
1910         if(xDrawPage.is())
1911         {
1912             // prepare page attributes, name of page
1913             Reference < container::XNamed > xNamed(xDrawPage, UNO_QUERY);
1914             if(xNamed.is())
1915                 AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, xNamed->getName());
1916 
1917             // draw:style-name (presentation page attributes AND background attributes)
1918             if( maDrawPagesStyleNames[nPageInd].getLength() )
1919                 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
1920                         maDrawPagesStyleNames[nPageInd]);
1921 
1922             // draw:master-page-name
1923             Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY);
1924             if(xMasterPageInt.is())
1925             {
1926                 Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
1927                 if(xUsedMasterPage.is())
1928                 {
1929                     Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
1930                     if(xMasterNamed.is())
1931                     {
1932                         AddAttribute(XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME,
1933                             EncodeStyleName( xMasterNamed->getName()) );
1934                     }
1935                 }
1936             }
1937 
1938             // presentation:page-layout-name
1939             if( IsImpress() && maDrawPagesAutoLayoutNames[nPageInd+1].getLength())
1940             {
1941                 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, maDrawPagesAutoLayoutNames[nPageInd+1] );
1942             }
1943 
1944             Reference< beans::XPropertySet > xProps( xDrawPage, UNO_QUERY );
1945             if( xProps.is() )
1946             {
1947                 try
1948                 {
1949                     OUString aBookmarkURL;
1950                     xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "BookmarkURL" ) ) ) >>= aBookmarkURL;
1951 
1952                     if( aBookmarkURL.getLength() )
1953                     {
1954                         sal_Int32 nIndex = aBookmarkURL.lastIndexOf( (sal_Unicode)'#' );
1955                         if( nIndex != -1 )
1956                         {
1957                             OUString aFileName( aBookmarkURL.copy( 0, nIndex ) );
1958                             OUString aBookmarkName( aBookmarkURL.copy( nIndex+1 ) );
1959 
1960                             aBookmarkURL = GetRelativeReference( aFileName );
1961                             aBookmarkURL += String( '#' );
1962                             aBookmarkURL += aBookmarkName;
1963                         }
1964 
1965                         AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, aBookmarkURL);
1966                         AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1967                         AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_REPLACE );
1968                         AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
1969                     }
1970                 }
1971                 catch( Exception& )
1972                 {
1973                     DBG_ERROR(" no \"BookmarkURL\" property at page?" );
1974                 }
1975             }
1976 
1977             if( IsImpress() )
1978                 ImplExportHeaderFooterDeclAttributes( maDrawPagesHeaderFooterSettings[nPageInd] );
1979 
1980 
1981             OUString sNavigationOrder( getNavigationOrder( xDrawPage ) );
1982             if( sNavigationOrder.getLength() != 0 )
1983                 AddAttribute ( XML_NAMESPACE_DRAW, XML_NAV_ORDER, sNavigationOrder );
1984 
1985             UniReference< xmloff::AnimationsExporter >  xAnimationsExporter;
1986             uno::Reference< ::com::sun::star::animations::XAnimationNodeSupplier > xAnimNodeSupplier;
1987 
1988             // prepare animation export
1989             if(IsImpress())
1990             {
1991                 if( getExportFlags() & EXPORT_OASIS )
1992                 {
1993                     // export new animations for oasis format
1994                     xAnimNodeSupplier.set( xDrawPage, UNO_QUERY );
1995 
1996                     // prepare animations exporter if impress
1997                     if(xAnimNodeSupplier.is())
1998                     {
1999                         xAnimationsExporter = new xmloff::AnimationsExporter( *this, xProps );
2000                         xAnimationsExporter->prepare( xAnimNodeSupplier->getAnimationNode() );
2001                     }
2002                 }
2003                 else
2004                 {
2005                     // export old animations for ooo format
2006                     UniReference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter( GetShapeExport().get() );
2007                     GetShapeExport()->setAnimationsExporter( xAnimExport );
2008                 }
2009             }
2010 
2011             // write draw:id
2012             const OUString aPageId = getInterfaceToIdentifierMapper().getIdentifier( xDrawPage );
2013             if( aPageId.getLength() != 0 )
2014             {
2015                 AddAttributeIdLegacy(XML_NAMESPACE_DRAW, aPageId);
2016             }
2017 
2018             // write page
2019             SvXMLElementExport aDPG(*this, XML_NAMESPACE_DRAW, XML_PAGE, sal_True, sal_True);
2020 
2021             // write optional office:forms
2022             exportFormsElement( xDrawPage );
2023 
2024             // write graphic objects on this page (if any)
2025             Reference< drawing::XShapes > xExportShapes(xDrawPage, UNO_QUERY);
2026             if(xExportShapes.is() && xExportShapes->getCount())
2027                 GetShapeExport()->exportShapes( xExportShapes );
2028 
2029             // write animations and presentation notes (ONLY if presentation)
2030             if(IsImpress())
2031             {
2032                 if(xAnimNodeSupplier.is())
2033                 {
2034                     xAnimationsExporter->exportAnimations( xAnimNodeSupplier->getAnimationNode() );
2035                 }
2036                 else
2037                 {
2038                     // animations
2039                     UniReference< XMLAnimationsExporter > xAnimExport( GetShapeExport()->getAnimationsExporter() );
2040                     if( xAnimExport.is() )
2041                         xAnimExport->exportAnimations( *this );
2042 
2043                     xAnimExport = NULL;
2044                     GetShapeExport()->setAnimationsExporter( xAnimExport );
2045                 }
2046 
2047                 // presentations
2048                 Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
2049                 if(xPresPage.is())
2050                 {
2051                     Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
2052                     if(xNotesPage.is())
2053                     {
2054                         Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
2055                         if(xShapes.is())
2056                         {
2057                             if( maDrawNotesPagesStyleNames[nPageInd].getLength() )
2058                                 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maDrawNotesPagesStyleNames[nPageInd]);
2059 
2060                             ImplExportHeaderFooterDeclAttributes( maDrawNotesPagesHeaderFooterSettings[nPageInd] );
2061 
2062                             // write presentation notes
2063                             SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, sal_True, sal_True);
2064 
2065                             // write optional office:forms
2066                             exportFormsElement( xNotesPage );
2067 
2068                             // write shapes per se
2069                             GetShapeExport()->exportShapes( xShapes );
2070                         }
2071                     }
2072                 }
2073             }
2074 
2075             exportAnnotations( xDrawPage );
2076         }
2077     }
2078 
2079     if( IsImpress() )
2080         exportPresentationSettings();
2081 }
2082 
2083 //////////////////////////////////////////////////////////////////////////////
2084 
exportPresentationSettings()2085 void SdXMLExport::exportPresentationSettings()
2086 {
2087     try
2088     {
2089         Reference< XPresentationSupplier > xPresSupplier( GetModel(), UNO_QUERY );
2090         if( !xPresSupplier.is() )
2091             return;
2092 
2093         Reference< XPropertySet > xPresProps( xPresSupplier->getPresentation(), UNO_QUERY );
2094         if( !xPresProps.is() )
2095             return;
2096 
2097         sal_Bool bHasAttr = sal_False;
2098 
2099         sal_Bool bTemp = false;
2100 
2101         // export range
2102         xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowAll" ) ) ) >>= bTemp;
2103         if( !bTemp )
2104         {
2105             OUString aFirstPage;
2106             xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ) ) >>= aFirstPage;
2107             if( aFirstPage.getLength() )
2108             {
2109                 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_PAGE, aFirstPage );
2110                 bHasAttr = sal_True;
2111             }
2112             else
2113             {
2114                 OUString aCustomShow;
2115                 xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomShow" ) ) ) >>= aCustomShow;
2116                 if( aCustomShow.getLength() )
2117                 {
2118                     AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW, aCustomShow );
2119                     bHasAttr = sal_True;
2120                 }
2121             }
2122         }
2123 
2124         xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ) ) >>= bTemp;
2125         if( bTemp )
2126         {
2127             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ENDLESS, XML_TRUE );
2128             bHasAttr = sal_True;
2129 
2130             sal_Int32 nPause = 0;
2131             xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Pause" ) ) ) >>= nPause;
2132 
2133             util::DateTime aTime( 0, (sal_uInt16)nPause, 0, 0, 0, 0, 0 );
2134 
2135             OUStringBuffer aOut;
2136             SvXMLUnitConverter::convertTime( aOut, aTime );
2137             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAUSE, aOut.makeStringAndClear() );
2138         }
2139 
2140         xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowAnimations" ) ) ) >>= bTemp;
2141         if( !bTemp )
2142         {
2143             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ANIMATIONS, XML_DISABLED );
2144             bHasAttr = sal_True;
2145         }
2146 
2147         xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAlwaysOnTop" ) ) ) >>= bTemp;
2148         if( bTemp )
2149         {
2150             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STAY_ON_TOP, XML_TRUE );
2151             bHasAttr = sal_True;
2152         }
2153 
2154         xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ) ) >>= bTemp;
2155         if( bTemp )
2156         {
2157             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FORCE_MANUAL, XML_TRUE );
2158             bHasAttr = sal_True;
2159         }
2160 
2161         xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ) ) >>= bTemp;
2162         if( !bTemp )
2163         {
2164             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FULL_SCREEN, XML_FALSE );
2165             bHasAttr = sal_True;
2166         }
2167 
2168         xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsMouseVisible" ) ) ) >>= bTemp;
2169         if( !bTemp )
2170         {
2171             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, XML_FALSE );
2172             bHasAttr = sal_True;
2173         }
2174 
2175         xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "StartWithNavigator" ) ) ) >>= bTemp;
2176         if( bTemp )
2177         {
2178             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_WITH_NAVIGATOR, XML_TRUE );
2179             bHasAttr = sal_True;
2180         }
2181 
2182         xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "UsePen" ) ) ) >>= bTemp;
2183         if( bTemp )
2184         {
2185             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_AS_PEN, XML_TRUE );
2186             bHasAttr = sal_True;
2187         }
2188 
2189         xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTransitionOnClick" ) ) ) >>= bTemp;
2190         if( !bTemp )
2191         {
2192             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_TRANSITION_ON_CLICK, XML_DISABLED );
2193             bHasAttr = sal_True;
2194         }
2195 
2196         xPresProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "IsShowLogo" ) ) ) >>= bTemp;
2197         if( bTemp )
2198         {
2199             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW_LOGO, XML_TRUE );
2200             bHasAttr = sal_True;
2201         }
2202 
2203         Reference< container::XNameContainer > xShows;
2204         Sequence< OUString > aShowNames;
2205         const OUString* pShowNames = NULL;
2206         sal_Int32 nShowCount = 0;
2207 
2208         Reference< XCustomPresentationSupplier > xSup( GetModel(), UNO_QUERY );
2209         if( xSup.is() )
2210         {
2211             xShows = xSup->getCustomPresentations();
2212             if( xShows.is() )
2213             {
2214                 aShowNames = xShows->getElementNames();
2215                 pShowNames = aShowNames.getArray();
2216                 nShowCount = aShowNames.getLength();
2217             }
2218         }
2219 
2220         if( bHasAttr || nShowCount != 0 )
2221         {
2222             SvXMLElementExport aSettings(*this, XML_NAMESPACE_PRESENTATION, XML_SETTINGS, sal_True, sal_True);
2223 
2224             if( nShowCount == 0 )
2225                 return;
2226 
2227             Reference< XIndexContainer > xShow;
2228             Reference< XNamed > xPageName;
2229 
2230             OUStringBuffer sTmp;
2231 
2232             for( sal_Int32 nIndex = 0; nIndex < nShowCount; nIndex++, pShowNames++ )
2233             {
2234                 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, *pShowNames );
2235 
2236                 xShows->getByName( *pShowNames ) >>= xShow;
2237                 DBG_ASSERT( xShow.is(), "invalid custom show!" );
2238                 if( !xShow.is() )
2239                     continue;
2240 
2241                 const sal_Int32 nPageCount = xShow->getCount();
2242                 for( sal_Int32 nPage = 0; nPage < nPageCount; nPage++ )
2243                 {
2244                     xShow->getByIndex( nPage ) >>= xPageName;
2245 
2246                     if( !xPageName.is() )
2247                         continue;
2248 
2249                     if( sTmp.getLength() != 0 )
2250                         sTmp.append( sal_Unicode( ',' ) );
2251                     sTmp.append( xPageName->getName() );
2252 
2253                 }
2254 
2255                 if( sTmp.getLength() )
2256                     AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAGES, sTmp.makeStringAndClear() );
2257 
2258                 SvXMLElementExport aShows(*this, XML_NAMESPACE_PRESENTATION, XML_SHOW, sal_True, sal_True);
2259             }
2260         }
2261     }
2262     catch( uno::Exception )
2263     {
2264         DBG_ERROR( "uno::Exception while exporting <presentation:settings>" );
2265     }
2266 }
2267 
2268 //////////////////////////////////////////////////////////////////////////////
2269 
_ExportStyles(sal_Bool bUsed)2270 void SdXMLExport::_ExportStyles(sal_Bool bUsed)
2271 {
2272     GetPropertySetMapper()->SetAutoStyles( sal_False );
2273 
2274     // export fill styles
2275     SvXMLExport::_ExportStyles( bUsed );
2276 
2277     // write draw:style-name for object graphic-styles
2278     GetShapeExport()->ExportGraphicDefaults();
2279 
2280     // do not export in ODF 1.1 or older
2281     if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
2282         GetShapeExport()->GetShapeTableExport()->exportTableStyles();
2283 
2284     // write presentation styles
2285     ImpWritePresentationStyles();
2286 
2287     // prepare draw:auto-layout-name for page export
2288     ImpPrepAutoLayoutInfos();
2289 
2290     // write draw:auto-layout-name for page export
2291     ImpWriteAutoLayoutInfos();
2292 
2293     Reference< beans::XPropertySet > xInfoSet( getExportInfo() );
2294     if( xInfoSet.is() )
2295     {
2296         Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
2297 
2298         Any aAny;
2299 
2300         if( xInfoSetInfo->hasPropertyByName( msPageLayoutNames ) )
2301         {
2302             aAny <<= maDrawPagesAutoLayoutNames;
2303             xInfoSet->setPropertyValue( msPageLayoutNames, aAny );
2304         }
2305     }
2306 }
2307 
2308 //////////////////////////////////////////////////////////////////////////////
2309 
_ExportAutoStyles()2310 void SdXMLExport::_ExportAutoStyles()
2311 {
2312     Reference< beans::XPropertySet > xInfoSet( getExportInfo() );
2313     if( xInfoSet.is() )
2314     {
2315         Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
2316 
2317         if( xInfoSetInfo->hasPropertyByName( msPageLayoutNames ) )
2318         {
2319             xInfoSet->getPropertyValue( msPageLayoutNames ) >>= maDrawPagesAutoLayoutNames;
2320         }
2321     }
2322 
2323     GetPropertySetMapper()->SetAutoStyles( sal_True );
2324 
2325     if( getExportFlags() & EXPORT_STYLES )
2326     {
2327         // #80012# PageMaster export moved from _ExportStyles
2328         // prepare page-master infos
2329         ImpPrepPageMasterInfos();
2330 
2331         // write page-master infos
2332         ImpWritePageMasterInfos();
2333 
2334         // prepare draw:style-name for master page export
2335         ImpPrepMasterPageInfos();
2336     }
2337 
2338     if( getExportFlags() & EXPORT_CONTENT )
2339     {
2340         // prepare draw:style-name for page export
2341         ImpPrepDrawPageInfos();
2342     }
2343 
2344     // export draw-page styles
2345     GetAutoStylePool()->exportXML(
2346         XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID
2347         , GetDocHandler(),
2348         GetMM100UnitConverter(),
2349         GetNamespaceMap()
2350         );
2351 
2352     if( getExportFlags() & EXPORT_STYLES )
2353     {
2354         // create auto style infos for shapes on master handout page
2355         if( IsImpress() )
2356         {
2357             Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
2358             if( xHandoutSupp.is() )
2359             {
2360                 Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
2361                 if( xHandoutPage.is() )
2362                 {
2363                     Reference< drawing::XShapes > xShapes(xHandoutPage, UNO_QUERY);
2364                     if(xShapes.is() && xShapes->getCount())
2365                         GetShapeExport()->collectShapesAutoStyles( xShapes );
2366                 }
2367             }
2368         }
2369 
2370         // create auto style infos for objects on master pages
2371         for(sal_Int32 nMPageId(0L); nMPageId < mnDocMasterPageCount; nMPageId++)
2372         {
2373             Reference< XDrawPage > xMasterPage(mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
2374 
2375             if( xMasterPage.is() )
2376             {
2377                 // collect layer information
2378                 GetFormExport()->examineForms( xMasterPage );
2379 
2380                 // get MasterPage Name
2381                 OUString aMasterPageNamePrefix;
2382                 Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY);
2383                 if(xNamed.is())
2384                 {
2385                     aMasterPageNamePrefix = xNamed->getName();
2386                 }
2387                 if(aMasterPageNamePrefix.getLength())
2388                 {
2389                     aMasterPageNamePrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
2390                 }
2391                 GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
2392 
2393                 Reference< drawing::XShapes > xMasterShapes(xMasterPage, UNO_QUERY);
2394                 if(xMasterShapes.is() && xMasterShapes->getCount())
2395                     GetShapeExport()->collectShapesAutoStyles( xMasterShapes );
2396 
2397                 if(IsImpress())
2398                 {
2399                     Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
2400                     if(xPresPage.is())
2401                     {
2402                         Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
2403                         if(xNotesPage.is())
2404                         {
2405                             // collect layer information
2406                             GetFormExport()->examineForms( xNotesPage );
2407 
2408                             Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
2409                             if(xShapes.is() && xShapes->getCount())
2410                                 GetShapeExport()->collectShapesAutoStyles( xShapes );
2411                         }
2412                     }
2413                 }
2414                 collectAnnotationAutoStyles(xMasterPage);
2415             }
2416         }
2417     }
2418 
2419     if( getExportFlags() & EXPORT_CONTENT )
2420     {
2421         // prepare animations exporter if impress
2422         if(IsImpress() && ((getExportFlags() & EXPORT_OASIS) == 0) )
2423         {
2424             UniReference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter( GetShapeExport().get() );
2425             GetShapeExport()->setAnimationsExporter( xAnimExport );
2426         }
2427 
2428         // create auto style infos for objects on pages
2429         for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
2430         {
2431             Reference<XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), UNO_QUERY );
2432             if( xDrawPage.is() )
2433             {
2434                 // collect layer information
2435                 GetFormExport()->examineForms( xDrawPage );
2436 
2437                 // get MasterPage Name
2438                 OUString aMasterPageNamePrefix;
2439                 Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY);
2440                 if(xMasterPageInt.is())
2441                 {
2442                     Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
2443                     if(xUsedMasterPage.is())
2444                     {
2445                         Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
2446                         if(xMasterNamed.is())
2447                         {
2448                             aMasterPageNamePrefix = xMasterNamed->getName();
2449                         }
2450                     }
2451                 }
2452                 if(aMasterPageNamePrefix.getLength())
2453                 {
2454                     aMasterPageNamePrefix += OUString(RTL_CONSTASCII_USTRINGPARAM("-"));
2455                 }
2456 
2457                 GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
2458 
2459                 // prepare object infos
2460                 Reference< drawing::XShapes > xDrawShapes(xDrawPage, UNO_QUERY);
2461                 if(xDrawShapes.is() && xDrawShapes->getCount())
2462                     GetShapeExport()->collectShapesAutoStyles( xDrawShapes );
2463 
2464                 // prepare presentation notes page object infos (ONLY if presentation)
2465                 if(IsImpress())
2466                 {
2467                     Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
2468                     if(xPresPage.is())
2469                     {
2470                         Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
2471                         if(xNotesPage.is())
2472                         {
2473                             // collect layer information
2474                             GetFormExport()->examineForms( xNotesPage );
2475 
2476                             Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
2477                             if(xShapes.is() && xShapes->getCount())
2478                                 GetShapeExport()->collectShapesAutoStyles( xShapes );
2479                         }
2480                     }
2481                 }
2482 
2483                 collectAnnotationAutoStyles( xDrawPage );
2484             }
2485         }
2486         if(IsImpress())
2487         {
2488             UniReference< XMLAnimationsExporter > xAnimExport;
2489             GetShapeExport()->setAnimationsExporter( xAnimExport );
2490         }
2491     }
2492 
2493     exportAutoDataStyles();
2494 
2495     GetShapeExport()->exportAutoStyles();
2496 
2497     sal_uInt16 nContentAutostyles = EXPORT_CONTENT | EXPORT_AUTOSTYLES;
2498     if ( ( getExportFlags() & nContentAutostyles ) == nContentAutostyles )
2499         GetFormExport()->exportAutoStyles( );
2500 
2501     // ...for text
2502     GetTextParagraphExport()->exportTextAutoStyles();
2503 }
2504 
2505 //////////////////////////////////////////////////////////////////////////////
2506 
_ExportMasterStyles()2507 void SdXMLExport::_ExportMasterStyles()
2508 {
2509     // export layer
2510     SdXMLayerExporter::exportLayer( *this );
2511 
2512     // export handout master page if impress
2513     if( IsImpress() )
2514     {
2515         Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
2516         if( xHandoutSupp.is() )
2517         {
2518             Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
2519             if( xHandoutPage.is() )
2520             {
2521                 // presentation:page-layout-name
2522                 if( IsImpress() && maDrawPagesAutoLayoutNames[0].getLength())
2523                 {
2524                     AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, EncodeStyleName( maDrawPagesAutoLayoutNames[0] ));
2525                 }
2526 
2527                 ImpXMLEXPPageMasterInfo* pInfo = mpHandoutPageMaster;
2528                 if(pInfo)
2529                 {
2530                     OUString sString = pInfo->GetName();
2531                     AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
2532                 }
2533 
2534                 // draw:style-name
2535                 if( maHandoutMasterStyleName.getLength() )
2536                     AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maHandoutMasterStyleName);
2537 
2538                 ImplExportHeaderFooterDeclAttributes( maHandoutPageHeaderFooterSettings );
2539 
2540                 // write masterpage
2541                 SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_HANDOUT_MASTER, sal_True, sal_True);
2542 
2543                 // write graphic objects on this master page (if any)
2544                 Reference< drawing::XShapes > xShapes(xHandoutPage, UNO_QUERY);
2545                 if(xShapes.is() && xShapes->getCount())
2546                     GetShapeExport()->exportShapes( xShapes );
2547             }
2548         }
2549     }
2550 
2551     // export MasterPages in master-styles section
2552     for (sal_Int32 nMPageId = 0; nMPageId < mnDocMasterPageCount; nMPageId++)
2553     {
2554         Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
2555         if(xMasterPage.is())
2556         {
2557             // prepare masterpage attributes
2558             OUString sMasterPageName;
2559             Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY);
2560             if(xNamed.is())
2561             {
2562                 sal_Bool bEncoded = sal_False;
2563                 sMasterPageName = xNamed->getName();
2564                 AddAttribute(XML_NAMESPACE_STYLE, XML_NAME,
2565                     EncodeStyleName( sMasterPageName, &bEncoded ));
2566                 if( bEncoded )
2567                     AddAttribute(
2568                         XML_NAMESPACE_STYLE, XML_DISPLAY_NAME,
2569                         sMasterPageName );
2570             }
2571 
2572             ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterUsageList->GetObject(nMPageId);
2573             if(pInfo)
2574             {
2575                 OUString sString = pInfo->GetName();
2576                 AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
2577             }
2578 
2579             // draw:style-name (background attributes)
2580             if( maMasterPagesStyleNames[nMPageId].getLength() )
2581                 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
2582                         maMasterPagesStyleNames[nMPageId]);
2583 
2584             // write masterpage
2585             SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_MASTER_PAGE, sal_True, sal_True);
2586 
2587             // write optional office:forms
2588             exportFormsElement( xMasterPage );
2589 
2590             // write graphic objects on this master page (if any)
2591             Reference< drawing::XShapes > xMasterShapes(xMasterPage, UNO_QUERY);
2592             if(xMasterShapes.is() && xMasterShapes->getCount())
2593                 GetShapeExport()->exportShapes( xMasterShapes );
2594 
2595             // write presentation notes (ONLY if presentation)
2596             if(IsImpress())
2597             {
2598                 Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
2599                 if(xPresPage.is())
2600                 {
2601                     Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
2602                     if(xNotesPage.is())
2603                     {
2604                         Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
2605                         if(xShapes.is())
2606                         {
2607                             ImpXMLEXPPageMasterInfo* pMasterInfo = mpNotesPageMasterUsageList->GetObject(nMPageId);
2608                             if(pMasterInfo)
2609                             {
2610                                 OUString sString = pMasterInfo->GetName();
2611                                 AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString);
2612                             }
2613 
2614                             // write presentation notes
2615                             SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, sal_True, sal_True);
2616 
2617                             // write optional office:forms
2618                             exportFormsElement( xNotesPage );
2619 
2620                             // write shapes per se
2621                             GetShapeExport()->exportShapes( xShapes );
2622                         }
2623                     }
2624                 }
2625             }
2626             exportAnnotations( xMasterPage );
2627         }
2628     }
2629 }
2630 
exportFormsElement(Reference<XDrawPage> xDrawPage)2631 void SdXMLExport::exportFormsElement( Reference< XDrawPage > xDrawPage )
2632 {
2633     if( xDrawPage.is() )
2634     {
2635         Reference< form::XFormsSupplier2 > xFormsSupplier( xDrawPage, UNO_QUERY );
2636         if ( xFormsSupplier.is() && xFormsSupplier->hasForms() )
2637         {
2638             // write masterpage
2639             ::xmloff::OOfficeFormsExport aForms(*this);
2640             GetFormExport()->exportForms( xDrawPage );
2641         }
2642 
2643         if(! GetFormExport()->seekPage( xDrawPage ) )
2644         {
2645             DBG_ERROR( "OFormLayerXMLExport::seekPage failed!" );
2646         }
2647     }
2648 }
2649 
GetViewSettings(uno::Sequence<beans::PropertyValue> & rProps)2650 void SdXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
2651 {
2652     rProps.realloc(4);
2653     beans::PropertyValue* pProps = rProps.getArray();
2654     if(pProps)
2655     {
2656 //      SvXMLElementExport aViewSettingsElem(*this, XML_NAMESPACE_DRAW, XML_VIEW_SETTINGS, sal_True, sal_True);
2657 
2658         Reference< beans::XPropertySet > xPropSet( GetModel(), UNO_QUERY );
2659         if( !xPropSet.is() )
2660             return;
2661 
2662         awt::Rectangle aVisArea;
2663         xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ) ) >>= aVisArea;
2664 /*
2665         sal_Int16 nMapUnit;
2666         xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MapUnit" ) ) ) >>= nMapUnit;
2667 */
2668 
2669         sal_uInt16 i = 0;
2670         pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaTop"));
2671         pProps[i++].Value <<= aVisArea.Y;
2672         pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaLeft"));
2673         pProps[i++].Value <<= aVisArea.X;
2674         pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaWidth"));
2675         pProps[i++].Value <<= aVisArea.Width;
2676         pProps[i].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VisibleAreaHeight"));
2677         pProps[i++].Value <<= aVisArea.Height;
2678     }
2679 }
2680 
GetConfigurationSettings(uno::Sequence<beans::PropertyValue> & rProps)2681 void SdXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& rProps)
2682 {
2683     Reference< lang::XMultiServiceFactory > xFac( GetModel(), UNO_QUERY );
2684     if( xFac.is() )
2685     {
2686         Reference< beans::XPropertySet > xProps( xFac->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.Settings" ) ) ), UNO_QUERY );
2687         if( xProps.is() )
2688             SvXMLUnitConverter::convertPropertySet( rProps, xProps );
2689     }
2690 }
2691 
2692 //////////////////////////////////////////////////////////////////////////////
2693 
addDataStyle(const sal_Int32 nNumberFormat,sal_Bool bTimeFormat)2694 void SdXMLExport::addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat )
2695 {
2696     sal_Int32 nFormat = nNumberFormat;
2697     if( (nNumberFormat > 1) && (nNumberFormat <= 0x0f) )
2698         nFormat -= 2;
2699 
2700     if( bTimeFormat )
2701     {
2702         if( maUsedTimeStyles.count( nFormat ) == 0 )
2703             maUsedTimeStyles.insert( nFormat );
2704     }
2705     else
2706     {
2707         if( maUsedDateStyles.count( nFormat ) == 0 )
2708             maUsedDateStyles.insert( nFormat );
2709     }
2710 }
2711 
2712 //////////////////////////////////////////////////////////////////////////////
2713 
exportDataStyles()2714 void SdXMLExport::exportDataStyles()
2715 {
2716     // there are no data styles to export in draw/impress yet
2717 }
2718 
2719 //////////////////////////////////////////////////////////////////////////////
2720 
exportAutoDataStyles()2721 void SdXMLExport::exportAutoDataStyles()
2722 {
2723     SdXMLFormatMap::iterator aIter( maUsedDateStyles.begin() );
2724     SdXMLFormatMap::iterator aEnd( maUsedDateStyles.end() );
2725 
2726     while( aIter != aEnd )
2727         SdXMLNumberStylesExporter::exportDateStyle( *this, (*aIter++) );
2728 
2729     aIter = maUsedTimeStyles.begin();
2730     aEnd = maUsedTimeStyles.end();
2731     while( aIter != aEnd )
2732         SdXMLNumberStylesExporter::exportTimeStyle( *this, (*aIter++) );
2733 
2734     if(HasFormExport())
2735         GetFormExport()->exportAutoControlNumberStyles();
2736 }
2737 
2738 //////////////////////////////////////////////////////////////////////////////
2739 
getDataStyleName(const sal_Int32 nNumberFormat,sal_Bool bTimeFormat) const2740 OUString SdXMLExport::getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat ) const
2741 {
2742     if( bTimeFormat )
2743     {
2744         return SdXMLNumberStylesExporter::getTimeStyleName( nNumberFormat );
2745     }
2746     else
2747     {
2748         return SdXMLNumberStylesExporter::getDateStyleName( nNumberFormat );
2749     }
2750 }
2751 
getNavigationOrder(const Reference<XDrawPage> & xDrawPage)2752 OUString SdXMLExport::getNavigationOrder( const Reference< XDrawPage >& xDrawPage )
2753 {
2754     OUStringBuffer sNavOrder;
2755     try
2756     {
2757         Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
2758         Reference< XIndexAccess > xNavOrder( xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NavigationOrder" ) ) ), UNO_QUERY_THROW );
2759 
2760         Reference< XIndexAccess > xZOrderAccess( xDrawPage, UNO_QUERY );
2761 
2762         // only export navigation order if it is different from the z-order
2763         if( (xNavOrder.get() != xZOrderAccess.get()) && (xNavOrder->getCount() == xDrawPage->getCount())  )
2764         {
2765             sal_Int32 nIndex;
2766             const sal_Int32 nCount = xNavOrder->getCount();
2767             for( nIndex = 0; nIndex < nCount; ++nIndex )
2768             {
2769                 OUString sId( getInterfaceToIdentifierMapper().registerReference( Reference< XInterface >( xNavOrder->getByIndex( nIndex ), UNO_QUERY ) ) );
2770                 if( sId.getLength() != 0 )
2771                 {
2772                     if( sNavOrder.getLength() != 0 )
2773                         sNavOrder.append( (sal_Unicode)' ' );
2774                     sNavOrder.append( sId );
2775                 }
2776             }
2777         }
2778     }
2779     catch( Exception& )
2780     {
2781     }
2782     return sNavOrder.makeStringAndClear();
2783 }
2784 
2785 //////////////////////////////////////////////////////////////////////////////
2786 
collectAnnotationAutoStyles(const Reference<XDrawPage> & xDrawPage)2787 void SdXMLExport::collectAnnotationAutoStyles( const Reference<XDrawPage>& xDrawPage )
2788 {
2789     Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY );
2790     if( xAnnotationAccess.is() ) try
2791     {
2792         Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
2793         if( xAnnotationEnumeration.is() )
2794         {
2795             while( xAnnotationEnumeration->hasMoreElements() )
2796             {
2797                 Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_QUERY_THROW );
2798                 Reference< XText > xText( xAnnotation->getTextRange() );
2799                 if(xText.is() && xText->getString().getLength())
2800                     GetTextParagraphExport()->collectTextAutoStyles( xText );
2801             }
2802         }
2803     }
2804     catch( Exception& )
2805     {
2806         DBG_ERROR("SdXMLExport::collectAnnotationAutoStyles(), exception caught during export of annotation auto styles");
2807     }
2808 }
2809 
exportAnnotations(const Reference<XDrawPage> & xDrawPage)2810 void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage )
2811 {
2812     // do not export in ODF 1.2 or older
2813     if( getDefaultVersion() <= SvtSaveOptions::ODFVER_012 )
2814         return;
2815 
2816     Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY );
2817     if( xAnnotationAccess.is() ) try
2818     {
2819         Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
2820         if( xAnnotationEnumeration.is() && xAnnotationEnumeration->hasMoreElements() )
2821         {
2822             OUStringBuffer sStringBuffer;
2823             do
2824             {
2825                 Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_QUERY_THROW );
2826 
2827                 RealPoint2D aPosition( xAnnotation->getPosition() );
2828 
2829                 GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aPosition.X * 100 ) );
2830                 AddAttribute(XML_NAMESPACE_SVG, XML_X, sStringBuffer.makeStringAndClear());
2831 
2832                 GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aPosition.Y * 100 ) );
2833                 AddAttribute(XML_NAMESPACE_SVG, XML_Y, sStringBuffer.makeStringAndClear());
2834 
2835                 RealSize2D aSize( xAnnotation->getSize() );
2836 
2837                 if( aSize.Width || aSize.Height )
2838                 {
2839                     GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aSize.Width * 100 ) );
2840                     AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, sStringBuffer.makeStringAndClear());
2841                     GetMM100UnitConverter().convertMeasure(sStringBuffer, static_cast<sal_Int32>( aSize.Height * 100 ) );
2842                     AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, sStringBuffer.makeStringAndClear());
2843                 }
2844 
2845                 // annotation element + content
2846                 SvXMLElementExport aElem(*this, XML_NAMESPACE_OFFICE_EXT, XML_ANNOTATION, sal_False, sal_True);
2847 
2848                 // author
2849                 OUString aAuthor( xAnnotation->getAuthor() );
2850                 if( aAuthor.getLength() )
2851                 {
2852                     SvXMLElementExport aCreatorElem( *this, XML_NAMESPACE_DC, XML_CREATOR, sal_True, sal_False );
2853                     this->Characters(aAuthor);
2854                 }
2855 
2856                 {
2857                     // date time
2858                     DateTime aDate( xAnnotation->getDateTime() );
2859                     GetMM100UnitConverter().convertDateTime(sStringBuffer, aDate, sal_True);
2860                     SvXMLElementExport aDateElem( *this, XML_NAMESPACE_DC, XML_DATE, sal_True, sal_False );
2861                     Characters(sStringBuffer.makeStringAndClear());
2862                 }
2863 
2864                 com::sun::star::uno::Reference < com::sun::star::text::XText > xText( xAnnotation->getTextRange() );
2865                 if( xText.is() )
2866                     this->GetTextParagraphExport()->exportText( xText );
2867             }
2868             while( xAnnotationEnumeration->hasMoreElements() );
2869         }
2870     }
2871     catch( Exception& )
2872     {
2873         DBG_ERROR("SdXMLExport::exportAnnotations(), exception caught during export of annotations");
2874     }
2875 }
2876 
2877 //////////////////////////////////////////////////////////////////////////////
2878 
2879 #define SERVICE( classname, servicename, implementationname, draw, flags )\
2880 uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw()\
2881 {\
2882     const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( servicename ) );\
2883     const uno::Sequence< OUString > aSeq( &aServiceName, 1 );\
2884     return aSeq;\
2885 }\
2886 OUString SAL_CALL classname##_getImplementationName() throw()\
2887 {\
2888     return OUString( RTL_CONSTASCII_USTRINGPARAM( implementationname ) );\
2889 }\
2890 uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr)\
2891 {\
2892     return (cppu::OWeakObject*)new SdXMLExport( rSMgr, draw, flags );\
2893 }
2894 
2895 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 );
2896 SERVICE( XMLImpressStylesExportOasis, "com.sun.star.comp.Impress.XMLOasisStylesExporter", "XMLImpressStylesExportOasis", sal_False, EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
2897 SERVICE( XMLImpressContentExportOasis, "com.sun.star.comp.Impress.XMLOasisContentExporter", "XMLImpressContentExportOasis", sal_False, EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
2898 SERVICE( XMLImpressMetaExportOasis, "com.sun.star.comp.Impress.XMLOasisMetaExporter", "XMLImpressMetaExportOasis", sal_False, EXPORT_OASIS|EXPORT_META );
2899 SERVICE( XMLImpressSettingsExportOasis, "com.sun.star.comp.Impress.XMLOasisSettingsExporter", "XMLImpressSettingsExportOasis", sal_False, EXPORT_OASIS|EXPORT_SETTINGS );
2900 
2901 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 );
2902 SERVICE( XMLImpressStylesExportOOO, "com.sun.star.comp.Impress.XMLStylesExporter", "XMLImpressStylesExportOOO", sal_False, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
2903 SERVICE( XMLImpressContentExportOOO, "com.sun.star.comp.Impress.XMLContentExporter", "XMLImpressContentExportOOO", sal_False, EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
2904 SERVICE( XMLImpressMetaExportOOO, "com.sun.star.comp.Impress.XMLMetaExporter", "XMLImpressMetaExportOOO", sal_False, EXPORT_META );
2905 SERVICE( XMLImpressSettingsExportOOO, "com.sun.star.comp.Impress.XMLSettingsExporter", "XMLImpressSettingsExportOOO", sal_False, EXPORT_SETTINGS );
2906 
2907 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 );
2908 SERVICE( XMLDrawStylesExportOasis, "com.sun.star.comp.Draw.XMLOasisStylesExporter", "XMLDrawStylesExportOasis", sal_True, EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
2909 SERVICE( XMLDrawContentExportOasis, "com.sun.star.comp.Draw.XMLOasisContentExporter", "XMLDrawContentExportOasis", sal_True, EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
2910 SERVICE( XMLDrawMetaExportOasis, "com.sun.star.comp.Draw.XMLOasisMetaExporter", "XMLDrawMetaExportOasis", sal_True, EXPORT_OASIS|EXPORT_META );
2911 SERVICE( XMLDrawSettingsExportOasis, "com.sun.star.comp.Draw.XMLOasisSettingsExporter", "XMLDrawSettingsExportOasis", sal_True, EXPORT_OASIS|EXPORT_SETTINGS );
2912 
2913 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 );
2914 SERVICE( XMLDrawStylesExportOOO, "com.sun.star.comp.Draw.XMLStylesExporter", "XMLDrawStylesExportOOO", sal_True, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES );
2915 SERVICE( XMLDrawContentExportOOO, "com.sun.star.comp.Draw.XMLContentExporter", "XMLDrawContentExportOOO", sal_True, EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
2916 SERVICE( XMLDrawMetaExportOOO, "com.sun.star.comp.Draw.XMLMetaExporter", "XMLDrawMetaExportOOO", sal_True, EXPORT_META );
2917 SERVICE( XMLDrawSettingsExportOOO, "com.sun.star.comp.Draw.XMLSettingsExporter", "XMLDrawSettingsExportOOO", sal_True, EXPORT_SETTINGS );
2918 
2919 SERVICE( XMLDrawingLayerExport, "com.sun.star.comp.DrawingLayer.XMLExporter", "XMLDrawingLayerExport", sal_True, EXPORT_OASIS|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
2920 SERVICE( XMLImpressClipboardExport, "com.sun.star.comp.Impress.XMLClipboardExporter", "XMLImpressClipboardExport", sal_False, EXPORT_OASIS|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
2921 
2922 // XServiceInfo
getImplementationName()2923 OUString SAL_CALL SdXMLExport::getImplementationName()
2924 {
2925     if( IsDraw())
2926     {
2927         // Draw
2928 
2929         switch( getExportFlags())
2930         {
2931             case EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
2932                 return XMLDrawExportOOO_getImplementationName();
2933             case EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
2934                 return XMLDrawStylesExportOOO_getImplementationName();
2935             case EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
2936                 return XMLDrawContentExportOOO_getImplementationName();
2937             case EXPORT_META:
2938                 return XMLDrawMetaExportOOO_getImplementationName();
2939             case EXPORT_SETTINGS:
2940                 return XMLDrawSettingsExportOOO_getImplementationName();
2941 
2942             case EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
2943                 return XMLDrawExportOasis_getImplementationName();
2944             case EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
2945                 return XMLDrawStylesExportOasis_getImplementationName();
2946             case EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
2947                 return XMLDrawContentExportOasis_getImplementationName();
2948             case EXPORT_OASIS|EXPORT_META:
2949                 return XMLDrawMetaExportOasis_getImplementationName();
2950             case EXPORT_OASIS|EXPORT_SETTINGS:
2951                 return XMLDrawSettingsExportOasis_getImplementationName();
2952 
2953             default:
2954                 return XMLDrawExportOOO_getImplementationName();
2955         }
2956     }
2957     else
2958     {
2959         // Impress
2960 
2961         switch( getExportFlags())
2962         {
2963             case EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
2964                 return XMLImpressExportOOO_getImplementationName();
2965             case EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
2966                 return XMLImpressStylesExportOOO_getImplementationName();
2967             case EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
2968                 return XMLImpressContentExportOOO_getImplementationName();
2969             case EXPORT_META:
2970                 return XMLImpressMetaExportOOO_getImplementationName();
2971             case EXPORT_SETTINGS:
2972                 return XMLImpressSettingsExportOOO_getImplementationName();
2973             case EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED:
2974                 return XMLImpressExportOasis_getImplementationName();
2975             case EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES:
2976                 return XMLImpressStylesExportOasis_getImplementationName();
2977             case EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS:
2978                 return XMLImpressContentExportOasis_getImplementationName();
2979             case EXPORT_OASIS|EXPORT_META:
2980                 return XMLImpressMetaExportOasis_getImplementationName();
2981             case EXPORT_OASIS|EXPORT_SETTINGS:
2982                 return XMLImpressSettingsExportOasis_getImplementationName();
2983 
2984             default:
2985                 return XMLImpressExportOOO_getImplementationName();
2986         }
2987     }
2988 }
2989