LibreOffice Module sd (master) 1
epptso.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 <memory>
21#include <sal/config.h>
22
24#include <o3tl/any.hxx>
25#include "eppt.hxx"
26#include "text.hxx"
27#include "epptdef.hxx"
28#include "escherex.hxx"
29#include <tools/poly.hxx>
30#include <tools/stream.hxx>
31#include <tools/fontenum.hxx>
33#include <sot/storage.hxx>
34#include <vcl/graph.hxx>
35#include <editeng/svxenum.hxx>
36#include <svx/svdobj.hxx>
37#include <com/sun/star/awt/FontFamily.hpp>
38#include <com/sun/star/awt/FontPitch.hpp>
39#include <com/sun/star/awt/Rectangle.hpp>
40#include <com/sun/star/awt/FontDescriptor.hpp>
41#include <com/sun/star/frame/XModel.hpp>
42#include <com/sun/star/style/TabStop.hpp>
43#include <com/sun/star/drawing/CircleKind.hpp>
44#include <com/sun/star/drawing/FillStyle.hpp>
45#include <com/sun/star/drawing/XShapes.hpp>
46#include <com/sun/star/beans/XPropertyState.hpp>
47#include <com/sun/star/drawing/XControlShape.hpp>
48#include <com/sun/star/embed/Aspects.hpp>
49#include <tools/urlobj.hxx>
50#include <com/sun/star/text/XSimpleText.hpp>
51#include <com/sun/star/task/XStatusIndicator.hpp>
52#include <com/sun/star/table/XTable.hpp>
53#include <com/sun/star/table/XMergeableCell.hpp>
54#include <com/sun/star/table/BorderLine.hpp>
55#include <com/sun/star/table/XColumnRowRange.hpp>
56#include <com/sun/star/table/XCellRange.hpp>
57#include <oox/ole/olehelper.hxx>
59
60using namespace ::com::sun::star;
61
62#define ANSI_CHARSET 0
63#define SYMBOL_CHARSET 2
64
65/* Font Families */
66#define FF_ROMAN 0x10
67#define FF_SWISS 0x20
68#define FF_MODERN 0x30
69#define FF_SCRIPT 0x40
70#define FF_DECORATIVE 0x50
71
72#define DEFAULT_PITCH 0x00
73#define FIXED_PITCH 0x01
74
75PPTExBulletProvider::PPTExBulletProvider()
77{
78}
79
80PPTExBulletProvider::~PPTExBulletProvider()
81{
82}
83
84sal_uInt16 PPTExBulletProvider::GetId(Graphic const & rGraphic, Size& rGraphicSize )
85{
86 sal_uInt16 nRetValue = 0xffff;
87
88 if (!rGraphic.IsNone())
89 {
90 Graphic aMappedGraphic, aGraphic(rGraphic);
91 GraphicObject aGraphicObject(aGraphic);
92 Size aPrefSize( aGraphic.GetPrefSize() );
93 BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
94
95 if ( rGraphicSize.Width() && rGraphicSize.Height() )
96 {
97 if (aPrefSize.IsEmpty())
98 {
99 aBmpEx.Scale(aPrefSize);
100 }
101 else
102 {
103 double fQ1 = static_cast<double>(aPrefSize.Width()) / static_cast<double>(aPrefSize.Height());
104 double fQ2 = static_cast<double>(rGraphicSize.Width()) / static_cast<double>(rGraphicSize.Height());
105 double fXScale = 1;
106 double fYScale = 1;
107
108 if ( fQ1 > fQ2 )
109 fYScale = fQ1 / fQ2;
110 else if ( fQ1 < fQ2 )
111 fXScale = fQ2 / fQ1;
112
113 if ( ( fXScale != 1.0 ) || ( fYScale != 1.0 ) )
114 {
115 aBmpEx.Scale( fXScale, fYScale );
116 rGraphicSize = Size( static_cast<sal_Int32>(static_cast<double>(rGraphicSize.Width()) / fXScale + 0.5 ),
117 static_cast<sal_Int32>(static_cast<double>(rGraphicSize.Height()) / fYScale + 0.5 ) );
118
119 aMappedGraphic = Graphic( aBmpEx );
120 aGraphicObject.SetGraphic(aMappedGraphic);
121 }
122 }
123 }
124 sal_uInt32 nId = pGraphicProv->GetBlibID(aBuExPictureStream, aGraphicObject);
125
126 if ( nId && ( nId < 0x10000 ) )
127 nRetValue = static_cast<sal_uInt16>(nId) - 1;
128 }
129 return nRetValue;
130}
131
133{
134 sal_uInt32 nSize = 28;
135 if ( pStrm )
136 {
137 pStrm->WriteUInt32( 0x1f | ( EPP_VBAInfo << 16 ) )
138 .WriteUInt32( nSize - 8 )
139 .WriteUInt32( 2 | ( EPP_VBAInfoAtom << 16 ) )
140 .WriteUInt32( 12 );
141 mpPptEscherEx->InsertPersistOffset( EPP_Persist_VBAInfoAtom, pStrm->Tell() );
142 pStrm->WriteUInt32( 0 )
143 .WriteUInt32( 0 )
144 .WriteUInt32( 1 );
145 }
146 return nSize;
147}
148
149sal_uInt32 PPTWriter::ImplSlideViewInfoContainer( sal_uInt32 nInstance, SvStream* pStrm )
150{
151 sal_uInt32 nSize = 111;
152 if ( pStrm )
153 {
154 sal_uInt8 bShowGuides = 0;
155 sal_uInt8 const bSnapToGrid = 1;
156 sal_uInt8 const bSnapToShape = 0;
157
158 sal_Int32 nScaling = 85;
159 sal_Int32 nMasterCoordinate = 0xdda;
160 sal_Int32 nXOrigin = -780;
161 sal_Int32 nYOrigin = -84;
162
163 sal_Int32 nPosition1 = 0x870;
164 sal_Int32 nPosition2 = 0xb40;
165
166 if ( nInstance )
167 {
168 bShowGuides = 1;
169 nScaling = 0x3b;
170 nMasterCoordinate = 0xf0c;
171 nXOrigin = -1752;
172 nYOrigin = -72;
173 nPosition1 = 0xb40;
174 nPosition2 = 0x870;
175 }
176 pStrm->WriteUInt32( 0xf | ( EPP_SlideViewInfo << 16 ) | ( nInstance << 4 ) )
177 .WriteUInt32( nSize - 8 )
179 .WriteUChar( bShowGuides ).WriteUChar( bSnapToGrid ).WriteUChar( bSnapToShape )
181 .WriteInt32( nScaling ).WriteInt32( 100 ).WriteInt32( nScaling ).WriteInt32( 100 ) // scaling atom - Keeps the current scale
182 .WriteInt32( nScaling ).WriteInt32( 100 ).WriteInt32( nScaling ).WriteInt32( 100 ) // scaling atom - Keeps the previous scale
183 .WriteInt32( 0x17ac ).WriteInt32( nMasterCoordinate )// Origin - Keeps the origin in master coordinates
184 .WriteInt32( nXOrigin ).WriteInt32( nYOrigin ) // Origin
185 .WriteUChar( 1 ) // Bool1 varScale - Set if zoom to fit is set
186 .WriteUChar( 0 ) // bool1 draftMode - Not used
187 .WriteUInt16( 0 ) // padword
188 .WriteUInt32( ( 7 << 4 ) | ( EPP_GuideAtom << 16 ) ).WriteUInt32( 8 )
189 .WriteUInt32( 0 ) // Type of the guide. If the guide is horizontal this value is zero. If it's vertical, it's one.
190 .WriteInt32( nPosition1 ) // Position of the guide in master coordinates. X coordinate if it's vertical, and Y coordinate if it's horizontal.
191 .WriteUInt32( ( 7 << 4 ) | ( EPP_GuideAtom << 16 ) ).WriteUInt32( 8 )
192 .WriteInt32( 1 ) // Type of the guide. If the guide is horizontal this value is zero. If it's vertical, it's one.
193 .WriteInt32( nPosition2 ); // Position of the guide in master coordinates. X coordinate if it's vertical, and Y coordinate if it's horizontal.
194 }
195 return nSize;
196}
197
199{
200 sal_uInt32 nSize = 68;
201 if ( pStrm )
202 {
203 pStrm->WriteUInt32( 0xf | ( EPP_OutlineViewInfo << 16 ) ).WriteUInt32( nSize - 8 )
205 .WriteInt32( 170 ).WriteInt32( 200 ).WriteInt32( 170 ).WriteInt32( 200 ) // scaling atom - Keeps the current scale
206 .WriteInt32( 170 ).WriteInt32( 200 ).WriteInt32( 170 ).WriteInt32( 200 ) // scaling atom - Keeps the previous scale
207 .WriteInt32( 0x17ac ).WriteInt32( 0xdda ) // Origin - Keeps the origin in master coordinates
208 .WriteInt32( -780 ).WriteInt32( -84 ) // Origin
209 .WriteUChar( 1 ) // bool1 varScale - Set if zoom to fit is set
210 .WriteUChar( 0 ) // bool1 draftMode - Not used
211 .WriteUInt16( 0 ); // padword
212 }
213 return nSize;
214}
215
217{
218 sal_uInt32 nPictureStreamSize, nOutlineStreamSize, nSize = 8;
219
220 nPictureStreamSize = aBuExPictureStream.Tell();
221 if ( nPictureStreamSize )
222 nSize += nPictureStreamSize + 8;
223
224 nOutlineStreamSize = aBuExOutlineStream.Tell();
225 if ( nOutlineStreamSize )
226 nSize += nOutlineStreamSize + 8;
227
228 if ( pStrm )
229 {
230 pStrm->WriteUInt32( EPP_BinaryTagData << 16 ).WriteUInt32( nSize - 8 );
231 if ( nPictureStreamSize )
232 {
233 pStrm->WriteUInt32( 0xf | ( EPP_PST_ExtendedBuGraContainer << 16 ) ).WriteUInt32( nPictureStreamSize );
234 pStrm->WriteBytes(aBuExPictureStream.GetData(), nPictureStreamSize);
235 }
236 if ( nOutlineStreamSize )
237 {
238 pStrm->WriteUInt32( 0xf | ( EPP_PST_ExtendedPresRuleContainer << 16 ) ).WriteUInt32( nOutlineStreamSize );
239 pStrm->WriteBytes(aBuExOutlineStream.GetData(), nOutlineStreamSize);
240 }
241 }
242 return nSize;
243}
244
246{
247 sal_uInt32 nSize = 8 + 8 + 14;
248 if ( pStrm )
249 {
250 pStrm->WriteUInt32( 0xf | ( EPP_ProgBinaryTag << 16 ) ).WriteUInt32( 0 )
251 .WriteUInt32( EPP_CString << 16 ).WriteUInt32( 14 )
252 .WriteUInt32( 0x5f005f ).WriteUInt32( 0x50005f )
253 .WriteUInt32( 0x540050 ).WriteUInt16( 0x39 );
254 }
255 if ( pStrm && pBinTagStrm )
256 {
257 sal_uInt32 nLen = pBinTagStrm->Tell();
258 nSize += nLen + 8;
259 pStrm->WriteUInt32( EPP_BinaryTagData << 16 ).WriteUInt32( nLen );
260 pStrm->WriteBytes(pBinTagStrm->GetData(), nLen);
261 }
262 else
263 nSize += ImplProgBinaryTag( pStrm );
264
265 if ( pStrm )
266 {
267 pStrm->SeekRel( - ( static_cast<sal_Int32>(nSize) - 4 ) );
268 pStrm->WriteUInt32( nSize - 8 );
269 pStrm->SeekRel( nSize - 8 );
270 }
271 return nSize;
272}
273
275{
276 sal_uInt32 nSize = 0;
277 if ( aBuExPictureStream.Tell() || aBuExOutlineStream.Tell() || pBinTagStrm )
278 {
279 nSize = 8;
280 if ( pStrm )
281 {
282 pStrm->WriteUInt32( 0xf | ( EPP_ProgTags << 16 ) ).WriteUInt32( 0 );
283 }
284 nSize += ImplProgBinaryTagContainer( pStrm, pBinTagStrm );
285 if ( pStrm )
286 {
287 pStrm->SeekRel( - ( static_cast<sal_Int32>(nSize) - 4 ) );
288 pStrm->WriteUInt32( nSize - 8 );
289 pStrm->SeekRel( nSize - 8 );
290 }
291 }
292 return nSize;
293}
294
296{
297 sal_uInt32 nSize = 8;
298 if ( pStrm )
299 {
300 pStrm->WriteUInt32( ( EPP_List << 16 ) | 0xf ).WriteUInt32( 0 );
301 }
302
303 nSize += ImplVBAInfoContainer( pStrm );
304 nSize += ImplSlideViewInfoContainer( 0, pStrm );
305 nSize += ImplOutlineViewInfoContainer( pStrm );
306 nSize += ImplSlideViewInfoContainer( 1, pStrm );
307 nSize += ImplProgTagContainer( pStrm );
308
309 if ( pStrm )
310 {
311 pStrm->SeekRel( - ( static_cast<sal_Int32>(nSize) - 4 ) );
312 pStrm->WriteUInt32( nSize - 8 );
313 pStrm->SeekRel( nSize - 8 );
314 }
315 return nSize;
316}
317
319{
320 sal_uInt32 i, nSize = 28 * mnMasterPages + 8;
321 if ( pStrm )
322 {
323 pStrm->WriteUInt32( 0x1f | ( EPP_SlideListWithText << 16 ) ).WriteUInt32( nSize - 8 );
324
325 for ( i = 0; i < mnMasterPages; i++ )
326 {
327 pStrm->WriteUInt32( EPP_SlidePersistAtom << 16 ).WriteUInt32( 20 );
328 mpPptEscherEx->InsertPersistOffset( EPP_MAINMASTER_PERSIST_KEY | i, pStrm->Tell() );
329 pStrm->WriteUInt32( 0 ) // psrReference - logical reference to the slide persist object ( EPP_MAINMASTER_PERSIST_KEY )
330 .WriteUInt32( 0 ) // flags - only bit 3 used, if set then slide contains shapes other than placeholders
331 .WriteInt32( 0 ) // numberTexts - number of placeholder texts stored with the persist object. Allows to display outline view without loading the slide persist objects
332 .WriteInt32( 0x80000000 | i ) // slideId - Unique slide identifier, used for OLE link monikers for example
333 .WriteUInt32( 0 ); // reserved, usually 0
334 }
335 }
336 return nSize;
337}
338
339sal_uInt32 PPTWriter::ImplInsertBookmarkURL( const OUString& rBookmarkURL, const sal_uInt32 nType,
340 std::u16string_view aStringVer0, std::u16string_view aStringVer1, std::u16string_view aStringVer2, std::u16string_view aStringVer3 )
341{
342 sal_uInt32 nHyperId = ++mnExEmbed;
343
344 OUString sBookmarkURL( rBookmarkURL );
345 INetURLObject aBaseURI( maBaseURI );
346 INetURLObject aBookmarkURI( rBookmarkURL );
347 if( aBaseURI.GetProtocol() == aBookmarkURI.GetProtocol() )
348 {
349 OUString aRelUrl( INetURLObject::GetRelURL( maBaseURI, rBookmarkURL ) );
350 if ( !aRelUrl.isEmpty() )
351 sBookmarkURL = aRelUrl;
352 }
353 maHyperlink.emplace_back( sBookmarkURL, nType );
354
355 mpExEmbed->WriteUInt16( 0xf )
356 .WriteUInt16( EPP_ExHyperlink )
357 .WriteUInt32( 0 );
358 sal_uInt32 nHyperSize, nHyperStart = mpExEmbed->Tell();
359 mpExEmbed->WriteUInt16( 0 )
360 .WriteUInt16( EPP_ExHyperlinkAtom )
361 .WriteUInt32( 4 )
362 .WriteUInt32( nHyperId );
363
364 PPTWriter::WriteCString( *mpExEmbed, aStringVer0 );
365 PPTWriter::WriteCString( *mpExEmbed, aStringVer1, 1 );
366 PPTWriter::WriteCString( *mpExEmbed, aStringVer2, 2 );
367 PPTWriter::WriteCString( *mpExEmbed, aStringVer3, 3 );
368
369 nHyperSize = mpExEmbed->Tell() - nHyperStart;
370 mpExEmbed->SeekRel( - ( static_cast<sal_Int32>(nHyperSize) + 4 ) );
371 mpExEmbed->WriteUInt32( nHyperSize );
372 mpExEmbed->SeekRel( nHyperSize );
373 return nHyperId;
374}
375
377{
378 sal_uInt32 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Document );
379 if ( nOfs )
380 {
381 mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_CurrentPos, mpStrm->Tell() );
382 mpStrm->Seek( nOfs );
383
384 // creating the TxMasterStyleAtom
385 SvMemoryStream aTxMasterStyleAtomStrm( 0x200, 0x200 );
386 {
387 EscherExAtom aTxMasterStyleAtom( aTxMasterStyleAtomStrm, EPP_TxMasterStyleAtom, EPP_TEXTTYPE_Other );
388 aTxMasterStyleAtomStrm.WriteUInt16( 5 ); // paragraph count
389 sal_uInt16 nLev;
390 for ( nLev = 0; nLev < 5; nLev++ )
391 {
392 mpStyleSheet->mpParaSheet[ EPP_TEXTTYPE_Other ]->Write( aTxMasterStyleAtomStrm, nLev, false, mXPagePropSet );
393 mpStyleSheet->mpCharSheet[ EPP_TEXTTYPE_Other ]->Write( aTxMasterStyleAtomStrm, nLev, false, mXPagePropSet );
394 }
395 }
396
397 sal_uInt32 nExEmbedSize = mpExEmbed->TellEnd();
398
399 // nEnvironment : whole size of the environment container
400 sal_uInt32 nEnvironment = maFontCollection.GetCount() * 76 // 68 bytes per Fontenityatom and 8 Bytes per header
401 + 8 // 1 FontCollection container
402 + 20 // SrKinsoku container
403 + 18 // 1 TxSiStyleAtom
404 + aTxMasterStyleAtomStrm.Tell() // 1 TxMasterStyleAtom;
406
407 sal_uInt32 nBytesToInsert = nEnvironment + 8;
408
409 if ( nExEmbedSize )
410 nBytesToInsert += nExEmbedSize + 8 + 12;
411
412 nBytesToInsert += maSoundCollection.GetSize();
413 nBytesToInsert += mpPptEscherEx->DrawingGroupContainerSize();
414 nBytesToInsert += ImplMasterSlideListContainer(nullptr);
415 nBytesToInsert += ImplDocumentListContainer(nullptr);
416
417 // insert nBytes into stream and adjust depending container
418 mpPptEscherEx->InsertAtCurrentPos( nBytesToInsert );
419
420 // CREATE HYPERLINK CONTAINER
421 if ( nExEmbedSize )
422 {
423 mpStrm->WriteUInt16( 0xf )
424 .WriteUInt16( EPP_ExObjList )
425 .WriteUInt32( nExEmbedSize + 12 )
426 .WriteUInt16( 0 )
427 .WriteUInt16( EPP_ExObjListAtom )
428 .WriteUInt32( 4 )
429 .WriteUInt32( mnExEmbed );
430 mpPptEscherEx->InsertPersistOffset( EPP_Persist_ExObj, mpStrm->Tell() );
431 mpStrm->WriteBytes(mpExEmbed->GetData(), nExEmbedSize);
432 }
433
434 // CREATE ENVIRONMENT
435 mpStrm->WriteUInt16( 0xf ).WriteUInt16( EPP_Environment ).WriteUInt32( nEnvironment );
436
437 // Open Container ( EPP_SrKinsoku )
438 mpStrm->WriteUInt16( 0x2f ).WriteUInt16( EPP_SrKinsoku ).WriteUInt32( 12 );
439 mpPptEscherEx->AddAtom( 4, EPP_SrKinsokuAtom, 0, 3 );
440 mpStrm->WriteInt32( 0 ); // SrKinsoku Level 0
441
442 // Open Container ( EPP_FontCollection )
443 mpStrm->WriteUInt16( 0xf ).WriteUInt16( EPP_FontCollection ).WriteUInt32( maFontCollection.GetCount() * 76 );
444
445 for ( sal_uInt32 i = 0; i < maFontCollection.GetCount(); i++ )
446 {
447 mpPptEscherEx->AddAtom( 68, EPP_FontEnityAtom, 0, i );
449 sal_Int32 nFontLen = pDesc->Name.getLength();
450 if ( nFontLen > 31 )
451 nFontLen = 31;
452 for ( sal_Int32 n = 0; n < 32; n++ )
453 {
454 sal_Unicode nUniCode = 0;
455 if ( n < nFontLen )
456 nUniCode = pDesc->Name[n];
457 mpStrm->WriteUInt16( nUniCode );
458 }
459 sal_uInt8 lfCharSet = ANSI_CHARSET;
460 sal_uInt8 const lfClipPrecision = 0;
461 sal_uInt8 const lfQuality = 6;
462 sal_uInt8 lfPitchAndFamily = 0;
463
464 if ( pDesc->CharSet == RTL_TEXTENCODING_SYMBOL )
465 lfCharSet = SYMBOL_CHARSET;
466
467 switch( pDesc->Family )
468 {
469 case css::awt::FontFamily::ROMAN :
470 lfPitchAndFamily |= FF_ROMAN;
471 break;
472
473 case css::awt::FontFamily::SWISS :
474 lfPitchAndFamily |= FF_SWISS;
475 break;
476
477 case css::awt::FontFamily::MODERN :
478 lfPitchAndFamily |= FF_MODERN;
479 break;
480
481 case css::awt::FontFamily::SCRIPT:
482 lfPitchAndFamily |= FF_SCRIPT;
483 break;
484
485 case css::awt::FontFamily::DECORATIVE:
486 lfPitchAndFamily |= FF_DECORATIVE;
487 break;
488
489 default:
490 lfPitchAndFamily |= FAMILY_DONTKNOW;
491 break;
492 }
493 switch( pDesc->Pitch )
494 {
495 case css::awt::FontPitch::FIXED:
496 lfPitchAndFamily |= FIXED_PITCH;
497 break;
498
499 default:
500 lfPitchAndFamily |= DEFAULT_PITCH;
501 break;
502 }
503 mpStrm->WriteUChar( lfCharSet )
504 .WriteUChar( lfClipPrecision )
505 .WriteUChar( lfQuality )
506 .WriteUChar( lfPitchAndFamily );
507 }
508 mpStyleSheet->WriteTxCFStyleAtom( *mpStrm ); // create style that is used for new standard objects
509 mpPptEscherEx->AddAtom( 10, EPP_TxSIStyleAtom );
510 mpStrm->WriteUInt32( 7 ) // ?
511 .WriteInt16( 2 ) // ?
512 .WriteUChar( 9 ) // ?
513 .WriteUChar( 8 ) // ?
514 .WriteInt16( 0 ); // ?
515
516 mpStrm->WriteBytes(aTxMasterStyleAtomStrm.GetData(), aTxMasterStyleAtomStrm.Tell());
518 mpPptEscherEx->WriteDrawingGroupContainer( *mpStrm );
521
522 sal_uInt32 nOldPos = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_CurrentPos );
523 if ( nOldPos )
524 {
525 mpStrm->Seek( nOldPos );
526 return true;
527 }
528 }
529 return false;
530}
531
533 css::uno::Any& rAny,
534 const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
535 const OUString& rString,
536 bool bTestPropertyAvailability )
537{
538 bool bRetValue = true;
539 if ( bTestPropertyAvailability )
540 {
541 bRetValue = false;
542 try
543 {
544 css::uno::Reference< css::beans::XPropertySetInfo > aXPropSetInfo( rXPropSet->getPropertySetInfo() );
545 if ( aXPropSetInfo.is() )
546 bRetValue = aXPropSetInfo->hasPropertyByName( rString );
547 }
548 catch( css::uno::Exception& )
549 {
550 bRetValue = false;
551 }
552 }
553 if ( bRetValue )
554 {
555 try
556 {
557 rAny = rXPropSet->getPropertyValue( rString );
558 if ( !rAny.hasValue() )
559 bRetValue = false;
560 }
561 catch( css::uno::Exception& )
562 {
563 bRetValue = false;
564 }
565 }
566 return bRetValue;
567}
568
569css::beans::PropertyState PropValue::GetPropertyState(
570 const css::uno::Reference< css::beans::XPropertySet > & rXPropSet,
571 const OUString& rPropertyName )
572{
573 css::beans::PropertyState eRetValue = css::beans::PropertyState_AMBIGUOUS_VALUE;
574 try
575 {
576 css::uno::Reference< css::beans::XPropertyState > aXPropState( rXPropSet, css::uno::UNO_QUERY );
577 if ( aXPropState.is() )
578 eRetValue = aXPropState->getPropertyState( rPropertyName );
579 }
580 catch( css::uno::Exception& )
581 {
582
583 }
584 return eRetValue;
585}
586
587bool PropValue::ImplGetPropertyValue( const OUString& rString )
588{
589 return GetPropertyValue( mAny, mXPropSet, rString );
590}
591
592bool PropValue::ImplGetPropertyValue( const css::uno::Reference< css::beans::XPropertySet > & aXPropSet, const OUString& rString )
593{
594 return GetPropertyValue( mAny, aXPropSet, rString );
595}
596
597bool PropStateValue::ImplGetPropertyValue( const OUString& rString, bool bGetPropertyState )
598{
599 ePropState = css::beans::PropertyState_AMBIGUOUS_VALUE;
600 bool bRetValue = true;
601#ifdef UNX
602 css::uno::Reference< css::beans::XPropertySetInfo >
603 aXPropSetInfo( mXPropSet->getPropertySetInfo() );
604 if ( !aXPropSetInfo.is() )
605 return false;
606#endif
607 try
608 {
609 mAny = mXPropSet->getPropertyValue( rString );
610 if ( !mAny.hasValue() )
611 bRetValue = false;
612 else if ( bGetPropertyState )
613 ePropState = mXPropState->getPropertyState( rString );
614 else
615 ePropState = css::beans::PropertyState_DIRECT_VALUE;
616 }
617 catch( css::uno::Exception& )
618 {
619 bRetValue = false;
620 }
621 return bRetValue;
622}
623
625{
626 bool bFirstParagraph = true;
627 sal_uInt32 nCharCount;
628 sal_uInt32 nPropertyFlags = 0;
629 sal_Int16 nLineSpacing;
630 int nInstance = rTextObj.GetInstance();
631
632 for ( sal_uInt32 i = 0; i < rTextObj.ParagraphCount(); ++i, bFirstParagraph = false )
633 {
634 ParagraphObj* pPara = rTextObj.GetParagraph(i);
635 const PortionObj& rPortion = pPara->front();
636 nCharCount = pPara->CharacterCount();
637
638 if ( ( pPara->meTextAdjust == css::beans::PropertyState_DIRECT_VALUE ) ||
639 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_Adjust, pPara->mnTextAdjust ) ) )
640 nPropertyFlags |= 0x00000800;
641 nLineSpacing = pPara->mnLineSpacing;
642
643 const FontCollectionEntry* pDesc = maFontCollection.GetById( rPortion.mnFont );
644 sal_Int16 nNormalSpacing = 100;
645 if ( !mbFontIndependentLineSpacing && pDesc )
646 {
647 double fN = 100.0;
648 fN *= pDesc->Scaling;
649 nNormalSpacing = static_cast<sal_Int16>( fN + 0.5 );
650 }
651 if ( !mbFontIndependentLineSpacing && bFirstParagraph && ( nLineSpacing > nNormalSpacing ) ) // sj: i28747, no replacement for fixed linespacing
652 {
653 nLineSpacing = nNormalSpacing;
654 nPropertyFlags |= 0x00001000;
655 }
656 else
657 {
658 if ( nLineSpacing > 0 )
659 {
660 if ( !mbFontIndependentLineSpacing && pDesc )
661 nLineSpacing = static_cast<sal_Int16>( static_cast<double>(nLineSpacing) * pDesc->Scaling + 0.5 );
662 }
663 else
664 {
665 if ( !pPara->mbFixedLineSpacing && rPortion.mnCharHeight > static_cast<sal_uInt16>( static_cast<double>(-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point
666 nLineSpacing = nNormalSpacing;
667 else
668 nLineSpacing = static_cast<sal_Int16>( convertMm100ToMasterUnit(nLineSpacing) );
669 }
670 if ( ( pPara->meLineSpacing == css::beans::PropertyState_DIRECT_VALUE ) ||
671 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_LineFeed, nLineSpacing ) ) )
672 nPropertyFlags |= 0x00001000;
673 }
674 if ( ( pPara->meLineSpacingTop == css::beans::PropertyState_DIRECT_VALUE ) ||
675 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mnLineSpacingTop ) ) )
676 nPropertyFlags |= 0x00002000;
677 if ( ( pPara->meLineSpacingBottom == css::beans::PropertyState_DIRECT_VALUE ) ||
679 nPropertyFlags |= 0x00004000;
680 if ( ( pPara->meForbiddenRules == css::beans::PropertyState_DIRECT_VALUE ) ||
681 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mbForbiddenRules ? 1 : 0 ) ) )
682 nPropertyFlags |= 0x00020000;
683 if ( ( pPara->meParagraphPunctation == css::beans::PropertyState_DIRECT_VALUE ) ||
684 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mbParagraphPunctation ? 1 : 0 ) ) )
685 nPropertyFlags |= 0x00080000;
686 if ( ( pPara->meBiDi == css::beans::PropertyState_DIRECT_VALUE ) ||
687 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_BiDi, pPara->mnBiDi ) ) )
688 nPropertyFlags |= 0x00200000;
689
690 sal_Int32 nBuRealSize = pPara->nBulletRealSize;
691 sal_Int16 nBulletFlags = pPara->nBulletFlags;
692
693 if ( pPara->bExtendedParameters )
694 nPropertyFlags |= pPara->nParaFlags;
695 else
696 {
697 nPropertyFlags |= 1; // turn off bullet explicit
698 nBulletFlags = 0;
699 }
700
701 // Write nTextOfs and nBullets
702 if ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_TextOfs, pPara->nTextOfs ) )
703 nPropertyFlags |= 0x100;
704 if ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_BulletOfs, pPara->nBulletOfs ))
705 nPropertyFlags |= 0x400;
706
707 FontCollectionEntry aFontDescEntry( pPara->aFontDesc.Name, pPara->aFontDesc.Family, pPara->aFontDesc.Pitch, pPara->aFontDesc.CharSet );
708 sal_uInt16 nFontId = static_cast<sal_uInt16>(maFontCollection.GetId( aFontDescEntry ));
709
710 rOut.WriteUInt32( nCharCount )
711 .WriteUInt16( pPara->nDepth ) // Level
712 .WriteUInt32( nPropertyFlags ); // Paragraph Attribute Set
713
714 if ( nPropertyFlags & 0xf )
715 rOut.WriteInt16( nBulletFlags );
716 if ( nPropertyFlags & 0x80 )
717 rOut.WriteUInt16( pPara->cBulletId );
718 if ( nPropertyFlags & 0x10 )
719 rOut.WriteUInt16( nFontId );
720 if ( nPropertyFlags & 0x40 )
721 rOut.WriteInt16( nBuRealSize );
722 if ( nPropertyFlags & 0x20 )
723 {
724 sal_uInt32 nBulletColor = pPara->nBulletColor;
725 if ( nBulletColor == sal_uInt32(COL_AUTO) )
726 {
727 bool bIsDark = false;
728 css::uno::Any aAny;
729 if ( PropValue::GetPropertyValue( aAny, mXPagePropSet, "IsBackgroundDark", true ) )
730 aAny >>= bIsDark;
731 nBulletColor = bIsDark ? 0xffffff : 0x000000;
732 }
733 nBulletColor &= 0xffffff;
734 nBulletColor |= 0xfe000000;
735 rOut.WriteUInt32( nBulletColor );
736 }
737 if ( nPropertyFlags & 0x00000800 )
738 rOut.WriteUInt16( pPara->mnTextAdjust );
739 if ( nPropertyFlags & 0x00001000 )
740 rOut.WriteUInt16( nLineSpacing );
741 if ( nPropertyFlags & 0x00002000 )
742 rOut.WriteUInt16( pPara->mnLineSpacingTop );
743 if ( nPropertyFlags & 0x00004000 )
744 rOut.WriteUInt16( pPara->mnLineSpacingBottom );
745 if ( nPropertyFlags & 0x100 )
746 rOut.WriteUInt16( pPara->nTextOfs );
747 if ( nPropertyFlags & 0x400 )
748 rOut.WriteUInt16( pPara->nBulletOfs );
749 if ( nPropertyFlags & 0x000e0000 )
750 {
751 sal_uInt16 nAsianSettings = 0;
752 if ( pPara->mbForbiddenRules )
753 nAsianSettings |= 1;
754 if ( pPara->mbParagraphPunctation )
755 nAsianSettings |= 4;
756 rOut.WriteUInt16( nAsianSettings );
757 }
758 if ( nPropertyFlags & 0x200000 )
759 rOut.WriteUInt16( pPara->mnBiDi );
760 }
761}
762
764{
765 sal_uInt32 nPropertyFlags;
766 int nInstance = rTextObj.GetInstance();
767
768 for ( sal_uInt32 i = 0; i < rTextObj.ParagraphCount(); ++i )
769 {
770 ParagraphObj* pPara = rTextObj.GetParagraph(i);
771 for ( std::vector<std::unique_ptr<PortionObj> >::const_iterator it = pPara->begin(); it != pPara->end(); ++it )
772 {
773 const PortionObj& rPortion = **it;
774 nPropertyFlags = 0;
775 sal_uInt32 nCharAttr = rPortion.mnCharAttr;
776 sal_uInt32 nCharColor = rPortion.mnCharColor;
777
778 if ( nCharColor == sal_uInt32(COL_AUTO) ) // nCharColor depends to the background color
779 {
780 bool bIsDark = false;
781 css::uno::Any aAny;
782 if ( PropValue::GetPropertyValue( aAny, mXPagePropSet, "IsBackgroundDark", true ) )
783 aAny >>= bIsDark;
784 nCharColor = bIsDark ? 0xffffff : 0x000000;
785 }
786
787 nCharColor &= 0xffffff;
788
789 /* the portion is using the embossed or engraved attribute, which we want to map to the relief feature of PPT.
790 Because the relief feature of PPT is dependent to the background color, such a mapping can not always be used. */
791 if ( nCharAttr & 0x200 )
792 {
793 sal_uInt32 nBackgroundColor = 0xffffff;
794
795 if ( !nCharColor ) // special treatment for
796 nCharColor = 0xffffff; // black fontcolor
797
798 css::uno::Any aAny;
799 css::drawing::FillStyle aFS( css::drawing::FillStyle_NONE );
800 if ( PropValue::GetPropertyValue( aAny, mXPropSet, "FillStyle" ) )
801 aAny >>= aFS;
802 switch( aFS )
803 {
804 case css::drawing::FillStyle_GRADIENT :
805 {
806 ::tools::Rectangle aRect( Point(), Size( 28000, 21000 ) );
807 EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm.get(), aRect );
809 aPropOpt.GetOpt( ESCHER_Prop_fillColor, nBackgroundColor );
810 }
811 break;
812 case css::drawing::FillStyle_SOLID :
813 {
814 if ( PropValue::GetPropertyValue( aAny, mXPropSet, "FillColor" ) )
815 nBackgroundColor = EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(aAny) );
816 }
817 break;
818 case css::drawing::FillStyle_NONE :
819 {
820 css::uno::Any aBackAny;
821 css::drawing::FillStyle aBackFS( css::drawing::FillStyle_NONE );
822 if ( PropValue::GetPropertyValue( aBackAny, mXBackgroundPropSet, "FillStyle" ) )
823 aBackAny >>= aBackFS;
824 switch( aBackFS )
825 {
826 case css::drawing::FillStyle_GRADIENT :
827 {
828 ::tools::Rectangle aRect( Point(), Size( 28000, 21000 ) );
829 EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm.get(), aRect );
831 aPropOpt.GetOpt( ESCHER_Prop_fillColor, nBackgroundColor );
832 }
833 break;
834 case css::drawing::FillStyle_SOLID :
835 {
836 if ( PropValue::GetPropertyValue( aAny, mXBackgroundPropSet, "FillColor" ) )
837 nBackgroundColor = EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(aAny) );
838 }
839 break;
840 default:
841 break;
842 }
843 }
844 break;
845 default:
846 break;
847 }
848
849 sal_Int32 nB = nBackgroundColor & 0xff;
850 nB += static_cast<sal_uInt8>( nBackgroundColor >> 8 );
851 nB += static_cast<sal_uInt8>( nBackgroundColor >> 16 );
852 // if the background color is nearly black, relief can't been used, because the text would not be visible
853 if ( nB < 0x60 || ( nBackgroundColor != nCharColor ) )
854 {
855 nCharAttr &=~ 0x200;
856
857 // now check if the text is part of a group, and if the previous object has the same color than the fontcolor
858 // ( and if fillcolor is not available the background color ), it is sometimes
859 // not possible to export the 'embossed' flag
860 if ( ( GetCurrentGroupLevel() > 0 ) && ( GetCurrentGroupIndex() >= 1 ) )
861 {
862 css::uno::Reference< css::drawing::XShape > aGroupedShape( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() - 1 ), uno::UNO_QUERY );
863 if( aGroupedShape.is() )
864 {
865 css::uno::Reference< css::beans::XPropertySet > aPropSetOfNextShape
866 ( aGroupedShape, css::uno::UNO_QUERY );
867 if ( aPropSetOfNextShape.is() )
868 {
869 if ( PropValue::GetPropertyValue( aAny, aPropSetOfNextShape,
870 "FillColor", true ) )
871 {
872 if ( nCharColor == EscherEx::GetColor( *o3tl::doAccess<sal_uInt32>(aAny) ) )
873 {
874 nCharAttr |= 0x200;
875 }
876 }
877 }
878 }
879 }
880 }
881 }
882 nCharColor |= 0xfe000000;
883 if ( nInstance == 4 ) // special handling for normal textobjects:
884 nPropertyFlags |= nCharAttr & 0x217; // not all attributes are inherited
885 else
886 {
887 if ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Bold, nCharAttr ) )
888 nPropertyFlags |= 1;
889 if ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Italic, nCharAttr ) )
890 nPropertyFlags |= 2;
891 if ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Underline, nCharAttr ) )
892 nPropertyFlags |= 4;
893 if ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Shadow, nCharAttr ) )
894 nPropertyFlags |= 0x10;
895 if ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Embossed, nCharAttr ) )
896 nPropertyFlags |= 512;
897 }
898 if ( rTextObj.HasExtendedBullets() )
899 {
900 nPropertyFlags |= ( i & 0x3f ) << 10 ;
901 nCharAttr |= ( i & 0x3f ) << 10;
902 }
903 if ( ( rPortion.meFontName == css::beans::PropertyState_DIRECT_VALUE ) ||
904 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Font, rPortion.mnFont ) ) )
905 nPropertyFlags |= 0x00010000;
906 if ( ( rPortion.meAsianOrComplexFont == css::beans::PropertyState_DIRECT_VALUE ) ||
908 nPropertyFlags |= 0x00200000;
909 if ( ( rPortion.meCharHeight == css::beans::PropertyState_DIRECT_VALUE ) ||
910 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontHeight, rPortion.mnCharHeight ) ) )
911 nPropertyFlags |= 0x00020000;
912 if ( ( rPortion.meCharColor == css::beans::PropertyState_DIRECT_VALUE ) ||
913 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontColor, nCharColor & 0xffffff ) ) )
914 nPropertyFlags |= 0x00040000;
915 if ( ( rPortion.meCharEscapement == css::beans::PropertyState_DIRECT_VALUE ) ||
916 ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Escapement, rPortion.mnCharEscapement ) ) )
917 nPropertyFlags |= 0x00080000;
918
919 sal_uInt32 nCharCount = rPortion.Count();
920
921 rOut.WriteUInt32( nCharCount )
922 .WriteUInt32( nPropertyFlags ); //PropertyFlags
923
924 if ( nPropertyFlags & 0xffff )
925 rOut.WriteUInt16( nCharAttr );
926 if ( nPropertyFlags & 0x00010000 )
927 rOut.WriteUInt16( rPortion.mnFont );
928 if ( nPropertyFlags & 0x00200000 )
929 rOut.WriteUInt16( rPortion.mnAsianOrComplexFont );
930 if ( nPropertyFlags & 0x00020000 )
931 rOut.WriteUInt16( rPortion.mnCharHeight );
932 if ( nPropertyFlags & 0x00040000 )
933 rOut.WriteUInt32( nCharColor );
934 if ( nPropertyFlags & 0x00080000 )
935 rOut.WriteInt16( rPortion.mnCharEscapement );
936 }
937 }
938}
939
944{
945 mnTextSize = 0;
947 mXText.set( mXShape, css::uno::UNO_QUERY );
948
949 if ( mXText.is() )
950 {
951 mnTextSize = mXText->getString().getLength();
952 css::uno::Any aAny;
953 if ( GetPropertyValue( aAny, mXPropSet, "FontIndependentLineSpacing", true ) )
955 }
956 return ( mnTextSize != 0 );
957}
958
960{
961 if ( mnAngle < 0 )
962 mnAngle = ( 36000 + mnAngle ) % 36000;
963 else
964 mnAngle = ( 36000 - ( mnAngle % 36000 ) );
965
966 double fCos = cos( basegfx::deg2rad<100>(mnAngle) );
967 double fSin = sin( basegfx::deg2rad<100>(mnAngle) );
968
969 double fWidthHalf = maRect.GetWidth() / 2.0;
970 double fHeightHalf = maRect.GetHeight() / 2.0;
971
972 double fXDiff = fCos * fWidthHalf + fSin * (-fHeightHalf);
973 double fYDiff = - ( fSin * fWidthHalf - fCos * ( -fHeightHalf ) );
974
975 maRect.Move( static_cast<sal_Int32>( -( fWidthHalf - fXDiff ) ), static_cast<sal_Int32>( - ( fHeightHalf + fYDiff ) ) );
976 mnAngle *= 655;
977 mnAngle += 0x8000;
978 mnAngle &=~0xffff; // round nAngle to full grads
980
981 if ( ( mnAngle >= ( 45 << 16 ) && mnAngle < ( 135 << 16 ) ) ||
982 ( mnAngle >= ( 225 << 16 ) && mnAngle < ( 315 << 16 ) ) )
983 {
984 // Maddeningly, in those two areas of PPT is the BoundingBox already
985 // vertical. Therefore, we need to put down it BEFORE THE ROTATION.
986 css::awt::Point aTopLeft( static_cast<sal_Int32>( maRect.Left() + fWidthHalf - fHeightHalf ), static_cast<sal_Int32>( maRect.Top() + fHeightHalf - fWidthHalf ) );
987 const tools::Long nRotatedWidth(maRect.GetHeight());
988 const tools::Long nRotatedHeight(maRect.GetWidth());
989 const Size aNewSize(nRotatedWidth, nRotatedHeight);
990 maRect = ::tools::Rectangle( Point( aTopLeft.X, aTopLeft.Y ), aNewSize );
991 }
992}
993
995{
997 return;
998
999 if ( !rTextObj.ParagraphCount() )
1000 return;
1001
1002 ParagraphObj* pPara = rTextObj.GetParagraph(0);
1003 if ( pPara->empty() )
1004 return;
1005
1006 const PortionObj& rPortion = pPara->front();
1007 sal_Int16 nLineSpacing = pPara->mnLineSpacing;
1008 const FontCollectionEntry* pDesc = maFontCollection.GetById( rPortion.mnFont );
1009 if ( pDesc )
1010 nLineSpacing = static_cast<sal_Int16>( static_cast<double>(nLineSpacing) * pDesc->Scaling + 0.5 );
1011
1012 if ( ( nLineSpacing > 0 ) && ( nLineSpacing < 100 ) )
1013 {
1014 double fCharHeight = convertPointToMm100<double>(rPortion.mnCharHeight);
1015 fCharHeight *= 100 - nLineSpacing;
1016 fCharHeight /= 100;
1017
1018 sal_uInt32 nUpperDistance = 0;
1019 rPropOpt.GetOpt( ESCHER_Prop_dyTextTop, nUpperDistance );
1020 nUpperDistance += static_cast< sal_uInt32 >( fCharHeight * 360.0 );
1021 rPropOpt.AddOpt( ESCHER_Prop_dyTextTop, nUpperDistance );
1022 }
1023}
1024
1025void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance,
1026 TextRuleEntry* pTextRule, SvStream& rExtBuStr, EscherPropertyContainer* pPropOpt )
1027{
1028 PPTExParaSheet& rParaSheet = mpStyleSheet->GetParaSheet( nTextInstance );
1029
1030 rOut.WriteUInt32( ( EPP_TextHeaderAtom << 16 ) | ( nAtomInstance << 4 ) ).WriteUInt32( 4 )
1031 .WriteInt32( nTextInstance );
1032
1033 if ( mbEmptyPresObj )
1034 mnTextSize = 0;
1035 if ( mbEmptyPresObj )
1036 return;
1037
1038 ParagraphObj* pPara;
1039 TextObjBinary aTextObj( mXText, nTextInstance, maFontCollection, static_cast<PPTExBulletProvider&>(*this) );
1040
1041 // leaving out EPP_TextCharsAtom w/o text - still write out
1042 // attribute info though
1043 if ( mnTextSize )
1044 aTextObj.Write( &rOut );
1045
1046 if ( pPropOpt && mType != "drawing.Table" )
1047 ImplAdjustFirstLineLineSpacing( aTextObj, *pPropOpt );
1048
1049 sal_uInt32 nSize, nPos = rOut.Tell();
1050
1052 ImplWriteParagraphs( rOut, aTextObj );
1053 ImplWritePortions( rOut, aTextObj );
1054 nSize = rOut.Tell() - nPos;
1055 rOut.SeekRel( - ( static_cast<sal_Int32>(nSize) - 4 ) );
1056 rOut.WriteUInt32( nSize - 8 );
1057 rOut.SeekRel( nSize - 8 );
1058
1059 for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
1060 {
1061 pPara = aTextObj.GetParagraph(i);
1062 for ( std::vector<std::unique_ptr<PortionObj> >::const_iterator it = pPara->begin(); it != pPara->end(); ++it )
1063 {
1064 const PortionObj& rPortion = **it;
1065 if ( rPortion.mpFieldEntry )
1066 {
1067 const FieldEntry* pFieldEntry = rPortion.mpFieldEntry.get();
1068
1069 switch ( pFieldEntry->nFieldType >> 28 )
1070 {
1071 case 1 :
1072 case 2 :
1073 {
1074 rOut.WriteUInt32( EPP_DateTimeMCAtom << 16 ).WriteUInt32( 8 )
1075 .WriteUInt32( pFieldEntry->nFieldStartPos ) // TxtOffset to TxtField;
1076 .WriteUChar( pFieldEntry->nFieldType & 0xff ) // Type
1077 .WriteUChar( 0 ).WriteUInt16( 0 ); // PadBytes
1078 }
1079 break;
1080 case 3 :
1081 {
1083 .WriteUInt32( pFieldEntry->nFieldStartPos );
1084 }
1085 break;
1086 case 4 :
1087 {
1088 sal_uInt32 nPageIndex = 0;
1089 OUString aPageUrl;
1090 OUString aFile( pFieldEntry->aFieldUrl );
1091 OUString aTarget( pFieldEntry->aFieldUrl );
1092 INetURLObject aUrl( pFieldEntry->aFieldUrl );
1093 if ( INetProtocol::File == aUrl.GetProtocol() )
1094 aFile = aUrl.PathToFileName();
1095 else if ( INetProtocol::Smb == aUrl.GetProtocol() )
1096 {
1097 // Convert smb notation to '\\' and skip the 'smb:' part
1099 aFile = aFile.replaceAll( "/", "\\" );
1100 aTarget = aFile;
1101 }
1102 else if ( pFieldEntry->aFieldUrl.startsWith("#") )
1103 {
1105 aPage = aPage.copy( 1 );
1106
1107 std::vector<OUString>::const_iterator pIter = std::find(
1108 maSlideNameList.begin(),maSlideNameList.end(),aPage);
1109
1110 if ( pIter != maSlideNameList.end() )
1111 {
1112 nPageIndex = pIter - maSlideNameList.begin();
1113 aPageUrl = OUString::number(256 + nPageIndex) +
1114 "," +
1115 OUString::number(nPageIndex + 1) +
1116 ",Slide " +
1117 OUString::number(nPageIndex + 1);
1118 }
1119 }
1120 sal_uInt32 nHyperId(0);
1121 if ( !aPageUrl.isEmpty() )
1122 nHyperId = ImplInsertBookmarkURL( aPageUrl, 1 | ( nPageIndex << 8 ) | ( 1U << 31 ), pFieldEntry->aRepresentation, u"", u"", aPageUrl );
1123 else
1124 nHyperId = ImplInsertBookmarkURL( pFieldEntry->aFieldUrl, 2 | ( nHyperId << 8 ), aFile, aTarget, u"", u"" );
1125
1126 rOut.WriteUInt32( ( EPP_InteractiveInfo << 16 ) | 0xf ).WriteUInt32( 24 )
1128 .WriteUInt32( 0 ) // soundref
1129 .WriteUInt32( nHyperId ) // hyperlink id
1130 .WriteUChar( 4 ) // hyperlink action
1131 .WriteUChar( 0 ) // ole verb
1132 .WriteUChar( 0 ) // jump
1133 .WriteUChar( 0 ) // flags
1134 .WriteUChar( 8 ) // hyperlink type ?
1135 .WriteUChar( 0 ).WriteUChar( 0 ).WriteUChar( 0 )
1137 .WriteUInt32( pFieldEntry->nFieldStartPos )
1138 .WriteUInt32( pFieldEntry->nFieldEndPos );
1139 }
1140 break;
1141 case 5 :
1142 {
1144 .WriteUInt32( pFieldEntry->nFieldStartPos );
1145 }
1146 break;
1147 case 6 :
1148 {
1149 rOut.WriteUInt32( EPP_HeaderMCAtom << 16 ).WriteUInt32( 4 )
1150 .WriteUInt32( pFieldEntry->nFieldStartPos );
1151 }
1152 break;
1153 case 7 :
1154 {
1155 rOut.WriteUInt32( EPP_FooterMCAtom << 16 ).WriteUInt32( 4 )
1156 .WriteUInt32( pFieldEntry->nFieldStartPos );
1157 }
1158 break;
1159 default:
1160 break;
1161 }
1162 }
1163 }
1164 }
1165
1166 aTextObj.WriteTextSpecInfo( &rOut );
1167
1168 // write Star Office Default TabSizes (if necessary)
1169 if ( aTextObj.ParagraphCount() )
1170 {
1171 pPara = aTextObj.GetParagraph(0);
1172 sal_uInt32 nParaFlags = 0x1f;
1173 sal_Int16 nMask, nNumberingRule[ 10 ];
1174 const sal_uInt32 nTabs = pPara->maTabStop.getLength();
1175 const auto& rTabStops = pPara->maTabStop;
1176
1177 for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
1178 {
1179 pPara = aTextObj.GetParagraph(i);
1180 if ( pPara->bExtendedParameters )
1181 {
1182 nMask = 1 << pPara->nDepth;
1183 if ( nParaFlags & nMask )
1184 {
1185 nParaFlags &=~ nMask;
1186 if ( ( rParaSheet.maParaLevel[ pPara->nDepth ].mnTextOfs != pPara->nTextOfs ) ||
1187 ( rParaSheet.maParaLevel[ pPara->nDepth ].mnBulletOfs != pPara->nBulletOfs ) )
1188 {
1189 nParaFlags |= nMask << 16;
1190 nNumberingRule[ pPara->nDepth << 1 ] = pPara->nTextOfs;
1191 nNumberingRule[ ( pPara->nDepth << 1 ) + 1 ] = static_cast<sal_Int16>(pPara->nBulletOfs);
1192 }
1193 }
1194 }
1195 }
1196 nParaFlags >>= 16;
1197
1198 sal_Int32 nDefaultTabSizeSrc = 2011; // I've no idea where this number came from, honestly
1199 const uno::Reference< beans::XPropertySet > xPropSet( mXModel, uno::UNO_QUERY );
1200 if ( xPropSet.is() )
1201 {
1202 if(ImplGetPropertyValue( xPropSet, "TabStop" ))
1203 {
1204 sal_Int32 nTabStop( 0 );
1205 if ( mAny >>= nTabStop )
1206 nDefaultTabSizeSrc = nTabStop;
1207 }
1208 }
1209 const sal_uInt32 nDefaultTabSize = MapSize( awt::Size( nDefaultTabSizeSrc, 1 ) ).Width;
1210 sal_uInt32 nDefaultTabs = std::abs( maRect.GetWidth() ) / nDefaultTabSize;
1211 if ( nTabs )
1212 nDefaultTabs -= static_cast<sal_Int32>( convertMm100ToMasterUnit(rTabStops[ nTabs - 1 ].Position) / nDefaultTabSize );
1213 if ( static_cast<sal_Int32>(nDefaultTabs) < 0 )
1214 nDefaultTabs = 0;
1215
1216 sal_uInt32 nTabCount = nTabs + nDefaultTabs;
1217 sal_uInt32 i, nTextRulerAtomFlags = 0;
1218
1219 if ( nTabCount )
1220 nTextRulerAtomFlags |= 4;
1221 if ( nParaFlags )
1222 nTextRulerAtomFlags |= ( ( nParaFlags << 3 ) | ( nParaFlags << 8 ) );
1223
1224 if ( nTextRulerAtomFlags )
1225 {
1226 SvStream* pRuleOut = &rOut;
1227 if ( pTextRule )
1228 {
1229 pTextRule->pOut.reset( new SvMemoryStream( 0x100, 0x100 ) );
1230 pRuleOut = pTextRule->pOut.get();
1231 }
1232
1233 sal_uInt32 nRulePos = pRuleOut->Tell();
1234 pRuleOut->WriteUInt32( EPP_TextRulerAtom << 16 ).WriteUInt32( 0 );
1235 pRuleOut->WriteUInt32( nTextRulerAtomFlags );
1236 if ( nTextRulerAtomFlags & 4 )
1237 {
1238 pRuleOut->WriteUInt16( nTabCount );
1239 for ( const css::style::TabStop& rTabStop : rTabStops )
1240 {
1241 sal_uInt16 nPosition = static_cast<sal_uInt16>( convertMm100ToMasterUnit(rTabStop.Position) );
1242 sal_uInt16 nType;
1243 switch ( rTabStop.Alignment )
1244 {
1245 case css::style::TabAlign_DECIMAL : nType = 3; break;
1246 case css::style::TabAlign_RIGHT : nType = 2; break;
1247 case css::style::TabAlign_CENTER : nType = 1; break;
1248
1249 case css::style::TabAlign_LEFT :
1250 default: nType = 0;
1251 }
1252 pRuleOut->WriteUInt16( nPosition )
1253 .WriteUInt16( nType );
1254 }
1255
1256 sal_uInt32 nWidth = 1;
1257 if ( nTabs )
1258 nWidth += static_cast<sal_Int32>( convertMm100ToMasterUnit(rTabStops[ nTabs - 1 ].Position) / nDefaultTabSize );
1259 nWidth *= nDefaultTabSize;
1260 for ( i = 0; i < nDefaultTabs; i++, nWidth += nDefaultTabSize )
1261 pRuleOut->WriteUInt32( nWidth );
1262 }
1263 for ( i = 0; i < 5; i++ )
1264 {
1265 if ( nTextRulerAtomFlags & ( 8 << i ) )
1266 pRuleOut->WriteInt16( nNumberingRule[ i << 1 ] );
1267 if ( nTextRulerAtomFlags & ( 256 << i ) )
1268 pRuleOut->WriteInt16( nNumberingRule[ ( i << 1 ) + 1 ] );
1269 }
1270 sal_uInt32 nBufSize = pRuleOut->Tell() - nRulePos;
1271 pRuleOut->SeekRel( - ( static_cast<sal_Int32>(nBufSize) - 4 ) );
1272 pRuleOut->WriteUInt32( nBufSize - 8 );
1273 pRuleOut->SeekRel( nBufSize - 8 );
1274 }
1275 }
1276 if ( !aTextObj.HasExtendedBullets() )
1277 return;
1278
1279 if ( !aTextObj.ParagraphCount() )
1280 return;
1281
1282 sal_uInt32 nNumberingType = 0, nPos2 = rExtBuStr.Tell();
1283
1285
1286 for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
1287 {
1288 ParagraphObj* pBulletPara = aTextObj.GetParagraph(i);
1289 sal_uInt32 nBulletFlags = 0;
1290 sal_uInt16 nBulletId = pBulletPara->nBulletId;
1291
1292 if ( pBulletPara->bExtendedBulletsUsed )
1293 {
1294 nBulletFlags = 0x800000;
1295 if ( pBulletPara->nNumberingType != SVX_NUM_BITMAP )
1296 nBulletFlags = 0x3000000;
1297 }
1298 rExtBuStr.WriteUInt32( nBulletFlags );
1299
1300 if ( nBulletFlags & 0x800000 )
1301 rExtBuStr.WriteUInt16( nBulletId );
1302 if ( nBulletFlags & 0x1000000 )
1303 {
1304 switch( pBulletPara->nNumberingType )
1305 {
1306 case SVX_NUM_NUMBER_NONE :
1308 nNumberingType = 0;
1309 break;
1314 case SVX_NUM_ROMAN_UPPER :
1315 case SVX_NUM_ROMAN_LOWER :
1316 case SVX_NUM_ARABIC :
1322 nNumberingType = pBulletPara->nMappedNumType;
1323 break;
1324
1325 case SVX_NUM_BITMAP :
1326 nNumberingType = 0;
1327 break;
1328 default: break;
1329 }
1330 rExtBuStr.WriteUInt32( nNumberingType );
1331 }
1332 if ( nBulletFlags & 0x2000000 )
1333 rExtBuStr.WriteUInt16( pBulletPara->nStartWith );
1334 rExtBuStr.WriteUInt32( 0 ).WriteUInt32( 0 );
1335 }
1336 sal_uInt32 nBulletSize = ( rExtBuStr.Tell() - nPos2 ) - 8;
1337 rExtBuStr.SeekRel( - ( static_cast<sal_Int32>(nBulletSize) + 4 ) );
1338 rExtBuStr.WriteUInt32( nBulletSize );
1339 rExtBuStr.SeekRel( nBulletSize );
1340}
1341
1342void PPTWriter::ImplWriteClickAction( SvStream& rSt, css::presentation::ClickAction eCa, bool bMediaClickAction )
1343{
1344 sal_uInt32 nSoundRef = 0; // a reference to a sound in the sound collection, or NULL.
1345 sal_uInt32 nHyperLinkID = 0;// a persistent unique identifier to an external hyperlink object (only valid when action == HyperlinkAction).
1346 sal_uInt8 nAction = 0; // Action See Action Table
1347 sal_uInt8 const nOleVerb = 0; // OleVerb Only valid when action == OLEAction. OLE verb to use, 0 = first verb, 1 = second verb, etc.
1348 sal_uInt8 nJump = 0; // Jump See Jump Table
1349 sal_uInt8 const nFlags = 0; // Bit 1: Animated. If 1, then button is animated
1350 // Bit 2: Stop sound. If 1, then stop current sound when button is pressed.
1351 // Bit 3: CustomShowReturn. If 1, and this is a jump to custom show, then return to this slide after custom show.
1352 sal_uInt8 nHyperLinkType = 0;// HyperlinkType a value from the LinkTo enum, such as LT_URL (only valid when action == HyperlinkAction).
1353
1354 OUString aFile;
1355
1356 /*
1357 Action Table: Action Value
1358 NoAction 0
1359 MacroAction 1
1360 RunProgramAction 2
1361 JumpAction 3
1362 HyperlinkAction 4
1363 OLEAction 5
1364 MediaAction 6
1365 CustomShowAction 7
1366
1367 Jump Table: Jump Value
1368 NoJump 0
1369 NextSlide, 1
1370 PreviousSlide, 2
1371 FirstSlide, 3
1372 LastSlide, 4
1373 LastSlideViewed 5
1374 EndShow 6
1375 */
1376
1377 if ( bMediaClickAction )
1378 nAction = 6;
1379 else switch( eCa )
1380 {
1381 case css::presentation::ClickAction_STOPPRESENTATION :
1382 nJump += 2;
1383 [[fallthrough]];
1384 case css::presentation::ClickAction_LASTPAGE :
1385 nJump++;
1386 [[fallthrough]];
1387 case css::presentation::ClickAction_FIRSTPAGE :
1388 nJump++;
1389 [[fallthrough]];
1390 case css::presentation::ClickAction_PREVPAGE :
1391 nJump++;
1392 [[fallthrough]];
1393 case css::presentation::ClickAction_NEXTPAGE :
1394 {
1395 nJump++;
1396 nAction = 3;
1397 }
1398 break;
1399 case css::presentation::ClickAction_SOUND :
1400 {
1401 if ( ImplGetPropertyValue( "Bookmark" ) )
1402 nSoundRef = maSoundCollection.GetId( *o3tl::doAccess<OUString>(mAny) );
1403 }
1404 break;
1405 case css::presentation::ClickAction_PROGRAM :
1406 {
1407 if ( ImplGetPropertyValue( "Bookmark" ) )
1408 {
1409 INetURLObject aUrl( *o3tl::doAccess<OUString>(mAny) );
1410 if ( INetProtocol::File == aUrl.GetProtocol() )
1411 {
1412 aFile = aUrl.PathToFileName();
1413 nAction = 2;
1414 }
1415 }
1416 }
1417 break;
1418
1419 case css::presentation::ClickAction_BOOKMARK :
1420 {
1421 if ( ImplGetPropertyValue( "Bookmark" ) )
1422 {
1423 OUString aBookmark( *o3tl::doAccess<OUString>(mAny) );
1424 sal_uInt32 nIndex = 0;
1425 for ( const auto& rSlideName : maSlideNameList )
1426 {
1427 if ( rSlideName == aBookmark )
1428 {
1429 // Bookmark is a link to a document page
1430 nAction = 4;
1431 nHyperLinkType = 7;
1432
1433 OUString aHyperString = OUString::number(256 + nIndex) +
1434 "," +
1435 OUString::number(nIndex + 1) +
1436 ",Slide " +
1437 OUString::number(nIndex + 1);
1438 nHyperLinkID = ImplInsertBookmarkURL( aHyperString, 1 | ( nIndex << 8 ) | ( 1U << 31 ), aBookmark, u"", u"", aHyperString );
1439 }
1440 nIndex++;
1441 }
1442 }
1443 }
1444 break;
1445
1446 case css::presentation::ClickAction_DOCUMENT :
1447 {
1448 if ( ImplGetPropertyValue( "Bookmark" ) )
1449 {
1450 OUString aBookmark( *o3tl::doAccess<OUString>(mAny) );
1451 if ( !aBookmark.isEmpty() )
1452 {
1453 nAction = 4;
1454 nHyperLinkType = 8;
1455
1456 OUString aBookmarkFile( aBookmark );
1457 INetURLObject aUrl( aBookmark );
1458 if ( INetProtocol::File == aUrl.GetProtocol() )
1459 aBookmarkFile = aUrl.PathToFileName();
1460 nHyperLinkID = ImplInsertBookmarkURL( aBookmark, sal_uInt32(2 | ( 1U << 31 )), aBookmarkFile, aBookmark, u"", u"" );
1461 }
1462 }
1463 }
1464 break;
1465
1466 case css::presentation::ClickAction_INVISIBLE :
1467 case css::presentation::ClickAction_VERB :
1468 case css::presentation::ClickAction_VANISH :
1469 case css::presentation::ClickAction_MACRO :
1470 default :
1471 break;
1472 }
1473
1474 sal_uInt32 nContainerSize = 24;
1475 if ( nAction == 2 )
1476 nContainerSize += ( aFile.getLength() * 2 ) + 8;
1477 rSt.WriteUInt32( ( EPP_InteractiveInfo << 16 ) | 0xf ).WriteUInt32( nContainerSize )
1479 .WriteUInt32( nSoundRef )
1480 .WriteUInt32( nHyperLinkID )
1481 .WriteUChar( nAction )
1482 .WriteUChar( nOleVerb )
1483 .WriteUChar( nJump )
1484 .WriteUChar( nFlags )
1485 .WriteUInt32( nHyperLinkType );
1486
1487 if ( nAction == 2 ) // run program Action
1488 {
1489 sal_Int32 nLen = aFile.getLength();
1490 rSt.WriteUInt32( ( EPP_CString << 16 ) | 0x20 ).WriteUInt32( nLen * 2 );
1491 for ( sal_Int32 i = 0; i < nLen; i++ )
1492 rSt.WriteUInt16( aFile[i] );
1493 }
1494
1495 rSt.WriteUInt32( ( EPP_InteractiveInfo << 16 ) | 0x1f ).WriteUInt32( 24 ) // Mouse Over Action
1497 for ( int i = 0; i < 4; i++, rSt.WriteUInt32( 0 ) ) ;
1498}
1499
1500bool PPTWriter::ImplGetEffect( const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
1501 css::presentation::AnimationEffect& eEffect,
1502 css::presentation::AnimationEffect& eTextEffect,
1503 bool& bIsSound )
1504{
1505 css::uno::Any aAny;
1506 if ( GetPropertyValue( aAny, rPropSet, "Effect" ) )
1507 aAny >>= eEffect;
1508 else
1509 eEffect = css::presentation::AnimationEffect_NONE;
1510
1511 if ( GetPropertyValue( aAny, rPropSet, "TextEffect" ) )
1512 aAny >>= eTextEffect;
1513 else
1514 eTextEffect = css::presentation::AnimationEffect_NONE;
1515 if ( GetPropertyValue( aAny, rPropSet, "SoundOn" ) )
1516 aAny >>= bIsSound;
1517 else
1518 bIsSound = false;
1519
1520 bool bHasEffect = ( ( eEffect != css::presentation::AnimationEffect_NONE )
1521 || ( eTextEffect != css::presentation::AnimationEffect_NONE )
1522 || bIsSound );
1523 return bHasEffect;
1524};
1525
1527 const sal_uInt32 nStyleInstance, const sal_uInt8 nPlaceHolderId )
1528{
1529 bool bRet = ImplGetText();
1530 if ( bRet && bMasterPage )
1531 {
1532 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1533 sal_uInt32 nPresShapeID = mpPptEscherEx->GenerateShapeId();
1535 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty, nPresShapeID );
1536 EscherPropertyContainer aPropOpt;
1537 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
1538 mnTxId += 0x60;
1539 aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId );
1541 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
1542 aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
1543 aPropOpt.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
1544 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
1545 sal_uInt32 nLineFlags = 0x90001;
1546 if ( aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
1547 nLineFlags |= 0x10001; // draw dashed line if no line
1548 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
1549
1550 SvMemoryStream aExtBu( 0x200, 0x200 );
1551 SvMemoryStream aClientTextBox( 0x200, 0x200 );
1552 ImplWriteTextStyleAtom( aClientTextBox, nStyleInstance, 0, nullptr, aExtBu, &aPropOpt );
1553
1554 mnTxId += 0x60;
1556 aPropOpt.CreateShapeProperties( mXShape );
1557 aPropOpt.Commit( *mpStrm );
1558 mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
1559 mpStrm->WriteInt16( maRect.Top() ).WriteInt16( maRect.Left() ).WriteInt16( maRect.Right() ).WriteInt16( maRect.Bottom() ); // top, left, right, bottom ????
1560 mpPptEscherEx->OpenContainer( ESCHER_ClientData );
1561 mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
1562 mpStrm->WriteUInt32( 0 ) // PlacementID
1563 .WriteUChar( nPlaceHolderId ) // PlaceHolderID
1564 .WriteUChar( 0 ) // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
1565 .WriteUInt16( 0 ); // padword
1566 mpPptEscherEx->CloseContainer(); // ESCHER_ClientData
1567
1568 if ( aClientTextBox.Tell() )
1569 {
1570 mpStrm->WriteUInt32( ( ESCHER_ClientTextbox << 16 ) | 0xf )
1571 .WriteUInt32( aClientTextBox.Tell() );
1572
1573 mpStrm->WriteBytes(aClientTextBox.GetData(), aClientTextBox.Tell());
1574 }
1575 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
1576 }
1577 else
1578 bRet = false;
1579 return bRet;
1580}
1581
1582void PPTWriter::ImplCreateShape( sal_uInt32 nType, ShapeFlag nFlags, EscherSolverContainer& rSolver )
1583{
1584 sal_uInt32 nId = mpPptEscherEx->GenerateShapeId();
1585 mpPptEscherEx->AddShape( nType, nFlags, nId );
1586 rSolver.AddShape( mXShape, nId );
1587}
1588
1590{
1592 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1593 ImplCreateShape( ESCHER_ShpInst_TextBox, ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty, rSolver );
1594 if ( bFill )
1595 rPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
1596 if ( ImplGetText() )
1597 {
1598 mnTxId += 0x60;
1600 }
1601}
1602
1603void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& aSolverContainer, PageType ePageType, bool bMasterPage, int nPageNumber )
1604{
1605 // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
1606 // sal_uInt32 nGroupLevel = 0;
1607
1608 sal_uInt32 nGroups, nShapes, nShapeCount, nPer, nLastPer, nIndices, nOlePictureId;
1609 css::awt::Point aTextRefPoint;
1610
1611 nShapes = mXShapes->getCount();
1612 ResetGroupTable( nShapes );
1613
1614 nIndices = nLastPer = nShapeCount = 0;
1615
1616 bool bIsTitlePossible = true; // powerpoint is not able to handle more than one title
1617
1618 sal_uInt32 nOutlinerCount = 0; // the outline objects have to conform to the layout,
1619 sal_uInt32 nPrevTextStyle = 0; // there are no more than two allowed
1620
1621 nOlePictureId = 0;
1622
1623 bool bAdditionalText = false;
1624
1625 bool bSecOutl = false;
1626 sal_uInt32 nPObjects = 0;
1627
1628 std::unique_ptr<SvMemoryStream> pClientTextBox;
1629 std::unique_ptr<SvMemoryStream> pClientData;
1630
1631 while( GetNextGroupEntry() )
1632 {
1633 nShapeCount++;
1634
1635 nPer = ( 5 * nShapeCount ) / nShapes;
1636 if ( nPer != nLastPer )
1637 {
1638 nLastPer = nPer;
1639 sal_uInt32 nValue = mnPagesWritten * 5 + nPer;
1640 if ( nValue > mnStatMaxValue )
1643 {
1644 mXStatusIndicator->setValue( nValue );
1646 }
1647 }
1648 nGroups = GetGroupsClosed();
1649 for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ;
1650
1651 if ( GetShapeByIndex( GetCurrentGroupIndex(), true ) )
1652 {
1653 bool bIsSound;
1654 bool bMediaClickAction = false;
1655 css::presentation::AnimationEffect eAe;
1656 css::presentation::AnimationEffect eTe;
1657
1658 bool bEffect = ImplGetEffect( mXPropSet, eAe, eTe, bIsSound );
1659 css::presentation::ClickAction eCa = css::presentation::ClickAction_NONE;
1660 if ( ImplGetPropertyValue( "OnClick" ) )
1661 mAny >>= eCa;
1662
1663 bool bGroup = mType == "drawing.Group";
1664 bool bOpenBezier = mType == "drawing.OpenBezier";
1665 bool bClosedBezier = mType == "drawing.ClosedBezier";
1666 bool bPolyPolygon = mType == "drawing.PolyPolygon";
1667 bool bPolyLine = mType == "drawing.PolyLine";
1668 OUString aGraphicPropertyName("Graphic");
1669
1670 const css::awt::Size aSize100thmm( mXShape->getSize() );
1671 const css::awt::Point aPoint100thmm( mXShape->getPosition() );
1672 ::tools::Rectangle aRect100thmm( Point( aPoint100thmm.X, aPoint100thmm.Y ), Size( aSize100thmm.Width, aSize100thmm.Height ) );
1673 EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm.get(), aRect100thmm );
1674
1675 if ( bGroup )
1676 {
1677 css::uno::Reference< css::container::XIndexAccess >
1678 aXIndexAccess( mXShape, css::uno::UNO_QUERY );
1679 if ( EnterGroup( aXIndexAccess ) )
1680 {
1681 std::unique_ptr<SvMemoryStream> pTmp;
1682 if ( eCa != css::presentation::ClickAction_NONE )
1683 {
1684 pTmp.reset(new SvMemoryStream(0x200, 0x200));
1685 ImplWriteClickAction( *pTmp, eCa, bMediaClickAction );
1686 }
1687 sal_uInt32 nShapeId = mpPptEscherEx->EnterGroup(&maRect, pTmp.get());
1688 aSolverContainer.AddShape( mXShape, nShapeId );
1689 }
1690 }
1691 else
1692 {
1693 bool bIsFontwork = false;
1694 bool bIsHatching = false;
1695 css::uno::Any aAny;
1696 if ( GetPropertyValue( aAny, mXPropSet, "IsFontwork", true ) )
1697 aAny >>= bIsFontwork;
1698 if ( GetPropertyValue( aAny, mXPropSet, "FillStyle", true ) )
1699 {
1700 css::drawing::FillStyle eFS;
1701 aAny >>= eFS;
1702 bIsHatching = eFS == css::drawing::FillStyle_HATCH;
1703 if (mType == "drawing.Custom" && eFS == drawing::FillStyle_BITMAP)
1704 {
1705 ShapeFlag nMirrorFlags;
1706 OUString sCustomShapeType;
1708 mXShape, nMirrorFlags, sCustomShapeType);
1709 if (eShapeType == mso_sptMax)
1710 {
1711 // We can't map this custom shape to a PPT preset and it has a bitmap
1712 // fill. Make sure that at least the bitmap fill is not lost.
1713 mType = "drawing.GraphicObject";
1714 aGraphicPropertyName = "Bitmap";
1715 }
1716 }
1717 }
1718 if ( bIsHatching || bIsFontwork || ( mType == "drawing.Measure" ) || ( mType == "drawing.Caption" ) )
1719 {
1720 if ( ImplGetPropertyValue( "BoundRect" ) )
1721 {
1722 auto aRect = o3tl::doAccess<css::awt::Rectangle>(mAny);
1723 maPosition = MapPoint( css::awt::Point( aRect->X, aRect->Y ) );
1724 maSize = MapSize( css::awt::Size( aRect->Width, aRect->Height ) );
1725 maRect = ::tools::Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
1726 }
1727 mType = "drawing.dontknow";
1728 }
1729 }
1730 sal_uInt8 nPlaceHolderAtom = EPP_PLACEHOLDER_NONE;
1731
1732 mnTextSize = 0;
1734
1735 if ( mType == "drawing.Custom" )
1736 {
1737 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1738 ShapeFlag nMirrorFlags;
1739 OUString sCustomShapeType;
1740 MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType( mXShape, nMirrorFlags, sCustomShapeType );
1741 if ( sCustomShapeType == "col-502ad400" || sCustomShapeType == "col-60da8460" )
1742 { // sj: creating metafile for customshapes that can't be saved to ms format properly
1744 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
1745 aSolverContainer );
1746 if ( aPropOpt.CreateGraphicProperties( mXPropSet, "MetaFile", false ) )
1747 {
1748 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
1750 if ( pObj )
1751 {
1752 ::tools::Rectangle aBound = pObj->GetCurrentBoundRect();
1753 maPosition = MapPoint( css::awt::Point( aBound.Left(), aBound.Top() ) );
1754 maSize = MapSize( css::awt::Size ( aBound.GetWidth(), aBound.GetHeight() ) );
1755 maRect = ::tools::Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
1756 mnAngle = 0;
1757 }
1758 }
1759 }
1760 else
1761 {
1762 ImplCreateShape( eShapeType,
1763 nMirrorFlags | ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
1764 aSolverContainer );
1765 aPropOpt.CreateCustomShapeProperties( eShapeType, mXShape );
1766 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape);
1767 if ( ImplGetText() )
1768 {
1769 if ( !aPropOpt.IsFontWork() )
1770 {
1771 mnTxId += 0x60;
1772 aPropOpt.CreateTextProperties( mXPropSet, mnTxId, true );
1773 }
1774 }
1775 }
1776 }
1777 else if ( mType == "drawing.Rectangle" )
1778 {
1779 sal_Int32 nRadius = 0;
1780 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1781 if ( ImplGetPropertyValue( "CornerRadius" ) )
1782 {
1783 mAny >>= nRadius;
1784 nRadius = MapSize( css::awt::Size( nRadius, 0 ) ).Width;
1785 }
1786 if ( nRadius )
1787 {
1789 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
1790 aSolverContainer );
1791 sal_Int32 nLength = maRect.GetWidth();
1792 if ( nLength > maRect.GetHeight() )
1794 nLength >>= 1;
1795 if ( nRadius >= nLength )
1796 nRadius = 0x2a30; // 0x2a30 is PPTs maximum radius
1797 else
1798 {
1799 if (nLength != 0)
1800 nRadius = ( 0x2a30 * nRadius ) / nLength;
1801 else
1802 nRadius = 0x2a30; // 0x2a30 is PPTs maximum radius
1803 }
1804 aPropOpt.AddOpt( ESCHER_Prop_adjustValue, nRadius );
1805 }
1806 else
1807 {
1809 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
1810 aSolverContainer );
1811 }
1812 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
1813 if ( ImplGetText() )
1814 {
1815 mnTxId += 0x60;
1816 aPropOpt.CreateTextProperties( mXPropSet, mnTxId, false, false );
1817 }
1818 }
1819 else if ( mType == "drawing.Ellipse" )
1820 {
1821 css::drawing::CircleKind eCircleKind( css::drawing::CircleKind_FULL );
1822 PolyStyle ePolyKind = PolyStyle::Chord;
1823 if ( ImplGetPropertyValue( "CircleKind" ) )
1824 {
1825 mAny >>= eCircleKind;
1826 switch ( eCircleKind )
1827 {
1828 case css::drawing::CircleKind_SECTION :
1829 {
1830 ePolyKind = PolyStyle::Pie;
1831 }
1832 break;
1833 case css::drawing::CircleKind_ARC :
1834 {
1835 ePolyKind = PolyStyle::Arc;
1836 }
1837 break;
1838
1839 case css::drawing::CircleKind_CUT :
1840 {
1841 ePolyKind = PolyStyle::Chord;
1842 }
1843 break;
1844
1845 default:
1846 eCircleKind = css::drawing::CircleKind_FULL;
1847 }
1848 }
1849 if ( eCircleKind == css::drawing::CircleKind_FULL )
1850 {
1851 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1853 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
1854 aSolverContainer );
1855 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
1856 if ( ImplGetText() )
1857 {
1858 mnTxId += 0x60;
1859 aPropOpt.CreateTextProperties( mXPropSet, mnTxId, false, false );
1860 }
1861 }
1862 else
1863 {
1864 sal_Int32 nStartAngle, nEndAngle;
1865 if ( !ImplGetPropertyValue( "CircleStartAngle" ) )
1866 continue;
1867 nStartAngle = *o3tl::doAccess<sal_Int32>(mAny);
1868 if( !ImplGetPropertyValue( "CircleEndAngle" ) )
1869 continue;
1870 nEndAngle = *o3tl::doAccess<sal_Int32>(mAny);
1871 css::awt::Point aPoint( mXShape->getPosition() );
1872 css::awt::Size aSize( mXShape->getSize() );
1873 css::awt::Point aStart, aEnd, aCenter;
1874 ::tools::Rectangle aRect( Point( aPoint.X, aPoint.Y ), Size( aSize.Width, aSize.Height ) );
1875 aStart.X = static_cast<sal_Int32>( cos( basegfx::deg2rad<100>(nStartAngle) ) * 100.0 );
1876 aStart.Y = - static_cast<sal_Int32>( sin( basegfx::deg2rad<100>(nStartAngle) ) * 100.0 );
1877 aEnd.X = static_cast<sal_Int32>( cos( basegfx::deg2rad<100>(nEndAngle) ) * 100.0 );
1878 aEnd.Y = - static_cast<sal_Int32>( sin( basegfx::deg2rad<100>(nEndAngle) ) * 100.0 );
1879 aCenter.X = aPoint.X + ( aSize.Width / 2 );
1880 aCenter.Y = aPoint.Y + ( aSize.Height / 2 );
1881 aStart.X += aCenter.X;
1882 aStart.Y += aCenter.Y;
1883 aEnd.X += aCenter.X;
1884 aEnd.Y += aCenter.Y;
1885 tools::Polygon aPolygon( aRect, Point( aStart.X, aStart.Y ), Point( aEnd.X, aEnd.Y ), ePolyKind );
1886 bool bNeedText = true;
1887 if ( mnAngle )
1888 {
1889 aPolygon.Rotate( aRect.TopLeft(), Degree10(static_cast<sal_Int16>( mnAngle / 10 )) );
1890 if ( ImplGetText() )
1891 {
1892 // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
1893 // mpPptEscherEx->EnterGroup( 0,0 );
1894 // nGroupLevel = mpPptEscherEx->GetGroupLevel();
1895 bNeedText = false;
1896 bAdditionalText = true;
1897 mnTextSize = 0;
1898 }
1899 mnAngle = 0;
1900 }
1901 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
1903 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
1904 aSolverContainer );
1905 css::awt::Rectangle aNewRect;
1906 switch ( ePolyKind )
1907 {
1908 case PolyStyle::Pie :
1909 case PolyStyle::Chord :
1910 {
1911 if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, false, aNewRect, &aPolygon ) )
1912 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
1913 }
1914 break;
1915
1916 case PolyStyle::Arc :
1917 {
1918 if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, false, aNewRect, &aPolygon ) )
1919 aPropOpt.CreateLineProperties( mXPropSet, false );
1920 }
1921 break;
1922 }
1923 maRect = MapRectangle( aNewRect );
1924 maPosition = css::awt::Point( maRect.Left(), maRect.Top() );
1925 maSize = css::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
1926 if ( bNeedText && ImplGetText() )
1927 {
1928 mnTxId += 0x60;
1929 aPropOpt.CreateTextProperties( mXPropSet, mnTxId, false, false );
1930 }
1931 }
1932 }
1933 else if ( mType == "drawing.Control" )
1934 {
1935 css::uno::Reference< css::drawing::XControlShape > aXControlShape( mXShape, css::uno::UNO_QUERY );
1936 if ( !aXControlShape.is() )
1937 continue;
1938 css::uno::Reference< css::awt::XControlModel > aXControlModel( aXControlShape->getControl() );
1939 if ( !aXControlModel.is() )
1940 continue;
1941
1942 sal_Int64 nAspect = css::embed::Aspects::MSOLE_CONTENT;
1943 try
1944 {
1945 // try to get the aspect when available
1946 css::uno::Reference< css::beans::XPropertySet > xShapeProps( mXShape, css::uno::UNO_QUERY_THROW );
1947 xShapeProps->getPropertyValue("Aspect") >>= nAspect;
1948 }
1949 catch( css::uno::Exception& )
1950 {}
1951
1952 mpExEmbed->WriteUInt32( 0xf | ( EPP_ExControl << 16 ) )
1953 .WriteUInt32( 0 ); // Size of this container
1954
1955 sal_uInt32 nSize, nOldPos = mpExEmbed->Tell();
1956
1957 sal_uInt32 nPageId = nPageNumber;
1958 if ( ePageType == MASTER )
1959 nPageId |= 0x80000000;
1960 else
1961 nPageId += 0x100;
1962 mpExEmbed->WriteUInt32( EPP_ExControlAtom << 16 )
1963 .WriteUInt32( 4 )
1964 .WriteUInt32( nPageId );
1965 std::unique_ptr<PPTExOleObjEntry> pEntry( new PPTExOleObjEntry( OCX_CONTROL, mpExEmbed->Tell() ) );
1966 pEntry->xControlModel = aXControlModel;
1967 pEntry->xShape = mXShape;
1968 maExOleObj.push_back( std::move(pEntry) );
1969
1970 mnExEmbed++;
1971
1972 mpExEmbed->WriteUInt32( 1 | ( EPP_ExOleObjAtom << 16 ) )
1973 .WriteUInt32( 24 )
1974 .WriteUInt32( nAspect )
1975 .WriteUInt32( 2 )
1976 .WriteUInt32( mnExEmbed )
1977 .WriteUInt32( 0 )
1978 .WriteUInt32( 4 ) // index to the persist table
1979 .WriteUInt32( 0x0012de00 );
1980
1981 css::awt::Size aSize;
1982 OUString aControlName;
1983 tools::SvRef<SotStorage> xTemp( new SotStorage( new SvMemoryStream(), true ) );
1984 if ( oox::ole::MSConvertOCXControls::WriteOCXStream( mXModel, xTemp, aXControlModel, aSize, aControlName ) )
1985 {
1986 OUString aUserName( xTemp->GetUserName() );
1987 OUString aOleIdentifier;
1988 if ( !aUserName.isEmpty() )
1989 {
1990 tools::SvRef<SotStorageStream> xCompObj = xTemp->OpenSotStream(
1991 "\1CompObj",
1992 StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYALL );
1993 sal_uInt32 const nStreamLen = xCompObj->remainingSize();
1994 sal_Int16 nVersion, nByteOrder;
1995 sal_Int32 nWinVersion, nVal, nStringLen;
1996 xCompObj->ReadInt16( nVersion )
1997 .ReadInt16( nByteOrder )
1998 .ReadInt32( nWinVersion )
1999 .ReadInt32( nVal );
2000 xCompObj->SeekRel( 16 ); // skipping clsid
2001 xCompObj->ReadInt32( nStringLen );
2002 if ( ( xCompObj->Tell() + nStringLen ) < nStreamLen )
2003 {
2004 xCompObj->SeekRel( nStringLen ); // now skipping the UserName;
2005 xCompObj->ReadInt32( nStringLen );
2006 if ( ( xCompObj->Tell() + nStringLen ) < nStreamLen )
2007 {
2008 xCompObj->SeekRel( nStringLen ); // now skipping the clipboard formatname
2009 xCompObj->ReadInt32( nStringLen );
2010 if ( ( nStringLen > 1 ) && ( ( xCompObj->Tell() + nStringLen ) < nStreamLen ) )
2011 { // i think that the OleIdentifier will follow
2012 OString aTemp = read_uInt8s_ToOString(*xCompObj, nStringLen - 1);
2013 aOleIdentifier = OStringToOUString(aTemp, RTL_TEXTENCODING_MS_1252);
2014 }
2015 }
2016 }
2017 }
2018
2019 PPTWriter::WriteCString( *mpExEmbed, aControlName, 1 );
2020 PPTWriter::WriteCString( *mpExEmbed, aOleIdentifier, 2 );
2021 PPTWriter::WriteCString( *mpExEmbed, aUserName, 3 );
2022 }
2023 nSize = mpExEmbed->Tell() - nOldPos;
2024 mpExEmbed->Seek( nOldPos - 4 );
2025 mpExEmbed->WriteUInt32( nSize );
2027 nOlePictureId = mnExEmbed;
2028
2029 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2030 ShapeFlag const nSpFlags = ShapeFlag::HaveShapeProperty | ShapeFlag::HaveAnchor | ShapeFlag::OLEShape;
2031 ImplCreateShape( ESCHER_ShpInst_HostControl, nSpFlags, aSolverContainer );
2032 if ( aPropOpt.CreateGraphicProperties( mXPropSet, "MetaFile", false ) )
2033 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
2034 //export form control graphic
2036 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
2038 aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0x10000 );
2039
2040 if ( !aControlName.isEmpty() )
2041 {
2042 aPropOpt.AddOpt(ESCHER_Prop_wzName, aControlName);
2043 }
2044 }
2045 else if ( mType == "drawing.Connector" )
2046 {
2047 sal_uInt16 nSpType;
2048 ShapeFlag nSpFlags;
2049 css::awt::Rectangle aNewRect;
2050 if ( !aPropOpt.CreateConnectorProperties( mXShape, aSolverContainer, aNewRect, nSpType, nSpFlags ) )
2051 continue;
2052
2053 maRect = MapRectangle( aNewRect );
2054 maPosition = css::awt::Point( maRect.Left(), maRect.Top() );
2055 maSize = css::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2056
2057 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2058 ImplCreateShape( nSpType, nSpFlags, aSolverContainer );
2059
2060 // #119459# for connector shape, the start point and end point is fixed, and should not be rotated.
2061 mnAngle = 0;
2062 }
2063 else if ( mType == "drawing.Measure" )
2064 {
2065 continue;
2066 }
2067 else if ( mType == "drawing.Line" )
2068 {
2069 css::awt::Rectangle aNewRect;
2070 aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_LINE, false, aNewRect );
2071 maRect = MapRectangle( aNewRect );
2072 maPosition = css::awt::Point( maRect.Left(), maRect.Top() );
2073 maSize = css::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2074 if ( ImplGetText() )
2075 {
2076 aTextRefPoint = css::awt::Point( maRect.Left(), maRect.Top() );
2077 mnTextSize = 0;
2078 bAdditionalText = true;
2079 // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
2080 // mpPptEscherEx->EnterGroup( &maRect,0 );
2081 }
2082 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2083 ShapeFlag nFlags = ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty;
2084
2085 if ( maRect.Top() > maRect.Bottom() )
2086 nFlags |= ShapeFlag::FlipV;
2087 if ( maRect.Left() > maRect.Right() )
2088 nFlags |= ShapeFlag::FlipH;
2089
2090 ImplCreateShape( ESCHER_ShpInst_Line, nFlags, aSolverContainer );
2092 aPropOpt.CreateLineProperties( mXPropSet, false );
2093 mnAngle = 0;
2094 }
2095 else if ( bPolyPolygon )
2096 {
2097 if ( ImplGetText() )
2098 {
2099 // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
2100 // mpPptEscherEx->EnterGroup( 0,0 );
2101 // nGroupLevel = mpPptEscherEx->GetGroupLevel();
2102 bAdditionalText = true;
2103 mnTextSize = 0;
2104 }
2105 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2107 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
2108 aSolverContainer );
2109 css::awt::Rectangle aNewRect;
2111 maRect = MapRectangle( aNewRect );
2112 maPosition = css::awt::Point( maRect.Left(), maRect.Top() );
2113 maSize = css::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2114 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
2115 mnAngle = 0;
2116 }
2117 else if ( bPolyLine )
2118 {
2119 if ( ImplGetText() )
2120 {
2121 // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
2122 // mpPptEscherEx->EnterGroup( 0,0 );
2123 // nGroupLevel = mpPptEscherEx->GetGroupLevel();
2124 bAdditionalText = true;
2125 mnTextSize = 0;
2126 }
2127 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2129 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
2130 aSolverContainer );
2131 css::awt::Rectangle aNewRect;
2133 maRect = MapRectangle( aNewRect );
2134 maPosition = css::awt::Point( maRect.Left(), maRect.Top() );
2135 maSize = css::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2136 aPropOpt.CreateLineProperties( mXPropSet, false );
2137 mnAngle = 0;
2138 }
2139 else if ( bOpenBezier )
2140 {
2141 if ( ImplGetText() )
2142 {
2143 // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
2144 // mpPptEscherEx->EnterGroup( 0,0 );
2145 // nGroupLevel = mpPptEscherEx->GetGroupLevel();
2146 bAdditionalText = true;
2147 mnTextSize = 0;
2148 }
2149 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2151 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
2152 aSolverContainer );
2153 css::awt::Rectangle aNewRect;
2155 maRect = MapRectangle( aNewRect );
2156 maPosition = css::awt::Point( maRect.Left(), maRect.Top() );
2157 maSize = css::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2158 aPropOpt.CreateLineProperties( mXPropSet, false );
2159 mnAngle = 0;
2160 }
2161 else if ( bClosedBezier )
2162 {
2163 if ( ImplGetText() )
2164 {
2165 // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
2166 // mpPptEscherEx->EnterGroup( 0,0 );
2167 // nGroupLevel = mpPptEscherEx->GetGroupLevel();
2168 bAdditionalText = true;
2169 mnTextSize = 0;
2170 }
2171 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2173 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
2174 aSolverContainer );
2175 css::awt::Rectangle aNewRect;
2177 maRect = MapRectangle( aNewRect );
2178 maPosition = css::awt::Point( maRect.Left(), maRect.Top() );
2179 maSize = css::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2180 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
2181 mnAngle = 0;
2182 }
2183 else if ( ( mType == "drawing.GraphicObject" ) || ( mType == "presentation.GraphicObject" ) )
2184 {
2185 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2186
2187 // a GraphicObject can also be a ClickMe element
2188 if ( mbEmptyPresObj && ( ePageType == NORMAL ) )
2189 {
2190 nPlaceHolderAtom = rLayout.nUsedObjectPlaceHolder;
2191 ImplCreateShape( ESCHER_ShpInst_Rectangle, ShapeFlag::HaveAnchor | ShapeFlag::HaveMaster, aSolverContainer );
2192 mnTxId += 0x60;
2193 aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId );
2194 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
2195 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
2197 }
2198 else
2199 {
2200 mXText.set( mXShape, css::uno::UNO_QUERY );
2201
2202 if ( mXText.is() )
2203 mnTextSize = mXText->getString().getLength();
2204
2205 if ( mnTextSize ) // graphic object or area fill
2206 {
2207 /* SJ #i34951#: because M. documents are not allowing GraphicObjects containing text, we
2208 have to create a simple Rectangle with fill bitmap instead (while not allowing BitmapMode_Repeat).
2209 */
2211 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
2212 aSolverContainer );
2213 if ( aPropOpt.CreateGraphicProperties( mXPropSet, "Graphic", true, true, false ) )
2214 {
2217 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
2218 aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x8000000 );
2219 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
2220 if ( ImplGetText() )
2221 {
2222 mnTxId += 0x60;
2223 aPropOpt.CreateTextProperties( mXPropSet, mnTxId, false, false );
2224 }
2225 }
2226 }
2227 else
2228 {
2230 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
2231 aSolverContainer );
2232
2233 if (aPropOpt.CreateGraphicProperties(mXPropSet, aGraphicPropertyName, false,
2234 true))
2235 {
2236 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
2237 }
2238 }
2239 }
2240 }
2241 else if ( ( mType == "drawing.Text" ) || ( mType == "presentation.Notes" ) )
2242 {
2243 if ( ( ePageType == NOTICE ) && mbPresObj )
2244 {
2246 continue;
2247 else
2248 nPlaceHolderAtom = EPP_PLACEHOLDER_NOTESBODY;
2249 }
2250 ImplCreateTextShape( aPropOpt, aSolverContainer, true );
2251 }
2252 else if ( mType == "presentation.TitleText" )
2253 {
2254 if ( mbPresObj )
2255 {
2256 if ( ( ePageType == NOTICE ) && mbEmptyPresObj )
2257 {
2258 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2259 nPlaceHolderAtom = EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE;
2260 ImplCreateShape( ESCHER_ShpInst_Rectangle, ShapeFlag::HaveAnchor, aSolverContainer );
2261 aPropOpt.CreateLineProperties( mXPropSet, false );
2262 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
2263 }
2264 else if ( rLayout.bTitlePossible && bIsTitlePossible )
2265 {
2266 bIsTitlePossible = false;
2267
2268 ImplGetText();
2269 TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Title, maFontCollection, static_cast<PPTExBulletProvider&>(*this) );
2270 if ( ePageType == MASTER )
2271 {
2272 if ( mnTextSize )
2273 {
2274 OUString aUString( mXText->getString() );
2275 sal_uInt16 nChar;
2276
2277 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2278 mnShapeMasterTitle = mpPptEscherEx->GenerateShapeId();
2280 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
2282 EscherPropertyContainer aPropertyOptions;
2283 aPropertyOptions.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
2284 mnTxId += 0x60;
2285 aPropertyOptions.AddOpt( ESCHER_Prop_lTxid, mnTxId );
2287 aPropertyOptions.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
2288 aPropertyOptions.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
2289 aPropertyOptions.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
2290 aPropertyOptions.CreateFillProperties( mXPropSet, true, mXShape );
2291 sal_uInt32 nLineFlags = 0x90001;
2292 if ( aPropertyOptions.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
2293 nLineFlags |= 0x10001; // draw dashed line if no line
2294 aPropertyOptions.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
2295 mnTxId += 0x60;
2296 aPropertyOptions.CreateTextProperties( mXPropSet, mnTxId );
2297 ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
2298 aPropertyOptions.Commit( *mpStrm );
2299 mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
2300 mpStrm->WriteInt16( maRect.Top() ).WriteInt16( maRect.Left() ).WriteInt16( maRect.Right() ).WriteInt16( maRect.Bottom() ); // top, left, right, bottom ????
2301 mpPptEscherEx->OpenContainer( ESCHER_ClientData );
2302 mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
2303 mpStrm->WriteUInt32( 0 ) // PlacementID
2304 .WriteUChar( EPP_PLACEHOLDER_MASTERTITLE ) // PlaceHolderID
2305 .WriteUChar( 0 ) // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
2306 .WriteUInt16( 0 ); // padword
2307 mpPptEscherEx->CloseContainer(); // ESCHER_ClientData
2308 mpPptEscherEx->OpenContainer( ESCHER_ClientTextbox );
2309 mpPptEscherEx->AddAtom( 4, EPP_TextHeaderAtom );
2310 mpStrm->WriteUInt32( EPP_TEXTTYPE_Title );
2311 mpPptEscherEx->AddAtom( mnTextSize << 1, EPP_TextCharsAtom );
2312 const sal_Unicode* pString = aUString.getStr();
2313 for ( sal_uInt32 i = 0; i < mnTextSize; i++ )
2314 {
2315 nChar = pString[ i ]; // 0xa -> 0xb soft newline
2316 if ( nChar == 0xa )
2317 nChar++; // 0xd -> 0xd hard newline
2318 mpStrm->WriteUInt16( nChar );
2319 }
2320 mpPptEscherEx->AddAtom( 6, EPP_BaseTextPropAtom );
2321 mpStrm->WriteUInt32( mnTextSize + 1 ).WriteUInt16( 0 );
2322 mpPptEscherEx->AddAtom( 10, EPP_TextSpecInfoAtom );
2323 mpStrm->WriteUInt32( mnTextSize + 1 ).WriteUInt32( 1 ).WriteUInt16( 0 );
2324 mpPptEscherEx->CloseContainer(); // ESCHER_ClientTextBox
2325 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
2326 }
2327 continue;
2328 }
2329 else
2330 {
2331 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2333 nPlaceHolderAtom = rLayout.nTypeOfTitle;
2335 ShapeFlag::HaveAnchor | ShapeFlag::HaveMaster,
2336 aSolverContainer );
2338 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
2339 mnTxId += 0x60;
2341 ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
2342 if ( mbEmptyPresObj )
2343 {
2344 sal_uInt32 nNoLineDrawDash = 0;
2345 aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
2346 nNoLineDrawDash |= 0x10001;
2347 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
2348 }
2349 }
2350 }
2351 else
2352 mbPresObj = false;
2353 }
2354 if ( !mbPresObj )
2355 {
2356 mType = "drawing.Text";
2357 ImplCreateTextShape( aPropOpt, aSolverContainer, true );
2358 }
2359 }
2360 else if ( ( mType == "presentation.Outliner" ) || ( mType == "presentation.Subtitle" ) )
2361 {
2362 if ( mbPresObj )
2363 {
2364 nOutlinerCount++;
2365 if ( (rLayout.bOutlinerPossible && ( nOutlinerCount == 1 )) ||
2366 (( rLayout.bSecOutlinerPossible && ( nOutlinerCount == 2 ) ) && ( nPrevTextStyle == EPP_TEXTSTYLE_BODY ))
2367 )
2368 {
2369 ImplGetText();
2370 TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Body, maFontCollection, static_cast<PPTExBulletProvider&>(*this) );
2371 if ( ePageType == MASTER )
2372 {
2373 nPrevTextStyle = EPP_TEXTSTYLE_TITLE;
2374 if ( mnTextSize )
2375 {
2376 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2377 mnShapeMasterBody = mpPptEscherEx->GenerateShapeId();
2379 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
2381 EscherPropertyContainer aPropOpt2;
2382 aPropOpt2.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
2383 mnTxId += 0x60;
2384 aPropOpt2.AddOpt( ESCHER_Prop_lTxid, mnTxId );
2385 aPropOpt2.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
2386 aPropOpt2.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
2387 aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90001 );
2388 aPropOpt2.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
2389 aPropOpt2.CreateFillProperties( mXPropSet, true, mXShape );
2390 sal_uInt32 nLineFlags = 0x90001;
2391 if ( aPropOpt2.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
2392 nLineFlags |= 0x10001; // draw dashed line if no line
2393 aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
2394 mnTxId += 0x60;
2396 ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt2 );
2397 aPropOpt2.Commit( *mpStrm );
2398 mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
2399 mpStrm->WriteInt16( maRect.Top() ).WriteInt16( maRect.Left() ).WriteInt16( maRect.Right() ).WriteInt16( maRect.Bottom() ); // top, left, right, bottom ????
2400 mpPptEscherEx->OpenContainer( ESCHER_ClientData );
2401 mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
2402 sal_uInt8 PlaceHolderID = ( mType == "presentation.Subtitle") ? EPP_PLACEHOLDER_MASTERSUBTITLE:EPP_PLACEHOLDER_MASTERBODY;
2403 mpStrm->WriteUInt32( 1 ) // PlacementID
2404 .WriteUChar( PlaceHolderID )/*(sal_uInt8)EPP_PLACEHOLDER_MASTERBODY */ // PlaceHolderID
2405 .WriteUChar( 0 ) // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
2406 .WriteUInt16( 0 ); // padword
2407 mpPptEscherEx->CloseContainer(); // ESCHER_ClientData
2408 mpPptEscherEx->OpenContainer( ESCHER_ClientTextbox ); // printf
2409 mpPptEscherEx->AddAtom( 4, EPP_TextHeaderAtom );
2410 if ( mType == "presentation.Subtitle")
2411 mpStrm->WriteUInt32( EPP_TEXTTYPE_CenterBody );
2412 else
2413 mpStrm->WriteUInt32( EPP_TEXTTYPE_Body );
2414 mnTextSize = aTextObj.Count();
2415 aTextObj.Write( mpStrm.get() );
2416 mpPptEscherEx->BeginAtom();
2417 for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount() ; ++i )
2418 {
2419 ParagraphObj* pPara = aTextObj.GetParagraph(i);
2420 mpStrm->WriteUInt32( pPara->CharacterCount() )
2421 .WriteUInt16( pPara->nDepth );
2422 }
2424 mpPptEscherEx->AddAtom( 10, EPP_TextSpecInfoAtom );
2425 mpStrm->WriteUInt32( mnTextSize ).WriteUInt32( 1 ).WriteUInt16( 0 );
2426
2427 mpPptEscherEx->CloseContainer(); // ESCHER_ClientTextBox
2428 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
2429 }
2430 continue;
2431 }
2432 else
2433 {
2435 nPlaceHolderAtom = rLayout.nTypeOfOutliner;
2436 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2438 ShapeFlag::HaveAnchor | ShapeFlag::HaveMaster,
2439 aSolverContainer );
2441 aPropOpt.CreateFillProperties( mXPropSet, true, mXShape );
2442 mnTxId += 0x60;
2444 ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
2445 if ( mbEmptyPresObj )
2446 {
2447 sal_uInt32 nNoLineDrawDash = 0;
2448 aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
2449 nNoLineDrawDash |= 0x10001;
2450 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
2451 }
2452 }
2453 }
2454 else
2455 mbPresObj = false;
2456 }
2457 if ( !mbPresObj )
2458 {
2459 if (ePageType == MASTER )
2460 {
2462 if (pObj && pObj->IsNotVisibleAsMaster())
2463 continue;
2464 }
2465
2466 mType = "drawing.Text";
2467 ImplCreateTextShape( aPropOpt, aSolverContainer, true );
2468 }
2469 }
2470 else if ( ( mType == "drawing.Page" ) || ( mType == "presentation.Page" ) )
2471 {
2472 if ( ( ePageType == NOTICE ) && mbPresObj )
2473 {
2475 continue;
2476 else
2477 nPlaceHolderAtom = EPP_PLACEHOLDER_NOTESSLIDEIMAGE;
2478 }
2479 ImplCreateTextShape( aPropOpt, aSolverContainer, true );
2480 }
2481 else if ( mType == "drawing.Frame" )
2482 {
2483 continue;
2484 }
2485 else if ( ( mType == "drawing.OLE2" ) || ( mType == "presentation.OLE2" )
2486 || ( mType == "presentation.Chart" ) || ( mType == "presentation.Calc" )
2487 || ( mType == "presentation.OrgChart" ) )
2488 {
2489 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2490 if ( mbEmptyPresObj && ( ePageType == NORMAL ) )
2491 {
2492 nPlaceHolderAtom = rLayout.nUsedObjectPlaceHolder;
2494 ShapeFlag::HaveAnchor | ShapeFlag::HaveMaster,
2495 aSolverContainer );
2496 mnTxId += 0x60;
2497 aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId );
2498 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
2499 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
2501 }
2502 else
2503 {
2504 mpExEmbed->WriteUInt32( 0xf | ( EPP_ExEmbed << 16 ) )
2505 .WriteUInt32( 0 ); // Size of this container
2506
2507 sal_uInt32 nSize, nOldPos = mpExEmbed->Tell();
2508
2509 mpExEmbed->WriteUInt32( EPP_ExEmbedAtom << 16 )
2510 .WriteUInt32( 8 )
2511 .WriteUInt32( 0 ) // follow colorscheme : 0->do not follow
2512 // 1->follow colorscheme
2513 // 2->follow text and background scheme
2514 .WriteUChar( 1 ) // (bool)set if embedded server can not be locked
2515 .WriteUChar( 0 ) // (bool)do not need to send dimension
2516 .WriteUChar( 0 ) // (bool)is object a world table
2517 .WriteUChar( 0 ); // pad byte
2518
2519 std::unique_ptr<PPTExOleObjEntry> pE( new PPTExOleObjEntry( NORMAL_OLE_OBJECT, mpExEmbed->Tell() ) );
2520 pE->xShape = mXShape;
2521 maExOleObj.push_back( std::move(pE) );
2522
2523 mnExEmbed++;
2524
2525 sal_Int64 nAspect = css::embed::Aspects::MSOLE_CONTENT;
2526 try
2527 {
2528 // try to get the aspect when available
2529 css::uno::Reference< css::beans::XPropertySet > xShapeProps( mXShape, css::uno::UNO_QUERY_THROW );
2530 xShapeProps->getPropertyValue("Aspect") >>= nAspect;
2531 }
2532 catch( css::uno::Exception& )
2533 {}
2534
2535 mpExEmbed->WriteUInt32( 1 | ( EPP_ExOleObjAtom << 16 ) )
2536 .WriteUInt32( 24 )
2537 .WriteUInt32( nAspect ) // Aspect
2538 .WriteUInt32( 0 )
2539 .WriteUInt32( mnExEmbed ) // index to the persist table
2540 .WriteUInt32( 0 ) // subtype
2541 .WriteUInt32( 0 )
2542 .WriteUInt32( 0x0012b600 );
2543
2544 nSize = mpExEmbed->Tell() - nOldPos;
2545 mpExEmbed->Seek( nOldPos - 4 );
2546 mpExEmbed->WriteUInt32( nSize );
2548 nOlePictureId = mnExEmbed;
2549
2550 ShapeFlag nSpFlags = ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty;
2551 if ( nOlePictureId )
2552 nSpFlags |= ShapeFlag::OLEShape;
2553 ImplCreateShape( ESCHER_ShpInst_PictureFrame, nSpFlags, aSolverContainer );
2554 if ( aPropOpt.CreateOLEGraphicProperties( mXShape ) )
2555 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
2556 if ( nOlePictureId )
2557 aPropOpt.AddOpt( ESCHER_Prop_pictureId, nOlePictureId );
2558 }
2559 }
2560 else if ( mType == "presentation.Header" )
2561 {
2563 continue;
2564 else
2565 {
2566 mbPresObj = false;
2567 mType = "drawing.Text";
2568 ImplCreateTextShape( aPropOpt, aSolverContainer, true );
2569 }
2570 }
2571 else if ( mType == "presentation.Footer" )
2572 {
2574 continue;
2575 else
2576 {
2577 mbPresObj = false;
2578 mType = "drawing.Text";
2579 ImplCreateTextShape( aPropOpt, aSolverContainer, true );
2580 }
2581 }
2582 else if ( mType == "presentation.DateTime" )
2583 {
2585 continue;
2586 else
2587 {
2588 mbPresObj = false;
2589 mType = "drawing.Text";
2590 ImplCreateTextShape( aPropOpt, aSolverContainer, true );
2591 }
2592 }
2593 else if ( mType == "presentation.SlideNumber" )
2594 {
2596 continue;
2597 else
2598 {
2599 mbPresObj = false;
2600 mType = "drawing.Text";
2601 ImplCreateTextShape( aPropOpt, aSolverContainer, true );
2602 }
2603 }
2604 else if ( (mType.getLength() > 9) && (mType[8] == '3') && (mType[9] == 'D') ) // drawing.3D
2605 {
2606 // SceneObject, CubeObject, SphereObject, LatheObject, ExtrudeObject, PolygonObject
2607 if ( !ImplGetPropertyValue( "Bitmap" ) )
2608 continue;
2609
2610 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2612 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
2613 aSolverContainer );
2614
2615 if ( aPropOpt.CreateGraphicProperties( mXPropSet, "Bitmap", false ) )
2616 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
2617 }
2618 else if ( mType == "drawing.Media" )
2619 {
2620 mnAngle = 0;
2621 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2623 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
2624 aSolverContainer );
2625 if ( aPropOpt.CreateMediaGraphicProperties( mXShape ) )
2626 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
2627 css::uno::Any aAny;
2628 if ( PropValue::GetPropertyValue( aAny, mXPropSet, "MediaURL", true ) )
2629 {
2630 OUString aMediaURL;
2631 if ( (aAny >>= aMediaURL ) && !aMediaURL.isEmpty() )
2632 {
2633 // SJ: creating the Media RefObj
2634 sal_uInt32 nRefId = ++mnExEmbed;
2635
2636 mpExEmbed->WriteUInt16( 0xf )
2637 .WriteUInt16( EPP_ExMCIMovie ) // PPT_PST_ExAviMovie
2638 .WriteUInt32( 0 );
2639 sal_uInt32 nSize, nStart = mpExEmbed->Tell();
2640 mpExEmbed->WriteUInt16( 0 )
2641 .WriteUInt16( EPP_ExObjRefAtom )
2642 .WriteUInt32( 4 )
2643 .WriteUInt32( nRefId );
2644 mpExEmbed->WriteUInt16( 0xf )
2645 .WriteUInt16( EPP_ExVideo )
2646 .WriteUInt32( 0 );
2647
2648 mpExEmbed->WriteUInt16( 0 )
2649 .WriteUInt16( EPP_ExMediaAtom )
2650 .WriteUInt32( 8 )
2651 .WriteUInt32( nRefId )
2652 .WriteUInt16( 0 )
2653 .WriteUInt16( 0x435 );
2654
2655 sal_uInt16 i, nStringLen = static_cast<sal_uInt16>(aMediaURL.getLength());
2656 mpExEmbed->WriteUInt32( EPP_CString << 16 ).WriteUInt32( nStringLen * 2 );
2657 for ( i = 0; i < nStringLen; i++ )
2658 {
2659 sal_Unicode nChar = aMediaURL[ i ];
2660 mpExEmbed->WriteUInt16( nChar );
2661 }
2662 nSize = mpExEmbed->Tell() - nStart;
2663 mpExEmbed->SeekRel( - ( static_cast<sal_Int32>(nSize) + 4 ) );
2664 mpExEmbed->WriteUInt32( nSize ); // size of PPT_PST_ExMCIMovie
2665 mpExEmbed->SeekRel( 0x10 );
2666 nSize -= 20;
2667 mpExEmbed->WriteUInt32( nSize ); // PPT_PST_ExMediaAtom
2668 mpExEmbed->SeekRel( nSize );
2669
2670 if ( !pClientData )
2671 pClientData.reset(new SvMemoryStream( 0x200, 0x200 ));
2672 pClientData->WriteUInt16( 0 )
2673 .WriteUInt16( EPP_ExObjRefAtom )
2674 .WriteUInt32( 4 )
2675 .WriteUInt32( nRefId );
2676 // write EPP_InteractiveInfo container for no_action
2677 pClientData->WriteUInt32( ( EPP_InteractiveInfo << 16 ) | 0xf ).WriteUInt32( 24 );
2678 pClientData->WriteUInt16( 0 )
2679 .WriteUInt16( EPP_InteractiveInfoAtom )
2680 .WriteUInt32( 16 )
2681 .WriteUInt32( 0 )
2682 .WriteUInt32( 0 )
2683 .WriteUChar( 6 )
2684 .WriteUChar( 0 )
2685 .WriteUChar( 0 )
2686 .WriteUChar( 0 )
2687 .WriteUInt32( 0 );
2688 }
2689 }
2690 }
2691 else if ( (mType == "drawing.Table") || (mType == "presentation.Table") )
2692 {
2693 if ( eCa != css::presentation::ClickAction_NONE )
2694 {
2695 SvMemoryStream aTmp(0x200, 0x200);
2696 ImplWriteClickAction( aTmp, eCa, bMediaClickAction );
2697 }
2698 ImplCreateTable( mXShape, aSolverContainer, aPropOpt );
2699 continue;
2700 }
2701 else if ( mType == "drawing.dontknow" )
2702 {
2703 mnAngle = 0;
2704 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2706 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty,
2707 aSolverContainer );
2708 if ( aPropOpt.CreateGraphicProperties( mXPropSet, "MetaFile", false ) )
2709 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
2710 }
2711 else
2712 {
2713 continue;
2714 }
2715
2716 bool bClientData = ( bEffect || ( eCa != css::presentation::ClickAction_NONE ) ||
2717 nPlaceHolderAtom || nOlePictureId );
2718 if ( bClientData )
2719 {
2720 if ( nPlaceHolderAtom )
2721 {
2722 sal_Int32 nPlacementID = -1;
2724 nPlacementID = nIndices++;
2725 else
2726 {
2727 switch ( nPlaceHolderAtom )
2728 {
2729 default :
2730 {
2731 if ( nPlaceHolderAtom < 19 )
2732 break;
2733 [[fallthrough]];
2734 }
2739 nPlacementID = nIndices++;
2740 }
2741 }
2742 if ( !pClientData )
2743 pClientData.reset(new SvMemoryStream( 0x200, 0x200 ));
2744
2745 pClientData->WriteUInt32( EPP_OEPlaceholderAtom << 16 ).WriteUInt32( 8 )
2746 .WriteInt32( nPlacementID ) // PlacementID
2747 .WriteUChar( nPlaceHolderAtom ) // PlaceHolderID
2748 .WriteUChar( 0 ) // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
2749 .WriteUInt16( 0 ); // padword
2750 }
2751 if ( nOlePictureId )
2752 {
2753 if ( !pClientData )
2754 pClientData.reset(new SvMemoryStream( 0x200, 0x200 ));
2755
2756 pClientData->WriteUInt32( EPP_ExObjRefAtom << 16 ).WriteUInt32( 4 )
2757 .WriteUInt32( nOlePictureId );
2758 nOlePictureId = 0;
2759 }
2760 if ( bEffect && !pClientData )
2761 {
2762 pClientData.reset(new SvMemoryStream( 0x200, 0x200 ));
2763 }
2764
2765 if ( eCa != css::presentation::ClickAction_NONE )
2766 {
2767 if ( !pClientData )
2768 pClientData.reset(new SvMemoryStream( 0x200, 0x200 ));
2769 ImplWriteClickAction( *pClientData, eCa, bMediaClickAction );
2770 }
2771 }
2773 {
2774 if ( !pClientTextBox )
2775 pClientTextBox.reset(new SvMemoryStream( 0x200, 0x200 ));
2776
2777 if ( !mbEmptyPresObj )
2778 {
2779 if ( ( ePageType == NORMAL ) && !bMasterPage )
2780 {
2781 sal_uInt32 nTextType = EPP_TEXTTYPE_Body;
2783 {
2784 if ( bSecOutl )
2785 nTextType = EPP_TEXTTYPE_HalfBody;
2786 else if ( mType == "presentation.Subtitle" )
2787 nTextType = EPP_TEXTTYPE_CenterBody;
2788 bSecOutl = true;
2789 }
2790 else
2791 nTextType = EPP_TEXTTYPE_Title;
2792
2793 TextRuleEntry aTextRule;
2794 SvMemoryStream aExtBu( 0x200, 0x200 );
2795 ImplGetText();
2796 ImplWriteTextStyleAtom( *pClientTextBox, nTextType, nPObjects, &aTextRule, aExtBu, nullptr );
2797 ImplWriteExtParaHeader( aExtBu, nPObjects++, nTextType, nPageNumber + 0x100 );
2798 SvMemoryStream* pOut = aTextRule.pOut.get();
2799 if ( pOut )
2800 {
2801 pClientTextBox->WriteBytes(pOut->GetData(), pOut->Tell());
2802 aTextRule.pOut.reset();
2803 }
2804 if ( aExtBu.Tell() )
2805 {
2806 if ( !pClientData )
2807 pClientData.reset(new SvMemoryStream( 0x200, 0x200 ));
2808 ImplProgTagContainer( pClientData.get(), &aExtBu );
2809 }
2810 }
2811 }
2812 }
2813 else
2814 {
2815 if ( !aPropOpt.IsFontWork() )
2816 {
2817 if ( mnTextSize || ( nPlaceHolderAtom == EPP_PLACEHOLDER_MASTERDATE ) || ( nPlaceHolderAtom == EPP_PLACEHOLDER_NOTESBODY ) )
2818 {
2819 int nInstance2;
2820 if ( ( nPlaceHolderAtom == EPP_PLACEHOLDER_MASTERDATE ) || ( nPlaceHolderAtom == EPP_PLACEHOLDER_NOTESBODY ) )
2821 nInstance2 = 2;
2822 else
2823 nInstance2 = EPP_TEXTTYPE_Other; // Text in a Shape
2824
2825 if ( !pClientTextBox )
2826 pClientTextBox.reset(new SvMemoryStream( 0x200, 0x200 ));
2827
2828 SvMemoryStream aExtBu( 0x200, 0x200 );
2829 ImplWriteTextStyleAtom( *pClientTextBox, nInstance2, 0, nullptr, aExtBu, &aPropOpt );
2830 if ( aExtBu.Tell() )
2831 {
2832 if ( !pClientData )
2833 pClientData.reset(new SvMemoryStream( 0x200, 0x200 ));
2834 ImplProgTagContainer( pClientData.get(), &aExtBu );
2835 }
2836 }
2837 else if ( nPlaceHolderAtom >= 19 )
2838 {
2839 if ( !pClientTextBox )
2840 pClientTextBox.reset(new SvMemoryStream( 12 ));
2841
2842 pClientTextBox->WriteUInt32( EPP_TextHeaderAtom << 16 ).WriteUInt32( 4 )
2843 .WriteUInt32( 7 );
2844 }
2845 }
2846 }
2847
2849 maRect.Normalize();
2850 if ( mnAngle )
2851 ImplFlipBoundingBox( aPropOpt );
2852 aPropOpt.CreateShapeProperties( mXShape );
2853 aPropOpt.Commit( *mpStrm );
2854 if ( GetCurrentGroupLevel() > 0 )
2855 mpPptEscherEx->AddChildAnchor( maRect );
2856 else
2857 mpPptEscherEx->AddClientAnchor( maRect );
2858
2859 if ( pClientData )
2860 {
2861 mpStrm->WriteUInt32( ( ESCHER_ClientData << 16 ) | 0xf )
2862 .WriteUInt32( pClientData->Tell() );
2863
2864 mpStrm->WriteBytes(pClientData->GetData(), pClientData->Tell());
2865 pClientData.reset();
2866 }
2867 if ( pClientTextBox )
2868 {
2869 mpStrm->WriteUInt32( ( ESCHER_ClientTextbox << 16 ) | 0xf )
2870 .WriteUInt32( pClientTextBox->Tell() );
2871
2872 mpStrm->WriteBytes(pClientTextBox->GetData(), pClientTextBox->Tell());
2873 pClientTextBox.reset();
2874 }
2875 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
2876 }
2877 nPrevTextStyle = mnTextStyle;
2878
2879 if ( bAdditionalText )
2880 {
2881 bAdditionalText = false;
2882
2883 css::uno::Any aAny;
2884 EscherPropertyContainer aPropOpt;
2886 mXPropSet, "RotateAngle", true ) )
2887 ? *o3tl::doAccess<sal_Int32>(aAny)
2888 : 0;
2889
2890 aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
2891 aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
2892 if ( mType == "drawing.Line" )
2893 {
2894 double fDist = hypot( maRect.GetWidth(), maRect.GetHeight() );
2895 maRect = ::tools::Rectangle( Point( aTextRefPoint.X, aTextRefPoint.Y ),
2896 Point( static_cast<sal_Int32>( aTextRefPoint.X + fDist ), aTextRefPoint.Y - 1 ) );
2897 ImplCreateTextShape( aPropOpt, aSolverContainer, false );
2898 aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x60006 ); // Size Shape To Fit Text
2899 if ( mnAngle < 0 )
2900 mnAngle = ( 36000 + mnAngle ) % 36000;
2901 if ( mnAngle )
2902 ImplFlipBoundingBox( aPropOpt );
2903 }
2904 else
2905 {
2906 ImplCreateTextShape( aPropOpt, aSolverContainer, false );
2907 if ( mnAngle < 0 )
2908 mnAngle = ( 36000 + mnAngle ) % 36000;
2909 else
2910 mnAngle = ( 36000 - ( mnAngle % 36000 ) );
2911
2912 mnAngle *= 655;
2913 mnAngle += 0x8000;
2914 mnAngle &=~0xffff; // round nAngle to full grad
2915 aPropOpt.AddOpt( ESCHER_Prop_Rotation, mnAngle );
2916
2917 // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
2918 // mpPptEscherEx->SetGroupSnapRect( nGroupLevel, maRect );
2919 // mpPptEscherEx->SetGroupLogicRect( nGroupLevel, maRect );
2920 }
2921 if ( !pClientTextBox )
2922 pClientTextBox.reset(new SvMemoryStream( 0x200, 0x200 ));
2923
2924 SvMemoryStream aExtBu( 0x200, 0x200 );
2925 ImplWriteTextStyleAtom( *pClientTextBox, EPP_TEXTTYPE_Other, 0, nullptr, aExtBu, &aPropOpt );
2926
2927 aPropOpt.CreateShapeProperties( mXShape );
2928 aPropOpt.Commit( *mpStrm );
2929 if ( GetCurrentGroupLevel() > 0 )
2930 mpPptEscherEx->AddChildAnchor( maRect );
2931 else
2932 mpPptEscherEx->AddClientAnchor( maRect );
2933
2934 mpStrm->WriteUInt32( ( ESCHER_ClientTextbox << 16 ) | 0xf )
2935 .WriteUInt32( pClientTextBox->Tell() );
2936
2937 mpStrm->WriteBytes(pClientTextBox->GetData(), pClientTextBox->Tell());
2938 pClientTextBox.reset();
2939
2940 mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
2941
2942 // #i119551# PPT does not support groups of polygons and text (MS patch KB2289187)
2943 // mpPptEscherEx->LeaveGroup();
2944 }
2945 }
2946 ClearGroupTable(); // storing groups if any are still open, which should not be the case
2947 nGroups = GetGroupsClosed();
2948 for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ;
2950}
2951
2953{
2954 sal_Int32 mnPos; // specifies the distance to the top/left position of the table
2955 table::BorderLine maCellBorder;
2956
2957 CellBorder() : mnPos ( 0 ) {};
2958};
2959
2960bool PPTWriter::ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2)
2961{
2962 sal_Int32 nLineWidth = pCellBorder->maCellBorder.OuterLineWidth + pCellBorder->maCellBorder.InnerLineWidth;
2963 if ( nLineWidth )
2964 {
2965 nLineWidth *= 2;
2966 mnAngle = 0;
2967 mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2968 EscherPropertyContainer aPropOptSp;
2969
2970 sal_uInt32 nId = mpPptEscherEx->GenerateShapeId();
2972 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty | ShapeFlag::Child,
2973 nId );
2975 aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0xa0008 );
2976 aPropOptSp.AddOpt( ESCHER_Prop_fshadowObscured, 0x20000 );
2977
2978 sal_uInt32 nBorderColor = pCellBorder->maCellBorder.Color & 0xff00; // green
2979 nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color ) << 16; // red
2980 nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color >> 16 ); // blue
2981 aPropOptSp.AddOpt( ESCHER_Prop_lineColor, nBorderColor );
2982
2983 aPropOptSp.AddOpt( ESCHER_Prop_lineWidth, nLineWidth * 360 );
2984 aPropOptSp.AddOpt( ESCHER_Prop_fc3DLightFace, 0x80000 );
2985 aPropOptSp.Commit( *mpStrm );
2986 mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
2987 mpStrm ->WriteInt32( nX1 )
2988 .WriteInt32( nY1 )
2989 .WriteInt32( nX2 )
2990 .WriteInt32( nY2 );
2991 mpPptEscherEx->CloseContainer();
2992 return true;
2993 }
2994 return false;
2995}
2996
2997//get merged cell's width
2998static sal_Int32 GetCellRight( sal_Int32 nColumn,
2999 ::tools::Rectangle const & rect,
3000 std::vector< std::pair< sal_Int32, sal_Int32 > >& aColumns,
3001 uno::Reference< table::XMergeableCell > const & xCell )
3002{
3003 sal_Int32 nRight = aColumns[ nColumn ].first + aColumns[ nColumn ].second;
3004 for ( sal_Int32 nColumnSpan = 1; nColumnSpan < xCell->getColumnSpan(); nColumnSpan++ )
3005 {
3006 sal_uInt32 nC = nColumnSpan + nColumn;
3007 if ( nC < aColumns.size() )
3008 nRight += aColumns[ nC ].second;
3009 else
3010 nRight = rect.Right();
3011 }
3012 return nRight;
3013}
3014//get merged cell's height
3015static sal_Int32 GetCellBottom( sal_Int32 nRow,
3016 ::tools::Rectangle const & rect,
3017 std::vector< std::pair< sal_Int32, sal_Int32 > >& aRows,
3018 uno::Reference< table::XMergeableCell > const & xCell )
3019{
3020 sal_Int32 nBottom = aRows[nRow].first + aRows[nRow].second;
3021 for ( sal_Int32 nRowSpan = 1; nRowSpan < xCell->getRowSpan(); nRowSpan++ )
3022 {
3023 sal_uInt32 nR = nRowSpan + nRow;
3024 if ( nR < aRows.size() )
3025 nBottom += aRows[ nR ].second;
3026 else
3027 nBottom = rect.Bottom();
3028 }
3029 return nBottom;
3030}
3031
3032void PPTWriter::WriteCString( SvStream& rSt, std::u16string_view aString, sal_uInt32 nInstance )
3033{
3034 sal_Int32 nLen = aString.size();
3035 if ( nLen )
3036 {
3037 rSt.WriteUInt32( ( nInstance << 4 ) | ( EPP_CString << 16 ) )
3038 .WriteUInt32( nLen << 1 );
3039 for ( sal_Int32 i = 0; i < nLen; i++ )
3040 rSt.WriteUInt16( aString[i] );
3041 }
3042}
3043
3044namespace {
3045
3046class ContainerGuard
3047{
3048private:
3049 PptEscherEx* m_pPptEscherEx;
3050public:
3051 ContainerGuard(PptEscherEx* pPptEscherEx, sal_uInt16 nRecord)
3052 : m_pPptEscherEx(pPptEscherEx)
3053 {
3054 m_pPptEscherEx->OpenContainer(nRecord);
3055 }
3056 ~ContainerGuard()
3057 {
3058 m_pPptEscherEx->CloseContainer();
3059 }
3060};
3061
3062}
3063
3064void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape > const & rXShape, EscherSolverContainer& aSolverContainer,
3065 EscherPropertyContainer& aPropOpt )
3066{
3067 try
3068 {
3069 uno::Reference< table::XTable > xTable;
3070 if ( mXPropSet->getPropertyValue( "Model" ) >>= xTable )
3071 {
3072 uno::Reference< table::XColumnRowRange > xColumnRowRange( xTable, uno::UNO_QUERY_THROW );
3073 uno::Reference< container::XIndexAccess > xColumns( xColumnRowRange->getColumns(), uno::UNO_QUERY_THROW );
3074 uno::Reference< container::XIndexAccess > xRows( xColumnRowRange->getRows(), uno::UNO_QUERY_THROW );
3075 sal_uInt16 nRowCount = static_cast< sal_uInt16 >( xRows->getCount() );
3076 sal_uInt16 nColumnCount = static_cast< sal_uInt16 >( xColumns->getCount() );
3077
3078 std::vector< std::pair< sal_Int32, sal_Int32 > > aColumns;
3079 std::vector< std::pair< sal_Int32, sal_Int32 > > aRows;
3080
3081 awt::Point aPosition( MapPoint( rXShape->getPosition() ) );
3082 sal_Int32 nPosition = aPosition.X;
3083 for ( sal_Int32 x = 0; x < nColumnCount; x++ )
3084 {
3085 uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( x ), uno::UNO_QUERY_THROW );
3086 awt::Size aS( 0, 0 );
3087 xPropSet->getPropertyValue( "Width" ) >>= aS.Width;
3088 awt::Size aM( MapSize( aS ) );
3089 aColumns.emplace_back( nPosition, aM.Width );
3090 nPosition += aM.Width;
3091 if ( x == nColumnCount - 1 && nPosition != maRect.Right() )
3092 maRect.SetRight( nPosition );
3093 }
3094
3095 nPosition = aPosition.Y;
3096 for ( sal_Int32 y = 0; y < nRowCount; y++ )
3097 {
3098 uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( y ), uno::UNO_QUERY_THROW );
3099 awt::Size aS( 0, 0 );
3100 xPropSet->getPropertyValue( "Height" ) >>= aS.Height;
3101 awt::Size aM( MapSize( aS ) );
3102 aRows.emplace_back( nPosition, aM.Height );
3103 nPosition += aM.Height;
3104 if ( y == nRowCount - 1 && nPosition != maRect.Bottom())
3105 maRect.SetBottom( nPosition );
3106 }
3107 std::optional<ContainerGuard> xSpgrContainer(std::in_place, mpPptEscherEx.get(), ESCHER_SpgrContainer);
3108 std::optional<ContainerGuard> xSpContainer(std::in_place, mpPptEscherEx.get(), ESCHER_SpContainer);
3109 mpPptEscherEx->AddAtom( 16, ESCHER_Spgr, 1 );
3110 mpStrm ->WriteInt32( maRect.Left() ) // Bounding box for the grouped shapes to which they are attached
3111 .WriteInt32( maRect.Top() )
3112 .WriteInt32( maRect.Right() )
3113 .WriteInt32( maRect.Bottom() );
3114
3115 sal_uInt32 nShapeId = mpPptEscherEx->GenerateShapeId();
3116 mpPptEscherEx->AddShape( ESCHER_ShpInst_Min, ShapeFlag::HaveAnchor | ShapeFlag::Group, nShapeId );
3117 // TODO: check flags, comment does not match code // Flags: Group | Patriarch
3118 aSolverContainer.AddShape( rXShape, nShapeId );
3119 EscherPropertyContainer aPropOpt2;
3120
3121 SvMemoryStream aMemStrm;
3122 aMemStrm.WriteUInt16( nRowCount )
3123 .WriteUInt16( nRowCount )
3124 .WriteUInt16( 4 );
3125
3126 for( const auto& rRow : aRows )
3127 aMemStrm.WriteInt32( rRow.second );
3128
3129 aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x1000100 );
3130 aPropOpt2.AddOpt( ESCHER_Prop_tableProperties, 1 );
3131 aPropOpt2.AddOpt(ESCHER_Prop_tableRowProperties, true, 0, aMemStrm);
3132 aPropOpt.CreateShapeProperties( rXShape );
3133 aPropOpt.Commit( *mpStrm );
3134 aPropOpt2.Commit( *mpStrm, 3, ESCHER_UDefProp );
3135 if ( GetCurrentGroupLevel() > 0 )
3136 mpPptEscherEx->AddChildAnchor( maRect );
3137 else
3138 mpPptEscherEx->AddClientAnchor( maRect );
3139 xSpContainer.reset(); //ESCHER_SpContainer
3140
3141 uno::Reference< table::XCellRange > xCellRange( xTable, uno::UNO_QUERY_THROW );
3142 for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
3143 {
3144 for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
3145 {
3146 uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nRow ), uno::UNO_QUERY_THROW );
3147 if ( !xCell->isMerged() )
3148 {
3149 sal_Int32 nLeft = aColumns[ nColumn ].first;
3150 sal_Int32 nTop = aRows[ nRow ].first;
3151 sal_Int32 nRight = GetCellRight( nColumn, maRect,aColumns,xCell );
3152 sal_Int32 nBottom = GetCellBottom( nRow, maRect,aRows,xCell );
3153
3155 mXPropSet.set( xCell, uno::UNO_QUERY_THROW );
3156 mXText.set( xCell, uno::UNO_QUERY_THROW );
3157 mnTextSize = mXText->getString().getLength();
3158
3159 css::uno::Any aAny;
3160 if ( GetPropertyValue( aAny, mXPropSet, "FontIndependentLineSpacing", true ) )
3162
3163 EscherPropertyContainer aPropOptSp;
3164 std::optional<ContainerGuard> xCellContainer(std::in_place, mpPptEscherEx.get(), ESCHER_SpContainer);
3166 ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty | ShapeFlag::Child,
3167 aSolverContainer );
3168 aPropOptSp.CreateFillProperties( mXPropSet, true );
3169 aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
3170 mnTxId += 0x60;
3171 aPropOptSp.CreateTextProperties( mXPropSet, mnTxId );
3173
3174 SvMemoryStream aClientTextBox( 0x200, 0x200 );
3175 SvMemoryStream aExtBu( 0x200, 0x200 );
3176
3177 ImplWriteTextStyleAtom( aClientTextBox, EPP_TEXTTYPE_Other, 0, nullptr, aExtBu, &aPropOptSp );
3178
3179 // need write client data for extend bullet
3180 if ( aExtBu.Tell() )
3181 {
3182 SvMemoryStream aClientData( 0x200, 0x200 );
3183 ImplProgTagContainer( &aClientData, &aExtBu );
3184 mpStrm->WriteUInt32( ( ESCHER_ClientData << 16 ) | 0xf )
3185 .WriteUInt32( aClientData.Tell() );
3186
3187 mpStrm->WriteBytes(aClientData.GetData(), aClientData.Tell());
3188 }
3189
3190 aPropOptSp.Commit( *mpStrm );
3191 mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
3192 mpStrm ->WriteInt32( nLeft )
3193 .WriteInt32( nTop )
3194 .WriteInt32( nRight )
3195 .WriteInt32( nBottom );
3196
3197 mpStrm->WriteUInt32( ( ESCHER_ClientTextbox << 16 ) | 0xf )
3198 .WriteUInt32( aClientTextBox.Tell() );
3199
3200 mpStrm->WriteBytes(aClientTextBox.GetData(), aClientTextBox.Tell());
3201 xCellContainer.reset();
3202 }
3203 }
3204 }
3205
3206 // creating horz lines
3207 for( sal_Int32 nLine = 0; nLine < ( xRows->getCount() + 1 ); nLine++ )
3208 {
3209 for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
3210 {
3211 CellBorder aCellBorder;
3212 aCellBorder.mnPos = aColumns[ nColumn ].first;
3213 bool bTop = false;
3214 //write nLine*nColumn cell's top border
3215 if ( nLine < xRows->getCount() )
3216 { // top border
3217 uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine ), uno::UNO_QUERY_THROW );
3218 if ( !xCell->isMerged() )
3219 {
3220 uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW );
3221 table::BorderLine aBorderLine;
3222 if ( xPropSet2->getPropertyValue( "TopBorder" ) >>= aBorderLine )
3223 aCellBorder.maCellBorder = aBorderLine;
3224 sal_Int32 nRight = GetCellRight( nColumn, maRect,aColumns,xCell );
3225 bTop = ImplCreateCellBorder( &aCellBorder, aCellBorder.mnPos,
3226 aRows[ nLine ].first, nRight, aRows[ nLine ].first );
3227 }
3228 }
3229
3230 //if nLine*nColumn cell's top border is empty, check (nLine-1)*nColumn cell's bottom border
3231 //and write the last row's bottom border
3232 if (( nLine && !bTop ) || (nLine == xRows->getCount()))
3233 { // bottom border
3234 sal_Int32 nRow = nLine;
3235
3236 while( nRow )
3237 { //find last no merged cell
3238 uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nRow - 1 ), uno::UNO_QUERY_THROW );
3239 if ( !xCell->isMerged() )
3240 {
3241 sal_Int32 nRight = GetCellRight( nColumn, maRect,aColumns,xCell );
3242 sal_Int32 nBottom = GetCellBottom( nRow - 1, maRect,aRows,xCell );
3243 if ( nBottom == ( aRows[ nLine-1 ].first + aRows[ nLine-1 ].second ) )
3244 {
3245 uno::Reference< table::XMergeableCell > xCellOwn( xCellRange->getCellByPosition( nColumn, nRow - 1 ), uno::UNO_QUERY_THROW );
3246 uno::Reference< beans::XPropertySet > xPropSet2( xCellOwn, uno::UNO_QUERY_THROW );
3247 table::BorderLine aBorderLine;
3248 if ( xPropSet2->getPropertyValue( "BottomBorder" ) >>= aBorderLine )
3249 aCellBorder.maCellBorder = aBorderLine;
3250 ImplCreateCellBorder( &aCellBorder, aCellBorder.mnPos,
3251 nBottom, nRight, nBottom);
3252 }
3253 nRow=0;
3254 }
3255 else
3256 nRow--;
3257 }
3258 }
3259 }
3260 }
3261
3262 // creating vertical lines
3263 for( sal_Int32 nLine = 0; nLine < ( xColumns->getCount() + 1 ); nLine++ )
3264 {
3265 for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
3266 {
3267
3268 CellBorder aCellBorder;
3269 aCellBorder.mnPos = aRows[ nRow].first;
3270 bool bLeft = false;
3271 if ( nLine < xColumns->getCount() )
3272 { // left border
3273 uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine, nRow ), uno::UNO_QUERY_THROW );
3274 if (!xCell->isMerged() )
3275 {
3276 uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW );
3277 table::BorderLine aBorderLine;
3278 if ( xCellSet->getPropertyValue( "LeftBorder" ) >>= aBorderLine )
3279 aCellBorder.maCellBorder = aBorderLine;
3280 sal_Int32 nBottom = GetCellBottom( nRow, maRect, aRows,xCell );
3281 bLeft = ImplCreateCellBorder( &aCellBorder, aColumns[nLine].first, aCellBorder.mnPos,
3282 aColumns[nLine].first, nBottom );
3283 }
3284 }
3285 if ( ( nLine && !bLeft )||(nLine == xColumns->getCount()))
3286 { // right border
3287 sal_Int32 nColumn = nLine;
3288 while ( nColumn )
3289 {
3290 uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn - 1, nRow ), uno::UNO_QUERY_THROW );
3291 if (!xCell->isMerged() )
3292 {
3293 sal_Int32 nRight = GetCellRight( nColumn-1, maRect, aColumns,xCell );
3294 sal_Int32 nBottom = GetCellBottom( nRow, maRect, aRows, xCell );
3295 if ( nRight == (aColumns[nLine-1].first + aColumns[nLine-1].second) )
3296 {
3297 uno::Reference< table::XMergeableCell > xCellOwn( xCellRange->getCellByPosition( nColumn - 1, nRow ), uno::UNO_QUERY_THROW );
3298 uno::Reference< beans::XPropertySet > xCellSet( xCellOwn, uno::UNO_QUERY_THROW );
3299 table::BorderLine aBorderLine;
3300 if ( xCellSet->getPropertyValue( "RightBorder" ) >>= aBorderLine )
3301 aCellBorder.maCellBorder = aBorderLine;
3302 ImplCreateCellBorder( &aCellBorder, nRight, aCellBorder.mnPos,
3303 nRight, nBottom );
3304 }
3305 nColumn = 0;
3306 }
3307 else
3308 nColumn --;
3309 }
3310 }
3311 }
3312 }
3313
3314 xSpgrContainer.reset(); //ESCHER_SpgrContainer
3315 }
3316 }
3317 catch( uno::Exception& )
3318 {
3319 }
3320}
3321
3323{
3324 sal_uInt32 nSize, nPos = pStrm->Tell();
3325 pStrm->WriteUInt32( EPP_TextCharsAtom << 16 ).WriteUInt32( 0 );
3326 for ( sal_uInt32 i = 0; i < ParagraphCount(); ++i )
3327 GetParagraph(i)->Write( pStrm );
3328 nSize = pStrm->Tell() - nPos;
3329 pStrm->SeekRel( - ( static_cast<sal_Int32>(nSize) - 4 ) );
3330 pStrm->WriteUInt32( nSize - 8 );
3331 pStrm->SeekRel( nSize - 8 );
3332}
3333
3335{
3336 sal_uInt32 nCharactersLeft( Count() );
3337 if ( nCharactersLeft < 1 )
3338 return;
3339
3340 EscherExAtom aAnimationInfoAtom( *pStrm, EPP_TextSpecInfoAtom, 0, 0 );
3341 for ( sal_uInt32 i = 0; nCharactersLeft && i < ParagraphCount(); ++i )
3342 {
3343 ParagraphObj* pPtr = GetParagraph(i);
3344 for ( std::vector<std::unique_ptr<PortionObj> >::const_iterator it = pPtr->begin(); nCharactersLeft && it != pPtr->end(); ++it )
3345 {
3346 const PortionObj& rPortion = **it;
3347 sal_Int32 nPortionSize = rPortion.mnTextSize >= nCharactersLeft ? nCharactersLeft : rPortion.mnTextSize;
3348 sal_Int32 const nFlags = 7;
3349 nCharactersLeft -= nPortionSize;
3350 pStrm ->WriteUInt32( nPortionSize )
3351 .WriteInt32( nFlags )
3352 .WriteInt16( 1 ) // spellinfo -> needs rechecking
3353 .WriteInt16( static_cast<sal_uInt16>(LanguageTag( rPortion.meCharLocale ).makeFallback().getLanguageType()) )
3354 .WriteInt16( 0 ); // alt language
3355 }
3356 }
3357 if ( nCharactersLeft )
3358 pStrm->WriteUInt32( nCharactersLeft ).WriteInt32( 1 ).WriteInt16( 1 );
3359}
3360
3361/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nLineWidth
PropFlags nPropertyFlags
constexpr auto convertMm100ToMasterUnit(N n)
sal_uInt16 nPageId
static sal_uInt32 GetColor(const sal_uInt32 nColor)
bool CreateGraphicProperties(const css::uno::Reference< css::drawing::XShape > &rXShape, const GraphicObject &rGraphicObj)
void CreateShapeProperties(const css::uno::Reference< css::drawing::XShape > &rXShape)
bool CreateBlipPropertiesforOLEControl(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, const css::uno::Reference< css::drawing::XShape > &rXShape)
static MSO_SPT GetCustomShapeType(const css::uno::Reference< css::drawing::XShape > &rXShape, ShapeFlag &nMirrorFlags, OUString &rShapeType, bool bOOXML=false)
void CreateShadowProperties(const css::uno::Reference< css::beans::XPropertySet > &)
bool CreateOLEGraphicProperties(const css::uno::Reference< css::drawing::XShape > &rXOleObject)
bool CreateMediaGraphicProperties(const css::uno::Reference< css::drawing::XShape > &rXMediaObject)
void AddOpt(sal_uInt16 nPropID, bool bBlib, sal_uInt32 nSizeReduction, SvMemoryStream &rStream)
bool CreatePolygonProperties(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, sal_uInt32 nFlags, bool bBezier, css::awt::Rectangle &rGeoRect, tools::Polygon const *pPolygon=nullptr)
void CreateGradientProperties(const css::awt::Gradient &rGradient)
bool CreateConnectorProperties(const css::uno::Reference< css::drawing::XShape > &rXShape, EscherSolverContainer &rSolver, css::awt::Rectangle &rGeoRect, sal_uInt16 &rShapeType, ShapeFlag &rShapeFlags)
void CreateLineProperties(const css::uno::Reference< css::beans::XPropertySet > &, bool bEdge)
bool GetOpt(sal_uInt16 nPropertyID, sal_uInt32 &rPropValue) const
void CreateTextProperties(const css::uno::Reference< css::beans::XPropertySet > &, sal_uInt32 nText, const bool bIsCustomShape=false, const bool bIsTextFrame=true)
void CreateFillProperties(const css::uno::Reference< css::beans::XPropertySet > &, bool bEdge, bool bTransparentGradient=false)
void CreateCustomShapeProperties(const MSO_SPT eShapeType, const css::uno::Reference< css::drawing::XShape > &)
void Commit(SvStream &rSt, sal_uInt16 nVersion=3, sal_uInt16 nRecType=ESCHER_OPT)
void AddShape(const css::uno::Reference< css::drawing::XShape > &, sal_uInt32 nId)
const FontCollectionEntry * GetById(sal_uInt32 nId)
Definition: pptx-text.cxx:1395
sal_uInt32 GetId(FontCollectionEntry &rFontDescriptor)
Definition: pptx-text.cxx:1357
sal_uInt32 GetCount() const
Definition: epptbase.hxx:189
bool IsNone() const
bool EnterGroup(css::uno::Reference< css::container::XIndexAccess > const &rIndex)
sal_uInt32 GetGroupsClosed()
sal_uInt32 GetCurrentGroupIndex() const
Definition: grouptable.hxx:54
sal_Int32 GetCurrentGroupLevel() const
Definition: grouptable.hxx:55
bool GetNextGroupEntry()
void ResetGroupTable(sal_uInt32 nCount)
const css::uno::Reference< css::container::XIndexAccess > & GetCurrentGroupAccess() const
Definition: grouptable.hxx:57
void ClearGroupTable()
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString PathToFileName() const
static OUString GetRelURL(std::u16string_view rTheBaseURIRef, OUString const &rTheAbsURIRef, EncodeMechanism eEncodeMechanism=EncodeMechanism::WasEncoded, DecodeMechanism eDecodeMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
INetProtocol GetProtocol() const
LanguageType getLanguageType(bool bResolveSystem=true) const
LanguageTag & makeFallback()
std::unique_ptr< PPTExCharSheet > mpCharSheet[PPTEX_STYLESHEETENTRIES]
Definition: epptbase.hxx:303
std::unique_ptr< PPTExParaSheet > mpParaSheet[PPTEX_STYLESHEETENTRIES]
Definition: epptbase.hxx:304
bool IsHardAttribute(sal_uInt32 nInstance, sal_uInt32 nLevel, PPTExTextAttr eAttr, sal_uInt32 nValue)
static sal_uInt32 SizeOfTxCFStyleAtom()
Definition: epptbase.hxx:315
PPTExParaSheet & GetParaSheet(int nInstance)
Definition: epptbase.hxx:309
void WriteTxCFStyleAtom(SvStream &rSt)
bool mbStatusIndicator
Definition: epptbase.hxx:325
css::uno::Reference< css::drawing::XShapes > mXShapes
Definition: epptbase.hxx:333
::tools::Rectangle MapRectangle(const css::awt::Rectangle &)
sal_Int32 mnAngle
Definition: epptbase.hxx:342
css::awt::Point MapPoint(const css::awt::Point &)
css::awt::Size maSize
Definition: epptbase.hxx:335
PPTExStyleSheet * mpStyleSheet
Definition: epptbase.hxx:356
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
OString mType
Definition: epptbase.hxx:338
FontCollection maFontCollection
Definition: epptbase.hxx:358
bool mbEmptyPresObj
Definition: epptbase.hxx:340
::tools::Rectangle maRect
Definition: epptbase.hxx:337
css::awt::Size MapSize(const css::awt::Size &)
css::uno::Reference< css::frame::XModel > mXModel
Definition: epptbase.hxx:322
css::uno::Reference< css::beans::XPropertySet > mXBackgroundPropSet
Definition: epptbase.hxx:332
css::awt::Point maPosition
Definition: epptbase.hxx:336
bool GetShapeByIndex(sal_uInt32 nIndex, bool bGroup)
css::uno::Reference< css::drawing::XShape > mXShape
Definition: epptbase.hxx:334
sal_uInt32 mnExEmbed
Definition: eppt.hxx:139
std::vector< std::unique_ptr< PPTExOleObjEntry > > maExOleObj
Definition: eppt.hxx:136
OUString maBaseURI
Definition: eppt.hxx:122
void ImplCreateTextShape(EscherPropertyContainer &, EscherSolverContainer &, bool bFill)
Definition: epptso.cxx:1589
sal_uInt32 mnStatMaxValue
Definition: eppt.hxx:118
sal_uInt32 mnTxId
Definition: eppt.hxx:143
sal_uInt32 ImplProgBinaryTag(SvStream *pOutStrm)
Definition: epptso.cxx:216
bool ImplCloseDocument()
Definition: epptso.cxx:376
sal_uInt32 ImplProgBinaryTagContainer(SvStream *pOutStrm, SvMemoryStream *pBinTag)
Definition: epptso.cxx:245
sal_uInt32 ImplDocumentListContainer(SvStream *pOutStrm)
Definition: epptso.cxx:295
css::uno::Reference< css::text::XSimpleText > mXText
Definition: eppt.hxx:124
sal_uInt32 mnPagesWritten
Definition: eppt.hxx:142
bool ImplCreatePresentationPlaceholder(const bool bMaster, const sal_uInt32 StyleInstance, const sal_uInt8 PlaceHolderId)
Definition: epptso.cxx:1526
sal_uInt32 ImplVBAInfoContainer(SvStream *pOutStrm)
Definition: epptso.cxx:132
void ImplWriteParagraphs(SvStream &rOutStrm, TextObj &rTextObj)
Definition: epptso.cxx:624
bool mbFontIndependentLineSpacing
Definition: eppt.hxx:127
tools::SvRef< SotStorageStream > mpStrm
Definition: eppt.hxx:132
void ImplWritePortions(SvStream &rOutStrm, TextObj &rTextObj)
Definition: epptso.cxx:763
void ImplCreateTable(css::uno::Reference< css::drawing::XShape > const &rXShape, EscherSolverContainer &aSolverContainer, EscherPropertyContainer &aPropOpt)
Definition: epptso.cxx:3064
void ImplAdjustFirstLineLineSpacing(TextObj &rTextObj, EscherPropertyContainer &rPropOpt)
Definition: epptso.cxx:994
sal_uInt32 mnLatestStatValue
Definition: eppt.hxx:119
std::vector< EPPTHyperlink > maHyperlink
Definition: eppt.hxx:151
void ImplWritePage(const PHLayout &rLayout, EscherSolverContainer &rSolver, PageType ePageType, bool bMaster, int nPageNumber=0)
Definition: epptso.cxx:1603
sal_uInt32 mnTextStyle
Definition: eppt.hxx:125
void ImplWriteTextStyleAtom(SvStream &rOut, int nTextInstance, sal_uInt32 nAtomInstance, TextRuleEntry *pTextRule, SvStream &rExtBu, EscherPropertyContainer *)
Definition: epptso.cxx:1025
sal_uInt32 ImplProgTagContainer(SvStream *pOutStrm, SvMemoryStream *pBinTag=nullptr)
Definition: epptso.cxx:274
static bool ImplGetEffect(const css::uno::Reference< css::beans::XPropertySet > &, css::presentation::AnimationEffect &eEffect, css::presentation::AnimationEffect &eTextEffect, bool &bHasSound)
Definition: epptso.cxx:1500
ppt::ExSoundCollection maSoundCollection
Definition: eppt.hxx:153
sal_uInt32 mnTextSize
Definition: eppt.hxx:128
std::vector< OUString > maSlideNameList
Definition: eppt.hxx:121
sal_uInt32 mnShapeMasterBody
Definition: eppt.hxx:149
void ImplWriteExtParaHeader(SvMemoryStream &rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId)
Definition: eppt.cxx:539
static sal_uInt32 ImplOutlineViewInfoContainer(SvStream *pOutStrm)
Definition: epptso.cxx:198
sal_uInt32 ImplInsertBookmarkURL(const OUString &rBookmark, const sal_uInt32 nType, std::u16string_view aStringVer0, std::u16string_view aStringVer1, std::u16string_view aStringVer2, std::u16string_view aStringVer3)
Definition: epptso.cxx:339
std::unique_ptr< PptEscherEx > mpPptEscherEx
Definition: eppt.hxx:134
sal_uInt32 mnShapeMasterTitle
Definition: eppt.hxx:148
static sal_uInt32 ImplSlideViewInfoContainer(sal_uInt32 nInstance, SvStream *pOutStrm)
Definition: epptso.cxx:149
static void WriteCString(SvStream &, std::u16string_view, sal_uInt32 nInstance=0)
Definition: epptso.cxx:3032
void ImplCreateShape(sal_uInt32 nType, ShapeFlag nFlags, EscherSolverContainer &)
Definition: epptso.cxx:1582
void ImplFlipBoundingBox(EscherPropertyContainer &rPropOpt)
Definition: epptso.cxx:959
sal_uInt32 ImplMasterSlideListContainer(SvStream *pOutStrm)
Definition: epptso.cxx:318
void ImplWriteClickAction(SvStream &rSt, css::presentation::ClickAction eAction, bool bMediaClickAction)
Definition: epptso.cxx:1342
bool ImplCreateCellBorder(const CellBorder *pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2)
Definition: epptso.cxx:2960
std::unique_ptr< SvMemoryStream > mpExEmbed
Definition: eppt.hxx:140
tools::SvRef< SotStorageStream > mpPicStrm
Definition: eppt.hxx:133
bool ImplGetText()
Loads and converts text from shape, value is stored in mnTextSize.
Definition: epptso.cxx:943
css::beans::PropertyState meLineSpacingBottom
Definition: text.hxx:199
sal_Int16 mnLineSpacingBottom
Definition: text.hxx:208
std::vector< std::unique_ptr< PortionObj > >::const_iterator begin() const
Definition: text.hxx:224
bool mbParagraphPunctation
Definition: text.hxx:210
bool empty() const
Definition: text.hxx:220
css::beans::PropertyState meBiDi
Definition: text.hxx:202
css::beans::PropertyState meLineSpacingTop
Definition: text.hxx:198
sal_uInt32 CharacterCount() const
Definition: text.hxx:231
bool mbFixedLineSpacing
Definition: text.hxx:206
css::uno::Sequence< css::style::TabStop > maTabStop
Definition: text.hxx:187
css::beans::PropertyState meForbiddenRules
Definition: text.hxx:200
sal_Int16 mnLineSpacingTop
Definition: text.hxx:207
const PortionObj & front() const
Definition: text.hxx:222
sal_uInt16 mnTextAdjust
Definition: text.hxx:204
bool mbForbiddenRules
Definition: text.hxx:209
sal_Int16 mnLineSpacing
Definition: text.hxx:205
sal_uInt16 mnBiDi
Definition: text.hxx:211
void Write(SvStream *pStrm)
Definition: pptx-text.cxx:739
css::beans::PropertyState meParagraphPunctation
Definition: text.hxx:201
std::vector< std::unique_ptr< PortionObj > >::const_iterator end() const
Definition: text.hxx:225
css::beans::PropertyState meTextAdjust
Definition: text.hxx:196
css::beans::PropertyState meLineSpacing
Definition: text.hxx:197
sal_uInt16 mnCharHeight
Definition: text.hxx:138
std::unique_ptr< FieldEntry > mpFieldEntry
Definition: text.hxx:147
sal_uInt32 mnTextSize
Definition: text.hxx:143
css::beans::PropertyState meCharColor
Definition: text.hxx:128
sal_uInt16 mnCharAttr
Definition: text.hxx:137
css::beans::PropertyState meCharEscapement
Definition: text.hxx:132
css::beans::PropertyState meAsianOrComplexFont
Definition: text.hxx:131
css::lang::Locale meCharLocale
Definition: text.hxx:133
sal_uInt16 mnFont
Definition: text.hxx:139
sal_uInt32 mnCharColor
Definition: text.hxx:136
css::beans::PropertyState meCharHeight
Definition: text.hxx:129
sal_uInt32 Count() const
Definition: text.hxx:157
css::beans::PropertyState meFontName
Definition: text.hxx:130
sal_Int16 mnCharEscapement
Definition: text.hxx:141
sal_uInt16 mnAsianOrComplexFont
Definition: text.hxx:140
void CloseContainer() override
Definition: escherex.cxx:162
void OpenContainer(sal_uInt16 n_EscherContainer, int nRecInstance=0) override
Definition: escherex.cxx:126
bool ImplGetPropertyValue(const OUString &rString, bool bGetPropertyState)
Definition: epptso.cxx:597
css::beans::PropertyState ePropState
Definition: text.hxx:92
css::uno::Reference< css::beans::XPropertyState > mXPropState
Definition: text.hxx:93
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
static css::beans::PropertyState GetPropertyState(const css::uno::Reference< css::beans::XPropertySet > &, const OUString &rPropertyName)
Definition: epptso.cxx:569
bool ImplGetPropertyValue(const OUString &rString)
Definition: epptso.cxx:587
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
virtual const tools::Rectangle & GetCurrentBoundRect() const
bool IsNotVisibleAsMaster() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const void * GetData()
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 & WriteUChar(unsigned char nChar)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
sal_uInt64 SeekRel(sal_Int64 nPos)
void Write(SvStream *pStrm)
Definition: epptso.cxx:3322
void WriteTextSpecInfo(SvStream *pStrm)
Definition: epptso.cxx:3334
int GetInstance() const
Definition: pptx-text.cxx:1316
sal_uInt32 ParagraphCount() const
Definition: pptx-text.cxx:1306
ParagraphObj * GetParagraph(int idx)
Definition: pptx-text.cxx:1301
sal_uInt32 Count() const
Definition: pptx-text.cxx:1311
bool HasExtendedBullets() const
Definition: pptx-text.cxx:1321
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)
sal_uInt32 GetId(const OUString &)
void Write(SvStream &rSt) const
void Rotate(const Point &rCenter, double fSin, double fCos)
constexpr tools::Long GetWidth() const
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr void SetRight(tools::Long v)
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long Right() const
constexpr void SetBottom(tools::Long v)
constexpr tools::Long GetHeight() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
T * get() const
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
PageType
FormulaCommand pE
float u
float y
float x
#define EPP_TEXTSTYLE_BODY
Definition: eppt.hxx:62
#define EPP_TEXTSTYLE_TEXT
Definition: eppt.hxx:63
#define EPP_Persist_VBAInfoAtom
Definition: eppt.hxx:57
@ OCX_CONTROL
Definition: eppt.hxx:80
@ NORMAL_OLE_OBJECT
Definition: eppt.hxx:80
#define EPP_TEXTSTYLE_NORMAL
Definition: eppt.hxx:60
#define EPP_Persist_ExObj
Definition: eppt.hxx:58
#define EPP_TEXTSTYLE_TITLE
Definition: eppt.hxx:61
#define EPP_Persist_Document
Definition: eppt.hxx:51
#define EPP_Persist_CurrentPos
Definition: eppt.hxx:56
#define EPP_MAINMASTER_PERSIST_KEY
Definition: eppt.hxx:46
@ NORMAL
Definition: epptbase.hxx:92
@ MASTER
Definition: epptbase.hxx:92
@ NOTICE
Definition: epptbase.hxx:92
@ ParaAttr_Adjust
Definition: epptbase.hxx:213
@ CharAttr_Embossed
Definition: epptbase.hxx:226
@ CharAttr_Bold
Definition: epptbase.hxx:221
@ ParaAttr_LineFeed
Definition: epptbase.hxx:214
@ ParaAttr_BulletOfs
Definition: epptbase.hxx:218
@ CharAttr_Escapement
Definition: epptbase.hxx:232
@ CharAttr_FontHeight
Definition: epptbase.hxx:230
@ CharAttr_FontColor
Definition: epptbase.hxx:231
@ ParaAttr_UpperDist
Definition: epptbase.hxx:215
@ CharAttr_Font
Definition: epptbase.hxx:227
@ CharAttr_Underline
Definition: epptbase.hxx:223
@ CharAttr_Shadow
Definition: epptbase.hxx:224
@ ParaAttr_TextOfs
Definition: epptbase.hxx:217
@ ParaAttr_LowerDist
Definition: epptbase.hxx:216
@ CharAttr_AsianOrComplexFont
Definition: epptbase.hxx:228
@ CharAttr_Italic
Definition: epptbase.hxx:222
@ ParaAttr_BiDi
Definition: epptbase.hxx:220
#define EPP_SlidePersistAtom
Definition: epptdef.hxx:30
#define EPP_ExOleObjAtom
Definition: epptdef.hxx:80
#define EPP_BaseTextPropAtom
Definition: epptdef.hxx:64
#define EPP_InteractiveInfoAtom
Definition: epptdef.hxx:96
#define EPP_ExObjRefAtom
Definition: epptdef.hxx:59
#define EPP_ExControl
Definition: epptdef.hxx:91
#define EPP_TEXTTYPE_CenterBody
Definition: epptdef.hxx:134
#define EPP_FooterMCAtom
Definition: epptdef.hxx:102
#define EPP_GuideAtom
Definition: epptdef.hxx:34
#define EPP_SlideViewInfo
Definition: epptdef.hxx:33
#define EPP_ExControlAtom
Definition: epptdef.hxx:92
#define EPP_InteractiveInfo
Definition: epptdef.hxx:95
#define EPP_OutlineViewInfo
Definition: epptdef.hxx:40
#define EPP_ExHyperlinkAtom
Definition: epptdef.hxx:85
#define EPP_VBAInfoAtom
Definition: epptdef.hxx:38
#define EPP_ExEmbedAtom
Definition: epptdef.hxx:83
#define EPP_SlideNumberMCAtom
Definition: epptdef.hxx:87
#define EPP_TEXTTYPE_Body
Definition: epptdef.hxx:130
#define EPP_SrKinsoku
Definition: epptdef.hxx:81
#define EPP_CString
Definition: epptdef.hxx:79
#define EPP_TEXTTYPE_Notes
Definition: epptdef.hxx:131
#define EPP_TxMasterStyleAtom
Definition: epptdef.hxx:65
#define EPP_ExMediaAtom
Definition: epptdef.hxx:103
#define EPP_ExVideo
Definition: epptdef.hxx:104
#define EPP_PLACEHOLDER_NONE
Definition: epptdef.hxx:115
#define EPP_ViewInfoAtom
Definition: epptdef.hxx:35
#define EPP_TxSIStyleAtom
Definition: epptdef.hxx:68
#define EPP_ProgTags
Definition: epptdef.hxx:108
#define EPP_TxInteractiveInfoAtom
Definition: epptdef.hxx:90
#define EPP_GenericDateMCAtom
Definition: epptdef.hxx:100
#define EPP_ExEmbed
Definition: epptdef.hxx:82
#define EPP_PLACEHOLDER_MASTERSLIDENUMBER
Definition: epptdef.hxx:122
#define EPP_ExObjList
Definition: epptdef.hxx:41
#define EPP_VBAInfo
Definition: epptdef.hxx:37
#define EPP_SlideViewInfoAtom
Definition: epptdef.hxx:36
#define EPP_TEXTTYPE_Title
Definition: epptdef.hxx:129
#define EPP_SrKinsokuAtom
Definition: epptdef.hxx:84
#define EPP_DateTimeMCAtom
Definition: epptdef.hxx:99
#define EPP_List
Definition: epptdef.hxx:48
#define EPP_StyleTextPropAtom
Definition: epptdef.hxx:63
#define EPP_ExMCIMovie
Definition: epptdef.hxx:105
#define EPP_FontEnityAtom
Definition: epptdef.hxx:78
#define EPP_Environment
Definition: epptdef.hxx:29
#define EPP_PLACEHOLDER_MASTERNOTESSLIDEIMAGE
Definition: epptdef.hxx:119
#define EPP_ExObjListAtom
Definition: epptdef.hxx:42
#define EPP_TEXTTYPE_Other
Definition: epptdef.hxx:133
#define EPP_TextSpecInfoAtom
Definition: epptdef.hxx:69
#define EPP_PLACEHOLDER_MASTERTITLE
Definition: epptdef.hxx:116
#define EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE
Definition: epptdef.hxx:120
#define EPP_PST_ExtendedPresRuleContainer
Definition: epptdef.hxx:74
#define EPP_HeaderMCAtom
Definition: epptdef.hxx:101
#define EPP_ExHyperlink
Definition: epptdef.hxx:86
#define EPP_PST_ExtendedBuGraContainer
Definition: epptdef.hxx:57
#define EPP_PLACEHOLDER_MASTERHEADER
Definition: epptdef.hxx:124
#define EPP_TextCharsAtom
Definition: epptdef.hxx:62
#define EPP_PLACEHOLDER_NOTESSLIDEIMAGE
Definition: epptdef.hxx:127
#define EPP_PLACEHOLDER_MASTERSUBTITLE
Definition: epptdef.hxx:118
#define EPP_SlideListWithText
Definition: epptdef.hxx:93
#define EPP_ProgBinaryTag
Definition: epptdef.hxx:109
#define EPP_OEPlaceholderAtom
Definition: epptdef.hxx:60
#define EPP_PLACEHOLDER_MASTERBODY
Definition: epptdef.hxx:117
#define EPP_PLACEHOLDER_NOTESBODY
Definition: epptdef.hxx:126
#define EPP_BinaryTagData
Definition: epptdef.hxx:110
#define EPP_PLACEHOLDER_MASTERDATE
Definition: epptdef.hxx:121
#define EPP_TextHeaderAtom
Definition: epptdef.hxx:61
#define EPP_TextRulerAtom
Definition: epptdef.hxx:67
#define EPP_TEXTTYPE_HalfBody
Definition: epptdef.hxx:136
#define EPP_PLACEHOLDER_MASTERFOOTER
Definition: epptdef.hxx:123
#define EPP_FontCollection
Definition: epptdef.hxx:49
#define EPP_PST_ExtendedParagraphAtom
Definition: epptdef.hxx:72
#define FIXED_PITCH
Definition: epptso.cxx:73
#define DEFAULT_PITCH
Definition: epptso.cxx:72
#define FF_MODERN
Definition: epptso.cxx:68
#define FF_DECORATIVE
Definition: epptso.cxx:70
#define FF_SCRIPT
Definition: epptso.cxx:69
#define FF_ROMAN
Definition: epptso.cxx:66
static sal_Int32 GetCellRight(sal_Int32 nColumn, ::tools::Rectangle const &rect, std::vector< std::pair< sal_Int32, sal_Int32 > > &aColumns, uno::Reference< table::XMergeableCell > const &xCell)
Definition: epptso.cxx:2998
#define ANSI_CHARSET
Definition: epptso.cxx:62
static sal_Int32 GetCellBottom(sal_Int32 nRow, ::tools::Rectangle const &rect, std::vector< std::pair< sal_Int32, sal_Int32 > > &aRows, uno::Reference< table::XMergeableCell > const &xCell)
Definition: epptso.cxx:3015
#define FF_SWISS
Definition: epptso.cxx:67
#define SYMBOL_CHARSET
Definition: epptso.cxx:63
ESCHER_ShapeComplex
#define ESCHER_Prop_pictureActive
#define ESCHER_CREATEPOLYGON_LINE
#define ESCHER_Prop_lineColor
#define ESCHER_ShpInst_RoundRectangle
ESCHER_AnchorMiddle
#define ESCHER_Prop_shapePath
#define ESCHER_Prop_hspMaster
#define ESCHER_Prop_LockAgainstGrouping
#define ESCHER_Prop_fNoFillHitTest
#define ESCHER_UDefProp
ESCHER_WrapNone
ESCHER_WrapSquare
#define ESCHER_ClientData
#define ESCHER_ShpInst_HostControl
#define ESCHER_Prop_fshadowObscured
#define ESCHER_Prop_FitTextToShape
#define ESCHER_Prop_fNoLineDrawDash
#define ESCHER_Prop_wzName
#define ESCHER_ChildAnchor
#define ESCHER_Prop_AnchorText
#define ESCHER_Prop_shadowColor
#define ESCHER_Prop_WrapText
#define ESCHER_CREATEPOLYGON_POLYLINE
#define ESCHER_ShpInst_TextBox
#define ESCHER_ShpInst_Min
#define ESCHER_Spgr
#define ESCHER_Prop_tableRowProperties
#define ESCHER_Prop_Rotation
#define ESCHER_ShpInst_NotPrimitive
#define ESCHER_ClientAnchor
#define ESCHER_Prop_lineWidth
#define ESCHER_SpgrContainer
#define ESCHER_Prop_dyTextTop
#define ESCHER_Prop_fillBackColor
#define ESCHER_ShpInst_Ellipse
#define ESCHER_Prop_fc3DLightFace
#define ESCHER_Prop_pictureId
EscherGraphicProviderFlags
#define ESCHER_Prop_lTxid
#define ESCHER_ShpInst_Rectangle
#define ESCHER_Prop_adjustValue
#define ESCHER_CREATEPOLYGON_POLYPOLYGON
ShapeFlag
#define ESCHER_SpContainer
#define ESCHER_ClientTextbox
#define ESCHER_Prop_fillColor
#define ESCHER_ShpInst_Line
#define ESCHER_Prop_tableProperties
#define ESCHER_ShpInst_PictureFrame
sal_Int16 nVersion
sal_Int16 nValue
FAMILY_DONTKNOW
sal_Int32 nIndex
sal_Int64 n
sal_uInt16 nPos
MSO_SPT
mso_sptMax
int i
constexpr OUStringLiteral first
long Long
sal_Int16 nId
PolyStyle
QPRO_FUNC_TYPE nType
TOOLS_DLLPUBLIC OString read_uInt8s_ToOString(SvStream &rStrm, std::size_t nUnits)
#define STREAM_SEEK_TO_END
sal_Int32 mnPos
Definition: epptso.cxx:2954
table::BorderLine maCellBorder
Definition: epptso.cxx:2955
OUString aRepresentation
Definition: text.hxx:103
sal_uInt32 nFieldEndPos
Definition: text.hxx:102
OUString aFieldUrl
Definition: text.hxx:104
sal_uInt32 nFieldStartPos
Definition: text.hxx:101
sal_uInt32 nFieldType
Definition: text.hxx:100
bool bSecOutlinerPossible
Definition: epptbase.hxx:89
sal_uInt8 nTypeOfTitle
Definition: epptbase.hxx:84
sal_uInt8 nUsedObjectPlaceHolder
Definition: epptbase.hxx:83
bool bTitlePossible
Definition: epptbase.hxx:87
sal_uInt8 nTypeOfOutliner
Definition: epptbase.hxx:85
bool bOutlinerPossible
Definition: epptbase.hxx:88
sal_uInt16 mnTextOfs
Definition: epptbase.hxx:270
sal_uInt16 mnBulletOfs
Definition: epptbase.hxx:271
PPTExParaLevel maParaLevel[5]
Definition: epptbase.hxx:289
sal_Int16 nBulletFlags
Definition: text.hxx:41
SvxNumType nNumberingType
Definition: text.hxx:46
bool bExtendedParameters
Definition: text.hxx:39
css::awt::FontDescriptor aFontDesc
Definition: text.hxx:55
sal_uInt32 nMappedNumType
Definition: text.hxx:59
sal_uInt16 nBulletId
Definition: text.hxx:58
bool bExtendedBulletsUsed
Definition: text.hxx:57
sal_uInt32 nParaFlags
Definition: text.hxx:40
sal_Int16 nBulletRealSize
Definition: text.hxx:52
sal_Int16 nDepth
Definition: text.hxx:53
sal_Int16 nTextOfs
Definition: text.hxx:51
sal_Int32 nBulletOfs
Definition: text.hxx:49
sal_uInt32 nBulletColor
Definition: text.hxx:48
sal_Unicode cBulletId
Definition: text.hxx:54
sal_Int16 nStartWith
Definition: text.hxx:50
std::unique_ptr< SvMemoryStream > pOut
Definition: eppt.hxx:101
SVX_NUM_NUMBER_NONE
SVX_NUM_FULL_WIDTH_ARABIC
SVX_NUM_CHARS_LOWER_LETTER_N
SVX_NUM_CIRCLE_NUMBER
SVX_NUM_CHARS_LOWER_LETTER
SVX_NUM_CHARS_UPPER_LETTER
SVX_NUM_NUMBER_UPPER_ZH_TW
SVX_NUM_ROMAN_UPPER
SVX_NUM_ROMAN_LOWER
SVX_NUM_ARABIC
SVX_NUM_CHARS_UPPER_LETTER_N
SVX_NUM_NUMBER_UPPER_ZH
SVX_NUM_BITMAP
SVX_NUM_CHAR_SPECIAL
SVX_NUM_NUMBER_LOWER_ZH
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
oslFileHandle & pOut
sal_Int32 nLength