LibreOffice Module sd (master) 1
eppt.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include "eppt.hxx"
21#include "epptdef.hxx"
22#include "pptexanimations.hxx"
23#include <o3tl/any.hxx>
24#include <tools/globname.hxx>
25#include <rtl/ustring.hxx>
26#include <tools/stream.hxx>
27#include <svx/svdobj.hxx>
28#include <svx/svdoole2.hxx>
29#include <com/sun/star/container/XIndexContainer.hpp>
30#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
31#include <com/sun/star/drawing/FillStyle.hpp>
32#include <com/sun/star/drawing/XDrawPage.hpp>
33#include <com/sun/star/frame/XModel.hpp>
34#include <com/sun/star/office/XAnnotation.hpp>
35#include <com/sun/star/office/XAnnotationAccess.hpp>
36#include <com/sun/star/office/XAnnotationEnumeration.hpp>
37#include <com/sun/star/presentation/AnimationSpeed.hpp>
38#include <com/sun/star/presentation/XPresentationSupplier.hpp>
39#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
40#include <com/sun/star/geometry/RealPoint2D.hpp>
41#include <com/sun/star/util/DateTime.hpp>
42#include <com/sun/star/task/XStatusIndicator.hpp>
44#include <tools/zcodec.hxx>
49#include <editeng/flditem.hxx>
50#include <sfx2/docinf.hxx>
51#include <oox/export/utils.hxx>
52#include <oox/ole/olehelper.hxx>
53#include <sdfilter.hxx>
54#include <memory>
55#include <utility>
56
57class SfxObjectShell;
58 // complete SfxObjectShell for SaveVBA under -fsanitize=function
59
60using namespace com::sun::star;
61using namespace ::com::sun::star::uno;
62using namespace ::com::sun::star::presentation;
63
64using ::com::sun::star::beans::XPropertySet;
65
66//============================ PPTWriter ==================================
67
69 css::uno::Reference< css::frame::XModel > const & rXModel,
70 css::uno::Reference< css::task::XStatusIndicator > const & rXStatInd,
71 SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags ) :
72 PPTWriterBase ( rXModel, rXStatInd ),
73 mnCnvrtFlags ( nCnvrtFlags ),
74 mbStatus ( false ),
75 mnStatMaxValue ( 0 ),
76 mnLatestStatValue ( 0 ),
77 mnTextStyle( 0 ),
78 mbFontIndependentLineSpacing( false ),
79 mnTextSize( 0 ),
80 mrStg (std::move( xSvStorage )),
81 mnVBAOleOfs ( 0 ),
82 mpVBA ( pVBA ),
83 mnExEmbed ( 0 ),
84 mpExEmbed ( new SvMemoryStream ),
85 mnPagesWritten ( 0 ),
86 mnTxId ( 0x7a2f64 ),
87 mnDiaMode ( 0 ),
88 mnShapeMasterTitle ( 0 ),
89 mnShapeMasterBody ( 0 )
90{
91}
92
93void PPTWriter::exportPPTPre( const std::vector< css::beans::PropertyValue >& rMediaData )
94{
95 if ( !mrStg.is() )
96 return;
97
98 if ( mXStatusIndicator.is() )
99 {
100 mbStatusIndicator = true;
102 mXStatusIndicator->start( "PowerPoint Export", mnStatMaxValue + ( mnStatMaxValue >> 3 ) );
103 }
104
106 mrStg->SetClass( aGName, SotClipboardFormatId::NONE, "MS PowerPoint 97" );
107
109 return;
110
111 mpStrm = mrStg->OpenSotStream( "PowerPoint Document" );
112 if ( !mpStrm )
113 return;
114
115 if ( !mpPicStrm )
116 mpPicStrm = mrStg->OpenSotStream( "Pictures" );
117
118 auto aIter = std::find_if(rMediaData.begin(), rMediaData.end(),
119 [](const css::beans::PropertyValue& rProp) { return rProp.Name == "BaseURI"; });
120 if (aIter != rMediaData.end())
121 (*aIter).Value >>= maBaseURI;
122 mpPptEscherEx.reset( new PptEscherEx( *mpStrm, maBaseURI ) );
123}
124
126{
127 if ( !ImplCloseDocument() )
128 return;
129
130 if ( mbStatusIndicator )
131 {
132 mXStatusIndicator->setText( "PowerPoint Export" );
133 sal_uInt32 nValue = mnStatMaxValue + ( mnStatMaxValue >> 3 );
135 {
136 mXStatusIndicator->setValue( nValue );
138 }
139 }
140
141 ImplWriteOLE();
142
143 ImplWriteVBA();
144
146
148
149 mbStatus = true;
150};
151
152static void ImplExportComments( const uno::Reference< drawing::XDrawPage >& xPage, SvMemoryStream& rBinaryTagData10Atom );
153
154void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode,
155 bool bHasBackground, Reference< XPropertySet > const & aXBackgroundPropSet )
156{
157 Any aAny;
158
159 const PHLayout& rLayout = GetLayout( mXPagePropSet );
160 mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Slide | nPageNum, mpStrm->Tell() );
161 mpPptEscherEx->OpenContainer( EPP_Slide );
162 mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 );
163 mpStrm->WriteInt32( static_cast<sal_Int32>(rLayout.nLayout) );
164 mpStrm->WriteBytes(rLayout.nPlaceHolder, 8); // placeholderIDs (8 parts)
165 mpStrm->WriteUInt32( nMasterNum | 0x80000000 ) // master ID (equals 0x80000000 on a master page)
166 .WriteUInt32( nPageNum + 0x100 ) // notes ID (equals null if no notes are present)
167 .WriteUInt16( nMode )
168 .WriteUInt16( 0 ); // padword
169
170 mnDiaMode = 0;
171 bool bVisible = true;
172 css::presentation::FadeEffect eFe = css::presentation::FadeEffect_NONE;
173
174 if ( GetPropertyValue( aAny, mXPagePropSet, "Visible" ) )
175 aAny >>= bVisible;
176 if ( GetPropertyValue( aAny, mXPagePropSet, "Change" ) )
177 {
178 switch ( *o3tl::doAccess<sal_Int32>(aAny) )
179 {
180 case 1 : // automatic
181 mnDiaMode++;
182 [[fallthrough]];
183 case 2 : // semi-automatic
184 mnDiaMode++;
185 break;
186 default :
187 case 0 : // manual
188 break;
189 }
190 }
191 if ( GetPropertyValue( aAny, mXPagePropSet, "Effect" ) )
192 aAny >>= eFe;
193
194 sal_uInt32 nSoundRef = 0;
195 bool bIsSound = false;
196 bool bStopSound = false;
197 bool bLoopSound = false;
198
199 if ( GetPropertyValue( aAny, mXPagePropSet, "Sound" ) )
200 {
201 OUString aSoundURL;
202 if ( aAny >>= aSoundURL )
203 {
204 nSoundRef = maSoundCollection.GetId( aSoundURL );
205 bIsSound = true;
206 }
207 else
208 aAny >>= bStopSound;
209 }
210 if ( GetPropertyValue( aAny, mXPagePropSet, "LoopSound" ) )
211 aAny >>= bLoopSound;
212
213 bool bNeedsSSSlideInfoAtom = !bVisible
214 || ( mnDiaMode == 2 )
215 || bIsSound
216 || bStopSound
217 || ( eFe != css::presentation::FadeEffect_NONE );
218 if ( bNeedsSSSlideInfoAtom )
219 {
220 sal_uInt8 nDirection = 0;
221 sal_uInt8 nTransitionType = 0;
222 sal_uInt16 nBuildFlags = 1; // advance by mouseclick
223 sal_Int32 nSlideTime = 0; // still has to !!!
224 sal_uInt8 nSpeed = 1;
225
226 if ( GetPropertyValue( aAny, mXPagePropSet, "TransitionDuration" ) )
227 {
228 css::presentation::AnimationSpeed aAs;
229 double fTransitionDuration = -1.0;
230 aAny >>= fTransitionDuration;
231
232 if (fTransitionDuration >= 0)
233 {
234 if (fTransitionDuration <= 0.5)
235 {
236 aAs = css::presentation::AnimationSpeed::AnimationSpeed_FAST;
237 }
238 else if (fTransitionDuration >= 1.0)
239 {
240 aAs = css::presentation::AnimationSpeed::AnimationSpeed_SLOW;
241 }
242 else
243 {
244 aAs = css::presentation::AnimationSpeed::AnimationSpeed_MEDIUM;
245 }
246 }
247 else
248 aAs = css::presentation::AnimationSpeed::AnimationSpeed_MEDIUM;
249
250 nSpeed = static_cast<sal_uInt8>(aAs);
251 }
252 sal_Int16 nTT = 0;
253 if ( GetPropertyValue( aAny, mXPagePropSet, "TransitionType" )
254 && ( aAny >>= nTT ) )
255 {
256 sal_Int16 nTST = 0;
257 if ( GetPropertyValue( aAny, mXPagePropSet, "TransitionSubtype" )
258 && ( aAny >>= nTST ) )
259 nTransitionType = GetTransition( nTT, nTST, eFe, 0, nDirection );
260
261 }
262 if ( !nTransitionType )
263 nTransitionType = GetTransition( eFe, nDirection );
264 if ( mnDiaMode == 2 ) // automatic ?
265 nBuildFlags |= 0x400;
266 if ( !bVisible )
267 nBuildFlags |= 4;
268 if ( bIsSound )
269 nBuildFlags |= 16;
270 if ( bLoopSound )
271 nBuildFlags |= 64;
272 if ( bStopSound )
273 nBuildFlags |= 256;
274
275 if ( GetPropertyValue( aAny, mXPagePropSet, "Duration" ) )// duration of this slide
276 nSlideTime = *o3tl::doAccess<sal_Int32>(aAny) << 10; // in ticks
277
278 mpPptEscherEx->AddAtom( 16, EPP_SSSlideInfoAtom );
279 mpStrm->WriteInt32( nSlideTime ) // standtime in ticks
280 .WriteUInt32( nSoundRef )
281 .WriteUChar( nDirection )
282 .WriteUChar( nTransitionType )
283 .WriteUInt16( nBuildFlags )
284 .WriteUChar( nSpeed )
285 .WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 );
286 }
287
289
290 EscherSolverContainer aSolverContainer;
291 mpPptEscherEx->OpenContainer( EPP_PPDrawing );
292 mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
293 mpPptEscherEx->EnterGroup(nullptr,nullptr);
294 ImplWritePage( rLayout, aSolverContainer, NORMAL, false, nPageNum ); // the shapes of the pages are created in the PPT document
295 mpPptEscherEx->LeaveGroup();
296
297 if ( bHasBackground )
298 ImplWriteBackground( aXBackgroundPropSet );
299 else
300 {
301 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
303 ShapeFlag::Background | ShapeFlag::HaveShapeProperty );
305 aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) );
306 aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Width ) );
307 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
308 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
310 aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape
311 aPropOpt.Commit( *mpStrm );
312 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
313 }
314
315 aSolverContainer.WriteSolver( *mpStrm );
316
317 mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
318 mpPptEscherEx->CloseContainer(); // EPP_Drawing
319 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
320 mpStrm->WriteUInt32( 0xffffff ).WriteUInt32( 0x000000 ).WriteUInt32( 0x808080 ).WriteUInt32( 0x000000 ).WriteUInt32( 0x99cc00 ).WriteUInt32( 0xcc3333 ).WriteUInt32( 0xffcccc ).WriteUInt32( 0xb2b2b2 );
321
322 SvMemoryStream aBinaryTagData10Atom;
323 ImplExportComments( mXDrawPage, aBinaryTagData10Atom );
324 SvMemoryStream amsofbtAnimGroup;
325 ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection );
326 aExporter.doexport( mXDrawPage, amsofbtAnimGroup );
327 sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell();
328 if ( nmsofbtAnimGroupSize )
329 {
330 {
331 EscherExAtom aMagic2( aBinaryTagData10Atom, 0x2eeb );
332 aBinaryTagData10Atom.WriteUInt32( 0x01c45df9 )
333 .WriteUInt32( 0xe1471b30 );
334 }
335 {
336 EscherExAtom aMagic( aBinaryTagData10Atom, 0x2b00 );
337 aBinaryTagData10Atom.WriteUInt32( 0 );
338 }
339 aBinaryTagData10Atom.WriteBytes(amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell());
340 {
341 EscherExContainer aMagic2( aBinaryTagData10Atom, 0x2b02 );
342 }
343 }
344 if ( aBinaryTagData10Atom.Tell() )
345 {
346 EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags );
347 EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag );
348 {
349 EscherExAtom aCString( *mpStrm, EPP_CString );
350 mpStrm->WriteUInt32( 0x5f005f )
351 .WriteUInt32( 0x50005f )
352 .WriteUInt32( 0x540050 )
353 .WriteUInt16( 0x31 )
354 .WriteUInt16( 0x30 );
355 }
356 {
357 EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData );
358 mpStrm->WriteBytes(aBinaryTagData10Atom.GetData(), aBinaryTagData10Atom.Tell());
359 }
360 }
361 mpPptEscherEx->CloseContainer(); // EPP_Slide
362}
363
364void PPTWriter::ImplWriteSlideMaster( sal_uInt32 nPageNum, Reference< XPropertySet > const & aXBackgroundPropSet )
365{
366 if (!aXBackgroundPropSet)
367 return;
368 mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainMaster | nPageNum, mpStrm->Tell() );
369 mpPptEscherEx->OpenContainer( EPP_MainMaster );
370 mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 );
371 mpStrm->WriteInt32( static_cast<sal_Int32>(EppLayout::TITLEANDBODYSLIDE) ) // slide layout -> title and body slide
372 .WriteUChar( 1 ).WriteUChar( 2 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 ) // placeholderID
373 .WriteUInt32( 0 ) // master ID (equals null at a master page)
374 .WriteUInt32( 0 ) // notes ID (equals null if no notes are present)
375 .WriteUInt16( 0 ) // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background
376 .WriteUInt16( 0 ); // padword
377
378 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
379 mpStrm->WriteUInt32( 0xffffff ).WriteUInt32( 0x000000 ).WriteUInt32( 0x808080 ).WriteUInt32( 0x000000 ).WriteUInt32( 0x99cc00 ).WriteUInt32( 0xcc3333 ).WriteUInt32( 0xffcccc ).WriteUInt32( 0xb2b2b2 );
380 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
381 mpStrm->WriteUInt32( 0xff0000 ).WriteUInt32( 0xffffff ).WriteUInt32( 0x000000 ).WriteUInt32( 0x00ffff ).WriteUInt32( 0x0099ff ).WriteUInt32( 0xffff00 ).WriteUInt32( 0x0000ff ).WriteUInt32( 0x969696 );
382 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
383 mpStrm->WriteUInt32( 0xccffff ).WriteUInt32( 0x000000 ).WriteUInt32( 0x336666 ).WriteUInt32( 0x008080 ).WriteUInt32( 0x339933 ).WriteUInt32( 0x000080 ).WriteUInt32( 0xcc3300 ).WriteUInt32( 0x66ccff );
384 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
385 mpStrm->WriteUInt32( 0xffffff ).WriteUInt32( 0x000000 ).WriteUInt32( 0x333333 ).WriteUInt32( 0x000000 ).WriteUInt32( 0xdddddd ).WriteUInt32( 0x808080 ).WriteUInt32( 0x4d4d4d ).WriteUInt32( 0xeaeaea );
386 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
387 mpStrm->WriteUInt32( 0xffffff ).WriteUInt32( 0x000000 ).WriteUInt32( 0x808080 ).WriteUInt32( 0x000000 ).WriteUInt32( 0x66ccff ).WriteUInt32( 0xff0000 ).WriteUInt32( 0xcc00cc ).WriteUInt32( 0xc0c0c0 );
388 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
389 mpStrm->WriteUInt32( 0xffffff ).WriteUInt32( 0x000000 ).WriteUInt32( 0x808080 ).WriteUInt32( 0x000000 ).WriteUInt32( 0xc0c0c0 ).WriteUInt32( 0xff6600 ).WriteUInt32( 0x0000ff ).WriteUInt32( 0x009900 );
390 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
391 mpStrm->WriteUInt32( 0xffffff ).WriteUInt32( 0x000000 ).WriteUInt32( 0x808080 ).WriteUInt32( 0x000000 ).WriteUInt32( 0xff9933 ).WriteUInt32( 0xccff99 ).WriteUInt32( 0xcc00cc ).WriteUInt32( 0xb2b2b2 );
392
393 for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
394 {
395 if ( nInstance == EPP_TEXTTYPE_notUsed )
396 continue;
397
398 // the auto color is dependent to the page background,so we have to set a page that is in the right context
399 if ( nInstance == EPP_TEXTTYPE_Notes )
400 (void)GetPageByIndex(0, NOTICE);
401 else
402 (void)GetPageByIndex(0, MASTER);
403
404 mpPptEscherEx->BeginAtom();
405
406 bool bSimpleText = false;
407
408 mpStrm->WriteUInt16( 5 ); // paragraph count
409
410 for ( sal_uInt16 nLev = 0; nLev < 5; nLev++ )
411 {
412 if ( nInstance >= EPP_TEXTTYPE_CenterBody )
413 {
414 bSimpleText = true;
415 mpStrm->WriteUInt16( nLev );
416 }
417 mpStyleSheet->mpParaSheet[ nInstance ]->Write( *mpStrm, nLev, bSimpleText, mXPagePropSet );
418 mpStyleSheet->mpCharSheet[ nInstance ]->Write( *mpStrm, nLev, bSimpleText, mXPagePropSet );
419 }
420 mpPptEscherEx->EndAtom( EPP_TxMasterStyleAtom, 0, nInstance );
421 }
422 GetPageByIndex( nPageNum, MASTER );
423
424 EscherSolverContainer aSolverContainer;
425
426 mpPptEscherEx->OpenContainer( EPP_PPDrawing );
427 mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
428
429 mpPptEscherEx->EnterGroup(nullptr,nullptr);
430 ImplWritePage( GetLayout( 0 ), aSolverContainer, MASTER, true ); // the shapes of the pages are created in the PPT document
431 mpPptEscherEx->LeaveGroup();
432
433 ImplWriteBackground( aXBackgroundPropSet );
434
435 aSolverContainer.WriteSolver( *mpStrm );
436
437 mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
438 mpPptEscherEx->CloseContainer(); // EPP_Drawing
439 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
440 mpStrm->WriteUInt32( 0xffffff ).WriteUInt32( 0x000000 ).WriteUInt32( 0x808080 ).WriteUInt32( 0x000000 ).WriteUInt32( 0x99cc00 ).WriteUInt32( 0xcc3333 ).WriteUInt32( 0xffcccc ).WriteUInt32( 0xb2b2b2 );
441
442 if ( aBuExMasterStream.Tell() )
443 {
444 ImplProgTagContainer( mpStrm.get(), &aBuExMasterStream );
445 }
446 mpPptEscherEx->CloseContainer(); // EPP_MainMaster
447};
448
450{
451 mpExEmbed.reset();
452 mpPptEscherEx.reset();
455 mpStrm.clear();
456 maStyleSheetList.clear();
457 maExOleObj.clear();
458 if ( mbStatusIndicator )
459 mXStatusIndicator->end();
460}
461
463{
464 mpCurUserStrm = mrStg->OpenSotStream( "Current User" );
465 if ( !mpCurUserStrm )
466 return false;
467 char pUserName[] = "Current User";
468 sal_uInt32 nLenOfUserName = strlen( pUserName );
469 sal_uInt32 nSizeOfRecord = 0x14 + ( ( nLenOfUserName + 4 ) & ~ 3 );
470
471 mpCurUserStrm->WriteUInt16( 0 ).WriteUInt16( EPP_CurrentUserAtom ).WriteUInt32( nSizeOfRecord );
472 mpCurUserStrm->WriteUInt32( 0x14 ) // Len
473 .WriteUInt32( 0xe391c05f ); // Magic
474
475 sal_uInt32 nEditPos = mpCurUserStrm->Tell();
476 mpCurUserStrm->WriteUInt32( 0x0 ) // OffsetToCurrentEdit;
477 .WriteUInt16( nLenOfUserName )
478 .WriteUInt16( 0x3f4 ) // DocFileVersion
479 .WriteUChar( 3 ) // MajorVersion
480 .WriteUChar( 0 ) // MinorVersion
481 .WriteUInt16( 0 ); // Pad Word
482 pUserName[ nLenOfUserName ] = 8;
483 mpCurUserStrm->WriteBytes(pUserName, nLenOfUserName + 1);
484 for ( sal_uInt32 i = 0x15 + nLenOfUserName; i < nSizeOfRecord; i++ )
485 {
486 mpCurUserStrm->WriteUChar( 0 ); // pad bytes
487 }
488 mpCurUserStrm->Seek( nEditPos );
489 return true;
490};
491
493{
494 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
495 mXModel, uno::UNO_QUERY_THROW);
496 uno::Reference<document::XDocumentProperties> xDocProps(
497 xDPS->getDocumentProperties());
498
499 if (!xDocProps.is())
500 return;
501
502 // no idea what this is...
503 static const sal_Int8 aGuid[ 0x52 ] =
504 {
505 0x4e, 0x00, 0x00, 0x00,
506 '{',0,'D',0,'B',0,'1',0,'A',0,'C',0,'9',0,'6',0,'4',0,'-',0,
507 'E',0,'3',0,'9',0,'C',0,'-',0,'1',0,'1',0,'D',0,'2',0,'-',0,
508 'A',0,'1',0,'E',0,'F',0,'-',0,'0',0,'0',0,'6',0,'0',0,'9',0,
509 '7',0,'D',0,'A',0,'5',0,'6',0,'8',0,'9',0,'}',0
510 };
511 // coverity[overrun-buffer-arg : FALSE] - coverity has difficulty with css::uno::Sequence
512 uno::Sequence<sal_Int8> aGuidSeq(aGuid, 0x52);
513
514 SvMemoryStream aHyperBlob;
515 ImplCreateHyperBlob( aHyperBlob );
516
517 auto nHyperLength = static_cast<sal_Int32>(aHyperBlob.Tell());
518 const sal_Int8* pBlob(
519 static_cast<const sal_Int8*>(aHyperBlob.GetData()));
520 auto aHyperSeq = comphelper::arrayToSequence<sal_Int8>(pBlob, nHyperLength);
521
522 if ( mnCnvrtFlags & 0x8000 )
523 {
524 uno::Sequence<sal_Int8> aThumbSeq;
525 if ( GetPageByIndex( 0, NORMAL ) && ImplGetPropertyValue( mXPagePropSet, "PreviewBitmap" ) )
526 {
527 aThumbSeq = *o3tl::doAccess<uno::Sequence<sal_Int8>>(mAny);
528 }
529 sfx2::SaveOlePropertySet( xDocProps, mrStg.get(),
530 &aThumbSeq, &aGuidSeq, &aHyperSeq);
531 }
532 else
533 {
534 sfx2::SaveOlePropertySet( xDocProps, mrStg.get(),
535 nullptr, &aGuidSeq, &aHyperSeq );
536 }
537}
538
539void PPTWriter::ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId )
540{
541 if ( rSt.Tell() )
542 {
543 aBuExOutlineStream.WriteUInt32( ( EPP_PST_ExtendedParagraphHeaderAtom << 16 )
544 | ( nRef << 4 ) )
545 .WriteUInt32( 8 )
546 .WriteUInt32( nSlideId )
547 .WriteUInt32( nInstance );
548 aBuExOutlineStream.WriteBytes(rSt.GetData(), rSt.Tell());
549 }
550}
551
552void PPTWriter::ImplCreateHeaderFooterStrings( SvStream& rStrm, css::uno::Reference< css::beans::XPropertySet > const & rXPagePropSet )
553{
554 if ( !rXPagePropSet.is() )
555 return;
556
557 OUString aString;
558 css::uno::Any aAny;
559 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, "HeaderText", true ) )
560 {
561 if ( aAny >>= aString )
562 PPTWriter::WriteCString( rStrm, aString, 1 );
563 }
564 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, "FooterText", true ) )
565 {
566 if ( aAny >>= aString )
567 PPTWriter::WriteCString( rStrm, aString, 2 );
568 }
569 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, "DateTimeText", true ) )
570 {
571 if ( aAny >>= aString )
572 PPTWriter::WriteCString( rStrm, aString );
573 }
574}
575
576void PPTWriter::ImplCreateHeaderFooters( css::uno::Reference< css::beans::XPropertySet > const & rXPagePropSet )
577{
578 if ( !rXPagePropSet.is() )
579 return;
580
581 bool bVal = false;
582 sal_uInt32 nVal = 0;
583 css::uno::Any aAny;
584 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, "IsHeaderVisible", true ) )
585 {
586 if ( ( aAny >>= bVal ) && bVal )
587 nVal |= 0x100000;
588 }
589 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, "IsFooterVisible", true ) )
590 {
591 if ( ( aAny >>= bVal ) && bVal )
592 nVal |= 0x200000;
593 }
594 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, "IsDateTimeVisible", true ) )
595 {
596 if ( ( aAny >>= bVal ) && bVal )
597 nVal |= 0x010000;
598 }
599 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, "IsPageNumberVisible", true ) )
600 {
601 if ( ( aAny >>= bVal ) && bVal )
602 nVal |= 0x080000;
603 }
604 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, "IsDateTimeFixed", true ) )
605 {
606 if ( ( aAny >>= bVal ) && !bVal )
607 nVal |= 0x20000;
608 else
609 nVal |= 0x40000;
610 }
611 if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, "DateTimeFormat", true ) )
612 {
613 sal_Int32 nFormat = *o3tl::doAccess<sal_Int32>(aAny);
614 SvxDateFormat eDateFormat = static_cast<SvxDateFormat>( nFormat & 0xf );
615 SvxTimeFormat eTimeFormat = static_cast<SvxTimeFormat>( ( nFormat >> 4 ) & 0xf );
616 switch( eDateFormat )
617 {
618 case SvxDateFormat::F :
619 nFormat = 1;
620 break;
621 case SvxDateFormat::D :
622 nFormat = 2;
623 break;
624 case SvxDateFormat::C :
625 nFormat = 4;
626 break;
627 default:
628 case SvxDateFormat::A :
629 nFormat = 0;
630 }
631 switch( eTimeFormat )
632 {
633 case SvxTimeFormat::HH24_MM :
634 nFormat = 9;
635 break;
636 case SvxTimeFormat::HH12_MM :
637 nFormat = 11;
638 break;
639 case SvxTimeFormat::HH24_MM_SS :
640 nFormat = 10;
641 break;
642 case SvxTimeFormat::HH12_MM_SS :
643 nFormat = 12;
644 break;
645 default:
646 break;
647 }
648 nVal |= nFormat;
649 }
650
651 mpPptEscherEx->OpenContainer( EPP_HeadersFooters );
653 mpStrm->WriteUInt32( nVal );
654 ImplCreateHeaderFooterStrings( *mpStrm, rXPagePropSet );
655 mpPptEscherEx->CloseContainer();
656}
657
659{
660 sal_uInt32 i;
661 sal_uInt16 nSlideType = EPP_SLIDESIZE_TYPECUSTOM;
662
663 sal_uInt32 nWidth = maDestPageSize.Width;
664 sal_uInt32 nHeight = maDestPageSize.Height;
665
666 if ( ( nWidth == 0x1680 ) && ( nHeight == 0x10e0 ) )
667 nSlideType = EPP_SLIDESIZE_TYPEONSCREEN;
668 else if ( ( nWidth == 0x1200 ) && ( nHeight == 0x240 ) )
669 nSlideType = EPP_SLIDESIZE_TYPEBANNER;
670 else if ( ( nWidth == 0x1950 ) && ( nHeight == 0x10e0 ) )
671 nSlideType = EPP_SLIDESIZE_TYPE35MM;
672 else if ( ( nWidth == 0x1860 ) && ( nHeight == 0x10e0 ) )
673 nSlideType = EPP_SLIDESIZE_TYPEA4PAPER;
674
675 mpPptEscherEx->OpenContainer( EPP_Document );
676 // CREATE DOCUMENT ATOM
677 mpPptEscherEx->AddAtom( 40, EPP_DocumentAtom, 1 );
678 mpStrm->WriteUInt32( nWidth ) // Slide Size in Master coordinates X
679 .WriteUInt32( nHeight ) // " " " " " Y
680 .WriteInt32( maNotesPageSize.Width ) // Notes Page Size X
681 .WriteInt32( maNotesPageSize.Height ) // " " " Y
682 .WriteInt32( 1 ).WriteInt32( 2 ); // the scale used when the Powerpoint document is embedded. the default is 1:2
683 mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTESMASTER_PERSIST_KEY, mpStrm->Tell() );
684 mpStrm->WriteUInt32( 0 ) // Reference to NotesMaster ( 0 if none );
685 .WriteUInt32( 0 ) // Reference to HandoutMaster ( 0 if none );
686 .WriteInt16( 1 ) // Number of the first slide;
687 .WriteUInt16( nSlideType ) // Size of the document slides ( default: EPP_SLIDESIZETYPEONSCREEN )
688 .WriteUChar( 0 ) // bool1 indicates if document was saved with embedded true type fonts
689 .WriteUChar( 0 ) // bool1 indicates if the placeholders on the title slide are omitted
690 .WriteUChar( 0 ) // bool1 right to left ( flag for Bidi version )
691 .WriteUChar( 1 ); // bool1 visibility of comments shapes
692
693 mpPptEscherEx->PtInsert( EPP_Persist_Document, mpStrm->Tell() );
694
695 mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 3 ); //Master footer (default)
697 mpStrm->WriteUInt32( 0x25000d );
698 if ( GetPageByIndex( 0, MASTER ) )
700 mpPptEscherEx->CloseContainer();
701 mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 4 ); //NotesMaster footer (default)
703 mpStrm->WriteUInt32( 0x3d000d );
704 if ( GetPageByIndex( 0, NOTICE ) )
706 mpPptEscherEx->CloseContainer();
707
708 mpPptEscherEx->OpenContainer( EPP_SlideListWithText ); // animation information for the slides
709
710 for ( i = 0; i < mnPages; i++ )
711 {
712 mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom );
713 mpPptEscherEx->InsertPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, mpStrm->Tell() );
714 mpStrm->WriteUInt32( 0 ) // psrReference - logical reference to the slide persist object ( EPP_MAINSLIDE_PERSIST_KEY )
715 .WriteUInt32( 4 ) // flags - only bit 3 used, if set then slide contains shapes other than placeholders
716 .WriteInt32( 0 ) // numberTexts - number of placeholder texts stored with the persist object. Allows to display outline view without loading the slide persist objects
717 .WriteInt32( i + 0x100 ) // slideId - Unique slide identifier, used for OLE link monikers for example
718 .WriteUInt32( 0 ); // reserved, usually 0
719
720 if ( !GetPageByIndex( i, NORMAL ) ) // very exciting: once again through all pages
721 return false;
723
724 css::uno::Reference< css::container::XNamed >
725 aXName( mXDrawPage, css::uno::UNO_QUERY );
726
727 if ( aXName.is() )
728 maSlideNameList.push_back( aXName->getName() );
729 else
730 maSlideNameList.emplace_back( );
731 }
732 mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText
733
734 mpPptEscherEx->OpenContainer( EPP_SlideListWithText, 2 ); // animation information for the notes
735 for( i = 0; i < mnPages; i++ )
736 {
737 mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom );
738 mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, mpStrm->Tell() );
739 mpStrm->WriteUInt32( 0 )
740 .WriteUInt32( 4 )
741 .WriteInt32( 0 )
742 .WriteInt32( i + 0x100 )
743 .WriteUInt32( 0 );
744 }
745 mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText
746
747 css::uno::Reference< css::presentation::XPresentationSupplier >
748 aXPresSupplier( mXModel, css::uno::UNO_QUERY );
749 if ( aXPresSupplier.is() )
750 {
751 css::uno::Reference< css::presentation::XPresentation > aXPresentation( aXPresSupplier->getPresentation() );
752 if ( aXPresentation.is() )
753 {
754 mXPropSet.set( aXPresentation, css::uno::UNO_QUERY );
755 if ( mXPropSet.is() )
756 {
757 OUString aCustomShow;
758 sal_uInt32 const nPenColor = 0x1000000;
759 sal_Int32 const nRestartTime = 0x7fffffff;
760 sal_Int16 nStartSlide = 0;
761 sal_Int16 nEndSlide = 0;
762 sal_uInt32 nFlags = 0; // Bit 0: Auto advance
763 // Bit 1 Skip builds ( do not allow slide effects )
764 // Bit 2 Use slide range
765 // Bit 3 Use named show
766 // Bit 4 Browse mode on
767 // Bit 5 Kiosk mode on
768 // Bit 6 Skip narration
769 // Bit 7 loop continuously
770 // Bit 8 show scrollbar
771
772 if ( ImplGetPropertyValue( "CustomShow" ) )
773 {
774 aCustomShow = *o3tl::doAccess<OUString>(mAny);
775 if ( !aCustomShow.isEmpty() )
776 {
777 nFlags |= 8;
778 }
779 }
780 if ( ( nFlags & 8 ) == 0 )
781 {
782 if ( ImplGetPropertyValue( "FirstPage" ) )
783 {
784 auto aSlideName = o3tl::doAccess<OUString>(mAny);
785
786 std::vector<OUString>::const_iterator pIter = std::find(
787 maSlideNameList.begin(),maSlideNameList.end(), *aSlideName);
788
789 if (pIter != maSlideNameList.end())
790 {
791 nStartSlide = pIter - maSlideNameList.begin() + 1;
792 nFlags |= 4;
793 nEndSlide = static_cast<sal_uInt16>(mnPages);
794 }
795 }
796 }
797
798 if ( ImplGetPropertyValue( "IsAutomatic" ) )
799 {
800 bool bBool = false;
801 mAny >>= bBool;
802 if ( !bBool )
803 nFlags |= 1;
804 }
805
806 if ( ImplGetPropertyValue( "IsEndless" ) )
807 {
808 bool bBool = false;
809 mAny >>= bBool;
810 if ( bBool )
811 nFlags |= 0x80;
812 }
813 if ( ImplGetPropertyValue( "IsFullScreen" ) )
814 {
815 bool bBool = false;
816 mAny >>= bBool;
817 if ( !bBool )
818 nFlags |= 0x11;
819 }
820
821 mpPptEscherEx->AddAtom( 80, EPP_SSDocInfoAtom, 1 );
822 mpStrm->WriteUInt32( nPenColor ).WriteInt32( nRestartTime ).WriteInt16( nStartSlide ).WriteInt16( nEndSlide );
823
824 sal_uInt32 nCustomShowNameLen = aCustomShow.getLength();
825 if ( nCustomShowNameLen > 31 )
826 nCustomShowNameLen = 31;
827 if ( nCustomShowNameLen ) // named show identifier
828 {
829 const sal_Unicode* pCustomShow = aCustomShow.getStr();
830 for ( i = 0; i < nCustomShowNameLen; i++ )
831 {
832 mpStrm->WriteUInt16( pCustomShow[ i ] );
833 }
834 }
835 for ( i = nCustomShowNameLen; i < 32; i++, mpStrm->WriteUInt16( 0 ) ) ;
836
837 mpStrm->WriteUInt32( nFlags );
838 css::uno::Reference< css::presentation::XCustomPresentationSupplier > aXCPSup( mXModel, css::uno::UNO_QUERY );
839 if ( aXCPSup.is() )
840 {
841 css::uno::Reference< css::container::XNameContainer > aXCont( aXCPSup->getCustomPresentations() );
842 if ( aXCont.is() )
843 {
844 const css::uno::Sequence< OUString> aNameSeq( aXCont->getElementNames() );
845 if ( aNameSeq.hasElements() )
846 {
847 mpPptEscherEx->OpenContainer( EPP_NamedShows );
848 sal_uInt32 nCustomShowIndex = 0;
849 for( OUString const & customShowName : aNameSeq )
850 {
851 if ( !customShowName.isEmpty() )
852 {
853 mpPptEscherEx->OpenContainer( EPP_NamedShow, nCustomShowIndex++ );
854
855 sal_uInt32 nNamedShowLen = customShowName.getLength();
856 if ( nNamedShowLen > 31 )
857 nNamedShowLen = 31;
858 mpPptEscherEx->AddAtom( nNamedShowLen << 1, EPP_CString );
859 const sal_Unicode* pCustomShowName = customShowName.getStr();
860 for ( sal_uInt32 k = 0; k < nNamedShowLen; ++k )
861 mpStrm->WriteUInt16( pCustomShowName[ k ] );
862 mAny = aXCont->getByName( customShowName );
863 css::uno::Reference< css::container::XIndexContainer > aXIC;
864 if ( mAny >>= aXIC )
865 {
866 mpPptEscherEx->BeginAtom();
867
868 sal_Int32 nSlideCount = aXIC->getCount();
869 for ( sal_Int32 j = 0; j < nSlideCount; j++ ) // number of slides
870 {
871 mAny = aXIC->getByIndex( j );
872 css::uno::Reference< css::drawing::XDrawPage > aXDrawPage;
873 if ( mAny >>= aXDrawPage )
874 {
875 css::uno::Reference< css::container::XNamed > aXName( aXDrawPage, css::uno::UNO_QUERY );
876 if ( aXName.is() )
877 {
878 OUString aSlideName( aXName->getName() );
879 std::vector<OUString>::const_iterator pIter = std::find(
880 maSlideNameList.begin(),maSlideNameList.end(),aSlideName);
881
882 if (pIter != maSlideNameList.end())
883 {
884 sal_uInt32 nPageNumber = pIter - maSlideNameList.begin();
885 mpStrm->WriteUInt32( nPageNumber + 0x100 ); // unique slide id
886 }
887 }
888 }
889 }
891 }
892 mpPptEscherEx->CloseContainer(); // EPP_NamedShow
893 }
894 }
895 mpPptEscherEx->CloseContainer(); // EPP_NamedShows
896 }
897 }
898 }
899 }
900 }
901 }
902 mpPptEscherEx->AddAtom( 0, EPP_EndDocument );
903 mpPptEscherEx->CloseContainer(); // EPP_Document
904 return true;
905};
906
908{
909 sal_uInt32 nCurrentOfs, nParaOfs, nParaCount = 0;
910
911 nParaOfs = rStrm.Tell();
912 rStrm.WriteUInt32( 0 ); // property size
913 rStrm.WriteUInt32( 0 ); // property count
914
915 for ( const auto& rHyperlink : maHyperlink )
916 {
917 nParaCount += 6;
918 rStrm .WriteUInt32( 3 ) // Type VT_I4
919 .WriteUInt32( 7 ) // (VTI4 - Private1)
920 .WriteUInt32( 3 ) // Type VT_I4
921 .WriteUInt32( 6 ) // (VTI4 - Private2)
922 .WriteUInt32( 3 ) // Type VT_I4
923 .WriteUInt32( 0 ); // (VTI4 - Private3)
924
925 // INFO
926 // HIWORD: = 0 : do not change anything
927 // = 1 : replace the hyperlink with the target and subaddress in the following two VTLPWSTR
928 // = 2 : delete the hyperlink
929 // LOWORD: = 0 : graphic shown as background (link)
930 // = 1 : graphic shown as shape (link)
931 // = 2 : graphic is used to fill a shape
932 // = 3 : graphic used to fill a shape outline (future use)
933 // = 4 : hyperlink attached to a shape
934 // = 5 : " " " " (Word) field
935 // = 6 : " " " " (Excel) range
936 // = 7 : " " " " (PPT) text range
937 // = 8 : " " " " (Project) task
938
939 sal_Int32 nUrlLen = rHyperlink.aURL.getLength();
940 const OUString& rUrl = rHyperlink.aURL;
941
942 sal_uInt32 const nInfo = 7;
943
944 rStrm .WriteUInt32( 3 ) // Type VT_I4
945 .WriteUInt32( nInfo ); // Info
946
947 switch( rHyperlink.nType & 0xff )
948 {
949 case 1 : // click action to slidenumber
950 {
951 rStrm.WriteUInt32( 0x1f ).WriteUInt32( 1 ).WriteUInt32( 0 ); // path
952 rStrm.WriteUInt32( 0x1f ).WriteUInt32( nUrlLen + 1 );
953 for ( sal_Int32 i = 0; i < nUrlLen; i++ )
954 {
955 rStrm.WriteUInt16( rUrl[ i ] );
956 }
957 rStrm.WriteUInt16( 0 );
958 }
959 break;
960 case 2 :
961 {
962 sal_Int32 i;
963
964 rStrm .WriteUInt32( 0x1f )
965 .WriteUInt32( nUrlLen + 1 );
966 for ( i = 0; i < nUrlLen; i++ )
967 {
968 rStrm.WriteUInt16( rUrl[ i ] );
969 }
970 if ( ! ( i & 1 ) )
971 rStrm.WriteUInt16( 0 );
972 rStrm .WriteUInt16( 0 )
973 .WriteUInt32( 0x1f )
974 .WriteUInt32( 1 )
975 .WriteUInt32( 0 );
976 }
977 break;
978 }
979 }
980 nCurrentOfs = rStrm.Tell();
981 rStrm.Seek( nParaOfs );
982 rStrm.WriteUInt32( nCurrentOfs - ( nParaOfs + 4 ) );
983 rStrm.WriteUInt32( nParaCount );
984 rStrm.Seek( nCurrentOfs );
985}
986
988{
989 EscherSolverContainer aSolverContainer;
990
991 mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainNotes, mpStrm->Tell() );
992 mpPptEscherEx->OpenContainer( EPP_Notes );
993 mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 );
994 mpStrm->WriteUInt32( 0x80000001 ) // Number that identifies this slide
995 .WriteUInt32( 0 ); // follow nothing
996 mpPptEscherEx->OpenContainer( EPP_PPDrawing );
997 mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
998 mpPptEscherEx->EnterGroup(nullptr,nullptr);
999
1000 ImplWritePage( GetLayout( 20 ), aSolverContainer, NOTICE, true );
1001
1002 mpPptEscherEx->LeaveGroup();
1003 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1004 mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, ShapeFlag::Background | ShapeFlag::HaveShapeProperty );
1005 EscherPropertyContainer aPropOpt;
1006 aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color
1007 aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
1008 aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x68bdde );
1009 aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x8b9f8e );
1010 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
1011 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0 );
1013 aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape
1014 aPropOpt.Commit( *mpStrm );
1015 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
1016
1017 aSolverContainer.WriteSolver( *mpStrm );
1018
1019 mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
1020 mpPptEscherEx->CloseContainer(); // EPP_Drawing
1021 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
1022 mpStrm->WriteUInt32( 0xffffff ).WriteUInt32( 0x000000 ).WriteUInt32( 0x808080 ).WriteUInt32( 0x000000 ).WriteUInt32( 0x99cc00 ).WriteUInt32( 0xcc3333 ).WriteUInt32( 0xffcccc ).WriteUInt32( 0xb2b2b2 );
1023 mpPptEscherEx->CloseContainer(); // EPP_Notes
1024 return true;
1025}
1026
1027static OUString getInitials( const OUString& rName )
1028{
1029 OUStringBuffer sInitials;
1030
1031 const sal_Unicode * pStr = rName.getStr();
1032 sal_Int32 nLength = rName.getLength();
1033
1034 while( nLength )
1035 {
1036 // skip whitespace
1037 while( nLength && (*pStr <= ' ') )
1038 {
1039 nLength--; pStr++;
1040 }
1041
1042 // take letter
1043 if( nLength )
1044 {
1045 sInitials.append( *pStr );
1046 nLength--; pStr++;
1047 }
1048
1049 // skip letters until whitespace
1050 while( nLength && (*pStr > ' ') )
1051 {
1052 nLength--; pStr++;
1053 }
1054 }
1055
1056 return sInitials.makeStringAndClear();
1057}
1058
1059void ImplExportComments( const uno::Reference< drawing::XDrawPage >& xPage, SvMemoryStream& rBinaryTagData10Atom )
1060{
1061 try
1062 {
1063 uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW );
1064 uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
1065
1066 sal_Int32 nIndex = 1;
1067
1068 while( xAnnotationEnumeration->hasMoreElements() )
1069 {
1070 EscherExContainer aComment10( rBinaryTagData10Atom, EPP_Comment10 );
1071 {
1072 uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() );
1073
1074 geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() );
1077
1078 OUString sAuthor( xAnnotation->getAuthor() );
1079 uno::Reference< text::XText > xText( xAnnotation->getTextRange() );
1080 OUString sText( xText->getString() );
1081 OUString sInitials( getInitials( sAuthor ) );
1082 util::DateTime aDateTime( xAnnotation->getDateTime() );
1083 if ( !sAuthor.isEmpty() )
1084 PPTWriter::WriteCString( rBinaryTagData10Atom, sAuthor );
1085 if ( !sText.isEmpty() )
1086 PPTWriter::WriteCString( rBinaryTagData10Atom, sText, 1 );
1087 if ( !sInitials.isEmpty() )
1088 PPTWriter::WriteCString( rBinaryTagData10Atom, sInitials, 2 );
1089
1090 sal_Int16 nMilliSeconds = static_cast<sal_Int16>(::rtl::math::round(static_cast<double>(aDateTime.NanoSeconds) / 1000000000.0));
1091 EscherExAtom aCommentAtom10( rBinaryTagData10Atom, EPP_CommentAtom10 );
1092 rBinaryTagData10Atom.WriteInt32( nIndex++ )
1093 .WriteInt16( aDateTime.Year )
1094 .WriteUInt16( aDateTime.Month )
1095 .WriteUInt16( aDateTime.Day ) // todo: day of week
1096 .WriteUInt16( aDateTime.Day )
1097 .WriteUInt16( aDateTime.Hours )
1098 .WriteUInt16( aDateTime.Minutes )
1099 .WriteUInt16( aDateTime.Seconds )
1100 .WriteInt16( nMilliSeconds )
1101 .WriteInt32( aPoint.X() )
1102 .WriteInt32( aPoint.Y() );
1103 }
1104 }
1105 }
1106 catch ( uno::Exception& )
1107 {
1108 }
1109}
1110
1111void PPTWriter::ImplWriteNotes( sal_uInt32 nPageNum )
1112{
1113 mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Notes | nPageNum, mpStrm->Tell() );
1114 mpPptEscherEx->OpenContainer( EPP_Notes );
1115 mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 );
1116 mpStrm->WriteUInt32( nPageNum + 0x100 )
1117 .WriteUInt16( 3 ) // follow master...
1118 .WriteUInt16( 0 );
1119
1121
1122 EscherSolverContainer aSolverContainer;
1123
1124 mpPptEscherEx->OpenContainer( EPP_PPDrawing );
1125 mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
1126 mpPptEscherEx->EnterGroup(nullptr,nullptr);
1127
1128 ImplWritePage( GetLayout( 20 ), aSolverContainer, NOTICE, false ); // the shapes of the pages are created in the PPT document
1129
1130 mpPptEscherEx->LeaveGroup();
1131 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1132 mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, ShapeFlag::Background | ShapeFlag::HaveShapeProperty );
1133 EscherPropertyContainer aPropOpt;
1134 aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color
1135 aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
1136 aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x8b9f8e );
1137 aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x68bdde );
1138 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
1139 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
1141 aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
1142 aPropOpt.Commit( *mpStrm );
1143 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
1144
1145 aSolverContainer.WriteSolver( *mpStrm );
1146
1147 mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
1148 mpPptEscherEx->CloseContainer(); // EPP_Drawing
1149 mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
1150 mpStrm->WriteUInt32( 0xffffff ).WriteUInt32( 0x000000 ).WriteUInt32( 0x808080 ).WriteUInt32( 0x000000 ).WriteUInt32( 0x99cc00 ).WriteUInt32( 0xcc3333 ).WriteUInt32( 0xffcccc ).WriteUInt32( 0xb2b2b2 );
1151 mpPptEscherEx->CloseContainer(); // EPP_Notes
1152};
1153
1154void PPTWriter::ImplWriteBackground( css::uno::Reference< css::beans::XPropertySet > const & rXPropSet )
1155{
1156 //************************ ******
1157 //** DEFAULT BACKGROUND SHAPE **
1158
1159 sal_uInt32 nFillColor = 0xffffff;
1160 sal_uInt32 nFillBackColor = 0;
1161
1162 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1163 mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, ShapeFlag::Background | ShapeFlag::HaveShapeProperty );
1164
1165 // #i121183# Use real PageSize in 100th mm
1166 ::tools::Rectangle aRect(Point(0, 0), Size(maPageSize.Width, maPageSize.Height));
1167
1168 EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm.get(), aRect );
1170 css::drawing::FillStyle aFS( css::drawing::FillStyle_NONE );
1171 if ( ImplGetPropertyValue( rXPropSet, "FillStyle" ) )
1172 mAny >>= aFS;
1173
1174 switch( aFS )
1175 {
1176 case css::drawing::FillStyle_GRADIENT :
1177 {
1178 aPropOpt.CreateGradientProperties( rXPropSet );
1179 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x1f001e );
1180 aPropOpt.GetOpt( ESCHER_Prop_fillColor, nFillColor );
1181 aPropOpt.GetOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
1182 }
1183 break;
1184
1185 case css::drawing::FillStyle_BITMAP :
1186 aPropOpt.CreateGraphicProperties( rXPropSet, "FillBitmap", true );
1187 break;
1188
1189 case css::drawing::FillStyle_HATCH :
1190 aPropOpt.CreateGraphicProperties( rXPropSet, "FillHatch", true );
1191 break;
1192
1193 case css::drawing::FillStyle_SOLID :
1194 {
1195 if ( ImplGetPropertyValue( rXPropSet, "FillColor" ) )
1196 {
1197 nFillColor = EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(mAny) );
1198 nFillBackColor = nFillColor ^ 0xffffff;
1199 }
1200 [[fallthrough]];
1201 }
1202 case css::drawing::FillStyle_NONE :
1203 default:
1204 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
1205 break;
1206 }
1207 aPropOpt.AddOpt( ESCHER_Prop_fillColor, nFillColor );
1208 aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
1209 aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) );
1210 aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Height ) );
1211 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
1213 aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
1214 aPropOpt.Commit( *mpStrm );
1215 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
1216}
1217
1219{
1220 if ( mpVBA )
1221 {
1222 sal_uInt32 nLen = mpVBA->TellEnd();
1223 if ( nLen > 8 )
1224 {
1225 nLen -= 8;
1226 mnVBAOleOfs = mpStrm->Tell();
1227 mpPptEscherEx->BeginAtom();
1228 mpStrm->WriteBytes(static_cast<sal_Int8 const *>(mpVBA->GetData()) + 8, nLen);
1229 mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
1230 }
1231 }
1232}
1233
1235{
1236
1237 SvxMSExportOLEObjects aOleExport( mnCnvrtFlags );
1238
1239 for ( const auto& rxExOleObjEntry : maExOleObj )
1240 {
1241 PPTExOleObjEntry* pPtr = rxExOleObjEntry.get();
1242 std::unique_ptr<SvMemoryStream> pStrm;
1243 pPtr->nOfsB = mpStrm->Tell();
1244 switch ( pPtr->eType )
1245 {
1246 case NORMAL_OLE_OBJECT :
1247 {
1249 if ( auto pSdrOle2Obj = dynamic_cast< SdrOle2Obj* >(pSdrObj) )
1250 {
1251 const ::uno::Reference < embed::XEmbeddedObject >& xObj( pSdrOle2Obj->GetObjRef() );
1252 if( xObj.is() )
1253 {
1254 tools::SvRef<SotStorage> xTempStorage( new SotStorage( new SvMemoryStream(), true ) );
1255 aOleExport.ExportOLEObject( xObj, *xTempStorage );
1256
1257 //TODO/MBA: testing
1258 SvMemoryStream aStream;
1259 tools::SvRef<SotStorage> xCleanStorage( new SotStorage( false, aStream ) );
1260 xTempStorage->CopyTo( xCleanStorage.get() );
1261 // create a dummy content stream, the dummy content is necessary for ppt, but not for
1262 // doc files, so we can't share code.
1263 tools::SvRef<SotStorageStream> xStm = xCleanStorage->OpenSotStream( SVEXT_PERSIST_STREAM );
1264 xStm->WriteUInt32( 0 ) // no ClipboardId
1265 .WriteUInt32( 4 ) // no target device
1266 .WriteUInt32( 1 ) // aspect ratio
1267 .WriteInt32( -1 ) // L-Index
1268 .WriteUInt32( 0 ) // Advanced Flags
1269 .WriteUInt32( 0 ) // compression
1270 .WriteUInt32( 0 ) // Size
1271 .WriteUInt32( 0 ) // "
1272 .WriteUInt32( 0 );
1273 pStrm = xCleanStorage->CreateMemoryStream();
1274 }
1275 }
1276 }
1277 break;
1278
1279 case OCX_CONTROL :
1280 {
1281 if ( pPtr->xControlModel.is() )
1282 {
1283 OUString aName;
1284 //Initialize the graphic size which will be used on export
1285 css::awt::Size aSize( pPtr->xShape->getSize() );
1286 tools::SvRef<SotStorage> xDest( new SotStorage( new SvMemoryStream(), true ) );
1288 if ( bOk )
1289 pStrm = xDest->CreateMemoryStream();
1290 }
1291 }
1292 }
1293 if ( pStrm )
1294 {
1295 mpPptEscherEx->BeginAtom();
1296 pStrm->Seek( STREAM_SEEK_TO_END );
1297 sal_uInt32 npStrmSize = pStrm->Tell();
1298 mpStrm->WriteUInt32( npStrmSize ); // uncompressed size
1299
1300 pStrm->Seek( 0 );
1301 ZCodec aZCodec( 0x8000, 0x8000 );
1302 aZCodec.BeginCompression();
1303 aZCodec.Compress( *pStrm, *mpStrm );
1304 aZCodec.EndCompression();
1305 pStrm.reset();
1306 mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
1307 }
1308 }
1309}
1310
1311// write PersistantTable and UserEditAtom
1312
1314{
1315
1316#define EPP_LastViewTypeSlideView 1
1317
1318 sal_uInt32 i, nPos, nOfs, nPersistOfs = mpStrm->Tell();
1319 sal_uInt32 nPersistEntrys = 0;
1320 mpStrm->WriteUInt32( 0 ).WriteUInt32( 0 ).WriteUInt32( 0 ); // skip record header and first entry
1321
1322 // write document persist
1323 nPersistEntrys++;
1324 mpStrm->WriteUInt32( 0 );
1325 // write MasterPages persists
1326 for ( i = 0; i < mnMasterPages; i++ )
1327 {
1328 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_MainMaster | i );
1329 if ( nOfs )
1330 {
1331 mpStrm->WriteUInt32( nOfs );
1332 mpPptEscherEx->InsertAtPersistOffset( EPP_MAINMASTER_PERSIST_KEY | i, ++nPersistEntrys );
1333 }
1334 }
1335 // write MainNotesMaster persist
1336 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_MainNotes );
1337 if ( nOfs )
1338 {
1339 mpStrm->WriteUInt32( nOfs );
1340 mpPptEscherEx->InsertAtPersistOffset( EPP_MAINNOTESMASTER_PERSIST_KEY, ++nPersistEntrys );
1341 }
1342 // write slide persists -> we have to write a valid value into EPP_SlidePersistAtome too
1343 for ( i = 0; i < mnPages; i++ )
1344 {
1345 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Slide | i );
1346 if ( nOfs )
1347 {
1348 mpStrm->WriteUInt32( nOfs );
1349 mpPptEscherEx->InsertAtPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, ++nPersistEntrys );
1350 }
1351 }
1352 // write Notes persists
1353 for ( i = 0; i < mnPages; i++ )
1354 {
1355 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Notes | i );
1356 if ( nOfs )
1357 {
1358 mpStrm->WriteUInt32( nOfs );
1359 mpPptEscherEx->InsertAtPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, ++nPersistEntrys );
1360 }
1361 }
1362 // Ole persists
1363 for ( const auto& rxExOleObjEntry : maExOleObj )
1364 {
1365 PPTExOleObjEntry* pPtr = rxExOleObjEntry.get();
1366 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_ExObj );
1367 if ( nOfs )
1368 {
1369 nPersistEntrys++;
1370 mpStrm->WriteUInt32( pPtr->nOfsB );
1371 sal_uInt32 nOldPos, nPersOfs = nOfs + pPtr->nOfsA + 16 + 8; // 8 bytes atom header, +16 to the persist entry
1372 nOldPos = mpStrm->Tell();
1373 mpStrm->Seek( nPersOfs );
1374 mpStrm->WriteUInt32( nPersistEntrys );
1375 mpStrm->Seek( nOldPos );
1376 }
1377 }
1378 // VB persist
1379 if ( mnVBAOleOfs && mpVBA )
1380 {
1381 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_VBAInfoAtom );
1382 if ( nOfs )
1383 {
1384 nPersistEntrys++;
1385 sal_uInt32 n1, n2;
1386
1387 mpVBA->Seek( 0 );
1388 mpVBA->ReadUInt32( n1 )
1389 .ReadUInt32( n2 );
1390
1391 mpStrm->WriteUInt32( mnVBAOleOfs );
1392 sal_uInt32 nOldPos = mpStrm->Tell();
1393 mpStrm->Seek( nOfs ); // Fill the VBAInfoAtom with the correct index to the persisttable
1394 mpStrm->WriteUInt32( nPersistEntrys )
1395 .WriteUInt32( n1 )
1396 .WriteInt32( 2 );
1397 mpStrm->Seek( nOldPos );
1398
1399 }
1400 }
1401 nPos = mpStrm->Tell();
1402 mpStrm->Seek( nPersistOfs );
1403 mpPptEscherEx->AddAtom( ( nPersistEntrys + 1 ) << 2, EPP_PersistPtrIncrementalBlock ); // insert Record Header
1404 mpStrm->WriteUInt32( ( nPersistEntrys << 20 ) | 1 );
1405 mpStrm->Seek( nPos );
1406
1407 mpCurUserStrm->WriteUInt32( nPos ); // set offset to current edit
1408 mpPptEscherEx->AddAtom( 28, EPP_UserEditAtom );
1409 mpStrm->WriteInt32( 0x100 ) // last slide ID
1410 .WriteUInt32( 0x03000dbc ) // minor and major app version that did the save
1411 .WriteUInt32( 0 ) // offset last save, 0 after a full save
1412 .WriteUInt32( nPersistOfs ) // File offset to persist pointers for this save operation
1413 .WriteUInt32( 1 ) // Persist reference to the document persist object
1414 .WriteUInt32( nPersistEntrys ) // max persists written, Seed value for persist object id management
1415 .WriteInt16( EPP_LastViewTypeSlideView ) // last view type
1416 .WriteInt16( 0x12 ); // padword
1417}
1418
1419// - exported function -
1420
1421SAL_DLLPUBLIC_EXPORT bool ExportPPT( const std::vector< css::beans::PropertyValue >& rMediaData,
1422 tools::SvRef<SotStorage> const & rSvStorage,
1423 css::uno::Reference< css::frame::XModel > const & rXModel,
1424 css::uno::Reference< css::task::XStatusIndicator > const & rXStatInd,
1425 SvMemoryStream* pVBA,
1426 sal_uInt32 nCnvrtFlags )
1427{
1428 PPTWriter aPPTWriter( rSvStorage, rXModel, rXStatInd, pVBA, nCnvrtFlags );
1429 aPPTWriter.exportPPT(rMediaData);
1430 bool bStatus = aPPTWriter.IsValid();
1431 return bStatus;
1432}
1433
1434SAL_DLLPUBLIC_EXPORT bool SaveVBA( SfxObjectShell& rDocShell, SvMemoryStream*& pBas )
1435{
1436 tools::SvRef<SotStorage> xDest( new SotStorage( new SvMemoryStream(), true ) );
1437 SvxImportMSVBasic aMSVBas( rDocShell, *xDest );
1438 aMSVBas.SaveOrDelMSVBAStorage( true, "_MS_VBA_Overhead" );
1439
1440 tools::SvRef<SotStorage> xOverhead = xDest->OpenSotStorage( "_MS_VBA_Overhead" );
1441 if ( xOverhead.is() && ( xOverhead->GetError() == ERRCODE_NONE ) )
1442 {
1443 tools::SvRef<SotStorage> xOverhead2 = xOverhead->OpenSotStorage( "_MS_VBA_Overhead" );
1444 if ( xOverhead2.is() && ( xOverhead2->GetError() == ERRCODE_NONE ) )
1445 {
1446 tools::SvRef<SotStorageStream> xTemp = xOverhead2->OpenSotStream( "_MS_VBA_Overhead2" );
1447 if ( xTemp.is() && ( xTemp->GetError() == ERRCODE_NONE ) )
1448 {
1449 sal_uInt32 nLen = xTemp->GetSize();
1450 if ( nLen )
1451 {
1452 char* pTemp = new char[ nLen ];
1453 xTemp->Seek( STREAM_SEEK_TO_BEGIN );
1454 xTemp->ReadBytes(pTemp, nLen);
1455 pBas = new SvMemoryStream( pTemp, nLen, StreamMode::READ );
1456 pBas->ObjectOwnsMemory( true );
1457 return true;
1458 }
1459 }
1460 }
1461 }
1462
1463 return false;
1464}
1465
1466/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static sal_uInt32 GetColor(const sal_uInt32 nColor)
bool CreateGraphicProperties(const css::uno::Reference< css::drawing::XShape > &rXShape, const GraphicObject &rGraphicObj)
void AddOpt(sal_uInt16 nPropID, bool bBlib, sal_uInt32 nSizeReduction, SvMemoryStream &rStream)
void CreateGradientProperties(const css::awt::Gradient &rGradient)
bool GetOpt(sal_uInt16 nPropertyID, sal_uInt32 &rPropValue) const
void Commit(SvStream &rSt, sal_uInt16 nVersion=3, sal_uInt16 nRecType=ESCHER_OPT)
void WriteSolver(SvStream &)
std::unique_ptr< PPTExCharSheet > mpCharSheet[PPTEX_STYLESHEETENTRIES]
Definition: epptbase.hxx:303
std::unique_ptr< PPTExParaSheet > mpParaSheet[PPTEX_STYLESHEETENTRIES]
Definition: epptbase.hxx:304
bool mbStatusIndicator
Definition: epptbase.hxx:325
PPTExStyleSheet * mpStyleSheet
Definition: epptbase.hxx:356
bool GetPageByIndex(sal_uInt32 nIndex, PageType)
std::vector< std::unique_ptr< PPTExStyleSheet > > maStyleSheetList
Definition: epptbase.hxx:355
static PHLayout const & GetLayout(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
css::awt::Size maPageSize
Definition: epptbase.hxx:351
sal_uInt32 GetMasterIndex(PageType ePageType)
sal_uInt32 mnMasterPages
Definition: epptbase.hxx:345
css::uno::Reference< css::beans::XPropertySet > mXPagePropSet
Definition: epptbase.hxx:331
css::uno::Reference< css::task::XStatusIndicator > mXStatusIndicator
Definition: epptbase.hxx:323
void exportPPT(const std::vector< css::beans::PropertyValue > &)
static sal_Int8 GetTransition(sal_Int16 nTransitionType, sal_Int16 nTransitionSubtype, css::presentation::FadeEffect eEffect, sal_Int32 nTransitionFadeColor, sal_uInt8 &nDirection)
sal_uInt32 mnPages
number of Slides ( w/o master pages & notes & handout )
Definition: epptbase.hxx:344
void SetCurrentStyleSheet(sal_uInt32 nPageNum)
css::uno::Reference< css::frame::XModel > mXModel
Definition: epptbase.hxx:322
css::uno::Reference< css::drawing::XDrawPage > mXDrawPage
Definition: epptbase.hxx:330
css::awt::Size maNotesPageSize
Definition: epptbase.hxx:352
css::awt::Size maDestPageSize
Definition: epptbase.hxx:350
std::vector< std::unique_ptr< PPTExOleObjEntry > > maExOleObj
Definition: eppt.hxx:136
sal_uInt32 mnDiaMode
Definition: eppt.hxx:144
OUString maBaseURI
Definition: eppt.hxx:122
sal_uInt32 mnCnvrtFlags
Definition: eppt.hxx:116
void ImplCreateDocumentSummaryInformation()
Definition: eppt.cxx:492
sal_uInt32 mnStatMaxValue
Definition: eppt.hxx:118
bool ImplCloseDocument()
Definition: epptso.cxx:376
virtual void ImplWriteSlideMaster(sal_uInt32 nPageNum, css::uno::Reference< css::beans::XPropertySet > const &aXBackgroundPropSet) override
Definition: eppt.cxx:364
bool mbStatus
Definition: eppt.hxx:117
sal_uInt32 mnVBAOleOfs
Definition: eppt.hxx:137
tools::SvRef< SotStorageStream > mpStrm
Definition: eppt.hxx:132
sal_uInt32 mnLatestStatValue
Definition: eppt.hxx:119
void ImplWriteVBA()
Definition: eppt.cxx:1218
std::vector< EPPTHyperlink > maHyperlink
Definition: eppt.hxx:151
bool IsValid() const
Definition: eppt.hxx:227
void ImplWritePage(const PHLayout &rLayout, EscherSolverContainer &rSolver, PageType ePageType, bool bMaster, int nPageNumber=0)
Definition: epptso.cxx:1603
sal_uInt32 ImplProgTagContainer(SvStream *pOutStrm, SvMemoryStream *pBinTag=nullptr)
Definition: epptso.cxx:274
bool ImplCreateCurrentUserStream()
Definition: eppt.cxx:462
void ImplCreateHyperBlob(SvMemoryStream &rStream)
Definition: eppt.cxx:907
ppt::ExSoundCollection maSoundCollection
Definition: eppt.hxx:153
virtual bool ImplCreateDocument() override
Definition: eppt.cxx:658
std::vector< OUString > maSlideNameList
Definition: eppt.hxx:121
void ImplWriteExtParaHeader(SvMemoryStream &rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId)
Definition: eppt.cxx:539
virtual void ImplWriteNotes(sal_uInt32 nPageNum) override
Definition: eppt.cxx:1111
std::unique_ptr< PptEscherEx > mpPptEscherEx
Definition: eppt.hxx:134
tools::SvRef< SotStorageStream > mpCurUserStrm
Definition: eppt.hxx:131
static void ImplCreateHeaderFooterStrings(SvStream &rOut, css::uno::Reference< css::beans::XPropertySet > const &rXPagePropSet)
Definition: eppt.cxx:552
static void WriteCString(SvStream &, std::u16string_view, sal_uInt32 nInstance=0)
Definition: epptso.cxx:3032
virtual void ImplWriteSlide(sal_uInt32 nPageNum, sal_uInt32 nMasterID, sal_uInt16 nMode, bool bHasBackground, css::uno::Reference< css::beans::XPropertySet > const &aXBackgroundPropSet) override
Definition: eppt.cxx:154
PPTWriter(tools::SvRef< SotStorage > xSvStorage, css::uno::Reference< css::frame::XModel > const &rModel, css::uno::Reference< css::task::XStatusIndicator > const &rStatInd, SvMemoryStream *pVBA, sal_uInt32 nCnvrtFlags)
Definition: eppt.cxx:68
void ImplWriteOLE()
Definition: eppt.cxx:1234
virtual void exportPPTPre(const std::vector< css::beans::PropertyValue > &) override
Definition: eppt.cxx:93
virtual ~PPTWriter() override
Definition: eppt.cxx:449
void ImplWriteBackground(css::uno::Reference< css::beans::XPropertySet > const &rXBackgroundPropSet)
Definition: eppt.cxx:1154
std::unique_ptr< SvMemoryStream > mpExEmbed
Definition: eppt.hxx:140
tools::SvRef< SotStorageStream > mpPicStrm
Definition: eppt.hxx:133
virtual bool ImplCreateMainNotes() override
Definition: eppt.cxx:987
virtual void exportPPTPost() override
Definition: eppt.cxx:125
tools::SvRef< SotStorage > mrStg
Definition: eppt.hxx:130
void ImplWriteAtomEnding()
Definition: eppt.cxx:1313
void ImplCreateHeaderFooters(css::uno::Reference< css::beans::XPropertySet > const &rXPagePropSet)
Definition: eppt.cxx:576
SvMemoryStream * mpVBA
Definition: eppt.hxx:138
constexpr tools::Long Y() const
constexpr tools::Long X() const
css::uno::Any mAny
Definition: epptbase.hxx:98
css::uno::Reference< css::beans::XPropertySet > mXPropSet
Definition: epptbase.hxx:99
static bool GetPropertyValue(css::uno::Any &rAny, const css::uno::Reference< css::beans::XPropertySet > &, const OUString &rPropertyName, bool bTestPropertyAvailability=false)
Definition: epptso.cxx:532
bool ImplGetPropertyValue(const OUString &rString)
Definition: epptso.cxx:587
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
const void * GetData()
virtual sal_uInt64 TellEnd() override
void ObjectOwnsMemory(bool bOwn)
SvStream & WriteInt32(sal_Int32 nInt32)
sal_uInt64 Tell() const
std::size_t WriteBytes(const void *pData, std::size_t nSize)
SvStream & WriteInt16(sal_Int16 nInt16)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
sal_uInt64 Seek(sal_uInt64 nPos)
ErrCode SaveOrDelMSVBAStorage(bool bSaveInto, const OUString &rStorageName)
void ExportOLEObject(svt::EmbeddedObjectRef const &rObj, SotStorage &rDestStg)
tools::Long EndCompression()
void BeginCompression(int nCompressLevel=ZCODEC_DEFAULT_COMPRESSION, bool gzLib=false)
void Compress(SvStream &rIStm, SvStream &rOStm)
#define MSO_PPT8_CLASSID
static bool WriteOCXStream(const css::uno::Reference< css::frame::XModel > &rxModel, tools::SvRef< SotStorage > const &rSrc1, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size &rSize, OUString &rName)
void doexport(const css::uno::Reference< css::drawing::XDrawPage > &xPage, SvStream &rStrm)
sal_uInt32 GetId(const OUString &)
T * get() const
bool is() const
SAL_DLLPUBLIC_EXPORT bool SaveVBA(SfxObjectShell &rDocShell, SvMemoryStream *&pBas)
Definition: eppt.cxx:1434
static void ImplExportComments(const uno::Reference< drawing::XDrawPage > &xPage, SvMemoryStream &rBinaryTagData10Atom)
Definition: eppt.cxx:1059
static OUString getInitials(const OUString &rName)
Definition: eppt.cxx:1027
SAL_DLLPUBLIC_EXPORT bool ExportPPT(const std::vector< css::beans::PropertyValue > &rMediaData, tools::SvRef< SotStorage > const &rSvStorage, css::uno::Reference< css::frame::XModel > const &rXModel, css::uno::Reference< css::task::XStatusIndicator > const &rXStatInd, SvMemoryStream *pVBA, sal_uInt32 nCnvrtFlags)
Definition: eppt.cxx:1421
#define EPP_LastViewTypeSlideView
#define EPP_Persist_MainNotes
Definition: eppt.hxx:53
#define EPP_Persist_VBAInfoAtom
Definition: eppt.hxx:57
@ OCX_CONTROL
Definition: eppt.hxx:80
@ NORMAL_OLE_OBJECT
Definition: eppt.hxx:80
#define EPP_MAINSLIDE_PERSIST_KEY
Definition: eppt.hxx:48
#define EPP_MAINNOTESMASTER_PERSIST_KEY
Definition: eppt.hxx:47
#define EPP_Persist_Slide
Definition: eppt.hxx:54
#define EPP_MAINNOTES_PERSIST_KEY
Definition: eppt.hxx:49
#define EPP_Persist_ExObj
Definition: eppt.hxx:58
#define EPP_Persist_Notes
Definition: eppt.hxx:55
#define EPP_Persist_MainMaster
Definition: eppt.hxx:52
#define EPP_Persist_Document
Definition: eppt.hxx:51
#define EPP_MAINMASTER_PERSIST_KEY
Definition: eppt.hxx:46
@ NORMAL
Definition: epptbase.hxx:92
@ MASTER
Definition: epptbase.hxx:92
@ NOTICE
Definition: epptbase.hxx:92
@ TITLEANDBODYSLIDE
#define EPP_SlidePersistAtom
Definition: epptdef.hxx:30
#define EPP_PersistPtrIncrementalBlock
Definition: epptdef.hxx:111
#define EPP_NamedShows
Definition: epptdef.hxx:45
#define EPP_TEXTTYPE_CenterBody
Definition: epptdef.hxx:134
#define EPP_SSSlideInfoAtom
Definition: epptdef.hxx:32
#define EPP_PPDrawing
Definition: epptdef.hxx:44
#define EPP_NamedShowSlides
Definition: epptdef.hxx:47
#define EPP_SLIDESIZE_TYPEONSCREEN
Definition: epptdef.hxx:139
#define EPP_Comment10
Definition: epptdef.hxx:112
#define EPP_HeadersFooters
Definition: epptdef.hxx:88
#define EPP_SLIDESIZE_TYPEBANNER
Definition: epptdef.hxx:142
#define EPP_NotesAtom
Definition: epptdef.hxx:28
#define EPP_CString
Definition: epptdef.hxx:79
#define EPP_TEXTTYPE_Notes
Definition: epptdef.hxx:131
#define EPP_TxMasterStyleAtom
Definition: epptdef.hxx:65
#define EPP_TEXTTYPE_QuarterBody
Definition: epptdef.hxx:137
#define EPP_ProgTags
Definition: epptdef.hxx:108
#define EPP_PST_ExtendedParagraphHeaderAtom
Definition: epptdef.hxx:75
#define EPP_TEXTTYPE_Title
Definition: epptdef.hxx:129
#define EPP_EndDocument
Definition: epptdef.hxx:24
#define EPP_SlideAtom
Definition: epptdef.hxx:26
#define EPP_NamedShow
Definition: epptdef.hxx:46
#define EPP_Document
Definition: epptdef.hxx:22
#define EPP_ExOleObjStg
Definition: epptdef.hxx:106
#define EPP_CurrentUserAtom
Definition: epptdef.hxx:98
#define EPP_SLIDESIZE_TYPEA4PAPER
Definition: epptdef.hxx:140
#define EPP_SSDocInfoAtom
Definition: epptdef.hxx:39
#define EPP_Slide
Definition: epptdef.hxx:25
#define EPP_CommentAtom10
Definition: epptdef.hxx:113
#define EPP_TEXTTYPE_notUsed
Definition: epptdef.hxx:132
#define EPP_DocumentAtom
Definition: epptdef.hxx:23
#define EPP_UserEditAtom
Definition: epptdef.hxx:97
#define EPP_HeadersFootersAtom
Definition: epptdef.hxx:89
#define EPP_SlideListWithText
Definition: epptdef.hxx:93
#define EPP_ProgBinaryTag
Definition: epptdef.hxx:109
#define EPP_ColorSchemeAtom
Definition: epptdef.hxx:54
#define EPP_BinaryTagData
Definition: epptdef.hxx:110
#define EPP_MainMaster
Definition: epptdef.hxx:31
#define EPP_SLIDESIZE_TYPECUSTOM
Definition: epptdef.hxx:143
#define EPP_Notes
Definition: epptdef.hxx:27
#define EPP_SLIDESIZE_TYPE35MM
Definition: epptdef.hxx:141
#define ERRCODE_NONE
ESCHER_FillSolid
#define ESCHER_Prop_fNoFillHitTest
#define ESCHER_Prop_fNoLineDrawDash
ESCHER_bwWhite
ESCHER_wDontShow
#define ESCHER_Prop_bWMode
#define ESCHER_DgContainer
#define ESCHER_Prop_fillBackColor
#define ESCHER_Prop_fillRectBottom
#define ESCHER_ShpInst_Rectangle
#define ESCHER_Prop_fBackground
#define ESCHER_Prop_fillType
#define ESCHER_SpContainer
#define ESCHER_Prop_fillColor
#define ESCHER_Prop_fillRectRight
SvxTimeFormat
SvxDateFormat
sal_Int16 nValue
sal_Int32 nIndex
OUString aName
sal_Int32 nRef
sal_uInt16 nPos
int n2
int n1
constexpr OUStringLiteral SVEXT_PERSIST_STREAM
int i
void SvStream & rStrm
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
bool SaveOlePropertySet(const uno::Reference< document::XDocumentProperties > &i_xDocProps, SotStorage *i_pStorage, const uno::Sequence< sal_Int8 > *i_pThumb, const uno::Sequence< sal_Int8 > *i_pGuid, const uno::Sequence< sal_Int8 > *i_pHyperlinks)
#define STREAM_SEEK_TO_END
#define STREAM_SEEK_TO_BEGIN
sal_uInt8 nPlaceHolder[8]
Definition: epptbase.hxx:81
EppLayout nLayout
Definition: epptbase.hxx:80
PPTExOleObjEntryType eType
Definition: eppt.hxx:85
sal_uInt32 nOfsB
offset to the EPP_ExOleObjStg
Definition: eppt.hxx:87
css::uno::Reference< css::awt::XControlModel > xControlModel
Definition: eppt.hxx:89
sal_uInt32 nOfsA
offset to the EPP_ExOleObjAtom in mpExEmbed (set at creation)
Definition: eppt.hxx:86
css::uno::Reference< css::drawing::XShape > xShape
Definition: eppt.hxx:90
bool bVisible
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
signed char sal_Int8
sal_Int32 nLength