1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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"
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
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
),
133 mXStatusIndicator ( rXStatInd
),
134 mbStatusIndicator ( FALSE
),
135 mpCurUserStrm ( NULL
),
138 mpPptEscherEx ( NULL
),
142 mpExEmbed ( new SvMemoryStream
),
143 mnPagesWritten ( 0 ),
147 if ( !ImplInitSOIface() )
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
) )
158 INT32 nWidth
= 21000;
159 if ( ImplGetPropertyValue( mXPagePropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) )
161 INT32 nHeight
= 29700;
162 if ( ImplGetPropertyValue( mXPagePropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) )
165 maNotesPageSize
= ImplMapSize( ::com::sun::star::awt::Size( nWidth
, nHeight
) );
167 if ( !ImplGetPageByIndex( 0, MASTER
) )
170 if ( ImplGetPropertyValue( mXPagePropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) )
173 if ( ImplGetPropertyValue( mXPagePropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) )
175 maDestPageSize
= ImplMapSize( ::com::sun::star::awt::Size( nWidth
, nHeight
) );
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() )
198 mpStrm
= mrStg
->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Document" ) ) );
203 mpPicStrm
= mrStg
->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ) );
205 mpPptEscherEx
= new PptEscherEx( *mpStrm
, mnDrawings
);
207 if ( !ImplGetStyleSheets() )
210 if ( !ImplCreateDocument() )
213 for ( i
= 0; i
< mnMasterPages
; i
++ )
215 if ( !ImplCreateMaster( i
) )
218 if ( !ImplCreateMainNotes() )
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
) )
227 for ( i
= 0; i
< mnPages
; i
++ )
229 if ( !ImplCreateNotes( i
) )
232 if ( !ImplCloseDocument() )
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() )
253 if ( !ImplCreateDocumentSummaryInformation( nCnvrtFlags
) )
260 // ---------------------------------------------------------------------------------------------
262 PPTWriter::~PPTWriter()
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
)
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
);
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" ) ) ) )
364 *static_cast<const uno::Sequence
<sal_uInt8
>*>(mAny
.getValue());
366 sfx2::SaveOlePropertySet( xDocProps
, mrStg
,
367 &aThumbSeq
, &aGuidSeq
, &aHyperSeq
);
371 sfx2::SaveOlePropertySet( xDocProps
, mrStg
,
372 NULL
, &aGuidSeq
, &aHyperSeq
);
379 // ---------------------------------------------------------------------------------------------
381 void PPTWriter::ImplWriteExtParaHeader( SvMemoryStream
& rSt
, sal_uInt32 nRef
, sal_uInt32 nInstance
, sal_uInt32 nSlideId
)
385 aBuExOutlineStream
<< (sal_uInt32
)( ( EPP_PST_ExtendedParagraphHeaderAtom
<< 16 )
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
;
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
)
434 if ( PropValue::GetPropertyValue( aAny
, rXPagePropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "IsFooterVisible" ) ), sal_True
) )
436 if ( ( aAny
>>= bVal
) && bVal
)
439 if ( PropValue::GetPropertyValue( aAny
, rXPagePropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeVisible" ) ), sal_True
) )
441 if ( ( aAny
>>= bVal
) && bVal
)
444 if ( PropValue::GetPropertyValue( aAny
, rXPagePropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "IsPageNumberVisible" ) ), sal_True
) )
446 if ( ( aAny
>>= bVal
) && bVal
)
449 if ( PropValue::GetPropertyValue( aAny
, rXPagePropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeFixed" ) ), sal_True
) )
451 if ( ( aAny
>>= bVal
) && !bVal
)
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
:
466 case SVXDATEFORMAT_D
:
469 case SVXDATEFORMAT_C
:
473 case SVXDATEFORMAT_A
:
476 switch( eTimeFormat
)
478 case SVXTIMEFORMAT_24_HM
:
481 case SVXTIMEFORMAT_12_HM
:
484 case SVXTIMEFORMAT_24_HMS
:
487 case SVXTIMEFORMAT_12_HMS
:
496 mpPptEscherEx
->OpenContainer( EPP_HeadersFooters
, 0 );
497 mpPptEscherEx
->AddAtom( 4, EPP_HeadersFootersAtom
);
499 ImplCreateHeaderFooterStrings( *mpStrm
, rXPagePropSet
);
500 mpPptEscherEx
->CloseContainer();
504 // ---------------------------------------------------------------------------------------------
506 sal_Bool
PPTWriter::ImplCreateDocument()
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
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
;
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
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
);
589 ::rtl::OUString aStr
= aXName
->getName();
590 ::rtl::OUString
*pUStr
= new ::rtl::OUString( aStr
);
591 maSlideNameList
.Insert( pUStr
, LIST_APPEND
);
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
) )
606 if ( mbPresObj
&& ( ( mType
== "presentation.Outliner" ) || ( mType
== "presentation.Subtitle" ) ) )
608 if ( bOutliner
== FALSE
)
611 mnTextStyle
= EPP_TEXTSTYLE_BODY
;
612 sal_uInt32 nTextType
= EPP_TEXTTYPE_Body
;
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
)
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" )
632 TextRuleEntry
* pTempRule
= new TextRuleEntry( i
);
633 SvMemoryStream
aTmpStrm( 0x200, 0x200 );
634 if ( !mbEmptyPresObj
)
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
)
649 mnTextStyle
= EPP_TEXTSTYLE_TITLE
;
650 TextRuleEntry
* pRule
= new TextRuleEntry( i
);
651 SvMemoryStream
aExtBu( 0x200, 0x200 );
652 if ( !mbEmptyPresObj
)
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
);
661 if ( mbEmptyPresObj
)
664 bOtherThanPlaceHolders
= TRUE
; // muss noch auf background und leeren Title/outliner geprueft werden !!!
666 if ( bOutliner
&& bTitle
&& bOtherThanPlaceHolders
)
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
) )
687 nShapes
= mXShapes
->getCount();
689 bOtherThanPlaceHolders
= FALSE
;
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 )
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() )
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
)
756 nEndSlide
= (sal_uInt16
)mnPages
;
765 // if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "DiaName" ) ) ) )
768 // if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsAlwaysOnTop" ) ) ) )
771 if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ) ) )
773 sal_Bool bBool
= sal_False
;
779 if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ) ) ) // muesste eigendlich heissen IsNotEndless !=)"§()&
781 sal_Bool bBool
= sal_False
;
786 if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ) ) )
788 sal_Bool bBool
= sal_False
;
793 // if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsMouseVisible" ) ) ) )
796 // if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ) ) )
799 // if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "StartWithNavigator" ) ) ) )
802 // if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "UsePen" ) ) ) )
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 ) ;
822 ::com::sun::star::uno::Reference
< ::com::sun::star::presentation::XCustomPresentationSupplier
>
823 aXCPSup( mXModel
, ::com::sun::star::uno::UNO_QUERY
);
826 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
>
827 aXCont( aXCPSup
->getCustomPresentations() );
830 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> aNameSeq( aXCont
->getElementNames() );
831 const ::rtl::OUString
* pUString
= aNameSeq
.getArray();
832 sal_uInt32 nCount
= aNameSeq
.getLength();
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 )
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
;
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
);
873 ::rtl::OUString
aSlideName( aXName
->getName() );
874 sal_uInt32 nPageNumber
= 0;
875 for ( ::rtl::OUString
* pSlideName
= (::rtl::OUString
*)maSlideNameList
.First();
877 pSlideName
= (::rtl::OUString
*)maSlideNameList
.Next(), nPageNumber
++ )
879 if ( *pSlideName
== aSlideName
)
881 *mpStrm
<< (sal_uInt32
)( nPageNumber
+ 0x100 ); // unique slide id
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
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() )
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)
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
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
++ )
960 rStrm
<< (sal_uInt16
)0;
967 rStrm
<< (sal_uInt32
)0x1f
968 << (sal_uInt32
)( nUrlLen
+ 1 );
969 for ( i
= 0; i
< nUrlLen
; i
++ )
974 rStrm
<< (sal_uInt16
)0;
975 rStrm
<< (sal_uInt16
)0
983 nCurrentOfs
= rStrm
.Tell();
984 rStrm
.Seek( nParaOfs
);
985 rStrm
<< (sal_uInt32
)( nCurrentOfs
- ( nParaOfs
+ 4 ) );
987 rStrm
.Seek( nCurrentOfs
);
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
)
998 if ( ( nLayout
>= 21 ) && ( nLayout
<= 26 ) ) // NOTES _> HANDOUT6
1000 if ( ( nLayout
>= 27 ) && ( nLayout
<= 30 ) ) // VERTICAL LAYOUT
1002 else if ( nLayout
> 30 )
1004 return pPHLayout
[ nLayout
];
1008 // ---------------------------------------------------------------------------------------------
1010 sal_Bool
PPTWriter::ImplCreateMaster( sal_uInt32 nPageNum
)
1012 if ( !ImplGetPageByIndex( nPageNum
, MASTER
) )
1014 ImplSetCurrentStyleSheet( nPageNum
);
1016 if ( !ImplGetPropertyValue( mXPagePropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) ) ) // Backgroundshape laden
1018 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> aXBackgroundPropSet
;
1019 if ( !( mAny
>>= aXBackgroundPropSet
) )
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" ) ) ) )
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 );
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;
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
)
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
);
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
)
1105 mpStyleSheet
->mpParaSheet
[ nInstance
]->Write( *mpStrm
, mpPptEscherEx
, nLev
, bFirst
, bSimpleText
, mXPagePropSet
);
1106 mpStyleSheet
->mpCharSheet
[ nInstance
]->Write( *mpStrm
, mpPptEscherEx
, nLev
, bFirst
, bSimpleText
, mXPagePropSet
);
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
1139 // ---------------------------------------------------------------------------------------------
1141 sal_Bool
PPTWriter::ImplCreateMainNotes()
1143 if ( !ImplGetPageByIndex( 0, NOTICE
) )
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() )
1153 mXDrawPage
= aXMasterPageTarget
->getMasterPage();
1154 if ( !mXDrawPage
.is() )
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() )
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() )
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
1207 // ---------------------------------------------------------------------------------------------
1209 sal_Bool
PPTWriter::ImplCreateSlide( sal_uInt32 nPageNum
)
1211 ::com::sun::star::uno::Any aAny
;
1213 if ( !ImplGetPageByIndex( nPageNum
, NORMAL
) )
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
)
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 )
1239 if ( GetPropertyValue( aAny
, mXPagePropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundObjectsVisible" ) ) ) )
1241 sal_Bool bBackgroundObjectsVisible
= sal_False
;
1242 if ( aAny
>>= bBackgroundObjectsVisible
)
1244 if ( !bBackgroundObjectsVisible
)
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 )
1258 << (sal_uInt16
)0; // padword
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" ) ) ) )
1266 if ( GetPropertyValue( aAny
, mXPagePropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "Change" ) ) ) )
1268 switch ( *(INT32
*)aAny
.getValue() )
1270 case 1 : // automatisch
1272 case 2 : // halbautomatisch
1279 if ( GetPropertyValue( aAny
, mXPagePropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ) ) )
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
;
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 )
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
;
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
) )
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
;
1338 case PPT_TRANSITION_TYPE_COMB
:
1340 nTransitionType
= PPT_TRANSITION_TYPE_COMB
;
1341 if ( nTST
== animations::TransitionSubType::COMBVERTICAL
)
1345 case animations::TransitionType::PUSHWIPE
:
1347 nTransitionType
= PPT_TRANSITION_TYPE_PUSH
;
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;
1357 case animations::TransitionType::PINWHEELWIPE
:
1359 nTransitionType
= PPT_TRANSITION_TYPE_WHEEL
;
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;
1370 case animations::TransitionType::FANWIPE
:
1372 nTransitionType
= PPT_TRANSITION_TYPE_WEDGE
;
1375 case animations::TransitionType::ELLIPSEWIPE
:
1377 nTransitionType
= PPT_TRANSITION_TYPE_CIRCLE
;
1380 case animations::TransitionType::FOURBOXWIPE
:
1382 nTransitionType
= PPT_TRANSITION_TYPE_PLUS
;
1385 case animations::TransitionType::IRISWIPE
:
1387 nTransitionType
= PPT_TRANSITION_TYPE_DIAMOND
;
1393 if ( !nTransitionType
)
1398 case ::com::sun::star::presentation::FadeEffect_RANDOM
:
1399 nTransitionType
= PPT_TRANSITION_TYPE_RANDOM
;
1402 case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_STRIPES
:
1404 case ::com::sun::star::presentation::FadeEffect_VERTICAL_STRIPES
:
1405 nTransitionType
= PPT_TRANSITION_TYPE_BLINDS
;
1408 case ::com::sun::star::presentation::FadeEffect_VERTICAL_CHECKERBOARD
:
1410 case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_CHECKERBOARD
:
1411 nTransitionType
= PPT_TRANSITION_TYPE_CHECKER
;
1414 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERLEFT
:
1416 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERRIGHT
:
1418 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERLEFT
:
1420 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERRIGHT
:
1422 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_TOP
:
1424 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LEFT
:
1426 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_BOTTOM
:
1428 case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_RIGHT
:
1429 nTransitionType
= PPT_TRANSITION_TYPE_COVER
;
1432 case ::com::sun::star::presentation::FadeEffect_DISSOLVE
:
1433 nTransitionType
= PPT_TRANSITION_TYPE_DISSOLVE
;
1436 case ::com::sun::star::presentation::FadeEffect_VERTICAL_LINES
:
1438 case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_LINES
:
1439 nTransitionType
= PPT_TRANSITION_TYPE_RANDOM_BARS
;
1442 case ::com::sun::star::presentation::FadeEffect_CLOSE_HORIZONTAL
:
1444 case ::com::sun::star::presentation::FadeEffect_OPEN_HORIZONTAL
:
1446 case ::com::sun::star::presentation::FadeEffect_CLOSE_VERTICAL
:
1448 case ::com::sun::star::presentation::FadeEffect_OPEN_VERTICAL
:
1449 nTransitionType
= PPT_TRANSITION_TYPE_SPLIT
;
1452 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERLEFT
:
1454 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERRIGHT
:
1456 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERLEFT
:
1458 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERRIGHT
:
1460 nTransitionType
= PPT_TRANSITION_TYPE_STRIPS
;
1463 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT
:
1465 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERLEFT
:
1467 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT
:
1469 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERLEFT
:
1471 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_BOTTOM
:
1473 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_RIGHT
:
1475 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_TOP
:
1477 case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LEFT
:
1478 nTransitionType
= PPT_TRANSITION_TYPE_PULL
;
1481 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_TOP
:
1483 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LEFT
:
1485 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_BOTTOM
:
1487 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_RIGHT
:
1488 nTransitionType
= PPT_TRANSITION_TYPE_WIPE
;
1491 case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_TOP
:
1493 case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_LEFT
:
1495 case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_BOTTOM
:
1497 case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_RIGHT
:
1498 nTransitionType
= PPT_TRANSITION_TYPE_WIPE
;
1501 case ::com::sun::star::presentation::FadeEffect_FADE_TO_CENTER
:
1503 case ::com::sun::star::presentation::FadeEffect_FADE_FROM_CENTER
:
1504 nTransitionType
= PPT_TRANSITION_TYPE_ZOOM
;
1507 case ::com::sun::star::presentation::FadeEffect_NONE
:
1512 if ( mnDiaMode
== 2 ) // automatic ?
1513 nBuildFlags
|= 0x400;
1514 if ( bVisible
== FALSE
)
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
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
);
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
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
1612 // ---------------------------------------------------------------------------------------------
1614 sal_Bool
PPTWriter::ImplCreateNotes( sal_uInt32 nPageNum
)
1616 if ( !ImplGetPageByIndex( nPageNum
, NOTICE
) )
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 ....
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
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" ) ) ) )
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
);
1693 case ::com::sun::star::drawing::FillStyle_BITMAP
:
1694 aPropOpt
.CreateGraphicProperties( rXPropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapURL" ) ), sal_True
);
1697 case ::com::sun::star::drawing::FillStyle_HATCH
:
1698 aPropOpt
.CreateGraphicProperties( rXPropSet
, String( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" ) ), sal_True
);
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
:
1711 aPropOpt
.AddOpt( ESCHER_Prop_fNoFillHitTest
, 0x120012 );
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();
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
)
1741 pVBA
->Seek( STREAM_SEEK_TO_END
);
1742 sal_uInt32 nLen
= pVBA
->Tell();
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() );
1777 SvStorageRef
xTempStorage( new SvStorage( new SvMemoryStream(), TRUE
) );
1778 aOleExport
.ExportOLEObject( xObj
, *xTempStorage
);
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 // "
1797 pStrm
= xCleanStorage
->CreateMemoryStream();
1805 if ( pPtr
->xControlModel
.is() )
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
);
1812 pStrm
= xDest
->CreateMemoryStream();
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
);
1826 aOut
.Write( pStrm
->GetData(), npStrmSize
);
1830 ZCodec
aZCodec( 0x8000, 0x8000 );
1831 aZCodec
.BeginCompression();
1832 aZCodec
.Compress( *pStrm
, *mpStrm
);
1833 aZCodec
.EndCompression();
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
1858 *mpStrm
<< (sal_uInt32
)0;
1859 // MasterPages persists schreiben
1860 for ( i
= 0; i
< mnMasterPages
; i
++ )
1862 nOfs
= mpPptEscherEx
->PtGetOffsetByID( EPP_Persist_MainMaster
| i
);
1866 mpPptEscherEx
->InsertAtPersistOffset( EPP_MAINMASTER_PERSIST_KEY
| i
, ++nPersistEntrys
);
1869 // MainNotesMaster persist schreiben
1870 nOfs
= mpPptEscherEx
->PtGetOffsetByID( EPP_Persist_MainNotes
);
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
);
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
);
1893 mpPptEscherEx
->InsertAtPersistOffset( EPP_MAINNOTES_PERSIST_KEY
| i
, ++nPersistEntrys
);
1897 PPTExOleObjEntry
* pPtr
;
1898 for ( pPtr
= (PPTExOleObjEntry
*)maExOleObj
.First(); pPtr
; pPtr
= (PPTExOleObjEntry
*)maExOleObj
.Next() )
1900 nOfs
= mpPptEscherEx
->PtGetOffsetByID( EPP_Persist_ExObj
);
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
);
1913 if ( mnVBAOleOfs
&& mpVBA
)
1915 nOfs
= mpPptEscherEx
->PtGetOffsetByID( EPP_Persist_VBAInfoAtom
);
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
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
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
:
1970 case EPP_TEXTTYPE_Body
:
1971 case EPP_TEXTTYPE_CenterBody
:
1972 case EPP_TEXTTYPE_HalfBody
:
1973 case EPP_TEXTTYPE_QuarterBody
:
1977 case 0 : nFontHeight
= 32; break;
1978 case 1 : nFontHeight
= 28; break;
1979 case 2 : nFontHeight
= 24; break;
1980 default :nFontHeight
= 20; break;
1984 case EPP_TEXTTYPE_Notes
:
1987 case EPP_TEXTTYPE_notUsed
:
1988 case EPP_TEXTTYPE_Other
:
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;
2029 nCharFlags
= 0x7ffff;
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
) )
2042 nFontColor
= bIsDark
? 0xffffff : 0x000000;
2044 nFontColor
&= 0xffffff;
2045 nFontColor
|= 0xfe000000;
2048 rSt
<< rLev
.mnFontHeight
2053 rSt
<< rLev
.mnAsianOrComplexFont
2054 << (sal_uInt16
)0xffff // unbekannt
2055 << (sal_uInt16
)0xffff // unbekannt
2056 << rLev
.mnFontHeight
2058 << rLev
.mnEscapement
;
2062 PPTExParaSheet::PPTExParaSheet( int nInstance
, sal_uInt16 nDefaultTab
, PPTExBulletProvider
& 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
:
2081 case EPP_TEXTTYPE_Body
:
2082 case EPP_TEXTTYPE_CenterBody
:
2083 case EPP_TEXTTYPE_HalfBody
:
2084 case EPP_TEXTTYPE_QuarterBody
:
2090 case EPP_TEXTTYPE_Notes
:
2095 // case EPP_TEXTTYPE_notUsed :
2096 // case EPP_TEXTTYPE_Other :
2103 nBulletChar
= 0x2022;
2105 nTextOfs
= ( bHasBullet
) ? 0xd8 : 0;
2110 nBulletChar
= 0x2013;
2117 nBulletChar
= 0x2022;
2124 nBulletChar
= 0x2013;
2137 rLev
.mbIsBullet
= bHasBullet
;
2138 rLev
.mnBulletChar
= nBulletChar
;
2139 rLev
.mnBulletFont
= 0;
2140 rLev
.mnBulletHeight
= 100;
2141 rLev
.mnBulletColor
= 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;
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
);
2182 nLineSpacing
= (sal_Int16
)( (double)nLineSpacing
* pDesc
->Scaling
+ 0.5 );
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
);
2191 nLineSpacing
= (sal_Int16
)( (double)100.0 * pDesc
->Scaling
+ 0.5 );
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 );
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
];
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
;
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
)
2271 rOut
<< (sal_uInt32
)0x03800000
2272 << (sal_uInt16
)nBulletId
2273 << (sal_uInt32
)rLev
.mnMappedNumType
2274 << (sal_uInt16
)rLev
.mnBulletStart
2278 sal_uInt32 nParaFlags
= 0x3ffdff;
2279 sal_uInt16 nBulletFlags
= ( rLev
.mbIsBullet
) ? 0xf : 0xe;
2282 nParaFlags
&= 0x207fff;
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
) )
2292 nBulletColor
= bIsDark
? 0xffffff : 0x000000;
2294 nBulletColor
&= 0xffffff;
2295 nBulletColor
|= 0xfe000000;
2298 << rLev
.mnBulletChar
2299 << rLev
.mnBulletFont
2300 << rLev
.mnBulletHeight
2307 << rLev
.mnBulletOfs
;
2309 if ( bSimpleText
|| nLev
)
2311 if ( nParaFlags
& 0x200000 )
2316 rSt
<< rLev
.mnDefaultTab
2319 << rLev
.mnAsianSettings
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
)
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
)
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;
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
);
2397 if ( rChar
.mnFlags
& nFlag
)
2398 return ( ( nValue
& nFlag
) == 0 );
2400 return ( ( nValue
& nFlag
) != 0 );
2405 sal_uInt32
PPTExStyleSheet::SizeOfTxCFStyleAtom() const
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 // ??
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
);
2452 bStatus
= ( pPPTWriter
->IsValid() == TRUE
);