Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <eppt.hxx>
30 : : #include "epptdef.hxx"
31 : : #include <tools/globname.hxx>
32 : : #include <tools/poly.hxx>
33 : : #include <vcl/graph.hxx>
34 : : #include <vcl/bmpacc.hxx>
35 : : #include <vcl/gradient.hxx>
36 : : #include <rtl/ustring.hxx>
37 : : #include <tools/stream.hxx>
38 : : #include <svtools/fltcall.hxx>
39 : : #include <sfx2/docfile.hxx>
40 : : #include <svx/unoapi.hxx>
41 : : #include <svx/svdobj.hxx>
42 : : #include <svx/svdoole2.hxx>
43 : : #include <svx/svdmodel.hxx>
44 : : #include <svx/svdpage.hxx>
45 : : #include <com/sun/star/view/PaperOrientation.hpp>
46 : : #include <com/sun/star/view/PaperFormat.hpp>
47 : : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
48 : : #include <com/sun/star/office/XAnnotation.hpp>
49 : : #include <com/sun/star/office/XAnnotationAccess.hpp>
50 : : #include <com/sun/star/office/XAnnotationEnumeration.hpp>
51 : : #include <com/sun/star/geometry/RealPoint2D.hpp>
52 : : #include <com/sun/star/util/DateTime.hpp>
53 : : #include <tools/zcodec.hxx>
54 : : #include <editeng/svxenum.hxx>
55 : : #include <sot/storinfo.hxx>
56 : : #include <filter/msfilter/msoleexp.hxx>
57 : : #include <vcl/virdev.hxx>
58 : : #include <svtools/wmf.hxx>
59 : : #include <filter/msfilter/msdffimp.hxx>
60 : : #include <filter/msfilter/svxmsbas.hxx>
61 : : #include <editeng/flditem.hxx>
62 : : #include <sfx2/docinf.hxx>
63 : : #include <oox/export/utils.hxx>
64 : : #include <oox/ole/olehelper.hxx>
65 : :
66 : : using namespace com::sun::star;
67 : : using namespace ::com::sun::star::uno;
68 : : using namespace ::com::sun::star::presentation;
69 : :
70 : : using ::com::sun::star::beans::XPropertySet;
71 : :
72 : : //============================ PPTWriter ==================================
73 : :
74 : 0 : PPTWriter::PPTWriter( SvStorageRef& rSvStorage,
75 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rXModel,
76 : : ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rXStatInd,
77 : : SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags ) :
78 : : PPTWriterBase ( rXModel, rXStatInd ),
79 : : mnCnvrtFlags ( nCnvrtFlags ),
80 : : mbStatus ( sal_False ),
81 : : mbUseNewAnimations ( sal_True ),
82 : : mnLatestStatValue ( 0 ),
83 : : mrStg ( rSvStorage ),
84 : : mpCurUserStrm ( NULL ),
85 : : mpStrm ( NULL ),
86 : : mpPicStrm ( NULL ),
87 : : mpPptEscherEx ( NULL ),
88 : : mnVBAOleOfs ( 0 ),
89 : : mpVBA ( pVBA ),
90 : : mnExEmbed ( 0 ),
91 [ # # ]: 0 : mpExEmbed ( new SvMemoryStream ),
92 : : mnPagesWritten ( 0 ),
93 [ # # ][ # # ]: 0 : mnTxId ( 0x7a2f64 )
[ # # ][ # # ]
[ # # ][ # # ]
94 : : {
95 : 0 : }
96 : :
97 : 0 : void PPTWriter::exportPPTPre( const std::vector< com::sun::star::beans::PropertyValue >& rMediaData )
98 : : {
99 [ # # ]: 0 : if ( !mrStg.Is() )
100 : : return;
101 : :
102 : : // MasterPages + Slides und Notizen + NotesMasterPage
103 : 0 : mnDrawings = mnMasterPages + ( mnPages << 1 ) + 1;
104 : :
105 [ # # ]: 0 : if ( mXStatusIndicator.is() )
106 : : {
107 : 0 : mbStatusIndicator = sal_True;
108 : 0 : mnStatMaxValue = ( mnPages + mnMasterPages ) * 5;
109 [ # # ][ # # ]: 0 : mXStatusIndicator->start( rtl::OUString( "PowerPoint Export" ), mnStatMaxValue + ( mnStatMaxValue >> 3 ) );
110 : : }
111 : :
112 [ # # ]: 0 : SvGlobalName aGName( 0x64818d10L, 0x4f9b, 0x11cf, 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8 );
113 [ # # ][ # # ]: 0 : mrStg->SetClass( aGName, 0, rtl::OUString("MS PowerPoint 97") );
[ # # ]
114 : :
115 [ # # ][ # # ]: 0 : if ( !ImplCreateCurrentUserStream() )
116 : : return;
117 : :
118 [ # # ][ # # ]: 0 : mpStrm = mrStg->OpenSotStream( rtl::OUString( "PowerPoint Document" ) );
[ # # ]
119 [ # # ]: 0 : if ( !mpStrm )
120 : : return;
121 : :
122 [ # # ]: 0 : if ( !mpPicStrm )
123 [ # # ][ # # ]: 0 : mpPicStrm = mrStg->OpenSotStream( rtl::OUString( "Pictures" ) );
[ # # ]
124 : :
125 : 0 : const rtl::OUString sBaseURI( "BaseURI" );
126 : 0 : std::vector< com::sun::star::beans::PropertyValue >::const_iterator aIter( rMediaData.begin() );
127 [ # # ][ # # ]: 0 : while( aIter != rMediaData.end() )
128 : : {
129 [ # # ]: 0 : if ( (*aIter).Name.equals( sBaseURI ) )
130 : : {
131 : 0 : (*aIter).Value >>= maBaseURI;
132 : 0 : break;
133 : : }
134 [ # # ]: 0 : aIter++;
135 : : }
136 [ # # ][ # # ]: 0 : mpPptEscherEx = new PptEscherEx( *mpStrm, maBaseURI );
[ # # ][ # # ]
137 : : }
138 : :
139 : 0 : void PPTWriter::exportPPTPost( )
140 : : {
141 [ # # ]: 0 : if ( !ImplCloseDocument() )
142 : 0 : return;
143 : :
144 [ # # ]: 0 : if ( mbStatusIndicator )
145 : : {
146 [ # # ]: 0 : mXStatusIndicator->setText( rtl::OUString( "PowerPoint Export" ) );
147 : 0 : sal_uInt32 nValue = mnStatMaxValue + ( mnStatMaxValue >> 3 );
148 [ # # ]: 0 : if ( nValue > mnLatestStatValue )
149 : : {
150 : 0 : mXStatusIndicator->setValue( nValue );
151 : 0 : mnLatestStatValue = nValue;
152 : : }
153 : : }
154 : :
155 : 0 : ImplWriteOLE();
156 : :
157 : 0 : ImplWriteVBA();
158 : :
159 [ # # ]: 0 : if ( !ImplWriteAtomEnding() )
160 : 0 : return;
161 : :
162 [ # # ]: 0 : if ( !ImplCreateDocumentSummaryInformation() )
163 : 0 : return;
164 : :
165 : 0 : mbStatus = sal_True;
166 : : };
167 : :
168 : : // ---------------------------------------------------------------------------------------------
169 : :
170 : : void ImplExportComments( uno::Reference< drawing::XDrawPage > xPage, SvMemoryStream& rBinaryTagData10Atom );
171 : :
172 : 0 : void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode,
173 : : sal_Bool bHasBackground, Reference< XPropertySet > aXBackgroundPropSet )
174 : : {
175 : 0 : Any aAny;
176 : :
177 [ # # ]: 0 : const PHLayout& rLayout = GetLayout( mXPagePropSet );
178 [ # # ]: 0 : mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Slide | nPageNum, mpStrm->Tell() );
179 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_Slide );
180 [ # # ]: 0 : mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 );
181 [ # # ]: 0 : *mpStrm << rLayout.nLayout;
182 [ # # ]: 0 : mpStrm->Write( rLayout.nPlaceHolder, 8 ); // placeholderIDs ( 8Stueck )
183 [ # # ]: 0 : *mpStrm << (sal_uInt32)(nMasterNum | 0x80000000)// master ID ( ist gleich 0x80000000 bei einer masterpage )
184 [ # # ]: 0 : << (sal_uInt32)nPageNum + 0x100 // notes ID ( ist gleich null wenn keine notizen vorhanden )
185 [ # # ]: 0 : << nMode
186 [ # # ]: 0 : << (sal_uInt16)0; // padword
187 : :
188 : 0 : mnDiaMode = 0;
189 : 0 : sal_Bool bVisible = sal_True;
190 : 0 : ::com::sun::star::presentation::FadeEffect eFe = ::com::sun::star::presentation::FadeEffect_NONE;
191 : :
192 [ # # ][ # # ]: 0 : if ( GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "Visible" ) ) )
[ # # ][ # # ]
193 : 0 : aAny >>= bVisible;
194 [ # # ][ # # ]: 0 : if ( GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "Change" ) ) )
[ # # ][ # # ]
195 : : {
196 [ # # # ]: 0 : switch ( *(sal_Int32*)aAny.getValue() )
197 : : {
198 : : case 1 : // automatisch
199 : 0 : mnDiaMode++;
200 : : case 2 : // halbautomatisch
201 : 0 : mnDiaMode++;
202 : : default :
203 : : case 0 : // manuell
204 : 0 : break;
205 : : }
206 : : }
207 [ # # ][ # # ]: 0 : if ( GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "Effect" ) ) )
[ # # ][ # # ]
208 [ # # ]: 0 : aAny >>= eFe;
209 : :
210 : 0 : sal_uInt32 nSoundRef = 0;
211 : 0 : sal_Bool bIsSound = sal_False;
212 : 0 : sal_Bool bStopSound = sal_False;
213 : 0 : sal_Bool bLoopSound = sal_False;
214 : :
215 [ # # ][ # # ]: 0 : if ( GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "Sound" ) ) )
[ # # ][ # # ]
216 : : {
217 : 0 : rtl::OUString aSoundURL;
218 [ # # ]: 0 : if ( aAny >>= aSoundURL )
219 : : {
220 [ # # ]: 0 : nSoundRef = maSoundCollection.GetId( aSoundURL );
221 : 0 : bIsSound = sal_True;
222 : : }
223 : : else
224 : 0 : aAny >>= bStopSound;
225 : : }
226 [ # # ][ # # ]: 0 : if ( GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "LoopSound" ) ) )
[ # # ][ # # ]
227 : 0 : aAny >>= bLoopSound;
228 : :
229 : : sal_Bool bNeedsSSSlideInfoAtom = ( bVisible == sal_False )
230 : : || ( mnDiaMode == 2 )
231 : : || ( bIsSound )
232 : : || ( bStopSound )
233 [ # # ][ # # ]: 0 : || ( eFe != ::com::sun::star::presentation::FadeEffect_NONE );
[ # # ][ # # ]
[ # # ]
234 [ # # ]: 0 : if ( bNeedsSSSlideInfoAtom )
235 : : {
236 : 0 : sal_uInt8 nDirection = 0;
237 : 0 : sal_uInt8 nTransitionType = 0;
238 : 0 : sal_uInt16 nBuildFlags = 1; // advange by mouseclick
239 : 0 : sal_Int32 nSlideTime = 0; // muss noch !!!
240 : 0 : sal_uInt8 nSpeed = 1;
241 : :
242 [ # # ][ # # ]: 0 : if ( GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "Speed" ) ) )
[ # # ][ # # ]
243 : : {
244 : : ::com::sun::star::presentation::AnimationSpeed aAs;
245 [ # # ]: 0 : aAny >>= aAs;
246 : 0 : nSpeed = (sal_uInt8)aAs;
247 : : }
248 : 0 : sal_Int16 nTT = 0;
249 [ # # ][ # # ]: 0 : if ( GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "TransitionType" ) )
[ # # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # # # ]
250 : 0 : && ( aAny >>= nTT ) )
251 : : {
252 : 0 : sal_Int16 nTST = 0;
253 [ # # ][ # # ]: 0 : if ( GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "TransitionSubtype" ) )
[ # # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # # # ]
254 : 0 : && ( aAny >>= nTST ) )
255 [ # # ]: 0 : nTransitionType = GetTransition( nTT, nTST, eFe, nDirection );
256 : :
257 : : }
258 [ # # ]: 0 : if ( !nTransitionType )
259 [ # # ]: 0 : nTransitionType = GetTransition( eFe, nDirection );
260 [ # # ]: 0 : if ( mnDiaMode == 2 ) // automatic ?
261 : 0 : nBuildFlags |= 0x400;
262 [ # # ]: 0 : if ( bVisible == sal_False )
263 : 0 : nBuildFlags |= 4;
264 [ # # ]: 0 : if ( bIsSound )
265 : 0 : nBuildFlags |= 16;
266 [ # # ]: 0 : if ( bLoopSound )
267 : 0 : nBuildFlags |= 64;
268 [ # # ]: 0 : if ( bStopSound )
269 : 0 : nBuildFlags |= 256;
270 : :
271 [ # # ][ # # ]: 0 : if ( GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "Duration" ) ) )// duration of this slide
[ # # ][ # # ]
272 : 0 : nSlideTime = *(sal_Int32*)aAny.getValue() << 10; // in ticks
273 : :
274 [ # # ]: 0 : mpPptEscherEx->AddAtom( 16, EPP_SSSlideInfoAtom );
275 [ # # ]: 0 : *mpStrm << nSlideTime // standtime in ticks
276 [ # # ]: 0 : << nSoundRef
277 [ # # ]: 0 : << nDirection
278 [ # # ]: 0 : << nTransitionType
279 [ # # ]: 0 : << nBuildFlags
280 [ # # ]: 0 : << nSpeed
281 [ # # ][ # # ]: 0 : << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0;
[ # # ]
282 : : }
283 : :
284 [ # # ]: 0 : ImplCreateHeaderFooters( mXPagePropSet );
285 : :
286 [ # # ]: 0 : EscherSolverContainer aSolverContainer;
287 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_PPDrawing );
288 [ # # ]: 0 : mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
289 [ # # ]: 0 : mpPptEscherEx->EnterGroup(0,0);
290 [ # # ]: 0 : ImplWritePage( rLayout, aSolverContainer, NORMAL, sal_False, nPageNum ); // Die Shapes der Seite werden im PPT Dok. erzeugt
291 [ # # ]: 0 : mpPptEscherEx->LeaveGroup();
292 : :
293 [ # # ]: 0 : if ( bHasBackground )
294 [ # # ]: 0 : ImplWriteBackground( aXBackgroundPropSet );
295 : : else
296 : : {
297 [ # # ]: 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
298 [ # # ]: 0 : mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
299 [ # # ]: 0 : EscherPropertyContainer aPropOpt;
300 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) );
301 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Width ) );
302 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
303 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
304 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
305 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape
306 [ # # ]: 0 : aPropOpt.Commit( *mpStrm );
307 [ # # ][ # # ]: 0 : mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
308 : : }
309 : :
310 [ # # ]: 0 : aSolverContainer.WriteSolver( *mpStrm );
311 : :
312 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
313 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_Drawing
314 [ # # ]: 0 : mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
315 [ # # ][ # # ]: 0 : *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;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
316 : :
317 [ # # ]: 0 : SvMemoryStream aBinaryTagData10Atom;
318 [ # # ]: 0 : ImplExportComments( mXDrawPage, aBinaryTagData10Atom );
319 [ # # ]: 0 : if ( mbUseNewAnimations )
320 : : {
321 [ # # ]: 0 : SvMemoryStream amsofbtAnimGroup;
322 [ # # ]: 0 : ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection );
323 [ # # ]: 0 : aExporter.doexport( mXDrawPage, amsofbtAnimGroup );
324 : 0 : sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell();
325 [ # # ]: 0 : if ( nmsofbtAnimGroupSize )
326 : : {
327 : : {
328 [ # # ]: 0 : EscherExAtom aMagic2( aBinaryTagData10Atom, 0x2eeb );
329 [ # # ]: 0 : aBinaryTagData10Atom << (sal_uInt32)0x01c45df9
330 [ # # ][ # # ]: 0 : << (sal_uInt32)0xe1471b30;
331 : : }
332 : : {
333 [ # # ]: 0 : EscherExAtom aMagic( aBinaryTagData10Atom, 0x2b00 );
334 [ # # ][ # # ]: 0 : aBinaryTagData10Atom << (sal_uInt32)0;
335 : : }
336 [ # # ][ # # ]: 0 : aBinaryTagData10Atom.Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() );
337 : : {
338 [ # # ][ # # ]: 0 : EscherExContainer aMagic2( aBinaryTagData10Atom, 0x2b02 );
339 : : }
340 [ # # ]: 0 : }
341 : : }
342 [ # # ]: 0 : if ( aBinaryTagData10Atom.Tell() )
343 : : {
344 [ # # ]: 0 : EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags );
345 [ # # ]: 0 : EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag );
346 : : {
347 [ # # ]: 0 : EscherExAtom aCString( *mpStrm, EPP_CString );
348 [ # # ]: 0 : *mpStrm << (sal_uInt32)0x5f005f
349 [ # # ]: 0 : << (sal_uInt32)0x50005f
350 [ # # ]: 0 : << (sal_uInt32)0x540050
351 [ # # ]: 0 : << (sal_uInt16)0x31
352 [ # # ][ # # ]: 0 : << (sal_uInt16)0x30;
353 : : }
354 : : {
355 [ # # ]: 0 : EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData );
356 [ # # ][ # # ]: 0 : mpStrm->Write( aBinaryTagData10Atom.GetData(), aBinaryTagData10Atom.Tell() );
[ # # ]
357 [ # # ][ # # ]: 0 : }
358 : : }
359 [ # # ][ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_Slide
[ # # ]
360 : 0 : }
361 : :
362 : : // ---------------------------------------------------------------------------------------------
363 : :
364 : 0 : void PPTWriter::ImplWriteSlideMaster( sal_uInt32 nPageNum, Reference< XPropertySet > aXBackgroundPropSet )
365 : : {
366 [ # # ]: 0 : mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainMaster | nPageNum, mpStrm->Tell() );
367 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_MainMaster );
368 [ # # ]: 0 : mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 );
369 [ # # ]: 0 : *mpStrm << (sal_Int32)EPP_LAYOUT_TITLEANDBODYSLIDE // slide layout -> title and body slide
370 [ # # ][ # # ]: 0 : << (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
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
371 [ # # ]: 0 : << (sal_uInt32)0 // master ID ( ist gleich null bei einer masterpage )
372 [ # # ]: 0 : << (sal_uInt32)0 // notes ID ( ist gleich null wenn keine notizen vorhanden )
373 [ # # ]: 0 : << (sal_uInt16)0 // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background
374 [ # # ]: 0 : << (sal_uInt16)0; // padword
375 : :
376 [ # # ]: 0 : mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
377 [ # # ][ # # ]: 0 : *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;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
378 [ # # ]: 0 : mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
379 [ # # ][ # # ]: 0 : *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;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
380 [ # # ]: 0 : mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
381 [ # # ][ # # ]: 0 : *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;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
382 [ # # ]: 0 : mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
383 [ # # ][ # # ]: 0 : *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;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
384 [ # # ]: 0 : mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
385 [ # # ][ # # ]: 0 : *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;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
386 [ # # ]: 0 : mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
387 [ # # ][ # # ]: 0 : *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;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
388 [ # # ]: 0 : mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
389 [ # # ][ # # ]: 0 : *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;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
390 : :
391 [ # # ]: 0 : for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
392 : : {
393 [ # # ]: 0 : if ( nInstance == EPP_TEXTTYPE_notUsed )
394 : 0 : continue;
395 : :
396 : : // the auto color is dependent to the page background,so we have to set a page that is in the right context
397 [ # # ]: 0 : if ( nInstance == EPP_TEXTTYPE_Notes )
398 [ # # ]: 0 : GetPageByIndex( 0, NOTICE );
399 : : else
400 [ # # ]: 0 : GetPageByIndex( 0, MASTER );
401 : :
402 [ # # ]: 0 : mpPptEscherEx->BeginAtom();
403 : :
404 : 0 : sal_Bool bFirst = sal_True;
405 : 0 : sal_Bool bSimpleText = sal_False;
406 : :
407 [ # # ]: 0 : *mpStrm << (sal_uInt16)5; // paragraph count
408 : :
409 [ # # ]: 0 : for ( sal_uInt16 nLev = 0; nLev < 5; nLev++ )
410 : : {
411 [ # # ]: 0 : if ( nInstance >= EPP_TEXTTYPE_CenterBody )
412 : : {
413 : 0 : bFirst = sal_False;
414 : 0 : bSimpleText = sal_True;
415 [ # # ]: 0 : *mpStrm << nLev;
416 : : }
417 [ # # ]: 0 : mpStyleSheet->mpParaSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet );
418 [ # # ]: 0 : mpStyleSheet->mpCharSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet );
419 : 0 : bFirst = sal_False;
420 : : }
421 [ # # ]: 0 : mpPptEscherEx->EndAtom( EPP_TxMasterStyleAtom, 0, nInstance );
422 : : }
423 [ # # ]: 0 : GetPageByIndex( nPageNum, MASTER );
424 : :
425 [ # # ]: 0 : EscherSolverContainer aSolverContainer;
426 : :
427 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_PPDrawing );
428 [ # # ]: 0 : mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
429 : :
430 [ # # ]: 0 : mpPptEscherEx->EnterGroup(0,0);
431 [ # # ][ # # ]: 0 : ImplWritePage( GetLayout( 0 ), aSolverContainer, MASTER, sal_True ); // Die Shapes der Seite werden im PPT Dok. erzeugt
432 [ # # ]: 0 : mpPptEscherEx->LeaveGroup();
433 : :
434 [ # # ]: 0 : ImplWriteBackground( aXBackgroundPropSet );
435 : :
436 [ # # ]: 0 : aSolverContainer.WriteSolver( *mpStrm );
437 : :
438 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
439 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_Drawing
440 [ # # ]: 0 : mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
441 [ # # ][ # # ]: 0 : *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;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
442 : :
443 [ # # ]: 0 : if ( aBuExMasterStream.Tell() )
444 : : {
445 [ # # ]: 0 : ImplProgTagContainer( mpStrm, &aBuExMasterStream );
446 : : }
447 [ # # ][ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_MainMaster
448 : 0 : };
449 : :
450 : : // ---------------------------------------------------------------------------------------------
451 : :
452 [ # # ][ # # ]: 0 : PPTWriter::~PPTWriter()
[ # # ]
453 : : {
454 [ # # ][ # # ]: 0 : delete mpExEmbed;
455 [ # # ][ # # ]: 0 : delete mpPptEscherEx;
456 [ # # ][ # # ]: 0 : delete mpCurUserStrm;
457 [ # # ][ # # ]: 0 : delete mpPicStrm;
458 [ # # ][ # # ]: 0 : delete mpStrm;
459 : :
460 : 0 : std::vector< PPTExStyleSheet* >::iterator aStyleSheetIter( maStyleSheetList.begin() );
461 [ # # ][ # # ]: 0 : while( aStyleSheetIter < maStyleSheetList.end() )
462 [ # # ][ # # ]: 0 : delete *aStyleSheetIter++;
[ # # ]
463 : :
464 [ # # ][ # # ]: 0 : for ( std::vector<PPTExOleObjEntry*>::const_iterator it = maExOleObj.begin(); it != maExOleObj.end(); ++it )
[ # # ]
465 [ # # ][ # # ]: 0 : delete *it;
466 : :
467 [ # # ]: 0 : if ( mbStatusIndicator )
468 [ # # ][ # # ]: 0 : mXStatusIndicator->end();
469 [ # # ]: 0 : }
470 : :
471 : : // ---------------------------------------------------------------------------------------------
472 : :
473 : 0 : sal_Bool PPTWriter::ImplCreateCurrentUserStream()
474 : : {
475 [ # # ][ # # ]: 0 : mpCurUserStrm = mrStg->OpenSotStream( rtl::OUString( "Current User" ) );
[ # # ]
476 [ # # ]: 0 : if ( !mpCurUserStrm )
477 : 0 : return sal_False;
478 : 0 : char pUserName[] = "Current User";
479 : 0 : sal_uInt32 nLenOfUserName = strlen( pUserName );
480 : 0 : sal_uInt32 nSizeOfRecord = 0x14 + ( ( nLenOfUserName + 4 ) & ~ 3 );
481 : :
482 [ # # ][ # # ]: 0 : *mpCurUserStrm << (sal_uInt16)0 << (sal_uInt16)EPP_CurrentUserAtom << nSizeOfRecord;
[ # # ]
483 [ # # ]: 0 : *mpCurUserStrm << (sal_uInt32)0x14 // Len
484 [ # # ]: 0 : << (sal_uInt32)0xe391c05f; // Magic
485 : :
486 : 0 : sal_uInt32 nEditPos = mpCurUserStrm->Tell();
487 [ # # ]: 0 : *mpCurUserStrm << (sal_uInt32)0x0 // OffsetToCurrentEdit;
488 [ # # ]: 0 : << (sal_uInt16)nLenOfUserName //
489 [ # # ]: 0 : << (sal_uInt16)0x3f4 // DocFileVersion
490 [ # # ]: 0 : << (sal_uInt8)3 // MajorVersion
491 [ # # ]: 0 : << (sal_uInt8)0 // MinorVersion
492 [ # # ]: 0 : << (sal_uInt16)0; // Pad Word
493 : 0 : pUserName[ nLenOfUserName ] = 8;
494 [ # # ]: 0 : mpCurUserStrm->Write( pUserName, nLenOfUserName + 1 );
495 [ # # ]: 0 : for ( sal_uInt32 i = 0x15 + nLenOfUserName; i < nSizeOfRecord; i++ )
496 : : {
497 [ # # ]: 0 : *mpCurUserStrm << (sal_uInt8)0; // pad bytes
498 : : };
499 [ # # ]: 0 : mpCurUserStrm->Seek( nEditPos );
500 : 0 : return sal_True;
501 : : };
502 : :
503 : : // ---------------------------------------------------------------------------------------------
504 : :
505 : 0 : sal_Bool PPTWriter::ImplCreateDocumentSummaryInformation()
506 : : {
507 : : uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
508 [ # # ]: 0 : mXModel, uno::UNO_QUERY_THROW);
509 : : uno::Reference<document::XDocumentProperties> xDocProps(
510 [ # # ][ # # ]: 0 : xDPS->getDocumentProperties());
511 : :
512 [ # # ]: 0 : if (xDocProps.is()) {
513 : :
514 : : // no idea what this is...
515 : : static sal_uInt8 aGuid[ 0x52 ] =
516 : : {
517 : : 0x4e, 0x00, 0x00, 0x00,
518 : : '{',0,'D',0,'B',0,'1',0,'A',0,'C',0,'9',0,'6',0,'4',0,'-',0,
519 : : 'E',0,'3',0,'9',0,'C',0,'-',0,'1',0,'1',0,'D',0,'2',0,'-',0,
520 : : 'A',0,'1',0,'E',0,'F',0,'-',0,'0',0,'0',0,'6',0,'0',0,'9',0,
521 : : '7',0,'D',0,'A',0,'5',0,'6',0,'8',0,'9',0,'}',0
522 : : };
523 [ # # ]: 0 : uno::Sequence<sal_uInt8> aGuidSeq(aGuid, 0x52);
524 : :
525 [ # # ]: 0 : SvMemoryStream aHyperBlob;
526 [ # # ]: 0 : ImplCreateHyperBlob( aHyperBlob );
527 : :
528 [ # # ]: 0 : uno::Sequence<sal_uInt8> aHyperSeq(aHyperBlob.Tell());
529 : : const sal_uInt8* pBlob(
530 [ # # ]: 0 : static_cast<const sal_uInt8*>(aHyperBlob.GetData()));
531 [ # # ]: 0 : for (sal_Int32 j = 0; j < aHyperSeq.getLength(); ++j) {
532 [ # # ]: 0 : aHyperSeq[j] = pBlob[j];
533 : : }
534 : :
535 [ # # ]: 0 : if ( mnCnvrtFlags & 0x8000 )
536 : : {
537 [ # # ]: 0 : uno::Sequence<sal_uInt8> aThumbSeq;
538 [ # # ][ # # ]: 0 : if ( GetPageByIndex( 0, NORMAL ) && ImplGetPropertyValue( mXPagePropSet, rtl::OUString( "PreviewBitmap" ) ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # #
# ]
539 : : {
540 : : aThumbSeq =
541 [ # # ]: 0 : *static_cast<const uno::Sequence<sal_uInt8>*>(mAny.getValue());
542 : : }
543 : : sfx2::SaveOlePropertySet( xDocProps, mrStg,
544 [ # # ][ # # ]: 0 : &aThumbSeq, &aGuidSeq, &aHyperSeq);
545 : : }
546 : : else
547 : : {
548 : : sfx2::SaveOlePropertySet( xDocProps, mrStg,
549 [ # # ]: 0 : NULL, &aGuidSeq, &aHyperSeq );
550 [ # # ][ # # ]: 0 : }
[ # # ]
551 : : }
552 : :
553 : 0 : return sal_True;
554 : : }
555 : :
556 : : // ---------------------------------------------------------------------------------------------
557 : :
558 : 0 : void PPTWriter::ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId )
559 : : {
560 [ # # ]: 0 : if ( rSt.Tell() )
561 : : {
562 : : aBuExOutlineStream << (sal_uInt32)( ( EPP_PST_ExtendedParagraphHeaderAtom << 16 )
563 : 0 : | ( nRef << 4 ) )
564 : 0 : << (sal_uInt32)8
565 : 0 : << (sal_uInt32)nSlideId
566 : 0 : << (sal_uInt32)nInstance;
567 : 0 : aBuExOutlineStream.Write( rSt.GetData(), rSt.Tell() );
568 : : }
569 : 0 : }
570 : :
571 : : // ---------------------------------------------------------------------------------------------
572 : :
573 : 0 : void PPTWriter::ImplCreateHeaderFooterStrings( SvStream& rStrm, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet )
574 : : {
575 [ # # ]: 0 : if ( rXPagePropSet.is() )
576 : : {
577 : 0 : rtl::OUString aString;
578 : 0 : ::com::sun::star::uno::Any aAny;
579 [ # # ][ # # ]: 0 : if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, rtl::OUString( "HeaderText" ), sal_True ) )
[ # # ][ # # ]
580 : : {
581 [ # # ]: 0 : if ( aAny >>= aString )
582 [ # # ][ # # ]: 0 : PPTWriter::WriteCString( rStrm, aString, 1 );
[ # # ]
583 : : }
584 [ # # ][ # # ]: 0 : if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, rtl::OUString( "FooterText" ), sal_True ) )
[ # # ][ # # ]
585 : : {
586 [ # # ]: 0 : if ( aAny >>= aString )
587 [ # # ][ # # ]: 0 : PPTWriter::WriteCString( rStrm, aString, 2 );
[ # # ]
588 : : }
589 [ # # ][ # # ]: 0 : if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, rtl::OUString( "DateTimeText" ), sal_True ) )
[ # # ][ # # ]
590 : : {
591 [ # # ]: 0 : if ( aAny >>= aString )
592 [ # # ][ # # ]: 0 : PPTWriter::WriteCString( rStrm, aString, 0 );
[ # # ]
593 : 0 : }
594 : : }
595 : 0 : }
596 : :
597 : : // ---------------------------------------------------------------------------------------------
598 : :
599 : 0 : void PPTWriter::ImplCreateHeaderFooters( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet )
600 : : {
601 [ # # ]: 0 : if ( rXPagePropSet.is() )
602 : : {
603 : 0 : sal_Bool bVal = sal_False;
604 : 0 : sal_uInt32 nVal = 0;
605 : 0 : ::com::sun::star::uno::Any aAny;
606 [ # # ][ # # ]: 0 : if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, rtl::OUString( "IsHeaderVisible" ), sal_True ) )
[ # # ][ # # ]
607 : : {
608 [ # # ][ # # ]: 0 : if ( ( aAny >>= bVal ) && bVal )
[ # # ]
609 : 0 : nVal |= 0x100000;
610 : : }
611 [ # # ][ # # ]: 0 : if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, rtl::OUString( "IsFooterVisible" ), sal_True ) )
[ # # ][ # # ]
612 : : {
613 [ # # ][ # # ]: 0 : if ( ( aAny >>= bVal ) && bVal )
[ # # ]
614 : 0 : nVal |= 0x200000;
615 : : }
616 [ # # ][ # # ]: 0 : if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, rtl::OUString( "IsDateTimeVisible" ), sal_True ) )
[ # # ][ # # ]
617 : : {
618 [ # # ][ # # ]: 0 : if ( ( aAny >>= bVal ) && bVal )
[ # # ]
619 : 0 : nVal |= 0x010000;
620 : : }
621 [ # # ][ # # ]: 0 : if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, rtl::OUString( "IsPageNumberVisible" ), sal_True ) )
[ # # ][ # # ]
622 : : {
623 [ # # ][ # # ]: 0 : if ( ( aAny >>= bVal ) && bVal )
[ # # ]
624 : 0 : nVal |= 0x080000;
625 : : }
626 [ # # ][ # # ]: 0 : if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, rtl::OUString( "IsDateTimeFixed" ), sal_True ) )
[ # # ][ # # ]
627 : : {
628 [ # # ][ # # ]: 0 : if ( ( aAny >>= bVal ) && !bVal )
[ # # ]
629 : 0 : nVal |= 0x20000;
630 : : else
631 : 0 : nVal |= 0x40000;
632 : : }
633 [ # # ][ # # ]: 0 : if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, rtl::OUString( "DateTimeFormat" ), sal_True ) )
[ # # ][ # # ]
634 : : {
635 : 0 : sal_Int32 nFormat = *(sal_Int32*)aAny.getValue();
636 : 0 : SvxDateFormat eDateFormat = (SvxDateFormat)( nFormat & 0xf );
637 : 0 : SvxTimeFormat eTimeFormat = (SvxTimeFormat)( ( nFormat >> 4 ) & 0xf );
638 [ # # # # ]: 0 : switch( eDateFormat )
639 : : {
640 : : case SVXDATEFORMAT_F :
641 : 0 : nFormat = 1;
642 : 0 : break;
643 : : case SVXDATEFORMAT_D :
644 : 0 : nFormat = 2;
645 : 0 : break;
646 : : case SVXDATEFORMAT_C :
647 : 0 : nFormat = 4;
648 : 0 : break;
649 : : default:
650 : : case SVXDATEFORMAT_A :
651 : 0 : nFormat = 0;
652 : : }
653 [ # # # # : 0 : switch( eTimeFormat )
# ]
654 : : {
655 : : case SVXTIMEFORMAT_24_HM :
656 : 0 : nFormat = 9;
657 : 0 : break;
658 : : case SVXTIMEFORMAT_12_HM :
659 : 0 : nFormat = 11;
660 : 0 : break;
661 : : case SVXTIMEFORMAT_24_HMS :
662 : 0 : nFormat = 10;
663 : 0 : break;
664 : : case SVXTIMEFORMAT_12_HMS :
665 : 0 : nFormat = 12;
666 : 0 : break;
667 : : default:
668 : 0 : break;
669 : : }
670 : 0 : nVal |= nFormat;
671 : : }
672 : :
673 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 0 );
674 [ # # ]: 0 : mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
675 [ # # ]: 0 : *mpStrm << nVal;
676 [ # # ]: 0 : ImplCreateHeaderFooterStrings( *mpStrm, rXPagePropSet );
677 [ # # ]: 0 : mpPptEscherEx->CloseContainer();
678 : : }
679 : 0 : }
680 : :
681 : : // ---------------------------------------------------------------------------------------------
682 : :
683 : 0 : sal_Bool PPTWriter::ImplCreateDocument()
684 : : {
685 : : sal_uInt32 i;
686 : 0 : sal_uInt16 nSlideType = EPP_SLIDESIZE_TYPECUSTOM;
687 : :
688 : 0 : sal_uInt32 nWidth = maDestPageSize.Width;
689 : 0 : sal_uInt32 nHeight = maDestPageSize.Height;
690 : :
691 [ # # ][ # # ]: 0 : if ( ( nWidth == 0x1680 ) && ( nHeight == 0x10e0 ) )
692 : 0 : nSlideType = EPP_SLIDESIZE_TYPEONSCREEN;
693 [ # # ][ # # ]: 0 : else if ( ( nWidth == 0x1200 ) && ( nHeight == 0x240 ) )
694 : 0 : nSlideType = EPP_SLIDESIZE_TYPEBANNER;
695 [ # # ][ # # ]: 0 : else if ( ( nWidth == 0x1950 ) && ( nHeight == 0x10e0 ) )
696 : 0 : nSlideType = EPP_SLIDESIZE_TYPE35MM;
697 [ # # ][ # # ]: 0 : else if ( ( nWidth == 0x1860 ) && ( nHeight == 0x10e0 ) )
698 : 0 : nSlideType = EPP_SLIDESIZE_TYPEA4PAPER;
699 : :
700 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_Document );
701 : : // CREATE DOCUMENT ATOM
702 [ # # ]: 0 : mpPptEscherEx->AddAtom( 40, EPP_DocumentAtom, 1 );
703 [ # # ]: 0 : *mpStrm << nWidth // Slide Size in Master coordinates X
704 [ # # ]: 0 : << nHeight // " " " " " Y
705 [ # # ]: 0 : << (sal_Int32)maNotesPageSize.Width // Notes Page Size X
706 [ # # ]: 0 : << (sal_Int32)maNotesPageSize.Height // " " " Y
707 [ # # ][ # # ]: 0 : << (sal_Int32)1 << (sal_Int32)2; // the scale used when the Powerpoint document is embedded. the default is 1:2
708 [ # # ]: 0 : mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTESMASTER_PERSIST_KEY, mpStrm->Tell() );
709 [ # # ]: 0 : *mpStrm << (sal_uInt32)0 // Reference to NotesMaster ( 0 if none );
710 [ # # ]: 0 : << (sal_uInt32)0 // Reference to HandoutMaster ( 0 if none );
711 [ # # ]: 0 : << (sal_Int16)1 // Number of the first slide;
712 [ # # ]: 0 : << nSlideType // Size of the document slides ( default: EPP_SLIDESIZETYPEONSCREEN )
713 [ # # ]: 0 : << (sal_uInt8)0 // bool1 indicates if document was saved with embedded true type fonts
714 [ # # ]: 0 : << (sal_uInt8)0 // bool1 indicates if the placeholders on the title slide are omitted
715 [ # # ]: 0 : << (sal_uInt8)0 // bool1 right to left ( flag for Bidi version )
716 [ # # ]: 0 : << (sal_uInt8)1; // bool1 visibility of comments shapes
717 : :
718 [ # # ]: 0 : mpPptEscherEx->PtInsert( EPP_Persist_Document, mpStrm->Tell() );
719 : :
720 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 3 ); //Master footer (default)
721 [ # # ]: 0 : mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
722 [ # # ]: 0 : *mpStrm << (sal_uInt32)0x25000d;
723 [ # # ][ # # ]: 0 : if ( GetPageByIndex( 0, MASTER ) )
724 [ # # ]: 0 : ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet );
725 [ # # ]: 0 : mpPptEscherEx->CloseContainer();
726 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 4 ); //NotesMaster footer (default)
727 [ # # ]: 0 : mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
728 [ # # ]: 0 : *mpStrm << (sal_uInt32)0x3d000d;
729 [ # # ][ # # ]: 0 : if ( GetPageByIndex( 0, NOTICE ) )
730 [ # # ]: 0 : ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet );
731 [ # # ]: 0 : mpPptEscherEx->CloseContainer();
732 : :
733 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_SlideListWithText ); // Animation info fuer die Slides
734 : :
735 [ # # ]: 0 : for ( i = 0; i < mnPages; i++ )
736 : : {
737 [ # # ]: 0 : mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom );
738 [ # # ]: 0 : mpPptEscherEx->InsertPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, mpStrm->Tell() );
739 [ # # ]: 0 : *mpStrm << (sal_uInt32)0 // psrReference - logical reference to the slide persist object ( EPP_MAINSLIDE_PERSIST_KEY )
740 [ # # ]: 0 : << (sal_uInt32)4 // flags - only bit 3 used, if set then slide contains shapes other than placeholders
741 [ # # ]: 0 : << (sal_Int32)0 // numberTexts - number of placeholder texts stored with the persist object. Allows to display outline view without loading the slide persist objects
742 [ # # ]: 0 : << (sal_Int32)i + 0x100 // slideId - Unique slide identifier, used for OLE link monikers for example
743 [ # # ]: 0 : << (sal_uInt32)0; // reserved, usualy 0
744 : :
745 [ # # ][ # # ]: 0 : if ( !GetPageByIndex( i, NORMAL ) ) // sehr aufregend: noch einmal ueber alle seiten
746 : 0 : return sal_False;
747 [ # # ][ # # ]: 0 : SetCurrentStyleSheet( GetMasterIndex( NORMAL ) );
748 : :
749 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed >
750 [ # # ]: 0 : aXName( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
751 : :
752 [ # # ]: 0 : if ( aXName.is() )
753 [ # # ][ # # ]: 0 : maSlideNameList.push_back( aXName->getName() );
[ # # ]
754 : : else
755 [ # # ]: 0 : maSlideNameList.push_back( ::rtl::OUString() );
756 : 0 : }
757 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText
758 : :
759 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_SlideListWithText, 2 ); // Animation info fuer die notes
760 [ # # ]: 0 : for( i = 0; i < mnPages; i++ )
761 : : {
762 [ # # ]: 0 : mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom );
763 [ # # ]: 0 : mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, mpStrm->Tell() );
764 [ # # ]: 0 : *mpStrm << (sal_uInt32)0
765 [ # # ]: 0 : << (sal_uInt32)4
766 [ # # ]: 0 : << (sal_Int32)0
767 [ # # ]: 0 : << (sal_Int32)i + 0x100
768 [ # # ]: 0 : << (sal_uInt32)0;
769 : : }
770 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText
771 : :
772 : : ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentationSupplier >
773 [ # # ]: 0 : aXPresSupplier( mXModel, ::com::sun::star::uno::UNO_QUERY ); ;
774 [ # # ]: 0 : if ( aXPresSupplier.is() )
775 : : {
776 : : ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentation >
777 [ # # ][ # # ]: 0 : aXPresentation( aXPresSupplier->getPresentation() );
778 [ # # ]: 0 : if ( aXPresentation.is() )
779 : : {
780 : : mXPropSet = ::com::sun::star::uno::Reference<
781 : : ::com::sun::star::beans::XPropertySet >
782 [ # # ][ # # ]: 0 : ( aXPresentation, ::com::sun::star::uno::UNO_QUERY );
783 [ # # ]: 0 : if ( mXPropSet.is() )
784 : : {
785 : 0 : ::rtl::OUString aCustomShow;
786 : 0 : sal_uInt32 nPenColor = 0x1000000;
787 : 0 : sal_Int32 nRestartTime = 0x7fffffff;
788 : 0 : sal_Int16 nStartSlide = 0;
789 : 0 : sal_Int16 nEndSlide = 0;
790 : 0 : sal_uInt32 nFlags = 0; // Bit 0: Auto advance
791 : : // Bit 1 Skip builds ( do not allow slide effects )
792 : : // Bit 2 Use slide range
793 : : // Bit 3 Use named show
794 : : // Bit 4 Browse mode on
795 : : // Bit 5 Kiosk mode on
796 : : // Bit 7 loop continously
797 : : // Bit ? show scrollbar
798 : :
799 [ # # ][ # # ]: 0 : if ( ImplGetPropertyValue( rtl::OUString( "CustomShow" ) ) )
[ # # ][ # # ]
800 : : {
801 : 0 : aCustomShow = ( *(::rtl::OUString*)mAny.getValue() );
802 [ # # ]: 0 : if ( !aCustomShow.isEmpty() )
803 : : {
804 : 0 : nFlags |= 8;
805 : : }
806 : : }
807 [ # # ]: 0 : if ( ( nFlags & 8 ) == 0 )
808 : : {
809 [ # # ][ # # ]: 0 : if ( ImplGetPropertyValue( rtl::OUString( "FirstPage" ) ) )
[ # # ][ # # ]
810 : : {
811 : 0 : ::rtl::OUString aSlideName( *(::rtl::OUString*)mAny.getValue() );
812 : :
813 : : std::vector<rtl::OUString>::const_iterator pIter = std::find(
814 [ # # ][ # # ]: 0 : maSlideNameList.begin(),maSlideNameList.end(),aSlideName);
815 : :
816 [ # # ][ # # ]: 0 : if (pIter != maSlideNameList.end())
817 : : {
818 [ # # ]: 0 : nStartSlide = pIter - maSlideNameList.begin() + 1;
819 : 0 : nFlags |= 4;
820 : 0 : nEndSlide = (sal_uInt16)mnPages;
821 : 0 : }
822 : : }
823 : : }
824 : :
825 [ # # ][ # # ]: 0 : if ( ImplGetPropertyValue( rtl::OUString("IsAutomatic" ) ) )
[ # # ][ # # ]
826 : : {
827 : 0 : sal_Bool bBool = sal_False;
828 : 0 : mAny >>= bBool;
829 [ # # ]: 0 : if ( !bBool )
830 : 0 : nFlags |= 1;
831 : : }
832 : :
833 [ # # ][ # # ]: 0 : if ( ImplGetPropertyValue( rtl::OUString( "IsEndless" ) ) ) // muesste eigendlich heissen IsNotEndless !=)"�()&
[ # # ][ # # ]
834 : : {
835 : 0 : sal_Bool bBool = sal_False;
836 : 0 : mAny >>= bBool;
837 [ # # ]: 0 : if ( bBool )
838 : 0 : nFlags |= 0x80;
839 : : }
840 [ # # ][ # # ]: 0 : if ( ImplGetPropertyValue( rtl::OUString( "IsFullScreen" ) ) )
[ # # ][ # # ]
841 : : {
842 : 0 : sal_Bool bBool = sal_False;
843 : 0 : mAny >>= bBool;
844 [ # # ]: 0 : if ( !bBool )
845 : 0 : nFlags |= 0x11;
846 : : }
847 : :
848 [ # # ]: 0 : mpPptEscherEx->AddAtom( 80, EPP_SSDocInfoAtom, 1 );
849 [ # # ][ # # ]: 0 : *mpStrm << nPenColor << nRestartTime << nStartSlide << nEndSlide;
[ # # ][ # # ]
850 : :
851 : 0 : sal_uInt32 nCustomShowNameLen = aCustomShow.getLength();
852 [ # # ]: 0 : if ( nCustomShowNameLen > 31 )
853 : 0 : nCustomShowNameLen = 31;
854 [ # # ]: 0 : if ( nCustomShowNameLen ) // named show identifier
855 : : {
856 : 0 : const sal_Unicode* pCustomShow = aCustomShow.getStr();
857 [ # # ]: 0 : for ( i = 0; i < nCustomShowNameLen; i++ )
858 : : {
859 [ # # ]: 0 : *mpStrm << (sal_uInt16)( pCustomShow[ i ] );
860 : : }
861 : : }
862 [ # # ][ # # ]: 0 : for ( i = nCustomShowNameLen; i < 32; i++, *mpStrm << (sal_uInt16)0 ) ;
863 : :
864 [ # # ]: 0 : *mpStrm << nFlags;
865 : : ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XCustomPresentationSupplier >
866 [ # # ]: 0 : aXCPSup( mXModel, ::com::sun::star::uno::UNO_QUERY );
867 [ # # ]: 0 : if ( aXCPSup.is() )
868 : : {
869 : : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
870 [ # # ][ # # ]: 0 : aXCont( aXCPSup->getCustomPresentations() );
871 [ # # ]: 0 : if ( aXCont.is() )
872 : : {
873 [ # # ][ # # ]: 0 : ::com::sun::star::uno::Sequence< ::rtl::OUString> aNameSeq( aXCont->getElementNames() );
874 [ # # ]: 0 : const ::rtl::OUString* pUString = aNameSeq.getArray();
875 : 0 : sal_uInt32 nCount = aNameSeq.getLength();
876 [ # # ]: 0 : if ( nCount )
877 : : {
878 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_NamedShows );
879 : 0 : sal_uInt32 nCustomShowIndex = 0;
880 [ # # ]: 0 : for( i = 0; i < nCount; i++ ) // Anzahl der Custom Shows
881 : : {
882 [ # # ]: 0 : if ( !pUString[ i ].isEmpty() )
883 : : {
884 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_NamedShow, nCustomShowIndex++ );
885 : :
886 : 0 : sal_uInt32 nNamedShowLen = pUString[ i ].getLength();
887 [ # # ]: 0 : if ( nNamedShowLen > 31 )
888 : 0 : nNamedShowLen = 31;
889 [ # # ]: 0 : mpPptEscherEx->AddAtom( nNamedShowLen << 1, EPP_CString );
890 : 0 : const sal_Unicode* pCustomShowName = pUString[ i ].getStr();
891 [ # # ][ # # ]: 0 : for ( sal_uInt32 k = 0; k < nNamedShowLen; *mpStrm << (sal_uInt16)( pCustomShowName[ k++ ] ) ) ;
892 [ # # ][ # # ]: 0 : mAny = aXCont->getByName( pUString[ i ] );
893 [ # # ]: 0 : if ( mAny.getValue() )
894 : : {
895 : :
896 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > aXIC;
897 [ # # ][ # # ]: 0 : if ( mAny >>= aXIC )
898 : : {
899 [ # # ]: 0 : mpPptEscherEx->BeginAtom();
900 : :
901 [ # # ][ # # ]: 0 : sal_Int32 nSlideCount = aXIC->getCount();
902 [ # # ]: 0 : for ( sal_Int32 j = 0; j < nSlideCount; j++ ) // Anzahl der Slides
903 : : {
904 [ # # ][ # # ]: 0 : mAny = aXIC->getByIndex( j );
905 [ # # ]: 0 : if ( mAny.getValue() )
906 : : {
907 : : ::com::sun::star::uno::Reference<
908 : 0 : ::com::sun::star::drawing::XDrawPage > aXDrawPage;
909 [ # # ][ # # ]: 0 : if ( mAny >>= aXDrawPage )
910 : : {
911 : : ::com::sun::star::uno::Reference<
912 : : ::com::sun::star::container::XNamed >
913 [ # # ]: 0 : aXName( aXDrawPage, ::com::sun::star::uno::UNO_QUERY );
914 [ # # ]: 0 : if ( aXName.is() )
915 : : {
916 [ # # ][ # # ]: 0 : ::rtl::OUString aSlideName( aXName->getName() );
917 : : std::vector<rtl::OUString>::const_iterator pIter = std::find(
918 [ # # ][ # # ]: 0 : maSlideNameList.begin(),maSlideNameList.end(),aSlideName);
919 : :
920 [ # # ][ # # ]: 0 : if (pIter != maSlideNameList.end())
921 : : {
922 [ # # ]: 0 : sal_uInt32 nPageNumber = pIter - maSlideNameList.begin();
923 [ # # ]: 0 : *mpStrm << (sal_uInt32)( nPageNumber + 0x100 ); // unique slide id
924 : 0 : }
925 : 0 : }
926 : 0 : }
927 : : }
928 : : }
929 [ # # ]: 0 : mpPptEscherEx->EndAtom( EPP_NamedShowSlides );
930 : 0 : }
931 : : }
932 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_NamedShow
933 : : }
934 : : }
935 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_NamedShows
936 [ # # ]: 0 : }
937 : 0 : }
938 : 0 : }
939 : : }
940 : 0 : }
941 : : }
942 [ # # ]: 0 : mpPptEscherEx->AddAtom( 0, EPP_EndDocument );
943 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_Document
944 : 0 : return sal_True;
945 : : };
946 : :
947 : : // ---------------------------------------------------------------------------------------------
948 : :
949 : 0 : sal_Bool PPTWriter::ImplCreateHyperBlob( SvMemoryStream& rStrm )
950 : : {
951 : 0 : sal_uInt32 nCurrentOfs, nParaOfs, nParaCount = 0;
952 : :
953 : 0 : nParaOfs = rStrm.Tell();
954 : 0 : rStrm << (sal_uInt32)0; // property size
955 : 0 : rStrm << (sal_uInt32)0; // property count
956 : :
957 [ # # ][ # # ]: 0 : for ( std::vector<EPPTHyperlink>::const_iterator pIter = maHyperlink.begin(); pIter != maHyperlink.end(); ++pIter )
[ # # ]
958 : : {
959 : 0 : nParaCount += 6;
960 [ # # ]: 0 : rStrm << (sal_uInt32)3 // Type VT_I4
961 [ # # ]: 0 : << (sal_uInt32)7 // (VTI4 - Private1)
962 [ # # ]: 0 : << (sal_uInt32)3 // Type VT_I4
963 [ # # ]: 0 : << (sal_uInt32)6 // (VTI4 - Private2)
964 [ # # ]: 0 : << (sal_uInt32)3 // Type VT_I4
965 [ # # ]: 0 : << (sal_uInt32)0; // (VTI4 - Private3)
966 : :
967 : : // INFO
968 : : // HIWORD: = 0 : do not change anything
969 : : // = 1 : replace the hyperlink with the target and subadress in the following two VTLPWSTR
970 : : // = 2 : delete the hyperlink
971 : : // LOWORD: = 0 : graphic shown as background (link)
972 : : // = 1 : graphic shown as shape (link)
973 : : // = 2 : graphic is used to fill a shape
974 : : // = 3 : graphic used to fill a shape outline (future use)
975 : : // = 4 : hyperlink attached to a shape
976 : : // = 5 : " " " " (Word) field
977 : : // = 6 : " " " " (Excel) range
978 : : // = 7 : " " " " (PPT) text range
979 : : // = 8 : " " " " (Project) task
980 : :
981 : 0 : sal_uInt32 nUrlLen = pIter->aURL.Len();
982 : 0 : const sal_Unicode* pUrl = pIter->aURL.GetBuffer();
983 : :
984 : 0 : sal_uInt32 nInfo = 7;
985 : :
986 [ # # ]: 0 : rStrm << (sal_uInt32)3 // Type VT_I4
987 [ # # ]: 0 : << nInfo; // Info
988 : :
989 [ # # # ]: 0 : switch( pIter->nType & 0xff )
990 : : {
991 : : case 1 : // click action to slidenumber
992 : : {
993 [ # # ][ # # ]: 0 : rStrm << (sal_uInt32)0x1f << (sal_uInt32)1 << (sal_uInt32)0; // path
[ # # ]
994 [ # # ][ # # ]: 0 : rStrm << (sal_uInt32)0x1f << (sal_uInt32)( nUrlLen + 1 );
995 [ # # ]: 0 : for ( sal_uInt32 i = 0; i < nUrlLen; i++ )
996 : : {
997 [ # # ]: 0 : rStrm << pUrl[ i ];
998 : : }
999 [ # # ]: 0 : rStrm << (sal_uInt16)0;
1000 : : }
1001 : 0 : break;
1002 : : case 2 :
1003 : : {
1004 : : sal_uInt32 i;
1005 : :
1006 [ # # ]: 0 : rStrm << (sal_uInt32)0x1f
1007 [ # # ]: 0 : << (sal_uInt32)( nUrlLen + 1 );
1008 [ # # ]: 0 : for ( i = 0; i < nUrlLen; i++ )
1009 : : {
1010 [ # # ]: 0 : rStrm << pUrl[ i ];
1011 : : }
1012 [ # # ]: 0 : if ( ! ( i & 1 ) )
1013 [ # # ]: 0 : rStrm << (sal_uInt16)0;
1014 [ # # ]: 0 : rStrm << (sal_uInt16)0
1015 [ # # ]: 0 : << (sal_uInt32)0x1f
1016 [ # # ]: 0 : << (sal_uInt32)1
1017 [ # # ]: 0 : << (sal_uInt32)0;
1018 : : }
1019 : 0 : break;
1020 : : }
1021 : : }
1022 : 0 : nCurrentOfs = rStrm.Tell();
1023 : 0 : rStrm.Seek( nParaOfs );
1024 : 0 : rStrm << (sal_uInt32)( nCurrentOfs - ( nParaOfs + 4 ) );
1025 : 0 : rStrm << nParaCount;
1026 : 0 : rStrm.Seek( nCurrentOfs );
1027 : 0 : return sal_True;
1028 : : }
1029 : :
1030 : : // ---------------------------------------------------------------------------------------------
1031 : :
1032 : 0 : sal_Bool PPTWriter::ImplCreateMainNotes()
1033 : : {
1034 [ # # ]: 0 : EscherSolverContainer aSolverContainer;
1035 : :
1036 [ # # ]: 0 : mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainNotes, mpStrm->Tell() );
1037 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_Notes );
1038 [ # # ]: 0 : mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 );
1039 [ # # ]: 0 : *mpStrm << (sal_uInt32)0x80000001 // Number that identifies this slide
1040 [ # # ]: 0 : << (sal_uInt32)0; // follow nothing
1041 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_PPDrawing );
1042 [ # # ]: 0 : mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
1043 [ # # ]: 0 : mpPptEscherEx->EnterGroup(0,0);
1044 : :
1045 [ # # ][ # # ]: 0 : ImplWritePage( GetLayout( 20 ), aSolverContainer, NOTICE, sal_True );
1046 : :
1047 [ # # ]: 0 : mpPptEscherEx->LeaveGroup();
1048 [ # # ]: 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1049 [ # # ]: 0 : mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 );
1050 [ # # ]: 0 : EscherPropertyContainer aPropOpt;
1051 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color
1052 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
1053 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x68bdde );
1054 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x8b9f8e );
1055 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
1056 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0 );
1057 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
1058 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape
1059 [ # # ]: 0 : aPropOpt.Commit( *mpStrm );
1060 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
1061 : :
1062 [ # # ]: 0 : aSolverContainer.WriteSolver( *mpStrm );
1063 : :
1064 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
1065 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_Drawing
1066 [ # # ]: 0 : mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
1067 [ # # ][ # # ]: 0 : *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;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1068 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_Notes
1069 [ # # ][ # # ]: 0 : return sal_True;
1070 : : }
1071 : :
1072 : : // ---------------------------------------------------------------------------------------------
1073 : :
1074 : 0 : static rtl::OUString getInitials( const rtl::OUString& rName )
1075 : : {
1076 : 0 : rtl::OUString sInitials;
1077 : :
1078 : 0 : const sal_Unicode * pStr = rName.getStr();
1079 : 0 : sal_Int32 nLength = rName.getLength();
1080 : :
1081 [ # # ]: 0 : while( nLength )
1082 : : {
1083 : : // skip whitespace
1084 [ # # ][ # # ]: 0 : while( nLength && (*pStr <= ' ') )
[ # # ]
1085 : : {
1086 : 0 : nLength--; pStr++;
1087 : : }
1088 : :
1089 : : // take letter
1090 [ # # ]: 0 : if( nLength )
1091 : : {
1092 : 0 : sInitials += rtl::OUString( *pStr );
1093 : 0 : nLength--; pStr++;
1094 : : }
1095 : :
1096 : : // skip letters until whitespace
1097 [ # # ][ # # ]: 0 : while( nLength && (*pStr > ' ') )
[ # # ]
1098 : : {
1099 : 0 : nLength--; pStr++;
1100 : : }
1101 : : }
1102 : :
1103 : 0 : return sInitials;
1104 : : }
1105 : :
1106 : 0 : void ImplExportComments( uno::Reference< drawing::XDrawPage > xPage, SvMemoryStream& rBinaryTagData10Atom )
1107 : : {
1108 : : try
1109 : : {
1110 [ # # ]: 0 : uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW );
1111 [ # # ][ # # ]: 0 : uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
1112 : :
1113 : 0 : sal_Int32 nIndex = 1;
1114 : :
1115 [ # # ][ # # ]: 0 : while( xAnnotationEnumeration->hasMoreElements() )
[ # # ]
1116 : : {
1117 [ # # ]: 0 : EscherExContainer aComment10( rBinaryTagData10Atom, EPP_Comment10 );
1118 : : {
1119 [ # # ][ # # ]: 0 : uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() );
1120 : :
1121 [ # # ][ # # ]: 0 : geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
1122 [ # # ][ # # ]: 0 : MapMode aMapDest( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) );
[ # # ]
1123 : : Point aPoint( OutputDevice::LogicToLogic( Point( static_cast< sal_Int32 >( aRealPoint2D.X * 100.0 ),
1124 [ # # ][ # # ]: 0 : static_cast< sal_Int32 >( aRealPoint2D.Y * 100.0 ) ), MAP_100TH_MM, aMapDest ) );
[ # # ]
1125 : :
1126 [ # # ][ # # ]: 0 : rtl::OUString sAuthor( xAnnotation->getAuthor() );
1127 [ # # ][ # # ]: 0 : uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
1128 [ # # ][ # # ]: 0 : rtl::OUString sText( xText->getString() );
1129 : 0 : rtl::OUString sInitials( getInitials( sAuthor ) );
1130 [ # # ][ # # ]: 0 : util::DateTime aDateTime( xAnnotation->getDateTime() );
1131 [ # # ]: 0 : if ( !sAuthor.isEmpty() )
1132 [ # # ][ # # ]: 0 : PPTWriter::WriteCString( rBinaryTagData10Atom, sAuthor, 0 );
[ # # ]
1133 [ # # ]: 0 : if ( !sText.isEmpty() )
1134 [ # # ][ # # ]: 0 : PPTWriter::WriteCString( rBinaryTagData10Atom, sText, 1 );
[ # # ]
1135 [ # # ]: 0 : if ( !sInitials.isEmpty() )
1136 [ # # ][ # # ]: 0 : PPTWriter::WriteCString( rBinaryTagData10Atom, sInitials, 2 );
[ # # ]
1137 : :
1138 : 0 : sal_Int16 nMilliSeconds = aDateTime.HundredthSeconds * 10;
1139 [ # # ]: 0 : EscherExAtom aCommentAtom10( rBinaryTagData10Atom, EPP_CommentAtom10 );
1140 [ # # ]: 0 : rBinaryTagData10Atom << nIndex++
1141 [ # # ]: 0 : << aDateTime.Year
1142 [ # # ]: 0 : << aDateTime.Month
1143 [ # # ]: 0 : << aDateTime.Day // todo: day of week
1144 [ # # ]: 0 : << aDateTime.Day
1145 [ # # ]: 0 : << aDateTime.Hours
1146 [ # # ]: 0 : << aDateTime.Minutes
1147 [ # # ]: 0 : << aDateTime.Seconds
1148 [ # # ]: 0 : << nMilliSeconds
1149 [ # # ]: 0 : << static_cast< sal_Int32 >( aPoint.X() )
1150 [ # # ][ # # ]: 0 : << static_cast< sal_Int32 >( aPoint.Y() );
[ # # ]
1151 : : }
1152 [ # # ][ # # ]: 0 : }
1153 : : }
1154 : 0 : catch ( uno::Exception& )
1155 : : {
1156 : : }
1157 : 0 : }
1158 : :
1159 : : // ---------------------------------------------------------------------------------------------
1160 : :
1161 : 0 : void PPTWriter::ImplWriteNotes( sal_uInt32 nPageNum )
1162 : : {
1163 [ # # ]: 0 : mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Notes | nPageNum, mpStrm->Tell() );
1164 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_Notes );
1165 [ # # ]: 0 : mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 );
1166 [ # # ]: 0 : *mpStrm << (sal_uInt32)nPageNum + 0x100
1167 [ # # ]: 0 : << (sal_uInt16)3 // follow master ....
1168 [ # # ]: 0 : << (sal_uInt16)0;
1169 : :
1170 [ # # ]: 0 : ImplCreateHeaderFooters( mXPagePropSet );
1171 : :
1172 [ # # ]: 0 : EscherSolverContainer aSolverContainer;
1173 : :
1174 [ # # ]: 0 : mpPptEscherEx->OpenContainer( EPP_PPDrawing );
1175 [ # # ]: 0 : mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
1176 [ # # ]: 0 : mpPptEscherEx->EnterGroup(0,0);
1177 : :
1178 [ # # ][ # # ]: 0 : ImplWritePage( GetLayout( 20 ), aSolverContainer, NOTICE, sal_False ); // Die Shapes der Seite werden im PPT Dok. erzeugt
1179 : :
1180 [ # # ]: 0 : mpPptEscherEx->LeaveGroup();
1181 [ # # ]: 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1182 [ # # ]: 0 : mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
1183 [ # # ]: 0 : EscherPropertyContainer aPropOpt;
1184 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color
1185 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
1186 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x8b9f8e );
1187 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x68bdde );
1188 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
1189 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
1190 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
1191 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
1192 [ # # ]: 0 : aPropOpt.Commit( *mpStrm );
1193 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
1194 : :
1195 [ # # ]: 0 : aSolverContainer.WriteSolver( *mpStrm );
1196 : :
1197 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
1198 [ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_Drawing
1199 [ # # ]: 0 : mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
1200 [ # # ][ # # ]: 0 : *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;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1201 [ # # ][ # # ]: 0 : mpPptEscherEx->CloseContainer(); // EPP_Notes
[ # # ]
1202 : 0 : };
1203 : :
1204 : 0 : void PPTWriter::ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet )
1205 : : {
1206 : : //************************ ******
1207 : : //** DEFAULT BACKGROUND SHAPE **
1208 : : //******************************
1209 : :
1210 : 0 : sal_uInt32 nFillColor = 0xffffff;
1211 : 0 : sal_uInt32 nFillBackColor = 0;
1212 : :
1213 [ # # ]: 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1214 [ # # ]: 0 : mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
1215 : 0 : Point aEmptyPoint = Point();
1216 [ # # ]: 0 : Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
1217 [ # # ][ # # ]: 0 : EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect );
1218 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
1219 : 0 : ::com::sun::star::drawing::FillStyle aFS( ::com::sun::star::drawing::FillStyle_NONE );
1220 [ # # ][ # # ]: 0 : if ( ImplGetPropertyValue( rXPropSet, rtl::OUString( "FillStyle" ) ) )
[ # # ][ # # ]
1221 [ # # ]: 0 : mAny >>= aFS;
1222 : :
1223 [ # # # # : 0 : switch( aFS )
# ]
1224 : : {
1225 : : case ::com::sun::star::drawing::FillStyle_GRADIENT :
1226 : : {
1227 [ # # ]: 0 : aPropOpt.CreateGradientProperties( rXPropSet );
1228 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x1f001e );
1229 [ # # ]: 0 : aPropOpt.GetOpt( ESCHER_Prop_fillColor, nFillColor );
1230 [ # # ]: 0 : aPropOpt.GetOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
1231 : : }
1232 : 0 : break;
1233 : :
1234 : : case ::com::sun::star::drawing::FillStyle_BITMAP :
1235 [ # # ][ # # ]: 0 : aPropOpt.CreateGraphicProperties( rXPropSet, rtl::OUString( "FillBitmapURL" ), sal_True );
[ # # ]
1236 : 0 : break;
1237 : :
1238 : : case ::com::sun::star::drawing::FillStyle_HATCH :
1239 [ # # ][ # # ]: 0 : aPropOpt.CreateGraphicProperties( rXPropSet, rtl::OUString( "FillHatch" ), sal_True );
[ # # ]
1240 : 0 : break;
1241 : :
1242 : : case ::com::sun::star::drawing::FillStyle_SOLID :
1243 : : {
1244 [ # # ][ # # ]: 0 : if ( ImplGetPropertyValue( rXPropSet, rtl::OUString( "FillColor" ) ) )
[ # # ][ # # ]
1245 : : {
1246 [ # # ]: 0 : nFillColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) );
1247 : 0 : nFillBackColor = nFillColor ^ 0xffffff;
1248 : : }
1249 : : } // PASSTHROUGH INTENDED
1250 : : case ::com::sun::star::drawing::FillStyle_NONE :
1251 : : default:
1252 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
1253 : 0 : break;
1254 : : }
1255 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillColor, nFillColor );
1256 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
1257 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) );
1258 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Height ) );
1259 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
1260 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_bwWhite );
1261 [ # # ]: 0 : aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
1262 [ # # ]: 0 : aPropOpt.Commit( *mpStrm );
1263 [ # # ][ # # ]: 0 : mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
1264 : 0 : }
1265 : :
1266 : 0 : void PPTWriter::ImplWriteVBA()
1267 : : {
1268 [ # # ]: 0 : if ( mpVBA )
1269 : : {
1270 : 0 : mpVBA->Seek( STREAM_SEEK_TO_END );
1271 : 0 : sal_uInt32 nLen = mpVBA->Tell();
1272 [ # # ]: 0 : if ( nLen > 8 )
1273 : : {
1274 : 0 : nLen -= 8;
1275 : 0 : mnVBAOleOfs = mpStrm->Tell();
1276 : 0 : mpPptEscherEx->BeginAtom();
1277 : 0 : mpStrm->Write( (sal_Int8*)mpVBA->GetData() + 8, nLen );
1278 : 0 : mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
1279 : : }
1280 : : }
1281 : 0 : }
1282 : :
1283 : : // ---------------------------------------------------------------------------------------------
1284 : :
1285 : 0 : void PPTWriter::ImplWriteOLE( )
1286 : : {
1287 : :
1288 : 0 : SvxMSExportOLEObjects aOleExport( mnCnvrtFlags );
1289 : :
1290 [ # # ][ # # ]: 0 : for ( std::vector<PPTExOleObjEntry*>::const_iterator it = maExOleObj.begin(); it != maExOleObj.end(); ++it )
[ # # ]
1291 : : {
1292 : 0 : PPTExOleObjEntry* pPtr = *it;
1293 : 0 : SvMemoryStream* pStrm = NULL;
1294 : 0 : pPtr->nOfsB = mpStrm->Tell();
1295 [ # # # ]: 0 : switch ( pPtr->eType )
1296 : : {
1297 : : case NORMAL_OLE_OBJECT :
1298 : : {
1299 : 0 : SdrObject* pSdrObj = GetSdrObjectFromXShape( pPtr->xShape );
1300 [ # # ][ # # ]: 0 : if ( pSdrObj && pSdrObj->ISA( SdrOle2Obj ) )
[ # # ][ # # ]
[ # # ]
1301 : : {
1302 [ # # ]: 0 : ::uno::Reference < embed::XEmbeddedObject > xObj( ( (SdrOle2Obj*) pSdrObj )->GetObjRef() );
1303 [ # # ]: 0 : if( xObj.is() )
1304 : : {
1305 [ # # ][ # # ]: 0 : SvStorageRef xTempStorage( new SvStorage( new SvMemoryStream(), sal_True ) );
[ # # ][ # # ]
1306 [ # # ]: 0 : aOleExport.ExportOLEObject( xObj, *xTempStorage );
1307 : :
1308 : : //TODO/MBA: testing
1309 : 0 : rtl::OUString aPersistStream( SVEXT_PERSIST_STREAM );
1310 [ # # ]: 0 : SvMemoryStream aStream;
1311 [ # # ][ # # ]: 0 : SvStorageRef xCleanStorage( new SvStorage( sal_False, aStream ) );
1312 [ # # ]: 0 : xTempStorage->CopyTo( xCleanStorage );
1313 : : // create a dummy content stream, the dummy content is necessary for ppt, but not for
1314 : : // doc files, so we can't share code.
1315 [ # # ][ # # ]: 0 : SotStorageStreamRef xStm = xCleanStorage->OpenSotStream( aPersistStream, STREAM_STD_READWRITE );
[ # # ]
1316 [ # # ]: 0 : *xStm << (sal_uInt32)0 // no ClipboardId
1317 [ # # ]: 0 : << (sal_uInt32)4 // no target device
1318 [ # # ]: 0 : << (sal_uInt32)1 // aspect ratio
1319 [ # # ]: 0 : << (sal_Int32)-1 // L-Index
1320 [ # # ]: 0 : << (sal_uInt32)0 // Advanced Flags
1321 [ # # ]: 0 : << (sal_uInt32)0 // compression
1322 [ # # ]: 0 : << (sal_uInt32)0 // Size
1323 [ # # ]: 0 : << (sal_uInt32)0 // "
1324 [ # # ]: 0 : << (sal_uInt32)0;
1325 [ # # ][ # # ]: 0 : pStrm = xCleanStorage->CreateMemoryStream();
[ # # ][ # # ]
[ # # ]
1326 : 0 : }
1327 : : }
1328 : : }
1329 : 0 : break;
1330 : :
1331 : : case OCX_CONTROL :
1332 : : {
1333 [ # # ]: 0 : if ( pPtr->xControlModel.is() )
1334 : : {
1335 : 0 : rtl::OUString aName;
1336 : 0 : ::com::sun::star::awt::Size aSize;
1337 [ # # ][ # # ]: 0 : SvStorageRef xDest( new SvStorage( new SvMemoryStream(), sal_True ) );
[ # # ][ # # ]
1338 [ # # ]: 0 : sal_Bool bOk = oox::ole::MSConvertOCXControls::WriteOCXStream( mXModel, xDest, pPtr->xControlModel, aSize, aName );
1339 [ # # ]: 0 : if ( bOk )
1340 [ # # ][ # # ]: 0 : pStrm = xDest->CreateMemoryStream();
1341 : : }
1342 : : }
1343 : : }
1344 [ # # ]: 0 : if ( pStrm )
1345 : : {
1346 [ # # ]: 0 : mpPptEscherEx->BeginAtom();
1347 [ # # ]: 0 : pStrm->Seek( STREAM_SEEK_TO_END );
1348 : 0 : sal_uInt32 npStrmSize = pStrm->Tell();
1349 [ # # ]: 0 : *mpStrm << npStrmSize; // uncompressed size
1350 : :
1351 [ # # ]: 0 : pStrm->Seek( 0 );
1352 [ # # ]: 0 : ZCodec aZCodec( 0x8000, 0x8000 );
1353 [ # # ]: 0 : aZCodec.BeginCompression();
1354 [ # # ]: 0 : aZCodec.Compress( *pStrm, *mpStrm );
1355 [ # # ]: 0 : aZCodec.EndCompression();
1356 [ # # ][ # # ]: 0 : delete pStrm;
1357 [ # # ][ # # ]: 0 : mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
1358 : : }
1359 : : }
1360 : 0 : }
1361 : :
1362 : : // ---------------------------------------------------------------------------------------------
1363 : : // PersistantTable und UserEditAtom schreiben
1364 : :
1365 : 0 : sal_Bool PPTWriter::ImplWriteAtomEnding()
1366 : : {
1367 : :
1368 : : #define EPP_LastViewTypeNone 0
1369 : : #define EPP_LastViewTypeSlideView 1
1370 : : #define EPP_LastViewTypeOutlineView 2
1371 : : #define EPP_LastViewTypeNotes 3
1372 : :
1373 : 0 : sal_uInt32 i, nPos, nOfs, nPersistOfs = mpStrm->Tell();
1374 : 0 : sal_uInt32 nPersistEntrys = 0;
1375 : 0 : *mpStrm << (sal_uInt32)0 << (sal_uInt32)0 << (sal_uInt32)0; // Record Header und ersten Eintrag ueberspringen
1376 : :
1377 : : // Document pesist schreiben
1378 : 0 : nPersistEntrys++;
1379 : 0 : *mpStrm << (sal_uInt32)0;
1380 : : // MasterPages persists schreiben
1381 [ # # ]: 0 : for ( i = 0; i < mnMasterPages; i++ )
1382 : : {
1383 : 0 : nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_MainMaster | i );
1384 [ # # ]: 0 : if ( nOfs )
1385 : : {
1386 : 0 : *mpStrm << nOfs;
1387 : 0 : mpPptEscherEx->InsertAtPersistOffset( EPP_MAINMASTER_PERSIST_KEY | i, ++nPersistEntrys );
1388 : : }
1389 : : }
1390 : : // MainNotesMaster persist schreiben
1391 : 0 : nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_MainNotes );
1392 [ # # ]: 0 : if ( nOfs )
1393 : : {
1394 : 0 : *mpStrm << nOfs;
1395 : 0 : mpPptEscherEx->InsertAtPersistOffset( EPP_MAINNOTESMASTER_PERSIST_KEY, ++nPersistEntrys );
1396 : : }
1397 : : // Slide persists schreiben -> es gilt hier auch den EPP_SlidePersistAtome mit einem gueltigen wert zu beschreiben
1398 [ # # ]: 0 : for ( i = 0; i < mnPages; i++ )
1399 : : {
1400 : 0 : nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Slide | i );
1401 [ # # ]: 0 : if ( nOfs )
1402 : : {
1403 : 0 : *mpStrm << nOfs;
1404 : 0 : mpPptEscherEx->InsertAtPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, ++nPersistEntrys );
1405 : : }
1406 : : }
1407 : : // Notes persists schreiben
1408 [ # # ]: 0 : for ( i = 0; i < mnPages; i++ )
1409 : : {
1410 : 0 : nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Notes | i );
1411 [ # # ]: 0 : if ( nOfs )
1412 : : {
1413 : 0 : *mpStrm << nOfs;
1414 : 0 : mpPptEscherEx->InsertAtPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, ++nPersistEntrys );
1415 : : }
1416 : : }
1417 : : // Ole persists
1418 [ # # ][ # # ]: 0 : for ( std::vector<PPTExOleObjEntry*>::const_iterator it = maExOleObj.begin(); it != maExOleObj.end(); ++it )
[ # # ]
1419 : : {
1420 : 0 : PPTExOleObjEntry* pPtr = *it;
1421 [ # # ]: 0 : nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_ExObj );
1422 [ # # ]: 0 : if ( nOfs )
1423 : : {
1424 : 0 : nPersistEntrys++;
1425 [ # # ]: 0 : *mpStrm << pPtr->nOfsB;
1426 : 0 : sal_uInt32 nOldPos, nPersOfs = nOfs + pPtr->nOfsA + 16 + 8; // 8 bytes atom header, +16 to the persist entry
1427 : 0 : nOldPos = mpStrm->Tell();
1428 [ # # ]: 0 : mpStrm->Seek( nPersOfs );
1429 [ # # ]: 0 : *mpStrm << nPersistEntrys;
1430 [ # # ]: 0 : mpStrm->Seek( nOldPos );
1431 : : }
1432 : : }
1433 : : // VB persist
1434 [ # # ][ # # ]: 0 : if ( mnVBAOleOfs && mpVBA )
1435 : : {
1436 : 0 : nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_VBAInfoAtom );
1437 [ # # ]: 0 : if ( nOfs )
1438 : : {
1439 : 0 : nPersistEntrys++;
1440 : : sal_uInt32 n1, n2;
1441 : :
1442 [ # # ]: 0 : mpVBA->Seek( 0 );
1443 [ # # ]: 0 : *mpVBA >> n1
1444 [ # # ]: 0 : >> n2;
1445 : :
1446 [ # # ]: 0 : *mpStrm << mnVBAOleOfs;
1447 : 0 : sal_uInt32 nOldPos = mpStrm->Tell();
1448 [ # # ]: 0 : mpStrm->Seek( nOfs ); // Fill the VBAInfoAtom with the correct index to the persisttable
1449 [ # # ]: 0 : *mpStrm << nPersistEntrys
1450 [ # # ]: 0 : << n1
1451 [ # # ]: 0 : << sal_Int32(2);
1452 [ # # ]: 0 : mpStrm->Seek( nOldPos );
1453 : :
1454 : : }
1455 : : }
1456 : 0 : nPos = mpStrm->Tell();
1457 : 0 : mpStrm->Seek( nPersistOfs );
1458 : 0 : mpPptEscherEx->AddAtom( ( nPersistEntrys + 1 ) << 2, EPP_PersistPtrIncrementalBlock ); // Record Header eintragen
1459 : 0 : *mpStrm << (sal_uInt32)( ( nPersistEntrys << 20 ) | 1 );
1460 : 0 : mpStrm->Seek( nPos );
1461 : :
1462 : 0 : *mpCurUserStrm << (sal_uInt32)nPos; // offset to current edit setzen
1463 : 0 : mpPptEscherEx->AddAtom( 28, EPP_UserEditAtom );
1464 : 0 : *mpStrm << (sal_Int32)0x100 // last slide ID
1465 : 0 : << (sal_uInt32)0x03000dbc // minor and major app version that did the save
1466 : 0 : << (sal_uInt32)0 // offset last save, 0 after a full save
1467 : 0 : << nPersistOfs // File offset to persist pointers for this save operation
1468 : 0 : << (sal_uInt32)1 // Persist reference to the document persist object
1469 : 0 : << (sal_uInt32)nPersistEntrys // max persists written, Seed value for persist object id management
1470 : 0 : << (sal_Int16)EPP_LastViewTypeSlideView // last view type
1471 : 0 : << (sal_Int16)0x12; // padword
1472 : :
1473 : 0 : return sal_True;
1474 : : }
1475 : :
1476 : : // ---------------------
1477 : : // - exported function -
1478 : : // ---------------------
1479 : :
1480 : 0 : extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool __LOADONCALLAPI ExportPPT( const std::vector< com::sun::star::beans::PropertyValue >& rMediaData, SvStorageRef& rSvStorage,
1481 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rXModel,
1482 : : ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rXStatInd,
1483 : : SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags )
1484 : : {
1485 : : PPTWriter* pPPTWriter;
1486 : 0 : sal_Bool bStatus = sal_False;
1487 : :
1488 [ # # ]: 0 : pPPTWriter = new PPTWriter( rSvStorage, rXModel, rXStatInd, pVBA, nCnvrtFlags );
1489 [ # # ]: 0 : if ( pPPTWriter )
1490 : : {
1491 : 0 : pPPTWriter->exportPPT(rMediaData);
1492 : 0 : bStatus = ( pPPTWriter->IsValid() == sal_True );
1493 [ # # ]: 0 : delete pPPTWriter;
1494 : : }
1495 : :
1496 : 0 : return bStatus;
1497 : : }
1498 : :
1499 : 0 : extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool __LOADONCALLAPI SaveVBA( SfxObjectShell& rDocShell, SvMemoryStream*& pBas )
1500 : : {
1501 [ # # ][ # # ]: 0 : SvStorageRef xDest( new SvStorage( new SvMemoryStream(), sal_True ) );
[ # # ][ # # ]
1502 [ # # ]: 0 : SvxImportMSVBasic aMSVBas( rDocShell, *xDest, sal_False, sal_False );
1503 [ # # ][ # # ]: 0 : aMSVBas.SaveOrDelMSVBAStorage( sal_True, rtl::OUString( "_MS_VBA_Overhead" ) );
[ # # ]
1504 : :
1505 [ # # ][ # # ]: 0 : SvStorageRef xOverhead = xDest->OpenSotStorage( rtl::OUString( "_MS_VBA_Overhead") );
[ # # ]
1506 [ # # ][ # # ]: 0 : if ( xOverhead.Is() && ( xOverhead->GetError() == SVSTREAM_OK ) )
[ # # ]
1507 : : {
1508 [ # # ][ # # ]: 0 : SvStorageRef xOverhead2 = xOverhead->OpenSotStorage( rtl::OUString( "_MS_VBA_Overhead") );
[ # # ]
1509 [ # # ][ # # ]: 0 : if ( xOverhead2.Is() && ( xOverhead2->GetError() == SVSTREAM_OK ) )
[ # # ]
1510 : : {
1511 [ # # ][ # # ]: 0 : SvStorageStreamRef xTemp = xOverhead2->OpenSotStream( rtl::OUString( "_MS_VBA_Overhead2") );
[ # # ]
1512 [ # # ][ # # ]: 0 : if ( xTemp.Is() && ( xTemp->GetError() == SVSTREAM_OK ) )
[ # # ]
1513 : : {
1514 [ # # ]: 0 : sal_uInt32 nLen = xTemp->GetSize();
1515 [ # # ]: 0 : if ( nLen )
1516 : : {
1517 [ # # ]: 0 : char* pTemp = new char[ nLen ];
1518 [ # # ]: 0 : if ( pTemp )
1519 : : {
1520 [ # # ]: 0 : xTemp->Seek( STREAM_SEEK_TO_BEGIN );
1521 [ # # ]: 0 : xTemp->Read( pTemp, nLen );
1522 [ # # ][ # # ]: 0 : pBas = new SvMemoryStream( pTemp, nLen, STREAM_READ );
1523 : 0 : pBas->ObjectOwnsMemory( sal_True );
1524 : 0 : return sal_True;
1525 : : }
1526 : : }
1527 [ # # ][ # # ]: 0 : }
1528 [ # # ][ # # ]: 0 : }
1529 : : }
1530 : :
1531 [ # # ][ # # ]: 0 : return sal_False;
[ # # ]
1532 [ + - ][ + - ]: 9 : }
1533 : :
1534 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|