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