xref: /AOO41X/main/filter/inc/filter/msfilter/svdfppt.hxx (revision 9dfa94006972403d4da45bb9d4b26585a3a98a43)
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 _SVDFPPT_HXX
25 #define _SVDFPPT_HXX
26 
27 #ifndef SVX_LIGHT
28 
29 #include <tools/solar.h>
30 #include <svl/svarray.hxx>
31 #include <tools/string.hxx>
32 #include <tools/gen.hxx>
33 #include <tools/color.hxx>
34 #include <svx/svdobj.hxx>
35 #include <editeng/numitem.hxx>
36 #include <editeng/editdata.hxx>
37 #include <filter/msfilter/msdffimp.hxx>         //  Escher-Grafikimport
38 #include <filter/msfilter/msocximex.hxx>
39 #include <filter/msfilter/msfiltertracer.hxx>
40 #include <editeng/eeitem.hxx>
41 #define ITEMID_FIELD EE_FEATURE_FIELD
42 #include <editeng/flditem.hxx>
43 #undef ITEMID_FIELD
44 #include "filter/msfilter/msfilterdllapi.h"
45 #include <vcl/font.hxx>
46 #include <vector>
47 #include <boost/optional.hpp>
48 ////////////////////////////////////////////////////////////////////////////////////////////////////
49 
50 class SdrModel;
51 class SdPage;
52 class SdrPage;
53 class SdrObject;
54 class SvStream;
55 class Polygon;
56 class PolyPolygon;
57 class SfxItemSet;
58 class Outliner;
59 class Graphic;
60 class SvxMSDffManager;
61 class PptTextMetaCharList;
62 class PPTTextObj;
63 class DffRecordHeader;
64 struct PptCharAttrSet;
65 class SvxBulletItem;
66 
67 #define PPT_IMPORTFLAGS_NO_TEXT_ASSERT  1
68 
69 struct MSFILTER_DLLPUBLIC PptCurrentUserAtom
70 {
71     sal_uInt32  nMagic;
72     sal_uInt32  nCurrentUserEdit;
73     sal_uInt16  nDocFileVersion;
74     sal_uInt8   nMajorVersion;
75     sal_uInt8   nMinorVersion;
76     String      aCurrentUser;
77 
78 public:
79 
PptCurrentUserAtomPptCurrentUserAtom80     PptCurrentUserAtom() :  nMagic              ( 0 ),
81                             nCurrentUserEdit    ( 0 ),
82                             nDocFileVersion     ( 0 ),
83                             nMajorVersion       ( 0 ),
84                             nMinorVersion       ( 0 ) {}
85 
86     MSFILTER_DLLPUBLIC friend SvStream& operator>>( SvStream& rIn, PptCurrentUserAtom& rAtom );
87 };
88 
89 struct MSFILTER_DLLPUBLIC PowerPointImportParam
90 {
91     SvStream&           rDocStream;
92     sal_uInt32          nImportFlags;
93     MSFilterTracer*     pTracer;
94     PptCurrentUserAtom  aCurrentUserAtom;
95 
96     PowerPointImportParam( SvStream& rDocStream, sal_uInt32 nImportFlags, MSFilterTracer* pTracer );
97 };
98 
99 struct SdHyperlinkEntry
100 {
101     sal_uInt32  nIndex;
102     sal_Int32   nPrivate1;
103     sal_Int32   nPrivate2;
104     sal_Int32   nPrivate3;
105     sal_Int32   nInfo;
106     String      aTarget;
107     String      aSubAdress;
108 
109     sal_Int32   nStartPos;
110     sal_Int32   nEndPos;
111 
112     String      aConvSubString;
113     ESelection  aESelection;
114     sal_Bool    bSelection;
115 };
116 
117 // Hilfsklasse zum Einlesen der PPT InteractiveInfoAtom
118 struct MSFILTER_DLLPUBLIC PptInteractiveInfoAtom
119 {
120     sal_uInt32          nSoundRef;
121     sal_uInt32          nExHyperlinkId;
122     sal_uInt8           nAction;
123     sal_uInt8           nOleVerb;
124     sal_uInt8           nJump;
125     sal_uInt8           nFlags;
126     sal_uInt8           nHyperlinkType;
127 
128     // unknown, da Gesamtgroesse 16 ist
129     sal_uInt8           nUnknown1;
130     sal_uInt8           nUnknown2;
131     sal_uInt8           nUnknown3;
132 
133 public:
134 
135     MSFILTER_DLLPUBLIC friend SvStream& operator>>( SvStream& rIn, PptInteractiveInfoAtom& rAtom );
136 };
137 
138 enum PptPageKind { PPT_MASTERPAGE, PPT_SLIDEPAGE, PPT_NOTEPAGE };
139 
140 enum PptPageFormat
141 {   PPTPF_SCREEN,   //
142     PPTPF_USLETTER, // 8.5x11"
143     PPTPF_A4,       // 210x297mm
144     PPTPF_35MMDIA,  // DIA
145     PPTPF_OVERHEAD, //
146     PPTPF_CUSTOM
147 };
148 
149 // Werte fuer den sal_uLong im PPT_PST_TextHeaderAtom
150 enum PPT_TextHeader
151 {
152     PPTTH_TITLE,
153     PPTTH_BODY,
154     PPTTH_NOTES,
155     PPTTH_NOTUSED,
156     PPTTH_OTHER,       // Text in a Shape
157     PPTTH_CENTERBODY,  // Subtitle in Title-Slide
158     PPTTH_CENTERTITLE, // Title in Title-Slide
159     PPTTH_HALFBODY,    // Body in two-column slide
160     PPTTH_QUARTERBODY  // Body in four-body slide
161 };
162 
163 #define TSS_TYPE_PAGETITLE      (0)
164 #define TSS_TYPE_BODY           (1)
165 #define TSS_TYPE_NOTES          (2)
166 #define TSS_TYPE_UNUSED         (3)
167 #define TSS_TYPE_TEXT_IN_SHAPE  (4)
168 #define TSS_TYPE_SUBTITLE       (5)
169 #define TSS_TYPE_TITLE          (6)
170 #define TSS_TYPE_HALFBODY       (7)
171 #define TSS_TYPE_QUARTERBODY    (8)
172 
173 // Inventor-Id fuer PPT UserData
174 const sal_uInt32 PPTInventor =sal_uInt32('P')*0x00000001+
175                           sal_uInt32('P')*0x00000100+
176                           sal_uInt32('T')*0x00010000+
177                           sal_uInt32('0')*0x01000000;
178 
179 // Object-Ids fuer StarDraw UserData
180 #define PPT_OBJECTINFO_ID       (1)
181 
182 struct MSFILTER_DLLPUBLIC PptDocumentAtom
183 {
184     Size            aSlidesPageSize;                    // Seitengroesse der Slides in 576DPI
185     Size            aNotesPageSize;                     // Seitengroesse der Notes in 576DPI
186     // RatioAtom erstmal weggelassen
187     sal_uInt32          nNotesMasterPersist;                // 0=nicht vorhanden
188     sal_uInt32          nHandoutMasterPersist;              // 0=nicht vorhanden
189     sal_uInt16          n1stPageNumber;                     // Seitennummer des ersten Slides
190     PptPageFormat   eSlidesPageFormat;                  // Seitenformat der Slides
191     sal_Bool        bEmbeddedTrueType           : 1;    // TrueType direkt im File?
192     sal_Bool        bTitlePlaceholdersOmitted   : 1;
193     sal_Bool        bRightToLeft                : 1;
194     sal_Bool        bShowComments               : 1;
195 
196 public:
197 
198     Size    GetPageSize( const Size& rSiz ) const;
GetSlidesPageSizePptDocumentAtom199     Size    GetSlidesPageSize() const { return GetPageSize( aSlidesPageSize ); }
GetNotesPageSizePptDocumentAtom200     Size    GetNotesPageSize() const { return GetPageSize( aNotesPageSize ); }
201 
202     friend SvStream& operator>>( SvStream& rIn, PptDocumentAtom& rAtom );
203 };
204 
205 struct PptSlideLayoutAtom
206 {
207     sal_Int32               eLayout;                // 0..18
208     sal_uInt8               aPlaceholderId[ 8 ];
209     sal_uLong               aPlacementId[ 8 ];
210 
211 public:
212 
PptSlideLayoutAtomPptSlideLayoutAtom213                         PptSlideLayoutAtom() { Clear(); }
214     void                Clear();
215 
216     // Das SlideLayoutAtom wird ohne Header eingelesen!
217     friend SvStream& operator>>( SvStream& rIn, PptSlideLayoutAtom& rAtom );
218 };
219 
220 struct PptSlideAtom
221 {
222     PptSlideLayoutAtom  aLayout;
223     sal_uInt32              nMasterId;
224     sal_uInt32              nNotesId;
225     sal_uInt16              nFlags;
226 
227 public:
228 
PptSlideAtomPptSlideAtom229                         PptSlideAtom() { Clear(); }
230     void                Clear();
231 
232     friend SvStream& operator>>(SvStream& rIn, PptSlideAtom& rAtom);
233 };
234 
235 struct PptSlidePersistAtom
236 {
237     sal_uInt32              nPsrReference;
238     sal_uInt32              nFlags;
239     sal_uInt32              nNumberTexts;
240     sal_uInt32              nSlideId;
241     sal_uInt32              nReserved;                  // we will use nReserved temporarly to set the offset to SSSlideInfoAtom ( if possible )
242 
243 public:
244 
PptSlidePersistAtomPptSlidePersistAtom245                         PptSlidePersistAtom() { Clear(); }
246     void                Clear();
247 
248     friend SvStream& operator>>(SvStream& rIn, PptSlidePersistAtom& rAtom);
249 };
250 
251 struct PptNotesAtom
252 {
253     sal_uInt32              nSlideId;
254     sal_uInt16              nFlags;
255 
256 public:
257 
PptNotesAtomPptNotesAtom258                         PptNotesAtom() { Clear(); }
259     void                Clear();
260 
261     friend SvStream& operator>>(SvStream& rIn, PptNotesAtom& rAtom);
262 };
263 
264 struct PptColorSchemeAtom
265 {
266     sal_uInt8               aData[32];
267 
268 public:
PptColorSchemeAtomPptColorSchemeAtom269                         PptColorSchemeAtom () { Clear(); }
270     void                Clear();
271     Color               GetColor( sal_uInt16 nNum ) const;
272 
273     friend SvStream& operator>>(SvStream& rIn, PptColorSchemeAtom& rAtom);
274 };
275 
276 struct PptFontEntityAtom
277 {
278     String              aName;
279     double              fScaling;
280     sal_uInt8           lfClipPrecision;
281     sal_uInt8           lfQuality;
282 
283     sal_uInt32          nUniqueFontId;          // not used anymore
284     CharSet             eCharSet;
285     FontFamily          eFamily;
286     FontPitch           ePitch;
287     sal_Bool            bAvailable;
288 
289     friend SvStream& operator>>(SvStream& rIn, PptFontEntityAtom& rAtom);
290 };
291 
292 class PptFontCollection;
293 struct PptUserEditAtom
294 {
295     DffRecordHeader     aHd;
296     sal_Int32               nLastSlideID;            // ID of last visible slide
297     sal_uInt32              nVersion;                // This is major/minor/build which did the edit
298     sal_uInt32              nOffsetLastEdit;         // File offset of prev PptUserEditAtom
299     sal_uInt32              nOffsetPersistDirectory; // Offset to PersistPtrs for this file version.
300     sal_uInt32              nDocumentRef;
301     sal_uInt32              nMaxPersistWritten;      // Gesamtanzahl der Persisteintraege bis hierher.
302     sal_Int16               eLastViewType;           // enum view type
303 
304 public:
305 
PptUserEditAtomPptUserEditAtom306     PptUserEditAtom() : nOffsetPersistDirectory( 0 ) {}
307 
308     friend SvStream& operator>>( SvStream& rIn, PptUserEditAtom& rAtom );
309 };
310 
311 struct PptOEPlaceholderAtom
312 {
313     sal_uInt32              nPlacementId;
314     sal_uInt8               nPlaceholderId;
315     sal_uInt8               nPlaceholderSize; // 0=Full size, 1=Half size, 2=Quarter of Slide
316 
317 public:
318 
PptOEPlaceholderAtomPptOEPlaceholderAtom319                         PptOEPlaceholderAtom() { Clear(); }
320     void                Clear();
321 
322     friend SvStream& operator>>( SvStream& rIn, PptOEPlaceholderAtom& rAtom );
323 };
324 
325 struct ProcessData;
326 struct PPTStyleSheet;
327 struct HeaderFooterEntry;
328 struct PptSlidePersistEntry
329 {
330     PptSlidePersistAtom aPersistAtom;
331     PptSlideAtom        aSlideAtom;
332     PptNotesAtom        aNotesAtom;
333     PptColorSchemeAtom  aColorScheme;           // each slide includes this colorscheme atom
334     PPTStyleSheet*      pStyleSheet;            // stylesheet of this page ( only in masterpages ), since XP supports more than one masterpage
335 
336     sal_uInt32          HeaderFooterOfs[ 4 ];   // containing the ofs to the placeholder (only masterpage)
337     HeaderFooterEntry*  pHeaderFooterEntry;
338     SvxMSDffSolverContainer* pSolverContainer;
339     sal_uInt32          nSlidePersistStartOffset;// is an array to the end of the SlidePersistAtom of this page, TextHeaderAtom is following
340     sal_uInt32          nSlidePersistEndOffset;
341     sal_uInt32          nBackgroundOffset;      // fileoffset
342     sal_uInt32          nDrawingDgId;           // valid, if not -1
343     sal_uInt32*         pPresentationObjects;   // if valid, this is a pointer to an array that includes the offsets to the presentation objects
344                                                 // on this masterpage for each instance ( 0 - 8 );
345     SdrObject*          pBObj;
346     sal_Bool            bBObjIsTemporary;
347 
348     void*               pDummy2;
349     PptPageKind         ePageKind;              //
350 
351     sal_Bool            bNotesMaster    : 1;    // fuer NotesMaster
352     sal_Bool            bHandoutMaster  : 1;    // fuer HandoutMaster
353     sal_Bool            bStarDrawFiller : 1;    // speziell fuer StarDraw
354 public:
355                         PptSlidePersistEntry();
356                         ~PptSlidePersistEntry();
GetSlideIdPptSlidePersistEntry357     sal_uInt32              GetSlideId() const { return aPersistAtom.nSlideId; }
358 };
359 
360 SV_DECL_PTRARR_DEL(_PptSlidePersistList,PptSlidePersistEntry*,16,16)
361 
362 #define PPTSLIDEPERSIST_ENTRY_NOTFOUND 0xFFFF
363 
364 class MSFILTER_DLLPUBLIC PptSlidePersistList: public _PptSlidePersistList
365 {
366 
367     public:
368 
369         sal_uInt16          FindPage( sal_uInt32 nId ) const;
370 };
371 
372 class  SfxObjectShell;
373 struct PPTOleEntry
374 {
375     sal_uInt32              nId;                        // OleId
376     sal_uInt32              nPersistPtr;                // PersistPtr
377     sal_uInt32              nRecHdOfs;                  // points to the record header: ExObjListHd
378     SfxObjectShell*         pShell;
379     sal_uInt16              nType;                      // maybe PPT_PST_ExEmbed or PPT_PST_ExControl
380     sal_uInt32              nAspect;                    // the aspect of the OLE object
381 
PPTOleEntryPPTOleEntry382     PPTOleEntry( sal_uInt32 nid, sal_uInt32 nOfs, SfxObjectShell* pSh, sal_uInt16 nT, sal_uInt32 nAsp ) :
383         nId             ( nid ),
384         nRecHdOfs       ( nOfs ),
385         pShell          ( pSh ),
386         nType           ( nT ),
387         nAspect         ( nAsp ) {}
388 };
389 
390 struct PptExOleObjAtom
391 {
392     sal_uInt32  nAspect;
393     sal_uInt32  nDummy1;
394     sal_uInt32  nId;
395     sal_uInt32  nDummy2;
396     sal_uInt32  nPersistPtr;
397     sal_uInt32  nDummy4;
398 
399 public:
400 
401     friend SvStream& operator>>( SvStream& rIn, PptExOleObjAtom& rAtom );
402 };
403 
404 class PPTExtParaProv;
405 class MSFILTER_DLLPUBLIC SdrEscherImport : public SvxMSDffManager
406 {
407 
408 protected:
409 
410     friend class PPTTextObj;
411     friend class PPTPortionObj;
412     friend struct PPTStyleTextPropReader;
413     friend class ImplSdPPTImport;
414 
415     PptDocumentAtom     aDocAtom;
416     DffRecordManager    aDocRecManager;                         // contains all first level container and atoms of the document container
417 
418     List                aHFMasterList;
419     List                aOleObjectList;                         // contains PPTOleEntrys
420 
421     PptFontCollection*  pFonts;
422 
423     sal_uInt32          nStreamLen;
424     sal_uInt16          nTextStylesIndex;
425 
426     CharSet             eCharSetSystem;
427 
428     sal_Bool            bWingdingsChecked       : 1;
429     sal_Bool            bWingdingsAvailable     : 1;
430     sal_Bool            bMonotypeSortsChecked   : 1;
431     sal_Bool            bMonotypeSortsAvailable : 1;
432     sal_Bool            bTimesNewRomanChecked   : 1;
433     sal_Bool            bTimesNewRomanAvailable : 1;
434 
435     sal_Bool            ReadString( String& rStr ) const;
436     // nur fuer PowerPoint-Filter:
437     virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const;
438     void                CheckWingdings() const;
439     void                CheckMonotypeSorts() const;
440     void                CheckTimesNewRoman() const;
441 
442 public:
443 
444     PowerPointImportParam& rImportParam;
445 
446     void*               pSdrEscherDummy1;
447     void*               pSdrEscherDummy2;
448     void*               pSdrEscherDummy3;
449     void*               pSdrEscherDummy4;
450 
451                         SdrEscherImport( PowerPointImportParam&, const String& rBaseURL );
452     virtual             ~SdrEscherImport();
453     virtual FASTBOOL    GetColorFromPalette( sal_uInt16 nNum, Color& rColor ) const;
454     virtual sal_Bool        SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const;
455     PptFontEntityAtom*  GetFontEnityAtom( sal_uInt32 nNum ) const;
456     CharSet             GetCharSet( sal_uInt32 nNum ) const;
457     sal_Bool                IsFontAvailable( sal_uInt32 nNum ) const;
458     void                RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraph );
459     using SvxMSDffManager::ReadObjText;
460     virtual SdrObject*  ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPage* pPage ) const;
461     virtual SdrObject*  ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, Rectangle& rTextRect, SdrObject* pObj );
462     virtual void        ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, void* pData, DffObjData& rObj );
463     void                ImportHeaderFooterContainer( DffRecordHeader& rHeader, HeaderFooterEntry& rEntry );
464 };
465 
466 ////////////////////////////////////////////////////////////////////////////////////////////////////
467 
468 #define SD_HEADERFOOTER_DATE        1
469 #define SD_HEADERFOOTER_TODAYDATE   2
470 #define SD_HEADERFOOTER_USERDATE    4
471 #define SD_HEADERFOOTER_SLIDENUMBER 8
472 #define SD_HEADERFOOTER_HEADER      16
473 #define SD_HEADERFOOTER_FOOTER      32
474 
475 class SvxFieldItem;
476 struct MSFILTER_DLLPUBLIC PPTFieldEntry
477 {
478     sal_uInt16          nPos;
479     sal_uInt16          nTextRangeEnd;
480     SvxFieldItem*   pField1;
481     SvxFieldItem*   pField2;
482     String*         pString;
483 
PPTFieldEntryPPTFieldEntry484     PPTFieldEntry() : nPos( 0 ), nTextRangeEnd( 0 ), pField1( NULL ), pField2( NULL ), pString( NULL ) {};
485     ~PPTFieldEntry();
486 
487     void            SetDateTime( sal_uInt32 nType );
488 
489                     // converting PPT date time format:
490     static void     GetDateTime( const sal_uInt32 nVal, SvxDateFormat& eDateFormat, SvxTimeFormat& eTimeFormat );
491 };
492 
493 struct MSFILTER_DLLPUBLIC HeaderFooterEntry
494 {
495     const PptSlidePersistEntry* pMasterPersist;
496     String              pPlaceholder[ 4 ];
497     sal_uInt32          nAtom;
498 
499     sal_uInt32          GetMaskForInstance( sal_uInt32 nInstance );
500     sal_uInt32          IsToDisplay( sal_uInt32 nInstance );
501     sal_uInt32          NeedToImportInstance( const sal_uInt32 nInstance, const PptSlidePersistEntry& rSlidePersist );
502 
503                         HeaderFooterEntry( const PptSlidePersistEntry* pMaster = NULL );
504                         ~HeaderFooterEntry();
505 };
506 
507 struct ProcessData
508 {
509     PptSlidePersistEntry&   rPersistEntry;
510     SdPage*                 pPage;
511     List*                   pBackgroundColoredObjects;
512     sal_uInt32*             pTableRowProperties;
513 
ProcessDataProcessData514     ProcessData( PptSlidePersistEntry& rP, SdPage* pP ) :
515         rPersistEntry               ( rP ),
516         pPage                       ( pP ),
517         pBackgroundColoredObjects   ( NULL ),
518         pTableRowProperties         ( NULL ) {};
~ProcessDataProcessData519     ~ProcessData() { delete pBackgroundColoredObjects; delete[] pTableRowProperties; };
520 };
521 
522 ////////////////////////////////////////////////////////////////////////////////////////////////////
523 
524 class SdrTextObj;
525 class SfxObjectShell;
526 class MSFILTER_DLLPUBLIC SdrPowerPointImport : public SdrEscherImport
527 {
528 
529 protected:
530 
531     friend class PPTTextObj;
532     friend class PPTExtParaProv;
533     friend struct PPTStyleSheet;
534     friend class PPTNumberFormatCreator;
535 
536     sal_Bool                bOk;
537     PptUserEditAtom     aUserEditAtom;
538     PptColorSchemeAtom  aPageColors;
539     List                aHyperList;
540     sal_uInt32*             pPersistPtr;
541     sal_uLong               nPersistPtrAnz;
542 
543     const PPTStyleSheet* pPPTStyleSheet;    // this is the current stylesheet;
544     const PPTStyleSheet* pDefaultSheet;     // this is a sheet we are using if no masterpage can be found, but that should
545                                             // never happen just preventing a crash
546     PptSlidePersistList* pMasterPages;
547     PptSlidePersistList* pSlidePages;
548     PptSlidePersistList* pNotePages;
549     sal_uInt16              nAktPageNum;
550     sal_uLong               nDocStreamPos;
551     sal_uInt16              nPageColorsNum;
552     PptPageKind         ePageColorsKind;
553     PptPageKind         eAktPageKind;
554 
555 protected:
556 
557     sal_Bool    SeekToAktPage(DffRecordHeader* pRecHd=NULL) const;
558     sal_Bool    SeekToDocument(DffRecordHeader* pRecHd=NULL) const;
559     sal_Bool    SeekToContentOfProgTag( sal_Int32 nVersion, SvStream& rSt, const DffRecordHeader& rProgTagBinaryDataHd,
560                                             DffRecordHeader& rContentHd );
561     virtual SdrObject* ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pText, SdPage* pPage, SfxStyleSheet*, SfxStyleSheet** ) const;
562     using SdrEscherImport::ReadObjText;
563     virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPage* pPage ) const;
564     // --> OD 2004-12-14 #i32596# - new parameter <_nCalledByGroup>, which
565     // indicates, if the OLE object is imported inside a group object.
566     virtual SdrObject* ImportOLE( long nOLEId,
567                                   const Graphic& rGraf,
568                                   const Rectangle& rBoundRect,
569                                   const Rectangle& rVisArea,
570                                   const int _nCalledByGroup,
571                                   sal_Int64 nAspect ) const;
572     // <--
573     SvMemoryStream* ImportExOleObjStg( sal_uInt32 nPersistPtr, sal_uInt32& nOleId ) const;
574     SdrPage*   MakeBlancPage(sal_Bool bMaster) const;
575     sal_Bool   ReadFontCollection();
ForceFontCollection() const576     sal_Bool   ForceFontCollection() const { return pFonts!=NULL?sal_True:((SdrPowerPointImport*)this)->ReadFontCollection(); }
577     PptSlidePersistList* GetPageList(PptPageKind ePageKind) const;
578     sal_uInt32     GetAktPageId();
579     sal_uInt32     GetMasterPageId(sal_uInt16 nPageNum, PptPageKind ePageKind) const;
580     sal_uInt32     GetNotesPageId(sal_uInt16 nPageNum ) const;
581     SdrOutliner* GetDrawOutliner( SdrTextObj* pSdrText ) const;
582     void        SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions );
583     void        ApplyTextAnchorAttributes( PPTTextObj& rTextObj, SfxItemSet& rSet ) const;
584     sal_Bool    IsVerticalText() const;
585 public:
586                 SdrPowerPointImport( PowerPointImportParam&, const String& rBaseURL );
587     virtual     ~SdrPowerPointImport();
588     sal_uInt16      GetPageCount( PptPageKind eKind = PPT_SLIDEPAGE ) const;
589     void        SetPageNum( sal_uInt16 nPageNum, PptPageKind = PPT_SLIDEPAGE );
GetPageNum() const590     sal_uInt16      GetPageNum() const { return nAktPageNum; }
GetPageKind() const591     PptPageKind GetPageKind() const { return eAktPageKind; }
592     Size        GetPageSize() const;
593     SdrObject*  ImportPageBackgroundObject( const SdrPage& rPage, sal_uInt32& nBgFileOffset, sal_Bool bForce );
594     sal_Bool    IsNoteOrHandout( sal_uInt16 nPageNum, PptPageKind ePageKind ) const;
595     sal_Bool    HasMasterPage( sal_uInt16 nPageNum, PptPageKind ePageKind = PPT_SLIDEPAGE ) const;
596     sal_uInt16      GetMasterPageIndex( sal_uInt16 nPageNum, PptPageKind ePageKind = PPT_SLIDEPAGE ) const;
597 
598     void        ImportPage( SdrPage* pPage, const PptSlidePersistEntry* pMasterPersist = NULL );
599     virtual FASTBOOL    GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const;
600     virtual sal_Bool        SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const;
601     sal_Unicode         PPTSubstitute( sal_uInt16 nFont, sal_Unicode nChar,
602                                         sal_uInt32& nMappedFontId, Font& rFont, char nDefault ) const;
GetDocumentAtom() const603     const PptDocumentAtom&              GetDocumentAtom() const { return aDocAtom; }
604     virtual const PptSlideLayoutAtom*   GetSlideLayoutAtom() const;
605     SdrObject*  CreateTable( SdrObject* pGroupObject, sal_uInt32* pTableArry, SvxMSDffSolverContainer* );
606 };
607 
608 ////////////////////////////////////////////////////////////////////////////////////////////////////
609 
610 struct PPTTextCharacterStyleAtomInterpreter
611 {
612     sal_uInt16  nFlags1;
613     sal_uInt16  nFlags2;
614     sal_uInt16  nFlags3;
615     sal_Int32   n1;
616     sal_uInt16  nFontHeight;
617     sal_Int32   nFontColor;
618 
619                     PPTTextCharacterStyleAtomInterpreter();
620                     ~PPTTextCharacterStyleAtomInterpreter();
621 
622     sal_Bool        Read( SvStream& rIn, const DffRecordHeader& rRecHd );
623 
624     sal_uInt32      GetColor( sal_uInt32 nDefault );
625 };
626 
627 struct PPTTextParagraphStyleAtomInterpreter
628 {
629     sal_Bool        bValid;
630     sal_Bool        bForbiddenRules;
631     sal_Bool        bHangingPunctuation;
632     sal_Bool        bLatinTextWrap;
633 
634                     PPTTextParagraphStyleAtomInterpreter();
635                     ~PPTTextParagraphStyleAtomInterpreter();
636 
637     sal_Bool        Read( SvStream& rIn, const DffRecordHeader& rRecHd );
638 };
639 
640 struct PPTTextSpecInfo
641 {
642     sal_uInt32      nCharIdx;
643     sal_uInt16      nLanguage[ 3 ];
644     sal_uInt16      nDontKnow;
645 
646     PPTTextSpecInfo( sal_uInt32 nCharIdx );
647     ~PPTTextSpecInfo();
648 };
649 
650 struct  PPTTextSpecInfoAtomInterpreter
651 {
652     sal_Bool        bValid;
653     List            aList;
654 
655                     PPTTextSpecInfoAtomInterpreter();
656                     ~PPTTextSpecInfoAtomInterpreter();
657 
658     sal_Bool        Read( SvStream& rIn, const DffRecordHeader& rRecHd,
659                             sal_uInt16 nRecordType, const PPTTextSpecInfo* pTextSpecDefault = NULL );
660 
661 };
662 
663 ////////////////////////////////////////////////////////////////////////////////////////////////////
664 
665 #define PPT_STYLESHEETENTRYS    9
666 
667 struct PPTExtParaLevel
668 {
669         sal_uInt32  mnExtParagraphMask;
670         sal_uInt16  mnBuBlip;
671         sal_uInt16  mnHasAnm;
672         sal_uInt32  mnAnmScheme;
673         sal_uInt32  mpfPP10Ext;
674         sal_uInt32  mnExtCharacterMask;
675         sal_uInt32  mcfPP10Ext;
676         sal_Bool    mbSet;
677 
678         PPTExtParaLevel();
679         friend SvStream& operator>>( SvStream& rIn, PPTExtParaLevel& rL );
680 };
681 
682 struct PPTExtParaSheet
683 {
684         PPTExtParaLevel aExtParaLevel[ 5 ];
685 };
686 
687 struct PPTBuGraEntry
688 {
689     sal_uInt32      nInstance;
690     Graphic     aBuGra;
691 
692                 PPTBuGraEntry( Graphic& rGraphic, sal_uInt32 nInstance );
693 };
694 
695 class PPTExtParaProv
696 {
697         List                aBuGraList;
698 
699     public :
700         sal_Bool                bStyles;
701         sal_Bool                bGraphics;
702         DffRecordManager    aExtendedPresRules;
703 
704         PPTExtParaSheet     aExtParaSheet[ PPT_STYLESHEETENTRYS ];
705 
706         sal_Bool                GetGraphic( sal_uInt32 nInstance, Graphic& rGraphic ) const;
707 
708                             PPTExtParaProv( SdrPowerPointImport& rManager, SvStream& rSt,
709                                                 const DffRecordHeader* pMainMasterHd );
710                             ~PPTExtParaProv();
711 };
712 
713 ////////////////////////////////////////////////////////////////////////////////////////////////////
714 
715 struct PPTCharLevel
716 {
717     Color       mnFontColorInStyleSheet;
718     sal_uInt32  mnFontColor;
719     sal_uInt16  mnFlags;
720     sal_uInt16  mnFont;
721     sal_uInt16  mnAsianOrComplexFont;
722     sal_uInt16  mnFontHeight;
723     sal_uInt16  mnEscapement;
724 };
725 
726 struct PPTCharSheet
727 {
728                 PPTCharLevel    maCharLevel[ 5 ];
729 
730                 PPTCharSheet( sal_uInt32 nInstance );
731                 PPTCharSheet( const PPTCharSheet& rCharSheet );
732 
733     void        Read( SvStream& rIn, sal_Bool bMasterStyle, sal_uInt32 nLevel, sal_Bool bFirst );
734 };
735 
736 struct PPTParaLevel
737 {
738     sal_uInt16  mnBuFlags;
739     sal_uInt16  mnBulletChar;
740     sal_uInt16  mnBulletFont;
741     sal_uInt16  mnBulletHeight;
742     sal_uInt32  mnBulletColor;
743 
744     sal_uInt16  mnAdjust;
745     sal_uInt16  mnLineFeed;
746     sal_uInt16  mnUpperDist;
747     sal_uInt16  mnLowerDist;
748     sal_uInt16  mnTextOfs;
749     sal_uInt16  mnBulletOfs;
750     sal_uInt16  mnDefaultTab;
751     sal_uInt16  mnAsianLineBreak;   // bit0:    use asian rules for first and last character
752                                     //    1:    do not wrap latin text in the middle of the word
753                                     //    2:    allow hanging punctuation
754     sal_uInt16  mnBiDi;
755 };
756 
757 struct PPTParaSheet
758 {
759     public:
760 
761                 PPTParaLevel    maParaLevel[ 5 ];
762 
763                 PPTParaSheet( sal_uInt32 nInstance );
764                 PPTParaSheet( const PPTParaSheet& rParaSheet );
765 
766     void        Read( SdrPowerPointImport& rMan, SvStream& rIn, sal_Bool bMasterStyle,
767                         sal_uInt32 nLevel, sal_Bool bFirst );
768     void        UpdateBulletRelSize(  sal_uInt32 nLevel, sal_uInt16 nFontHeight );
769 };
770 
771 ////////////////////////////////////////////////////////////////////////////////////////////////////
772 
773 class PPTParagraphObj;
774 class PPTNumberFormatCreator
775 {
776         sal_uInt32 nIsBullet;
777         sal_uInt32 nBulletChar;
778         sal_uInt32 nBulletFont;
779         sal_uInt32 nBulletHeight;
780         sal_uInt32 nBulletColor;
781         sal_uInt32 nTextOfs;
782         sal_uInt32 nBulletOfs;
783 
784         void    ImplGetNumberFormat( SdrPowerPointImport& rMan, SvxNumberFormat& rNumberFormat, sal_uInt32 nLevel );
785         sal_Bool    ImplGetExtNumberFormat( SdrPowerPointImport& rMan, SvxNumberFormat& rNumberFormat, sal_uInt32 nLevel,
786                             sal_uInt32 nInstance, sal_uInt32 nInstanceInSheet, boost::optional< sal_Int16 >& rStartNumbering,
787                                 sal_uInt32 nFontHeight, PPTParagraphObj* pPara );
788 
789     protected :
790 
791         PPTNumberFormatCreator( PPTExtParaProv* );
792         ~PPTNumberFormatCreator();
793 
794     public :
795 
796         PPTExtParaProv*  pExtParaProv;
797 
798         void    GetNumberFormat(  SdrPowerPointImport& rMan, SvxNumberFormat& rNumberFormat, sal_uInt32 nLevel,
799                     const PPTParaLevel& rParaLevel, const PPTCharLevel& rCharLevel, sal_uInt32 nInstance );
800 
801         sal_Bool    GetNumberFormat(  SdrPowerPointImport& rMan, SvxNumberFormat& rNumberFormat,
802                     PPTParagraphObj* pPara, sal_uInt32 nInstanceInSheet, boost::optional< sal_Int16 >& rStartNumbering );
803 };
804 
805 ////////////////////////////////////////////////////////////////////////////////////////////////////
806 
807 class SvxNumBulletItem;
808 struct PPTStyleSheet : public PPTNumberFormatCreator
809 {
810     PPTTextSpecInfo     maTxSI;
811     PPTCharSheet*       mpCharSheet[ PPT_STYLESHEETENTRYS ];
812     PPTParaSheet*       mpParaSheet[ PPT_STYLESHEETENTRYS ];
813     SvxNumBulletItem*   mpNumBulletItem[ PPT_STYLESHEETENTRYS ];
814     void*               mpDummy;
815 
816                 PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rSt, SdrPowerPointImport&,
817                                 const PPTTextCharacterStyleAtomInterpreter&, const PPTTextParagraphStyleAtomInterpreter&, const PPTTextSpecInfo& );
818                 ~PPTStyleSheet();
819 };
820 
821 ////////////////////////////////////////////////////////////////////////////////////////////////////
822 
823 struct ImplPPTParaPropSet
824 {
825     sal_uInt32  mnRefCount;
826 
827     sal_uInt16  mnDepth;
828     sal_uInt32  mnAttrSet;
829     sal_uInt32  mnBulletColor;
830     sal_uInt16  mpArry[ 22 ];
831 
832     sal_uInt32  mnExtParagraphMask;
833     sal_uInt32  mnAnmScheme;
834     sal_uInt16  mnHasAnm;
835     sal_uInt16  mnBuBlip;
836 
837     sal_uInt32  nDontKnow1;
838     sal_uInt32  nDontKnow2;
839     sal_uInt16  nDontKnow2bit06;
840 
ImplPPTParaPropSetImplPPTParaPropSet841             ImplPPTParaPropSet(){ mnRefCount = 1; mnAttrSet = 0; mnExtParagraphMask = 0; mnDepth = 0; };
842 };
843 
844 struct PPTParaPropSet
845 {
846     sal_uInt32          mnOriginalTextPos;
847     ImplPPTParaPropSet* pParaSet;
848 
849                         PPTParaPropSet();
850                         PPTParaPropSet( PPTParaPropSet& rParaPropSet );
851                         ~PPTParaPropSet();
852 
853     PPTParaPropSet&     operator=( PPTParaPropSet& rParaPropSet );
854 };
855 
856 struct ImplPPTCharPropSet
857 {
858     sal_uInt32  mnRefCount;
859 
860     sal_uInt32  mnAttrSet;
861     sal_uInt16  mnFlags;
862     sal_uInt32  mnColor;
863     sal_uInt16  mnFont;
864     sal_uInt16  mnAsianOrComplexFont;
865     sal_uInt16  mnANSITypeface;
866     sal_uInt16  mnFontHeight;
867     sal_uInt16  mnEscapement;
868     sal_uInt16  mnSymbolFont;
869 
ImplPPTCharPropSetImplPPTCharPropSet870     ImplPPTCharPropSet(){ mnRefCount = 1; mnAttrSet = 0; };
871 };
872 
873 struct PPTCharPropSet
874 {
875     //when the bullet text has more than two color,next the text following with bullet has been set hyperlink.
876     //now,the bullet color should be set original hyperlink text's color
877     //so  "mbHardHylinkOrigColor" hold the original hyperlink text's color.
878     sal_uInt32  mnHylinkOrigColor;
879     //the bullet text weather has a hyperlink.
880     sal_Bool    mbIsHyperlink;
881     //the hyperlink text weather has a custom color.
882     sal_Bool    mbHardHylinkOrigColor;
883 
884     sal_uInt32          mnOriginalTextPos;
885     sal_uInt32          mnParagraph;
886     String              maString;
887     SvxFieldItem*       mpFieldItem;
888     sal_uInt16          mnLanguage[ 3 ];
889 
890     ImplPPTCharPropSet* pCharSet;
891 
892     void                SetFont( sal_uInt16 nFont );
893     void                SetColor( sal_uInt32 nColor );
894 
895                         PPTCharPropSet( sal_uInt32 nParagraph );
896                         PPTCharPropSet( PPTCharPropSet& rCharPropSet );
897                         PPTCharPropSet( PPTCharPropSet& rCharPropSet, sal_uInt32 nParagraph );
898                         ~PPTCharPropSet();
899 
900     PPTCharPropSet&     operator=( PPTCharPropSet& rCharPropSet );
901 
902     private :
903 
904         void            ImplMakeUnique();
905 };
906 
907 ////////////////////////////////////////////////////////////////////////////////////////////////////
908 
909 struct PPTTabEntry
910 {
911     sal_uInt16  nOffset;
912     sal_uInt16  nStyle;
913 };
914 
915 struct PPTRuler
916 {
917         sal_uInt32          nRefCount;
918 
919         sal_Int32           nFlags;
920         sal_uInt16          nDefaultTab;
921         sal_uInt16          nTextOfs[ 5 ];
922         sal_uInt16          nBulletOfs[ 5 ];
923         PPTTabEntry*    pTab;
924         sal_uInt16          nTabCount;
925 
926         PPTRuler();
927         ~PPTRuler();
928 };
929 
930 struct PPTTextRulerInterpreter
931 {
932         PPTRuler    *mpImplRuler;
933 
934                     PPTTextRulerInterpreter();
935                     PPTTextRulerInterpreter( PPTTextRulerInterpreter& rRuler );
936                     PPTTextRulerInterpreter( sal_uInt32 nFileOfs, SdrPowerPointImport&, DffRecordHeader& rHd, SvStream& rIn );
937                     ~PPTTextRulerInterpreter();
938 
GetTabOffsetByIndexPPTTextRulerInterpreter939         sal_uInt16  GetTabOffsetByIndex( sal_uInt16 nIndex ) const { return mpImplRuler->pTab[ nIndex ].nOffset; };
GetTabStyleByIndexPPTTextRulerInterpreter940         sal_uInt16  GetTabStyleByIndex( sal_uInt16 nIndex ) const { return mpImplRuler->pTab[ nIndex ].nStyle; };
GetTabCountPPTTextRulerInterpreter941         sal_uInt16      GetTabCount() const { return mpImplRuler->nTabCount; };
942         sal_Bool        GetDefaultTab( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
943         sal_Bool        GetTextOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
944         sal_Bool        GetBulletOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
945 
946         PPTTextRulerInterpreter& operator=( PPTTextRulerInterpreter& rRuler );
947 };
948 
949 ////////////////////////////////////////////////////////////////////////////////////////////////////
950 
951 #define PPT_SPEC_NEWLINE            0x10000
952 #define PPT_SPEC_SYMBOL             0x20000
953 #define PPT_SPEC_USE_STARBATS       0x40000
954 
955 struct StyleTextProp9
956 {
957     sal_uInt32  mnExtParagraphMask;
958     sal_uInt16  mnBuBlip;
959     sal_uInt16  mnHasAnm;
960     sal_uInt32  mnAnmScheme;
961     sal_uInt32  mpfPP10Ext;
962     sal_uInt32  mnExtCharacterMask;
963     sal_uInt32  mncfPP10Ext;
964     sal_uInt32  mnSpecialInfoMask;
965     sal_uInt32  mnPP10Ext;
966     sal_uInt16  mfBidi;
967 
StyleTextProp9StyleTextProp9968     StyleTextProp9()
969     : mnExtParagraphMask( 0 )
970     , mnBuBlip( 0 )
971     , mnHasAnm( 0 )
972     , mnAnmScheme( 0 )
973     , mpfPP10Ext( 0 )
974     , mnExtCharacterMask( 0 )
975     , mncfPP10Ext( 0 )
976     , mnSpecialInfoMask( 0 )
977     , mnPP10Ext( 0 )
978     , mfBidi( 0 )
979     {
980     }
981     void Read( SvStream& rSt );
982 };
983 
984 struct PPTStyleTextPropReader
985 {
986     List    aSpecMarkerList;            // hiword -> Flags, loword -> Position
987     List    aParaPropList;
988     List    aCharPropList;
989 
990     PPTStyleTextPropReader( SvStream& rIn, SdrPowerPointImport&, const DffRecordHeader& rClientTextBoxHd,
991         PPTTextRulerInterpreter& rInterpreter, const DffRecordHeader& rExtParaHd, sal_uInt32 nTextInstance );
992 
993     void Init( SvStream& rIn, SdrPowerPointImport&, const DffRecordHeader& rClientTextBoxHd,
994                PPTTextRulerInterpreter& rInterpreter, const DffRecordHeader& rExtParaHd, sal_uInt32 nTextInstance );
995     void ReadParaProps( SvStream& rIn, SdrPowerPointImport& rMan, const DffRecordHeader& rTextHeader,
996                         const String& aString, PPTTextRulerInterpreter& rRuler,
997                         sal_uInt32& nCharCount, sal_Bool& bTextPropAtom );
998     void ReadCharProps( SvStream& rIn, PPTCharPropSet& aCharPropSet, const String& aString,
999                         sal_uInt32& nCharCount, sal_uInt32 nCharAnzRead,
1000                         sal_Bool& bTextPropAtom, sal_uInt32 nExtParaPos,
1001                         const std::vector< StyleTextProp9 >& aStyleTextProp9,
1002                         sal_uInt32& nExtParaFlags, sal_uInt16& nBuBlip,
1003                         sal_uInt16& nHasAnm, sal_uInt32& nAnmScheme );
1004 
1005     ~PPTStyleTextPropReader();
1006 };
1007 
1008 ////////////////////////////////////////////////////////////////////////////////////////////////////
1009 
1010 class SvxFieldItem;
1011 class MSFILTER_DLLPUBLIC PPTPortionObj : public PPTCharPropSet
1012 {
1013 
1014     friend class PPTParagraphObj;
1015 
1016         const PPTStyleSheet&    mrStyleSheet;
1017         sal_uInt32                  mnInstance;
1018         sal_uInt32                  mnDepth;
1019 
1020     public :
1021 
1022         sal_Bool            GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet );
1023         SvxFieldItem*   GetTextField();
1024 
1025                         PPTPortionObj( const PPTStyleSheet&, sal_uInt32 nInstance, sal_uInt32 nDepth );
1026                         PPTPortionObj( PPTCharPropSet&, const PPTStyleSheet&, sal_uInt32 nInstance, sal_uInt32 nDepth );
1027                         PPTPortionObj( PPTPortionObj& );
1028                         ~PPTPortionObj();
1029 
1030         // the following function should be removed during next full update
1031         void            ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, sal_uInt32 nInstanceInSheet );
1032         void            ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, sal_uInt32 nInstanceInSheet, const PPTTextObj* pTextObj );
Count() const1033         sal_uInt32          Count() const { return ( mpFieldItem ) ? 1 : maString.Len(); };
1034         sal_Bool            HasTabulator();
1035 };
1036 
1037 class MSFILTER_DLLPUBLIC PPTParagraphObj : public PPTParaPropSet, public PPTNumberFormatCreator, public PPTTextRulerInterpreter
1038 {
1039     friend class PPTTextObj;
1040     friend class PPTNumberFormatCreator;
1041 
1042         const PPTStyleSheet&    mrStyleSheet;
1043         sal_uInt32                  mnInstance;
1044 
1045     protected :
1046 
1047         void                    ImplClear();
1048 
1049     public :
1050 
1051         sal_Bool                    mbTab;          // if true, this paragraph has tabulators in text
1052 
1053         sal_uInt32                  mnCurrentObject;
1054         sal_uInt32                  mnPortionCount;
1055         PPTPortionObj**         mpPortionList;
1056 
1057         void                    UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const;
1058         sal_Bool                    GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet );
1059 
1060                                 PPTParagraphObj( const PPTStyleSheet&, sal_uInt32 nInstance, sal_uInt16 nDepth );
1061                                 PPTParagraphObj( PPTStyleTextPropReader&, const PPTStyleSheet&, sal_uInt32 nInstance, PPTTextRulerInterpreter& rRuler );
1062                                 ~PPTParagraphObj();
1063 
1064         sal_uInt32                  GetTextSize();
1065         PPTPortionObj*          First();
1066         PPTPortionObj*          Next();
1067 
1068         void                    AppendPortion( PPTPortionObj& rPortion );
1069         void                    ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& rStartNumbering, SdrPowerPointImport& rManager, sal_uInt32 nInstanceInSheet, const PPTParagraphObj* pPrev );
1070 };
1071 
1072 #define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT      1
1073 #define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER    2
1074 #define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT     4
1075 #define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK     8
1076 #define PPT_TEXTOBJ_FLAGS_VERTICAL                      16
1077 
1078 struct ImplPPTTextObj
1079 {
1080     sal_uInt32                      mnRefCount;
1081     sal_uInt32                      mnShapeId;
1082     sal_uInt32                      mnShapeMaster;
1083     PptOEPlaceholderAtom*       mpPlaceHolderAtom;
1084     sal_uInt16                      mnInstance;
1085     sal_uInt16                      mnDestinationInstance;
1086     MSO_SPT                     meShapeType;
1087 
1088     sal_uInt32                      mnCurrentObject;
1089     sal_uInt32                      mnParagraphCount;
1090     PPTParagraphObj**           mpParagraphList;
1091     PptSlidePersistEntry&       mrPersistEntry;
1092 
1093     sal_uInt32                  mnTextFlags;
1094 
ImplPPTTextObjImplPPTTextObj1095     ImplPPTTextObj( PptSlidePersistEntry& rPersistEntry ) : mrPersistEntry ( rPersistEntry ) {};
1096 };
1097 
1098 class MSFILTER_DLLPUBLIC PPTTextObj
1099 {
1100         ImplPPTTextObj*         mpImplTextObj;
1101         void                    ImplClear();
1102 
PPTTextObj()1103                                 PPTTextObj(){};
1104     public :
1105                                 PPTTextObj( SvStream& rSt, SdrPowerPointImport&, PptSlidePersistEntry&, DffObjData* );
1106                                 PPTTextObj( PPTTextObj& rTextObj );
1107                                 ~PPTTextObj();
1108 
GetCurrentIndex() const1109         sal_uInt32                  GetCurrentIndex() const { return mpImplTextObj->mnCurrentObject; };
Count() const1110         sal_uInt32                  Count() const { return mpImplTextObj->mnParagraphCount; };
1111         PPTParagraphObj*        First();
1112         PPTParagraphObj*        Next();
GetShapeType() const1113         MSO_SPT                 GetShapeType() const { return mpImplTextObj->meShapeType; };
GetInstance() const1114         sal_uInt32                  GetInstance() const { return mpImplTextObj->mnInstance; };
SetInstance(sal_uInt16 nInstance)1115         void                    SetInstance( sal_uInt16 nInstance ) { mpImplTextObj->mnInstance = nInstance; };
GetDestinationInstance() const1116         sal_uInt32                  GetDestinationInstance() const { return mpImplTextObj->mnDestinationInstance; };
SetDestinationInstance(sal_uInt16 nInstance)1117         void                    SetDestinationInstance( sal_uInt16 nInstance ) { mpImplTextObj->mnDestinationInstance = nInstance; };
GetOEPlaceHolderAtom() const1118         PptOEPlaceholderAtom*   GetOEPlaceHolderAtom() const { return mpImplTextObj->mpPlaceHolderAtom; };
GetTextFlags() const1119         sal_uInt32              GetTextFlags() const { return mpImplTextObj->mnTextFlags; };
SetVertical(sal_Bool bVertical)1120         void                    SetVertical( sal_Bool bVertical )
1121                                 {
1122                                     if ( bVertical )
1123                                         mpImplTextObj->mnTextFlags |= PPT_TEXTOBJ_FLAGS_VERTICAL;
1124                                     else
1125                                         mpImplTextObj->mnTextFlags &= ~PPT_TEXTOBJ_FLAGS_VERTICAL;
1126                                 }
GetVertical() const1127         sal_Bool                GetVertical() const { return ( mpImplTextObj->mnTextFlags & PPT_TEXTOBJ_FLAGS_VERTICAL ) != 0; };
1128         const SfxItemSet*       GetBackground() const;
1129 
1130         PPTTextObj&         operator=( PPTTextObj& rTextObj );
1131 };
1132 
1133 class PPTConvertOCXControls : public SvxMSConvertOCXControls
1134 {
1135         virtual const   ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > & GetDrawPage();
1136         PptPageKind     ePageKind;
1137     public :
1138 
PPTConvertOCXControls(SfxObjectShell * pDSh,PptPageKind ePKind)1139         PPTConvertOCXControls( SfxObjectShell* pDSh, PptPageKind ePKind ) :
1140             SvxMSConvertOCXControls ( pDSh, NULL ),
1141             ePageKind               ( ePKind ){};
1142 
1143         virtual sal_Bool InsertControl(
1144             const com::sun::star::uno::Reference<
1145             com::sun::star::form::XFormComponent > &rFComp,
1146             const com::sun::star::awt::Size& rSize,
1147             com::sun::star::uno::Reference< com::sun::star::drawing::XShape > *pShape,
1148             sal_Bool bFloatingCtrl );
1149 };
1150 
1151 ////////////////////////////////////////////////////////////////////////////////////////////////////
1152 
1153 // Powerpoint Recordtypen
1154 #define PPT_PST_Unknown                         0
1155 #define PPT_PST_SubContainerCompleted           1
1156 #define PPT_PST_IRRAtom                         2
1157 #define PPT_PST_PSS                             3
1158 #define PPT_PST_SubContainerException           4
1159 #define PPT_PST_ClientSignal1                   6
1160 #define PPT_PST_ClientSignal2                   7
1161 #define PPT_PST_PowerPointStateInfoAtom         10
1162 #define PPT_PST_Document                        1000
1163 #define PPT_PST_DocumentAtom                    1001
1164 #define PPT_PST_EndDocument                     1002
1165 #define PPT_PST_SlidePersist                    1003
1166 #define PPT_PST_SlideBase                       1004
1167 #define PPT_PST_SlideBaseAtom                   1005
1168 #define PPT_PST_Slide                           1006
1169 #define PPT_PST_SlideAtom                       1007
1170 #define PPT_PST_Notes                           1008
1171 #define PPT_PST_NotesAtom                       1009
1172 #define PPT_PST_Environment                     1010
1173 #define PPT_PST_SlidePersistAtom                1011
1174 #define PPT_PST_Scheme                          1012
1175 #define PPT_PST_SchemeAtom                      1013
1176 #define PPT_PST_DocViewInfo                     1014
1177 #define PPT_PST_SslideLayoutAtom                1015
1178 #define PPT_PST_MainMaster                      1016
1179 #define PPT_PST_SSSlideInfoAtom                 1017
1180 #define PPT_PST_SlideViewInfo                   1018
1181 #define PPT_PST_GuideAtom                       1019
1182 #define PPT_PST_ViewInfo                        1020
1183 #define PPT_PST_ViewInfoAtom                    1021
1184 #define PPT_PST_SlideViewInfoAtom               1022
1185 #define PPT_PST_VBAInfo                         1023
1186 #define PPT_PST_VBAInfoAtom                     1024
1187 #define PPT_PST_SSDocInfoAtom                   1025
1188 #define PPT_PST_Summary                         1026
1189 #define PPT_PST_Texture                         1027
1190 #define PPT_PST_VBASlideInfo                    1028
1191 #define PPT_PST_VBASlideInfoAtom                1029
1192 #define PPT_PST_DocRoutingSlip                  1030
1193 #define PPT_PST_OutlineViewInfo                 1031
1194 #define PPT_PST_SorterViewInfo                  1032
1195 #define PPT_PST_ExObjList                       1033
1196 #define PPT_PST_ExObjListAtom                   1034
1197 #define PPT_PST_PPDrawingGroup                  1035
1198 #define PPT_PST_PPDrawing                       1036
1199 #define PPT_PST_NewlyAddedAtomByXP1037          1037
1200 #define PPT_PST_NamedShows                      1040
1201 #define PPT_PST_NamedShow                       1041
1202 #define PPT_PST_NamedShowSlides                 1042
1203 #define PPT_PST_List                            2000
1204 #define PPT_PST_FontCollection                  2005
1205 #define PPT_PST_ListPlaceholder                 2017
1206 #define PPT_PST_BookmarkCollection              2019
1207 #define PPT_PST_SoundCollection                 2020
1208 #define PPT_PST_SoundCollAtom                   2021
1209 #define PPT_PST_Sound                           2022
1210 #define PPT_PST_SoundData                       2023
1211 #define PPT_PST_BookmarkSeedAtom                2025
1212 #define PPT_PST_GuideList                       2026
1213 #define PPT_PST_RunArray                        2028
1214 #define PPT_PST_RunArrayAtom                    2029
1215 #define PPT_PST_ArrayElementAtom                2030
1216 #define PPT_PST_Int4ArrayAtom                   2031
1217 #define PPT_PST_ColorSchemeAtom                 2032
1218 
1219 // these atoms first was seen in ppt2000 in a private Tag atom
1220 #define PPT_PST_ExtendedBuGraContainer          2040    // consist of 4041
1221 #define PPT_PST_ExtendedBuGraAtom               2041    // the instance of this atom indices the current graphic
1222 
1223 #define PPT_PST_OEShape                         3008
1224 #define PPT_PST_ExObjRefAtom                    3009
1225 #define PPT_PST_OEPlaceholderAtom               3011
1226 #define PPT_PST_GrColor                         3020
1227 #define PPT_PST_GrectAtom                       3025
1228 #define PPT_PST_GratioAtom                      3031
1229 #define PPT_PST_Gscaling                        3032
1230 #define PPT_PST_GpointAtom                      3034
1231 #define PPT_PST_OEShapeAtom                     3035
1232 #define PPT_PST_OutlineTextRefAtom              3998
1233 #define PPT_PST_TextHeaderAtom                  3999
1234 #define PPT_PST_TextCharsAtom                   4000
1235 #define PPT_PST_StyleTextPropAtom               4001
1236 #define PPT_PST_BaseTextPropAtom                4002
1237 #define PPT_PST_TxMasterStyleAtom               4003
1238 #define PPT_PST_TxCFStyleAtom                   4004
1239 #define PPT_PST_TxPFStyleAtom                   4005
1240 #define PPT_PST_TextRulerAtom                   4006
1241 #define PPT_PST_TextBookmarkAtom                4007
1242 #define PPT_PST_TextBytesAtom                   4008
1243 #define PPT_PST_TxSIStyleAtom                   4009
1244 #define PPT_PST_TextSpecInfoAtom                4010
1245 #define PPT_PST_DefaultRulerAtom                4011
1246 
1247 // these atoms first was seen in ppt2000 in a private Tag atom
1248 #define PPT_PST_ExtendedParagraphAtom           4012
1249 #define PPT_PST_ExtendedParagraphMasterAtom     4013
1250 #define PPT_PST_ExtendedPresRuleContainer       4014    // consist of 4012, 4015,
1251 #define PPT_PST_ExtendedParagraphHeaderAtom     4015    // the instance of this atom indices the current presobj
1252                                                         // the first sal_uInt32 in this atom indices the current slideId
1253 #define PPT_PST_NewlyAddedAtom4016              4016
1254 
1255 #define PPT_PST_FontEntityAtom                  4023
1256 #define PPT_PST_FontEmbedData                   4024
1257 #define PPT_PST_TypeFace                        4025
1258 #define PPT_PST_CString                         4026
1259 #define PPT_PST_ExternalObject                  4027
1260 #define PPT_PST_MetaFile                        4033
1261 #define PPT_PST_ExOleObj                        4034
1262 #define PPT_PST_ExOleObjAtom                    4035
1263 #define PPT_PST_ExPlainLinkAtom                 4036
1264 #define PPT_PST_CorePict                        4037
1265 #define PPT_PST_CorePictAtom                    4038
1266 #define PPT_PST_ExPlainAtom                     4039
1267 #define PPT_PST_SrKinsoku                       4040
1268 #define PPT_PST_Handout                         4041
1269 #define PPT_PST_ExEmbed                         4044
1270 #define PPT_PST_ExEmbedAtom                     4045
1271 #define PPT_PST_ExLink                          4046
1272 #define PPT_PST_ExLinkAtom_old                  4047
1273 #define PPT_PST_BookmarkEntityAtom              4048
1274 #define PPT_PST_ExLinkAtom                      4049
1275 #define PPT_PST_SrKinsokuAtom                   4050
1276 #define PPT_PST_ExHyperlinkAtom                 4051
1277 #define PPT_PST_ExPlain                         4053
1278 #define PPT_PST_ExPlainLink                     4054
1279 #define PPT_PST_ExHyperlink                     4055
1280 #define PPT_PST_SlideNumberMCAtom               4056
1281 #define PPT_PST_HeadersFooters                  4057
1282 #define PPT_PST_HeadersFootersAtom              4058
1283 #define PPT_PST_RecolorEntryAtom                4062
1284 #define PPT_PST_TxInteractiveInfoAtom           4063
1285 #define PPT_PST_EmFormatAtom                    4065
1286 #define PPT_PST_CharFormatAtom                  4066
1287 #define PPT_PST_ParaFormatAtom                  4067
1288 #define PPT_PST_MasterText                      4068
1289 #define PPT_PST_RecolorInfoAtom                 4071
1290 #define PPT_PST_ExQuickTime                     4073
1291 #define PPT_PST_ExQuickTimeMovie                4074
1292 #define PPT_PST_ExQuickTimeMovieData            4075
1293 #define PPT_PST_ExSubscription                  4076
1294 #define PPT_PST_ExSubscriptionSection           4077
1295 #define PPT_PST_ExControl                       4078
1296 #define PPT_PST_ExControlAtom                   4091
1297 #define PPT_PST_SlideListWithText               4080
1298 #define PPT_PST_AnimationInfoAtom               4081
1299 #define PPT_PST_InteractiveInfo                 4082
1300 #define PPT_PST_InteractiveInfoAtom             4083
1301 #define PPT_PST_SlideList                       4084
1302 #define PPT_PST_UserEditAtom                    4085
1303 #define PPT_PST_CurrentUserAtom                 4086
1304 #define PPT_PST_DateTimeMCAtom                  4087
1305 #define PPT_PST_GenericDateMCAtom               4088
1306 #define PPT_PST_HeaderMCAtom                    4089
1307 #define PPT_PST_FooterMCAtom                    4090
1308 #define PPT_PST_ExMediaAtom                     4100
1309 #define PPT_PST_ExVideo                         4101
1310 #define PPT_PST_ExAviMovie                      4102
1311 #define PPT_PST_ExMCIMovie                      4103
1312 #define PPT_PST_ExMIDIAudio                     4109
1313 #define PPT_PST_ExCDAudio                       4110
1314 #define PPT_PST_ExWAVAudioEmbedded              4111
1315 #define PPT_PST_ExWAVAudioLink                  4112
1316 #define PPT_PST_ExOleObjStg                     4113
1317 #define PPT_PST_ExCDAudioAtom                   4114
1318 #define PPT_PST_ExWAVAudioEmbeddedAtom          4115
1319 #define PPT_PST_AnimationInfo               4116
1320 #define PPT_PST_RTFDateTimeMCAtom           4117
1321 #define PPT_PST_ProgTags                    5000
1322 #define PPT_PST_ProgStringTag               5001
1323 #define PPT_PST_ProgBinaryTag               5002
1324 #define PPT_PST_BinaryTagData               5003
1325 #define PPT_PST_PrintOptions                6000
1326 #define PPT_PST_PersistPtrFullBlock         6001
1327 #define PPT_PST_PersistPtrIncrementalBlock  6002
1328 
1329 // these atoms first was seen in ppt2000 in a private Tag atom
1330 #define PPT_PST_NewlyAddedAtomByPPT2000_6010    6010
1331 #define PPT_PST_NewlyAddedAtomByPPT2000_6011    6011
1332 
1333 #define PPT_PST_RulerIndentAtom            10000
1334 #define PPT_PST_GscalingAtom               10001
1335 #define PPT_PST_GrColorAtom                10002
1336 #define PPT_PST_GLPointAtom                10003
1337 #define PPT_PST_GlineAtom                  10004
1338 
1339 #define PPT_PST_NewlyAddedAtomByXP11008     11008
1340 #define PPT_PST_NewlyAddedAtomByXP11010     11010
1341 #define PPT_PST_Comment10                   12000
1342 #define PPT_PST_CommentAtom10               12001
1343 #define PPT_PST_NewlyAddedAtomByXP12004     12004
1344 #define PPT_PST_NewlyAddedAtomByXP12010     12010
1345 #define PPT_PST_NewlyAddedAtomByXP12011     12011
1346 #define PPT_PST_NewlyAddedAtomByXP14001     14001
1347 
1348 // Attribute fuer PptTextStyleSheet
1349 #define PPT_ParaAttr_BulletOn       0   //00000001
1350 #define PPT_ParaAttr_BuHardFont     1   //00000002
1351 #define PPT_ParaAttr_BuHardColor    2   //00000004
1352 #define PPT_ParaAttr_BuHardHeight   3   //00000008
1353 #define PPT_ParaAttr_BulletFont     4   //00000010
1354 #define PPT_ParaAttr_BulletColor    5   //00000020
1355 #define PPT_ParaAttr_BulletHeight   6   //00000040
1356 #define PPT_ParaAttr_BulletChar     7   //00000080
1357 
1358 #define PPT_ParaAttr_DontKnow1      8   //00000100
1359 #define PPT_ParaAttr_DontKnow2      9   //00000200
1360 #define PPT_ParaAttr_DontKnow3      10  //00000400
1361 #define PPT_ParaAttr_Adjust         11  //00000800 0000=Left, 0001=Center, 0002=Right, 0003=Block
1362 
1363 #define PPT_ParaAttr_LineFeed       12  //00001000
1364 #define PPT_ParaAttr_UpperDist      13  //00002000 ist bei Textframes default immer auf 0032 gesetzt
1365 #define PPT_ParaAttr_LowerDist      14  //00004000
1366 #define PPT_ParaAttr_TextOfs        15  //00008000
1367 
1368 #define PPT_ParaAttr_BulletOfs      16  //00010000
1369 #define PPT_ParaAttr_DefaultTab     17  //00020000
1370 #define PPT_ParaAttr_AsianLB_1      18
1371 #define PPT_ParaAttr_AsianLB_2      19
1372 #define PPT_ParaAttr_AsianLB_3      20
1373 #define PPT_ParaAttr_BiDi           21  //00200000
1374 
1375 #define PPT_CharAttr_Bold               0   //00000001
1376 #define PPT_CharAttr_Italic             1   //00000002
1377 #define PPT_CharAttr_Underline          2   //00000004
1378 #define PPT_CharAttr_Shadow             4   //00000010
1379 #define PPT_CharAttr_Strikeout          8   //00000100
1380 #define PPT_CharAttr_Embossed           9   //00000200
1381 #define PPT_CharAttr_ResetNumbering     10  //00000400
1382 #define PPT_CharAttr_EnableNumbering1   11  //00000800
1383 #define PPT_CharAttr_EnableNumbering2   12  //00001000
1384 #define PPT_CharAttr_Font               16  //00010000
1385 #define PPT_CharAttr_AsianOrComplexFont 21  //00200000
1386 #define PPT_CharAttr_ANSITypeface       22  //00400000
1387 #define PPT_CharAttr_Symbol             23  //00800000
1388 #define PPT_CharAttr_FontHeight         17  //00020000
1389 #define PPT_CharAttr_FontColor          18  //00040000
1390 #define PPT_CharAttr_Escapement         19  //00080000
1391 
1392 // Werte fuer PptSlideLayoutAtom.eLayout
1393 #define PPT_LAYOUT_TITLESLIDE               0   // The slide is a title slide
1394 #define PPT_LAYOUT_TITLEANDBODYSLIDE        1   // Title and body slide
1395 #define PPT_LAYOUT_TITLEMASTERSLIDE         2   // Title master slide
1396 #define PPT_LAYOUT_MASTERSLIDE              3   // Master slide layout
1397 #define PPT_LAYOUT_MASTERNOTES              4   // Master notes layout
1398 #define PPT_LAYOUT_NOTESTITLEBODY           5   // Notes title/body layout
1399 #define PPT_LAYOUT_HANDOUTLAYOUT            6   // Handout layout, therefore it doesn't have placeholders except header, footer, and date
1400 #define PPT_LAYOUT_ONLYTITLE                7   // Only title placeholder
1401 #define PPT_LAYOUT_2COLUMNSANDTITLE         8   // Body of the slide has 2 columns and a title
1402 #define PPT_LAYOUT_2ROWSANDTITLE            9   // Slide's body has 2 rows and a title
1403 #define PPT_LAYOUT_RIGHTCOLUMN2ROWS         10  // Body contains 2 columns, right column has 2 rows
1404 #define PPT_LAYOUT_LEFTCOLUMN2ROWS          11  // Body contains 2 columns, left column has 2 rows
1405 #define PPT_LAYOUT_BOTTOMROW2COLUMNS        12  // Body contains 2 rows, bottom row has 2 columns
1406 #define PPT_LAYOUT_TOPROW2COLUMN            13  // Body contains 2 rows, top row has 2 columns
1407 #define PPT_LAYOUT_4OBJECTS                 14  // 4 objects
1408 #define PPT_LAYOUT_BIGOBJECT                15  // Big object
1409 #define PPT_LAYOUT_BLANCSLIDE               16  // Blank slide
1410 #define PPT_LAYOUT_TITLERIGHTBODYLEFT       17  // Vertical title on the right, body on the left
1411 #define PPT_LAYOUT_TITLERIGHT2BODIESLEFT    18  // Vertical title on the right, body on the left split into 2 rows
1412 
1413 // the following table describes the placeholder id's (values from reality followed by values taken from the documentation)
1414 #define PPT_PLACEHOLDER_NONE                    0   //  0 None
1415 #define PPT_PLACEHOLDER_MASTERTITLE             1   //  1 Master title
1416 #define PPT_PLACEHOLDER_MASTERBODY              2   //  2 Master body
1417 #define PPT_PLACEHOLDER_MASTERCENTEREDTITLE     3   //  3 Master centered title
1418 #define PPT_PLACEHOLDER_MASTERSUBTITLE          4   // 10 Master subtitle
1419 #define PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE   5   //  4 Master notes slide image
1420 #define PPT_PLACEHOLDER_MASTERNOTESBODYIMAGE    6   //  5 Master notes body image
1421 #define PPT_PLACEHOLDER_MASTERDATE              7   //  6 Master date
1422 #define PPT_PLACEHOLDER_MASTERSLIDENUMBER       8   //  7 Master slide number
1423 #define PPT_PLACEHOLDER_MASTERFOOTER            9   //  8 Master footer
1424 #define PPT_PLACEHOLDER_MASTERHEADER            10  //  9 Master header
1425 #define PPT_PLACEHOLDER_GENERICTEXTOBJECT           // 11 Generic text object
1426 #define PPT_PLACEHOLDER_TITLE                   13  // 12 Title
1427 #define PPT_PLACEHOLDER_BODY                    14  // 13 Body
1428 #define PPT_PLACEHOLDER_NOTESBODY               12  // 14 Notes body
1429 #define PPT_PLACEHOLDER_CENTEREDTITLE           15  // 15 Centered title
1430 #define PPT_PLACEHOLDER_SUBTITLE                16  // 16 Subtitle
1431 #define PPT_PLACEHOLDER_VERTICALTEXTTITLE       17  // 17 Vertical text title
1432 #define PPT_PLACEHOLDER_VERTICALTEXTBODY        18  // 18 Vertical text body
1433 #define PPT_PLACEHOLDER_NOTESSLIDEIMAGE         11  // 19 Notes slide image
1434 #define PPT_PLACEHOLDER_OBJECT                  19  // 20 Object (no matter the size)
1435 #define PPT_PLACEHOLDER_GRAPH                   20  // 21 Graph
1436 #define PPT_PLACEHOLDER_TABLE                   21  // 22 Table
1437 #define PPT_PLACEHOLDER_CLIPART                 22  // 23 Clip Art
1438 #define PPT_PLACEHOLDER_ORGANISZATIONCHART      23  // 24 Organization Chart
1439 #define PPT_PLACEHOLDER_MEDIACLIP               24  // 25 Media Clip
1440 
1441 ////////////////////////////////////////////////////////////////////////////////////////////////////
1442 
1443 #endif // SVX_LIGHT
1444 
1445 #endif //_SVDFPPT_HXX
1446 
1447