Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "eppt.hxx"
22 : #include "epptdef.hxx"
23 :
24 : #include <comphelper/extract.hxx>
25 : #include <tools/globname.hxx>
26 : #include <tools/datetime.hxx>
27 : #include <tools/poly.hxx>
28 : #include <tools/stream.hxx>
29 : #include <vcl/graph.hxx>
30 : #include <vcl/bmpacc.hxx>
31 : #include <vcl/gradient.hxx>
32 : #include <vcl/virdev.hxx>
33 : #include <rtl/ustring.hxx>
34 : #include <rtl/strbuf.hxx>
35 : #include <vcl/fltcall.hxx>
36 : #include <vcl/wmf.hxx>
37 : #include <sfx2/docfile.hxx>
38 : #include <sfx2/docinf.hxx>
39 : #include <svx/unoapi.hxx>
40 : #include <svx/svdobj.hxx>
41 : #include <svx/svdoole2.hxx>
42 : #include <svx/svdmodel.hxx>
43 : #include <svx/svdpage.hxx>
44 : #include <com/sun/star/view/PaperOrientation.hpp>
45 : #include <com/sun/star/view/PaperFormat.hpp>
46 : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
47 : #include <com/sun/star/office/XAnnotation.hpp>
48 : #include <com/sun/star/office/XAnnotationAccess.hpp>
49 : #include <com/sun/star/office/XAnnotationEnumeration.hpp>
50 : #include <com/sun/star/geometry/RealPoint2D.hpp>
51 : #include <com/sun/star/util/DateTime.hpp>
52 : #include <com/sun/star/animations/TransitionType.hpp>
53 : #include <com/sun/star/animations/TransitionSubType.hpp>
54 : #include <com/sun/star/awt/FontDescriptor.hpp>
55 : #include <com/sun/star/awt/FontFamily.hpp>
56 : #include <com/sun/star/awt/FontPitch.hpp>
57 : #include <com/sun/star/container/XNamed.hpp>
58 : #include <com/sun/star/container/XNameAccess.hpp>
59 : #include <com/sun/star/presentation/XPresentationPage.hpp>
60 : #include <com/sun/star/text/XSimpleText.hpp>
61 : #include <com/sun/star/style/XStyle.hpp>
62 : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
63 : #include <editeng/svxenum.hxx>
64 : #include <editeng/flditem.hxx>
65 : #include <sot/storinfo.hxx>
66 : #include <filter/msfilter/msoleexp.hxx>
67 : #include <filter/msfilter/msdffimp.hxx>
68 : #include <filter/msfilter/svxmsbas.hxx>
69 :
70 : #ifdef DEBUG
71 : #define DBG(x) x
72 : #include <stdio.h>
73 : #else
74 : #define DBG(x)
75 : #endif
76 :
77 : using namespace com::sun::star;
78 :
79 : using namespace ::com::sun::star::animations;
80 : using namespace ::com::sun::star::awt::FontFamily;
81 : using namespace ::com::sun::star::awt::FontPitch;
82 : using namespace ::com::sun::star::presentation;
83 :
84 : using ::com::sun::star::awt::FontDescriptor;
85 : using ::com::sun::star::beans::XPropertySet;
86 : using ::com::sun::star::container::XNameAccess;
87 : using ::com::sun::star::container::XNamed;
88 : using ::com::sun::star::drawing::XDrawPagesSupplier;
89 : using ::com::sun::star::drawing::XMasterPagesSupplier;
90 : using ::com::sun::star::drawing::XShapes;
91 : using ::com::sun::star::drawing::XMasterPageTarget;
92 : using ::com::sun::star::drawing::XDrawPage;
93 : using ::com::sun::star::frame::XModel;
94 : using ::com::sun::star::style::XStyleFamiliesSupplier;
95 : using ::com::sun::star::style::XStyle;
96 : using ::com::sun::star::task::XStatusIndicator;
97 : using ::com::sun::star::text::XSimpleText;
98 : using ::com::sun::star::uno::Any;
99 : using ::com::sun::star::uno::Exception;
100 : using ::com::sun::star::uno::Reference;
101 : using ::com::sun::star::uno::UNO_QUERY;
102 :
103 : static PHLayout pPHLayout[] =
104 : {
105 : { EPP_LAYOUT_TITLESLIDE, { 0x0d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x10, sal_True, sal_True, sal_False },
106 : { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_True, sal_True, sal_False },
107 : { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, sal_True, sal_True, sal_False },
108 : { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_True, sal_True, sal_True },
109 : { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, sal_True, sal_True, sal_False },
110 : { EPP_LAYOUT_BLANCSLIDE, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_False, sal_False, sal_False },
111 : { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, sal_True, sal_True, sal_False },
112 : { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x14, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, sal_True, sal_True, sal_False },
113 : { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x15, 0x0d, 0x0e, sal_True, sal_False, sal_False },
114 : { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x16, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, sal_True, sal_True, sal_False },
115 : { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
116 : { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_False, sal_False },
117 : { EPP_LAYOUT_RIGHTCOLUMN2ROWS, { 0x0d, 0x0e, 0x13, 0x13, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
118 : { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
119 : { EPP_LAYOUT_2ROWSANDTITLE, { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
120 : { EPP_LAYOUT_LEFTCOLUMN2ROWS, { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
121 : { EPP_LAYOUT_TOPROW2COLUMN, { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
122 : { EPP_LAYOUT_2ROWSANDTITLE, { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
123 : { EPP_LAYOUT_4OBJECTS, { 0x0d, 0x13, 0x13, 0x13, 0x13, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_False, sal_False },
124 : { EPP_LAYOUT_ONLYTITLE, { 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_True, sal_False, sal_False },
125 : { EPP_LAYOUT_BLANCSLIDE, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_False, sal_False, sal_False },
126 : { EPP_LAYOUT_TITLERIGHT2BODIESLEFT, { 0x11, 0x12, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x11, 0x12, sal_True, sal_True, sal_False },
127 : { EPP_LAYOUT_TITLERIGHTBODYLEFT, { 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x11, 0x12, sal_True, sal_True, sal_False },
128 : { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x12, sal_True, sal_True, sal_False },
129 : { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x16, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x12, sal_True, sal_True, sal_False }
130 : };
131 :
132 0 : PPTWriterBase::PPTWriterBase() :
133 : mXModel (0),
134 : mXStatusIndicator (0),
135 : mbStatusIndicator (false),
136 : maFraction (1, 576),
137 : maMapModeSrc (MAP_100TH_MM),
138 : maMapModeDest (MAP_INCH, Point(), maFraction, maFraction),
139 : meLatestPageType (NORMAL),
140 0 : mpStyleSheet (0)
141 : {
142 : DBG(printf ("PPTWriterBase::PPTWriterBase()\n"));
143 0 : }
144 :
145 0 : PPTWriterBase::PPTWriterBase( const Reference< XModel > & rXModel,
146 : const Reference< XStatusIndicator > & rXStatInd ) :
147 : mXModel (rXModel),
148 : mXStatusIndicator (rXStatInd),
149 : mbStatusIndicator (false),
150 : maFraction (1, 576),
151 : maMapModeSrc (MAP_100TH_MM),
152 : maMapModeDest (MAP_INCH, Point(), maFraction, maFraction),
153 : meLatestPageType (NORMAL),
154 0 : mpStyleSheet (0)
155 : {
156 0 : }
157 :
158 : // ---------------------------------------------------------------------------------------------
159 :
160 0 : PPTWriterBase::~PPTWriterBase()
161 : {
162 : // Possibly unnecessary sanity check for mXStatusIndicator.is().
163 : // In 3.3 we had a bug report of a crash where it was null,
164 : // https://bugzilla.novell.com/show_bug.cgi?id=694119 (non-public,
165 : // bug report, sorry).
166 0 : if ( mbStatusIndicator && mXStatusIndicator.is() )
167 0 : mXStatusIndicator->end();
168 0 : }
169 :
170 : // ---------------------------------------------------------------------------------------------
171 :
172 0 : void PPTWriterBase::exportPPT( const std::vector< com::sun::star::beans::PropertyValue >& rMediaData )
173 : {
174 0 : if ( !InitSOIface() )
175 0 : return;
176 :
177 : FontCollectionEntry aDefaultFontDesc( OUString( "Times New Roman" ),
178 : ROMAN,
179 : awt::FontPitch::VARIABLE,
180 0 : RTL_TEXTENCODING_MS_1252 );
181 0 : maFontCollection.GetId( aDefaultFontDesc ); // default is always times new roman
182 :
183 0 : if ( !GetPageByIndex( 0, NOTICE ) )
184 0 : return;
185 :
186 0 : sal_Int32 nWidth = 21000;
187 0 : if ( ImplGetPropertyValue( mXPagePropSet, OUString( "Width" ) ) )
188 0 : mAny >>= nWidth;
189 0 : sal_Int32 nHeight = 29700;
190 0 : if ( ImplGetPropertyValue( mXPagePropSet, OUString( "Height" ) ) )
191 0 : mAny >>= nHeight;
192 :
193 0 : maNotesPageSize = MapSize( awt::Size( nWidth, nHeight ) );
194 :
195 0 : if ( !GetPageByIndex( 0, MASTER ) )
196 0 : return;
197 :
198 0 : nWidth = 28000;
199 0 : if ( ImplGetPropertyValue( mXPagePropSet, OUString( "Width" ) ) )
200 0 : mAny >>= nWidth;
201 0 : nHeight = 21000;
202 0 : if ( ImplGetPropertyValue( mXPagePropSet, OUString( "Height" ) ) )
203 0 : mAny >>= nHeight;
204 0 : maDestPageSize = MapSize( awt::Size( nWidth, nHeight ) );
205 0 : maPageSize = awt::Size(nWidth, nHeight);
206 :
207 : DBG(printf( "call exportDocumentPre()\n"));
208 0 : exportPPTPre(rMediaData);
209 :
210 0 : if ( !GetStyleSheets() )
211 0 : return;
212 :
213 0 : if ( !ImplCreateDocument() )
214 0 : return;
215 :
216 : sal_uInt32 i;
217 :
218 0 : for ( i = 0; i < mnPages; i++ )
219 : {
220 0 : if ( GetPageByIndex( i, NORMAL ) ) {
221 0 : sal_uInt32 nMasterNum = GetMasterIndex( NORMAL );
222 0 : ImplWriteLayout( GetLayoutOffset( mXPagePropSet ), nMasterNum );
223 : }
224 : }
225 :
226 0 : for ( i = 0; i < mnMasterPages; i++ )
227 : {
228 0 : if ( !CreateSlideMaster( i ) )
229 0 : return;
230 : }
231 0 : if ( !CreateMainNotes() )
232 0 : return;
233 :
234 0 : for ( i = 0; i < mnPages; i++ )
235 : {
236 : DBG(printf( "call ImplCreateSlide( %" SAL_PRIuUINT32 " )\n", i));
237 0 : if ( !CreateSlide( i ) )
238 0 : return;
239 : }
240 :
241 0 : for ( i = 0; i < mnPages; i++ )
242 : {
243 0 : if ( !CreateNotes( i ) )
244 0 : return;
245 : }
246 :
247 : DBG(printf( "call exportDocumentPost()\n"));
248 0 : exportPPTPost();
249 : }
250 :
251 : // ---------------------------------------------------------------------------------------------
252 :
253 0 : sal_Bool PPTWriterBase::InitSOIface()
254 : {
255 : while( true )
256 : {
257 0 : mXDrawPagesSupplier = Reference< XDrawPagesSupplier >( mXModel, UNO_QUERY );
258 0 : if ( !mXDrawPagesSupplier.is() )
259 0 : break;
260 :
261 0 : mXMasterPagesSupplier = Reference< XMasterPagesSupplier >( mXModel, UNO_QUERY );
262 0 : if ( !mXMasterPagesSupplier.is() )
263 0 : break;
264 0 : mXDrawPages = mXMasterPagesSupplier->getMasterPages();
265 0 : if ( !mXDrawPages.is() )
266 0 : break;
267 0 : mnMasterPages = mXDrawPages->getCount();
268 0 : mXDrawPages = mXDrawPagesSupplier->getDrawPages();
269 0 : if( !mXDrawPages.is() )
270 0 : break;
271 0 : mnPages = mXDrawPages->getCount();
272 0 : if ( !GetPageByIndex( 0, NORMAL ) )
273 0 : break;
274 :
275 0 : return sal_True;
276 : }
277 0 : return sal_False;
278 : }
279 :
280 : // ---------------------------------------------------------------------------------------------
281 :
282 0 : sal_Bool PPTWriterBase::GetPageByIndex( sal_uInt32 nIndex, PageType ePageType )
283 : {
284 : while( true )
285 : {
286 0 : if ( ePageType != meLatestPageType )
287 : {
288 0 : switch( ePageType )
289 : {
290 : case NORMAL :
291 : case NOTICE :
292 : {
293 0 : mXDrawPages = mXDrawPagesSupplier->getDrawPages();
294 0 : if( !mXDrawPages.is() )
295 0 : return sal_False;
296 : }
297 0 : break;
298 :
299 : case MASTER :
300 : {
301 0 : mXDrawPages = mXMasterPagesSupplier->getMasterPages();
302 0 : if( !mXDrawPages.is() )
303 0 : return sal_False;
304 : }
305 0 : break;
306 : default:
307 0 : break;
308 : }
309 0 : meLatestPageType = ePageType;
310 : }
311 0 : Any aAny( mXDrawPages->getByIndex( nIndex ) );
312 0 : aAny >>= mXDrawPage;
313 0 : if ( !mXDrawPage.is() )
314 0 : break;
315 0 : if ( ePageType == NOTICE )
316 : {
317 0 : Reference< XPresentationPage > aXPresentationPage( mXDrawPage, UNO_QUERY );
318 0 : if ( !aXPresentationPage.is() )
319 0 : break;
320 0 : mXDrawPage = aXPresentationPage->getNotesPage();
321 0 : if ( !mXDrawPage.is() )
322 0 : break;
323 : }
324 0 : mXPagePropSet = Reference< XPropertySet >( mXDrawPage, UNO_QUERY );
325 0 : if ( !mXPagePropSet.is() )
326 0 : break;
327 :
328 0 : mXShapes = Reference< XShapes >( mXDrawPage, UNO_QUERY );
329 0 : if ( !mXShapes.is() )
330 0 : break;
331 :
332 : /* try to get the "real" background PropertySet. If the normal page is not supporting this property, it is
333 : taken the property from the master */
334 0 : sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, OUString( "Background" ), sal_True );
335 0 : if ( bHasBackground )
336 0 : bHasBackground = ( aAny >>= mXBackgroundPropSet );
337 0 : if ( !bHasBackground )
338 : {
339 0 : Reference< XMasterPageTarget > aXMasterPageTarget( mXDrawPage, UNO_QUERY );
340 0 : if ( aXMasterPageTarget.is() )
341 : {
342 0 : Reference< XDrawPage > aXMasterDrawPage;
343 0 : aXMasterDrawPage = aXMasterPageTarget->getMasterPage();
344 0 : if ( aXMasterDrawPage.is() )
345 : {
346 0 : Reference< XPropertySet > aXMasterPagePropSet;
347 0 : aXMasterPagePropSet = Reference< XPropertySet >
348 0 : ( aXMasterDrawPage, UNO_QUERY );
349 0 : if ( aXMasterPagePropSet.is() )
350 : {
351 0 : sal_Bool bBackground = GetPropertyValue( aAny, aXMasterPagePropSet, OUString( "Background" ) );
352 0 : if ( bBackground )
353 : {
354 0 : aAny >>= mXBackgroundPropSet;
355 : }
356 0 : }
357 0 : }
358 0 : }
359 : }
360 0 : return sal_True;
361 0 : }
362 0 : return sal_False;
363 : }
364 :
365 : // ---------------------------------------------------------------------------------------------
366 :
367 0 : sal_Bool PPTWriterBase::CreateSlide( sal_uInt32 nPageNum )
368 : {
369 0 : Any aAny;
370 :
371 0 : if ( !GetPageByIndex( nPageNum, NORMAL ) )
372 0 : return sal_False;
373 :
374 0 : sal_uInt32 nMasterNum = GetMasterIndex( NORMAL );
375 0 : SetCurrentStyleSheet( nMasterNum );
376 :
377 0 : Reference< XPropertySet > aXBackgroundPropSet;
378 0 : sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, OUString( "Background" ) );
379 0 : if ( bHasBackground )
380 0 : bHasBackground = ( aAny >>= aXBackgroundPropSet );
381 :
382 0 : sal_uInt16 nMode = 7; // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background
383 0 : if ( bHasBackground )
384 0 : nMode &=~4;
385 :
386 : /* sj: Don't know what's IsBackgroundVisible for, have to ask cl
387 : if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundVisible" ) ) ) )
388 : {
389 : sal_Bool bBackgroundVisible;
390 : if ( aAny >>= bBackgroundVisible )
391 : {
392 : if ( bBackgroundVisible )
393 : nMode &= ~4;
394 : }
395 : }
396 : */
397 0 : if ( GetPropertyValue( aAny, mXPagePropSet, OUString( "IsBackgroundObjectsVisible" ) ) )
398 : {
399 0 : sal_Bool bBackgroundObjectsVisible = sal_False;
400 0 : if ( aAny >>= bBackgroundObjectsVisible )
401 : {
402 0 : if ( !bBackgroundObjectsVisible )
403 0 : nMode &= ~1;
404 : }
405 : }
406 :
407 0 : ImplWriteSlide( nPageNum, nMasterNum, nMode, bHasBackground, aXBackgroundPropSet );
408 :
409 0 : return sal_True;
410 : };
411 :
412 : // ---------------------------------------------------------------------------------------------
413 :
414 0 : sal_Bool PPTWriterBase::CreateNotes( sal_uInt32 nPageNum )
415 : {
416 0 : if ( !GetPageByIndex( nPageNum, NOTICE ) )
417 0 : return sal_False;
418 0 : SetCurrentStyleSheet( GetMasterIndex( NORMAL ) );
419 :
420 0 : ImplWriteNotes( nPageNum );
421 :
422 0 : return sal_True;
423 : };
424 :
425 : // ---------------------------------------------------------------------------------------------
426 :
427 0 : sal_Bool PPTWriterBase::CreateSlideMaster( sal_uInt32 nPageNum )
428 : {
429 0 : if ( !GetPageByIndex( nPageNum, MASTER ) )
430 0 : return sal_False;
431 0 : SetCurrentStyleSheet( nPageNum );
432 :
433 0 : if ( !ImplGetPropertyValue( mXPagePropSet, OUString( "Background" ) ) ) // load background shape
434 0 : return sal_False;
435 0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet;
436 0 : if ( !( mAny >>= aXBackgroundPropSet ) )
437 0 : return sal_False;
438 :
439 0 : ImplWriteSlideMaster( nPageNum, aXBackgroundPropSet );
440 :
441 0 : return sal_True;
442 : };
443 :
444 : // ---------------------------------------------------------------------------------------------
445 :
446 0 : sal_Int32 PPTWriterBase::GetLayoutOffset( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const
447 : {
448 0 : ::com::sun::star::uno::Any aAny;
449 0 : sal_Int32 nLayout = 20;
450 0 : if ( GetPropertyValue( aAny, rXPropSet, OUString( "Layout" ) ), sal_True )
451 0 : aAny >>= nLayout;
452 :
453 : DBG(printf("GetLayoutOffset %" SAL_PRIdINT32 "\n", nLayout));
454 :
455 0 : return nLayout;
456 : }
457 :
458 0 : sal_Int32 PPTWriterBase::GetLayoutOffsetFixed( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const
459 : {
460 0 : sal_Int32 nLayout = GetLayoutOffset( rXPropSet );
461 :
462 0 : if ( ( nLayout >= 21 ) && ( nLayout <= 26 ) ) // NOTES _> HANDOUT6
463 0 : nLayout = 20;
464 0 : if ( ( nLayout >= 27 ) && ( nLayout <= 30 ) ) // VERTICAL LAYOUT
465 0 : nLayout -= 6;
466 0 : else if ( nLayout > 30 )
467 0 : nLayout = 20;
468 :
469 0 : return nLayout;
470 : }
471 :
472 0 : PHLayout& PPTWriterBase::GetLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const
473 : {
474 0 : return pPHLayout[ GetLayoutOffsetFixed( rXPropSet ) ];
475 : }
476 :
477 : // ---------------------------------------------------------------------------------------------
478 :
479 0 : PHLayout& PPTWriterBase::GetLayout( sal_Int32 nOffset ) const
480 : {
481 0 : if( nOffset >= 0 && nOffset < EPP_LAYOUT_SIZE )
482 0 : return pPHLayout[ nOffset ];
483 :
484 : DBG(printf("asked %" SAL_PRIdINT32 " for layout outside of 0,%d array scope\n", nOffset, EPP_LAYOUT_SIZE ));
485 :
486 0 : return pPHLayout[ 0 ];
487 : }
488 :
489 : // ---------------------------------------------------------------------------------------------
490 :
491 0 : sal_uInt32 PPTWriterBase::GetMasterIndex( PageType ePageType )
492 : {
493 0 : sal_uInt32 nRetValue = 0;
494 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget >
495 0 : aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
496 :
497 0 : if ( aXMasterPageTarget.is() )
498 : {
499 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
500 0 : aXDrawPage = aXMasterPageTarget->getMasterPage();
501 0 : if ( aXDrawPage.is() )
502 : {
503 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
504 0 : aXPropertySet( aXDrawPage, ::com::sun::star::uno::UNO_QUERY );
505 :
506 0 : if ( aXPropertySet.is() )
507 : {
508 0 : if ( ImplGetPropertyValue( aXPropertySet, OUString( "Number" ) ) )
509 0 : nRetValue |= *(sal_Int16*)mAny.getValue();
510 0 : if ( nRetValue & 0xffff ) // avoid overflow
511 0 : nRetValue--;
512 0 : }
513 0 : }
514 : }
515 0 : if ( ePageType == NOTICE )
516 0 : nRetValue += mnMasterPages;
517 0 : return nRetValue;
518 : }
519 :
520 : // -----------------------------------------------------------------------
521 :
522 0 : sal_Bool PPTWriterBase::SetCurrentStyleSheet( sal_uInt32 nPageNum )
523 : {
524 0 : sal_Bool bRet = sal_False;
525 0 : if ( nPageNum >= maStyleSheetList.size() )
526 0 : nPageNum = 0;
527 : else
528 0 : bRet = sal_True;
529 0 : mpStyleSheet = maStyleSheetList[ nPageNum ];
530 0 : return bRet;
531 : }
532 :
533 : // ---------------------------------------------------------------------------------------------
534 :
535 0 : sal_Bool PPTWriterBase::GetStyleSheets()
536 : {
537 : int nInstance, nLevel;
538 0 : sal_Bool bRetValue = sal_False;
539 : sal_uInt32 nPageNum;
540 :
541 0 : for ( nPageNum = 0; nPageNum < mnMasterPages; nPageNum++ )
542 : {
543 : Reference< XNamed >
544 0 : aXNamed;
545 :
546 : Reference< XNameAccess >
547 0 : aXNameAccess;
548 :
549 : Reference< XStyleFamiliesSupplier >
550 0 : aXStyleFamiliesSupplier( mXModel, UNO_QUERY );
551 :
552 : Reference< XPropertySet >
553 0 : aXPropSet( mXModel, UNO_QUERY );
554 :
555 0 : sal_uInt16 nDefaultTab = ( aXPropSet.is() && ImplGetPropertyValue( aXPropSet, OUString( "TabStop" ) ) )
556 0 : ? (sal_uInt16)( *(sal_Int32*)mAny.getValue() / 4.40972 )
557 0 : : 1250;
558 :
559 0 : maStyleSheetList.push_back( new PPTExStyleSheet( nDefaultTab, (PPTExBulletProvider&)*this ) );
560 0 : SetCurrentStyleSheet( nPageNum );
561 0 : if ( GetPageByIndex( nPageNum, MASTER ) )
562 0 : aXNamed = Reference< XNamed >
563 0 : ( mXDrawPage, UNO_QUERY );
564 :
565 0 : if ( aXStyleFamiliesSupplier.is() )
566 0 : aXNameAccess = aXStyleFamiliesSupplier->getStyleFamilies();
567 :
568 0 : bRetValue = aXNamed.is() && aXNameAccess.is() && aXStyleFamiliesSupplier.is();
569 0 : if ( bRetValue )
570 : {
571 0 : for ( nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_CenterTitle; nInstance++ )
572 : {
573 0 : String aStyle;
574 0 : String aFamily;
575 0 : switch ( nInstance )
576 : {
577 : case EPP_TEXTTYPE_CenterTitle :
578 : case EPP_TEXTTYPE_Title :
579 : {
580 0 : aStyle = OUString( "title" );
581 0 : aFamily = aXNamed->getName();
582 : }
583 0 : break;
584 : case EPP_TEXTTYPE_Body :
585 : {
586 0 : aStyle = OUString( "outline1" ); // SD_LT_SEPARATOR
587 0 : aFamily = aXNamed->getName();
588 : }
589 0 : break;
590 : case EPP_TEXTTYPE_Other :
591 : {
592 0 : aStyle = OUString( "standard" );
593 0 : aFamily = OUString( "graphics" );
594 : }
595 0 : break;
596 : case EPP_TEXTTYPE_CenterBody :
597 : {
598 0 : aStyle = OUString( "subtitle" );
599 0 : aFamily = aXNamed->getName();
600 : }
601 0 : break;
602 : }
603 0 : if ( aStyle.Len() && aFamily.Len() )
604 : {
605 : try
606 : {
607 0 : Reference< XNameAccess >xNameAccess;
608 0 : if ( aXNameAccess->hasByName( aFamily ) )
609 : {
610 0 : Any aAny( aXNameAccess->getByName( aFamily ) );
611 0 : if( aAny.getValue() && ::cppu::extractInterface( xNameAccess, aAny ) )
612 : {
613 0 : Reference< XNameAccess > aXFamily;
614 0 : if ( aAny >>= aXFamily )
615 : {
616 0 : if ( aXFamily->hasByName( aStyle ) )
617 : {
618 0 : Reference< XStyle > xStyle;
619 0 : aAny = aXFamily->getByName( aStyle );
620 0 : if( aAny.getValue() && ::cppu::extractInterface( xStyle, aAny ) )
621 : {
622 0 : Reference< XStyle > aXStyle;
623 0 : aAny >>= aXStyle;
624 : Reference< XPropertySet >
625 0 : xPropSet( aXStyle, UNO_QUERY );
626 0 : if( xPropSet.is() )
627 0 : mpStyleSheet->SetStyleSheet( xPropSet, maFontCollection, nInstance, 0 );
628 0 : for ( nLevel = 1; nLevel < 5; nLevel++ )
629 : {
630 0 : if ( nInstance == EPP_TEXTTYPE_Body )
631 : {
632 0 : sal_Unicode cTemp = aStyle.GetChar( aStyle.Len() - 1 );
633 0 : aStyle.SetChar( aStyle.Len() - 1, ++cTemp );
634 0 : if ( aXFamily->hasByName( aStyle ) )
635 : {
636 0 : aXFamily->getByName( aStyle ) >>= xStyle;
637 0 : if( xStyle.is() )
638 : {
639 : Reference< XPropertySet >
640 0 : xPropertySet( xStyle, UNO_QUERY );
641 0 : if ( xPropertySet.is() )
642 0 : mpStyleSheet->SetStyleSheet( xPropertySet, maFontCollection, nInstance, nLevel );
643 : }
644 : }
645 : }
646 : else
647 0 : mpStyleSheet->SetStyleSheet( xPropSet, maFontCollection, nInstance, nLevel );
648 0 : }
649 0 : }
650 : }
651 0 : }
652 0 : }
653 0 : }
654 : }
655 0 : catch( Exception& )
656 : {
657 : //
658 : }
659 : }
660 0 : }
661 0 : for ( ; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
662 : {
663 :
664 : }
665 : }
666 0 : }
667 0 : return bRetValue;
668 : }
669 :
670 : // -----------------------------------------------------------------------
671 :
672 0 : sal_Bool PPTWriterBase::CreateMainNotes()
673 : {
674 0 : if ( !GetPageByIndex( 0, NOTICE ) )
675 0 : return sal_False;
676 0 : SetCurrentStyleSheet( 0 );
677 :
678 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget >
679 0 : aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
680 :
681 0 : if ( !aXMasterPageTarget.is() )
682 0 : return sal_False;
683 :
684 0 : mXDrawPage = aXMasterPageTarget->getMasterPage();
685 0 : if ( !mXDrawPage.is() )
686 0 : return sal_False;
687 :
688 0 : mXPropSet = ::com::sun::star::uno::Reference<
689 : ::com::sun::star::beans::XPropertySet >
690 0 : ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
691 0 : if ( !mXPropSet.is() )
692 0 : return sal_False;
693 :
694 0 : mXShapes = ::com::sun::star::uno::Reference<
695 : ::com::sun::star::drawing::XShapes >
696 0 : ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
697 0 : if ( !mXShapes.is() )
698 0 : return sal_False;
699 :
700 0 : return ImplCreateMainNotes();
701 : }
702 :
703 : // -----------------------------------------------------------------------
704 :
705 0 : awt::Size PPTWriterBase::MapSize( const awt::Size& rSize )
706 : {
707 0 : Size aRetSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) );
708 :
709 0 : if ( !aRetSize.Width() )
710 0 : aRetSize.Width()++;
711 0 : if ( !aRetSize.Height() )
712 0 : aRetSize.Height()++;
713 0 : return awt::Size( aRetSize.Width(), aRetSize.Height() );
714 : }
715 :
716 : // -----------------------------------------------------------------------
717 :
718 0 : awt::Point PPTWriterBase::MapPoint( const awt::Point& rPoint )
719 : {
720 0 : Point aRet( OutputDevice::LogicToLogic( Point( rPoint.X, rPoint.Y ), maMapModeSrc, maMapModeDest ) );
721 0 : return awt::Point( aRet.X(), aRet.Y() );
722 : }
723 :
724 : // -----------------------------------------------------------------------
725 :
726 0 : Rectangle PPTWriterBase::MapRectangle( const awt::Rectangle& rRect )
727 : {
728 0 : ::com::sun::star::awt::Point aPoint( rRect.X, rRect.Y );
729 0 : ::com::sun::star::awt::Size aSize( rRect.Width, rRect.Height );
730 0 : ::com::sun::star::awt::Point aP( MapPoint( aPoint ) );
731 0 : ::com::sun::star::awt::Size aS( MapSize( aSize ) );
732 0 : return Rectangle( Point( aP.X, aP.Y ), Size( aS.Width, aS.Height ) );
733 : }
734 :
735 : // -----------------------------------------------------------------------
736 :
737 0 : sal_Bool PPTWriterBase::GetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup )
738 : {
739 : while(true)
740 : {
741 0 : if ( ( bGroup == sal_False ) || ( GetCurrentGroupLevel() == 0 ) )
742 : {
743 0 : Any aAny( mXShapes->getByIndex( nIndex ) );
744 0 : aAny >>= mXShape;
745 : }
746 : else
747 : {
748 0 : Any aAny( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() ) );
749 0 : aAny >>= mXShape;
750 : }
751 0 : if ( !mXShape.is() )
752 0 : break;
753 :
754 0 : Any aAny( mXShape->queryInterface( ::getCppuType( (const Reference< XPropertySet >*) 0 ) ));
755 0 : aAny >>= mXPropSet;
756 :
757 0 : if ( !mXPropSet.is() )
758 0 : break;
759 0 : maPosition = MapPoint( mXShape->getPosition() );
760 0 : maSize = MapSize( mXShape->getSize() );
761 0 : maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
762 :
763 : OStringBuffer aTypeBuffer(OUStringToOString(
764 0 : mXShape->getShapeType(), RTL_TEXTENCODING_UTF8));
765 : // remove "com.sun.star."
766 0 : aTypeBuffer.remove(0, RTL_CONSTASCII_LENGTH("com.sun.star."));
767 :
768 0 : sal_Int32 nPos = aTypeBuffer.toString().indexOf("Shape");
769 0 : aTypeBuffer.remove(nPos, RTL_CONSTASCII_LENGTH("Shape"));
770 0 : mType = aTypeBuffer.makeStringAndClear();
771 :
772 0 : mbPresObj = mbEmptyPresObj = sal_False;
773 0 : if ( ImplGetPropertyValue( OUString( "IsPresentationObject" ) ) )
774 0 : mAny >>= mbPresObj;
775 :
776 0 : if ( mbPresObj && ImplGetPropertyValue( OUString( "IsEmptyPresentationObject" ) ) )
777 0 : mAny >>= mbEmptyPresObj;
778 :
779 : mnAngle = ( PropValue::GetPropertyValue( aAny,
780 0 : mXPropSet, OUString( "RotateAngle" ), sal_True ) )
781 0 : ? *((sal_Int32*)aAny.getValue() )
782 0 : : 0;
783 :
784 0 : return sal_True;
785 0 : }
786 0 : return sal_False;
787 : }
788 :
789 : // -----------------------------------------------------------------------
790 :
791 0 : sal_Int8 PPTWriterBase::GetTransition( sal_Int16 nTransitionType, sal_Int16 nTransitionSubtype, FadeEffect eEffect, sal_uInt8& nDirection )
792 : {
793 0 : sal_Int8 nPPTTransitionType = 0;
794 0 : nDirection = 0;
795 :
796 0 : switch( nTransitionType )
797 : {
798 : case TransitionType::FADE :
799 : {
800 0 : if ( nTransitionSubtype == TransitionSubType::CROSSFADE )
801 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_SMOOTHFADE;
802 0 : else if ( nTransitionSubtype == TransitionSubType::FADEOVERCOLOR )
803 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_FADE;
804 : }
805 0 : break;
806 : case PPT_TRANSITION_TYPE_COMB :
807 : {
808 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_COMB;
809 0 : if ( nTransitionSubtype == TransitionSubType::COMBVERTICAL )
810 0 : nDirection++;
811 : }
812 0 : break;
813 : case TransitionType::PUSHWIPE :
814 : {
815 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_PUSH;
816 0 : switch( nTransitionSubtype )
817 : {
818 0 : case TransitionSubType::FROMRIGHT: nDirection = 0; break;
819 0 : case TransitionSubType::FROMBOTTOM: nDirection = 1; break;
820 0 : case TransitionSubType::FROMLEFT: nDirection = 2; break;
821 0 : case TransitionSubType::FROMTOP: nDirection = 3; break;
822 : }
823 : }
824 0 : break;
825 : case TransitionType::PINWHEELWIPE :
826 : {
827 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_WHEEL;
828 0 : switch( nTransitionSubtype )
829 : {
830 0 : case TransitionSubType::ONEBLADE: nDirection = 1; break;
831 0 : case TransitionSubType::TWOBLADEVERTICAL : nDirection = 2; break;
832 0 : case TransitionSubType::THREEBLADE : nDirection = 3; break;
833 0 : case TransitionSubType::FOURBLADE: nDirection = 4; break;
834 0 : case TransitionSubType::EIGHTBLADE: nDirection = 8; break;
835 : }
836 : }
837 0 : break;
838 : case TransitionType::FANWIPE :
839 : {
840 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_WEDGE;
841 : }
842 0 : break;
843 : case TransitionType::ELLIPSEWIPE :
844 : {
845 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_CIRCLE;
846 : }
847 0 : break;
848 : case TransitionType::FOURBOXWIPE :
849 : {
850 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_PLUS;
851 : }
852 0 : break;
853 : case TransitionType::IRISWIPE :
854 : {
855 0 : switch( nTransitionSubtype ) {
856 : case TransitionSubType::RECTANGLE:
857 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_ZOOM;
858 0 : nDirection = (eEffect == FadeEffect_FADE_FROM_CENTER) ? 0 : 1;
859 0 : break;
860 : default:
861 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_DIAMOND;
862 0 : break;
863 : }
864 : }
865 0 : break;
866 : }
867 :
868 0 : return nPPTTransitionType;
869 : }
870 :
871 0 : sal_Int8 PPTWriterBase::GetTransition( FadeEffect eEffect, sal_uInt8& nDirection )
872 : {
873 0 : sal_Int8 nPPTTransitionType = 0;
874 :
875 0 : switch ( eEffect )
876 : {
877 : default :
878 : case FadeEffect_RANDOM :
879 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_RANDOM;
880 0 : break;
881 :
882 : case FadeEffect_HORIZONTAL_STRIPES :
883 0 : nDirection++;
884 : case FadeEffect_VERTICAL_STRIPES :
885 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_BLINDS;
886 0 : break;
887 :
888 : case FadeEffect_VERTICAL_CHECKERBOARD :
889 0 : nDirection++;
890 : case FadeEffect_HORIZONTAL_CHECKERBOARD :
891 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_CHECKER;
892 0 : break;
893 :
894 : case FadeEffect_MOVE_FROM_UPPERLEFT :
895 0 : nDirection++;
896 : case FadeEffect_MOVE_FROM_UPPERRIGHT :
897 0 : nDirection++;
898 : case FadeEffect_MOVE_FROM_LOWERLEFT :
899 0 : nDirection++;
900 : case FadeEffect_MOVE_FROM_LOWERRIGHT :
901 0 : nDirection++;
902 : case FadeEffect_MOVE_FROM_TOP :
903 0 : nDirection++;
904 : case FadeEffect_MOVE_FROM_LEFT :
905 0 : nDirection++;
906 : case FadeEffect_MOVE_FROM_BOTTOM :
907 0 : nDirection++;
908 : case FadeEffect_MOVE_FROM_RIGHT :
909 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_COVER;
910 0 : break;
911 :
912 : case FadeEffect_DISSOLVE :
913 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_DISSOLVE;
914 0 : break;
915 :
916 : case FadeEffect_VERTICAL_LINES :
917 0 : nDirection++;
918 : case FadeEffect_HORIZONTAL_LINES :
919 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_RANDOM_BARS;
920 0 : break;
921 :
922 : case FadeEffect_CLOSE_HORIZONTAL :
923 0 : nDirection++;
924 : case FadeEffect_OPEN_HORIZONTAL :
925 0 : nDirection++;
926 : case FadeEffect_CLOSE_VERTICAL :
927 0 : nDirection++;
928 : case FadeEffect_OPEN_VERTICAL :
929 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_SPLIT;
930 0 : break;
931 :
932 : case FadeEffect_FADE_FROM_UPPERLEFT :
933 0 : nDirection++;
934 : case FadeEffect_FADE_FROM_UPPERRIGHT :
935 0 : nDirection++;
936 : case FadeEffect_FADE_FROM_LOWERLEFT :
937 0 : nDirection++;
938 : case FadeEffect_FADE_FROM_LOWERRIGHT :
939 0 : nDirection += 4;
940 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_STRIPS;
941 0 : break;
942 :
943 : case FadeEffect_UNCOVER_TO_LOWERRIGHT :
944 0 : nDirection++;
945 : case FadeEffect_UNCOVER_TO_LOWERLEFT :
946 0 : nDirection++;
947 : case FadeEffect_UNCOVER_TO_UPPERRIGHT :
948 0 : nDirection++;
949 : case FadeEffect_UNCOVER_TO_UPPERLEFT :
950 0 : nDirection++;
951 : case FadeEffect_UNCOVER_TO_BOTTOM :
952 0 : nDirection++;
953 : case FadeEffect_UNCOVER_TO_RIGHT :
954 0 : nDirection++;
955 : case FadeEffect_UNCOVER_TO_TOP :
956 0 : nDirection++;
957 : case FadeEffect_UNCOVER_TO_LEFT :
958 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_PULL;
959 0 : break;
960 :
961 : case FadeEffect_FADE_FROM_TOP :
962 0 : nDirection++;
963 : case FadeEffect_FADE_FROM_LEFT :
964 0 : nDirection++;
965 : case FadeEffect_FADE_FROM_BOTTOM :
966 0 : nDirection++;
967 : case FadeEffect_FADE_FROM_RIGHT :
968 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_WIPE;
969 0 : break;
970 :
971 : case FadeEffect_ROLL_FROM_TOP :
972 0 : nDirection++;
973 : case FadeEffect_ROLL_FROM_LEFT :
974 0 : nDirection++;
975 : case FadeEffect_ROLL_FROM_BOTTOM :
976 0 : nDirection++;
977 : case FadeEffect_ROLL_FROM_RIGHT :
978 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_WIPE;
979 0 : break;
980 :
981 : case FadeEffect_FADE_TO_CENTER :
982 0 : nDirection++;
983 : case FadeEffect_FADE_FROM_CENTER :
984 0 : nPPTTransitionType = PPT_TRANSITION_TYPE_ZOOM;
985 0 : break;
986 :
987 : case FadeEffect_NONE :
988 0 : nDirection = 2;
989 0 : break;
990 : }
991 :
992 0 : return nPPTTransitionType;
993 : }
994 :
995 : // -----------------------------------------------------------------------
996 :
997 0 : sal_Bool PPTWriterBase::ContainsOtherShapeThanPlaceholders( sal_Bool bForOOMLX )
998 : {
999 0 : sal_uInt32 nShapes = mXShapes->getCount();
1000 0 : sal_Bool bOtherThanPlaceHolders = sal_False;
1001 :
1002 0 : if ( nShapes )
1003 0 : for ( sal_uInt32 nIndex = 0; ( nIndex < nShapes ) && ( bOtherThanPlaceHolders == sal_False ); nIndex++ )
1004 : {
1005 0 : if ( GetShapeByIndex( nIndex ) && mType != "drawing.Page" )
1006 : {
1007 0 : if( bForOOMLX &&
1008 0 : ( mType == "presentation.Page" ||
1009 0 : mType == "presentation.Notes" ) ) {
1010 0 : Reference< XSimpleText > rXText( mXShape, UNO_QUERY );
1011 :
1012 0 : if( rXText.is() && !rXText->getString().isEmpty() )
1013 0 : bOtherThanPlaceHolders = sal_True;
1014 : }
1015 : else
1016 0 : bOtherThanPlaceHolders = sal_True;
1017 : }
1018 : DBG(printf("mType == %s\n", mType.getStr()));
1019 : }
1020 :
1021 0 : return bOtherThanPlaceHolders;
1022 6 : }
1023 :
1024 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|