xref: /AOO41X/main/sd/source/filter/eppt/eppt.hxx (revision 704461710d6b0b9df7a233b5bdb473de2e95718a)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _EPPT_HXX_
25 #define _EPPT_HXX_
26 #include <vector>
27 #ifndef _PptEscherEx_HXX
28 #include "escherex.hxx"
29 #endif
30 #include <tools/solar.h>
31 #include <sot/storage.hxx>
32 #include <tools/gen.hxx>
33 #include <vcl/graph.hxx>
34 #include <unotools/fontcvt.hxx>
35 #include <tools/string.hxx>
36 #include "pptexanimations.hxx"
37 #include <pptexsoundcollection.hxx>
38 
39 // ------------------------------------------------------------------------
40 
41 #include <vcl/mapmod.hxx>
42 #include <com/sun/star/uno/Any.hxx>
43 #include <com/sun/star/frame/XModel.hpp>
44 #include <com/sun/star/drawing/FillStyle.hpp>
45 #include <com/sun/star/drawing/LineStyle.hpp>
46 #include <com/sun/star/drawing/DashStyle.hpp>
47 #include <com/sun/star/drawing/HatchStyle.hpp>
48 #include <com/sun/star/drawing/LineEndType.hpp>
49 #include <com/sun/star/drawing/Alignment.hpp>
50 #include <com/sun/star/drawing/TextAdjust.hpp>
51 #include <com/sun/star/drawing/CircleKind.hpp>
52 #include <com/sun/star/drawing/PolygonKind.hpp>
53 #include <com/sun/star/drawing/PolygonFlags.hpp>
54 #include <com/sun/star/drawing/XUniversalShapeDescriptor.hpp>
55 #include <com/sun/star/drawing/XShapeGrouper.hpp>
56 #include <com/sun/star/text/XSimpleText.hpp>
57 #include <com/sun/star/drawing/XConnectorShape.hpp>
58 #include <com/sun/star/drawing/BezierPoint.hpp>
59 #include <com/sun/star/drawing/Hatch.hpp>
60 #include <com/sun/star/drawing/LineDash.hpp>
61 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
62 #include <com/sun/star/presentation/XPresentationSupplier.hpp>
63 #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
64 #include <com/sun/star/drawing/XMasterPageTarget.hpp>
65 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
66 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
67 #include <com/sun/star/awt/XGraphics.hpp>
68 #include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
69 #include <com/sun/star/presentation/AnimationEffect.hpp>
70 #include <com/sun/star/presentation/FadeEffect.hpp>
71 #include <com/sun/star/presentation/ClickAction.hpp>
72 #include <com/sun/star/presentation/AnimationSpeed.hpp>
73 #include <com/sun/star/presentation/PresentationRange.hpp>
74 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
75 #include <com/sun/star/text/XTextField.hpp>
76 #include <com/sun/star/container/XNamed.hpp>
77 #include <com/sun/star/awt/FontDescriptor.hpp>
78 #include <com/sun/star/container/XIndexContainer.hpp>
79 #include <com/sun/star/awt/XControlModel.hpp>
80 #include <com/sun/star/style/TabStop.hpp>
81 #include <filter/msfilter/msocximex.hxx>
82 #include <com/sun/star/beans/XPropertySet.hpp>
83 #include <com/sun/star/beans/XPropertyState.hpp>
84 #include <com/sun/star/beans/XPropertySetInfo.hpp>
85 #include <com/sun/star/awt/FontFamily.hpp>
86 #include <com/sun/star/awt/FontPitch.hpp>
87 #include <com/sun/star/awt/CharSet.hpp>
88 #include <com/sun/star/text/WritingMode.hpp>
89 #include <com/sun/star/lang/Locale.hpp>
90 
91 enum PageType { NORMAL = 0, MASTER = 1, NOTICE = 2, UNDEFINED = 3 };
92 
93 #define EPP_MAINMASTER_PERSIST_KEY      0x80010000
94 #define EPP_MAINNOTESMASTER_PERSIST_KEY 0x80020000
95 #define EPP_MAINSLIDE_PERSIST_KEY       0x80030000
96 #define EPP_MAINNOTES_PERSIST_KEY       0x80040000
97 
98 #define EPP_Persist_Document            0x80080000
99 #define EPP_Persist_MainMaster          0x80100000
100 #define EPP_Persist_MainNotes           0x80200000
101 #define EPP_Persist_Slide               0x80400000
102 #define EPP_Persist_Notes               0x80800000
103 #define EPP_Persist_CurrentPos          0x81000000
104 #define EPP_Persist_VBAInfoAtom         0x84000000
105 #define EPP_Persist_ExObj               0x88000000
106 
107 #define EPP_TEXTSTYLE_NORMAL            0x00000001
108 #define EPP_TEXTSTYLE_TITLE             0x00000010
109 #define EPP_TEXTSTYLE_BODY              0x00000100
110 #define EPP_TEXTSTYLE_TEXT              0x00001000
111 
112 // PLACEMENT_ID
113 #define EPP_LAYOUT_TITLESLIDE             0 /* The slide is a title slide                                                             */
114 #define EPP_LAYOUT_TITLEANDBODYSLIDE      1 /* Title and body slide                                                                   */
115 #define EPP_LAYOUT_TITLEMASTERSLIDE       2 /* Title master slide                                                                     */
116 #define EPP_LAYOUT_MASTERSLIDE            3 /* Master slide layout                                                                    */
117 #define EPP_LAYOUT_MASTERNOTES            4 /* Master notes layout                                                                    */
118 #define EPP_LAYOUT_NOTESTITLEBODY         5 /* Notes title/body layout                                                                */
119 #define EPP_LAYOUT_HANDOUTLAYOUT          6 /* Handout layout, therefore it doesn't have placeholders except header, footer, and date */
120 #define EPP_LAYOUT_ONLYTITLE              7 /* Only title placeholder                                                                 */
121 #define EPP_LAYOUT_2COLUMNSANDTITLE       8 /* Body of the slide has 2 columns and a title                                            */
122 #define EPP_LAYOUT_2ROWSANDTITLE          9 /* Slide's body has 2 rows and a title                                                    */
123 #define EPP_LAYOUT_RIGHTCOLUMN2ROWS      10 /* Body contains 2 columns, right column has 2 rows                                       */
124 #define EPP_LAYOUT_LEFTCOLUMN2ROWS       11 /* Body contains 2 columns, left column has 2 rows                                        */
125 #define EPP_LAYOUT_BOTTOMROW2COLUMNS     12 /* Body contains 2 rows, bottom row has 2 columns                                         */
126 #define EPP_LAYOUT_TOPROW2COLUMN         13 /* Body contains 2 rows, top row has 2 columns                                            */
127 #define EPP_LAYOUT_4OBJECTS              14 /* 4 objects                                                                              */
128 #define EPP_LAYOUT_BIGOBJECT             15 /* Big object                                                                             */
129 #define EPP_LAYOUT_BLANCSLIDE            16 /* Blank slide                                                                            */
130 #define EPP_LAYOUT_TITLERIGHTBODYLEFT    17 /* Vertical title on the right, body on the left                                          */
131 #define EPP_LAYOUT_TITLERIGHT2BODIESLEFT 18 /* Vertical title on the right, body on the left split into 2 rows                        */
132 
133 class Polygon;
134 class PptEscherEx;
135 class XStatusIndicatorRef;
136 
137 struct PHLayout
138 {
139     sal_Int32   nLayout;
140     sal_uInt8   nPlaceHolder[ 8 ];
141 
142     sal_uInt8   nUsedObjectPlaceHolder;
143     sal_uInt8   nTypeOfTitle;
144     sal_uInt8   nTypeOfOutliner;
145 
146     sal_Bool    bTitlePossible;
147     sal_Bool    bOutlinerPossible;
148     sal_Bool    bSecOutlinerPossible;
149 };
150 
151 struct SOParagraph
152 {
153     sal_Bool                bExtendedParameters;
154     sal_uInt32              nParaFlags;
155     sal_Int16               nBulletFlags;
156     String                  sPrefix;
157     String                  sSuffix;
158     String                  sGraphicUrl;            // String auf eine Graphic
159     Size                    aBuGraSize;
160     sal_uInt32              nNumberingType;         // in wirlichkeit ist dies ein SvxEnum
161     sal_uInt32              nHorzAdjust;
162     sal_uInt32              nBulletColor;
163     sal_Int32               nBulletOfs;
164     sal_Int16               nStartWith;             // Start der nummerierung
165     sal_Int16               nTextOfs;
166     sal_Int16               nBulletRealSize;        // GroessenVerhaeltnis in Proz
167     sal_Int16               nDepth;                 // aktuelle tiefe
168     sal_Unicode             cBulletId;              // wenn Numbering Type == CharSpecial
169     ::com::sun::star::awt::FontDescriptor       aFontDesc;
170 
171     sal_Bool                bExtendedBulletsUsed;
172     sal_uInt16              nBulletId;
173     sal_uInt32              nMappedNumType;
174     sal_Bool                bNumberingIsNumber;
175 
SOParagraphSOParagraph176     SOParagraph()
177     {
178         nDepth = 0;
179         bExtendedParameters = sal_False;
180         nParaFlags = 0;
181         nBulletFlags = 0;
182         nBulletOfs = 0;
183         nTextOfs = 0;
184         bExtendedBulletsUsed = sal_False;
185         nBulletId = 0xffff;
186         bNumberingIsNumber = sal_True;
187     };
188 };
189 
190 // ------------------------------------------------------------------------
191 
192 class EscherGraphicProvider;
193 class PPTExBulletProvider
194 {
195     friend struct PPTExParaSheet;
196 
197     protected :
198 
199         SvMemoryStream          aBuExPictureStream;
200         SvMemoryStream          aBuExOutlineStream;
201         SvMemoryStream          aBuExMasterStream;
202 
203         EscherGraphicProvider*  pGraphicProv;
204 
205     public :
206 
207         sal_uInt16              GetId( const ByteString& rUniqueId, Size& rGraphicSize );
208 
209                                 PPTExBulletProvider();
210                                 ~PPTExBulletProvider();
211 };
212 
213 struct FontCollectionEntry
214 {
215         String                  Name;
216         double                  Scaling;
217         sal_Int16               Family;
218         sal_Int16               Pitch;
219         sal_Int16               CharSet;
220 
221         String                  Original;
222         sal_Bool                bIsConverted;
223 
FontCollectionEntryFontCollectionEntry224         FontCollectionEntry( const String& rName, sal_Int16 nFamily, sal_Int16 nPitch, sal_Int16 nCharSet ) :
225                             Scaling ( 1.0 ),
226                             Family  ( nFamily ),
227                             Pitch   ( nPitch ),
228                             CharSet ( nCharSet ),
229                             Original( rName )
230                             {
231                                 ImplInit( rName );
232                             };
233 
FontCollectionEntryFontCollectionEntry234         FontCollectionEntry( const String& rName ) :
235                             Scaling ( 1.0 ),
236                             Original( rName )
237                             {
238                                 ImplInit( rName );
239                             };
240         ~FontCollectionEntry();
241 
242     private :
243 
FontCollectionEntryFontCollectionEntry244         FontCollectionEntry() {};
245 
246         void ImplInit( const String& rName );
247 };
248 
249 class VirtualDevice;
250 class FontCollection : private List
251 {
252         VirtualDevice* pVDev;
253     public :
254                     FontCollection();
255                     ~FontCollection();
256 
257         short       GetScriptDirection( const String& rText ) const;
258         sal_uInt32  GetId( FontCollectionEntry& rFontDescriptor );
GetCount() const259         sal_uInt32  GetCount() const { return List::Count(); };
260         const FontCollectionEntry*                      GetById( sal_uInt32 nId );
GetLast()261         FontCollectionEntry&    GetLast() { return *(FontCollectionEntry*)List::Last(); };
262 };
263 
264 // ------------------------------------------------------------------------
265 
266 #define PPTEX_STYLESHEETENTRYS  9
267 
268 enum PPTExTextAttr
269 {
270     ParaAttr_BulletOn,
271     ParaAttr_BuHardFont,
272     ParaAttr_BuHardColor,
273     ParaAttr_BuHardHeight,
274     ParaAttr_BulletChar,
275     ParaAttr_BulletFont,
276     ParaAttr_BulletHeight,
277     ParaAttr_BulletColor,
278     ParaAttr_Adjust,
279     ParaAttr_LineFeed,
280     ParaAttr_UpperDist,
281     ParaAttr_LowerDist,
282     ParaAttr_TextOfs,
283     ParaAttr_BulletOfs,
284     ParaAttr_DefaultTab,
285     ParaAttr_AsianLB_1,
286     ParaAttr_AsianLB_2,
287     ParaAttr_AsianLB_3,
288     ParaAttr_BiDi,
289     CharAttr_Bold,
290     CharAttr_Italic,
291     CharAttr_Underline,
292     CharAttr_Shadow,
293     CharAttr_Strikeout,
294     CharAttr_Embossed,
295     CharAttr_Font,
296     CharAttr_AsianOrComplexFont,
297     CharAttr_Symbol,
298     CharAttr_FontHeight,
299     CharAttr_FontColor,
300     CharAttr_Escapement
301 };
302 
303 struct PPTExCharLevel
304 {
305     sal_uInt16      mnFlags;
306     sal_uInt16      mnFont;
307     sal_uInt16      mnAsianOrComplexFont;
308     sal_uInt16      mnFontHeight;
309     sal_uInt16      mnEscapement;
310     sal_uInt32      mnFontColor;
311 };
312 
313 struct PPTExCharSheet
314 {
315                 PPTExCharLevel  maCharLevel[ 5 ];
316 
317                 PPTExCharSheet( int nInstance );
318 
319                 void    SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
320                                         FontCollection& rFontCollection, int nLevel );
321                 void    Write( SvStream& rSt, PptEscherEx* pEx, sal_uInt16 nLev, sal_Bool bFirst, sal_Bool bSimpleText,
322                             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet );
323 
324 };
325 
326 struct PPTExParaLevel
327 {
328     sal_Bool        mbIsBullet;
329     sal_uInt16      mnBulletChar;
330     sal_uInt16      mnBulletFont;
331     sal_uInt16      mnBulletHeight;
332     sal_uInt32      mnBulletColor;
333 
334     sal_uInt16      mnAdjust;
335     sal_uInt16      mnLineFeed;
336     sal_uInt16      mnUpperDist;
337     sal_uInt16      mnLowerDist;
338     sal_uInt16      mnTextOfs;
339     sal_uInt16      mnBulletOfs;
340     sal_uInt16      mnDefaultTab;
341 
342     sal_Bool        mbExtendedBulletsUsed;
343     sal_uInt16      mnBulletId;
344     sal_uInt16      mnBulletStart;
345     sal_uInt32      mnMappedNumType;
346     sal_uInt32      mnNumberingType;
347     sal_uInt16      mnAsianSettings;
348     sal_uInt16      mnBiDi;
349 };
350 
351 struct PPTExParaSheet
352 {
353                 PPTExBulletProvider& rBuProv;
354 
355                 sal_uInt32  mnInstance;
356 
357                 PPTExParaLevel  maParaLevel[ 5 ];
358                 PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv );
359 
360                 void    SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
361                                         FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel );
362                 void    Write( SvStream& rSt, PptEscherEx* pEx, sal_uInt16 nLev, sal_Bool bFirst, sal_Bool bSimpleText,
363                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet );
364 };
365 
366 class PPTExStyleSheet
367 {
368 
369     public :
370 
371                 PPTExCharSheet*     mpCharSheet[ PPTEX_STYLESHEETENTRYS ];
372                 PPTExParaSheet*     mpParaSheet[ PPTEX_STYLESHEETENTRYS ];
373 
374                 PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv );
375                 ~PPTExStyleSheet();
376 
GetParaSheet(int nInstance)377                 PPTExParaSheet& GetParaSheet( int nInstance ) { return *mpParaSheet[ nInstance ]; };
GetCharSheet(int nInstance)378                 PPTExCharSheet& GetCharSheet( int nInstance ) { return *mpCharSheet[ nInstance ]; };
379 
380                 void            SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
381                                                 FontCollection& rFontCollection, int nInstance, int nLevel );
382                 sal_Bool        IsHardAttribute( sal_uInt32 nInstance, sal_uInt32 nLevel, PPTExTextAttr eAttr, sal_uInt32 nValue );
383 
384                 sal_uInt32      SizeOfTxCFStyleAtom() const;
385                 void            WriteTxCFStyleAtom( SvStream& rSt );
386 };
387 
388 
389 struct EPPTHyperlink
390 {
391     String      aURL;
392     sal_uInt32  nType;      // bit 0-7 : type       ( 1: click action to a slide )
393                             //                      ( 2: hyperlink url )
394                             // bit 8-23: index
395                             // bit 31  : hyperlink is attached to a shape
396 
EPPTHyperlinkEPPTHyperlink397     EPPTHyperlink( const String rURL, sal_uInt32 nT ) :
398         aURL        ( rURL ),
399         nType       ( nT ){};
400 };
401 
402 enum PPTExOleObjEntryType
403 {
404     NORMAL_OLE_OBJECT, OCX_CONTROL
405 };
406 
407 struct PPTExOleObjEntry
408 {
409     PPTExOleObjEntryType    eType;
410     sal_uInt32              nOfsA;          // offset to the EPP_ExOleObjAtom in mpExEmbed (set at creation)
411     sal_uInt32              nOfsB;          // offset to the EPP_ExOleObjStg
412 
413     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >    xControlModel;
414     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >       xShape;
415 
PPTExOleObjEntryPPTExOleObjEntry416     PPTExOleObjEntry( PPTExOleObjEntryType eT, sal_uInt32 nOfs ) :
417         eType   ( eT ),
418         nOfsA   ( nOfs ) {};
419 };
420 
421 struct TextRuleEntry
422 {
423     int                 nPageNumber;
424     SvMemoryStream*     pOut;
425 
TextRuleEntryTextRuleEntry426     TextRuleEntry( int nPg ) :
427         nPageNumber( nPg ),
428         pOut ( NULL ){};
429 
~TextRuleEntryTextRuleEntry430     ~TextRuleEntry() { delete pOut; };
431 };
432 
433 // ------------------------------------------------------------------------
434 
435 struct GroupEntry
436 {
437         sal_uInt32                  mnCurrentPos;
438         sal_uInt32                  mnCount;
439         ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >           mXIndexAccess;
GroupEntryGroupEntry440                                 GroupEntry( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & rIndex )
441                                 {
442                                     mXIndexAccess = rIndex;
443                                     mnCount =mXIndexAccess->getCount();
444                                     mnCurrentPos = 0;
445                                 };
GroupEntryGroupEntry446                                 GroupEntry( sal_uInt32 nCount )
447                                 {
448                                     mnCount = nCount;
449                                     mnCurrentPos = 0;
450                                 };
~GroupEntryGroupEntry451                                 ~GroupEntry(){};
452 };
453 
454 // ------------------------------------------------------------------------
455 
456 class GroupTable
457 {
458     protected:
459 
460         sal_uInt32              mnIndex;
461         sal_uInt32              mnCurrentGroupEntry;
462         sal_uInt32              mnMaxGroupEntry;
463         sal_uInt32              mnGroupsClosed;
464         GroupEntry**            mpGroupEntry;
465 
466         void                    ImplResizeGroupTable( sal_uInt32 nEntrys );
467 
468     public:
469 
GetCurrentGroupIndex() const470         sal_uInt32              GetCurrentGroupIndex() const { return mnIndex; };
GetCurrentGroupLevel() const471         sal_Int32               GetCurrentGroupLevel() const { return mnCurrentGroupEntry - 1; };
472         ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > &
GetCurrentGroupAccess() const473                                 GetCurrentGroupAccess() const { return mpGroupEntry[  mnCurrentGroupEntry - 1 ]->mXIndexAccess; };
474         sal_uInt32              GetGroupsClosed();
475         void                    ResetGroupTable( sal_uInt32 nCount );
476         void                    ClearGroupTable();
477         sal_Bool                EnterGroup( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & rIndex );
478         sal_Bool                GetNextGroupEntry();
479                                 GroupTable();
480                                 ~GroupTable();
481 };
482 
483 class PropValue
484 {
485     protected :
486 
487         ::com::sun::star::uno::Any                              mAny;
488 
489         ::com::sun::star::uno::Reference
490             < ::com::sun::star::beans::XPropertySet >           mXPropSet;
491 
492         sal_Bool    ImplGetPropertyValue( const String& rString );
493         sal_Bool    ImplGetPropertyValue( const ::com::sun::star::uno::Reference
494                         < ::com::sun::star::beans::XPropertySet > &, const String& );
495 
496     public :
497 
498         static sal_Bool GetPropertyValue(
499                 ::com::sun::star::uno::Any& rAny,
500                     const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
501                         const String& rPropertyName,
502                             sal_Bool bTestPropertyAvailability = sal_False );
503 
504         static ::com::sun::star::beans::PropertyState GetPropertyState(
505                     const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > &,
506                         const String& rPropertyName );
507 };
508 
509 class PropStateValue : public PropValue
510 {
511     protected :
512 
513         ::com::sun::star::beans::PropertyState                  ePropState;
514         ::com::sun::star::uno::Reference
515             < ::com::sun::star::beans::XPropertyState >         mXPropState;
516 
517         sal_Bool    ImplGetPropertyValue( const String& rString, sal_Bool bGetPropertyState = sal_True );
518 
519 };
520 
521 // ------------------------------------------------------------------------
522 
523 struct FieldEntry;
524 class PortionObj : public PropStateValue
525 {
526 
527     friend class ParagraphObj;
528 
529     protected :
530 
531         void            ImplClear();
532         void            ImplConstruct( const PortionObj& rPortionObj );
533         sal_uInt32      ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef,
534                             const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, String& rURL );
535         sal_uInt32      ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
536         void            ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool bGetPropStateValue = sal_False );
537 
538     public :
539 
540         ::com::sun::star::beans::PropertyState  meCharColor;
541         ::com::sun::star::beans::PropertyState  meCharHeight;
542         ::com::sun::star::beans::PropertyState  meFontName;
543         ::com::sun::star::beans::PropertyState  meAsianOrComplexFont;
544         ::com::sun::star::beans::PropertyState  meCharEscapement;
545         ::com::sun::star::lang::Locale          meCharLocale;
546         sal_uInt16      mnCharAttrHard;
547 
548         sal_uInt32      mnCharColor;
549         sal_uInt16      mnCharAttr;
550         sal_uInt16      mnCharHeight;
551         sal_uInt16      mnFont;
552         sal_uInt16      mnAsianOrComplexFont;
553         sal_Int16       mnCharEscapement;
554 
555         sal_uInt32      mnTextSize;
556         sal_Bool        mbLastPortion;
557 
558         sal_uInt16*     mpText;
559         FieldEntry*     mpFieldEntry;
560 
561                         PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef,
562                                         sal_Bool bLast, FontCollection& rFontCollection );
563                         PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
564                                         FontCollection& rFontCollection );
565                         PortionObj( const PortionObj& rPortionObj );
566                         ~PortionObj();
567 
568         void            Write( SvStream* pStrm, sal_Bool bLast );
Count() const569         sal_uInt32      Count() const { return mnTextSize; };
570 
571         PortionObj&     operator=( const PortionObj& rPortionObj );
572 };
573 
574 struct ParaFlags
575 {
576     sal_Bool    bFirstParagraph : 1;
577     sal_Bool    bLastParagraph  : 1;
578 
ParaFlagsParaFlags579                     ParaFlags() { bFirstParagraph = sal_True; bLastParagraph = sal_False; };
580 };
581 
582 class ParagraphObj : public List, public PropStateValue, public SOParagraph
583 {
584     friend class TextObj;
585     friend struct PPTExParaSheet;
586 
587         MapMode         maMapModeSrc;
588         MapMode         maMapModeDest;
589 
590     protected :
591 
592         void            ImplConstruct( const ParagraphObj& rParagraphObj );
593         void            ImplClear();
594         sal_uInt32      ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
595         void            ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue = sal_False );
596         void            ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue = sal_False );
597 
598     public :
599 
600         ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > maTabStop;
601 
602         sal_uInt32          mnTextSize;
603 
604         sal_Bool            mbIsBullet;
605         sal_Bool            mbFirstParagraph;
606         sal_Bool            mbLastParagraph;
607 
608         ::com::sun::star::beans::PropertyState  meBullet;
609         ::com::sun::star::beans::PropertyState  meTextAdjust;
610         ::com::sun::star::beans::PropertyState  meLineSpacing;
611         ::com::sun::star::beans::PropertyState  meLineSpacingTop;
612         ::com::sun::star::beans::PropertyState  meLineSpacingBottom;
613         ::com::sun::star::beans::PropertyState  meForbiddenRules;
614         ::com::sun::star::beans::PropertyState  meParagraphPunctation;
615         ::com::sun::star::beans::PropertyState  meBiDi;
616 
617         sal_uInt16                              mnTextAdjust;
618         sal_Int16                               mnLineSpacing;
619         sal_Int16                               mnLineSpacingTop;
620         sal_Int16                               mnLineSpacingBottom;
621         sal_Bool                                mbForbiddenRules;
622         sal_Bool                                mbParagraphPunctation;
623         sal_uInt16                              mnBiDi;
624 
625                         ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContentRef,
626                             ParaFlags, FontCollection& rFontCollection,
627                                 PPTExBulletProvider& rBuProv );
628                         ParagraphObj( const ParagraphObj& rParargraphObj );
629                         ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
630                                         PPTExBulletProvider& rBuProv );
631 
632         void            CalculateGraphicBulletSize( sal_uInt16 nFontHeight );
633                         ~ParagraphObj();
634 
635         void            Write( SvStream* pStrm );
Count() const636         sal_uInt32          Count() const { return mnTextSize; };
637 
638         ParagraphObj&   operator=( const ParagraphObj& rParagraphObj );
639 };
640 
641 struct ImplTextObj
642 {
643     sal_uInt32      mnRefCount;
644     sal_uInt32      mnTextSize;
645     int             mnInstance;
646     List*           mpList;
647     sal_Bool        mbHasExtendedBullets;
648     sal_Bool        mbFixedCellHeightUsed;
649 
650                     ImplTextObj( int nInstance );
651                     ~ImplTextObj();
652 };
653 
654 class TextObj
655 {
656         mutable ImplTextObj*    mpImplTextObj;
657         void            ImplCalculateTextPositions();
658 
659     public :
660                         TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > &
661                                     rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv );
662                         TextObj( const TextObj& rTextObj );
663                         ~TextObj();
664 
665         void            Write( SvStream* pStrm );
666 
First()667         ParagraphObj*   First(){ return (ParagraphObj*)mpImplTextObj->mpList->First(); };
Next()668         ParagraphObj*   Next(){ return(ParagraphObj*)mpImplTextObj->mpList->Next(); };
Count() const669         sal_uInt32      Count() const { return mpImplTextObj->mnTextSize; };
GetInstance() const670         int             GetInstance() const { return mpImplTextObj->mnInstance; };
HasExtendedBullets()671         sal_Bool        HasExtendedBullets(){ return mpImplTextObj->mbHasExtendedBullets; };
672         void            WriteTextSpecInfo( SvStream* pStrm );
673 
674         TextObj&        operator=( TextObj& rTextObj );
675 };
676 
677 // ------------------------------------------------------------------------
678 struct CellBorder;
679 class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvider
680 {
681         sal_Bool                        mbStatus;
682         sal_Bool                        mbUseNewAnimations;
683         sal_uInt32                      mnStatMaxValue;
684         sal_uInt32                      mnLatestStatValue;
685         std::vector< PPTExStyleSheet* > maStyleSheetList;
686         PPTExStyleSheet*                mpStyleSheet;
687 
688         Fraction                        maFraction;
689         MapMode                         maMapModeSrc;
690         MapMode                         maMapModeDest;
691         ::com::sun::star::awt::Size     maDestPageSize;
692         Size                            maPageSize; // #121183# Keep size in logic coordinates (100th mm)
693         ::com::sun::star::awt::Size     maNotesPageSize;
694         PageType                        meLatestPageType;
695         List                            maSlideNameList;
696         rtl::OUString                   maBaseURI;
697 
698         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >                 mXModel;
699         ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >        mXStatusIndicator;
700         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPagesSupplier >   mXDrawPagesSupplier;
701         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPagesSupplier > mXMasterPagesSupplier;
702         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages >           mXDrawPages;
703         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >            mXDrawPage;
704         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >           mXPagePropSet;
705         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >           mXBackgroundPropSet;
706         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >              mXShapes;
707         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >               mXShape;
708         ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText >             mXText;             // TextRef des globalen Text
709         ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor >             mXCursor;
710         ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >              mXCursorText;       // TextRef des Teilstuecks des Cursors
711         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >           mXCursorPropSet;    // die Properties des Teilstueckes
712         ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField >              mXTextField;
713         ::com::sun::star::awt::Size         maSize;
714         ::com::sun::star::awt::Point        maPosition;
715         Rectangle           maRect;
716         ByteString          mType;
717         sal_Bool            mbPresObj;
718         sal_Bool            mbEmptyPresObj;
719         sal_Bool            mbStatusIndicator;
720         sal_Int32           mnAngle;
721         sal_uInt32          mnTextStyle;
722 
723         sal_Bool            mbFontIndependentLineSpacing;
724         sal_uInt32          mnTextSize;
725 
726         SvStorageRef        mrStg;
727         SvStream*           mpCurUserStrm;
728         SvStream*           mpStrm;
729         SvStream*           mpPicStrm;
730         PptEscherEx*        mpPptEscherEx;
731 
732         List                maExOleObj;
733         sal_uInt32          mnVBAOleOfs;
734         SvMemoryStream*     mpVBA;
735         sal_uInt32          mnExEmbed;
736         SvMemoryStream*     mpExEmbed;
737 
738         sal_uInt32          mnPages;            // anzahl einzelner Slides ( ohne masterpages & notes & handout )
739         sal_uInt32          mnMasterPages;      //
740         sal_uInt32          mnDrawings;         // anzahl Slides +  masterpages + notes +  handout
741         sal_uInt32          mnPagesWritten;
742         sal_uInt32          mnUniqueSlideIdentifier;
743         sal_uInt32          mnTxId;             // Identifier determined by the HOST (PP) ????
744         sal_uInt32          mnDiaMode;          // 0 -> manuell
745                                                 // 1 -> halbautomatisch
746                                                 // 2 -> automatisch
747 
748         sal_uInt32          mnShapeMasterTitle;
749         sal_uInt32          mnShapeMasterBody;
750 
751         List                maHyperlink;
752 
753         FontCollection          maFontCollection;
754         ppt::ExSoundCollection  maSoundCollection;
755 
756         PHLayout&           ImplGetLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const;
757         void                ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId );
758 
759 
760         sal_uInt32          ImplProgBinaryTag( SvStream* pOutStrm = NULL );
761         sal_uInt32          ImplProgBinaryTagContainer( SvStream* pOutStrm = NULL, SvMemoryStream* pBinTag = NULL );
762         sal_uInt32          ImplProgTagContainer( SvStream* pOutStrm = NULL, SvMemoryStream* pBinTag = NULL );
763         sal_uInt32          ImplOutlineViewInfoContainer( SvStream* pOutStrm = NULL );
764         sal_uInt32          ImplSlideViewInfoContainer( sal_uInt32 nInstance, SvStream* pOutStrm = NULL );
765         sal_uInt32          ImplVBAInfoContainer( SvStream* pOutStrm = NULL );
766         sal_uInt32          ImplDocumentListContainer( SvStream* pOutStrm = NULL );
767         sal_uInt32          ImplMasterSlideListContainer( SvStream* pOutStrm = NULL );
768 
769     public:
770         static void         WriteCString( SvStream&, const String&, sal_uInt32 nInstance = 0 );
771 
772     protected:
773 
774         sal_Bool            ImplCreateDocumentSummaryInformation( sal_uInt32 nCnvrtFlags );
775         sal_Bool            ImplCreateCurrentUserStream();
776         void                ImplCreateHeaderFooterStrings( SvStream& rOut,
777                                 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet );
778         void                ImplCreateHeaderFooters( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet );
779         sal_Bool            ImplCreateDocument();
780         sal_Bool            ImplCreateHyperBlob( SvMemoryStream& rStream );
781         sal_uInt32          ImplInsertBookmarkURL( const String& rBookmark, const sal_uInt32 nType,
782             const String& rStringVer0, const String& rStringVer1, const String& rStringVer2, const String& rStringVer3 );
783         sal_Bool            ImplCreateMaster( sal_uInt32 nPageNum );
784         sal_Bool            ImplCreateMainNotes();
785         sal_Bool            ImplCreateSlide( sal_uInt32 nPageNum );
786         sal_Bool            ImplCreateNotes( sal_uInt32 nPageNum );
787         void                ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXBackgroundPropSet );
788         void                ImplWriteVBA( SvMemoryStream* pVBA );
789         void                ImplWriteOLE( sal_uInt32 nCnvrtFlags );
790         sal_Bool            ImplWriteAtomEnding();
791 
792         sal_Bool            ImplInitSOIface();
793         sal_Bool            ImplSetCurrentStyleSheet( sal_uInt32 nPageNum );
794         sal_Bool            ImplGetPageByIndex( sal_uInt32 nIndex, PageType );
795         sal_Bool            ImplGetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup = sal_False );
796         sal_uInt32          ImplGetMasterIndex( PageType ePageType );
797         void                ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt );
798         sal_Bool            ImplGetText();
799         sal_Bool            ImplCreatePresentationPlaceholder( const sal_Bool bMaster, const PageType PageType,
800                                 const sal_uInt32 StyleInstance, const sal_uInt8 PlaceHolderId );
801         sal_Bool            ImplGetEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
802                                 ::com::sun::star::presentation::AnimationEffect& eEffect,
803                                 ::com::sun::star::presentation::AnimationEffect& eTextEffect,
804                                 sal_Bool& bHasSound );
805         void                ImplWriteObjectEffect( SvStream& rSt,
806                                 ::com::sun::star::presentation::AnimationEffect eEffect,
807                                 ::com::sun::star::presentation::AnimationEffect eTextEffect,
808                                 sal_uInt16 nOrder );
809         void                ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentation::ClickAction eAction, sal_Bool bMediaClickAction );
810         sal_Bool            ImplGetStyleSheets();
811         void                ImplWriteParagraphs( SvStream& rOutStrm, TextObj& rTextObj );
812         void                ImplWritePortions( SvStream& rOutStrm, TextObj& rTextObj );
813         void                ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance,
814                                 TextRuleEntry* pTextRule, SvStream& rExtBu, EscherPropertyContainer* );
815         void                ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt );
816         void                ImplCreateShape( sal_uInt32 nType, sal_uInt32 nFlags, EscherSolverContainer& );
817         void                ImplCreateTextShape( EscherPropertyContainer&, EscherSolverContainer&, sal_Bool bFill );
818 
819         void                ImplWritePage( const PHLayout& rLayout,
820                                                 EscherSolverContainer& rSolver,
821                                                     PageType ePageType,
822                                                         sal_Bool bMaster,
823                                                             int nPageNumber = 0 );
824         sal_Bool            ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 );
825         void                ImplCreateTable( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer,
826                                 EscherPropertyContainer& aPropOpt );
827         ::com::sun::star::awt::Point        ImplMapPoint( const ::com::sun::star::awt::Point& );
828         ::com::sun::star::awt::Size         ImplMapSize( const ::com::sun::star::awt::Size& );
829         Rectangle                           ImplMapRectangle( const ::com::sun::star::awt::Rectangle& );
830 
831         sal_Bool                            ImplCloseDocument();        // die font-, hyper-, Soundliste wird geschrieben ..
832 
833     public:
834                                 PPTWriter( const std::vector< com::sun::star::beans::PropertyValue >&, SvStorageRef& rSvStorage,
835                                             ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel,
836                                             ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rStatInd,
837                                                 SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags );
838 
839                                 ~PPTWriter();
840 
IsValid() const841         sal_Bool                IsValid() const { return mbStatus; };
842 };
843 
844 
845 #endif
846