Line data Source code
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 <osl/endian.h>
21 : #include <eppt.hxx>
22 : #include "text.hxx"
23 : #include "epptdef.hxx"
24 : #include "escherex.hxx"
25 : #include <tools/poly.hxx>
26 : #include <vcl/bmpacc.hxx>
27 : #include <vcl/gradient.hxx>
28 : #include <vcl/gfxlink.hxx>
29 : #include <tools/stream.hxx>
30 : #include <sot/storage.hxx>
31 : #include <vcl/outdev.hxx>
32 : #include <vcl/virdev.hxx>
33 : #include <sfx2/app.hxx>
34 : #include <svl/languageoptions.hxx>
35 : #include <editeng/svxenum.hxx>
36 : #include <svx/unoapi.hxx>
37 : #include <svx/svdoashp.hxx>
38 : #include <com/sun/star/style/VerticalAlignment.hpp>
39 : #include <com/sun/star/container/XIndexReplace.hpp>
40 : #include <com/sun/star/presentation/XPresentationPage.hpp>
41 : #include <com/sun/star/awt/XFont.hpp>
42 : #include <com/sun/star/awt/FontWeight.hpp>
43 : #include <com/sun/star/awt/FontUnderline.hpp>
44 : #include <com/sun/star/style/ParagraphAdjust.hpp>
45 : #include <com/sun/star/style/LineSpacing.hpp>
46 : #include <com/sun/star/style/LineSpacingMode.hpp>
47 : #ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_PP_
48 : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
49 : #endif
50 : #include <com/sun/star/style/XStyle.hpp>
51 : #include <com/sun/star/drawing/PointSequence.hpp>
52 : #include <com/sun/star/drawing/FlagSequence.hpp>
53 : #include <com/sun/star/drawing/PolygonFlags.hpp>
54 : #include <com/sun/star/beans/PropertyValue.hpp>
55 : #include <com/sun/star/drawing/XControlShape.hpp>
56 : #include <comphelper/processfactory.hxx>
57 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
58 : #include <com/sun/star/i18n/XBreakIterator.hpp>
59 : #include <com/sun/star/i18n/XScriptTypeDetector.hpp>
60 : #include <com/sun/star/i18n/ScriptType.hpp>
61 : #include <com/sun/star/i18n/ScriptDirection.hpp>
62 : #include <com/sun/star/embed/Aspects.hpp>
63 : #include <vcl/cvtgrf.hxx>
64 : #include <tools/urlobj.hxx>
65 : #include <comphelper/extract.hxx>
66 : #include <cppuhelper/proptypehlp.hxx>
67 : #include <toolkit/unohlp.hxx>
68 : #include <rtl/crc.h>
69 : #include <sot/clsids.hxx>
70 : #include <unotools/ucbstreamhelper.hxx>
71 : #include <com/sun/star/text/FontRelief.hpp>
72 : #include <editeng/frmdiritem.hxx>
73 : #include <svtools/fltcall.hxx>
74 : #include <com/sun/star/table/XTable.hpp>
75 : #include <com/sun/star/table/XMergeableCell.hpp>
76 : #include <com/sun/star/table/BorderLine.hpp>
77 : #include <set>
78 : #include <oox/ole/olehelper.hxx>
79 : #include "i18npool/languagetag.hxx"
80 :
81 : using namespace ::com::sun::star;
82 :
83 : ////////////////////////////////////////////////////////////////////////////////////////////////////
84 :
85 : #define ANSI_CHARSET 0
86 : #define SYMBOL_CHARSET 2
87 :
88 : ////////////////////////////////////////////////////////////////////////////////////////////////////
89 :
90 : /* Font Families */
91 : #define FF_DONTCARE 0x00
92 : #define FF_ROMAN 0x10
93 : #define FF_SWISS 0x20
94 : #define FF_MODERN 0x30
95 : #define FF_SCRIPT 0x40
96 : #define FF_DECORATIVE 0x50
97 :
98 : ////////////////////////////////////////////////////////////////////////////////////////////////////
99 :
100 : #define DEFAULT_PITCH 0x00
101 : #define FIXED_PITCH 0x01
102 : #define VARIABLE_PITCH 0x02
103 :
104 : // ---------------------------------------------------------------------------------------------
105 :
106 0 : PPTExBulletProvider::PPTExBulletProvider()
107 : {
108 0 : pGraphicProv = new EscherGraphicProvider( _E_GRAPH_PROV_USE_INSTANCES | _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES );
109 0 : }
110 :
111 0 : PPTExBulletProvider::~PPTExBulletProvider()
112 : {
113 0 : delete pGraphicProv;
114 0 : }
115 :
116 0 : sal_uInt16 PPTExBulletProvider::GetId( const rtl::OString& rUniqueId, Size& rGraphicSize )
117 : {
118 0 : sal_uInt16 nRetValue = 0xffff;
119 :
120 0 : if ( !rUniqueId.isEmpty() )
121 : {
122 0 : Rectangle aRect;
123 0 : GraphicObject aGraphicObject( rUniqueId );
124 0 : Graphic aMappedGraphic, aGraphic( aGraphicObject.GetGraphic() );
125 0 : Size aPrefSize( aGraphic.GetPrefSize() );
126 0 : BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
127 :
128 0 : if ( rGraphicSize.Width() && rGraphicSize.Height() )
129 : {
130 0 : double fQ1 = ( (double)aPrefSize.Width() / (double)aPrefSize.Height() );
131 0 : double fQ2 = ( (double)rGraphicSize.Width() / (double)rGraphicSize.Height() );
132 0 : double fXScale = 1;
133 0 : double fYScale = 1;
134 :
135 0 : if ( fQ1 > fQ2 )
136 0 : fYScale = fQ1 / fQ2;
137 0 : else if ( fQ1 < fQ2 )
138 0 : fXScale = fQ2 / fQ1;
139 :
140 0 : if ( ( fXScale != 1.0 ) || ( fYScale != 1.0 ) )
141 : {
142 0 : aBmpEx.Scale( fXScale, fYScale );
143 0 : Size aNewSize( (sal_Int32)((double)rGraphicSize.Width() / fXScale + 0.5 ),
144 0 : (sal_Int32)((double)rGraphicSize.Height() / fYScale + 0.5 ) );
145 :
146 0 : rGraphicSize = aNewSize;
147 :
148 0 : aMappedGraphic = Graphic( aBmpEx );
149 0 : aGraphicObject = GraphicObject( aMappedGraphic );
150 : }
151 : }
152 0 : sal_uInt32 nId = pGraphicProv->GetBlibID( aBuExPictureStream, aGraphicObject.GetUniqueID(), aRect, NULL, NULL );
153 :
154 0 : if ( nId && ( nId < 0x10000 ) )
155 0 : nRetValue = (sal_uInt16)nId - 1;
156 : }
157 0 : return nRetValue;
158 : }
159 :
160 : // ---------------------------------------------------------------------------------------------
161 :
162 0 : sal_uInt32 PPTWriter::ImplVBAInfoContainer( SvStream* pStrm )
163 : {
164 0 : sal_uInt32 nSize = 28;
165 0 : if ( pStrm )
166 : {
167 0 : *pStrm << (sal_uInt32)( 0x1f | ( EPP_VBAInfo << 16 ) )
168 0 : << (sal_uInt32)( nSize - 8 )
169 0 : << (sal_uInt32)( 2 | ( EPP_VBAInfoAtom << 16 ) )
170 0 : << (sal_uInt32)12;
171 0 : mpPptEscherEx->InsertPersistOffset( EPP_Persist_VBAInfoAtom, pStrm->Tell() );
172 0 : *pStrm << (sal_uInt32)0
173 0 : << (sal_uInt32)0
174 0 : << (sal_uInt32)1;
175 : }
176 0 : return nSize;
177 : }
178 :
179 : // ---------------------------------------------------------------------------------------------
180 :
181 0 : sal_uInt32 PPTWriter::ImplSlideViewInfoContainer( sal_uInt32 nInstance, SvStream* pStrm )
182 : {
183 0 : sal_uInt32 nSize = 111;
184 0 : if ( pStrm )
185 : {
186 0 : sal_uInt8 bShowGuides = 0;
187 0 : sal_uInt8 bSnapToGrid = 1;
188 0 : sal_uInt8 bSnapToShape = 0;
189 :
190 0 : sal_Int32 nScaling = 85;
191 0 : sal_Int32 nMasterCoordinate = 0xdda;
192 0 : sal_Int32 nXOrigin = -780;
193 0 : sal_Int32 nYOrigin = -84;
194 :
195 0 : sal_Int32 nPosition1 = 0x870;
196 0 : sal_Int32 nPosition2 = 0xb40;
197 :
198 0 : if ( nInstance )
199 : {
200 0 : bShowGuides = 1;
201 0 : nScaling = 0x3b;
202 0 : nMasterCoordinate = 0xf0c;
203 0 : nXOrigin = -1752;
204 0 : nYOrigin = -72;
205 0 : nPosition1 = 0xb40;
206 0 : nPosition2 = 0x870;
207 : }
208 0 : *pStrm << (sal_uInt32)( 0xf | ( EPP_SlideViewInfo << 16 ) | ( nInstance << 4 ) )
209 0 : << (sal_uInt32)( nSize - 8 )
210 0 : << (sal_uInt32)( EPP_SlideViewInfoAtom << 16 ) << (sal_uInt32)3
211 0 : << bShowGuides << bSnapToGrid << bSnapToShape
212 0 : << (sal_uInt32)( EPP_ViewInfoAtom << 16 ) << (sal_uInt32)52
213 0 : << nScaling << (sal_Int32)100 << nScaling << (sal_Int32)100 // scaling atom - Keeps the current scale
214 0 : << nScaling << (sal_Int32)100 << nScaling << (sal_Int32)100 // scaling atom - Keeps the previous scale
215 0 : << (sal_Int32)0x17ac << nMasterCoordinate// Origin - Keeps the origin in master coordinates
216 0 : << nXOrigin << nYOrigin // Origin
217 0 : << (sal_uInt8)1 // Bool1 varScale - Set if zoom to fit is set
218 0 : << (sal_uInt8)0 // bool1 draftMode - Not used
219 0 : << (sal_uInt16)0 // padword
220 0 : << (sal_uInt32)( ( 7 << 4 ) | ( EPP_GuideAtom << 16 ) ) << (sal_uInt32)8
221 0 : << (sal_uInt32)0 // Type of the guide. If the guide is horizontal this value is zero. If it's vertical, it's one.
222 0 : << nPosition1 // Position of the guide in master coordinates. X coordinate if it's vertical, and Y coordinate if it's horizontal.
223 0 : << (sal_uInt32)( ( 7 << 4 ) | ( EPP_GuideAtom << 16 ) ) << (sal_uInt32)8
224 0 : << (sal_Int32)1 // Type of the guide. If the guide is horizontal this value is zero. If it's vertical, it's one.
225 0 : << nPosition2; // Position of the guide in master coordinates. X coordinate if it's vertical, and Y coordinate if it's horizontal.
226 : }
227 0 : return nSize;
228 : }
229 :
230 : // ---------------------------------------------------------------------------------------------
231 :
232 0 : sal_uInt32 PPTWriter::ImplOutlineViewInfoContainer( SvStream* pStrm )
233 : {
234 0 : sal_uInt32 nSize = 68;
235 0 : if ( pStrm )
236 : {
237 0 : *pStrm << (sal_uInt32)( 0xf | ( EPP_OutlineViewInfo << 16 ) ) << (sal_uInt32)( nSize - 8 )
238 0 : << (sal_uInt32)( EPP_ViewInfoAtom << 16 ) << (sal_uInt32)52
239 0 : << (sal_Int32)170 << (sal_Int32)200 << (sal_Int32)170 << (sal_Int32)200 // scaling atom - Keeps the current scale
240 0 : << (sal_Int32)170 << (sal_Int32)200 << (sal_Int32)170 << (sal_Int32)200 // scaling atom - Keeps the previous scale
241 0 : << (sal_Int32)0x17ac << (sal_Int32)0xdda // Origin - Keeps the origin in master coordinates
242 0 : << (sal_Int32)-780 << (sal_Int32)-84 // Origin
243 0 : << (sal_uInt8)1 // bool1 varScale - Set if zoom to fit is set
244 0 : << (sal_uInt8)0 // bool1 draftMode - Not used
245 0 : << (sal_uInt16)0; // padword
246 : }
247 0 : return nSize;
248 : }
249 :
250 : // ---------------------------------------------------------------------------------------------
251 :
252 0 : sal_uInt32 PPTWriter::ImplProgBinaryTag( SvStream* pStrm )
253 : {
254 0 : sal_uInt32 nPictureStreamSize, nOutlineStreamSize, nSize = 8;
255 :
256 0 : nPictureStreamSize = aBuExPictureStream.Tell();
257 0 : if ( nPictureStreamSize )
258 0 : nSize += nPictureStreamSize + 8;
259 :
260 0 : nOutlineStreamSize = aBuExOutlineStream.Tell();
261 0 : if ( nOutlineStreamSize )
262 0 : nSize += nOutlineStreamSize + 8;
263 :
264 0 : if ( pStrm )
265 : {
266 0 : *pStrm << (sal_uInt32)( EPP_BinaryTagData << 16 ) << (sal_uInt32)( nSize - 8 );
267 0 : if ( nPictureStreamSize )
268 : {
269 0 : *pStrm << (sal_uInt32)( 0xf | ( EPP_PST_ExtendedBuGraContainer << 16 ) ) << nPictureStreamSize;
270 0 : pStrm->Write( aBuExPictureStream.GetData(), nPictureStreamSize );
271 : }
272 0 : if ( nOutlineStreamSize )
273 : {
274 0 : *pStrm << (sal_uInt32)( 0xf | ( EPP_PST_ExtendedPresRuleContainer << 16 ) ) << nOutlineStreamSize;
275 0 : pStrm->Write( aBuExOutlineStream.GetData(), nOutlineStreamSize );
276 : }
277 : }
278 0 : return nSize;
279 : }
280 :
281 : // ---------------------------------------------------------------------------------------------
282 :
283 0 : sal_uInt32 PPTWriter::ImplProgBinaryTagContainer( SvStream* pStrm, SvMemoryStream* pBinTagStrm )
284 : {
285 0 : sal_uInt32 nSize = 8 + 8 + 14;
286 0 : if ( pStrm )
287 : {
288 0 : *pStrm << (sal_uInt32)( 0xf | ( EPP_ProgBinaryTag << 16 ) ) << (sal_uInt32)0
289 0 : << (sal_uInt32)( EPP_CString << 16 ) << (sal_uInt32)14
290 0 : << (sal_uInt32)0x5f005f << (sal_uInt32)0x50005f
291 0 : << (sal_uInt32)0x540050 << (sal_uInt16)0x39;
292 : }
293 0 : if ( pBinTagStrm )
294 : {
295 0 : sal_uInt32 nLen = pBinTagStrm->Tell();
296 0 : nSize += nLen + 8;
297 0 : *pStrm << (sal_uInt32)( EPP_BinaryTagData << 16 ) << nLen;
298 0 : pStrm->Write( pBinTagStrm->GetData(), nLen );
299 : }
300 : else
301 0 : nSize += ImplProgBinaryTag( pStrm );
302 :
303 0 : if ( pStrm )
304 : {
305 0 : pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
306 0 : *pStrm << (sal_uInt32)( nSize - 8 );
307 0 : pStrm->SeekRel( nSize - 8 );
308 : }
309 0 : return nSize;
310 : }
311 :
312 : // ---------------------------------------------------------------------------------------------
313 :
314 0 : sal_uInt32 PPTWriter::ImplProgTagContainer( SvStream* pStrm, SvMemoryStream* pBinTagStrm )
315 : {
316 0 : sal_uInt32 nSize = 0;
317 0 : if ( aBuExPictureStream.Tell() || aBuExOutlineStream.Tell() || pBinTagStrm )
318 : {
319 0 : nSize = 8;
320 0 : if ( pStrm )
321 : {
322 0 : *pStrm << (sal_uInt32)( 0xf | ( EPP_ProgTags << 16 ) ) << (sal_uInt32)0;
323 : }
324 0 : nSize += ImplProgBinaryTagContainer( pStrm, pBinTagStrm );
325 0 : if ( pStrm )
326 : {
327 0 : pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
328 0 : *pStrm << (sal_uInt32)( nSize - 8 );
329 0 : pStrm->SeekRel( nSize - 8 );
330 : }
331 : }
332 0 : return nSize;
333 : }
334 :
335 : // ---------------------------------------------------------------------------------------------
336 :
337 0 : sal_uInt32 PPTWriter::ImplDocumentListContainer( SvStream* pStrm )
338 : {
339 0 : sal_uInt32 nSize = 8;
340 0 : if ( pStrm )
341 : {
342 0 : *pStrm << (sal_uInt32)( ( EPP_List << 16 ) | 0xf ) << (sal_uInt32)0;
343 : }
344 :
345 0 : nSize += ImplVBAInfoContainer( pStrm );
346 0 : nSize += ImplSlideViewInfoContainer( 0, pStrm );
347 0 : nSize += ImplOutlineViewInfoContainer( pStrm );
348 0 : nSize += ImplSlideViewInfoContainer( 1, pStrm );
349 0 : nSize += ImplProgTagContainer( pStrm );
350 :
351 0 : if ( pStrm )
352 : {
353 0 : pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
354 0 : *pStrm << (sal_uInt32)( nSize - 8 );
355 0 : pStrm->SeekRel( nSize - 8 );
356 : }
357 0 : return nSize;
358 : }
359 :
360 : // ---------------------------------------------------------------------------------------------
361 :
362 0 : sal_uInt32 PPTWriter::ImplMasterSlideListContainer( SvStream* pStrm )
363 : {
364 0 : sal_uInt32 i, nSize = 28 * mnMasterPages + 8;
365 0 : if ( pStrm )
366 : {
367 0 : *pStrm << (sal_uInt32)( 0x1f | ( EPP_SlideListWithText << 16 ) ) << (sal_uInt32)( nSize - 8 );
368 :
369 0 : for ( i = 0; i < mnMasterPages; i++ )
370 : {
371 0 : *pStrm << (sal_uInt32)( EPP_SlidePersistAtom << 16 ) << (sal_uInt32)20;
372 0 : mpPptEscherEx->InsertPersistOffset( EPP_MAINMASTER_PERSIST_KEY | i, pStrm->Tell() );
373 0 : *pStrm << (sal_uInt32)0 // psrReference - logical reference to the slide persist object ( EPP_MAINMASTER_PERSIST_KEY )
374 0 : << (sal_uInt32)0 // flags - only bit 3 used, if set then slide contains shapes other than placeholders
375 0 : << (sal_Int32)0 // numberTexts - number of placeholder texts stored with the persist object. Allows to display outline view without loading the slide persist objects
376 0 : << (sal_Int32)( 0x80000000 | i ) // slideId - Unique slide identifier, used for OLE link monikers for example
377 0 : << (sal_uInt32)0; // reserved, usualy 0
378 : }
379 : }
380 0 : return nSize;
381 : }
382 :
383 : // ---------------------------------------------------------------------------------------------
384 :
385 0 : sal_uInt32 PPTWriter::ImplInsertBookmarkURL( const String& rBookmarkURL, const sal_uInt32 nType,
386 : const String& rStringVer0, const String& rStringVer1, const String& rStringVer2, const String& rStringVer3 )
387 : {
388 0 : sal_uInt32 nHyperId = ++mnExEmbed;
389 :
390 0 : rtl::OUString sBookmarkURL( rBookmarkURL );
391 0 : INetURLObject aBaseURI( maBaseURI );
392 0 : INetURLObject aBookmarkURI( rBookmarkURL );
393 0 : if( aBaseURI.GetProtocol() == aBookmarkURI.GetProtocol() )
394 : {
395 : rtl::OUString aRelUrl( INetURLObject::GetRelURL( maBaseURI, rBookmarkURL,
396 0 : INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI, RTL_TEXTENCODING_UTF8, INetURLObject::FSYS_DETECT ) );
397 0 : if ( !aRelUrl.isEmpty() )
398 0 : sBookmarkURL = aRelUrl;
399 : }
400 0 : maHyperlink.push_back( EPPTHyperlink( sBookmarkURL, nType ) );
401 :
402 0 : *mpExEmbed << (sal_uInt16)0xf
403 0 : << (sal_uInt16)EPP_ExHyperlink
404 0 : << (sal_uInt32)0;
405 0 : sal_uInt32 nHyperSize, nHyperStart = mpExEmbed->Tell();
406 0 : *mpExEmbed << (sal_uInt16)0
407 0 : << (sal_uInt16)EPP_ExHyperlinkAtom
408 0 : << (sal_uInt32)4
409 0 : << nHyperId;
410 :
411 : sal_uInt16 i, nStringLen;
412 0 : nStringLen = rStringVer0.Len();
413 0 : if ( nStringLen )
414 : {
415 0 : *mpExEmbed << (sal_uInt32)( EPP_CString << 16 ) << (sal_uInt32)( nStringLen * 2 );
416 0 : for ( i = 0; i < nStringLen; i++ )
417 : {
418 0 : *mpExEmbed << rStringVer0.GetChar( i );
419 : }
420 : }
421 0 : nStringLen = rStringVer1.Len();
422 0 : if ( nStringLen )
423 : {
424 0 : *mpExEmbed << (sal_uInt32)( ( EPP_CString << 16 ) | 0x10 ) << (sal_uInt32)( nStringLen * 2 );
425 0 : for ( i = 0; i < nStringLen; i++ )
426 : {
427 0 : *mpExEmbed << rStringVer1.GetChar( i );
428 : }
429 : }
430 0 : nStringLen = rStringVer2.Len();
431 0 : if ( nStringLen )
432 : {
433 0 : *mpExEmbed << (sal_uInt32)( ( EPP_CString << 16 ) | 0x20 ) << (sal_uInt32)( nStringLen * 2 );
434 0 : for ( i = 0; i < nStringLen; i++ )
435 : {
436 0 : *mpExEmbed << rStringVer2.GetChar( i );
437 : }
438 : }
439 0 : nStringLen = rStringVer3.Len();
440 0 : if ( nStringLen )
441 : {
442 0 : *mpExEmbed << (sal_uInt32)( ( EPP_CString << 16 ) | 0x30 ) << (sal_uInt32)( nStringLen * 2 );
443 0 : for ( i = 0; i < nStringLen; i++ )
444 : {
445 0 : *mpExEmbed << rStringVer3.GetChar( i );
446 : }
447 : }
448 0 : nHyperSize = mpExEmbed->Tell() - nHyperStart;
449 0 : mpExEmbed->SeekRel( - ( (sal_Int32)nHyperSize + 4 ) );
450 0 : *mpExEmbed << nHyperSize;
451 0 : mpExEmbed->SeekRel( nHyperSize );
452 0 : return nHyperId;
453 : }
454 :
455 : // ---------------------------------------------------------------------------------------------
456 :
457 0 : sal_Bool PPTWriter::ImplCloseDocument()
458 : {
459 0 : sal_uInt32 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Document );
460 0 : if ( nOfs )
461 : {
462 0 : mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_CurrentPos, mpStrm->Tell() );
463 0 : mpStrm->Seek( nOfs );
464 :
465 : // creating the TxMasterStyleAtom
466 0 : SvMemoryStream aTxMasterStyleAtomStrm( 0x200, 0x200 );
467 : {
468 0 : EscherExAtom aTxMasterStyleAtom( aTxMasterStyleAtomStrm, EPP_TxMasterStyleAtom, EPP_TEXTTYPE_Other );
469 0 : aTxMasterStyleAtomStrm << (sal_uInt16)5; // paragraph count
470 : sal_uInt16 nLev;
471 0 : sal_Bool bFirst = sal_True;
472 0 : for ( nLev = 0; nLev < 5; nLev++ )
473 : {
474 0 : mpStyleSheet->mpParaSheet[ EPP_TEXTTYPE_Other ]->Write( aTxMasterStyleAtomStrm, mpPptEscherEx, nLev, bFirst, sal_False, mXPagePropSet );
475 0 : mpStyleSheet->mpCharSheet[ EPP_TEXTTYPE_Other ]->Write( aTxMasterStyleAtomStrm, mpPptEscherEx, nLev, bFirst, sal_False, mXPagePropSet );
476 0 : bFirst = sal_False;
477 0 : }
478 : }
479 :
480 0 : mpExEmbed->Seek( STREAM_SEEK_TO_END );
481 0 : sal_uInt32 nExEmbedSize = mpExEmbed->Tell();
482 :
483 : // nEnviroment : Gesamtgroesse des Environment Containers
484 0 : sal_uInt32 nEnvironment = maFontCollection.GetCount() * 76 // 68 bytes pro Fontenityatom und je 8 Bytes fuer die Header
485 : + 8 // 1 FontCollection Container
486 : + 20 // SrKinsoku Container
487 : + 18 // 1 TxSiStyleAtom
488 0 : + aTxMasterStyleAtomStrm.Tell() // 1 TxMasterStyleAtom;
489 0 : + mpStyleSheet->SizeOfTxCFStyleAtom();
490 :
491 0 : sal_uInt32 nBytesToInsert = nEnvironment + 8;
492 :
493 0 : if ( nExEmbedSize )
494 0 : nBytesToInsert += nExEmbedSize + 8 + 12;
495 :
496 0 : nBytesToInsert += maSoundCollection.GetSize();
497 0 : nBytesToInsert += mpPptEscherEx->DrawingGroupContainerSize();
498 0 : nBytesToInsert += ImplMasterSlideListContainer( NULL );
499 0 : nBytesToInsert += ImplDocumentListContainer( NULL );
500 :
501 : // nBytes im Stream einfuegen, und abhaengige Container anpassen
502 0 : mpPptEscherEx->InsertAtCurrentPos( nBytesToInsert, false );
503 :
504 : // CREATE HYPERLINK CONTAINER
505 0 : if ( nExEmbedSize )
506 : {
507 0 : *mpStrm << (sal_uInt16)0xf
508 0 : << (sal_uInt16)EPP_ExObjList
509 0 : << (sal_uInt32)( nExEmbedSize + 12 )
510 0 : << (sal_uInt16)0
511 0 : << (sal_uInt16)EPP_ExObjListAtom
512 0 : << (sal_uInt32)4
513 0 : << (sal_uInt32)mnExEmbed;
514 0 : mpPptEscherEx->InsertPersistOffset( EPP_Persist_ExObj, mpStrm->Tell() );
515 0 : mpStrm->Write( mpExEmbed->GetData(), nExEmbedSize );
516 : }
517 :
518 : // CREATE ENVIRONMENT
519 0 : *mpStrm << (sal_uInt16)0xf << (sal_uInt16)EPP_Environment << (sal_uInt32)nEnvironment;
520 :
521 : // Open Container ( EPP_SrKinsoku )
522 0 : *mpStrm << (sal_uInt16)0x2f << (sal_uInt16)EPP_SrKinsoku << (sal_uInt32)12;
523 0 : mpPptEscherEx->AddAtom( 4, EPP_SrKinsokuAtom, 0, 3 );
524 0 : *mpStrm << (sal_Int32)0; // SrKinsoku Level 0
525 :
526 : // Open Container ( EPP_FontCollection )
527 0 : *mpStrm << (sal_uInt16)0xf << (sal_uInt16)EPP_FontCollection << (sal_uInt32)maFontCollection.GetCount() * 76;
528 :
529 0 : for ( sal_uInt32 i = 0; i < maFontCollection.GetCount(); i++ )
530 : {
531 0 : mpPptEscherEx->AddAtom( 68, EPP_FontEnityAtom, 0, i );
532 0 : const FontCollectionEntry* pDesc = maFontCollection.GetById( i );
533 0 : sal_uInt32 nFontLen = pDesc->Name.Len();
534 0 : if ( nFontLen > 31 )
535 0 : nFontLen = 31;
536 0 : for ( sal_uInt16 n = 0; n < 32; n++ )
537 : {
538 0 : sal_Unicode nUniCode = 0;
539 0 : if ( n < nFontLen )
540 0 : nUniCode = pDesc->Name.GetChar( n );
541 0 : *mpStrm << nUniCode;
542 : }
543 0 : sal_uInt8 lfCharSet = ANSI_CHARSET;
544 0 : sal_uInt8 lfClipPrecision = 0;
545 0 : sal_uInt8 lfQuality = 6;
546 0 : sal_uInt8 lfPitchAndFamily = 0;
547 :
548 0 : if ( pDesc->CharSet == RTL_TEXTENCODING_SYMBOL )
549 0 : lfCharSet = SYMBOL_CHARSET;
550 :
551 0 : switch( pDesc->Family )
552 : {
553 : case ::com::sun::star::awt::FontFamily::ROMAN :
554 0 : lfPitchAndFamily |= FF_ROMAN;
555 0 : break;
556 :
557 : case ::com::sun::star::awt::FontFamily::SWISS :
558 0 : lfPitchAndFamily |= FF_SWISS;
559 0 : break;
560 :
561 : case ::com::sun::star::awt::FontFamily::MODERN :
562 0 : lfPitchAndFamily |= FF_MODERN;
563 0 : break;
564 :
565 : case ::com::sun::star::awt::FontFamily::SCRIPT:
566 0 : lfPitchAndFamily |= FF_SCRIPT;
567 0 : break;
568 :
569 : case ::com::sun::star::awt::FontFamily::DECORATIVE:
570 0 : lfPitchAndFamily |= FF_DECORATIVE;
571 0 : break;
572 :
573 : default:
574 0 : lfPitchAndFamily |= FAMILY_DONTKNOW;
575 0 : break;
576 : }
577 0 : switch( pDesc->Pitch )
578 : {
579 : case ::com::sun::star::awt::FontPitch::FIXED:
580 0 : lfPitchAndFamily |= FIXED_PITCH;
581 0 : break;
582 :
583 : default:
584 0 : lfPitchAndFamily |= DEFAULT_PITCH;
585 0 : break;
586 : }
587 0 : *mpStrm << lfCharSet
588 0 : << lfClipPrecision
589 0 : << lfQuality
590 0 : << lfPitchAndFamily;
591 : }
592 0 : mpStyleSheet->WriteTxCFStyleAtom( *mpStrm ); // create style that is used for new standard objects
593 0 : mpPptEscherEx->AddAtom( 10, EPP_TxSIStyleAtom );
594 0 : *mpStrm << (sal_uInt32)7 // ?
595 0 : << (sal_Int16)2 // ?
596 0 : << (sal_uInt8)9 // ?
597 0 : << (sal_uInt8)8 // ?
598 0 : << (sal_Int16)0; // ?
599 :
600 0 : mpStrm->Write( aTxMasterStyleAtomStrm.GetData(), aTxMasterStyleAtomStrm.Tell() );
601 0 : maSoundCollection.Write( *mpStrm );
602 0 : mpPptEscherEx->WriteDrawingGroupContainer( *mpStrm );
603 0 : ImplMasterSlideListContainer( mpStrm );
604 0 : ImplDocumentListContainer( mpStrm );
605 :
606 0 : sal_uInt32 nOldPos = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_CurrentPos );
607 0 : if ( nOldPos )
608 : {
609 0 : mpStrm->Seek( nOldPos );
610 0 : return sal_True;
611 0 : }
612 : }
613 0 : return sal_False;
614 : }
615 :
616 : // ---------------------------------------------------------------------------------------------
617 :
618 0 : sal_Bool PropValue::GetPropertyValue(
619 : ::com::sun::star::uno::Any& rAny,
620 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
621 : const String& rString,
622 : sal_Bool bTestPropertyAvailability )
623 : {
624 0 : sal_Bool bRetValue = sal_True;
625 0 : if ( bTestPropertyAvailability )
626 : {
627 0 : bRetValue = sal_False;
628 : try
629 : {
630 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
631 0 : aXPropSetInfo( rXPropSet->getPropertySetInfo() );
632 0 : if ( aXPropSetInfo.is() )
633 0 : bRetValue = aXPropSetInfo->hasPropertyByName( rString );
634 : }
635 0 : catch( ::com::sun::star::uno::Exception& )
636 : {
637 0 : bRetValue = sal_False;
638 : }
639 : }
640 0 : if ( bRetValue )
641 : {
642 : try
643 : {
644 0 : rAny = rXPropSet->getPropertyValue( rString );
645 0 : if ( !rAny.hasValue() )
646 0 : bRetValue = sal_False;
647 : }
648 0 : catch( ::com::sun::star::uno::Exception& )
649 : {
650 0 : bRetValue = sal_False;
651 : }
652 : }
653 0 : return bRetValue;
654 : }
655 :
656 : // ---------------------------------------------------------------------------------------------
657 :
658 0 : ::com::sun::star::beans::PropertyState PropValue::GetPropertyState(
659 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
660 : const String& rPropertyName )
661 : {
662 0 : ::com::sun::star::beans::PropertyState eRetValue = ::com::sun::star::beans::PropertyState_AMBIGUOUS_VALUE;
663 : try
664 : {
665 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > aXPropState
666 0 : ( rXPropSet, ::com::sun::star::uno::UNO_QUERY );
667 0 : if ( aXPropState.is() )
668 0 : eRetValue = aXPropState->getPropertyState( rPropertyName );
669 : }
670 0 : catch( ::com::sun::star::uno::Exception& )
671 : {
672 : //...
673 : }
674 0 : return eRetValue;
675 : }
676 :
677 : // ---------------------------------------------------------------------------------------------
678 :
679 0 : sal_Bool PropValue::ImplGetPropertyValue( const String& rString )
680 : {
681 0 : return GetPropertyValue( mAny, mXPropSet, rString );
682 : }
683 :
684 : // ---------------------------------------------------------------------------------------------
685 :
686 0 : sal_Bool PropValue::ImplGetPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & aXPropSet, const String& rString )
687 : {
688 0 : return GetPropertyValue( mAny, aXPropSet, rString );
689 : }
690 :
691 : // ---------------------------------------------------------------------------------------------
692 :
693 0 : sal_Bool PropStateValue::ImplGetPropertyValue( const String& rString, sal_Bool bGetPropertyState )
694 : {
695 0 : ePropState = ::com::sun::star::beans::PropertyState_AMBIGUOUS_VALUE;
696 0 : sal_Bool bRetValue = sal_True;
697 : #ifdef UNX
698 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
699 0 : aXPropSetInfo( mXPropSet->getPropertySetInfo() );
700 0 : if ( !aXPropSetInfo.is() )
701 0 : return sal_False;
702 : #endif
703 : try
704 : {
705 0 : mAny = mXPropSet->getPropertyValue( rString );
706 0 : if ( !mAny.hasValue() )
707 0 : bRetValue = sal_False;
708 0 : else if ( bGetPropertyState )
709 0 : ePropState = mXPropState->getPropertyState( rString );
710 : else
711 0 : ePropState = ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
712 : }
713 0 : catch( ::com::sun::star::uno::Exception& )
714 : {
715 0 : bRetValue = sal_False;
716 : }
717 0 : return bRetValue;
718 : }
719 :
720 : // ---------------------------------------------------------------------------------------------
721 :
722 0 : void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj )
723 : {
724 0 : sal_Bool bFirstParagraph = sal_True;
725 : sal_uInt32 nCharCount;
726 0 : sal_uInt32 nPropertyFlags = 0;
727 0 : sal_uInt16 nDepth = 0;
728 : sal_Int16 nLineSpacing;
729 0 : int nInstance = rTextObj.GetInstance();
730 :
731 0 : for ( sal_uInt32 i = 0; i < rTextObj.ParagraphCount(); ++i, bFirstParagraph = sal_False )
732 : {
733 0 : ParagraphObj* pPara = rTextObj.GetParagraph(i);
734 0 : PortionObj* pPortion = pPara->front();
735 0 : nCharCount = pPara->size();
736 :
737 0 : nDepth = pPara->nDepth;
738 0 : if ( nDepth > 4)
739 0 : nDepth = 4;
740 :
741 0 : if ( ( pPara->meTextAdjust == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
742 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_Adjust, pPara->mnTextAdjust ) ) )
743 0 : nPropertyFlags |= 0x00000800;
744 0 : nLineSpacing = pPara->mnLineSpacing;
745 :
746 0 : const FontCollectionEntry* pDesc = maFontCollection.GetById( pPortion->mnFont );
747 0 : sal_Int16 nNormalSpacing = 100;
748 0 : if ( !mbFontIndependentLineSpacing && pDesc )
749 : {
750 0 : double fN = 100.0;
751 0 : fN *= pDesc->Scaling;
752 0 : nNormalSpacing = (sal_Int16)( fN + 0.5 );
753 : }
754 0 : if ( !mbFontIndependentLineSpacing && bFirstParagraph && ( nLineSpacing > nNormalSpacing ) ) // sj: i28747, no replacement for fixed linespacing
755 : {
756 0 : nLineSpacing = nNormalSpacing;
757 0 : nPropertyFlags |= 0x00001000;
758 : }
759 : else
760 : {
761 0 : if ( nLineSpacing > 0 )
762 : {
763 0 : if ( !mbFontIndependentLineSpacing && pDesc )
764 0 : nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
765 : }
766 : else
767 : {
768 0 : if ( !pPara->mbFixedLineSpacing && pPortion && pPortion->mnCharHeight > (sal_uInt16)( ((double)-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point
769 0 : nLineSpacing = nNormalSpacing;
770 : else
771 0 : nLineSpacing = (sal_Int16)( (double)nLineSpacing / 4.40972 );
772 : }
773 0 : if ( ( pPara->meLineSpacing == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
774 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_LineFeed, nLineSpacing ) ) )
775 0 : nPropertyFlags |= 0x00001000;
776 : }
777 0 : if ( ( pPara->meLineSpacingTop == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
778 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mnLineSpacingTop ) ) )
779 0 : nPropertyFlags |= 0x00002000;
780 0 : if ( ( pPara->meLineSpacingBottom == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
781 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_LowerDist, pPara->mnLineSpacingBottom ) ) )
782 0 : nPropertyFlags |= 0x00004000;
783 0 : if ( ( pPara->meForbiddenRules == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
784 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mbForbiddenRules ) ) )
785 0 : nPropertyFlags |= 0x00020000;
786 0 : if ( ( pPara->meParagraphPunctation == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
787 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mbParagraphPunctation ) ) )
788 0 : nPropertyFlags |= 0x00080000;
789 0 : if ( ( pPara->meBiDi == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
790 0 : ( mpStyleSheet->IsHardAttribute( nInstance, nDepth, ParaAttr_BiDi, pPara->mnBiDi ) ) )
791 0 : nPropertyFlags |= 0x00200000;
792 :
793 0 : sal_Int32 nBuRealSize = pPara->nBulletRealSize;
794 0 : sal_Int16 nBulletFlags = pPara->nBulletFlags;
795 :
796 0 : if ( pPara->bExtendedParameters )
797 0 : nPropertyFlags |= pPara->nParaFlags;
798 : else
799 : {
800 0 : nPropertyFlags |= 1; // turn off bullet explicit
801 0 : nBulletFlags = 0;
802 : }
803 0 : FontCollectionEntry aFontDescEntry( pPara->aFontDesc.Name, pPara->aFontDesc.Family, pPara->aFontDesc.Pitch, pPara->aFontDesc.CharSet );
804 0 : sal_uInt16 nFontId = (sal_uInt16)maFontCollection.GetId( aFontDescEntry );
805 :
806 0 : rOut << nCharCount
807 0 : << nDepth // Level
808 0 : << (sal_uInt32)nPropertyFlags; // Paragraph Attribut Set
809 :
810 0 : if ( nPropertyFlags & 0xf )
811 0 : rOut << nBulletFlags;
812 0 : if ( nPropertyFlags & 0x80 )
813 0 : rOut << (sal_uInt16)( pPara->cBulletId );
814 0 : if ( nPropertyFlags & 0x10 )
815 0 : rOut << nFontId;
816 0 : if ( nPropertyFlags & 0x40 )
817 0 : rOut << (sal_Int16)nBuRealSize;
818 0 : if ( nPropertyFlags & 0x20 )
819 : {
820 0 : sal_uInt32 nBulletColor = pPara->nBulletColor;
821 0 : if ( nBulletColor == COL_AUTO )
822 : {
823 0 : sal_Bool bIsDark = sal_False;
824 0 : ::com::sun::star::uno::Any aAny;
825 0 : if ( PropValue::GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "IsBackgroundDark" ), sal_True ) )
826 0 : aAny >>= bIsDark;
827 0 : nBulletColor = bIsDark ? 0xffffff : 0x000000;
828 : }
829 0 : nBulletColor &= 0xffffff;
830 0 : nBulletColor |= 0xfe000000;
831 0 : rOut << nBulletColor;
832 : }
833 0 : if ( nPropertyFlags & 0x00000800 )
834 0 : rOut << (sal_uInt16)( pPara->mnTextAdjust );
835 0 : if ( nPropertyFlags & 0x00001000 )
836 0 : rOut << (sal_uInt16)( nLineSpacing );
837 0 : if ( nPropertyFlags & 0x00002000 )
838 0 : rOut << (sal_uInt16)( pPara->mnLineSpacingTop );
839 0 : if ( nPropertyFlags & 0x00004000 )
840 0 : rOut << (sal_uInt16)( pPara->mnLineSpacingBottom );
841 0 : if ( nPropertyFlags & 0x000e0000 )
842 : {
843 0 : sal_uInt16 nAsianSettings = 0;
844 0 : if ( pPara->mbForbiddenRules )
845 0 : nAsianSettings |= 1;
846 0 : if ( pPara->mbParagraphPunctation )
847 0 : nAsianSettings |= 4;
848 0 : rOut << nAsianSettings;
849 : }
850 0 : if ( nPropertyFlags & 0x200000 )
851 0 : rOut << pPara->mnBiDi;
852 0 : }
853 0 : }
854 :
855 : // -----------------------------------------------------------------------
856 :
857 0 : void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj )
858 : {
859 : sal_uInt32 nPropertyFlags;
860 0 : int nInstance = rTextObj.GetInstance();
861 :
862 0 : for ( sal_uInt32 i = 0; i < rTextObj.ParagraphCount(); ++i )
863 : {
864 0 : ParagraphObj* pPara = rTextObj.GetParagraph(i);
865 0 : for ( ParagraphObj::const_iterator it = pPara->begin(); it != pPara->end(); ++it )
866 : {
867 0 : PortionObj* pPortion = *it;
868 0 : nPropertyFlags = 0;
869 0 : sal_uInt32 nCharAttr = pPortion->mnCharAttr;
870 0 : sal_uInt32 nCharColor = pPortion->mnCharColor;
871 :
872 0 : if ( nCharColor == COL_AUTO ) // nCharColor depends to the background color
873 : {
874 0 : sal_Bool bIsDark = sal_False;
875 0 : ::com::sun::star::uno::Any aAny;
876 0 : if ( PropValue::GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "IsBackgroundDark" ), sal_True ) )
877 0 : aAny >>= bIsDark;
878 0 : nCharColor = bIsDark ? 0xffffff : 0x000000;
879 : }
880 :
881 0 : nCharColor &= 0xffffff;
882 :
883 : /* the portion is using the embossed or engraved attribute, which we want to map to the relief feature of PPT.
884 : Because the relief feature of PPT is dependent to the background color, such a mapping can not always be used. */
885 0 : if ( nCharAttr & 0x200 )
886 : {
887 0 : sal_uInt32 nBackgroundColor = 0xffffff;
888 :
889 0 : if ( !nCharColor ) // special threatment for
890 0 : nCharColor = 0xffffff; // black fontcolor
891 :
892 0 : ::com::sun::star::uno::Any aAny;
893 0 : ::com::sun::star::drawing::FillStyle aFS( ::com::sun::star::drawing::FillStyle_NONE );
894 0 : if ( PropValue::GetPropertyValue( aAny, mXPropSet, rtl::OUString( "FillStyle" ) ) )
895 0 : aAny >>= aFS;
896 0 : switch( aFS )
897 : {
898 : case ::com::sun::star::drawing::FillStyle_GRADIENT :
899 : {
900 0 : Point aEmptyPoint = Point();
901 0 : Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
902 0 : EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect );
903 0 : aPropOpt.CreateGradientProperties( mXPropSet );
904 0 : aPropOpt.GetOpt( ESCHER_Prop_fillColor, nBackgroundColor );
905 : }
906 0 : break;
907 : case ::com::sun::star::drawing::FillStyle_SOLID :
908 : {
909 0 : if ( PropValue::GetPropertyValue( aAny, mXPropSet, rtl::OUString( "FillColor" ) ) )
910 0 : nBackgroundColor = mpPptEscherEx->GetColor( *((sal_uInt32*)aAny.getValue()) );
911 : }
912 0 : break;
913 : case ::com::sun::star::drawing::FillStyle_NONE :
914 : {
915 0 : ::com::sun::star::uno::Any aBackAny;
916 0 : ::com::sun::star::drawing::FillStyle aBackFS( ::com::sun::star::drawing::FillStyle_NONE );
917 0 : if ( PropValue::GetPropertyValue( aBackAny, mXBackgroundPropSet, rtl::OUString( "FillStyle" ) ) )
918 0 : aBackAny >>= aBackFS;
919 0 : switch( aBackFS )
920 : {
921 : case ::com::sun::star::drawing::FillStyle_GRADIENT :
922 : {
923 0 : Point aEmptyPoint = Point();
924 0 : Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
925 0 : EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect );
926 0 : aPropOpt.CreateGradientProperties( mXBackgroundPropSet );
927 0 : aPropOpt.GetOpt( ESCHER_Prop_fillColor, nBackgroundColor );
928 : }
929 0 : break;
930 : case ::com::sun::star::drawing::FillStyle_SOLID :
931 : {
932 0 : if ( PropValue::GetPropertyValue( aAny, mXBackgroundPropSet, rtl::OUString( "FillColor" ) ) )
933 0 : nBackgroundColor = mpPptEscherEx->GetColor( *((sal_uInt32*)aAny.getValue()) );
934 : }
935 0 : break;
936 : default:
937 0 : break;
938 0 : }
939 : }
940 0 : break;
941 : default:
942 0 : break;
943 : }
944 :
945 0 : sal_Int32 nB = nBackgroundColor & 0xff;
946 0 : nB += (sal_uInt8)( nBackgroundColor >> 8 );
947 0 : nB += (sal_uInt8)( nBackgroundColor >> 16 );
948 : // if the background color is nearly black, relief can't been used, because the text would not be visible
949 0 : if ( nB < 0x60 || ( nBackgroundColor != nCharColor ) )
950 : {
951 0 : nCharAttr &=~ 0x200;
952 :
953 : // now check if the text is part of a group, and if the previous object has the same color than the fontcolor
954 : // ( and if fillcolor is not available the background color ), it is sometimes
955 : // not possible to export the 'embossed' flag
956 0 : if ( ( GetCurrentGroupLevel() > 0 ) && ( GetCurrentGroupIndex() >= 1 ) )
957 : {
958 0 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > aGroupedShape( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() - 1 ), uno::UNO_QUERY );
959 0 : if( aGroupedShape.is() )
960 : {
961 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aPropSetOfNextShape
962 0 : ( aGroupedShape, ::com::sun::star::uno::UNO_QUERY );
963 0 : if ( aPropSetOfNextShape.is() )
964 : {
965 0 : if ( PropValue::GetPropertyValue( aAny, aPropSetOfNextShape,
966 0 : rtl::OUString( "FillColor" ), sal_True ) )
967 : {
968 0 : if ( nCharColor == mpPptEscherEx->GetColor( *((sal_uInt32*)aAny.getValue()) ) )
969 : {
970 0 : nCharAttr |= 0x200;
971 : }
972 : }
973 0 : }
974 0 : }
975 : }
976 0 : }
977 : }
978 0 : nCharColor |= 0xfe000000;
979 0 : if ( nInstance == 4 ) // special handling for normal textobjects:
980 0 : nPropertyFlags |= nCharAttr & 0x217; // not all attributes ar inherited
981 : else
982 : {
983 0 : if ( /* ( pPortion->mnCharAttrHard & 1 ) || */
984 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Bold, nCharAttr ) ) )
985 0 : nPropertyFlags |= 1;
986 0 : if ( /* ( pPortion->mnCharAttrHard & 2 ) || */
987 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Italic, nCharAttr ) ) )
988 0 : nPropertyFlags |= 2;
989 0 : if ( /* ( pPortion->mnCharAttrHard & 4 ) || */
990 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Underline, nCharAttr ) ) )
991 0 : nPropertyFlags |= 4;
992 0 : if ( /* ( pPortion->mnCharAttrHard & 0x10 ) || */
993 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Shadow, nCharAttr ) ) )
994 0 : nPropertyFlags |= 0x10;
995 0 : if ( /* ( pPortion->mnCharAttrHard & 0x200 ) || */
996 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Embossed, nCharAttr ) ) )
997 0 : nPropertyFlags |= 512;
998 : }
999 0 : if ( rTextObj.HasExtendedBullets() )
1000 : {
1001 0 : nPropertyFlags |= ( i & 0x3f ) << 10 ;
1002 0 : nCharAttr |= ( i & 0x3f ) << 10;
1003 : }
1004 0 : if ( ( pPortion->meFontName == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
1005 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Font, pPortion->mnFont ) ) )
1006 0 : nPropertyFlags |= 0x00010000;
1007 0 : if ( ( pPortion->meAsianOrComplexFont == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
1008 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_AsianOrComplexFont, pPortion->mnAsianOrComplexFont ) ) )
1009 0 : nPropertyFlags |= 0x00200000;
1010 0 : if ( ( pPortion->meCharHeight == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
1011 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontHeight, pPortion->mnCharHeight ) ) )
1012 0 : nPropertyFlags |= 0x00020000;
1013 0 : if ( ( pPortion->meCharColor == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
1014 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontColor, nCharColor & 0xffffff ) ) )
1015 0 : nPropertyFlags |= 0x00040000;
1016 0 : if ( ( pPortion->meCharEscapement == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
1017 0 : ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Escapement, pPortion->mnCharEscapement ) ) )
1018 0 : nPropertyFlags |= 0x00080000;
1019 :
1020 0 : sal_uInt32 nCharCount = pPortion->Count();
1021 :
1022 0 : rOut << nCharCount
1023 0 : << nPropertyFlags; //PropertyFlags
1024 :
1025 0 : if ( nPropertyFlags & 0xffff )
1026 0 : rOut << (sal_uInt16)( nCharAttr );
1027 0 : if ( nPropertyFlags & 0x00010000 )
1028 0 : rOut << pPortion->mnFont;
1029 0 : if ( nPropertyFlags & 0x00200000 )
1030 0 : rOut << pPortion->mnAsianOrComplexFont;
1031 0 : if ( nPropertyFlags & 0x00020000 )
1032 0 : rOut << (sal_uInt16)( pPortion->mnCharHeight );
1033 0 : if ( nPropertyFlags & 0x00040000 )
1034 0 : rOut << (sal_uInt32)nCharColor;
1035 0 : if ( nPropertyFlags & 0x00080000 )
1036 0 : rOut << pPortion->mnCharEscapement;
1037 : }
1038 : }
1039 0 : }
1040 :
1041 : // ----------------------------------------------------------------------------------------
1042 : // laedt und konvertiert text aus shape, ergebnis ist mnTextSize gespeichert;
1043 0 : sal_Bool PPTWriter::ImplGetText()
1044 : {
1045 0 : mnTextSize = 0;
1046 0 : mbFontIndependentLineSpacing = sal_False;
1047 : mXText = ::com::sun::star::uno::Reference<
1048 : ::com::sun::star::text::XSimpleText >
1049 0 : ( mXShape, ::com::sun::star::uno::UNO_QUERY );
1050 :
1051 0 : if ( mXText.is() )
1052 : {
1053 0 : mnTextSize = mXText->getString().getLength();
1054 0 : ::com::sun::star::uno::Any aAny;
1055 0 : if ( GetPropertyValue( aAny, mXPropSet, rtl::OUString( "FontIndependentLineSpacing" ) ), sal_True )
1056 0 : aAny >>= mbFontIndependentLineSpacing;
1057 : }
1058 0 : return ( mnTextSize != 0 );
1059 : }
1060 :
1061 : // -----------------------------------------------------------------------
1062 :
1063 0 : void PPTWriter::ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt )
1064 : {
1065 0 : if ( mnAngle < 0 )
1066 0 : mnAngle = ( 36000 + mnAngle ) % 36000;
1067 : else
1068 0 : mnAngle = ( 36000 - ( mnAngle % 36000 ) );
1069 :
1070 0 : double fCos = cos( (double)mnAngle * F_PI18000 );
1071 0 : double fSin = sin( (double)mnAngle * F_PI18000 );
1072 :
1073 0 : double fWidthHalf = maRect.GetWidth() / 2;
1074 0 : double fHeightHalf = maRect.GetHeight() / 2;
1075 :
1076 0 : double fXDiff = fCos * fWidthHalf + fSin * (-fHeightHalf);
1077 0 : double fYDiff = - ( fSin * fWidthHalf - fCos * ( -fHeightHalf ) );
1078 :
1079 0 : maRect.Move( (sal_Int32)( -( fWidthHalf - fXDiff ) ), (sal_Int32)( - ( fHeightHalf + fYDiff ) ) );
1080 0 : mnAngle *= 655;
1081 0 : mnAngle += 0x8000;
1082 0 : mnAngle &=~0xffff; // nAngle auf volle Gradzahl runden
1083 0 : rPropOpt.AddOpt( ESCHER_Prop_Rotation, mnAngle );
1084 :
1085 0 : if ( ( mnAngle >= ( 45 << 16 ) && mnAngle < ( 135 << 16 ) ) ||
1086 : ( mnAngle >= ( 225 << 16 ) && mnAngle < ( 315 << 16 ) ) )
1087 : {
1088 : // In diesen beiden Bereichen steht in PPT gemeinerweise die
1089 : // BoundingBox bereits senkrecht. Daher muss diese VOR
1090 : // DER ROTATION flachgelegt werden.
1091 : ::com::sun::star::awt::Point
1092 0 : aTopLeft( (sal_Int32)( maRect.Left() + fWidthHalf - fHeightHalf ), (sal_Int32)( maRect.Top() + fHeightHalf - fWidthHalf ) );
1093 0 : Size aNewSize( maRect.GetHeight(), maRect.GetWidth() );
1094 0 : maRect = Rectangle( Point( aTopLeft.X, aTopLeft.Y ), aNewSize );
1095 : }
1096 0 : }
1097 :
1098 : // -----------------------------------------------------------------------
1099 :
1100 0 : void PPTWriter::ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt )
1101 : {
1102 0 : if ( !mbFontIndependentLineSpacing )
1103 : {
1104 0 : if ( rTextObj.ParagraphCount() )
1105 : {
1106 0 : ParagraphObj* pPara = rTextObj.GetParagraph(0);
1107 0 : if ( !pPara->empty() )
1108 : {
1109 0 : PortionObj* pPortion = pPara->front();
1110 0 : sal_Int16 nLineSpacing = pPara->mnLineSpacing;
1111 0 : const FontCollectionEntry* pDesc = maFontCollection.GetById( pPortion->mnFont );
1112 0 : if ( pDesc )
1113 0 : nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
1114 :
1115 0 : if ( ( nLineSpacing > 0 ) && ( nLineSpacing < 100 ) )
1116 : {
1117 0 : double fCharHeight = pPortion->mnCharHeight;
1118 0 : fCharHeight *= 2540 / 72;
1119 0 : fCharHeight *= 100 - nLineSpacing;
1120 0 : fCharHeight /= 100;
1121 :
1122 0 : sal_uInt32 nUpperDistance = 0;
1123 0 : rPropOpt.GetOpt( ESCHER_Prop_dyTextTop, nUpperDistance );
1124 0 : nUpperDistance += static_cast< sal_uInt32 >( fCharHeight * 360.0 );
1125 0 : rPropOpt.AddOpt( ESCHER_Prop_dyTextTop, nUpperDistance );
1126 : }
1127 : }
1128 : }
1129 : }
1130 0 : }
1131 :
1132 : // -----------------------------------------------------------------------
1133 :
1134 0 : void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance,
1135 : TextRuleEntry* pTextRule, SvStream& rExtBuStr, EscherPropertyContainer* pPropOpt )
1136 : {
1137 0 : PPTExParaSheet& rParaSheet = mpStyleSheet->GetParaSheet( nTextInstance );
1138 :
1139 0 : rOut << (sal_uInt32)( ( EPP_TextHeaderAtom << 16 ) | ( nAtomInstance << 4 ) ) << (sal_uInt32)4
1140 0 : << sal_Int32(nTextInstance);
1141 :
1142 0 : if ( mbEmptyPresObj )
1143 0 : mnTextSize = 0;
1144 0 : if ( !mbEmptyPresObj )
1145 : {
1146 : ParagraphObj* pPara;
1147 0 : TextObjBinary aTextObj( mXText, nTextInstance, maFontCollection, (PPTExBulletProvider&)*this );
1148 :
1149 : // leaving out EPP_TextCharsAtom w/o text - still write out
1150 : // attribute info though
1151 0 : if ( mnTextSize )
1152 0 : aTextObj.Write( &rOut );
1153 :
1154 0 : if ( pPropOpt )
1155 0 : ImplAdjustFirstLineLineSpacing( aTextObj, *pPropOpt );
1156 :
1157 0 : sal_uInt32 nSize, nPos = rOut.Tell();
1158 :
1159 0 : rOut << (sal_uInt32)( EPP_StyleTextPropAtom << 16 ) << (sal_uInt32)0;
1160 0 : ImplWriteParagraphs( rOut, aTextObj );
1161 0 : ImplWritePortions( rOut, aTextObj );
1162 0 : nSize = rOut.Tell() - nPos;
1163 0 : rOut.SeekRel( - ( (sal_Int32)nSize - 4 ) );
1164 0 : rOut << (sal_uInt32)( nSize - 8 );
1165 0 : rOut.SeekRel( nSize - 8 );
1166 :
1167 0 : for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
1168 : {
1169 0 : pPara = aTextObj.GetParagraph(i);
1170 0 : for ( ParagraphObj::const_iterator it = pPara->begin(); it != pPara->end(); ++it )
1171 : {
1172 0 : PortionObj* pPortion = *it;
1173 0 : if ( pPortion->mpFieldEntry )
1174 : {
1175 0 : const FieldEntry* pFieldEntry = pPortion->mpFieldEntry;
1176 :
1177 0 : switch ( pFieldEntry->nFieldType >> 28 )
1178 : {
1179 : case 1 :
1180 : case 2 :
1181 : {
1182 0 : rOut << (sal_uInt32)( EPP_DateTimeMCAtom << 16 ) << (sal_uInt32)8
1183 0 : << (sal_uInt32)( pFieldEntry->nFieldStartPos ) // TxtOffset auf TxtField;
1184 0 : << (sal_uInt8)( pFieldEntry->nFieldType & 0xff ) // Type
1185 0 : << (sal_uInt8)0 << (sal_uInt16)0; // PadBytes
1186 : }
1187 0 : break;
1188 : case 3 :
1189 : {
1190 0 : rOut << (sal_uInt32)( EPP_SlideNumberMCAtom << 16 ) << (sal_uInt32 ) 4
1191 0 : << (sal_uInt32)( pFieldEntry->nFieldStartPos );
1192 : }
1193 0 : break;
1194 : case 4 :
1195 : {
1196 0 : sal_uInt32 nPageIndex = 0;
1197 0 : String aPageUrl;
1198 0 : String aEmpty;
1199 0 : String aFile( pFieldEntry->aFieldUrl );
1200 0 : String aTarget( pFieldEntry->aFieldUrl );
1201 0 : INetURLObject aUrl( pFieldEntry->aFieldUrl );
1202 0 : if ( INET_PROT_FILE == aUrl.GetProtocol() )
1203 0 : aFile = aUrl.PathToFileName();
1204 0 : else if ( INET_PROT_SMB == aUrl.GetProtocol() )
1205 : {
1206 : // Convert smb notation to '\\' and skip the 'smb:' part
1207 0 : aFile = aUrl.GetMainURL(INetURLObject::NO_DECODE).copy(4);
1208 0 : aFile.SearchAndReplaceAll( '/', '\\' );
1209 0 : aTarget = aFile;
1210 : }
1211 0 : else if ( pFieldEntry->aFieldUrl.GetChar( 0 ) == '#' )
1212 : {
1213 0 : String aPage( INetURLObject::decode( pFieldEntry->aFieldUrl, '%', INetURLObject::DECODE_WITH_CHARSET ) );
1214 0 : aPage.Erase( 0, 1 );
1215 :
1216 0 : rtl::OUString aUPage(aPage);
1217 : std::vector<rtl::OUString>::const_iterator pIter = std::find(
1218 0 : maSlideNameList.begin(),maSlideNameList.end(),aUPage);
1219 :
1220 0 : if ( pIter != maSlideNameList.end() )
1221 : {
1222 0 : nPageIndex = pIter - maSlideNameList.begin();
1223 0 : aPageUrl = rtl::OUString::valueOf(static_cast<sal_Int32>(256 + nPageIndex));
1224 0 : aPageUrl.Append( rtl::OUString( "," ) );
1225 0 : aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) );
1226 0 : aPageUrl.Append( rtl::OUString( ",Slide " ) );
1227 0 : aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) );
1228 0 : }
1229 : }
1230 0 : sal_uInt32 nHyperId(0);
1231 0 : if ( aPageUrl.Len() )
1232 0 : nHyperId = ImplInsertBookmarkURL( aPageUrl, 1 | ( nPageIndex << 8 ) | ( 1 << 31 ), pFieldEntry->aRepresentation, aEmpty, aEmpty, aPageUrl );
1233 : else
1234 0 : nHyperId = ImplInsertBookmarkURL( pFieldEntry->aFieldUrl, 2 | ( nHyperId << 8 ), aFile, aTarget, aEmpty, aEmpty );
1235 :
1236 0 : rOut << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0xf ) << (sal_uInt32)24
1237 0 : << (sal_uInt32)( EPP_InteractiveInfoAtom << 16 ) << (sal_uInt32)16
1238 0 : << (sal_uInt32)0 // soundref
1239 0 : << nHyperId // hyperlink id
1240 0 : << (sal_uInt8)4 // hyperlink action
1241 0 : << (sal_uInt8)0 // ole verb
1242 0 : << (sal_uInt8)0 // jump
1243 0 : << (sal_uInt8)0 // flags
1244 0 : << (sal_uInt8)8 // hyperlink type ?
1245 0 : << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0
1246 0 : << (sal_uInt32)( EPP_TxInteractiveInfoAtom << 16 ) << (sal_uInt32)8
1247 0 : << (sal_uInt32)( pFieldEntry->nFieldStartPos )
1248 0 : << (sal_uInt32)( pFieldEntry->nFieldEndPos );
1249 : }
1250 0 : break;
1251 : case 5 :
1252 : {
1253 0 : rOut << (sal_uInt32)( EPP_GenericDateMCAtom << 16 ) << (sal_uInt32)4
1254 0 : << (sal_uInt32)( pFieldEntry->nFieldStartPos );
1255 : }
1256 0 : break;
1257 : case 6 :
1258 : {
1259 0 : rOut << (sal_uInt32)( EPP_HeaderMCAtom << 16 ) << (sal_uInt32 ) 4
1260 0 : << (sal_uInt32)( pFieldEntry->nFieldStartPos );
1261 : }
1262 0 : break;
1263 : case 7 :
1264 : {
1265 0 : rOut << (sal_uInt32)( EPP_FooterMCAtom << 16 ) << (sal_uInt32 ) 4
1266 0 : << (sal_uInt32)( pFieldEntry->nFieldStartPos );
1267 : }
1268 0 : break;
1269 : default:
1270 0 : break;
1271 : }
1272 : }
1273 : }
1274 : }
1275 :
1276 0 : aTextObj.WriteTextSpecInfo( &rOut );
1277 :
1278 : // Star Office Default TabSizes schreiben ( wenn noetig )
1279 0 : if ( aTextObj.ParagraphCount() )
1280 : {
1281 0 : pPara = aTextObj.GetParagraph(0);
1282 0 : sal_uInt32 nParaFlags = 0x1f;
1283 : sal_Int16 nDepth, nMask, nNumberingRule[ 10 ];
1284 0 : sal_uInt32 nTextOfs = pPara->nTextOfs;
1285 0 : sal_uInt32 nTabs = pPara->maTabStop.getLength();
1286 0 : const ::com::sun::star::style::TabStop* pTabStop = ( const ::com::sun::star::style::TabStop* )pPara->maTabStop.getConstArray();
1287 :
1288 0 : for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
1289 : {
1290 0 : pPara = aTextObj.GetParagraph(i);
1291 0 : if ( pPara->bExtendedParameters )
1292 : {
1293 0 : nDepth = pPara->nDepth;
1294 0 : if ( nDepth < 5 )
1295 : {
1296 0 : nMask = 1 << nDepth;
1297 0 : if ( nParaFlags & nMask )
1298 : {
1299 0 : nParaFlags &=~ nMask;
1300 0 : if ( ( rParaSheet.maParaLevel[ nDepth ].mnTextOfs != pPara->nTextOfs ) ||
1301 : ( rParaSheet.maParaLevel[ nDepth ].mnBulletOfs != pPara->nBulletOfs ) )
1302 : {
1303 0 : nParaFlags |= nMask << 16;
1304 0 : nNumberingRule[ nDepth << 1 ] = pPara->nTextOfs;
1305 0 : nNumberingRule[ ( nDepth << 1 ) + 1 ] = (sal_Int16)pPara->nBulletOfs;
1306 : }
1307 : }
1308 : }
1309 : }
1310 : }
1311 0 : nParaFlags >>= 16;
1312 :
1313 0 : sal_uInt32 nDefaultTabSize = MapSize( ::com::sun::star::awt::Size( 2011, 1 ) ).Width;
1314 0 : sal_uInt32 nDefaultTabs = abs( maRect.GetWidth() ) / nDefaultTabSize;
1315 0 : if ( nTabs )
1316 0 : nDefaultTabs -= (sal_Int32)( ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 ) + nTextOfs ) / nDefaultTabSize );
1317 0 : if ( (sal_Int32)nDefaultTabs < 0 )
1318 0 : nDefaultTabs = 0;
1319 :
1320 0 : sal_uInt32 nTabCount = nTabs + nDefaultTabs;
1321 0 : sal_uInt32 i, nTextRulerAtomFlags = 0;
1322 :
1323 0 : if ( nTabCount )
1324 0 : nTextRulerAtomFlags |= 4;
1325 0 : if ( nParaFlags )
1326 0 : nTextRulerAtomFlags |= ( ( nParaFlags << 3 ) | ( nParaFlags << 8 ) );
1327 :
1328 0 : if ( nTextRulerAtomFlags )
1329 : {
1330 0 : SvStream* pRuleOut = &rOut;
1331 0 : if ( pTextRule )
1332 0 : pRuleOut = pTextRule->pOut = new SvMemoryStream( 0x100, 0x100 );
1333 :
1334 0 : sal_uInt32 nRulePos = pRuleOut->Tell();
1335 0 : *pRuleOut << (sal_uInt32)( EPP_TextRulerAtom << 16 ) << (sal_uInt32)0;
1336 0 : *pRuleOut << nTextRulerAtomFlags;
1337 0 : if ( nTextRulerAtomFlags & 4 )
1338 : {
1339 0 : *pRuleOut << (sal_uInt16)nTabCount;
1340 0 : for ( i = 0; i < nTabs; i++ )
1341 : {
1342 0 : sal_uInt16 nPosition = (sal_uInt16)( ( pTabStop[ i ].Position / 4.40972 ) + nTextOfs );
1343 : sal_uInt16 nType;
1344 0 : switch ( pTabStop[ i ].Alignment )
1345 : {
1346 0 : case ::com::sun::star::style::TabAlign_DECIMAL : nType = 3; break;
1347 0 : case ::com::sun::star::style::TabAlign_RIGHT : nType = 2; break;
1348 0 : case ::com::sun::star::style::TabAlign_CENTER : nType = 1; break;
1349 :
1350 : case ::com::sun::star::style::TabAlign_LEFT :
1351 0 : default: nType = 0;
1352 : };
1353 0 : *pRuleOut << nPosition
1354 0 : << nType;
1355 : }
1356 :
1357 0 : sal_uInt32 nWidth = 1;
1358 0 : if ( nTabs )
1359 0 : nWidth += (sal_Int32)( ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 + nTextOfs ) / nDefaultTabSize ) );
1360 0 : nWidth *= nDefaultTabSize;
1361 0 : for ( i = 0; i < nDefaultTabs; i++, nWidth += nDefaultTabSize )
1362 0 : *pRuleOut << nWidth;
1363 : }
1364 0 : for ( i = 0; i < 5; i++ )
1365 : {
1366 0 : if ( nTextRulerAtomFlags & ( 8 << i ) )
1367 0 : *pRuleOut << nNumberingRule[ i << 1 ];
1368 0 : if ( nTextRulerAtomFlags & ( 256 << i ) )
1369 0 : *pRuleOut << nNumberingRule[ ( i << 1 ) + 1 ];
1370 : }
1371 0 : sal_uInt32 nBufSize = pRuleOut->Tell() - nRulePos;
1372 0 : pRuleOut->SeekRel( - ( (sal_Int32)nBufSize - 4 ) );
1373 0 : *pRuleOut << (sal_uInt32)( nBufSize - 8 );
1374 0 : pRuleOut->SeekRel( nBufSize - 8 );
1375 : }
1376 : }
1377 0 : if ( aTextObj.HasExtendedBullets() )
1378 : {
1379 0 : if ( aTextObj.ParagraphCount() )
1380 : {
1381 0 : ParagraphObj* pBulletPara = aTextObj.GetParagraph(0);
1382 0 : sal_uInt32 nBulletFlags = 0;
1383 0 : sal_uInt32 nNumberingType = 0, nPos2 = rExtBuStr.Tell();
1384 :
1385 0 : rExtBuStr << (sal_uInt32)( EPP_PST_ExtendedParagraphAtom << 16 ) << (sal_uInt32)0;
1386 :
1387 0 : for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
1388 : {
1389 0 : pBulletPara = aTextObj.GetParagraph(i);
1390 0 : nBulletFlags = 0;
1391 0 : sal_uInt16 nBulletId = pBulletPara->nBulletId;
1392 0 : if ( pBulletPara->bExtendedBulletsUsed )
1393 : {
1394 0 : nBulletFlags = 0x800000;
1395 0 : if ( pBulletPara->nNumberingType != SVX_NUM_BITMAP )
1396 0 : nBulletFlags = 0x3000000;
1397 : }
1398 0 : rExtBuStr << (sal_uInt32)nBulletFlags;
1399 :
1400 0 : if ( nBulletFlags & 0x800000 )
1401 0 : rExtBuStr << nBulletId;
1402 0 : if ( nBulletFlags & 0x1000000 )
1403 : {
1404 0 : switch( pBulletPara->nNumberingType )
1405 : {
1406 : case SVX_NUM_NUMBER_NONE :
1407 : case SVX_NUM_CHAR_SPECIAL :
1408 0 : nNumberingType = 0;
1409 0 : break;
1410 : case SVX_NUM_CHARS_UPPER_LETTER :
1411 : case SVX_NUM_CHARS_UPPER_LETTER_N :
1412 : case SVX_NUM_CHARS_LOWER_LETTER :
1413 : case SVX_NUM_CHARS_LOWER_LETTER_N :
1414 : case SVX_NUM_ROMAN_UPPER :
1415 : case SVX_NUM_ROMAN_LOWER :
1416 : case SVX_NUM_ARABIC :
1417 0 : nNumberingType = pBulletPara->nMappedNumType;
1418 0 : break;
1419 :
1420 : case SVX_NUM_BITMAP :
1421 0 : nNumberingType = 0;
1422 0 : break;
1423 :
1424 : }
1425 0 : rExtBuStr << (sal_uInt32)nNumberingType;
1426 : }
1427 0 : if ( nBulletFlags & 0x2000000 )
1428 0 : rExtBuStr << (sal_uInt16)pBulletPara->nStartWith;
1429 0 : rExtBuStr << (sal_uInt32)0 << (sal_uInt32)0;
1430 : }
1431 0 : sal_uInt32 nBulletSize = ( rExtBuStr.Tell() - nPos2 ) - 8;
1432 0 : rExtBuStr.SeekRel( - ( (sal_Int32)nBulletSize + 4 ) );
1433 0 : rExtBuStr << nBulletSize;
1434 0 : rExtBuStr.SeekRel( nBulletSize );
1435 : }
1436 0 : }
1437 : }
1438 0 : }
1439 :
1440 : // -----------------------------------------------------------------------
1441 :
1442 0 : void PPTWriter::ImplWriteObjectEffect( SvStream& rSt,
1443 : ::com::sun::star::presentation::AnimationEffect eAe,
1444 : ::com::sun::star::presentation::AnimationEffect eTe,
1445 : sal_uInt16 nOrder )
1446 : {
1447 0 : EscherExContainer aAnimationInfo( rSt, EPP_AnimationInfo );
1448 0 : EscherExAtom aAnimationInfoAtom( rSt, EPP_AnimationInfoAtom, 0, 1 );
1449 0 : sal_uInt32 nDimColor = 0x7000000; // color to use for dimming
1450 0 : sal_uInt32 nFlags = 0x4400; // set of flags that determine type of build
1451 0 : sal_uInt32 nSoundRef = 0; // 0 if storage is from clipboard. Otherwise index(ID) in SoundCollection list.
1452 0 : sal_uInt32 nDelayTime = 0; // delay before playing object
1453 0 : sal_uInt16 nSlideCount = 1; // number of slides to play object
1454 0 : sal_uInt8 nBuildType = 1; // type of build
1455 0 : sal_uInt8 nFlyMethod = 0; // animation effect( fly, zoom, appear, etc )
1456 0 : sal_uInt8 nFlyDirection = 0; // Animation direction( left, right, up, down, etc )
1457 0 : sal_uInt8 nAfterEffect = 0; // what to do after build
1458 0 : sal_uInt8 nSubEffect = 0; // build by word or letter
1459 0 : sal_uInt8 nOleVerb = 0; // Determines object's class (sound, video, other)
1460 :
1461 0 : if ( eAe == ::com::sun::star::presentation::AnimationEffect_NONE )
1462 : {
1463 0 : nBuildType = 0;
1464 0 : eAe = eTe;
1465 : }
1466 0 : switch ( eAe )
1467 : {
1468 : case ::com::sun::star::presentation::AnimationEffect_NONE :
1469 0 : break;
1470 : case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LEFT :
1471 : {
1472 0 : nFlyDirection = 2;
1473 0 : nFlyMethod = 10;
1474 : }
1475 0 : break;
1476 : case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_TOP :
1477 : {
1478 0 : nFlyDirection = 3;
1479 0 : nFlyMethod = 10;
1480 : }
1481 0 : break;
1482 : case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_RIGHT :
1483 : {
1484 0 : nFlyDirection = 0;
1485 0 : nFlyMethod = 10;
1486 : }
1487 0 : break;
1488 : case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_BOTTOM :
1489 : {
1490 0 : nFlyDirection = 1;
1491 0 : nFlyMethod = 10;
1492 : }
1493 0 : break;
1494 : case ::com::sun::star::presentation::AnimationEffect_FADE_TO_CENTER :
1495 : {
1496 0 : nFlyDirection = 1;
1497 0 : nFlyMethod = 11;
1498 : }
1499 0 : break;
1500 : case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_CENTER :
1501 : {
1502 0 : nFlyDirection = 0;
1503 0 : nFlyMethod = 11;
1504 : }
1505 0 : break;
1506 : case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LEFT :
1507 : {
1508 0 : nFlyDirection = 0;
1509 0 : nFlyMethod = 12;
1510 : }
1511 0 : break;
1512 : case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_TOP :
1513 : {
1514 0 : nFlyDirection = 1;
1515 0 : nFlyMethod = 12;
1516 : }
1517 0 : break;
1518 : case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_RIGHT :
1519 : {
1520 0 : nFlyDirection = 2;
1521 0 : nFlyMethod = 12;
1522 : }
1523 0 : break;
1524 : case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_BOTTOM :
1525 : {
1526 0 : nFlyDirection = 3;
1527 0 : nFlyMethod = 12;
1528 : }
1529 0 : break;
1530 : case ::com::sun::star::presentation::AnimationEffect_VERTICAL_STRIPES :
1531 : {
1532 0 : nFlyDirection = 0;
1533 0 : nFlyMethod = 2;
1534 : }
1535 0 : break;
1536 : case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_STRIPES :
1537 : {
1538 0 : nFlyDirection = 1;
1539 0 : nFlyMethod = 2;
1540 : }
1541 0 : break;
1542 : case ::com::sun::star::presentation::AnimationEffect_CLOCKWISE :
1543 : {
1544 0 : nFlyDirection = 1;
1545 0 : nFlyMethod = 3;
1546 : }
1547 0 : break;
1548 : case ::com::sun::star::presentation::AnimationEffect_COUNTERCLOCKWISE :
1549 : {
1550 0 : nFlyDirection = 0;
1551 0 : nFlyMethod = 3;
1552 : }
1553 0 : break;
1554 : case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_UPPERLEFT :
1555 : {
1556 0 : nFlyDirection = 7;
1557 0 : nFlyMethod = 9;
1558 : }
1559 0 : break;
1560 : case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_UPPERRIGHT :
1561 : {
1562 0 : nFlyDirection = 6;
1563 0 : nFlyMethod = 9;
1564 : }
1565 0 : break;
1566 : case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LOWERLEFT :
1567 : {
1568 0 : nFlyDirection = 5;
1569 0 : nFlyMethod = 9;
1570 : }
1571 0 : break;
1572 : case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LOWERRIGHT :
1573 : {
1574 0 : nFlyDirection = 4;
1575 0 : nFlyMethod = 9;
1576 : }
1577 0 : break;
1578 : case ::com::sun::star::presentation::AnimationEffect_CLOSE_VERTICAL :
1579 : {
1580 0 : nFlyDirection = 1;
1581 0 : nFlyMethod = 13;
1582 : }
1583 0 : break;
1584 : case ::com::sun::star::presentation::AnimationEffect_CLOSE_HORIZONTAL :
1585 : {
1586 0 : nFlyDirection = 3;
1587 0 : nFlyMethod = 13;
1588 : }
1589 0 : break;
1590 : case ::com::sun::star::presentation::AnimationEffect_OPEN_VERTICAL :
1591 : {
1592 0 : nFlyDirection = 0;
1593 0 : nFlyMethod = 13;
1594 : }
1595 0 : break;
1596 : case ::com::sun::star::presentation::AnimationEffect_OPEN_HORIZONTAL :
1597 : {
1598 0 : nFlyDirection = 2;
1599 0 : nFlyMethod = 13;
1600 : }
1601 0 : break;
1602 : case ::com::sun::star::presentation::AnimationEffect_PATH :
1603 : {
1604 0 : nFlyDirection = 28;
1605 0 : nFlyMethod = 12;
1606 : }
1607 0 : break;
1608 : case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_LEFT :
1609 : {
1610 0 : nFlyDirection = 0;
1611 0 : nFlyMethod = 1;
1612 : }
1613 0 : break;
1614 : case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_TOP :
1615 : {
1616 0 : nFlyDirection = 0;
1617 0 : nFlyMethod = 1;
1618 : }
1619 0 : break;
1620 : case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_RIGHT :
1621 : {
1622 0 : nFlyDirection = 0;
1623 0 : nFlyMethod = 1;
1624 : }
1625 0 : break;
1626 : case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_BOTTOM :
1627 : {
1628 0 : nFlyDirection = 0;
1629 0 : nFlyMethod = 1;
1630 : }
1631 0 : break;
1632 : case ::com::sun::star::presentation::AnimationEffect_SPIRALIN_LEFT :
1633 : case ::com::sun::star::presentation::AnimationEffect_SPIRALIN_RIGHT :
1634 : case ::com::sun::star::presentation::AnimationEffect_SPIRALOUT_LEFT :
1635 : case ::com::sun::star::presentation::AnimationEffect_SPIRALOUT_RIGHT :
1636 : {
1637 0 : nFlyDirection = 0x1c;
1638 0 : nFlyMethod = 0xc;
1639 : }
1640 0 : break;
1641 : case ::com::sun::star::presentation::AnimationEffect_DISSOLVE :
1642 : {
1643 0 : nFlyDirection = 0;
1644 0 : nFlyMethod = 5;
1645 : }
1646 0 : break;
1647 : case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_LEFT :
1648 : {
1649 0 : nFlyDirection = 2;
1650 0 : nFlyMethod = 10;
1651 : }
1652 0 : break;
1653 : case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_TOP :
1654 : {
1655 0 : nFlyDirection = 3;
1656 0 : nFlyMethod = 10;
1657 : }
1658 0 : break;
1659 : case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_RIGHT :
1660 : {
1661 0 : nFlyDirection = 0;
1662 0 : nFlyMethod = 10;
1663 : }
1664 0 : break;
1665 : case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_BOTTOM :
1666 : {
1667 0 : nFlyDirection = 1;
1668 0 : nFlyMethod = 10;
1669 : }
1670 0 : break;
1671 : case ::com::sun::star::presentation::AnimationEffect_RANDOM :
1672 : {
1673 0 : nFlyDirection = 0;
1674 0 : nFlyMethod = 1;
1675 : }
1676 0 : break;
1677 : case ::com::sun::star::presentation::AnimationEffect_VERTICAL_LINES :
1678 : {
1679 0 : nFlyDirection = 1;
1680 0 : nFlyMethod = 8;
1681 : }
1682 0 : break;
1683 : case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_LINES :
1684 : {
1685 0 : nFlyDirection = 0;
1686 0 : nFlyMethod = 8;
1687 : }
1688 0 : break;
1689 : case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_LEFT :
1690 : {
1691 0 : nFlyDirection = 2;
1692 0 : nFlyMethod = 10;
1693 : }
1694 0 : break;
1695 : case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_TOP :
1696 : {
1697 0 : nFlyDirection = 3;
1698 0 : nFlyMethod = 10;
1699 : }
1700 0 : break;
1701 : case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_RIGHT :
1702 : {
1703 0 : nFlyDirection = 0;
1704 0 : nFlyMethod = 10;
1705 : }
1706 0 : break;
1707 : case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_BOTTOM :
1708 : {
1709 0 : nFlyDirection = 1;
1710 0 : nFlyMethod = 10;
1711 : }
1712 0 : break;
1713 : case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_UPPERLEFT :
1714 : {
1715 0 : nFlyDirection = 7;
1716 0 : nFlyMethod = 9;
1717 : }
1718 0 : break;
1719 : case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_UPPERRIGHT :
1720 : {
1721 0 : nFlyDirection = 6;
1722 0 : nFlyMethod = 9;
1723 : }
1724 0 : break;
1725 : case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_LOWERLEFT :
1726 : {
1727 0 : nFlyDirection = 5;
1728 0 : nFlyMethod = 9;
1729 : }
1730 0 : break;
1731 : case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_LOWERRIGHT :
1732 : {
1733 0 : nFlyDirection = 4;
1734 0 : nFlyMethod = 9;
1735 : }
1736 0 : break;
1737 : case ::com::sun::star::presentation::AnimationEffect_APPEAR :
1738 0 : break;
1739 : case ::com::sun::star::presentation::AnimationEffect_HIDE :
1740 : {
1741 0 : nFlyDirection = 0;
1742 0 : nFlyMethod = 1;
1743 : }
1744 0 : break;
1745 : case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_UPPERLEFT :
1746 : {
1747 0 : nFlyDirection = 4;
1748 0 : nFlyMethod = 12;
1749 : }
1750 0 : break;
1751 : case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_UPPERRIGHT :
1752 : {
1753 0 : nFlyDirection = 5;
1754 0 : nFlyMethod = 12;
1755 : }
1756 0 : break;
1757 : case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LOWERRIGHT :
1758 : {
1759 0 : nFlyDirection = 7;
1760 0 : nFlyMethod = 12;
1761 : }
1762 0 : break;
1763 : case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LOWERLEFT :
1764 : {
1765 0 : nFlyDirection = 6;
1766 0 : nFlyMethod = 12;
1767 : }
1768 0 : break;
1769 : case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_UPPERLEFT :
1770 : case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_UPPERRIGHT :
1771 : case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_LOWERRIGHT :
1772 : case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_LOWERLEFT :
1773 0 : nAfterEffect |= 2;
1774 0 : break;
1775 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LEFT :
1776 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT :
1777 : {
1778 0 : nFlyDirection = 8;
1779 0 : nFlyMethod = 12;
1780 : }
1781 0 : break;
1782 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_TOP :
1783 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT :
1784 : {
1785 0 : nFlyDirection = 11;
1786 0 : nFlyMethod = 12;
1787 : }
1788 0 : break;
1789 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_RIGHT :
1790 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT :
1791 : {
1792 0 : nFlyDirection = 10;
1793 0 : nFlyMethod = 12;
1794 : }
1795 0 : break;
1796 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_BOTTOM :
1797 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT :
1798 : {
1799 0 : nFlyDirection = 9;
1800 0 : nFlyMethod = 12;
1801 : }
1802 0 : break;
1803 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_LEFT :
1804 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_UPPERLEFT :
1805 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_TOP :
1806 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT :
1807 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_RIGHT :
1808 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT :
1809 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_BOTTOM :
1810 : case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_LOWERLEFT :
1811 0 : nAfterEffect |= 2;
1812 0 : break;
1813 : case ::com::sun::star::presentation::AnimationEffect_VERTICAL_CHECKERBOARD :
1814 : {
1815 0 : nFlyDirection = 1;
1816 0 : nFlyMethod = 3;
1817 : }
1818 0 : break;
1819 : case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_CHECKERBOARD :
1820 : {
1821 0 : nFlyDirection = 0;
1822 0 : nFlyMethod = 3;
1823 : }
1824 0 : break;
1825 : case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_ROTATE :
1826 : case ::com::sun::star::presentation::AnimationEffect_VERTICAL_ROTATE :
1827 : {
1828 0 : nFlyDirection = 27;
1829 0 : nFlyMethod = 12;
1830 : }
1831 0 : break;
1832 : case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_STRETCH :
1833 : case ::com::sun::star::presentation::AnimationEffect_VERTICAL_STRETCH :
1834 : {
1835 0 : nFlyDirection = 22;
1836 0 : nFlyMethod = 12;
1837 : }
1838 0 : break;
1839 : case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LEFT :
1840 : case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_UPPERLEFT :
1841 : {
1842 0 : nFlyDirection = 23;
1843 0 : nFlyMethod = 12;
1844 : }
1845 0 : break;
1846 : case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_TOP :
1847 : case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_UPPERRIGHT :
1848 : {
1849 0 : nFlyDirection = 24;
1850 0 : nFlyMethod = 12;
1851 : }
1852 0 : break;
1853 : case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_RIGHT :
1854 : case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LOWERRIGHT :
1855 : {
1856 0 : nFlyDirection = 25;
1857 0 : nFlyMethod = 12;
1858 : }
1859 0 : break;
1860 : case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_BOTTOM :
1861 : case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LOWERLEFT :
1862 : {
1863 0 : nFlyDirection = 26;
1864 0 : nFlyMethod = 12;
1865 : }
1866 0 : break;
1867 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN :
1868 : {
1869 0 : nFlyDirection = 16;
1870 0 : nFlyMethod = 12;
1871 : }
1872 0 : break;
1873 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_SMALL :
1874 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_SPIRAL :
1875 : {
1876 0 : nFlyDirection = 17;
1877 0 : nFlyMethod = 12;
1878 : }
1879 0 : break;
1880 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT :
1881 : {
1882 0 : nFlyDirection = 18;
1883 0 : nFlyMethod = 12;
1884 : }
1885 0 : break;
1886 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_SMALL :
1887 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_SPIRAL :
1888 : {
1889 0 : nFlyDirection = 19;
1890 0 : nFlyMethod = 12;
1891 : }
1892 0 : break;
1893 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_LEFT :
1894 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_UPPERLEFT :
1895 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_TOP :
1896 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT :
1897 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_RIGHT :
1898 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT :
1899 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_BOTTOM :
1900 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_LOWERLEFT :
1901 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_CENTER :
1902 : {
1903 0 : nFlyDirection = 16;
1904 0 : nFlyMethod = 12;
1905 : }
1906 0 : break;
1907 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_LEFT :
1908 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT :
1909 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_TOP :
1910 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT :
1911 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_RIGHT :
1912 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT :
1913 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_BOTTOM :
1914 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT :
1915 : case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_CENTER :
1916 0 : nAfterEffect |= 2;
1917 0 : break;
1918 : default:
1919 0 : break;
1920 : }
1921 0 : if ( mnDiaMode >= 1 )
1922 0 : nFlags |= 4;
1923 0 : if ( eTe != ::com::sun::star::presentation::AnimationEffect_NONE )
1924 0 : nBuildType = 2;
1925 0 : if ( ImplGetPropertyValue( rtl::OUString( "SoundOn" ) ) )
1926 : {
1927 0 : sal_Bool bBool(sal_False);
1928 0 : mAny >>= bBool;
1929 0 : if ( bBool )
1930 : {
1931 0 : if ( ImplGetPropertyValue( rtl::OUString( "Sound" ) ) )
1932 : {
1933 0 : nSoundRef = maSoundCollection.GetId( *(::rtl::OUString*)mAny.getValue() );
1934 0 : if ( nSoundRef )
1935 0 : nFlags |= 0x10;
1936 : }
1937 : }
1938 : }
1939 0 : sal_Bool bDimHide = sal_False;
1940 0 : sal_Bool bDimPrevious = sal_False;
1941 0 : if ( ImplGetPropertyValue( rtl::OUString( "DimHide" ) ) )
1942 0 : mAny >>= bDimHide;
1943 0 : if ( ImplGetPropertyValue( rtl::OUString( "DimPrevious" ) ) )
1944 0 : mAny >>= bDimPrevious;
1945 0 : if ( bDimPrevious )
1946 0 : nAfterEffect |= 1;
1947 0 : if ( bDimHide )
1948 0 : nAfterEffect |= 2;
1949 0 : if ( ImplGetPropertyValue( rtl::OUString( "DimColor" ) ) )
1950 0 : nDimColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) ) | 0xfe000000;
1951 :
1952 0 : rSt << nDimColor << nFlags << nSoundRef << nDelayTime
1953 0 : << nOrder // order of build ( 1.. )
1954 0 : << nSlideCount << nBuildType << nFlyMethod << nFlyDirection
1955 0 : << nAfterEffect << nSubEffect << nOleVerb
1956 0 : << (sal_uInt16)0; // PadWord
1957 0 : }
1958 :
1959 : // -----------------------------------------------------------------------
1960 :
1961 0 : void PPTWriter::ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentation::ClickAction eCa, sal_Bool bMediaClickAction )
1962 : {
1963 0 : sal_uInt32 nSoundRef = 0; // a reference to a sound in the sound collection, or NULL.
1964 0 : sal_uInt32 nHyperLinkID = 0;// a persistent unique identifier to an external hyperlink object (only valid when action == HyperlinkAction).
1965 0 : sal_uInt8 nAction = 0; // Action See Action Table
1966 0 : sal_uInt8 nOleVerb = 0; // OleVerb Only valid when action == OLEAction. OLE verb to use, 0 = first verb, 1 = second verb, etc.
1967 0 : sal_uInt8 nJump = 0; // Jump See Jump Table
1968 0 : sal_uInt8 nFlags = 0; // Bit 1: Animated. If 1, then button is animated
1969 : // Bit 2: Stop sound. If 1, then stop current sound when button is pressed.
1970 : // Bit 3: CustomShowReturn. If 1, and this is a jump to custom show, then return to this slide after custom show.
1971 0 : sal_uInt8 nHyperLinkType = 0;// HyperlinkType a value from the LinkTo enum, such as LT_URL (only valid when action == HyperlinkAction).
1972 :
1973 0 : String aFile;
1974 :
1975 : /*
1976 : Action Table: Action Value
1977 : NoAction 0
1978 : MacroAction 1
1979 : RunProgramAction 2
1980 : JumpAction 3
1981 : HyperlinkAction 4
1982 : OLEAction 5
1983 : MediaAction 6
1984 : CustomShowAction 7
1985 :
1986 : Jump Table: Jump Value
1987 : NoJump 0
1988 : NextSlide, 1
1989 : PreviousSlide, 2
1990 : FirstSlide, 3
1991 : LastSlide, 4
1992 : LastSlideViewed 5
1993 : EndShow 6
1994 : */
1995 :
1996 0 : if ( bMediaClickAction )
1997 0 : nAction = 6;
1998 0 : else switch( eCa )
1999 : {
2000 : case ::com::sun::star::presentation::ClickAction_STOPPRESENTATION :
2001 0 : nJump += 2;
2002 : case ::com::sun::star::presentation::ClickAction_LASTPAGE :
2003 0 : nJump++;
2004 : case ::com::sun::star::presentation::ClickAction_FIRSTPAGE :
2005 0 : nJump++;
2006 : case ::com::sun::star::presentation::ClickAction_PREVPAGE :
2007 0 : nJump++;
2008 : case ::com::sun::star::presentation::ClickAction_NEXTPAGE :
2009 : {
2010 0 : nJump++;
2011 0 : nAction = 3;
2012 : }
2013 0 : break;
2014 : case ::com::sun::star::presentation::ClickAction_SOUND :
2015 : {
2016 0 : if ( ImplGetPropertyValue( rtl::OUString( "Bookmark" ) ) )
2017 0 : nSoundRef = maSoundCollection.GetId( *(::rtl::OUString*)mAny.getValue() );
2018 : }
2019 0 : break;
2020 : case ::com::sun::star::presentation::ClickAction_PROGRAM :
2021 : {
2022 0 : if ( ImplGetPropertyValue( rtl::OUString( "Bookmark" ) ) )
2023 : {
2024 0 : INetURLObject aUrl( *(::rtl::OUString*)mAny.getValue() );
2025 0 : if ( INET_PROT_FILE == aUrl.GetProtocol() )
2026 : {
2027 0 : aFile = aUrl.PathToFileName();
2028 0 : nAction = 2;
2029 0 : }
2030 : }
2031 : }
2032 0 : break;
2033 :
2034 : case ::com::sun::star::presentation::ClickAction_BOOKMARK :
2035 : {
2036 0 : if ( ImplGetPropertyValue( rtl::OUString( "Bookmark" ) ) )
2037 : {
2038 0 : rtl::OUString aBookmark( *(::rtl::OUString*)mAny.getValue() );
2039 0 : sal_uInt32 nIndex = 0;
2040 0 : std::vector<rtl::OUString>::const_iterator pIter;
2041 0 : for ( pIter = maSlideNameList.begin(); pIter != maSlideNameList.end(); ++pIter, nIndex++ )
2042 : {
2043 0 : if ( *pIter == aBookmark )
2044 : {
2045 : // Bookmark ist ein link zu einer Dokumentseite
2046 0 : nAction = 4;
2047 0 : nHyperLinkType = 7;
2048 :
2049 0 : String aEmpty;
2050 0 : String aHyperString = rtl::OUString::valueOf(static_cast<sal_Int32>(256 + nIndex));
2051 0 : aHyperString.Append( rtl::OUString( "," ) );
2052 0 : aHyperString.Append( String::CreateFromInt32( nIndex + 1 ) );
2053 0 : aHyperString.Append( rtl::OUString( ",Slide " ) );
2054 0 : aHyperString.Append( String::CreateFromInt32( nIndex + 1 ) );
2055 0 : nHyperLinkID = ImplInsertBookmarkURL( aHyperString, 1 | ( nIndex << 8 ) | ( 1 << 31 ), aBookmark, aEmpty, aEmpty, aHyperString );
2056 : }
2057 0 : }
2058 : }
2059 : }
2060 0 : break;
2061 :
2062 : case ::com::sun::star::presentation::ClickAction_DOCUMENT :
2063 : {
2064 0 : if ( ImplGetPropertyValue( rtl::OUString( "Bookmark" ) ) )
2065 : {
2066 0 : String aBookmark( *(::rtl::OUString*)mAny.getValue() );
2067 0 : if ( aBookmark.Len() )
2068 : {
2069 0 : nAction = 4;
2070 0 : nHyperLinkType = 8;
2071 :
2072 0 : String aEmpty;
2073 0 : String aBookmarkFile( aBookmark );
2074 0 : INetURLObject aUrl( aBookmark );
2075 0 : if ( INET_PROT_FILE == aUrl.GetProtocol() )
2076 0 : aBookmarkFile = aUrl.PathToFileName();
2077 0 : nHyperLinkID = ImplInsertBookmarkURL( aBookmark, (sal_uInt32)(2 | ( 1 << 31 )), aBookmarkFile, aBookmark, aEmpty, aEmpty );
2078 0 : }
2079 : }
2080 : }
2081 0 : break;
2082 :
2083 : case ::com::sun::star::presentation::ClickAction_INVISIBLE :
2084 : case ::com::sun::star::presentation::ClickAction_VERB :
2085 : case ::com::sun::star::presentation::ClickAction_VANISH :
2086 : case ::com::sun::star::presentation::ClickAction_MACRO :
2087 : default :
2088 0 : break;
2089 : }
2090 :
2091 0 : sal_uInt32 nContainerSize = 24;
2092 0 : if ( nAction == 2 )
2093 0 : nContainerSize += ( aFile.Len() * 2 ) + 8;
2094 0 : rSt << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0xf ) << (sal_uInt32)nContainerSize
2095 0 : << (sal_uInt32)( EPP_InteractiveInfoAtom << 16 ) << (sal_uInt32)16
2096 0 : << nSoundRef
2097 0 : << nHyperLinkID
2098 0 : << nAction
2099 0 : << nOleVerb
2100 0 : << nJump
2101 0 : << nFlags
2102 0 : << (sal_uInt32)nHyperLinkType;
2103 :
2104 0 : if ( nAction == 2 ) // run program Action
2105 : {
2106 0 : sal_uInt16 i, nLen = aFile.Len();
2107 0 : rSt << (sal_uInt32)( ( EPP_CString << 16 ) | 0x20 ) << (sal_uInt32)( nLen * 2 );
2108 0 : for ( i = 0; i < nLen; i++ )
2109 0 : rSt << aFile.GetChar( i );
2110 : }
2111 :
2112 0 : rSt << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0x1f ) << (sal_uInt32)24 // Mouse Over Action
2113 0 : << (sal_uInt32)( EPP_InteractiveInfo << 16 ) << (sal_uInt32)16;
2114 0 : for ( int i = 0; i < 4; i++, rSt << (sal_uInt32)0 ) ;
2115 0 : }
2116 :
2117 : // -----------------------------------------------------------------------
2118 :
2119 0 : sal_Bool PPTWriter::ImplGetEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPropSet,
2120 : ::com::sun::star::presentation::AnimationEffect& eEffect,
2121 : ::com::sun::star::presentation::AnimationEffect& eTextEffect,
2122 : sal_Bool& bIsSound )
2123 : {
2124 0 : ::com::sun::star::uno::Any aAny;
2125 0 : if ( GetPropertyValue( aAny, rPropSet, rtl::OUString( "Effect" ) ) )
2126 0 : aAny >>= eEffect;
2127 : else
2128 0 : eEffect = ::com::sun::star::presentation::AnimationEffect_NONE;
2129 :
2130 0 : if ( GetPropertyValue( aAny, rPropSet, rtl::OUString( "TextEffect" ) ) )
2131 0 : aAny >>= eTextEffect;
2132 : else
2133 0 : eTextEffect = ::com::sun::star::presentation::AnimationEffect_NONE;
2134 0 : if ( GetPropertyValue( aAny, rPropSet, rtl::OUString( "SoundOn" ) ) )
2135 0 : aAny >>= bIsSound;
2136 : else
2137 0 : bIsSound = sal_False;
2138 :
2139 : sal_Bool bHasEffect = ( ( eEffect != ::com::sun::star::presentation::AnimationEffect_NONE )
2140 : || ( eTextEffect != ::com::sun::star::presentation::AnimationEffect_NONE )
2141 0 : || bIsSound );
2142 0 : return bHasEffect;
2143 : };
2144 :
2145 : // -----------------------------------------------------------------------
2146 :
2147 0 : sal_Bool PPTWriter::ImplCreatePresentationPlaceholder( const sal_Bool bMasterPage, const PageType /* ePageType */,
2148 : const sal_uInt32 nStyleInstance, const sal_uInt8 nPlaceHolderId )
2149 : {
2150 0 : sal_Bool bRet = ImplGetText();
2151 0 : if ( bRet && bMasterPage )
2152 : {
2153 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2154 0 : sal_uInt32 nPresShapeID = mpPptEscherEx->GenerateShapeId();
2155 0 : mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, nPresShapeID );// Flags: HaveAnchor | HasSpt
2156 0 : EscherPropertyContainer aPropOpt;
2157 0 : aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
2158 0 : aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
2159 0 : aPropOpt.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
2160 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
2161 0 : aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
2162 0 : aPropOpt.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
2163 0 : aPropOpt.CreateFillProperties( mXPropSet, sal_True );
2164 0 : sal_uInt32 nLineFlags = 0x90001;
2165 0 : if ( aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
2166 0 : nLineFlags |= 0x10001; // draw dashed line if no line
2167 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
2168 :
2169 0 : SvMemoryStream aExtBu( 0x200, 0x200 );
2170 0 : SvMemoryStream aClientTextBox( 0x200, 0x200 );
2171 0 : ImplWriteTextStyleAtom( aClientTextBox, nStyleInstance, 0, NULL, aExtBu, &aPropOpt );
2172 :
2173 0 : aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
2174 0 : aPropOpt.CreateShapeProperties( mXShape );
2175 0 : aPropOpt.Commit( *mpStrm );
2176 0 : mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
2177 0 : *mpStrm << (sal_Int16)maRect.Top() << (sal_Int16)maRect.Left() << (sal_Int16)maRect.Right() << (sal_Int16)maRect.Bottom(); // oben, links, rechts, unten ????
2178 0 : mpPptEscherEx->OpenContainer( ESCHER_ClientData );
2179 0 : mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
2180 0 : *mpStrm << (sal_uInt32)0 // PlacementID
2181 0 : << (sal_uInt8)nPlaceHolderId // PlaceHolderID
2182 0 : << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
2183 0 : << (sal_uInt16)0; // padword
2184 0 : mpPptEscherEx->CloseContainer(); // ESCHER_ClientData
2185 :
2186 0 : if ( aClientTextBox.Tell() )
2187 : {
2188 0 : *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
2189 0 : << (sal_uInt32)aClientTextBox.Tell();
2190 :
2191 0 : mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() );
2192 : }
2193 0 : mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
2194 : }
2195 : else
2196 0 : bRet = sal_False;
2197 0 : return bRet;
2198 : }
2199 :
2200 : // -----------------------------------------------------------------------
2201 :
2202 0 : void PPTWriter::ImplCreateShape( sal_uInt32 nType, sal_uInt32 nFlags, EscherSolverContainer& rSolver )
2203 : {
2204 0 : sal_uInt32 nId = mpPptEscherEx->GenerateShapeId();
2205 0 : mpPptEscherEx->AddShape( nType, nFlags, nId );
2206 0 : rSolver.AddShape( mXShape, nId );
2207 0 : }
2208 :
2209 0 : void PPTWriter::ImplCreateTextShape( EscherPropertyContainer& rPropOpt, EscherSolverContainer& rSolver, sal_Bool bFill )
2210 : {
2211 0 : mnTextStyle = EPP_TEXTSTYLE_TEXT;
2212 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2213 0 : ImplCreateShape( ESCHER_ShpInst_TextBox, 0xa00, rSolver );
2214 0 : if ( bFill )
2215 0 : rPropOpt.CreateFillProperties( mXPropSet, sal_True );
2216 0 : if ( ImplGetText() )
2217 0 : rPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
2218 0 : }
2219 :
2220 0 : void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& aSolverContainer, PageType ePageType, sal_Bool bMasterPage, int nPageNumber )
2221 : {
2222 0 : sal_uInt32 nInstance, nGroups, nShapes, nShapeCount, nPer, nLastPer, nIndices, nGroupLevel = 0, nOlePictureId;
2223 : sal_uInt16 nEffectCount;
2224 0 : ::com::sun::star::awt::Point aTextRefPoint;
2225 :
2226 0 : ResetGroupTable( nShapes = mXShapes->getCount() );
2227 :
2228 0 : nIndices = nInstance = nLastPer = nShapeCount = nEffectCount = 0;
2229 :
2230 0 : sal_Bool bIsTitlePossible = sal_True; // bei mehr als einem title geht powerpoint in die knie
2231 :
2232 0 : sal_uInt32 nOutlinerCount = 0; // die gliederungsobjekte muessen dem layout entsprechen,
2233 0 : sal_uInt32 nPrevTextStyle = 0; // es darf nicht mehr als zwei geben
2234 :
2235 0 : nOlePictureId = 0;
2236 :
2237 0 : sal_Bool bAdditionalText = sal_False;
2238 :
2239 0 : sal_Bool bSecOutl = sal_False;
2240 0 : sal_uInt32 nPObjects = 0;
2241 :
2242 0 : SvMemoryStream* pClientTextBox = NULL;
2243 0 : SvMemoryStream* pClientData = NULL;
2244 :
2245 0 : while( GetNextGroupEntry() )
2246 : {
2247 0 : nShapeCount++;
2248 :
2249 0 : nPer = ( 5 * nShapeCount ) / nShapes;
2250 0 : if ( nPer != nLastPer )
2251 : {
2252 0 : nLastPer = nPer;
2253 0 : sal_uInt32 nValue = mnPagesWritten * 5 + nPer;
2254 0 : if ( nValue > mnStatMaxValue )
2255 0 : nValue = mnStatMaxValue;
2256 0 : if ( mbStatusIndicator && ( nValue > mnLatestStatValue ) )
2257 : {
2258 0 : mXStatusIndicator->setValue( nValue );
2259 0 : mnLatestStatValue = nValue;
2260 : }
2261 : }
2262 0 : nGroups = GetGroupsClosed();
2263 0 : for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ;
2264 :
2265 0 : if ( GetShapeByIndex( GetCurrentGroupIndex(), sal_True ) )
2266 : {
2267 : sal_Bool bIsSound;
2268 0 : sal_Bool bMediaClickAction = sal_False;
2269 : ::com::sun::star::presentation::AnimationEffect eAe;
2270 : ::com::sun::star::presentation::AnimationEffect eTe;
2271 :
2272 0 : if ( ImplGetPropertyValue( rtl::OUString( "PresentationOrder" ) ) )
2273 0 : nEffectCount = *(sal_uInt16*)mAny.getValue();
2274 :
2275 0 : sal_Bool bEffect = ImplGetEffect( mXPropSet, eAe, eTe, bIsSound );
2276 0 : ::com::sun::star::presentation::ClickAction eCa = ::com::sun::star::presentation::ClickAction_NONE;
2277 0 : if ( ImplGetPropertyValue( rtl::OUString( "OnClick" ) ) )
2278 0 : mAny >>= eCa;
2279 :
2280 0 : sal_Bool bGroup = mType == "drawing.Group";
2281 0 : sal_Bool bOpenBezier = mType == "drawing.OpenBezier";
2282 0 : sal_Bool bClosedBezier = mType == "drawing.ClosedBezier";
2283 0 : sal_Bool bPolyPolygon = mType == "drawing.PolyPolygon";
2284 0 : sal_Bool bPolyLine = mType == "drawing.PolyLine";
2285 :
2286 0 : Rectangle aPolyBoundRect;
2287 :
2288 0 : const ::com::sun::star::awt::Size aSize100thmm( mXShape->getSize() );
2289 0 : const ::com::sun::star::awt::Point aPoint100thmm( mXShape->getPosition() );
2290 0 : Rectangle aRect100thmm( Point( aPoint100thmm.X, aPoint100thmm.Y ), Size( aSize100thmm.Width, aSize100thmm.Height ) );
2291 0 : EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect100thmm );
2292 :
2293 0 : if ( bGroup )
2294 : {
2295 0 : SvMemoryStream* pTmp = NULL;
2296 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >
2297 0 : aXIndexAccess( mXShape, ::com::sun::star::uno::UNO_QUERY );
2298 0 : if ( EnterGroup( aXIndexAccess ) )
2299 : {
2300 0 : if ( bEffect && !mbUseNewAnimations )
2301 : {
2302 0 : pTmp = new SvMemoryStream( 0x200, 0x200 );
2303 0 : ImplWriteObjectEffect( *pTmp, eAe, eTe, ++nEffectCount );
2304 : }
2305 0 : if ( eCa != ::com::sun::star::presentation::ClickAction_NONE )
2306 : {
2307 0 : if ( !pTmp )
2308 0 : pTmp = new SvMemoryStream( 0x200, 0x200 );
2309 0 : ImplWriteClickAction( *pTmp, eCa, bMediaClickAction );
2310 : }
2311 0 : sal_uInt32 nShapeId = mpPptEscherEx->EnterGroup( &maRect, pTmp );
2312 0 : aSolverContainer.AddShape( mXShape, nShapeId );
2313 0 : delete pTmp;
2314 0 : }
2315 : }
2316 : else
2317 : {
2318 0 : sal_Bool bIsFontwork = sal_False;
2319 0 : sal_Bool bIsHatching = sal_False;
2320 0 : ::com::sun::star::uno::Any aAny;
2321 : ::com::sun::star::drawing::FillStyle eFS;
2322 0 : if ( GetPropertyValue( aAny, mXPropSet, rtl::OUString( "IsFontwork" ), sal_True ) )
2323 0 : aAny >>= bIsFontwork;
2324 0 : if ( GetPropertyValue( aAny, mXPropSet, rtl::OUString( "FillStyle" ), sal_True ) )
2325 : {
2326 0 : aAny >>= eFS;
2327 0 : bIsHatching = eFS == ::com::sun::star::drawing::FillStyle_HATCH;
2328 : }
2329 0 : if ( bIsHatching || bIsFontwork || ( mType == "drawing.Measure" ) || ( mType == "drawing.Caption" ) )
2330 : {
2331 0 : if ( ImplGetPropertyValue( rtl::OUString( "BoundRect" ) ) )
2332 : {
2333 0 : ::com::sun::star::awt::Rectangle aRect( *(::com::sun::star::awt::Rectangle*)mAny.getValue() );
2334 0 : maPosition = MapPoint( ::com::sun::star::awt::Point( aRect.X, aRect.Y ) );
2335 0 : maSize = MapSize( ::com::sun::star::awt::Size( aRect.Width, aRect.Height ) );
2336 0 : maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
2337 : }
2338 0 : mType = "drawing.dontknow";
2339 0 : }
2340 : }
2341 0 : sal_uInt8 nPlaceHolderAtom = EPP_PLACEHOLDER_NONE;
2342 :
2343 0 : mnTextSize = 0;
2344 0 : mnTextStyle = EPP_TEXTSTYLE_NORMAL;
2345 :
2346 0 : if ( mType == "drawing.Custom" )
2347 : {
2348 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2349 : sal_uInt32 nMirrorFlags;
2350 0 : rtl::OUString sCustomShapeType;
2351 0 : MSO_SPT eShapeType = aPropOpt.GetCustomShapeType( mXShape, nMirrorFlags, sCustomShapeType );
2352 0 : if ( sCustomShapeType == "col-502ad400" || sCustomShapeType == "col-60da8460" )
2353 : { // sj: creating metafile for customshapes that can't be saved to ms format properly
2354 0 : ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
2355 0 : if ( aPropOpt.CreateGraphicProperties( mXPropSet, rtl::OUString( "MetaFile" ), sal_False ) )
2356 : {
2357 0 : aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
2358 0 : SdrObject* pObj = GetSdrObjectFromXShape( mXShape );
2359 0 : if ( pObj )
2360 : {
2361 0 : Rectangle aBound = pObj->GetCurrentBoundRect();
2362 0 : maPosition = MapPoint( ::com::sun::star::awt::Point( aBound.Left(), aBound.Top() ) );
2363 0 : maSize = MapSize( ::com::sun::star::awt::Size ( aBound.GetWidth(), aBound.GetHeight() ) );
2364 0 : maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
2365 0 : mnAngle = 0;
2366 : }
2367 : }
2368 : }
2369 : else
2370 : {
2371 0 : ImplCreateShape( eShapeType, nMirrorFlags | 0xa00, aSolverContainer );
2372 0 : aPropOpt.CreateCustomShapeProperties( eShapeType, mXShape );
2373 0 : aPropOpt.CreateFillProperties( mXPropSet, sal_True );
2374 0 : if ( ImplGetText() )
2375 : {
2376 0 : if ( !aPropOpt.IsFontWork() )
2377 0 : aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_True, sal_True );
2378 : }
2379 0 : }
2380 : }
2381 0 : else if ( mType == "drawing.Rectangle" )
2382 : {
2383 0 : sal_Int32 nRadius = 0;
2384 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2385 0 : if ( ImplGetPropertyValue( rtl::OUString( "CornerRadius" ) ) )
2386 : {
2387 0 : mAny >>= nRadius;
2388 0 : nRadius = MapSize( ::com::sun::star::awt::Size( nRadius, 0 ) ).Width;
2389 : }
2390 0 : if ( nRadius )
2391 : {
2392 0 : ImplCreateShape( ESCHER_ShpInst_RoundRectangle, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
2393 0 : sal_Int32 nLenght = maRect.GetWidth();
2394 0 : if ( nLenght > maRect.GetHeight() )
2395 0 : nLenght = maRect.GetHeight();
2396 0 : nLenght >>= 1;
2397 0 : if ( nRadius >= nLenght )
2398 0 : nRadius = 0x2a30; // 0x2a30 ist PPTs maximum radius
2399 : else
2400 0 : nRadius = ( 0x2a30 * nRadius ) / nLenght;
2401 0 : aPropOpt.AddOpt( ESCHER_Prop_adjustValue, nRadius );
2402 : }
2403 : else
2404 : {
2405 0 : ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
2406 : }
2407 0 : aPropOpt.CreateFillProperties( mXPropSet, sal_True );
2408 0 : if ( ImplGetText() )
2409 0 : aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
2410 : }
2411 0 : else if ( mType == "drawing.Ellipse" )
2412 : {
2413 0 : ::com::sun::star::drawing::CircleKind eCircleKind( ::com::sun::star::drawing::CircleKind_FULL );
2414 0 : PolyStyle ePolyKind = POLY_CHORD;
2415 0 : if ( ImplGetPropertyValue( rtl::OUString( "CircleKind" ) ) )
2416 : {
2417 0 : mAny >>= eCircleKind;
2418 0 : switch ( eCircleKind )
2419 : {
2420 : case ::com::sun::star::drawing::CircleKind_SECTION :
2421 : {
2422 0 : ePolyKind = POLY_PIE;
2423 : }
2424 0 : break;
2425 : case ::com::sun::star::drawing::CircleKind_ARC :
2426 : {
2427 0 : ePolyKind = POLY_ARC;
2428 : }
2429 0 : break;
2430 :
2431 : case ::com::sun::star::drawing::CircleKind_CUT :
2432 : {
2433 0 : ePolyKind = POLY_CHORD;
2434 : }
2435 0 : break;
2436 :
2437 : default:
2438 0 : eCircleKind = ::com::sun::star::drawing::CircleKind_FULL;
2439 : }
2440 : }
2441 0 : if ( eCircleKind == ::com::sun::star::drawing::CircleKind_FULL )
2442 : {
2443 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2444 0 : ImplCreateShape( ESCHER_ShpInst_Ellipse, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
2445 0 : aPropOpt.CreateFillProperties( mXPropSet, sal_True );
2446 0 : if ( ImplGetText() )
2447 0 : aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
2448 : }
2449 : else
2450 : {
2451 : sal_Int32 nStartAngle, nEndAngle;
2452 0 : if ( !ImplGetPropertyValue( rtl::OUString( "CircleStartAngle" ) ) )
2453 0 : continue;
2454 0 : nStartAngle = *( (sal_Int32*)mAny.getValue() );
2455 0 : if( !ImplGetPropertyValue( rtl::OUString( "CircleEndAngle" ) ) )
2456 0 : continue;
2457 0 : nEndAngle = *( (sal_Int32*)mAny.getValue() );
2458 0 : ::com::sun::star::awt::Point aPoint( mXShape->getPosition() );
2459 0 : ::com::sun::star::awt::Size aSize( mXShape->getSize() );
2460 0 : ::com::sun::star::awt::Point aStart, aEnd, aCenter;
2461 0 : Rectangle aRect( Point( aPoint.X, aPoint.Y ), Size( aSize.Width, aSize.Height ) );
2462 0 : aStart.X = (sal_Int32)( ( cos( (double)( nStartAngle * F_PI18000 ) ) * 100.0 ) );
2463 0 : aStart.Y = - (sal_Int32)( ( sin( (double)( nStartAngle * F_PI18000 ) ) * 100.0 ) );
2464 0 : aEnd.X = (sal_Int32)( ( cos( (double)( nEndAngle * F_PI18000 ) ) * 100.0 ) );
2465 0 : aEnd.Y = - (sal_Int32)( ( sin( (double)( nEndAngle * F_PI18000 ) ) * 100.0 ) );
2466 0 : aCenter.X = aPoint.X + ( aSize.Width / 2 );
2467 0 : aCenter.Y = aPoint.Y + ( aSize.Height / 2 );
2468 0 : aStart.X += aCenter.X;
2469 0 : aStart.Y += aCenter.Y;
2470 0 : aEnd.X += aCenter.X;
2471 0 : aEnd.Y += aCenter.Y;
2472 0 : Polygon aPolygon( aRect, Point( aStart.X, aStart.Y ), Point( aEnd.X, aEnd.Y ), ePolyKind );
2473 0 : sal_Bool bNeedText = sal_True;
2474 0 : if ( mnAngle )
2475 : {
2476 0 : aPolygon.Rotate( aRect.TopLeft(), (sal_uInt16)( mnAngle / 10 ) );
2477 0 : if ( ImplGetText() )
2478 : {
2479 0 : mpPptEscherEx->EnterGroup( 0,0 );
2480 0 : nGroupLevel = mpPptEscherEx->GetGroupLevel();
2481 0 : bNeedText = sal_False;
2482 0 : bAdditionalText = sal_True;
2483 0 : mnTextSize = 0;
2484 : }
2485 0 : mnAngle = 0;
2486 : }
2487 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2488 0 : ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
2489 0 : ::com::sun::star::awt::Rectangle aNewRect;
2490 0 : switch ( ePolyKind )
2491 : {
2492 : case POLY_PIE :
2493 : case POLY_CHORD :
2494 : {
2495 0 : if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, &aPolygon ) )
2496 0 : aPropOpt.CreateFillProperties( mXPropSet, sal_True );
2497 : }
2498 0 : break;
2499 :
2500 : case POLY_ARC :
2501 : {
2502 0 : if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, &aPolygon ) )
2503 0 : aPropOpt.CreateLineProperties( mXPropSet, sal_False );
2504 : }
2505 0 : break;
2506 : }
2507 0 : maRect = MapRectangle( aNewRect );
2508 0 : maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
2509 0 : maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2510 0 : if ( bNeedText && ImplGetText() )
2511 0 : aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
2512 : }
2513 : }
2514 0 : else if ( mType == "drawing.Control" )
2515 : {
2516 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XControlShape >
2517 0 : aXControlShape( mXShape, ::com::sun::star::uno::UNO_QUERY );
2518 0 : if ( !aXControlShape.is() )
2519 0 : continue;
2520 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
2521 0 : aXControlModel( aXControlShape->getControl() );
2522 0 : if ( !aXControlModel.is() )
2523 0 : continue;
2524 :
2525 0 : sal_Int64 nAspect = ::com::sun::star::embed::Aspects::MSOLE_CONTENT;
2526 : try
2527 : {
2528 : // try to get the aspect when available
2529 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
2530 0 : xShapeProps( mXShape, ::com::sun::star::uno::UNO_QUERY_THROW );
2531 0 : xShapeProps->getPropertyValue( ::rtl::OUString( "Aspect" ) ) >>= nAspect;
2532 : }
2533 0 : catch( ::com::sun::star::uno::Exception& )
2534 : {}
2535 :
2536 0 : *mpExEmbed << (sal_uInt32)( 0xf | ( EPP_ExControl << 16 ) )
2537 0 : << (sal_uInt32)0; // Size of this container
2538 :
2539 0 : sal_uInt32 nSize, nOldPos = mpExEmbed->Tell();
2540 :
2541 0 : sal_uInt32 nPageId = nPageNumber;
2542 0 : if ( ePageType == MASTER )
2543 0 : nPageId |= 0x80000000;
2544 : else
2545 0 : nPageId += 0x100;
2546 0 : *mpExEmbed << (sal_uInt32)( EPP_ExControlAtom << 16 )
2547 0 : << (sal_uInt32)4
2548 0 : << nPageId;
2549 0 : PPTExOleObjEntry* pEntry = new PPTExOleObjEntry( OCX_CONTROL, mpExEmbed->Tell() );
2550 0 : pEntry->xControlModel = aXControlModel;
2551 0 : maExOleObj.push_back( pEntry );
2552 :
2553 0 : mnExEmbed++;
2554 :
2555 0 : *mpExEmbed << (sal_uInt32)( 1 | ( EPP_ExOleObjAtom << 16 ) )
2556 0 : << (sal_uInt32)24
2557 0 : << (sal_uInt32)nAspect
2558 0 : << (sal_uInt32)2
2559 0 : << (sal_uInt32)mnExEmbed
2560 0 : << (sal_uInt32)0
2561 0 : << (sal_uInt32)4 // index to the persist table
2562 0 : << (sal_uInt32)0x0012de00;
2563 :
2564 0 : ::com::sun::star::awt::Size aSize;
2565 0 : rtl::OUString aControlName;
2566 0 : SvStorageRef xTemp( new SvStorage( new SvMemoryStream(), sal_True ) );
2567 0 : if ( oox::ole::MSConvertOCXControls::WriteOCXStream( mXModel, xTemp, aXControlModel, aSize, aControlName ) )
2568 : {
2569 0 : String aUserName( xTemp->GetUserName() );
2570 0 : String aOleIdentifier;
2571 0 : if ( aUserName.Len() )
2572 : {
2573 : SvStorageStreamRef xCompObj = xTemp->OpenSotStream(
2574 : rtl::OUString( "\1CompObj" ),
2575 0 : STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYALL );
2576 0 : xCompObj->Seek( STREAM_SEEK_TO_END );
2577 0 : sal_uInt32 nStreamLen = xCompObj->Tell();
2578 0 : xCompObj->Seek( 0 );
2579 : sal_Int16 nVersion, nByteOrder;
2580 : sal_Int32 nWinVersion, nVal, nStringLen;
2581 0 : *xCompObj >> nVersion
2582 0 : >> nByteOrder
2583 0 : >> nWinVersion
2584 0 : >> nVal;
2585 0 : xCompObj->SeekRel( 16 ); // skipping clsid
2586 0 : *xCompObj >> nStringLen;
2587 0 : if ( ( xCompObj->Tell() + nStringLen ) < nStreamLen )
2588 : {
2589 0 : xCompObj->SeekRel( nStringLen ); // now skipping the UserName;
2590 0 : *xCompObj >> nStringLen;
2591 0 : if ( ( xCompObj->Tell() + nStringLen ) < nStreamLen )
2592 : {
2593 0 : xCompObj->SeekRel( nStringLen ); // now skipping the clipboard formatname
2594 0 : *xCompObj >> nStringLen;
2595 0 : if ( ( nStringLen > 1 ) && ( ( xCompObj->Tell() + nStringLen ) < nStreamLen ) )
2596 : { // i think that the OleIdentifier will follow
2597 0 : rtl::OString aTemp = read_uInt8s_ToOString(*xCompObj, nStringLen - 1);
2598 0 : aOleIdentifier = rtl::OStringToOUString(aTemp, RTL_TEXTENCODING_MS_1252);
2599 : }
2600 : }
2601 0 : }
2602 : }
2603 :
2604 0 : if ( !aControlName.isEmpty() )
2605 0 : PPTWriter::WriteCString( *mpExEmbed, aControlName, 1 );
2606 0 : if ( aOleIdentifier.Len() )
2607 0 : PPTWriter::WriteCString( *mpExEmbed, aOleIdentifier, 2 );
2608 0 : if ( aUserName.Len() )
2609 0 : PPTWriter::WriteCString( *mpExEmbed, aUserName, 3 );
2610 : }
2611 0 : nSize = mpExEmbed->Tell() - nOldPos;
2612 0 : mpExEmbed->Seek( nOldPos - 4 );
2613 0 : *mpExEmbed << nSize;
2614 0 : mpExEmbed->Seek( STREAM_SEEK_TO_END );
2615 0 : nOlePictureId = mnExEmbed;
2616 :
2617 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2618 0 : sal_uInt32 nSpFlags = SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_OLESHAPE;
2619 0 : ImplCreateShape( ESCHER_ShpInst_HostControl, nSpFlags, aSolverContainer );
2620 0 : if ( aPropOpt.CreateGraphicProperties( mXPropSet, rtl::OUString( "MetaFile" ), sal_False ) )
2621 0 : aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
2622 0 : aPropOpt.AddOpt( ESCHER_Prop_pictureId, mnExEmbed );
2623 0 : aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0x10000 );
2624 :
2625 0 : if ( !aControlName.isEmpty() )
2626 : {
2627 : sal_uInt16 i, nBufSize;
2628 0 : nBufSize = ( aControlName.getLength() + 1 ) << 1;
2629 0 : sal_uInt8* pBuf = new sal_uInt8[ nBufSize ];
2630 0 : sal_uInt8* pTmp = pBuf;
2631 0 : for ( i = 0; i < aControlName.getLength(); i++ )
2632 : {
2633 0 : sal_Unicode nUnicode = *(aControlName.getStr() + i);
2634 0 : *pTmp++ = (sal_uInt8)nUnicode;
2635 0 : *pTmp++ = (sal_uInt8)( nUnicode >> 8 );
2636 : }
2637 0 : *pTmp++ = 0;
2638 0 : *pTmp = 0;
2639 0 : aPropOpt.AddOpt( ESCHER_Prop_wzName, sal_True, nBufSize, pBuf, nBufSize );
2640 0 : }
2641 : }
2642 0 : else if ( mType == "drawing.Connector" )
2643 : {
2644 : sal_uInt16 nSpType, nSpFlags;
2645 0 : ::com::sun::star::awt::Rectangle aNewRect;
2646 0 : if ( aPropOpt.CreateConnectorProperties( mXShape, aSolverContainer, aNewRect, nSpType, nSpFlags ) == sal_False )
2647 0 : continue;
2648 :
2649 0 : maRect = MapRectangle( aNewRect );
2650 0 : maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
2651 0 : maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2652 :
2653 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2654 0 : ImplCreateShape( nSpType, nSpFlags, aSolverContainer );
2655 : }
2656 0 : else if ( mType == "drawing.Measure" )
2657 : {
2658 0 : continue;
2659 : }
2660 0 : else if ( mType == "drawing.Line" )
2661 : {
2662 0 : ::com::sun::star::awt::Rectangle aNewRect;
2663 0 : aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_LINE, sal_False, aNewRect, NULL );
2664 0 : maRect = MapRectangle( aNewRect );
2665 0 : maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
2666 0 : maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2667 0 : if ( ImplGetText() )
2668 : {
2669 0 : aTextRefPoint = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
2670 0 : mnTextSize = 0;
2671 0 : bAdditionalText = sal_True;
2672 0 : mpPptEscherEx->EnterGroup( &maRect,0 );
2673 : }
2674 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2675 0 : sal_uInt32 nFlags = 0xa00; // Flags: Connector | HasSpt
2676 0 : if ( maRect.Top() > maRect.Bottom() )
2677 0 : nFlags |= 0x80; // Flags: VertMirror
2678 0 : if ( maRect.Left() > maRect.Right() )
2679 0 : nFlags |= 0x40; // Flags: HorzMirror
2680 :
2681 0 : ImplCreateShape( ESCHER_ShpInst_Line, nFlags, aSolverContainer );
2682 0 : aPropOpt.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
2683 0 : aPropOpt.CreateLineProperties( mXPropSet, sal_False );
2684 0 : mnAngle = 0;
2685 : }
2686 0 : else if ( bPolyPolygon )
2687 : {
2688 0 : if ( ImplGetText() )
2689 : {
2690 0 : mpPptEscherEx->EnterGroup( 0,0 );
2691 0 : nGroupLevel = mpPptEscherEx->GetGroupLevel();
2692 0 : bAdditionalText = sal_True;
2693 0 : mnTextSize = 0;
2694 : }
2695 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2696 0 : ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
2697 0 : ::com::sun::star::awt::Rectangle aNewRect;
2698 0 : aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, NULL );
2699 0 : maRect = MapRectangle( aNewRect );
2700 0 : maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
2701 0 : maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2702 0 : aPropOpt.CreateFillProperties( mXPropSet, sal_True );
2703 0 : mnAngle = 0;
2704 : }
2705 0 : else if ( bPolyLine )
2706 : {
2707 0 : if ( ImplGetText() )
2708 : {
2709 0 : mpPptEscherEx->EnterGroup( 0,0 );
2710 0 : nGroupLevel = mpPptEscherEx->GetGroupLevel();
2711 0 : bAdditionalText = sal_True;
2712 0 : mnTextSize = 0;
2713 : }
2714 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2715 0 : ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
2716 0 : ::com::sun::star::awt::Rectangle aNewRect;
2717 0 : aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, NULL );
2718 0 : maRect = MapRectangle( aNewRect );
2719 0 : maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
2720 0 : maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2721 0 : aPropOpt.CreateLineProperties( mXPropSet, sal_False );
2722 0 : mnAngle = 0;
2723 : }
2724 0 : else if ( bOpenBezier )
2725 : {
2726 0 : if ( ImplGetText() )
2727 : {
2728 0 : mpPptEscherEx->EnterGroup( 0,0 );
2729 0 : nGroupLevel = mpPptEscherEx->GetGroupLevel();
2730 0 : bAdditionalText = sal_True;
2731 0 : mnTextSize = 0;
2732 : }
2733 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2734 0 : ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
2735 0 : ::com::sun::star::awt::Rectangle aNewRect;
2736 0 : aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_True, aNewRect, NULL );
2737 0 : maRect = MapRectangle( aNewRect );
2738 0 : maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
2739 0 : maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2740 0 : aPropOpt.CreateLineProperties( mXPropSet, sal_False );
2741 0 : mnAngle = 0;
2742 : }
2743 0 : else if ( bClosedBezier )
2744 : {
2745 0 : if ( ImplGetText() )
2746 : {
2747 0 : mpPptEscherEx->EnterGroup( 0,0 );
2748 0 : nGroupLevel = mpPptEscherEx->GetGroupLevel();
2749 0 : bAdditionalText = sal_True;
2750 0 : mnTextSize = 0;
2751 : }
2752 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2753 0 : ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
2754 0 : ::com::sun::star::awt::Rectangle aNewRect;
2755 0 : aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_True, aNewRect, NULL );
2756 0 : maRect = MapRectangle( aNewRect );
2757 0 : maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
2758 0 : maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
2759 0 : aPropOpt.CreateFillProperties( mXPropSet, sal_True );
2760 0 : mnAngle = 0;
2761 : }
2762 0 : else if ( ( mType == "drawing.GraphicObject" ) || ( mType == "presentation.GraphicObject" ) )
2763 : {
2764 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2765 :
2766 : // ein GraphicObject kann auch ein ClickMe Element sein
2767 0 : if ( mbEmptyPresObj && ( ePageType == NORMAL ) )
2768 : {
2769 0 : nPlaceHolderAtom = rLayout.nUsedObjectPlaceHolder;
2770 0 : ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
2771 0 : aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
2772 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
2773 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
2774 0 : aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
2775 : }
2776 : else
2777 : {
2778 : mXText = ::com::sun::star::uno::Reference<
2779 : ::com::sun::star::text::XSimpleText >
2780 0 : ( mXShape, ::com::sun::star::uno::UNO_QUERY );
2781 :
2782 0 : if ( mXText.is() )
2783 0 : mnTextSize = mXText->getString().getLength();
2784 :
2785 0 : if ( mnTextSize ) // graphic object oder Flachenfuellung
2786 : {
2787 : /* SJ #i34951#: because M. documents are not allowing GraphicObjects containing text, we
2788 : have to create a simpe Rectangle with fill bitmap instead (while not allowing BitmapMode_Repeat).
2789 : */
2790 0 : ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
2791 0 : if ( aPropOpt.CreateGraphicProperties( mXPropSet, rtl::OUString( "GraphicURL" ), sal_True, sal_True, sal_False ) )
2792 : {
2793 0 : aPropOpt.AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
2794 0 : aPropOpt.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
2795 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
2796 0 : aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x8000000 );
2797 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
2798 0 : if ( ImplGetText() )
2799 0 : aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
2800 : }
2801 : }
2802 : else
2803 : {
2804 0 : ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
2805 0 : if ( aPropOpt.CreateGraphicProperties( mXPropSet, rtl::OUString( "GraphicURL" ), sal_False, sal_True ) )
2806 0 : aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
2807 : }
2808 : }
2809 : }
2810 0 : else if ( ( mType == "drawing.Text" ) || ( mType == "presentation.Notes" ) )
2811 : {
2812 0 : if ( ( ePageType == NOTICE ) && mbPresObj )
2813 : {
2814 0 : if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Notes, EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE ) )
2815 0 : continue;
2816 : else
2817 0 : nPlaceHolderAtom = EPP_PLACEHOLDER_NOTESBODY;
2818 : }
2819 0 : ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
2820 : }
2821 0 : else if ( mType == "presentation.TitleText" )
2822 : {
2823 0 : if ( mbPresObj )
2824 : {
2825 0 : if ( ( ePageType == NOTICE ) && mbEmptyPresObj )
2826 : {
2827 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2828 0 : nPlaceHolderAtom = EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE;
2829 0 : ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x200, aSolverContainer );
2830 0 : aPropOpt.CreateLineProperties( mXPropSet, sal_False );
2831 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
2832 : }
2833 0 : else if ( rLayout.bTitlePossible && bIsTitlePossible )
2834 : {
2835 0 : bIsTitlePossible = sal_False;
2836 :
2837 0 : ImplGetText();
2838 0 : TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Title, maFontCollection, (PPTExBulletProvider&)*this );
2839 0 : if ( ePageType == MASTER )
2840 : {
2841 0 : if ( mnTextSize )
2842 : {
2843 0 : ::rtl::OUString aUString( mXText->getString() );
2844 : sal_uInt16 nChar;
2845 :
2846 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2847 0 : mnShapeMasterTitle = mpPptEscherEx->GenerateShapeId();
2848 0 : mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, mnShapeMasterTitle );// Flags: HaveAnchor | HasSpt
2849 0 : EscherPropertyContainer aPropertyOptions;
2850 0 : aPropertyOptions.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
2851 0 : aPropertyOptions.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
2852 0 : aPropertyOptions.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
2853 0 : aPropertyOptions.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
2854 0 : aPropertyOptions.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
2855 0 : aPropertyOptions.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
2856 0 : aPropertyOptions.CreateFillProperties( mXPropSet, sal_True );
2857 0 : sal_uInt32 nLineFlags = 0x90001;
2858 0 : if ( aPropertyOptions.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
2859 0 : nLineFlags |= 0x10001; // draw dashed line if no line
2860 0 : aPropertyOptions.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
2861 0 : aPropertyOptions.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
2862 0 : ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
2863 0 : aPropertyOptions.Commit( *mpStrm );
2864 0 : mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
2865 0 : *mpStrm << (sal_Int16)maRect.Top() << (sal_Int16)maRect.Left() << (sal_Int16)maRect.Right() << (sal_Int16)maRect.Bottom(); // oben, links, rechts, unten ????
2866 0 : mpPptEscherEx->OpenContainer( ESCHER_ClientData );
2867 0 : mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
2868 0 : *mpStrm << (sal_uInt32)0 // PlacementID
2869 0 : << (sal_uInt8)EPP_PLACEHOLDER_MASTERTITLE // PlaceHolderID
2870 0 : << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
2871 0 : << (sal_uInt16)0; // padword
2872 0 : mpPptEscherEx->CloseContainer(); // ESCHER_ClientData
2873 0 : mpPptEscherEx->OpenContainer( ESCHER_ClientTextbox );
2874 0 : mpPptEscherEx->AddAtom( 4, EPP_TextHeaderAtom );
2875 0 : *mpStrm << (sal_uInt32)EPP_TEXTTYPE_Title;
2876 0 : mpPptEscherEx->AddAtom( mnTextSize << 1, EPP_TextCharsAtom );
2877 0 : const sal_Unicode* pString = aUString.getStr();
2878 0 : for ( sal_uInt32 i = 0; i < mnTextSize; i++ )
2879 : {
2880 0 : nChar = pString[ i ]; // 0xa -> 0xb weicher Zeilenumbruch
2881 0 : if ( nChar == 0xa )
2882 0 : nChar++; // 0xd -> 0xd harter Zeilenumbruch
2883 0 : *mpStrm << nChar;
2884 : }
2885 0 : mpPptEscherEx->AddAtom( 6, EPP_BaseTextPropAtom );
2886 0 : *mpStrm << (sal_uInt32)( mnTextSize + 1 ) << (sal_uInt16)0;
2887 0 : mpPptEscherEx->AddAtom( 10, EPP_TextSpecInfoAtom );
2888 0 : *mpStrm << (sal_uInt32)( mnTextSize + 1 ) << (sal_uInt32)1 << (sal_uInt16)0;
2889 0 : mpPptEscherEx->CloseContainer(); // ESCHER_ClientTextBox
2890 0 : mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
2891 : }
2892 0 : continue;
2893 : }
2894 : else
2895 : {
2896 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2897 0 : mnTextStyle = EPP_TEXTSTYLE_TITLE;
2898 0 : nPlaceHolderAtom = rLayout.nTypeOfTitle;
2899 0 : ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
2900 0 : aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterTitle );
2901 0 : aPropOpt.CreateFillProperties( mXPropSet, sal_True );
2902 0 : aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
2903 0 : ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
2904 0 : if ( mbEmptyPresObj )
2905 : {
2906 0 : sal_uInt32 nNoLineDrawDash = 0;
2907 0 : aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
2908 0 : nNoLineDrawDash |= 0x10001;
2909 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
2910 : }
2911 0 : }
2912 : }
2913 : else
2914 0 : mbPresObj = sal_False;
2915 : }
2916 0 : if ( !mbPresObj )
2917 : {
2918 0 : mType = "drawing.Text";
2919 0 : ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
2920 : }
2921 : }
2922 0 : else if ( ( mType == "presentation.Outliner" ) || ( mType == "presentation.Subtitle" ) )
2923 : {
2924 0 : if ( mbPresObj )
2925 : {
2926 0 : nOutlinerCount++;
2927 0 : if ( (rLayout.bOutlinerPossible && ( nOutlinerCount == 1 )) ||
2928 : (( rLayout.bSecOutlinerPossible && ( nOutlinerCount == 2 ) ) && ( nPrevTextStyle == EPP_TEXTSTYLE_BODY ))
2929 : )
2930 : {
2931 0 : ImplGetText();
2932 0 : TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Body, maFontCollection, (PPTExBulletProvider&)*this );
2933 0 : if ( ePageType == MASTER )
2934 : {
2935 0 : nPrevTextStyle = EPP_TEXTSTYLE_TITLE;
2936 0 : if ( mnTextSize )
2937 : {
2938 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2939 0 : mnShapeMasterBody = mpPptEscherEx->GenerateShapeId();
2940 0 : mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, mnShapeMasterBody ); // Flags: HaveAnchor | HasSpt
2941 0 : EscherPropertyContainer aPropOpt2;
2942 0 : aPropOpt2.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
2943 0 : aPropOpt2.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
2944 0 : aPropOpt2.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
2945 0 : aPropOpt2.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
2946 0 : aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90001 );
2947 0 : aPropOpt2.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
2948 0 : aPropOpt2.CreateFillProperties( mXPropSet, sal_True );
2949 0 : sal_uInt32 nLineFlags = 0x90001;
2950 0 : if ( aPropOpt2.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
2951 0 : nLineFlags |= 0x10001; // draw dashed line if no line
2952 0 : aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
2953 0 : aPropOpt2.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
2954 0 : ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt2 );
2955 0 : aPropOpt2.Commit( *mpStrm );
2956 0 : mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
2957 0 : *mpStrm << (sal_Int16)maRect.Top() << (sal_Int16)maRect.Left() << (sal_Int16)maRect.Right() << (sal_Int16)maRect.Bottom(); // oben, links, rechts, unten ????
2958 0 : mpPptEscherEx->OpenContainer( ESCHER_ClientData );
2959 0 : mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
2960 0 : *mpStrm << (sal_uInt32)1 // PlacementID
2961 0 : << (sal_uInt8)EPP_PLACEHOLDER_MASTERBODY // PlaceHolderID
2962 0 : << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
2963 0 : << (sal_uInt16)0; // padword
2964 0 : mpPptEscherEx->CloseContainer(); // ESCHER_ClientData
2965 0 : mpPptEscherEx->OpenContainer( ESCHER_ClientTextbox ); // printf
2966 0 : mpPptEscherEx->AddAtom( 4, EPP_TextHeaderAtom );
2967 0 : *mpStrm << (sal_uInt32)EPP_TEXTTYPE_Body;
2968 0 : mnTextSize = aTextObj.Count();
2969 0 : aTextObj.Write( mpStrm );
2970 0 : mpPptEscherEx->BeginAtom();
2971 0 : for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount() ; ++i )
2972 : {
2973 0 : ParagraphObj* pPara = aTextObj.GetParagraph(i);
2974 0 : sal_uInt32 nCharCount = pPara->Count();
2975 0 : sal_uInt16 nDepth = pPara->nDepth;
2976 0 : if ( nDepth > 4)
2977 0 : nDepth = 4;
2978 :
2979 0 : *mpStrm << nCharCount
2980 0 : << nDepth;
2981 : }
2982 0 : mpPptEscherEx->EndAtom( EPP_BaseTextPropAtom );
2983 0 : mpPptEscherEx->AddAtom( 10, EPP_TextSpecInfoAtom );
2984 0 : *mpStrm << (sal_uInt32)( mnTextSize ) << (sal_uInt32)1 << (sal_uInt16)0;
2985 :
2986 0 : mpPptEscherEx->CloseContainer(); // ESCHER_ClientTextBox
2987 0 : mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
2988 : }
2989 0 : continue;
2990 : }
2991 : else
2992 : {
2993 0 : mnTextStyle = EPP_TEXTSTYLE_BODY;
2994 0 : nPlaceHolderAtom = rLayout.nTypeOfOutliner;
2995 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2996 0 : ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
2997 0 : aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
2998 0 : aPropOpt.CreateFillProperties( mXPropSet, sal_True );
2999 0 : aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
3000 0 : ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
3001 0 : if ( mbEmptyPresObj )
3002 : {
3003 0 : sal_uInt32 nNoLineDrawDash = 0;
3004 0 : aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
3005 0 : nNoLineDrawDash |= 0x10001;
3006 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
3007 : }
3008 0 : }
3009 : }
3010 : else
3011 0 : mbPresObj = sal_False;
3012 : }
3013 0 : if ( !mbPresObj )
3014 : {
3015 0 : mType = "drawing.Text";
3016 0 : ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
3017 : }
3018 : }
3019 0 : else if ( ( mType == "drawing.Page" ) || ( mType == "presentation.Page" ) )
3020 : {
3021 0 : if ( ( ePageType == NOTICE ) && mbPresObj )
3022 : {
3023 0 : if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Notes, EPP_PLACEHOLDER_MASTERNOTESSLIDEIMAGE ) )
3024 0 : continue;
3025 : else
3026 0 : nPlaceHolderAtom = EPP_PLACEHOLDER_NOTESSLIDEIMAGE;
3027 : }
3028 0 : ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
3029 : }
3030 0 : else if ( mType == "drawing.Frame" )
3031 : {
3032 0 : continue;
3033 : }
3034 0 : else if ( ( mType == "drawing.OLE2" ) || ( mType == "presentation.OLE2" )
3035 0 : || ( mType == "presentation.Chart" ) || ( mType == "presentation.Calc" )
3036 0 : || ( mType == "presentation.OrgChart" ) )
3037 : {
3038 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
3039 0 : if ( mbEmptyPresObj && ( ePageType == NORMAL ) )
3040 : {
3041 0 : nPlaceHolderAtom = rLayout.nUsedObjectPlaceHolder;
3042 0 : ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
3043 0 : aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
3044 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
3045 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
3046 0 : aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
3047 : }
3048 : else
3049 : {
3050 0 : *mpExEmbed << (sal_uInt32)( 0xf | ( EPP_ExEmbed << 16 ) )
3051 0 : << (sal_uInt32)0; // Size of this container
3052 :
3053 0 : sal_uInt32 nSize, nOldPos = mpExEmbed->Tell();
3054 :
3055 0 : *mpExEmbed << (sal_uInt32)( EPP_ExEmbedAtom << 16 )
3056 0 : << (sal_uInt32)8
3057 0 : << (sal_uInt32)0 // follow colorscheme : 0->do not follow
3058 : // 1->follow collorscheme
3059 : // 2->follow text and background scheme
3060 0 : << (sal_uInt8)1 // (bool)set if embedded server can not be locked
3061 0 : << (sal_uInt8)0 // (bool)do not need to send dimension
3062 0 : << (sal_uInt8)0 // (bool)is object a world table
3063 0 : << (sal_uInt8)0; // pad byte
3064 :
3065 0 : PPTExOleObjEntry* pE = new PPTExOleObjEntry( NORMAL_OLE_OBJECT, mpExEmbed->Tell() );
3066 0 : pE->xShape = mXShape;
3067 0 : maExOleObj.push_back( pE );
3068 :
3069 0 : mnExEmbed++;
3070 :
3071 0 : sal_Int64 nAspect = ::com::sun::star::embed::Aspects::MSOLE_CONTENT;
3072 : try
3073 : {
3074 : // try to get the aspect when available
3075 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
3076 0 : xShapeProps( mXShape, ::com::sun::star::uno::UNO_QUERY_THROW );
3077 0 : xShapeProps->getPropertyValue( ::rtl::OUString( "Aspect" ) ) >>= nAspect;
3078 : }
3079 0 : catch( ::com::sun::star::uno::Exception& )
3080 : {}
3081 :
3082 0 : *mpExEmbed << (sal_uInt32)( 1 | ( EPP_ExOleObjAtom << 16 ) )
3083 0 : << (sal_uInt32)24
3084 0 : << (sal_uInt32)nAspect // Aspect
3085 0 : << (sal_uInt32)0
3086 0 : << (sal_uInt32)mnExEmbed // index to the persist table
3087 0 : << (sal_uInt32)0 // subtype
3088 0 : << (sal_uInt32)0
3089 0 : << (sal_uInt32)0x0012b600;
3090 :
3091 0 : nSize = mpExEmbed->Tell() - nOldPos;
3092 0 : mpExEmbed->Seek( nOldPos - 4 );
3093 0 : *mpExEmbed << nSize;
3094 0 : mpExEmbed->Seek( STREAM_SEEK_TO_END );
3095 0 : nOlePictureId = mnExEmbed;
3096 :
3097 0 : sal_uInt32 nSpFlags = 0xa00;
3098 0 : if ( nOlePictureId )
3099 0 : nSpFlags |= 0x10;
3100 0 : ImplCreateShape( ESCHER_ShpInst_PictureFrame, nSpFlags, aSolverContainer );
3101 0 : if ( aPropOpt.CreateOLEGraphicProperties( mXShape ) )
3102 0 : aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
3103 0 : if ( nOlePictureId )
3104 0 : aPropOpt.AddOpt( ESCHER_Prop_pictureId, nOlePictureId );
3105 : }
3106 : }
3107 0 : else if ( mType == "presentation.Header" )
3108 : {
3109 0 : if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERHEADER ) )
3110 0 : continue;
3111 : else
3112 : {
3113 0 : mbPresObj = sal_False;
3114 0 : mType = "drawing.Text";
3115 0 : ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
3116 : }
3117 : }
3118 0 : else if ( mType == "presentation.Footer" )
3119 : {
3120 0 : if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERFOOTER ) )
3121 0 : continue;
3122 : else
3123 : {
3124 0 : mbPresObj = sal_False;
3125 0 : mType = "drawing.Text";
3126 0 : ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
3127 : }
3128 : }
3129 0 : else if ( mType == "presentation.DateTime" )
3130 : {
3131 0 : if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERDATE ) )
3132 0 : continue;
3133 : else
3134 : {
3135 0 : mbPresObj = sal_False;
3136 0 : mType = "drawing.Text";
3137 0 : ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
3138 : }
3139 : }
3140 0 : else if ( mType == "presentation.SlideNumber" )
3141 : {
3142 0 : if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERSLIDENUMBER ) )
3143 0 : continue;
3144 : else
3145 : {
3146 0 : mbPresObj = sal_False;
3147 0 : mType = "drawing.Text";
3148 0 : ImplCreateTextShape( aPropOpt, aSolverContainer, sal_True );
3149 : }
3150 : }
3151 0 : else if ( (mType.getLength() > 9) && (mType[8] == '3') && (mType[9] == 'D') ) // drawing.3D
3152 : {
3153 : // SceneObject, CubeObject, SphereObject, LatheObject, ExtrudeObject, PolygonObject
3154 0 : if ( !ImplGetPropertyValue( rtl::OUString( "Bitmap" ) ) )
3155 0 : continue;
3156 :
3157 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
3158 0 : ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
3159 :
3160 0 : if ( aPropOpt.CreateGraphicProperties( mXPropSet, rtl::OUString( "Bitmap" ), sal_False ) )
3161 0 : aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
3162 : }
3163 0 : else if ( mType == "drawing.Media" )
3164 : {
3165 0 : mnAngle = 0;
3166 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
3167 0 : ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
3168 :
3169 0 : ::com::sun::star::uno::Any aAny;
3170 0 : if ( PropValue::GetPropertyValue( aAny, mXPropSet, rtl::OUString( "MediaURL" ), sal_True ) )
3171 : {
3172 0 : rtl::OUString aMediaURL;
3173 0 : if ( (aAny >>= aMediaURL ) && !aMediaURL.isEmpty() )
3174 : {
3175 : // SJ: creating the Media RefObj
3176 0 : sal_uInt32 nRefId = ++mnExEmbed;
3177 :
3178 0 : *mpExEmbed << (sal_uInt16)0xf
3179 0 : << (sal_uInt16)EPP_ExMCIMovie // PPT_PST_ExAviMovie
3180 0 : << (sal_uInt32)0;
3181 0 : sal_uInt32 nSize, nStart = mpExEmbed->Tell();
3182 0 : *mpExEmbed << (sal_uInt16)0
3183 0 : << (sal_uInt16)EPP_ExObjRefAtom
3184 0 : << (sal_uInt32)4
3185 0 : << nRefId;
3186 0 : *mpExEmbed << (sal_uInt16)0xf
3187 0 : << (sal_uInt16)EPP_ExVideo
3188 0 : << (sal_uInt32)0;
3189 :
3190 0 : *mpExEmbed << (sal_uInt16)0
3191 0 : << (sal_uInt16)EPP_ExMediaAtom
3192 0 : << (sal_uInt32)8
3193 0 : << nRefId
3194 0 : << (sal_uInt16)0
3195 0 : << (sal_uInt16)0x435;
3196 :
3197 0 : sal_uInt16 i, nStringLen = (sal_uInt16)aMediaURL.getLength();
3198 0 : *mpExEmbed << (sal_uInt32)( EPP_CString << 16 ) << (sal_uInt32)( nStringLen * 2 );
3199 0 : for ( i = 0; i < nStringLen; i++ )
3200 : {
3201 0 : sal_Unicode nChar = aMediaURL[ i ];
3202 0 : *mpExEmbed << nChar;
3203 : }
3204 0 : nSize = mpExEmbed->Tell() - nStart;
3205 0 : mpExEmbed->SeekRel( - ( (sal_Int32)nSize + 4 ) );
3206 0 : *mpExEmbed << nSize; // size of PPT_PST_ExMCIMovie
3207 0 : mpExEmbed->SeekRel( 0x10 );
3208 0 : nSize -= 20;
3209 0 : *mpExEmbed << nSize; // PPT_PST_ExMediaAtom
3210 0 : mpExEmbed->SeekRel( nSize );
3211 :
3212 0 : if ( !pClientData )
3213 0 : pClientData = new SvMemoryStream( 0x200, 0x200 );
3214 0 : *pClientData << (sal_uInt16)0
3215 0 : << (sal_uInt16)EPP_ExObjRefAtom
3216 0 : << (sal_uInt32)4
3217 0 : << nRefId;
3218 0 : }
3219 0 : }
3220 : }
3221 0 : else if ( (mType == "drawing.Table") || (mType == "presentation.Table") )
3222 : {
3223 0 : SvMemoryStream* pTmp = NULL;
3224 0 : if ( bEffect && !mbUseNewAnimations )
3225 : {
3226 0 : pTmp = new SvMemoryStream( 0x200, 0x200 );
3227 0 : ImplWriteObjectEffect( *pTmp, eAe, eTe, ++nEffectCount );
3228 : }
3229 0 : if ( eCa != ::com::sun::star::presentation::ClickAction_NONE )
3230 : {
3231 0 : if ( !pTmp )
3232 0 : pTmp = new SvMemoryStream( 0x200, 0x200 );
3233 0 : ImplWriteClickAction( *pTmp, eCa, bMediaClickAction );
3234 : }
3235 0 : ImplCreateTable( mXShape, aSolverContainer, aPropOpt );
3236 0 : continue;
3237 : }
3238 0 : else if ( mType == "drawing.dontknow" )
3239 : {
3240 0 : mnAngle = 0;
3241 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
3242 0 : ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
3243 0 : if ( aPropOpt.CreateGraphicProperties( mXPropSet, rtl::OUString( "MetaFile" ), sal_False ) )
3244 0 : aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
3245 : }
3246 : else
3247 : {
3248 0 : continue;
3249 : }
3250 :
3251 : sal_Bool bClientData = ( bEffect || ( eCa != ::com::sun::star::presentation::ClickAction_NONE ) ||
3252 0 : nPlaceHolderAtom || nOlePictureId );
3253 0 : if ( bClientData )
3254 : {
3255 0 : if ( nPlaceHolderAtom )
3256 : {
3257 0 : sal_Int32 nPlacementID = -1;
3258 0 : if ( ( mnTextStyle == EPP_TEXTSTYLE_TITLE ) || ( mnTextStyle == EPP_TEXTSTYLE_BODY ) )
3259 0 : nPlacementID = nIndices++;
3260 : else
3261 : {
3262 0 : switch ( nPlaceHolderAtom )
3263 : {
3264 : default :
3265 : {
3266 0 : if ( nPlaceHolderAtom < 19 )
3267 0 : break;
3268 : }
3269 : case EPP_PLACEHOLDER_NOTESBODY :
3270 : case EPP_PLACEHOLDER_MASTERDATE :
3271 : case EPP_PLACEHOLDER_NOTESSLIDEIMAGE :
3272 : case EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE :
3273 0 : nPlacementID = nIndices++;
3274 : }
3275 : }
3276 0 : if ( !pClientData )
3277 0 : pClientData = new SvMemoryStream( 0x200, 0x200 );
3278 :
3279 0 : *pClientData << (sal_uInt32)( EPP_OEPlaceholderAtom << 16 ) << (sal_uInt32)8
3280 0 : << nPlacementID // PlacementID
3281 0 : << (sal_uInt8)nPlaceHolderAtom // PlaceHolderID
3282 0 : << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
3283 0 : << (sal_uInt16)0; // padword
3284 : }
3285 0 : if ( nOlePictureId )
3286 : {
3287 0 : if ( !pClientData )
3288 0 : pClientData = new SvMemoryStream( 0x200, 0x200 );
3289 :
3290 0 : *pClientData << (sal_uInt32)( EPP_ExObjRefAtom << 16 ) << (sal_uInt32)4
3291 0 : << nOlePictureId;
3292 0 : nOlePictureId = 0;
3293 : }
3294 0 : if ( bEffect )
3295 : {
3296 0 : if ( !pClientData )
3297 0 : pClientData = new SvMemoryStream( 0x200, 0x200 );
3298 :
3299 : // check if it is sensible to replace the object effect with text effect,
3300 : // because in Impress there is the possibility to use a compound effect,
3301 : // e.g. the object effect is an AnimationEffect_FADE_FROM_LEFT and the
3302 : // text effect is a AnimationEffect_FADE_FROM_TOP, in PowerPoint there
3303 : // can be used only one effect
3304 0 : if ( mnTextSize && ( eTe != ::com::sun::star::presentation::AnimationEffect_NONE )
3305 : && ( eAe != ::com::sun::star::presentation::AnimationEffect_NONE )
3306 : && ( eTe != eAe ) )
3307 : {
3308 : sal_uInt32 nFillStyleFlags, nLineStyleFlags;
3309 0 : if ( aPropOpt.GetOpt( ESCHER_Prop_fNoFillHitTest, nFillStyleFlags )
3310 0 : && aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineStyleFlags ) )
3311 : {
3312 : // there is no fillstyle and also no linestyle
3313 0 : if ( ! ( ( nFillStyleFlags & 0x10 ) + ( nLineStyleFlags & 9 ) ) )
3314 0 : eAe = eTe;
3315 : }
3316 : }
3317 0 : if ( !mbUseNewAnimations )
3318 0 : ImplWriteObjectEffect( *pClientData, eAe, eTe, ++nEffectCount );
3319 : }
3320 :
3321 0 : if ( eCa != ::com::sun::star::presentation::ClickAction_NONE )
3322 : {
3323 0 : if ( !pClientData )
3324 0 : pClientData = new SvMemoryStream( 0x200, 0x200 );
3325 0 : ImplWriteClickAction( *pClientData, eCa, bMediaClickAction );
3326 : }
3327 : }
3328 0 : if ( ( mnTextStyle == EPP_TEXTSTYLE_TITLE ) || ( mnTextStyle == EPP_TEXTSTYLE_BODY ) )
3329 : {
3330 0 : if ( !pClientTextBox )
3331 0 : pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
3332 :
3333 0 : if ( mbEmptyPresObj == sal_False )
3334 : {
3335 0 : if ( ( ePageType == NORMAL ) && ( bMasterPage == sal_False ) )
3336 : {
3337 0 : sal_uInt32 nTextType = EPP_TEXTTYPE_Body;
3338 0 : if ( mnTextStyle == EPP_TEXTSTYLE_BODY )
3339 : {
3340 0 : if ( bSecOutl )
3341 0 : nTextType = EPP_TEXTTYPE_HalfBody;
3342 0 : else if ( mType == "presentation.Subtitle" )
3343 0 : nTextType = EPP_TEXTTYPE_CenterBody;
3344 0 : bSecOutl = sal_True;
3345 : }
3346 : else
3347 0 : nTextType = EPP_TEXTTYPE_Title;
3348 :
3349 0 : TextRuleEntry aTextRule( nPageNumber );
3350 0 : SvMemoryStream aExtBu( 0x200, 0x200 );
3351 0 : ImplGetText();
3352 0 : ImplWriteTextStyleAtom( *pClientTextBox, nTextType, nPObjects, &aTextRule, aExtBu, NULL );
3353 0 : ImplWriteExtParaHeader( aExtBu, nPObjects++, nTextType, nPageNumber + 0x100 );
3354 0 : SvMemoryStream* pOut = aTextRule.pOut;
3355 0 : if ( pOut )
3356 : {
3357 0 : pClientTextBox->Write( pOut->GetData(), pOut->Tell() );
3358 0 : delete pOut, aTextRule.pOut = NULL;
3359 : }
3360 0 : if ( aExtBu.Tell() )
3361 : {
3362 0 : if ( !pClientData )
3363 0 : pClientData = new SvMemoryStream( 0x200, 0x200 );
3364 0 : ImplProgTagContainer( pClientData, &aExtBu );
3365 0 : }
3366 : }
3367 0 : }
3368 : }
3369 : else
3370 : {
3371 0 : if ( !aPropOpt.IsFontWork() )
3372 : {
3373 0 : if ( mnTextSize || ( nPlaceHolderAtom == EPP_PLACEHOLDER_MASTERDATE ) || ( nPlaceHolderAtom == EPP_PLACEHOLDER_NOTESBODY ) )
3374 : {
3375 : int nInstance2;
3376 0 : if ( ( nPlaceHolderAtom == EPP_PLACEHOLDER_MASTERDATE ) || ( nPlaceHolderAtom == EPP_PLACEHOLDER_NOTESBODY ) )
3377 0 : nInstance2 = 2;
3378 : else
3379 0 : nInstance2 = EPP_TEXTTYPE_Other; // Text in a Shape
3380 :
3381 0 : if ( !pClientTextBox )
3382 0 : pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
3383 :
3384 0 : SvMemoryStream aExtBu( 0x200, 0x200 );
3385 0 : ImplWriteTextStyleAtom( *pClientTextBox, nInstance2, 0, NULL, aExtBu, &aPropOpt );
3386 0 : if ( aExtBu.Tell() )
3387 : {
3388 0 : if ( !pClientData )
3389 0 : pClientData = new SvMemoryStream( 0x200, 0x200 );
3390 0 : ImplProgTagContainer( pClientData, &aExtBu );
3391 0 : }
3392 : }
3393 0 : else if ( nPlaceHolderAtom >= 19 )
3394 : {
3395 0 : if ( !pClientTextBox )
3396 0 : pClientTextBox = new SvMemoryStream( 12 );
3397 :
3398 0 : *pClientTextBox << (sal_uInt32)( EPP_TextHeaderAtom << 16 ) << (sal_uInt32)4
3399 0 : << (sal_uInt32)7;
3400 : }
3401 : }
3402 : }
3403 :
3404 0 : aPropOpt.CreateShadowProperties( mXPropSet );
3405 0 : maRect.Justify();
3406 0 : if ( mnAngle )
3407 0 : ImplFlipBoundingBox( aPropOpt );
3408 0 : aPropOpt.CreateShapeProperties( mXShape );
3409 0 : aPropOpt.Commit( *mpStrm );
3410 0 : if ( GetCurrentGroupLevel() > 0 )
3411 0 : mpPptEscherEx->AddChildAnchor( maRect );
3412 : else
3413 0 : mpPptEscherEx->AddClientAnchor( maRect );
3414 :
3415 0 : if ( pClientData )
3416 : {
3417 0 : *mpStrm << (sal_uInt32)( ( ESCHER_ClientData << 16 ) | 0xf )
3418 0 : << (sal_uInt32)pClientData->Tell();
3419 :
3420 0 : mpStrm->Write( pClientData->GetData(), pClientData->Tell() );
3421 0 : delete pClientData, pClientData = NULL;
3422 : }
3423 0 : if ( pClientTextBox )
3424 : {
3425 0 : *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
3426 0 : << (sal_uInt32)pClientTextBox->Tell();
3427 :
3428 0 : mpStrm->Write( pClientTextBox->GetData(), pClientTextBox->Tell() );
3429 0 : delete pClientTextBox, pClientTextBox = NULL;
3430 : }
3431 0 : mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
3432 : }
3433 0 : nPrevTextStyle = mnTextStyle;
3434 :
3435 0 : if ( bAdditionalText )
3436 : {
3437 0 : bAdditionalText = sal_False;
3438 :
3439 0 : ::com::sun::star::uno::Any aAny;
3440 0 : EscherPropertyContainer aPropOpt;
3441 : mnAngle = ( PropValue::GetPropertyValue( aAny,
3442 0 : mXPropSet, rtl::OUString( "RotateAngle" ), sal_True ) )
3443 0 : ? *((sal_Int32*)aAny.getValue() )
3444 0 : : 0;
3445 :
3446 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
3447 0 : aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
3448 0 : if ( mType == "drawing.Line" )
3449 : {
3450 0 : double fDist = hypot( maRect.GetWidth(), maRect.GetHeight() );
3451 : maRect = Rectangle( Point( aTextRefPoint.X, aTextRefPoint.Y ),
3452 0 : Point( (sal_Int32)( aTextRefPoint.X + fDist ), aTextRefPoint.Y - 1 ) );
3453 0 : ImplCreateTextShape( aPropOpt, aSolverContainer, sal_False );
3454 0 : aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x60006 ); // Size Shape To Fit Text
3455 0 : if ( mnAngle < 0 )
3456 0 : mnAngle = ( 36000 + mnAngle ) % 36000;
3457 0 : if ( mnAngle )
3458 0 : ImplFlipBoundingBox( aPropOpt );
3459 : }
3460 : else
3461 : {
3462 0 : ImplCreateTextShape( aPropOpt, aSolverContainer, sal_False );
3463 0 : if ( mnAngle < 0 )
3464 0 : mnAngle = ( 36000 + mnAngle ) % 36000;
3465 : else
3466 0 : mnAngle = ( 36000 - ( mnAngle % 36000 ) );
3467 :
3468 0 : mnAngle *= 655;
3469 0 : mnAngle += 0x8000;
3470 0 : mnAngle &=~0xffff; // nAngle auf volle Gradzahl runden
3471 0 : aPropOpt.AddOpt( ESCHER_Prop_Rotation, mnAngle );
3472 0 : mpPptEscherEx->SetGroupSnapRect( nGroupLevel, maRect );
3473 0 : mpPptEscherEx->SetGroupLogicRect( nGroupLevel, maRect );
3474 : }
3475 0 : if ( !pClientTextBox )
3476 0 : pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
3477 :
3478 0 : SvMemoryStream aExtBu( 0x200, 0x200 );
3479 0 : ImplWriteTextStyleAtom( *pClientTextBox, EPP_TEXTTYPE_Other, 0, NULL, aExtBu, &aPropOpt );
3480 :
3481 0 : aPropOpt.CreateShapeProperties( mXShape );
3482 0 : aPropOpt.Commit( *mpStrm );
3483 0 : if ( GetCurrentGroupLevel() > 0 )
3484 0 : mpPptEscherEx->AddChildAnchor( maRect );
3485 : else
3486 0 : mpPptEscherEx->AddClientAnchor( maRect );
3487 :
3488 0 : *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
3489 0 : << (sal_uInt32)pClientTextBox->Tell();
3490 :
3491 0 : mpStrm->Write( pClientTextBox->GetData(), pClientTextBox->Tell() );
3492 0 : delete pClientTextBox, pClientTextBox = NULL;
3493 :
3494 0 : mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
3495 0 : mpPptEscherEx->LeaveGroup();
3496 : }
3497 : }
3498 0 : ClearGroupTable(); // gruppierungen wegschreiben, sofern noch irgendwelche offen sind, was eigendlich nicht sein sollte
3499 0 : nGroups = GetGroupsClosed();
3500 0 : for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ;
3501 0 : mnPagesWritten++;
3502 0 : }
3503 :
3504 : // -----------------------------------------------------------------------
3505 :
3506 : struct CellBorder
3507 : {
3508 : sal_Int32 mnPos; // specifies the distance to the top/left position of the table
3509 : sal_Int32 mnLength;
3510 : table::BorderLine maCellBorder;
3511 :
3512 0 : CellBorder() : mnPos ( 0 ), mnLength( 0 ){};
3513 : };
3514 :
3515 0 : void PPTWriter::ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 )
3516 : {
3517 0 : sal_Int32 nLineWidth = pCellBorder->maCellBorder.OuterLineWidth + pCellBorder->maCellBorder.InnerLineWidth;
3518 0 : if ( nLineWidth )
3519 : {
3520 0 : mnAngle = 0;
3521 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
3522 0 : EscherPropertyContainer aPropOptSp;
3523 :
3524 0 : sal_uInt32 nId = mpPptEscherEx->GenerateShapeId();
3525 0 : mpPptEscherEx->AddShape( ESCHER_ShpInst_Line, 0xa02, nId );
3526 0 : aPropOptSp.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
3527 0 : aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0xa0008 );
3528 0 : aPropOptSp.AddOpt( ESCHER_Prop_fshadowObscured, 0x20000 );
3529 :
3530 0 : sal_uInt32 nBorderColor = pCellBorder->maCellBorder.Color & 0xff00; // green
3531 0 : nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color ) << 16; // red
3532 0 : nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color >> 16 ); // blue
3533 0 : aPropOptSp.AddOpt( ESCHER_Prop_lineColor, nBorderColor );
3534 :
3535 0 : aPropOptSp.AddOpt( ESCHER_Prop_lineWidth, nLineWidth * 360 );
3536 0 : aPropOptSp.AddOpt( ESCHER_Prop_fc3DLightFace, 0x80000 );
3537 0 : aPropOptSp.Commit( *mpStrm );
3538 0 : mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
3539 0 : *mpStrm << nX1
3540 0 : << nY1
3541 0 : << nX2
3542 0 : << nY2;
3543 0 : mpPptEscherEx->CloseContainer();
3544 : }
3545 0 : }
3546 :
3547 0 : void PPTWriter::WriteCString( SvStream& rSt, const String& rString, sal_uInt32 nInstance )
3548 : {
3549 0 : sal_uInt32 i, nLen = rString.Len();
3550 0 : if ( nLen )
3551 : {
3552 0 : rSt << (sal_uInt32)( ( nInstance << 4 ) | ( EPP_CString << 16 ) )
3553 0 : << (sal_uInt32)( nLen << 1 );
3554 0 : for ( i = 0; i < nLen; i++ )
3555 0 : rSt << rString.GetChar( (sal_uInt16)i );
3556 : }
3557 0 : }
3558 :
3559 0 : void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer,
3560 : EscherPropertyContainer& aPropOpt )
3561 : {
3562 0 : mpPptEscherEx->OpenContainer( ESCHER_SpgrContainer );
3563 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
3564 0 : mpPptEscherEx->AddAtom( 16, ESCHER_Spgr, 1 );
3565 0 : *mpStrm << (sal_Int32)maRect.Left() // Bounding box fuer die Gruppierten shapes an die sie attached werden
3566 0 : << (sal_Int32)maRect.Top()
3567 0 : << (sal_Int32)maRect.Right()
3568 0 : << (sal_Int32)maRect.Bottom();
3569 :
3570 0 : sal_uInt32 nShapeId = mpPptEscherEx->GenerateShapeId();
3571 0 : mpPptEscherEx->AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId ); // Flags: Group | Patriarch
3572 0 : aSolverContainer.AddShape( rXShape, nShapeId );
3573 0 : EscherPropertyContainer aPropOpt2;
3574 : try
3575 : {
3576 0 : static const rtl::OUString sModel( "Model" );
3577 0 : static const rtl::OUString sWidth( "Width" );
3578 0 : static const rtl::OUString sHeight( "Height" );
3579 :
3580 0 : uno::Reference< table::XTable > xTable;
3581 0 : if ( mXPropSet->getPropertyValue( sModel ) >>= xTable )
3582 : {
3583 0 : uno::Reference< table::XColumnRowRange > xColumnRowRange( xTable, uno::UNO_QUERY_THROW );
3584 0 : uno::Reference< container::XIndexAccess > xColumns( xColumnRowRange->getColumns(), uno::UNO_QUERY_THROW );
3585 0 : uno::Reference< container::XIndexAccess > xRows( xColumnRowRange->getRows(), uno::UNO_QUERY_THROW );
3586 0 : sal_uInt16 nRowCount = static_cast< sal_uInt16 >( xRows->getCount() );
3587 0 : sal_uInt16 nColumnCount = static_cast< sal_uInt16 >( xColumns->getCount() );
3588 :
3589 0 : std::vector< std::pair< sal_Int32, sal_Int32 > > aColumns;
3590 0 : std::vector< std::pair< sal_Int32, sal_Int32 > > aRows;
3591 :
3592 0 : awt::Point aPosition( MapPoint( rXShape->getPosition() ) );
3593 0 : sal_uInt32 nPosition = aPosition.X;
3594 0 : for ( sal_Int32 x = 0; x < nColumnCount; x++ )
3595 : {
3596 0 : uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( x ), uno::UNO_QUERY_THROW );
3597 0 : awt::Size aS( 0, 0 );
3598 0 : xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
3599 0 : awt::Size aM( MapSize( aS ) );
3600 0 : aColumns.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Width ) );
3601 0 : nPosition += aM.Width;
3602 0 : }
3603 :
3604 0 : nPosition = aPosition.Y;
3605 0 : for ( sal_Int32 y = 0; y < nRowCount; y++ )
3606 : {
3607 0 : uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( y ), uno::UNO_QUERY_THROW );
3608 0 : awt::Size aS( 0, 0 );
3609 0 : xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
3610 0 : awt::Size aM( MapSize( aS ) );
3611 0 : aRows.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Height ) );
3612 0 : nPosition += aM.Height;
3613 0 : }
3614 :
3615 0 : if ( nRowCount )
3616 : {
3617 0 : SvMemoryStream aMemStrm;
3618 0 : aMemStrm.ObjectOwnsMemory( sal_False );
3619 0 : aMemStrm << nRowCount
3620 0 : << nRowCount
3621 0 : << (sal_uInt16)4;
3622 :
3623 0 : std::vector< std::pair< sal_Int32, sal_Int32 > >::const_iterator aIter( aRows.begin() );
3624 0 : while( aIter != aRows.end() )
3625 0 : aMemStrm << (*aIter++).second;
3626 :
3627 0 : aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x1000100 );
3628 0 : aPropOpt2.AddOpt( ESCHER_Prop_tableProperties, 1 );
3629 0 : aPropOpt2.AddOpt( ESCHER_Prop_tableRowProperties, sal_True, aMemStrm.Tell(), static_cast< sal_uInt8* >( const_cast< void* >( aMemStrm.GetData() ) ), aMemStrm.Tell() );
3630 0 : aPropOpt.CreateShapeProperties( rXShape );
3631 0 : aPropOpt.Commit( *mpStrm );
3632 0 : aPropOpt2.Commit( *mpStrm, 3, ESCHER_UDefProp );
3633 0 : if ( GetCurrentGroupLevel() > 0 )
3634 0 : mpPptEscherEx->AddChildAnchor( maRect );
3635 : else
3636 0 : mpPptEscherEx->AddClientAnchor( maRect );
3637 0 : mpPptEscherEx->CloseContainer();
3638 :
3639 0 : uno::Reference< table::XCellRange > xCellRange( xTable, uno::UNO_QUERY_THROW );
3640 0 : for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
3641 : {
3642 0 : for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
3643 : {
3644 0 : uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nRow ), uno::UNO_QUERY_THROW );
3645 0 : if ( !xCell->isMerged() )
3646 : {
3647 0 : sal_Int32 nLeft = aColumns[ nColumn ].first;
3648 0 : sal_Int32 nTop = aRows[ nRow ].first;
3649 0 : sal_Int32 nRight = nLeft + aColumns[ nColumn ].second;
3650 0 : sal_Int32 nBottom = nTop + aRows[ nRow ].second;
3651 :
3652 0 : for ( sal_Int32 nColumnSpan = 1; nColumnSpan < xCell->getColumnSpan(); nColumnSpan++ )
3653 : {
3654 0 : sal_uInt32 nC = nColumnSpan + nColumn;
3655 0 : if ( nC < aColumns.size() )
3656 0 : nRight += aColumns[ nC ].second;
3657 : else
3658 0 : nRight = maRect.Right();
3659 : }
3660 0 : for ( sal_Int32 nRowSpan = 1; nRowSpan < xCell->getRowSpan(); nRowSpan++ )
3661 : {
3662 0 : sal_uInt32 nR = nRowSpan + nRow;
3663 0 : if ( nR < aColumns.size() )
3664 0 : nBottom += aRows[ nR ].second;
3665 : else
3666 0 : nBottom = maRect.Bottom();
3667 : }
3668 :
3669 0 : mbFontIndependentLineSpacing = sal_False;
3670 0 : mXPropSet = uno::Reference< beans::XPropertySet >( xCell, uno::UNO_QUERY_THROW );
3671 0 : mXText = uno::Reference< text::XSimpleText >( xCell, uno::UNO_QUERY_THROW );
3672 0 : mnTextSize = mXText->getString().getLength();
3673 :
3674 0 : ::com::sun::star::uno::Any aAny;
3675 0 : if ( GetPropertyValue( aAny, mXPropSet, rtl::OUString( "FontIndependentLineSpacing" ) ), sal_True )
3676 0 : aAny >>= mbFontIndependentLineSpacing;
3677 :
3678 0 : EscherPropertyContainer aPropOptSp;
3679 0 : mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
3680 0 : ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa02, aSolverContainer ); // Flags: Connector | HasSpt | Child
3681 0 : aPropOptSp.CreateFillProperties( mXPropSet, sal_True );
3682 0 : aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
3683 0 : aPropOptSp.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
3684 0 : aPropOptSp.AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapSquare );
3685 :
3686 0 : SvMemoryStream aClientTextBox( 0x200, 0x200 );
3687 0 : SvMemoryStream aExtBu( 0x200, 0x200 );
3688 :
3689 0 : ImplWriteTextStyleAtom( aClientTextBox, EPP_TEXTTYPE_Other, 0, NULL, aExtBu, &aPropOptSp );
3690 :
3691 0 : aPropOptSp.Commit( *mpStrm );
3692 0 : mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
3693 0 : *mpStrm << nLeft
3694 0 : << nTop
3695 0 : << nRight
3696 0 : << nBottom;
3697 :
3698 0 : *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
3699 0 : << (sal_uInt32)aClientTextBox.Tell();
3700 :
3701 0 : mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() );
3702 0 : mpPptEscherEx->CloseContainer();
3703 : }
3704 0 : }
3705 : }
3706 :
3707 0 : static const rtl::OUString sTopBorder( "TopBorder" );
3708 0 : static const rtl::OUString sBottomBorder( "BottomBorder" );
3709 0 : static const rtl::OUString sLeftBorder( "LeftBorder" );
3710 0 : static const rtl::OUString sRightBorder( "RightBorder" );
3711 :
3712 : // creating horz lines
3713 0 : sal_Int32 nYPos = MapPoint( rXShape->getPosition() ).Y;
3714 0 : for( sal_Int32 nLine = 0; nLine < ( xRows->getCount() + 1 ); nLine++ )
3715 : {
3716 0 : sal_Int32 nXPos = MapPoint( rXShape->getPosition() ).X;
3717 0 : std::vector< CellBorder > vCellBorders;
3718 0 : for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
3719 : {
3720 0 : uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nColumn ), uno::UNO_QUERY_THROW );
3721 0 : awt::Size aS( 0, 0 );
3722 0 : xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
3723 0 : awt::Size aM( MapSize( aS ) );
3724 :
3725 0 : CellBorder aCellBorder;
3726 0 : aCellBorder.mnPos = nXPos;
3727 0 : aCellBorder.mnLength = aM.Width;
3728 0 : if ( nLine < xRows->getCount() )
3729 : { // top border
3730 0 : uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine ), uno::UNO_QUERY_THROW );
3731 0 : uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW );
3732 0 : table::BorderLine aBorderLine;
3733 0 : if ( xPropSet2->getPropertyValue( sTopBorder ) >>= aBorderLine )
3734 0 : aCellBorder.maCellBorder = aBorderLine;
3735 : }
3736 0 : if ( nLine )
3737 : { // bottom border
3738 0 : uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine - 1 ), uno::UNO_QUERY_THROW );
3739 0 : uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW );
3740 0 : table::BorderLine aBorderLine;
3741 0 : if ( xPropSet2->getPropertyValue( sBottomBorder ) >>= aBorderLine )
3742 0 : aCellBorder.maCellBorder = aBorderLine;
3743 : }
3744 0 : vCellBorders.push_back( aCellBorder );
3745 0 : nXPos += aM.Width;
3746 0 : }
3747 0 : std::vector< CellBorder >::const_iterator aCellBorderIter( vCellBorders.begin() );
3748 0 : while( aCellBorderIter != vCellBorders.end() )
3749 : {
3750 0 : ImplCreateCellBorder( &*aCellBorderIter, aCellBorderIter->mnPos, nYPos,
3751 0 : static_cast< sal_Int32 >( aCellBorderIter->mnPos + aCellBorderIter->mnLength ), nYPos );
3752 0 : ++aCellBorderIter;
3753 : }
3754 0 : if ( nLine < xRows->getCount() )
3755 : {
3756 0 : uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nLine ), uno::UNO_QUERY_THROW );
3757 0 : awt::Size aS( 0, 0 );
3758 0 : xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
3759 0 : awt::Size aM( MapSize( aS ) );
3760 0 : nYPos += aM.Height;
3761 : }
3762 0 : }
3763 :
3764 : // creating vertical lines
3765 0 : sal_Int32 nXPos = MapPoint( rXShape->getPosition() ).X;
3766 0 : for( sal_Int32 nLine = 0; nLine < ( xColumns->getCount() + 1 ); nLine++ )
3767 : {
3768 0 : nYPos = MapPoint( rXShape->getPosition() ).Y;
3769 0 : std::vector< CellBorder > vCellBorders;
3770 0 : for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
3771 : {
3772 0 : uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nRow ), uno::UNO_QUERY_THROW );
3773 0 : awt::Size aS( 0, 0 );
3774 0 : xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
3775 0 : awt::Size aM( MapSize( aS ) );
3776 :
3777 0 : CellBorder aCellBorder;
3778 0 : aCellBorder.mnPos = nYPos;
3779 0 : aCellBorder.mnLength = aM.Height;
3780 0 : if ( nLine < xColumns->getCount() )
3781 : { // left border
3782 0 : uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine, nRow ), uno::UNO_QUERY_THROW );
3783 0 : uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW );
3784 0 : table::BorderLine aBorderLine;
3785 0 : if ( xCellSet->getPropertyValue( sLeftBorder ) >>= aBorderLine )
3786 0 : aCellBorder.maCellBorder = aBorderLine;
3787 : }
3788 0 : if ( nLine )
3789 : { // right border
3790 0 : uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine - 1, nRow ), uno::UNO_QUERY_THROW );
3791 0 : uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW );
3792 0 : table::BorderLine aBorderLine;
3793 0 : if ( xCellSet->getPropertyValue( sRightBorder ) >>= aBorderLine )
3794 0 : aCellBorder.maCellBorder = aBorderLine;
3795 : }
3796 0 : vCellBorders.push_back( aCellBorder );
3797 0 : nYPos += aM.Height;
3798 0 : }
3799 0 : std::vector< CellBorder >::const_iterator aCellBorderIter( vCellBorders.begin() );
3800 0 : while( aCellBorderIter != vCellBorders.end() )
3801 : {
3802 0 : ImplCreateCellBorder( &*aCellBorderIter, nXPos, aCellBorderIter->mnPos,
3803 0 : nXPos, static_cast< sal_Int32 >( aCellBorderIter->mnPos + aCellBorderIter->mnLength ) );
3804 0 : ++aCellBorderIter;
3805 : }
3806 0 : if ( nLine < xColumns->getCount() )
3807 : {
3808 0 : uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nLine ), uno::UNO_QUERY_THROW );
3809 0 : awt::Size aS( 0, 0 );
3810 0 : xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
3811 0 : awt::Size aM( MapSize( aS ) );
3812 0 : nXPos += aM.Width;
3813 : }
3814 0 : }
3815 0 : }
3816 0 : }
3817 : }
3818 0 : catch( uno::Exception& )
3819 : {
3820 : }
3821 0 : mpPptEscherEx->CloseContainer();
3822 0 : }
3823 :
3824 : //----------------------------------------------------------------------------------------------------------
3825 :
3826 0 : void TextObjBinary::Write( SvStream* pStrm )
3827 : {
3828 0 : sal_uInt32 nSize, nPos = pStrm->Tell();
3829 0 : *pStrm << (sal_uInt32)( EPP_TextCharsAtom << 16 ) << (sal_uInt32)0;
3830 0 : for ( sal_uInt32 i = 0; i < ParagraphCount(); ++i )
3831 0 : GetParagraph(i)->Write( pStrm );
3832 0 : nSize = pStrm->Tell() - nPos;
3833 0 : pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
3834 0 : *pStrm << (sal_uInt32)( nSize - 8 );
3835 0 : pStrm->SeekRel( nSize - 8 );
3836 0 : }
3837 :
3838 0 : void TextObjBinary::WriteTextSpecInfo( SvStream* pStrm )
3839 : {
3840 0 : sal_uInt32 nCharactersLeft( Count() );
3841 0 : if ( nCharactersLeft >= 1 )
3842 : {
3843 0 : EscherExAtom aAnimationInfoAtom( *pStrm, EPP_TextSpecInfoAtom, 0, 0 );
3844 0 : for ( sal_uInt32 i = 0; nCharactersLeft && i < ParagraphCount(); ++i )
3845 : {
3846 0 : ParagraphObj* pPtr = GetParagraph(i);
3847 0 : for ( ParagraphObj::const_iterator it = pPtr->begin(); nCharactersLeft && it != pPtr->end(); ++it )
3848 : {
3849 0 : PortionObj* pPortion = *it;
3850 0 : sal_Int32 nPortionSize = pPortion->mnTextSize >= nCharactersLeft ? nCharactersLeft : pPortion->mnTextSize;
3851 0 : sal_Int32 nFlags = 7;
3852 0 : nCharactersLeft -= nPortionSize;
3853 0 : *pStrm << static_cast< sal_uInt32 >( nPortionSize )
3854 0 : << nFlags
3855 0 : << static_cast< sal_Int16 >( 1 ) // spellinfo -> needs rechecking
3856 0 : << static_cast< sal_Int16 >( LanguageTag( pPortion->meCharLocale ).makeFallback().getLanguageType() )
3857 0 : << static_cast< sal_Int16 >( 0 ); // alt language
3858 : }
3859 : }
3860 0 : if ( nCharactersLeft )
3861 0 : *pStrm << nCharactersLeft << static_cast< sal_Int32 >( 1 ) << static_cast< sal_Int16 >( 1 );
3862 :
3863 : }
3864 6 : }
3865 :
3866 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|