1 diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp
2 index f731f78..0990ba8 100644
3 --- scp2/source/ooo/file_ooo.scp
4 +++ scp2/source/ooo/file_ooo.scp
5 @@ -361,6 +361,8 @@ STD_FILTER_FILE( gid_File_Filter_Eme, eme)
7 STD_FILTER_FILE_PATCH( gid_File_Filter_Sdfilt, sdfilt)
9 +STD_UNO_LIB_FILE( gid_File_Lib_Pptx, pptx )
11 STD_FILTER_FILE( gid_File_Filter_Icg, icg)
13 STD_FILTER_FILE( gid_File_Filter_Egi, egi)
14 diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp
15 index 08f3d34..2b93f24 100644
16 --- scp2/source/ooo/module_hidden_ooo.scp
17 +++ scp2/source/ooo/module_hidden_ooo.scp
18 @@ -141,6 +141,7 @@ Module gid_Module_Root_Files_4
19 Files = (gid_File_Dat_Root4,
21 gid_File_Filter_Sdfilt,
22 + gid_File_Filter_Pptx,
26 diff --git a/sd/prj/d.lst b/sd/prj/d.lst
27 index fd21f7c..ebc244f 100644
30 @@ -32,6 +32,7 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\simpress\statusbar
31 ..\%__SRC%\bin\sd??????.dll %_DEST%\bin%_EXT%\sd??????.dll
32 ..\%__SRC%\bin\sd*.res %_DEST%\bin%_EXT%\sd*.res
33 ..\%__SRC%\bin\sd???????.dll %_DEST%\bin%_EXT%\sd???????.dll
34 +..\%__SRC%\bin\pptx*.dll %_DEST%\bin%_EXT%\pptx*.dll
35 ..\%__SRC%\bin\emp?????.* %_DEST%\bin%_EXT%\emp?????.*
37 mkdir: %_DEST%\pck%_EXT%
38 diff --git a/sd/source/filter/pptx/eppt.hxx b/sd/source/filter/pptx/eppt.hxx
40 index 0000000..9d0ab80
42 +++ sd/source/filter/pptx/eppt.hxx
44 +/*************************************************************************
46 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
48 + * Copyright 2008 by Sun Microsystems, Inc.
50 + * OpenOffice.org - a multi-platform office productivity suite
52 + * $RCSfile: eppt.hxx,v $
55 + * This file is part of OpenOffice.org.
57 + * OpenOffice.org is free software: you can redistribute it and/or modify
58 + * it under the terms of the GNU Lesser General Public License version 3
59 + * only, as published by the Free Software Foundation.
61 + * OpenOffice.org is distributed in the hope that it will be useful,
62 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
63 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64 + * GNU Lesser General Public License version 3 for more details
65 + * (a copy is included in the LICENSE file that accompanied this code).
67 + * You should have received a copy of the GNU Lesser General Public License
68 + * version 3 along with OpenOffice.org. If not, see
69 + * <http://www.openoffice.org/license.html>
70 + * for a copy of the LGPLv3 License.
72 + ************************************************************************/
77 +#ifndef _PptEscherEx_HXX
78 +#include "escherex.hxx"
80 +#include <tools/solar.h>
81 +#include <sot/storage.hxx>
82 +#include <tools/gen.hxx>
83 +#include <vcl/graph.hxx>
84 +#include <vcl/fontcvt.hxx>
85 +#include <tools/string.hxx>
86 +#include "pptexanimations.hxx"
87 +#include <pptexsoundcollection.hxx>
89 +// ------------------------------------------------------------------------
91 +#include <vcl/mapmod.hxx>
92 +#include <com/sun/star/uno/Any.hxx>
93 +#include <com/sun/star/frame/XModel.hpp>
94 +#include <com/sun/star/drawing/FillStyle.hpp>
95 +#include <com/sun/star/drawing/LineStyle.hpp>
96 +#include <com/sun/star/drawing/DashStyle.hpp>
97 +#include <com/sun/star/drawing/HatchStyle.hpp>
98 +#include <com/sun/star/drawing/LineEndType.hpp>
99 +#include <com/sun/star/drawing/Alignment.hpp>
100 +#include <com/sun/star/drawing/TextAdjust.hpp>
101 +#include <com/sun/star/drawing/CircleKind.hpp>
102 +#include <com/sun/star/drawing/PolygonKind.hpp>
103 +#include <com/sun/star/drawing/PolygonFlags.hpp>
104 +#include <com/sun/star/drawing/XUniversalShapeDescriptor.hpp>
105 +#include <com/sun/star/drawing/XShapeGrouper.hpp>
106 +#include <com/sun/star/text/XSimpleText.hpp>
107 +#include <com/sun/star/drawing/XConnectorShape.hpp>
108 +#include <com/sun/star/drawing/BezierPoint.hpp>
109 +#include <com/sun/star/drawing/Hatch.hpp>
110 +#include <com/sun/star/drawing/LineDash.hpp>
111 +#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
112 +#include <com/sun/star/presentation/XPresentationSupplier.hpp>
113 +#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
114 +#include <com/sun/star/drawing/XMasterPageTarget.hpp>
115 +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
116 +#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
117 +#include <com/sun/star/awt/XGraphics.hpp>
118 +#include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
119 +#include <com/sun/star/presentation/AnimationEffect.hpp>
120 +#include <com/sun/star/presentation/FadeEffect.hpp>
121 +#include <com/sun/star/presentation/ClickAction.hpp>
122 +#include <com/sun/star/presentation/AnimationSpeed.hpp>
123 +#include <com/sun/star/presentation/PresentationRange.hpp>
124 +#include <com/sun/star/text/XTextFieldsSupplier.hpp>
125 +#include <com/sun/star/text/XTextField.hpp>
126 +#include <com/sun/star/container/XNamed.hpp>
127 +#include <com/sun/star/awt/FontDescriptor.hpp>
128 +#include <com/sun/star/container/XIndexContainer.hpp>
129 +#include <com/sun/star/awt/XControlModel.hpp>
130 +#include <com/sun/star/style/TabStop.hpp>
131 +#include <svx/msocximex.hxx>
132 +#include <com/sun/star/beans/XPropertySet.hpp>
133 +#include <com/sun/star/beans/XPropertyState.hpp>
134 +#include <com/sun/star/beans/XPropertySetInfo.hpp>
135 +#include <com/sun/star/awt/FontFamily.hpp>
136 +#include <com/sun/star/awt/FontPitch.hpp>
137 +#include <com/sun/star/awt/CharSet.hpp>
138 +#include <com/sun/star/text/WritingMode.hpp>
139 +#include <com/sun/star/lang/Locale.hpp>
141 +enum PageType { NORMAL = 0, MASTER = 1, NOTICE = 2, UNDEFINED = 3 };
143 +#define EPP_MAINMASTER_PERSIST_KEY 0x80010000
144 +#define EPP_MAINNOTESMASTER_PERSIST_KEY 0x80020000
145 +#define EPP_MAINSLIDE_PERSIST_KEY 0x80030000
146 +#define EPP_MAINNOTES_PERSIST_KEY 0x80040000
148 +#define EPP_Persist_Document 0x80080000
149 +#define EPP_Persist_MainMaster 0x80100000
150 +#define EPP_Persist_MainNotes 0x80200000
151 +#define EPP_Persist_Slide 0x80400000
152 +#define EPP_Persist_Notes 0x80800000
153 +#define EPP_Persist_CurrentPos 0x81000000
154 +#define EPP_Persist_VBAInfoAtom 0x84000000
155 +#define EPP_Persist_ExObj 0x88000000
157 +#define EPP_TEXTSTYLE_NORMAL 0x00000001
158 +#define EPP_TEXTSTYLE_TITLE 0x00000010
159 +#define EPP_TEXTSTYLE_BODY 0x00000100
160 +#define EPP_TEXTSTYLE_TEXT 0x00001000
163 +#define EPP_LAYOUT_TITLESLIDE 0 /* The slide is a title slide */
164 +#define EPP_LAYOUT_TITLEANDBODYSLIDE 1 /* Title and body slide */
165 +#define EPP_LAYOUT_TITLEMASTERSLIDE 2 /* Title master slide */
166 +#define EPP_LAYOUT_MASTERSLIDE 3 /* Master slide layout */
167 +#define EPP_LAYOUT_MASTERNOTES 4 /* Master notes layout */
168 +#define EPP_LAYOUT_NOTESTITLEBODY 5 /* Notes title/body layout */
169 +#define EPP_LAYOUT_HANDOUTLAYOUT 6 /* Handout layout, therefore it doesn't have placeholders except header, footer, and date */
170 +#define EPP_LAYOUT_ONLYTITLE 7 /* Only title placeholder */
171 +#define EPP_LAYOUT_2COLUMNSANDTITLE 8 /* Body of the slide has 2 columns and a title */
172 +#define EPP_LAYOUT_2ROWSANDTITLE 9 /* Slide's body has 2 rows and a title */
173 +#define EPP_LAYOUT_RIGHTCOLUMN2ROWS 10 /* Body contains 2 columns, right column has 2 rows */
174 +#define EPP_LAYOUT_LEFTCOLUMN2ROWS 11 /* Body contains 2 columns, left column has 2 rows */
175 +#define EPP_LAYOUT_BOTTOMROW2COLUMNS 12 /* Body contains 2 rows, bottom row has 2 columns */
176 +#define EPP_LAYOUT_TOPROW2COLUMN 13 /* Body contains 2 rows, top row has 2 columns */
177 +#define EPP_LAYOUT_4OBJECTS 14 /* 4 objects */
178 +#define EPP_LAYOUT_BIGOBJECT 15 /* Big object */
179 +#define EPP_LAYOUT_BLANCSLIDE 16 /* Blank slide */
180 +#define EPP_LAYOUT_TITLERIGHTBODYLEFT 17 /* Vertical title on the right, body on the left */
181 +#define EPP_LAYOUT_TITLERIGHT2BODIESLEFT 18 /* Vertical title on the right, body on the left split into 2 rows */
185 +class XStatusIndicatorRef;
190 + sal_uInt8 nPlaceHolder[ 8 ];
192 + sal_uInt8 nUsedObjectPlaceHolder;
193 + sal_uInt8 nTypeOfTitle;
194 + sal_uInt8 nTypeOfOutliner;
196 + BOOL bTitlePossible;
197 + BOOL bOutlinerPossible;
198 + BOOL bSecOutlinerPossible;
203 + sal_Bool bExtendedParameters;
204 + sal_uInt32 nParaFlags;
205 + sal_Int16 nBulletFlags;
208 + String sGraphicUrl; // String auf eine Graphic
210 + sal_uInt32 nNumberingType; // in wirlichkeit ist dies ein SvxEnum
211 + sal_uInt32 nHorzAdjust;
212 + sal_uInt32 nBulletColor;
213 + sal_Int32 nBulletOfs;
214 + sal_Int16 nStartWith; // Start der nummerierung
215 + sal_Int16 nTextOfs;
216 + sal_Int16 nBulletRealSize; // GroessenVerhaeltnis in Proz
217 + sal_Int16 nDepth; // aktuelle tiefe
218 + sal_Unicode cBulletId; // wenn Numbering Type == CharSpecial
219 + ::com::sun::star::awt::FontDescriptor aFontDesc;
221 + sal_Bool bExtendedBulletsUsed;
222 + sal_uInt16 nBulletId;
223 + sal_uInt32 nMappedNumType;
224 + sal_Bool bNumberingIsNumber;
229 + bExtendedParameters = FALSE;
234 + bExtendedBulletsUsed = FALSE;
235 + nBulletId = 0xffff;
236 + bNumberingIsNumber = sal_True;
240 +// ------------------------------------------------------------------------
242 +class EscherGraphicProvider;
243 +class PPTExBulletProvider
245 + friend struct PPTExParaSheet;
249 + SvMemoryStream aBuExPictureStream;
250 + SvMemoryStream aBuExOutlineStream;
251 + SvMemoryStream aBuExMasterStream;
253 + EscherGraphicProvider* pGraphicProv;
257 + sal_uInt16 GetId( const ByteString& rUniqueId, Size& rGraphicSize );
259 + PPTExBulletProvider();
260 + ~PPTExBulletProvider();
263 +struct FontCollectionEntry
272 + sal_Bool bIsConverted;
274 + FontCollectionEntry( const String& rName, sal_Int16 nFamily, sal_Int16 nPitch, sal_Int16 nCharSet ) :
276 + Family ( nFamily ),
278 + CharSet ( nCharSet ),
284 + FontCollectionEntry( const String& rName ) :
290 + ~FontCollectionEntry();
294 + FontCollectionEntry() {};
296 + void ImplInit( const String& rName );
299 +class VirtualDevice;
300 +class FontCollection : private List
302 + VirtualDevice* pVDev;
307 + short GetScriptDirection( const String& rText ) const;
308 + sal_uInt32 GetId( FontCollectionEntry& rFontDescriptor );
309 + sal_uInt32 GetCount() const { return List::Count(); };
310 + const FontCollectionEntry* GetById( sal_uInt32 nId );
311 + FontCollectionEntry& GetLast() { return *(FontCollectionEntry*)List::Last(); };
314 +// ------------------------------------------------------------------------
316 +#define PPTEX_STYLESHEETENTRYS 9
321 + ParaAttr_BuHardFont,
322 + ParaAttr_BuHardColor,
323 + ParaAttr_BuHardHeight,
324 + ParaAttr_BulletChar,
325 + ParaAttr_BulletFont,
326 + ParaAttr_BulletHeight,
327 + ParaAttr_BulletColor,
330 + ParaAttr_UpperDist,
331 + ParaAttr_LowerDist,
333 + ParaAttr_BulletOfs,
334 + ParaAttr_DefaultTab,
335 + ParaAttr_AsianLB_1,
336 + ParaAttr_AsianLB_2,
337 + ParaAttr_AsianLB_3,
341 + CharAttr_Underline,
343 + CharAttr_Strikeout,
346 + CharAttr_AsianOrComplexFont,
348 + CharAttr_FontHeight,
349 + CharAttr_FontColor,
350 + CharAttr_Escapement
353 +struct PPTExCharLevel
355 + sal_uInt16 mnFlags;
357 + sal_uInt16 mnAsianOrComplexFont;
358 + sal_uInt16 mnFontHeight;
359 + sal_uInt16 mnEscapement;
360 + sal_uInt32 mnFontColor;
363 +struct PPTExCharSheet
365 + PPTExCharLevel maCharLevel[ 5 ];
367 + PPTExCharSheet( int nInstance );
369 + void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
370 + FontCollection& rFontCollection, int nLevel );
371 + void Write( SvStream& rSt, PptEscherEx* pEx, sal_uInt16 nLev, sal_Bool bFirst, sal_Bool bSimpleText,
372 + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet );
376 +struct PPTExParaLevel
378 + sal_Bool mbIsBullet;
379 + sal_uInt16 mnBulletChar;
380 + sal_uInt16 mnBulletFont;
381 + sal_uInt16 mnBulletHeight;
382 + sal_uInt32 mnBulletColor;
384 + sal_uInt16 mnAdjust;
385 + sal_uInt16 mnLineFeed;
386 + sal_uInt16 mnUpperDist;
387 + sal_uInt16 mnLowerDist;
388 + sal_uInt16 mnTextOfs;
389 + sal_uInt16 mnBulletOfs;
390 + sal_uInt16 mnDefaultTab;
392 + sal_Bool mbExtendedBulletsUsed;
393 + sal_uInt16 mnBulletId;
394 + sal_uInt16 mnBulletStart;
395 + sal_uInt32 mnMappedNumType;
396 + sal_uInt32 mnNumberingType;
397 + sal_uInt16 mnAsianSettings;
401 +struct PPTExParaSheet
403 + PPTExBulletProvider& rBuProv;
405 + sal_uInt32 mnInstance;
407 + PPTExParaLevel maParaLevel[ 5 ];
408 + PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv );
410 + void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
411 + FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel );
412 + void Write( SvStream& rSt, PptEscherEx* pEx, sal_uInt16 nLev, sal_Bool bFirst, sal_Bool bSimpleText,
413 + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet );
416 +class PPTExStyleSheet
421 + PPTExCharSheet* mpCharSheet[ PPTEX_STYLESHEETENTRYS ];
422 + PPTExParaSheet* mpParaSheet[ PPTEX_STYLESHEETENTRYS ];
424 + PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv );
425 + ~PPTExStyleSheet();
427 + PPTExParaSheet& GetParaSheet( int nInstance ) { return *mpParaSheet[ nInstance ]; };
428 + PPTExCharSheet& GetCharSheet( int nInstance ) { return *mpCharSheet[ nInstance ]; };
430 + void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
431 + FontCollection& rFontCollection, int nInstance, int nLevel );
432 + sal_Bool IsHardAttribute( sal_uInt32 nInstance, sal_uInt32 nLevel, PPTExTextAttr eAttr, sal_uInt32 nValue );
434 + sal_uInt32 SizeOfTxCFStyleAtom() const;
435 + void WriteTxCFStyleAtom( SvStream& rSt );
439 +struct EPPTHyperlink
442 + sal_uInt32 nType; // bit 0-7 : type ( 1: click action to a slide )
443 + // ( 2: hyperlink url )
445 + // bit 31 : hyperlink is attached to a shape
447 + EPPTHyperlink( const String rURL, sal_uInt32 nT ) :
452 +enum PPTExOleObjEntryType
454 + NORMAL_OLE_OBJECT, OCX_CONTROL
457 +struct PPTExOleObjEntry
459 + PPTExOleObjEntryType eType;
460 + sal_uInt32 nOfsA; // offset to the EPP_ExOleObjAtom in mpExEmbed (set at creation)
461 + sal_uInt32 nOfsB; // offset to the EPP_ExOleObjStg
463 + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xControlModel;
464 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape;
466 + PPTExOleObjEntry( PPTExOleObjEntryType eT, sal_uInt32 nOfs ) :
471 +struct TextRuleEntry
474 + SvMemoryStream* pOut;
476 + TextRuleEntry( int nPg ) :
477 + nPageNumber( nPg ),
480 + ~TextRuleEntry() { delete pOut; };
483 +// ------------------------------------------------------------------------
487 + sal_uInt32 mnCurrentPos;
488 + sal_uInt32 mnCount;
489 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mXIndexAccess;
490 + GroupEntry( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & rIndex )
492 + mXIndexAccess = rIndex;
493 + mnCount =mXIndexAccess->getCount();
496 + GroupEntry( sal_uInt32 nCount )
504 +// ------------------------------------------------------------------------
510 + sal_uInt32 mnIndex;
511 + sal_uInt32 mnCurrentGroupEntry;
512 + sal_uInt32 mnMaxGroupEntry;
513 + sal_uInt32 mnGroupsClosed;
514 + GroupEntry** mpGroupEntry;
516 + void ImplResizeGroupTable( sal_uInt32 nEntrys );
520 + sal_uInt32 GetCurrentGroupIndex() const { return mnIndex; };
521 + sal_Int32 GetCurrentGroupLevel() const { return mnCurrentGroupEntry - 1; };
522 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > &
523 + GetCurrentGroupAccess() const { return mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mXIndexAccess; };
524 + sal_uInt32 GetGroupsClosed();
525 + void SkipCurrentGroup();
526 + void ResetGroupTable( sal_uInt32 nCount );
527 + void ClearGroupTable();
528 + sal_Bool EnterGroup( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & rIndex );
529 + sal_Bool GetNextGroupEntry();
538 + ::com::sun::star::uno::Any mAny;
540 + ::com::sun::star::uno::Reference
541 + < ::com::sun::star::beans::XPropertySet > mXPropSet;
543 + sal_Bool ImplGetPropertyValue( const String& rString );
544 + sal_Bool ImplGetPropertyValue( const ::com::sun::star::uno::Reference
545 + < ::com::sun::star::beans::XPropertySet > &, const String& );
549 + static sal_Bool GetPropertyValue(
550 + ::com::sun::star::uno::Any& rAny,
551 + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
552 + const String& rPropertyName,
553 + sal_Bool bTestPropertyAvailability = sal_False );
555 + static ::com::sun::star::beans::PropertyState GetPropertyState(
556 + const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > &,
557 + const String& rPropertyName );
560 +class PropStateValue : public PropValue
564 + ::com::sun::star::beans::PropertyState ePropState;
565 + ::com::sun::star::uno::Reference
566 + < ::com::sun::star::beans::XPropertyState > mXPropState;
568 + sal_Bool ImplGetPropertyValue( const String& rString, sal_Bool bGetPropertyState = TRUE );
572 +// ------------------------------------------------------------------------
575 +class PortionObj : public PropStateValue
578 + friend class ParagraphObj;
583 + void ImplConstruct( PortionObj& rPortionObj );
584 + sal_uInt32 ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef,
585 + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, String& rURL );
586 + sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
587 + void ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool bGetPropStateValue = FALSE );
591 + ::com::sun::star::beans::PropertyState meCharColor;
592 + ::com::sun::star::beans::PropertyState meCharHeight;
593 + ::com::sun::star::beans::PropertyState meFontName;
594 + ::com::sun::star::beans::PropertyState meAsianOrComplexFont;
595 + ::com::sun::star::beans::PropertyState meCharEscapement;
596 + ::com::sun::star::lang::Locale meCharLocale;
597 + sal_uInt16 mnCharAttrHard;
599 + sal_uInt32 mnCharColor;
600 + sal_uInt16 mnCharAttr;
601 + sal_uInt16 mnCharHeight;
603 + sal_uInt16 mnAsianOrComplexFont;
604 + sal_Int16 mnCharEscapement;
606 + sal_uInt32 mnTextSize;
607 + sal_Bool mbLastPortion;
609 + sal_uInt16* mpText;
610 + FieldEntry* mpFieldEntry;
612 + PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef,
613 + sal_Bool bLast, FontCollection& rFontCollection );
614 + PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
615 + FontCollection& rFontCollection );
616 + PortionObj( PortionObj& rPortionObj );
619 + void Write( SvStream* pStrm, sal_Bool bLast );
620 + sal_uInt32 Count() const { return mnTextSize; };
622 + PortionObj& operator=( PortionObj& rPortionObj );
627 + sal_Bool bFirstParagraph : 1;
628 + sal_Bool bLastParagraph : 1;
630 + ParaFlags() { bFirstParagraph = TRUE; bLastParagraph = FALSE; };
633 +class ParagraphObj : public List, public PropStateValue, public SOParagraph
635 + friend class TextObj;
636 + friend struct PPTExParaSheet;
638 + MapMode maMapModeSrc;
639 + MapMode maMapModeDest;
643 + void ImplConstruct( ParagraphObj& rParagraphObj );
645 + sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
646 + ::com::sun::star::awt::Size ImplMapSize( const ::com::sun::star::awt::Size& rSize );
647 + void ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue = FALSE );
648 + void ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue = FALSE );
652 + ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > maTabStop;
654 + sal_uInt32 mnTextSize;
656 + sal_Bool mbIsBullet;
657 + sal_Bool mbFirstParagraph;
658 + sal_Bool mbLastParagraph;
660 + ::com::sun::star::beans::PropertyState meBullet;
661 + ::com::sun::star::beans::PropertyState meTextAdjust;
662 + ::com::sun::star::beans::PropertyState meLineSpacing;
663 + ::com::sun::star::beans::PropertyState meLineSpacingTop;
664 + ::com::sun::star::beans::PropertyState meLineSpacingBottom;
665 + ::com::sun::star::beans::PropertyState meForbiddenRules;
666 + ::com::sun::star::beans::PropertyState meParagraphPunctation;
667 + ::com::sun::star::beans::PropertyState meBiDi;
669 + sal_uInt16 mnTextAdjust;
670 + sal_Int16 mnLineSpacing;
671 + sal_Bool mbFixedLineSpacing;
672 + sal_Int16 mnLineSpacingTop;
673 + sal_Int16 mnLineSpacingBottom;
674 + sal_Bool mbForbiddenRules;
675 + sal_Bool mbParagraphPunctation;
678 + ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContentRef,
679 + ParaFlags, FontCollection& rFontCollection,
680 + PPTExBulletProvider& rBuProv );
681 + ParagraphObj( ParagraphObj& rParargraphObj );
682 + ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
683 + PPTExBulletProvider& rBuProv );
685 + void CalculateGraphicBulletSize( sal_uInt16 nFontHeight );
688 + void Write( SvStream* pStrm );
689 + sal_uInt32 Count() const { return mnTextSize; };
691 + ParagraphObj& operator=( ParagraphObj& rParagraphObj );
696 + sal_uInt32 mnRefCount;
697 + sal_uInt32 mnTextSize;
700 + sal_Bool mbHasExtendedBullets;
701 + sal_Bool mbFixedCellHeightUsed;
703 + ImplTextObj( int nInstance );
709 + ImplTextObj* mpImplTextObj;
710 + void ImplCalculateTextPositions();
713 + TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > &
714 + rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv );
715 + TextObj( TextObj& rTextObj );
718 + void Write( SvStream* pStrm );
720 + ParagraphObj* First(){ return (ParagraphObj*)mpImplTextObj->mpList->First(); };
721 + ParagraphObj* Next(){ return(ParagraphObj*)mpImplTextObj->mpList->Next(); };
722 + sal_uInt32 Count() const { return mpImplTextObj->mnTextSize; };
723 + int GetInstance() const { return mpImplTextObj->mnInstance; };
724 + sal_Bool HasExtendedBullets(){ return mpImplTextObj->mbHasExtendedBullets; };
725 + void WriteTextSpecInfo( SvStream* pStrm );
727 + TextObj& operator=( TextObj& rTextObj );
730 +// ------------------------------------------------------------------------
732 +class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvider
735 + sal_Bool mbUseNewAnimations;
736 + sal_uInt32 mnStatMaxValue;
737 + sal_uInt32 mnLatestStatValue;
738 + std::vector< PPTExStyleSheet* > maStyleSheetList;
739 + PPTExStyleSheet* mpStyleSheet;
741 + EscherGraphicProvider* mpGraphicProvider;
742 + Fraction maFraction;
743 + MapMode maMapModeSrc;
744 + MapMode maMapModeDest;
745 + ::com::sun::star::awt::Size maDestPageSize;
746 + ::com::sun::star::awt::Size maNotesPageSize;
747 + PageType meLatestPageType;
748 + List maSlideNameList;
750 + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mXModel;
751 + ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mXStatusIndicator;
752 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPagesSupplier > mXDrawPagesSupplier;
753 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPagesSupplier > mXMasterPagesSupplier;
754 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > mXDrawPages;
755 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mXDrawPage;
756 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXPagePropSet;
757 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXBackgroundPropSet;
758 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mXShapes;
759 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXShape;
760 + ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > mXText; // TextRef des globalen Text
761 + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > mXCursor;
762 + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > mXCursorText; // TextRef des Teilstuecks des Cursors
763 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXCursorPropSet; // die Properties des Teilstueckes
764 + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > mXTextField;
765 + ::com::sun::star::awt::Size maSize;
766 + ::com::sun::star::awt::Point maPosition;
769 + sal_Bool mbPresObj;
770 + sal_Bool mbEmptyPresObj;
771 + sal_Bool mbStatusIndicator;
773 + sal_uInt32 mnTextStyle;
775 + sal_Bool mbFontIndependentLineSpacing;
776 + sal_uInt32 mnTextSize;
778 + SvStorageRef mrStg;
779 + SvStorageStream* mpCurUserStrm;
780 + SvStorageStream* mpStrm;
781 + SvStorageStream* mpPicStrm;
782 + PptEscherEx* mpPptEscherEx;
785 + sal_uInt32 mnVBAOleOfs;
786 + SvMemoryStream* mpVBA;
787 + sal_uInt32 mnExEmbed;
788 + SvMemoryStream* mpExEmbed;
790 + sal_uInt32 mnPages; // anzahl einzelner Slides ( ohne masterpages & notes & handout )
791 + sal_uInt32 mnMasterPages; //
792 + sal_uInt32 mnDrawings; // anzahl Slides + masterpages + notes + handout
793 + sal_uInt32 mnPagesWritten;
794 + sal_uInt32 mnUniqueSlideIdentifier;
795 + sal_uInt32 mnTxId; // Identifier determined by the HOST (PP) ????
796 + sal_uInt32 mnDiaMode; // 0 -> manuell
797 + // 1 -> halbautomatisch
798 + // 2 -> automatisch
800 + sal_uInt32 mnShapeMasterTitle;
801 + sal_uInt32 mnShapeMasterBody;
803 + List maTextRuleList; // TextRuleEntry's
806 + FontCollection maFontCollection;
807 + ppt::ExSoundCollection maSoundCollection;
809 + PHLayout& ImplGetLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const;
810 + void ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId );
813 + sal_uInt32 ImplProgBinaryTag( SvStream* pOutStrm = NULL );
814 + sal_uInt32 ImplProgBinaryTagContainer( SvStream* pOutStrm = NULL, SvMemoryStream* pBinTag = NULL );
815 + sal_uInt32 ImplProgTagContainer( SvStream* pOutStrm = NULL, SvMemoryStream* pBinTag = NULL );
816 + sal_uInt32 ImplOutlineViewInfoContainer( SvStream* pOutStrm = NULL );
817 + sal_uInt32 ImplSlideViewInfoContainer( sal_uInt32 nInstance, SvStream* pOutStrm = NULL );
818 + sal_uInt32 ImplVBAInfoContainer( SvStream* pOutStrm = NULL );
819 + sal_uInt32 ImplDocumentListContainer( SvStream* pOutStrm = NULL );
820 + sal_uInt32 ImplMasterSlideListContainer( SvStream* pOutStrm = NULL );
824 + sal_Bool ImplCreateDocumentSummaryInformation( sal_uInt32 nCnvrtFlags );
825 + sal_Bool ImplCreateCurrentUserStream();
826 + void ImplCreateHeaderFooterStrings( SvStream& rOut,
827 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet );
828 + void ImplCreateHeaderFooters( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet );
829 + sal_Bool ImplCreateDocument();
830 + sal_Bool ImplCreateHyperBlob( SvMemoryStream& rStream );
831 + sal_uInt32 ImplInsertBookmarkURL( const String& rBookmark, const sal_uInt32 nType,
832 + const String& rStringVer0, const String& rStringVer1, const String& rStringVer2, const String& rStringVer3 );
833 + sal_Bool ImplCreateMaster( sal_uInt32 nPageNum );
834 + sal_Bool ImplCreateMainNotes();
835 + sal_Bool ImplCreateSlide( sal_uInt32 nPageNum );
836 + sal_Bool ImplCreateNotes( sal_uInt32 nPageNum );
837 + void ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXBackgroundPropSet );
838 + void ImplWriteVBA( SvMemoryStream* pVBA );
839 + void ImplWriteOLE( sal_uInt32 nCnvrtFlags );
840 + sal_Bool ImplWriteAtomEnding();
842 + sal_Bool ImplInitSOIface();
843 + sal_Bool ImplSetCurrentStyleSheet( sal_uInt32 nPageNum );
844 + sal_Bool ImplGetPageByIndex( sal_uInt32 nIndex, PageType );
845 + sal_Bool ImplGetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup = FALSE );
846 + sal_uInt32 ImplGetMasterIndex( PageType ePageType );
847 + void ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt );
848 + sal_Bool ImplGetText();
849 + sal_Bool ImplCreatePresentationPlaceholder( const sal_Bool bMaster, const PageType PageType,
850 + const sal_uInt32 StyleInstance, const sal_uInt8 PlaceHolderId );
851 + sal_Bool ImplGetEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
852 + ::com::sun::star::presentation::AnimationEffect& eEffect,
853 + ::com::sun::star::presentation::AnimationEffect& eTextEffect,
854 + sal_Bool& bHasSound );
855 + void ImplWriteObjectEffect( SvStream& rSt,
856 + ::com::sun::star::presentation::AnimationEffect eEffect,
857 + ::com::sun::star::presentation::AnimationEffect eTextEffect,
858 + sal_uInt16 nOrder );
859 + void ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentation::ClickAction eAction, sal_Bool bMediaClickAction );
860 + sal_Bool ImplGetStyleSheets();
861 + void ImplWriteParagraphs( SvStream& rOutStrm, TextObj& rTextObj );
862 + void ImplWritePortions( SvStream& rOutStrm, TextObj& rTextObj );
863 + void ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance,
864 + TextRuleEntry* pTextRule, SvStream& rExtBu, EscherPropertyContainer* );
865 + void ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt );
866 + void ImplCreateShape( sal_uInt32 nType, sal_uInt32 nFlags, EscherSolverContainer& );
867 + void ImplCreateTextShape( EscherPropertyContainer&, EscherSolverContainer&, sal_Bool bFill );
869 + void ImplWritePage( const PHLayout& rLayout,
870 + EscherSolverContainer& rSolver,
871 + PageType ePageType,
873 + int nPageNumber = 0 );
874 + void ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 );
875 + void ImplCreateTable( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer,
876 + EscherPropertyContainer& aPropOpt );
877 + ::com::sun::star::awt::Point ImplMapPoint( const ::com::sun::star::awt::Point& );
878 + ::com::sun::star::awt::Size ImplMapSize( const ::com::sun::star::awt::Size& );
879 + Rectangle ImplMapRectangle( const ::com::sun::star::awt::Rectangle& );
881 + sal_Bool ImplCloseDocument(); // die font-, hyper-, Soundliste wird geschrieben ..
882 + void ImplWriteCString( SvStream&, const String&, sal_uInt32 nInstance = 0 );
885 + PPTWriter( SvStorageRef& rSvStorage,
886 + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel,
887 + ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rStatInd,
888 + SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags );
892 + sal_Bool IsValid() const { return mbStatus; };
897 diff --git a/sd/source/filter/pptx/epptdef.hxx b/sd/source/filter/pptx/epptdef.hxx
899 index 0000000..cd35da8
901 +++ sd/source/filter/pptx/epptdef.hxx
903 +/*************************************************************************
905 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
907 + * Copyright 2008 by Sun Microsystems, Inc.
909 + * OpenOffice.org - a multi-platform office productivity suite
911 + * $RCSfile: epptdef.hxx,v $
914 + * This file is part of OpenOffice.org.
916 + * OpenOffice.org is free software: you can redistribute it and/or modify
917 + * it under the terms of the GNU Lesser General Public License version 3
918 + * only, as published by the Free Software Foundation.
920 + * OpenOffice.org is distributed in the hope that it will be useful,
921 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
922 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
923 + * GNU Lesser General Public License version 3 for more details
924 + * (a copy is included in the LICENSE file that accompanied this code).
926 + * You should have received a copy of the GNU Lesser General Public License
927 + * version 3 along with OpenOffice.org. If not, see
928 + * <http://www.openoffice.org/license.html>
929 + * for a copy of the LGPLv3 License.
931 + ************************************************************************/
933 +#ifndef _EPPT_DEF_HXX
934 +#define _EPPT_DEF_HXX
936 +#include <tools/solar.h>
938 +#define EPP_FLAG_CONTAINER 0x0F // If the version field of a record
939 + // header takes on this value, the
940 + // record header marks the start of
943 +#define EPP_Unknown 0
944 +#define EPP_SubContainerCompleted 1
945 +#define EPP_IRRAtom 2
947 +#define EPP_SubContainerException 4
948 +#define EPP_ClientSignal1 6
949 +#define EPP_ClientSignal2 7
950 +#define EPP_PowerPointStateInfoAtom 10
951 +#define EPP_Document 1000
952 +#define EPP_DocumentAtom 1001
953 +#define EPP_EndDocument 1002
954 +#define EPP_SlidePersist 1003
955 +#define EPP_SlideBase 1004
956 +#define EPP_SlideBaseAtom 1005
957 +#define EPP_Slide 1006
958 +#define EPP_SlideAtom 1007
959 +#define EPP_Notes 1008
960 +#define EPP_NotesAtom 1009
961 +#define EPP_Environment 1010
962 +#define EPP_SlidePersistAtom 1011 //0x03F3
963 +#define EPP_Scheme 1012
964 +#define EPP_SchemeAtom 1013
965 +#define EPP_DocViewInfo 1014
966 +#define EPP_SslideLayoutAtom 1015
967 +#define EPP_MainMaster 1016
968 +#define EPP_SSSlideInfoAtom 1017
969 +#define EPP_SlideViewInfo 1018
970 +#define EPP_GuideAtom 1019
971 +#define EPP_ViewInfo 1020
972 +#define EPP_ViewInfoAtom 1021
973 +#define EPP_SlideViewInfoAtom 1022
974 +#define EPP_VBAInfo 1023
975 +#define EPP_VBAInfoAtom 1024
976 +#define EPP_SSDocInfoAtom 1025
977 +#define EPP_Summary 1026
978 +#define EPP_Texture 1027
979 +#define EPP_VBASlideInfo 1028
980 +#define EPP_VBASlideInfoAtom 1029
981 +#define EPP_DocRoutingSlip 1030
982 +#define EPP_OutlineViewInfo 1031
983 +#define EPP_SorterViewInfo 1032
984 +#define EPP_ExObjList 1033
985 +#define EPP_ExObjListAtom 1034
986 +#define EPP_PPDrawingGroup 1035
987 +#define EPP_PPDrawing 1036
988 +#define EPP_NamedShows 1040
989 +#define EPP_NamedShow 1041
990 +#define EPP_NamedShowSlides 1042
991 +#define EPP_List 2000
992 +#define EPP_FontCollection 2005
993 +#define EPP_ListPlaceholder 2017
994 +#define EPP_BookmarkCollection 2019
995 +#define EPP_SoundCollection 2020
996 +#define EPP_SoundCollAtom 2021
997 +#define EPP_Sound 2022
998 +#define EPP_SoundData 2023
999 +#define EPP_BookmarkSeedAtom 2025
1000 +#define EPP_GuideList 2026
1001 +#define EPP_RunArray 2028
1002 +#define EPP_RunArrayAtom 2029
1003 +#define EPP_ArrayElementAtom 2030
1004 +#define EPP_Int4ArrayAtom 2031
1005 +#define EPP_ColorSchemeAtom 2032
1007 +// these atoms first was seen in ppt2000 in a private Tag atom
1008 +#define EPP_PST_ExtendedBuGraContainer 2040 // consist of 4041
1009 +#define EPP_PST_ExtendedBuGraAtom 2041 // the instance of this atom indices the current graphic
1011 +#define EPP_OEShape 3008
1012 +#define EPP_ExObjRefAtom 3009
1013 +#define EPP_OEPlaceholderAtom 3011
1014 +#define EPP_GrColor 3020
1015 +#define EPP_GrectAtom 3025
1016 +#define EPP_GratioAtom 3031
1017 +#define EPP_Gscaling 3032
1018 +#define EPP_GpointAtom 3034
1019 +#define EPP_OEShapeAtom 3035
1020 +#define EPP_OutlineTextRefAtom 3998
1021 +#define EPP_TextHeaderAtom 3999
1022 +#define EPP_TextCharsAtom 4000
1023 +#define EPP_StyleTextPropAtom 4001
1024 +#define EPP_BaseTextPropAtom 4002
1025 +#define EPP_TxMasterStyleAtom 4003
1026 +#define EPP_TxCFStyleAtom 4004
1027 +#define EPP_TxPFStyleAtom 4005
1028 +#define EPP_TextRulerAtom 4006
1029 +#define EPP_TextBookmarkAtom 4007
1030 +#define EPP_TextBytesAtom 4008
1031 +#define EPP_TxSIStyleAtom 4009
1032 +#define EPP_TextSpecInfoAtom 4010
1033 +#define EPP_DefaultRulerAtom 4011
1035 +// these atoms first was seen in ppt2000 in a private Tag atom
1036 +#define EPP_PST_ExtendedParagraphAtom 4012
1037 +#define EPP_PST_ExtendedParagraphMasterAtom 4013
1038 +#define EPP_PST_ExtendedPresRuleContainer 4014 // consist of 4012, 4015,
1039 +#define EPP_PST_ExtendedParagraphHeaderAtom 4015 // the instance of this atom indices the current presobj
1040 + // the first UINT32 in this atom indices the current slideId
1042 +#define EPP_FontEnityAtom 4023
1043 +#define EPP_FontEmbedData 4024
1044 +#define EPP_TypeFace 4025
1045 +#define EPP_CString 4026
1046 +#define EPP_ExternalObject 4027
1047 +#define EPP_MetaFile 4033
1048 +#define EPP_ExOleObj 4034
1049 +#define EPP_ExOleObjAtom 4035
1050 +#define EPP_ExPlainLinkAtom 4036
1051 +#define EPP_CorePict 4037
1052 +#define EPP_CorePictAtom 4038
1053 +#define EPP_ExPlainAtom 4039
1054 +#define EPP_SrKinsoku 4040
1055 +#define EPP_Handout 4041
1056 +#define EPP_ExEmbed 4044
1057 +#define EPP_ExEmbedAtom 4045
1058 +#define EPP_ExLink 4046
1059 +#define EPP_ExLinkAtom_old 4047
1060 +#define EPP_BookmarkEntityAtom 4048
1061 +#define EPP_ExLinkAtom 4049
1062 +#define EPP_SrKinsokuAtom 4050
1063 +#define EPP_ExHyperlinkAtom 4051
1064 +#define EPP_ExPlain 4053
1065 +#define EPP_ExPlainLink 4054
1066 +#define EPP_ExHyperlink 4055
1067 +#define EPP_SlideNumberMCAtom 4056
1068 +#define EPP_HeadersFooters 4057
1069 +#define EPP_HeadersFootersAtom 4058
1070 +#define EPP_RecolorEntryAtom 4062
1071 +#define EPP_TxInteractiveInfoAtom 4063
1072 +#define EPP_EmFormatAtom 4065
1073 +#define EPP_CharFormatAtom 4066
1074 +#define EPP_ParaFormatAtom 4067
1075 +#define EPP_MasterText 4068
1076 +#define EPP_RecolorInfoAtom 4071
1077 +#define EPP_ExQuickTime 4073
1078 +#define EPP_ExQuickTimeMovie 4074
1079 +#define EPP_ExQuickTimeMovieData 4075
1080 +#define EPP_ExSubscription 4076
1081 +#define EPP_ExSubscriptionSection 4077
1082 +#define EPP_ExControl 4078
1083 +#define EPP_ExControlAtom 4091
1084 +#define EPP_SlideListWithText 4080 // 0x0FF0
1085 +#define EPP_AnimationInfoAtom 4081
1086 +#define EPP_InteractiveInfo 4082
1087 +#define EPP_InteractiveInfoAtom 4083
1088 +#define EPP_SlideList 4084
1089 +#define EPP_UserEditAtom 4085
1090 +#define EPP_CurrentUserAtom 4086
1091 +#define EPP_DateTimeMCAtom 4087
1092 +#define EPP_GenericDateMCAtom 4088
1093 +#define EPP_HeaderMCAtom 4089
1094 +#define EPP_FooterMCAtom 4090
1095 +#define EPP_ExMediaAtom 4100
1096 +#define EPP_ExVideo 4101
1097 +#define EPP_ExAviMovie 4102
1098 +#define EPP_ExMCIMovie 4103
1099 +#define EPP_ExMIDIAudio 4109
1100 +#define EPP_ExCDAudio 4110
1101 +#define EPP_ExWAVAudioEmbedded 4111
1102 +#define EPP_ExWAVAudioLink 4112
1103 +#define EPP_ExOleObjStg 4113
1104 +#define EPP_ExCDAudioAtom 4114
1105 +#define EPP_ExWAVAudioEmbeddedAtom 4115
1106 +#define EPP_AnimationInfo 4116
1107 +#define EPP_RTFDateTimeMCAtom 4117
1108 +#define EPP_ProgTags 5000
1109 +#define EPP_ProgStringTag 5001
1110 +#define EPP_ProgBinaryTag 5002
1111 +#define EPP_BinaryTagData 5003
1112 +#define EPP_PrintOptions 6000
1113 +#define EPP_PersistPtrFullBlock 6001
1114 +#define EPP_PersistPtrIncrementalBlock 6002
1115 +#define EPP_RulerIndentAtom 10000
1116 +#define EPP_GscalingAtom 10001
1117 +#define EPP_GrColorAtom 10002
1118 +#define EPP_GLPointAtom 10003
1120 +#define EPP_PLACEHOLDER_NONE 0 // 0 None
1121 +#define EPP_PLACEHOLDER_MASTERTITLE 1 // 1 Master title
1122 +#define EPP_PLACEHOLDER_MASTERBODY 2 // 2 Master body
1123 +#define EPP_PLACEHOLDER_MASTERCENTEREDTITLE 3 // 3 Master centered title
1124 +#define EPP_PLACEHOLDER_MASTERSUBTITLE 4 // 10 Master subtitle
1125 +#define EPP_PLACEHOLDER_MASTERNOTESSLIDEIMAGE 5 // 4 Master notes slide image
1126 +#define EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE 6 // 5 Master notes body image
1127 +#define EPP_PLACEHOLDER_MASTERDATE 7 // 6 Master date
1128 +#define EPP_PLACEHOLDER_MASTERSLIDENUMBER 8 // 7 Master slide number
1129 +#define EPP_PLACEHOLDER_MASTERFOOTER 9 // 8 Master footer
1130 +#define EPP_PLACEHOLDER_MASTERHEADER 10 // 9 Master header
1131 +#define EPP_PLACEHOLDER_GENERICTEXTOBJECT // 11 Generic text object
1132 +#define EPP_PLACEHOLDER_TITLE 13 // 12 Title
1133 +#define EPP_PLACEHOLDER_BODY 14 // 13 Body
1134 +#define EPP_PLACEHOLDER_NOTESBODY 12 // 14 Notes body
1135 +#define EPP_PLACEHOLDER_CENTEREDTITLE 15 // 15 Centered title
1136 +#define EPP_PLACEHOLDER_SUBTITLE 16 // 16 Subtitle
1137 +#define EPP_PLACEHOLDER_VERTICALTEXTTITLE 17 // 17 Vertical text title
1138 +#define EPP_PLACEHOLDER_VERTICALTEXTBODY 18 // 18 Vertical text body
1139 +#define EPP_PLACEHOLDER_NOTESSLIDEIMAGE 11 // 19 Notes slide image
1140 +#define EPP_PLACEHOLDER_OBJECT 19 // 20 Object (no matter the size)
1141 +#define EPP_PLACEHOLDER_GRAPH 20 // 21 Graph
1142 +#define EPP_PLACEHOLDER_TABLE 21 // 22 Table
1143 +#define EPP_PLACEHOLDER_CLIPART 22 // 23 Clip Art
1144 +#define EPP_PLACEHOLDER_ORGANISZATIONCHART 23 // 24 Organization Chart
1145 +#define EPP_PLACEHOLDER_MEDIACLIP 24 // 25 Media Clip
1147 +#define EPP_TEXTTYPE_Title 0
1148 +#define EPP_TEXTTYPE_Body 1
1149 +#define EPP_TEXTTYPE_Notes 2
1150 +#define EPP_TEXTTYPE_notUsed 3
1151 +#define EPP_TEXTTYPE_Other 4 // ( Text in a shape )
1152 +#define EPP_TEXTTYPE_CenterBody 5 // ( subtitle in title slide )
1153 +#define EPP_TEXTTYPE_CenterTitle 6 // ( title in title slide )
1154 +#define EPP_TEXTTYPE_HalfBody 7 // ( body in two-column slide )
1155 +#define EPP_TEXTTYPE_QuarterBody 8 // ( body in four-body slide )
1157 +#define EPP_SLIDESIZE_TYPEONSCREEN 0
1158 +#define EPP_SLIDESIZE_TYPELETTERSIZERPAPER 1
1159 +#define EPP_SLIDESIZE_TYPEA4PAPER 2
1160 +#define EPP_SLIDESIZE_TYPE35MM 3
1161 +#define EPP_SLIDESIZE_TYPEOVERHEAD 4
1162 +#define EPP_SLIDESIZE_TYPEBANNER 5
1163 +#define EPP_SLIDESIZE_TYPECUSTOM 6
1166 diff --git a/sd/source/filter/pptx/escherex.hxx b/sd/source/filter/pptx/escherex.hxx
1167 new file mode 100644
1168 index 0000000..ced7adf
1170 +++ sd/source/filter/pptx/escherex.hxx
1172 +/*************************************************************************
1174 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1176 + * Copyright 2008 by Sun Microsystems, Inc.
1178 + * OpenOffice.org - a multi-platform office productivity suite
1180 + * $RCSfile: escherex.hxx,v $
1181 + * $Revision: 1.12 $
1183 + * This file is part of OpenOffice.org.
1185 + * OpenOffice.org is free software: you can redistribute it and/or modify
1186 + * it under the terms of the GNU Lesser General Public License version 3
1187 + * only, as published by the Free Software Foundation.
1189 + * OpenOffice.org is distributed in the hope that it will be useful,
1190 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1191 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1192 + * GNU Lesser General Public License version 3 for more details
1193 + * (a copy is included in the LICENSE file that accompanied this code).
1195 + * You should have received a copy of the GNU Lesser General Public License
1196 + * version 3 along with OpenOffice.org. If not, see
1197 + * <http://www.openoffice.org/license.html>
1198 + * for a copy of the LGPLv3 License.
1200 + ************************************************************************/
1202 +#ifndef _PptEscherEX_HXX
1203 +#define _PptEscherEX_HXX
1204 +#include <svx/escherex.hxx>
1206 +// ---------------------------------------------------------------------------------------------
1207 +// Werte fuer den ULONG im PPT_PST_TextHeaderAtom
1208 +enum PPT_TextHeader
1214 + PPTTH_OTHER, // Text in a Shape
1215 + PPTTH_CENTERBODY, // Subtitle in Title-Slide
1216 + PPTTH_CENTERTITLE, // Title in Title-Slide
1217 + PPTTH_HALFBODY, // Body in two-column slide
1218 + PPTTH_QUARTERBODY // Body in four-body slide
1221 +// ---------------------------------------------------------------------------------------------
1223 +class PptEscherEx : public EscherEx
1225 + SvMemoryStream maFIDCLs;
1227 + sal_uInt32 ImplDggContainerSize();
1228 + void ImplWriteDggContainer( SvStream& rSt );
1230 + sal_uInt32 ImplDggAtomSize();
1231 + void ImplWriteDggAtom( SvStream& rSt );
1233 + sal_uInt32 ImplOptAtomSize();
1234 + void ImplWriteOptAtom( SvStream& rSt );
1236 + sal_uInt32 ImplSplitMenuColorsAtomSize();
1237 + void ImplWriteSplitMenuColorsAtom( SvStream& rSt );
1241 + PptEscherEx( SvStream& rOut, UINT32 nDrawings );
1244 + void OpenContainer( UINT16 n_EscherContainer, int nRecInstance = 0 );
1245 + void CloseContainer();
1247 + sal_uInt32 EnterGroup( Rectangle* pBoundRect, SvMemoryStream* pClientData );
1249 + UINT32 DrawingGroupContainerSize();
1250 + void WriteDrawingGroupContainer( SvStream& rSt );
1252 + using EscherEx::EnterGroup;
1257 diff --git a/sd/source/filter/pptx/exports.map b/sd/source/filter/pptx/exports.map
1258 new file mode 100644
1259 index 0000000..e69de29
1260 diff --git a/sd/source/filter/pptx/makefile.mk b/sd/source/filter/pptx/makefile.mk
1261 new file mode 100644
1262 index 0000000..239135b
1264 +++ sd/source/filter/pptx/makefile.mk
1266 +#*************************************************************************
1268 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1270 +# Copyright 2008 by Sun Microsystems, Inc.
1272 +# OpenOffice.org - a multi-platform office productivity suite
1274 +# $RCSfile: makefile.mk,v $
1276 +# $Revision: 1.15 $
1278 +# This file is part of OpenOffice.org.
1280 +# OpenOffice.org is free software: you can redistribute it and/or modify
1281 +# it under the terms of the GNU Lesser General Public License version 3
1282 +# only, as published by the Free Software Foundation.
1284 +# OpenOffice.org is distributed in the hope that it will be useful,
1285 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1286 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1287 +# GNU Lesser General Public License version 3 for more details
1288 +# (a copy is included in the LICENSE file that accompanied this code).
1290 +# You should have received a copy of the GNU Lesser General Public License
1291 +# version 3 along with OpenOffice.org. If not, see
1292 +# <http://www.openoffice.org/license.html>
1293 +# for a copy of the LGPLv3 License.
1295 +#*************************************************************************
1300 +ENABLE_EXCEPTIONS=TRUE
1301 +VISIBILITY_HIDDEN=TRUE
1303 +# --- Settings -----------------------------------------------------
1305 +.INCLUDE : settings.mk
1307 +# --- Files --------------------------------------------------------
1309 +.IF "$(COM)"=="GCC"
1310 +NOOPTFILES= $(SLO)$/pptx-epptso.obj
1313 +SLOFILES = $(SLO)$/pptx-eppt.obj \
1314 + $(SLO)$/pptx-epptbase.obj \
1315 + $(SLO)$/pptx-epptooxml.obj \
1316 + $(SLO)$/pptx-epptso.obj \
1317 + $(SLO)$/pptx-escherex.obj \
1318 + $(SLO)$/pptx-grouptable.obj \
1319 + $(SLO)$/pptx-pptexanimations.obj \
1320 + $(SLO)$/pptx-pptexsoundcollection.obj \
1321 + $(SLO)$/pptx-text.obj \
1322 + $(SLO)$/pptx-stylesheet.obj
1324 +# --- Targets --------------------------------------------------------------
1326 +.INCLUDE : target.mk
1327 diff --git a/sd/source/filter/pptx/pptexanimations.hxx b/sd/source/filter/pptx/pptexanimations.hxx
1328 new file mode 100644
1329 index 0000000..5099900
1331 +++ sd/source/filter/pptx/pptexanimations.hxx
1333 +/*************************************************************************
1335 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1337 + * Copyright 2008 by Sun Microsystems, Inc.
1339 + * OpenOffice.org - a multi-platform office productivity suite
1341 + * $RCSfile: pptexanimations.hxx,v $
1342 + * $Revision: 1.9 $
1344 + * This file is part of OpenOffice.org.
1346 + * OpenOffice.org is free software: you can redistribute it and/or modify
1347 + * it under the terms of the GNU Lesser General Public License version 3
1348 + * only, as published by the Free Software Foundation.
1350 + * OpenOffice.org is distributed in the hope that it will be useful,
1351 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1352 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1353 + * GNU Lesser General Public License version 3 for more details
1354 + * (a copy is included in the LICENSE file that accompanied this code).
1356 + * You should have received a copy of the GNU Lesser General Public License
1357 + * version 3 along with OpenOffice.org. If not, see
1358 + * <http://www.openoffice.org/license.html>
1359 + * for a copy of the LGPLv3 License.
1361 + ************************************************************************/
1363 +#ifndef _SD_PPT_EXANIMATIONS_HXX
1364 +#define _SD_PPT_EXANIMATIONS_HXX
1366 +#include <com/sun/star/animations/XTimeContainer.hpp>
1367 +#include <com/sun/star/drawing/XDrawPage.hpp>
1368 +#include <com/sun/star/animations/XAnimate.hpp>
1369 +#ifndef _SD_PPTANIMATIONS_HXX
1370 +#include "../ppt/pptanimations.hxx"
1372 +#include <pptexsoundcollection.hxx>
1373 +#include <svx/escherex.hxx>
1375 +#ifdef DBG_ANIM_LOG
1379 +#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
1380 +#include <boost/shared_ptr.hpp>
1385 +class DffRecordHeader;
1392 + struct AfterEffectNode
1394 + ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxNode;
1395 + ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxMaster;
1397 + AfterEffectNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
1398 + const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xMaster )
1399 + : mxNode( xNode ), mxMaster( xMaster ) {}
1402 + typedef boost::shared_ptr< AfterEffectNode > AfterEffectNodePtr;
1404 +typedef sal_uInt32 TranslateMode;
1405 +#define TRANSLATE_NONE 0
1406 +#define TRANSLATE_VALUE 1
1407 +#define TRANSLATE_ATTRIBUTE 2
1408 +#define TRANSLATE_MEASURE 4
1409 +#define TRANSLATE_NUMBER_TO_STRING 8
1411 +const int AFTEREFFECT_NONE = 0;
1412 +const int AFTEREFFECT_COLOR = 1;
1413 +const int AFTEREFFECT_SET = 2;
1415 +class AnimationExporter
1417 + ::com::sun::star::uno::Any aTarget;
1419 + void writeZString( SvStream& rStrm, const rtl::OUString& rVal );
1420 + sal_Bool getColorAny( const ::com::sun::star::uno::Any& rAny, const sal_Int16 nColorSpace, sal_Int32& rMode, sal_Int32& rA, sal_Int32& rB, sal_Int32& rC ) const;
1421 + sal_Bool exportAnimProperty( SvStream& rStrm, const sal_uInt16 nPropertyId, const ::com::sun::star::uno::Any& rAny, const TranslateMode eTranslateMode );
1422 + ::com::sun::star::uno::Any convertAnimateValue( const ::com::sun::star::uno::Any& rSource, const rtl::OUString& rAttributeName ) const;
1423 + void exportAnimPropertyString( SvStream& rStrm, const sal_uInt16 nPropertyId, const rtl::OUString& rVal, const TranslateMode eTranslateMode );
1424 + void exportAnimPropertyFloat( SvStream& rStrm, const sal_uInt16 nPropertyId, const double& rVal, const TranslateMode eTranslateMode );
1425 + void exportAnimPropertyuInt32( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt32 nVal, const TranslateMode eTranslateMode );
1426 + void exportAnimPropertyByte( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt8 nVal, const TranslateMode eTranslateMode );
1428 + // if available exportAnimPropertySet returns the ::com::sun::star::presentation::EffectNodeType
1429 + sal_Int16 exportAnimPropertySet( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
1430 + void exportAnimNode( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
1431 + const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >* pParent, const sal_Int32 nGroupLevel, const sal_Int16 nFillDefault );
1432 + void exportAnimate( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
1433 + void exportAnimateTarget( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_uInt32 nForceAttributeName = 0, int nAfterEffectType = AFTEREFFECT_NONE );
1434 + void exportAnimateSet( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, int nAfterEffectType );
1435 + void exportAnimAction( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
1436 + void exportAnimEvent( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_Int32 nFlags = 0 );
1437 + void exportNode( SvStream& rStrm, ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > xNode,
1438 + const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >* xParent,
1439 + const sal_uInt16 nContainerRecType, const sal_uInt16 nInstance, const sal_Int32 nGroupLevel, const sal_Bool bTakeBackInteractiveSequenceTiming,
1440 + const sal_Int16 nFillDefault );
1441 + void exportAnimateTargetElement( SvStream& rStrm, const ::com::sun::star::uno::Any aAny, const sal_Bool bCreate2b01Atom );
1442 + void exportAnimateKeyPoints( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimate >& xAnimate );
1443 + void exportAnimValue( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_Bool bExportAlways );
1444 + void exportTransitionFilter( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
1445 + void exportAnimateMotion( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
1446 + void exportAnimateTransform( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
1447 + void exportAnimateColor( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, int nAfterEffectType );
1448 + void exportIterate( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
1450 + const EscherSolverContainer& mrSolverContainer;
1451 + ppt::ExSoundCollection& mrExSoundCollection;
1452 + void processAfterEffectNodes( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
1454 + bool isAfterEffectNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
1455 + bool hasAfterEffectNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAfterEffectNode ) const;
1456 + bool isEmptyNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
1458 + ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > createAfterEffectNodeClone( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
1460 + std::list< AfterEffectNodePtr > maAfterEffectNodes;
1463 + AnimationExporter( const EscherSolverContainer& rSolverContainer, ppt::ExSoundCollection& rExSoundCollection );
1465 + void doexport( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage, SvStream& rStrm );
1467 + sal_Int32 mnCurrentGroup;
1473 diff --git a/sd/source/filter/pptx/pptexsoundcollection.hxx b/sd/source/filter/pptx/pptexsoundcollection.hxx
1474 new file mode 100644
1475 index 0000000..9dc8e54
1477 +++ sd/source/filter/pptx/pptexsoundcollection.hxx
1479 +/*************************************************************************
1481 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1483 + * Copyright 2008 by Sun Microsystems, Inc.
1485 + * OpenOffice.org - a multi-platform office productivity suite
1487 + * $RCSfile: pptexsoundcollection.hxx,v $
1488 + * $Revision: 1.4 $
1490 + * This file is part of OpenOffice.org.
1492 + * OpenOffice.org is free software: you can redistribute it and/or modify
1493 + * it under the terms of the GNU Lesser General Public License version 3
1494 + * only, as published by the Free Software Foundation.
1496 + * OpenOffice.org is distributed in the hope that it will be useful,
1497 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1498 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1499 + * GNU Lesser General Public License version 3 for more details
1500 + * (a copy is included in the LICENSE file that accompanied this code).
1502 + * You should have received a copy of the GNU Lesser General Public License
1503 + * version 3 along with OpenOffice.org. If not, see
1504 + * <http://www.openoffice.org/license.html>
1505 + * for a copy of the LGPLv3 License.
1507 + ************************************************************************/
1509 +#ifndef _SD_PPT_EXSOUNDCOLLECTION_HXX
1510 +#define _SD_PPT_EXSOUNDCOLLECTION_HXX
1512 +#ifdef DBG_ANIM_LOG
1515 +#include <tools/string.hxx>
1516 +#include <tools/stream.hxx>
1517 +#ifndef BOOST_SHARED_PTR_HPP_INCLUDED
1518 +#include <boost/shared_ptr.hpp>
1528 + sal_uInt32 nFileSize;
1531 + String ImplGetName() const;
1532 + String ImplGetExtension() const;
1536 + sal_Bool IsSameURL( const String& rURL ) const;
1537 + sal_uInt32 GetFileSize( ) const { return nFileSize; };
1539 + ExSoundEntry( const String& rSoundURL );
1541 + // returns the size of a complete SoundContainer
1542 + sal_uInt32 GetSize( sal_uInt32 nId ) const;
1543 + void Write( SvStream& rSt, sal_uInt32 nId );
1546 +class ExSoundCollection : private List
1548 + const ExSoundEntry* ImplGetByIndex( sal_uInt32 nId ) const;
1552 + ExSoundCollection() {}
1553 + ~ExSoundCollection();
1555 + sal_uInt32 GetId( const String& );
1557 + // returns the size of a complete SoundCollectionContainer
1558 + sal_uInt32 GetSize() const;
1559 + void Write( SvStream& rSt );
1565 diff --git a/sd/source/filter/pptx/pptx-eppt.cxx b/sd/source/filter/pptx/pptx-eppt.cxx
1566 new file mode 100644
1567 index 0000000..29f6829
1569 +++ sd/source/filter/pptx/pptx-eppt.cxx
1571 +/*************************************************************************
1573 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1575 + * Copyright 2008 by Sun Microsystems, Inc.
1577 + * OpenOffice.org - a multi-platform office productivity suite
1579 + * $RCSfile: eppt.cxx,v $
1580 + * $Revision: 1.64.78.1 $
1582 + * This file is part of OpenOffice.org.
1584 + * OpenOffice.org is free software: you can redistribute it and/or modify
1585 + * it under the terms of the GNU Lesser General Public License version 3
1586 + * only, as published by the Free Software Foundation.
1588 + * OpenOffice.org is distributed in the hope that it will be useful,
1589 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1590 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1591 + * GNU Lesser General Public License version 3 for more details
1592 + * (a copy is included in the LICENSE file that accompanied this code).
1594 + * You should have received a copy of the GNU Lesser General Public License
1595 + * version 3 along with OpenOffice.org. If not, see
1596 + * <http://www.openoffice.org/license.html>
1597 + * for a copy of the LGPLv3 License.
1599 + ************************************************************************/
1601 +// MARKER(update_precomp.py): autogen include statement, do not remove
1602 +#include "precompiled_sd.hxx"
1603 +#include <eppt.hxx>
1604 +#include "epptdef.hxx"
1605 +#include <tools/globname.hxx>
1606 +#include <tools/datetime.hxx>
1607 +#include <tools/poly.hxx>
1608 +#include <vcl/graph.hxx>
1609 +#include <vcl/bmpacc.hxx>
1610 +#include <vcl/gradient.hxx>
1611 +#include <rtl/ustring.hxx>
1612 +#include <tools/stream.hxx>
1613 +#include <svtools/fltcall.hxx>
1614 +#include <sfx2/docfile.hxx>
1615 +#include <svx/unoapi.hxx>
1616 +#include <svx/svdobj.hxx>
1617 +#include <svx/svdoole2.hxx>
1618 +#include <svx/svdmodel.hxx>
1619 +#include <svx/svdpage.hxx>
1620 +#include <com/sun/star/view/PaperOrientation.hpp>
1621 +#include <com/sun/star/view/PaperFormat.hpp>
1622 +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
1623 +#include <tools/zcodec.hxx>
1624 +#include <svx/svxenum.hxx>
1625 +#include <sot/storinfo.hxx>
1626 +#include <svx/msoleexp.hxx>
1627 +#include <vcl/virdev.hxx>
1628 +#include <svtools/wmf.hxx>
1629 +#include <svx/msdffimp.hxx>
1630 +#include <svx/flditem.hxx>
1631 +#include <sfx2/docinf.hxx>
1633 +#define PPT_TRANSITION_TYPE_NONE 0
1634 +#define PPT_TRANSITION_TYPE_RANDOM 1
1635 +#define PPT_TRANSITION_TYPE_BLINDS 2
1636 +#define PPT_TRANSITION_TYPE_CHECKER 3
1637 +#define PPT_TRANSITION_TYPE_COVER 4
1638 +#define PPT_TRANSITION_TYPE_DISSOLVE 5
1639 +#define PPT_TRANSITION_TYPE_FADE 6
1640 +#define PPT_TRANSITION_TYPE_PULL 7
1641 +#define PPT_TRANSITION_TYPE_RANDOM_BARS 8
1642 +#define PPT_TRANSITION_TYPE_STRIPS 9
1643 +#define PPT_TRANSITION_TYPE_WIPE 10
1644 +#define PPT_TRANSITION_TYPE_ZOOM 11
1645 +#define PPT_TRANSITION_TYPE_SPLIT 13
1647 +// effects, new in xp
1648 +#define PPT_TRANSITION_TYPE_DIAMOND 17
1649 +#define PPT_TRANSITION_TYPE_PLUS 18
1650 +#define PPT_TRANSITION_TYPE_WEDGE 19
1651 +#define PPT_TRANSITION_TYPE_PUSH 20
1652 +#define PPT_TRANSITION_TYPE_COMB 21
1653 +#define PPT_TRANSITION_TYPE_NEWSFLASH 22
1654 +#define PPT_TRANSITION_TYPE_SMOOTHFADE 23
1655 +#define PPT_TRANSITION_TYPE_WHEEL 26
1656 +#define PPT_TRANSITION_TYPE_CIRCLE 27
1658 +using namespace com::sun::star;
1660 +static PHLayout pPHLayout[] =
1662 + { EPP_LAYOUT_TITLESLIDE, { 0x0d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x10, TRUE, TRUE, FALSE },
1663 + { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1664 + { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1665 + { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, TRUE, TRUE, TRUE },
1666 + { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1667 + { EPP_LAYOUT_BLANCSLIDE, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, FALSE, FALSE, FALSE },
1668 + { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1669 + { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x14, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1670 + { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x15, 0x0d, 0x0e, TRUE, FALSE, FALSE },
1671 + { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x16, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1672 + { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1673 + { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, FALSE, FALSE },
1674 + { EPP_LAYOUT_RIGHTCOLUMN2ROWS, { 0x0d, 0x0e, 0x13, 0x13, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1675 + { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1676 + { EPP_LAYOUT_2ROWSANDTITLE, { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1677 + { EPP_LAYOUT_LEFTCOLUMN2ROWS, { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1678 + { EPP_LAYOUT_TOPROW2COLUMN, { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1679 + { EPP_LAYOUT_2ROWSANDTITLE, { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE },
1680 + { EPP_LAYOUT_4OBJECTS, { 0x0d, 0x13, 0x13, 0x13, 0x13, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, FALSE, FALSE },
1681 + { EPP_LAYOUT_ONLYTITLE, { 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, TRUE, FALSE, FALSE },
1682 + { EPP_LAYOUT_BLANCSLIDE, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, FALSE, FALSE, FALSE },
1683 + { EPP_LAYOUT_TITLERIGHT2BODIESLEFT, { 0x11, 0x12, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x11, 0x12, TRUE, TRUE, FALSE },
1684 + { EPP_LAYOUT_TITLERIGHTBODYLEFT, { 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x11, 0x12, TRUE, TRUE, FALSE },
1685 + { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x12, TRUE, TRUE, FALSE },
1686 + { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x16, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x12, TRUE, TRUE, FALSE }
1689 +//============================ PPTWriter ==================================
1691 +PPTWriter::PPTWriter( SvStorageRef& rSvStorage,
1692 + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rXModel,
1693 + ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rXStatInd,
1694 + SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags ) :
1695 + mbStatus ( sal_False ),
1696 + mbUseNewAnimations ( sal_True ),
1697 + mnLatestStatValue ( 0 ),
1698 + maFraction ( 1, 576 ),
1699 + maMapModeSrc ( MAP_100TH_MM ),
1700 + maMapModeDest ( MAP_INCH, Point(), maFraction, maFraction ),
1701 + meLatestPageType ( NORMAL ),
1702 + mXModel ( rXModel ),
1703 + mXStatusIndicator ( rXStatInd ),
1704 + mbStatusIndicator ( FALSE ),
1705 + mpCurUserStrm ( NULL ),
1707 + mpPicStrm ( NULL ),
1708 + mpPptEscherEx ( NULL ),
1709 + mnVBAOleOfs ( 0 ),
1712 + mpExEmbed ( new SvMemoryStream ),
1713 + mnPagesWritten ( 0 ),
1714 + mnTxId ( 0x7a2f64 )
1717 + if ( !ImplInitSOIface() )
1720 + FontCollectionEntry aDefaultFontDesc( String( RTL_CONSTASCII_USTRINGPARAM( "Times New Roman" ) ),
1721 + ::com::sun::star::awt::FontFamily::ROMAN,
1722 + ::com::sun::star::awt::FontPitch::VARIABLE,
1723 + RTL_TEXTENCODING_MS_1252 );
1724 + maFontCollection.GetId( aDefaultFontDesc ); // default is always times new roman
1726 + if ( !ImplGetPageByIndex( 0, NOTICE ) )
1728 + INT32 nWidth = 21000;
1729 + if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) )
1731 + INT32 nHeight = 29700;
1732 + if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) )
1735 + maNotesPageSize = ImplMapSize( ::com::sun::star::awt::Size( nWidth, nHeight ) );
1737 + if ( !ImplGetPageByIndex( 0, MASTER ) )
1740 + if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) )
1743 + if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) )
1745 + maDestPageSize = ImplMapSize( ::com::sun::star::awt::Size( nWidth, nHeight ) );
1747 + mrStg = rSvStorage;
1748 + if ( !mrStg.Is() )
1751 + // MasterPages + Slides und Notizen + NotesMasterPage
1752 + mnDrawings = mnMasterPages + ( mnPages << 1 ) + 1;
1754 + if ( mXStatusIndicator.is() )
1756 + mbStatusIndicator = TRUE;
1757 + mnStatMaxValue = ( mnPages + mnMasterPages ) * 5;
1758 + mXStatusIndicator->start( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Export" ) ),
1759 + mnStatMaxValue + ( mnStatMaxValue >> 3 ) );
1762 + SvGlobalName aGName( 0x64818d10L, 0x4f9b, 0x11cf, 0x86, 0xea, 0x00, 0xaa, 0x00, 0xb9, 0x29, 0xe8 );
1763 + mrStg->SetClass( aGName, 0, String( RTL_CONSTASCII_USTRINGPARAM( "MS PowerPoint 97" ) ) );
1765 + if ( !ImplCreateCurrentUserStream() )
1768 + mpStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Document" ) ) );
1773 + mpPicStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ) );
1775 + mpPptEscherEx = new PptEscherEx( *mpStrm, mnDrawings );
1777 + if ( !ImplGetStyleSheets() )
1780 + if ( !ImplCreateDocument() )
1783 + for ( i = 0; i < mnMasterPages; i++ )
1785 + if ( !ImplCreateMaster( i ) )
1788 + if ( !ImplCreateMainNotes() )
1790 + maTextRuleList.First(); // rewind list, so we can get the current or next entry without
1791 + // searching, all entrys are sorted#
1792 + for ( i = 0; i < mnPages; i++ )
1794 + if ( !ImplCreateSlide( i ) )
1797 + for ( i = 0; i < mnPages; i++ )
1799 + if ( !ImplCreateNotes( i ) )
1802 + if ( !ImplCloseDocument() )
1805 + if ( mbStatusIndicator )
1807 + mXStatusIndicator->setText( String( RTL_CONSTASCII_USTRINGPARAM( "PowerPoint Export" ) ) );
1808 + sal_uInt32 nValue = mnStatMaxValue + ( mnStatMaxValue >> 3 );
1809 + if ( nValue > mnLatestStatValue )
1811 + mXStatusIndicator->setValue( nValue );
1812 + mnLatestStatValue = nValue;
1816 + ImplWriteOLE( nCnvrtFlags );
1818 + ImplWriteVBA( pVBA );
1820 + if ( !ImplWriteAtomEnding() )
1823 + if ( !ImplCreateDocumentSummaryInformation( nCnvrtFlags ) )
1830 +// ---------------------------------------------------------------------------------------------
1832 +PPTWriter::~PPTWriter()
1836 + delete mpPptEscherEx;
1838 + std::vector< PPTExStyleSheet* >::iterator aStyleSheetIter( maStyleSheetList.begin() );
1839 + while( aStyleSheetIter < maStyleSheetList.end() )
1840 + delete *aStyleSheetIter++;
1842 + for ( pPtr = maTextRuleList.First(); pPtr; pPtr = maTextRuleList.Next() )
1843 + delete (TextRuleEntry*)pPtr;
1844 + for ( pPtr = maSlideNameList.First(); pPtr; pPtr = maSlideNameList.Next() )
1845 + delete (::rtl::OUString*)pPtr;
1846 + for ( pPtr = maHyperlink.First(); pPtr; pPtr = maHyperlink.Next() )
1847 + delete (EPPTHyperlink*)pPtr;
1848 + for ( pPtr = maExOleObj.First(); pPtr; pPtr = maExOleObj.Next() )
1849 + delete (PPTExOleObjEntry*)pPtr;
1851 + if ( mbStatusIndicator )
1852 + mXStatusIndicator->end();
1855 +// ---------------------------------------------------------------------------------------------
1857 +static inline sal_uInt32 PPTtoEMU( INT32 nPPT )
1859 + return (sal_uInt32)( (double)nPPT * 1587.5 );
1862 +// ---------------------------------------------------------------------------------------------
1864 +sal_Bool PPTWriter::ImplCreateCurrentUserStream()
1866 + mpCurUserStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Current User" ) ) );
1867 + if ( !mpCurUserStrm )
1869 + char pUserName[] = "Current User";
1870 + sal_uInt32 nLenOfUserName = strlen( pUserName );
1871 + sal_uInt32 nSizeOfRecord = 0x14 + ( ( nLenOfUserName + 4 ) & ~ 3 );
1873 + *mpCurUserStrm << (sal_uInt16)0 << (sal_uInt16)EPP_CurrentUserAtom << nSizeOfRecord;
1874 + *mpCurUserStrm << (sal_uInt32)0x14 // Len
1875 + << (sal_uInt32)0xe391c05f; // Magic
1877 + sal_uInt32 nEditPos = mpCurUserStrm->Tell();
1878 + *mpCurUserStrm << (sal_uInt32)0x0 // OffsetToCurrentEdit;
1879 + << (sal_uInt16)nLenOfUserName //
1880 + << (sal_uInt16)0x3f4 // DocFileVersion
1881 + << (sal_uInt8)3 // MajorVersion
1882 + << (sal_uInt8)0 // MinorVersion
1883 + << (sal_uInt16)0; // Pad Word
1884 + pUserName[ nLenOfUserName ] = 8;
1885 + mpCurUserStrm->Write( pUserName, nLenOfUserName + 1 );
1886 + for ( sal_uInt32 i = 0x15 + nLenOfUserName; i < nSizeOfRecord; i++ )
1888 + *mpCurUserStrm << (sal_uInt8)0; // pad bytes
1890 + mpCurUserStrm->Seek( nEditPos );
1894 +// ---------------------------------------------------------------------------------------------
1896 +sal_Bool PPTWriter::ImplCreateDocumentSummaryInformation( sal_uInt32 nCnvrtFlags )
1898 + uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1899 + mXModel, uno::UNO_QUERY_THROW);
1900 + uno::Reference<document::XDocumentProperties> xDocProps(
1901 + xDPS->getDocumentProperties());
1903 + if (xDocProps.is()) {
1905 + // no idea what this is...
1906 + static sal_uInt8 aGuid[ 0x52 ] =
1908 + 0x4e, 0x00, 0x00, 0x00,
1909 + '{',0,'D',0,'B',0,'1',0,'A',0,'C',0,'9',0,'6',0,'4',0,'-',0,
1910 + 'E',0,'3',0,'9',0,'C',0,'-',0,'1',0,'1',0,'D',0,'2',0,'-',0,
1911 + 'A',0,'1',0,'E',0,'F',0,'-',0,'0',0,'0',0,'6',0,'0',0,'9',0,
1912 + '7',0,'D',0,'A',0,'5',0,'6',0,'8',0,'9',0,'}',0
1914 + uno::Sequence<sal_uInt8> aGuidSeq(aGuid, 0x52);
1916 + SvMemoryStream aHyperBlob;
1917 + ImplCreateHyperBlob( aHyperBlob );
1919 + uno::Sequence<sal_uInt8> aHyperSeq(aHyperBlob.Tell());
1920 + const sal_uInt8* pBlob(
1921 + static_cast<const sal_uInt8*>(aHyperBlob.GetData()));
1922 + for (sal_Int32 j = 0; j < aHyperSeq.getLength(); ++j) {
1923 + aHyperSeq[j] = pBlob[j];
1926 + if ( nCnvrtFlags & 0x8000 )
1928 + uno::Sequence<sal_uInt8> aThumbSeq;
1929 + if ( ImplGetPageByIndex( 0, NORMAL ) &&
1930 + ImplGetPropertyValue( mXPagePropSet,
1931 + String( RTL_CONSTASCII_USTRINGPARAM( "PreviewBitmap" ) ) ) )
1934 + *static_cast<const uno::Sequence<sal_uInt8>*>(mAny.getValue());
1936 + sfx2::SaveOlePropertySet( xDocProps, mrStg,
1937 + &aThumbSeq, &aGuidSeq, &aHyperSeq);
1941 + sfx2::SaveOlePropertySet( xDocProps, mrStg,
1942 + NULL, &aGuidSeq, &aHyperSeq );
1949 +// ---------------------------------------------------------------------------------------------
1951 +void PPTWriter::ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId )
1955 + aBuExOutlineStream << (sal_uInt32)( ( EPP_PST_ExtendedParagraphHeaderAtom << 16 )
1958 + << (sal_uInt32)nSlideId
1959 + << (sal_uInt32)nInstance;
1960 + aBuExOutlineStream.Write( rSt.GetData(), rSt.Tell() );
1964 +// ---------------------------------------------------------------------------------------------
1966 +void PPTWriter::ImplCreateHeaderFooterStrings( SvStream& rStrm, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet )
1968 + if ( rXPagePropSet.is() )
1970 + rtl::OUString aString;
1971 + ::com::sun::star::uno::Any aAny;
1972 + if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "HeaderText" ) ), sal_True ) )
1974 + if ( aAny >>= aString )
1975 + ImplWriteCString( rStrm, aString, 1 );
1977 + if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FooterText" ) ), sal_True ) )
1979 + if ( aAny >>= aString )
1980 + ImplWriteCString( rStrm, aString, 2 );
1982 + if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "DateTimeText" ) ), sal_True ) )
1984 + if ( aAny >>= aString )
1985 + ImplWriteCString( rStrm, aString, 0 );
1990 +// ---------------------------------------------------------------------------------------------
1992 +void PPTWriter::ImplCreateHeaderFooters( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet )
1994 + if ( rXPagePropSet.is() )
1996 + sal_Bool bVal = sal_False;
1997 + sal_uInt32 nVal = 0;
1998 + ::com::sun::star::uno::Any aAny;
1999 + if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsHeaderVisible" ) ), sal_True ) )
2001 + if ( ( aAny >>= bVal ) && bVal )
2004 + if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFooterVisible" ) ), sal_True ) )
2006 + if ( ( aAny >>= bVal ) && bVal )
2009 + if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeVisible" ) ), sal_True ) )
2011 + if ( ( aAny >>= bVal ) && bVal )
2014 + if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsPageNumberVisible" ) ), sal_True ) )
2016 + if ( ( aAny >>= bVal ) && bVal )
2019 + if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsDateTimeFixed" ) ), sal_True ) )
2021 + if ( ( aAny >>= bVal ) && !bVal )
2026 + if ( PropValue::GetPropertyValue( aAny, rXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "DateTimeFormat" ) ), sal_True ) )
2028 + sal_Int32 nFormat = *(sal_Int32*)aAny.getValue();
2029 + SvxDateFormat eDateFormat = (SvxDateFormat)( nFormat & 0xf );
2030 + SvxTimeFormat eTimeFormat = (SvxTimeFormat)( ( nFormat >> 4 ) & 0xf );
2031 + switch( eDateFormat )
2033 + case SVXDATEFORMAT_F :
2036 + case SVXDATEFORMAT_D :
2039 + case SVXDATEFORMAT_C :
2043 + case SVXDATEFORMAT_A :
2046 + switch( eTimeFormat )
2048 + case SVXTIMEFORMAT_24_HM :
2051 + case SVXTIMEFORMAT_12_HM :
2054 + case SVXTIMEFORMAT_24_HMS :
2057 + case SVXTIMEFORMAT_12_HMS :
2066 + mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 0 );
2067 + mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
2069 + ImplCreateHeaderFooterStrings( *mpStrm, rXPagePropSet );
2070 + mpPptEscherEx->CloseContainer();
2074 +// ---------------------------------------------------------------------------------------------
2076 +sal_Bool PPTWriter::ImplCreateDocument()
2079 + sal_uInt16 nSlideType = EPP_SLIDESIZE_TYPECUSTOM;
2081 + sal_uInt32 nWidth = maDestPageSize.Width;
2082 + sal_uInt32 nHeight = maDestPageSize.Height;
2084 + if ( ( nWidth == 0x1680 ) && ( nHeight == 0x10e0 ) )
2085 + nSlideType = EPP_SLIDESIZE_TYPEONSCREEN;
2086 + else if ( ( nWidth == 0x1200 ) && ( nHeight == 0x240 ) )
2087 + nSlideType = EPP_SLIDESIZE_TYPEBANNER;
2088 + else if ( ( nWidth == 0x1950 ) && ( nHeight == 0x10e0 ) )
2089 + nSlideType = EPP_SLIDESIZE_TYPE35MM;
2090 + else if ( ( nWidth == 0x1860 ) && ( nHeight == 0x10e0 ) )
2091 + nSlideType = EPP_SLIDESIZE_TYPEA4PAPER;
2093 + mpPptEscherEx->OpenContainer( EPP_Document );
2094 + // CREATE DOCUMENT ATOM
2095 + mpPptEscherEx->AddAtom( 40, EPP_DocumentAtom, 1 );
2096 + *mpStrm << nWidth // Slide Size in Master coordinates X
2097 + << nHeight // " " " " " Y
2098 + << (INT32)maNotesPageSize.Width // Notes Page Size X
2099 + << (INT32)maNotesPageSize.Height // " " " Y
2100 + << (INT32)1 << (INT32)2; // the scale used when the Powerpoint document is embedded. the default is 1:2
2101 + mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTESMASTER_PERSIST_KEY, mpStrm->Tell() );
2102 + *mpStrm << (sal_uInt32)0 // Reference to NotesMaster ( 0 if none );
2103 + << (sal_uInt32)0 // Reference to HandoutMaster ( 0 if none );
2104 + << (sal_Int16)1 // Number of the first slide;
2105 + << nSlideType // Size of the document slides ( default: EPP_SLIDESIZETYPEONSCREEN )
2106 + << (sal_uInt8)0 // bool1 indicates if document was saved with embedded true type fonts
2107 + << (sal_uInt8)0 // bool1 indicates if the placeholders on the title slide are omitted
2108 + << (sal_uInt8)0 // bool1 right to left ( flag for Bidi version )
2109 + << (sal_uInt8)1; // bool1 visibility of comments shapes
2111 + mpPptEscherEx->PtInsert( EPP_Persist_Document, mpStrm->Tell() );
2113 + mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 3 ); //Master footer (default)
2114 + mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
2115 + *mpStrm << (sal_uInt32)0x25000d;
2116 + if ( ImplGetPageByIndex( 0, MASTER ) )
2117 + ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet );
2118 + mpPptEscherEx->CloseContainer();
2119 + mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 4 ); //NotesMaster footer (default)
2120 + mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom );
2121 + *mpStrm << (sal_uInt32)0x3d000d;
2122 + if ( ImplGetPageByIndex( 0, NOTICE ) )
2123 + ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet );
2124 + mpPptEscherEx->CloseContainer();
2126 + mpPptEscherEx->OpenContainer( EPP_SlideListWithText ); // Animation info fuer die Slides
2128 + sal_uInt32 nShapes;
2129 + sal_Bool bOtherThanPlaceHolders;
2131 + for ( i = 0; i < mnPages; i++ )
2133 + sal_uInt32 nPOffset, nPObjects;
2134 + sal_Bool bOutliner, bTitle;
2136 + bOtherThanPlaceHolders = bOutliner = bTitle = FALSE;
2139 + mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom );
2140 + mpPptEscherEx->InsertPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, mpStrm->Tell() );
2141 + *mpStrm << (sal_uInt32)0; // psrReference - logical reference to the slide persist object ( EPP_MAINSLIDE_PERSIST_KEY )
2142 + nPOffset = mpStrm->Tell();
2143 + *mpStrm << (sal_uInt32)0 // flags - only bit 3 used, if set then slide contains shapes other than placeholders
2144 + << (INT32)0 // numberTexts - number of placeholder texts stored with the persist object. Allows to display outline view without loading the slide persist objects
2145 + << (INT32)i + 0x100 // slideId - Unique slide identifier, used for OLE link monikers for example
2146 + << (sal_uInt32)0; // reserved, usualy 0
2148 + if ( !ImplGetPageByIndex( i, NORMAL ) ) // sehr aufregend: noch einmal ueber alle seiten
2150 + ImplSetCurrentStyleSheet( ImplGetMasterIndex( NORMAL ) );
2152 + const PHLayout& rLayout = ImplGetLayout( mXPagePropSet );
2154 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed >
2155 + aXName( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
2157 + if ( aXName.is() )
2159 + ::rtl::OUString aStr = aXName->getName();
2160 + ::rtl::OUString *pUStr = new ::rtl::OUString( aStr );
2161 + maSlideNameList.Insert( pUStr, LIST_APPEND );
2164 + maSlideNameList.Insert( new ::rtl::OUString(), LIST_APPEND );
2166 + nShapes = mXShapes->getCount();
2168 + sal_Bool bSecOutl = FALSE;
2169 + if ( nShapes && ( rLayout.bTitlePossible || rLayout.bOutlinerPossible ) )
2171 + for ( sal_uInt32 nIndex = 0; nIndex < nShapes; nIndex++ )
2173 + if ( !ImplGetShapeByIndex( nIndex ) )
2176 + if ( mbPresObj && ( ( mType == "presentation.Outliner" ) || ( mType == "presentation.Subtitle" ) ) )
2178 + if ( bOutliner == FALSE )
2181 + mnTextStyle = EPP_TEXTSTYLE_BODY;
2182 + sal_uInt32 nTextType = EPP_TEXTTYPE_Body;
2184 + nTextType = EPP_TEXTTYPE_HalfBody;
2185 + else if ( mType == "presentation.Subtitle" )
2186 + nTextType = EPP_TEXTTYPE_CenterBody;
2188 + TextRuleEntry* pRule = new TextRuleEntry( i );
2189 + SvMemoryStream aExtBu( 0x200, 0x200 );
2190 + if ( !mbEmptyPresObj )
2192 + ImplWriteTextStyleAtom( *mpStrm, nTextType, nPObjects, pRule, aExtBu, NULL );
2193 + ImplWriteExtParaHeader( aExtBu, nPObjects++, nTextType, i + 0x100 );
2194 + maTextRuleList.Insert( (void*)pRule, LIST_APPEND );
2195 + if ( rLayout.bSecOutlinerPossible )
2197 + if ( ( nIndex + 1 ) < nShapes )
2199 + if ( ImplGetShapeByIndex( nIndex + 1 ) && mType == "presentation.Outliner" )
2202 + TextRuleEntry* pTempRule = new TextRuleEntry( i );
2203 + SvMemoryStream aTmpStrm( 0x200, 0x200 );
2204 + if ( !mbEmptyPresObj )
2206 + ImplWriteTextStyleAtom( *mpStrm, nTextType, nPObjects, pTempRule, aTmpStrm, NULL );
2207 + ImplWriteExtParaHeader( aTmpStrm, nPObjects++, nTextType, i + 0x100 );
2208 + maTextRuleList.Insert( (void*)pTempRule, LIST_APPEND );
2214 + else if ( rLayout.bTitlePossible && ( mType == "presentation.TitleText" ) )
2216 + if ( bTitle == FALSE )
2219 + mnTextStyle = EPP_TEXTSTYLE_TITLE;
2220 + TextRuleEntry* pRule = new TextRuleEntry( i );
2221 + SvMemoryStream aExtBu( 0x200, 0x200 );
2222 + if ( !mbEmptyPresObj )
2224 + ImplWriteTextStyleAtom( *mpStrm, EPP_TEXTTYPE_Title, nPObjects, pRule, aExtBu, NULL );
2225 + ImplWriteExtParaHeader( aExtBu, nPObjects++, EPP_TEXTTYPE_Title, i + 0x100 );
2226 + maTextRuleList.Insert( (void*)pRule, LIST_APPEND );
2231 + if ( mbEmptyPresObj )
2234 + bOtherThanPlaceHolders = TRUE; // muss noch auf background und leeren Title/outliner geprueft werden !!!
2236 + if ( bOutliner && bTitle && bOtherThanPlaceHolders )
2242 + sal_uInt32 nOldPos = mpStrm->Tell();
2243 + mpStrm->Seek( nPOffset );
2244 + *mpStrm << (sal_uInt32)( ( bOtherThanPlaceHolders ) ? 4 : 0 );
2245 + *mpStrm << nPObjects;
2246 + mpStrm->Seek( nOldPos );
2249 + mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText
2251 + mpPptEscherEx->OpenContainer( EPP_SlideListWithText, 2 ); // Animation info fuer die notes
2252 + for( i = 0; i < mnPages; i++ )
2254 + if ( !ImplGetPageByIndex( i, NOTICE ) )
2257 + nShapes = mXShapes->getCount();
2259 + bOtherThanPlaceHolders = FALSE;
2262 + for ( sal_uInt32 nIndex = 0; ( nIndex < nShapes ) && ( bOtherThanPlaceHolders == FALSE ); nIndex++ )
2264 + if ( ImplGetShapeByIndex( nIndex ) && ( mType != "drawing.Page" ) )
2265 + bOtherThanPlaceHolders = TRUE;
2268 + mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom );
2269 + mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, mpStrm->Tell() );
2270 + *mpStrm << (sal_uInt32)0
2271 + << (sal_uInt32)( ( bOtherThanPlaceHolders ) ? 4 : 0 )
2273 + << (INT32)i + 0x100
2276 + mpPptEscherEx->CloseContainer(); // EPP_SlideListWithText
2278 + ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentationSupplier >
2279 + aXPresSupplier( mXModel, ::com::sun::star::uno::UNO_QUERY ); ;
2280 + if ( aXPresSupplier.is() )
2282 + ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentation >
2283 + aXPresentation( aXPresSupplier->getPresentation() );
2284 + if ( aXPresentation.is() )
2286 + mXPropSet = ::com::sun::star::uno::Reference<
2287 + ::com::sun::star::beans::XPropertySet >
2288 + ( aXPresentation, ::com::sun::star::uno::UNO_QUERY );
2289 + if ( mXPropSet.is() )
2291 + ::rtl::OUString aCustomShow;
2292 + sal_uInt32 nPenColor = 0x1000000;
2293 + INT32 nRestartTime = 0x7fffffff;
2294 + sal_Int16 nStartSlide = 0;
2295 + sal_Int16 nEndSlide = 0;
2296 + sal_uInt32 nFlags = 0; // Bit 0: Auto advance
2297 + // Bit 1 Skip builds ( do not allow slide effects )
2298 + // Bit 2 Use slide range
2299 + // Bit 3 Use named show
2300 + // Bit 4 Browse mode on
2301 + // Bit 5 Kiosk mode on
2302 + // Bit 7 loop continously
2303 + // Bit ? show scrollbar
2305 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CustomShow" ) ) ) )
2307 + aCustomShow = ( *(::rtl::OUString*)mAny.getValue() );
2308 + if ( aCustomShow.getLength() )
2313 + if ( ( nFlags & 8 ) == 0 )
2315 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "FirstPage" ) ) ) )
2317 + ::rtl::OUString aSlideName( *(::rtl::OUString*)mAny.getValue() );
2318 + ::rtl::OUString* pStr;
2319 + for ( pStr = (::rtl::OUString*)maSlideNameList.First(); pStr;
2320 + pStr = (::rtl::OUString*)maSlideNameList.Next(), nStartSlide++ )
2322 + if ( *pStr == aSlideName )
2326 + nEndSlide = (sal_uInt16)mnPages;
2335 +// if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "DiaName" ) ) ) )
2338 +// if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsAlwaysOnTop" ) ) ) )
2341 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ) ) )
2343 + sal_Bool bBool = sal_False;
2349 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsEndless" ) ) ) ) // muesste eigendlich heissen IsNotEndless !=)"§()&
2351 + sal_Bool bBool = sal_False;
2356 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsFullScreen" ) ) ) )
2358 + sal_Bool bBool = sal_False;
2363 +// if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsMouseVisible" ) ) ) )
2366 +// if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ) ) )
2369 +// if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "StartWithNavigator" ) ) ) )
2372 +// if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "UsePen" ) ) ) )
2375 + mpPptEscherEx->AddAtom( 80, EPP_SSDocInfoAtom, 1 );
2376 + *mpStrm << nPenColor << nRestartTime << nStartSlide << nEndSlide;
2378 + sal_uInt32 nCustomShowNameLen = aCustomShow.getLength();
2379 + if ( nCustomShowNameLen > 31 )
2380 + nCustomShowNameLen = 31;
2381 + if ( nCustomShowNameLen ) // named show identifier
2383 + const sal_Unicode* pCustomShow = aCustomShow.getStr();
2384 + for ( i = 0; i < nCustomShowNameLen; i++ )
2386 + *mpStrm << (sal_uInt16)( pCustomShow[ i ] );
2389 + for ( i = nCustomShowNameLen; i < 32; i++, *mpStrm << (sal_uInt16)0 ) ;
2391 + *mpStrm << nFlags;
2392 + ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XCustomPresentationSupplier >
2393 + aXCPSup( mXModel, ::com::sun::star::uno::UNO_QUERY );
2394 + if ( aXCPSup.is() )
2396 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
2397 + aXCont( aXCPSup->getCustomPresentations() );
2398 + if ( aXCont.is() )
2400 + ::com::sun::star::uno::Sequence< ::rtl::OUString> aNameSeq( aXCont->getElementNames() );
2401 + const ::rtl::OUString* pUString = aNameSeq.getArray();
2402 + sal_uInt32 nCount = aNameSeq.getLength();
2405 + mpPptEscherEx->OpenContainer( EPP_NamedShows );
2406 + sal_uInt32 nCustomShowIndex = 0;
2407 + for( i = 0; i < nCount; i++ ) // Anzahl der Custom Shows
2409 + if ( pUString[ i ].getLength() )
2411 + mpPptEscherEx->OpenContainer( EPP_NamedShow, nCustomShowIndex++ );
2413 + sal_uInt32 nNamedShowLen = pUString[ i ].getLength();
2414 + if ( nNamedShowLen > 31 )
2415 + nNamedShowLen = 31;
2416 + mpPptEscherEx->AddAtom( nNamedShowLen << 1, EPP_CString );
2417 + const sal_Unicode* pCustomShowName = pUString[ i ].getStr();
2418 + for ( sal_uInt32 k = 0; k < nNamedShowLen; *mpStrm << (sal_uInt16)( pCustomShowName[ k++ ] ) ) ;
2419 + mAny = aXCont->getByName( pUString[ i ] );
2420 + if ( mAny.getValue() )
2423 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > aXIC;
2424 + if ( mAny >>= aXIC )
2426 + mpPptEscherEx->BeginAtom();
2428 + INT32 nSlideCount = aXIC->getCount();
2429 + for ( INT32 j = 0; j < nSlideCount; j++ ) // Anzahl der Slides
2431 + mAny = aXIC->getByIndex( j );
2432 + if ( mAny.getValue() )
2434 + ::com::sun::star::uno::Reference<
2435 + ::com::sun::star::drawing::XDrawPage > aXDrawPage;
2436 + if ( mAny >>= aXDrawPage )
2438 + ::com::sun::star::uno::Reference<
2439 + ::com::sun::star::container::XNamed >
2440 + aXName( aXDrawPage, ::com::sun::star::uno::UNO_QUERY );
2441 + if ( aXName.is() )
2443 + ::rtl::OUString aSlideName( aXName->getName() );
2444 + sal_uInt32 nPageNumber = 0;
2445 + for ( ::rtl::OUString* pSlideName = (::rtl::OUString*)maSlideNameList.First();
2447 + pSlideName = (::rtl::OUString*)maSlideNameList.Next(), nPageNumber++ )
2449 + if ( *pSlideName == aSlideName )
2451 + *mpStrm << (sal_uInt32)( nPageNumber + 0x100 ); // unique slide id
2459 + mpPptEscherEx->EndAtom( EPP_NamedShowSlides );
2462 + mpPptEscherEx->CloseContainer(); // EPP_NamedShow
2465 + mpPptEscherEx->CloseContainer(); // EPP_NamedShows
2472 + mpPptEscherEx->AddAtom( 0, EPP_EndDocument );
2473 + mpPptEscherEx->CloseContainer(); // EPP_Document
2477 +// ---------------------------------------------------------------------------------------------
2479 +sal_Bool PPTWriter::ImplCreateHyperBlob( SvMemoryStream& rStrm )
2481 + sal_uInt32 nCurrentOfs, nParaOfs, nParaCount = 0;
2482 +// SfxOlePropertySection does this...
2483 +// rStrm << (sal_uInt32)0x41; // property type VT_BLOB
2484 + nParaOfs = rStrm.Tell();
2485 + rStrm << (sal_uInt32)0; // property size
2486 + rStrm << (sal_uInt32)0; // property count
2488 + for ( EPPTHyperlink* pLink = (EPPTHyperlink*)maHyperlink.First(); pLink; pLink = (EPPTHyperlink*)maHyperlink.Next() )
2491 + rStrm << (sal_uInt32)3 // Type VT_I4
2492 + << (sal_uInt32)7 // (VTI4 - Private1)
2493 + << (sal_uInt32)3 // Type VT_I4
2494 + << (sal_uInt32)6 // (VTI4 - Private2)
2495 + << (sal_uInt32)3 // Type VT_I4
2496 + << (sal_uInt32)0; // (VTI4 - Private3)
2499 + // HIWORD: = 0 : do not change anything
2500 + // = 1 : replace the hyperlink with the target and subadress in the following two VTLPWSTR
2501 + // = 2 : delete the hyperlink
2502 + // LOWORD: = 0 : graphic shown as background (link)
2503 + // = 1 : graphic shown as shape (link)
2504 + // = 2 : graphic is used to fill a shape
2505 + // = 3 : graphic used to fill a shape outline (future use)
2506 + // = 4 : hyperlink attached to a shape
2507 + // = 5 : " " " " (Word) field
2508 + // = 6 : " " " " (Excel) range
2509 + // = 7 : " " " " (PPT) text range
2510 + // = 8 : " " " " (Project) task
2512 + sal_uInt32 nUrlLen = pLink->aURL.Len();
2513 + const sal_Unicode* pUrl = pLink->aURL.GetBuffer();
2515 + sal_uInt32 nInfo = 7;
2517 + rStrm << (sal_uInt32)3 // Type VT_I4
2520 + switch( pLink->nType & 0xff )
2522 + case 1 : // click action to slidenumber
2524 + rStrm << (sal_uInt32)0x1f << (sal_uInt32)1 << (sal_uInt32)0; // path
2525 + rStrm << (sal_uInt32)0x1f << (sal_uInt32)( nUrlLen + 1 );
2526 + for ( sal_uInt32 i = 0; i < nUrlLen; i++ )
2528 + rStrm << pUrl[ i ];
2530 + rStrm << (sal_uInt16)0;
2537 + rStrm << (sal_uInt32)0x1f
2538 + << (sal_uInt32)( nUrlLen + 1 );
2539 + for ( i = 0; i < nUrlLen; i++ )
2541 + rStrm << pUrl[ i ];
2543 + if ( ! ( i & 1 ) )
2544 + rStrm << (sal_uInt16)0;
2545 + rStrm << (sal_uInt16)0
2546 + << (sal_uInt32)0x1f
2553 + nCurrentOfs = rStrm.Tell();
2554 + rStrm.Seek( nParaOfs );
2555 + rStrm << (sal_uInt32)( nCurrentOfs - ( nParaOfs + 4 ) );
2556 + rStrm << nParaCount;
2557 + rStrm.Seek( nCurrentOfs );
2561 +PHLayout& PPTWriter::ImplGetLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const
2563 + ::com::sun::star::uno::Any aAny;
2564 + sal_Int16 nLayout = 20;
2565 + if ( GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Layout" ) ) ), sal_True )
2568 + if ( ( nLayout >= 21 ) && ( nLayout <= 26 ) ) // NOTES _> HANDOUT6
2570 + if ( ( nLayout >= 27 ) && ( nLayout <= 30 ) ) // VERTICAL LAYOUT
2572 + else if ( nLayout > 30 )
2574 + return pPHLayout[ nLayout ];
2578 +// ---------------------------------------------------------------------------------------------
2580 +sal_Bool PPTWriter::ImplCreateMaster( sal_uInt32 nPageNum )
2582 + if ( !ImplGetPageByIndex( nPageNum, MASTER ) )
2584 + ImplSetCurrentStyleSheet( nPageNum );
2586 + if ( !ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) ) ) // Backgroundshape laden
2588 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet;
2589 + if ( !( mAny >>= aXBackgroundPropSet ) )
2592 + sal_uInt32 nFillColor = 0xffffff;
2593 + sal_uInt32 nFillBackColor = 0x000000;
2595 + ::com::sun::star::drawing::FillStyle aFS = ::com::sun::star::drawing::FillStyle_NONE;
2596 + if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) )
2600 + case ::com::sun::star::drawing::FillStyle_GRADIENT :
2602 + if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ) ) ) )
2604 + nFillColor = EscherPropertyContainer::GetGradientColor( (::com::sun::star::awt::Gradient*)mAny.getValue(), 0 );
2605 + nFillBackColor = EscherPropertyContainer::GetGradientColor( (::com::sun::star::awt::Gradient*)mAny.getValue(), 1 );
2610 + case ::com::sun::star::drawing::FillStyle_SOLID :
2612 + if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) )
2614 + nFillColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) );
2615 + nFillBackColor = nFillColor ^ 0xffffff;
2624 + mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainMaster | nPageNum, mpStrm->Tell() );
2625 + mpPptEscherEx->OpenContainer( EPP_MainMaster );
2626 + mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 );
2627 + *mpStrm << (INT32)EPP_LAYOUT_TITLEANDBODYSLIDE // slide layout -> title and body slide
2628 + << (sal_uInt8)1 << (sal_uInt8)2 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 // placeholderID
2629 + << (sal_uInt32)0 // master ID ( ist gleich null bei einer masterpage )
2630 + << (sal_uInt32)0 // notes ID ( ist gleich null wenn keine notizen vorhanden )
2631 + << (sal_uInt16)0 // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background
2632 + << (sal_uInt16)0; // padword
2634 + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
2635 + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
2636 + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
2637 + *mpStrm << (sal_uInt32)0xff0000 << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x00ffff << (sal_uInt32)0x0099ff << (sal_uInt32)0xffff00 << (sal_uInt32)0x0000ff << (sal_uInt32)0x969696;
2638 + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
2639 + *mpStrm << (sal_uInt32)0xccffff << (sal_uInt32)0x000000 << (sal_uInt32)0x336666 << (sal_uInt32)0x008080 << (sal_uInt32)0x339933 << (sal_uInt32)0x000080 << (sal_uInt32)0xcc3300 << (sal_uInt32)0x66ccff;
2640 + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
2641 + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x333333 << (sal_uInt32)0x000000 << (sal_uInt32)0xdddddd << (sal_uInt32)0x808080 << (sal_uInt32)0x4d4d4d << (sal_uInt32)0xeaeaea;
2642 + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
2643 + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x66ccff << (sal_uInt32)0xff0000 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xc0c0c0;
2644 + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
2645 + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xc0c0c0 << (sal_uInt32)0xff6600 << (sal_uInt32)0x0000ff << (sal_uInt32)0x009900;
2646 + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 );
2647 + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xff9933 << (sal_uInt32)0xccff99 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xb2b2b2;
2649 + for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
2651 + if ( nInstance == EPP_TEXTTYPE_notUsed )
2654 + // the auto color is dependent to the page background,so we have to set a page that is in the right context
2655 + if ( nInstance == EPP_TEXTTYPE_Notes )
2656 + ImplGetPageByIndex( 0, NOTICE );
2658 + ImplGetPageByIndex( 0, MASTER );
2660 + mpPptEscherEx->BeginAtom();
2662 + sal_Bool bFirst = TRUE;
2663 + sal_Bool bSimpleText = FALSE;
2665 + *mpStrm << (sal_uInt16)5; // paragraph count
2667 + for ( sal_uInt16 nLev = 0; nLev < 5; nLev++ )
2669 + if ( nInstance >= EPP_TEXTTYPE_CenterBody )
2672 + bSimpleText = TRUE;
2675 + mpStyleSheet->mpParaSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet );
2676 + mpStyleSheet->mpCharSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet );
2679 + mpPptEscherEx->EndAtom( EPP_TxMasterStyleAtom, 0, nInstance );
2681 + ImplGetPageByIndex( nPageNum, MASTER );
2683 + EscherSolverContainer aSolverContainer;
2685 + mpPptEscherEx->OpenContainer( EPP_PPDrawing );
2686 + mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
2688 + mpPptEscherEx->EnterGroup(0,0);
2689 + ImplWritePage( pPHLayout[ 0 ], aSolverContainer, MASTER, TRUE ); // Die Shapes der Seite werden im PPT Dok. erzeugt
2690 + mpPptEscherEx->LeaveGroup();
2692 + ImplWriteBackground( aXBackgroundPropSet );
2694 + aSolverContainer.WriteSolver( *mpStrm );
2696 + mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
2697 + mpPptEscherEx->CloseContainer(); // EPP_Drawing
2698 + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
2699 + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
2701 + if ( aBuExMasterStream.Tell() )
2703 + ImplProgTagContainer( mpStrm, &aBuExMasterStream );
2705 + mpPptEscherEx->CloseContainer(); // EPP_MainMaster
2709 +// ---------------------------------------------------------------------------------------------
2711 +sal_Bool PPTWriter::ImplCreateMainNotes()
2713 + if ( !ImplGetPageByIndex( 0, NOTICE ) )
2715 + ImplSetCurrentStyleSheet( 0 );
2717 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget >
2718 + aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
2720 + if ( !aXMasterPageTarget.is() )
2723 + mXDrawPage = aXMasterPageTarget->getMasterPage();
2724 + if ( !mXDrawPage.is() )
2727 + mXPropSet = ::com::sun::star::uno::Reference<
2728 + ::com::sun::star::beans::XPropertySet >
2729 + ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
2730 + if ( !mXPropSet.is() )
2733 + mXShapes = ::com::sun::star::uno::Reference<
2734 + ::com::sun::star::drawing::XShapes >
2735 + ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
2736 + if ( !mXShapes.is() )
2739 + EscherSolverContainer aSolverContainer;
2741 + mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainNotes, mpStrm->Tell() );
2742 + mpPptEscherEx->OpenContainer( EPP_Notes );
2743 + mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 );
2744 + *mpStrm << (sal_uInt32)0x80000001 // Number that identifies this slide
2745 + << (sal_uInt32)0; // follow nothing
2746 + mpPptEscherEx->OpenContainer( EPP_PPDrawing );
2747 + mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
2748 + mpPptEscherEx->EnterGroup(0,0);
2750 + ImplWritePage( pPHLayout[ 20 ], aSolverContainer, NOTICE, TRUE );
2752 + mpPptEscherEx->LeaveGroup();
2753 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
2754 + mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 );
2755 + EscherPropertyContainer aPropOpt;
2756 + aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color
2757 + aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
2758 + aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x68bdde );
2759 + aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x8b9f8e );
2760 + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
2761 + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0 );
2762 + aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
2763 + aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape
2764 + aPropOpt.Commit( *mpStrm );
2765 + mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
2767 + aSolverContainer.WriteSolver( *mpStrm );
2769 + mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
2770 + mpPptEscherEx->CloseContainer(); // EPP_Drawing
2771 + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
2772 + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
2773 + mpPptEscherEx->CloseContainer(); // EPP_Notes
2777 +// ---------------------------------------------------------------------------------------------
2779 +sal_Bool PPTWriter::ImplCreateSlide( sal_uInt32 nPageNum )
2781 + ::com::sun::star::uno::Any aAny;
2783 + if ( !ImplGetPageByIndex( nPageNum, NORMAL ) )
2785 + sal_uInt32 nMasterID = ImplGetMasterIndex( NORMAL );
2786 + ImplSetCurrentStyleSheet( nMasterID );
2787 + nMasterID |= 0x80000000;
2789 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet;
2790 + sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) );
2791 + if ( bHasBackground )
2792 + bHasBackground = ( aAny >>= aXBackgroundPropSet );
2794 + sal_uInt16 nMode = 7; // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background
2795 + if ( bHasBackground )
2798 +/* sj: Don't know what's IsBackgroundVisible for, have to ask cl
2799 + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundVisible" ) ) ) )
2801 + sal_Bool bBackgroundVisible;
2802 + if ( aAny >>= bBackgroundVisible )
2804 + if ( bBackgroundVisible )
2809 + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundObjectsVisible" ) ) ) )
2811 + sal_Bool bBackgroundObjectsVisible = sal_False;
2812 + if ( aAny >>= bBackgroundObjectsVisible )
2814 + if ( !bBackgroundObjectsVisible )
2819 + const PHLayout& rLayout = ImplGetLayout( mXPagePropSet );
2820 + mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Slide | nPageNum, mpStrm->Tell() );
2821 + mpPptEscherEx->OpenContainer( EPP_Slide );
2822 + mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 );
2823 + *mpStrm << rLayout.nLayout;
2824 + mpStrm->Write( rLayout.nPlaceHolder, 8 ); // placeholderIDs ( 8Stueck )
2825 + *mpStrm << (sal_uInt32)nMasterID // master ID ( ist gleich 0x80000000 bei einer masterpage )
2826 + << (sal_uInt32)nPageNum + 0x100 // notes ID ( ist gleich null wenn keine notizen vorhanden )
2828 + << (sal_uInt16)0; // padword
2831 + sal_Bool bVisible = sal_True;
2832 + ::com::sun::star::presentation::FadeEffect eFe = ::com::sun::star::presentation::FadeEffect_NONE;
2834 + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ) ) )
2835 + aAny >>= bVisible;
2836 + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Change" ) ) ) )
2838 + switch ( *(INT32*)aAny.getValue() )
2840 + case 1 : // automatisch
2842 + case 2 : // halbautomatisch
2845 + case 0 : // manuell
2849 + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ) ) )
2852 + sal_uInt32 nSoundRef = 0;
2853 + sal_Bool bIsSound = sal_False;
2854 + sal_Bool bStopSound = sal_False;
2855 + sal_Bool bLoopSound = sal_False;
2857 + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) )
2859 + rtl::OUString aSoundURL;
2860 + if ( aAny >>= aSoundURL )
2862 + nSoundRef = maSoundCollection.GetId( aSoundURL );
2863 + bIsSound = sal_True;
2866 + aAny >>= bStopSound;
2868 + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" ) ) ) )
2869 + aAny >>= bLoopSound;
2872 + sal_Bool bNeedsSSSlideInfoAtom = ( bVisible == FALSE )
2873 + || ( mnDiaMode == 2 )
2876 + || ( eFe != ::com::sun::star::presentation::FadeEffect_NONE );
2877 + if ( bNeedsSSSlideInfoAtom )
2879 + sal_uInt8 nDirection = 0;
2880 + sal_uInt8 nTransitionType = 0;
2881 + sal_uInt16 nBuildFlags = 1; // advange by mouseclick
2882 + INT32 nSlideTime = 0; // muss noch !!!
2883 + sal_uInt8 nSpeed = 1;
2885 + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ) ) )
2887 + ::com::sun::star::presentation::AnimationSpeed aAs;
2889 + nSpeed = (sal_uInt8)aAs;
2891 + sal_Int16 nTT = 0, nTST = 0;
2892 + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ) )
2893 + && ( aAny >>= nTT ) )
2895 + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionSubtype" ) ) )
2896 + && ( aAny >>= nTST ) )
2900 + case animations::TransitionType::FADE :
2902 + if ( nTST == animations::TransitionSubType::CROSSFADE )
2903 + nTransitionType = PPT_TRANSITION_TYPE_SMOOTHFADE;
2904 + else if ( nTST == animations::TransitionSubType::FADEOVERCOLOR )
2905 + nTransitionType = PPT_TRANSITION_TYPE_FADE;
2908 + case PPT_TRANSITION_TYPE_COMB :
2910 + nTransitionType = PPT_TRANSITION_TYPE_COMB;
2911 + if ( nTST == animations::TransitionSubType::COMBVERTICAL )
2915 + case animations::TransitionType::PUSHWIPE :
2917 + nTransitionType = PPT_TRANSITION_TYPE_PUSH;
2920 + case animations::TransitionSubType::FROMRIGHT: nDirection = 0; break;
2921 + case animations::TransitionSubType::FROMBOTTOM: nDirection = 1; break;
2922 + case animations::TransitionSubType::FROMLEFT: nDirection = 2; break;
2923 + case animations::TransitionSubType::FROMTOP: nDirection = 3; break;
2927 + case animations::TransitionType::PINWHEELWIPE :
2929 + nTransitionType = PPT_TRANSITION_TYPE_WHEEL;
2932 + case animations::TransitionSubType::ONEBLADE: nDirection = 1; break;
2933 + case animations::TransitionSubType::TWOBLADEVERTICAL : nDirection = 2; break;
2934 + case animations::TransitionSubType::THREEBLADE : nDirection = 3; break;
2935 + case animations::TransitionSubType::FOURBLADE: nDirection = 4; break;
2936 + case animations::TransitionSubType::EIGHTBLADE: nDirection = 8; break;
2940 + case animations::TransitionType::FANWIPE :
2942 + nTransitionType = PPT_TRANSITION_TYPE_WEDGE;
2945 + case animations::TransitionType::ELLIPSEWIPE :
2947 + nTransitionType = PPT_TRANSITION_TYPE_CIRCLE;
2950 + case animations::TransitionType::FOURBOXWIPE :
2952 + nTransitionType = PPT_TRANSITION_TYPE_PLUS;
2955 + case animations::TransitionType::IRISWIPE :
2957 + nTransitionType = PPT_TRANSITION_TYPE_DIAMOND;
2963 + if ( !nTransitionType )
2968 + case ::com::sun::star::presentation::FadeEffect_RANDOM :
2969 + nTransitionType = PPT_TRANSITION_TYPE_RANDOM;
2972 + case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_STRIPES :
2974 + case ::com::sun::star::presentation::FadeEffect_VERTICAL_STRIPES :
2975 + nTransitionType = PPT_TRANSITION_TYPE_BLINDS;
2978 + case ::com::sun::star::presentation::FadeEffect_VERTICAL_CHECKERBOARD :
2980 + case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_CHECKERBOARD :
2981 + nTransitionType = PPT_TRANSITION_TYPE_CHECKER;
2984 + case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERLEFT :
2986 + case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERRIGHT :
2988 + case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERLEFT :
2990 + case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERRIGHT :
2992 + case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_TOP :
2994 + case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LEFT :
2996 + case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_BOTTOM :
2998 + case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_RIGHT :
2999 + nTransitionType = PPT_TRANSITION_TYPE_COVER;
3002 + case ::com::sun::star::presentation::FadeEffect_DISSOLVE :
3003 + nTransitionType = PPT_TRANSITION_TYPE_DISSOLVE;
3006 + case ::com::sun::star::presentation::FadeEffect_VERTICAL_LINES :
3008 + case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_LINES :
3009 + nTransitionType = PPT_TRANSITION_TYPE_RANDOM_BARS;
3012 + case ::com::sun::star::presentation::FadeEffect_CLOSE_HORIZONTAL :
3014 + case ::com::sun::star::presentation::FadeEffect_OPEN_HORIZONTAL :
3016 + case ::com::sun::star::presentation::FadeEffect_CLOSE_VERTICAL :
3018 + case ::com::sun::star::presentation::FadeEffect_OPEN_VERTICAL :
3019 + nTransitionType = PPT_TRANSITION_TYPE_SPLIT;
3022 + case ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERLEFT :
3024 + case ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERRIGHT :
3026 + case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERLEFT :
3028 + case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERRIGHT :
3030 + nTransitionType = PPT_TRANSITION_TYPE_STRIPS;
3033 + case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT :
3035 + case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERLEFT :
3037 + case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT :
3039 + case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERLEFT :
3041 + case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_BOTTOM :
3043 + case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_RIGHT :
3045 + case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_TOP :
3047 + case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LEFT :
3048 + nTransitionType = PPT_TRANSITION_TYPE_PULL;
3051 + case ::com::sun::star::presentation::FadeEffect_FADE_FROM_TOP :
3053 + case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LEFT :
3055 + case ::com::sun::star::presentation::FadeEffect_FADE_FROM_BOTTOM :
3057 + case ::com::sun::star::presentation::FadeEffect_FADE_FROM_RIGHT :
3058 + nTransitionType = PPT_TRANSITION_TYPE_WIPE;
3061 + case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_TOP :
3063 + case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_LEFT :
3065 + case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_BOTTOM :
3067 + case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_RIGHT :
3068 + nTransitionType = PPT_TRANSITION_TYPE_WIPE;
3071 + case ::com::sun::star::presentation::FadeEffect_FADE_TO_CENTER :
3073 + case ::com::sun::star::presentation::FadeEffect_FADE_FROM_CENTER :
3074 + nTransitionType = PPT_TRANSITION_TYPE_ZOOM;
3077 + case ::com::sun::star::presentation::FadeEffect_NONE :
3082 + if ( mnDiaMode == 2 ) // automatic ?
3083 + nBuildFlags |= 0x400;
3084 + if ( bVisible == FALSE )
3087 + nBuildFlags |= 16;
3089 + nBuildFlags |= 64;
3091 + nBuildFlags |= 256;
3093 + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Duration" ) ) ) )// duration of this slide
3094 + nSlideTime = *(INT32*)aAny.getValue() << 10; // in ticks
3097 + mpPptEscherEx->AddAtom( 16, EPP_SSSlideInfoAtom );
3098 + *mpStrm << nSlideTime // standtime in ticks
3101 + << nTransitionType
3104 + << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0;
3107 + ImplCreateHeaderFooters( mXPagePropSet );
3109 + EscherSolverContainer aSolverContainer;
3110 + mpPptEscherEx->OpenContainer( EPP_PPDrawing );
3111 + mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
3112 + mpPptEscherEx->EnterGroup(0,0);
3113 + ImplWritePage( rLayout, aSolverContainer, NORMAL, FALSE, nPageNum ); // Die Shapes der Seite werden im PPT Dok. erzeugt
3114 + mpPptEscherEx->LeaveGroup();
3116 + if ( bHasBackground )
3117 + ImplWriteBackground( aXBackgroundPropSet );
3120 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
3121 + mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
3122 + EscherPropertyContainer aPropOpt;
3123 + aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) );
3124 + aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Width ) );
3125 + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
3126 + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
3127 + aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
3128 + aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape
3129 + aPropOpt.Commit( *mpStrm );
3130 + mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
3133 + aSolverContainer.WriteSolver( *mpStrm );
3135 + mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
3136 + mpPptEscherEx->CloseContainer(); // EPP_Drawing
3137 + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
3138 + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
3140 + if ( mbUseNewAnimations )
3142 + SvMemoryStream amsofbtAnimGroup;
3143 + ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection );
3144 + aExporter.doexport( mXDrawPage, amsofbtAnimGroup );
3145 + sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell();
3146 + if ( nmsofbtAnimGroupSize )
3148 + EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags );
3149 + EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag );
3151 + EscherExAtom aCString( *mpStrm, EPP_CString );
3152 + *mpStrm << (sal_uInt32)0x5f005f
3153 + << (sal_uInt32)0x50005f
3154 + << (sal_uInt32)0x540050
3155 + << (sal_uInt16)0x31
3156 + << (sal_uInt16)0x30;
3159 + EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData );
3162 + EscherExAtom aMagic2( *mpStrm, 0x2eeb );
3163 + *mpStrm << (sal_uInt32)0x01c45df9
3164 + << (sal_uInt32)0xe1471b30;
3167 + EscherExAtom aMagic( *mpStrm, 0x2b00 );
3168 + *mpStrm << (sal_uInt32)0;
3171 + mpStrm->Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() );
3173 + EscherExContainer aMagic2( *mpStrm, 0x2b02 );
3178 + mpPptEscherEx->CloseContainer(); // EPP_Slide
3182 +// ---------------------------------------------------------------------------------------------
3184 +sal_Bool PPTWriter::ImplCreateNotes( sal_uInt32 nPageNum )
3186 + if ( !ImplGetPageByIndex( nPageNum, NOTICE ) )
3188 + ImplSetCurrentStyleSheet( ImplGetMasterIndex( NORMAL ) );
3191 + mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Notes | nPageNum, mpStrm->Tell() );
3192 + mpPptEscherEx->OpenContainer( EPP_Notes );
3193 + mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 );
3194 + *mpStrm << (sal_uInt32)nPageNum + 0x100
3195 + << (sal_uInt16)3 // follow master ....
3198 + ImplCreateHeaderFooters( mXPagePropSet );
3200 + EscherSolverContainer aSolverContainer;
3202 + mpPptEscherEx->OpenContainer( EPP_PPDrawing );
3203 + mpPptEscherEx->OpenContainer( ESCHER_DgContainer );
3204 + mpPptEscherEx->EnterGroup(0,0);
3206 + ImplWritePage( pPHLayout[ 20 ], aSolverContainer, NOTICE, FALSE ); // Die Shapes der Seite werden im PPT Dok. erzeugt
3208 + mpPptEscherEx->LeaveGroup();
3209 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
3210 + mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
3211 + EscherPropertyContainer aPropOpt;
3212 + aPropOpt.AddOpt( ESCHER_Prop_fillColor, 0xffffff ); // stock valued fill color
3213 + aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
3214 + aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, 0x8b9f8e );
3215 + aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, 0x68bdde );
3216 + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
3217 + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
3218 + aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow );
3219 + aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
3220 + aPropOpt.Commit( *mpStrm );
3221 + mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
3223 + aSolverContainer.WriteSolver( *mpStrm );
3225 + mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer
3226 + mpPptEscherEx->CloseContainer(); // EPP_Drawing
3227 + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 );
3228 + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2;
3229 + mpPptEscherEx->CloseContainer(); // EPP_Notes
3233 +void PPTWriter::ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet )
3235 + //************************ ******
3236 + //** DEFAULT BACKGROUND SHAPE **
3237 + //******************************
3239 + sal_uInt32 nFillColor = 0xffffff;
3240 + sal_uInt32 nFillBackColor = 0;
3242 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
3243 + mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
3244 + Point aEmptyPoint = Point();
3245 + Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
3246 + EscherPropertyContainer aPropOpt( (EscherGraphicProvider&)*mpPptEscherEx, mpPicStrm, aRect );
3247 + aPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
3248 + ::com::sun::star::drawing::FillStyle aFS( ::com::sun::star::drawing::FillStyle_NONE );
3249 + if ( ImplGetPropertyValue( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) )
3254 + case ::com::sun::star::drawing::FillStyle_GRADIENT :
3256 + aPropOpt.CreateGradientProperties( rXPropSet );
3257 + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x1f001e );
3258 + aPropOpt.GetOpt( ESCHER_Prop_fillColor, nFillColor );
3259 + aPropOpt.GetOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
3263 + case ::com::sun::star::drawing::FillStyle_BITMAP :
3264 + aPropOpt.CreateGraphicProperties( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillBitmapURL" ) ), sal_True );
3267 + case ::com::sun::star::drawing::FillStyle_HATCH :
3268 + aPropOpt.CreateGraphicProperties( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillHatch" ) ), sal_True );
3271 + case ::com::sun::star::drawing::FillStyle_SOLID :
3273 + if ( ImplGetPropertyValue( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) )
3275 + nFillColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) );
3276 + nFillBackColor = nFillColor ^ 0xffffff;
3278 + } // PASSTHROUGH INTENDED
3279 + case ::com::sun::star::drawing::FillStyle_NONE :
3281 + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 );
3284 + aPropOpt.AddOpt( ESCHER_Prop_fillColor, nFillColor );
3285 + aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
3286 + aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) );
3287 + aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Height ) );
3288 + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
3289 + aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_bwWhite );
3290 + aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 );
3291 + aPropOpt.Commit( *mpStrm );
3292 + mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
3295 +void PPTWriter::ImplWriteCString( SvStream& rSt, const String& rString, sal_uInt32 nInstance )
3297 + sal_uInt32 i, nLen = rString.Len();
3300 + rSt << (sal_uInt32)( ( nInstance << 4 ) | ( EPP_CString << 16 ) )
3301 + << (sal_uInt32)( nLen << 1 );
3302 + for ( i = 0; i < nLen; i++ )
3303 + rSt << rString.GetChar( (sal_uInt16)i );
3307 +void PPTWriter::ImplWriteVBA( SvMemoryStream* pVBA )
3311 + pVBA->Seek( STREAM_SEEK_TO_END );
3312 + sal_uInt32 nLen = pVBA->Tell();
3316 + mnVBAOleOfs = mpStrm->Tell();
3317 + mpPptEscherEx->BeginAtom();
3318 + mpStrm->Write( (sal_Int8*)pVBA->GetData() + 8, nLen );
3319 + mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
3324 +// ---------------------------------------------------------------------------------------------
3326 +void PPTWriter::ImplWriteOLE( sal_uInt32 nCnvrtFlags )
3328 + PPTExOleObjEntry* pPtr;
3330 + SvxMSExportOLEObjects aOleExport( nCnvrtFlags );
3332 + for ( pPtr = (PPTExOleObjEntry*)maExOleObj.First(); pPtr;
3333 + pPtr = (PPTExOleObjEntry*)maExOleObj.Next() )
3335 + SvMemoryStream* pStrm = NULL;
3336 + pPtr->nOfsB = mpStrm->Tell();
3337 + switch ( pPtr->eType )
3339 + case NORMAL_OLE_OBJECT :
3341 + SdrObject* pSdrObj = GetSdrObjectFromXShape( pPtr->xShape );
3342 + if ( pSdrObj && pSdrObj->ISA( SdrOle2Obj ) )
3344 + ::uno::Reference < embed::XEmbeddedObject > xObj( ( (SdrOle2Obj*) pSdrObj )->GetObjRef() );
3347 + SvStorageRef xTempStorage( new SvStorage( new SvMemoryStream(), TRUE ) );
3348 + aOleExport.ExportOLEObject( xObj, *xTempStorage );
3350 + //TODO/MBA: testing
3351 + String aPersistStream( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( SVEXT_PERSIST_STREAM ) ) );
3352 + SvMemoryStream aStream;
3353 + SvStorageRef xCleanStorage( new SvStorage( FALSE, aStream ) );
3354 + xTempStorage->CopyTo( xCleanStorage );
3355 + // SJ: #99809# create a dummy content stream, the dummy content is necessary for ppt, but not for
3356 + // doc files, so we can't share code.
3357 + SotStorageStreamRef xStm = xCleanStorage->OpenSotStream( aPersistStream, STREAM_STD_READWRITE );
3358 + *xStm << (sal_uInt32)0 // no ClipboardId
3359 + << (sal_uInt32)4 // no target device
3360 + << (sal_uInt32)1 // aspect ratio
3361 + << (sal_Int32)-1 // L-Index
3362 + << (sal_uInt32)0 // Advanced Flags
3363 + << (sal_uInt32)0 // compression
3364 + << (sal_uInt32)0 // Size
3365 + << (sal_uInt32)0 // "
3367 + pStrm = xCleanStorage->CreateMemoryStream();
3373 + case OCX_CONTROL :
3375 + if ( pPtr->xControlModel.is() )
3378 + ::com::sun::star::awt::Size aSize;
3379 + SvStorageRef xDest( new SvStorage( new SvMemoryStream(), TRUE ) );
3380 + sal_Bool bOk = SvxMSConvertOCXControls::WriteOCXStream( xDest, pPtr->xControlModel, aSize, aName );
3382 + pStrm = xDest->CreateMemoryStream();
3388 + mpPptEscherEx->BeginAtom();
3389 + pStrm->Seek( STREAM_SEEK_TO_END );
3390 + sal_uInt32 npStrmSize = pStrm->Tell();
3391 + *mpStrm << npStrmSize; // uncompressed size
3393 +#ifdef DBG_EXTRACTOLEOBJECTS
3394 + SvFileStream aOut( String::CreateFromAscii( "D:\\OUT.OLE" ), STREAM_TRUNC | STREAM_WRITE );
3396 + aOut.Write( pStrm->GetData(), npStrmSize );
3400 + ZCodec aZCodec( 0x8000, 0x8000 );
3401 + aZCodec.BeginCompression();
3402 + aZCodec.Compress( *pStrm, *mpStrm );
3403 + aZCodec.EndCompression();
3405 + mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 );
3410 +// ---------------------------------------------------------------------------------------------
3411 +// PersistantTable und UserEditAtom schreiben
3413 +sal_Bool PPTWriter::ImplWriteAtomEnding()
3416 +#define EPP_LastViewTypeNone 0
3417 +#define EPP_LastViewTypeSlideView 1
3418 +#define EPP_LastViewTypeOutlineView 2
3419 +#define EPP_LastViewTypeNotes 3
3422 + sal_uInt32 i, nPos, nOfs, nPersistOfs = mpStrm->Tell();
3423 + sal_uInt32 nPersistEntrys = 0;
3424 + *mpStrm << (sal_uInt32)0 << (sal_uInt32)0 << (sal_uInt32)0; // Record Header und ersten Eintrag ueberspringen
3426 + // Document pesist schreiben
3428 + *mpStrm << (sal_uInt32)0;
3429 + // MasterPages persists schreiben
3430 + for ( i = 0; i < mnMasterPages; i++ )
3432 + nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_MainMaster | i );
3436 + mpPptEscherEx->InsertAtPersistOffset( EPP_MAINMASTER_PERSIST_KEY | i, ++nPersistEntrys );
3439 + // MainNotesMaster persist schreiben
3440 + nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_MainNotes );
3444 + mpPptEscherEx->InsertAtPersistOffset( EPP_MAINNOTESMASTER_PERSIST_KEY, ++nPersistEntrys );
3446 + // Slide persists schreiben -> es gilt hier auch den EPP_SlidePersistAtome mit einem gueltigen wert zu beschreiben
3447 + for ( i = 0; i < mnPages; i++ )
3449 + nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Slide | i );
3453 + mpPptEscherEx->InsertAtPersistOffset( EPP_MAINSLIDE_PERSIST_KEY | i, ++nPersistEntrys );
3456 + // Notes persists schreiben
3457 + for ( i = 0; i < mnPages; i++ )
3459 + nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Notes | i );
3463 + mpPptEscherEx->InsertAtPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, ++nPersistEntrys );
3467 + PPTExOleObjEntry* pPtr;
3468 + for ( pPtr = (PPTExOleObjEntry*)maExOleObj.First(); pPtr; pPtr = (PPTExOleObjEntry*)maExOleObj.Next() )
3470 + nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_ExObj );
3474 + *mpStrm << pPtr->nOfsB;
3475 + sal_uInt32 nOldPos, nPersOfs = nOfs + pPtr->nOfsA + 16 + 8; // 8 bytes atom header, +16 to the persist entry
3476 + nOldPos = mpStrm->Tell();
3477 + mpStrm->Seek( nPersOfs );
3478 + *mpStrm << nPersistEntrys;
3479 + mpStrm->Seek( nOldPos );
3483 + if ( mnVBAOleOfs && mpVBA )
3485 + nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_VBAInfoAtom );
3489 + sal_uInt32 n1, n2;
3495 + *mpStrm << mnVBAOleOfs;
3496 + sal_uInt32 nOldPos = mpStrm->Tell();
3497 + mpStrm->Seek( nOfs ); // Fill the VBAInfoAtom with the correct index to the persisttable
3498 + *mpStrm << nPersistEntrys
3501 + mpStrm->Seek( nOldPos );
3505 + nPos = mpStrm->Tell();
3506 + mpStrm->Seek( nPersistOfs );
3507 + mpPptEscherEx->AddAtom( ( nPersistEntrys + 1 ) << 2, EPP_PersistPtrIncrementalBlock ); // Record Header eintragen
3508 + *mpStrm << (sal_uInt32)( ( nPersistEntrys << 20 ) | 1 );
3509 + mpStrm->Seek( nPos );
3511 + *mpCurUserStrm << (sal_uInt32)nPos; // offset to current edit setzen
3512 + mpPptEscherEx->AddAtom( 28, EPP_UserEditAtom );
3513 + *mpStrm << (INT32)0x100 // last slide ID
3514 + << (sal_uInt32)0x03000dbc // minor and major app version that did the save
3515 + << (sal_uInt32)0 // offset last save, 0 after a full save
3516 + << nPersistOfs // File offset to persist pointers for this save operation
3517 + << (sal_uInt32)1 // Persist reference to the document persist object
3518 + << (sal_uInt32)nPersistEntrys // max persists written, Seed value for persist object id management
3519 + << (sal_Int16)EPP_LastViewTypeSlideView // last view type
3520 + << (sal_Int16)0x12; // padword
3525 +// ---------------------------------------------------------------------------------------------
3527 +PPTExCharSheet::PPTExCharSheet( int nInstance )
3529 + sal_uInt16 nFontHeight = 24;
3531 + for ( int nDepth = 0; nDepth < 5; nDepth++ )
3533 + PPTExCharLevel& rLev = maCharLevel[ nDepth ];
3534 + switch ( nInstance )
3536 + case EPP_TEXTTYPE_Title :
3537 + case EPP_TEXTTYPE_CenterTitle :
3540 + case EPP_TEXTTYPE_Body :
3541 + case EPP_TEXTTYPE_CenterBody :
3542 + case EPP_TEXTTYPE_HalfBody :
3543 + case EPP_TEXTTYPE_QuarterBody :
3547 + case 0 : nFontHeight = 32; break;
3548 + case 1 : nFontHeight = 28; break;
3549 + case 2 : nFontHeight = 24; break;
3550 + default :nFontHeight = 20; break;
3554 + case EPP_TEXTTYPE_Notes :
3557 + case EPP_TEXTTYPE_notUsed :
3558 + case EPP_TEXTTYPE_Other :
3564 + rLev.mnAsianOrComplexFont = 0xffff;
3565 + rLev.mnFontHeight = nFontHeight;
3566 + rLev.mnFontColor = 0;
3567 + rLev.mnEscapement = 0;
3572 +void PPTExCharSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
3573 + FontCollection& rFontCollection, int nLevel )
3575 + PortionObj aPortionObj( rXPropSet, rFontCollection );
3577 + PPTExCharLevel& rLev = maCharLevel[ nLevel ];
3579 + if ( aPortionObj.meCharColor == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3580 + rLev.mnFontColor = aPortionObj.mnCharColor;
3581 + if ( aPortionObj.meCharEscapement == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3582 + rLev.mnEscapement = aPortionObj.mnCharEscapement;
3583 + if ( aPortionObj.meCharHeight == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3584 + rLev.mnFontHeight = aPortionObj.mnCharHeight;
3585 + if ( aPortionObj.meFontName == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3586 + rLev.mnFont = aPortionObj.mnFont;
3587 + if ( aPortionObj.meAsianOrComplexFont == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3588 + rLev.mnAsianOrComplexFont = aPortionObj.mnAsianOrComplexFont;
3589 + rLev.mnFlags = aPortionObj.mnCharAttr;
3592 +void PPTExCharSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, sal_Bool, sal_Bool bSimpleText,
3593 + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet )
3595 + const PPTExCharLevel& rLev = maCharLevel[ nLev ];
3597 + sal_uInt32 nCharFlags = 0xefffff;
3598 + if ( bSimpleText )
3599 + nCharFlags = 0x7ffff;
3605 + sal_uInt32 nFontColor = rLev.mnFontColor;
3606 + if ( nFontColor == COL_AUTO )
3608 + sal_Bool bIsDark = sal_False;
3609 + ::com::sun::star::uno::Any aAny;
3610 + if ( PropValue::GetPropertyValue( aAny, rPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) )
3612 + nFontColor = bIsDark ? 0xffffff : 0x000000;
3614 + nFontColor &= 0xffffff;
3615 + nFontColor |= 0xfe000000;
3616 + if ( bSimpleText )
3618 + rSt << rLev.mnFontHeight
3623 + rSt << rLev.mnAsianOrComplexFont
3624 + << (sal_uInt16)0xffff // unbekannt
3625 + << (sal_uInt16)0xffff // unbekannt
3626 + << rLev.mnFontHeight
3628 + << rLev.mnEscapement;
3632 +PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv ) :
3633 + rBuProv ( rProv ),
3634 + mnInstance ( nInstance )
3636 + sal_Bool bHasBullet = FALSE;
3638 + sal_uInt16 nUpperDist = 0;
3639 + sal_uInt16 nBulletChar = 0x2022;
3640 + sal_uInt16 nBulletOfs = 0;
3641 + sal_uInt16 nTextOfs = 0;
3643 + for ( int nDepth = 0; nDepth < 5; nDepth++ )
3645 + PPTExParaLevel& rLev = maParaLevel[ nDepth ];
3646 + switch ( nInstance )
3648 + case EPP_TEXTTYPE_Title :
3649 + case EPP_TEXTTYPE_CenterTitle :
3651 + case EPP_TEXTTYPE_Body :
3652 + case EPP_TEXTTYPE_CenterBody :
3653 + case EPP_TEXTTYPE_HalfBody :
3654 + case EPP_TEXTTYPE_QuarterBody :
3656 + bHasBullet = TRUE;
3657 + nUpperDist = 0x14;
3660 + case EPP_TEXTTYPE_Notes :
3661 + nUpperDist = 0x1e;
3665 +// case EPP_TEXTTYPE_notUsed :
3666 +// case EPP_TEXTTYPE_Other :
3673 + nBulletChar = 0x2022;
3675 + nTextOfs = ( bHasBullet ) ? 0xd8 : 0;
3680 + nBulletChar = 0x2013;
3681 + nBulletOfs = 0x120;
3687 + nBulletChar = 0x2022;
3688 + nBulletOfs = 0x240;
3694 + nBulletChar = 0x2013;
3695 + nBulletOfs = 0x360;
3701 + nBulletChar = 0xbb;
3702 + nBulletOfs = 0x480;
3707 + rLev.mbIsBullet = bHasBullet;
3708 + rLev.mnBulletChar = nBulletChar;
3709 + rLev.mnBulletFont = 0;
3710 + rLev.mnBulletHeight = 100;
3711 + rLev.mnBulletColor = 0;
3712 + rLev.mnAdjust = 0;
3713 + rLev.mnLineFeed = 100;
3714 + rLev.mnLowerDist = 0;
3715 + rLev.mnUpperDist = nUpperDist;
3716 + rLev.mnTextOfs = nTextOfs;
3717 + rLev.mnBulletOfs = nBulletOfs;
3718 + rLev.mnDefaultTab = nDefaultTab;
3719 + rLev.mnAsianSettings = 2;
3722 + rLev.mbExtendedBulletsUsed = FALSE;
3723 + rLev.mnBulletId = 0xffff;
3724 + rLev.mnBulletStart = 0;
3725 + rLev.mnMappedNumType = 0;
3726 + rLev.mnNumberingType = 0;
3730 +void PPTExParaSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
3731 + FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel )
3733 + ParagraphObj aParagraphObj( rXPropSet, rBuProv );
3734 + aParagraphObj.CalculateGraphicBulletSize( rCharLevel.mnFontHeight );
3735 + PPTExParaLevel& rLev = maParaLevel[ nLevel ];
3737 + if ( aParagraphObj.meTextAdjust == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3738 + rLev.mnAdjust = aParagraphObj.mnTextAdjust;
3739 + if ( aParagraphObj.meLineSpacing == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3741 + sal_Int16 nLineSpacing = aParagraphObj.mnLineSpacing;
3742 + if ( nLineSpacing > 0 ) // if nLinespacing is < 0 the linespacing is an absolute spacing
3744 + sal_Bool bFixedLineSpacing = sal_False;
3745 + uno::Any aAny = rXPropSet->getPropertyValue( ::rtl::OUString(
3746 + RTL_CONSTASCII_USTRINGPARAM(
3747 + "FontIndependentLineSpacing" ) ) );
3748 + if( !(aAny >>= bFixedLineSpacing) || !bFixedLineSpacing )
3750 + const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont );
3752 + nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
3757 + if ( rCharLevel.mnFontHeight > (sal_uInt16)( ((double)-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point
3759 + const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont );
3761 + nLineSpacing = (sal_Int16)( (double)100.0 * pDesc->Scaling + 0.5 );
3763 + nLineSpacing = 100;
3766 + nLineSpacing = (sal_Int16)( (double)nLineSpacing / 4.40972 );
3768 + rLev.mnLineFeed = nLineSpacing;
3770 + if ( aParagraphObj.meLineSpacingBottom == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3771 + rLev.mnLowerDist = aParagraphObj.mnLineSpacingBottom;
3772 + if ( aParagraphObj.meLineSpacingTop == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3773 + rLev.mnUpperDist = aParagraphObj.mnLineSpacingTop;
3774 + if ( aParagraphObj.meForbiddenRules == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3776 + rLev.mnAsianSettings &=~1;
3777 + if ( aParagraphObj.mbForbiddenRules )
3778 + rLev.mnAsianSettings |= 1;
3780 + if ( aParagraphObj.meParagraphPunctation == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3782 + rLev.mnAsianSettings &=~4;
3783 + if ( aParagraphObj.mbParagraphPunctation )
3784 + rLev.mnAsianSettings |= 4;
3787 + if ( aParagraphObj.meBiDi == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3788 + rLev.mnBiDi = aParagraphObj.mnBiDi;
3790 + rLev.mbIsBullet = aParagraphObj.mbIsBullet; //( ( aParagraphObj.nBulletFlags & 1 ) != 0 );
3794 + if ( ( aParagraphObj.meBullet == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
3795 + && aParagraphObj.bExtendedParameters )
3797 + for ( sal_Int16 i = 0; i < 5; i++ )
3799 + PPTExParaLevel& rLevel = maParaLevel[ i ];
3801 + aParagraphObj.ImplGetNumberingLevel( rBuProv, i, FALSE );
3802 +// rLevel.mbIsBullet = ( ( aParagraphObj.nBulletFlags & 1 ) != 0 );
3803 + rLevel.mnTextOfs = aParagraphObj.nTextOfs;
3804 + rLevel.mnBulletOfs = (sal_uInt16)aParagraphObj.nBulletOfs;
3805 + rLevel.mnBulletChar = aParagraphObj.cBulletId;
3806 + FontCollectionEntry aFontDescEntry( aParagraphObj.aFontDesc.Name, aParagraphObj.aFontDesc.Family,
3807 + aParagraphObj.aFontDesc.Pitch, aParagraphObj.aFontDesc.CharSet );
3808 + rLevel.mnBulletFont = (sal_uInt16)rFontCollection.GetId( aFontDescEntry );
3809 + rLevel.mnBulletHeight = aParagraphObj.nBulletRealSize;
3810 + rLevel.mnBulletColor = aParagraphObj.nBulletColor;
3812 + rLevel.mbExtendedBulletsUsed = aParagraphObj.bExtendedBulletsUsed;
3813 + rLevel.mnBulletId = aParagraphObj.nBulletId;
3814 + rLevel.mnNumberingType = aParagraphObj.nNumberingType;
3815 + rLevel.mnBulletStart = aParagraphObj.nStartWith;
3816 + rLevel.mnMappedNumType = aParagraphObj.nMappedNumType;
3822 +void PPTExParaSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, sal_Bool, sal_Bool bSimpleText,
3823 + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet )
3825 + const PPTExParaLevel& rLev = maParaLevel[ nLev ];
3827 + if ( maParaLevel[ 0 ].mbExtendedBulletsUsed || maParaLevel[ 1 ].mbExtendedBulletsUsed ||
3828 + maParaLevel[ 2 ].mbExtendedBulletsUsed || maParaLevel[ 3 ].mbExtendedBulletsUsed ||
3829 + maParaLevel[ 4 ].mbExtendedBulletsUsed )
3831 + SvStream& rOut = rBuProv.aBuExMasterStream;
3834 + rOut << (sal_uInt32)( ( EPP_PST_ExtendedParagraphMasterAtom << 16 ) | ( mnInstance << 4 ) )
3835 + << (sal_uInt32)( 5 * 16 + 2 )
3836 + << (sal_uInt16)5; // depth
3838 + sal_uInt16 nBulletId = rLev.mnBulletId;
3839 + if ( rLev.mnNumberingType != SVX_NUM_BITMAP )
3840 + nBulletId = 0xffff;
3841 + rOut << (sal_uInt32)0x03800000
3842 + << (sal_uInt16)nBulletId
3843 + << (sal_uInt32)rLev.mnMappedNumType
3844 + << (sal_uInt16)rLev.mnBulletStart
3848 + sal_uInt32 nParaFlags = 0x3ffdff;
3849 + sal_uInt16 nBulletFlags = ( rLev.mbIsBullet ) ? 0xf : 0xe;
3852 + nParaFlags &= 0x207fff;
3853 + if ( bSimpleText )
3854 + nParaFlags &= 0x7fff;
3855 + sal_uInt32 nBulletColor = rLev.mnBulletColor;
3856 + if ( nBulletColor == COL_AUTO )
3858 + sal_Bool bIsDark = sal_False;
3859 + ::com::sun::star::uno::Any aAny;
3860 + if ( PropValue::GetPropertyValue( aAny, rPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) )
3862 + nBulletColor = bIsDark ? 0xffffff : 0x000000;
3864 + nBulletColor &= 0xffffff;
3865 + nBulletColor |= 0xfe000000;
3868 + << rLev.mnBulletChar
3869 + << rLev.mnBulletFont
3870 + << rLev.mnBulletHeight
3873 + << rLev.mnLineFeed
3874 + << rLev.mnUpperDist
3875 + << rLev.mnLowerDist
3877 + << rLev.mnBulletOfs;
3879 + if ( bSimpleText || nLev )
3881 + if ( nParaFlags & 0x200000 )
3882 + rSt << rLev.mnBiDi;
3886 + rSt << rLev.mnDefaultTab
3889 + << rLev.mnAsianSettings
3895 +PPTExStyleSheet::PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv )
3897 + for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
3899 + mpParaSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExParaSheet( nInstance, nDefaultTab, rBuProv );
3900 + mpCharSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExCharSheet( nInstance );
3904 +PPTExStyleSheet::~PPTExStyleSheet()
3906 + for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
3908 + if ( nInstance == EPP_TEXTTYPE_notUsed )
3911 + delete mpParaSheet[ nInstance ];
3912 + delete mpCharSheet[ nInstance ];
3916 +void PPTExStyleSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
3917 + FontCollection& rFontCollection, int nInstance, int nLevel )
3919 + if ( nInstance == EPP_TEXTTYPE_notUsed )
3921 + mpCharSheet[ nInstance ]->SetStyleSheet( rXPropSet, rFontCollection, nLevel );
3922 + mpParaSheet[ nInstance ]->SetStyleSheet( rXPropSet, rFontCollection, nLevel, mpCharSheet[ nInstance ]->maCharLevel[ nLevel ] );
3925 +sal_Bool PPTExStyleSheet::IsHardAttribute( sal_uInt32 nInstance, sal_uInt32 nLevel, PPTExTextAttr eAttr, sal_uInt32 nValue )
3927 + const PPTExParaLevel& rPara = mpParaSheet[ nInstance ]->maParaLevel[ nLevel ];
3928 + const PPTExCharLevel& rChar = mpCharSheet[ nInstance ]->maCharLevel[ nLevel ];
3930 + sal_uInt32 nFlag = 0;
3934 + case ParaAttr_BulletOn : return ( rPara.mbIsBullet ) ? ( nValue ) ? FALSE : TRUE : ( nValue ) ? TRUE : FALSE;
3935 + case ParaAttr_BuHardFont :
3936 + case ParaAttr_BulletFont : return ( rPara.mnBulletFont != nValue );
3937 + case ParaAttr_BuHardColor :
3938 + case ParaAttr_BulletColor : return ( rPara.mnBulletColor != nValue );
3939 + case ParaAttr_BuHardHeight :
3940 + case ParaAttr_BulletHeight : return ( rPara.mnBulletHeight != nValue );
3941 + case ParaAttr_BulletChar : return ( rPara.mnBulletChar != nValue );
3942 + case ParaAttr_Adjust : return ( rPara.mnAdjust != nValue );
3943 + case ParaAttr_LineFeed : return ( rPara.mnLineFeed != nValue );
3944 + case ParaAttr_UpperDist : return ( rPara.mnUpperDist != nValue );
3945 + case ParaAttr_LowerDist : return ( rPara.mnLowerDist != nValue );
3946 + case ParaAttr_TextOfs : return ( rPara.mnTextOfs != nValue );
3947 + case ParaAttr_BulletOfs : return ( rPara.mnBulletOfs != nValue );
3948 + case ParaAttr_DefaultTab : return ( rPara.mnDefaultTab != nValue );
3949 + case ParaAttr_BiDi : return ( rPara.mnBiDi != nValue );
3950 + case CharAttr_Bold : nFlag = 1; break;
3951 + case CharAttr_Italic : nFlag = 2; break;
3952 + case CharAttr_Underline : nFlag = 4; break;
3953 + case CharAttr_Shadow : nFlag = 16; break;
3954 + case CharAttr_Strikeout : nFlag = 256; break;
3955 + case CharAttr_Embossed : nFlag = 512; break;
3956 + case CharAttr_Font : return ( rChar.mnFont != nValue );
3957 + case CharAttr_AsianOrComplexFont : return ( rChar.mnAsianOrComplexFont != nValue );
3958 + case CharAttr_Symbol : return TRUE;
3959 + case CharAttr_FontHeight : return ( rChar.mnFontHeight != nValue );
3960 + case CharAttr_FontColor : return ( rChar.mnFontColor != nValue );
3961 + case CharAttr_Escapement : return ( rChar.mnEscapement != nValue );
3967 + if ( rChar.mnFlags & nFlag )
3968 + return ( ( nValue & nFlag ) == 0 );
3970 + return ( ( nValue & nFlag ) != 0 );
3975 +sal_uInt32 PPTExStyleSheet::SizeOfTxCFStyleAtom() const
3980 +// the TxCFStyleAtom stores the text properties that are used
3981 +// when creating new objects in PowerPoint.
3983 +void PPTExStyleSheet::WriteTxCFStyleAtom( SvStream& rSt )
3985 + const PPTExCharLevel& rCharStyle = mpCharSheet[ EPP_TEXTTYPE_Other ]->maCharLevel[ 0 ];
3987 + sal_uInt16 nFlags = 0x60 // ??
3988 + | 0x02 // fontsize;
3989 + | 0x04; // fontcolor
3991 + sal_uInt32 nCharFlags = rCharStyle.mnFlags;
3992 + nCharFlags &= CharAttr_Italic | CharAttr_Bold | CharAttr_Underline | CharAttr_Shadow;
3994 + rSt << (sal_uInt32)( EPP_TxCFStyleAtom << 16 ) // recordheader
3995 + << SizeOfTxCFStyleAtom() - 8
3996 + << (sal_uInt16)( 0x80 | nCharFlags )
3997 + << (sal_uInt16)nFlags
3998 + << (sal_uInt16)nCharFlags
3999 + << (sal_Int32)-1 // ?
4000 + << rCharStyle.mnFontHeight
4001 + << rCharStyle.mnFontColor;
4005 +// ---------------------------------------------------------------------------------------------
4007 +// ---------------------
4008 +// - exported function -
4009 +// ---------------------
4011 +extern "C" SAL_DLLPUBLIC_EXPORT BOOL __LOADONCALLAPI ExportPPT( SvStorageRef& rSvStorage,
4012 + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rXModel,
4013 + ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rXStatInd,
4014 + SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags )
4016 + PPTWriter* pPPTWriter;
4017 + BOOL bStatus = FALSE;
4019 + pPPTWriter = new PPTWriter( rSvStorage, rXModel, rXStatInd, pVBA, nCnvrtFlags );
4022 + bStatus = ( pPPTWriter->IsValid() == TRUE );
4023 + delete pPPTWriter;
4029 diff --git a/sd/source/filter/pptx/pptx-epptso.cxx b/sd/source/filter/pptx/pptx-epptso.cxx
4030 new file mode 100644
4031 index 0000000..08c427f
4033 +++ sd/source/filter/pptx/pptx-epptso.cxx
4035 +/*************************************************************************
4037 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4039 + * Copyright 2008 by Sun Microsystems, Inc.
4041 + * OpenOffice.org - a multi-platform office productivity suite
4043 + * $RCSfile: epptso.cxx,v $
4044 + * $Revision: 1.107.6.4 $
4046 + * This file is part of OpenOffice.org.
4048 + * OpenOffice.org is free software: you can redistribute it and/or modify
4049 + * it under the terms of the GNU Lesser General Public License version 3
4050 + * only, as published by the Free Software Foundation.
4052 + * OpenOffice.org is distributed in the hope that it will be useful,
4053 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4054 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4055 + * GNU Lesser General Public License version 3 for more details
4056 + * (a copy is included in the LICENSE file that accompanied this code).
4058 + * You should have received a copy of the GNU Lesser General Public License
4059 + * version 3 along with OpenOffice.org. If not, see
4060 + * <http://www.openoffice.org/license.html>
4061 + * for a copy of the LGPLv3 License.
4063 + ************************************************************************/
4065 +// MARKER(update_precomp.py): autogen include statement, do not remove
4066 +#include "precompiled_sd.hxx"
4067 +#include <osl/endian.h>
4068 +#include <eppt.hxx>
4069 +#include "epptdef.hxx"
4070 +#ifndef _PptEscherEx_HXX
4071 +#include "escherex.hxx"
4073 +#include <tools/poly.hxx>
4074 +#include <vcl/bmpacc.hxx>
4075 +#include <vcl/gradient.hxx>
4076 +#include <vcl/gfxlink.hxx>
4077 +#include <tools/stream.hxx>
4078 +#include <sot/storage.hxx>
4079 +#include <vcl/outdev.hxx>
4080 +#include <vcl/virdev.hxx>
4081 +#include <vcl/gradient.hxx>
4082 +#include <sfx2/app.hxx>
4083 +#include <svtools/languageoptions.hxx>
4084 +//#ifndef _SVX_XIT_HXX
4085 +//#include <svx/xit.hxx>
4087 +#include <svx/svxenum.hxx>
4088 +#include <svx/unoapi.hxx>
4089 +#include <svx/svdoashp.hxx>
4090 +#include <com/sun/star/style/VerticalAlignment.hpp>
4091 +#include <com/sun/star/container/XIndexReplace.hpp>
4092 +#include <com/sun/star/presentation/XPresentationPage.hpp>
4093 +#include <com/sun/star/awt/XFont.hpp>
4094 +#ifndef _COM_SUN_STAR_AWT_XFONTWEIGHT_HPP_
4095 +#include <com/sun/star/awt/FontWeight.hpp>
4097 +#ifndef _COM_SUN_STAR_AWT_XFONTUNDERLINE_HPP_
4098 +#include <com/sun/star/awt/FontUnderline.hpp>
4100 +#include <com/sun/star/style/ParagraphAdjust.hpp>
4101 +#include <com/sun/star/style/LineSpacing.hpp>
4102 +#include <com/sun/star/style/LineSpacingMode.hpp>
4103 +#ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_PP_
4104 +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
4106 +#include <com/sun/star/style/XStyle.hpp>
4107 +#include <com/sun/star/drawing/PointSequence.hpp>
4108 +#include <com/sun/star/drawing/FlagSequence.hpp>
4109 +#include <com/sun/star/drawing/PolygonFlags.hpp>
4110 +#include <com/sun/star/beans/PropertyValue.hpp>
4111 +#include <com/sun/star/drawing/XControlShape.hpp>
4112 +#include <comphelper/processfactory.hxx>
4113 +#include <com/sun/star/lang/XMultiServiceFactory.hpp>
4114 +#include <com/sun/star/i18n/XBreakIterator.hpp>
4115 +#include <com/sun/star/i18n/XScriptTypeDetector.hpp>
4116 +#include <com/sun/star/i18n/ScriptType.hpp>
4117 +#include <com/sun/star/i18n/ScriptDirection.hpp>
4118 +#include <com/sun/star/embed/Aspects.hpp>
4119 +#include <vcl/cvtgrf.hxx>
4120 +#include <tools/urlobj.hxx>
4121 +#ifndef _CPPUHELPER_EXTRACT_HXX_
4122 +#include <comphelper/extract.hxx>
4124 +#ifndef _CPPUHELPER_PROPTYPEHLP_HXX_
4125 +#include <cppuhelper/proptypehlp.hxx>
4127 +#ifndef _UCBHELPER_CONTENT_HXX_
4128 +#include <ucbhelper/content.hxx>
4130 +#ifndef _UCBHELPER_CONTENTBROKER_HXX_
4131 +#include <ucbhelper/contentbroker.hxx>
4133 +#ifndef _TOOLKIT_UNOHLP_HXX
4134 +#include <toolkit/unohlp.hxx>
4136 +#include <rtl/crc.h>
4137 +#include <sot/clsids.hxx>
4138 +#include <unotools/ucbstreamhelper.hxx>
4139 +#include <com/sun/star/text/FontRelief.hpp>
4140 +#include <svx/frmdiritem.hxx>
4142 +#include <svx/outliner.hxx>
4143 +#include <svx/outlobj.hxx>
4144 +#include <svx/svdmodel.hxx>
4146 +#include <svtools/fltcall.hxx>
4147 +#include <com/sun/star/table/XTable.hpp>
4148 +#include <com/sun/star/table/XMergeableCell.hpp>
4149 +#include <com/sun/star/table/BorderLine.hpp>
4152 +//#include <svx/xbtmpit.hxx>
4154 +#include "i18npool/mslangid.hxx"
4156 +#include <vos/xception.hxx>
4157 +#ifndef _VOS_NO_NAMESPACE
4158 +using namespace vos;
4161 +using namespace ::com::sun::star;
4163 +////////////////////////////////////////////////////////////////////////////////////////////////////
4165 +#define ANSI_CHARSET 0
4166 +#define DEFAULT_CHARSET 1
4167 +#define SYMBOL_CHARSET 2
4168 +#define SHIFTJIS_CHARSET 128
4169 +#define HANGEUL_CHARSET 129
4170 +#define CHINESEBIG5_CHARSET 136
4171 +#define OEM_CHARSET 255
4173 +////////////////////////////////////////////////////////////////////////////////////////////////////
4175 +/* Font Families */
4176 +#define FF_DONTCARE 0x00
4177 +#define FF_ROMAN 0x10
4178 +#define FF_SWISS 0x20
4179 +#define FF_MODERN 0x30
4180 +#define FF_SCRIPT 0x40
4181 +#define FF_DECORATIVE 0x50
4183 +////////////////////////////////////////////////////////////////////////////////////////////////////
4185 +#define DEFAULT_PITCH 0x00
4186 +#define FIXED_PITCH 0x01
4187 +#define VARIABLE_PITCH 0x02
4189 +// ---------------------------------------------------------------------------------------------
4191 +com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xPPTBreakIter;
4192 +com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > xScriptTypeDetector;
4194 +PPTExBulletProvider::PPTExBulletProvider()
4196 + pGraphicProv = new EscherGraphicProvider( _E_GRAPH_PROV_USE_INSTANCES | _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES );
4199 +PPTExBulletProvider::~PPTExBulletProvider()
4201 + delete pGraphicProv;
4204 +sal_uInt16 PPTExBulletProvider::GetId( const ByteString& rUniqueId, Size& rGraphicSize )
4206 + sal_uInt16 nRetValue = 0xffff;
4207 + sal_uInt32 nId = 0;
4209 + if ( rUniqueId.Len() )
4212 + GraphicObject aGraphicObject( rUniqueId );
4213 + Graphic aMappedGraphic, aGraphic( aGraphicObject.GetGraphic() );
4214 + Size aPrefSize( aGraphic.GetPrefSize() );
4215 + BitmapEx aBmpEx( aGraphic.GetBitmapEx() );
4217 + if ( rGraphicSize.Width() && rGraphicSize.Height() )
4219 + double fQ1 = ( (double)aPrefSize.Width() / (double)aPrefSize.Height() );
4220 + double fQ2 = ( (double)rGraphicSize.Width() / (double)rGraphicSize.Height() );
4221 + double fXScale = 1;
4222 + double fYScale = 1;
4225 + fYScale = fQ1 / fQ2;
4226 + else if ( fQ1 < fQ2 )
4227 + fXScale = fQ2 / fQ1;
4229 + if ( ( fXScale != 1.0 ) || ( fYScale != 1.0 ) )
4231 + aBmpEx.Scale( fXScale, fYScale );
4232 + Size aNewSize( (sal_Int32)((double)rGraphicSize.Width() / fXScale + 0.5 ),
4233 + (sal_Int32)((double)rGraphicSize.Height() / fYScale + 0.5 ) );
4235 + rGraphicSize = aNewSize;
4237 + aMappedGraphic = Graphic( aBmpEx );
4238 + aGraphicObject = GraphicObject( aMappedGraphic );
4242 + nId = pGraphicProv->GetBlibID( aBuExPictureStream, aGraphicObject.GetUniqueID(), aRect, NULL, NULL );
4244 + if ( nId && ( nId < 0x10000 ) )
4245 + nRetValue = (sal_uInt16)nId - 1;
4250 +// ---------------------------------------------------------------------------------------------
4252 +GroupTable::GroupTable() :
4253 + mnCurrentGroupEntry ( 0 ),
4254 + mnMaxGroupEntry ( 0 ),
4255 + mnGroupsClosed ( 0 ),
4256 + mpGroupEntry ( NULL )
4258 + ImplResizeGroupTable( 32 );
4261 +// ---------------------------------------------------------------------------------------------
4263 +GroupTable::~GroupTable()
4265 + for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; delete mpGroupEntry[ i++ ] ) ;
4266 + delete[] mpGroupEntry;
4269 +// ---------------------------------------------------------------------------------------------
4271 +void GroupTable::ImplResizeGroupTable( sal_uInt32 nEntrys )
4273 + if ( nEntrys > mnMaxGroupEntry )
4275 + mnMaxGroupEntry = nEntrys;
4276 + GroupEntry** pTemp = new GroupEntry*[ nEntrys ];
4277 + for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; i++ )
4278 + pTemp[ i ] = mpGroupEntry[ i ];
4279 + if ( mpGroupEntry )
4280 + delete[] mpGroupEntry;
4281 + mpGroupEntry = pTemp;
4285 +// ---------------------------------------------------------------------------------------------
4287 +sal_Bool GroupTable::EnterGroup( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rXIndexAccessRef )
4289 + sal_Bool bRet = sal_False;
4290 + if ( rXIndexAccessRef.is() )
4292 + GroupEntry* pNewGroup = new GroupEntry( rXIndexAccessRef );
4293 + if ( pNewGroup->mnCount )
4295 + if ( mnMaxGroupEntry == mnCurrentGroupEntry )
4296 + ImplResizeGroupTable( mnMaxGroupEntry + 8 );
4297 + mpGroupEntry[ mnCurrentGroupEntry++ ] = pNewGroup;
4306 +// ---------------------------------------------------------------------------------------------
4308 +sal_uInt32 GroupTable::GetGroupsClosed()
4310 + sal_uInt32 nRet = mnGroupsClosed;
4311 + mnGroupsClosed = 0;
4315 +// ---------------------------------------------------------------------------------------------
4317 +void GroupTable::ClearGroupTable()
4319 + for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; i++, delete mpGroupEntry[ i ] ) ;
4320 + mnCurrentGroupEntry = 0;
4323 +// ---------------------------------------------------------------------------------------------
4325 +void GroupTable::ResetGroupTable( sal_uInt32 nCount )
4327 + ClearGroupTable();
4328 + mpGroupEntry[ mnCurrentGroupEntry++ ] = new GroupEntry( nCount );
4331 +// ---------------------------------------------------------------------------------------------
4333 +sal_Bool GroupTable::GetNextGroupEntry()
4335 + while ( mnCurrentGroupEntry )
4337 + mnIndex = mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mnCurrentPos++;
4339 + if ( mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mnCount > mnIndex )
4342 + delete ( mpGroupEntry[ --mnCurrentGroupEntry ] );
4344 + if ( mnCurrentGroupEntry )
4350 +// ---------------------------------------------------------------------------------------------
4352 +void GroupTable::SkipCurrentGroup()
4354 + if ( mnCurrentGroupEntry )
4355 + delete ( mpGroupEntry[ --mnCurrentGroupEntry ] );
4358 +// ---------------------------------------------------------------------------------------------
4360 +FontCollectionEntry::~FontCollectionEntry()
4364 +// ---------------------------------------------------------------------------------------------
4366 +void FontCollectionEntry::ImplInit( const String& rName )
4368 + String aSubstName( GetSubsFontName( rName, SUBSFONT_ONLYONE | SUBSFONT_MS ) );
4369 + if ( aSubstName.Len() )
4371 + Name = aSubstName;
4372 + bIsConverted = sal_True;
4377 + bIsConverted = sal_False;
4381 +FontCollection::~FontCollection()
4383 + for( void* pStr = List::First(); pStr; pStr = List::Next() )
4384 + delete (FontCollectionEntry*)pStr;
4386 + xPPTBreakIter = NULL;
4387 + xScriptTypeDetector = NULL;
4390 +FontCollection::FontCollection() :
4393 + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
4394 + xMSF = ::comphelper::getProcessServiceFactory();
4395 + com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
4396 + xInterface = xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) );
4397 + if ( xInterface.is() )
4398 + xPPTBreakIter = com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator >
4399 + ( xInterface, com::sun::star::uno::UNO_QUERY );
4401 + xInterface = xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.i18n.ScriptTypeDetector" ) );
4402 + if ( xInterface.is() )
4403 + xScriptTypeDetector = com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector >
4404 + ( xInterface, com::sun::star::uno::UNO_QUERY );
4407 +short FontCollection::GetScriptDirection( const String& rString ) const
4409 + short nRet = com::sun::star::i18n::ScriptDirection::NEUTRAL;
4410 + if ( xScriptTypeDetector.is() )
4412 + const rtl::OUString sT( rString );
4413 + nRet = xScriptTypeDetector->getScriptDirection( sT, 0, com::sun::star::i18n::ScriptDirection::NEUTRAL );
4418 +sal_uInt32 FontCollection::GetId( FontCollectionEntry& rEntry )
4420 + if( rEntry.Name.Len() )
4422 + const sal_uInt32 nFonts = GetCount();
4424 + for( sal_uInt32 i = 0; i < nFonts; i++ )
4426 + const FontCollectionEntry* pEntry = GetById( i );
4427 + if( pEntry->Name == rEntry.Name )
4431 + aFont.SetCharSet( rEntry.CharSet );
4432 + aFont.SetName( rEntry.Original );
4433 +// aFont.SetFamily( rEntry.Family );
4434 +// aFont.SetPitch( rEntry.Pitch );
4435 + aFont.SetHeight( 100 );
4438 + pVDev = new VirtualDevice;
4440 + pVDev->SetFont( aFont );
4441 + FontMetric aMetric( pVDev->GetFontMetric() );
4443 + sal_uInt16 nTxtHeight = (sal_uInt16)aMetric.GetAscent() + (sal_uInt16)aMetric.GetDescent();
4447 + double fScaling = (double)nTxtHeight / 120.0;
4448 + if ( ( fScaling > 0.50 ) && ( fScaling < 1.5 ) )
4449 + rEntry.Scaling = fScaling;
4452 + List::Insert( new FontCollectionEntry( rEntry ), LIST_APPEND );
4458 +const FontCollectionEntry* FontCollection::GetById( sal_uInt32 nId )
4460 + return (FontCollectionEntry*)List::GetObject( nId );
4463 +// ---------------------------------------------------------------------------------------------
4465 +sal_uInt32 PPTWriter::ImplVBAInfoContainer( SvStream* pStrm )
4467 + sal_uInt32 nSize = 28;
4470 + *pStrm << (sal_uInt32)( 0x1f | ( EPP_VBAInfo << 16 ) )
4471 + << (sal_uInt32)( nSize - 8 )
4472 + << (sal_uInt32)( 2 | ( EPP_VBAInfoAtom << 16 ) )
4473 + << (sal_uInt32)12;
4474 + mpPptEscherEx->InsertPersistOffset( EPP_Persist_VBAInfoAtom, pStrm->Tell() );
4475 + *pStrm << (sal_uInt32)0
4482 +// ---------------------------------------------------------------------------------------------
4484 +sal_uInt32 PPTWriter::ImplSlideViewInfoContainer( sal_uInt32 nInstance, SvStream* pStrm )
4486 + sal_uInt32 nSize = 111;
4489 + sal_uInt8 bShowGuides = 0;
4490 + sal_uInt8 bSnapToGrid = 1;
4491 + sal_uInt8 bSnapToShape = 0;
4493 + sal_Int32 nScaling = 85;
4494 + sal_Int32 nMasterCoordinate = 0xdda;
4495 + sal_Int32 nXOrigin = -780;
4496 + sal_Int32 nYOrigin = -84;
4498 + sal_Int32 nPosition1 = 0x870;
4499 + sal_Int32 nPosition2 = 0xb40;
4505 + nMasterCoordinate = 0xf0c;
4508 + nPosition1 = 0xb40;
4509 + nPosition2 = 0x870;
4511 + *pStrm << (sal_uInt32)( 0xf | ( EPP_SlideViewInfo << 16 ) | ( nInstance << 4 ) )
4512 + << (sal_uInt32)( nSize - 8 )
4513 + << (sal_uInt32)( EPP_SlideViewInfoAtom << 16 ) << (sal_uInt32)3
4514 + << bShowGuides << bSnapToGrid << bSnapToShape
4515 + << (sal_uInt32)( EPP_ViewInfoAtom << 16 ) << (sal_uInt32)52
4516 + << nScaling << (sal_Int32)100 << nScaling << (sal_Int32)100 // scaling atom - Keeps the current scale
4517 + << nScaling << (sal_Int32)100 << nScaling << (sal_Int32)100 // scaling atom - Keeps the previous scale
4518 + << (sal_Int32)0x17ac << nMasterCoordinate// Origin - Keeps the origin in master coordinates
4519 + << nXOrigin << nYOrigin // Origin
4520 + << (sal_uInt8)1 // Bool1 varScale - Set if zoom to fit is set
4521 + << (sal_uInt8)0 // bool1 draftMode - Not used
4522 + << (sal_uInt16)0 // padword
4523 + << (sal_uInt32)( ( 7 << 4 ) | ( EPP_GuideAtom << 16 ) ) << (sal_uInt32)8
4524 + << (sal_uInt32)0 // Type of the guide. If the guide is horizontal this value is zero. If it's vertical, it's one.
4525 + << nPosition1 // Position of the guide in master coordinates. X coordinate if it's vertical, and Y coordinate if it's horizontal.
4526 + << (sal_uInt32)( ( 7 << 4 ) | ( EPP_GuideAtom << 16 ) ) << (sal_uInt32)8
4527 + << (sal_Int32)1 // Type of the guide. If the guide is horizontal this value is zero. If it's vertical, it's one.
4528 + << nPosition2; // Position of the guide in master coordinates. X coordinate if it's vertical, and Y coordinate if it's horizontal.
4533 +// ---------------------------------------------------------------------------------------------
4535 +sal_uInt32 PPTWriter::ImplOutlineViewInfoContainer( SvStream* pStrm )
4537 + sal_uInt32 nSize = 68;
4540 + *pStrm << (sal_uInt32)( 0xf | ( EPP_OutlineViewInfo << 16 ) ) << (sal_uInt32)( nSize - 8 )
4541 + << (sal_uInt32)( EPP_ViewInfoAtom << 16 ) << (sal_uInt32)52
4542 + << (sal_Int32)170 << (sal_Int32)200 << (sal_Int32)170 << (sal_Int32)200 // scaling atom - Keeps the current scale
4543 + << (sal_Int32)170 << (sal_Int32)200 << (sal_Int32)170 << (sal_Int32)200 // scaling atom - Keeps the previous scale
4544 + << (sal_Int32)0x17ac << 0xdda // Origin - Keeps the origin in master coordinates
4545 + << (sal_Int32)-780 << (sal_Int32)-84 // Origin
4546 + << (sal_uInt8)1 // bool1 varScale - Set if zoom to fit is set
4547 + << (sal_uInt8)0 // bool1 draftMode - Not used
4548 + << (sal_uInt16)0; // padword
4553 +// ---------------------------------------------------------------------------------------------
4555 +sal_uInt32 PPTWriter::ImplProgBinaryTag( SvStream* pStrm )
4557 + sal_uInt32 nPictureStreamSize, nOutlineStreamSize, nSize = 8;
4559 + nPictureStreamSize = aBuExPictureStream.Tell();
4560 + if ( nPictureStreamSize )
4561 + nSize += nPictureStreamSize + 8;
4563 + nOutlineStreamSize = aBuExOutlineStream.Tell();
4564 + if ( nOutlineStreamSize )
4565 + nSize += nOutlineStreamSize + 8;
4569 + *pStrm << (sal_uInt32)( EPP_BinaryTagData << 16 ) << (sal_uInt32)( nSize - 8 );
4570 + if ( nPictureStreamSize )
4572 + *pStrm << (sal_uInt32)( 0xf | ( EPP_PST_ExtendedBuGraContainer << 16 ) ) << nPictureStreamSize;
4573 + pStrm->Write( aBuExPictureStream.GetData(), nPictureStreamSize );
4575 + if ( nOutlineStreamSize )
4577 + *pStrm << (sal_uInt32)( 0xf | ( EPP_PST_ExtendedPresRuleContainer << 16 ) ) << nOutlineStreamSize;
4578 + pStrm->Write( aBuExOutlineStream.GetData(), nOutlineStreamSize );
4584 +// ---------------------------------------------------------------------------------------------
4586 +sal_uInt32 PPTWriter::ImplProgBinaryTagContainer( SvStream* pStrm, SvMemoryStream* pBinTagStrm )
4588 + sal_uInt32 nSize = 8 + 8 + 14;
4591 + *pStrm << (sal_uInt32)( 0xf | ( EPP_ProgBinaryTag << 16 ) ) << (sal_uInt32)0
4592 + << (sal_uInt32)( EPP_CString << 16 ) << (sal_uInt32)14
4593 + << (sal_uInt32)0x5f005f << (sal_uInt32)0x50005f
4594 + << (sal_uInt32)0x540050 << (sal_uInt16)0x39;
4596 + if ( pBinTagStrm )
4598 + sal_uInt32 nLen = pBinTagStrm->Tell();
4599 + nSize += nLen + 8;
4600 + *pStrm << (sal_uInt32)( EPP_BinaryTagData << 16 ) << nLen;
4601 + pStrm->Write( pBinTagStrm->GetData(), nLen );
4604 + nSize += ImplProgBinaryTag( pStrm );
4608 + pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
4609 + *pStrm << (sal_uInt32)( nSize - 8 );
4610 + pStrm->SeekRel( nSize - 8 );
4615 +// ---------------------------------------------------------------------------------------------
4617 +sal_uInt32 PPTWriter::ImplProgTagContainer( SvStream* pStrm, SvMemoryStream* pBinTagStrm )
4619 + sal_uInt32 nSize = 0;
4620 + if ( aBuExPictureStream.Tell() || aBuExOutlineStream.Tell() || pBinTagStrm )
4625 + *pStrm << (sal_uInt32)( 0xf | ( EPP_ProgTags << 16 ) ) << (sal_uInt32)0;
4627 + nSize += ImplProgBinaryTagContainer( pStrm, pBinTagStrm );
4630 + pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
4631 + *pStrm << (sal_uInt32)( nSize - 8 );
4632 + pStrm->SeekRel( nSize - 8 );
4638 +// ---------------------------------------------------------------------------------------------
4640 +sal_uInt32 PPTWriter::ImplDocumentListContainer( SvStream* pStrm )
4642 + sal_uInt32 nSize = 8;
4645 + *pStrm << (sal_uInt32)( ( EPP_List << 16 ) | 0xf ) << (sal_uInt32)0;
4648 + nSize += ImplVBAInfoContainer( pStrm );
4649 + nSize += ImplSlideViewInfoContainer( 0, pStrm );
4650 + nSize += ImplOutlineViewInfoContainer( pStrm );
4651 + nSize += ImplSlideViewInfoContainer( 1, pStrm );
4652 + nSize += ImplProgTagContainer( pStrm );
4656 + pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
4657 + *pStrm << (sal_uInt32)( nSize - 8 );
4658 + pStrm->SeekRel( nSize - 8 );
4663 +// ---------------------------------------------------------------------------------------------
4665 +sal_uInt32 PPTWriter::ImplMasterSlideListContainer( SvStream* pStrm )
4667 + sal_uInt32 i, nSize = 28 * mnMasterPages + 8;
4670 + *pStrm << (sal_uInt32)( 0x1f | ( EPP_SlideListWithText << 16 ) ) << (sal_uInt32)( nSize - 8 );
4672 + for ( i = 0; i < mnMasterPages; i++ )
4674 + *pStrm << (sal_uInt32)( EPP_SlidePersistAtom << 16 ) << (sal_uInt32)20;
4675 + mpPptEscherEx->InsertPersistOffset( EPP_MAINMASTER_PERSIST_KEY | i, pStrm->Tell() );
4676 + *pStrm << (sal_uInt32)0 // psrReference - logical reference to the slide persist object ( EPP_MAINMASTER_PERSIST_KEY )
4677 + << (sal_uInt32)0 // flags - only bit 3 used, if set then slide contains shapes other than placeholders
4678 + << (sal_Int32)0 // numberTexts - number of placeholder texts stored with the persist object. Allows to display outline view without loading the slide persist objects
4679 + << (sal_Int32)( 0x80000000 | i ) // slideId - Unique slide identifier, used for OLE link monikers for example
4680 + << (sal_uInt32)0; // reserved, usualy 0
4686 +// ---------------------------------------------------------------------------------------------
4688 +sal_uInt32 PPTWriter::ImplInsertBookmarkURL( const String& rBookmarkURL, const sal_uInt32 nType,
4689 + const String& rStringVer0, const String& rStringVer1, const String& rStringVer2, const String& rStringVer3 )
4691 + sal_uInt32 nHyperId = ++mnExEmbed;
4692 + maHyperlink.Insert( new EPPTHyperlink( rBookmarkURL, nType ), LIST_APPEND );
4694 + *mpExEmbed << (sal_uInt16)0xf
4695 + << (sal_uInt16)EPP_ExHyperlink
4697 + sal_uInt32 nHyperSize, nHyperStart = mpExEmbed->Tell();
4698 + *mpExEmbed << (sal_uInt16)0
4699 + << (sal_uInt16)EPP_ExHyperlinkAtom
4703 + sal_uInt16 i, nStringLen;
4704 + nStringLen = rStringVer0.Len();
4707 + *mpExEmbed << (sal_uInt32)( EPP_CString << 16 ) << (sal_uInt32)( nStringLen * 2 );
4708 + for ( i = 0; i < nStringLen; i++ )
4710 + *mpExEmbed << rStringVer0.GetChar( i );
4713 + nStringLen = rStringVer1.Len();
4716 + *mpExEmbed << (sal_uInt32)( ( EPP_CString << 16 ) | 0x10 ) << (sal_uInt32)( nStringLen * 2 );
4717 + for ( i = 0; i < nStringLen; i++ )
4719 + *mpExEmbed << rStringVer1.GetChar( i );
4722 + nStringLen = rStringVer2.Len();
4725 + *mpExEmbed << (sal_uInt32)( ( EPP_CString << 16 ) | 0x20 ) << (sal_uInt32)( nStringLen * 2 );
4726 + for ( i = 0; i < nStringLen; i++ )
4728 + *mpExEmbed << rStringVer2.GetChar( i );
4731 + nStringLen = rStringVer3.Len();
4734 + *mpExEmbed << (sal_uInt32)( ( EPP_CString << 16 ) | 0x30 ) << (sal_uInt32)( nStringLen * 2 );
4735 + for ( i = 0; i < nStringLen; i++ )
4737 + *mpExEmbed << rStringVer3.GetChar( i );
4740 + nHyperSize = mpExEmbed->Tell() - nHyperStart;
4741 + mpExEmbed->SeekRel( - ( (sal_Int32)nHyperSize + 4 ) );
4742 + *mpExEmbed << nHyperSize;
4743 + mpExEmbed->SeekRel( nHyperSize );
4747 +// ---------------------------------------------------------------------------------------------
4749 +sal_Bool PPTWriter::ImplCloseDocument()
4751 + sal_uInt32 nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_Document );
4754 + mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_CurrentPos, mpStrm->Tell() );
4755 + mpStrm->Seek( nOfs );
4757 + // creating the TxMasterStyleAtom
4758 + SvMemoryStream aTxMasterStyleAtomStrm( 0x200, 0x200 );
4760 + EscherExAtom aTxMasterStyleAtom( aTxMasterStyleAtomStrm, EPP_TxMasterStyleAtom, EPP_TEXTTYPE_Other );
4761 + aTxMasterStyleAtomStrm << (sal_uInt16)5; // paragraph count
4763 + sal_Bool bFirst = sal_True;
4764 + for ( nLev = 0; nLev < 5; nLev++ )
4766 + mpStyleSheet->mpParaSheet[ EPP_TEXTTYPE_Other ]->Write( aTxMasterStyleAtomStrm, mpPptEscherEx, nLev, bFirst, sal_False, mXPagePropSet );
4767 + mpStyleSheet->mpCharSheet[ EPP_TEXTTYPE_Other ]->Write( aTxMasterStyleAtomStrm, mpPptEscherEx, nLev, bFirst, sal_False, mXPagePropSet );
4768 + bFirst = sal_False;
4772 + mpExEmbed->Seek( STREAM_SEEK_TO_END );
4773 + sal_uInt32 nExEmbedSize = mpExEmbed->Tell();
4775 + // nEnviroment : Gesamtgroesse des Environment Containers
4776 + sal_uInt32 nEnvironment = maFontCollection.GetCount() * 76 // 68 bytes pro Fontenityatom und je 8 Bytes fuer die Header
4777 + + 8 // 1 FontCollection Container
4778 + + 20 // SrKinsoku Container
4779 + + 18 // 1 TxSiStyleAtom
4780 + + aTxMasterStyleAtomStrm.Tell() // 1 TxMasterStyleAtom;
4781 + + mpStyleSheet->SizeOfTxCFStyleAtom();
4783 + sal_uInt32 nBytesToInsert = nEnvironment + 8;
4785 + if ( nExEmbedSize )
4786 + nBytesToInsert += nExEmbedSize + 8 + 12;
4788 + nBytesToInsert += maSoundCollection.GetSize();
4789 + nBytesToInsert += mpPptEscherEx->DrawingGroupContainerSize();
4790 + nBytesToInsert += ImplMasterSlideListContainer( NULL );
4791 + nBytesToInsert += ImplDocumentListContainer( NULL );
4793 + // nBytes im Stream einfuegen, und abhaengige Container anpassen
4794 + mpPptEscherEx->InsertAtCurrentPos( nBytesToInsert, TRUE );
4796 + // CREATE HYPERLINK CONTAINER
4797 + if ( nExEmbedSize )
4799 + *mpStrm << (sal_uInt16)0xf
4800 + << (sal_uInt16)EPP_ExObjList
4801 + << (sal_uInt32)( nExEmbedSize + 12 )
4803 + << (sal_uInt16)EPP_ExObjListAtom
4805 + << (sal_uInt32)mnExEmbed;
4806 + mpPptEscherEx->InsertPersistOffset( EPP_Persist_ExObj, mpStrm->Tell() );
4807 + mpStrm->Write( mpExEmbed->GetData(), nExEmbedSize );
4810 + // CREATE ENVIRONMENT
4811 + *mpStrm << (sal_uInt16)0xf << (sal_uInt16)EPP_Environment << (sal_uInt32)nEnvironment;
4813 + // Open Container ( EPP_SrKinsoku )
4814 + *mpStrm << (sal_uInt16)0x2f << (sal_uInt16)EPP_SrKinsoku << (sal_uInt32)12;
4815 + mpPptEscherEx->AddAtom( 4, EPP_SrKinsokuAtom, 0, 3 );
4816 + *mpStrm << (sal_Int32)0; // SrKinsoku Level 0
4818 + // Open Container ( EPP_FontCollection )
4819 + *mpStrm << (sal_uInt16)0xf << (sal_uInt16)EPP_FontCollection << (sal_uInt32)maFontCollection.GetCount() * 76;
4821 + for ( sal_uInt32 i = 0; i < maFontCollection.GetCount(); i++ )
4823 + mpPptEscherEx->AddAtom( 68, EPP_FontEnityAtom, 0, i );
4824 + const FontCollectionEntry* pDesc = maFontCollection.GetById( i );
4825 + sal_uInt32 nFontLen = pDesc->Name.Len();
4826 + if ( nFontLen > 31 )
4828 + for ( sal_uInt16 n = 0; n < 32; n++ )
4830 + sal_Unicode nUniCode = 0;
4831 + if ( n < nFontLen )
4832 + nUniCode = pDesc->Name.GetChar( n );
4833 + *mpStrm << nUniCode;
4835 + sal_uInt8 lfCharSet = ANSI_CHARSET;
4836 + sal_uInt8 lfClipPrecision = 0;
4837 + sal_uInt8 lfQuality = 6;
4838 + sal_uInt8 lfPitchAndFamily = 0;
4840 + if ( pDesc->CharSet == RTL_TEXTENCODING_SYMBOL )
4841 + lfCharSet = SYMBOL_CHARSET;
4843 + switch( pDesc->Family )
4845 + case ::com::sun::star::awt::FontFamily::ROMAN :
4846 + lfPitchAndFamily |= FF_ROMAN;
4849 + case ::com::sun::star::awt::FontFamily::SWISS :
4850 + lfPitchAndFamily |= FF_SWISS;
4853 + case ::com::sun::star::awt::FontFamily::MODERN :
4854 + lfPitchAndFamily |= FF_MODERN;
4857 + case ::com::sun::star::awt::FontFamily::SCRIPT:
4858 + lfPitchAndFamily |= FF_SCRIPT;
4861 + case ::com::sun::star::awt::FontFamily::DECORATIVE:
4862 + lfPitchAndFamily |= FF_DECORATIVE;
4866 + lfPitchAndFamily |= FAMILY_DONTKNOW;
4869 + switch( pDesc->Pitch )
4871 + case ::com::sun::star::awt::FontPitch::FIXED:
4872 + lfPitchAndFamily |= FIXED_PITCH;
4876 + lfPitchAndFamily |= DEFAULT_PITCH;
4879 + *mpStrm << lfCharSet
4880 + << lfClipPrecision
4882 + << lfPitchAndFamily;
4884 + mpStyleSheet->WriteTxCFStyleAtom( *mpStrm ); // create style that is used for new standard objects
4885 + mpPptEscherEx->AddAtom( 10, EPP_TxSIStyleAtom );
4886 + *mpStrm << (sal_uInt32)7 // ?
4887 + << (sal_Int16)2 // ?
4888 + << (sal_uInt8)9 // ?
4889 + << (sal_uInt8)8 // ?
4890 + << (sal_Int16)0; // ?
4892 + mpStrm->Write( aTxMasterStyleAtomStrm.GetData(), aTxMasterStyleAtomStrm.Tell() );
4893 + maSoundCollection.Write( *mpStrm );
4894 + mpPptEscherEx->WriteDrawingGroupContainer( *mpStrm );
4895 + ImplMasterSlideListContainer( mpStrm );
4896 + ImplDocumentListContainer( mpStrm );
4898 + sal_uInt32 nOldPos = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_CurrentPos );
4901 + mpStrm->Seek( nOldPos );
4908 +// ---------------------------------------------------------------------------------------------
4910 +sal_Bool PropValue::GetPropertyValue(
4911 + ::com::sun::star::uno::Any& rAny,
4912 + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
4913 + const String& rString,
4914 + sal_Bool bTestPropertyAvailability )
4916 + sal_Bool bRetValue = sal_True;
4917 + if ( bTestPropertyAvailability )
4919 + bRetValue = sal_False;
4922 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
4923 + aXPropSetInfo( rXPropSet->getPropertySetInfo() );
4924 + if ( aXPropSetInfo.is() )
4925 + bRetValue = aXPropSetInfo->hasPropertyByName( rString );
4927 + catch( ::com::sun::star::uno::Exception& )
4929 + bRetValue = sal_False;
4936 + rAny = rXPropSet->getPropertyValue( rString );
4937 + if ( !rAny.hasValue() )
4938 + bRetValue = sal_False;
4940 + catch( ::com::sun::star::uno::Exception& )
4942 + bRetValue = sal_False;
4948 +// ---------------------------------------------------------------------------------------------
4950 +::com::sun::star::beans::PropertyState PropValue::GetPropertyState(
4951 + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
4952 + const String& rPropertyName )
4954 + ::com::sun::star::beans::PropertyState eRetValue = ::com::sun::star::beans::PropertyState_AMBIGUOUS_VALUE;
4957 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > aXPropState
4958 + ( rXPropSet, ::com::sun::star::uno::UNO_QUERY );
4959 + if ( aXPropState.is() )
4960 + eRetValue = aXPropState->getPropertyState( rPropertyName );
4962 + catch( ::com::sun::star::uno::Exception& )
4969 +// ---------------------------------------------------------------------------------------------
4971 +sal_Bool PropValue::ImplGetPropertyValue( const String& rString )
4973 + return GetPropertyValue( mAny, mXPropSet, rString );
4976 +// ---------------------------------------------------------------------------------------------
4978 +sal_Bool PropValue::ImplGetPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & aXPropSet, const String& rString )
4980 + return GetPropertyValue( mAny, aXPropSet, rString );
4983 +// ---------------------------------------------------------------------------------------------
4985 +sal_Bool PropStateValue::ImplGetPropertyValue( const String& rString, sal_Bool bGetPropertyState )
4987 + ePropState = ::com::sun::star::beans::PropertyState_AMBIGUOUS_VALUE;
4988 + sal_Bool bRetValue = TRUE;
4990 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
4991 + aXPropSetInfo( mXPropSet->getPropertySetInfo() );
4992 + if ( !aXPropSetInfo.is() )
4997 + mAny = mXPropSet->getPropertyValue( rString );
4998 + if ( !mAny.hasValue() )
4999 + bRetValue = FALSE;
5000 + else if ( bGetPropertyState )
5001 + ePropState = mXPropState->getPropertyState( rString );
5003 + ePropState = ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
5005 + catch( ::com::sun::star::uno::Exception& )
5007 + bRetValue = FALSE;
5012 +// ---------------------------------------------------------------------------------------------
5014 +sal_Bool PPTWriter::ImplInitSOIface()
5018 + mXDrawPagesSupplier = ::com::sun::star::uno::Reference<
5019 + ::com::sun::star::drawing::XDrawPagesSupplier >
5020 + ( mXModel, ::com::sun::star::uno::UNO_QUERY );
5021 + if ( !mXDrawPagesSupplier.is() )
5024 + mXMasterPagesSupplier = ::com::sun::star::uno::Reference<
5025 + ::com::sun::star::drawing::XMasterPagesSupplier >
5026 + ( mXModel, ::com::sun::star::uno::UNO_QUERY );
5027 + if ( !mXMasterPagesSupplier.is() )
5029 + mXDrawPages = mXMasterPagesSupplier->getMasterPages();
5030 + if ( !mXDrawPages.is() )
5032 + mnMasterPages = mXDrawPages->getCount();
5033 + mXDrawPages = mXDrawPagesSupplier->getDrawPages();
5034 + if( !mXDrawPages.is() )
5036 + mnPages = mXDrawPages->getCount();
5037 + if ( !ImplGetPageByIndex( 0, NORMAL ) )
5045 +// ---------------------------------------------------------------------------------------------
5047 +sal_Bool PPTWriter::ImplSetCurrentStyleSheet( sal_uInt32 nPageNum )
5049 + sal_Bool bRet = sal_False;
5050 + if ( nPageNum >= maStyleSheetList.size() )
5054 + mpStyleSheet = maStyleSheetList[ nPageNum ];
5058 +// ---------------------------------------------------------------------------------------------
5060 +sal_Bool PPTWriter::ImplGetPageByIndex( sal_uInt32 nIndex, PageType ePageType )
5064 + if ( ePageType != meLatestPageType )
5066 + switch( ePageType )
5071 + mXDrawPages = mXDrawPagesSupplier->getDrawPages();
5072 + if( !mXDrawPages.is() )
5079 + mXDrawPages = mXMasterPagesSupplier->getMasterPages();
5080 + if( !mXDrawPages.is() )
5087 + meLatestPageType = ePageType;
5089 + ::com::sun::star::uno::Any aAny( mXDrawPages->getByIndex( nIndex ) );
5090 + aAny >>= mXDrawPage;
5091 + if ( !mXDrawPage.is() )
5093 + if ( ePageType == NOTICE )
5095 + ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentationPage >
5096 + aXPresentationPage( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
5097 + if ( !aXPresentationPage.is() )
5099 + mXDrawPage = aXPresentationPage->getNotesPage();
5100 + if ( !mXDrawPage.is() )
5103 + mXPagePropSet = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
5104 + ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
5105 + if ( !mXPagePropSet.is() )
5108 + mXShapes = ::com::sun::star::uno::Reference<
5109 + ::com::sun::star::drawing::XShapes >
5110 + ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
5111 + if ( !mXShapes.is() )
5114 + /* try to get the "real" background PropertySet. If the normal page is not supporting this property, it is
5115 + taken the property from the master */
5116 + sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ), sal_True );
5117 + if ( bHasBackground )
5118 + bHasBackground = ( aAny >>= mXBackgroundPropSet );
5119 + if ( !bHasBackground )
5121 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget >
5122 + aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
5123 + if ( aXMasterPageTarget.is() )
5125 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > aXMasterDrawPage;
5126 + aXMasterDrawPage = aXMasterPageTarget->getMasterPage();
5127 + if ( aXMasterDrawPage.is() )
5129 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXMasterPagePropSet;
5130 + aXMasterPagePropSet = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
5131 + ( aXMasterDrawPage, ::com::sun::star::uno::UNO_QUERY );
5132 + if ( aXMasterPagePropSet.is() )
5134 + sal_Bool bBackground = GetPropertyValue( aAny, aXMasterPagePropSet,
5135 + String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) );
5136 + if ( bBackground )
5138 + aAny >>= mXBackgroundPropSet;
5149 +// ---------------------------------------------------------------------------------------------
5151 +sal_Bool PPTWriter::ImplGetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup )
5155 + if ( ( bGroup == FALSE ) || ( GetCurrentGroupLevel() == 0 ) )
5157 + ::com::sun::star::uno::Any aAny( mXShapes->getByIndex( nIndex ) );
5162 + ::com::sun::star::uno::Any aAny( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() ) );
5165 + if ( !mXShape.is() )
5168 + ::com::sun::star::uno::Any aAny( mXShape->queryInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >*) 0 ) ));
5169 + aAny >>= mXPropSet;
5171 + if ( !mXPropSet.is() )
5173 + maPosition = ImplMapPoint( mXShape->getPosition() );
5174 + maSize = ImplMapSize( mXShape->getSize() );
5175 + maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
5176 + mType = ByteString( String( mXShape->getShapeType() ), RTL_TEXTENCODING_UTF8 );
5177 + mType.Erase( 0, 13 ); // "com.sun.star." entfernen
5178 + sal_uInt16 nPos = mType.Search( (const char*)"Shape" );
5179 + mType.Erase( nPos, 5 );
5181 + mbPresObj = mbEmptyPresObj = FALSE;
5182 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsPresentationObject" ) ) ) )
5183 + mAny >>= mbPresObj;
5185 + if ( mbPresObj && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsEmptyPresentationObject" ) ) ) )
5186 + mAny >>= mbEmptyPresObj;
5188 + mnAngle = ( PropValue::GetPropertyValue( aAny,
5189 + mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), sal_True ) )
5190 + ? *((sal_Int32*)aAny.getValue() )
5198 +// -----------------------------------------------------------------------
5200 +sal_uInt32 PPTWriter::ImplGetMasterIndex( PageType ePageType )
5202 + sal_uInt32 nRetValue = 0;
5203 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget >
5204 + aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
5206 + if ( aXMasterPageTarget.is() )
5208 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
5209 + aXDrawPage = aXMasterPageTarget->getMasterPage();
5210 + if ( aXDrawPage.is() )
5212 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
5213 + aXPropertySet( aXDrawPage, ::com::sun::star::uno::UNO_QUERY );
5215 + if ( aXPropertySet.is() )
5217 + if ( ImplGetPropertyValue( aXPropertySet, String( RTL_CONSTASCII_USTRINGPARAM( "Number" ) ) ) )
5218 + nRetValue |= *(sal_Int16*)mAny.getValue();
5219 + if ( nRetValue & 0xffff ) // ueberlauf vermeiden
5224 + if ( ePageType == NOTICE )
5225 + nRetValue += mnMasterPages;
5229 +// -----------------------------------------------------------------------
5231 +sal_Bool PPTWriter::ImplGetStyleSheets()
5233 + int nInstance, nLevel;
5234 + sal_Bool bRetValue = sal_False;
5235 + sal_uInt32 nPageNum;
5237 + for ( nPageNum = 0; nPageNum < mnMasterPages; nPageNum++ )
5239 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed >
5242 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
5245 + ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyleFamiliesSupplier >
5246 + aXStyleFamiliesSupplier( mXModel, ::com::sun::star::uno::UNO_QUERY );
5248 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
5249 + aXPropSet( mXModel, ::com::sun::star::uno::UNO_QUERY );
5251 + sal_uInt16 nDefaultTab = ( aXPropSet.is() && ImplGetPropertyValue( aXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TabStop" ) ) ) )
5252 + ? (sal_uInt16)( *(sal_Int32*)mAny.getValue() / 4.40972 )
5255 + maStyleSheetList.push_back( new PPTExStyleSheet( nDefaultTab, (PPTExBulletProvider&)*this ) );
5256 + ImplSetCurrentStyleSheet( nPageNum );
5257 + if ( ImplGetPageByIndex( nPageNum, MASTER ) )
5258 + aXNamed = ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed >
5259 + ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
5261 + if ( aXStyleFamiliesSupplier.is() )
5262 + aXNameAccess = aXStyleFamiliesSupplier->getStyleFamilies();
5264 + bRetValue = aXNamed.is() && aXNameAccess.is() && aXStyleFamiliesSupplier.is();
5267 + for ( nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_CenterTitle; nInstance++ )
5271 + switch ( nInstance )
5273 + case EPP_TEXTTYPE_CenterTitle :
5274 + case EPP_TEXTTYPE_Title :
5276 + aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "title" ) );
5277 + aFamily = aXNamed->getName();
5280 + case EPP_TEXTTYPE_Body :
5282 + aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "outline1" ) ); // SD_LT_SEPARATOR
5283 + aFamily = aXNamed->getName();
5286 + case EPP_TEXTTYPE_Other :
5288 + aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "standard" ) );
5289 + aFamily = String( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) );
5292 + case EPP_TEXTTYPE_CenterBody :
5294 + aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "subtitle" ) );
5295 + aFamily = aXNamed->getName();
5299 + if ( aStyle.Len() && aFamily.Len() )
5303 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >xNameAccess;
5304 + if ( aXNameAccess->hasByName( aFamily ) )
5306 + ::com::sun::star::uno::Any aAny( aXNameAccess->getByName( aFamily ) );
5307 + if( aAny.getValue() && ::cppu::extractInterface( xNameAccess, aAny ) )
5309 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > aXFamily;
5310 + if ( aAny >>= aXFamily )
5312 + if ( aXFamily->hasByName( aStyle ) )
5314 + ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > xStyle;
5315 + aAny = aXFamily->getByName( aStyle );
5316 + if( aAny.getValue() && ::cppu::extractInterface( xStyle, aAny ) )
5318 + ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > aXStyle;
5320 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
5321 + xPropSet( aXStyle, ::com::sun::star::uno::UNO_QUERY );
5322 + if( xPropSet.is() )
5323 + mpStyleSheet->SetStyleSheet( xPropSet, maFontCollection, nInstance, 0 );
5324 + for ( nLevel = 1; nLevel < 5; nLevel++ )
5326 + if ( nInstance == EPP_TEXTTYPE_Body )
5328 + sal_Unicode cTemp = aStyle.GetChar( aStyle.Len() - 1 );
5329 + aStyle.SetChar( aStyle.Len() - 1, ++cTemp );
5330 + if ( aXFamily->hasByName( aStyle ) )
5332 + aXFamily->getByName( aStyle ) >>= xStyle;
5335 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
5336 + xPropertySet( xStyle, ::com::sun::star::uno::UNO_QUERY );
5337 + if ( xPropertySet.is() )
5338 + mpStyleSheet->SetStyleSheet( xPropertySet, maFontCollection, nInstance, nLevel );
5343 + mpStyleSheet->SetStyleSheet( xPropSet, maFontCollection, nInstance, nLevel );
5351 + catch( ::com::sun::star::uno::Exception& )
5357 + for ( ; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
5366 +// -----------------------------------------------------------------------
5368 +void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj )
5370 + sal_Bool bFirstParagraph = TRUE;
5371 + sal_uInt32 nCharCount;
5372 + sal_uInt32 nPropertyFlags = 0;
5373 + sal_uInt16 nDepth = 0;
5374 + sal_Int16 nLineSpacing;
5375 + int nInstance = rTextObj.GetInstance();
5377 + for ( ParagraphObj* pPara = rTextObj.First() ; pPara; pPara = rTextObj.Next(), bFirstParagraph = FALSE )
5379 + PortionObj* pPortion = (PortionObj*)pPara->First();
5380 + nCharCount = pPara->Count();
5382 + nDepth = pPara->nDepth;
5386 + if ( ( pPara->meTextAdjust == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
5387 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_Adjust, pPara->mnTextAdjust ) ) )
5388 + nPropertyFlags |= 0x00000800;
5389 + nLineSpacing = pPara->mnLineSpacing;
5391 + const FontCollectionEntry* pDesc = maFontCollection.GetById( pPortion->mnFont );
5392 + sal_Int16 nNormalSpacing = 100;
5393 + if ( !mbFontIndependentLineSpacing && pDesc )
5395 + double fN = 100.0;
5396 + fN *= pDesc->Scaling;
5397 + nNormalSpacing = (sal_Int16)( fN + 0.5 );
5399 + if ( !mbFontIndependentLineSpacing && bFirstParagraph && ( nLineSpacing > nNormalSpacing ) ) // sj: i28747, no replacement for fixed linespacing
5401 + nLineSpacing = nNormalSpacing;
5402 + nPropertyFlags |= 0x00001000;
5406 + if ( nLineSpacing > 0 )
5408 + if ( !mbFontIndependentLineSpacing && pDesc )
5409 + nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
5413 + if ( !pPara->mbFixedLineSpacing && pPortion && pPortion->mnCharHeight > (sal_uInt16)( ((double)-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point
5414 + nLineSpacing = nNormalSpacing;
5416 + nLineSpacing = (sal_Int16)( (double)nLineSpacing / 4.40972 );
5418 + if ( ( pPara->meLineSpacing == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
5419 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_LineFeed, nLineSpacing ) ) )
5420 + nPropertyFlags |= 0x00001000;
5422 + if ( ( pPara->meLineSpacingTop == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
5423 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mnLineSpacingTop ) ) )
5424 + nPropertyFlags |= 0x00002000;
5425 + if ( ( pPara->meLineSpacingBottom == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
5426 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_LowerDist, pPara->mnLineSpacingBottom ) ) )
5427 + nPropertyFlags |= 0x00004000;
5428 + if ( ( pPara->meForbiddenRules == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
5429 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mbForbiddenRules ) ) )
5430 + nPropertyFlags |= 0x00020000;
5431 + if ( ( pPara->meParagraphPunctation == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
5432 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, ParaAttr_UpperDist, pPara->mbParagraphPunctation ) ) )
5433 + nPropertyFlags |= 0x00080000;
5434 + if ( ( pPara->meBiDi == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
5435 + ( mpStyleSheet->IsHardAttribute( nInstance, nDepth, ParaAttr_BiDi, pPara->mnBiDi ) ) )
5436 + nPropertyFlags |= 0x00200000;
5439 + sal_Int32 nBuRealSize = pPara->nBulletRealSize;
5440 + sal_Int16 nBulletFlags = pPara->nBulletFlags;
5442 + if ( pPara->bExtendedParameters )
5443 + nPropertyFlags |= pPara->nParaFlags;
5446 + nPropertyFlags |= 1; // turn off bullet explicit
5449 + FontCollectionEntry aFontDescEntry( pPara->aFontDesc.Name, pPara->aFontDesc.Family, pPara->aFontDesc.Pitch, pPara->aFontDesc.CharSet );
5450 + sal_uInt16 nFontId = (sal_uInt16)maFontCollection.GetId( aFontDescEntry );
5452 + rOut << nCharCount
5453 + << nDepth // Level
5454 + << (sal_uInt32)nPropertyFlags; // Paragraph Attribut Set
5456 + if ( nPropertyFlags & 0xf )
5457 + rOut << nBulletFlags;
5458 + if ( nPropertyFlags & 0x80 )
5459 + rOut << (sal_uInt16)( pPara->cBulletId );
5460 + if ( nPropertyFlags & 0x10 )
5462 + if ( nPropertyFlags & 0x40 )
5463 + rOut << (sal_Int16)nBuRealSize;
5464 + if ( nPropertyFlags & 0x20 )
5466 + sal_uInt32 nBulletColor = pPara->nBulletColor;
5467 + if ( nBulletColor == COL_AUTO )
5469 + sal_Bool bIsDark = sal_False;
5470 + ::com::sun::star::uno::Any aAny;
5471 + if ( PropValue::GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) )
5473 + nBulletColor = bIsDark ? 0xffffff : 0x000000;
5475 + nBulletColor &= 0xffffff;
5476 + nBulletColor |= 0xfe000000;
5477 + rOut << nBulletColor;
5479 + if ( nPropertyFlags & 0x00000800 )
5480 + rOut << (sal_uInt16)( pPara->mnTextAdjust );
5481 + if ( nPropertyFlags & 0x00001000 )
5482 + rOut << (sal_uInt16)( nLineSpacing );
5483 + if ( nPropertyFlags & 0x00002000 )
5484 + rOut << (sal_uInt16)( pPara->mnLineSpacingTop );
5485 + if ( nPropertyFlags & 0x00004000 )
5486 + rOut << (sal_uInt16)( pPara->mnLineSpacingBottom );
5487 + if ( nPropertyFlags & 0x000e0000 )
5489 + sal_uInt16 nAsianSettings = 0;
5490 + if ( pPara->mbForbiddenRules )
5491 + nAsianSettings |= 1;
5492 + if ( pPara->mbParagraphPunctation )
5493 + nAsianSettings |= 4;
5494 + rOut << nAsianSettings;
5496 + if ( nPropertyFlags & 0x200000 )
5497 + rOut << pPara->mnBiDi;
5501 +// -----------------------------------------------------------------------
5503 +void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj )
5505 + sal_uInt32 nPropertyFlags, i = 0;
5506 + int nInstance = rTextObj.GetInstance();
5508 + for ( ParagraphObj* pPara = rTextObj.First(); pPara; pPara = rTextObj.Next(), i++ )
5510 + for ( PortionObj* pPortion = (PortionObj*)pPara->First(); pPortion; pPortion = (PortionObj*)pPara->Next() )
5512 + nPropertyFlags = 0;
5513 + sal_uInt32 nCharAttr = pPortion->mnCharAttr;
5514 + sal_uInt32 nCharColor = pPortion->mnCharColor;
5516 + if ( nCharColor == COL_AUTO ) // nCharColor depends to the background color
5518 + sal_Bool bIsDark = sal_False;
5519 + ::com::sun::star::uno::Any aAny;
5520 + if ( PropValue::GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) )
5522 + nCharColor = bIsDark ? 0xffffff : 0x000000;
5525 + nCharColor &= 0xffffff;
5527 + /* the portion is using the embossed or engraved attribute, which we want to map to the relief feature of PPT.
5528 + Because the relief feature of PPT is dependent to the background color, such a mapping can not always be used. */
5529 + if ( nCharAttr & 0x200 )
5531 + sal_uInt32 nBackgroundColor = 0xffffff;
5533 + if ( !nCharColor ) // special threatment for
5534 + nCharColor = 0xffffff; // black fontcolor
5536 + ::com::sun::star::uno::Any aAny;
5537 + ::com::sun::star::drawing::FillStyle aFS( ::com::sun::star::drawing::FillStyle_NONE );
5538 + if ( PropValue::GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) )
5542 + case ::com::sun::star::drawing::FillStyle_GRADIENT :
5544 + Point aEmptyPoint = Point();
5545 + Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
5546 + EscherPropertyContainer aPropOpt( (EscherGraphicProvider&)*mpPptEscherEx, mpPicStrm, aRect );
5547 + aPropOpt.CreateGradientProperties( mXPropSet );
5548 + aPropOpt.GetOpt( ESCHER_Prop_fillColor, nBackgroundColor );
5551 + case ::com::sun::star::drawing::FillStyle_SOLID :
5553 + if ( PropValue::GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) )
5554 + nBackgroundColor = mpPptEscherEx->GetColor( *((sal_uInt32*)aAny.getValue()) );
5557 + case ::com::sun::star::drawing::FillStyle_NONE :
5559 + ::com::sun::star::uno::Any aBackAny;
5560 + ::com::sun::star::drawing::FillStyle aBackFS( ::com::sun::star::drawing::FillStyle_NONE );
5561 + if ( PropValue::GetPropertyValue( aBackAny, mXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) )
5562 + aBackAny >>= aBackFS;
5565 + case ::com::sun::star::drawing::FillStyle_GRADIENT :
5567 + Point aEmptyPoint = Point();
5568 + Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
5569 + EscherPropertyContainer aPropOpt( (EscherGraphicProvider&)*mpPptEscherEx, mpPicStrm, aRect );
5570 + aPropOpt.CreateGradientProperties( mXBackgroundPropSet );
5571 + aPropOpt.GetOpt( ESCHER_Prop_fillColor, nBackgroundColor );
5574 + case ::com::sun::star::drawing::FillStyle_SOLID :
5576 + if ( PropValue::GetPropertyValue( aAny, mXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) )
5577 + nBackgroundColor = mpPptEscherEx->GetColor( *((sal_uInt32*)aAny.getValue()) );
5589 + sal_Int32 nB = nBackgroundColor & 0xff;
5590 + nB += (sal_uInt8)( nBackgroundColor >> 8 );
5591 + nB += (sal_uInt8)( nBackgroundColor >> 16 );
5592 + // if the background color is nearly black, relief can't been used, because the text would not be visible
5593 + if ( nB < 0x60 || ( nBackgroundColor != nCharColor ) )
5595 + nCharAttr &=~ 0x200;
5597 + // now check if the text is part of a group, and if the previous object has the same color than the fontcolor
5598 + // ( and if fillcolor is not available the background color ), it is sometimes
5599 + // not possible to export the 'embossed' flag
5600 + if ( ( GetCurrentGroupLevel() > 0 ) && ( GetCurrentGroupIndex() >= 1 ) )
5602 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > aGroupedShape( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() - 1 ), uno::UNO_QUERY );
5603 + if( aGroupedShape.is() )
5605 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aPropSetOfNextShape
5606 + ( aGroupedShape, ::com::sun::star::uno::UNO_QUERY );
5607 + if ( aPropSetOfNextShape.is() )
5609 + if ( PropValue::GetPropertyValue( aAny, aPropSetOfNextShape,
5610 + String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ), sal_True ) )
5612 + if ( nCharColor == mpPptEscherEx->GetColor( *((sal_uInt32*)aAny.getValue()) ) )
5614 + nCharAttr |= 0x200;
5622 + nCharColor |= 0xfe000000;
5623 + if ( nInstance == 4 ) // special handling for normal textobjects:
5624 + nPropertyFlags |= nCharAttr & 0x217; // not all attributes ar inherited
5627 + if ( /* ( pPortion->mnCharAttrHard & 1 ) || */
5628 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Bold, nCharAttr ) ) )
5629 + nPropertyFlags |= 1;
5630 + if ( /* ( pPortion->mnCharAttrHard & 2 ) || */
5631 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Italic, nCharAttr ) ) )
5632 + nPropertyFlags |= 2;
5633 + if ( /* ( pPortion->mnCharAttrHard & 4 ) || */
5634 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Underline, nCharAttr ) ) )
5635 + nPropertyFlags |= 4;
5636 + if ( /* ( pPortion->mnCharAttrHard & 0x10 ) || */
5637 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Shadow, nCharAttr ) ) )
5638 + nPropertyFlags |= 0x10;
5639 + if ( /* ( pPortion->mnCharAttrHard & 0x200 ) || */
5640 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Embossed, nCharAttr ) ) )
5641 + nPropertyFlags |= 512;
5643 + if ( rTextObj.HasExtendedBullets() )
5645 + nPropertyFlags |= ( i & 0x3f ) << 10 ;
5646 + nCharAttr |= ( i & 0x3f ) << 10;
5648 + if ( ( pPortion->meFontName == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
5649 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Font, pPortion->mnFont ) ) )
5650 + nPropertyFlags |= 0x00010000;
5651 + if ( ( pPortion->meAsianOrComplexFont == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
5652 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_AsianOrComplexFont, pPortion->mnAsianOrComplexFont ) ) )
5653 + nPropertyFlags |= 0x00200000;
5654 + if ( ( pPortion->meCharHeight == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
5655 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontHeight, pPortion->mnCharHeight ) ) )
5656 + nPropertyFlags |= 0x00020000;
5657 + if ( ( pPortion->meCharColor == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
5658 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontColor, nCharColor & 0xffffff ) ) )
5659 + nPropertyFlags |= 0x00040000;
5660 + if ( ( pPortion->meCharEscapement == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
5661 + ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Escapement, pPortion->mnCharEscapement ) ) )
5662 + nPropertyFlags |= 0x00080000;
5664 + sal_uInt32 nCharCount = pPortion->Count();
5666 + rOut << nCharCount
5667 + << nPropertyFlags; //PropertyFlags
5669 + if ( nPropertyFlags & 0xffff )
5670 + rOut << (sal_uInt16)( nCharAttr );
5671 + if ( nPropertyFlags & 0x00010000 )
5672 + rOut << pPortion->mnFont;
5673 + if ( nPropertyFlags & 0x00200000 )
5674 + rOut << pPortion->mnAsianOrComplexFont;
5675 + if ( nPropertyFlags & 0x00020000 )
5676 + rOut << (sal_uInt16)( pPortion->mnCharHeight );
5677 + if ( nPropertyFlags & 0x00040000 )
5678 + rOut << (sal_uInt32)nCharColor;
5679 + if ( nPropertyFlags & 0x00080000 )
5680 + rOut << pPortion->mnCharEscapement;
5685 +// ----------------------------------------------------------------------------------------
5686 +// laedt und konvertiert text aus shape, ergebnis ist mnTextSize gespeichert;
5687 +sal_Bool PPTWriter::ImplGetText()
5690 + mbFontIndependentLineSpacing = sal_False;
5691 + mXText = ::com::sun::star::uno::Reference<
5692 + ::com::sun::star::text::XSimpleText >
5693 + ( mXShape, ::com::sun::star::uno::UNO_QUERY );
5695 + if ( mXText.is() )
5697 + mnTextSize = mXText->getString().getLength();
5698 + ::com::sun::star::uno::Any aAny;
5699 + if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FontIndependentLineSpacing" ) ) ), sal_True )
5700 + aAny >>= mbFontIndependentLineSpacing;
5702 + return ( mnTextSize != 0 );
5705 +// -----------------------------------------------------------------------
5707 +void PPTWriter::ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt )
5709 + if ( mnAngle < 0 )
5710 + mnAngle = ( 36000 + mnAngle ) % 36000;
5712 + mnAngle = ( 36000 - ( mnAngle % 36000 ) );
5714 + double fCos = cos( (double)mnAngle * F_PI18000 );
5715 + double fSin = sin( (double)mnAngle * F_PI18000 );
5717 + double fWidthHalf = maRect.GetWidth() / 2;
5718 + double fHeightHalf = maRect.GetHeight() / 2;
5720 + double fXDiff = fCos * fWidthHalf + fSin * (-fHeightHalf);
5721 + double fYDiff = - ( fSin * fWidthHalf - fCos * ( -fHeightHalf ) );
5723 + maRect.Move( (sal_Int32)( -( fWidthHalf - fXDiff ) ), (sal_Int32)( - ( fHeightHalf + fYDiff ) ) );
5725 + mnAngle += 0x8000;
5726 + mnAngle &=~0xffff; // nAngle auf volle Gradzahl runden
5727 + rPropOpt.AddOpt( ESCHER_Prop_Rotation, mnAngle );
5729 + if ( ( mnAngle >= ( 45 << 16 ) && mnAngle < ( 135 << 16 ) ) ||
5730 + ( mnAngle >= ( 225 << 16 ) && mnAngle < ( 315 << 16 ) ) )
5732 + // In diesen beiden Bereichen steht in PPT gemeinerweise die
5733 + // BoundingBox bereits senkrecht. Daher muss diese VOR
5734 + // DER ROTATION flachgelegt werden.
5735 + ::com::sun::star::awt::Point
5736 + aTopLeft( (sal_Int32)( maRect.Left() + fWidthHalf - fHeightHalf ), (sal_Int32)( maRect.Top() + fHeightHalf - fWidthHalf ) );
5737 + Size aNewSize( maRect.GetHeight(), maRect.GetWidth() );
5738 + maRect = Rectangle( Point( aTopLeft.X, aTopLeft.Y ), aNewSize );
5742 +// -----------------------------------------------------------------------
5746 + sal_uInt32 nFieldType;
5747 + sal_uInt32 nFieldStartPos;
5748 + sal_uInt32 nFieldEndPos;
5749 + String aRepresentation;
5752 + FieldEntry( sal_uInt32 nType, sal_uInt32 nStart, sal_uInt32 nEnd )
5754 + nFieldType = nType;
5755 + nFieldStartPos = nStart;
5756 + nFieldEndPos = nEnd;
5760 +// -----------------------------------------------------------------------
5762 +PortionObj::PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
5763 + FontCollection& rFontCollection ) :
5764 + mnCharAttrHard ( 0 ),
5767 + mnAsianOrComplexFont( 0xffff ),
5769 + mbLastPortion ( TRUE ),
5771 + mpFieldEntry ( NULL )
5773 + mXPropSet = rXPropSet;
5775 + ImplGetPortionValues( rFontCollection, FALSE );
5778 +PortionObj::PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRange,
5779 + sal_Bool bLast, FontCollection& rFontCollection ) :
5780 + mnCharAttrHard ( 0 ),
5783 + mnAsianOrComplexFont ( 0xffff ),
5784 + mbLastPortion ( bLast ),
5786 + mpFieldEntry ( NULL )
5788 + String aString( rXTextRange->getString() );
5790 + BOOL bRTL_endingParen = FALSE;
5792 + mnTextSize = aString.Len();
5798 + mpFieldEntry = NULL;
5799 + sal_uInt32 nFieldType = 0;
5801 + mXPropSet = ::com::sun::star::uno::Reference<
5802 + ::com::sun::star::beans::XPropertySet >
5803 + ( rXTextRange, ::com::sun::star::uno::UNO_QUERY );
5804 + mXPropState = ::com::sun::star::uno::Reference<
5805 + ::com::sun::star::beans::XPropertyState >
5806 + ( rXTextRange, ::com::sun::star::uno::UNO_QUERY );
5808 + sal_Bool bPropSetsValid = ( mXPropSet.is() && mXPropState.is() );
5809 + if ( bPropSetsValid )
5810 + nFieldType = ImplGetTextField( rXTextRange, mXPropSet, aURL );
5813 + mpFieldEntry = new FieldEntry( nFieldType, 0, mnTextSize );
5814 + if ( ( nFieldType >> 28 == 4 ) )
5816 + mpFieldEntry->aRepresentation = aString;
5817 + mpFieldEntry->aFieldUrl = aURL;
5820 + sal_Bool bSymbol = FALSE;
5822 + if ( bPropSetsValid && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSet" ) ), FALSE ) )
5824 + sal_Int16 nCharset;
5825 + mAny >>= nCharset;
5826 + if ( nCharset == ::com::sun::star::awt::CharSet::SYMBOL )
5829 + if ( mpFieldEntry && ( nFieldType & 0x800000 ) ) // placeholder ?
5834 + mpText = new sal_uInt16[ mnTextSize ];
5835 + mpText[ 0 ] = 0x2a;
5839 + const sal_Unicode* pText = aString.GetBuffer();
5840 + // For i39516 - a closing parenthesis that ends an RTL string is displayed backwards by PPT
5841 + // Solution: add a Unicode Right-to-Left Mark, following the method described in i18024
5842 + if ( bLast && pText[ aString.Len() - 1 ] == sal_Unicode(')') && rFontCollection.GetScriptDirection( aString ) == com::sun::star::i18n::ScriptDirection::RIGHT_TO_LEFT )
5845 + bRTL_endingParen = TRUE;
5847 + mpText = new sal_uInt16[ mnTextSize ];
5849 + for ( int i = 0; i < aString.Len(); i++ )
5851 + nChar = (sal_uInt16)pText[ i ];
5852 + if ( nChar == 0xa )
5854 + else if ( !bSymbol )
5859 + case 128: nChar = 0x20AC; break;
5860 + // Punctuation and other
5861 + case 130: nChar = 0x201A; break;// SINGLE LOW-9 QUOTATION MARK
5862 + case 131: nChar = 0x0192; break;// LATIN SMALL LETTER F WITH HOOK
5863 + case 132: nChar = 0x201E; break;// DOUBLE LOW-9 QUOTATION MARK
5864 + // LOW DOUBLE PRIME QUOTATION MARK
5865 + case 133: nChar = 0x2026; break;// HORIZONTAL ELLIPSES
5866 + case 134: nChar = 0x2020; break;// DAGGER
5867 + case 135: nChar = 0x2021; break;// DOUBLE DAGGER
5868 + case 136: nChar = 0x02C6; break;// MODIFIER LETTER CIRCUMFLEX ACCENT
5869 + case 137: nChar = 0x2030; break;// PER MILLE SIGN
5870 + case 138: nChar = 0x0160; break;// LATIN CAPITAL LETTER S WITH CARON
5871 + case 139: nChar = 0x2039; break;// SINGLE LEFT-POINTING ANGLE QUOTATION MARK
5872 + case 140: nChar = 0x0152; break;// LATIN CAPITAL LIGATURE OE
5873 + case 142: nChar = 0x017D; break;// LATIN CAPITAL LETTER Z WITH CARON
5874 + case 145: nChar = 0x2018; break;// LEFT SINGLE QUOTATION MARK
5875 + // MODIFIER LETTER TURNED COMMA
5876 + case 146: nChar = 0x2019; break;// RIGHT SINGLE QUOTATION MARK
5877 + // MODIFIER LETTER APOSTROPHE
5878 + case 147: nChar = 0x201C; break;// LEFT DOUBLE QUOTATION MARK
5879 + // REVERSED DOUBLE PRIME QUOTATION MARK
5880 + case 148: nChar = 0x201D; break;// RIGHT DOUBLE QUOTATION MARK
5881 + // REVERSED DOUBLE PRIME QUOTATION MARK
5882 + case 149: nChar = 0x2022; break;// BULLET
5883 + case 150: nChar = 0x2013; break;// EN DASH
5884 + case 151: nChar = 0x2014; break;// EM DASH
5885 + case 152: nChar = 0x02DC; break;// SMALL TILDE
5886 + case 153: nChar = 0x2122; break;// TRADE MARK SIGN
5887 + case 154: nChar = 0x0161; break;// LATIN SMALL LETTER S WITH CARON
5888 + case 155: nChar = 0x203A; break;// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
5889 + case 156: nChar = 0x0153; break;// LATIN SMALL LIGATURE OE
5890 + case 158: nChar = 0x017E; break;// LATIN SMALL LETTER Z WITH CARON
5891 + case 159: nChar = 0x0178; break;// LATIN CAPITAL LETTER Y WITH DIAERESIS
5892 +// case 222: nChar = 0x00B6; break;// PILCROW SIGN / PARAGRAPH SIGN
5895 + mpText[ i ] = nChar;
5898 + if ( bRTL_endingParen )
5899 + mpText[ mnTextSize - 2 ] = 0x200F; // Unicode Right-to-Left mark
5902 + mpText[ mnTextSize - 1 ] = 0xd;
5904 + if ( bPropSetsValid )
5905 + ImplGetPortionValues( rFontCollection, TRUE );
5909 +PortionObj::PortionObj( PortionObj& rPortionObj )
5910 +: PropStateValue( rPortionObj )
5912 + ImplConstruct( rPortionObj );
5915 +PortionObj::~PortionObj()
5920 +void PortionObj::Write( SvStream* pStrm, sal_Bool bLast )
5922 + sal_uInt32 nCount = mnTextSize;
5923 + if ( bLast && mbLastPortion )
5925 + for ( sal_uInt32 i = 0; i < nCount; i++ )
5926 + *pStrm << (sal_uInt16)mpText[ i ];
5929 +void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool bGetPropStateValue )
5932 + sal_Bool bOk = ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), bGetPropStateValue );
5933 + meFontName = ePropState;
5936 + FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() );
5937 + sal_uInt32 nCount = rFontCollection.GetCount();
5938 + mnFont = (sal_uInt16)rFontCollection.GetId( aFontDesc );
5939 + if ( mnFont == nCount )
5941 + FontCollectionEntry& rFontDesc = rFontCollection.GetLast();
5942 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSet" ) ), sal_False ) )
5943 + mAny >>= rFontDesc.CharSet;
5944 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamily" ) ), sal_False ) )
5945 + mAny >>= rFontDesc.Family;
5946 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitch" ) ), sal_False ) )
5947 + mAny >>= rFontDesc.Pitch;
5951 + sal_Int16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguage() );
5952 + if ( mpText && mnTextSize && xPPTBreakIter.is() )
5954 + rtl::OUString sT( mpText, mnTextSize );
5955 + nScriptType = xPPTBreakIter->getScriptType( sT, 0 );
5957 + if ( nScriptType != com::sun::star::i18n::ScriptType::COMPLEX )
5959 + bOk = ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontNameAsian" ) ), bGetPropStateValue );
5960 + meAsianOrComplexFont = ePropState;
5963 + FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() );
5964 + sal_uInt32 nCount = rFontCollection.GetCount();
5965 + mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc );
5966 + if ( mnAsianOrComplexFont == nCount )
5968 + FontCollectionEntry& rFontDesc = rFontCollection.GetLast();
5969 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSetAsian" ) ), sal_False ) )
5970 + mAny >>= rFontDesc.CharSet;
5971 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamilyAsian" ) ), sal_False ) )
5972 + mAny >>= rFontDesc.Family;
5973 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitchAsian" ) ), sal_False ) )
5974 + mAny >>= rFontDesc.Pitch;
5980 + bOk = ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontNameComplex" ) ), bGetPropStateValue );
5981 + meAsianOrComplexFont = ePropState;
5984 + FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() );
5985 + sal_uInt32 nCount = rFontCollection.GetCount();
5986 + mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc );
5987 + if ( mnAsianOrComplexFont == nCount )
5989 + FontCollectionEntry& rFontDesc = rFontCollection.GetLast();
5990 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSetComplex" ) ), sal_False ) )
5991 + mAny >>= rFontDesc.CharSet;
5992 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamilyComplex" ) ), sal_False ) )
5993 + mAny >>= rFontDesc.Family;
5994 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitchComplex" ) ), sal_False ) )
5995 + mAny >>= rFontDesc.Pitch;
6000 + if ( nScriptType != com::sun::star::i18n::ScriptType::COMPLEX )
6002 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ), bGetPropStateValue ) )
6006 + if ( fFloat >= ::com::sun::star::awt::FontWeight::SEMIBOLD )
6012 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharWeightComplex" ) ), bGetPropStateValue ) )
6016 + if ( fFloat >= ::com::sun::star::awt::FontWeight::SEMIBOLD )
6021 + if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
6022 + mnCharAttrHard |= 1;
6024 + if ( nScriptType != com::sun::star::i18n::ScriptType::COMPLEX )
6026 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ), bGetPropStateValue ) )
6028 + ::com::sun::star::awt::FontSlant aFS;
6032 + case ::com::sun::star::awt::FontSlant_OBLIQUE :
6033 + case ::com::sun::star::awt::FontSlant_ITALIC :
6043 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharPostureComplex" ) ), bGetPropStateValue ) )
6045 + ::com::sun::star::awt::FontSlant aFS;
6049 + case ::com::sun::star::awt::FontSlant_OBLIQUE :
6050 + case ::com::sun::star::awt::FontSlant_ITALIC :
6059 + if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
6060 + mnCharAttrHard |= 2;
6062 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ), bGetPropStateValue ) )
6068 + case ::com::sun::star::awt::FontUnderline::SINGLE :
6069 + case ::com::sun::star::awt::FontUnderline::DOUBLE :
6070 + case ::com::sun::star::awt::FontUnderline::DOTTED :
6074 + if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
6075 + mnCharAttrHard |= 4;
6077 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), bGetPropStateValue ) )
6082 + mnCharAttr |= 0x10;
6084 + if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
6085 + mnCharAttrHard |= 16;
6087 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharLocale" ) ), bGetPropStateValue ) )
6089 + com::sun::star::lang::Locale eLocale;
6090 + if ( mAny >>= eLocale )
6091 + meCharLocale = eLocale;
6094 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharRelief" ) ), bGetPropStateValue ) )
6098 + if ( nVal != ::com::sun::star::text::FontRelief::NONE )
6099 + mnCharAttr |= 512;
6101 + if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
6102 + mnCharAttrHard |= 512;
6104 + mnCharHeight = 24;
6105 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ), bGetPropStateValue ) )
6109 + mnCharHeight = (sal_uInt16)( fVal + 0.5 );
6111 + meCharHeight = ePropState;
6113 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ), bGetPropStateValue ) )
6115 + sal_uInt32 nSOColor = *( (sal_uInt32*)mAny.getValue() );
6116 + mnCharColor = nSOColor & 0xff00ff00; // green and hibyte
6117 + mnCharColor |= (sal_uInt8)( nSOColor ) << 16; // red and blue is switched
6118 + mnCharColor |= (sal_uInt8)( nSOColor >> 16 );
6120 + meCharColor = ePropState;
6122 + mnCharEscapement = 0;
6123 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), bGetPropStateValue ) )
6125 + mAny >>= mnCharEscapement;
6126 + if ( mnCharEscapement > 100 )
6127 + mnCharEscapement = 33;
6128 + else if ( mnCharEscapement < -100 )
6129 + mnCharEscapement = -33;
6131 + meCharEscapement = ePropState;
6134 +void PortionObj::ImplClear()
6136 + delete (FieldEntry*)mpFieldEntry;
6140 +void PortionObj::ImplConstruct( PortionObj& rPortionObj )
6142 + mbLastPortion = rPortionObj.mbLastPortion;
6143 + mnTextSize = rPortionObj.mnTextSize;
6144 + mnCharColor = rPortionObj.mnCharColor;
6145 + mnCharEscapement = rPortionObj.mnCharEscapement;
6146 + mnCharAttr = rPortionObj.mnCharAttr;
6147 + mnCharHeight = rPortionObj.mnCharHeight;
6148 + mnFont = rPortionObj.mnFont;
6149 + mnAsianOrComplexFont = rPortionObj.mnAsianOrComplexFont;
6151 + if ( rPortionObj.mpText )
6153 + mpText = new sal_uInt16[ mnTextSize ];
6154 + memcpy( mpText, rPortionObj.mpText, mnTextSize << 1 );
6159 + if ( rPortionObj.mpFieldEntry )
6160 + mpFieldEntry = new FieldEntry( *( rPortionObj.mpFieldEntry ) );
6162 + mpFieldEntry = NULL;
6165 +sal_uInt32 PortionObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition )
6167 + if ( mpFieldEntry && ( !mpFieldEntry->nFieldStartPos ) )
6169 + mpFieldEntry->nFieldStartPos += nCurrentTextPosition;
6170 + mpFieldEntry->nFieldEndPos += nCurrentTextPosition;
6172 + return mnTextSize;
6175 +// -----------------------------------------------------------------------
6176 +// Rueckgabe: 0 = kein TextField
6177 +// bit28->31 text field type :
6185 +// bit24->27 text field sub type (optional)
6186 +// 23-> PPT Textfield needs a placeholder
6188 +sal_uInt32 PortionObj::ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & ,
6189 + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, String& rURL )
6191 + sal_uInt32 nRetValue = 0;
6192 + sal_Int32 nFormat;
6193 + ::com::sun::star::uno::Any aAny;
6194 + if ( GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextPortionType" ) ), sal_True ) )
6196 + String aTextFieldType( *(::rtl::OUString*)aAny.getValue() );
6197 + if ( aTextFieldType == String( RTL_CONSTASCII_USTRINGPARAM( "TextField" ) ) )
6199 + if ( GetPropertyValue( aAny, rXPropSet, aTextFieldType, sal_True ) )
6201 + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > aXTextField;
6202 + if ( aAny >>= aXTextField )
6204 + if ( aXTextField.is() )
6206 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
6207 + xFieldPropSet( aXTextField, ::com::sun::star::uno::UNO_QUERY );
6208 + if ( xFieldPropSet.is() )
6210 + String aFieldKind( aXTextField->getPresentation( TRUE ) );
6211 + if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Date" ) ) )
6213 + if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True )
6217 + if ( !bBool ) // Fixed DateFields gibt es in PPT nicht
6219 + if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Format" ) ) ), sal_True )
6221 + nFormat = *(sal_Int32*)aAny.getValue();
6222 + switch ( nFormat )
6227 + case 2 : nFormat = 0; break;
6230 + case 3 : nFormat = 1; break;
6232 + case 6 : nFormat = 2; break;
6234 + nRetValue |= ( ( ( 1 << 4 ) | nFormat ) << 24 ) | 0x800000;
6239 + else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) )
6241 + if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ), sal_True )
6242 + rURL = String( *(::rtl::OUString*)aAny.getValue() );
6243 + nRetValue = 4 << 28;
6245 + else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Page" ) ) )
6247 + nRetValue = 3 << 28 | 0x800000;
6249 + else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) )
6253 + else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Time" ) ) )
6255 + if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True )
6261 + if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True )
6263 + nFormat = *(sal_Int32*)aAny.getValue();
6264 + nRetValue |= ( ( ( 2 << 4 ) | nFormat ) << 24 ) | 0x800000;
6269 + else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) )
6273 + else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Table" ) ) )
6277 + else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "ExtTime" ) ) )
6279 + if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True )
6285 + if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Format" ) ) ), sal_True )
6287 + nFormat = *(sal_Int32*)aAny.getValue();
6288 + switch ( nFormat )
6294 + case 2 : nFormat = 12; break;
6295 + case 3 : nFormat = 9; break;
6297 + case 4 : nFormat = 10; break;
6300 + nRetValue |= ( ( ( 2 << 4 ) | nFormat ) << 24 ) | 0x800000;
6305 + else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "ExtFile" ) ) )
6309 + else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Author" ) ) )
6313 + else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "DateTime" ) ) )
6315 + nRetValue = 5 << 28 | 0x800000;
6317 + else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Header" ) ) )
6319 + nRetValue = 6 << 28 | 0x800000;
6321 + else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Footer" ) ) )
6323 + nRetValue = 7 << 28 | 0x800000;
6334 +PortionObj& PortionObj::operator=( PortionObj& rPortionObj )
6336 + if ( this != &rPortionObj )
6339 + ImplConstruct( rPortionObj );
6344 +// -----------------------------------------------------------------------
6346 +ParagraphObj::ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
6347 + PPTExBulletProvider& rProv ) :
6348 + maMapModeSrc ( MAP_100TH_MM ),
6349 + maMapModeDest ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) )
6351 + mXPropSet = rXPropSet;
6353 + bExtendedParameters = FALSE;
6359 + ImplGetParagraphValues( rProv, FALSE );
6362 + ParagraphObj::ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContent,
6363 + ParaFlags aParaFlags, FontCollection& rFontCollection, PPTExBulletProvider& rProv ) :
6364 + maMapModeSrc ( MAP_100TH_MM ),
6365 + maMapModeDest ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) ),
6366 + mbFirstParagraph ( aParaFlags.bFirstParagraph ),
6367 + mbLastParagraph ( aParaFlags.bLastParagraph )
6369 + bExtendedParameters = FALSE;
6375 + mXPropSet = ::com::sun::star::uno::Reference<
6376 + ::com::sun::star::beans::XPropertySet >
6377 + ( rXTextContent, ::com::sun::star::uno::UNO_QUERY );
6379 + mXPropState = ::com::sun::star::uno::Reference<
6380 + ::com::sun::star::beans::XPropertyState >
6381 + ( rXTextContent, ::com::sun::star::uno::UNO_QUERY );
6383 + if ( mXPropSet.is() && mXPropState.is() )
6385 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >
6386 + aXTextPortionEA( rXTextContent, ::com::sun::star::uno::UNO_QUERY );
6387 + if ( aXTextPortionEA.is() )
6389 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
6390 + aXTextPortionE( aXTextPortionEA->createEnumeration() );
6391 + if ( aXTextPortionE.is() )
6393 + while ( aXTextPortionE->hasMoreElements() )
6395 + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > aXCursorText;
6396 + ::com::sun::star::uno::Any aAny( aXTextPortionE->nextElement() );
6397 + if ( aAny >>= aXCursorText )
6399 + PortionObj* pPortionObj = new PortionObj( aXCursorText, !aXTextPortionE->hasMoreElements(), rFontCollection );
6400 + if ( pPortionObj->Count() )
6401 + Insert( pPortionObj, LIST_APPEND );
6403 + delete pPortionObj;
6408 + ImplGetParagraphValues( rProv, TRUE );//
6412 +ParagraphObj::ParagraphObj( ParagraphObj& rObj )
6417 + ImplConstruct( rObj );
6420 +ParagraphObj::~ParagraphObj()
6425 +void ParagraphObj::Write( SvStream* pStrm )
6427 + for ( void* pPtr = First(); pPtr; pPtr = Next() )
6428 + ((PortionObj*)pPtr)->Write( pStrm, mbLastParagraph );
6431 +void ParagraphObj::ImplClear()
6433 + for ( void* pPtr = First(); pPtr; pPtr = Next() )
6434 + delete (PortionObj*)pPtr;
6437 +void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight )
6439 + if ( ( (SvxExtNumType)nNumberingType == SVX_NUM_BITMAP ) && ( nBulletId != 0xffff ) )
6441 + // calculate the bulletrealsize for this grafik
6442 + if ( aBuGraSize.Width() && aBuGraSize.Height() )
6444 + double fCharHeight = nFontHeight;
6445 + double fLen = aBuGraSize.Height();
6446 + fCharHeight = fCharHeight * 0.2540;
6447 + double fQuo = fLen / fCharHeight;
6448 + nBulletRealSize = (sal_Int16)( fQuo + 0.5 );
6449 + if ( (sal_uInt16)nBulletRealSize > 400 )
6450 + nBulletRealSize = 400;
6455 +// from sw/source/filter/ww8/wrtw8num.cxx for default bullets to export to MS intact
6456 +static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, String& rFontName)
6458 + StarSymbolToMSMultiFont *pConvert = 0;
6459 + FontFamily eFamily = FAMILY_DECORATIVE;
6463 + pConvert = CreateStarSymbolToMSMultiFont();
6465 + sal_Unicode cChar = rNumStr.GetChar(0);
6466 + String sFont = pConvert->ConvertChar(cChar);
6469 + rNumStr = static_cast< sal_Unicode >(cChar | 0xF000);
6470 + rFontName = sFont;
6471 + rChrSet = RTL_TEXTENCODING_SYMBOL;
6473 + else if ( (rNumStr.GetChar(0) < 0xE000 || rNumStr.GetChar(0) > 0xF8FF) )
6476 + Ok we can't fit into a known windows unicode font, but
6477 + we are not in the private area, so we are a
6478 + standardized symbol, so turn off the symbol bit and
6479 + let words own font substitution kick in
6481 + rChrSet = RTL_TEXTENCODING_UNICODE;
6482 + eFamily = FAMILY_SWISS;
6483 + rFontName = ::GetFontToken(rFontName, 0);
6488 + Well we don't have an available substition, and we're
6489 + in our private area, so give up and show a standard
6492 + rFontName.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Wingdings"));
6493 + rNumStr = static_cast< sal_Unicode >(0x6C);
6498 +void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nNumberingDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue )
6500 + ::com::sun::star::uno::Any aAny;
6501 + if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "ParaLeftMargin" ) ) ) )
6504 + if ( aAny >>= nVal )
6505 + nTextOfs = static_cast< sal_Int16 >( nVal / ( 2540.0 / 576 ) + 0.5 ) ;
6507 + if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "ParaFirstLineIndent" ) ) ) )
6509 + if ( aAny >>= nBulletOfs )
6510 + nBulletOfs = static_cast< sal_Int32 >( nBulletOfs / ( 2540.0 / 576 ) + 0.5 );
6512 + if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsNumber" ) ) ) )
6513 + aAny >>= bNumberingIsNumber;
6515 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > aXIndexReplace;
6517 + if ( bIsBullet && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ), bGetPropStateValue ) )
6519 + if ( ( mAny >>= aXIndexReplace ) && nNumberingDepth < aXIndexReplace->getCount() )
6521 + mAny <<= aXIndexReplace->getByIndex( nNumberingDepth );
6522 + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>
6523 + aPropertySequence( *( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>*)mAny.getValue() );
6525 + const ::com::sun::star::beans::PropertyValue* pPropValue = aPropertySequence.getArray();
6527 + sal_Int32 nPropertyCount = aPropertySequence.getLength();
6528 + if ( nPropertyCount )
6530 + bExtendedParameters = TRUE;
6531 + nBulletRealSize = 100;
6532 + nMappedNumType = 0;
6534 + String aGraphicURL;
6535 + for ( sal_Int32 i = 0; i < nPropertyCount; i++ )
6537 + const void* pValue = pPropValue[ i ].Value.getValue();
6540 + ::rtl::OUString aPropName( pPropValue[ i ].Name );
6541 + if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "NumberingType" ) ) )
6542 + nNumberingType = *( (sal_Int16*)pValue );
6543 + else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Adjust" ) ) )
6544 + nHorzAdjust = *( (sal_Int16*)pValue );
6545 + else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletChar" ) ) )
6547 + String aString( *( (String*)pValue ) );
6548 + if ( aString.Len() )
6549 + cBulletId = aString.GetChar( 0 );
6551 + else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletFont" ) ) )
6553 + aFontDesc = *( (::com::sun::star::awt::FontDescriptor*)pValue );
6555 + // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font,
6556 + // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used.
6557 + // Because there might exist a lot of damaged documemts I added this two lines
6558 + // which fixes the bullet problem for the export.
6559 + if ( aFontDesc.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ) )
6560 + aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252;
6563 + else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GraphicURL" ) ) )
6564 + aGraphicURL = ( *(::rtl::OUString*)pValue );
6565 + else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GraphicSize" ) ) )
6567 + if ( pPropValue[ i ].Value.getValueType() == ::getCppuType( (::com::sun::star::awt::Size*)0) )
6569 + // don't cast awt::Size to Size as on 64-bits they are not the same.
6570 + ::com::sun::star::awt::Size aSize;
6571 + pPropValue[ i ].Value >>= aSize;
6572 + aBuGraSize.nA = aSize.Width;
6573 + aBuGraSize.nB = aSize.Height;
6576 + else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StartWith" ) ) )
6577 + nStartWith = *( (sal_Int16*)pValue );
6578 + else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LeftMargin" ) ) )
6579 + nTextOfs = nTextOfs + static_cast< sal_Int16 >( *( (sal_Int32*)pValue ) / ( 2540.0 / 576 ) );
6580 + else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FirstLineOffset" ) ) )
6581 + nBulletOfs += (sal_Int16)( *( (sal_Int32*)pValue ) / ( 2540.0 / 576 ) );
6582 + else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletColor" ) ) )
6584 + sal_uInt32 nSOColor = *( (sal_uInt32*)pValue );
6585 + nBulletColor = nSOColor & 0xff00ff00; // green and hibyte
6586 + nBulletColor |= (sal_uInt8)( nSOColor ) << 16; // red
6587 + nBulletColor |= (sal_uInt8)( nSOColor >> 16 ) | 0xfe000000; // blue
6589 + else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletRelSize" ) ) )
6591 + nBulletRealSize = *( (sal_Int16*)pValue );
6592 + nParaFlags |= 0x40;
6593 + nBulletFlags |= 8;
6595 + else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Prefix" ) ) )
6596 + sPrefix = ( *(::rtl::OUString*)pValue );
6597 + else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Suffix" ) ) )
6598 + sSuffix = ( *(::rtl::OUString*)pValue );
6601 + ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SymbolTextDistance" ) ) )
6602 + || ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Graphic" ) ) ) ) )
6604 + DBG_ERROR( "Unbekanntes Property" );
6610 + if ( aGraphicURL.Len() )
6612 + if ( aBuGraSize.Width() && aBuGraSize.Height() )
6614 + xub_StrLen nIndex = aGraphicURL.Search( (sal_Unicode)':', 0 );
6615 + if ( nIndex != STRING_NOTFOUND )
6618 + if ( aGraphicURL.Len() > nIndex )
6620 + ByteString aUniqueId( aGraphicURL, nIndex, aGraphicURL.Len() - nIndex, RTL_TEXTENCODING_UTF8 );
6621 + if ( aUniqueId.Len() )
6623 + nBulletId = rBuProv.GetId( aUniqueId, aBuGraSize );
6624 + if ( nBulletId != 0xffff )
6625 + bExtendedBulletsUsed = TRUE;
6632 + nNumberingType = SVX_NUM_NUMBER_NONE;
6636 + PortionObj* pPortion = (PortionObj*)First();
6637 + CalculateGraphicBulletSize( ( pPortion ) ? pPortion->mnCharHeight : 24 );
6639 + switch( (SvxExtNumType)nNumberingType )
6641 + case SVX_NUM_NUMBER_NONE : nParaFlags |= 0xf; break;
6643 + case SVX_NUM_CHAR_SPECIAL : // Bullet
6645 + if ( aFontDesc.Name.equalsIgnoreAsciiCaseAscii("starsymbol") ||
6646 + aFontDesc.Name.equalsIgnoreAsciiCaseAscii("opensymbol") )
6648 + String sFontName = aFontDesc.Name;
6649 + String sNumStr = cBulletId;
6650 + rtl_TextEncoding eChrSet = aFontDesc.CharSet;
6651 + lcl_SubstituteBullet(sNumStr,eChrSet,sFontName);
6652 + aFontDesc.Name = sFontName;
6653 + cBulletId = sNumStr.GetChar( 0 );
6654 + aFontDesc.CharSet = eChrSet;
6657 + if ( aFontDesc.Name.getLength() )
6660 + if ( aFontDesc.CharSet != ::com::sun::star::awt::CharSet::SYMBOL )
6662 + switch ( cBulletId )
6665 + case 128: cBulletId = 0x20AC; break;
6666 + // Punctuation and other
6667 + case 130: cBulletId = 0x201A; break;// SINGLE LOW-9 QUOTATION MARK
6668 + case 131: cBulletId = 0x0192; break;// LATIN SMALL LETTER F WITH HOOK
6669 + case 132: cBulletId = 0x201E; break;// DOUBLE LOW-9 QUOTATION MARK
6670 + // LOW DOUBLE PRIME QUOTATION MARK
6671 + case 133: cBulletId = 0x2026; break;// HORIZONTAL ELLIPSES
6672 + case 134: cBulletId = 0x2020; break;// DAGGER
6673 + case 135: cBulletId = 0x2021; break;// DOUBLE DAGGER
6674 + case 136: cBulletId = 0x02C6; break;// MODIFIER LETTER CIRCUMFLEX ACCENT
6675 + case 137: cBulletId = 0x2030; break;// PER MILLE SIGN
6676 + case 138: cBulletId = 0x0160; break;// LATIN CAPITAL LETTER S WITH CARON
6677 + case 139: cBulletId = 0x2039; break;// SINGLE LEFT-POINTING ANGLE QUOTATION MARK
6678 + case 140: cBulletId = 0x0152; break;// LATIN CAPITAL LIGATURE OE
6679 + case 142: cBulletId = 0x017D; break;// LATIN CAPITAL LETTER Z WITH CARON
6680 + case 145: cBulletId = 0x2018; break;// LEFT SINGLE QUOTATION MARK
6681 + // MODIFIER LETTER TURNED COMMA
6682 + case 146: cBulletId = 0x2019; break;// RIGHT SINGLE QUOTATION MARK
6683 + // MODIFIER LETTER APOSTROPHE
6684 + case 147: cBulletId = 0x201C; break;// LEFT DOUBLE QUOTATION MARK
6685 + // REVERSED DOUBLE PRIME QUOTATION MARK
6686 + case 148: cBulletId = 0x201D; break;// RIGHT DOUBLE QUOTATION MARK
6687 + // REVERSED DOUBLE PRIME QUOTATION MARK
6688 + case 149: cBulletId = 0x2022; break;// BULLET
6689 + case 150: cBulletId = 0x2013; break;// EN DASH
6690 + case 151: cBulletId = 0x2014; break;// EM DASH
6691 + case 152: cBulletId = 0x02DC; break;// SMALL TILDE
6692 + case 153: cBulletId = 0x2122; break;// TRADE MARK SIGN
6693 + case 154: cBulletId = 0x0161; break;// LATIN SMALL LETTER S WITH CARON
6694 + case 155: cBulletId = 0x203A; break;// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
6695 + case 156: cBulletId = 0x0153; break;// LATIN SMALL LIGATURE OE
6696 + case 158: cBulletId = 0x017E; break;// LATIN SMALL LETTER Z WITH CARON
6697 + case 159: cBulletId = 0x0178; break;// LATIN CAPITAL LETTER Y WITH DIAERESIS
6698 +// case 222: cBulletId = 0x00B6; break;// PILCROW SIGN / PARAGRAPH SIGN
6702 + nParaFlags |= 0x90; // wir geben den Font und den Charset vor
6705 + case SVX_NUM_CHARS_UPPER_LETTER : // zaehlt von a-z, aa - az, ba - bz, ...
6706 + case SVX_NUM_CHARS_LOWER_LETTER :
6707 + case SVX_NUM_ROMAN_UPPER :
6708 + case SVX_NUM_ROMAN_LOWER :
6709 + case SVX_NUM_ARABIC :
6710 + case SVX_NUM_PAGEDESC : // Numerierung aus der Seitenvorlage
6711 + case SVX_NUM_BITMAP :
6712 + case SVX_NUM_CHARS_UPPER_LETTER_N : // zaehlt von a-z, aa-zz, aaa-zzz
6713 + case SVX_NUM_CHARS_LOWER_LETTER_N :
6715 + if ( nNumberingType != SVX_NUM_CHAR_SPECIAL )
6717 + bExtendedBulletsUsed = TRUE;
6718 + if ( nNumberingDepth & 1 )
6719 + cBulletId = 0x2013; // defaulting bullet characters for ppt97
6720 + else if ( nNumberingDepth == 4 )
6723 + cBulletId = 0x2022;
6725 + switch( (SvxExtNumType)nNumberingType )
6727 + case SVX_NUM_CHARS_UPPER_LETTER :
6728 + case SVX_NUM_CHARS_UPPER_LETTER_N :
6730 + if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
6732 + if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
6733 + nMappedNumType = 0xa0001; // (A)
6735 + nMappedNumType = 0xb0001; // A)
6738 + nMappedNumType = 0x10001; // A.
6741 + case SVX_NUM_CHARS_LOWER_LETTER :
6742 + case SVX_NUM_CHARS_LOWER_LETTER_N :
6744 + if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
6746 + if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
6747 + nMappedNumType = 0x80001; // (a)
6749 + nMappedNumType = 0x90001; // a)
6752 + nMappedNumType = 0x00001; // a.
6755 + case SVX_NUM_ROMAN_UPPER :
6757 + if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
6759 + if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
6760 + nMappedNumType = 0xe0001; // (I)
6762 + nMappedNumType = 0xf0001; // I)
6765 + nMappedNumType = 0x70001; // I.
6768 + case SVX_NUM_ROMAN_LOWER :
6770 + if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
6772 + if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
6773 + nMappedNumType = 0x40001; // (i)
6775 + nMappedNumType = 0x50001; // i)
6778 + nMappedNumType = 0x60001; // i.
6781 + case SVX_NUM_ARABIC :
6783 + if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) )
6785 + if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) )
6786 + nMappedNumType = 0xc0001; // (1)
6788 + nMappedNumType = 0x20001; // 1)
6792 + if ( ! ( sSuffix.Len() + sPrefix.Len() ) )
6793 + nMappedNumType = 0xd0001; // 1
6795 + nMappedNumType = 0x30001; // 1.
6803 + nParaFlags |= 0x2f;
6804 + nBulletFlags |= 6;
6805 + if ( mbIsBullet && bNumberingIsNumber )
6806 + nBulletFlags |= 1;
6812 + nBulletOfs = nTextOfs + nBulletOfs;
6813 + if ( nBulletOfs < 0 )
6817 +void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue )
6819 + static String sNumberingLevel ( RTL_CONSTASCII_USTRINGPARAM( "NumberingLevel" ) );
6821 + ::com::sun::star::uno::Any aAny;
6822 + if ( GetPropertyValue( aAny, mXPropSet, sNumberingLevel, sal_True ) )
6824 + if ( bGetPropStateValue )
6825 + meBullet = GetPropertyState( mXPropSet, sNumberingLevel );
6826 + nDepth = *( (sal_Int16*)aAny.getValue() );
6830 + mbIsBullet = sal_False;
6837 + mbIsBullet = sal_True;
6843 + mbIsBullet = sal_False;
6845 + ImplGetNumberingLevel( rBuProv, nDepth, mbIsBullet, bGetPropStateValue );
6847 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaTabStops" ) ), bGetPropStateValue ) )
6848 + maTabStop = *( ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop>*)mAny.getValue();
6849 + sal_Int16 eTextAdjust( ::com::sun::star::style::ParagraphAdjust_LEFT );
6850 + if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "ParaAdjust" ) ), bGetPropStateValue ) )
6851 + aAny >>= eTextAdjust;
6852 + switch ( (::com::sun::star::style::ParagraphAdjust)eTextAdjust )
6854 + case ::com::sun::star::style::ParagraphAdjust_CENTER :
6857 + case ::com::sun::star::style::ParagraphAdjust_RIGHT :
6860 + case ::com::sun::star::style::ParagraphAdjust_BLOCK :
6864 + case ::com::sun::star::style::ParagraphAdjust_LEFT :
6868 + meTextAdjust = ePropState;
6870 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaLineSpacing" ) ), bGetPropStateValue ) )
6872 + ::com::sun::star::style::LineSpacing aLineSpacing
6873 + = *( (::com::sun::star::style::LineSpacing*)mAny.getValue() );
6874 + switch ( aLineSpacing.Mode )
6876 + case ::com::sun::star::style::LineSpacingMode::FIX :
6877 + mnLineSpacing = (sal_Int16)(-( aLineSpacing.Height ) );
6878 + mbFixedLineSpacing = TRUE;
6880 + case ::com::sun::star::style::LineSpacingMode::MINIMUM :
6881 + case ::com::sun::star::style::LineSpacingMode::LEADING :
6882 + mnLineSpacing = (sal_Int16)(-( aLineSpacing.Height ) );
6883 + mbFixedLineSpacing = FALSE;
6886 + case ::com::sun::star::style::LineSpacingMode::PROP :
6888 + mnLineSpacing = (sal_Int16)( aLineSpacing.Height );
6892 + meLineSpacing = ePropState;
6894 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaBottomMargin" ) ), bGetPropStateValue ) )
6896 + double fSpacing = *( (sal_uInt32*)mAny.getValue() ) + ( 2540.0 / 576.0 ) - 1;
6897 + mnLineSpacingBottom = (sal_Int16)(-( fSpacing * 576.0 / 2540.0 ) );
6899 + meLineSpacingBottom = ePropState;
6901 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaTopMargin" ) ), bGetPropStateValue ) )
6903 + double fSpacing = *( (sal_uInt32*)mAny.getValue() ) + ( 2540.0 / 576.0 ) - 1;
6904 + mnLineSpacingTop = (sal_Int16)(-( fSpacing * 576.0 / 2540.0 ) );
6906 + meLineSpacingTop = ePropState;
6908 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaIsForbiddenRules" ) ), bGetPropStateValue ) )
6909 + mAny >>= mbForbiddenRules;
6910 + meForbiddenRules = ePropState;
6912 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaIsHangingPunctuation" ) ), bGetPropStateValue ) )
6913 + mAny >>= mbParagraphPunctation;
6914 + meParagraphPunctation = ePropState;
6917 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "WritingMode" ) ), bGetPropStateValue ) )
6919 + sal_Int16 nWritingMode;
6920 + mAny >>= nWritingMode;
6922 + SvxFrameDirection eWritingMode( (SvxFrameDirection)nWritingMode );
6923 + if ( ( eWritingMode == FRMDIR_HORI_RIGHT_TOP )
6924 + || ( eWritingMode == FRMDIR_VERT_TOP_RIGHT ) )
6929 + meBiDi = ePropState;
6932 +void ParagraphObj::ImplConstruct( ParagraphObj& rParagraphObj )
6934 + mnTextSize = rParagraphObj.mnTextSize;
6935 + mnTextAdjust = rParagraphObj.mnTextAdjust;
6936 + mnLineSpacing = rParagraphObj.mnLineSpacing;
6937 + mnLineSpacingTop = rParagraphObj.mnLineSpacingTop;
6938 + mnLineSpacingBottom = rParagraphObj.mnLineSpacingBottom;
6939 + mbFirstParagraph = rParagraphObj.mbFirstParagraph;
6940 + mbLastParagraph = rParagraphObj.mbLastParagraph;
6941 + mbParagraphPunctation = rParagraphObj.mbParagraphPunctation;
6942 + mbForbiddenRules = rParagraphObj.mbForbiddenRules;
6943 + mnBiDi = rParagraphObj.mnBiDi;
6945 + for ( void* pPtr = rParagraphObj.First(); pPtr; pPtr = rParagraphObj.Next() )
6946 + Insert( new PortionObj( *(PortionObj*)pPtr ), LIST_APPEND );
6948 + maTabStop = rParagraphObj.maTabStop;
6949 + bExtendedParameters = rParagraphObj.bExtendedParameters;
6950 + nParaFlags = rParagraphObj.nParaFlags;
6951 + nBulletFlags = rParagraphObj.nBulletFlags;
6952 + sPrefix = rParagraphObj.sPrefix;
6953 + sSuffix = rParagraphObj.sSuffix;
6954 + sGraphicUrl = rParagraphObj.sGraphicUrl; // String auf eine Graphic
6955 + aBuGraSize = rParagraphObj.aBuGraSize;
6956 + nNumberingType = rParagraphObj.nNumberingType; // in wirlichkeit ist dies ein SvxEnum
6957 + nHorzAdjust = rParagraphObj.nHorzAdjust;
6958 + nBulletColor = rParagraphObj.nBulletColor;
6959 + nBulletOfs = rParagraphObj.nBulletOfs;
6960 + nStartWith = rParagraphObj.nStartWith; // Start der nummerierung
6961 + nTextOfs = rParagraphObj.nTextOfs;
6962 + nBulletRealSize = rParagraphObj.nBulletRealSize; // GroessenVerhaeltnis in Proz
6963 + nDepth = rParagraphObj.nDepth; // aktuelle tiefe
6964 + cBulletId = rParagraphObj.cBulletId; // wenn Numbering Type == CharSpecial
6965 + aFontDesc = rParagraphObj.aFontDesc;
6967 + bExtendedBulletsUsed = rParagraphObj.bExtendedBulletsUsed;
6968 + nBulletId = rParagraphObj.nBulletId;
6971 +::com::sun::star::awt::Size ParagraphObj::ImplMapSize( const ::com::sun::star::awt::Size& rSize )
6973 + Size aSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) );
6974 + if ( !aSize.Width() )
6976 + if ( !aSize.Height() )
6978 + return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() );
6981 +sal_uInt32 ParagraphObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition )
6984 + for ( void* pPtr = First(); pPtr; pPtr = Next() )
6985 + mnTextSize += ((PortionObj*)pPtr)->ImplCalculateTextPositions( nCurrentTextPosition + mnTextSize );
6986 + return mnTextSize;
6989 +ParagraphObj& ParagraphObj::operator=( ParagraphObj& rParagraphObj )
6991 + if ( this != &rParagraphObj )
6994 + ImplConstruct( rParagraphObj );
6999 +// -----------------------------------------------------------------------
7001 +ImplTextObj::ImplTextObj( int nInstance )
7005 + mnInstance = nInstance;
7006 + mpList = new List;
7007 + mbHasExtendedBullets = FALSE;
7008 + mbFixedCellHeightUsed = FALSE;
7011 +ImplTextObj::~ImplTextObj()
7013 + for ( ParagraphObj* pPtr = (ParagraphObj*)mpList->First(); pPtr; pPtr = (ParagraphObj*)mpList->Next() )
7018 +TextObj::TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > & rXTextRef,
7019 + int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rProv )
7021 + mpImplTextObj = new ImplTextObj( nInstance );
7023 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >
7024 + aXTextParagraphEA( rXTextRef, ::com::sun::star::uno::UNO_QUERY );
7026 + if ( aXTextParagraphEA.is() )
7028 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
7029 + aXTextParagraphE( aXTextParagraphEA->createEnumeration() );
7030 + if ( aXTextParagraphE.is() )
7032 + ParaFlags aParaFlags;
7033 + while ( aXTextParagraphE->hasMoreElements() )
7035 + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > aXParagraph;
7036 + ::com::sun::star::uno::Any aAny( aXTextParagraphE->nextElement() );
7037 + if ( aAny >>= aXParagraph )
7039 + if ( !aXTextParagraphE->hasMoreElements() )
7040 + aParaFlags.bLastParagraph = TRUE;
7041 + ParagraphObj* pPara = new ParagraphObj( aXParagraph, aParaFlags, rFontCollection, rProv );
7042 + mpImplTextObj->mbHasExtendedBullets |= pPara->bExtendedBulletsUsed;
7043 + mpImplTextObj->mpList->Insert( pPara, LIST_APPEND );
7044 + aParaFlags.bFirstParagraph = FALSE;
7049 + ImplCalculateTextPositions();
7052 +TextObj::TextObj( TextObj& rTextObj )
7054 + mpImplTextObj = rTextObj.mpImplTextObj;
7055 + mpImplTextObj->mnRefCount++;
7058 +TextObj::~TextObj()
7060 + if ( ! ( --mpImplTextObj->mnRefCount ) )
7061 + delete mpImplTextObj;
7064 +void TextObj::Write( SvStream* pStrm )
7066 + sal_uInt32 nSize, nPos = pStrm->Tell();
7067 + *pStrm << (sal_uInt32)( EPP_TextCharsAtom << 16 ) << (sal_uInt32)0;
7068 + for ( void* pPtr = First(); pPtr; pPtr = Next() )
7069 + ((ParagraphObj*)pPtr)->Write( pStrm );
7070 + nSize = pStrm->Tell() - nPos;
7071 + pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
7072 + *pStrm << (sal_uInt32)( nSize - 8 );
7073 + pStrm->SeekRel( nSize - 8 );
7076 +void TextObj::ImplCalculateTextPositions()
7078 + mpImplTextObj->mnTextSize = 0;
7079 + for ( void* pPtr = First(); pPtr; pPtr = Next() )
7080 + mpImplTextObj->mnTextSize += ((ParagraphObj*)pPtr)->ImplCalculateTextPositions( mpImplTextObj->mnTextSize );
7083 +TextObj& TextObj::operator=( TextObj& rTextObj )
7085 + if ( this != &rTextObj )
7087 + if ( ! ( --mpImplTextObj->mnRefCount ) )
7088 + delete mpImplTextObj;
7089 + mpImplTextObj = rTextObj.mpImplTextObj;
7090 + mpImplTextObj->mnRefCount++;
7095 +void TextObj::WriteTextSpecInfo( SvStream* pStrm )
7097 + sal_uInt32 nCharactersLeft( Count() );
7098 + if ( nCharactersLeft >= 1 )
7100 + EscherExAtom aAnimationInfoAtom( *pStrm, EPP_TextSpecInfoAtom, 0, 0 );
7101 + for ( ParagraphObj* pPtr = static_cast < ParagraphObj * >( First() ); nCharactersLeft && pPtr; pPtr = static_cast< ParagraphObj* >( Next() ) )
7103 + for ( PortionObj* pPortion = static_cast< PortionObj* >( pPtr->First() ); nCharactersLeft && pPortion; pPortion = static_cast< PortionObj* >( pPtr->Next() ) )
7105 + sal_Int32 nPortionSize = pPortion->mnTextSize >= nCharactersLeft ? nCharactersLeft : pPortion->mnTextSize;
7106 + sal_Int32 nFlags = 7;
7107 + nCharactersLeft -= nPortionSize;
7108 + *pStrm << static_cast< sal_uInt32 >( nPortionSize )
7110 + << static_cast< sal_Int16 >( 1 ) // spellinfo -> needs rechecking
7111 + << static_cast< sal_Int16 >( MsLangId::convertLocaleToLanguageWithFallback( pPortion->meCharLocale ) )
7112 + << static_cast< sal_Int16 >( 0 ); // alt language
7115 + if ( nCharactersLeft )
7116 + *pStrm << nCharactersLeft << static_cast< sal_Int32 >( 1 ) << static_cast< sal_Int16 >( 1 );
7121 +// -----------------------------------------------------------------------
7123 +void PPTWriter::ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt )
7125 + if ( !mbFontIndependentLineSpacing )
7127 + ParagraphObj* pPara = rTextObj.First();
7130 + PortionObj* pPortion = (PortionObj*)pPara->First();
7133 + sal_Int16 nLineSpacing = pPara->mnLineSpacing;
7134 + const FontCollectionEntry* pDesc = maFontCollection.GetById( pPortion->mnFont );
7136 + nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
7138 + if ( ( nLineSpacing > 0 ) && ( nLineSpacing < 100 ) )
7141 + if ( rxText.is() )
7143 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape( rxText, ::com::sun::star::uno::UNO_QUERY );
7144 + if ( xShape.is() )
7146 + SdrObject* pObj = GetSdrObjectFromXShape( mXShape );
7149 + const OutlinerParaObject* pParaObj = pObj->GetOutlinerParaObject();
7152 + SdrModel* pModel = pObj->GetModel();
7155 + Outliner aOutliner( &pModel->GetItemPool(), pParaObj->GetOutlinerMode() );
7156 + aOutliner.SetText( *pParaObj );
7157 + ULONG nTextHeight = aOutliner.GetLineHeight( 0, 0 );
7158 + if ( nTextHeight )
7167 + double fCharHeight = pPortion->mnCharHeight;
7168 + fCharHeight *= 2540 / 72;
7169 + fCharHeight *= 100 - nLineSpacing;
7170 + fCharHeight /= 100;
7172 + sal_uInt32 nUpperDistance = 0;
7173 + rPropOpt.GetOpt( ESCHER_Prop_dyTextTop, nUpperDistance );
7174 + nUpperDistance += static_cast< sal_uInt32 >( fCharHeight * 360.0 );
7175 + rPropOpt.AddOpt( ESCHER_Prop_dyTextTop, nUpperDistance );
7182 +// -----------------------------------------------------------------------
7184 +void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance,
7185 + TextRuleEntry* pTextRule, SvStream& rExtBuStr, EscherPropertyContainer* pPropOpt )
7187 + PPTExParaSheet& rParaSheet = mpStyleSheet->GetParaSheet( nTextInstance );
7189 + rOut << (sal_uInt32)( ( EPP_TextHeaderAtom << 16 ) | ( nAtomInstance << 4 ) ) << (sal_uInt32)4
7192 + if ( mbEmptyPresObj )
7194 + if ( !mbEmptyPresObj )
7196 + ParagraphObj* pPara;
7197 + TextObj aTextObj( mXText, nTextInstance, maFontCollection, (PPTExBulletProvider&)*this );
7199 + // leaving out EPP_TextCharsAtom w/o text - still write out
7200 + // attribute info though
7202 + aTextObj.Write( &rOut );
7205 + ImplAdjustFirstLineLineSpacing( aTextObj, *pPropOpt );
7207 + sal_uInt32 nSize, nPos = rOut.Tell();
7209 + rOut << (sal_uInt32)( EPP_StyleTextPropAtom << 16 ) << (sal_uInt32)0;
7210 + ImplWriteParagraphs( rOut, aTextObj );
7211 + ImplWritePortions( rOut, aTextObj );
7212 + nSize = rOut.Tell() - nPos;
7213 + rOut.SeekRel( - ( (sal_Int32)nSize - 4 ) );
7214 + rOut << (sal_uInt32)( nSize - 8 );
7215 + rOut.SeekRel( nSize - 8 );
7217 + for ( pPara = aTextObj.First(); pPara; pPara = aTextObj.Next() )
7219 + for ( PortionObj* pPortion = (PortionObj*)pPara->First(); pPortion; pPortion = (PortionObj*)pPara->Next() )
7221 + if ( pPortion->mpFieldEntry )
7223 + const FieldEntry* pFieldEntry = pPortion->mpFieldEntry;
7225 + switch ( pFieldEntry->nFieldType >> 28 )
7230 + rOut << (sal_uInt32)( EPP_DateTimeMCAtom << 16 ) << (sal_uInt32)8
7231 + << (sal_uInt32)( pFieldEntry->nFieldStartPos ) // TxtOffset auf TxtField;
7232 + << (sal_uInt8)( pFieldEntry->nFieldType & 0xff ) // Type
7233 + << (sal_uInt8)0 << (sal_uInt16)0; // PadBytes
7238 + rOut << (sal_uInt32)( EPP_SlideNumberMCAtom << 16 ) << (sal_uInt32 ) 4
7239 + << (sal_uInt32)( pFieldEntry->nFieldStartPos );
7244 + sal_uInt32 nPageIndex = 0;
7247 + String aFile( pFieldEntry->aFieldUrl );
7248 + String aTarget( pFieldEntry->aFieldUrl );
7249 + INetURLObject aUrl( pFieldEntry->aFieldUrl );
7250 + if ( INET_PROT_FILE == aUrl.GetProtocol() )
7251 + aFile = aUrl.PathToFileName();
7252 + else if ( INET_PROT_SMB == aUrl.GetProtocol() )
7254 + // #n382718# (and #n261623#) Convert smb notation to '\\'
7255 + aFile = aUrl.GetMainURL( INetURLObject::NO_DECODE );
7256 + aFile = String( aFile.GetBuffer() + 4 ); // skip the 'smb:' part
7257 + aFile.SearchAndReplaceAll( '/', '\\' );
7260 + else if ( pFieldEntry->aFieldUrl.GetChar( 0 ) == '#' )
7262 + String aPage( INetURLObject::decode( pFieldEntry->aFieldUrl, '%', INetURLObject::DECODE_WITH_CHARSET ) );
7263 + aPage.Erase( 0, 1 );
7264 + for ( String* pStr = (String*)maSlideNameList.First(); pStr; pStr = (String*)maSlideNameList.Next(), nPageIndex++ )
7266 + if ( *pStr == aPage )
7268 + aPageUrl = UniString::CreateFromInt32( 256 + nPageIndex );
7269 + aPageUrl.Append( String( RTL_CONSTASCII_USTRINGPARAM( "," ) ) );
7270 + aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) );
7271 + aPageUrl.Append( String( RTL_CONSTASCII_USTRINGPARAM( ",Slide " ) ) );
7272 + aPageUrl.Append( String::CreateFromInt32( nPageIndex + 1 ) );
7276 + sal_uInt32 nHyperId;
7277 + if ( aPageUrl.Len() )
7278 + nHyperId = ImplInsertBookmarkURL( aPageUrl, 1 | ( nPageIndex << 8 ) | ( 1 << 31 ), pFieldEntry->aRepresentation, aEmpty, aEmpty, aPageUrl );
7280 + nHyperId = ImplInsertBookmarkURL( pFieldEntry->aFieldUrl, 2 | ( nHyperId << 8 ), aFile, aTarget, aEmpty, aEmpty );
7282 + rOut << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0xf ) << (sal_uInt32)24
7283 + << (sal_uInt32)( EPP_InteractiveInfoAtom << 16 ) << (sal_uInt32)16
7284 + << (sal_uInt32)0 // soundref
7285 + << nHyperId // hyperlink id
7286 + << (sal_uInt8)4 // hyperlink action
7287 + << (sal_uInt8)0 // ole verb
7288 + << (sal_uInt8)0 // jump
7289 + << (sal_uInt8)0 // flags
7290 + << (sal_uInt8)8 // hyperlink type ?
7291 + << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0
7292 + << (sal_uInt32)( EPP_TxInteractiveInfoAtom << 16 ) << (sal_uInt32)8
7293 + << (sal_uInt32)( pFieldEntry->nFieldStartPos )
7294 + << (sal_uInt32)( pFieldEntry->nFieldEndPos );
7299 + rOut << (sal_uInt32)( EPP_GenericDateMCAtom << 16 ) << (sal_uInt32)4
7300 + << (sal_uInt32)( pFieldEntry->nFieldStartPos );
7305 + rOut << (sal_uInt32)( EPP_HeaderMCAtom << 16 ) << (sal_uInt32 ) 4
7306 + << (sal_uInt32)( pFieldEntry->nFieldStartPos );
7311 + rOut << (sal_uInt32)( EPP_FooterMCAtom << 16 ) << (sal_uInt32 ) 4
7312 + << (sal_uInt32)( pFieldEntry->nFieldStartPos );
7322 + aTextObj.WriteTextSpecInfo( &rOut );
7324 + // Star Office Default TabSizes schreiben ( wenn noetig )
7325 + pPara = aTextObj.First();
7328 + sal_uInt32 nParaFlags = 0x1f;
7329 + sal_Int16 nDepth, nMask, nNumberingRule[ 10 ];
7330 + sal_uInt32 nTextOfs = pPara->nTextOfs;
7331 + sal_uInt32 nTabs = pPara->maTabStop.getLength();
7332 + const ::com::sun::star::style::TabStop* pTabStop = ( const ::com::sun::star::style::TabStop* )pPara->maTabStop.getConstArray();
7334 + for ( ; pPara; pPara = aTextObj.Next() )
7336 + if ( pPara->bExtendedParameters )
7338 + nDepth = pPara->nDepth;
7341 + nMask = 1 << nDepth;
7342 + if ( nParaFlags & nMask )
7344 + nParaFlags &=~ nMask;
7345 + if ( ( rParaSheet.maParaLevel[ nDepth ].mnTextOfs != pPara->nTextOfs ) ||
7346 + ( rParaSheet.maParaLevel[ nDepth ].mnBulletOfs != pPara->nBulletOfs ) )
7348 + nParaFlags |= nMask << 16;
7349 + nNumberingRule[ nDepth << 1 ] = pPara->nTextOfs;
7350 + nNumberingRule[ ( nDepth << 1 ) + 1 ] = (sal_Int16)pPara->nBulletOfs;
7356 + nParaFlags >>= 16;
7358 + sal_uInt32 nDefaultTabSize = ImplMapSize( ::com::sun::star::awt::Size( 2011, 1 ) ).Width;
7359 + sal_uInt32 nDefaultTabs = abs( maRect.GetWidth() ) / nDefaultTabSize;
7361 + nDefaultTabs -= (sal_Int32)( ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 ) + nTextOfs ) / nDefaultTabSize );
7362 + if ( (sal_Int32)nDefaultTabs < 0 )
7365 + sal_uInt32 nTabCount = nTabs + nDefaultTabs;
7366 + sal_uInt32 i, nTextRulerAtomFlags = 0;
7369 + nTextRulerAtomFlags |= 4;
7371 + nTextRulerAtomFlags |= ( ( nParaFlags << 3 ) | ( nParaFlags << 8 ) );
7373 + if ( nTextRulerAtomFlags )
7375 + SvStream* pRuleOut = &rOut;
7377 + pRuleOut = pTextRule->pOut = new SvMemoryStream( 0x100, 0x100 );
7379 + sal_uInt32 nRulePos = pRuleOut->Tell();
7380 + *pRuleOut << (sal_uInt32)( EPP_TextRulerAtom << 16 ) << (sal_uInt32)0;
7381 + *pRuleOut << nTextRulerAtomFlags;
7382 + if ( nTextRulerAtomFlags & 4 )
7384 + *pRuleOut << (sal_uInt16)nTabCount;
7385 + for ( i = 0; i < nTabs; i++ )
7387 + sal_uInt16 nPosition = (sal_uInt16)( ( pTabStop[ i ].Position / 4.40972 ) + nTextOfs );
7389 + switch ( pTabStop[ i ].Alignment )
7391 + case ::com::sun::star::style::TabAlign_DECIMAL : nType = 3; break;
7392 + case ::com::sun::star::style::TabAlign_RIGHT : nType = 2; break;
7393 + case ::com::sun::star::style::TabAlign_CENTER : nType = 1; break;
7395 + case ::com::sun::star::style::TabAlign_LEFT :
7396 + default: nType = 0;
7398 + *pRuleOut << nPosition
7402 + sal_uInt32 nWidth = 1;
7404 + nWidth += (sal_Int32)( ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 + nTextOfs ) / nDefaultTabSize ) );
7405 + nWidth *= nDefaultTabSize;
7406 + for ( i = 0; i < nDefaultTabs; i++, nWidth += nDefaultTabSize )
7407 + *pRuleOut << nWidth;
7409 + for ( i = 0; i < 5; i++ )
7411 + if ( nTextRulerAtomFlags & ( 8 << i ) )
7412 + *pRuleOut << nNumberingRule[ i << 1 ];
7413 + if ( nTextRulerAtomFlags & ( 256 << i ) )
7414 + *pRuleOut << nNumberingRule[ ( i << 1 ) + 1 ];
7416 + sal_uInt32 nBufSize = pRuleOut->Tell() - nRulePos;
7417 + pRuleOut->SeekRel( - ( (sal_Int32)nBufSize - 4 ) );
7418 + *pRuleOut << (sal_uInt32)( nBufSize - 8 );
7419 + pRuleOut->SeekRel( nBufSize - 8 );
7422 + if ( aTextObj.HasExtendedBullets() )
7424 + ParagraphObj* pBulletPara = aTextObj.First();
7425 + if ( pBulletPara )
7427 + sal_uInt32 nBulletFlags = 0;
7428 + sal_uInt32 nNumberingType = 0, nPos2 = rExtBuStr.Tell();
7430 + rExtBuStr << (sal_uInt32)( EPP_PST_ExtendedParagraphAtom << 16 ) << (sal_uInt32)0;
7432 + for ( ; pBulletPara; pBulletPara = aTextObj.Next() )
7435 + sal_uInt16 nBulletId = pBulletPara->nBulletId;
7436 + if ( pBulletPara->bExtendedBulletsUsed )
7438 + nBulletFlags = 0x800000;
7439 + if ( pBulletPara->nNumberingType != SVX_NUM_BITMAP )
7440 + nBulletFlags = 0x3000000;
7442 + rExtBuStr << (sal_uInt32)nBulletFlags;
7444 + if ( nBulletFlags & 0x800000 )
7445 + rExtBuStr << nBulletId;
7446 + if ( nBulletFlags & 0x1000000 )
7448 + switch( pBulletPara->nNumberingType )
7450 + case SVX_NUM_NUMBER_NONE :
7451 + case SVX_NUM_CHAR_SPECIAL :
7452 + nNumberingType = 0;
7454 + case SVX_NUM_CHARS_UPPER_LETTER :
7455 + case SVX_NUM_CHARS_UPPER_LETTER_N :
7456 + case SVX_NUM_CHARS_LOWER_LETTER :
7457 + case SVX_NUM_CHARS_LOWER_LETTER_N :
7458 + case SVX_NUM_ROMAN_UPPER :
7459 + case SVX_NUM_ROMAN_LOWER :
7460 + case SVX_NUM_ARABIC :
7461 + nNumberingType = pBulletPara->nMappedNumType;
7464 + // case SVX_NUM_PAGEDESC :
7465 + case SVX_NUM_BITMAP :
7466 + nNumberingType = 0;
7470 + rExtBuStr << (sal_uInt32)nNumberingType;
7472 + if ( nBulletFlags & 0x2000000 )
7473 + rExtBuStr << (sal_uInt16)pBulletPara->nStartWith;
7474 + rExtBuStr << (sal_uInt32)0 << (sal_uInt32)0;
7476 + sal_uInt32 nBulletSize = ( rExtBuStr.Tell() - nPos2 ) - 8;
7477 + rExtBuStr.SeekRel( - ( (sal_Int32)nBulletSize + 4 ) );
7478 + rExtBuStr << nBulletSize;
7479 + rExtBuStr.SeekRel( nBulletSize );
7485 +// -----------------------------------------------------------------------
7487 +void PPTWriter::ImplWriteObjectEffect( SvStream& rSt,
7488 + ::com::sun::star::presentation::AnimationEffect eAe,
7489 + ::com::sun::star::presentation::AnimationEffect eTe,
7490 + sal_uInt16 nOrder )
7492 + EscherExContainer aAnimationInfo( rSt, EPP_AnimationInfo );
7493 + EscherExAtom aAnimationInfoAtom( rSt, EPP_AnimationInfoAtom, 0, 1 );
7494 + sal_uInt32 nDimColor = 0x7000000; // color to use for dimming
7495 + sal_uInt32 nFlags = 0x4400; // set of flags that determine type of build
7496 + sal_uInt32 nSoundRef = 0; // 0 if storage is from clipboard. Otherwise index(ID) in SoundCollection list.
7497 + sal_uInt32 nDelayTime = 0; // delay before playing object
7498 + sal_uInt16 nSlideCount = 1; // number of slides to play object
7499 + UINT8 nBuildType = 1; // type of build
7500 + UINT8 nFlyMethod = 0; // animation effect( fly, zoom, appear, etc )
7501 + UINT8 nFlyDirection = 0; // Animation direction( left, right, up, down, etc )
7502 + UINT8 nAfterEffect = 0; // what to do after build
7503 + UINT8 nSubEffect = 0; // build by word or letter
7504 + UINT8 nOleVerb = 0; // Determines object's class (sound, video, other)
7506 + if ( eAe == ::com::sun::star::presentation::AnimationEffect_NONE )
7513 + case ::com::sun::star::presentation::AnimationEffect_NONE :
7515 + case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LEFT :
7517 + nFlyDirection = 2;
7521 + case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_TOP :
7523 + nFlyDirection = 3;
7527 + case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_RIGHT :
7529 + nFlyDirection = 0;
7533 + case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_BOTTOM :
7535 + nFlyDirection = 1;
7539 + case ::com::sun::star::presentation::AnimationEffect_FADE_TO_CENTER :
7541 + nFlyDirection = 1;
7545 + case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_CENTER :
7547 + nFlyDirection = 0;
7551 + case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LEFT :
7553 + nFlyDirection = 0;
7557 + case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_TOP :
7559 + nFlyDirection = 1;
7563 + case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_RIGHT :
7565 + nFlyDirection = 2;
7569 + case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_BOTTOM :
7571 + nFlyDirection = 3;
7575 + case ::com::sun::star::presentation::AnimationEffect_VERTICAL_STRIPES :
7577 + nFlyDirection = 0;
7581 + case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_STRIPES :
7583 + nFlyDirection = 1;
7587 + case ::com::sun::star::presentation::AnimationEffect_CLOCKWISE :
7589 + nFlyDirection = 1;
7593 + case ::com::sun::star::presentation::AnimationEffect_COUNTERCLOCKWISE :
7595 + nFlyDirection = 0;
7599 + case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_UPPERLEFT :
7601 + nFlyDirection = 7;
7605 + case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_UPPERRIGHT :
7607 + nFlyDirection = 6;
7611 + case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LOWERLEFT :
7613 + nFlyDirection = 5;
7617 + case ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LOWERRIGHT :
7619 + nFlyDirection = 4;
7623 + case ::com::sun::star::presentation::AnimationEffect_CLOSE_VERTICAL :
7625 + nFlyDirection = 1;
7629 + case ::com::sun::star::presentation::AnimationEffect_CLOSE_HORIZONTAL :
7631 + nFlyDirection = 3;
7635 + case ::com::sun::star::presentation::AnimationEffect_OPEN_VERTICAL :
7637 + nFlyDirection = 0;
7641 + case ::com::sun::star::presentation::AnimationEffect_OPEN_HORIZONTAL :
7643 + nFlyDirection = 2;
7647 + case ::com::sun::star::presentation::AnimationEffect_PATH :
7649 + nFlyDirection = 28;
7653 + case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_LEFT :
7655 + nFlyDirection = 0;
7659 + case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_TOP :
7661 + nFlyDirection = 0;
7665 + case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_RIGHT :
7667 + nFlyDirection = 0;
7671 + case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_BOTTOM :
7673 + nFlyDirection = 0;
7677 + case ::com::sun::star::presentation::AnimationEffect_SPIRALIN_LEFT :
7678 + case ::com::sun::star::presentation::AnimationEffect_SPIRALIN_RIGHT :
7679 + case ::com::sun::star::presentation::AnimationEffect_SPIRALOUT_LEFT :
7680 + case ::com::sun::star::presentation::AnimationEffect_SPIRALOUT_RIGHT :
7682 + nFlyDirection = 0x1c;
7686 + case ::com::sun::star::presentation::AnimationEffect_DISSOLVE :
7688 + nFlyDirection = 0;
7692 + case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_LEFT :
7694 + nFlyDirection = 2;
7698 + case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_TOP :
7700 + nFlyDirection = 3;
7704 + case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_RIGHT :
7706 + nFlyDirection = 0;
7710 + case ::com::sun::star::presentation::AnimationEffect_WAVYLINE_FROM_BOTTOM :
7712 + nFlyDirection = 1;
7716 + case ::com::sun::star::presentation::AnimationEffect_RANDOM :
7718 + nFlyDirection = 0;
7722 + case ::com::sun::star::presentation::AnimationEffect_VERTICAL_LINES :
7724 + nFlyDirection = 1;
7728 + case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_LINES :
7730 + nFlyDirection = 0;
7734 + case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_LEFT :
7736 + nFlyDirection = 2;
7740 + case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_TOP :
7742 + nFlyDirection = 3;
7746 + case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_RIGHT :
7748 + nFlyDirection = 0;
7752 + case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_BOTTOM :
7754 + nFlyDirection = 1;
7758 + case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_UPPERLEFT :
7760 + nFlyDirection = 7;
7764 + case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_UPPERRIGHT :
7766 + nFlyDirection = 6;
7770 + case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_LOWERLEFT :
7772 + nFlyDirection = 5;
7776 + case ::com::sun::star::presentation::AnimationEffect_LASER_FROM_LOWERRIGHT :
7778 + nFlyDirection = 4;
7782 + case ::com::sun::star::presentation::AnimationEffect_APPEAR :
7784 + case ::com::sun::star::presentation::AnimationEffect_HIDE :
7786 + nFlyDirection = 0;
7790 + case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_UPPERLEFT :
7792 + nFlyDirection = 4;
7796 + case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_UPPERRIGHT :
7798 + nFlyDirection = 5;
7802 + case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LOWERRIGHT :
7804 + nFlyDirection = 7;
7808 + case ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LOWERLEFT :
7810 + nFlyDirection = 6;
7814 + case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_UPPERLEFT :
7815 + case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_UPPERRIGHT :
7816 + case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_LOWERRIGHT :
7817 + case ::com::sun::star::presentation::AnimationEffect_MOVE_TO_LOWERLEFT :
7818 + nAfterEffect |= 2;
7820 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LEFT :
7821 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_UPPERLEFT :
7823 + nFlyDirection = 8;
7827 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_TOP :
7828 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_UPPERRIGHT :
7830 + nFlyDirection = 11;
7834 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_RIGHT :
7835 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LOWERRIGHT :
7837 + nFlyDirection = 10;
7841 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_BOTTOM :
7842 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LOWERLEFT :
7844 + nFlyDirection = 9;
7848 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_LEFT :
7849 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_UPPERLEFT :
7850 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_TOP :
7851 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_UPPERRIGHT :
7852 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_RIGHT :
7853 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_LOWERRIGHT :
7854 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_BOTTOM :
7855 + case ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_TO_LOWERLEFT :
7856 + nAfterEffect |= 2;
7858 + case ::com::sun::star::presentation::AnimationEffect_VERTICAL_CHECKERBOARD :
7860 + nFlyDirection = 1;
7864 + case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_CHECKERBOARD :
7866 + nFlyDirection = 0;
7870 + case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_ROTATE :
7871 + case ::com::sun::star::presentation::AnimationEffect_VERTICAL_ROTATE :
7873 + nFlyDirection = 27;
7877 + case ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_STRETCH :
7878 + case ::com::sun::star::presentation::AnimationEffect_VERTICAL_STRETCH :
7880 + nFlyDirection = 22;
7884 + case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LEFT :
7885 + case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_UPPERLEFT :
7887 + nFlyDirection = 23;
7891 + case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_TOP :
7892 + case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_UPPERRIGHT :
7894 + nFlyDirection = 24;
7898 + case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_RIGHT :
7899 + case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LOWERRIGHT :
7901 + nFlyDirection = 25;
7905 + case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_BOTTOM :
7906 + case ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LOWERLEFT :
7908 + nFlyDirection = 26;
7912 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN :
7914 + nFlyDirection = 16;
7918 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_SMALL :
7919 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_SPIRAL :
7921 + nFlyDirection = 17;
7925 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT :
7927 + nFlyDirection = 18;
7931 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_SMALL :
7932 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_SPIRAL :
7934 + nFlyDirection = 19;
7938 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_LEFT :
7939 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_UPPERLEFT :
7940 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_TOP :
7941 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_UPPERRIGHT :
7942 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_RIGHT :
7943 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_LOWERRIGHT :
7944 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_BOTTOM :
7945 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_LOWERLEFT :
7946 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_IN_FROM_CENTER :
7948 + nFlyDirection = 16;
7952 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_LEFT :
7953 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_UPPERLEFT :
7954 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_TOP :
7955 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_UPPERRIGHT :
7956 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_RIGHT :
7957 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_LOWERRIGHT :
7958 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_BOTTOM :
7959 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_LOWERLEFT :
7960 + case ::com::sun::star::presentation::AnimationEffect_ZOOM_OUT_FROM_CENTER :
7961 + nAfterEffect |= 2;
7966 + if ( mnDiaMode >= 1 )
7968 + if ( eTe != ::com::sun::star::presentation::AnimationEffect_NONE )
7970 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "SoundOn" ) ) ) )
7976 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) )
7978 + nSoundRef = maSoundCollection.GetId( *(::rtl::OUString*)mAny.getValue() );
7984 + sal_Bool bDimHide = FALSE;
7985 + sal_Bool bDimPrevious = FALSE;
7986 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "DimHide" ) ) ) )
7987 + mAny >>= bDimHide;
7988 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "DimPrevious" ) ) ) )
7989 + mAny >>= bDimPrevious;
7990 + if ( bDimPrevious )
7991 + nAfterEffect |= 1;
7993 + nAfterEffect |= 2;
7994 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "DimColor" ) ) ) )
7995 + nDimColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) ) | 0xfe000000;
7997 + rSt << nDimColor << nFlags << nSoundRef << nDelayTime
7998 + << nOrder // order of build ( 1.. )
7999 + << nSlideCount << nBuildType << nFlyMethod << nFlyDirection
8000 + << nAfterEffect << nSubEffect << nOleVerb
8001 + << (sal_uInt16)0; // PadWord
8004 +// -----------------------------------------------------------------------
8006 +void PPTWriter::ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentation::ClickAction eCa, sal_Bool bMediaClickAction )
8008 + sal_uInt32 nSoundRef = 0; // a reference to a sound in the sound collection, or NULL.
8009 + sal_uInt32 nHyperLinkID = 0;// a persistent unique identifier to an external hyperlink object (only valid when action == HyperlinkAction).
8010 + sal_uInt8 nAction = 0; // Action See Action Table
8011 + sal_uInt8 nOleVerb = 0; // OleVerb Only valid when action == OLEAction. OLE verb to use, 0 = first verb, 1 = second verb, etc.
8012 + sal_uInt8 nJump = 0; // Jump See Jump Table
8013 + sal_uInt8 nFlags = 0; // Bit 1: Animated. If 1, then button is animated
8014 + // Bit 2: Stop sound. If 1, then stop current sound when button is pressed.
8015 + // Bit 3: CustomShowReturn. If 1, and this is a jump to custom show, then return to this slide after custom show.
8016 + sal_uInt8 nHyperLinkType = 0;// HyperlinkType a value from the LinkTo enum, such as LT_URL (only valid when action == HyperlinkAction).
8021 + Action Table: Action Value
8024 + RunProgramAction 2
8029 + CustomShowAction 7
8031 + Jump Table: Jump Value
8041 + if ( bMediaClickAction )
8043 + else switch( eCa )
8045 + case ::com::sun::star::presentation::ClickAction_STOPPRESENTATION :
8047 + case ::com::sun::star::presentation::ClickAction_LASTPAGE :
8049 + case ::com::sun::star::presentation::ClickAction_FIRSTPAGE :
8051 + case ::com::sun::star::presentation::ClickAction_PREVPAGE :
8053 + case ::com::sun::star::presentation::ClickAction_NEXTPAGE :
8059 + case ::com::sun::star::presentation::ClickAction_SOUND :
8061 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) ) ) )
8062 + nSoundRef = maSoundCollection.GetId( *(::rtl::OUString*)mAny.getValue() );
8065 + case ::com::sun::star::presentation::ClickAction_PROGRAM :
8067 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) ) ) )
8069 + INetURLObject aUrl( *(::rtl::OUString*)mAny.getValue() );
8070 + if ( INET_PROT_FILE == aUrl.GetProtocol() )
8072 + aFile = aUrl.PathToFileName();
8079 + case ::com::sun::star::presentation::ClickAction_BOOKMARK :
8081 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) ) ) )
8083 + String aBookmark( *(::rtl::OUString*)mAny.getValue() );
8084 + sal_uInt32 nIndex = 0;
8085 + for ( String* pStr = (String*)maSlideNameList.First(); pStr; pStr = (String*)maSlideNameList.Next(), nIndex++ )
8087 + if ( *pStr == aBookmark )
8089 + // Bookmark ist ein link zu einer Dokumentseite
8091 + nHyperLinkType = 7;
8094 + String aHyperString = UniString::CreateFromInt32( 256 + nIndex );
8095 + aHyperString.Append( String( RTL_CONSTASCII_USTRINGPARAM( "," ) ) );
8096 + aHyperString.Append( String::CreateFromInt32( nIndex + 1 ) );
8097 + aHyperString.Append( String( RTL_CONSTASCII_USTRINGPARAM( ",Slide " ) ) );
8098 + aHyperString.Append( String::CreateFromInt32( nIndex + 1 ) );
8099 + nHyperLinkID = ImplInsertBookmarkURL( aHyperString, 1 | ( nIndex << 8 ) | ( 1 << 31 ), aBookmark, aEmpty, aEmpty, aHyperString );
8106 + case ::com::sun::star::presentation::ClickAction_DOCUMENT :
8108 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) ) ) )
8110 + String aBookmark( *(::rtl::OUString*)mAny.getValue() );
8111 + if ( aBookmark.Len() )
8114 + nHyperLinkType = 8;
8117 + String aBookmarkFile( aBookmark );
8118 + INetURLObject aUrl( aBookmark );
8119 + if ( INET_PROT_FILE == aUrl.GetProtocol() )
8120 + aBookmarkFile = aUrl.PathToFileName();
8121 + nHyperLinkID = ImplInsertBookmarkURL( aBookmark, (sal_uInt32)(2 | ( 1 << 31 )), aBookmarkFile, aBookmark, aEmpty, aEmpty );
8127 + case ::com::sun::star::presentation::ClickAction_INVISIBLE :
8128 + case ::com::sun::star::presentation::ClickAction_VERB :
8129 + case ::com::sun::star::presentation::ClickAction_VANISH :
8130 + case ::com::sun::star::presentation::ClickAction_MACRO :
8135 + sal_uInt32 nContainerSize = 24;
8136 + if ( nAction == 2 )
8137 + nContainerSize += ( aFile.Len() * 2 ) + 8;
8138 + rSt << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0xf ) << (sal_uInt32)nContainerSize
8139 + << (sal_uInt32)( EPP_InteractiveInfoAtom << 16 ) << (sal_uInt32)16
8146 + << (sal_uInt32)nHyperLinkType;
8148 + if ( nAction == 2 ) // run program Action
8150 + sal_uInt16 i, nLen = aFile.Len();
8151 + rSt << (sal_uInt32)( ( EPP_CString << 16 ) | 0x20 ) << (sal_uInt32)( nLen * 2 );
8152 + for ( i = 0; i < nLen; i++ )
8153 + rSt << aFile.GetChar( i );
8156 + rSt << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0x1f ) << (sal_uInt32)24 // Mouse Over Action
8157 + << (sal_uInt32)( EPP_InteractiveInfo << 16 ) << (sal_uInt32)16;
8158 + for ( int i = 0; i < 4; i++, rSt << (sal_uInt32)0 ) ;
8161 +// -----------------------------------------------------------------------
8163 +sal_Bool PPTWriter::ImplGetEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPropSet,
8164 + ::com::sun::star::presentation::AnimationEffect& eEffect,
8165 + ::com::sun::star::presentation::AnimationEffect& eTextEffect,
8166 + sal_Bool& bIsSound )
8168 + ::com::sun::star::uno::Any aAny;
8169 + if ( GetPropertyValue( aAny, rPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ) ) )
8172 + eEffect = ::com::sun::star::presentation::AnimationEffect_NONE;
8174 + if ( GetPropertyValue( aAny, rPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextEffect" ) ) ) )
8175 + aAny >>= eTextEffect;
8177 + eTextEffect = ::com::sun::star::presentation::AnimationEffect_NONE;
8178 + if ( GetPropertyValue( aAny, rPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "SoundOn" ) ) ) )
8179 + aAny >>= bIsSound;
8183 + sal_Bool bHasEffect = ( ( eEffect != ::com::sun::star::presentation::AnimationEffect_NONE )
8184 + || ( eTextEffect != ::com::sun::star::presentation::AnimationEffect_NONE )
8186 + return bHasEffect;
8189 +// -----------------------------------------------------------------------
8191 +sal_Bool PPTWriter::ImplCreatePresentationPlaceholder( const sal_Bool bMasterPage, const PageType /* ePageType */,
8192 + const sal_uInt32 nStyleInstance, const sal_uInt8 nPlaceHolderId )
8194 + sal_Bool bRet = ImplGetText();
8195 + if ( bRet && bMasterPage )
8197 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8198 + sal_uInt32 nPresShapeID = mpPptEscherEx->GetShapeID();
8199 + mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, nPresShapeID );// Flags: HaveAnchor | HasSpt
8200 + EscherPropertyContainer aPropOpt;
8201 + aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
8202 + aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
8203 + aPropOpt.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
8204 + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
8205 + aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
8206 + aPropOpt.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
8207 + aPropOpt.CreateFillProperties( mXPropSet, sal_True );
8208 + sal_uInt32 nLineFlags = 0x90001;
8209 + if ( aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
8210 + nLineFlags |= 0x10001; // draw dashed line if no line
8211 + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
8213 + SvMemoryStream aExtBu( 0x200, 0x200 );
8214 + SvMemoryStream aClientTextBox( 0x200, 0x200 );
8215 + ImplWriteTextStyleAtom( aClientTextBox, nStyleInstance, 0, NULL, aExtBu, &aPropOpt );
8217 + aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
8218 + aPropOpt.Commit( *mpStrm );
8219 + mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
8220 + *mpStrm << (sal_Int16)maRect.Top() << (sal_Int16)maRect.Left() << (sal_Int16)maRect.Right() << (sal_Int16)maRect.Bottom(); // oben, links, rechts, unten ????
8221 + mpPptEscherEx->OpenContainer( ESCHER_ClientData );
8222 + mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
8223 + *mpStrm << (sal_uInt32)0 // PlacementID
8224 + << (sal_uInt8)nPlaceHolderId // PlaceHolderID
8225 + << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
8226 + << (sal_uInt16)0; // padword
8227 + mpPptEscherEx->CloseContainer(); // ESCHER_ClientData
8229 + if ( aExtBu.Tell() )
8231 + if ( !pClientData )
8232 + pClientData = new SvMemoryStream( 0x200, 0x200 );
8233 + ImplProgTagContainer( pClientData, &aExtBu );
8236 + if ( aClientTextBox.Tell() )
8238 + *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
8239 + << (sal_uInt32)aClientTextBox.Tell();
8241 + mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() );
8243 + mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
8250 +// -----------------------------------------------------------------------
8252 +void PPTWriter::ImplCreateShape( sal_uInt32 nType, sal_uInt32 nFlags, EscherSolverContainer& rSolver )
8254 + sal_uInt32 nId = mpPptEscherEx->GetShapeID();
8255 + mpPptEscherEx->AddShape( nType, nFlags, nId );
8256 + rSolver.AddShape( mXShape, nId );
8259 +void PPTWriter::ImplCreateTextShape( EscherPropertyContainer& rPropOpt, EscherSolverContainer& rSolver, sal_Bool bFill )
8261 + mnTextStyle = EPP_TEXTSTYLE_TEXT;
8262 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8263 + ImplCreateShape( ESCHER_ShpInst_TextBox, 0xa00, rSolver );
8265 + rPropOpt.CreateFillProperties( mXPropSet, sal_True );
8266 + if ( ImplGetText() )
8267 + rPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
8270 +void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& aSolverContainer, PageType ePageType, sal_Bool bMasterPage, int nPageNumber )
8272 + sal_uInt32 nInstance, nGroups, nShapes, nShapeCount, nPer, nLastPer, nIndices, nGroupLevel = 0, nOlePictureId;
8273 + sal_uInt16 nEffectCount;
8274 + ::com::sun::star::awt::Point aTextRefPoint;
8276 + ResetGroupTable( nShapes = mXShapes->getCount() );
8278 + nIndices = nInstance = nLastPer = nShapeCount = nEffectCount = 0;
8280 + sal_Bool bIsTitlePossible = TRUE; // bei mehr als einem title geht powerpoint in die knie
8282 + sal_uInt32 nOutlinerCount = 0; // die gliederungsobjekte muessen dem layout entsprechen,
8283 + sal_uInt32 nPrevTextStyle = 0; // es darf nicht mehr als zwei geben
8285 + nOlePictureId = 0;
8287 + sal_Bool bAdditionalText = FALSE;
8289 + SvMemoryStream* pClientTextBox = NULL;
8290 + SvMemoryStream* pClientData = NULL;
8292 + while( GetNextGroupEntry() )
8296 + nPer = ( 5 * nShapeCount ) / nShapes;
8297 + if ( nPer != nLastPer )
8300 + sal_uInt32 nValue = mnPagesWritten * 5 + nPer;
8301 + if ( nValue > mnStatMaxValue )
8302 + nValue = mnStatMaxValue;
8303 + if ( mbStatusIndicator && ( nValue > mnLatestStatValue ) )
8305 + mXStatusIndicator->setValue( nValue );
8306 + mnLatestStatValue = nValue;
8309 + nGroups = GetGroupsClosed();
8310 + for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ;
8312 + if ( ImplGetShapeByIndex( GetCurrentGroupIndex(), TRUE ) )
8314 + sal_Bool bIsSound;
8315 + sal_Bool bMediaClickAction = sal_False;
8316 + ::com::sun::star::presentation::AnimationEffect eAe;
8317 + ::com::sun::star::presentation::AnimationEffect eTe;
8319 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "PresentationOrder" ) ) ) )
8320 + nEffectCount = *(sal_uInt16*)mAny.getValue();
8322 + sal_Bool bEffect = ImplGetEffect( mXPropSet, eAe, eTe, bIsSound );
8323 + ::com::sun::star::presentation::ClickAction eCa = ::com::sun::star::presentation::ClickAction_NONE;
8324 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) ) ) )
8327 + sal_Bool bGroup = mType == "drawing.Group";
8328 + sal_Bool bOpenBezier = mType == "drawing.OpenBezier";
8329 + sal_Bool bClosedBezier = mType == "drawing.ClosedBezier";
8330 + sal_Bool bPolyPolygon = mType == "drawing.PolyPolygon";
8331 + sal_Bool bPolyLine = mType == "drawing.PolyLine";
8333 + List aAdjustmentList;
8334 + Rectangle aPolyBoundRect;
8336 + const ::com::sun::star::awt::Size aSize100thmm( mXShape->getSize() );
8337 + const ::com::sun::star::awt::Point aPoint100thmm( mXShape->getPosition() );
8338 + Rectangle aRect100thmm( Point( aPoint100thmm.X, aPoint100thmm.Y ), Size( aSize100thmm.Width, aSize100thmm.Height ) );
8339 + EscherPropertyContainer aPropOpt( (EscherGraphicProvider&)*mpPptEscherEx, mpPicStrm, aRect100thmm );
8343 + SvMemoryStream* pTmp = NULL;
8344 + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >
8345 + aXIndexAccess( mXShape, ::com::sun::star::uno::UNO_QUERY );
8346 + if ( EnterGroup( aXIndexAccess ) )
8348 + if ( bEffect && !mbUseNewAnimations )
8350 + pTmp = new SvMemoryStream( 0x200, 0x200 );
8351 + ImplWriteObjectEffect( *pTmp, eAe, eTe, ++nEffectCount );
8353 + if ( eCa != ::com::sun::star::presentation::ClickAction_NONE )
8356 + pTmp = new SvMemoryStream( 0x200, 0x200 );
8357 + ImplWriteClickAction( *pTmp, eCa, bMediaClickAction );
8359 + sal_uInt32 nShapeId = mpPptEscherEx->EnterGroup( &maRect, pTmp );
8360 + aSolverContainer.AddShape( mXShape, nShapeId );
8366 + sal_Bool bIsFontwork = sal_False;
8367 + sal_Bool bIsHatching = sal_False;
8368 + ::com::sun::star::uno::Any aAny;
8369 + ::com::sun::star::drawing::FillStyle eFS;
8370 + if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFontwork" ) ), sal_True ) )
8371 + aAny >>= bIsFontwork;
8372 + if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ), sal_True ) )
8375 + bIsHatching = eFS == ::com::sun::star::drawing::FillStyle_HATCH;
8377 + if ( bIsHatching || bIsFontwork || ( mType == "drawing.Measure" ) || ( mType == "drawing.Caption" ) )
8379 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "BoundRect" ) ) ) )
8381 + ::com::sun::star::awt::Rectangle aRect( *(::com::sun::star::awt::Rectangle*)mAny.getValue() );
8382 + maPosition = ImplMapPoint( ::com::sun::star::awt::Point( aRect.X, aRect.Y ) );
8383 + maSize = ImplMapSize( ::com::sun::star::awt::Size( aRect.Width, aRect.Height ) );
8384 + maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
8386 + mType = "drawing.dontknow";
8389 + sal_uInt8 nPlaceHolderAtom = EPP_PLACEHOLDER_NONE;
8392 + mnTextStyle = EPP_TEXTSTYLE_NORMAL;
8394 + if ( mType == "drawing.Custom" )
8396 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8397 + sal_uInt32 nMirrorFlags;
8398 + rtl::OUString sCustomShapeType;
8399 + MSO_SPT eShapeType = aPropOpt.GetCustomShapeType( mXShape, nMirrorFlags, sCustomShapeType );
8400 + if ( sCustomShapeType.equalsAscii( "col-502ad400" ) || sCustomShapeType.equalsAscii( "col-60da8460" ) )
8401 + { // sj: creating metafile for customshapes that can't be saved to ms format properly
8402 + ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
8403 + if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
8405 + aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
8406 + SdrObject* pObj = GetSdrObjectFromXShape( mXShape );
8409 + Rectangle aBound = pObj->GetCurrentBoundRect();
8410 + maPosition = ImplMapPoint( ::com::sun::star::awt::Point( aBound.Left(), aBound.Top() ) );
8411 + maSize = ImplMapSize( ::com::sun::star::awt::Size ( aBound.GetWidth(), aBound.GetHeight() ) );
8412 + maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
8419 + ImplCreateShape( eShapeType, nMirrorFlags | 0xa00, aSolverContainer );
8420 + aPropOpt.CreateCustomShapeProperties( eShapeType, mXShape );
8421 + aPropOpt.CreateFillProperties( mXPropSet, sal_True );
8422 + if ( ImplGetText() )
8424 + if ( !aPropOpt.IsFontWork() )
8425 + aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_True, sal_True );
8429 + else if ( mType == "drawing.Rectangle" )
8431 + sal_Int32 nRadius = 0;
8432 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8433 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CornerRadius" ) ) ) )
8436 + nRadius = ImplMapSize( ::com::sun::star::awt::Size( nRadius, 0 ) ).Width;
8440 + ImplCreateShape( ESCHER_ShpInst_RoundRectangle, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
8441 + sal_Int32 nLenght = maRect.GetWidth();
8442 + if ( nLenght > maRect.GetHeight() )
8443 + nLenght = maRect.GetHeight();
8445 + if ( nRadius >= nLenght )
8446 + nRadius = 0x2a30; // 0x2a30 ist PPTs maximum radius
8448 + nRadius = ( 0x2a30 * nRadius ) / nLenght;
8449 + aPropOpt.AddOpt( ESCHER_Prop_adjustValue, nRadius );
8453 + ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
8455 + aPropOpt.CreateFillProperties( mXPropSet, sal_True );
8456 + if ( ImplGetText() )
8457 + aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
8459 + else if ( mType == "drawing.Ellipse" )
8461 + ::com::sun::star::drawing::CircleKind eCircleKind( ::com::sun::star::drawing::CircleKind_FULL );
8462 + PolyStyle ePolyKind = POLY_CHORD;
8463 + if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CircleKind" ) ) ) )
8465 + mAny >>= eCircleKind;
8466 + switch ( eCircleKind )
8468 + case ::com::sun::star::drawing::CircleKind_SECTION :
8470 + ePolyKind = POLY_PIE;
8473 + case ::com::sun::star::drawing::CircleKind_ARC :
8475 + ePolyKind = POLY_ARC;
8479 + case ::com::sun::star::drawing::CircleKind_CUT :
8481 + ePolyKind = POLY_CHORD;
8486 + eCircleKind = ::com::sun::star::drawing::CircleKind_FULL;
8489 + if ( eCircleKind == ::com::sun::star::drawing::CircleKind_FULL )
8491 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8492 + ImplCreateShape( ESCHER_ShpInst_Ellipse, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
8493 + aPropOpt.CreateFillProperties( mXPropSet, sal_True );
8494 + if ( ImplGetText() )
8495 + aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
8499 + sal_Int32 nStartAngle, nEndAngle;
8500 + if ( !ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CircleStartAngle" ) ) ) )
8502 + nStartAngle = *( (sal_Int32*)mAny.getValue() );
8503 + if( !ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CircleEndAngle" ) ) ) )
8505 + nEndAngle = *( (sal_Int32*)mAny.getValue() );
8506 + ::com::sun::star::awt::Point aPoint( mXShape->getPosition() );
8507 + ::com::sun::star::awt::Size aSize( mXShape->getSize() );
8508 + ::com::sun::star::awt::Point aStart, aEnd, aCenter;
8509 + Rectangle aRect( Point( aPoint.X, aPoint.Y ), Size( aSize.Width, aSize.Height ) );
8510 + aStart.X = (sal_Int32)( ( cos( (double)( nStartAngle * F_PI18000 ) ) * 100.0 ) );
8511 + aStart.Y = - (sal_Int32)( ( sin( (double)( nStartAngle * F_PI18000 ) ) * 100.0 ) );
8512 + aEnd.X = (sal_Int32)( ( cos( (double)( nEndAngle * F_PI18000 ) ) * 100.0 ) );
8513 + aEnd.Y = - (sal_Int32)( ( sin( (double)( nEndAngle * F_PI18000 ) ) * 100.0 ) );
8514 + aCenter.X = aPoint.X + ( aSize.Width / 2 );
8515 + aCenter.Y = aPoint.Y + ( aSize.Height / 2 );
8516 + aStart.X += aCenter.X;
8517 + aStart.Y += aCenter.Y;
8518 + aEnd.X += aCenter.X;
8519 + aEnd.Y += aCenter.Y;
8520 + Polygon aPolygon( aRect, Point( aStart.X, aStart.Y ), Point( aEnd.X, aEnd.Y ), ePolyKind );
8521 + sal_Bool bNeedText = sal_True;
8524 + aPolygon.Rotate( aRect.TopLeft(), (sal_uInt16)( mnAngle / 10 ) );
8525 + if ( ImplGetText() )
8527 + mpPptEscherEx->EnterGroup( 0,0 );
8528 + nGroupLevel = mpPptEscherEx->GetGroupLevel();
8529 + bNeedText = sal_False;
8530 + bAdditionalText = TRUE;
8535 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8536 + ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
8537 + ::com::sun::star::awt::Rectangle aNewRect;
8538 + switch ( ePolyKind )
8543 + if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, &aPolygon ) )
8544 + aPropOpt.CreateFillProperties( mXPropSet, sal_True );
8550 + if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, &aPolygon ) )
8551 + aPropOpt.CreateLineProperties( mXPropSet, sal_False );
8555 + maRect = ImplMapRectangle( aNewRect );
8556 + maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
8557 + maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
8558 + if ( bNeedText && ImplGetText() )
8559 + aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
8562 + else if ( mType == "drawing.Control" )
8564 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XControlShape >
8565 + aXControlShape( mXShape, ::com::sun::star::uno::UNO_QUERY );
8566 + if ( !aXControlShape.is() )
8568 + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
8569 + aXControlModel( aXControlShape->getControl() );
8570 + if ( !aXControlModel.is() )
8573 + sal_Int64 nAspect = ::com::sun::star::embed::Aspects::MSOLE_CONTENT;
8576 + // try to get the aspect when available
8577 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
8578 + xShapeProps( mXShape, ::com::sun::star::uno::UNO_QUERY_THROW );
8579 + xShapeProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Aspect" ) ) ) >>= nAspect;
8581 + catch( ::com::sun::star::uno::Exception& )
8584 + *mpExEmbed << (sal_uInt32)( 0xf | ( EPP_ExControl << 16 ) )
8585 + << (sal_uInt32)0; // Size of this container
8587 + sal_uInt32 nSize, nOldPos = mpExEmbed->Tell();
8589 + sal_uInt32 nPageId = nPageNumber;
8590 + if ( ePageType == MASTER )
8591 + nPageId |= 0x80000000;
8594 + *mpExEmbed << (sal_uInt32)( EPP_ExControlAtom << 16 )
8597 + PPTExOleObjEntry* pEntry = new PPTExOleObjEntry( OCX_CONTROL, mpExEmbed->Tell() );
8598 + pEntry->xControlModel = aXControlModel;
8599 + maExOleObj.Insert( pEntry );
8603 + *mpExEmbed << (sal_uInt32)( 1 | ( EPP_ExOleObjAtom << 16 ) )
8605 + << (sal_uInt32)nAspect
8607 + << (sal_uInt32)mnExEmbed
8609 + << (sal_uInt32)4 // index to the persist table
8610 + << (sal_uInt32)0x0012de00;
8613 + ::com::sun::star::awt::Size aSize;
8614 + String aControlName;
8615 + SvStorageRef xTemp( new SvStorage( new SvMemoryStream(), TRUE ) );
8616 + if ( SvxMSConvertOCXControls::WriteOCXStream( xTemp, aXControlModel, aSize, aControlName ) )
8618 + String aUserName( xTemp->GetUserName() );
8619 + String aOleIdentifier;
8620 + if ( aUserName.Len() )
8622 + SvStorageStreamRef xCompObj = xTemp->OpenSotStream(
8623 + String( RTL_CONSTASCII_USTRINGPARAM( "\1CompObj" ) ),
8624 + STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYALL );
8625 + xCompObj->Seek( STREAM_SEEK_TO_END );
8626 + sal_uInt32 nStreamLen = xCompObj->Tell();
8627 + xCompObj->Seek( 0 );
8628 + sal_Int16 nVersion, nByteOrder;
8629 + sal_Int32 nWinVersion, nVal, nStringLen;
8630 + *xCompObj >> nVersion
8634 + xCompObj->SeekRel( 16 ); // skipping clsid
8635 + *xCompObj >> nStringLen;
8636 + if ( ( xCompObj->Tell() + nStringLen ) < nStreamLen )
8638 + xCompObj->SeekRel( nStringLen ); // now skipping the UserName;
8639 + *xCompObj >> nStringLen;
8640 + if ( ( xCompObj->Tell() + nStringLen ) < nStreamLen )
8642 + xCompObj->SeekRel( nStringLen ); // now skipping the clipboard formatname
8643 + *xCompObj >> nStringLen;
8644 + if ( ( nStringLen > 1 ) && ( ( xCompObj->Tell() + nStringLen ) < nStreamLen ) )
8645 + { // i think that the OleIdentifier will follow
8647 + sal_Char* p = aTemp.AllocBuffer( (USHORT)(nStringLen - 1) );
8648 + xCompObj->Read( p, nStringLen - 1 );
8649 + aOleIdentifier = String( aTemp, gsl_getSystemTextEncoding() );
8654 + if ( aControlName.Len() )
8655 + ImplWriteCString( *mpExEmbed, aControlName, 1 );
8656 + if ( aOleIdentifier.Len() )
8657 + ImplWriteCString( *mpExEmbed, aOleIdentifier, 2 );
8658 + if ( aUserName.Len() )
8659 + ImplWriteCString( *mpExEmbed, aUserName, 3 );
8661 + nSize = mpExEmbed->Tell() - nOldPos;
8662 + mpExEmbed->Seek( nOldPos - 4 );
8663 + *mpExEmbed << nSize;
8664 + mpExEmbed->Seek( STREAM_SEEK_TO_END );
8665 + nOlePictureId = mnExEmbed;
8667 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8668 + sal_uInt32 nSpFlags = SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_OLESHAPE;
8669 + ImplCreateShape( ESCHER_ShpInst_HostControl, nSpFlags, aSolverContainer );
8670 + if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
8671 + aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
8672 + aPropOpt.AddOpt( ESCHER_Prop_pictureId, mnExEmbed );
8673 + aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0x10000 );
8675 + if ( aControlName.Len() )
8677 + sal_uInt16 i, nBufSize;
8678 + nBufSize = ( aControlName.Len() + 1 ) << 1;
8679 + sal_uInt8* pBuf = new sal_uInt8[ nBufSize ];
8680 + sal_uInt8* pTmp = pBuf;
8681 + for ( i = 0; i < aControlName.Len(); i++ )
8683 + sal_Unicode nUnicode = aControlName.GetChar( i );
8684 + *pTmp++ = (sal_uInt8)nUnicode;
8685 + *pTmp++ = (sal_uInt8)( nUnicode >> 8 );
8689 + aPropOpt.AddOpt( ESCHER_Prop_wzName, TRUE, nBufSize, pBuf, nBufSize );
8692 + else if ( mType == "drawing.Connector" )
8694 + sal_uInt16 nSpType, nSpFlags;
8695 + ::com::sun::star::awt::Rectangle aNewRect;
8696 + if ( aPropOpt.CreateConnectorProperties( mXShape, aSolverContainer, aNewRect, nSpType, nSpFlags ) == sal_False )
8699 + maRect = ImplMapRectangle( aNewRect );
8700 + maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
8701 + maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
8703 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8704 + ImplCreateShape( nSpType, nSpFlags, aSolverContainer );
8706 + else if ( mType == "drawing.Measure" )
8710 + else if ( mType == "drawing.Line" )
8712 + ::com::sun::star::awt::Rectangle aNewRect;
8713 + aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_LINE, sal_False, aNewRect, NULL );
8714 + maRect = ImplMapRectangle( aNewRect );
8715 + maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
8716 + maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
8717 + if ( ImplGetText() )
8719 + aTextRefPoint = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
8721 + bAdditionalText = TRUE;
8722 + mpPptEscherEx->EnterGroup( &maRect,0 );
8724 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8725 + sal_uInt32 nFlags = 0xa00; // Flags: Connector | HasSpt
8726 + if ( maRect.Top() > maRect.Bottom() )
8727 + nFlags |= 0x80; // Flags: VertMirror
8728 + if ( maRect.Left() > maRect.Right() )
8729 + nFlags |= 0x40; // Flags: HorzMirror
8731 + ImplCreateShape( ESCHER_ShpInst_Line, nFlags, aSolverContainer );
8732 + aPropOpt.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
8733 + aPropOpt.CreateLineProperties( mXPropSet, sal_False );
8736 + else if ( bPolyPolygon )
8738 + if ( ImplGetText() )
8740 + mpPptEscherEx->EnterGroup( 0,0 );
8741 + nGroupLevel = mpPptEscherEx->GetGroupLevel();
8742 + bAdditionalText = TRUE;
8745 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8746 + ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
8747 + ::com::sun::star::awt::Rectangle aNewRect;
8748 + aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, NULL );
8749 + maRect = ImplMapRectangle( aNewRect );
8750 + maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
8751 + maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
8752 + aPropOpt.CreateFillProperties( mXPropSet, sal_True );
8755 + else if ( bPolyLine )
8757 + if ( ImplGetText() )
8759 + mpPptEscherEx->EnterGroup( 0,0 );
8760 + nGroupLevel = mpPptEscherEx->GetGroupLevel();
8761 + bAdditionalText = TRUE;
8764 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8765 + ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
8766 + ::com::sun::star::awt::Rectangle aNewRect;
8767 + aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, NULL );
8768 + maRect = ImplMapRectangle( aNewRect );
8769 + maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
8770 + maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
8771 + aPropOpt.CreateLineProperties( mXPropSet, sal_False );
8774 + else if ( bOpenBezier )
8776 + if ( ImplGetText() )
8778 + mpPptEscherEx->EnterGroup( 0,0 );
8779 + nGroupLevel = mpPptEscherEx->GetGroupLevel();
8780 + bAdditionalText = TRUE;
8783 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8784 + ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
8785 + ::com::sun::star::awt::Rectangle aNewRect;
8786 + aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_True, aNewRect, NULL );
8787 + maRect = ImplMapRectangle( aNewRect );
8788 + maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
8789 + maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
8790 + aPropOpt.CreateLineProperties( mXPropSet, sal_False );
8793 + else if ( bClosedBezier )
8795 + if ( ImplGetText() )
8797 + mpPptEscherEx->EnterGroup( 0,0 );
8798 + nGroupLevel = mpPptEscherEx->GetGroupLevel();
8799 + bAdditionalText = TRUE;
8802 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8803 + ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
8804 + ::com::sun::star::awt::Rectangle aNewRect;
8805 + aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_True, aNewRect, NULL );
8806 + maRect = ImplMapRectangle( aNewRect );
8807 + maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
8808 + maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
8809 + aPropOpt.CreateFillProperties( mXPropSet, sal_True );
8812 + else if ( ( mType == "drawing.GraphicObject" ) || ( mType == "presentation.GraphicObject" ) )
8814 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8816 + // ein GraphicObject kann auch ein ClickMe Element sein
8817 + if ( mbEmptyPresObj && ( ePageType == NORMAL ) )
8819 + nPlaceHolderAtom = rLayout.nUsedObjectPlaceHolder;
8820 + ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
8821 + aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
8822 + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
8823 + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
8824 + aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
8828 + mXText = ::com::sun::star::uno::Reference<
8829 + ::com::sun::star::text::XSimpleText >
8830 + ( mXShape, ::com::sun::star::uno::UNO_QUERY );
8832 + if ( mXText.is() )
8833 + mnTextSize = mXText->getString().getLength();
8835 + if ( mnTextSize ) // graphic object oder Flachenfuellung
8837 + /* SJ #i34951#: because M. documents are not allowing GraphicObjects containing text, we
8838 + have to create a simpe Rectangle with fill bitmap instead (while not allowing BitmapMode_Repeat).
8840 + ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt
8841 + if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), sal_True, sal_True, sal_False ) )
8843 + aPropOpt.AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
8844 + aPropOpt.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
8845 + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
8846 + aPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0x8000000 );
8847 + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 );
8848 + if ( ImplGetText() )
8849 + aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
8854 + ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
8855 + if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ), sal_False, sal_True ) )
8856 + aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
8860 + else if ( ( mType == "drawing.Text" ) || ( mType == "presentation.Notes" ) )
8862 + if ( ( ePageType == NOTICE ) && mbPresObj )
8864 + if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Notes, EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE ) )
8867 + nPlaceHolderAtom = EPP_PLACEHOLDER_NOTESBODY;
8869 + ImplCreateTextShape( aPropOpt, aSolverContainer, TRUE );
8871 + else if ( mType == "presentation.TitleText" )
8875 + if ( ( ePageType == NOTICE ) && mbEmptyPresObj )
8877 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8878 + nPlaceHolderAtom = EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE;
8879 + ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x200, aSolverContainer );
8880 + aPropOpt.CreateLineProperties( mXPropSet, sal_False );
8881 + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
8883 + else if ( rLayout.bTitlePossible && bIsTitlePossible )
8885 + bIsTitlePossible = FALSE;
8888 + TextObj aTextObj( mXText, EPP_TEXTTYPE_Title, maFontCollection, (PPTExBulletProvider&)*this );
8889 + if ( ePageType == MASTER )
8893 + ::rtl::OUString aUString( mXText->getString() );
8896 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8897 + mnShapeMasterTitle = mpPptEscherEx->GetShapeID();
8898 + mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, mnShapeMasterTitle );// Flags: HaveAnchor | HasSpt
8899 + EscherPropertyContainer aPropertyOptions;
8900 + aPropertyOptions.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
8901 + aPropertyOptions.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
8902 + aPropertyOptions.AddOpt( ESCHER_Prop_AnchorText, ESCHER_AnchorMiddle );
8903 +// aPropertyOptions.AddOpt( ESCHER_Prop_fillColor, nFillColor );
8904 +// aPropertyOptions.AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
8905 + aPropertyOptions.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
8906 + aPropertyOptions.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
8907 + aPropertyOptions.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
8908 + aPropertyOptions.CreateFillProperties( mXPropSet, sal_True );
8909 + sal_uInt32 nLineFlags = 0x90001;
8910 + if ( aPropertyOptions.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
8911 + nLineFlags |= 0x10001; // draw dashed line if no line
8912 + aPropertyOptions.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
8913 + aPropertyOptions.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
8914 + ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
8915 + aPropertyOptions.Commit( *mpStrm );
8916 + mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
8917 + *mpStrm << (sal_Int16)maRect.Top() << (sal_Int16)maRect.Left() << (sal_Int16)maRect.Right() << (sal_Int16)maRect.Bottom(); // oben, links, rechts, unten ????
8918 + mpPptEscherEx->OpenContainer( ESCHER_ClientData );
8919 + mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
8920 + *mpStrm << (sal_uInt32)0 // PlacementID
8921 + << (sal_uInt8)EPP_PLACEHOLDER_MASTERTITLE // PlaceHolderID
8922 + << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
8923 + << (sal_uInt16)0; // padword
8924 + mpPptEscherEx->CloseContainer(); // ESCHER_ClientData
8925 + mpPptEscherEx->OpenContainer( ESCHER_ClientTextbox );
8926 + mpPptEscherEx->AddAtom( 4, EPP_TextHeaderAtom );
8927 + *mpStrm << (sal_uInt32)EPP_TEXTTYPE_Title;
8928 + mpPptEscherEx->AddAtom( mnTextSize << 1, EPP_TextCharsAtom );
8929 + const sal_Unicode* pString = aUString;
8930 + for ( sal_uInt32 i = 0; i < mnTextSize; i++ )
8932 + nChar = pString[ i ]; // 0xa -> 0xb weicher Zeilenumbruch
8933 + if ( nChar == 0xa )
8934 + nChar++; // 0xd -> 0xd harter Zeilenumbruch
8937 + mpPptEscherEx->AddAtom( 6, EPP_BaseTextPropAtom );
8938 + *mpStrm << (sal_uInt32)( mnTextSize + 1 ) << (sal_uInt16)0;
8939 + mpPptEscherEx->AddAtom( 10, EPP_TextSpecInfoAtom );
8940 + *mpStrm << (sal_uInt32)( mnTextSize + 1 ) << (sal_uInt32)1 << (sal_uInt16)0;
8941 + mpPptEscherEx->CloseContainer(); // ESCHER_ClientTextBox
8942 + mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
8948 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8949 + mnTextStyle = EPP_TEXTSTYLE_TITLE;
8950 + nPlaceHolderAtom = rLayout.nTypeOfTitle;
8951 + ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
8952 + aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterTitle );
8953 + aPropOpt.CreateFillProperties( mXPropSet, sal_True );
8954 + aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
8955 + ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
8956 + if ( mbEmptyPresObj )
8958 + sal_uInt32 nNoLineDrawDash = 0;
8959 + aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
8960 + nNoLineDrawDash |= 0x10001;
8961 + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
8966 + mbPresObj = FALSE;
8970 + mType = "drawing.Text";
8971 + ImplCreateTextShape( aPropOpt, aSolverContainer, TRUE );
8974 + else if ( ( mType == "presentation.Outliner" ) || ( mType == "presentation.Subtitle" ) )
8979 + if ( rLayout.bOutlinerPossible && ( nOutlinerCount == 1 ) ||
8980 + ( ( rLayout.bSecOutlinerPossible && ( nOutlinerCount == 2 ) )
8981 + && ( nPrevTextStyle == EPP_TEXTSTYLE_BODY ) ) )
8984 + TextObj aTextObj( mXText, EPP_TEXTTYPE_Body, maFontCollection, (PPTExBulletProvider&)*this );
8985 + if ( ePageType == MASTER )
8987 + nPrevTextStyle = EPP_TEXTSTYLE_TITLE;
8990 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
8991 + mnShapeMasterBody = mpPptEscherEx->GetShapeID();
8992 + mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xa00, mnShapeMasterBody ); // Flags: HaveAnchor | HasSpt
8993 + EscherPropertyContainer aPropOpt2;
8994 + aPropOpt2.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x50001 );
8995 + aPropOpt2.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
8996 +// aPropOpt2.AddOpt( ESCHER_Prop_fillColor, nFillColor );
8997 +// aPropOpt2.AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
8998 + aPropOpt2.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
8999 + aPropOpt2.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
9000 + aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90001 );
9001 + aPropOpt2.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
9002 + aPropOpt2.CreateFillProperties( mXPropSet, sal_True );
9003 + sal_uInt32 nLineFlags = 0x90001;
9004 + if ( aPropOpt2.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
9005 + nLineFlags |= 0x10001; // draw dashed line if no line
9006 + aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags );
9007 + aPropOpt2.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
9008 + ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt2 );
9009 + aPropOpt2.Commit( *mpStrm );
9010 + mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
9011 + *mpStrm << (sal_Int16)maRect.Top() << (sal_Int16)maRect.Left() << (sal_Int16)maRect.Right() << (sal_Int16)maRect.Bottom(); // oben, links, rechts, unten ????
9012 + mpPptEscherEx->OpenContainer( ESCHER_ClientData );
9013 + mpPptEscherEx->AddAtom( 8, EPP_OEPlaceholderAtom );
9014 + *mpStrm << (sal_uInt32)1 // PlacementID
9015 + << (sal_uInt8)EPP_PLACEHOLDER_MASTERBODY // PlaceHolderID
9016 + << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
9017 + << (sal_uInt16)0; // padword
9018 + mpPptEscherEx->CloseContainer(); // ESCHER_ClientData
9019 + mpPptEscherEx->OpenContainer( ESCHER_ClientTextbox ); // printf
9020 + mpPptEscherEx->AddAtom( 4, EPP_TextHeaderAtom );
9021 + *mpStrm << (sal_uInt32)EPP_TEXTTYPE_Body;
9022 + mnTextSize = aTextObj.Count();
9023 + aTextObj.Write( mpStrm );
9024 + mpPptEscherEx->BeginAtom();
9025 + for ( ParagraphObj* pPara = aTextObj.First() ; pPara; pPara = aTextObj.Next() )
9027 + sal_uInt32 nCharCount = pPara->Count();
9028 + sal_uInt16 nDepth = pPara->nDepth;
9032 + *mpStrm << nCharCount
9035 + mpPptEscherEx->EndAtom( EPP_BaseTextPropAtom );
9036 + mpPptEscherEx->AddAtom( 10, EPP_TextSpecInfoAtom );
9037 + *mpStrm << (sal_uInt32)( mnTextSize ) << (sal_uInt32)1 << (sal_uInt16)0;
9039 + mpPptEscherEx->CloseContainer(); // ESCHER_ClientTextBox
9040 + mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
9046 + mnTextStyle = EPP_TEXTSTYLE_BODY;
9047 + nPlaceHolderAtom = rLayout.nTypeOfOutliner;
9048 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
9049 + ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
9050 + aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
9051 + aPropOpt.CreateFillProperties( mXPropSet, sal_True );
9052 + aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
9053 + ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
9054 + if ( mbEmptyPresObj )
9056 + sal_uInt32 nNoLineDrawDash = 0;
9057 + aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
9058 + nNoLineDrawDash |= 0x10001;
9059 + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, nNoLineDrawDash );
9064 + mbPresObj = FALSE;
9068 + mType = "drawing.Text";
9069 + ImplCreateTextShape( aPropOpt, aSolverContainer, TRUE );
9072 + else if ( ( mType == "drawing.Page" ) || ( mType == "presentation.Page" ) )
9074 + if ( ( ePageType == NOTICE ) && mbPresObj )
9076 + if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Notes, EPP_PLACEHOLDER_MASTERNOTESSLIDEIMAGE ) )
9079 + nPlaceHolderAtom = EPP_PLACEHOLDER_NOTESSLIDEIMAGE;
9081 + ImplCreateTextShape( aPropOpt, aSolverContainer, TRUE );
9083 + else if ( mType == "drawing.Frame" )
9087 + else if ( ( mType == "drawing.OLE2" ) || ( mType == "presentation.OLE2" )
9088 + || ( mType == "presentation.Chart" ) || ( mType == "presentation.Table" )
9089 + || ( mType == "presentation.OrgChart" ) )
9091 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
9092 + if ( mbEmptyPresObj && ( ePageType == NORMAL ) )
9094 + nPlaceHolderAtom = rLayout.nUsedObjectPlaceHolder;
9095 + ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer ); // Flags: HaveAnchor | HaveMaster
9096 + aPropOpt.AddOpt( ESCHER_Prop_lTxid, mnTxId += 0x60 );
9097 + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x10001 );
9098 + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x10001 );
9099 + aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
9103 + *mpExEmbed << (sal_uInt32)( 0xf | ( EPP_ExEmbed << 16 ) )
9104 + << (sal_uInt32)0; // Size of this container
9106 + sal_uInt32 nSize, nOldPos = mpExEmbed->Tell();
9108 + *mpExEmbed << (sal_uInt32)( EPP_ExEmbedAtom << 16 )
9110 + << (sal_uInt32)0 // follow colorscheme : 0->do not follow
9111 + // 1->follow collorscheme
9112 + // 2->follow text and background scheme
9113 + << (sal_uInt8)1 // (bool)set if embedded server can not be locked
9114 + << (sal_uInt8)0 // (bool)do not need to send dimension
9115 + << (sal_uInt8)0 // (bool)is object a world table
9116 + << (sal_uInt8)0; // pad byte
9118 + PPTExOleObjEntry* pE = new PPTExOleObjEntry( NORMAL_OLE_OBJECT, mpExEmbed->Tell() );
9119 + pE->xShape = mXShape;
9120 + maExOleObj.Insert( pE );
9124 + sal_Int64 nAspect = ::com::sun::star::embed::Aspects::MSOLE_CONTENT;
9127 + // try to get the aspect when available
9128 + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
9129 + xShapeProps( mXShape, ::com::sun::star::uno::UNO_QUERY_THROW );
9130 + xShapeProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Aspect" ) ) ) >>= nAspect;
9132 + catch( ::com::sun::star::uno::Exception& )
9135 + *mpExEmbed << (sal_uInt32)( 1 | ( EPP_ExOleObjAtom << 16 ) )
9137 + << (sal_uInt32)nAspect // Aspect
9139 + << (sal_uInt32)mnExEmbed // index to the persist table
9140 + << (sal_uInt32)0 // subtype
9142 + << (sal_uInt32)0x0012b600;
9144 +// ImplWriteCString( *mpExEmbed, "Photo Editor Photo", 1 );
9145 +// ImplWriteCString( *mpExEmbed, "MSPhotoEd.3", 2 );
9146 +// ImplWriteCString( *mpExEmbed, "Microsoft Photo Editor 3.0 Photo", 3 );
9148 + nSize = mpExEmbed->Tell() - nOldPos;
9149 + mpExEmbed->Seek( nOldPos - 4 );
9150 + *mpExEmbed << nSize;
9151 + mpExEmbed->Seek( STREAM_SEEK_TO_END );
9152 + nOlePictureId = mnExEmbed;
9154 + sal_uInt32 nSpFlags = 0xa00;
9155 + if ( nOlePictureId )
9157 + ImplCreateShape( ESCHER_ShpInst_PictureFrame, nSpFlags, aSolverContainer );
9158 + if ( aPropOpt.CreateOLEGraphicProperties( mXShape ) )
9159 + aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
9160 + if ( nOlePictureId )
9161 + aPropOpt.AddOpt( ESCHER_Prop_pictureId, nOlePictureId );
9164 + else if ( mType == "presentation.Header" )
9166 + if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERHEADER ) )
9170 + mbPresObj = sal_False;
9171 + mType = "drawing.Text";
9172 + ImplCreateTextShape( aPropOpt, aSolverContainer, TRUE );
9175 + else if ( mType == "presentation.Footer" )
9177 + if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERFOOTER ) )
9181 + mbPresObj = sal_False;
9182 + mType = "drawing.Text";
9183 + ImplCreateTextShape( aPropOpt, aSolverContainer, TRUE );
9186 + else if ( mType == "presentation.DateTime" )
9188 + if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERDATE ) )
9192 + mbPresObj = sal_False;
9193 + mType = "drawing.Text";
9194 + ImplCreateTextShape( aPropOpt, aSolverContainer, TRUE );
9197 + else if ( mType == "presentation.SlideNumber" )
9199 + if ( ImplCreatePresentationPlaceholder( bMasterPage, ePageType, EPP_TEXTTYPE_Other, EPP_PLACEHOLDER_MASTERSLIDENUMBER ) )
9203 + mbPresObj = sal_False;
9204 + mType = "drawing.Text";
9205 + ImplCreateTextShape( aPropOpt, aSolverContainer, TRUE );
9208 + else if ( ( (sal_Char)'3' == mType.GetChar( 8 ) ) && ( (char)'D' == mType.GetChar( 9 ) ) ) // drawing.3D
9210 + // SceneObject, CubeObject, SphereObject, LatheObject, ExtrudeObject, PolygonObject
9211 + if ( !ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "Bitmap" ) ) ) )
9214 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
9215 + ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
9217 + if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Bitmap" ) ), sal_False ) )
9218 + aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
9220 + else if ( mType == "drawing.Media" )
9223 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
9224 + ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
9226 + ::com::sun::star::uno::Any aAny;
9227 + if ( PropValue::GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ), sal_True ) )
9229 + rtl::OUString aMediaURL;
9230 + if ( (aAny >>= aMediaURL ) && aMediaURL.getLength() )
9232 + // SJ: creating the Media RefObj
9233 + sal_uInt32 nRefId = ++mnExEmbed;
9235 + *mpExEmbed << (sal_uInt16)0xf
9236 + << (sal_uInt16)EPP_ExMCIMovie // PPT_PST_ExAviMovie
9238 + sal_uInt32 nSize, nStart = mpExEmbed->Tell();
9239 + *mpExEmbed << (sal_uInt16)0
9240 + << (sal_uInt16)EPP_ExObjRefAtom
9243 + *mpExEmbed << (sal_uInt16)0xf
9244 + << (sal_uInt16)EPP_ExVideo
9247 + *mpExEmbed << (sal_uInt16)0
9248 + << (sal_uInt16)EPP_ExMediaAtom
9252 + << (sal_uInt16)0x435;
9255 + sal_uInt16 i, nStringLen = (sal_uInt16)aMediaURL.getLength();
9256 + *mpExEmbed << (sal_uInt32)( EPP_CString << 16 ) << (sal_uInt32)( nStringLen * 2 );
9257 + for ( i = 0; i < nStringLen; i++ )
9259 + sal_Unicode nChar = aMediaURL[ i ];
9260 + *mpExEmbed << nChar;
9262 + nSize = mpExEmbed->Tell() - nStart;
9263 + mpExEmbed->SeekRel( - ( (sal_Int32)nSize + 4 ) );
9264 + *mpExEmbed << nSize; // size of PPT_PST_ExMCIMovie
9265 + mpExEmbed->SeekRel( 0x10 );
9267 + *mpExEmbed << nSize; // PPT_PST_ExMediaAtom
9268 + mpExEmbed->SeekRel( nSize );
9270 + if ( !pClientData )
9271 + pClientData = new SvMemoryStream( 0x200, 0x200 );
9272 + *pClientData << (sal_uInt16)0
9273 + << (sal_uInt16)EPP_ExObjRefAtom
9279 + else if ( mType == "drawing.Table" )
9281 + SvMemoryStream* pTmp = NULL;
9282 + if ( bEffect && !mbUseNewAnimations )
9284 + pTmp = new SvMemoryStream( 0x200, 0x200 );
9285 + ImplWriteObjectEffect( *pTmp, eAe, eTe, ++nEffectCount );
9287 + if ( eCa != ::com::sun::star::presentation::ClickAction_NONE )
9290 + pTmp = new SvMemoryStream( 0x200, 0x200 );
9291 + ImplWriteClickAction( *pTmp, eCa, bMediaClickAction );
9293 + ImplCreateTable( mXShape, aSolverContainer, aPropOpt );
9296 + else if ( mType == "drawing.dontknow" )
9299 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
9300 + ImplCreateShape( ESCHER_ShpInst_PictureFrame, 0xa00, aSolverContainer );
9301 + if ( aPropOpt.CreateGraphicProperties( mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
9302 + aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x800080 );
9308 + sal_Int32 nPlacementID = -1;
9310 + sal_Bool bClientData = ( bEffect || ( eCa != ::com::sun::star::presentation::ClickAction_NONE ) ||
9311 + nPlaceHolderAtom || nOlePictureId );
9312 + if ( bClientData )
9314 + if ( nPlaceHolderAtom )
9316 + if ( ( mnTextStyle == EPP_TEXTSTYLE_TITLE ) || ( mnTextStyle == EPP_TEXTSTYLE_BODY ) )
9317 + nPlacementID = nIndices++;
9320 + switch ( nPlaceHolderAtom )
9324 + if ( nPlaceHolderAtom < 19 )
9327 + case EPP_PLACEHOLDER_NOTESBODY :
9328 + case EPP_PLACEHOLDER_MASTERDATE :
9329 + case EPP_PLACEHOLDER_NOTESSLIDEIMAGE :
9330 + case EPP_PLACEHOLDER_MASTERNOTESBODYIMAGE :
9331 + nPlacementID = nIndices++;
9334 + if ( !pClientData )
9335 + pClientData = new SvMemoryStream( 0x200, 0x200 );
9337 + *pClientData << (sal_uInt32)( EPP_OEPlaceholderAtom << 16 ) << (sal_uInt32)8
9338 + << nPlacementID // PlacementID
9339 + << (sal_uInt8)nPlaceHolderAtom // PlaceHolderID
9340 + << (sal_uInt8)0 // Size of PlaceHolder ( 0 = FULL, 1 = HALF, 2 = QUARTER )
9341 + << (sal_uInt16)0; // padword
9343 + if ( nOlePictureId )
9345 + if ( !pClientData )
9346 + pClientData = new SvMemoryStream( 0x200, 0x200 );
9348 + *pClientData << (sal_uInt32)( EPP_ExObjRefAtom << 16 ) << (sal_uInt32)4
9350 + nOlePictureId = 0;
9354 + if ( !pClientData )
9355 + pClientData = new SvMemoryStream( 0x200, 0x200 );
9357 + // check if it is sensible to replace the object effect with text effect,
9358 + // because in Impress there is the possibility to use a compound effect,
9359 + // e.g. the object effect is an AnimationEffect_FADE_FROM_LEFT and the
9360 + // text effect is a AnimationEffect_FADE_FROM_TOP, in PowerPoint there
9361 + // can be used only one effect
9362 + if ( mnTextSize && ( eTe != ::com::sun::star::presentation::AnimationEffect_NONE )
9363 + && ( eAe != ::com::sun::star::presentation::AnimationEffect_NONE )
9364 + && ( eTe != eAe ) )
9366 + sal_uInt32 nFillStyleFlags, nLineStyleFlags;
9367 + if ( aPropOpt.GetOpt( ESCHER_Prop_fNoFillHitTest, nFillStyleFlags )
9368 + && aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineStyleFlags ) )
9370 + // there is no fillstyle and also no linestyle
9371 + if ( ! ( ( nFillStyleFlags & 0x10 ) + ( nLineStyleFlags & 9 ) ) )
9375 + if ( !mbUseNewAnimations )
9376 + ImplWriteObjectEffect( *pClientData, eAe, eTe, ++nEffectCount );
9379 + if ( eCa != ::com::sun::star::presentation::ClickAction_NONE )
9381 + if ( !pClientData )
9382 + pClientData = new SvMemoryStream( 0x200, 0x200 );
9383 + ImplWriteClickAction( *pClientData, eCa, bMediaClickAction );
9386 + if ( ( mnTextStyle == EPP_TEXTSTYLE_TITLE ) || ( mnTextStyle == EPP_TEXTSTYLE_BODY ) )
9388 + if ( !pClientTextBox )
9389 + pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
9391 + *pClientTextBox << (sal_uInt32)( EPP_OutlineTextRefAtom << 16 ) << (sal_uInt32)4
9394 + if ( mbEmptyPresObj == FALSE )
9396 + if ( ( ePageType == NORMAL ) && ( bMasterPage == FALSE ) )
9397 + { // try to allocate the textruleratom
9398 + TextRuleEntry* pTextRule = (TextRuleEntry*)maTextRuleList.GetCurObject();
9399 + while ( pTextRule )
9401 + int nRulePage = pTextRule->nPageNumber;
9402 + if ( nRulePage > nPageNumber )
9404 + else if ( nRulePage < nPageNumber )
9405 + pTextRule = (TextRuleEntry*)maTextRuleList.Next();
9408 + SvMemoryStream* pOut = pTextRule->pOut;
9411 + pClientTextBox->Write( pOut->GetData(), pOut->Tell() );
9412 + delete pOut, pTextRule->pOut = NULL;
9414 + maTextRuleList.Next();
9423 + if ( !aPropOpt.IsFontWork() )
9425 + if ( mnTextSize || ( nPlaceHolderAtom == EPP_PLACEHOLDER_MASTERDATE ) || ( nPlaceHolderAtom == EPP_PLACEHOLDER_NOTESBODY ) )
9428 + if ( ( nPlaceHolderAtom == EPP_PLACEHOLDER_MASTERDATE ) || ( nPlaceHolderAtom == EPP_PLACEHOLDER_NOTESBODY ) )
9431 + nInstance2 = EPP_TEXTTYPE_Other; // Text in a Shape
9433 + if ( !pClientTextBox )
9434 + pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
9436 + SvMemoryStream aExtBu( 0x200, 0x200 );
9437 + ImplWriteTextStyleAtom( *pClientTextBox, nInstance2, 0, NULL, aExtBu, &aPropOpt );
9438 + if ( aExtBu.Tell() )
9440 + if ( !pClientData )
9441 + pClientData = new SvMemoryStream( 0x200, 0x200 );
9442 + ImplProgTagContainer( pClientData, &aExtBu );
9445 + else if ( nPlaceHolderAtom >= 19 )
9447 + if ( !pClientTextBox )
9448 + pClientTextBox = new SvMemoryStream( 12 );
9450 + *pClientTextBox << (sal_uInt32)( EPP_TextHeaderAtom << 16 ) << (sal_uInt32)4
9456 + aPropOpt.CreateShadowProperties( mXPropSet );
9459 + ImplFlipBoundingBox( aPropOpt );
9460 + aPropOpt.Commit( *mpStrm );
9461 + mpPptEscherEx->AddClientAnchor( maRect );
9463 + if ( pClientData )
9465 + *mpStrm << (sal_uInt32)( ( ESCHER_ClientData << 16 ) | 0xf )
9466 + << (sal_uInt32)pClientData->Tell();
9468 + mpStrm->Write( pClientData->GetData(), pClientData->Tell() );
9469 + delete pClientData, pClientData = NULL;
9471 + if ( pClientTextBox )
9473 + *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
9474 + << (sal_uInt32)pClientTextBox->Tell();
9476 + mpStrm->Write( pClientTextBox->GetData(), pClientTextBox->Tell() );
9477 + delete pClientTextBox, pClientTextBox = NULL;
9479 + mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
9481 + nPrevTextStyle = mnTextStyle;
9483 + if ( bAdditionalText )
9485 + bAdditionalText = FALSE;
9487 + ::com::sun::star::uno::Any aAny;
9488 + EscherPropertyContainer aPropOpt;
9489 + mnAngle = ( PropValue::GetPropertyValue( aAny,
9490 + mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), sal_True ) )
9491 + ? *((sal_Int32*)aAny.getValue() )
9494 + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
9495 + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100000 );
9496 + if ( mType == "drawing.Line" )
9498 + double fDist = hypot( maRect.GetWidth(), maRect.GetHeight() );
9499 + maRect = Rectangle( Point( aTextRefPoint.X, aTextRefPoint.Y ),
9500 + Point( (sal_Int32)( aTextRefPoint.X + fDist ), aTextRefPoint.Y - 1 ) );
9501 + ImplCreateTextShape( aPropOpt, aSolverContainer, FALSE );
9502 + aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x60006 ); // Size Shape To Fit Text
9503 + if ( mnAngle < 0 )
9504 + mnAngle = ( 36000 + mnAngle ) % 36000;
9506 + ImplFlipBoundingBox( aPropOpt );
9510 + ImplCreateTextShape( aPropOpt, aSolverContainer, FALSE );
9511 + if ( mnAngle < 0 )
9512 + mnAngle = ( 36000 + mnAngle ) % 36000;
9514 + mnAngle = ( 36000 - ( mnAngle % 36000 ) );
9517 + mnAngle += 0x8000;
9518 + mnAngle &=~0xffff; // nAngle auf volle Gradzahl runden
9519 + aPropOpt.AddOpt( ESCHER_Prop_Rotation, mnAngle );
9520 + mpPptEscherEx->SetGroupSnapRect( nGroupLevel, maRect );
9521 + mpPptEscherEx->SetGroupLogicRect( nGroupLevel, maRect );
9523 + if ( !pClientTextBox )
9524 + pClientTextBox = new SvMemoryStream( 0x200, 0x200 );
9526 + SvMemoryStream aExtBu( 0x200, 0x200 );
9527 + ImplWriteTextStyleAtom( *pClientTextBox, EPP_TEXTTYPE_Other, 0, NULL, aExtBu, &aPropOpt );
9529 + aPropOpt.Commit( *mpStrm );
9530 + mpPptEscherEx->AddClientAnchor( maRect );
9532 + *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
9533 + << (sal_uInt32)pClientTextBox->Tell();
9535 + mpStrm->Write( pClientTextBox->GetData(), pClientTextBox->Tell() );
9536 + delete pClientTextBox, pClientTextBox = NULL;
9538 + mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer
9539 + mpPptEscherEx->LeaveGroup();
9542 + ClearGroupTable(); // gruppierungen wegschreiben, sofern noch irgendwelche offen sind, was eigendlich nicht sein sollte
9543 + nGroups = GetGroupsClosed();
9544 + for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ;
9548 +// -----------------------------------------------------------------------
9550 +::com::sun::star::awt::Point PPTWriter::ImplMapPoint( const ::com::sun::star::awt::Point& rPoint )
9552 + Point aRet( OutputDevice::LogicToLogic( Point( rPoint.X, rPoint.Y ), maMapModeSrc, maMapModeDest ) );
9553 + return ::com::sun::star::awt::Point( aRet.X(), aRet.Y() );
9556 +// -----------------------------------------------------------------------
9558 +::com::sun::star::awt::Size PPTWriter::ImplMapSize( const ::com::sun::star::awt::Size& rSize )
9560 + Size aRetSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) );
9562 + if ( !aRetSize.Width() )
9563 + aRetSize.Width()++;
9564 + if ( !aRetSize.Height() )
9565 + aRetSize.Height()++;
9566 + return ::com::sun::star::awt::Size( aRetSize.Width(), aRetSize.Height() );
9569 +// -----------------------------------------------------------------------
9571 +Rectangle PPTWriter::ImplMapRectangle( const ::com::sun::star::awt::Rectangle& rRect )
9573 + ::com::sun::star::awt::Point aPoint( rRect.X, rRect.Y );
9574 + ::com::sun::star::awt::Size aSize( rRect.Width, rRect.Height );
9575 + ::com::sun::star::awt::Point aP( ImplMapPoint( aPoint ) );
9576 + ::com::sun::star::awt::Size aS( ImplMapSize( aSize ) );
9577 + return Rectangle( Point( aP.X, aP.Y ), Size( aS.Width, aS.Height ) );
9580 +// -----------------------------------------------------------------------
9584 + sal_Int32 mnPos; // specifies the distance to the top/left position of the table
9585 + sal_Int32 mnLength;
9586 + table::BorderLine maCellBorder;
9588 + CellBorder() : mnPos ( 0 ), mnLength( 0 ){};
9591 +void PPTWriter::ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 )
9593 + sal_Int32 nLineWidth = pCellBorder->maCellBorder.OuterLineWidth + pCellBorder->maCellBorder.InnerLineWidth;
9597 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
9598 + EscherPropertyContainer aPropOptSp;
9600 + sal_uInt32 nId = mpPptEscherEx->GetShapeID();
9601 + mpPptEscherEx->AddShape( ESCHER_ShpInst_Line, 0xa02, nId );
9602 + aPropOptSp.AddOpt( ESCHER_Prop_shapePath, ESCHER_ShapeComplex );
9603 + aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0xa0008 );
9604 + aPropOptSp.AddOpt( ESCHER_Prop_fshadowObscured, 0x20000 );
9606 + sal_uInt32 nBorderColor = pCellBorder->maCellBorder.Color & 0xff00; // green
9607 + nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color ) << 16; // red
9608 + nBorderColor |= static_cast< sal_uInt8 >( pCellBorder->maCellBorder.Color >> 16 ); // blue
9609 + aPropOptSp.AddOpt( ESCHER_Prop_lineColor, nBorderColor );
9611 + aPropOptSp.AddOpt( ESCHER_Prop_lineWidth, nLineWidth * 360 );
9612 + aPropOptSp.AddOpt( ESCHER_Prop_fc3DLightFace, 0x80000 );
9613 + aPropOptSp.Commit( *mpStrm );
9614 + mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
9619 + mpPptEscherEx->CloseContainer();
9623 +void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer,
9624 + EscherPropertyContainer& aPropOpt )
9626 + mpPptEscherEx->OpenContainer( ESCHER_SpgrContainer );
9627 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
9628 + mpPptEscherEx->AddAtom( 16, ESCHER_Spgr, 1 );
9629 + *mpStrm << (INT32)maRect.Left() // Bounding box fuer die Gruppierten shapes an die sie attached werden
9630 + << (INT32)maRect.Top()
9631 + << (INT32)maRect.Right()
9632 + << (INT32)maRect.Bottom();
9634 + sal_uInt32 nShapeId = mpPptEscherEx->GetShapeID();
9635 + mpPptEscherEx->AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId ); // Flags: Group | Patriarch
9636 + aSolverContainer.AddShape( rXShape, nShapeId );
9637 + EscherPropertyContainer aPropOpt2;
9640 + static const rtl::OUString sModel( RTL_CONSTASCII_USTRINGPARAM ( "Model" ) );
9641 + static const rtl::OUString sWidth( RTL_CONSTASCII_USTRINGPARAM ( "Width" ) );
9642 + static const rtl::OUString sHeight( RTL_CONSTASCII_USTRINGPARAM ( "Height" ) );
9644 + uno::Reference< table::XTable > xTable;
9645 + if ( mXPropSet->getPropertyValue( sModel ) >>= xTable )
9647 + uno::Reference< table::XColumnRowRange > xColumnRowRange( xTable, uno::UNO_QUERY_THROW );
9648 + uno::Reference< container::XIndexAccess > xColumns( xColumnRowRange->getColumns(), uno::UNO_QUERY_THROW );
9649 + uno::Reference< container::XIndexAccess > xRows( xColumnRowRange->getRows(), uno::UNO_QUERY_THROW );
9650 + sal_uInt16 nRowCount = static_cast< sal_uInt16 >( xRows->getCount() );
9651 + sal_uInt16 nColumnCount = static_cast< sal_uInt16 >( xColumns->getCount() );
9653 + std::vector< std::pair< sal_Int32, sal_Int32 > > aColumns;
9654 + std::vector< std::pair< sal_Int32, sal_Int32 > > aRows;
9656 + awt::Point aPosition( ImplMapPoint( rXShape->getPosition() ) );
9657 + sal_uInt32 nPosition = aPosition.X;
9658 + for ( sal_Int32 x = 0; x < nColumnCount; x++ )
9660 + uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( x ), uno::UNO_QUERY_THROW );
9661 + awt::Size aS( 0, 0 );
9662 + xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
9663 + awt::Size aM( ImplMapSize( aS ) );
9664 + aColumns.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Width ) );
9665 + nPosition += aM.Width;
9668 + nPosition = aPosition.Y;
9669 + for ( sal_Int32 y = 0; y < nRowCount; y++ )
9671 + uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( y ), uno::UNO_QUERY_THROW );
9672 + awt::Size aS( 0, 0 );
9673 + xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
9674 + awt::Size aM( ImplMapSize( aS ) );
9675 + aRows.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Height ) );
9676 + nPosition += aM.Height;
9681 + SvMemoryStream aMemStrm;
9682 + aMemStrm.ObjectOwnsMemory( FALSE );
9683 + aMemStrm << nRowCount
9687 + std::vector< std::pair< sal_Int32, sal_Int32 > >::const_iterator aIter( aRows.begin() );
9688 + while( aIter != aRows.end() )
9689 + aMemStrm << (*aIter++).second;
9691 + aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 0x1000100 );
9692 + aPropOpt2.AddOpt( ESCHER_Prop_tableProperties, 1 );
9693 + aPropOpt2.AddOpt( ESCHER_Prop_tableRowProperties, sal_True, aMemStrm.Tell(), static_cast< sal_uInt8* >( const_cast< void* >( aMemStrm.GetData() ) ), aMemStrm.Tell() );
9694 + aPropOpt.Commit( *mpStrm );
9695 + aPropOpt2.Commit( *mpStrm, 3, ESCHER_UDefProp );
9696 + mpPptEscherEx->AddAtom( 8, ESCHER_ClientAnchor );
9697 + *mpStrm << (sal_Int16)maRect.Top()
9698 + << (sal_Int16)maRect.Left()
9699 + << (sal_Int16)( maRect.GetWidth() + maRect.Left() )
9700 + << (sal_Int16)( maRect.GetHeight() + maRect.Top() );
9701 + mpPptEscherEx->CloseContainer();
9704 + uno::Reference< table::XCellRange > xCellRange( xTable, uno::UNO_QUERY_THROW );
9705 + for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
9707 + for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
9709 + uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nRow ), uno::UNO_QUERY_THROW );
9710 + if ( !xCell->isMerged() )
9712 + sal_Int32 nLeft = aColumns[ nColumn ].first;
9713 + sal_Int32 nTop = aRows[ nRow ].first;
9714 + sal_Int32 nRight = nLeft + aColumns[ nColumn ].second;
9715 + sal_Int32 nBottom = nTop + aRows[ nRow ].second;
9717 + for ( sal_Int32 nColumnSpan = 1; nColumnSpan < xCell->getColumnSpan(); nColumnSpan++ )
9719 + sal_uInt32 nC = nColumnSpan + nColumn;
9720 + if ( nC < aColumns.size() )
9721 + nRight += aColumns[ nC ].second;
9723 + nRight = maRect.Right();
9725 + for ( sal_Int32 nRowSpan = 1; nRowSpan < xCell->getRowSpan(); nRowSpan++ )
9727 + sal_uInt32 nR = nRowSpan + nRow;
9728 + if ( nR < aColumns.size() )
9729 + nBottom += aRows[ nR ].second;
9731 + nBottom = maRect.Bottom();
9734 + mbFontIndependentLineSpacing = sal_False;
9735 + mXPropSet = uno::Reference< beans::XPropertySet >( xCell, uno::UNO_QUERY_THROW );
9736 + mXText = uno::Reference< text::XSimpleText >( xCell, uno::UNO_QUERY_THROW );
9737 + mnTextSize = mXText->getString().getLength();
9739 + ::com::sun::star::uno::Any aAny;
9740 + if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FontIndependentLineSpacing" ) ) ), sal_True )
9741 + aAny >>= mbFontIndependentLineSpacing;
9743 + EscherPropertyContainer aPropOptSp;
9744 + mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
9745 + ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa02, aSolverContainer ); // Flags: Connector | HasSpt | Child
9746 + aPropOptSp.CreateFillProperties( mXPropSet, sal_True );
9747 + aPropOptSp.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90000 );
9748 + aPropOptSp.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
9749 + aPropOptSp.AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapSquare );
9751 + SvMemoryStream aClientTextBox( 0x200, 0x200 );
9752 + SvMemoryStream aExtBu( 0x200, 0x200 );
9754 + ImplWriteTextStyleAtom( aClientTextBox, EPP_TEXTTYPE_Other, 0, NULL, aExtBu, &aPropOptSp );
9756 + aPropOptSp.Commit( *mpStrm );
9757 + mpPptEscherEx->AddAtom( 16, ESCHER_ChildAnchor );
9763 + *mpStrm << (sal_uInt32)( ( ESCHER_ClientTextbox << 16 ) | 0xf )
9764 + << (sal_uInt32)aClientTextBox.Tell();
9766 + mpStrm->Write( aClientTextBox.GetData(), aClientTextBox.Tell() );
9767 + mpPptEscherEx->CloseContainer();
9772 + static const rtl::OUString sTopBorder( String( RTL_CONSTASCII_USTRINGPARAM( "TopBorder" ) ) );
9773 + static const rtl::OUString sBottomBorder( String( RTL_CONSTASCII_USTRINGPARAM( "BottomBorder" ) ) );
9774 + static const rtl::OUString sLeftBorder( String( RTL_CONSTASCII_USTRINGPARAM( "LeftBorder" ) ) );
9775 + static const rtl::OUString sRightBorder( String( RTL_CONSTASCII_USTRINGPARAM( "RightBorder" ) ) );
9776 + static const rtl::OUString sDiagonalTLBR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalTLBR" ) );
9777 + static const rtl::OUString sDiagonalBLTR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalBLTR" ) );
9779 + // creating horz lines
9780 + sal_Int32 nYPos = ImplMapPoint( rXShape->getPosition() ).Y;
9781 + for( sal_Int32 nLine = 0; nLine < ( xRows->getCount() + 1 ); nLine++ )
9783 + sal_Int32 nXPos = ImplMapPoint( rXShape->getPosition() ).X;
9784 + std::vector< CellBorder > vCellBorders;
9785 + for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ )
9787 + uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nColumn ), uno::UNO_QUERY_THROW );
9788 + awt::Size aS( 0, 0 );
9789 + xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
9790 + awt::Size aM( ImplMapSize( aS ) );
9792 + CellBorder aCellBorder;
9793 + aCellBorder.mnPos = nXPos;
9794 + aCellBorder.mnLength = aM.Width;
9795 + if ( nLine < xRows->getCount() )
9797 + uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine ), uno::UNO_QUERY_THROW );
9798 + uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW );
9799 + table::BorderLine aBorderLine;
9800 + if ( xPropSet2->getPropertyValue( sTopBorder ) >>= aBorderLine )
9801 + aCellBorder.maCellBorder = aBorderLine;
9804 + { // bottom border
9805 + uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nColumn, nLine - 1 ), uno::UNO_QUERY_THROW );
9806 + uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW );
9807 + table::BorderLine aBorderLine;
9808 + if ( xPropSet2->getPropertyValue( sBottomBorder ) >>= aBorderLine )
9809 + aCellBorder.maCellBorder = aBorderLine;
9811 + vCellBorders.push_back( aCellBorder );
9812 + nXPos += aM.Width;
9814 + std::vector< CellBorder >::const_iterator aCellBorderIter( vCellBorders.begin() );
9815 + while( aCellBorderIter != vCellBorders.end() )
9817 + ImplCreateCellBorder( &*aCellBorderIter, aCellBorderIter->mnPos, nYPos,
9818 + static_cast< sal_Int32 >( aCellBorderIter->mnPos + aCellBorderIter->mnLength ), nYPos );
9819 + aCellBorderIter++;
9821 + if ( nLine < xRows->getCount() )
9823 + uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nLine ), uno::UNO_QUERY_THROW );
9824 + awt::Size aS( 0, 0 );
9825 + xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
9826 + awt::Size aM( ImplMapSize( aS ) );
9827 + nYPos += aM.Height;
9831 + // creating vertical lines
9832 + sal_Int32 nXPos = ImplMapPoint( rXShape->getPosition() ).X;
9833 + for( sal_Int32 nLine = 0; nLine < ( xColumns->getCount() + 1 ); nLine++ )
9835 + nYPos = ImplMapPoint( rXShape->getPosition() ).Y;
9836 + std::vector< CellBorder > vCellBorders;
9837 + for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ )
9839 + uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nRow ), uno::UNO_QUERY_THROW );
9840 + awt::Size aS( 0, 0 );
9841 + xPropSet->getPropertyValue( sHeight ) >>= aS.Height;
9842 + awt::Size aM( ImplMapSize( aS ) );
9844 + CellBorder aCellBorder;
9845 + aCellBorder.mnPos = nYPos;
9846 + aCellBorder.mnLength = aM.Height;
9847 + if ( nLine < xColumns->getCount() )
9849 + uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine, nRow ), uno::UNO_QUERY_THROW );
9850 + uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW );
9851 + table::BorderLine aBorderLine;
9852 + if ( xCellSet->getPropertyValue( sLeftBorder ) >>= aBorderLine )
9853 + aCellBorder.maCellBorder = aBorderLine;
9857 + uno::Reference< table::XMergeableCell > xCell( xCellRange->getCellByPosition( nLine - 1, nRow ), uno::UNO_QUERY_THROW );
9858 + uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW );
9859 + table::BorderLine aBorderLine;
9860 + if ( xCellSet->getPropertyValue( sRightBorder ) >>= aBorderLine )
9861 + aCellBorder.maCellBorder = aBorderLine;
9863 + vCellBorders.push_back( aCellBorder );
9864 + nYPos += aM.Height;
9866 + std::vector< CellBorder >::const_iterator aCellBorderIter( vCellBorders.begin() );
9867 + while( aCellBorderIter != vCellBorders.end() )
9869 + ImplCreateCellBorder( &*aCellBorderIter, nXPos, aCellBorderIter->mnPos,
9870 + nXPos, static_cast< sal_Int32 >( aCellBorderIter->mnPos + aCellBorderIter->mnLength ) );
9871 + aCellBorderIter++;
9873 + if ( nLine < xColumns->getCount() )
9875 + uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nLine ), uno::UNO_QUERY_THROW );
9876 + awt::Size aS( 0, 0 );
9877 + xPropSet->getPropertyValue( sWidth ) >>= aS.Width;
9878 + awt::Size aM( ImplMapSize( aS ) );
9879 + nXPos += aM.Width;
9885 + catch( uno::Exception& )
9888 + mpPptEscherEx->CloseContainer();
9890 diff --git a/sd/source/filter/pptx/pptx-escherex.cxx b/sd/source/filter/pptx/pptx-escherex.cxx
9891 new file mode 100644
9892 index 0000000..d1ef92f
9894 +++ sd/source/filter/pptx/pptx-escherex.cxx
9896 +/*************************************************************************
9898 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9900 + * Copyright 2008 by Sun Microsystems, Inc.
9902 + * OpenOffice.org - a multi-platform office productivity suite
9904 + * $RCSfile: escherex.cxx,v $
9905 + * $Revision: 1.13 $
9907 + * This file is part of OpenOffice.org.
9909 + * OpenOffice.org is free software: you can redistribute it and/or modify
9910 + * it under the terms of the GNU Lesser General Public License version 3
9911 + * only, as published by the Free Software Foundation.
9913 + * OpenOffice.org is distributed in the hope that it will be useful,
9914 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9915 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9916 + * GNU Lesser General Public License version 3 for more details
9917 + * (a copy is included in the LICENSE file that accompanied this code).
9919 + * You should have received a copy of the GNU Lesser General Public License
9920 + * version 3 along with OpenOffice.org. If not, see
9921 + * <http://www.openoffice.org/license.html>
9922 + * for a copy of the LGPLv3 License.
9924 + ************************************************************************/
9926 +// MARKER(update_precomp.py): autogen include statement, do not remove
9927 +#include "precompiled_sd.hxx"
9930 +#ifndef _PptEscherEx_HXX
9931 +#include "escherex.hxx"
9934 +// ---------------------------------------------------------------------------------------------
9935 +// ---------------------------------------------------------------------------------------------
9936 +// ---------------------------------------------------------------------------------------------
9938 +PptEscherEx::PptEscherEx( SvStream& rOutStrm, UINT32 nDrawings ) :
9939 + EscherEx ( rOutStrm, nDrawings )
9941 + mnFIDCLs = nDrawings;
9943 + mnCurrentShapeID = 0;
9944 + mnTotalShapesDgg = 0;
9945 + mnCurrentShapeMaximumID = 0;
9948 +// ---------------------------------------------------------------------------------------------
9950 +sal_uInt32 PptEscherEx::DrawingGroupContainerSize()
9952 + return ImplDggContainerSize() + 8;
9955 +void PptEscherEx::WriteDrawingGroupContainer( SvStream& rSt )
9957 + UINT32 nSize = DrawingGroupContainerSize();
9958 + rSt << (sal_uInt32)( 0xf | ( 1035 << 16 ) ) // EPP_PPDrawingGroup
9959 + << (sal_uInt32)( nSize - 8 );
9961 + ImplWriteDggContainer( rSt );
9964 +// ---------------------------------------------------------------------------------------------
9966 +sal_uInt32 PptEscherEx::ImplDggContainerSize()
9970 + nSize = ImplDggAtomSize();
9971 + nSize += GetBlibStoreContainerSize();
9972 + nSize += ImplOptAtomSize();
9973 + nSize += ImplSplitMenuColorsAtomSize();
9978 +void PptEscherEx::ImplWriteDggContainer( SvStream& rSt )
9980 + sal_uInt32 nSize = ImplDggContainerSize();
9983 + rSt << (sal_uInt32)( 0xf | ( ESCHER_DggContainer << 16 ) )
9984 + << (sal_uInt32)( nSize - 8 );
9986 + ImplWriteDggAtom( rSt );
9987 + WriteBlibStoreContainer( rSt );
9988 + ImplWriteOptAtom( rSt );
9989 + ImplWriteSplitMenuColorsAtom( rSt );
9993 +// ---------------------------------------------------------------------------------------------
9995 +sal_uInt32 PptEscherEx::ImplDggAtomSize()
9997 + return maFIDCLs.Tell() + 24;
10000 +void PptEscherEx::ImplWriteDggAtom( SvStream& rSt )
10002 + sal_uInt32 nSize = ImplDggAtomSize();
10005 + rSt << (sal_uInt32)( ESCHER_Dgg << 16 )
10006 + << (sal_uInt32)( nSize - 8 )
10007 + << mnCurrentShapeID
10008 + << (sal_uInt32)( mnFIDCLs + 1 )
10009 + << mnTotalShapesDgg
10012 + rSt.Write( maFIDCLs.GetData(), nSize - 24 );
10016 +// ---------------------------------------------------------------------------------------------
10018 +#define ESCHER_OPT_COUNT 6
10020 +sal_uInt32 PptEscherEx::ImplOptAtomSize()
10022 + sal_uInt32 nSize = 0;
10023 + if ( ESCHER_OPT_COUNT )
10024 + nSize = ( ESCHER_OPT_COUNT * 6 ) + 8;
10028 +void PptEscherEx::ImplWriteOptAtom( SvStream& rSt )
10030 + sal_uInt32 nSize = ImplOptAtomSize();
10033 + rSt << (sal_uInt32)( ( ESCHER_OPT << 16 ) | ( ESCHER_OPT_COUNT << 4 ) | 0x3 )
10034 + << (sal_uInt32)( nSize - 8 )
10035 + << (sal_uInt16)ESCHER_Prop_fillColor << (sal_uInt32)0xffb800
10036 + << (sal_uInt16)ESCHER_Prop_fillBackColor << (sal_uInt32)0
10037 + << (sal_uInt16)ESCHER_Prop_fNoFillHitTest << (sal_uInt32)0x00100010
10038 + << (sal_uInt16)ESCHER_Prop_lineColor << (sal_uInt32)0x8000001
10039 + << (sal_uInt16)ESCHER_Prop_fNoLineDrawDash << (sal_uInt32)0x00080008
10040 + << (sal_uInt16)ESCHER_Prop_shadowColor << (sal_uInt32)0x8000002;
10044 +// ---------------------------------------------------------------------------------------------
10046 +#define ESCHER_SPLIT_MENU_COLORS_COUNT 4
10048 +sal_uInt32 PptEscherEx::ImplSplitMenuColorsAtomSize()
10050 + sal_uInt32 nSize = 0;
10051 + if ( ESCHER_SPLIT_MENU_COLORS_COUNT )
10052 + nSize = ( ESCHER_SPLIT_MENU_COLORS_COUNT << 2 ) + 8;
10056 +void PptEscherEx::ImplWriteSplitMenuColorsAtom( SvStream& rSt )
10058 + UINT32 nSize = ImplSplitMenuColorsAtomSize();
10061 + rSt << (sal_uInt32)( ( ESCHER_SplitMenuColors << 16 ) | ( ESCHER_SPLIT_MENU_COLORS_COUNT << 4 ) )
10062 + << (sal_uInt32)( nSize - 8 )
10063 + << (sal_uInt32)0x08000004
10064 + << (sal_uInt32)0x08000001
10065 + << (sal_uInt32)0x08000002
10066 + << (sal_uInt32)0x100000f7;
10071 +// ---------------------------------------------------------------------------------------------
10073 +PptEscherEx::~PptEscherEx()
10077 +// ---------------------------------------------------------------------------------------------
10079 +void PptEscherEx::OpenContainer( UINT16 n_EscherContainer, int nRecInstance )
10081 + *mpOutStrm << (UINT16)( ( nRecInstance << 4 ) | 0xf ) << n_EscherContainer << (UINT32)0;
10082 + mOffsets.push_back( mpOutStrm->Tell() - 4 );
10083 + mRecTypes.push_back( n_EscherContainer );
10085 + switch( n_EscherContainer )
10087 + case ESCHER_DgContainer :
10089 + if ( !mbEscherDg )
10091 + mbEscherDg = TRUE;
10093 + mnTotalShapesDg = 0;
10094 + mnTotalShapeIdUsedDg = 0;
10095 + mnCurrentShapeID = ( mnCurrentShapeMaximumID &~0x3ff ) + 0x400; // eine neue Seite bekommt immer eine neue ShapeId die ein vielfaches von 1024 ist,
10096 + // damit ist erste aktuelle Shape ID 0x400
10097 + AddAtom( 8, ESCHER_Dg, 0, mnCurrentDg );
10098 + PtReplaceOrInsert( ESCHER_Persist_Dg | mnCurrentDg, mpOutStrm->Tell() );
10099 + *mpOutStrm << (UINT32)0 // The number of shapes in this drawing
10100 + << (UINT32)0; // The last MSOSPID given to an SP in this DG
10105 + case ESCHER_SpgrContainer :
10107 + if ( mbEscherDg )
10109 + mbEscherSpgr = TRUE;
10114 + case ESCHER_SpContainer :
10124 +// ---------------------------------------------------------------------------------------------
10126 +void PptEscherEx::CloseContainer()
10128 + /* SJ: #Issue 26747#
10129 + not creating group objects with a depth higher than 16, because then
10130 + PPT is having a big performance problem when starting a slide show
10132 + if ( ( mRecTypes.back() != ESCHER_SpgrContainer ) || ( mnGroupLevel < 12 ) )
10134 + UINT32 nSize, nPos = mpOutStrm->Tell();
10135 + nSize = ( nPos - mOffsets.back() ) - 4;
10136 + mpOutStrm->Seek( mOffsets.back() );
10137 + *mpOutStrm << nSize;
10139 + switch( mRecTypes.back() )
10141 + case ESCHER_DgContainer :
10143 + if ( mbEscherDg )
10145 + mbEscherDg = FALSE;
10146 + if ( DoSeek( ESCHER_Persist_Dg | mnCurrentDg ) )
10148 + // shapeanzahl des drawings setzen
10149 + mnTotalShapesDgg += mnTotalShapesDg;
10150 + *mpOutStrm << mnTotalShapesDg << mnCurrentShapeMaximumID;
10152 + if ( !mnTotalShapesDg )
10154 + maFIDCLs << (UINT32)0
10159 + if ( mnTotalShapeIdUsedDg )
10161 + UINT32 i, nFIDCL = ( ( mnTotalShapeIdUsedDg - 1 ) / 0x400 );
10163 + mnFIDCLs += nFIDCL;
10164 + for ( i = 0; i <= nFIDCL; i++ )
10166 + maFIDCLs << mnCurrentDg; // drawing number
10167 + if ( i < nFIDCL )
10168 + maFIDCLs << 0x400;
10171 + UINT32 nShapesLeft = mnTotalShapeIdUsedDg % 0x400;
10172 + if ( !nShapesLeft )
10173 + nShapesLeft = 0x400; // shape count in this IDCL
10174 + maFIDCLs << (UINT32)nShapesLeft;
10184 + case ESCHER_SpgrContainer :
10186 + if ( mbEscherSpgr )
10188 + mbEscherSpgr = FALSE;
10197 + mOffsets.pop_back();
10198 + mRecTypes.pop_back();
10199 + mpOutStrm->Seek( nPos );
10203 +// ---------------------------------------------------------------------------------------------
10205 +sal_uInt32 PptEscherEx::EnterGroup( Rectangle* pBoundRect, SvMemoryStream* pClientData )
10207 + sal_uInt32 nShapeId = 0;
10208 + /* SJ: #Issue 26747#
10209 + not creating group objects with a depth higher than 16, because then
10210 + PPT is having a big performance problem when starting a slide show
10212 + if ( mnGroupLevel < 12 )
10215 + if ( pBoundRect )
10216 + aRect = *pBoundRect;
10218 + OpenContainer( ESCHER_SpgrContainer );
10219 + OpenContainer( ESCHER_SpContainer );
10220 + AddAtom( 16, ESCHER_Spgr, 1 );
10221 + PtReplaceOrInsert( ESCHER_Persist_Grouping_Snap | mnGroupLevel, mpOutStrm->Tell() );
10222 + *mpOutStrm << (INT32)aRect.Left() // Bounding box fuer die Gruppierten shapes an die sie attached werden
10223 + << (INT32)aRect.Top()
10224 + << (INT32)aRect.Right()
10225 + << (INT32)aRect.Bottom();
10227 + nShapeId = GetShapeID();
10228 + if ( !mnGroupLevel )
10229 + AddShape( ESCHER_ShpInst_Min, 5, nShapeId ); // Flags: Group | Patriarch
10232 + AddShape( ESCHER_ShpInst_Min, 0x201, nShapeId ); // Flags: Group | HaveAnchor
10233 + AddAtom( 8, ESCHER_ClientAnchor );
10234 + PtReplaceOrInsert( ESCHER_Persist_Grouping_Logic | mnGroupLevel, mpOutStrm->Tell() );
10235 + *mpOutStrm << (INT16)aRect.Top() << (INT16)aRect.Left() << (INT16)aRect.Right() << (INT16)aRect.Bottom();
10237 + if ( pClientData )
10239 + pClientData->Seek( STREAM_SEEK_TO_END );
10240 + sal_uInt32 nSize = pClientData->Tell();
10243 + *mpOutStrm << (sal_uInt32)( ( ESCHER_ClientData << 16 ) | 0xf )
10245 + mpOutStrm->Write( pClientData->GetData(), nSize );
10248 + CloseContainer(); // ESCHER_SpContainer
10254 +// ---------------------------------------------------------------------------------------------
10255 diff --git a/sd/source/filter/pptx/pptx-pptexanimations.cxx b/sd/source/filter/pptx/pptx-pptexanimations.cxx
10256 new file mode 100644
10257 index 0000000..2b2588a
10259 +++ sd/source/filter/pptx/pptx-pptexanimations.cxx
10261 +/*************************************************************************
10263 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10265 + * Copyright 2008 by Sun Microsystems, Inc.
10267 + * OpenOffice.org - a multi-platform office productivity suite
10269 + * $RCSfile: pptexanimations.cxx,v $
10270 + * $Revision: 1.15.108.1 $
10272 + * This file is part of OpenOffice.org.
10274 + * OpenOffice.org is free software: you can redistribute it and/or modify
10275 + * it under the terms of the GNU Lesser General Public License version 3
10276 + * only, as published by the Free Software Foundation.
10278 + * OpenOffice.org is distributed in the hope that it will be useful,
10279 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
10280 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10281 + * GNU Lesser General Public License version 3 for more details
10282 + * (a copy is included in the LICENSE file that accompanied this code).
10284 + * You should have received a copy of the GNU Lesser General Public License
10285 + * version 3 along with OpenOffice.org. If not, see
10286 + * <http://www.openoffice.org/license.html>
10287 + * for a copy of the LGPLv3 License.
10289 + ************************************************************************/
10291 +// MARKER(update_precomp.py): autogen include statement, do not remove
10292 +#include "precompiled_sd.hxx"
10293 +#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
10294 +#include <com/sun/star/animations/AnimationFill.hpp>
10295 +#include <com/sun/star/animations/AnimationRestart.hpp>
10296 +#include <com/sun/star/animations/Timing.hpp>
10297 +#include <com/sun/star/animations/Event.hpp>
10298 +#include <com/sun/star/animations/AnimationEndSync.hpp>
10299 +#include <com/sun/star/animations/EventTrigger.hpp>
10300 +#include <com/sun/star/presentation/EffectNodeType.hpp>
10301 +#include <com/sun/star/presentation/EffectPresetClass.hpp>
10302 +#include <com/sun/star/animations/AnimationNodeType.hpp>
10303 +#include <com/sun/star/animations/AnimationTransformType.hpp>
10304 +#include <com/sun/star/animations/AnimationCalcMode.hpp>
10305 +#include <com/sun/star/animations/AnimationValueType.hpp>
10306 +#include <com/sun/star/util/XCloneable.hpp>
10307 +#include <com/sun/star/animations/AnimationAdditiveMode.hpp>
10308 +#include <com/sun/star/animations/XAnimateSet.hpp>
10309 +#include <com/sun/star/animations/XAudio.hpp>
10310 +#include <com/sun/star/animations/XTransitionFilter.hpp>
10311 +#include <com/sun/star/animations/XAnimateColor.hpp>
10312 +#include <com/sun/star/animations/XAnimateMotion.hpp>
10313 +#include <com/sun/star/animations/XAnimateTransform.hpp>
10314 +#include <com/sun/star/animations/TransitionType.hpp>
10315 +#include <com/sun/star/animations/TransitionSubType.hpp>
10316 +#include <com/sun/star/animations/ValuePair.hpp>
10317 +#include <com/sun/star/animations/AnimationColorSpace.hpp>
10318 +#include <com/sun/star/beans/NamedValue.hpp>
10319 +#include <com/sun/star/drawing/FillStyle.hpp>
10320 +#include <com/sun/star/drawing/LineStyle.hpp>
10321 +#include <com/sun/star/awt/FontWeight.hpp>
10322 +#include <com/sun/star/awt/FontUnderline.hpp>
10323 +#include <com/sun/star/awt/FontSlant.hpp>
10324 +#include <com/sun/star/container/XEnumerationAccess.hpp>
10325 +#include <com/sun/star/presentation/ParagraphTarget.hpp>
10326 +#include <com/sun/star/text/XSimpleText.hpp>
10327 +#include <com/sun/star/animations/XIterateContainer.hpp>
10328 +#include <com/sun/star/presentation/TextAnimationType.hpp>
10329 +#include <com/sun/star/container/XChild.hpp>
10330 +#include <comphelper/processfactory.hxx>
10331 +#include <rtl/ustrbuf.hxx>
10332 +#ifndef _RTL_MEMORY_H_
10333 +#include <rtl/memory.hxx>
10336 +#include <vcl/vclenum.hxx>
10337 +#include <svx/svdotext.hxx>
10338 +#include <svx/outlobj.hxx>
10339 +#include <svx/editobj.hxx>
10340 +#include <pptexanimations.hxx>
10341 +#include <osl/endian.h>
10343 +#include <algorithm>
10346 +using ::rtl::OUString;
10347 +using ::rtl::OUStringBuffer;
10348 +using ::com::sun::star::uno::Any;
10349 +using ::com::sun::star::container::XChild;
10350 +using ::com::sun::star::util::XCloneable;
10351 +using ::com::sun::star::uno::Reference;
10352 +using ::com::sun::star::uno::UNO_QUERY;
10353 +using ::com::sun::star::uno::UNO_QUERY_THROW;
10354 +using ::com::sun::star::uno::Sequence;
10355 +using ::com::sun::star::uno::makeAny;
10356 +using ::com::sun::star::uno::Exception;
10357 +using ::com::sun::star::uno::XInterface;
10358 +using ::com::sun::star::beans::NamedValue;
10359 +using ::com::sun::star::container::XEnumerationAccess;
10360 +using ::com::sun::star::container::XEnumeration;
10361 +using ::com::sun::star::lang::XMultiServiceFactory;
10363 +using namespace ::com::sun::star::text;
10364 +using namespace ::com::sun::star::drawing;
10365 +using namespace ::com::sun::star::animations;
10366 +using namespace ::com::sun::star::presentation;
10371 +void ImplTranslateAttribute( rtl::OUString& rString, const TranslateMode eTranslateMode )
10373 + if ( eTranslateMode != TRANSLATE_NONE )
10375 + if ( ( eTranslateMode & TRANSLATE_VALUE ) || ( eTranslateMode & TRANSLATE_ATTRIBUTE ) )
10377 + const ImplAttributeNameConversion* p = gImplConversionList;
10378 + while( p->mpAPIName )
10380 + if( rString.compareToAscii( p->mpAPIName ) == 0 )
10384 + if( p->mpMSName )
10386 + if ( eTranslateMode & TRANSLATE_VALUE )
10388 + rString = rtl::OUString( (sal_Unicode)'#' );
10389 + rString += OUString::createFromAscii( p->mpMSName );
10392 + rString = OUString::createFromAscii( p->mpMSName );
10395 + else if ( eTranslateMode & TRANSLATE_MEASURE )
10397 + const sal_Char* pDest[] = { "#ppt_x", "#ppt_y", "#ppt_w", "#ppt_h", NULL };
10398 + const sal_Char* pSource[] = { "x", "y", "width", "height", NULL };
10399 + sal_Int32 nIndex = 0;
10401 + const sal_Char** ps = pSource;
10402 + const sal_Char** pd = pDest;
10406 + const OUString aSearch( OUString::createFromAscii( *ps ) );
10407 + while( (nIndex = rString.indexOf( aSearch, nIndex )) != -1 )
10409 + sal_Int32 nLength = aSearch.getLength();
10410 + if( nIndex && (rString.getStr()[nIndex-1] == '#' ) )
10416 + const OUString aNew( OUString::createFromAscii( *pd ) );
10417 + rString = rString.replaceAt( nIndex, nLength, aNew );
10418 + nIndex += aNew.getLength();
10427 +sal_uInt32 ImplTranslatePresetSubType( const sal_uInt32 nPresetClass, const sal_uInt32 nPresetId, const rtl::OUString& rPresetSubType )
10429 + sal_uInt32 nPresetSubType = 0;
10430 + sal_Bool bTranslated = sal_False;
10432 + if ( ( nPresetClass == (sal_uInt32)EffectPresetClass::ENTRANCE ) || ( nPresetClass == (sal_uInt32)EffectPresetClass::EXIT ) )
10434 + if ( nPresetId != 21 )
10436 + switch( nPresetId )
10440 + if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "downward" ) ) )
10442 + nPresetSubType = 5;
10443 + bTranslated = sal_True;
10445 + else if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "across" ) ) )
10447 + nPresetSubType = 10;
10448 + bTranslated = sal_True;
10454 + if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "across" ) ) )
10456 + nPresetSubType = 10;
10457 + bTranslated = sal_True;
10463 + if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "right-to-top" ) ) )
10465 + nPresetSubType = 3;
10466 + bTranslated = sal_True;
10468 + else if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "right-to-bottom" ) ) )
10470 + nPresetSubType = 6;
10471 + bTranslated = sal_True;
10473 + else if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "left-to-top" ) ) )
10475 + nPresetSubType = 9;
10476 + bTranslated = sal_True;
10478 + else if ( rPresetSubType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "left-to-bottom" ) ) )
10480 + nPresetSubType = 12;
10481 + bTranslated = sal_True;
10487 + if ( !bTranslated )
10489 + const convert_subtype* p = gConvertArray;
10490 + while( p->mpStrSubType )
10492 + if ( rPresetSubType.equalsAscii( p->mpStrSubType ) )
10494 + nPresetSubType = p->mnID;
10495 + bTranslated = sal_True;
10502 + if ( !bTranslated )
10503 + nPresetSubType = (sal_uInt32)rPresetSubType.toInt32();
10504 + return nPresetSubType;
10507 +const sal_Char* transition::find( const sal_Int16 nType, const sal_Int16 nSubType, const sal_Bool bDirection )
10509 + const sal_Char* pRet = NULL;
10512 + const transition* p = gTransitions;
10513 + while( p->mpName )
10516 + if ( nType == p->mnType )
10518 + if ( nSubType == p->mnSubType )
10520 + if ( bDirection == p->mbDirection )
10524 + pRet = p->mpName;
10527 + if ( nFit == 7 ) // maximum
10534 +SvStream& operator<<(SvStream& rOut, AnimationNode& rNode )
10536 + rOut << rNode.mnU1;
10537 + rOut << rNode.mnRestart;
10538 + rOut << rNode.mnGroupType;
10539 + rOut << rNode.mnFill;
10540 + rOut << rNode.mnU3;
10541 + rOut << rNode.mnU4;
10542 + rOut << rNode.mnDuration;
10543 + rOut << rNode.mnNodeType;
10548 +AnimationExporter::AnimationExporter( const EscherSolverContainer& rSolverContainer, ppt::ExSoundCollection& rExSoundCollection ) :
10549 + mrSolverContainer ( rSolverContainer ),
10550 + mrExSoundCollection ( rExSoundCollection ),
10551 + mnCurrentGroup(0)
10555 +// --------------------------------------------------------------------
10557 +static sal_Int16 GetFillMode( const Reference< XAnimationNode >& xNode, const sal_Int16 nFillDefault )
10559 + sal_Int16 nFill = xNode->getFill();
10560 + if ( ( nFill == AnimationFill::DEFAULT ) ||
10561 + ( nFill == AnimationFill::INHERIT ) )
10563 + if ( nFill != AnimationFill::AUTO )
10564 + nFill = nFillDefault;
10566 + if( nFill == AnimationFill::AUTO )
10568 + nFill = AnimationFill::REMOVE;
10569 + sal_Bool bIsIndefiniteTiming = sal_True;
10570 + Any aAny = xNode->getDuration();
10571 + if( aAny.hasValue() )
10574 + if( aAny >>= eTiming )
10575 + bIsIndefiniteTiming = eTiming == Timing_INDEFINITE;
10577 + if ( bIsIndefiniteTiming )
10579 + aAny = xNode->getEnd();
10580 + if( aAny.hasValue() )
10583 + if( aAny >>= eTiming )
10584 + bIsIndefiniteTiming = eTiming == Timing_INDEFINITE;
10586 + if ( bIsIndefiniteTiming )
10588 + if ( !xNode->getRepeatCount().hasValue() )
10590 + aAny = xNode->getRepeatDuration();
10591 + if( aAny.hasValue() )
10594 + if( aAny >>= eTiming )
10595 + bIsIndefiniteTiming = eTiming == Timing_INDEFINITE;
10597 + if ( bIsIndefiniteTiming )
10598 + nFill = AnimationFill::FREEZE;
10606 +void AnimationExporter::doexport( const Reference< XDrawPage >& xPage, SvStream& rStrm )
10608 + Reference< XAnimationNodeSupplier > xNodeSupplier( xPage, UNO_QUERY );
10609 + if( xNodeSupplier.is() )
10611 + const Reference< XAnimationNode > xRootNode( xNodeSupplier->getAnimationNode() );
10612 + if( xRootNode.is() )
10614 + processAfterEffectNodes( xRootNode );
10615 + exportNode( rStrm, xRootNode, NULL, DFF_msofbtAnimGroup, 1, 0, sal_False, AnimationFill::AUTO );
10620 +void AnimationExporter::processAfterEffectNodes( const Reference< XAnimationNode >& xRootNode )
10624 + Reference< XEnumerationAccess > xEnumerationAccess( xRootNode, UNO_QUERY_THROW );
10625 + Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
10626 + while( xEnumeration->hasMoreElements() )
10628 + Reference< XAnimationNode > xNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
10630 + Reference< XEnumerationAccess > xEnumerationAccess2( xNode, UNO_QUERY );
10631 + if ( xEnumerationAccess2.is() )
10633 + Reference< XEnumeration > xEnumeration2( xEnumerationAccess2->createEnumeration(), UNO_QUERY_THROW );
10634 + while( xEnumeration2->hasMoreElements() )
10636 + Reference< XAnimationNode > xChildNode( xEnumeration2->nextElement(), UNO_QUERY_THROW );
10638 + Reference< XEnumerationAccess > xEnumerationAccess3( xChildNode, UNO_QUERY_THROW );
10639 + Reference< XEnumeration > xEnumeration3( xEnumerationAccess3->createEnumeration(), UNO_QUERY_THROW );
10640 + while( xEnumeration3->hasMoreElements() )
10642 + Reference< XAnimationNode > xChildNode2( xEnumeration3->nextElement(), UNO_QUERY_THROW );
10644 + Reference< XEnumerationAccess > xEnumerationAccess4( xChildNode2, UNO_QUERY_THROW );
10645 + Reference< XEnumeration > xEnumeration4( xEnumerationAccess4->createEnumeration(), UNO_QUERY_THROW );
10646 + while( xEnumeration4->hasMoreElements() )
10648 + Reference< XAnimationNode > xChildNode3( xEnumeration4->nextElement(), UNO_QUERY_THROW );
10650 + switch( xChildNode3->getType() )
10652 + // found an after effect
10653 + case AnimationNodeType::SET:
10654 + case AnimationNodeType::ANIMATECOLOR:
10656 + Reference< XAnimationNode > xMaster;
10658 + Sequence< NamedValue > aUserData( xChildNode3->getUserData() );
10659 + sal_Int32 nLength = aUserData.getLength();
10660 + const NamedValue* p = aUserData.getConstArray();
10662 + while( nLength-- )
10664 + if( p->Name.equalsAscii( "master-element" ) )
10666 + p->Value >>= xMaster;
10672 + AfterEffectNodePtr pAfterEffectNode( new AfterEffectNode( xChildNode3, xMaster ) );
10673 + maAfterEffectNodes.push_back( pAfterEffectNode );
10683 + catch( Exception& e )
10686 + DBG_ERROR( "(@CL)AnimationExporter::processAfterEffectNodes(), exception cought!" );
10690 +bool AnimationExporter::isAfterEffectNode( const Reference< XAnimationNode >& xNode ) const
10692 + std::list< AfterEffectNodePtr >::const_iterator aIter( maAfterEffectNodes.begin() );
10693 + const std::list< AfterEffectNodePtr >::const_iterator aEnd( maAfterEffectNodes.end() );
10694 + while( aIter != aEnd )
10696 + if( (*aIter)->mxNode == xNode )
10704 +bool AnimationExporter::hasAfterEffectNode( const Reference< XAnimationNode >& xNode, Reference< XAnimationNode >& xAfterEffectNode ) const
10706 + std::list< AfterEffectNodePtr >::const_iterator aIter( maAfterEffectNodes.begin() );
10707 + const std::list< AfterEffectNodePtr >::const_iterator aEnd( maAfterEffectNodes.end() );
10708 + while( aIter != aEnd )
10710 + if( (*aIter)->mxMaster == xNode )
10712 + xAfterEffectNode = (*aIter)->mxNode;
10721 +// check if this group only contain empty groups. this may happen when
10722 +// after effect nodes are not exported at theire original position
10723 +bool AnimationExporter::isEmptyNode( const Reference< XAnimationNode >& xNode ) const
10725 + if( xNode.is() ) switch( xNode->getType() )
10727 + case AnimationNodeType::PAR :
10728 + case AnimationNodeType::SEQ :
10729 + case AnimationNodeType::ITERATE :
10731 + Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
10732 + if( xEnumerationAccess.is() )
10734 + Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
10735 + if( xEnumeration.is() )
10737 + while( xEnumeration->hasMoreElements() )
10739 + Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
10740 + if( xChildNode.is() && !isEmptyNode( xChildNode ) )
10748 + case AnimationNodeType::SET :
10749 + case AnimationNodeType::ANIMATECOLOR :
10750 + return isAfterEffectNode( xNode );
10758 +void AnimationExporter::exportNode( SvStream& rStrm, Reference< XAnimationNode > xNode, const Reference< XAnimationNode >* pParent, const sal_uInt16 nContainerRecType,
10759 + const sal_uInt16 nInstance, const sal_Int32 nGroupLevel, const sal_Bool bTakeBackInteractiveSequenceTiming, const sal_Int16 nFDef )
10761 + if( (nGroupLevel == 4) && isEmptyNode( xNode ) )
10764 + if ( ( nContainerRecType == DFF_msofbtAnimGroup ) && ( nGroupLevel == 2 ) && isEmptyNode( xNode ) )
10767 + if( nContainerRecType == DFF_msofbtAnimGroup )
10768 + mnCurrentGroup++;
10770 + sal_Bool bTakeBackInteractiveSequenceTimingForChild = sal_False;
10771 + sal_Int16 nFillDefault = GetFillMode( xNode, nFDef );
10773 + bool bSkipChildren = false;
10775 + Reference< XAnimationNode > xAudioNode;
10776 + static sal_uInt32 nAudioGroup;
10779 + EscherExContainer aContainer( rStrm, nContainerRecType, nInstance );
10780 + switch( xNode->getType() )
10782 + case AnimationNodeType::CUSTOM :
10784 + exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
10785 + exportAnimPropertySet( rStrm, xNode );
10786 + exportAnimEvent( rStrm, xNode, 0 );
10787 + exportAnimValue( rStrm, xNode, sal_False );
10791 + case AnimationNodeType::PAR :
10793 + exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
10794 + exportAnimPropertySet( rStrm, xNode );
10795 + sal_Int32 nFlags = nGroupLevel == 2 ? 0x10 : 0;
10796 + if ( bTakeBackInteractiveSequenceTiming )
10798 + exportAnimEvent( rStrm, xNode, nFlags );
10799 + exportAnimValue( rStrm, xNode, nGroupLevel == 4 );
10803 + case AnimationNodeType::SEQ :
10805 + exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
10806 + sal_Int16 nNodeType = exportAnimPropertySet( rStrm, xNode );
10807 + sal_Int32 nFlags = 12;
10808 + if ( ( nGroupLevel == 1 ) && ( nNodeType == ::com::sun::star::presentation::EffectNodeType::INTERACTIVE_SEQUENCE ) )
10811 + bTakeBackInteractiveSequenceTimingForChild = sal_True;
10813 + exportAnimAction( rStrm, xNode );
10814 + exportAnimEvent( rStrm, xNode, nFlags );
10815 + exportAnimValue( rStrm, xNode, sal_False );
10819 + case AnimationNodeType::ITERATE :
10822 + EscherExAtom aAnimNodeExAtom( rStrm, DFF_msofbtAnimNode );
10823 + AnimationNode aAnim;
10824 + rtl_zeroMemory( &aAnim, sizeof( aAnim ) );
10825 + aAnim.mnGroupType = mso_Anim_GroupType_PAR;
10826 + aAnim.mnNodeType = 1;
10827 + // attribute Restart
10828 + switch( xNode->getRestart() )
10831 + case AnimationRestart::DEFAULT : aAnim.mnRestart = 0; break;
10832 + case AnimationRestart::ALWAYS : aAnim.mnRestart = 1; break;
10833 + case AnimationRestart::WHEN_NOT_ACTIVE : aAnim.mnRestart = 2; break;
10834 + case AnimationRestart::NEVER : aAnim.mnRestart = 3; break;
10836 + // attribute Fill
10837 + switch( xNode->getFill() )
10840 + case AnimationFill::DEFAULT : aAnim.mnFill = 0; break;
10841 + case AnimationFill::REMOVE : aAnim.mnFill = 1; break;
10842 + case AnimationFill::FREEZE : aAnim.mnFill = 2; break;
10843 + case AnimationFill::HOLD : aAnim.mnFill = 3; break;
10844 + case AnimationFill::TRANSITION : aAnim.mnFill = 4; break;
10848 + exportIterate( rStrm, xNode );
10849 + exportAnimPropertySet( rStrm, xNode );
10850 + exportAnimEvent( rStrm, xNode, 0 );
10851 + exportAnimValue( rStrm, xNode, sal_False );
10854 + EscherExContainer aContainer( rStrm, DFF_msofbtAnimGroup, 1 );
10855 + exportAnimNode( rStrm, xNode, pParent, nGroupLevel + 1, nFillDefault );
10856 + exportAnimPropertySet( rStrm, xNode );
10857 + exportAnimEvent( rStrm, xNode, 0 );
10858 + exportAnimValue( rStrm, xNode, sal_False );
10863 + case AnimationNodeType::ANIMATE :
10865 + exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
10866 + exportAnimPropertySet( rStrm, xNode );
10867 + exportAnimEvent( rStrm, xNode, 0 );
10868 + exportAnimValue( rStrm, xNode, sal_False );
10869 + exportAnimate( rStrm, xNode );
10873 + case AnimationNodeType::SET :
10875 + bool bIsAfterEffectNode( isAfterEffectNode( xNode ) );
10876 + if( (nGroupLevel != 4) || !bIsAfterEffectNode )
10878 + exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
10879 + exportAnimPropertySet( rStrm, xNode );
10880 + exportAnimateSet( rStrm, xNode, bIsAfterEffectNode ? AFTEREFFECT_SET : AFTEREFFECT_NONE );
10881 + exportAnimEvent( rStrm, xNode, 0 );
10882 + exportAnimValue( rStrm, xNode, sal_False );
10886 + bSkipChildren = true;
10891 + case AnimationNodeType::ANIMATEMOTION :
10893 + exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
10894 + exportAnimPropertySet( rStrm, xNode );
10895 + exportAnimateMotion( rStrm, xNode );
10896 + exportAnimEvent( rStrm, xNode, 0 );
10897 + exportAnimValue( rStrm, xNode, sal_False );
10901 + case AnimationNodeType::ANIMATECOLOR :
10903 + bool bIsAfterEffectNode( isAfterEffectNode( xNode ) );
10904 + if( (nGroupLevel != 4) || !bIsAfterEffectNode )
10906 + if( bIsAfterEffectNode )
10907 + xNode = createAfterEffectNodeClone( xNode );
10909 + exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
10910 + exportAnimPropertySet( rStrm, xNode );
10911 + exportAnimateColor( rStrm, xNode, bIsAfterEffectNode ? AFTEREFFECT_COLOR : AFTEREFFECT_NONE );
10912 + exportAnimEvent( rStrm, xNode, 0 );
10913 + exportAnimValue( rStrm, xNode, sal_False );
10917 + bSkipChildren = true;
10922 + case AnimationNodeType::ANIMATETRANSFORM :
10924 + exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
10925 + exportAnimPropertySet( rStrm, xNode );
10926 + exportAnimateTransform( rStrm, xNode );
10927 + exportAnimEvent( rStrm, xNode, 0 );
10928 + exportAnimValue( rStrm, xNode, sal_False );
10932 + case AnimationNodeType::TRANSITIONFILTER :
10934 + exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
10935 + exportAnimPropertySet( rStrm, xNode );
10936 + exportAnimEvent( rStrm, xNode, 0 );
10937 + exportAnimValue( rStrm, xNode, sal_False );
10938 + exportTransitionFilter( rStrm, xNode );
10942 + case AnimationNodeType::AUDIO : // #i58428#
10944 + exportAnimNode( rStrm, xNode, pParent, nGroupLevel, nFillDefault );
10945 + exportAnimPropertySet( rStrm, xNode );
10947 + Reference< XAudio > xAudio( xNode, UNO_QUERY );
10948 + if( xAudio.is() )
10950 + Any aAny( xAudio->getSource() );
10951 + rtl::OUString aURL;
10953 + if ( ( aAny >>= aURL ) && ( aURL.getLength() ) )
10955 + sal_Int32 nU1 = 2;
10956 + sal_Int32 nTrigger = 3;
10957 + sal_Int32 nU3 = nAudioGroup;
10958 + sal_Int32 nBegin = 0;
10960 + EscherExContainer aAnimEvent( rStrm, DFF_msofbtAnimEvent, 1 );
10962 + EscherExAtom aAnimTrigger( rStrm, DFF_msofbtAnimTrigger );
10963 + rStrm << nU1 << nTrigger << nU3 << nBegin;
10970 + EscherExContainer aAnimEvent( rStrm, DFF_msofbtAnimEvent, 2 );
10972 + EscherExAtom aAnimTrigger( rStrm, DFF_msofbtAnimTrigger );
10973 + rStrm << nU1 << nTrigger << nU3 << nBegin;
10976 + EscherExContainer aAnimateTargetElement( rStrm, DFF_msofbtAnimateTargetElement );
10978 + sal_uInt32 nRefMode = 3;
10979 + sal_uInt32 nRefType = 2;
10980 + sal_uInt32 nRefId = mrExSoundCollection.GetId( aURL );
10981 + sal_Int32 begin = -1;
10982 + sal_Int32 end = -1;
10984 + EscherExAtom aAnimReference( rStrm, DFF_msofbtAnimReference );
10985 + rStrm << nRefMode << nRefType << nRefId << begin << end;
10989 + exportAnimValue( rStrm, xNode, sal_False );
10993 + if( !bSkipChildren )
10995 + // export after effect node if one exists for this node
10996 + Reference< XAnimationNode > xAfterEffectNode;
10997 + if( hasAfterEffectNode( xNode, xAfterEffectNode ) )
10999 + exportNode( rStrm, xAfterEffectNode, &xNode, DFF_msofbtAnimSubGoup, 1, nGroupLevel + 1, bTakeBackInteractiveSequenceTimingForChild, nFillDefault );
11002 + Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
11003 + if( xEnumerationAccess.is() )
11005 + Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
11006 + if( xEnumeration.is() )
11008 + while( xEnumeration->hasMoreElements() )
11010 + Reference< XAnimationNode > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
11011 + if( xChildNode.is() )
11013 + if ( xChildNode->getType() == AnimationNodeType::AUDIO )
11015 + xAudioNode = xChildNode;
11016 + nAudioGroup = mnCurrentGroup;
11019 + exportNode( rStrm, xChildNode, &xNode, DFF_msofbtAnimGroup, 1, nGroupLevel + 1, bTakeBackInteractiveSequenceTimingForChild, nFillDefault );
11026 + if ( xAudioNode.is() )
11027 + exportNode( rStrm, xAudioNode, &xNode, DFF_msofbtAnimGroup, 1, nGroupLevel, bTakeBackInteractiveSequenceTimingForChild, nFillDefault );
11029 + if( xNode->getType() == AnimationNodeType::ITERATE )
11033 +Reference< XAnimationNode > AnimationExporter::createAfterEffectNodeClone( const Reference< XAnimationNode >& xNode ) const
11037 + Reference< ::com::sun::star::util::XCloneable > xClonable( xNode, UNO_QUERY_THROW );
11038 + Reference< XAnimationNode > xCloneNode( xClonable->createClone(), UNO_QUERY_THROW );
11041 + xCloneNode->setBegin( aEmpty );
11044 + return xCloneNode;
11046 + catch( Exception& e )
11049 + DBG_ERROR("(@CL)sd::ppt::AnimationExporter::createAfterEffectNodeClone(), could not create clone!" );
11054 +void AnimationExporter::exportAnimNode( SvStream& rStrm, const Reference< XAnimationNode >& xNode,
11055 + const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >*, const sal_Int32, const sal_Int16 nFillDefault )
11057 + EscherExAtom aAnimNodeExAtom( rStrm, DFF_msofbtAnimNode );
11058 + AnimationNode aAnim;
11059 + rtl_zeroMemory( &aAnim, sizeof( aAnim ) );
11061 + // attribute Restart
11062 + switch( xNode->getRestart() )
11065 + case AnimationRestart::DEFAULT : aAnim.mnRestart = 0; break;
11066 + case AnimationRestart::ALWAYS : aAnim.mnRestart = 1; break;
11067 + case AnimationRestart::WHEN_NOT_ACTIVE : aAnim.mnRestart = 2; break;
11068 + case AnimationRestart::NEVER : aAnim.mnRestart = 3; break;
11071 + // attribute Fill
11072 +// aAnim.mnFill = GetFillMode( xNode, pParent );
11073 + switch( nFillDefault )
11076 + case AnimationFill::DEFAULT : aAnim.mnFill = 0; break;
11077 + case AnimationFill::REMOVE : aAnim.mnFill = 1; break;
11078 + case AnimationFill::FREEZE : // aAnim.mnFill = 2; break;
11079 + case AnimationFill::HOLD : aAnim.mnFill = 3; break;
11080 + case AnimationFill::TRANSITION : aAnim.mnFill = 4; break;
11082 + // attribute Duration
11083 + double fDuration = 0.0;
11084 + com::sun::star::animations::Timing eTiming;
11085 + if ( xNode->getDuration() >>= eTiming )
11087 + if ( eTiming == Timing_INDEFINITE )
11088 + aAnim.mnDuration = -1;
11090 + else if ( xNode->getDuration() >>= fDuration )
11092 + aAnim.mnDuration = (sal_Int32)( fDuration * 1000.0 );
11095 + aAnim.mnDuration = -1;
11097 + // NodeType, NodeGroup
11098 + aAnim.mnNodeType = 1;
11099 + aAnim.mnGroupType = mso_Anim_GroupType_SEQ;
11100 + switch( xNode->getType() )
11102 + case AnimationNodeType::PAR : // PASSTROUGH!!! (as it was intended)
11103 + aAnim.mnGroupType = mso_Anim_GroupType_PAR;
11104 + case AnimationNodeType::SEQ :
11106 + // trying to get the nodetype
11107 + Sequence< NamedValue > aUserData = xNode->getUserData();
11108 + if ( aUserData.getLength() )
11110 + const NamedValue* p = aUserData.getConstArray();
11111 + sal_Int32 nLength = aUserData.getLength();
11112 + while( nLength-- )
11114 + if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "node-type" ) ) )
11116 + sal_Int16 nType = 0;
11117 + if ( p->Value >>= nType )
11121 + case ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT : aAnim.mnNodeType = 0x12; break;
11122 + case ::com::sun::star::presentation::EffectNodeType::MAIN_SEQUENCE : aAnim.mnNodeType = 0x18; break;
11124 + case ::com::sun::star::presentation::EffectNodeType::ON_CLICK :
11125 + case ::com::sun::star::presentation::EffectNodeType::WITH_PREVIOUS :
11126 + case ::com::sun::star::presentation::EffectNodeType::AFTER_PREVIOUS :
11127 + case ::com::sun::star::presentation::EffectNodeType::INTERACTIVE_SEQUENCE :
11139 + case AnimationNodeType::ANIMATE :
11140 + case AnimationNodeType::SET :
11142 + case AnimationNodeType::CUSTOM :
11143 + case AnimationNodeType::ITERATE :
11144 + case AnimationNodeType::ANIMATEMOTION :
11145 + case AnimationNodeType::ANIMATECOLOR :
11146 + case AnimationNodeType::ANIMATETRANSFORM :
11148 + aAnim.mnGroupType = mso_Anim_GroupType_NODE;
11149 + aAnim.mnNodeType = mso_Anim_Behaviour_ANIMATION;
11153 + case AnimationNodeType::AUDIO :
11155 + aAnim.mnGroupType = mso_Anim_GroupType_MEDIA;
11156 + aAnim.mnNodeType = mso_Anim_Behaviour_ANIMATION;
11160 + case AnimationNodeType::TRANSITIONFILTER :
11162 + aAnim.mnGroupType = mso_Anim_GroupType_NODE;
11163 + aAnim.mnNodeType = mso_Anim_Behaviour_FILTER;
11170 +sal_Int16 AnimationExporter::exportAnimPropertySet( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
11172 + sal_Int16 nNodeType = ::com::sun::star::presentation::EffectNodeType::DEFAULT;
11174 + EscherExContainer aAnimPropertySet( rStrm, DFF_msofbtAnimPropertySet );
11175 + const ::com::sun::star::uno::Any* pAny[ DFF_ANIM_PROPERTY_ID_COUNT ];
11176 + rtl_zeroMemory( pAny, sizeof( pAny ) );
11178 + Reference< XAnimationNode > xMaster;
11180 + const Any aTrue( makeAny( (sal_Bool)sal_True ) );
11181 + Any aMasterRel, aOverride, aRunTimeContext;
11183 + // storing user data into pAny, to allow direct access later
11184 + Sequence< NamedValue > aUserData = xNode->getUserData();
11185 + if ( aUserData.getLength() )
11187 + const NamedValue* p = aUserData.getConstArray();
11188 + sal_Int32 nLength = aUserData.getLength();
11189 + while( nLength-- )
11191 + if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "node-type" ) ) )
11193 + pAny[ DFF_ANIM_NODE_TYPE ] = &(p->Value);
11195 + else if ( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-class" ) ) )
11197 + pAny[ DFF_ANIM_PRESET_CLASS ] = &(p->Value);
11199 + else if ( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-id" ) ) )
11201 + pAny[ DFF_ANIM_PRESET_ID ] = &(p->Value);
11203 + else if ( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "preset-sub-type" ) ) )
11205 + pAny[ DFF_ANIM_PRESET_SUB_TYPE ] = &(p->Value);
11207 + else if ( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "master-element" ) ) )
11209 + pAny[ DFF_ANIM_AFTEREFFECT ] = &aTrue;
11210 + p->Value >>= xMaster;
11216 + // calculate master-rel
11217 + if( xMaster.is() )
11219 + sal_Int32 nMasterRel = 2;
11220 + Reference< XChild > xNodeChild( xNode, UNO_QUERY );
11221 + Reference< XChild > xMasterChild( xMaster, UNO_QUERY );
11222 + if( xNodeChild.is() && xMasterChild.is() && (xNodeChild->getParent() == xMasterChild->getParent() ) )
11225 + aMasterRel <<= nMasterRel;
11227 + pAny[ DFF_ANIM_MASTERREL ] = &aMasterRel;
11229 + aOverride <<= (sal_Int32)1;
11230 + pAny[ DFF_ANIM_OVERRIDE ] = &aOverride;
11232 + aRunTimeContext <<= (sal_Int32)1;
11233 + pAny[ DFF_ANIM_RUNTIMECONTEXT ] = &aRunTimeContext;
11236 + // the order is important
11237 + if ( pAny[ DFF_ANIM_NODE_TYPE ] )
11239 + if ( *pAny[ DFF_ANIM_NODE_TYPE ] >>= nNodeType )
11241 + sal_uInt32 nPPTNodeType = DFF_ANIM_NODE_TYPE_ON_CLICK;
11242 + switch( nNodeType )
11244 + case ::com::sun::star::presentation::EffectNodeType::ON_CLICK : nPPTNodeType = DFF_ANIM_NODE_TYPE_ON_CLICK; break;
11245 + case ::com::sun::star::presentation::EffectNodeType::WITH_PREVIOUS : nPPTNodeType = DFF_ANIM_NODE_TYPE_WITH_PREVIOUS; break;
11246 + case ::com::sun::star::presentation::EffectNodeType::AFTER_PREVIOUS : nPPTNodeType = DFF_ANIM_NODE_TYPE_AFTER_PREVIOUS; break;
11247 + case ::com::sun::star::presentation::EffectNodeType::MAIN_SEQUENCE : nPPTNodeType = DFF_ANIM_NODE_TYPE_MAIN_SEQUENCE; break;
11248 + case ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT : nPPTNodeType = DFF_ANIM_NODE_TYPE_TIMING_ROOT; break;
11249 + case ::com::sun::star::presentation::EffectNodeType::INTERACTIVE_SEQUENCE: nPPTNodeType = DFF_ANIM_NODE_TYPE_INTERACTIVE_SEQ; break;
11251 + exportAnimPropertyuInt32( rStrm, DFF_ANIM_NODE_TYPE, nPPTNodeType, TRANSLATE_NONE );
11254 + sal_uInt32 nPresetId = 0;
11255 + sal_uInt32 nPresetSubType = 0;
11256 + sal_uInt32 nAPIPresetClass = EffectPresetClass::CUSTOM;
11257 + sal_uInt32 nPresetClass = DFF_ANIM_PRESS_CLASS_USER_DEFINED;
11258 + sal_Bool bPresetClass, bPresetId, bPresetSubType;
11259 + bPresetClass = bPresetId = bPresetSubType = sal_False;
11261 + if ( pAny[ DFF_ANIM_PRESET_CLASS ] )
11263 + if ( *pAny[ DFF_ANIM_PRESET_CLASS ] >>= nAPIPresetClass )
11265 + sal_uInt8 nPPTPresetClass;
11266 + switch( nAPIPresetClass )
11268 + case EffectPresetClass::ENTRANCE : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_ENTRANCE; break;
11269 + case EffectPresetClass::EXIT : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_EXIT; break;
11270 + case EffectPresetClass::EMPHASIS : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_EMPHASIS; break;
11271 + case EffectPresetClass::MOTIONPATH : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_MOTIONPATH; break;
11272 + case EffectPresetClass::OLEACTION : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_OLE_ACTION; break;
11273 + case EffectPresetClass::MEDIACALL : nPPTPresetClass = DFF_ANIM_PRESS_CLASS_MEDIACALL; break;
11275 + nPPTPresetClass = DFF_ANIM_PRESS_CLASS_USER_DEFINED;
11277 + nPresetClass = nPPTPresetClass;
11278 + bPresetClass = sal_True;
11281 + if ( pAny[ DFF_ANIM_PRESET_ID ] )
11283 + rtl::OUString sPreset;
11284 + if ( *pAny[ DFF_ANIM_PRESET_ID ] >>= sPreset )
11286 + if ( sPreset.match( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ppt_" ) ), 0 ) )
11288 + sal_Int32 nLast = sPreset.lastIndexOf( '_' );
11289 + if ( ( nLast != -1 ) && ( ( nLast + 1 ) < sPreset.getLength() ) )
11291 + rtl::OUString aNumber( sPreset.copy( nLast + 1 ) );
11292 + nPresetId = aNumber.toInt32();
11293 + bPresetId = sal_True;
11298 + const preset_maping* p = gPresetMaping;
11299 + while( p->mpStrPresetId && ((p->mnPresetClass != (sal_Int32)nAPIPresetClass) || !sPreset.equalsAscii( p->mpStrPresetId )) )
11302 + if( p->mpStrPresetId )
11304 + nPresetId = p->mnPresetId;
11305 + bPresetId = sal_True;
11311 + if ( pAny[ DFF_ANIM_PRESET_SUB_TYPE ] )
11313 + rtl::OUString sPresetSubType;
11314 + if ( *pAny[ DFF_ANIM_PRESET_SUB_TYPE ] >>= sPresetSubType )
11316 + nPresetSubType = ImplTranslatePresetSubType( nPresetClass, nPresetId, sPresetSubType );
11317 + bPresetSubType = sal_True;
11321 + exportAnimPropertyuInt32( rStrm, DFF_ANIM_PRESET_ID, nPresetId, TRANSLATE_NONE );
11322 + if ( bPresetSubType )
11323 + exportAnimPropertyuInt32( rStrm, DFF_ANIM_PRESET_SUB_TYPE, nPresetSubType, TRANSLATE_NONE );
11324 + if ( bPresetClass )
11325 + exportAnimPropertyuInt32( rStrm, DFF_ANIM_PRESET_CLASS, nPresetClass, TRANSLATE_NONE );
11327 + if ( pAny[ DFF_ANIM_ID ] )
11329 + // TODO DFF_ANIM_ID
11332 + if ( pAny[ DFF_ANIM_AFTEREFFECT ] )
11334 + sal_Bool bAfterEffect = sal_False;
11335 + if ( *pAny[ DFF_ANIM_AFTEREFFECT ] >>= bAfterEffect )
11336 + exportAnimPropertyByte( rStrm, DFF_ANIM_AFTEREFFECT, bAfterEffect, TRANSLATE_NONE );
11339 + if ( pAny[ DFF_ANIM_RUNTIMECONTEXT ] )
11341 + sal_Int32 nRunTimeContext = 0;
11342 + if ( *pAny[ DFF_ANIM_RUNTIMECONTEXT ] >>= nRunTimeContext )
11343 + exportAnimPropertyuInt32( rStrm, DFF_ANIM_RUNTIMECONTEXT, nRunTimeContext, TRANSLATE_NONE );
11345 + if ( pAny[ DFF_ANIM_PATH_EDIT_MODE ] )
11347 + // TODO DFF_ANIM_ID
11350 + if( !xMaster.is() )
11352 + Reference< XAnimateColor > xColor( xNode, UNO_QUERY );
11353 + if( xColor.is() )
11355 +// sal_uInt32 nColorSpace = xColor->getColorSpace() == AnimationColorSpace::RGB ? 0 : 1;
11356 +// exportAnimPropertyuInt32( rStrm, DFF_ANIM_COLORSPACE, nColorSpace, TRANSLATE_NONE );
11358 + sal_Bool bDirection = !xColor->getDirection();
11359 + exportAnimPropertyuInt32( rStrm, DFF_ANIM_DIRECTION, bDirection, TRANSLATE_NONE );
11363 + if ( pAny[ DFF_ANIM_OVERRIDE ] )
11365 + sal_Int32 nOverride = 0;
11366 + if ( *pAny[ DFF_ANIM_OVERRIDE ] >>= nOverride )
11367 + exportAnimPropertyuInt32( rStrm, DFF_ANIM_OVERRIDE, nOverride, TRANSLATE_NONE );
11370 + if ( pAny[ DFF_ANIM_MASTERREL ] )
11372 + sal_Int32 nMasterRel = 0;
11373 + if ( *pAny[ DFF_ANIM_MASTERREL ] >>= nMasterRel )
11374 + exportAnimPropertyuInt32( rStrm, DFF_ANIM_MASTERREL, nMasterRel, TRANSLATE_NONE );
11378 + Reference< XAudio > xAudio( xNode, UNO_QUERY );
11379 + if( xAudio.is() )
11381 + sal_Int16 nEndAfterSlide = 0;
11382 + nEndAfterSlide = xAudio->getEndAfterSlide();
11383 + exportAnimPropertyuInt32( rStrm, DFF_ANIM_ENDAFTERSLIDE, nEndAfterSlide, TRANSLATE_NONE );
11386 + Reference< XAnimate > xAnim( xNode, UNO_QUERY );
11389 + // TODO: DFF_ANIM_TIMEFILTER
11391 + if ( pAny[ DFF_ANIM_EVENT_FILTER ] )
11393 + // TODO DFF_ANIM_EVENT_FILTER
11395 + if ( pAny[ DFF_ANIM_VOLUME ] )
11397 + // TODO DFF_ANIM_VOLUME
11399 + return nNodeType;
11402 +sal_Bool AnimationExporter::exportAnimProperty( SvStream& rStrm, const sal_uInt16 nPropertyId, const ::com::sun::star::uno::Any& rAny, const TranslateMode eTranslateMode )
11404 + sal_Bool bRet = sal_False;
11405 + if ( rAny.hasValue() )
11407 + switch( rAny.getValueType().getTypeClass() )
11409 + case ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT :
11410 + case ::com::sun::star::uno::TypeClass_SHORT :
11411 + case ::com::sun::star::uno::TypeClass_UNSIGNED_LONG :
11412 + case ::com::sun::star::uno::TypeClass_LONG :
11414 + sal_Int32 nVal = 0;
11415 + if ( rAny >>= nVal )
11417 + exportAnimPropertyuInt32( rStrm, nPropertyId, nVal, eTranslateMode );
11423 + case ::com::sun::star::uno::TypeClass_DOUBLE :
11425 + double fVal = 0.0;
11426 + if ( rAny >>= fVal )
11428 + exportAnimPropertyFloat( rStrm, nPropertyId, fVal, eTranslateMode );
11433 + case ::com::sun::star::uno::TypeClass_FLOAT :
11435 + float fVal = 0.0;
11436 + if ( rAny >>= fVal )
11438 + if ( eTranslateMode & TRANSLATE_NUMBER_TO_STRING )
11441 + rtl::OUString aNumber( rtl::OUString::valueOf( fVal ) );
11442 + aAny <<= aNumber;
11443 + exportAnimPropertyString( rStrm, nPropertyId, aNumber, eTranslateMode );
11447 + exportAnimPropertyFloat( rStrm, nPropertyId, fVal, eTranslateMode );
11453 + case ::com::sun::star::uno::TypeClass_STRING :
11455 + rtl::OUString aStr;
11456 + if ( rAny >>= aStr )
11458 + exportAnimPropertyString( rStrm, nPropertyId, aStr, eTranslateMode );
11469 +void AnimationExporter::exportAnimPropertyString( SvStream& rStrm, const sal_uInt16 nPropertyId, const rtl::OUString& rVal, const TranslateMode eTranslateMode )
11471 + EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAttributeValue, nPropertyId );
11472 + sal_uInt8 nType = DFF_ANIM_PROP_TYPE_UNISTRING;
11474 + rtl::OUString aStr( rVal );
11475 + if ( eTranslateMode != TRANSLATE_NONE )
11476 + ImplTranslateAttribute( aStr, eTranslateMode );
11477 + writeZString( rStrm, aStr );
11480 +void AnimationExporter::exportAnimPropertyFloat( SvStream& rStrm, const sal_uInt16 nPropertyId, const double& rVal, const TranslateMode )
11482 + EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAttributeValue, nPropertyId );
11483 + sal_uInt8 nType = DFF_ANIM_PROP_TYPE_FLOAT;
11484 + float fFloat = (float)rVal;
11489 +void AnimationExporter::exportAnimPropertyuInt32( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt32 nVal, const TranslateMode )
11491 + EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAttributeValue, nPropertyId );
11492 + sal_uInt8 nType = DFF_ANIM_PROP_TYPE_INT32 ;
11497 +void AnimationExporter::exportAnimPropertyByte( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt8 nVal, const TranslateMode )
11499 + EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAttributeValue, nPropertyId );
11500 + sal_uInt8 nType = DFF_ANIM_PROP_TYPE_BYTE;
11505 +void AnimationExporter::writeZString( SvStream& rStrm, const rtl::OUString& rVal )
11508 + for ( i = 0; i < rVal.getLength(); i++ )
11509 + rStrm << rVal[ i ];
11510 + rStrm << (sal_Unicode)0;
11513 +void AnimationExporter::exportAnimAction( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
11515 + EscherExAtom aExAtom( rStrm, DFF_msofbtAnimAction );
11517 + sal_Int32 nConcurrent = 1;
11518 + sal_Int32 nNextAction = 1;
11519 + sal_Int32 nEndSync = 0;
11520 + sal_Int32 nU4 = 0;
11521 + sal_Int32 nU5 = 3;
11523 + sal_Int16 nAnimationEndSync = 0;
11524 + if ( xNode->getEndSync() >>= nAnimationEndSync )
11526 + if ( nAnimationEndSync == AnimationEndSync::ALL )
11529 + rStrm << nConcurrent
11537 +// nFlags Bit 6 = fixInteractiveSequenceTiming (for child)
11538 +// nFlags Bit 5 = fixInteractiveSequenceTiming (for root)
11539 +// nFlags Bit 4 = first node of main sequence -> begin event next has to be replaced to indefinite
11540 +void AnimationExporter::exportAnimEvent( SvStream& rStrm, const Reference< XAnimationNode >& xNode, const sal_Int32 nFlags )
11543 + for ( i = 0; i < 4; i++ )
11545 + sal_Int32 nU1 = 0;
11546 + sal_Int32 nTrigger = 0;
11547 + sal_Int32 nU3 = 0;
11548 + sal_Int32 nBegin = 0;
11550 + sal_Bool bCreateEvent = sal_False;
11560 + com::sun::star::animations::Timing eTiming;
11563 + if ( nFlags & 0x20 )
11565 + // taking the first child
11566 + Reference< XEnumerationAccess > xEA( xNode, UNO_QUERY_THROW );
11567 + Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW );
11568 + if ( xE.is() && xE->hasMoreElements() )
11570 +// while( xE->hasMoreElements() )
11572 + Reference< XAnimationNode > xClickNode( xE->nextElement(), UNO_QUERY );
11573 + aAny = xClickNode->getBegin();
11577 + else if ( nFlags & 0x40 )
11579 + // begin has to be replaced with void, so don't do anything
11583 + aAny = xNode->getBegin();
11584 + if ( nFlags & 0x10 ) // replace ON_NEXT with IDEFINITE
11586 + if ( ( aAny >>= aEvent ) && ( aEvent.Trigger == EventTrigger::ON_NEXT ) )
11588 + eTiming = Timing_INDEFINITE;
11589 + aAny <<= eTiming;
11595 + aAny = xNode->getEnd();
11597 + double fTiming = 0.0;
11598 + if ( aAny >>= aEvent )
11600 + bCreateEvent = sal_True;
11601 + switch( aEvent.Trigger )
11603 + case EventTrigger::NONE : nTrigger = 0; break;
11604 + case EventTrigger::ON_BEGIN : nTrigger = 1; break;
11605 + case EventTrigger::ON_END : nTrigger = 2; break;
11606 + case EventTrigger::BEGIN_EVENT : nTrigger = 3; break;
11607 + case EventTrigger::END_EVENT : nTrigger = 4; nU1 = 2; nU3 = mnCurrentGroup; break;
11608 + case EventTrigger::ON_CLICK : nTrigger = 5; break;
11609 + case EventTrigger::ON_DBL_CLICK : nTrigger = 6; break;
11610 + case EventTrigger::ON_MOUSE_ENTER : nTrigger = 7; break;
11611 + case EventTrigger::ON_MOUSE_LEAVE : nTrigger = 8; break;
11612 + case EventTrigger::ON_NEXT : nTrigger = 9; break;
11613 + case EventTrigger::ON_PREV : nTrigger = 10; break;
11614 + case EventTrigger::ON_STOP_AUDIO : nTrigger = 11; break;
11616 + if ( aEvent.Offset.hasValue() )
11618 + if ( aEvent.Offset >>= eTiming )
11620 + if ( eTiming == Timing_INDEFINITE )
11623 + else if ( aEvent.Offset >>= fTiming )
11624 + nBegin = (sal_Int32)( fTiming * 1000.0 );
11626 + aSource = aEvent.Source;
11628 + else if ( aAny >>= eTiming )
11630 + bCreateEvent = sal_True;
11631 + if ( eTiming == Timing_INDEFINITE )
11634 + else if ( aAny >>= fTiming )
11636 + bCreateEvent = sal_True;
11637 + if ( eTiming == Timing_INDEFINITE )
11638 + nBegin = (sal_Int32)( fTiming * 1000.0 );
11645 + if ( nFlags & ( 1 << i ) )
11647 + bCreateEvent = sal_True;
11655 + if ( nFlags & ( 1 << i ) )
11657 + bCreateEvent = sal_True;
11664 + if ( bCreateEvent )
11666 + EscherExContainer aAnimEvent( rStrm, DFF_msofbtAnimEvent, i + 1 );
11668 + EscherExAtom aAnimTrigger( rStrm, DFF_msofbtAnimTrigger );
11674 + exportAnimateTargetElement( rStrm, aSource, ( nFlags & ( 1 << i ) ) != 0 );
11679 +Any AnimationExporter::convertAnimateValue( const Any& rSourceValue, const rtl::OUString& rAttributeName ) const
11681 + rtl::OUString aDest;
11682 + if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "X" ) )
11683 + || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Y" ) )
11684 + || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Width" ) )
11685 + || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Height" ) )
11688 + rtl::OUString aStr;
11689 + if ( rSourceValue >>= aStr )
11691 + ImplTranslateAttribute( aStr, TRANSLATE_MEASURE );
11695 + else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Rotate" ) ) // "r" or "style.rotation" ?
11696 + || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SkewX" ) )
11697 + || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Opacity" ) )
11698 + || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharHeight" ) )
11701 + double fNumber = 0.0;
11702 + if ( rSourceValue >>= fNumber )
11703 + aDest += rtl::OUString::valueOf( fNumber );
11705 + else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Color" ) )
11706 + || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillColor" ) ) // "Fillcolor" or "FillColor" ?
11707 + || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LineColor" ) )
11708 + || rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharColor" ) )
11711 + sal_Int32 nColor = 0;
11712 + Sequence< double > aHSL( 3 );
11713 + rtl::OUString aP( RTL_CONSTASCII_USTRINGPARAM( "," ) );
11714 + if ( rSourceValue >>= aHSL )
11716 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hsl(" ) );
11717 + aDest += rtl::OUString::valueOf( (sal_Int32)( aHSL[ 0 ] / ( 360.0 / 255 ) ) );
11719 + aDest += rtl::OUString::valueOf( (sal_Int32)( aHSL[ 1 ] * 255.0 ) );
11721 + aDest += rtl::OUString::valueOf( (sal_Int32)( aHSL[ 2 ] * 255.0 ) );
11722 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ) );
11724 + else if ( rSourceValue >>= nColor )
11726 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "rgb(" ) );
11727 + aDest += rtl::OUString::valueOf( (sal_Int32)( (sal_Int8)nColor ) );
11729 + aDest += rtl::OUString::valueOf( (sal_Int32)( (sal_Int8)( nColor >> 8 ) ) );
11731 + aDest += rtl::OUString::valueOf( (sal_Int32)( (sal_Int8)( nColor >> 16 ) ) );
11732 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ) );
11735 + else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FillStyle" ) ) )
11737 + ::com::sun::star::drawing::FillStyle eFillStyle;
11738 + if ( rSourceValue >>= eFillStyle )
11740 + if ( eFillStyle == ::com::sun::star::drawing::FillStyle_NONE )
11741 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "none" ) ); // ?
11743 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "solid" ) );
11746 + else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LineStyle" ) ) )
11748 + ::com::sun::star::drawing::LineStyle eLineStyle;
11749 + if ( rSourceValue >>= eLineStyle )
11751 + if ( eLineStyle == ::com::sun::star::drawing::LineStyle_NONE )
11752 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );
11754 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
11757 + else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharWeight" ) ) )
11759 + float fFontWeight = 0.0;
11760 + if ( rSourceValue >>= fFontWeight )
11762 + if ( fFontWeight == com::sun::star::awt::FontWeight::BOLD )
11763 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "bold" ) );
11765 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "normal" ) );
11768 + else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharUnderline" ) ) )
11770 + sal_Int16 nFontUnderline = 0;
11771 + if ( rSourceValue >>= nFontUnderline )
11773 + if ( nFontUnderline == com::sun::star::awt::FontUnderline::NONE )
11774 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );
11776 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
11779 + else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CharPosture" ) ) )
11781 + ::com::sun::star::awt::FontSlant eFontSlant;
11782 + if ( rSourceValue >>= eFontSlant )
11784 + if ( eFontSlant == com::sun::star::awt::FontSlant_ITALIC )
11785 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "italic" ) );
11787 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "normal" ) ); // ?
11790 + else if ( rAttributeName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Visibility" ) ) )
11792 + sal_Bool bVisible = sal_True;
11793 + if ( rSourceValue >>= bVisible )
11796 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "visible" ) );
11798 + aDest += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hidden" ) );
11802 + if ( aDest.getLength() )
11805 + aRet = rSourceValue;
11809 +void AnimationExporter::exportAnimateSet( SvStream& rStrm, const Reference< XAnimationNode >& xNode, int nAfterEffectType )
11811 + Reference< XAnimateSet > xSet( xNode, UNO_QUERY );
11814 + EscherExContainer aAnimateSet( rStrm, DFF_msofbtAnimateSet, 0 );
11816 + EscherExAtom aAnimateSetData( rStrm, DFF_msofbtAnimateSetData );
11817 + sal_uInt32 nId1 = 1; // ??
11818 + sal_uInt32 nId2 = 1; // ??
11819 + rStrm << nId1 << nId2;
11821 + Any aConvertedValue( convertAnimateValue( xSet->getTo(), xSet->getAttributeName() ) );
11822 + if ( aConvertedValue.hasValue() )
11823 + exportAnimProperty( rStrm, 1, aConvertedValue, TRANSLATE_NONE );
11824 + exportAnimateTarget( rStrm, xNode, 0, nAfterEffectType );
11828 +sal_uInt32 GetValueTypeForAttributeName( const rtl::OUString& rAttributeName )
11830 + sal_uInt32 nValueType = 0;
11833 + AnimationValueType::STRING == 0;
11834 + AnimationValueType::NUMBER == 1;
11835 + AnimationValueType::COLOR == 2;
11840 + const sal_Char* pName;
11843 + static const Entry lcl_attributeMap[] =
11845 + { "charcolor", 2 },
11846 + { "charfontname", 0 },
11847 + { "charheight", 1 },
11848 + { "charposture", 0 },
11849 + // TODO(Q1): This should prolly be changed in PPT import
11850 + // { "charrotation", ATTRIBUTE_CHAR_ROTATION },
11851 + { "charrotation", 1 },
11852 + { "charunderline", 0 },
11853 + { "charweight", 0 },
11855 + { "dimcolor", 2 },
11856 + { "fillcolor", 2 },
11857 + { "fillstyle", 0 },
11859 + { "linecolor", 2 },
11860 + { "linestyle", 0 },
11861 + { "opacity", 0 },
11865 + { "visibility", 1 },
11871 + const Entry* pPtr = &lcl_attributeMap[ 0 ];
11872 + while( pPtr->pName )
11874 + if ( rAttributeName.equalsIgnoreAsciiCaseAscii( pPtr->pName ) )
11876 + nValueType = pPtr->nType;
11881 + DBG_ASSERT( pPtr->pName, "GetValueTypeForAttributeName, unknown property value!" );
11882 + return nValueType;
11885 +void AnimationExporter::exportAnimate( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
11887 + Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
11888 + if ( xAnimate.is() )
11890 + Any aBy ( xAnimate->getBy() );
11891 + Any aFrom( xAnimate->getFrom() );
11892 + Any aTo ( xAnimate->getTo() );
11894 + EscherExContainer aContainer( rStrm, DFF_msofbtAnimate, 0 );
11896 + EscherExAtom aAnimateData( rStrm, DFF_msofbtAnimateData );
11897 + sal_uInt32 nBits = 0x38;
11898 + sal_Int16 nTmp = xAnimate->getCalcMode();
11899 + sal_uInt32 nCalcMode = /* (nTmp == AnimationCalcMode::FORMULA) ? 2 : */ (nTmp == AnimationCalcMode::LINEAR) ? 1 : 0;
11900 + nTmp = xAnimate->getValueType();
11901 + sal_uInt32 nValueType = GetValueTypeForAttributeName( xAnimate->getAttributeName() );
11903 + if ( aBy.hasValue() )
11905 + if ( aFrom.hasValue() )
11907 + if ( aTo.hasValue() )
11910 + rStrm << nCalcMode
11914 + if ( aBy.hasValue() )
11915 + exportAnimProperty( rStrm, 1, aBy, TRANSLATE_NUMBER_TO_STRING | TRANSLATE_MEASURE );
11916 + if ( aFrom.hasValue() )
11917 + exportAnimProperty( rStrm, 2, aFrom, TRANSLATE_NUMBER_TO_STRING | TRANSLATE_MEASURE );
11918 + if ( aTo.hasValue() )
11919 + exportAnimProperty( rStrm, 3, aTo, TRANSLATE_NUMBER_TO_STRING | TRANSLATE_MEASURE );
11921 + exportAnimateKeyPoints( rStrm, xAnimate );
11922 + exportAnimateTarget( rStrm, xNode );
11926 +void AnimationExporter::exportAnimateTarget( SvStream& rStrm, const Reference< XAnimationNode >& xNode, const sal_uInt32 nForceAttributeNames, int nAfterEffectType )
11928 + EscherExContainer aAnimateTarget( rStrm, DFF_msofbtAnimateTarget, 0 );
11929 + Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
11930 + if ( xAnimate.is() )
11933 + EscherExAtom aAnimateTargetSettings( rStrm, DFF_msofbtAnimateTargetSettings, 0 );
11934 + // nBits %0001: additive, %0010: accumulate, %0100: attributeName, %1000: transformtype
11935 + // nAdditive 0 = base, 1 = sum, 2 = replace, 3 = multiply, 4 = none
11936 + // nAccumulate 0 = none, 1 = always
11937 + // nTransformType 0: "property" else "image"
11938 + sal_uInt32 nBits = 0;
11939 + sal_uInt32 nAdditive = 0;
11940 + sal_uInt32 nAccumulate = 0;
11941 + sal_uInt32 nTransformType = 0;
11942 + if ( xAnimate.is() )
11944 + if ( xAnimate->getAttributeName().getLength() )
11945 + nBits |= 4; // what is attributeName ?, maybe this is set if a DFF_msofbtAnimateAttributeNames is written
11946 + sal_Int16 nAdditiveMode = xAnimate->getAdditive();
11947 + if ( nAdditiveMode != AnimationAdditiveMode::BASE )
11950 + switch( nAdditiveMode )
11952 + case AnimationAdditiveMode::SUM : nAdditive = 1; break;
11953 + case AnimationAdditiveMode::REPLACE : nAdditive = 2; break;
11954 + case AnimationAdditiveMode::MULTIPLY : nAdditive = 3; break;
11955 + case AnimationAdditiveMode::NONE : nAdditive = 4; break;
11958 + if ( xAnimate->getAccumulate() )
11967 + << nTransformType;
11969 + if ( xAnimate->getAttributeName().getLength() || nForceAttributeNames )
11971 + EscherExContainer aAnimateAttributeNames( rStrm, DFF_msofbtAnimateAttributeNames, 1 );
11972 + rtl::OUString aAttributeName( xAnimate->getAttributeName() );
11973 + if ( nForceAttributeNames )
11975 + switch( nForceAttributeNames )
11977 + case 1 : aAttributeName = rtl::OUString::createFromAscii( "r" ); break;
11980 + sal_Int32 nIndex = 0;
11983 + OUString aToken( aAttributeName.getToken( 0, ';', nIndex ) );
11984 + exportAnimPropertyString( rStrm, 0, aToken, TRANSLATE_ATTRIBUTE );
11986 + while ( nIndex >= 0 );
11989 + if( nAfterEffectType != AFTEREFFECT_NONE )
11991 + EscherExContainer aAnimPropertySet( rStrm, DFF_msofbtAnimPropertySet );
11992 + exportAnimPropertyuInt32( rStrm, 6, 1, TRANSLATE_NONE );
11993 + if( nAfterEffectType == AFTEREFFECT_COLOR )
11995 + exportAnimPropertyuInt32( rStrm, 4, 0, TRANSLATE_NONE );
11996 + exportAnimPropertyuInt32( rStrm, 5, 0, TRANSLATE_NONE );
11999 + exportAnimateTargetElement( rStrm, aTarget.hasValue() ? aTarget : xAnimate->getTarget(), sal_False );
12003 +void AnimationExporter::exportAnimateTargetElement( SvStream& rStrm, const Any aAny, const sal_Bool bCreate2b01Atom )
12005 + Reference< XShape > xShape;
12007 + sal_uInt32 nRefMode = 0; // nRefMode == 2 -> Paragraph
12008 + sal_Int32 begin = -1;
12009 + sal_Int32 end = -1;
12011 + if( !xShape.is() )
12013 + ParagraphTarget aParaTarget;
12014 + if( aAny >>= aParaTarget )
12015 + xShape = aParaTarget.Shape;
12016 + if ( xShape.is() )
12018 + // now calculating the character range for the paragraph
12019 + sal_Int16 nParagraph = aParaTarget.Paragraph;
12020 + Reference< XSimpleText > xText( xShape, UNO_QUERY );
12021 + if ( xText.is() )
12024 + Reference< XEnumerationAccess > xTextParagraphEnumerationAccess( xText, UNO_QUERY );
12025 + if ( xTextParagraphEnumerationAccess.is() )
12027 + Reference< XEnumeration > xTextParagraphEnumeration( xTextParagraphEnumerationAccess->createEnumeration() );
12028 + if ( xTextParagraphEnumeration.is() )
12030 + sal_Int16 nCurrentParagraph;
12031 + begin = end = nCurrentParagraph = 0;
12032 + while ( xTextParagraphEnumeration->hasMoreElements() )
12034 + Reference< XTextRange > xTextRange( xTextParagraphEnumeration->nextElement(), UNO_QUERY );
12035 + if ( xTextRange.is() )
12037 + rtl::OUString aParaText( xTextRange->getString() );
12038 + sal_Int32 nLength = aParaText.getLength() + 1;
12040 + if ( nCurrentParagraph == nParagraph )
12042 + nCurrentParagraph++;
12043 + begin += nLength;
12051 + if ( xShape.is() || bCreate2b01Atom )
12053 + EscherExContainer aAnimateTargetElement( rStrm, DFF_msofbtAnimateTargetElement );
12054 + if ( xShape.is() )
12056 + EscherExAtom aAnimReference( rStrm, DFF_msofbtAnimReference );
12058 + sal_uInt32 nRefType = 1; // TODO: nRefType == 2 -> Sound;
12059 + sal_uInt32 nRefId = ((EscherSolverContainer&)mrSolverContainer).GetShapeId( xShape );
12061 + rStrm << nRefMode
12067 + if ( bCreate2b01Atom )
12069 + EscherExAtom a2b01Atom( rStrm, 0x2b01 );
12070 + rStrm << (sal_uInt32)1; // ?
12075 +void AnimationExporter::exportAnimateKeyPoints( SvStream& rStrm, const Reference< XAnimate >& xAnimate )
12077 + Sequence< double > aKeyTimes( xAnimate->getKeyTimes() );
12078 + Sequence< Any > aValues( xAnimate->getValues() );
12079 + OUString aFormula( xAnimate->getFormula() );
12080 + if ( aKeyTimes.getLength() )
12082 + EscherExContainer aAnimKeyPoints( rStrm, DFF_msofbtAnimKeyPoints );
12084 + for ( i = 0; i < aKeyTimes.getLength(); i++ )
12087 + EscherExAtom aAnimKeyTime( rStrm, DFF_msofbtAnimKeyTime );
12088 + sal_Int32 nKeyTime = (sal_Int32)( aKeyTimes[ i ] * 1000.0 );
12089 + rStrm << nKeyTime;
12092 + if ( aValues[ i ].hasValue() )
12095 + if ( aValues[ i ] >>= aPair )
12097 + aAny[ 0 ] = convertAnimateValue( aPair.First, xAnimate->getAttributeName() );
12098 + aAny[ 1 ] = convertAnimateValue( aPair.Second, xAnimate->getAttributeName() );
12102 + aAny[ 0 ] = convertAnimateValue( aValues[ i ], xAnimate->getAttributeName() );
12104 + if ( !i && aFormula.getLength() )
12106 + ImplTranslateAttribute( aFormula, TRANSLATE_MEASURE );
12107 + aAny[ 1 ] <<= aFormula;
12109 + exportAnimProperty( rStrm, 0, aAny[ 0 ], TRANSLATE_NONE );
12110 + exportAnimProperty( rStrm, 1, aAny[ 1 ], TRANSLATE_NONE );
12116 +void AnimationExporter::exportAnimValue( SvStream& rStrm, const Reference< XAnimationNode >& xNode, const sal_Bool bExportAlways )
12119 + // repeat count (0)
12120 + double fRepeat = 0.0;
12121 + float fRepeatCount = 0.0;
12122 + com::sun::star::animations::Timing eTiming;
12123 + aAny = xNode->getRepeatCount();
12124 + if ( aAny >>= eTiming )
12126 + if ( eTiming == Timing_INDEFINITE )
12127 + fRepeatCount = ((float)3.40282346638528860e+38);
12129 + else if ( aAny >>= fRepeat )
12130 + fRepeatCount = (float)fRepeat;
12131 + if ( fRepeatCount != 0.0 )
12133 + EscherExAtom aExAtom( rStrm, DFF_msofbtAnimValue );
12134 + sal_uInt32 nType = 0;
12138 + // accelerate (3)
12139 + float fAccelerate = (float)xNode->getAcceleration();
12140 + if ( bExportAlways || ( fAccelerate != 0.0 ) )
12142 + EscherExAtom aExAtom( rStrm, DFF_msofbtAnimValue );
12143 + sal_uInt32 nType = 3;
12148 + // decelerate (4)
12149 + float fDecelerate = (float)xNode->getDecelerate();
12150 + if ( bExportAlways || ( fDecelerate != 0.0 ) )
12152 + EscherExAtom aExAtom( rStrm, DFF_msofbtAnimValue );
12153 + sal_uInt32 nType = 4;
12158 + // autoreverse (5)
12159 + sal_Bool bAutoReverse = xNode->getAutoReverse();
12160 + if ( bExportAlways || bAutoReverse )
12162 + EscherExAtom aExAtom( rStrm, DFF_msofbtAnimValue );
12163 + sal_uInt32 nType = 5;
12164 + sal_uInt32 nVal = bAutoReverse ? 1 : 0;
12170 +void AnimationExporter::exportTransitionFilter( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
12172 + Reference< XTransitionFilter > xFilter( xNode, UNO_QUERY );
12173 + if ( xFilter.is() )
12175 + EscherExContainer aAnimateFilter( rStrm, DFF_msofbtAnimateFilter );
12177 + EscherExAtom aAnimateFilterData( rStrm, DFF_msofbtAnimateFilterData );
12178 + sal_uInt32 nBits = 3; // bit 0 -> use AnimAttributeValue
12179 + // bit 1 -> use nTransition
12181 + sal_uInt32 nTransition = xFilter->getMode() ? 0 : 1;
12185 + const sal_Char* pFilter = transition::find( xFilter->getTransition(), xFilter->getSubtype(), xFilter->getDirection() );
12188 + const OUString aStr( OUString::createFromAscii( pFilter ) );
12189 + exportAnimPropertyString( rStrm, 1, aStr, TRANSLATE_NONE );
12191 + exportAnimateTarget( rStrm, xNode );
12195 +void AnimationExporter::exportAnimateMotion( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
12197 + Reference< XAnimateMotion > xMotion( xNode, UNO_QUERY );
12198 + if ( xMotion.is() )
12200 + EscherExContainer aAnimateMotion( rStrm, DFF_msofbtAnimateMotion );
12202 + { //SJ: Ignored from import filter
12203 + EscherExAtom aAnimateMotionData( rStrm, DFF_msofbtAnimateMotionData );
12204 + sal_uInt32 nBits = 0x98;
12205 + sal_uInt32 nOrigin = 0x2;
12206 + float fByX = 100.0; // nBits&1
12207 + float fByY = 100.0; // nBits&1
12208 + float fFromX = 0.0; // nBits&2
12209 + float fFromY = 0.0; // nBits&2
12210 + float fToX = 100.0; // nBits&4
12211 + float fToY = 100.0; // nBits&4
12212 + rStrm << nBits << fByX << fByY << fFromX << fFromY << fToX << fToY << nOrigin;
12216 + EscherExAtom aF137( rStrm, 0xf137 );
12220 + if ( xMotion->getPath() >>= aStr )
12222 + if ( aStr.getLength() )
12223 + exportAnimPropertyString( rStrm, 1, aStr, TRANSLATE_NONE );
12225 + exportAnimateTarget( rStrm, xNode );
12230 +void AnimationExporter::exportAnimateTransform( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
12232 + Reference< XAnimateTransform > xTransform( xNode, UNO_QUERY );
12233 + if ( xTransform.is() )
12235 + if ( xTransform->getTransformType() == AnimationTransformType::SCALE )
12237 + EscherExContainer aAnimateScale( rStrm, DFF_msofbtAnimateScale );
12239 + EscherExAtom aAnimateScaleData( rStrm, DFF_msofbtAnimateScaleData );
12240 + sal_uInt32 nBits = 0;
12241 + sal_uInt32 nZoomContents = 1;
12242 + float fByX = 100.0;
12243 + float fByY = 100.0;
12244 + float fFromX = 0.0;
12245 + float fFromY = 0.0;
12246 + float fToX = 100.0;
12247 + float fToY = 100.0;
12249 + double fX = 0.0, fY = 0.0;
12251 + if ( xTransform->getBy() >>= aPair )
12253 + if ( ( aPair.First >>= fX ) && ( aPair.Second >>= fY ) )
12256 + fByX = (float)( fX * 100 );
12257 + fByY = (float)( fY * 100 );
12260 + if ( xTransform->getFrom() >>= aPair )
12262 + if ( ( aPair.First >>= fX ) && ( aPair.Second >>= fY ) )
12265 + fFromX = (float)( fX * 100 );
12266 + fFromY = (float)( fY * 100 );
12269 + if( xTransform->getTo() >>= aPair )
12271 + if ( ( aPair.First >>= fX ) && ( aPair.Second >>= fY ) )
12274 + fToX = (float)( fX * 100 );
12275 + fToY = (float)( fY * 100 );
12279 + // TODO: ZoomContents:
12280 + //if( nBits & 8 )
12281 + //( fprintf( mpFile, " zoomContents=\"%s\"", nZoomContents ? "true" : "false" );
12283 + rStrm << nBits << fByX << fByY << fFromX << fFromY << fToX << fToY << nZoomContents;
12285 + exportAnimateTarget( rStrm, xNode );
12287 + else if ( xTransform->getTransformType() == AnimationTransformType::ROTATE )
12289 + EscherExContainer aAnimateRotation( rStrm, DFF_msofbtAnimateRotation );
12291 + EscherExAtom aAnimateRotationData( rStrm, DFF_msofbtAnimateRotationData );
12292 + sal_uInt32 nBits = 0;
12293 + sal_uInt32 nU1 = 0;
12294 + float fBy = 360.0;
12295 + float fFrom = 0.0;
12296 + float fTo = 360.0;
12298 + double fVal = 0.0;
12299 + if ( xTransform->getBy() >>= fVal )
12302 + fBy = (float)fVal;
12304 + if ( xTransform->getFrom() >>= fVal )
12307 + fFrom = (float)fVal;
12309 + if ( xTransform->getTo() >>= fVal )
12312 + fTo = (float)fVal;
12314 + rStrm << nBits << fBy << fFrom << fTo << nU1;
12316 + exportAnimateTarget( rStrm, xNode, 1 );
12321 +sal_Bool AnimationExporter::getColorAny( const Any& rAny, const sal_Int16 nColorSpace, sal_Int32& rMode, sal_Int32& rA, sal_Int32& rB, sal_Int32& rC ) const
12323 + sal_Bool bIsColor = sal_True;
12326 + if ( nColorSpace == AnimationColorSpace::HSL )
12329 + sal_Int32 nColor = 0;
12330 + Sequence< double > aHSL( 3 );
12331 + if ( rAny >>= nColor ) // RGB color
12333 + rA = (sal_uInt8)( nColor >> 24 );
12334 + rB = (sal_uInt8)( nColor >> 8 );
12335 + rC = (sal_uInt8)( nColor );
12337 + else if ( rAny >>= aHSL ) // HSL
12339 + rA = (sal_Int32) ( aHSL[ 0 ] * 255.0 / 360.0 );
12340 + rB = (sal_Int32) ( aHSL[ 1 ] * 255.0 );
12341 + rC = (sal_Int32) ( aHSL[ 2 ] * 255.0 );
12344 + bIsColor = sal_False;
12348 +void AnimationExporter::exportAnimateColor( SvStream& rStrm, const Reference< XAnimationNode >& xNode, int nAfterEffectType )
12350 + Reference< XAnimateColor > xColor( xNode, UNO_QUERY );
12351 + if ( xColor.is() )
12353 + EscherExContainer aAnimateColor( rStrm, DFF_msofbtAnimateColor );
12355 + EscherExAtom aAnimateColorData( rStrm, DFF_msofbtAnimateColorData );
12356 + sal_uInt32 nBits = 8;
12358 + sal_Int32 nByMode, nByA, nByB, nByC;
12359 + nByMode = nByA = nByB = nByC = 0;
12361 + sal_Int32 nFromMode, nFromA, nFromB, nFromC;
12362 + nFromMode = nFromA = nFromB = nFromC = 0;
12364 + sal_Int32 nToMode, nToA, nToB, nToC;
12365 + nToMode = nToA = nToB = nToC = 0;
12367 + sal_Int16 nColorSpace = xColor->getColorInterpolation();
12369 + Any aAny( xColor->getBy() );
12370 + if ( aAny.hasValue() )
12372 + if ( getColorAny( aAny, nColorSpace, nByMode, nByA, nByB, nByC ) )
12375 + aAny = xColor->getFrom();
12376 + if ( aAny.hasValue() )
12378 + if ( getColorAny( aAny, nColorSpace, nFromMode, nFromA, nFromB, nFromC ) )
12381 + aAny = xColor->getTo();
12382 + if ( aAny.hasValue() )
12384 + if ( getColorAny( aAny, nColorSpace, nToMode, nToA, nToB, nToC ) )
12388 + << nByMode << nByA << nByB << nByC
12389 + << nFromMode << nFromA << nFromB << nFromC
12390 + << nToMode << nToA << nToB << nToC;
12392 + exportAnimateTarget( rStrm, xNode, 0, nAfterEffectType );
12396 +void AnimationExporter::exportIterate( SvStream& rStrm, const Reference< XAnimationNode >& xNode )
12398 + Reference< XIterateContainer > xIterate( xNode, UNO_QUERY );
12399 + if ( xIterate.is() )
12401 + EscherExAtom aAnimIteration( rStrm, DFF_msofbtAnimIteration );
12403 + float fInterval = 10.0;
12404 + sal_Int32 nTextUnitEffect = 0;
12405 + sal_Int32 nU1 = 1;
12406 + sal_Int32 nU2 = 1;
12407 + sal_Int32 nU3 = 0xe;
12409 + sal_Int16 nIterateType = xIterate->getIterateType();
12410 + switch( nIterateType )
12412 + case TextAnimationType::BY_WORD : nTextUnitEffect = 1; break;
12413 + case TextAnimationType::BY_LETTER : nTextUnitEffect = 2; break;
12416 + fInterval = (float)xIterate->getIterateInterval();
12418 + // convert interval from absolute to percentage
12419 + double fDuration = 0.0;
12421 + Reference< XEnumerationAccess > xEnumerationAccess( xNode, UNO_QUERY );
12422 + if( xEnumerationAccess.is() )
12424 + Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY );
12425 + if( xEnumeration.is() )
12427 + while( xEnumeration->hasMoreElements() )
12429 + Reference< XAnimate > xChildNode( xEnumeration->nextElement(), UNO_QUERY );
12430 + if( xChildNode.is() )
12432 + double fChildBegin = 0.0;
12433 + double fChildDuration = 0.0;
12434 + xChildNode->getBegin() >>= fChildBegin;
12435 + xChildNode->getDuration() >>= fChildDuration;
12437 + fChildDuration += fChildBegin;
12438 + if( fChildDuration > fDuration )
12439 + fDuration = fChildDuration;
12446 + fInterval = (float)(100.0 * fInterval / fDuration);
12448 + rStrm << fInterval << nTextUnitEffect << nU1 << nU2 << nU3;
12449 + aTarget = xIterate->getTarget();
12453 +} // namespace ppt;
12455 diff --git a/sd/source/filter/pptx/pptx-pptexsoundcollection.cxx b/sd/source/filter/pptx/pptx-pptexsoundcollection.cxx
12456 new file mode 100644
12457 index 0000000..fe8616c
12459 +++ sd/source/filter/pptx/pptx-pptexsoundcollection.cxx
12461 +/*************************************************************************
12463 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
12465 + * Copyright 2008 by Sun Microsystems, Inc.
12467 + * OpenOffice.org - a multi-platform office productivity suite
12469 + * $RCSfile: pptexsoundcollection.cxx,v $
12470 + * $Revision: 1.7 $
12472 + * This file is part of OpenOffice.org.
12474 + * OpenOffice.org is free software: you can redistribute it and/or modify
12475 + * it under the terms of the GNU Lesser General Public License version 3
12476 + * only, as published by the Free Software Foundation.
12478 + * OpenOffice.org is distributed in the hope that it will be useful,
12479 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12480 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12481 + * GNU Lesser General Public License version 3 for more details
12482 + * (a copy is included in the LICENSE file that accompanied this code).
12484 + * You should have received a copy of the GNU Lesser General Public License
12485 + * version 3 along with OpenOffice.org. If not, see
12486 + * <http://www.openoffice.org/license.html>
12487 + * for a copy of the LGPLv3 License.
12489 + ************************************************************************/
12491 +// MARKER(update_precomp.py): autogen include statement, do not remove
12492 +#include "precompiled_sd.hxx"
12493 +#include <pptexsoundcollection.hxx>
12494 +#include "epptdef.hxx"
12495 +#include <tools/urlobj.hxx>
12496 +#ifndef _UCBHELPER_CONTENT_HXX_
12497 +#include <ucbhelper/content.hxx>
12499 +#ifndef _UCBHELPER_CONTENTBROKER_HXX_
12500 +#include <ucbhelper/contentbroker.hxx>
12502 +#ifndef _CPPUHELPER_PROPTYPEHLP_HXX_
12503 +#include <cppuhelper/proptypehlp.hxx>
12505 +#include <unotools/ucbstreamhelper.hxx>
12510 +ExSoundEntry::ExSoundEntry( const String& rString )
12512 +, aSoundURL( rString )
12516 + ::ucbhelper::Content aCnt( aSoundURL,
12517 + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
12518 + sal_Int64 nVal = 0;
12519 + ::cppu::convertPropertyValue( nVal, aCnt.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ) ) );
12520 + nFileSize = (sal_uInt32)nVal;
12522 + catch( ::com::sun::star::uno::Exception& )
12528 +String ExSoundEntry::ImplGetName() const
12530 + INetURLObject aTmp( aSoundURL );
12531 + return aTmp.GetName();
12534 +String ExSoundEntry::ImplGetExtension() const
12536 + INetURLObject aTmp( aSoundURL );
12537 + String aExtension( aTmp.GetExtension() );
12538 + if ( aExtension.Len() )
12539 + aExtension.Insert( (sal_Unicode)'.', 0 );
12540 + return aExtension;
12543 +sal_Bool ExSoundEntry::IsSameURL( const String& rURL ) const
12545 + return ( rURL == aSoundURL );
12548 +sal_uInt32 ExSoundEntry::GetSize( sal_uInt32 nId ) const
12550 + String aName( ImplGetName() );
12551 + String aExtension( ImplGetExtension() );
12553 + sal_uInt32 nSize = 8; // SoundContainer Header
12554 + if ( aName.Len() ) // String Atom ( instance 0 - name of sound )
12555 + nSize += aName.Len() * 2 + 8;
12556 + if ( aExtension.Len() ) // String Atom ( instance 1 - extension of sound )
12557 + nSize += aExtension.Len() * 2 + 8;
12559 + String aId( String::CreateFromInt32( nId ) ); // String Atom ( instance 2 - reference id )
12560 + nSize += 2 * aId.Len() + 8;
12562 + nSize += nFileSize + 8; // SoundData Atom
12567 +void ExSoundEntry::Write( SvStream& rSt, sal_uInt32 nId )
12571 + ::ucbhelper::Content aCnt( aSoundURL,
12572 + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() );
12574 + // create SoundContainer
12575 + rSt << (sal_uInt32)( ( EPP_Sound << 16 ) | 0xf ) << (sal_uInt32)( GetSize( nId ) - 8 );
12577 + String aSoundName( ImplGetName() );
12578 + sal_uInt16 i, nSoundNameLen = aSoundName.Len();
12579 + if ( nSoundNameLen )
12581 + // name of sound ( instance 0 )
12582 + rSt << (sal_uInt32)( EPP_CString << 16 ) << (sal_uInt32)( nSoundNameLen * 2 );
12583 + for ( i = 0; i < nSoundNameLen; i++ )
12584 + rSt << aSoundName.GetChar( i );
12586 + String aExtension( ImplGetExtension() );
12587 + sal_uInt32 nExtensionLen = aExtension.Len();
12588 + if ( nExtensionLen )
12590 + // extension of sound ( instance 1 )
12591 + rSt << (sal_uInt32)( ( EPP_CString << 16 ) | 16 ) << (sal_uInt32)( nExtensionLen * 2 );
12592 + for ( i = 0; i < nExtensionLen; i++ )
12593 + rSt << aExtension.GetChar( i );
12595 + // id of sound ( instance 2 )
12596 + String aId( String::CreateFromInt32( nId ) );
12597 + sal_uInt32 nIdLen = aId.Len();
12598 + rSt << (sal_uInt32)( ( EPP_CString << 16 ) | 32 ) << (sal_uInt32)( nIdLen * 2 );
12599 + for ( i = 0; i < nIdLen; i++ )
12600 + rSt << aId.GetChar( i );
12602 + rSt << (sal_uInt32)( EPP_SoundData << 16 ) << (sal_uInt32)( nFileSize );
12603 + sal_uInt32 nBytesLeft = nFileSize;
12604 + SvStream* pSourceFile = ::utl::UcbStreamHelper::CreateStream( aSoundURL, STREAM_READ );
12605 + if ( pSourceFile )
12607 + sal_uInt8* pBuf = new sal_uInt8[ 0x10000 ]; // 64 kB Buffer
12608 + while ( nBytesLeft )
12610 + sal_uInt32 nToDo = ( nBytesLeft > 0x10000 ) ? 0x10000 : nBytesLeft;
12611 + pSourceFile->Read( pBuf, nToDo );
12612 + rSt.Write( pBuf, nToDo );
12613 + nBytesLeft -= nToDo;
12615 + delete pSourceFile;
12619 + catch( ::com::sun::star::uno::Exception& )
12625 +ExSoundCollection::~ExSoundCollection()
12627 + for( void* pPtr = List::First(); pPtr; pPtr = List::Next() )
12628 + delete (ExSoundEntry*)pPtr;
12631 +sal_uInt32 ExSoundCollection::GetId( const String& rString )
12633 + sal_uInt32 nSoundId = 0;
12634 + if( rString.Len() )
12636 + const sal_uInt32 nSoundCount = Count();
12638 + for( ; nSoundId < nSoundCount; nSoundId++ )
12639 + if( ImplGetByIndex( nSoundId )->IsSameURL( rString ) )
12641 + if ( nSoundId++ == nSoundCount )
12643 + ExSoundEntry* pEntry = new ExSoundEntry( rString );
12644 + if ( pEntry->GetFileSize() )
12645 + List::Insert( pEntry, LIST_APPEND );
12648 + nSoundId = 0; // only insert sounds that are accessible
12656 +const ExSoundEntry* ExSoundCollection::ImplGetByIndex( sal_uInt32 nIndex ) const
12658 + return (ExSoundEntry*)List::GetObject( nIndex );
12661 +sal_uInt32 ExSoundCollection::GetSize() const
12663 + sal_uInt32 nSize = 0;
12664 + sal_uInt32 i, nSoundCount = Count();
12665 + if ( nSoundCount )
12667 + nSize += 8 + 12; // size of SoundCollectionContainerHeader + SoundCollAtom
12668 + for ( i = 0; i < nSoundCount; i++ )
12669 + nSize += ImplGetByIndex( i )->GetSize( i + 1 );
12674 +void ExSoundCollection::Write( SvStream& rSt )
12676 + sal_uInt32 i, nSoundCount = Count();
12677 + if ( nSoundCount )
12679 + // create SoundCollection Container
12680 + rSt << (sal_uInt16)0xf << (sal_uInt16)EPP_SoundCollection << (sal_uInt32)( GetSize() - 8 );
12682 + // create SoundCollAtom ( reference to the next free SoundId );
12683 + rSt << (sal_uInt32)( EPP_SoundCollAtom << 16 ) << (sal_uInt32)4 << nSoundCount;
12685 + for ( i = 0; i < nSoundCount; i++ )
12686 + ((ExSoundEntry*)List::GetObject( i ))->Write( rSt, i + 1 );
12691 +} // namespace ppt;
12693 diff --git a/sd/util/makefile.mk b/sd/util/makefile.mk
12694 index fb5e7af..08c64d0 100644
12695 --- sd/util/makefile.mk
12696 +++ sd/util/makefile.mk
12697 @@ -270,6 +270,36 @@ SHL5STDLIBS = $(ISDLIB) \
12701 +# pptx export library
12702 +SHL6TARGET = pptx$(DLLPOSTFIX)
12703 +SHL6IMPLIB = pptxi
12704 +SHL6VERSIONMAP= pptx.map
12705 +SHL6DEF = $(MISC)$/$(SHL6TARGET).def
12706 +SHL6LIBS = $(SLB)$/pptx.lib
12707 +SHL6DEPN = $(SHL1TARGETN)
12708 +DEF6NAME = $(SHL6TARGET)
12710 +SHL6STDLIBS = $(ISDLIB) \
12712 + $(SVXMSFILTERLIB) \
12722 + $(UCBHELPERLIB) \
12723 + $(CPPUHELPERLIB) \
12726 + $(COMPHELPERLIB) \
12727 + $(I18NISOLANGLIB) \
12731 # --- Targets -------------------------------------------------------------
12733 .INCLUDE : target.mk
12734 diff --git a/sd/util/pptx.map b/sd/util/pptx.map
12735 new file mode 100644
12736 index 0000000..e72a8e3
12738 +++ sd/util/pptx.map
12742 + component_getImplementationEnvironment;
12743 + component_writeInfo;
12744 + component_getFactory;