update dev300-m58
[ooovba.git] / sd / source / filter / eppt / eppt.cxx
blobc9cdd924031dc6d6c91f82292893b20e1d72d886
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: eppt.cxx,v $
10 * $Revision: 1.64.78.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
33 #include <eppt.hxx>
34 #include "epptdef.hxx"
35 #include <tools/globname.hxx>
36 #include <tools/datetime.hxx>
37 #include <tools/poly.hxx>
38 #include <vcl/graph.hxx>
39 #include <vcl/bmpacc.hxx>
40 #include <vcl/gradient.hxx>
41 #include <rtl/ustring.hxx>
42 #include <tools/stream.hxx>
43 #include <svtools/fltcall.hxx>
44 #include <sfx2/docfile.hxx>
45 #include <svx/unoapi.hxx>
46 #include <svx/svdobj.hxx>
47 #include <svx/svdoole2.hxx>
48 #include <svx/svdmodel.hxx>
49 #include <svx/svdpage.hxx>
50 #include <com/sun/star/view/PaperOrientation.hpp>
51 #include <com/sun/star/view/PaperFormat.hpp>
52 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
53 #include <tools/zcodec.hxx>
54 #include <svx/svxenum.hxx>
55 #include <sot/storinfo.hxx>
56 #include <svx/msoleexp.hxx>
57 #include <vcl/virdev.hxx>
58 #include <svtools/wmf.hxx>
59 #include <svx/msdffimp.hxx>
60 #include <svx/flditem.hxx>
61 #include <sfx2/docinf.hxx>
63 #define PPT_TRANSITION_TYPE_NONE 0
64 #define PPT_TRANSITION_TYPE_RANDOM 1
65 #define PPT_TRANSITION_TYPE_BLINDS 2
66 #define PPT_TRANSITION_TYPE_CHECKER 3
67 #define PPT_TRANSITION_TYPE_COVER 4
68 #define PPT_TRANSITION_TYPE_DISSOLVE 5
69 #define PPT_TRANSITION_TYPE_FADE 6
70 #define PPT_TRANSITION_TYPE_PULL 7
71 #define PPT_TRANSITION_TYPE_RANDOM_BARS 8
72 #define PPT_TRANSITION_TYPE_STRIPS 9
73 #define PPT_TRANSITION_TYPE_WIPE 10
74 #define PPT_TRANSITION_TYPE_ZOOM 11
75 #define PPT_TRANSITION_TYPE_SPLIT 13
77 // effects, new in xp
78 #define PPT_TRANSITION_TYPE_DIAMOND 17
79 #define PPT_TRANSITION_TYPE_PLUS 18
80 #define PPT_TRANSITION_TYPE_WEDGE 19
81 #define PPT_TRANSITION_TYPE_PUSH 20
82 #define PPT_TRANSITION_TYPE_COMB 21
83 #define PPT_TRANSITION_TYPE_NEWSFLASH 22
84 #define PPT_TRANSITION_TYPE_SMOOTHFADE 23
85 #define PPT_TRANSITION_TYPE_WHEEL 26
86 #define PPT_TRANSITION_TYPE_CIRCLE 27
88 using namespace com::sun::star;
90 static PHLayout pPHLayout[] =
92 { EPP_LAYOUT_TITLESLIDE, { 0x0d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x10, TRUE, TRUE, FALSE },
93 { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, TRUE, TRUE, FALSE },
94 { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, TRUE, TRUE, FALSE },
95 { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, TRUE, TRUE, TRUE },
96 { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, TRUE, TRUE, FALSE },
97 { EPP_LAYOUT_BLANCSLIDE, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, FALSE, FALSE, FALSE },
98 { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, TRUE, TRUE, FALSE },
99 { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x14, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, TRUE, TRUE, FALSE },
100 { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x15, 0x0d, 0x0e, TRUE, FALSE, FALSE },
101 { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x16, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, TRUE, TRUE, FALSE },
102 { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
103 { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, FALSE, FALSE },
104 { EPP_LAYOUT_RIGHTCOLUMN2ROWS, { 0x0d, 0x0e, 0x13, 0x13, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
105 { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
106 { EPP_LAYOUT_2ROWSANDTITLE, { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
107 { EPP_LAYOUT_LEFTCOLUMN2ROWS, { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
108 { EPP_LAYOUT_TOPROW2COLUMN, { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
109 { EPP_LAYOUT_2ROWSANDTITLE, { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
110 { EPP_LAYOUT_4OBJECTS, { 0x0d, 0x13, 0x13, 0x13, 0x13, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, FALSE, FALSE },
111 { EPP_LAYOUT_ONLYTITLE, { 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, TRUE, FALSE, FALSE },
112 { EPP_LAYOUT_BLANCSLIDE, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, FALSE, FALSE, FALSE },
113 { EPP_LAYOUT_TITLERIGHT2BODIESLEFT, { 0x11, 0x12, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x11, 0x12, TRUE, TRUE, FALSE },
114 { EPP_LAYOUT_TITLERIGHTBODYLEFT, { 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x11, 0x12, TRUE, TRUE, FALSE },
115 { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x12, TRUE, TRUE, FALSE },
116 { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x16, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x12, TRUE, TRUE, FALSE }
119 //============================ PPTWriter ==================================
121 PPTWriter::PPTWriter( SvStorageRef& rSvStorage,
122 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rXModel,
123 ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rXStatInd,
124 SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags ) :
125 mbStatus ( sal_False ),
126 mbUseNewAnimations ( sal_True ),
127 mnLatestStatValue ( 0 ),
128 maFraction ( 1, 576 ),
129 maMapModeSrc ( MAP_100TH_MM ),
130 maMapModeDest ( MAP_INCH, Point(), maFraction, maFraction ),
131 meLatestPageType ( NORMAL ),
132 mXModel ( rXModel ),
133 mXStatusIndicator ( rXStatInd ),
134 mbStatusIndicator ( FALSE ),
135 mpCurUserStrm ( NULL ),
136 mpStrm ( NULL ),
137 mpPicStrm ( NULL ),
138 mpPptEscherEx ( NULL ),
139 mnVBAOleOfs ( 0 ),
140 mpVBA ( pVBA ),
141 mnExEmbed ( 0 ),
142 mpExEmbed ( new SvMemoryStream ),
143 mnPagesWritten ( 0 ),
144 mnTxId ( 0x7a2f64 )
146 sal_uInt32 i;
147 if ( !ImplInitSOIface() )
148 return;
150 FontCollectionEntry aDefaultFontDesc( String( RTL_CONSTASCII_USTRINGPARAM( "Times New Roman" ) ),
151 ::com::sun::star::awt::FontFamily::ROMAN,
152 ::com::sun::star::awt::FontPitch::VARIABLE,
153 RTL_TEXTENCODING_MS_1252 );
154 maFontCollection.GetId( aDefaultFontDesc ); // default is always times new roman
156 if ( !ImplGetPageByIndex( 0, NOTICE ) )
157 return;
158 INT32 nWidth = 21000;
159 if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) )
160 mAny >>= nWidth;
161 INT32 nHeight = 29700;
162 if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) )
163 mAny >>= nHeight;
165 maNotesPageSize = ImplMapSize( ::com::sun::star::awt::Size( nWidth, nHeight ) );
167 if ( !ImplGetPageByIndex( 0, MASTER ) )
168 return;
169 nWidth = 28000;
170 if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) )
171 mAny >>= nWidth;
172 nHeight = 21000;
173 if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) )
174 mAny >>= nHeight;
175 maDestPageSize = ImplMapSize( ::com::sun::star::awt::Size( nWidth, nHeight ) );
177 mrStg = rSvStorage;
178 if ( !mrStg.Is() )
179 return;
181 // MasterPages + Slides und Notizen + NotesMasterPage
182 mnDrawings = mnMasterPages + ( mnPages << 1 ) + 1;
184 if ( mXStatusIndicator.is() )
186 mbStatusIndicator = TRUE;
187 mnStatMaxValue = ( mnPages + mnMasterPages ) * 5;
188 mXStatusIndicator->start( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Export" ) ),
189 mnStatMaxValue + ( mnStatMaxValue >> 3 ) );
192 SvGlobalName aGName( 0x64818d10L, 0x4f9b, 0x11cf, 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8 );
193 mrStg->SetClass( aGName, 0, String( RTL_CONSTASCII_USTRINGPARAM( "MS PowerPoint 97" ) ) );
195 if ( !ImplCreateCurrentUserStream() )
196 return;
198 mpStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Document" ) ) );
199 if ( !mpStrm )
200 return;
202 if ( !mpPicStrm )
203 mpPicStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ) );
205 mpPptEscherEx = new PptEscherEx( *mpStrm, mnDrawings );
207 if ( !ImplGetStyleSheets() )
208 return;
210 if ( !ImplCreateDocument() )
211 return;
213 for ( i = 0; i < mnMasterPages; i++ )
215 if ( !ImplCreateMaster( i ) )
216 return;
218 if ( !ImplCreateMainNotes() )
219 return;
220 maTextRuleList.First(); // rewind list, so we can get the current or next entry without
221 // searching, all entrys are sorted#
222 for ( i = 0; i < mnPages; i++ )
224 if ( !ImplCreateSlide( i ) )
225 return;
227 for ( i = 0; i < mnPages; i++ )
229 if ( !ImplCreateNotes( i ) )
230 return;
232 if ( !ImplCloseDocument() )
233 return;
235 if ( mbStatusIndicator )
237 mXStatusIndicator->setText( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Export" ) ) );
238 sal_uInt32 nValue = mnStatMaxValue + ( mnStatMaxValue >> 3 );
239 if ( nValue > mnLatestStatValue )
241 mXStatusIndicator->setValue( nValue );
242 mnLatestStatValue = nValue;
246 ImplWriteOLE( nCnvrtFlags );
248 ImplWriteVBA( pVBA );
250 if ( !ImplWriteAtomEnding() )
251 return;
253 if ( !ImplCreateDocumentSummaryInformation( nCnvrtFlags ) )
254 return;
256 mbStatus = TRUE;
260 // ---------------------------------------------------------------------------------------------
262 PPTWriter::~PPTWriter()
264 void* pPtr;
265 delete mpExEmbed;
266 delete mpPptEscherEx;
268 std::vector< PPTExStyleSheet* >::iterator aStyleSheetIter( maStyleSheetList.begin() );
269 while( aStyleSheetIter < maStyleSheetList.end() )
270 delete *aStyleSheetIter++;
272 for ( pPtr = maTextRuleList.First(); pPtr; pPtr = maTextRuleList.Next() )
273 delete (TextRuleEntry*)pPtr;
274 for ( pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
275 delete (::rtl::OUString*)pPtr;
276 for ( pPtr = maHyperlink.First(); pPtr; pPtr = maHyperlink.Next() )
277 delete (EPPTHyperlink*)pPtr;
278 for ( pPtr = maExOleObj.First(); pPtr; pPtr = maExOleObj.Next() )
279 delete (PPTExOleObjEntry*)pPtr;
281 if ( mbStatusIndicator )
282 mXStatusIndicator->end();
285 // ---------------------------------------------------------------------------------------------
287 static inline sal_uInt32 PPTtoEMU( INT32 nPPT )
289 return (sal_uInt32)( (double)nPPT * 1587.5 );
292 // ---------------------------------------------------------------------------------------------
294 sal_Bool PPTWriter::ImplCreateCurrentUserStream()
296 mpCurUserStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Current User" ) ) );
297 if ( !mpCurUserStrm )
298 return FALSE;
299 char pUserName[] = "Current User";
300 sal_uInt32 nLenOfUserName = strlen( pUserName );
301 sal_uInt32 nSizeOfRecord = 0x14 + ( ( nLenOfUserName + 4 ) & ~ 3 );
303 *mpCurUserStrm << (sal_uInt16)0 << (sal_uInt16)EPP_CurrentUserAtom << nSizeOfRecord;
304 *mpCurUserStrm << (sal_uInt32)0x14 // Len
305 << (sal_uInt32)0xe391c05f; // Magic
307 sal_uInt32 nEditPos = mpCurUserStrm->Tell();
308 *mpCurUserStrm << (sal_uInt32)0x0 // OffsetToCurrentEdit;
309 << (sal_uInt16)nLenOfUserName //
310 << (sal_uInt16)0x3f4 // DocFileVersion
311 << (sal_uInt8)3 // MajorVersion
312 << (sal_uInt8)0 // MinorVersion
313 << (sal_uInt16)0; // Pad Word
314 pUserName[ nLenOfUserName ] = 8;
315 mpCurUserStrm->Write( pUserName, nLenOfUserName + 1 );
316 for ( sal_uInt32 i = 0x15 + nLenOfUserName; i < nSizeOfRecord; i++ )
318 *mpCurUserStrm << (sal_uInt8)0; // pad bytes
320 mpCurUserStrm->Seek( nEditPos );
321 return TRUE;
324 // ---------------------------------------------------------------------------------------------
326 sal_Bool PPTWriter::ImplCreateDocumentSummaryInformation( sal_uInt32 nCnvrtFlags )
328 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
329 mXModel, uno::UNO_QUERY_THROW);
330 uno::Reference<document::XDocumentProperties> xDocProps(
331 xDPS->getDocumentProperties());
333 if (xDocProps.is()) {
335 // no idea what this is...
336 static sal_uInt8 aGuid[ 0x52 ] =
338 0x4e, 0x00, 0x00, 0x00,
339 '{',0,'D',0,'B',0,'1',0,'A',0,'C',0,'9',0,'6',0,'4',0,'-',0,
340 'E',0,'3',0,'9',0,'C',0,'-',0,'1',0,'1',0,'D',0,'2',0,'-',0,
341 'A',0,'1',0,'E',0,'F',0,'-',0,'0',0,'0',0,'6',0,'0',0,'9',0,
342 '7',0,'D',0,'A',0,'5',0,'6',0,'8',0,'9',0,'}',0
344 uno::Sequence<sal_uInt8> aGuidSeq(aGuid, 0x52);
346 SvMemoryStream aHyperBlob;
347 ImplCreateHyperBlob( aHyperBlob );
349 uno::Sequence<sal_uInt8> aHyperSeq(aHyperBlob.Tell());
350 const sal_uInt8* pBlob(
351 static_cast<const sal_uInt8*>(aHyperBlob.GetData()));
352 for (sal_Int32 j = 0; j < aHyperSeq.getLength(); ++j) {
353 aHyperSeq[j] = pBlob[j];
356 if ( nCnvrtFlags & 0x8000 )
358 uno::Sequence<sal_uInt8> aThumbSeq;
359 if ( ImplGetPageByIndex( 0, NORMAL ) &&
360 ImplGetPropertyValue( mXPagePropSet,
361 String( RTL_CONSTASCII_USTRINGPARAM( "PreviewBitmap" ) ) ) )
363 aThumbSeq =
364 *static_cast<const uno::Sequence<sal_uInt8>*>(mAny.getValue());
366 sfx2::SaveOlePropertySet( xDocProps, mrStg,
367 &aThumbSeq, &aGuidSeq, &aHyperSeq);
369 else
371 sfx2::SaveOlePropertySet( xDocProps, mrStg,
372 NULL, &aGuidSeq, &aHyperSeq );
376 return sal_True;
379 // ---------------------------------------------------------------------------------------------
381 void PPTWriter::ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId )
383 if ( rSt.Tell() )
385 aBuExOutlineStream << (sal_uInt32)( ( EPP_PST_ExtendedParagraphHeaderAtom << 16 )
386 | ( nRef << 4 ) )
387 << (sal_uInt32)8
388 << (sal_uInt32)nSlideId
389 << (sal_uInt32)nInstance;
390 aBuExOutlineStream.Write( rSt.GetData(), rSt.Tell() );
394 // ---------------------------------------------------------------------------------------------
396 void PPTWriter::ImplCreateHeaderFooterStrings( SvStream& rStrm, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet )
398 if ( rXPagePropSet.is() )
400 rtl::OUString aString;
401 ::com::sun::star::uno::Any aAny;
402 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "HeaderText" ) ), sal_True ) )
404 if ( aAny >>= aString )
405 ImplWriteCString( rStrm, aString, 1 );
407 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FooterText" ) ), sal_True ) )
409 if ( aAny >>= aString )
410 ImplWriteCString( rStrm, aString, 2 );
412 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "DateTimeText" ) ), sal_True ) )
414 if ( aAny >>= aString )
415 ImplWriteCString( rStrm, aString, 0 );
420 // ---------------------------------------------------------------------------------------------
422 void PPTWriter::ImplCreateHeaderFooters( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet )
424 if ( rXPagePropSet.is() )
426 sal_Bool bVal = sal_False;
427 sal_uInt32 nVal = 0;
428 ::com::sun::star::uno::Any aAny;
429 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsHeaderVisible" ) ), sal_True ) )
431 if ( ( aAny >>= bVal ) && bVal )
432 nVal |= 0x100000;
434 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFooterVisible" ) ), sal_True ) )
436 if ( ( aAny >>= bVal ) && bVal )
437 nVal |= 0x200000;
439 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeVisible" ) ), sal_True ) )
441 if ( ( aAny >>= bVal ) && bVal )
442 nVal |= 0x010000;
444 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsPageNumberVisible" ) ), sal_True ) )
446 if ( ( aAny >>= bVal ) && bVal )
447 nVal |= 0x080000;
449 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeFixed" ) ), sal_True ) )
451 if ( ( aAny >>= bVal ) && !bVal )
452 nVal |= 0x20000;
453 else
454 nVal |= 0x40000;
456 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "DateTimeFormat" ) ), sal_True ) )
458 sal_Int32 nFormat = *(sal_Int32*)aAny.getValue();
459 SvxDateFormat eDateFormat = (SvxDateFormat)( nFormat & 0xf );
460 SvxTimeFormat eTimeFormat = (SvxTimeFormat)( ( nFormat >> 4 ) & 0xf );
461 switch( eDateFormat )
463 case SVXDATEFORMAT_F :
464 nFormat = 1;
465 break;
466 case SVXDATEFORMAT_D :
467 nFormat = 2;
468 break;
469 case SVXDATEFORMAT_C :
470 nFormat = 4;
471 break;
472 default:
473 case SVXDATEFORMAT_A :
474 nFormat = 0;
476 switch( eTimeFormat )
478 case SVXTIMEFORMAT_24_HM :
479 nFormat = 9;
480 break;
481 case SVXTIMEFORMAT_12_HM :
482 nFormat = 11;
483 break;
484 case SVXTIMEFORMAT_24_HMS :
485 nFormat = 10;
486 break;
487 case SVXTIMEFORMAT_12_HMS :
488 nFormat = 12;
489 break;
490 default:
491 break;
493 nVal |= nFormat;
496 mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 0 );
497 mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
498 *mpStrm << nVal;
499 ImplCreateHeaderFooterStrings( *mpStrm, rXPagePropSet );
500 mpPptEscherEx->CloseContainer();
504 // ---------------------------------------------------------------------------------------------
506 sal_Bool PPTWriter::ImplCreateDocument()
508 sal_uInt32 i;
509 sal_uInt16 nSlideType = EPP_SLIDESIZE_TYPECUSTOM;
511 sal_uInt32 nWidth = maDestPageSize.Width;
512 sal_uInt32 nHeight = maDestPageSize.Height;
514 if ( ( nWidth == 0x1680 ) && ( nHeight == 0x10e0 ) )
515 nSlideType = EPP_SLIDESIZE_TYPEONSCREEN;
516 else if ( ( nWidth == 0x1200 ) && ( nHeight == 0x240 ) )
517 nSlideType = EPP_SLIDESIZE_TYPEBANNER;
518 else if ( ( nWidth == 0x1950 ) && ( nHeight == 0x10e0 ) )
519 nSlideType = EPP_SLIDESIZE_TYPE35MM;
520 else if ( ( nWidth == 0x1860 ) && ( nHeight == 0x10e0 ) )
521 nSlideType = EPP_SLIDESIZE_TYPEA4PAPER;
523 mpPptEscherEx->OpenContainer( EPP_Document );
524 // CREATE DOCUMENT ATOM
525 mpPptEscherEx->AddAtom( 40, EPP_DocumentAtom, 1 );
526 *mpStrm << nWidth // Slide Size in Master coordinates X
527 << nHeight // " " " " " Y
528 << (INT32)maNotesPageSize.Width // Notes Page Size X
529 << (INT32)maNotesPageSize.Height // " " " Y
530 << (INT32)1 << (INT32)2; // the scale used when the Powerpoint document is embedded. the default is 1:2
531 mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTESMASTER_PERSIST_KEY, mpStrm->Tell() );
532 *mpStrm << (sal_uInt32)0 // Reference to NotesMaster ( 0 if none );
533 << (sal_uInt32)0 // Reference to HandoutMaster ( 0 if none );
534 << (sal_Int16)1 // Number of the first slide;
535 << nSlideType // Size of the document slides ( default: EPP_SLIDESIZETYPEONSCREEN )
536 << (sal_uInt8)0 // bool1 indicates if document was saved with embedded true type fonts
537 << (sal_uInt8)0 // bool1 indicates if the placeholders on the title slide are omitted
538 << (sal_uInt8)0 // bool1 right to left ( flag for Bidi version )
539 << (sal_uInt8)1; // bool1 visibility of comments shapes
541 mpPptEscherEx->PtInsert( EPP_Persist_Document, mpStrm->Tell() );
543 mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 3 ); //Master footer (default)
544 mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
545 *mpStrm << (sal_uInt32)0x25000d;
546 if ( ImplGetPageByIndex( 0, MASTER ) )
547 ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet );
548 mpPptEscherEx->CloseContainer();
549 mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 4 ); //NotesMaster footer (default)
550 mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
551 *mpStrm << (sal_uInt32)0x3d000d;
552 if ( ImplGetPageByIndex( 0, NOTICE ) )
553 ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet );
554 mpPptEscherEx->CloseContainer();
556 mpPptEscherEx->OpenContainer( EPP_SlideListWithText ); // Animation info fuer die Slides
558 sal_uInt32 nShapes;
559 sal_Bool bOtherThanPlaceHolders;
561 for ( i = 0; i < mnPages; i++ )
563 sal_uInt32 nPOffset, nPObjects;
564 sal_Bool bOutliner, bTitle;
566 bOtherThanPlaceHolders = bOutliner = bTitle = FALSE;
567 nPObjects = 0;
569 mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom );
570 mpPptEscherEx->InsertPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, mpStrm->Tell() );
571 *mpStrm << (sal_uInt32)0; // psrReference - logical reference to the slide persist object ( EPP_MAINSLIDE_PERSIST_KEY )
572 nPOffset = mpStrm->Tell();
573 *mpStrm << (sal_uInt32)0 // flags - only bit 3 used, if set then slide contains shapes other than placeholders
574 << (INT32)0 // numberTexts - number of placeholder texts stored with the persist object. Allows to display outline view without loading the slide persist objects
575 << (INT32)i + 0x100 // slideId - Unique slide identifier, used for OLE link monikers for example
576 << (sal_uInt32)0; // reserved, usualy 0
578 if ( !ImplGetPageByIndex( i, NORMAL ) ) // sehr aufregend: noch einmal ueber alle seiten
579 return FALSE;
580 ImplSetCurrentStyleSheet( ImplGetMasterIndex( NORMAL ) );
582 const PHLayout& rLayout = ImplGetLayout( mXPagePropSet );
584 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed >
585 aXName( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
587 if ( aXName.is() )
589 ::rtl::OUString aStr = aXName->getName();
590 ::rtl::OUString *pUStr = new ::rtl::OUString( aStr );
591 maSlideNameList.Insert( pUStr, LIST_APPEND );
593 else
594 maSlideNameList.Insert( new ::rtl::OUString(), LIST_APPEND );
596 nShapes = mXShapes->getCount();
598 sal_Bool bSecOutl = FALSE;
599 if ( nShapes && ( rLayout.bTitlePossible || rLayout.bOutlinerPossible ) )
601 for ( sal_uInt32 nIndex = 0; nIndex < nShapes; nIndex++ )
603 if ( !ImplGetShapeByIndex( nIndex ) )
604 continue;
606 if ( mbPresObj && ( ( mType == "presentation.Outliner" ) || ( mType == "presentation.Subtitle" ) ) )
608 if ( bOutliner == FALSE )
610 bOutliner = TRUE;
611 mnTextStyle = EPP_TEXTSTYLE_BODY;
612 sal_uInt32 nTextType = EPP_TEXTTYPE_Body;
613 if ( bSecOutl )
614 nTextType = EPP_TEXTTYPE_HalfBody;
615 else if ( mType == "presentation.Subtitle" )
616 nTextType = EPP_TEXTTYPE_CenterBody;
618 TextRuleEntry* pRule = new TextRuleEntry( i );
619 SvMemoryStream aExtBu( 0x200, 0x200 );
620 if ( !mbEmptyPresObj )
621 ImplGetText();
622 ImplWriteTextStyleAtom( *mpStrm, nTextType, nPObjects, pRule, aExtBu, NULL );
623 ImplWriteExtParaHeader( aExtBu, nPObjects++, nTextType, i + 0x100 );
624 maTextRuleList.Insert( (void*)pRule, LIST_APPEND );
625 if ( rLayout.bSecOutlinerPossible )
627 if ( ( nIndex + 1 ) < nShapes )
629 if ( ImplGetShapeByIndex( nIndex + 1 ) && mType == "presentation.Outliner" )
631 bSecOutl = TRUE;
632 TextRuleEntry* pTempRule = new TextRuleEntry( i );
633 SvMemoryStream aTmpStrm( 0x200, 0x200 );
634 if ( !mbEmptyPresObj )
635 ImplGetText();
636 ImplWriteTextStyleAtom( *mpStrm, nTextType, nPObjects, pTempRule, aTmpStrm, NULL );
637 ImplWriteExtParaHeader( aTmpStrm, nPObjects++, nTextType, i + 0x100 );
638 maTextRuleList.Insert( (void*)pTempRule, LIST_APPEND );
644 else if ( rLayout.bTitlePossible && ( mType == "presentation.TitleText" ) )
646 if ( bTitle == FALSE )
648 bTitle = TRUE;
649 mnTextStyle = EPP_TEXTSTYLE_TITLE;
650 TextRuleEntry* pRule = new TextRuleEntry( i );
651 SvMemoryStream aExtBu( 0x200, 0x200 );
652 if ( !mbEmptyPresObj )
653 ImplGetText();
654 ImplWriteTextStyleAtom( *mpStrm, EPP_TEXTTYPE_Title, nPObjects, pRule, aExtBu, NULL );
655 ImplWriteExtParaHeader( aExtBu, nPObjects++, EPP_TEXTTYPE_Title, i + 0x100 );
656 maTextRuleList.Insert( (void*)pRule, LIST_APPEND );
659 else
661 if ( mbEmptyPresObj )
662 nPObjects++;
663 else
664 bOtherThanPlaceHolders = TRUE; // muss noch auf background und leeren Title/outliner geprueft werden !!!
666 if ( bOutliner && bTitle && bOtherThanPlaceHolders )
667 break;
670 if ( nPObjects )
672 sal_uInt32 nOldPos = mpStrm->Tell();
673 mpStrm->Seek( nPOffset );
674 *mpStrm << (sal_uInt32)( ( bOtherThanPlaceHolders ) ? 4 : 0 );
675 *mpStrm << nPObjects;
676 mpStrm->Seek( nOldPos );
679 mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText
681 mpPptEscherEx->OpenContainer( EPP_SlideListWithText, 2 ); // Animation info fuer die notes
682 for( i = 0; i < mnPages; i++ )
684 if ( !ImplGetPageByIndex( i, NOTICE ) )
685 return FALSE;
687 nShapes = mXShapes->getCount();
689 bOtherThanPlaceHolders = FALSE;
690 if ( nShapes )
692 for ( sal_uInt32 nIndex = 0; ( nIndex < nShapes ) && ( bOtherThanPlaceHolders == FALSE ); nIndex++ )
694 if ( ImplGetShapeByIndex( nIndex ) && ( mType != "drawing.Page" ) )
695 bOtherThanPlaceHolders = TRUE;
698 mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom );
699 mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, mpStrm->Tell() );
700 *mpStrm << (sal_uInt32)0
701 << (sal_uInt32)( ( bOtherThanPlaceHolders ) ? 4 : 0 )
702 << (INT32)0
703 << (INT32)i + 0x100
704 << (sal_uInt32)0;
706 mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText
708 ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentationSupplier >
709 aXPresSupplier( mXModel, ::com::sun::star::uno::UNO_QUERY ); ;
710 if ( aXPresSupplier.is() )
712 ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentation >
713 aXPresentation( aXPresSupplier->getPresentation() );
714 if ( aXPresentation.is() )
716 mXPropSet = ::com::sun::star::uno::Reference<
717 ::com::sun::star::beans::XPropertySet >
718 ( aXPresentation, ::com::sun::star::uno::UNO_QUERY );
719 if ( mXPropSet.is() )
721 ::rtl::OUString aCustomShow;
722 sal_uInt32 nPenColor = 0x1000000;
723 INT32 nRestartTime = 0x7fffffff;
724 sal_Int16 nStartSlide = 0;
725 sal_Int16 nEndSlide = 0;
726 sal_uInt32 nFlags = 0; // Bit 0: Auto advance
727 // Bit 1 Skip builds ( do not allow slide effects )
728 // Bit 2 Use slide range
729 // Bit 3 Use named show
730 // Bit 4 Browse mode on
731 // Bit 5 Kiosk mode on
732 // Bit 7 loop continously
733 // Bit ? show scrollbar
735 if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CustomShow" ) ) ) )
737 aCustomShow = ( *(::rtl::OUString*)mAny.getValue() );
738 if ( aCustomShow.getLength() )
740 nFlags |= 8;
743 if ( ( nFlags & 8 ) == 0 )
745 if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ) ) )
747 ::rtl::OUString aSlideName( *(::rtl::OUString*)mAny.getValue() );
748 ::rtl::OUString* pStr;
749 for ( pStr = (::rtl::OUString*)maSlideNameList.First(); pStr;
750 pStr = (::rtl::OUString*)maSlideNameList.Next(), nStartSlide++ )
752 if ( *pStr == aSlideName )
754 nStartSlide++;
755 nFlags |= 4;
756 nEndSlide = (sal_uInt16)mnPages;
757 break;
760 if ( !pStr )
761 nStartSlide = 0;
765 // if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "DiaName" ) ) ) )
766 // {
767 // }
768 // if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsAlwaysOnTop" ) ) ) )
769 // {
770 // }
771 if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ) ) )
773 sal_Bool bBool = sal_False;
774 mAny >>= bBool;
775 if ( !bBool )
776 nFlags |= 1;
779 if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ) ) ) // muesste eigendlich heissen IsNotEndless !=)"§()&
781 sal_Bool bBool = sal_False;
782 mAny >>= bBool;
783 if ( bBool )
784 nFlags |= 0x80;
786 if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ) ) )
788 sal_Bool bBool = sal_False;
789 mAny >>= bBool;
790 if ( !bBool )
791 nFlags |= 0x11;
793 // if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsMouseVisible" ) ) ) )
794 // {
795 // }
796 // if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ) ) )
797 // {
798 // }
799 // if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "StartWithNavigator" ) ) ) )
800 // {
801 // }
802 // if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "UsePen" ) ) ) )
803 // {
804 // }
805 mpPptEscherEx->AddAtom( 80, EPP_SSDocInfoAtom, 1 );
806 *mpStrm << nPenColor << nRestartTime << nStartSlide << nEndSlide;
808 sal_uInt32 nCustomShowNameLen = aCustomShow.getLength();
809 if ( nCustomShowNameLen > 31 )
810 nCustomShowNameLen = 31;
811 if ( nCustomShowNameLen ) // named show identifier
813 const sal_Unicode* pCustomShow = aCustomShow.getStr();
814 for ( i = 0; i < nCustomShowNameLen; i++ )
816 *mpStrm << (sal_uInt16)( pCustomShow[ i ] );
819 for ( i = nCustomShowNameLen; i < 32; i++, *mpStrm << (sal_uInt16)0 ) ;
821 *mpStrm << nFlags;
822 ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XCustomPresentationSupplier >
823 aXCPSup( mXModel, ::com::sun::star::uno::UNO_QUERY );
824 if ( aXCPSup.is() )
826 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
827 aXCont( aXCPSup->getCustomPresentations() );
828 if ( aXCont.is() )
830 ::com::sun::star::uno::Sequence< ::rtl::OUString> aNameSeq( aXCont->getElementNames() );
831 const ::rtl::OUString* pUString = aNameSeq.getArray();
832 sal_uInt32 nCount = aNameSeq.getLength();
833 if ( nCount )
835 mpPptEscherEx->OpenContainer( EPP_NamedShows );
836 sal_uInt32 nCustomShowIndex = 0;
837 for( i = 0; i < nCount; i++ ) // Anzahl der Custom Shows
839 if ( pUString[ i ].getLength() )
841 mpPptEscherEx->OpenContainer( EPP_NamedShow, nCustomShowIndex++ );
843 sal_uInt32 nNamedShowLen = pUString[ i ].getLength();
844 if ( nNamedShowLen > 31 )
845 nNamedShowLen = 31;
846 mpPptEscherEx->AddAtom( nNamedShowLen << 1, EPP_CString );
847 const sal_Unicode* pCustomShowName = pUString[ i ].getStr();
848 for ( sal_uInt32 k = 0; k < nNamedShowLen; *mpStrm << (sal_uInt16)( pCustomShowName[ k++ ] ) ) ;
849 mAny = aXCont->getByName( pUString[ i ] );
850 if ( mAny.getValue() )
853 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > aXIC;
854 if ( mAny >>= aXIC )
856 mpPptEscherEx->BeginAtom();
858 INT32 nSlideCount = aXIC->getCount();
859 for ( INT32 j = 0; j < nSlideCount; j++ ) // Anzahl der Slides
861 mAny = aXIC->getByIndex( j );
862 if ( mAny.getValue() )
864 ::com::sun::star::uno::Reference<
865 ::com::sun::star::drawing::XDrawPage > aXDrawPage;
866 if ( mAny >>= aXDrawPage )
868 ::com::sun::star::uno::Reference<
869 ::com::sun::star::container::XNamed >
870 aXName( aXDrawPage, ::com::sun::star::uno::UNO_QUERY );
871 if ( aXName.is() )
873 ::rtl::OUString aSlideName( aXName->getName() );
874 sal_uInt32 nPageNumber = 0;
875 for ( ::rtl::OUString* pSlideName = (::rtl::OUString*)maSlideNameList.First();
876 pSlideName;
877 pSlideName = (::rtl::OUString*)maSlideNameList.Next(), nPageNumber++ )
879 if ( *pSlideName == aSlideName )
881 *mpStrm << (sal_uInt32)( nPageNumber + 0x100 ); // unique slide id
882 break;
889 mpPptEscherEx->EndAtom( EPP_NamedShowSlides );
892 mpPptEscherEx->CloseContainer(); // EPP_NamedShow
895 mpPptEscherEx->CloseContainer(); // EPP_NamedShows
902 mpPptEscherEx->AddAtom( 0, EPP_EndDocument );
903 mpPptEscherEx->CloseContainer(); // EPP_Document
904 return TRUE;
907 // ---------------------------------------------------------------------------------------------
909 sal_Bool PPTWriter::ImplCreateHyperBlob( SvMemoryStream& rStrm )
911 sal_uInt32 nCurrentOfs, nParaOfs, nParaCount = 0;
912 // SfxOlePropertySection does this...
913 // rStrm << (sal_uInt32)0x41; // property type VT_BLOB
914 nParaOfs = rStrm.Tell();
915 rStrm << (sal_uInt32)0; // property size
916 rStrm << (sal_uInt32)0; // property count
918 for ( EPPTHyperlink* pLink = (EPPTHyperlink*)maHyperlink.First(); pLink; pLink = (EPPTHyperlink*)maHyperlink.Next() )
920 nParaCount += 6;
921 rStrm << (sal_uInt32)3 // Type VT_I4
922 << (sal_uInt32)7 // (VTI4 - Private1)
923 << (sal_uInt32)3 // Type VT_I4
924 << (sal_uInt32)6 // (VTI4 - Private2)
925 << (sal_uInt32)3 // Type VT_I4
926 << (sal_uInt32)0; // (VTI4 - Private3)
928 // INFO
929 // HIWORD: = 0 : do not change anything
930 // = 1 : replace the hyperlink with the target and subadress in the following two VTLPWSTR
931 // = 2 : delete the hyperlink
932 // LOWORD: = 0 : graphic shown as background (link)
933 // = 1 : graphic shown as shape (link)
934 // = 2 : graphic is used to fill a shape
935 // = 3 : graphic used to fill a shape outline (future use)
936 // = 4 : hyperlink attached to a shape
937 // = 5 : " " " " (Word) field
938 // = 6 : " " " " (Excel) range
939 // = 7 : " " " " (PPT) text range
940 // = 8 : " " " " (Project) task
942 sal_uInt32 nUrlLen = pLink->aURL.Len();
943 const sal_Unicode* pUrl = pLink->aURL.GetBuffer();
945 sal_uInt32 nInfo = 7;
947 rStrm << (sal_uInt32)3 // Type VT_I4
948 << nInfo; // Info
950 switch( pLink->nType & 0xff )
952 case 1 : // click action to slidenumber
954 rStrm << (sal_uInt32)0x1f << (sal_uInt32)1 << (sal_uInt32)0; // path
955 rStrm << (sal_uInt32)0x1f << (sal_uInt32)( nUrlLen + 1 );
956 for ( sal_uInt32 i = 0; i < nUrlLen; i++ )
958 rStrm << pUrl[ i ];
960 rStrm << (sal_uInt16)0;
962 break;
963 case 2 :
965 sal_uInt32 i;
967 rStrm << (sal_uInt32)0x1f
968 << (sal_uInt32)( nUrlLen + 1 );
969 for ( i = 0; i < nUrlLen; i++ )
971 rStrm << pUrl[ i ];
973 if ( ! ( i & 1 ) )
974 rStrm << (sal_uInt16)0;
975 rStrm << (sal_uInt16)0
976 << (sal_uInt32)0x1f
977 << (sal_uInt32)1
978 << (sal_uInt32)0;
980 break;
983 nCurrentOfs = rStrm.Tell();
984 rStrm.Seek( nParaOfs );
985 rStrm << (sal_uInt32)( nCurrentOfs - ( nParaOfs + 4 ) );
986 rStrm << nParaCount;
987 rStrm.Seek( nCurrentOfs );
988 return TRUE;
991 PHLayout& PPTWriter::ImplGetLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const
993 ::com::sun::star::uno::Any aAny;
994 sal_Int16 nLayout = 20;
995 if ( GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Layout" ) ) ), sal_True )
996 aAny >>= nLayout;
998 if ( ( nLayout >= 21 ) && ( nLayout <= 26 ) ) // NOTES _> HANDOUT6
999 nLayout = 20;
1000 if ( ( nLayout >= 27 ) && ( nLayout <= 30 ) ) // VERTICAL LAYOUT
1001 nLayout -= 6;
1002 else if ( nLayout > 30 )
1003 nLayout = 20;
1004 return pPHLayout[ nLayout ];
1008 // ---------------------------------------------------------------------------------------------
1010 sal_Bool PPTWriter::ImplCreateMaster( sal_uInt32 nPageNum )
1012 if ( !ImplGetPageByIndex( nPageNum, MASTER ) )
1013 return FALSE;
1014 ImplSetCurrentStyleSheet( nPageNum );
1016 if ( !ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) ) ) // Backgroundshape laden
1017 return FALSE;
1018 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet;
1019 if ( !( mAny >>= aXBackgroundPropSet ) )
1020 return FALSE;
1022 sal_uInt32 nFillColor = 0xffffff;
1023 sal_uInt32 nFillBackColor = 0x000000;
1025 ::com::sun::star::drawing::FillStyle aFS = ::com::sun::star::drawing::FillStyle_NONE;
1026 if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) )
1027 mAny >>= aFS;
1028 switch ( aFS )
1030 case ::com::sun::star::drawing::FillStyle_GRADIENT :
1032 if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ) ) ) )
1034 nFillColor = EscherPropertyContainer::GetGradientColor( (::com::sun::star::awt::Gradient*)mAny.getValue(), 0 );
1035 nFillBackColor = EscherPropertyContainer::GetGradientColor( (::com::sun::star::awt::Gradient*)mAny.getValue(), 1 );
1038 break;
1040 case ::com::sun::star::drawing::FillStyle_SOLID :
1042 if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) )
1044 nFillColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) );
1045 nFillBackColor = nFillColor ^ 0xffffff;
1048 break;
1050 default:
1051 break;
1054 mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainMaster | nPageNum, mpStrm->Tell() );
1055 mpPptEscherEx->OpenContainer( EPP_MainMaster );
1056 mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 );
1057 *mpStrm << (INT32)EPP_LAYOUT_TITLEANDBODYSLIDE // slide layout -> title and body slide
1058 << (sal_uInt8)1 << (sal_uInt8)2 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 // placeholderID
1059 << (sal_uInt32)0 // master ID ( ist gleich null bei einer masterpage )
1060 << (sal_uInt32)0 // notes ID ( ist gleich null wenn keine notizen vorhanden )
1061 << (sal_uInt16)0 // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background
1062 << (sal_uInt16)0; // padword
1064 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
1065 *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
1066 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
1067 *mpStrm << (sal_uInt32)0xff0000 << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x00ffff << (sal_uInt32)0x0099ff << (sal_uInt32)0xffff00 << (sal_uInt32)0x0000ff << (sal_uInt32)0x969696;
1068 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
1069 *mpStrm << (sal_uInt32)0xccffff << (sal_uInt32)0x000000 << (sal_uInt32)0x336666 << (sal_uInt32)0x008080 << (sal_uInt32)0x339933 << (sal_uInt32)0x000080 << (sal_uInt32)0xcc3300 << (sal_uInt32)0x66ccff;
1070 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
1071 *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x333333 << (sal_uInt32)0x000000 << (sal_uInt32)0xdddddd << (sal_uInt32)0x808080 << (sal_uInt32)0x4d4d4d << (sal_uInt32)0xeaeaea;
1072 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
1073 *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x66ccff << (sal_uInt32)0xff0000 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xc0c0c0;
1074 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
1075 *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xc0c0c0 << (sal_uInt32)0xff6600 << (sal_uInt32)0x0000ff << (sal_uInt32)0x009900;
1076 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
1077 *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xff9933 << (sal_uInt32)0xccff99 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xb2b2b2;
1079 for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
1081 if ( nInstance == EPP_TEXTTYPE_notUsed )
1082 continue;
1084 // the auto color is dependent to the page background,so we have to set a page that is in the right context
1085 if ( nInstance == EPP_TEXTTYPE_Notes )
1086 ImplGetPageByIndex( 0, NOTICE );
1087 else
1088 ImplGetPageByIndex( 0, MASTER );
1090 mpPptEscherEx->BeginAtom();
1092 sal_Bool bFirst = TRUE;
1093 sal_Bool bSimpleText = FALSE;
1095 *mpStrm << (sal_uInt16)5; // paragraph count
1097 for ( sal_uInt16 nLev = 0; nLev < 5; nLev++ )
1099 if ( nInstance >= EPP_TEXTTYPE_CenterBody )
1101 bFirst = FALSE;
1102 bSimpleText = TRUE;
1103 *mpStrm << nLev;
1105 mpStyleSheet->mpParaSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet );
1106 mpStyleSheet->mpCharSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet );
1107 bFirst = FALSE;
1109 mpPptEscherEx->EndAtom( EPP_TxMasterStyleAtom, 0, nInstance );
1111 ImplGetPageByIndex( nPageNum, MASTER );
1113 EscherSolverContainer aSolverContainer;
1115 mpPptEscherEx->OpenContainer( EPP_PPDrawing );
1116 mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
1118 mpPptEscherEx->EnterGroup(0,0);
1119 ImplWritePage( pPHLayout[ 0 ], aSolverContainer, MASTER, TRUE ); // Die Shapes der Seite werden im PPT Dok. erzeugt
1120 mpPptEscherEx->LeaveGroup();
1122 ImplWriteBackground( aXBackgroundPropSet );
1124 aSolverContainer.WriteSolver( *mpStrm );
1126 mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
1127 mpPptEscherEx->CloseContainer(); // EPP_Drawing
1128 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
1129 *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
1131 if ( aBuExMasterStream.Tell() )
1133 ImplProgTagContainer( mpStrm, &aBuExMasterStream );
1135 mpPptEscherEx->CloseContainer(); // EPP_MainMaster
1136 return TRUE;
1139 // ---------------------------------------------------------------------------------------------
1141 sal_Bool PPTWriter::ImplCreateMainNotes()
1143 if ( !ImplGetPageByIndex( 0, NOTICE ) )
1144 return FALSE;
1145 ImplSetCurrentStyleSheet( 0 );
1147 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget >
1148 aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
1150 if ( !aXMasterPageTarget.is() )
1151 return FALSE;
1153 mXDrawPage = aXMasterPageTarget->getMasterPage();
1154 if ( !mXDrawPage.is() )
1155 return FALSE;
1157 mXPropSet = ::com::sun::star::uno::Reference<
1158 ::com::sun::star::beans::XPropertySet >
1159 ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
1160 if ( !mXPropSet.is() )
1161 return FALSE;
1163 mXShapes = ::com::sun::star::uno::Reference<
1164 ::com::sun::star::drawing::XShapes >
1165 ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
1166 if ( !mXShapes.is() )
1167 return FALSE;
1169 EscherSolverContainer aSolverContainer;
1171 mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainNotes, mpStrm->Tell() );
1172 mpPptEscherEx->OpenContainer( EPP_Notes );
1173 mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 );
1174 *mpStrm << (sal_uInt32)0x80000001 // Number that identifies this slide
1175 << (sal_uInt32)0; // follow nothing
1176 mpPptEscherEx->OpenContainer( EPP_PPDrawing );
1177 mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
1178 mpPptEscherEx->EnterGroup(0,0);
1180 ImplWritePage( pPHLayout[ 20 ], aSolverContainer, NOTICE, TRUE );
1182 mpPptEscherEx->LeaveGroup();
1183 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1184 mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 );
1185 EscherPropertyContainer aPropOpt;
1186 aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color
1187 aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
1188 aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x68bdde );
1189 aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x8b9f8e );
1190 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
1191 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0 );
1192 aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
1193 aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape
1194 aPropOpt.Commit( *mpStrm );
1195 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
1197 aSolverContainer.WriteSolver( *mpStrm );
1199 mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
1200 mpPptEscherEx->CloseContainer(); // EPP_Drawing
1201 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
1202 *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
1203 mpPptEscherEx->CloseContainer(); // EPP_Notes
1204 return TRUE;
1207 // ---------------------------------------------------------------------------------------------
1209 sal_Bool PPTWriter::ImplCreateSlide( sal_uInt32 nPageNum )
1211 ::com::sun::star::uno::Any aAny;
1213 if ( !ImplGetPageByIndex( nPageNum, NORMAL ) )
1214 return FALSE;
1215 sal_uInt32 nMasterID = ImplGetMasterIndex( NORMAL );
1216 ImplSetCurrentStyleSheet( nMasterID );
1217 nMasterID |= 0x80000000;
1219 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet;
1220 sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) );
1221 if ( bHasBackground )
1222 bHasBackground = ( aAny >>= aXBackgroundPropSet );
1224 sal_uInt16 nMode = 7; // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background
1225 if ( bHasBackground )
1226 nMode &=~4;
1228 /* sj: Don't know what's IsBackgroundVisible for, have to ask cl
1229 if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundVisible" ) ) ) )
1231 sal_Bool bBackgroundVisible;
1232 if ( aAny >>= bBackgroundVisible )
1234 if ( bBackgroundVisible )
1235 nMode &= ~4;
1239 if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundObjectsVisible" ) ) ) )
1241 sal_Bool bBackgroundObjectsVisible = sal_False;
1242 if ( aAny >>= bBackgroundObjectsVisible )
1244 if ( !bBackgroundObjectsVisible )
1245 nMode &= ~1;
1249 const PHLayout& rLayout = ImplGetLayout( mXPagePropSet );
1250 mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Slide | nPageNum, mpStrm->Tell() );
1251 mpPptEscherEx->OpenContainer( EPP_Slide );
1252 mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 );
1253 *mpStrm << rLayout.nLayout;
1254 mpStrm->Write( rLayout.nPlaceHolder, 8 ); // placeholderIDs ( 8Stueck )
1255 *mpStrm << (sal_uInt32)nMasterID // master ID ( ist gleich 0x80000000 bei einer masterpage )
1256 << (sal_uInt32)nPageNum + 0x100 // notes ID ( ist gleich null wenn keine notizen vorhanden )
1257 << nMode
1258 << (sal_uInt16)0; // padword
1260 mnDiaMode = 0;
1261 sal_Bool bVisible = sal_True;
1262 ::com::sun::star::presentation::FadeEffect eFe = ::com::sun::star::presentation::FadeEffect_NONE;
1264 if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ) ) )
1265 aAny >>= bVisible;
1266 if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Change" ) ) ) )
1268 switch ( *(INT32*)aAny.getValue() )
1270 case 1 : // automatisch
1271 mnDiaMode++;
1272 case 2 : // halbautomatisch
1273 mnDiaMode++;
1274 default :
1275 case 0 : // manuell
1276 break;
1279 if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ) ) )
1280 aAny >>= eFe;
1282 sal_uInt32 nSoundRef = 0;
1283 sal_Bool bIsSound = sal_False;
1284 sal_Bool bStopSound = sal_False;
1285 sal_Bool bLoopSound = sal_False;
1287 if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) )
1289 rtl::OUString aSoundURL;
1290 if ( aAny >>= aSoundURL )
1292 nSoundRef = maSoundCollection.GetId( aSoundURL );
1293 bIsSound = sal_True;
1295 else
1296 aAny >>= bStopSound;
1298 if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" ) ) ) )
1299 aAny >>= bLoopSound;
1302 sal_Bool bNeedsSSSlideInfoAtom = ( bVisible == FALSE )
1303 || ( mnDiaMode == 2 )
1304 || ( bIsSound )
1305 || ( bStopSound )
1306 || ( eFe != ::com::sun::star::presentation::FadeEffect_NONE );
1307 if ( bNeedsSSSlideInfoAtom )
1309 sal_uInt8 nDirection = 0;
1310 sal_uInt8 nTransitionType = 0;
1311 sal_uInt16 nBuildFlags = 1; // advange by mouseclick
1312 INT32 nSlideTime = 0; // muss noch !!!
1313 sal_uInt8 nSpeed = 1;
1315 if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ) ) )
1317 ::com::sun::star::presentation::AnimationSpeed aAs;
1318 aAny >>= aAs;
1319 nSpeed = (sal_uInt8)aAs;
1321 sal_Int16 nTT = 0, nTST = 0;
1322 if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ) )
1323 && ( aAny >>= nTT ) )
1325 if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionSubtype" ) ) )
1326 && ( aAny >>= nTST ) )
1328 switch( nTT )
1330 case animations::TransitionType::FADE :
1332 if ( nTST == animations::TransitionSubType::CROSSFADE )
1333 nTransitionType = PPT_TRANSITION_TYPE_SMOOTHFADE;
1334 else if ( nTST == animations::TransitionSubType::FADEOVERCOLOR )
1335 nTransitionType = PPT_TRANSITION_TYPE_FADE;
1337 break;
1338 case PPT_TRANSITION_TYPE_COMB :
1340 nTransitionType = PPT_TRANSITION_TYPE_COMB;
1341 if ( nTST == animations::TransitionSubType::COMBVERTICAL )
1342 nDirection++;
1344 break;
1345 case animations::TransitionType::PUSHWIPE :
1347 nTransitionType = PPT_TRANSITION_TYPE_PUSH;
1348 switch( nTST )
1350 case animations::TransitionSubType::FROMRIGHT: nDirection = 0; break;
1351 case animations::TransitionSubType::FROMBOTTOM: nDirection = 1; break;
1352 case animations::TransitionSubType::FROMLEFT: nDirection = 2; break;
1353 case animations::TransitionSubType::FROMTOP: nDirection = 3; break;
1356 break;
1357 case animations::TransitionType::PINWHEELWIPE :
1359 nTransitionType = PPT_TRANSITION_TYPE_WHEEL;
1360 switch( nTST )
1362 case animations::TransitionSubType::ONEBLADE: nDirection = 1; break;
1363 case animations::TransitionSubType::TWOBLADEVERTICAL : nDirection = 2; break;
1364 case animations::TransitionSubType::THREEBLADE : nDirection = 3; break;
1365 case animations::TransitionSubType::FOURBLADE: nDirection = 4; break;
1366 case animations::TransitionSubType::EIGHTBLADE: nDirection = 8; break;
1369 break;
1370 case animations::TransitionType::FANWIPE :
1372 nTransitionType = PPT_TRANSITION_TYPE_WEDGE;
1374 break;
1375 case animations::TransitionType::ELLIPSEWIPE :
1377 nTransitionType = PPT_TRANSITION_TYPE_CIRCLE;
1379 break;
1380 case animations::TransitionType::FOURBOXWIPE :
1382 nTransitionType = PPT_TRANSITION_TYPE_PLUS;
1384 break;
1385 case animations::TransitionType::IRISWIPE :
1387 nTransitionType = PPT_TRANSITION_TYPE_DIAMOND;
1389 break;
1393 if ( !nTransitionType )
1395 switch ( eFe )
1397 default :
1398 case ::com::sun::star::presentation::FadeEffect_RANDOM :
1399 nTransitionType = PPT_TRANSITION_TYPE_RANDOM;
1400 break;
1402 case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_STRIPES :
1403 nDirection++;
1404 case ::com::sun::star::presentation::FadeEffect_VERTICAL_STRIPES :
1405 nTransitionType = PPT_TRANSITION_TYPE_BLINDS;
1406 break;
1408 case ::com::sun::star::presentation::FadeEffect_VERTICAL_CHECKERBOARD :
1409 nDirection++;
1410 case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_CHECKERBOARD :
1411 nTransitionType = PPT_TRANSITION_TYPE_CHECKER;
1412 break;
1414 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERLEFT :
1415 nDirection++;
1416 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERRIGHT :
1417 nDirection++;
1418 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERLEFT :
1419 nDirection++;
1420 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERRIGHT :
1421 nDirection++;
1422 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_TOP :
1423 nDirection++;
1424 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LEFT :
1425 nDirection++;
1426 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_BOTTOM :
1427 nDirection++;
1428 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_RIGHT :
1429 nTransitionType = PPT_TRANSITION_TYPE_COVER;
1430 break;
1432 case ::com::sun::star::presentation::FadeEffect_DISSOLVE :
1433 nTransitionType = PPT_TRANSITION_TYPE_DISSOLVE;
1434 break;
1436 case ::com::sun::star::presentation::FadeEffect_VERTICAL_LINES :
1437 nDirection++;
1438 case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_LINES :
1439 nTransitionType = PPT_TRANSITION_TYPE_RANDOM_BARS;
1440 break;
1442 case ::com::sun::star::presentation::FadeEffect_CLOSE_HORIZONTAL :
1443 nDirection++;
1444 case ::com::sun::star::presentation::FadeEffect_OPEN_HORIZONTAL :
1445 nDirection++;
1446 case ::com::sun::star::presentation::FadeEffect_CLOSE_VERTICAL :
1447 nDirection++;
1448 case ::com::sun::star::presentation::FadeEffect_OPEN_VERTICAL :
1449 nTransitionType = PPT_TRANSITION_TYPE_SPLIT;
1450 break;
1452 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERLEFT :
1453 nDirection++;
1454 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERRIGHT :
1455 nDirection++;
1456 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERLEFT :
1457 nDirection++;
1458 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERRIGHT :
1459 nDirection += 4;
1460 nTransitionType = PPT_TRANSITION_TYPE_STRIPS;
1461 break;
1463 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT :
1464 nDirection++;
1465 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERLEFT :
1466 nDirection++;
1467 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT :
1468 nDirection++;
1469 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERLEFT :
1470 nDirection++;
1471 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_BOTTOM :
1472 nDirection++;
1473 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_RIGHT :
1474 nDirection++;
1475 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_TOP :
1476 nDirection++;
1477 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LEFT :
1478 nTransitionType = PPT_TRANSITION_TYPE_PULL;
1479 break;
1481 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_TOP :
1482 nDirection++;
1483 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LEFT :
1484 nDirection++;
1485 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_BOTTOM :
1486 nDirection++;
1487 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_RIGHT :
1488 nTransitionType = PPT_TRANSITION_TYPE_WIPE;
1489 break;
1491 case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_TOP :
1492 nDirection++;
1493 case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_LEFT :
1494 nDirection++;
1495 case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_BOTTOM :
1496 nDirection++;
1497 case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_RIGHT :
1498 nTransitionType = PPT_TRANSITION_TYPE_WIPE;
1499 break;
1501 case ::com::sun::star::presentation::FadeEffect_FADE_TO_CENTER :
1502 nDirection++;
1503 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_CENTER :
1504 nTransitionType = PPT_TRANSITION_TYPE_ZOOM;
1505 break;
1507 case ::com::sun::star::presentation::FadeEffect_NONE :
1508 nDirection = 2;
1509 break;
1512 if ( mnDiaMode == 2 ) // automatic ?
1513 nBuildFlags |= 0x400;
1514 if ( bVisible == FALSE )
1515 nBuildFlags |= 4;
1516 if ( bIsSound )
1517 nBuildFlags |= 16;
1518 if ( bLoopSound )
1519 nBuildFlags |= 64;
1520 if ( bStopSound )
1521 nBuildFlags |= 256;
1523 if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Duration" ) ) ) )// duration of this slide
1524 nSlideTime = *(INT32*)aAny.getValue() << 10; // in ticks
1527 mpPptEscherEx->AddAtom( 16, EPP_SSSlideInfoAtom );
1528 *mpStrm << nSlideTime // standtime in ticks
1529 << nSoundRef
1530 << nDirection
1531 << nTransitionType
1532 << nBuildFlags
1533 << nSpeed
1534 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0;
1537 ImplCreateHeaderFooters( mXPagePropSet );
1539 EscherSolverContainer aSolverContainer;
1540 mpPptEscherEx->OpenContainer( EPP_PPDrawing );
1541 mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
1542 mpPptEscherEx->EnterGroup(0,0);
1543 ImplWritePage( rLayout, aSolverContainer, NORMAL, FALSE, nPageNum ); // Die Shapes der Seite werden im PPT Dok. erzeugt
1544 mpPptEscherEx->LeaveGroup();
1546 if ( bHasBackground )
1547 ImplWriteBackground( aXBackgroundPropSet );
1548 else
1550 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1551 mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
1552 EscherPropertyContainer aPropOpt;
1553 aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) );
1554 aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Width ) );
1555 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
1556 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
1557 aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
1558 aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape
1559 aPropOpt.Commit( *mpStrm );
1560 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
1563 aSolverContainer.WriteSolver( *mpStrm );
1565 mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
1566 mpPptEscherEx->CloseContainer(); // EPP_Drawing
1567 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
1568 *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
1570 if ( mbUseNewAnimations )
1572 SvMemoryStream amsofbtAnimGroup;
1573 ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection );
1574 aExporter.doexport( mXDrawPage, amsofbtAnimGroup );
1575 sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell();
1576 if ( nmsofbtAnimGroupSize )
1578 EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags );
1579 EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag );
1581 EscherExAtom aCString( *mpStrm, EPP_CString );
1582 *mpStrm << (sal_uInt32)0x5f005f
1583 << (sal_uInt32)0x50005f
1584 << (sal_uInt32)0x540050
1585 << (sal_uInt16)0x31
1586 << (sal_uInt16)0x30;
1589 EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData );
1592 EscherExAtom aMagic2( *mpStrm, 0x2eeb );
1593 *mpStrm << (sal_uInt32)0x01c45df9
1594 << (sal_uInt32)0xe1471b30;
1597 EscherExAtom aMagic( *mpStrm, 0x2b00 );
1598 *mpStrm << (sal_uInt32)0;
1601 mpStrm->Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() );
1603 EscherExContainer aMagic2( *mpStrm, 0x2b02 );
1608 mpPptEscherEx->CloseContainer(); // EPP_Slide
1609 return TRUE;
1612 // ---------------------------------------------------------------------------------------------
1614 sal_Bool PPTWriter::ImplCreateNotes( sal_uInt32 nPageNum )
1616 if ( !ImplGetPageByIndex( nPageNum, NOTICE ) )
1617 return FALSE;
1618 ImplSetCurrentStyleSheet( ImplGetMasterIndex( NORMAL ) );
1621 mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Notes | nPageNum, mpStrm->Tell() );
1622 mpPptEscherEx->OpenContainer( EPP_Notes );
1623 mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 );
1624 *mpStrm << (sal_uInt32)nPageNum + 0x100
1625 << (sal_uInt16)3 // follow master ....
1626 << (sal_uInt16)0;
1628 ImplCreateHeaderFooters( mXPagePropSet );
1630 EscherSolverContainer aSolverContainer;
1632 mpPptEscherEx->OpenContainer( EPP_PPDrawing );
1633 mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
1634 mpPptEscherEx->EnterGroup(0,0);
1636 ImplWritePage( pPHLayout[ 20 ], aSolverContainer, NOTICE, FALSE ); // Die Shapes der Seite werden im PPT Dok. erzeugt
1638 mpPptEscherEx->LeaveGroup();
1639 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1640 mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
1641 EscherPropertyContainer aPropOpt;
1642 aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color
1643 aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
1644 aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x8b9f8e );
1645 aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x68bdde );
1646 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
1647 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
1648 aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
1649 aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
1650 aPropOpt.Commit( *mpStrm );
1651 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
1653 aSolverContainer.WriteSolver( *mpStrm );
1655 mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
1656 mpPptEscherEx->CloseContainer(); // EPP_Drawing
1657 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
1658 *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
1659 mpPptEscherEx->CloseContainer(); // EPP_Notes
1660 return TRUE;
1663 void PPTWriter::ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet )
1665 //************************ ******
1666 //** DEFAULT BACKGROUND SHAPE **
1667 //******************************
1669 sal_uInt32 nFillColor = 0xffffff;
1670 sal_uInt32 nFillBackColor = 0;
1672 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1673 mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
1674 Point aEmptyPoint = Point();
1675 Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
1676 EscherPropertyContainer aPropOpt( (EscherGraphicProvider&)*mpPptEscherEx, mpPicStrm, aRect );
1677 aPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
1678 ::com::sun::star::drawing::FillStyle aFS( ::com::sun::star::drawing::FillStyle_NONE );
1679 if ( ImplGetPropertyValue( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) )
1680 mAny >>= aFS;
1682 switch( aFS )
1684 case ::com::sun::star::drawing::FillStyle_GRADIENT :
1686 aPropOpt.CreateGradientProperties( rXPropSet );
1687 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x1f001e );
1688 aPropOpt.GetOpt( ESCHER_Prop_fillColor, nFillColor );
1689 aPropOpt.GetOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
1691 break;
1693 case ::com::sun::star::drawing::FillStyle_BITMAP :
1694 aPropOpt.CreateGraphicProperties( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapURL" ) ), sal_True );
1695 break;
1697 case ::com::sun::star::drawing::FillStyle_HATCH :
1698 aPropOpt.CreateGraphicProperties( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" ) ), sal_True );
1699 break;
1701 case ::com::sun::star::drawing::FillStyle_SOLID :
1703 if ( ImplGetPropertyValue( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) )
1705 nFillColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) );
1706 nFillBackColor = nFillColor ^ 0xffffff;
1708 } // PASSTHROUGH INTENDED
1709 case ::com::sun::star::drawing::FillStyle_NONE :
1710 default:
1711 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
1712 break;
1714 aPropOpt.AddOpt( ESCHER_Prop_fillColor, nFillColor );
1715 aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
1716 aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) );
1717 aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Height ) );
1718 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
1719 aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_bwWhite );
1720 aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
1721 aPropOpt.Commit( *mpStrm );
1722 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
1725 void PPTWriter::ImplWriteCString( SvStream& rSt, const String& rString, sal_uInt32 nInstance )
1727 sal_uInt32 i, nLen = rString.Len();
1728 if ( nLen )
1730 rSt << (sal_uInt32)( ( nInstance << 4 ) | ( EPP_CString << 16 ) )
1731 << (sal_uInt32)( nLen << 1 );
1732 for ( i = 0; i < nLen; i++ )
1733 rSt << rString.GetChar( (sal_uInt16)i );
1737 void PPTWriter::ImplWriteVBA( SvMemoryStream* pVBA )
1739 if ( pVBA )
1741 pVBA->Seek( STREAM_SEEK_TO_END );
1742 sal_uInt32 nLen = pVBA->Tell();
1743 if ( nLen > 8 )
1745 nLen -= 8;
1746 mnVBAOleOfs = mpStrm->Tell();
1747 mpPptEscherEx->BeginAtom();
1748 mpStrm->Write( (sal_Int8*)pVBA->GetData() + 8, nLen );
1749 mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
1754 // ---------------------------------------------------------------------------------------------
1756 void PPTWriter::ImplWriteOLE( sal_uInt32 nCnvrtFlags )
1758 PPTExOleObjEntry* pPtr;
1760 SvxMSExportOLEObjects aOleExport( nCnvrtFlags );
1762 for ( pPtr = (PPTExOleObjEntry*)maExOleObj.First(); pPtr;
1763 pPtr = (PPTExOleObjEntry*)maExOleObj.Next() )
1765 SvMemoryStream* pStrm = NULL;
1766 pPtr->nOfsB = mpStrm->Tell();
1767 switch ( pPtr->eType )
1769 case NORMAL_OLE_OBJECT :
1771 SdrObject* pSdrObj = GetSdrObjectFromXShape( pPtr->xShape );
1772 if ( pSdrObj && pSdrObj->ISA( SdrOle2Obj ) )
1774 ::uno::Reference < embed::XEmbeddedObject > xObj( ( (SdrOle2Obj*) pSdrObj )->GetObjRef() );
1775 if( xObj.is() )
1777 SvStorageRef xTempStorage( new SvStorage( new SvMemoryStream(), TRUE ) );
1778 aOleExport.ExportOLEObject( xObj, *xTempStorage );
1780 //TODO/MBA: testing
1781 String aPersistStream( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( SVEXT_PERSIST_STREAM ) ) );
1782 SvMemoryStream aStream;
1783 SvStorageRef xCleanStorage( new SvStorage( FALSE, aStream ) );
1784 xTempStorage->CopyTo( xCleanStorage );
1785 // SJ: #99809# create a dummy content stream, the dummy content is necessary for ppt, but not for
1786 // doc files, so we can't share code.
1787 SotStorageStreamRef xStm = xCleanStorage->OpenSotStream( aPersistStream, STREAM_STD_READWRITE );
1788 *xStm << (sal_uInt32)0 // no ClipboardId
1789 << (sal_uInt32)4 // no target device
1790 << (sal_uInt32)1 // aspect ratio
1791 << (sal_Int32)-1 // L-Index
1792 << (sal_uInt32)0 // Advanced Flags
1793 << (sal_uInt32)0 // compression
1794 << (sal_uInt32)0 // Size
1795 << (sal_uInt32)0 // "
1796 << (sal_uInt32)0;
1797 pStrm = xCleanStorage->CreateMemoryStream();
1801 break;
1803 case OCX_CONTROL :
1805 if ( pPtr->xControlModel.is() )
1807 String aName;
1808 ::com::sun::star::awt::Size aSize;
1809 SvStorageRef xDest( new SvStorage( new SvMemoryStream(), TRUE ) );
1810 sal_Bool bOk = SvxMSConvertOCXControls::WriteOCXStream( xDest, pPtr->xControlModel, aSize, aName );
1811 if ( bOk )
1812 pStrm = xDest->CreateMemoryStream();
1816 if ( pStrm )
1818 mpPptEscherEx->BeginAtom();
1819 pStrm->Seek( STREAM_SEEK_TO_END );
1820 sal_uInt32 npStrmSize = pStrm->Tell();
1821 *mpStrm << npStrmSize; // uncompressed size
1823 #ifdef DBG_EXTRACTOLEOBJECTS
1824 SvFileStream aOut( String::CreateFromAscii( "D:\\OUT.OLE" ), STREAM_TRUNC | STREAM_WRITE );
1825 pStrm->Seek( 0 );
1826 aOut.Write( pStrm->GetData(), npStrmSize );
1827 #endif
1829 pStrm->Seek( 0 );
1830 ZCodec aZCodec( 0x8000, 0x8000 );
1831 aZCodec.BeginCompression();
1832 aZCodec.Compress( *pStrm, *mpStrm );
1833 aZCodec.EndCompression();
1834 delete pStrm;
1835 mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
1840 // ---------------------------------------------------------------------------------------------
1841 // PersistantTable und UserEditAtom schreiben
1843 sal_Bool PPTWriter::ImplWriteAtomEnding()
1846 #define EPP_LastViewTypeNone 0
1847 #define EPP_LastViewTypeSlideView 1
1848 #define EPP_LastViewTypeOutlineView 2
1849 #define EPP_LastViewTypeNotes 3
1852 sal_uInt32 i, nPos, nOfs, nPersistOfs = mpStrm->Tell();
1853 sal_uInt32 nPersistEntrys = 0;
1854 *mpStrm << (sal_uInt32)0 << (sal_uInt32)0 << (sal_uInt32)0; // Record Header und ersten Eintrag ueberspringen
1856 // Document pesist schreiben
1857 nPersistEntrys++;
1858 *mpStrm << (sal_uInt32)0;
1859 // MasterPages persists schreiben
1860 for ( i = 0; i < mnMasterPages; i++ )
1862 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_MainMaster | i );
1863 if ( nOfs )
1865 *mpStrm << nOfs;
1866 mpPptEscherEx->InsertAtPersistOffset( EPP_MAINMASTER_PERSIST_KEY | i, ++nPersistEntrys );
1869 // MainNotesMaster persist schreiben
1870 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_MainNotes );
1871 if ( nOfs )
1873 *mpStrm << nOfs;
1874 mpPptEscherEx->InsertAtPersistOffset( EPP_MAINNOTESMASTER_PERSIST_KEY, ++nPersistEntrys );
1876 // Slide persists schreiben -> es gilt hier auch den EPP_SlidePersistAtome mit einem gueltigen wert zu beschreiben
1877 for ( i = 0; i < mnPages; i++ )
1879 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Slide | i );
1880 if ( nOfs )
1882 *mpStrm << nOfs;
1883 mpPptEscherEx->InsertAtPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, ++nPersistEntrys );
1886 // Notes persists schreiben
1887 for ( i = 0; i < mnPages; i++ )
1889 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Notes | i );
1890 if ( nOfs )
1892 *mpStrm << nOfs;
1893 mpPptEscherEx->InsertAtPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, ++nPersistEntrys );
1896 // Ole persists
1897 PPTExOleObjEntry* pPtr;
1898 for ( pPtr = (PPTExOleObjEntry*)maExOleObj.First(); pPtr; pPtr = (PPTExOleObjEntry*)maExOleObj.Next() )
1900 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_ExObj );
1901 if ( nOfs )
1903 nPersistEntrys++;
1904 *mpStrm << pPtr->nOfsB;
1905 sal_uInt32 nOldPos, nPersOfs = nOfs + pPtr->nOfsA + 16 + 8; // 8 bytes atom header, +16 to the persist entry
1906 nOldPos = mpStrm->Tell();
1907 mpStrm->Seek( nPersOfs );
1908 *mpStrm << nPersistEntrys;
1909 mpStrm->Seek( nOldPos );
1912 // VB persist
1913 if ( mnVBAOleOfs && mpVBA )
1915 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_VBAInfoAtom );
1916 if ( nOfs )
1918 nPersistEntrys++;
1919 sal_uInt32 n1, n2;
1921 mpVBA->Seek( 0 );
1922 *mpVBA >> n1
1923 >> n2;
1925 *mpStrm << mnVBAOleOfs;
1926 sal_uInt32 nOldPos = mpStrm->Tell();
1927 mpStrm->Seek( nOfs ); // Fill the VBAInfoAtom with the correct index to the persisttable
1928 *mpStrm << nPersistEntrys
1929 << n1
1930 << 2;
1931 mpStrm->Seek( nOldPos );
1935 nPos = mpStrm->Tell();
1936 mpStrm->Seek( nPersistOfs );
1937 mpPptEscherEx->AddAtom( ( nPersistEntrys + 1 ) << 2, EPP_PersistPtrIncrementalBlock ); // Record Header eintragen
1938 *mpStrm << (sal_uInt32)( ( nPersistEntrys << 20 ) | 1 );
1939 mpStrm->Seek( nPos );
1941 *mpCurUserStrm << (sal_uInt32)nPos; // offset to current edit setzen
1942 mpPptEscherEx->AddAtom( 28, EPP_UserEditAtom );
1943 *mpStrm << (INT32)0x100 // last slide ID
1944 << (sal_uInt32)0x03000dbc // minor and major app version that did the save
1945 << (sal_uInt32)0 // offset last save, 0 after a full save
1946 << nPersistOfs // File offset to persist pointers for this save operation
1947 << (sal_uInt32)1 // Persist reference to the document persist object
1948 << (sal_uInt32)nPersistEntrys // max persists written, Seed value for persist object id management
1949 << (sal_Int16)EPP_LastViewTypeSlideView // last view type
1950 << (sal_Int16)0x12; // padword
1952 return TRUE;
1955 // ---------------------------------------------------------------------------------------------
1957 PPTExCharSheet::PPTExCharSheet( int nInstance )
1959 sal_uInt16 nFontHeight = 24;
1961 for ( int nDepth = 0; nDepth < 5; nDepth++ )
1963 PPTExCharLevel& rLev = maCharLevel[ nDepth ];
1964 switch ( nInstance )
1966 case EPP_TEXTTYPE_Title :
1967 case EPP_TEXTTYPE_CenterTitle :
1968 nFontHeight = 44;
1969 break;
1970 case EPP_TEXTTYPE_Body :
1971 case EPP_TEXTTYPE_CenterBody :
1972 case EPP_TEXTTYPE_HalfBody :
1973 case EPP_TEXTTYPE_QuarterBody :
1975 switch ( nDepth )
1977 case 0 : nFontHeight = 32; break;
1978 case 1 : nFontHeight = 28; break;
1979 case 2 : nFontHeight = 24; break;
1980 default :nFontHeight = 20; break;
1983 break;
1984 case EPP_TEXTTYPE_Notes :
1985 nFontHeight = 12;
1986 break;
1987 case EPP_TEXTTYPE_notUsed :
1988 case EPP_TEXTTYPE_Other :
1989 nFontHeight = 24;
1990 break;
1992 rLev.mnFlags = 0;
1993 rLev.mnFont = 0;
1994 rLev.mnAsianOrComplexFont = 0xffff;
1995 rLev.mnFontHeight = nFontHeight;
1996 rLev.mnFontColor = 0;
1997 rLev.mnEscapement = 0;
2002 void PPTExCharSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
2003 FontCollection& rFontCollection, int nLevel )
2005 PortionObj aPortionObj( rXPropSet, rFontCollection );
2007 PPTExCharLevel& rLev = maCharLevel[ nLevel ];
2009 if ( aPortionObj.meCharColor == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2010 rLev.mnFontColor = aPortionObj.mnCharColor;
2011 if ( aPortionObj.meCharEscapement == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2012 rLev.mnEscapement = aPortionObj.mnCharEscapement;
2013 if ( aPortionObj.meCharHeight == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2014 rLev.mnFontHeight = aPortionObj.mnCharHeight;
2015 if ( aPortionObj.meFontName == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2016 rLev.mnFont = aPortionObj.mnFont;
2017 if ( aPortionObj.meAsianOrComplexFont == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2018 rLev.mnAsianOrComplexFont = aPortionObj.mnAsianOrComplexFont;
2019 rLev.mnFlags = aPortionObj.mnCharAttr;
2022 void PPTExCharSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, sal_Bool, sal_Bool bSimpleText,
2023 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet )
2025 const PPTExCharLevel& rLev = maCharLevel[ nLev ];
2027 sal_uInt32 nCharFlags = 0xefffff;
2028 if ( bSimpleText )
2029 nCharFlags = 0x7ffff;
2031 rSt << nCharFlags
2032 << rLev.mnFlags
2033 << rLev.mnFont;
2035 sal_uInt32 nFontColor = rLev.mnFontColor;
2036 if ( nFontColor == COL_AUTO )
2038 sal_Bool bIsDark = sal_False;
2039 ::com::sun::star::uno::Any aAny;
2040 if ( PropValue::GetPropertyValue( aAny, rPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) )
2041 aAny >>= bIsDark;
2042 nFontColor = bIsDark ? 0xffffff : 0x000000;
2044 nFontColor &= 0xffffff;
2045 nFontColor |= 0xfe000000;
2046 if ( bSimpleText )
2048 rSt << rLev.mnFontHeight
2049 << nFontColor;
2051 else
2053 rSt << rLev.mnAsianOrComplexFont
2054 << (sal_uInt16)0xffff // unbekannt
2055 << (sal_uInt16)0xffff // unbekannt
2056 << rLev.mnFontHeight
2057 << nFontColor
2058 << rLev.mnEscapement;
2062 PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv ) :
2063 rBuProv ( rProv ),
2064 mnInstance ( nInstance )
2066 sal_Bool bHasBullet = FALSE;
2068 sal_uInt16 nUpperDist = 0;
2069 sal_uInt16 nBulletChar = 0x2022;
2070 sal_uInt16 nBulletOfs = 0;
2071 sal_uInt16 nTextOfs = 0;
2073 for ( int nDepth = 0; nDepth < 5; nDepth++ )
2075 PPTExParaLevel& rLev = maParaLevel[ nDepth ];
2076 switch ( nInstance )
2078 case EPP_TEXTTYPE_Title :
2079 case EPP_TEXTTYPE_CenterTitle :
2080 break;
2081 case EPP_TEXTTYPE_Body :
2082 case EPP_TEXTTYPE_CenterBody :
2083 case EPP_TEXTTYPE_HalfBody :
2084 case EPP_TEXTTYPE_QuarterBody :
2086 bHasBullet = TRUE;
2087 nUpperDist = 0x14;
2089 break;
2090 case EPP_TEXTTYPE_Notes :
2091 nUpperDist = 0x1e;
2092 break;
2094 // default :
2095 // case EPP_TEXTTYPE_notUsed :
2096 // case EPP_TEXTTYPE_Other :
2097 // break;
2099 switch ( nDepth )
2101 case 0 :
2103 nBulletChar = 0x2022;
2104 nBulletOfs = 0;
2105 nTextOfs = ( bHasBullet ) ? 0xd8 : 0;
2107 break;
2108 case 1 :
2110 nBulletChar = 0x2013;
2111 nBulletOfs = 0x120;
2112 nTextOfs = 0x1d4;
2114 break;
2115 case 2 :
2117 nBulletChar = 0x2022;
2118 nBulletOfs = 0x240;
2119 nTextOfs = 0x2d0;
2121 break;
2122 case 3 :
2124 nBulletChar = 0x2013;
2125 nBulletOfs = 0x360;
2126 nTextOfs = 0x3f0;
2128 break;
2129 case 4 :
2131 nBulletChar = 0xbb;
2132 nBulletOfs = 0x480;
2133 nTextOfs = 0x510;
2135 break;
2137 rLev.mbIsBullet = bHasBullet;
2138 rLev.mnBulletChar = nBulletChar;
2139 rLev.mnBulletFont = 0;
2140 rLev.mnBulletHeight = 100;
2141 rLev.mnBulletColor = 0;
2142 rLev.mnAdjust = 0;
2143 rLev.mnLineFeed = 100;
2144 rLev.mnLowerDist = 0;
2145 rLev.mnUpperDist = nUpperDist;
2146 rLev.mnTextOfs = nTextOfs;
2147 rLev.mnBulletOfs = nBulletOfs;
2148 rLev.mnDefaultTab = nDefaultTab;
2149 rLev.mnAsianSettings = 2;
2150 rLev.mnBiDi = 0;
2152 rLev.mbExtendedBulletsUsed = FALSE;
2153 rLev.mnBulletId = 0xffff;
2154 rLev.mnBulletStart = 0;
2155 rLev.mnMappedNumType = 0;
2156 rLev.mnNumberingType = 0;
2160 void PPTExParaSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
2161 FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel )
2163 ParagraphObj aParagraphObj( rXPropSet, rBuProv );
2164 aParagraphObj.CalculateGraphicBulletSize( rCharLevel.mnFontHeight );
2165 PPTExParaLevel& rLev = maParaLevel[ nLevel ];
2167 if ( aParagraphObj.meTextAdjust == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2168 rLev.mnAdjust = aParagraphObj.mnTextAdjust;
2169 if ( aParagraphObj.meLineSpacing == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2171 sal_Int16 nLineSpacing = aParagraphObj.mnLineSpacing;
2172 if ( nLineSpacing > 0 ) // if nLinespacing is < 0 the linespacing is an absolute spacing
2174 sal_Bool bFixedLineSpacing = sal_False;
2175 uno::Any aAny = rXPropSet->getPropertyValue( ::rtl::OUString(
2176 RTL_CONSTASCII_USTRINGPARAM(
2177 "FontIndependentLineSpacing" ) ) );
2178 if( !(aAny >>= bFixedLineSpacing) || !bFixedLineSpacing )
2180 const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont );
2181 if ( pDesc )
2182 nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
2185 else
2187 if ( rCharLevel.mnFontHeight > (sal_uInt16)( ((double)-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point
2189 const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont );
2190 if ( pDesc )
2191 nLineSpacing = (sal_Int16)( (double)100.0 * pDesc->Scaling + 0.5 );
2192 else
2193 nLineSpacing = 100;
2195 else
2196 nLineSpacing = (sal_Int16)( (double)nLineSpacing / 4.40972 );
2198 rLev.mnLineFeed = nLineSpacing;
2200 if ( aParagraphObj.meLineSpacingBottom == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2201 rLev.mnLowerDist = aParagraphObj.mnLineSpacingBottom;
2202 if ( aParagraphObj.meLineSpacingTop == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2203 rLev.mnUpperDist = aParagraphObj.mnLineSpacingTop;
2204 if ( aParagraphObj.meForbiddenRules == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2206 rLev.mnAsianSettings &=~1;
2207 if ( aParagraphObj.mbForbiddenRules )
2208 rLev.mnAsianSettings |= 1;
2210 if ( aParagraphObj.meParagraphPunctation == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2212 rLev.mnAsianSettings &=~4;
2213 if ( aParagraphObj.mbParagraphPunctation )
2214 rLev.mnAsianSettings |= 4;
2217 if ( aParagraphObj.meBiDi == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2218 rLev.mnBiDi = aParagraphObj.mnBiDi;
2220 rLev.mbIsBullet = aParagraphObj.mbIsBullet; //( ( aParagraphObj.nBulletFlags & 1 ) != 0 );
2222 if ( !nLevel )
2224 if ( ( aParagraphObj.meBullet == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
2225 && aParagraphObj.bExtendedParameters )
2227 for ( sal_Int16 i = 0; i < 5; i++ )
2229 PPTExParaLevel& rLevel = maParaLevel[ i ];
2230 if ( i )
2231 aParagraphObj.ImplGetNumberingLevel( rBuProv, i, FALSE );
2232 // rLevel.mbIsBullet = ( ( aParagraphObj.nBulletFlags & 1 ) != 0 );
2233 rLevel.mnTextOfs = aParagraphObj.nTextOfs;
2234 rLevel.mnBulletOfs = (sal_uInt16)aParagraphObj.nBulletOfs;
2235 rLevel.mnBulletChar = aParagraphObj.cBulletId;
2236 FontCollectionEntry aFontDescEntry( aParagraphObj.aFontDesc.Name, aParagraphObj.aFontDesc.Family,
2237 aParagraphObj.aFontDesc.Pitch, aParagraphObj.aFontDesc.CharSet );
2238 rLevel.mnBulletFont = (sal_uInt16)rFontCollection.GetId( aFontDescEntry );
2239 rLevel.mnBulletHeight = aParagraphObj.nBulletRealSize;
2240 rLevel.mnBulletColor = aParagraphObj.nBulletColor;
2242 rLevel.mbExtendedBulletsUsed = aParagraphObj.bExtendedBulletsUsed;
2243 rLevel.mnBulletId = aParagraphObj.nBulletId;
2244 rLevel.mnNumberingType = aParagraphObj.nNumberingType;
2245 rLevel.mnBulletStart = aParagraphObj.nStartWith;
2246 rLevel.mnMappedNumType = aParagraphObj.nMappedNumType;
2252 void PPTExParaSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, sal_Bool, sal_Bool bSimpleText,
2253 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet )
2255 const PPTExParaLevel& rLev = maParaLevel[ nLev ];
2257 if ( maParaLevel[ 0 ].mbExtendedBulletsUsed || maParaLevel[ 1 ].mbExtendedBulletsUsed ||
2258 maParaLevel[ 2 ].mbExtendedBulletsUsed || maParaLevel[ 3 ].mbExtendedBulletsUsed ||
2259 maParaLevel[ 4 ].mbExtendedBulletsUsed )
2261 SvStream& rOut = rBuProv.aBuExMasterStream;
2262 if ( !nLev )
2264 rOut << (sal_uInt32)( ( EPP_PST_ExtendedParagraphMasterAtom << 16 ) | ( mnInstance << 4 ) )
2265 << (sal_uInt32)( 5 * 16 + 2 )
2266 << (sal_uInt16)5; // depth
2268 sal_uInt16 nBulletId = rLev.mnBulletId;
2269 if ( rLev.mnNumberingType != SVX_NUM_BITMAP )
2270 nBulletId = 0xffff;
2271 rOut << (sal_uInt32)0x03800000
2272 << (sal_uInt16)nBulletId
2273 << (sal_uInt32)rLev.mnMappedNumType
2274 << (sal_uInt16)rLev.mnBulletStart
2275 << (sal_uInt32)0;
2278 sal_uInt32 nParaFlags = 0x3ffdff;
2279 sal_uInt16 nBulletFlags = ( rLev.mbIsBullet ) ? 0xf : 0xe;
2281 if ( nLev )
2282 nParaFlags &= 0x207fff;
2283 if ( bSimpleText )
2284 nParaFlags &= 0x7fff;
2285 sal_uInt32 nBulletColor = rLev.mnBulletColor;
2286 if ( nBulletColor == COL_AUTO )
2288 sal_Bool bIsDark = sal_False;
2289 ::com::sun::star::uno::Any aAny;
2290 if ( PropValue::GetPropertyValue( aAny, rPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) )
2291 aAny >>= bIsDark;
2292 nBulletColor = bIsDark ? 0xffffff : 0x000000;
2294 nBulletColor &= 0xffffff;
2295 nBulletColor |= 0xfe000000;
2296 rSt << nParaFlags
2297 << nBulletFlags
2298 << rLev.mnBulletChar
2299 << rLev.mnBulletFont
2300 << rLev.mnBulletHeight
2301 << nBulletColor
2302 << rLev.mnAdjust
2303 << rLev.mnLineFeed
2304 << rLev.mnUpperDist
2305 << rLev.mnLowerDist
2306 << rLev.mnTextOfs
2307 << rLev.mnBulletOfs;
2309 if ( bSimpleText || nLev )
2311 if ( nParaFlags & 0x200000 )
2312 rSt << rLev.mnBiDi;
2314 else
2316 rSt << rLev.mnDefaultTab
2317 << (sal_uInt16)0
2318 << (sal_uInt16)0
2319 << rLev.mnAsianSettings
2320 << rLev.mnBiDi;
2325 PPTExStyleSheet::PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv )
2327 for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
2329 mpParaSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExParaSheet( nInstance, nDefaultTab, rBuProv );
2330 mpCharSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExCharSheet( nInstance );
2334 PPTExStyleSheet::~PPTExStyleSheet()
2336 for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
2338 if ( nInstance == EPP_TEXTTYPE_notUsed )
2339 continue;
2341 delete mpParaSheet[ nInstance ];
2342 delete mpCharSheet[ nInstance ];
2346 void PPTExStyleSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
2347 FontCollection& rFontCollection, int nInstance, int nLevel )
2349 if ( nInstance == EPP_TEXTTYPE_notUsed )
2350 return;
2351 mpCharSheet[ nInstance ]->SetStyleSheet( rXPropSet, rFontCollection, nLevel );
2352 mpParaSheet[ nInstance ]->SetStyleSheet( rXPropSet, rFontCollection, nLevel, mpCharSheet[ nInstance ]->maCharLevel[ nLevel ] );
2355 sal_Bool PPTExStyleSheet::IsHardAttribute( sal_uInt32 nInstance, sal_uInt32 nLevel, PPTExTextAttr eAttr, sal_uInt32 nValue )
2357 const PPTExParaLevel& rPara = mpParaSheet[ nInstance ]->maParaLevel[ nLevel ];
2358 const PPTExCharLevel& rChar = mpCharSheet[ nInstance ]->maCharLevel[ nLevel ];
2360 sal_uInt32 nFlag = 0;
2362 switch ( eAttr )
2364 case ParaAttr_BulletOn : return ( rPara.mbIsBullet ) ? ( nValue ) ? FALSE : TRUE : ( nValue ) ? TRUE : FALSE;
2365 case ParaAttr_BuHardFont :
2366 case ParaAttr_BulletFont : return ( rPara.mnBulletFont != nValue );
2367 case ParaAttr_BuHardColor :
2368 case ParaAttr_BulletColor : return ( rPara.mnBulletColor != nValue );
2369 case ParaAttr_BuHardHeight :
2370 case ParaAttr_BulletHeight : return ( rPara.mnBulletHeight != nValue );
2371 case ParaAttr_BulletChar : return ( rPara.mnBulletChar != nValue );
2372 case ParaAttr_Adjust : return ( rPara.mnAdjust != nValue );
2373 case ParaAttr_LineFeed : return ( rPara.mnLineFeed != nValue );
2374 case ParaAttr_UpperDist : return ( rPara.mnUpperDist != nValue );
2375 case ParaAttr_LowerDist : return ( rPara.mnLowerDist != nValue );
2376 case ParaAttr_TextOfs : return ( rPara.mnTextOfs != nValue );
2377 case ParaAttr_BulletOfs : return ( rPara.mnBulletOfs != nValue );
2378 case ParaAttr_DefaultTab : return ( rPara.mnDefaultTab != nValue );
2379 case ParaAttr_BiDi : return ( rPara.mnBiDi != nValue );
2380 case CharAttr_Bold : nFlag = 1; break;
2381 case CharAttr_Italic : nFlag = 2; break;
2382 case CharAttr_Underline : nFlag = 4; break;
2383 case CharAttr_Shadow : nFlag = 16; break;
2384 case CharAttr_Strikeout : nFlag = 256; break;
2385 case CharAttr_Embossed : nFlag = 512; break;
2386 case CharAttr_Font : return ( rChar.mnFont != nValue );
2387 case CharAttr_AsianOrComplexFont : return ( rChar.mnAsianOrComplexFont != nValue );
2388 case CharAttr_Symbol : return TRUE;
2389 case CharAttr_FontHeight : return ( rChar.mnFontHeight != nValue );
2390 case CharAttr_FontColor : return ( rChar.mnFontColor != nValue );
2391 case CharAttr_Escapement : return ( rChar.mnEscapement != nValue );
2392 default:
2393 break;
2395 if ( nFlag )
2397 if ( rChar.mnFlags & nFlag )
2398 return ( ( nValue & nFlag ) == 0 );
2399 else
2400 return ( ( nValue & nFlag ) != 0 );
2402 return TRUE;
2405 sal_uInt32 PPTExStyleSheet::SizeOfTxCFStyleAtom() const
2407 return 24;
2410 // the TxCFStyleAtom stores the text properties that are used
2411 // when creating new objects in PowerPoint.
2413 void PPTExStyleSheet::WriteTxCFStyleAtom( SvStream& rSt )
2415 const PPTExCharLevel& rCharStyle = mpCharSheet[ EPP_TEXTTYPE_Other ]->maCharLevel[ 0 ];
2417 sal_uInt16 nFlags = 0x60 // ??
2418 | 0x02 // fontsize;
2419 | 0x04; // fontcolor
2421 sal_uInt32 nCharFlags = rCharStyle.mnFlags;
2422 nCharFlags &= CharAttr_Italic | CharAttr_Bold | CharAttr_Underline | CharAttr_Shadow;
2424 rSt << (sal_uInt32)( EPP_TxCFStyleAtom << 16 ) // recordheader
2425 << SizeOfTxCFStyleAtom() - 8
2426 << (sal_uInt16)( 0x80 | nCharFlags )
2427 << (sal_uInt16)nFlags
2428 << (sal_uInt16)nCharFlags
2429 << (sal_Int32)-1 // ?
2430 << rCharStyle.mnFontHeight
2431 << rCharStyle.mnFontColor;
2435 // ---------------------------------------------------------------------------------------------
2437 // ---------------------
2438 // - exported function -
2439 // ---------------------
2441 extern "C" SAL_DLLPUBLIC_EXPORT BOOL __LOADONCALLAPI ExportPPT( SvStorageRef& rSvStorage,
2442 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rXModel,
2443 ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rXStatInd,
2444 SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags )
2446 PPTWriter* pPPTWriter;
2447 BOOL bStatus = FALSE;
2449 pPPTWriter = new PPTWriter( rSvStorage, rXModel, rXStatInd, pVBA, nCnvrtFlags );
2450 if ( pPPTWriter )
2452 bStatus = ( pPPTWriter->IsValid() == TRUE );
2453 delete pPPTWriter;
2456 return bStatus;