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 <boost/unordered_map.hpp>
30 : : #include <boost/foreach.hpp>
31 : : #include <stdio.h>
32 : : #include <oox/drawingml/chart/chartconverter.hxx>
33 : : #include <oox/token/tokens.hxx>
34 : : #include <oox/ole/vbaproject.hxx>
35 : : #include <epptooxml.hxx>
36 : : #include <epptdef.hxx>
37 : : #include <oox/export/shapes.hxx>
38 : :
39 : : #include <cppuhelper/implementationentry.hxx>
40 : : #include <cppuhelper/factory.hxx>
41 : : #include <sax/fshelper.hxx>
42 : : #include <rtl/ustrbuf.hxx>
43 : : #include <filter/msfilter/escherex.hxx>
44 : : #include <tools/poly.hxx>
45 : :
46 : : #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
47 : : #include <com/sun/star/animations/AnimationCalcMode.hpp>
48 : : #include <com/sun/star/animations/AnimationFill.hpp>
49 : : #include <com/sun/star/animations/AnimationNodeType.hpp>
50 : : #include <com/sun/star/animations/AnimationRestart.hpp>
51 : : #include <com/sun/star/animations/AnimationValueType.hpp>
52 : : #include <com/sun/star/animations/Event.hpp>
53 : : #include <com/sun/star/animations/EventTrigger.hpp>
54 : : #include <com/sun/star/animations/Timing.hpp>
55 : : #include <com/sun/star/animations/ValuePair.hpp>
56 : : #include <com/sun/star/animations/XAnimateSet.hpp>
57 : : #include <com/sun/star/animations/XAnimationNode.hpp>
58 : : #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
59 : : #include <com/sun/star/animations/XTransitionFilter.hpp>
60 : : #include <com/sun/star/beans/Property.hpp>
61 : : #include <com/sun/star/beans/XPropertySetInfo.hpp>
62 : : #include <com/sun/star/container/XEnumerationAccess.hpp>
63 : : #include <com/sun/star/drawing/FillStyle.hpp>
64 : : #include <com/sun/star/drawing/RectanglePoint.hpp>
65 : : #include <com/sun/star/geometry/RealPoint2D.hpp>
66 : : #include <com/sun/star/office/XAnnotationEnumeration.hpp>
67 : : #include <com/sun/star/office/XAnnotationAccess.hpp>
68 : : #include <com/sun/star/presentation/AnimationSpeed.hpp>
69 : : #include <com/sun/star/presentation/EffectNodeType.hpp>
70 : : #include <com/sun/star/text/XSimpleText.hpp>
71 : : #include <com/sun/star/util/DateTime.hpp>
72 : :
73 : : #include <oox/export/utils.hxx>
74 : :
75 : : #include "pptexanimations.hxx"
76 : :
77 : : // presentation namespaces
78 : : #define PNMSS FSNS( XML_xmlns, XML_a ), "http://schemas.openxmlformats.org/drawingml/2006/main", \
79 : : FSNS( XML_xmlns, XML_p ), "http://schemas.openxmlformats.org/presentationml/2006/main", \
80 : : FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
81 : :
82 : : using ::rtl::OString;
83 : : using ::rtl::OUString;
84 : : using ::rtl::OUStringBuffer;
85 : : using namespace ::com::sun::star;
86 : : using namespace ::com::sun::star::animations;
87 : : using namespace ::com::sun::star::beans;
88 : : using namespace ::com::sun::star::container;
89 : : using namespace ::com::sun::star::drawing;
90 : : using namespace ::com::sun::star::geometry;
91 : : using namespace ::com::sun::star::presentation;
92 : : using namespace ::com::sun::star::office;
93 : : using namespace ::com::sun::star::text;
94 : : using namespace ::com::sun::star::uno;
95 : : using namespace ::com::sun::star::util;
96 : : using namespace ::ppt;
97 : : using ::com::sun::star::beans::XPropertySet;
98 : : using ::com::sun::star::beans::XPropertySetInfo;
99 : : using ::com::sun::star::lang::XMultiServiceFactory;
100 : : using ::com::sun::star::container::XIndexAccess;
101 : : using ::com::sun::star::frame::XModel;
102 : : using ::com::sun::star::io::XOutputStream;
103 : : using ::com::sun::star::task::XStatusIndicator;
104 : : using ::com::sun::star::text::XSimpleText;
105 : : using ::sax_fastparser::FastSerializerHelper;
106 : : using ::sax_fastparser::FSHelperPtr;
107 : :
108 : : void dump_pset(Reference< XPropertySet > rXPropSet);
109 : :
110 : : #define IDS(x) (OString(#x " ") + OString::valueOf( mnShapeIdMax++ )).getStr()
111 : :
112 : : namespace oox {
113 : : using namespace drawingml;
114 : : namespace core {
115 : :
116 [ # # ]: 0 : class PowerPointShapeExport : public ShapeExport
117 : : {
118 : : PowerPointExport& mrExport;
119 : : PageType mePageType;
120 : : sal_Bool mbMaster;
121 : : public:
122 : : PowerPointShapeExport( FSHelperPtr pFS, ShapeHashMap* pShapeMap, PowerPointExport* pFB );
123 : : void SetMaster( sal_Bool bMaster );
124 : : void SetPageType( PageType ePageType );
125 : : ShapeExport& WriteNonVisualProperties( Reference< XShape > xShape );
126 : : ShapeExport& WriteTextShape( Reference< XShape > xShape );
127 : : ShapeExport& WriteUnknownShape( Reference< XShape > xShape );
128 : : ShapeExport& WritePlaceholderShape( Reference< XShape > xShape, PlaceholderType ePlaceholder );
129 : : ShapeExport& WritePageShape( Reference< XShape > xShape, PageType ePageType, sal_Bool bPresObj );
130 : :
131 : : // helper parts
132 : : sal_Bool WritePlaceholder( Reference< XShape > xShape, PlaceholderType ePlaceholder, sal_Bool bMaster );
133 : : };
134 : :
135 : : enum PPTXLayout {
136 : : LAYOUT_BLANK,
137 : : LAYOUT_TITLE_SLIDE,
138 : : LAYOUT_TITLE_CONTENT,
139 : : LAYOUT_TITLE_2CONTENT,
140 : : LAYOUT_TITLE,
141 : : LAYOUT_CENTERED_TEXT,
142 : : LAYOUT_TITLE_2CONTENT_CONTENT,
143 : : LAYOUT_TITLE_CONTENT_2CONTENT,
144 : : LAYOUT_TITLE_2CONTENT_OVER_CONTENT,
145 : : LAYOUT_TITLE_CONTENT_OVER_CONTENT,
146 : : LAYOUT_TITLE_4CONTENT,
147 : : LAYOUT_TITLE_6CONTENT,
148 : : LAYOUT_SIZE
149 : : };
150 : :
151 : : struct PPTXLayoutInfo {
152 : : int nType;
153 : : const char* sName;
154 : : const char* sType;
155 : : };
156 : :
157 : : static PPTXLayoutInfo aLayoutInfo[LAYOUT_SIZE] = {
158 : : { 20, "Blank Slide", "blank" },
159 : : { 0, "Title Slide", "tx" },
160 : : { 1, "Title, Content", "obj" },
161 : : { 3, "Title, 2 Content", "twoObj" },
162 : : { 19, "Title Only", "titleOnly" },
163 : : { 32, "Centered Text", "objOnly" }, // not exactly, but close
164 : : { 15, "Title, 2 Content and Content", "twoObjAndObj" },
165 : : { 12, "Title Content and 2 Content", "objAndTwoObj" },
166 : : { 16, "Title, 2 Content over Content", "twoObjOverTx" }, // not exactly, but close
167 : : { 14, "Title, Content over Content", "objOverTx" }, // not exactly, but close
168 : : { 18, "Title, 4 Content", "fourObj" },
169 : : { 33, "Title, 6 Content", "blank" } // not defined => blank
170 : : };
171 : :
172 : 0 : int PowerPointExport::GetPPTXLayoutId( int nOffset )
173 : : {
174 : 0 : int nId = LAYOUT_BLANK;
175 : :
176 : : DBG(printf("GetPPTXLayoutId %d\n", nOffset));
177 : :
178 [ # # # # : 0 : switch( nOffset ) {
# # # # #
# # # ]
179 : : case 0:
180 : 0 : nId = LAYOUT_TITLE_SLIDE;
181 : 0 : break;
182 : : case 1:
183 : 0 : nId = LAYOUT_TITLE_CONTENT;
184 : 0 : break;
185 : : case 3:
186 : 0 : nId = LAYOUT_TITLE_2CONTENT;
187 : 0 : break;
188 : : case 19:
189 : 0 : nId = LAYOUT_TITLE;
190 : 0 : break;
191 : : case 15:
192 : 0 : nId = LAYOUT_TITLE_2CONTENT_CONTENT;
193 : 0 : break;
194 : : case 12:
195 : 0 : nId = LAYOUT_TITLE_CONTENT_2CONTENT;
196 : 0 : break;
197 : : case 16:
198 : 0 : nId = LAYOUT_TITLE_2CONTENT_OVER_CONTENT;
199 : 0 : break;
200 : : case 14:
201 : 0 : nId = LAYOUT_TITLE_CONTENT_OVER_CONTENT;
202 : 0 : break;
203 : : case 18:
204 : 0 : nId = LAYOUT_TITLE_4CONTENT;
205 : 0 : break;
206 : : case 32:
207 : 0 : nId = LAYOUT_CENTERED_TEXT;
208 : 0 : break;
209 : : case 33:
210 : 0 : nId = LAYOUT_TITLE_6CONTENT;
211 : 0 : break;
212 : : case 20:
213 : : default:
214 : 0 : nId = LAYOUT_BLANK;
215 : 0 : break;
216 : : }
217 : :
218 : 0 : return nId;
219 : : }
220 : :
221 : 0 : PowerPointShapeExport::PowerPointShapeExport( FSHelperPtr pFS, ShapeHashMap* pShapeMap, PowerPointExport* pFB )
222 : : : ShapeExport( XML_p, pFS, pShapeMap, pFB )
223 [ # # ]: 0 : , mrExport( *pFB )
224 : : {
225 : 0 : }
226 : :
227 : 0 : void PowerPointShapeExport::SetMaster( sal_Bool bMaster )
228 : : {
229 : 0 : mbMaster = bMaster;
230 : 0 : }
231 : :
232 : 0 : void PowerPointShapeExport::SetPageType( PageType ePageType )
233 : : {
234 : 0 : mePageType = ePageType;
235 : 0 : }
236 : :
237 : 0 : ShapeExport& PowerPointShapeExport::WriteNonVisualProperties( Reference< XShape > )
238 : : {
239 [ # # ]: 0 : GetFS()->singleElementNS( XML_p, XML_nvPr, FSEND );
240 : :
241 : 0 : return *this;
242 : : }
243 : :
244 : 0 : ShapeExport& PowerPointShapeExport::WriteTextShape( Reference< XShape > xShape )
245 : : {
246 [ # # ][ # # ]: 0 : OUString sShapeType = xShape->getShapeType();
247 : :
248 : : DBG(printf( "shape(text): %s\n", USS(sShapeType) ));
249 : :
250 [ # # ]: 0 : if ( sShapeType == "com.sun.star.drawing.TextShape" )
251 : : {
252 [ # # ]: 0 : ShapeExport::WriteTextShape( xShape );
253 : : }
254 [ # # ]: 0 : else if ( sShapeType == "com.sun.star.presentation.DateTimeShape" )
255 : : {
256 [ # # ][ # # ]: 0 : if( !WritePlaceholder( xShape, DateAndTime, mbMaster ) )
257 [ # # ]: 0 : ShapeExport::WriteTextShape( xShape );
258 : : }
259 [ # # ]: 0 : else if ( sShapeType == "com.sun.star.presentation.FooterShape" )
260 : : {
261 [ # # ][ # # ]: 0 : if( !WritePlaceholder( xShape, Footer, mbMaster ) )
262 [ # # ]: 0 : ShapeExport::WriteTextShape( xShape );
263 : : }
264 [ # # ]: 0 : else if ( sShapeType == "com.sun.star.presentation.HeaderShape" )
265 : : {
266 [ # # ][ # # ]: 0 : if( !WritePlaceholder( xShape, Header, mbMaster ) )
267 [ # # ]: 0 : ShapeExport::WriteTextShape( xShape );
268 : : }
269 [ # # ]: 0 : else if ( sShapeType == "com.sun.star.presentation.NotesShape" )
270 : : {
271 [ # # ][ # # ]: 0 : if( mePageType == NOTICE && mrExport.GetPresObj() )
[ # # ]
272 [ # # ]: 0 : WritePlaceholderShape( xShape, Notes );
273 : : else
274 [ # # ]: 0 : ShapeExport::WriteTextShape( xShape );
275 : : }
276 [ # # ]: 0 : else if ( sShapeType == "com.sun.star.presentation.OutlinerShape" )
277 : : {
278 [ # # ][ # # ]: 0 : if( !WritePlaceholder( xShape, Outliner, mbMaster ) )
279 [ # # ]: 0 : ShapeExport::WriteTextShape( xShape );
280 : : }
281 [ # # ]: 0 : else if ( sShapeType == "com.sun.star.presentation.SlideNumberShape" )
282 : : {
283 [ # # ][ # # ]: 0 : if( !WritePlaceholder( xShape, SlideNumber, mbMaster ) )
284 [ # # ]: 0 : ShapeExport::WriteTextShape( xShape );
285 : : }
286 [ # # ]: 0 : else if ( sShapeType == "com.sun.star.presentation.TitleTextShape" )
287 : : {
288 [ # # ][ # # ]: 0 : if( !WritePlaceholder( xShape, Title, mbMaster ) )
289 [ # # ]: 0 : ShapeExport::WriteTextShape( xShape );
290 : : }
291 : :
292 : 0 : return *this;
293 : : }
294 : :
295 : 0 : ShapeExport& PowerPointShapeExport::WriteUnknownShape( Reference< XShape > xShape )
296 : : {
297 [ # # ][ # # ]: 0 : OUString sShapeType = xShape->getShapeType();
298 : :
299 : : DBG(printf( "shape(unknown): %s\n", USS(sShapeType) ));
300 : :
301 [ # # ]: 0 : if ( sShapeType == "com.sun.star.drawing.GroupShape" )
302 : : {
303 [ # # ]: 0 : Reference< XIndexAccess > rXIndexAccess( xShape, UNO_QUERY );
304 : :
305 [ # # ]: 0 : mrExport.EnterGroup( rXIndexAccess );
306 : 0 : DBG(printf( "enter group\n" ));
307 : : }
308 [ # # ]: 0 : else if ( sShapeType == "com.sun.star.drawing.PageShape" )
309 : : {
310 [ # # ]: 0 : WritePageShape( xShape, mePageType, mrExport.GetPresObj() );
311 : : }
312 [ # # ]: 0 : else if ( sShapeType == "com.sun.star.presentation.SubtitleShape" )
313 : : {
314 [ # # ][ # # ]: 0 : if( !WritePlaceholder( xShape, Subtitle, mbMaster ) )
315 [ # # ]: 0 : ShapeExport::WriteTextShape( xShape );
316 : : }
317 : :
318 : 0 : return *this;
319 : : }
320 : :
321 : 0 : PowerPointExport::PowerPointExport( const Reference< XComponentContext > & rxCtxt )
322 : : : XmlFilterBase( rxCtxt ),
323 : : PPTWriterBase(),
324 : : mnLayoutFileIdMax( 1 ),
325 : : mnSlideIdMax( 1 << 8 ),
326 : : mnSlideMasterIdMax( 1 << 31 ),
327 [ # # ][ # # ]: 0 : mnAnimationNodeIdMax( 1 )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
[ # # # # ]
328 : : {
329 : 0 : memset( mLayoutInfo, 0, sizeof(mLayoutInfo) );
330 [ # # # # ]: 0 : }
331 : :
332 [ # # ][ # # ]: 0 : PowerPointExport::~PowerPointExport()
[ # # ][ # # ]
[ # # ]
333 : : {
334 [ # # ]: 0 : }
[ # # # # ]
[ # # # # ]
335 : :
336 : 0 : bool PowerPointExport::importDocument() throw()
337 : : {
338 : 0 : return false;
339 : : }
340 : :
341 : 0 : bool PowerPointExport::exportDocument() throw()
342 : : {
343 [ # # ]: 0 : DrawingML::ResetCounters();
344 [ # # ]: 0 : maShapeMap.clear ();
345 : :
346 [ # # ][ # # ]: 0 : addRelation( US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" ), S( "ppt/presentation.xml" ) );
[ # # ][ # # ]
[ # # ]
347 : :
348 : : mPresentationFS = openFragmentStreamWithSerializer( US( "ppt/presentation.xml" ),
349 [ # # ][ # # ]: 0 : US( "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml" ) );
[ # # ][ # # ]
[ # # ]
350 : :
351 : : addRelation( mPresentationFS->getOutputStream(),
352 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" ),
353 [ # # ][ # # ]: 0 : US( "theme/theme1.xml" ) );
[ # # ][ # # ]
354 : :
355 [ # # ]: 0 : mPresentationFS->startElementNS( XML_p, XML_presentation, PNMSS, FSEND );
356 : :
357 [ # # ][ # # ]: 0 : mXModel.set( getModel(), UNO_QUERY );
358 [ # # ][ # # ]: 0 : mXStatusIndicator.set( getStatusIndicator(), UNO_QUERY );
359 : :
360 : 0 : rtl::OUString sBaseURI( "BaseURI");
361 [ # # ]: 0 : std::vector< PropertyValue > aProperties;
362 : 0 : PropertyValue aProperty;
363 : 0 : aProperty.Name = sBaseURI;
364 [ # # ][ # # ]: 0 : aProperty.Value = makeAny( getFileUrl() );
365 [ # # ]: 0 : aProperties.push_back( aProperty );
366 : :
367 [ # # ]: 0 : exportPPT(aProperties);
368 : :
369 : : mPresentationFS->singleElementNS( XML_p, XML_sldSz,
370 : : XML_cx, IS( PPTtoEMU( maDestPageSize.Width ) ),
371 : : XML_cy, IS( PPTtoEMU( maDestPageSize.Height ) ),
372 [ # # ]: 0 : FSEND );
373 : : // for some reason if added before slides list it will not load the slides (alas with error reports) in mso
374 : : mPresentationFS->singleElementNS( XML_p, XML_notesSz,
375 : : XML_cx, IS( PPTtoEMU( maNotesPageSize.Width ) ),
376 : : XML_cy, IS( PPTtoEMU( maNotesPageSize.Height ) ),
377 [ # # ]: 0 : FSEND );
378 : :
379 [ # # ]: 0 : WriteAuthors();
380 : :
381 [ # # ]: 0 : mPresentationFS->endElementNS( XML_p, XML_presentation );
382 [ # # ]: 0 : mPresentationFS.reset();
383 : :
384 [ # # ]: 0 : commitStorage();
385 : :
386 [ # # ]: 0 : maShapeMap.clear();
387 [ # # ]: 0 : maAuthors.clear();
388 : :
389 : 0 : return true;
390 : : }
391 : :
392 : 0 : ::oox::ole::VbaProject* PowerPointExport::implCreateVbaProject() const
393 : : {
394 [ # # ][ # # ]: 0 : return new ::oox::ole::VbaProject( getComponentContext(), getModel(), "Impress" );
395 : : }
396 : :
397 : 0 : void PowerPointExport::ImplWriteBackground( FSHelperPtr pFS, Reference< XPropertySet > rXPropSet )
398 : : {
399 : 0 : FillStyle aFillStyle( FillStyle_NONE );
400 [ # # ][ # # ]: 0 : if ( ImplGetPropertyValue( rXPropSet, S( "FillStyle" ) ) )
[ # # ][ # # ]
401 [ # # ]: 0 : mAny >>= aFillStyle;
402 : :
403 [ # # ][ # # ]: 0 : if( aFillStyle == FillStyle_NONE ||
[ # # ]
404 : : aFillStyle == FillStyle_GRADIENT ||
405 : : aFillStyle == FillStyle_HATCH )
406 : 0 : return;
407 : :
408 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_bg, FSEND );
409 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_bgPr, FSEND );
410 : :
411 [ # # ][ # # ]: 0 : PowerPointShapeExport( pFS, &maShapeMap, this ).WriteFill( rXPropSet );
[ # # ][ # # ]
[ # # ]
412 : :
413 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_bgPr );
414 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_bg );
415 : : }
416 : :
417 : : #define MINIMAL_SPTREE "<p:spTree>\
418 : : <p:nvGrpSpPr>\
419 : : <p:cNvPr id=\"1\" name=\"\"/>\
420 : : <p:cNvGrpSpPr/>\
421 : : <p:nvPr/>\
422 : : </p:nvGrpSpPr>\
423 : : <p:grpSpPr>\
424 : : <a:xfrm>\
425 : : <a:off x=\"0\" y=\"0\"/>\
426 : : <a:ext cx=\"0\" cy=\"0\"/>\
427 : : <a:chOff x=\"0\" y=\"0\"/>\
428 : : <a:chExt cx=\"0\" cy=\"0\"/>\
429 : : </a:xfrm>\
430 : : </p:grpSpPr>\
431 : : </p:spTree>"
432 : :
433 : : #define MAIN_GROUP \
434 : : "<p:nvGrpSpPr>\
435 : : <p:cNvPr id=\"1\" name=\"\"/>\
436 : : <p:cNvGrpSpPr/>\
437 : : <p:nvPr/>\
438 : : </p:nvGrpSpPr>\
439 : : <p:grpSpPr>\
440 : : <a:xfrm>\
441 : : <a:off x=\"0\" y=\"0\"/>\
442 : : <a:ext cx=\"0\" cy=\"0\"/>\
443 : : <a:chOff x=\"0\" y=\"0\"/>\
444 : : <a:chExt cx=\"0\" cy=\"0\"/>\
445 : : </a:xfrm>\
446 : : </p:grpSpPr>"
447 : :
448 : : #define GETA(propName) \
449 : : ImplGetPropertyValue( mXPagePropSet, rtl::OUString( #propName ) )
450 : :
451 : : #define GET(variable, propName) \
452 : : if ( GETA(propName) ) \
453 : : mAny >>= variable;
454 : :
455 : 0 : const char* PowerPointExport::GetSideDirection( sal_uInt8 nDirection )
456 : : {
457 : 0 : const char* pDirection = NULL;
458 : :
459 [ # # # # : 0 : switch( nDirection ) {
# ]
460 : : case 0:
461 : 0 : pDirection = "r";
462 : 0 : break;
463 : : case 1:
464 : 0 : pDirection = "d";
465 : 0 : break;
466 : : case 2:
467 : 0 : pDirection = "l";
468 : 0 : break;
469 : : case 3:
470 : 0 : pDirection = "u";
471 : 0 : break;
472 : : }
473 : :
474 : 0 : return pDirection;
475 : : }
476 : :
477 : 0 : const char* PowerPointExport::GetCornerDirection( sal_uInt8 nDirection )
478 : : {
479 : 0 : const char* pDirection = NULL;
480 : :
481 [ # # # # : 0 : switch( nDirection ) {
# ]
482 : : case 4:
483 : 0 : pDirection = "rd";
484 : 0 : break;
485 : : case 5:
486 : 0 : pDirection = "ld";
487 : 0 : break;
488 : : case 6:
489 : 0 : pDirection = "ru";
490 : 0 : break;
491 : : case 7:
492 : 0 : pDirection = "lu";
493 : 0 : break;
494 : : }
495 : :
496 : 0 : return pDirection;
497 : : }
498 : :
499 : 0 : const char* PowerPointExport::Get8Direction( sal_uInt8 nDirection )
500 : : {
501 : 0 : const char* pDirection = GetSideDirection( nDirection );
502 : :
503 [ # # ]: 0 : if( !pDirection )
504 : 0 : pDirection = GetCornerDirection( nDirection );
505 : :
506 : 0 : return pDirection;
507 : : }
508 : :
509 : 0 : void PowerPointExport::WriteTransition( FSHelperPtr pFS )
510 : : {
511 : 0 : FadeEffect eFadeEffect = FadeEffect_NONE;
512 [ # # ][ # # ]: 0 : GET( eFadeEffect, Effect );
[ # # ][ # # ]
[ # # ]
513 : :
514 : : OSL_TRACE("fade effect %d", eFadeEffect);
515 : :
516 : 0 : sal_Int16 nTransitionType = 0, nTransitionSubtype = 0;
517 : 0 : sal_Int8 nPPTTransitionType = 0;
518 : 0 : sal_uInt8 nDirection = 0;
519 : :
520 [ # # ][ # # ]: 0 : if( GETA( TransitionType ) && ( mAny >>= nTransitionType ) &&
[ # # ][ # # ]
[ # # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # # # ]
521 [ # # ][ # # ]: 0 : GETA( TransitionSubtype ) && ( mAny >>= nTransitionSubtype ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # ]
522 [ # # ]: 0 : nPPTTransitionType = GetTransition( nTransitionType, nTransitionSubtype, eFadeEffect, nDirection );
523 : :
524 [ # # ][ # # ]: 0 : if( !nPPTTransitionType && eFadeEffect != FadeEffect_NONE )
525 [ # # ]: 0 : nPPTTransitionType = GetTransition( eFadeEffect, nDirection );
526 : :
527 [ # # ]: 0 : if( nPPTTransitionType ) {
528 : 0 : AnimationSpeed animationSpeed = AnimationSpeed_MEDIUM;
529 : 0 : const char* speed = NULL;
530 : 0 : sal_Int32 advanceTiming = -1;
531 : 0 : sal_Int32 changeType = 0;
532 : :
533 [ # # ][ # # ]: 0 : if( GETA( Speed ) ) {
[ # # ][ # # ]
534 [ # # ]: 0 : mAny >>= animationSpeed;
535 : :
536 [ # # # ]: 0 : switch( animationSpeed ) {
537 : : default:
538 : : case AnimationSpeed_MEDIUM:
539 : 0 : speed = "med";
540 : 0 : break;
541 : : case AnimationSpeed_SLOW:
542 : 0 : speed = "slow";
543 : 0 : break;
544 : : case AnimationSpeed_FAST:
545 : 0 : break;
546 : : }
547 : : }
548 : :
549 [ # # ][ # # ]: 0 : if( GETA( Change ) )
[ # # ][ # # ]
550 : 0 : mAny >>= changeType;
551 : :
552 : : // 1 means automatic, 2 half automatic - not sure what it means - at least I don't see it in UI
553 [ # # ][ # # ]: 0 : if( changeType == 1 && GETA( Duration ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # # # ]
554 : 0 : mAny >>= advanceTiming;
555 : :
556 : : pFS->startElementNS( XML_p, XML_transition,
557 : : XML_spd, speed,
558 [ # # ][ # # ]: 0 : XML_advTm, advanceTiming != -1 ? I32S( advanceTiming*1000 ) : NULL,
559 [ # # ][ # # ]: 0 : FSEND );
560 : :
561 : 0 : sal_Int32 nTransition = 0;
562 : 0 : const char* pDirection = NULL;
563 : 0 : const char* pOrientation = NULL;
564 : 0 : const char* pThruBlk = NULL;
565 : 0 : const char* pSpokes = NULL;
566 : 0 : char pSpokesTmp[2] = "0";
567 : :
568 [ # # # # : 0 : switch( nPPTTransitionType ) {
# # # # #
# # # # #
# # # # #
# # # ]
569 : : case PPT_TRANSITION_TYPE_BLINDS:
570 : 0 : nTransition = XML_blinds;
571 [ # # ]: 0 : pDirection = ( nDirection == 0) ? "vert" : "horz";
572 : 0 : break;
573 : : case PPT_TRANSITION_TYPE_CHECKER:
574 : 0 : nTransition = XML_checker;
575 [ # # ]: 0 : pDirection = ( nDirection == 1) ? "vert" : "horz";
576 : 0 : break;
577 : : case PPT_TRANSITION_TYPE_CIRCLE:
578 : 0 : nTransition = XML_circle;
579 : 0 : break;
580 : : case PPT_TRANSITION_TYPE_COMB:
581 : 0 : nTransition = XML_comb;
582 [ # # ]: 0 : pDirection = ( nDirection == 1) ? "vert" : "horz";
583 : 0 : break;
584 : : case PPT_TRANSITION_TYPE_COVER:
585 : 0 : nTransition = XML_cover;
586 : 0 : pDirection = Get8Direction( nDirection );
587 : 0 : break;
588 : : case PPT_TRANSITION_TYPE_DIAMOND:
589 : 0 : nTransition = XML_diamond;
590 : 0 : break;
591 : : case PPT_TRANSITION_TYPE_DISSOLVE:
592 : 0 : nTransition = XML_dissolve;
593 : 0 : break;
594 : : case PPT_TRANSITION_TYPE_FADE:
595 : 0 : nTransition = XML_fade;
596 : 0 : pThruBlk = "true";
597 : 0 : break;
598 : : case PPT_TRANSITION_TYPE_SMOOTHFADE:
599 : 0 : nTransition = XML_fade;
600 : 0 : break;
601 : : case PPT_TRANSITION_TYPE_NEWSFLASH:
602 : 0 : nTransition = XML_newsflash;
603 : 0 : break;
604 : : case PPT_TRANSITION_TYPE_PLUS:
605 : 0 : nTransition = XML_plus;
606 : 0 : break;
607 : : case PPT_TRANSITION_TYPE_PULL:
608 : 0 : nTransition = XML_pull;
609 : 0 : pDirection = Get8Direction( nDirection );
610 : 0 : break;
611 : : case PPT_TRANSITION_TYPE_PUSH:
612 : 0 : nTransition = XML_push;
613 : 0 : pDirection = GetSideDirection( nDirection );
614 : 0 : break;
615 : : case PPT_TRANSITION_TYPE_RANDOM:
616 : 0 : nTransition = XML_random;
617 : 0 : break;
618 : : case PPT_TRANSITION_TYPE_RANDOM_BARS:
619 : 0 : nTransition = XML_randomBar;
620 [ # # ]: 0 : pDirection = ( nDirection == 1) ? "vert" : "horz";
621 : 0 : break;
622 : : case PPT_TRANSITION_TYPE_SPLIT:
623 : 0 : nTransition = XML_split;
624 [ # # ]: 0 : pDirection = ( nDirection & 1) ? "in" : "out";
625 [ # # ]: 0 : pOrientation = ( nDirection < 2) ? "horz" : "vert";
626 : 0 : break;
627 : : case PPT_TRANSITION_TYPE_STRIPS:
628 : 0 : nTransition = XML_strips;
629 : 0 : pDirection = GetCornerDirection( nDirection );
630 : 0 : break;
631 : : case PPT_TRANSITION_TYPE_WEDGE:
632 : 0 : nTransition = XML_wedge;
633 : 0 : break;
634 : : case PPT_TRANSITION_TYPE_WHEEL:
635 : 0 : nTransition = XML_wheel;
636 [ # # ][ # # ]: 0 : if( nDirection != 4 && nDirection <= 9 ) {
637 : 0 : pSpokesTmp[0] = '0' + nDirection;
638 : 0 : pSpokes = pSpokesTmp;
639 : : }
640 : 0 : break;
641 : : case PPT_TRANSITION_TYPE_WIPE:
642 : 0 : nTransition = XML_wipe;
643 : 0 : pDirection = GetSideDirection( nDirection );
644 : 0 : break;
645 : : case PPT_TRANSITION_TYPE_ZOOM:
646 : 0 : nTransition = XML_zoom;
647 [ # # ]: 0 : pDirection = ( nDirection == 1) ? "in" : "out";
648 : 0 : break;
649 : : case PPT_TRANSITION_TYPE_NONE:
650 : : default:
651 : 0 : nTransition = 0;
652 : : }
653 : :
654 [ # # ]: 0 : if( nTransition )
655 : : pFS->singleElementNS( XML_p, nTransition,
656 : : XML_dir, pDirection,
657 : : XML_orient, pOrientation,
658 : : XML_spokes, pSpokes,
659 : : XML_thruBlk, pThruBlk,
660 [ # # ]: 0 : FSEND );
661 : :
662 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_transition );
663 : : }
664 : 0 : }
665 : :
666 : 0 : void PowerPointExport::WriteAnimationProperty( FSHelperPtr pFS, const Any& rAny )
667 : : {
668 [ # # ]: 0 : if( !rAny.hasValue() )
669 : 0 : return;
670 : :
671 [ # # ]: 0 : switch( rAny.getValueType().getTypeClass() ) {
672 : : case TypeClass_STRING:
673 : : pFS->singleElementNS( XML_p, XML_strVal,
674 : 0 : XML_val, USS( *static_cast< const OUString* >( rAny.getValue() ) ),
675 [ # # ]: 0 : FSEND );
676 : 0 : break;
677 : : default:
678 : 0 : break;
679 : : }
680 : : }
681 : :
682 : 0 : void PowerPointExport::WriteAnimateValues( FSHelperPtr pFS, const Reference< XAnimate >& rXAnimate )
683 : : {
684 [ # # ][ # # ]: 0 : const Sequence< double > aKeyTimes = rXAnimate->getKeyTimes();
685 [ # # ]: 0 : if( aKeyTimes.getLength() <= 0 )
686 : 0 : return;
687 [ # # ][ # # ]: 0 : const Sequence< Any > aValues = rXAnimate->getValues();
688 [ # # ][ # # ]: 0 : const OUString& sFormula = rXAnimate->getFormula();
689 [ # # ][ # # ]: 0 : const OUString& rAttributeName = rXAnimate->getAttributeName();
690 : :
691 : : DBG(printf("animate values, formula: %s\n", USS( sFormula )));
692 : :
693 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_tavLst, FSEND );
694 : :
695 [ # # ]: 0 : for( int i = 0; i < aKeyTimes.getLength(); i++ ) {
696 : : DBG(printf("animate value %d: %f\n", i, aKeyTimes[ i ]));
697 [ # # ]: 0 : if( aValues[ i ].hasValue() ) {
698 : : pFS->startElementNS( XML_p, XML_tav,
699 [ # # ][ # # ]: 0 : XML_fmla, sFormula.isEmpty() ? NULL : USS( sFormula ),
[ # # ]
700 : 0 : XML_tm, I32S( ( sal_Int32 )( aKeyTimes[ i ]*100000.0 ) ),
701 [ # # ][ # # ]: 0 : FSEND );
702 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_val, FSEND );
703 : 0 : ValuePair aPair;
704 [ # # ][ # # ]: 0 : if( aValues[ i ] >>= aPair ) {
705 [ # # ][ # # ]: 0 : WriteAnimationProperty( pFS, AnimationExporter::convertAnimateValue( aPair.First, rAttributeName ) );
[ # # ][ # # ]
706 [ # # ][ # # ]: 0 : WriteAnimationProperty( pFS, AnimationExporter::convertAnimateValue( aPair.Second, rAttributeName ) );
[ # # ][ # # ]
707 : : } else
708 [ # # ][ # # ]: 0 : WriteAnimationProperty( pFS, AnimationExporter::convertAnimateValue( aValues[ i ], rAttributeName ) );
[ # # ][ # # ]
709 : :
710 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_val );
711 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_tav );
712 : : }
713 : : }
714 : :
715 [ # # ][ # # ]: 0 : pFS->endElementNS( XML_p, XML_tavLst );
[ # # ][ # # ]
716 : : }
717 : :
718 : 0 : void PowerPointExport::WriteAnimateTo( FSHelperPtr pFS, Any aValue, const OUString& rAttributeName )
719 : : {
720 [ # # ]: 0 : if( !aValue.hasValue() )
721 : 0 : return;
722 : :
723 : : DBG(printf("to attribute name: %s\n", USS( rAttributeName )));
724 : :
725 : 0 : pFS->startElementNS( XML_p, XML_to, FSEND );
726 : :
727 [ # # ][ # # ]: 0 : WriteAnimationProperty( pFS, AnimationExporter::convertAnimateValue( aValue, rAttributeName ) );
[ # # ]
728 : :
729 : 0 : pFS->endElementNS( XML_p, XML_to );
730 : : }
731 : :
732 : 0 : void PowerPointExport::WriteAnimationAttributeName( FSHelperPtr pFS, const OUString& rAttributeName )
733 : : {
734 [ # # ]: 0 : if( rAttributeName.isEmpty() )
735 : 0 : return;
736 : :
737 : 0 : pFS->startElementNS( XML_p, XML_attrNameLst, FSEND );
738 : :
739 : : DBG(printf("write attribute name: %s\n", USS( rAttributeName )));
740 : :
741 : 0 : const char* sAttributeName = NULL;
742 [ # # ]: 0 : if ( rAttributeName == "Visibility" ) {
743 : 0 : sAttributeName = "style.visibility";
744 [ # # ]: 0 : } else if ( rAttributeName == "X" ) {
745 : 0 : sAttributeName = "ppt_x";
746 [ # # ]: 0 : } else if ( rAttributeName == "Y" ) {
747 : 0 : sAttributeName = "ppt_y";
748 : : }
749 : :
750 : 0 : pFS->startElementNS( XML_p, XML_attrName, FSEND );
751 : 0 : pFS->writeEscaped( sAttributeName );
752 : 0 : pFS->endElementNS( XML_p, XML_attrName );
753 : :
754 : 0 : pFS->endElementNS( XML_p, XML_attrNameLst );
755 : : }
756 : :
757 : 0 : void PowerPointExport::WriteAnimationTarget( FSHelperPtr pFS, Any aTarget )
758 : : {
759 : 0 : sal_Int32 nBegin = -1, nEnd = -1;
760 : : sal_Bool bParagraphTarget;
761 [ # # ]: 0 : Reference< XShape > rXShape = AnimationExporter::getTargetElementShape( aTarget, nBegin, nEnd, bParagraphTarget );
762 : :
763 [ # # ]: 0 : if( rXShape.is() ) {
764 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_tgtEl, FSEND );
765 : : pFS->startElementNS( XML_p, XML_spTgt,
766 : : XML_spid, I32S( ShapeExport::GetShapeID( rXShape, &maShapeMap ) ),
767 [ # # ][ # # ]: 0 : FSEND );
768 [ # # ]: 0 : if( bParagraphTarget ) {
769 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_txEl, FSEND );
770 : : pFS->singleElementNS( XML_p, XML_pRg,
771 : : XML_st, I32S( nBegin ),
772 : : XML_end, I32S( nEnd ),
773 [ # # ]: 0 : FSEND );
774 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_txEl );
775 : : }
776 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_spTgt );
777 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_tgtEl );
778 : 0 : }
779 : 0 : }
780 : :
781 : 0 : void PowerPointExport::WriteAnimationNodeAnimate( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Int32 nXmlNodeType, sal_Bool bMainSeqChild )
782 : : {
783 [ # # ]: 0 : Reference< XAnimate > rXAnimate( rXNode, UNO_QUERY );
784 [ # # ]: 0 : if( !rXAnimate.is() )
785 : 0 : return;
786 : :
787 : 0 : const char* pCalcMode = NULL;
788 : 0 : const char* pValueType = NULL;
789 : 0 : sal_Bool bSimple = ( nXmlNodeType != XML_anim );
790 : :
791 [ # # ]: 0 : if( !bSimple ) {
792 [ # # ][ # # ]: 0 : switch( rXAnimate->getCalcMode() ) {
[ # # # ]
793 : : case AnimationCalcMode::DISCRETE:
794 : 0 : pCalcMode = "discrete";
795 : 0 : break;
796 : : case AnimationCalcMode::LINEAR:
797 : 0 : pCalcMode = "lin";
798 : 0 : break;
799 : : }
800 : :
801 [ # # ][ # # ]: 0 : switch( AnimationExporter::GetValueTypeForAttributeName( rXAnimate->getAttributeName() ) ) {
[ # # ]
[ # # # # ]
802 : : case AnimationValueType::STRING:
803 : 0 : pValueType = "str";
804 : 0 : break;
805 : : case AnimationValueType::NUMBER:
806 : 0 : pValueType = "num";
807 : 0 : break;
808 : : case AnimationValueType::COLOR:
809 : 0 : pValueType = "clr";
810 : 0 : break;
811 : : }
812 : : }
813 : :
814 : : pFS->startElementNS( XML_p, nXmlNodeType,
815 : : XML_calcmode, pCalcMode,
816 : : XML_valueType, pValueType,
817 [ # # ]: 0 : FSEND );
818 [ # # ][ # # ]: 0 : WriteAnimationNodeAnimateInside( pFS, rXNode, bMainSeqChild, bSimple );
[ # # ]
819 [ # # ][ # # ]: 0 : pFS->endElementNS( XML_p, nXmlNodeType );
820 : : }
821 : :
822 : 0 : void PowerPointExport::WriteAnimationNodeAnimateInside( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Bool bMainSeqChild, sal_Bool bSimple )
823 : : {
824 [ # # ]: 0 : Reference< XAnimate > rXAnimate( rXNode, UNO_QUERY );
825 [ # # ]: 0 : if( !rXAnimate.is() )
826 : 0 : return;
827 : :
828 : 0 : const char* pAdditive = NULL;
829 : :
830 [ # # ]: 0 : if( !bSimple ) {
831 [ # # ][ # # ]: 0 : switch( rXAnimate->getAdditive() ) {
[ # # # #
# # ]
832 : : case AnimationAdditiveMode::BASE:
833 : 0 : pAdditive = "base";
834 : 0 : break;
835 : : case AnimationAdditiveMode::SUM:
836 : 0 : pAdditive = "sum";
837 : 0 : break;
838 : : case AnimationAdditiveMode::REPLACE:
839 : 0 : pAdditive = "repl";
840 : 0 : break;
841 : : case AnimationAdditiveMode::MULTIPLY:
842 : 0 : pAdditive = "mult";
843 : 0 : break;
844 : : case AnimationAdditiveMode::NONE:
845 : 0 : pAdditive = "none";
846 : 0 : break;
847 : : }
848 : : }
849 : :
850 : : pFS->startElementNS( XML_p, XML_cBhvr,
851 : : XML_additive, pAdditive,
852 [ # # ]: 0 : FSEND );
853 [ # # ][ # # ]: 0 : WriteAnimationNodeCommonPropsStart( pFS, rXNode, sal_True, bMainSeqChild );
[ # # ]
854 [ # # ][ # # ]: 0 : WriteAnimationTarget( pFS, rXAnimate->getTarget() );
[ # # ][ # # ]
[ # # ]
855 [ # # ][ # # ]: 0 : WriteAnimationAttributeName( pFS, rXAnimate->getAttributeName() );
[ # # ][ # # ]
[ # # ]
856 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_cBhvr );
857 [ # # ][ # # ]: 0 : WriteAnimateValues( pFS, rXAnimate );
[ # # ]
858 [ # # ][ # # ]: 0 : WriteAnimateTo( pFS, rXAnimate->getTo(), rXAnimate->getAttributeName() );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
859 : : }
860 : :
861 : 0 : void PowerPointExport::WriteAnimationCondition( FSHelperPtr pFS, const char* pDelay, const char* pEvent, double fDelay, sal_Bool bHasFDelay )
862 : : {
863 [ # # ][ # # ]: 0 : if( bHasFDelay || pDelay || pEvent ) {
[ # # ]
864 [ # # ]: 0 : if( !pEvent )
865 : : pFS->singleElementNS( XML_p, XML_cond,
866 [ # # ][ # # ]: 0 : XML_delay, bHasFDelay ? I64S( (sal_uInt32) (fDelay*1000.0) ) : pDelay,
867 [ # # ][ # # ]: 0 : FSEND );
868 : : else {
869 : : pFS->startElementNS( XML_p, XML_cond,
870 [ # # ][ # # ]: 0 : XML_delay, bHasFDelay ? I64S( (sal_uInt32) (fDelay*1000.0) ) : pDelay,
871 : : XML_evt, pEvent,
872 [ # # ][ # # ]: 0 : FSEND );
873 : :
874 : 0 : pFS->startElementNS( XML_p, XML_tgtEl, FSEND );
875 : 0 : pFS->singleElementNS( XML_p, XML_sldTgt, FSEND );
876 : 0 : pFS->endElementNS( XML_p, XML_tgtEl );
877 : :
878 : 0 : pFS->endElementNS( XML_p, XML_cond );
879 : : }
880 : : }
881 : 0 : }
882 : :
883 : 0 : void PowerPointExport::WriteAnimationCondition( FSHelperPtr pFS, Any& rAny, sal_Bool bWriteEvent, sal_Bool bMainSeqChild )
884 : : {
885 : 0 : sal_Bool bHasFDelay = sal_False;
886 : 0 : double fDelay = 0;
887 : : Timing eTiming;
888 : 0 : Event aEvent;
889 : 0 : const char* pDelay = NULL;
890 : 0 : const char* pEvent = NULL;
891 : :
892 [ # # ]: 0 : if( rAny >>= fDelay )
893 : 0 : bHasFDelay = sal_True;
894 [ # # ][ # # ]: 0 : else if( rAny >>= eTiming ) {
895 [ # # ]: 0 : if( eTiming == Timing_INDEFINITE )
896 : 0 : pDelay = "indefinite";
897 [ # # ][ # # ]: 0 : } else if( rAny >>= aEvent ) {
898 : : // TODO
899 : : DBG(printf ("animation condition event: TODO\n"));
900 : : DBG(printf ("event offset has value: %d triger: %d source has value: %d\n", aEvent.Offset.hasValue(), aEvent.Trigger, aEvent.Source.hasValue()));
901 : :
902 [ # # ][ # # ]: 0 : if( !bWriteEvent && aEvent.Trigger == EventTrigger::ON_NEXT && bMainSeqChild )
[ # # ]
903 : 0 : pDelay = "indefinite";
904 [ # # ]: 0 : else if( bWriteEvent ) {
905 [ # # # # : 0 : switch( aEvent.Trigger ) {
# # # # #
# # # ]
906 : : case EventTrigger::ON_NEXT:
907 : 0 : pEvent = "onNext";
908 : 0 : break;
909 : : case EventTrigger::ON_PREV:
910 : 0 : pEvent = "onPrev";
911 : 0 : break;
912 : : case EventTrigger::BEGIN_EVENT:
913 : 0 : pEvent = "begin";
914 : 0 : break;
915 : : case EventTrigger::END_EVENT:
916 : 0 : pEvent = "end";
917 : 0 : break;
918 : : case EventTrigger::ON_BEGIN:
919 : 0 : pEvent = "onBegin";
920 : 0 : break;
921 : : case EventTrigger::ON_END:
922 : 0 : pEvent = "onEnd";
923 : 0 : break;
924 : : case EventTrigger::ON_CLICK:
925 : 0 : pEvent = "onClick";
926 : 0 : break;
927 : : case EventTrigger::ON_DBL_CLICK:
928 : 0 : pEvent = "onDblClick";
929 : 0 : break;
930 : : case EventTrigger::ON_STOP_AUDIO:
931 : 0 : pEvent = "onStopAudio";
932 : 0 : break;
933 : : case EventTrigger::ON_MOUSE_ENTER:
934 : 0 : pEvent = "onMouseOver"; // not exact?
935 : 0 : break;
936 : : case EventTrigger::ON_MOUSE_LEAVE:
937 : 0 : pEvent = "onMouseOut";
938 : 0 : break;
939 : : }
940 : : }
941 : :
942 [ # # ]: 0 : if( aEvent.Offset >>= fDelay ) {
943 : 0 : bHasFDelay = sal_True;
944 : : DBG(printf ("event offset: %f\n", fDelay));
945 [ # # ][ # # ]: 0 : } else if( aEvent.Offset >>= eTiming ) {
946 [ # # ]: 0 : if( eTiming == Timing_INDEFINITE )
947 : 0 : pDelay = "indefinite";
948 : : DBG(printf ("event offset timing: %d\n", eTiming));
949 : : }
950 : : }
951 : :
952 [ # # ][ # # ]: 0 : WriteAnimationCondition( pFS, pDelay, pEvent, fDelay, bHasFDelay );
[ # # ]
953 : 0 : }
954 : :
955 : 0 : void PowerPointExport::WriteAnimationNodeCommonPropsStart( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Bool bSingle, sal_Bool bMainSeqChild )
956 : : {
957 : 0 : const char* pDuration = NULL;
958 : 0 : const char* pRestart = NULL;
959 : 0 : const char* pNodeType = NULL;
960 : 0 : const char* pPresetClass = NULL;
961 : 0 : const char* pFill = NULL;
962 : 0 : double fDuration = 0;
963 : 0 : Any aAny;
964 : :
965 [ # # ][ # # ]: 0 : aAny = rXNode->getDuration();
966 [ # # ]: 0 : if( aAny.hasValue() ) {
967 : : Timing eTiming;
968 : :
969 [ # # ][ # # ]: 0 : if( aAny >>= eTiming ) {
970 [ # # ]: 0 : if( eTiming == Timing_INDEFINITE )
971 : 0 : pDuration = "indefinite";
972 : : } else
973 : 0 : aAny >>= fDuration;
974 : : }
975 : :
976 [ # # ][ # # ]: 0 : switch( rXNode->getRestart() ) {
[ # # # # ]
977 : : case AnimationRestart::ALWAYS:
978 : 0 : pRestart = "always";
979 : 0 : break;
980 : : case AnimationRestart::WHEN_NOT_ACTIVE:
981 : 0 : pRestart = "whenNotActive";
982 : 0 : break;
983 : : case AnimationRestart::NEVER:
984 : 0 : pRestart = "never";
985 : 0 : break;
986 : : }
987 : :
988 [ # # ][ # # ]: 0 : const Sequence< NamedValue > aUserData = rXNode->getUserData();
989 : : const Any* pAny[ DFF_ANIM_PROPERTY_ID_COUNT ];
990 [ # # ]: 0 : AnimationExporter::GetUserData( aUserData, pAny, sizeof( pAny ) );
991 : :
992 : 0 : sal_Int16 nType = 0;
993 [ # # ][ # # ]: 0 : if( pAny[ DFF_ANIM_NODE_TYPE ] && ( *pAny[ DFF_ANIM_NODE_TYPE ] >>= nType ) ) {
[ # # ]
994 [ # # # # : 0 : switch( nType ) {
# # # ]
995 : : case EffectNodeType::TIMING_ROOT:
996 : 0 : pNodeType = "tmRoot";
997 [ # # ]: 0 : if( !pDuration )
998 : 0 : pDuration = "indefinite";
999 [ # # ]: 0 : if( !pRestart )
1000 : 0 : pRestart = "never";
1001 : 0 : break;
1002 : : case EffectNodeType::MAIN_SEQUENCE:
1003 : 0 : pNodeType = "mainSeq";
1004 : 0 : break;
1005 : : case EffectNodeType::ON_CLICK:
1006 : 0 : pNodeType = "clickEffect";
1007 : 0 : break;
1008 : : case EffectNodeType::AFTER_PREVIOUS:
1009 : 0 : pNodeType = "afterEffect";
1010 : 0 : break;
1011 : : case EffectNodeType::WITH_PREVIOUS:
1012 : 0 : pNodeType = "withEffect";
1013 : 0 : break;
1014 : : case EffectNodeType::INTERACTIVE_SEQUENCE:
1015 : 0 : pNodeType = "interactiveSeq";
1016 : 0 : break;
1017 : : }
1018 : : }
1019 : :
1020 : 0 : sal_uInt32 nPresetClass = DFF_ANIM_PRESS_CLASS_USER_DEFINED;
1021 [ # # ]: 0 : if ( pAny[ DFF_ANIM_PRESET_CLASS ] ) {
1022 [ # # ]: 0 : if ( *pAny[ DFF_ANIM_PRESET_CLASS ] >>= nPresetClass ) {
1023 [ # # # # : 0 : switch( nPresetClass ) {
# # # ]
1024 : : case EffectPresetClass::ENTRANCE:
1025 : 0 : pPresetClass = "entr";
1026 : 0 : break;
1027 : : case EffectPresetClass::EXIT:
1028 : 0 : pPresetClass = "exit";
1029 : 0 : break;
1030 : : case EffectPresetClass::EMPHASIS:
1031 : 0 : pPresetClass = "emph";
1032 : 0 : break;
1033 : : case EffectPresetClass::MOTIONPATH:
1034 : 0 : pPresetClass = "path";
1035 : 0 : break;
1036 : : case EffectPresetClass::OLEACTION:
1037 : 0 : pPresetClass = "verb"; // ?
1038 : 0 : break;
1039 : : case EffectPresetClass::MEDIACALL:
1040 : 0 : pPresetClass = "mediacall";
1041 : 0 : break;
1042 : : }
1043 : : }
1044 : : }
1045 : :
1046 : 0 : sal_uInt32 nPresetId = 0;
1047 : 0 : sal_Bool bPresetId = sal_False;
1048 [ # # ]: 0 : if ( pAny[ DFF_ANIM_PRESET_ID ] ) {
1049 : 0 : rtl::OUString sPreset;
1050 [ # # ]: 0 : if ( *pAny[ DFF_ANIM_PRESET_ID ] >>= sPreset )
1051 [ # # ]: 0 : nPresetId = AnimationExporter::GetPresetID( sPreset, nPresetClass, bPresetId );
1052 : : }
1053 : :
1054 : 0 : sal_uInt32 nPresetSubType = 0;
1055 : 0 : sal_Bool bPresetSubType = sal_False;
1056 [ # # ]: 0 : if ( pAny[ DFF_ANIM_PRESET_SUB_TYPE ] ) {
1057 : 0 : rtl::OUString sPresetSubType;
1058 [ # # ]: 0 : if ( *pAny[ DFF_ANIM_PRESET_SUB_TYPE ] >>= sPresetSubType ) {
1059 [ # # ]: 0 : nPresetSubType = AnimationExporter::TranslatePresetSubType( nPresetClass, nPresetId, sPresetSubType );
1060 : 0 : bPresetSubType = sal_True;
1061 : 0 : }
1062 : : }
1063 : :
1064 [ # # ][ # # ]: 0 : if( nType != EffectNodeType::TIMING_ROOT && nType != EffectNodeType::MAIN_SEQUENCE ) {
1065 : : // it doesn't seem to work right on root and mainseq nodes
1066 [ # # ]: 0 : sal_Int16 nFill = AnimationExporter::GetFillMode( rXNode, AnimationFill::AUTO );
1067 [ # # # # : 0 : switch( nFill ) {
# ]
1068 : : case AnimationFill::FREEZE:
1069 : 0 : pFill = "freeze";
1070 : 0 : break;
1071 : : case AnimationFill::HOLD:
1072 : 0 : pFill = "hold";
1073 : 0 : break;
1074 : : case AnimationFill::REMOVE:
1075 : 0 : pFill = "remove";
1076 : 0 : break;
1077 : : case AnimationFill::TRANSITION:
1078 : 0 : pFill = "transition";
1079 : 0 : break;
1080 : : }
1081 : : }
1082 : :
1083 : : pFS->startElementNS( XML_p, XML_cTn,
1084 : : XML_id, I64S( mnAnimationNodeIdMax ++ ),
1085 [ # # ][ # # ]: 0 : XML_dur, fDuration != 0 ? I32S( (sal_Int32) ( fDuration * 1000.0 ) ) : pDuration,
1086 : : XML_restart, pRestart,
1087 : : XML_nodeType, pNodeType,
1088 : : XML_fill, pFill,
1089 : : XML_presetClass, pPresetClass,
1090 [ # # ][ # # ]: 0 : XML_presetID, bPresetId ? I64S( nPresetId ) : NULL,
1091 [ # # ][ # # ]: 0 : XML_presetSubtype, bPresetSubType ? I64S( nPresetSubType ) : NULL,
1092 [ # # ][ # # ]: 0 : FSEND );
[ # # ][ # # ]
1093 : :
1094 [ # # ][ # # ]: 0 : aAny = rXNode->getBegin();
1095 [ # # ]: 0 : if( aAny.hasValue() ) {
1096 [ # # ]: 0 : Sequence< Any > aCondSeq;
1097 : :
1098 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_stCondLst, FSEND );
1099 [ # # ][ # # ]: 0 : if( aAny >>= aCondSeq ) {
1100 [ # # ]: 0 : for( int i = 0; i < aCondSeq.getLength(); i ++ )
1101 [ # # ][ # # ]: 0 : WriteAnimationCondition( pFS, aCondSeq[ i ], sal_False, bMainSeqChild );
[ # # ][ # # ]
1102 : : } else
1103 [ # # ][ # # ]: 0 : WriteAnimationCondition( pFS, aAny, sal_False, bMainSeqChild );
[ # # ]
1104 [ # # ][ # # ]: 0 : pFS->endElementNS( XML_p, XML_stCondLst );
1105 : : }
1106 : :
1107 [ # # ][ # # ]: 0 : aAny = rXNode->getEnd();
1108 [ # # ]: 0 : if( aAny.hasValue() ) {
1109 [ # # ]: 0 : Sequence< Any > aCondSeq;
1110 : :
1111 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_endCondLst, FSEND );
1112 [ # # ][ # # ]: 0 : if( aAny >>= aCondSeq ) {
1113 [ # # ]: 0 : for( int i = 0; i < aCondSeq.getLength(); i ++ )
1114 [ # # ][ # # ]: 0 : WriteAnimationCondition( pFS, aCondSeq[ i ], sal_False, bMainSeqChild );
[ # # ][ # # ]
1115 : : } else
1116 [ # # ][ # # ]: 0 : WriteAnimationCondition( pFS, aAny, sal_False, bMainSeqChild );
[ # # ]
1117 [ # # ][ # # ]: 0 : pFS->endElementNS( XML_p, XML_stCondLst );
1118 : : }
1119 : :
1120 [ # # ]: 0 : Reference< XEnumerationAccess > xEnumerationAccess( rXNode, UNO_QUERY );
1121 [ # # ]: 0 : if( xEnumerationAccess.is() ) {
1122 [ # # ][ # # ]: 0 : Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
[ # # ]
1123 [ # # ]: 0 : if( xEnumeration.is() ) {
1124 : : DBG(printf ("-----\n"));
1125 : :
1126 [ # # ][ # # ]: 0 : if( xEnumeration->hasMoreElements() ) {
[ # # ]
1127 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_childTnLst, FSEND );
1128 : :
1129 [ # # ][ # # ]: 0 : while( xEnumeration->hasMoreElements() ) {
[ # # ]
1130 [ # # ][ # # ]: 0 : Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
[ # # ]
1131 [ # # ]: 0 : if( xChildNode.is() )
1132 [ # # ][ # # ]: 0 : WriteAnimationNode( pFS, xChildNode, nType == EffectNodeType::MAIN_SEQUENCE );
[ # # ]
1133 : 0 : }
1134 : :
1135 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_childTnLst );
1136 : : }
1137 : : DBG(printf ("-----\n"));
1138 : 0 : }
1139 : : }
1140 : :
1141 [ # # ]: 0 : if( bSingle )
1142 [ # # ][ # # ]: 0 : pFS->endElementNS( XML_p, XML_cTn );
1143 : 0 : }
1144 : :
1145 : 0 : void PowerPointExport::WriteAnimationNodeSeq( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Int32, sal_Bool bMainSeqChild )
1146 : : {
1147 : : DBG(printf ("write animation node SEQ\n"));
1148 : :
1149 : 0 : pFS->startElementNS( XML_p, XML_seq, FSEND );
1150 : :
1151 [ # # ]: 0 : WriteAnimationNodeCommonPropsStart( pFS, rXNode, sal_True, bMainSeqChild );
1152 : :
1153 : 0 : pFS->startElementNS( XML_p, XML_prevCondLst, FSEND );
1154 [ # # ]: 0 : WriteAnimationCondition( pFS, NULL, "onPrev", 0, sal_True );
1155 : 0 : pFS->endElementNS( XML_p, XML_prevCondLst );
1156 : :
1157 : 0 : pFS->startElementNS( XML_p, XML_nextCondLst, FSEND );
1158 [ # # ]: 0 : WriteAnimationCondition( pFS, NULL, "onNext", 0, sal_True );
1159 : 0 : pFS->endElementNS( XML_p, XML_nextCondLst );
1160 : :
1161 : 0 : pFS->endElementNS( XML_p, XML_seq );
1162 : 0 : }
1163 : :
1164 : 0 : void PowerPointExport::WriteAnimationNodeEffect( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Int32, sal_Bool bMainSeqChild )
1165 : : {
1166 : : DBG(printf ("write animation node FILTER\n"));
1167 : :
1168 [ # # ]: 0 : Reference< XTransitionFilter > xFilter( rXNode, UNO_QUERY );
1169 [ # # ]: 0 : if ( xFilter.is() ) {
1170 [ # # ][ # # ]: 0 : const char* pFilter = ppt::AnimationExporter::FindTransitionName( xFilter->getTransition(), xFilter->getSubtype(), xFilter->getDirection() );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1171 [ # # ][ # # ]: 0 : const char* pDirection = xFilter->getDirection() ? "in" : "out";
[ # # ]
1172 : : pFS->startElementNS( XML_p, XML_animEffect,
1173 : : XML_filter, pFilter,
1174 : : XML_transition, pDirection,
1175 [ # # ]: 0 : FSEND );
1176 : :
1177 [ # # ][ # # ]: 0 : WriteAnimationNodeAnimateInside( pFS, rXNode, bMainSeqChild, sal_False );
[ # # ]
1178 : :
1179 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_animEffect );
1180 : 0 : }
1181 : 0 : }
1182 : :
1183 : 0 : void PowerPointExport::WriteAnimationNode( FSHelperPtr pFS, const Reference< XAnimationNode >& rXNode, sal_Bool bMainSeqChild )
1184 : : {
1185 : : DBG(printf ("export node type: %d\n", rXNode->getType()));
1186 : 0 : sal_Int32 xmlNodeType = -1;
1187 : : typedef void (PowerPointExport::*AnimationNodeWriteMethod)( FSHelperPtr, const Reference< XAnimationNode >&, sal_Int32, sal_Bool );
1188 : 0 : AnimationNodeWriteMethod pMethod = NULL;
1189 : :
1190 [ # # ][ # # ]: 0 : switch( rXNode->getType() ) {
[ # # # #
# # ]
1191 : : case AnimationNodeType::PAR:
1192 : 0 : xmlNodeType = XML_par;
1193 : 0 : break;
1194 : : case AnimationNodeType::SEQ:
1195 : 0 : pMethod = &PowerPointExport::WriteAnimationNodeSeq;
1196 : 0 : break;
1197 : : case AnimationNodeType::ANIMATE:
1198 : 0 : xmlNodeType = XML_anim;
1199 : 0 : pMethod = &PowerPointExport::WriteAnimationNodeAnimate;
1200 : 0 : break;
1201 : : case AnimationNodeType::SET:
1202 : 0 : xmlNodeType = XML_set;
1203 : 0 : pMethod = &PowerPointExport::WriteAnimationNodeAnimate;
1204 : 0 : break;
1205 : : case AnimationNodeType::TRANSITIONFILTER:
1206 : 0 : xmlNodeType = XML_animEffect;
1207 : 0 : pMethod = &PowerPointExport::WriteAnimationNodeEffect;
1208 : 0 : break;
1209 : : }
1210 : :
1211 [ # # ]: 0 : if( pMethod ) {
1212 [ # # ][ # # ]: 0 : (this->*(pMethod))( pFS, rXNode, xmlNodeType, bMainSeqChild );
[ # # ][ # # ]
1213 : : return;
1214 : : }
1215 : :
1216 [ # # ]: 0 : if( xmlNodeType == -1 )
1217 : : return;
1218 : :
1219 [ # # ]: 0 : pFS->startElementNS( XML_p, xmlNodeType, FSEND );
1220 : :
1221 [ # # ][ # # ]: 0 : WriteAnimationNodeCommonPropsStart( pFS, rXNode, sal_True, bMainSeqChild );
[ # # ]
1222 : :
1223 [ # # ]: 0 : pFS->endElementNS( XML_p, xmlNodeType );
1224 : : }
1225 : :
1226 : 0 : void PowerPointExport::WriteAnimations( FSHelperPtr pFS )
1227 : : {
1228 [ # # ]: 0 : Reference< XAnimationNodeSupplier > xNodeSupplier( mXDrawPage, UNO_QUERY );
1229 [ # # ]: 0 : if( xNodeSupplier.is() ) {
1230 [ # # ][ # # ]: 0 : const Reference< XAnimationNode > xNode( xNodeSupplier->getAnimationNode() );
1231 [ # # ]: 0 : if( xNode.is() ) {
1232 [ # # ]: 0 : Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
1233 [ # # ]: 0 : if( xEnumerationAccess.is() ) {
1234 [ # # ][ # # ]: 0 : Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
[ # # ]
1235 [ # # ][ # # ]: 0 : if( xEnumeration.is() && xEnumeration->hasMoreElements() ) {
[ # # ][ # # ]
[ # # ]
1236 : :
1237 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_timing, FSEND );
1238 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_tnLst, FSEND );
1239 : :
1240 [ # # ][ # # ]: 0 : WriteAnimationNode( pFS, xNode, sal_False );
[ # # ]
1241 : :
1242 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_tnLst );
1243 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_timing );
1244 : 0 : }
1245 : 0 : }
1246 : 0 : }
1247 : 0 : }
1248 : 0 : }
1249 : :
1250 : :
1251 : 0 : static OUString lcl_GetInitials( OUString sName )
1252 : : {
1253 : 0 : OUStringBuffer sRet;
1254 : :
1255 [ # # ]: 0 : if ( !sName.isEmpty() ) {
1256 [ # # ]: 0 : sRet.append ( sName[0] );
1257 : 0 : sal_Int32 nStart = 0, nOffset;
1258 : :
1259 [ # # ]: 0 : while ( ( nOffset = sName.indexOf ( ' ', nStart ) ) != -1 ) {
1260 [ # # ]: 0 : if ( nOffset + 1 < sName.getLength() )
1261 [ # # ]: 0 : sRet.append ( sName[ nOffset + 1 ] );
1262 : 0 : nStart = nOffset + 1;
1263 : : }
1264 : : }
1265 : :
1266 [ # # ]: 0 : return sRet.makeStringAndClear();
1267 : : }
1268 : :
1269 : 0 : void PowerPointExport::WriteAuthors()
1270 : : {
1271 [ # # ]: 0 : if ( maAuthors.size() <= 0 )
1272 : 0 : return;
1273 : :
1274 : : FSHelperPtr pFS = openFragmentStreamWithSerializer( US( "ppt/commentAuthors.xml" ),
1275 [ # # ][ # # ]: 0 : US( "application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml" ) );
[ # # ]
1276 : : addRelation( mPresentationFS->getOutputStream(),
1277 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors" ),
1278 [ # # ][ # # ]: 0 : US( "commentAuthors.xml" ) );
[ # # ][ # # ]
1279 : :
1280 : : pFS->startElementNS( XML_p, XML_cmAuthorLst,
1281 : : FSNS( XML_xmlns, XML_p ), "http://schemas.openxmlformats.org/presentationml/2006/main",
1282 [ # # ]: 0 : FSEND );
1283 : :
1284 [ # # ][ # # ]: 0 : BOOST_FOREACH( AuthorsMap::value_type i, maAuthors ) {
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1285 : : pFS->singleElementNS( XML_p, XML_cmAuthor,
1286 : : XML_id, I32S( i.second.nId ),
1287 : : XML_name, USS( i.first ),
1288 : : XML_initials, USS( lcl_GetInitials( i.first ) ),
1289 : : XML_lastIdx, I32S( i.second.nLastIndex ),
1290 : : XML_clrIdx, I32S( i.second.nId ),
1291 [ # # ][ # # ]: 0 : FSEND );
[ # # ][ # # ]
1292 : 0 : }
1293 : :
1294 [ # # ][ # # ]: 0 : pFS->endElementNS( XML_p, XML_cmAuthorLst );
1295 : : }
1296 : :
1297 : 0 : sal_Int32 PowerPointExport::GetAuthorIdAndLastIndex( OUString sAuthor, sal_Int32& nLastIndex )
1298 : : {
1299 [ # # ]: 0 : if ( maAuthors.count( sAuthor ) <= 0 ) {
1300 : : struct AuthorComments aAuthorComments;
1301 : :
1302 : 0 : aAuthorComments.nId = maAuthors.size();
1303 : 0 : aAuthorComments.nLastIndex = 0;
1304 : :
1305 [ # # ]: 0 : maAuthors[ sAuthor ] = aAuthorComments;
1306 : : }
1307 : :
1308 : 0 : nLastIndex = ++maAuthors[ sAuthor ].nLastIndex;
1309 : :
1310 : 0 : return maAuthors[ sAuthor ].nId;
1311 : : }
1312 : :
1313 : 0 : bool PowerPointExport::WriteComments( sal_uInt32 nPageNum )
1314 : : {
1315 [ # # ]: 0 : Reference< XAnnotationAccess > xAnnotationAccess( mXDrawPage, uno::UNO_QUERY );
1316 [ # # ]: 0 : if ( xAnnotationAccess.is() )
1317 : : {
1318 [ # # ][ # # ]: 0 : Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
1319 : :
1320 [ # # ][ # # ]: 0 : if ( xAnnotationEnumeration->hasMoreElements() )
[ # # ]
1321 : : {
1322 : : FSHelperPtr pFS = openFragmentStreamWithSerializer( OUStringBuffer()
1323 [ # # ]: 0 : .appendAscii( "ppt/comments/comment" )
1324 [ # # ]: 0 : .append( (sal_Int32) nPageNum + 1 )
1325 [ # # ]: 0 : .appendAscii( ".xml" )
1326 : : .makeStringAndClear(),
1327 [ # # ][ # # ]: 0 : US( "application/vnd.openxmlformats-officedocument.presentationml.comments+xml" ) );
[ # # ]
1328 : :
1329 : : pFS->startElementNS( XML_p, XML_cmLst,
1330 : : FSNS( XML_xmlns, XML_p ), "http://schemas.openxmlformats.org/presentationml/2006/main",
1331 [ # # ]: 0 : FSEND );
1332 : :
1333 [ # # ]: 0 : do {
1334 [ # # ][ # # ]: 0 : Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() );
1335 [ # # ][ # # ]: 0 : DateTime aDateTime( xAnnotation->getDateTime() );
1336 [ # # ][ # # ]: 0 : RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
1337 [ # # ][ # # ]: 0 : Reference< XText > xText( xAnnotation->getTextRange() );
1338 : : sal_Int32 nLastIndex;
1339 [ # # ][ # # ]: 0 : sal_Int32 nId = GetAuthorIdAndLastIndex ( xAnnotation->getAuthor(), nLastIndex );
[ # # ]
1340 : : char cDateTime[32];
1341 : :
1342 : 0 : snprintf(cDateTime, 31, "%02d-%02d-%02dT%02d:%02d:%02d.%03d", aDateTime.Year, aDateTime.Month, aDateTime.Day, aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds, aDateTime.HundredthSeconds);
1343 : :
1344 : : pFS->startElementNS( XML_p, XML_cm,
1345 : : XML_authorId, I32S( nId ),
1346 : : XML_dt, cDateTime,
1347 : : XML_idx, I32S( nLastIndex ),
1348 [ # # ]: 0 : FSEND );
1349 : :
1350 : : pFS->singleElementNS( XML_p, XML_pos,
1351 : : XML_x, I64S( ( (sal_Int64) ( 57600*aRealPoint2D.X + 1270 )/2540.0 ) ),
1352 : : XML_y, I64S( ( (sal_Int64) ( 57600*aRealPoint2D.Y + 1270 )/2540.0 ) ),
1353 [ # # ]: 0 : FSEND );
1354 : :
1355 : : pFS->startElementNS( XML_p, XML_text,
1356 [ # # ]: 0 : FSEND );
1357 [ # # ][ # # ]: 0 : pFS->write( xText->getString() );
[ # # ]
1358 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_text );
1359 : :
1360 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_cm );
1361 : :
1362 [ # # ][ # # ]: 0 : } while ( xAnnotationEnumeration->hasMoreElements() );
1363 : :
1364 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_cmLst );
1365 : :
1366 [ # # ]: 0 : return true;
1367 [ # # ]: 0 : }
1368 : : }
1369 : :
1370 : 0 : return false;
1371 : : }
1372 : :
1373 : 0 : void PowerPointExport::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 /* nMode */,
1374 : : sal_Bool bHasBackground, Reference< XPropertySet > aXBackgroundPropSet )
1375 : : {
1376 : : DBG(printf("write slide: %" SAL_PRIuUINT32 "\n----------------\n", nPageNum));
1377 : :
1378 : : // slides list
1379 [ # # ]: 0 : if( nPageNum == 0 )
1380 [ # # ]: 0 : mPresentationFS->startElementNS( XML_p, XML_sldIdLst, FSEND );
1381 : :
1382 : : // add explicit relation of presentation to this slide
1383 : : OUString sRelId = addRelation( mPresentationFS->getOutputStream(),
1384 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" ),
1385 : : OUStringBuffer()
1386 [ # # ]: 0 : .appendAscii( "slides/slide" )
1387 [ # # ]: 0 : .append( (sal_Int32) nPageNum + 1 )
1388 [ # # ]: 0 : .appendAscii( ".xml" )
1389 [ # # ][ # # ]: 0 : .makeStringAndClear() );
[ # # ][ # # ]
1390 : :
1391 : : mPresentationFS->singleElementNS( XML_p, XML_sldId,
1392 : 0 : XML_id, I32S( GetNewSlideId() ),
1393 : : FSNS( XML_r, XML_id ), USS( sRelId ),
1394 [ # # ][ # # ]: 0 : FSEND );
1395 : :
1396 [ # # ]: 0 : if( nPageNum == mnPages - 1 )
1397 [ # # ]: 0 : mPresentationFS->endElementNS( XML_p, XML_sldIdLst );
1398 : :
1399 : : FSHelperPtr pFS = openFragmentStreamWithSerializer( OUStringBuffer()
1400 [ # # ]: 0 : .appendAscii( "ppt/slides/slide" )
1401 [ # # ]: 0 : .append( (sal_Int32) nPageNum + 1 )
1402 [ # # ]: 0 : .appendAscii( ".xml" )
1403 : : .makeStringAndClear(),
1404 [ # # ][ # # ]: 0 : US( "application/vnd.openxmlformats-officedocument.presentationml.slide+xml" ) );
[ # # ]
1405 : :
1406 [ # # ]: 0 : if( mpSlidesFSArray.size() < mnPages )
1407 [ # # ]: 0 : mpSlidesFSArray.resize( mnPages );
1408 [ # # ]: 0 : mpSlidesFSArray[ nPageNum ] = pFS;
1409 : :
1410 : 0 : const char* pShow = NULL;
1411 : :
1412 [ # # ][ # # ]: 0 : if( GETA( Visible ) ) {
[ # # ][ # # ]
1413 : 0 : sal_Bool bShow(sal_False);
1414 [ # # ][ # # ]: 0 : if( ( mAny >>= bShow ) && !bShow )
[ # # ]
1415 : 0 : pShow = "0";
1416 : : }
1417 : :
1418 : : pFS->startElementNS( XML_p, XML_sld, PNMSS,
1419 : : XML_show, pShow,
1420 [ # # ]: 0 : FSEND );
1421 : :
1422 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_cSld, FSEND );
1423 : :
1424 : : // background
1425 [ # # ]: 0 : if( bHasBackground ) {
1426 [ # # ][ # # ]: 0 : ImplWriteBackground( pFS, aXBackgroundPropSet );
[ # # ]
1427 : : }
1428 : :
1429 [ # # ][ # # ]: 0 : WriteShapeTree( pFS, NORMAL, sal_False );
[ # # ]
1430 : :
1431 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_cSld );
1432 : :
1433 [ # # ][ # # ]: 0 : WriteTransition( pFS );
[ # # ]
1434 [ # # ][ # # ]: 0 : WriteAnimations( pFS );
[ # # ]
1435 : :
1436 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_sld );
1437 : :
1438 : : // add implicit relation to slide layout
1439 : : addRelation( pFS->getOutputStream(),
1440 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" ),
1441 : : OUStringBuffer()
1442 [ # # ]: 0 : .appendAscii( "../slideLayouts/slideLayout" )
1443 [ # # ][ # # ]: 0 : .append( GetLayoutFileId( GetPPTXLayoutId( GetLayoutOffset( mXPagePropSet ) ), nMasterNum ) )
[ # # ]
1444 [ # # ]: 0 : .appendAscii( ".xml" )
1445 [ # # ][ # # ]: 0 : .makeStringAndClear() );
[ # # ][ # # ]
1446 : :
1447 [ # # ][ # # ]: 0 : if ( WriteComments( nPageNum ) )
1448 : : // add implicit relation to slide comments
1449 : : addRelation( pFS->getOutputStream(),
1450 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" ),
1451 : : OUStringBuffer()
1452 [ # # ]: 0 : .appendAscii( "../comments/comment" )
1453 [ # # ]: 0 : .append( (sal_Int32) nPageNum + 1 )
1454 [ # # ]: 0 : .appendAscii( ".xml" )
1455 [ # # ][ # # ]: 0 : .makeStringAndClear() );
[ # # ][ # # ]
1456 : :
1457 [ # # ]: 0 : DBG(printf("----------------\n"));
1458 : 0 : }
1459 : :
1460 : 0 : void PowerPointExport::ImplWriteNotes( sal_uInt32 nPageNum )
1461 : : {
1462 [ # # ][ # # ]: 0 : if( !mbCreateNotes || !ContainsOtherShapeThanPlaceholders( sal_True ) )
[ # # ][ # # ]
1463 : 0 : return;
1464 : :
1465 : : DBG(printf("write Notes %" SAL_PRIuUINT32 "\n----------------\n", nPageNum));
1466 : :
1467 : : FSHelperPtr pFS = openFragmentStreamWithSerializer( OUStringBuffer()
1468 [ # # ]: 0 : .appendAscii( "ppt/notesSlides/notesSlide" )
1469 [ # # ]: 0 : .append( (sal_Int32) nPageNum + 1 )
1470 [ # # ]: 0 : .appendAscii( ".xml" )
1471 : : .makeStringAndClear(),
1472 [ # # ][ # # ]: 0 : US( "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml" ) );
[ # # ]
1473 : :
1474 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_notes, PNMSS, FSEND );
1475 : :
1476 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_cSld, FSEND );
1477 : :
1478 [ # # ][ # # ]: 0 : WriteShapeTree( pFS, NOTICE, sal_False );
[ # # ]
1479 : :
1480 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_cSld );
1481 : :
1482 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_notes );
1483 : :
1484 : : // add implicit relation to slide
1485 : : addRelation( pFS->getOutputStream(),
1486 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" ),
1487 : : OUStringBuffer()
1488 [ # # ]: 0 : .appendAscii( "../slides/slide" )
1489 [ # # ]: 0 : .append( (sal_Int32) nPageNum + 1 )
1490 [ # # ]: 0 : .appendAscii( ".xml" )
1491 [ # # ][ # # ]: 0 : .makeStringAndClear() );
[ # # ][ # # ]
1492 : :
1493 : : // add slide implicit relation to notes
1494 [ # # ]: 0 : if( mpSlidesFSArray.size() >= nPageNum )
1495 : 0 : addRelation( mpSlidesFSArray[ nPageNum ]->getOutputStream(),
1496 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide" ),
1497 : : OUStringBuffer()
1498 [ # # ]: 0 : .appendAscii( "../notesSlides/notesSlide" )
1499 [ # # ]: 0 : .append( (sal_Int32) nPageNum + 1 )
1500 [ # # ]: 0 : .appendAscii( ".xml" )
1501 [ # # ]: 0 : .makeStringAndClear() );
[ # # # # ]
[ # # ]
1502 : :
1503 : : // add implicit relation to notes master
1504 : : addRelation( pFS->getOutputStream(),
1505 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster" ),
1506 [ # # ][ # # ]: 0 : US( "../notesMasters/notesMaster1.xml" ) );
[ # # ][ # # ]
1507 : :
1508 [ # # ]: 0 : DBG(printf("----------------\n"));
1509 : : }
1510 : :
1511 : 0 : void PowerPointExport::AddLayoutIdAndRelation( FSHelperPtr pFS, sal_Int32 nLayoutFileId )
1512 : : {
1513 : : // add implicit relation of slide master to slide layout
1514 : : OUString sRelId = addRelation( pFS->getOutputStream(),
1515 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" ),
1516 : : OUStringBuffer()
1517 [ # # ]: 0 : .appendAscii( "../slideLayouts/slideLayout" )
1518 [ # # ]: 0 : .append( nLayoutFileId )
1519 [ # # ]: 0 : .appendAscii( ".xml" )
1520 [ # # ][ # # ]: 0 : .makeStringAndClear() );
[ # # ][ # # ]
1521 : :
1522 : : pFS->singleElementNS( XML_p, XML_sldLayoutId,
1523 : 0 : XML_id, I64S( GetNewSlideMasterId() ),
1524 : : FSNS( XML_r, XML_id ), USS( sRelId ),
1525 [ # # ][ # # ]: 0 : FSEND );
1526 : 0 : }
1527 : :
1528 : : sal_Int32 PowerPointExport::nStyleLevelToken[5] =
1529 : : {
1530 : : XML_lvl1pPr,
1531 : : XML_lvl2pPr,
1532 : : XML_lvl3pPr,
1533 : : XML_lvl4pPr,
1534 : : XML_lvl5pPr
1535 : : };
1536 : :
1537 : 0 : void PowerPointExport::ImplWriteSlideMaster( sal_uInt32 nPageNum, Reference< XPropertySet > aXBackgroundPropSet )
1538 : : {
1539 : : DBG(printf("write slide master: %" SAL_PRIuUINT32 "\n----------------\n", nPageNum));
1540 : :
1541 : : // slides list
1542 [ # # ]: 0 : if( nPageNum == 0 )
1543 [ # # ]: 0 : mPresentationFS->startElementNS( XML_p, XML_sldMasterIdLst, FSEND );
1544 : :
1545 : : OUString sRelId = addRelation( mPresentationFS->getOutputStream(),
1546 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" ),
1547 : : OUStringBuffer()
1548 [ # # ]: 0 : .appendAscii( "slideMasters/slideMaster" )
1549 [ # # ]: 0 : .append( (sal_Int32) nPageNum + 1 )
1550 [ # # ]: 0 : .appendAscii( ".xml" )
1551 [ # # ][ # # ]: 0 : .makeStringAndClear() );
[ # # ][ # # ]
1552 : :
1553 : : mPresentationFS->singleElementNS( XML_p, XML_sldMasterId,
1554 : 0 : XML_id, OString::valueOf( (sal_Int64) GetNewSlideMasterId() ).getStr(),
1555 : : FSNS( XML_r, XML_id ), USS( sRelId ),
1556 [ # # ][ # # ]: 0 : FSEND );
1557 : :
1558 [ # # ]: 0 : if( nPageNum == mnMasterPages - 1 )
1559 [ # # ]: 0 : mPresentationFS->endElementNS( XML_p, XML_sldMasterIdLst );
1560 : :
1561 : : FSHelperPtr pFS =
1562 : : openFragmentStreamWithSerializer( OUStringBuffer()
1563 [ # # ]: 0 : .appendAscii( "ppt/slideMasters/slideMaster" )
1564 [ # # ]: 0 : .append( (sal_Int32) nPageNum + 1 )
1565 [ # # ]: 0 : .appendAscii( ".xml" )
1566 : : .makeStringAndClear(),
1567 [ # # ][ # # ]: 0 : US( "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml" ) );
[ # # ]
1568 [ # # ]: 0 : if( mpMasterFSArray.size() < mnMasterPages )
1569 [ # # ]: 0 : mpMasterFSArray.resize( mnMasterPages );
1570 [ # # ]: 0 : mpMasterFSArray[ nPageNum ] = pFS;
1571 : :
1572 : : // write theme per master
1573 [ # # ]: 0 : WriteTheme( nPageNum );
1574 : :
1575 : : // add implicit relation to the presentation theme
1576 : : addRelation( pFS->getOutputStream(),
1577 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" ),
1578 : : OUStringBuffer()
1579 [ # # ]: 0 : .appendAscii( "../theme/theme" )
1580 [ # # ]: 0 : .append( (sal_Int32) nPageNum + 1 )
1581 [ # # ]: 0 : .appendAscii( ".xml" )
1582 [ # # ][ # # ]: 0 : .makeStringAndClear() );
[ # # ][ # # ]
1583 : :
1584 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_sldMaster, PNMSS, FSEND );
1585 : :
1586 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_cSld, FSEND );
1587 : :
1588 [ # # ][ # # ]: 0 : ImplWriteBackground( pFS, aXBackgroundPropSet );
[ # # ]
1589 [ # # ][ # # ]: 0 : WriteShapeTree( pFS, LAYOUT, sal_True );
[ # # ]
1590 : :
1591 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_cSld );
1592 : :
1593 : : // color map - now it uses colors from hardcoded theme, once we eventually generate theme, this might need update
1594 : : pFS->singleElementNS( XML_p, XML_clrMap,
1595 : : XML_bg1, "lt1",
1596 : : XML_bg2, "lt2",
1597 : : XML_tx1, "dk1",
1598 : : XML_tx2, "dk2",
1599 : : XML_accent1, "accent1",
1600 : : XML_accent2, "accent2",
1601 : : XML_accent3, "accent3",
1602 : : XML_accent4, "accent4",
1603 : : XML_accent5, "accent5",
1604 : : XML_accent6, "accent6",
1605 : : XML_hlink, "hlink",
1606 : : XML_folHlink, "folHlink",
1607 [ # # ]: 0 : FSEND );
1608 : :
1609 : : // use master's id type as they have same range, mso does that as well
1610 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_sldLayoutIdLst, FSEND );
1611 : :
1612 : 0 : int nCount = 0;
1613 [ # # ]: 0 : for( int i = 0; i < LAYOUT_SIZE; i++) {
1614 [ # # ]: 0 : sal_Int32 nLayoutFileId = GetLayoutFileId( i, nPageNum );
1615 [ # # ]: 0 : if( nLayoutFileId > 0 ) {
1616 [ # # ][ # # ]: 0 : AddLayoutIdAndRelation( pFS, nLayoutFileId );
[ # # ]
1617 : 0 : nCount++;
1618 : : } else {
1619 [ # # ]: 0 : ImplWritePPTXLayout( i, nPageNum );
1620 [ # # ][ # # ]: 0 : AddLayoutIdAndRelation( pFS, GetLayoutFileId( i, nPageNum ) );
[ # # ][ # # ]
1621 : : }
1622 : : }
1623 : :
1624 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_sldLayoutIdLst );
1625 : :
1626 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_sldMaster );
1627 : :
1628 [ # # ]: 0 : DBG(printf("----------------\n"));
1629 : 0 : }
1630 : :
1631 : 0 : sal_Int32 PowerPointExport::GetLayoutFileId( sal_Int32 nOffset, sal_uInt32 nMasterNum )
1632 : : {
1633 : : DBG(printf("GetLayoutFileId offset: %" SAL_PRIdINT32 " master: %" SAL_PRIuUINT32 "", nOffset, nMasterNum));
1634 [ # # ]: 0 : if( mLayoutInfo[ nOffset ].mnFileIdArray.size() <= nMasterNum )
1635 : 0 : return 0;
1636 : :
1637 : 0 : return mLayoutInfo[ nOffset ].mnFileIdArray[ nMasterNum ];
1638 : : }
1639 : :
1640 : 0 : void PowerPointExport::ImplWriteLayout( sal_Int32 /*nOffset*/, sal_uInt32 /*nMasterNum*/ )
1641 : : {
1642 : : // we write all the layouts together with master(s)
1643 : : // ImplWritePPTXLayout( GetPPTXLayoutId( nOffset ), nMasterNum );
1644 : 0 : }
1645 : :
1646 : 0 : void PowerPointExport::ImplWritePPTXLayout( sal_Int32 nOffset, sal_uInt32 nMasterNum )
1647 : : {
1648 : : DBG(printf("write layout: %" SAL_PRIdINT32 "\n", nOffset));
1649 : :
1650 [ # # ][ # # ]: 0 : Reference< drawing::XDrawPagesSupplier > xDPS( getModel(), uno::UNO_QUERY );
1651 [ # # ][ # # ]: 0 : Reference< drawing::XDrawPages > xDrawPages( xDPS->getDrawPages(), uno::UNO_QUERY );
[ # # ]
1652 : 0 : Reference< drawing::XDrawPage > xSlide;
1653 [ # # ]: 0 : Reference< container::XIndexAccess > xIndexAccess( xDrawPages, uno::UNO_QUERY );
1654 : :
1655 [ # # ][ # # ]: 0 : xSlide = xDrawPages->insertNewByIndex( xIndexAccess->getCount() );
[ # # ][ # # ]
[ # # ]
1656 : :
1657 : : #ifdef DEBUG
1658 : : if( xSlide.is() )
1659 : : printf("new page created\n");
1660 : : #endif
1661 : :
1662 [ # # ]: 0 : Reference< beans::XPropertySet > xPropSet( xSlide, uno::UNO_QUERY );
1663 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue( US( "Layout" ), makeAny( short( aLayoutInfo[ nOffset ].nType ) ) );
[ # # ][ # # ]
1664 : : DBG(dump_pset( xPropSet ));
1665 : :
1666 [ # # ][ # # ]: 0 : mXPagePropSet = Reference< XPropertySet >( xSlide, UNO_QUERY );
1667 [ # # ][ # # ]: 0 : mXShapes = Reference< XShapes >( xSlide, UNO_QUERY );
1668 : :
1669 [ # # ]: 0 : if( mLayoutInfo[ nOffset ].mnFileIdArray.size() < mnMasterPages ) {
1670 [ # # ]: 0 : mLayoutInfo[ nOffset ].mnFileIdArray.resize( mnMasterPages );
1671 : : }
1672 : :
1673 [ # # ][ # # ]: 0 : if( mLayoutInfo[ nOffset ].mnFileIdArray[ nMasterNum ] != 0 )
1674 : 0 : return;
1675 : :
1676 : : FSHelperPtr pFS
1677 : : = openFragmentStreamWithSerializer( OUStringBuffer()
1678 [ # # ]: 0 : .appendAscii( "ppt/slideLayouts/slideLayout" )
1679 [ # # ]: 0 : .append( (sal_Int32) mnLayoutFileIdMax )
1680 [ # # ]: 0 : .appendAscii( ".xml" )
1681 : : .makeStringAndClear(),
1682 [ # # ][ # # ]: 0 : US( "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml" ) );
[ # # ]
1683 : :
1684 : : // add implicit relation of slide layout to slide master
1685 : : addRelation( pFS->getOutputStream(),
1686 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" ),
1687 : : OUStringBuffer()
1688 [ # # ]: 0 : .appendAscii( "../slideMasters/slideMaster" )
1689 [ # # ]: 0 : .append( (sal_Int32) nMasterNum + 1 )
1690 [ # # ]: 0 : .appendAscii( ".xml" )
1691 [ # # ][ # # ]: 0 : .makeStringAndClear() );
[ # # ][ # # ]
1692 : :
1693 : : pFS->startElementNS( XML_p, XML_sldLayout,
1694 : : PNMSS,
1695 : : XML_type, aLayoutInfo[ nOffset ].sType,
1696 : : XML_preserve, "1",
1697 [ # # ]: 0 : FSEND );
1698 : :
1699 : : pFS->startElementNS( XML_p, XML_cSld,
1700 : : XML_name, aLayoutInfo[ nOffset ].sName,
1701 [ # # ]: 0 : FSEND );
1702 : : //pFS->write( MINIMAL_SPTREE ); // TODO: write actual shape tree
1703 [ # # ][ # # ]: 0 : WriteShapeTree( pFS, LAYOUT, sal_True );
[ # # ]
1704 : :
1705 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_cSld );
1706 : :
1707 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_sldLayout );
1708 : :
1709 [ # # ]: 0 : mLayoutInfo[ nOffset ].mnFileIdArray[ nMasterNum ] = mnLayoutFileIdMax;
1710 : :
1711 : 0 : mnLayoutFileIdMax ++;
1712 : :
1713 [ # # ][ # # ]: 0 : xDrawPages->remove( xSlide );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1714 : : }
1715 : :
1716 : 0 : void PowerPointExport::WriteShapeTree( FSHelperPtr pFS, PageType ePageType, sal_Bool bMaster )
1717 : : {
1718 [ # # ][ # # ]: 0 : PowerPointShapeExport aDML( pFS, &maShapeMap, this );
[ # # ]
1719 : 0 : aDML.SetMaster( bMaster );
1720 : 0 : aDML.SetPageType( ePageType );
1721 : : sal_uInt32 nShapes;
1722 : :
1723 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_spTree, FSEND );
1724 [ # # ]: 0 : pFS->write( MAIN_GROUP );
1725 : :
1726 [ # # ][ # # ]: 0 : ResetGroupTable( nShapes = mXShapes->getCount() );
[ # # ]
1727 : :
1728 [ # # ][ # # ]: 0 : while( GetNextGroupEntry() ) {
1729 : :
1730 [ # # ]: 0 : sal_uInt32 nGroups = GetGroupsClosed();
1731 [ # # ]: 0 : for ( sal_uInt32 i = 0; i < nGroups; i++ ) {
1732 : : DBG(printf( "leave group\n" ));
1733 : : }
1734 : :
1735 [ # # ][ # # ]: 0 : if ( GetShapeByIndex( GetCurrentGroupIndex(), sal_True ) ) {
1736 : : DBG(printf( "mType: \"%s\"\n", mType.getStr() ));
1737 [ # # ]: 0 : aDML.WriteShape( mXShape );
1738 : : }
1739 : : }
1740 : :
1741 [ # # ][ # # ]: 0 : pFS->endElementNS( XML_p, XML_spTree );
1742 : 0 : }
1743 : :
1744 : : #define BEGIN_SHAPE mpFS->startElementNS( XML_p, XML_sp, FSEND )
1745 : : #define END_SHAPE mpFS->endElementNS( XML_p, XML_sp )
1746 : :
1747 : 0 : ShapeExport& PowerPointShapeExport::WritePageShape( Reference< XShape > xShape, PageType ePageType, sal_Bool bPresObj )
1748 : : {
1749 [ # # ][ # # ]: 0 : if( ( ePageType == NOTICE && bPresObj ) || ePageType == LAYOUT )
[ # # ]
1750 [ # # ]: 0 : return WritePlaceholderShape( xShape, SlideImage );
1751 : :
1752 [ # # ]: 0 : return WriteTextShape( xShape );
1753 : : }
1754 : :
1755 : 0 : sal_Bool PowerPointShapeExport::WritePlaceholder( Reference< XShape > xShape, PlaceholderType ePlaceholder, sal_Bool bMaster )
1756 : : {
1757 : : DBG(printf("WritePlaceholder %d %d\n", bMaster, ShapeExport::NonEmptyText( xShape )));
1758 [ # # ][ # # ]: 0 : if( bMaster && ShapeExport::NonEmptyText( xShape ) ) {
[ # # ][ # # ]
[ # # # # ]
1759 [ # # ]: 0 : WritePlaceholderShape( xShape, ePlaceholder );
1760 : :
1761 : 0 : return sal_True;
1762 : : }
1763 : :
1764 : 0 : return sal_False;
1765 : : }
1766 : :
1767 : 0 : ShapeExport& PowerPointShapeExport::WritePlaceholderShape( Reference< XShape > xShape, PlaceholderType ePlaceholder )
1768 : : {
1769 [ # # ]: 0 : BEGIN_SHAPE;
1770 : :
1771 : : // non visual shape properties
1772 [ # # ]: 0 : mpFS->startElementNS( XML_p, XML_nvSpPr, FSEND );
1773 [ # # ]: 0 : WriteNonVisualDrawingProperties( xShape, IDS( PlaceHolder ) );
1774 [ # # ]: 0 : mpFS->startElementNS( XML_p, XML_cNvSpPr, FSEND );
1775 [ # # ]: 0 : mpFS->singleElementNS( XML_a, XML_spLocks, XML_noGrp, "1", FSEND );
1776 [ # # ]: 0 : mpFS->endElementNS( XML_p, XML_cNvSpPr );
1777 [ # # ]: 0 : mpFS->startElementNS( XML_p, XML_nvPr, FSEND );
1778 : :
1779 : 0 : const char* pType = NULL;
1780 [ # # # # : 0 : switch( ePlaceholder ) {
# # # # #
# ]
1781 : : case SlideImage:
1782 : 0 : pType = "sldImg";
1783 : 0 : break;
1784 : : case Notes:
1785 : 0 : pType = "body";
1786 : 0 : break;
1787 : : case Header:
1788 : 0 : pType = "hdr";
1789 : 0 : break;
1790 : : case Footer:
1791 : 0 : pType = "ftr";
1792 : 0 : break;
1793 : : case SlideNumber:
1794 : 0 : pType = "sldNum";
1795 : 0 : break;
1796 : : case DateAndTime:
1797 : 0 : pType = "dt";
1798 : 0 : break;
1799 : : case Outliner:
1800 : 0 : pType = "body";
1801 : 0 : break;
1802 : : case Title:
1803 : 0 : pType = "title";
1804 : 0 : break;
1805 : : case Subtitle:
1806 : 0 : pType = "subTitle";
1807 : 0 : break;
1808 : : default:
1809 : : DBG(printf("warning: unhandled placeholder type: %d\n", ePlaceholder));
1810 : : }
1811 : : DBG(printf("write placeholder %s\n", pType));
1812 [ # # ]: 0 : mpFS->singleElementNS( XML_p, XML_ph, XML_type, pType, FSEND );
1813 [ # # ]: 0 : mpFS->endElementNS( XML_p, XML_nvPr );
1814 [ # # ]: 0 : mpFS->endElementNS( XML_p, XML_nvSpPr );
1815 : :
1816 : : // visual shape properties
1817 [ # # ]: 0 : mpFS->startElementNS( XML_p, XML_spPr, FSEND );
1818 [ # # ]: 0 : WriteShapeTransformation( xShape, XML_a );
1819 [ # # ]: 0 : WritePresetShape( "rect" );
1820 [ # # ]: 0 : Reference< XPropertySet > xProps( xShape, UNO_QUERY );
1821 [ # # ]: 0 : if( xProps.is() )
1822 [ # # ][ # # ]: 0 : WriteBlipFill( xProps, S( "GraphicURL" ) );
[ # # ]
1823 [ # # ]: 0 : mpFS->endElementNS( XML_p, XML_spPr );
1824 : :
1825 [ # # ]: 0 : WriteTextBox( xShape, XML_p );
1826 : :
1827 [ # # ]: 0 : END_SHAPE;
1828 : :
1829 : 0 : return *this;
1830 : : }
1831 : :
1832 : : #define MINIMAL_THEME " <a:themeElements>\
1833 : : <a:clrScheme name=\"Office\">\
1834 : : <a:dk1>\
1835 : : <a:sysClr val=\"windowText\" lastClr=\"000000\"/>\
1836 : : </a:dk1>\
1837 : : <a:lt1>\
1838 : : <a:sysClr val=\"window\" lastClr=\"FFFFFF\"/>\
1839 : : </a:lt1>\
1840 : : <a:dk2>\
1841 : : <a:srgbClr val=\"1F497D\"/>\
1842 : : </a:dk2>\
1843 : : <a:lt2>\
1844 : : <a:srgbClr val=\"EEECE1\"/>\
1845 : : </a:lt2>\
1846 : : <a:accent1>\
1847 : : <a:srgbClr val=\"4F81BD\"/>\
1848 : : </a:accent1>\
1849 : : <a:accent2>\
1850 : : <a:srgbClr val=\"C0504D\"/>\
1851 : : </a:accent2>\
1852 : : <a:accent3>\
1853 : : <a:srgbClr val=\"9BBB59\"/>\
1854 : : </a:accent3>\
1855 : : <a:accent4>\
1856 : : <a:srgbClr val=\"8064A2\"/>\
1857 : : </a:accent4>\
1858 : : <a:accent5>\
1859 : : <a:srgbClr val=\"4BACC6\"/>\
1860 : : </a:accent5>\
1861 : : <a:accent6>\
1862 : : <a:srgbClr val=\"F79646\"/>\
1863 : : </a:accent6>\
1864 : : <a:hlink>\
1865 : : <a:srgbClr val=\"0000FF\"/>\
1866 : : </a:hlink>\
1867 : : <a:folHlink>\
1868 : : <a:srgbClr val=\"800080\"/>\
1869 : : </a:folHlink>\
1870 : : </a:clrScheme>\
1871 : : <a:fontScheme name=\"Office\">\
1872 : : <a:majorFont>\
1873 : : <a:latin typeface=\"Arial\"/>\
1874 : : <a:ea typeface=\"DejaVu Sans\"/>\
1875 : : <a:cs typeface=\"DejaVu Sans\"/>\
1876 : : </a:majorFont>\
1877 : : <a:minorFont>\
1878 : : <a:latin typeface=\"Arial\"/>\
1879 : : <a:ea typeface=\"DejaVu Sans\"/>\
1880 : : <a:cs typeface=\"DejaVu Sans\"/>\
1881 : : </a:minorFont>\
1882 : : </a:fontScheme>\
1883 : : <a:fmtScheme name=\"Office\">\
1884 : : <a:fillStyleLst>\
1885 : : <a:solidFill>\
1886 : : <a:schemeClr val=\"phClr\"/>\
1887 : : </a:solidFill>\
1888 : : <a:gradFill rotWithShape=\"1\">\
1889 : : <a:gsLst>\
1890 : : <a:gs pos=\"0\">\
1891 : : <a:schemeClr val=\"phClr\">\
1892 : : <a:tint val=\"50000\"/>\
1893 : : <a:satMod val=\"300000\"/>\
1894 : : </a:schemeClr>\
1895 : : </a:gs>\
1896 : : <a:gs pos=\"35000\">\
1897 : : <a:schemeClr val=\"phClr\">\
1898 : : <a:tint val=\"37000\"/>\
1899 : : <a:satMod val=\"300000\"/>\
1900 : : </a:schemeClr>\
1901 : : </a:gs>\
1902 : : <a:gs pos=\"100000\">\
1903 : : <a:schemeClr val=\"phClr\">\
1904 : : <a:tint val=\"15000\"/>\
1905 : : <a:satMod val=\"350000\"/>\
1906 : : </a:schemeClr>\
1907 : : </a:gs>\
1908 : : </a:gsLst>\
1909 : : <a:lin ang=\"16200000\" scaled=\"1\"/>\
1910 : : </a:gradFill>\
1911 : : <a:gradFill rotWithShape=\"1\">\
1912 : : <a:gsLst>\
1913 : : <a:gs pos=\"0\">\
1914 : : <a:schemeClr val=\"phClr\">\
1915 : : <a:shade val=\"51000\"/>\
1916 : : <a:satMod val=\"130000\"/>\
1917 : : </a:schemeClr>\
1918 : : </a:gs>\
1919 : : <a:gs pos=\"80000\">\
1920 : : <a:schemeClr val=\"phClr\">\
1921 : : <a:shade val=\"93000\"/>\
1922 : : <a:satMod val=\"130000\"/>\
1923 : : </a:schemeClr>\
1924 : : </a:gs>\
1925 : : <a:gs pos=\"100000\">\
1926 : : <a:schemeClr val=\"phClr\">\
1927 : : <a:shade val=\"94000\"/>\
1928 : : <a:satMod val=\"135000\"/>\
1929 : : </a:schemeClr>\
1930 : : </a:gs>\
1931 : : </a:gsLst>\
1932 : : <a:lin ang=\"16200000\" scaled=\"0\"/>\
1933 : : </a:gradFill>\
1934 : : </a:fillStyleLst>\
1935 : : <a:lnStyleLst>\
1936 : : <a:ln w=\"9525\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\">\
1937 : : <a:solidFill>\
1938 : : <a:schemeClr val=\"phClr\">\
1939 : : <a:shade val=\"95000\"/>\
1940 : : <a:satMod val=\"105000\"/>\
1941 : : </a:schemeClr>\
1942 : : </a:solidFill>\
1943 : : <a:prstDash val=\"solid\"/>\
1944 : : </a:ln>\
1945 : : <a:ln w=\"25400\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\">\
1946 : : <a:solidFill>\
1947 : : <a:schemeClr val=\"phClr\"/>\
1948 : : </a:solidFill>\
1949 : : <a:prstDash val=\"solid\"/>\
1950 : : </a:ln>\
1951 : : <a:ln w=\"38100\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\">\
1952 : : <a:solidFill>\
1953 : : <a:schemeClr val=\"phClr\"/>\
1954 : : </a:solidFill>\
1955 : : <a:prstDash val=\"solid\"/>\
1956 : : </a:ln>\
1957 : : </a:lnStyleLst>\
1958 : : <a:effectStyleLst>\
1959 : : <a:effectStyle>\
1960 : : <a:effectLst>\
1961 : : <a:outerShdw blurRad=\"40000\" dist=\"20000\" dir=\"5400000\" rotWithShape=\"0\">\
1962 : : <a:srgbClr val=\"000000\">\
1963 : : <a:alpha val=\"38000\"/>\
1964 : : </a:srgbClr>\
1965 : : </a:outerShdw>\
1966 : : </a:effectLst>\
1967 : : </a:effectStyle>\
1968 : : <a:effectStyle>\
1969 : : <a:effectLst>\
1970 : : <a:outerShdw blurRad=\"40000\" dist=\"23000\" dir=\"5400000\" rotWithShape=\"0\">\
1971 : : <a:srgbClr val=\"000000\">\
1972 : : <a:alpha val=\"35000\"/>\
1973 : : </a:srgbClr>\
1974 : : </a:outerShdw>\
1975 : : </a:effectLst>\
1976 : : </a:effectStyle>\
1977 : : <a:effectStyle>\
1978 : : <a:effectLst>\
1979 : : <a:outerShdw blurRad=\"40000\" dist=\"23000\" dir=\"5400000\" rotWithShape=\"0\">\
1980 : : <a:srgbClr val=\"000000\">\
1981 : : <a:alpha val=\"35000\"/>\
1982 : : </a:srgbClr>\
1983 : : </a:outerShdw>\
1984 : : </a:effectLst>\
1985 : : <a:scene3d>\
1986 : : <a:camera prst=\"orthographicFront\">\
1987 : : <a:rot lat=\"0\" lon=\"0\" rev=\"0\"/>\
1988 : : </a:camera>\
1989 : : <a:lightRig rig=\"threePt\" dir=\"t\">\
1990 : : <a:rot lat=\"0\" lon=\"0\" rev=\"1200000\"/>\
1991 : : </a:lightRig>\
1992 : : </a:scene3d>\
1993 : : <a:sp3d>\
1994 : : <a:bevelT w=\"63500\" h=\"25400\"/>\
1995 : : </a:sp3d>\
1996 : : </a:effectStyle>\
1997 : : </a:effectStyleLst>\
1998 : : <a:bgFillStyleLst>\
1999 : : <a:solidFill>\
2000 : : <a:schemeClr val=\"phClr\"/>\
2001 : : </a:solidFill>\
2002 : : <a:gradFill rotWithShape=\"1\">\
2003 : : <a:gsLst>\
2004 : : <a:gs pos=\"0\">\
2005 : : <a:schemeClr val=\"phClr\">\
2006 : : <a:tint val=\"40000\"/>\
2007 : : <a:satMod val=\"350000\"/>\
2008 : : </a:schemeClr>\
2009 : : </a:gs>\
2010 : : <a:gs pos=\"40000\">\
2011 : : <a:schemeClr val=\"phClr\">\
2012 : : <a:tint val=\"45000\"/>\
2013 : : <a:shade val=\"99000\"/>\
2014 : : <a:satMod val=\"350000\"/>\
2015 : : </a:schemeClr>\
2016 : : </a:gs>\
2017 : : <a:gs pos=\"100000\">\
2018 : : <a:schemeClr val=\"phClr\">\
2019 : : <a:shade val=\"20000\"/>\
2020 : : <a:satMod val=\"255000\"/>\
2021 : : </a:schemeClr>\
2022 : : </a:gs>\
2023 : : </a:gsLst>\
2024 : : <a:path path=\"circle\">\
2025 : : <a:fillToRect l=\"50000\" t=\"-80000\" r=\"50000\" b=\"180000\"/>\
2026 : : </a:path>\
2027 : : </a:gradFill>\
2028 : : <a:gradFill rotWithShape=\"1\">\
2029 : : <a:gsLst>\
2030 : : <a:gs pos=\"0\">\
2031 : : <a:schemeClr val=\"phClr\">\
2032 : : <a:tint val=\"80000\"/>\
2033 : : <a:satMod val=\"300000\"/>\
2034 : : </a:schemeClr>\
2035 : : </a:gs>\
2036 : : <a:gs pos=\"100000\">\
2037 : : <a:schemeClr val=\"phClr\">\
2038 : : <a:shade val=\"30000\"/>\
2039 : : <a:satMod val=\"200000\"/>\
2040 : : </a:schemeClr>\
2041 : : </a:gs>\
2042 : : </a:gsLst>\
2043 : : <a:path path=\"circle\">\
2044 : : <a:fillToRect l=\"50000\" t=\"50000\" r=\"50000\" b=\"50000\"/>\
2045 : : </a:path>\
2046 : : </a:gradFill>\
2047 : : </a:bgFillStyleLst>\
2048 : : </a:fmtScheme>\
2049 : : </a:themeElements>"
2050 : :
2051 : 0 : void PowerPointExport::WriteTheme( sal_Int32 nThemeNum )
2052 : : {
2053 : : FSHelperPtr pFS = openFragmentStreamWithSerializer( OUStringBuffer()
2054 [ # # ]: 0 : .appendAscii( "ppt/theme/theme" )
2055 [ # # ]: 0 : .append( (sal_Int32) nThemeNum + 1 )
2056 [ # # ]: 0 : .appendAscii( ".xml" )
2057 : : .makeStringAndClear(),
2058 [ # # ][ # # ]: 0 : US( "application/vnd.openxmlformats-officedocument.theme+xml" ) );
[ # # ]
2059 : :
2060 : : pFS->startElementNS( XML_a, XML_theme,
2061 : : FSNS( XML_xmlns, XML_a), "http://schemas.openxmlformats.org/drawingml/2006/main",
2062 : : XML_name, "Office Theme",
2063 [ # # ]: 0 : FSEND );
2064 : :
2065 [ # # ]: 0 : pFS->write( MINIMAL_THEME );
2066 [ # # ][ # # ]: 0 : pFS->endElementNS( XML_a, XML_theme );
2067 : 0 : }
2068 : :
2069 : 0 : sal_Bool PowerPointExport::ImplCreateDocument()
2070 : : {
2071 : 0 : mbCreateNotes = sal_False;
2072 : :
2073 [ # # ]: 0 : for( sal_uInt32 i = 0; i < mnPages; i++ )
2074 : : {
2075 [ # # ]: 0 : if ( !GetPageByIndex( i, NOTICE ) )
2076 : 0 : return sal_False;
2077 : :
2078 [ # # ]: 0 : if( ContainsOtherShapeThanPlaceholders( sal_True ) ) {
2079 : 0 : mbCreateNotes = sal_True;
2080 : 0 : break;
2081 : : }
2082 : : }
2083 : :
2084 : 0 : return sal_True;
2085 : : }
2086 : :
2087 : 0 : sal_Bool PowerPointExport::WriteNotesMaster()
2088 : : {
2089 : : DBG(printf("write Notes master\n----------------\n"));
2090 : :
2091 [ # # ]: 0 : mPresentationFS->startElementNS( XML_p, XML_notesMasterIdLst, FSEND );
2092 : :
2093 : : OUString sRelId = addRelation( mPresentationFS->getOutputStream(),
2094 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster" ),
2095 [ # # ][ # # ]: 0 : US( "notesMasters/notesMaster1.xml" ) );
[ # # ][ # # ]
2096 : :
2097 : : mPresentationFS->singleElementNS( XML_p, XML_notesMasterId,
2098 : : FSNS( XML_r, XML_id ), USS( sRelId ),
2099 [ # # ][ # # ]: 0 : FSEND );
2100 : :
2101 [ # # ]: 0 : mPresentationFS->endElementNS( XML_p, XML_notesMasterIdLst );
2102 : :
2103 : : FSHelperPtr pFS =
2104 : : openFragmentStreamWithSerializer( US( "ppt/notesMasters/notesMaster1.xml" ),
2105 [ # # ][ # # ]: 0 : US( "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml" ) );
[ # # ]
2106 : : // write theme per master
2107 [ # # ]: 0 : WriteTheme( mnMasterPages );
2108 : :
2109 : : // add implicit relation to the presentation theme
2110 : : addRelation( pFS->getOutputStream(),
2111 : : US( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" ),
2112 : : OUStringBuffer()
2113 [ # # ]: 0 : .appendAscii( "../theme/theme" )
2114 [ # # ]: 0 : .append( (sal_Int32) mnMasterPages + 1 )
2115 [ # # ]: 0 : .appendAscii( ".xml" )
2116 [ # # ][ # # ]: 0 : .makeStringAndClear() );
[ # # ][ # # ]
2117 : :
2118 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_notesMaster, PNMSS, FSEND );
2119 : :
2120 [ # # ]: 0 : pFS->startElementNS( XML_p, XML_cSld, FSEND );
2121 : :
2122 : 0 : Reference< XPropertySet > aXBackgroundPropSet;
2123 [ # # ][ # # ]: 0 : if( ImplGetPropertyValue( mXPagePropSet, rtl::OUString( "Background" ) ) &&
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # #
# ][ # # ]
2124 [ # # ]: 0 : ( mAny >>= aXBackgroundPropSet ) )
2125 [ # # ][ # # ]: 0 : ImplWriteBackground( pFS, aXBackgroundPropSet );
[ # # ]
2126 : :
2127 [ # # ][ # # ]: 0 : WriteShapeTree( pFS, NOTICE, sal_True );
[ # # ]
2128 : :
2129 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_cSld );
2130 : :
2131 : : // color map - now it uses colors from hardcoded theme, once we eventually generate theme, this might need update
2132 : : pFS->singleElementNS( XML_p, XML_clrMap,
2133 : : XML_bg1, "lt1",
2134 : : XML_bg2, "lt2",
2135 : : XML_tx1, "dk1",
2136 : : XML_tx2, "dk2",
2137 : : XML_accent1, "accent1",
2138 : : XML_accent2, "accent2",
2139 : : XML_accent3, "accent3",
2140 : : XML_accent4, "accent4",
2141 : : XML_accent5, "accent5",
2142 : : XML_accent6, "accent6",
2143 : : XML_hlink, "hlink",
2144 : : XML_folHlink, "folHlink",
2145 [ # # ]: 0 : FSEND );
2146 : :
2147 [ # # ]: 0 : pFS->endElementNS( XML_p, XML_notesMaster );
2148 : :
2149 : : DBG(printf("----------------\n"));
2150 : :
2151 [ # # ]: 0 : return sal_True;
2152 : : }
2153 : :
2154 : 0 : sal_Bool PowerPointExport::ImplCreateMainNotes()
2155 : : {
2156 [ # # ]: 0 : if( mbCreateNotes )
2157 : 0 : return WriteNotesMaster();
2158 : :
2159 : 0 : return sal_True;
2160 : : }
2161 : :
2162 : 0 : OUString SAL_CALL PowerPointExport_getImplementationName() throw()
2163 : : {
2164 : 0 : return OUString( "com.sun.star.comp.Impress.oox.PowerPointExport" );
2165 : : }
2166 : :
2167 : 0 : uno::Sequence< OUString > SAL_CALL PowerPointExport_getSupportedServiceNames() throw()
2168 : : {
2169 : 0 : const OUString aServiceName( "com.sun.star.comp.ooxpptx" );
2170 [ # # ]: 0 : const Sequence< OUString > aSeq( &aServiceName, 1 );
2171 : 0 : return aSeq;
2172 : : }
2173 : :
2174 : 0 : uno::Reference< uno::XInterface > SAL_CALL PowerPointExport_createInstance(const uno::Reference< XComponentContext > & rxCtxt ) throw( uno::Exception )
2175 : : {
2176 [ # # ]: 0 : return (cppu::OWeakObject*)new PowerPointExport( rxCtxt );
2177 : : }
2178 : :
2179 : 0 : OUString PowerPointExport::implGetImplementationName() const
2180 : : {
2181 : 0 : return PowerPointExport_getImplementationName();
2182 : : }
2183 : : }
2184 : : }
2185 : :
2186 : : // UNO component
2187 : :
2188 : : static struct cppu::ImplementationEntry g_entries[] =
2189 : : {
2190 : : {
2191 : : oox::core::PowerPointExport_createInstance,
2192 : : oox::core::PowerPointExport_getImplementationName,
2193 : : oox::core::PowerPointExport_getSupportedServiceNames,
2194 : : cppu::createSingleComponentFactory,
2195 : : 0 , 0
2196 : : },
2197 : : { 0, 0, 0, 0, 0, 0 }
2198 : : };
2199 : :
2200 : : #ifdef __cplusplus
2201 : : extern "C"
2202 : : {
2203 : : #endif
2204 : :
2205 : 0 : SAL_DLLPUBLIC_EXPORT void* SAL_CALL sdfilt_component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey )
2206 : : {
2207 : 0 : return cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
2208 : : }
2209 : :
2210 : : #ifdef __cplusplus
2211 : : }
2212 : : #endif
2213 : :
2214 : : DBG(
2215 : : void dump_pset(Reference< XPropertySet > rXPropSet)
2216 : : {
2217 : : Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo ();
2218 : : Sequence< beans::Property > props = info->getProperties ();
2219 : :
2220 : : for (int i=0; i < props.getLength (); i++) {
2221 : : OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8);
2222 : : printf ("%30s = ", name.getStr() );
2223 : :
2224 : : Any value = rXPropSet->getPropertyValue( props [i].Name );
2225 : :
2226 : : OUString strValue;
2227 : : sal_Int32 intValue;
2228 : : bool boolValue;
2229 : : RectanglePoint pointValue;
2230 : :
2231 : : if( value >>= strValue )
2232 : : printf ("\"%s\"\n", USS( strValue ) );
2233 : : else if( value >>= intValue )
2234 : : printf ("%" SAL_PRIdINT32 " (hex: %" SAL_PRIxUINT32 ")\n", intValue, intValue);
2235 : : else if( value >>= boolValue )
2236 : : printf ("%d (bool)\n", boolValue);
2237 : : else if( value >>= pointValue )
2238 : : printf ("%d (RectanglePoint)\n", pointValue);
2239 : : else
2240 : : printf ("??? <unhandled type>\n");
2241 : : }
2242 : : }
2243 [ + - ][ + - ]: 9 : );
2244 : :
2245 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|