Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_FILTER_MSFILTER_SVDFPPT_HXX
21 : #define INCLUDED_FILTER_MSFILTER_SVDFPPT_HXX
22 :
23 : #include <rtl/ustring.hxx>
24 : #include <tools/solar.h>
25 : #include <tools/gen.hxx>
26 : #include <tools/color.hxx>
27 : #include <svx/svdobj.hxx>
28 : #include <editeng/numitem.hxx>
29 : #include <editeng/editdata.hxx>
30 : #include <filter/msfilter/msdffimp.hxx>
31 : #include <filter/msfilter/msocximex.hxx>
32 : #include <editeng/eeitem.hxx>
33 : #define ITEMID_FIELD EE_FEATURE_FIELD
34 : #include <editeng/flditem.hxx>
35 : #undef ITEMID_FIELD
36 : #include <filter/msfilter/msfilterdllapi.h>
37 : #include <vcl/font.hxx>
38 : #include <vector>
39 : #include <boost/noncopyable.hpp>
40 : #include <boost/optional.hpp>
41 : #include <boost/ptr_container/ptr_vector.hpp>
42 :
43 : class SdrModel;
44 : class SdPage;
45 : class SdrPage;
46 : class SdrObject;
47 : class SvStream;
48 : class Polygon;
49 : namespace tools { class PolyPolygon; }
50 : class SfxItemSet;
51 : class Outliner;
52 : class Graphic;
53 : class SvxMSDffManager;
54 : class PPTTextObj;
55 : class DffRecordHeader;
56 : class SvxBulletItem;
57 : enum class PptSlideLayout;
58 : enum class PptPlaceholder;
59 :
60 : #define PPT_IMPORTFLAGS_NO_TEXT_ASSERT 1
61 :
62 13 : struct MSFILTER_DLLPUBLIC PptCurrentUserAtom
63 : {
64 : sal_uInt32 nMagic;
65 : sal_uInt32 nCurrentUserEdit;
66 : sal_uInt16 nDocFileVersion;
67 : sal_uInt8 nMajorVersion;
68 : sal_uInt8 nMinorVersion;
69 : OUString aCurrentUser;
70 :
71 : public:
72 :
73 13 : PptCurrentUserAtom() : nMagic ( 0 ),
74 : nCurrentUserEdit ( 0 ),
75 : nDocFileVersion ( 0 ),
76 : nMajorVersion ( 0 ),
77 13 : nMinorVersion ( 0 ) {}
78 :
79 : MSFILTER_DLLPUBLIC friend SvStream& ReadPptCurrentUserAtom( SvStream& rIn, PptCurrentUserAtom& rAtom );
80 : };
81 :
82 13 : struct MSFILTER_DLLPUBLIC PowerPointImportParam
83 : {
84 : SvStream& rDocStream;
85 : sal_uInt32 nImportFlags;
86 : PptCurrentUserAtom aCurrentUserAtom;
87 :
88 : PowerPointImportParam( SvStream& rDocStream, sal_uInt32 nImportFlags );
89 : };
90 :
91 0 : struct SdHyperlinkEntry
92 : {
93 : sal_uInt32 nIndex;
94 : sal_Int32 nPrivate1;
95 : sal_Int32 nPrivate2;
96 : sal_Int32 nPrivate3;
97 : sal_Int32 nInfo;
98 : OUString aTarget;
99 : OUString aSubAdress;
100 :
101 : sal_Int32 nStartPos;
102 : sal_Int32 nEndPos;
103 :
104 : OUString aConvSubString;
105 : ESelection aESelection;
106 : bool bSelection;
107 : };
108 :
109 : // Helper class for reading the PPT InteractiveInfoAtom
110 : struct MSFILTER_DLLPUBLIC PptInteractiveInfoAtom
111 : {
112 : sal_uInt32 nSoundRef;
113 : sal_uInt32 nExHyperlinkId;
114 : sal_uInt8 nAction;
115 : sal_uInt8 nOleVerb;
116 : sal_uInt8 nJump;
117 : sal_uInt8 nFlags;
118 : sal_uInt8 nHyperlinkType;
119 :
120 : // unknown, because total size is 16
121 : sal_uInt8 nUnknown1;
122 : sal_uInt8 nUnknown2;
123 : sal_uInt8 nUnknown3;
124 :
125 : public:
126 :
127 : MSFILTER_DLLPUBLIC friend SvStream& ReadPptInteractiveInfoAtom( SvStream& rIn, PptInteractiveInfoAtom& rAtom );
128 : };
129 :
130 : enum PptPageKind { PPT_MASTERPAGE, PPT_SLIDEPAGE, PPT_NOTEPAGE };
131 :
132 : enum PptPageFormat
133 : { PPTPF_SCREEN,
134 : PPTPF_USLETTER, // 8.5x11"
135 : PPTPF_A4, // 210x297mm
136 : PPTPF_35MMDIA, // DIA
137 : PPTPF_OVERHEAD,
138 : PPTPF_CUSTOM
139 : };
140 :
141 : // values for PPT_PST_TextHeaderAtom's sal_uLong
142 : enum PPT_TextHeader
143 : {
144 : PPTTH_TITLE,
145 : PPTTH_BODY,
146 : PPTTH_NOTES,
147 : PPTTH_NOTUSED,
148 : PPTTH_OTHER, // Text in a Shape
149 : PPTTH_CENTERBODY, // Subtitle in Title-Slide
150 : PPTTH_CENTERTITLE, // Title in Title-Slide
151 : PPTTH_HALFBODY, // Body in two-column slide
152 : PPTTH_QUARTERBODY // Body in four-body slide
153 : };
154 :
155 : #define TSS_TYPE_PAGETITLE (0)
156 : #define TSS_TYPE_BODY (1)
157 : #define TSS_TYPE_NOTES (2)
158 : #define TSS_TYPE_UNUSED (3)
159 : #define TSS_TYPE_TEXT_IN_SHAPE (4)
160 : #define TSS_TYPE_SUBTITLE (5)
161 : #define TSS_TYPE_TITLE (6)
162 : #define TSS_TYPE_HALFBODY (7)
163 : #define TSS_TYPE_QUARTERBODY (8)
164 :
165 : // Inventor-Id for PPT UserData
166 : const sal_uInt32 PPTInventor = sal_uInt32('P') * 0x00000001
167 : + sal_uInt32('P') * 0x00000100
168 : + sal_uInt32('T') * 0x00010000
169 : + sal_uInt32('0') * 0x01000000;
170 :
171 : // Object IDs for StarDraw UserData
172 : #define PPT_OBJECTINFO_ID (1)
173 :
174 13 : struct MSFILTER_DLLPUBLIC PptDocumentAtom
175 : {
176 : Size aSlidesPageSize; // page size of the slides in 576DPI
177 : Size aNotesPageSize; // page size of the notes in 576DPI
178 : // avoid RatioAtom for the time being
179 : sal_uInt32 nNotesMasterPersist; // 0=non-existent
180 : sal_uInt32 nHandoutMasterPersist; // 0=non-existent
181 : sal_uInt16 n1stPageNumber; // page number of the first slide
182 : PptPageFormat eSlidesPageFormat; // page format of the slides
183 : bool bEmbeddedTrueType : 1; // TrueType direcly within the File?
184 : bool bTitlePlaceholdersOmitted : 1;
185 : bool bRightToLeft : 1;
186 : bool bShowComments : 1;
187 :
188 : public:
189 :
190 : static Size GetPageSize( const Size& rSiz );
191 67 : Size GetSlidesPageSize() const { return GetPageSize( aSlidesPageSize ); }
192 79 : Size GetNotesPageSize() const { return GetPageSize( aNotesPageSize ); }
193 :
194 : friend SvStream& ReadPptDocumentAtom( SvStream& rIn, PptDocumentAtom& rAtom );
195 : };
196 :
197 : struct PptSlideLayoutAtom
198 : {
199 : PptSlideLayout eLayout; // 0..18
200 : PptPlaceholder aPlaceholderId[ 8 ];
201 :
202 : public:
203 107 : PptSlideLayoutAtom() { Clear(); }
204 : void Clear();
205 :
206 : // SlideLayoutAtom is read without header!
207 : friend SvStream& ReadPptSlideLayoutAtom( SvStream& rIn, PptSlideLayoutAtom& rAtom );
208 : };
209 :
210 : struct PptSlideAtom
211 : {
212 : PptSlideLayoutAtom aLayout;
213 : sal_uInt32 nMasterId;
214 : sal_uInt32 nNotesId;
215 : sal_uInt16 nFlags;
216 :
217 : public:
218 107 : PptSlideAtom() { Clear(); }
219 : void Clear();
220 :
221 : friend SvStream& ReadPptSlideAtom(SvStream& rIn, PptSlideAtom& rAtom);
222 : };
223 :
224 : struct PptSlidePersistAtom
225 : {
226 : sal_uInt32 nPsrReference;
227 : sal_uInt32 nFlags;
228 : sal_uInt32 nNumberTexts;
229 : sal_uInt32 nSlideId;
230 : sal_uInt32 nReserved; // we will use nReserved temporarly to set the offset to SSSlideInfoAtom ( if possible )
231 :
232 : public:
233 107 : PptSlidePersistAtom() { Clear(); }
234 : void Clear();
235 :
236 : friend SvStream& ReadPptSlidePersistAtom(SvStream& rIn, PptSlidePersistAtom& rAtom);
237 : };
238 :
239 : struct PptNotesAtom
240 : {
241 : sal_uInt32 nSlideId;
242 : sal_uInt16 nFlags;
243 :
244 : public:
245 107 : PptNotesAtom() { Clear(); }
246 : void Clear();
247 :
248 : friend SvStream& ReadPptNotesAtom(SvStream& rIn, PptNotesAtom& rAtom);
249 : };
250 :
251 : struct PptColorSchemeAtom
252 : {
253 : sal_uInt8 aData[32];
254 :
255 : public:
256 120 : PptColorSchemeAtom () { Clear(); }
257 : void Clear();
258 : Color GetColor( sal_uInt16 nNum ) const;
259 :
260 : friend SvStream& ReadPptColorSchemeAtom(SvStream& rIn, PptColorSchemeAtom& rAtom);
261 : };
262 :
263 90 : struct PptFontEntityAtom
264 : {
265 : OUString aName;
266 : double fScaling;
267 : sal_uInt8 lfClipPrecision;
268 : sal_uInt8 lfQuality;
269 :
270 : sal_uInt32 nUniqueFontId; // not used anymore
271 : rtl_TextEncoding eCharSet;
272 : FontFamily eFamily;
273 : FontPitch ePitch;
274 : bool bAvailable;
275 :
276 : friend SvStream& ReadPptFontEntityAtom(SvStream& rIn, PptFontEntityAtom& rAtom);
277 : };
278 :
279 : class PptFontCollection;
280 : struct PptUserEditAtom
281 : {
282 : DffRecordHeader aHd;
283 : sal_Int32 nLastSlideID; // ID of last visible slide
284 : sal_uInt32 nVersion; // This is major/minor/build which did the edit
285 : sal_uInt32 nOffsetLastEdit; // File offset of prev PptUserEditAtom
286 : sal_uInt32 nOffsetPersistDirectory; // Offset to PersistPtrs for this file version.
287 : sal_uInt32 nDocumentRef;
288 : sal_uInt32 nMaxPersistWritten; // total number of Persist entries up to this point
289 : sal_Int16 eLastViewType; // enum view type
290 :
291 : public:
292 13 : PptUserEditAtom()
293 : : nLastSlideID( 0 )
294 : , nVersion( 0 )
295 : , nOffsetLastEdit( 0 )
296 : , nOffsetPersistDirectory( 0 )
297 : , nDocumentRef( 0 )
298 : , nMaxPersistWritten( 0 )
299 13 : , eLastViewType( 0 )
300 13 : {}
301 :
302 : friend SvStream& ReadPptUserEditAtom( SvStream& rIn, PptUserEditAtom& rAtom );
303 : };
304 :
305 : struct PptOEPlaceholderAtom
306 : {
307 : sal_uInt32 nPlacementId;
308 : PptPlaceholder nPlaceholderId;
309 : sal_uInt8 nPlaceholderSize; // 0=Full size, 1=Half size, 2=Quarter of Slide
310 :
311 : public:
312 1549 : PptOEPlaceholderAtom() { Clear(); }
313 : void Clear();
314 :
315 : friend SvStream& ReadPptOEPlaceholderAtom( SvStream& rIn, PptOEPlaceholderAtom& rAtom );
316 : };
317 :
318 : struct ProcessData;
319 : struct PPTStyleSheet;
320 : struct HeaderFooterEntry;
321 : struct PptSlidePersistEntry : private boost::noncopyable
322 : {
323 : PptSlidePersistAtom aPersistAtom;
324 : PptSlideAtom aSlideAtom;
325 : PptNotesAtom aNotesAtom;
326 : PptColorSchemeAtom aColorScheme; // each slide includes this colorscheme atom
327 : PPTStyleSheet* pStyleSheet; // stylesheet of this page (only in masterpages), since XP supports more than one masterpage
328 :
329 : sal_uInt32 HeaderFooterOfs[ 4 ]; // containing the ofs to the placeholder (only masterpage)
330 : HeaderFooterEntry* pHeaderFooterEntry;
331 : SvxMSDffSolverContainer* pSolverContainer;
332 : sal_uInt32 nSlidePersistStartOffset;// is an array to the end of the SlidePersistAtom of this page, TextHeaderAtom is following
333 : sal_uInt32 nSlidePersistEndOffset;
334 : sal_uInt32 nBackgroundOffset; // fileoffset
335 : sal_uInt32 nDrawingDgId; // valid, if not -1
336 : sal_uInt32* pPresentationObjects; // if valid, this is a pointer to an array that includes the offsets to the presentation objects
337 : // on this masterpage for each instance (0 - 8);
338 : SdrObject* pBObj;
339 : bool bBObjIsTemporary;
340 :
341 : PptPageKind ePageKind;
342 :
343 : bool bNotesMaster : 1; // for NotesMaster
344 : bool bHandoutMaster : 1; // for HandoutMaster
345 : bool bStarDrawFiller : 1; // special for StarDraw
346 : public:
347 : PptSlidePersistEntry();
348 : ~PptSlidePersistEntry();
349 733 : sal_uInt32 GetSlideId() const { return aPersistAtom.nSlideId; }
350 : };
351 :
352 : #define PPTSLIDEPERSIST_ENTRY_NOTFOUND 0xFFFF
353 :
354 : class MSFILTER_DLLPUBLIC PptSlidePersistList: private boost::noncopyable
355 : {
356 : private:
357 : boost::ptr_vector<PptSlidePersistEntry> mvEntries;
358 :
359 : public:
360 : PptSlidePersistList();
361 : ~PptSlidePersistList();
362 :
363 2055 : size_t size() const { return mvEntries.size(); }
364 : bool is_null( size_t nIdx ) const { return mvEntries.is_null( nIdx ); }
365 : const PptSlidePersistEntry& operator[]( size_t nIdx ) const { return mvEntries[ nIdx ]; }
366 2132 : PptSlidePersistEntry& operator[]( size_t nIdx ) { return mvEntries[ nIdx ]; }
367 25 : boost::ptr_vector<PptSlidePersistEntry>::iterator begin() { return mvEntries.begin(); }
368 25 : void insert( boost::ptr_vector<PptSlidePersistEntry>::iterator it,
369 : PptSlidePersistEntry* pEntry )
370 : {
371 25 : mvEntries.insert(it, pEntry);
372 25 : }
373 82 : void push_back( PptSlidePersistEntry* pEntry ) { mvEntries.push_back(pEntry); }
374 :
375 : sal_uInt16 FindPage( sal_uInt32 nId ) const;
376 : };
377 :
378 : class SfxObjectShell;
379 : struct PPTOleEntry
380 : {
381 : sal_uInt32 nId; // OleId
382 : sal_uInt32 nPersistPtr; // PersistPtr
383 : sal_uInt32 nRecHdOfs; // points to the record header: ExObjListHd
384 : SfxObjectShell* pShell;
385 : sal_uInt16 nType; // maybe PPT_PST_ExEmbed or PPT_PST_ExControl
386 : sal_uInt32 nAspect; // the aspect of the OLE object
387 :
388 4 : PPTOleEntry( sal_uInt32 nid, sal_uInt32 nOfs, SfxObjectShell* pSh, sal_uInt16 nT, sal_uInt32 nAsp )
389 : : nId(nid)
390 : , nPersistPtr(0)
391 : , nRecHdOfs(nOfs)
392 : , pShell(pSh)
393 : , nType(nT)
394 4 : , nAspect(nAsp)
395 4 : {}
396 : };
397 :
398 : struct PptExOleObjAtom
399 : {
400 : sal_uInt32 nAspect;
401 : sal_uInt32 nId;
402 : sal_uInt32 nPersistPtr;
403 :
404 : public:
405 :
406 : friend SvStream& ReadPptExOleObjAtom( SvStream& rIn, PptExOleObjAtom& rAtom );
407 : };
408 :
409 : // SdPage derives from SdrPage, is only known inside sd, and needs to be carried
410 : // around as an opaque pointer here:
411 : struct SdPageCapsule {
412 97 : explicit SdPageCapsule(SdrPage * thePage): page(thePage) {}
413 :
414 : SdrPage * page;
415 : };
416 :
417 : typedef ::std::vector< PPTOleEntry* > PPTOleEntryList;
418 : class PPTExtParaProv;
419 : class MSFILTER_DLLPUBLIC SdrEscherImport : public SvxMSDffManager
420 : {
421 : protected:
422 :
423 : friend class PPTTextObj;
424 : friend class PPTPortionObj;
425 : friend struct PPTStyleTextPropReader;
426 : friend class ImplSdPPTImport;
427 :
428 : PptDocumentAtom aDocAtom;
429 : DffRecordManager aDocRecManager; // contains all first level container and atoms of the document container
430 :
431 : PPTOleEntryList aOleObjectList; // contains PPTOleEntrys
432 :
433 : PptFontCollection* pFonts;
434 :
435 : sal_uInt32 nStreamLen;
436 : sal_uInt16 nTextStylesIndex;
437 :
438 : rtl_TextEncoding eCharSetSystem;
439 :
440 : bool bWingdingsChecked : 1;
441 : bool bWingdingsAvailable : 1;
442 : bool bMonotypeSortsChecked : 1;
443 : bool bMonotypeSortsAvailable : 1;
444 : bool bTimesNewRomanChecked : 1;
445 : bool bTimesNewRomanAvailable : 1;
446 :
447 : bool ReadString( OUString& rStr ) const;
448 : // only for PowerPoint filter:
449 : virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const;
450 :
451 : public:
452 : using SvxMSDffManager::ReadObjText;
453 :
454 : PowerPointImportParam& rImportParam;
455 :
456 : SdrEscherImport( PowerPointImportParam&, const OUString& rBaseURL );
457 : virtual ~SdrEscherImport();
458 : virtual bool GetColorFromPalette( sal_uInt16 nNum, Color& rColor ) const SAL_OVERRIDE;
459 : virtual bool SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const SAL_OVERRIDE;
460 : PptFontEntityAtom* GetFontEnityAtom( sal_uInt32 nNum ) const;
461 : void RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraph );
462 : virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPageCapsule pPage ) const;
463 : virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, Rectangle& rTextRect, SdrObject* pObj ) SAL_OVERRIDE;
464 : virtual void ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, void* pData, DffObjData& rObj ) SAL_OVERRIDE;
465 : void ImportHeaderFooterContainer( DffRecordHeader& rHeader, HeaderFooterEntry& rEntry );
466 : };
467 :
468 :
469 :
470 :
471 : class SvxFieldItem;
472 : struct MSFILTER_DLLPUBLIC PPTFieldEntry
473 : {
474 : sal_uInt16 nPos;
475 : sal_uInt16 nTextRangeEnd;
476 : SvxFieldItem* pField1;
477 : SvxFieldItem* pField2;
478 : OUString* pString;
479 :
480 75 : PPTFieldEntry() : nPos( 0 ), nTextRangeEnd( 0 ), pField1( NULL ), pField2( NULL ), pString( NULL ) {};
481 : ~PPTFieldEntry();
482 :
483 : void SetDateTime( sal_uInt32 nType );
484 :
485 : // converting PPT date time format:
486 : static void GetDateTime(
487 : const sal_uInt32 nVal,
488 : SvxDateFormat& eDateFormat,
489 : SvxTimeFormat& eTimeFormat
490 : );
491 : };
492 :
493 38 : struct MSFILTER_DLLPUBLIC HeaderFooterEntry
494 : {
495 : const PptSlidePersistEntry* pMasterPersist;
496 : OUString pPlaceholder[ 4 ];
497 : sal_uInt32 nAtom;
498 :
499 : static sal_uInt32 GetMaskForInstance( sal_uInt32 nInstance );
500 : sal_uInt32 IsToDisplay( sal_uInt32 nInstance );
501 : sal_uInt32 NeedToImportInstance(
502 : const sal_uInt32 nInstance,
503 : const PptSlidePersistEntry& rSlidePersist
504 : );
505 :
506 : explicit HeaderFooterEntry( const PptSlidePersistEntry* pMaster = NULL );
507 : ~HeaderFooterEntry();
508 : };
509 :
510 : struct ProcessData
511 : {
512 : PptSlidePersistEntry& rPersistEntry;
513 : SdPageCapsule pPage;
514 : ::std::vector< SdrObject* > aBackgroundColoredObjects;
515 : sal_uInt32* pTableRowProperties;
516 :
517 97 : ProcessData( PptSlidePersistEntry& rP, SdPageCapsule pP ) :
518 : rPersistEntry ( rP ),
519 : pPage ( pP ),
520 97 : pTableRowProperties ( NULL ) {};
521 97 : ~ProcessData() { delete[] pTableRowProperties; };
522 : };
523 :
524 :
525 :
526 : typedef ::std::vector< SdHyperlinkEntry* > SdHyperlinkEntryList;
527 : class SdrTextObj;
528 : class SfxObjectShell;
529 :
530 : class MSFILTER_DLLPUBLIC SdrPowerPointImport : public SdrEscherImport
531 : {
532 : protected:
533 :
534 : friend class PPTTextObj;
535 : friend class PPTExtParaProv;
536 : friend struct PPTStyleSheet;
537 : friend class PPTNumberFormatCreator;
538 :
539 : bool bOk;
540 : PptUserEditAtom aUserEditAtom;
541 : PptColorSchemeAtom aPageColors;
542 : SdHyperlinkEntryList aHyperList;
543 : sal_uInt32* pPersistPtr;
544 : sal_uLong nPersistPtrAnz;
545 :
546 : const PPTStyleSheet* pPPTStyleSheet; // this is the current stylesheet;
547 : const PPTStyleSheet* pDefaultSheet; // this is a sheet we are using if no masterpage can be found, but that should
548 : // never happen just preventing a crash
549 : PptSlidePersistList* pMasterPages;
550 : PptSlidePersistList* pSlidePages;
551 : PptSlidePersistList* pNotePages;
552 : sal_uInt16 nAktPageNum;
553 : sal_uLong nDocStreamPos;
554 : sal_uInt16 nPageColorsNum;
555 : PptPageKind ePageColorsKind;
556 : PptPageKind eAktPageKind;
557 :
558 : protected:
559 : using SdrEscherImport::ReadObjText;
560 :
561 : bool SeekToAktPage(DffRecordHeader* pRecHd=NULL) const;
562 : bool SeekToDocument(DffRecordHeader* pRecHd=NULL) const;
563 : static bool SeekToContentOfProgTag(
564 : sal_Int32 nVersion,
565 : SvStream& rSt,
566 : const DffRecordHeader& rProgTagBinaryDataHd,
567 : DffRecordHeader& rContentHd
568 : );
569 : virtual SdrObject* ApplyTextObj(
570 : PPTTextObj* pTextObj,
571 : SdrTextObj* pText,
572 : SdPageCapsule pPage,
573 : SfxStyleSheet*,
574 : SfxStyleSheet** )
575 : const;
576 : virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPageCapsule pPage ) const SAL_OVERRIDE;
577 : // #i32596# - new parameter <_nCalledByGroup>, which
578 : // indicates, if the OLE object is imported inside a group object.
579 : virtual SdrObject* ImportOLE(
580 : long nOLEId,
581 : const Graphic& rGraf,
582 : const Rectangle& rBoundRect,
583 : const Rectangle& rVisArea,
584 : const int _nCalledByGroup,
585 : sal_Int64 nAspect
586 : ) const SAL_OVERRIDE;
587 : SvMemoryStream* ImportExOleObjStg( sal_uInt32 nPersistPtr, sal_uInt32& nOleId ) const;
588 : SdrPage* MakeBlancPage(bool bMaster) const;
589 : bool ReadFontCollection();
590 : bool ForceFontCollection() const
591 : { return pFonts != nullptr || const_cast<SdrPowerPointImport*>(this)->ReadFontCollection(); }
592 : PptSlidePersistList* GetPageList(PptPageKind ePageKind) const;
593 : sal_uInt32 GetAktPageId();
594 : sal_uInt32 GetMasterPageId(sal_uInt16 nPageNum, PptPageKind ePageKind) const;
595 : sal_uInt32 GetNotesPageId(sal_uInt16 nPageNum ) const;
596 : static SdrOutliner* GetDrawOutliner( SdrTextObj* pSdrText );
597 : void SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions );
598 :
599 : void ApplyTextAnchorAttributes( PPTTextObj& rTextObj, SfxItemSet& rSet ) const;
600 : bool IsVerticalText() const;
601 :
602 : public:
603 : SdrPowerPointImport( PowerPointImportParam&, const OUString& rBaseURL );
604 : virtual ~SdrPowerPointImport();
605 : sal_uInt16 GetPageCount( PptPageKind eKind = PPT_SLIDEPAGE ) const;
606 : void SetPageNum( sal_uInt16 nPageNum, PptPageKind = PPT_SLIDEPAGE );
607 : sal_uInt16 GetPageNum() const { return nAktPageNum; }
608 : PptPageKind GetPageKind() const { return eAktPageKind; }
609 : Size GetPageSize() const;
610 : SdrObject* ImportPageBackgroundObject(
611 : const SdrPage& rPage,
612 : sal_uInt32& nBgFileOffset,
613 : bool bForce
614 : );
615 : bool IsNoteOrHandout( sal_uInt16 nPageNum, PptPageKind ePageKind ) const;
616 : bool HasMasterPage(
617 : sal_uInt16 nPageNum,
618 : PptPageKind ePageKind = PPT_SLIDEPAGE
619 : ) const;
620 : sal_uInt16 GetMasterPageIndex(
621 : sal_uInt16 nPageNum,
622 : PptPageKind ePageKind = PPT_SLIDEPAGE
623 : ) const;
624 :
625 : void ImportPage( SdrPage* pPage, const PptSlidePersistEntry* pMasterPersist = NULL );
626 : virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const SAL_OVERRIDE;
627 : virtual bool SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const SAL_OVERRIDE;
628 : const PptDocumentAtom& GetDocumentAtom() const { return aDocAtom; }
629 : virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const SAL_OVERRIDE;
630 : SdrObject* CreateTable(
631 : SdrObject* pGroupObject,
632 : sal_uInt32* pTableArry,
633 : SvxMSDffSolverContainer*
634 : );
635 : virtual bool ReadFormControl( tools::SvRef<SotStorage>& rSrc1, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const = 0;
636 : };
637 :
638 : struct PPTTextCharacterStyleAtomInterpreter
639 : {
640 : sal_uInt16 nFlags1;
641 : sal_uInt16 nFlags2;
642 : sal_uInt16 nFlags3;
643 : sal_Int32 n1;
644 : sal_uInt16 nFontHeight;
645 : sal_Int32 nFontColor;
646 :
647 : PPTTextCharacterStyleAtomInterpreter();
648 : ~PPTTextCharacterStyleAtomInterpreter();
649 :
650 : bool Read( SvStream& rIn, const DffRecordHeader& rRecHd );
651 :
652 : sal_uInt32 GetColor( sal_uInt32 nDefault );
653 : };
654 :
655 : struct PPTTextParagraphStyleAtomInterpreter
656 : {
657 : bool bValid;
658 : bool bForbiddenRules;
659 : bool bHangingPunctuation;
660 : bool bLatinTextWrap;
661 :
662 : PPTTextParagraphStyleAtomInterpreter();
663 : ~PPTTextParagraphStyleAtomInterpreter();
664 :
665 : bool Read( SvStream& rIn, const DffRecordHeader& rRecHd );
666 : };
667 :
668 : struct PPTTextSpecInfo
669 : {
670 : sal_uInt32 nCharIdx;
671 : sal_uInt16 nLanguage[ 3 ];
672 : sal_uInt16 nDontKnow;
673 :
674 : explicit PPTTextSpecInfo( sal_uInt32 nCharIdx );
675 : ~PPTTextSpecInfo();
676 : };
677 :
678 : typedef ::std::vector< PPTTextSpecInfo* > PPTTextSpecInfoList;
679 : struct PPTTextSpecInfoAtomInterpreter
680 : {
681 : bool bValid;
682 : PPTTextSpecInfoList aList;
683 :
684 : PPTTextSpecInfoAtomInterpreter();
685 : ~PPTTextSpecInfoAtomInterpreter();
686 :
687 : bool Read(
688 : SvStream& rIn,
689 : const DffRecordHeader& rRecHd,
690 : sal_uInt16 nRecordType,
691 : const PPTTextSpecInfo* pTextSpecDefault = NULL
692 : );
693 :
694 : };
695 :
696 : #define PPT_STYLESHEETENTRYS 9
697 :
698 : struct PPTExtParaLevel
699 : {
700 : sal_uInt32 mnExtParagraphMask;
701 : sal_uInt16 mnBuBlip;
702 : sal_uInt16 mnHasAnm;
703 : sal_uInt32 mnAnmScheme;
704 : sal_uInt32 mpfPP10Ext;
705 : sal_uInt32 mnExtCharacterMask;
706 : sal_uInt32 mcfPP10Ext;
707 : bool mbSet;
708 :
709 : PPTExtParaLevel();
710 : friend SvStream& ReadPPTExtParaLevel( SvStream& rIn, PPTExtParaLevel& rL );
711 : };
712 :
713 135 : struct PPTExtParaSheet
714 : {
715 : PPTExtParaLevel aExtParaLevel[ 5 ];
716 : };
717 :
718 0 : struct PPTBuGraEntry
719 : {
720 : sal_uInt32 nInstance;
721 : Graphic aBuGra;
722 :
723 : PPTBuGraEntry( Graphic& rGraphic, sal_uInt32 nInstance );
724 : };
725 :
726 : typedef ::std::vector< PPTBuGraEntry* > PPTBuGraEntryList;
727 :
728 : class PPTExtParaProv
729 : {
730 : PPTBuGraEntryList aBuGraList;
731 :
732 : public :
733 : bool bStyles;
734 : bool bGraphics;
735 : DffRecordManager aExtendedPresRules;
736 :
737 : PPTExtParaSheet aExtParaSheet[ PPT_STYLESHEETENTRYS ];
738 :
739 : bool GetGraphic( sal_uInt32 nInstance, Graphic& rGraphic ) const;
740 :
741 : PPTExtParaProv(
742 : SdrPowerPointImport& rManager,
743 : SvStream& rSt,
744 : const DffRecordHeader* pMainMasterHd
745 : );
746 : ~PPTExtParaProv();
747 : };
748 :
749 675 : struct PPTCharLevel
750 : {
751 : Color mnFontColorInStyleSheet;
752 : sal_uInt32 mnFontColor;
753 : sal_uInt16 mnFlags;
754 : sal_uInt16 mnFont;
755 : sal_uInt16 mnAsianOrComplexFont;
756 : sal_uInt16 mnFontHeight;
757 : sal_uInt16 mnEscapement;
758 : };
759 :
760 : struct PPTCharSheet
761 : {
762 : PPTCharLevel maCharLevel[ 5 ];
763 :
764 : explicit PPTCharSheet( sal_uInt32 nInstance );
765 : PPTCharSheet( const PPTCharSheet& rCharSheet );
766 :
767 : void Read( SvStream& rIn, bool bMasterStyle, sal_uInt32 nLevel, bool bFirst );
768 : };
769 :
770 : struct PPTParaLevel
771 : {
772 : sal_uInt16 mnBuFlags;
773 : sal_uInt16 mnBulletChar;
774 : sal_uInt16 mnBulletFont;
775 : sal_uInt16 mnBulletHeight;
776 : sal_uInt32 mnBulletColor;
777 :
778 : sal_uInt16 mnAdjust;
779 : sal_uInt16 mnLineFeed;
780 : sal_uInt16 mnUpperDist;
781 : sal_uInt16 mnLowerDist;
782 : sal_uInt16 mnTextOfs;
783 : sal_uInt16 mnBulletOfs;
784 : sal_uInt16 mnDefaultTab;
785 : sal_uInt16 mnAsianLineBreak; // bit0: use asian rules for first and last character
786 : // 1: do not wrap latin text in the middle of the word
787 : // 2: allow hanging punctuation
788 : sal_uInt16 mnBiDi;
789 : };
790 :
791 : struct PPTParaSheet
792 : {
793 : public:
794 :
795 : PPTParaLevel maParaLevel[ 5 ];
796 :
797 : explicit PPTParaSheet( sal_uInt32 nInstance );
798 : PPTParaSheet( const PPTParaSheet& rParaSheet );
799 :
800 : bool Read(
801 : SdrPowerPointImport& rMan,
802 : SvStream& rIn,
803 : bool bMasterStyle,
804 : sal_uInt32 nLevel,
805 : bool bFirst
806 : );
807 : void UpdateBulletRelSize( sal_uInt32 nLevel, sal_uInt16 nFontHeight );
808 : };
809 :
810 : class PPTParagraphObj;
811 : class PPTNumberFormatCreator
812 : {
813 : sal_uInt32 nIsBullet;
814 : sal_uInt32 nBulletChar;
815 : sal_uInt32 nBulletFont;
816 : sal_uInt32 nBulletHeight;
817 : sal_uInt32 nBulletColor;
818 : sal_uInt32 nTextOfs;
819 : sal_uInt32 nBulletOfs;
820 :
821 : void ImplGetNumberFormat(
822 : SdrPowerPointImport& rMan,
823 : SvxNumberFormat& rNumberFormat,
824 : sal_uInt32 nLevel
825 : );
826 : bool ImplGetExtNumberFormat(
827 : SdrPowerPointImport& rMan,
828 : SvxNumberFormat& rNumberFormat,
829 : sal_uInt32 nLevel,
830 : sal_uInt32 nInstance,
831 : sal_uInt32 nInstanceInSheet,
832 : boost::optional< sal_Int16 >& rStartNumbering,
833 : sal_uInt32 nFontHeight,
834 : PPTParagraphObj* pPara
835 : );
836 :
837 : protected:
838 :
839 : PPTNumberFormatCreator( PPTExtParaProv* );
840 : ~PPTNumberFormatCreator();
841 :
842 : public:
843 :
844 : PPTExtParaProv* pExtParaProv;
845 :
846 : void GetNumberFormat(
847 : SdrPowerPointImport& rMan,
848 : SvxNumberFormat& rNumberFormat,
849 : sal_uInt32 nLevel,
850 : const PPTParaLevel& rParaLevel,
851 : const PPTCharLevel& rCharLevel,
852 : sal_uInt32 nInstance
853 : );
854 :
855 : bool GetNumberFormat(
856 : SdrPowerPointImport& rMan,
857 : SvxNumberFormat& rNumberFormat,
858 : PPTParagraphObj* pPara,
859 : sal_uInt32 nInstanceInSheet,
860 : boost::optional< sal_Int16 >& rStartNumbering
861 : );
862 : };
863 :
864 : class SvxNumBulletItem;
865 : struct PPTStyleSheet : public PPTNumberFormatCreator
866 : {
867 : PPTTextSpecInfo maTxSI;
868 : PPTCharSheet* mpCharSheet[ PPT_STYLESHEETENTRYS ];
869 : PPTParaSheet* mpParaSheet[ PPT_STYLESHEETENTRYS ];
870 : SvxNumBulletItem* mpNumBulletItem[ PPT_STYLESHEETENTRYS ];
871 :
872 : PPTStyleSheet(
873 : const DffRecordHeader& rSlideHd,
874 : SvStream& rSt, SdrPowerPointImport&,
875 : const PPTTextCharacterStyleAtomInterpreter&,
876 : const PPTTextParagraphStyleAtomInterpreter&,
877 : const PPTTextSpecInfo&
878 : );
879 : ~PPTStyleSheet();
880 : };
881 :
882 : struct ImplPPTParaPropSet
883 : {
884 : sal_uInt32 mnRefCount;
885 :
886 : sal_uInt16 mnDepth;
887 : sal_uInt32 mnAttrSet;
888 : sal_uInt32 mnBulletColor;
889 : sal_uInt16 mpArry[ 22 ];
890 :
891 : sal_uInt32 mnExtParagraphMask;
892 : sal_uInt32 mnAnmScheme;
893 : sal_uInt16 mnHasAnm;
894 : sal_uInt16 mnBuBlip;
895 :
896 : sal_uInt32 nDontKnow1;
897 : sal_uInt32 nDontKnow2;
898 : sal_uInt16 nDontKnow2bit06;
899 :
900 923 : ImplPPTParaPropSet()
901 : : mnRefCount( 1 )
902 : , mnDepth( 0 )
903 : , mnAttrSet( 0 )
904 : , mnBulletColor( 0 )
905 : , mnExtParagraphMask( 0 )
906 : , mnAnmScheme( 0 )
907 : , mnHasAnm( 0 )
908 : , mnBuBlip( 0 )
909 : , nDontKnow1( 0 )
910 : , nDontKnow2( 0 )
911 923 : , nDontKnow2bit06( 0 )
912 923 : { }
913 : };
914 :
915 : struct PPTParaPropSet
916 : {
917 : sal_uInt32 mnOriginalTextPos;
918 : ImplPPTParaPropSet* pParaSet;
919 :
920 : PPTParaPropSet();
921 : PPTParaPropSet( PPTParaPropSet& rParaPropSet );
922 : ~PPTParaPropSet();
923 :
924 : PPTParaPropSet& operator=( PPTParaPropSet& rParaPropSet );
925 : };
926 :
927 : struct ImplPPTCharPropSet
928 : {
929 : sal_uInt32 mnRefCount;
930 :
931 : sal_uInt32 mnAttrSet;
932 : sal_uInt16 mnFlags;
933 : sal_uInt32 mnColor;
934 : sal_uInt16 mnFont;
935 : sal_uInt16 mnAsianOrComplexFont;
936 : sal_uInt16 mnANSITypeface;
937 : sal_uInt16 mnFontHeight;
938 : sal_uInt16 mnEscapement;
939 : sal_uInt16 mnSymbolFont;
940 :
941 1303 : ImplPPTCharPropSet()
942 : : mnRefCount ( 1 )
943 : , mnAttrSet( 0 )
944 : , mnFlags( 0 )
945 : , mnColor( 0 )
946 : , mnFont( 0 )
947 : , mnAsianOrComplexFont( 0 )
948 : , mnANSITypeface( 0 )
949 : , mnFontHeight( 0 )
950 : , mnEscapement( 0 )
951 1303 : , mnSymbolFont( 0)
952 1303 : { }
953 : };
954 :
955 : struct PPTCharPropSet
956 : {
957 : //when the bullet text has more than two color,next the text following with bullet has been set hyperlink.
958 : //now,the bullet color should be set original hyperlink text's color
959 : //so "mbHardHylinkOrigColor" hold the original hyperlink text's color.
960 : sal_uInt32 mnHylinkOrigColor;
961 : //the bullet text weather has a hyperlink.
962 : bool mbIsHyperlink;
963 : //the hyperlink text weather has a custom color.
964 : bool mbHardHylinkOrigColor;
965 :
966 : sal_uInt32 mnOriginalTextPos;
967 : sal_uInt32 mnParagraph;
968 : OUString maString;
969 : SvxFieldItem* mpFieldItem;
970 : sal_uInt16 mnLanguage[ 3 ];
971 :
972 : ImplPPTCharPropSet* pCharSet;
973 :
974 : void SetFont( sal_uInt16 nFont );
975 : void SetColor( sal_uInt32 nColor );
976 :
977 : explicit PPTCharPropSet( sal_uInt32 nParagraph );
978 : PPTCharPropSet( const PPTCharPropSet& rCharPropSet );
979 : PPTCharPropSet( const PPTCharPropSet& rCharPropSet, sal_uInt32 nParagraph );
980 : ~PPTCharPropSet();
981 :
982 : PPTCharPropSet& operator=( const PPTCharPropSet& rCharPropSet );
983 :
984 : private:
985 : void ImplMakeUnique();
986 : };
987 :
988 : struct PPTTabEntry
989 : {
990 : sal_uInt16 nOffset;
991 : sal_uInt16 nStyle;
992 : };
993 :
994 : struct PPTRuler
995 : {
996 : sal_uInt32 nRefCount;
997 :
998 : sal_Int32 nFlags;
999 : sal_uInt16 nDefaultTab;
1000 : sal_uInt16 nTextOfs[ 5 ];
1001 : sal_uInt16 nBulletOfs[ 5 ];
1002 : PPTTabEntry* pTab;
1003 : sal_uInt16 nTabCount;
1004 :
1005 : PPTRuler();
1006 : ~PPTRuler();
1007 : };
1008 :
1009 : struct PPTTextRulerInterpreter
1010 : {
1011 : PPTRuler *mpImplRuler;
1012 :
1013 : PPTTextRulerInterpreter();
1014 : PPTTextRulerInterpreter( PPTTextRulerInterpreter& rRuler );
1015 : PPTTextRulerInterpreter(
1016 : sal_uInt32 nFileOfs,
1017 : DffRecordHeader& rHd,
1018 : SvStream& rIn
1019 : );
1020 : ~PPTTextRulerInterpreter();
1021 :
1022 0 : sal_uInt16 GetTabOffsetByIndex( sal_uInt16 nIndex ) const
1023 0 : { return mpImplRuler->pTab[ nIndex ].nOffset; };
1024 :
1025 0 : sal_uInt16 GetTabStyleByIndex( sal_uInt16 nIndex ) const
1026 0 : { return mpImplRuler->pTab[ nIndex ].nStyle; };
1027 :
1028 203 : sal_uInt16 GetTabCount() const { return mpImplRuler->nTabCount; };
1029 : bool GetDefaultTab( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
1030 : bool GetTextOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
1031 : bool GetBulletOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
1032 :
1033 : PPTTextRulerInterpreter& operator=( PPTTextRulerInterpreter& rRuler );
1034 : };
1035 :
1036 : #define PPT_SPEC_NEWLINE 0x10000
1037 : #define PPT_SPEC_SYMBOL 0x20000
1038 :
1039 : struct StyleTextProp9
1040 : {
1041 : sal_uInt32 mnExtParagraphMask;
1042 : sal_uInt16 mnBuBlip;
1043 : sal_uInt16 mnHasAnm;
1044 : sal_uInt32 mnAnmScheme;
1045 : sal_uInt32 mpfPP10Ext;
1046 : sal_uInt32 mnExtCharacterMask;
1047 : sal_uInt32 mncfPP10Ext;
1048 : sal_uInt32 mnSpecialInfoMask;
1049 : sal_uInt32 mnPP10Ext;
1050 : sal_uInt16 mfBidi;
1051 :
1052 5 : StyleTextProp9()
1053 : : mnExtParagraphMask( 0 )
1054 : , mnBuBlip( 0 )
1055 : , mnHasAnm( 0 )
1056 : , mnAnmScheme( 0 )
1057 : , mpfPP10Ext( 0 )
1058 : , mnExtCharacterMask( 0 )
1059 : , mncfPP10Ext( 0 )
1060 : , mnSpecialInfoMask( 0 )
1061 : , mnPP10Ext( 0 )
1062 5 : , mfBidi( 0 )
1063 : {
1064 5 : }
1065 : void Read( SvStream& rSt );
1066 : };
1067 :
1068 : typedef std::vector<PPTParaPropSet*> PPTParaPropSetList;
1069 : typedef std::vector<PPTCharPropSet*> PPTCharPropSetList;
1070 :
1071 : struct PPTStyleTextPropReader
1072 : {
1073 : std::vector< sal_uInt32 > aSpecMarkerList; // hiword -> Flags, loword -> Position
1074 : PPTParaPropSetList aParaPropList;
1075 : PPTCharPropSetList aCharPropList;
1076 :
1077 : PPTStyleTextPropReader(
1078 : SvStream& rIn,
1079 : const DffRecordHeader& rClientTextBoxHd,
1080 : PPTTextRulerInterpreter& rInterpreter,
1081 : const DffRecordHeader& rExtParaHd,
1082 : sal_uInt32 nTextInstance
1083 : );
1084 : ~PPTStyleTextPropReader();
1085 :
1086 : void Init(
1087 : SvStream& rIn,
1088 : const DffRecordHeader& rClientTextBoxHd,
1089 : PPTTextRulerInterpreter& rInterpreter,
1090 : const DffRecordHeader& rExtParaHd,
1091 : sal_uInt32 nTextInstance
1092 : );
1093 : void ReadParaProps(
1094 : SvStream& rIn,
1095 : const DffRecordHeader& rTextHeader,
1096 : const OUString& aString,
1097 : PPTTextRulerInterpreter& rRuler,
1098 : sal_uInt32& nCharCount,
1099 : bool& bTextPropAtom
1100 : );
1101 : static void ReadCharProps(
1102 : SvStream& rIn,
1103 : PPTCharPropSet& aCharPropSet,
1104 : const OUString& aString,
1105 : sal_uInt32& nCharCount,
1106 : sal_uInt32 nCharAnzRead,
1107 : bool& bTextPropAtom,
1108 : sal_uInt32 nExtParaPos,
1109 : const std::vector< StyleTextProp9 >& aStyleTextProp9,
1110 : sal_uInt32& nExtParaFlags,
1111 : sal_uInt16& nBuBlip,
1112 : sal_uInt16& nHasAnm,
1113 : sal_uInt32& nAnmScheme
1114 : );
1115 : };
1116 :
1117 : class SvxFieldItem;
1118 : class MSFILTER_DLLPUBLIC PPTPortionObj : public PPTCharPropSet
1119 : {
1120 :
1121 : friend class PPTParagraphObj;
1122 :
1123 : const PPTStyleSheet& mrStyleSheet;
1124 : sal_uInt32 mnInstance;
1125 : sal_uInt32 mnDepth;
1126 :
1127 : public:
1128 :
1129 : bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet ) const;
1130 : SvxFieldItem* GetTextField();
1131 :
1132 : PPTPortionObj( const PPTStyleSheet&, sal_uInt32 nInstance, sal_uInt32 nDepth );
1133 : PPTPortionObj(
1134 : const PPTCharPropSet&,
1135 : const PPTStyleSheet&,
1136 : sal_uInt32 nInstance,
1137 : sal_uInt32 nDepth
1138 : );
1139 : PPTPortionObj( const PPTPortionObj& );
1140 : ~PPTPortionObj();
1141 :
1142 : // the following function should be removed during next full update
1143 : void ApplyTo(
1144 : SfxItemSet& rSet,
1145 : SdrPowerPointImport& rManager,
1146 : sal_uInt32 nInstanceInSheet
1147 : );
1148 : void ApplyTo(
1149 : SfxItemSet& rSet,
1150 : SdrPowerPointImport& rManager,
1151 : sal_uInt32 nInstanceInSheet,
1152 : const PPTTextObj* pTextObj
1153 : );
1154 2593 : sal_uInt32 Count() const { return ( mpFieldItem ) ? 1 : maString.getLength(); };
1155 : bool HasTabulator();
1156 : };
1157 :
1158 : class MSFILTER_DLLPUBLIC PPTParagraphObj
1159 : : public PPTParaPropSet,
1160 : public PPTNumberFormatCreator,
1161 : public PPTTextRulerInterpreter
1162 : {
1163 : friend class PPTTextObj;
1164 : friend class PPTNumberFormatCreator;
1165 :
1166 : const PPTStyleSheet& mrStyleSheet;
1167 : sal_uInt32 mnInstance;
1168 :
1169 : public:
1170 :
1171 : bool mbTab; // if true, this paragraph has tabulators in text
1172 :
1173 : sal_uInt32 mnCurrentObject;
1174 : ::boost::ptr_vector<PPTPortionObj> m_PortionList;
1175 :
1176 : void UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const;
1177 : bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet );
1178 :
1179 : PPTParagraphObj(
1180 : const PPTStyleSheet&,
1181 : sal_uInt32 nInstance,
1182 : sal_uInt16 nDepth
1183 : );
1184 : PPTParagraphObj(
1185 : PPTStyleTextPropReader&,
1186 : size_t nCurParaPos,
1187 : size_t& rnCurCharPos,
1188 : const PPTStyleSheet&,
1189 : sal_uInt32 nInstance,
1190 : PPTTextRulerInterpreter& rRuler
1191 : );
1192 : ~PPTParagraphObj();
1193 :
1194 : sal_uInt32 GetTextSize();
1195 : PPTPortionObj* First();
1196 : PPTPortionObj* Next();
1197 :
1198 : void AppendPortion( PPTPortionObj& rPortion );
1199 : void ApplyTo(
1200 : SfxItemSet& rSet,
1201 : boost::optional< sal_Int16 >& rStartNumbering,
1202 : SdrPowerPointImport& rManager,
1203 : sal_uInt32 nInstanceInSheet,
1204 : const PPTParagraphObj* pPrev
1205 : );
1206 : };
1207 :
1208 : #define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT 1
1209 : #define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER 2
1210 : #define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT 4
1211 : #define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK 8
1212 : #define PPT_TEXTOBJ_FLAGS_VERTICAL 16
1213 :
1214 : struct ImplPPTTextObj
1215 : {
1216 : sal_uInt32 mnRefCount;
1217 : sal_uInt32 mnShapeId;
1218 : sal_uInt32 mnShapeMaster;
1219 : PptOEPlaceholderAtom* mpPlaceHolderAtom;
1220 : sal_uInt16 mnInstance;
1221 : sal_uInt16 mnDestinationInstance;
1222 : MSO_SPT meShapeType;
1223 :
1224 : sal_uInt32 mnCurrentObject;
1225 : sal_uInt32 mnParagraphCount;
1226 : PPTParagraphObj** mpParagraphList;
1227 : PptSlidePersistEntry& mrPersistEntry;
1228 :
1229 : sal_uInt32 mnTextFlags;
1230 :
1231 1300 : explicit ImplPPTTextObj( PptSlidePersistEntry& rPersistEntry )
1232 : : mnRefCount(0)
1233 : , mnShapeId(0)
1234 : , mnShapeMaster(0)
1235 : , mpPlaceHolderAtom(NULL)
1236 : , mnInstance(0)
1237 : , mnDestinationInstance(0)
1238 : , meShapeType(mso_sptMin)
1239 : , mnCurrentObject(0)
1240 : , mnParagraphCount(0)
1241 : , mpParagraphList(NULL)
1242 : , mrPersistEntry ( rPersistEntry )
1243 1300 : , mnTextFlags(0) {};
1244 : };
1245 :
1246 : class MSFILTER_DLLPUBLIC PPTTextObj
1247 : {
1248 : ImplPPTTextObj* mpImplTextObj;
1249 : void ImplClear();
1250 :
1251 : PPTTextObj(){};
1252 : public:
1253 : PPTTextObj(
1254 : SvStream& rSt,
1255 : SdrPowerPointImport&,
1256 : PptSlidePersistEntry&,
1257 : DffObjData*
1258 : );
1259 : PPTTextObj( PPTTextObj& rTextObj );
1260 : ~PPTTextObj();
1261 :
1262 892 : sal_uInt32 GetCurrentIndex() const { return mpImplTextObj->mnCurrentObject; };
1263 2150 : sal_uInt32 Count() const { return mpImplTextObj->mnParagraphCount; };
1264 : PPTParagraphObj* First();
1265 : PPTParagraphObj* Next();
1266 80 : MSO_SPT GetShapeType() const { return mpImplTextObj->meShapeType; };
1267 3997 : sal_uInt32 GetInstance() const { return mpImplTextObj->mnInstance; };
1268 44 : void SetInstance( sal_uInt16 nInstance )
1269 44 : { mpImplTextObj->mnInstance = nInstance; }
1270 :
1271 2055 : sal_uInt32 GetDestinationInstance() const
1272 2055 : { return mpImplTextObj->mnDestinationInstance; }
1273 :
1274 1102 : void SetDestinationInstance( sal_uInt16 nInstance )
1275 1102 : { mpImplTextObj->mnDestinationInstance = nInstance; }
1276 :
1277 2709 : PptOEPlaceholderAtom* GetOEPlaceHolderAtom() const { return mpImplTextObj->mpPlaceHolderAtom; }
1278 716 : sal_uInt32 GetTextFlags() const { return mpImplTextObj->mnTextFlags; }
1279 698 : void SetVertical( bool bVertical )
1280 : {
1281 698 : if ( bVertical )
1282 0 : mpImplTextObj->mnTextFlags |= PPT_TEXTOBJ_FLAGS_VERTICAL;
1283 : else
1284 698 : mpImplTextObj->mnTextFlags &= ~PPT_TEXTOBJ_FLAGS_VERTICAL;
1285 698 : }
1286 655 : bool GetVertical() const
1287 655 : { return ( mpImplTextObj->mnTextFlags & PPT_TEXTOBJ_FLAGS_VERTICAL ) != 0; }
1288 :
1289 : const SfxItemSet* GetBackground() const;
1290 :
1291 : PPTTextObj& operator=( PPTTextObj& rTextObj );
1292 : };
1293 :
1294 0 : class PPTConvertOCXControls : public SvxMSConvertOCXControls
1295 : {
1296 : virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > & GetDrawPage() SAL_OVERRIDE;
1297 : PptPageKind ePageKind;
1298 : const SdrPowerPointImport* mpPPTImporter;
1299 : com::sun::star::uno::Reference< com::sun::star::io::XInputStream > mxInStrm;
1300 : public :
1301 :
1302 0 : PPTConvertOCXControls( const SdrPowerPointImport* pPPTImporter, com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& rxInStrm, const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxModel, PptPageKind ePKind ) :
1303 : SvxMSConvertOCXControls ( rxModel ),
1304 : ePageKind ( ePKind ),
1305 : mpPPTImporter ( pPPTImporter ),
1306 0 : mxInStrm ( rxInStrm )
1307 0 : {};
1308 : bool ReadOCXStream( tools::SvRef<SotStorage>& rSrc1,
1309 : com::sun::star::uno::Reference<
1310 : com::sun::star::drawing::XShape > *pShapeRef=0,
1311 : bool bFloatingCtrl=false );
1312 : virtual bool InsertControl(
1313 : const com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > &rFComp,
1314 : const com::sun::star::awt::Size& rSize,
1315 : com::sun::star::uno::Reference< com::sun::star::drawing::XShape > *pShape,
1316 : bool bFloatingCtrl
1317 : ) SAL_OVERRIDE;
1318 : };
1319 :
1320 : // PowerPoint record types
1321 : #define PPT_PST_Document 1000
1322 : #define PPT_PST_DocumentAtom 1001
1323 : #define PPT_PST_SlideAtom 1007
1324 : #define PPT_PST_NotesAtom 1009
1325 : #define PPT_PST_Environment 1010
1326 : #define PPT_PST_SlidePersistAtom 1011
1327 : #define PPT_PST_SSSlideInfoAtom 1017
1328 : #define PPT_PST_VBAInfo 1023
1329 : #define PPT_PST_VBAInfoAtom 1024
1330 : #define PPT_PST_SSDocInfoAtom 1025
1331 : #define PPT_PST_ExObjList 1033
1332 : #define PPT_PST_PPDrawingGroup 1035
1333 : #define PPT_PST_PPDrawing 1036
1334 : #define PPT_PST_GridSpacing10Atom 1037
1335 : #define PPT_PST_NamedShows 1040
1336 : #define PPT_PST_NamedShow 1041
1337 : #define PPT_PST_NamedShowSlides 1042
1338 : #define PPT_PST_List 2000
1339 : #define PPT_PST_FontCollection 2005
1340 : #define PPT_PST_SoundCollection 2020
1341 : #define PPT_PST_Sound 2022
1342 : #define PPT_PST_SoundData 2023
1343 : #define PPT_PST_ColorSchemeAtom 2032
1344 :
1345 : // these atoms first was seen in ppt2000 in a private Tag atom
1346 : #define PPT_PST_ExtendedBuGraContainer 2040 // consist of 4041
1347 : #define PPT_PST_ExtendedBuGraAtom 2041 // the instance of this atom indices the current graphic
1348 :
1349 : #define PPT_PST_ExObjRefAtom 3009
1350 : #define PPT_PST_OEPlaceholderAtom 3011
1351 : #define PPT_PST_OutlineTextRefAtom 3998
1352 : #define PPT_PST_TextHeaderAtom 3999
1353 : #define PPT_PST_TextCharsAtom 4000
1354 : #define PPT_PST_StyleTextPropAtom 4001
1355 : #define PPT_PST_TxMasterStyleAtom 4003
1356 : #define PPT_PST_TxPFStyleAtom 4005
1357 : #define PPT_PST_TextRulerAtom 4006
1358 : #define PPT_PST_TextBytesAtom 4008
1359 : #define PPT_PST_TxSIStyleAtom 4009
1360 : #define PPT_PST_TextSpecInfoAtom 4010
1361 :
1362 : // these atoms first was seen in ppt2000 in a private Tag atom
1363 : #define PPT_PST_ExtendedParagraphAtom 4012
1364 : #define PPT_PST_ExtendedParagraphMasterAtom 4013
1365 : #define PPT_PST_ExtendedPresRuleContainer 4014 // consist of 4012, 4015,
1366 : #define PPT_PST_ExtendedParagraphHeaderAtom 4015 // the instance of this atom indices the current presobj
1367 : // the first sal_uInt32 in this atom indices the current slideId
1368 : #define PPT_PST_TextDefaults9Atom 4016
1369 :
1370 : #define PPT_PST_FontEntityAtom 4023
1371 : #define PPT_PST_CString 4026
1372 : #define PPT_PST_ExOleObjAtom 4035
1373 : #define PPT_PST_SrKinsoku 4040
1374 : #define PPT_PST_ExEmbed 4044
1375 : #define PPT_PST_ExHyperlinkAtom 4051
1376 : #define PPT_PST_ExHyperlink 4055
1377 : #define PPT_PST_SlideNumberMCAtom 4056
1378 : #define PPT_PST_HeadersFooters 4057
1379 : #define PPT_PST_HeadersFootersAtom 4058
1380 : #define PPT_PST_TxInteractiveInfoAtom 4063
1381 : #define PPT_PST_MasterText 4068
1382 : #define PPT_PST_RecolorInfoAtom 4071
1383 : #define PPT_PST_ExControl 4078
1384 : #define PPT_PST_SlideListWithText 4080
1385 : #define PPT_PST_AnimationInfoAtom 4081
1386 : #define PPT_PST_InteractiveInfo 4082
1387 : #define PPT_PST_InteractiveInfoAtom 4083
1388 : #define PPT_PST_UserEditAtom 4085
1389 : #define PPT_PST_CurrentUserAtom 4086
1390 : #define PPT_PST_DateTimeMCAtom 4087
1391 : #define PPT_PST_GenericDateMCAtom 4088
1392 : #define PPT_PST_HeaderMCAtom 4089
1393 : #define PPT_PST_FooterMCAtom 4090
1394 : #define PPT_PST_ExMediaAtom 4100
1395 : #define PPT_PST_ExVideo 4101
1396 : #define PPT_PST_ExAviMovie 4102
1397 : #define PPT_PST_ExMCIMovie 4103
1398 : #define PPT_PST_AnimationInfo 4116
1399 : #define PPT_PST_RTFDateTimeMCAtom 4117
1400 : #define PPT_PST_ProgTags 5000
1401 : #define PPT_PST_ProgBinaryTag 5002
1402 : #define PPT_PST_BinaryTagData 5003
1403 : #define PPT_PST_PersistPtrIncrementalBlock 6002
1404 :
1405 : // these atoms first was seen in ppt2000 in a private Tag atom
1406 : #define PPT_PST_PresentationAdvisorFlags9Atom 6010
1407 : #define PPT_PST_HtmlDocInfo9Atom 6011
1408 :
1409 :
1410 : #define PPT_PST_HashCodeAtom 11008
1411 : #define PPT_PST_BuildList 11010
1412 : #define PPT_PST_Comment10 12000
1413 : #define PPT_PST_CommentAtom10 12001
1414 : #define PPT_PST_CommentIndex10 12004
1415 : #define PPT_PST_SlideFlags10Atom 12010
1416 : #define PPT_PST_SlideTime10Atom 12011
1417 : #define PPT_PST_DocToolbarStates10Atom 14001
1418 :
1419 : // attributes for PptTextStyleSheet
1420 : #define PPT_ParaAttr_BulletOn 0 //00000001
1421 : #define PPT_ParaAttr_BuHardFont 1 //00000002
1422 : #define PPT_ParaAttr_BuHardColor 2 //00000004
1423 : #define PPT_ParaAttr_BuHardHeight 3 //00000008
1424 : #define PPT_ParaAttr_BulletFont 4 //00000010
1425 : #define PPT_ParaAttr_BulletColor 5 //00000020
1426 : #define PPT_ParaAttr_BulletHeight 6 //00000040
1427 : #define PPT_ParaAttr_BulletChar 7 //00000080
1428 : #define PPT_ParaAttr_Adjust 11 //00000800 0000=Left, 0001=Center, 0002=Right, 0003=Block
1429 : #define PPT_ParaAttr_LineFeed 12 //00001000
1430 : #define PPT_ParaAttr_UpperDist 13 //00002000 is set to 0032 for TextFrames by default
1431 : #define PPT_ParaAttr_LowerDist 14 //00004000
1432 : #define PPT_ParaAttr_TextOfs 15 //00008000
1433 : #define PPT_ParaAttr_BulletOfs 16 //00010000
1434 : #define PPT_ParaAttr_DefaultTab 17 //00020000
1435 : #define PPT_ParaAttr_AsianLB_1 18
1436 : #define PPT_ParaAttr_AsianLB_2 19
1437 : #define PPT_ParaAttr_AsianLB_3 20
1438 : #define PPT_ParaAttr_BiDi 21 //00200000
1439 :
1440 : #define PPT_CharAttr_Bold 0 //00000001
1441 : #define PPT_CharAttr_Italic 1 //00000002
1442 : #define PPT_CharAttr_Underline 2 //00000004
1443 : #define PPT_CharAttr_Shadow 4 //00000010
1444 : #define PPT_CharAttr_Strikeout 8 //00000100
1445 : #define PPT_CharAttr_Embossed 9 //00000200
1446 : #define PPT_CharAttr_Font 16 //00010000
1447 : #define PPT_CharAttr_AsianOrComplexFont 21 //00200000
1448 : #define PPT_CharAttr_ANSITypeface 22 //00400000
1449 : #define PPT_CharAttr_Symbol 23 //00800000
1450 : #define PPT_CharAttr_FontHeight 17 //00020000
1451 : #define PPT_CharAttr_FontColor 18 //00040000
1452 : #define PPT_CharAttr_Escapement 19 //00080000
1453 :
1454 : // values for PptSlideLayoutAtom.eLayout
1455 : enum class PptSlideLayout
1456 : {
1457 : TITLESLIDE = 0, // The slide is a title slide
1458 : TITLEANDBODYSLIDE = 1, // Title and body slide
1459 : TITLEMASTERSLIDE = 2, // Title master slide
1460 : MASTERSLIDE = 3, // Master slide layout
1461 : MASTERNOTES = 4, // Master notes layout
1462 : NOTESTITLEBODY = 5, // Notes title/body layout
1463 : HANDOUTLAYOUT = 6, // Handout layout, therefore it doesn't have placeholders except header, footer, and date
1464 : ONLYTITLE = 7, // Only title placeholder
1465 : TWOCOLUMNSANDTITLE = 8, // Body of the slide has 2 columns and a title
1466 : TWOROWSANDTITLE = 9, // Slide's body has 2 rows and a title
1467 : RIGHTCOLUMN2ROWS = 10, // Body contains 2 columns, right column has 2 rows
1468 : LEFTCOLUMN2ROWS = 11, // Body contains 2 columns, left column has 2 rows
1469 : BOTTOMROW2COLUMNS = 12, // Body contains 2 rows, bottom row has 2 columns
1470 : TOPROW2COLUMN = 13, // Body contains 2 rows, top row has 2 columns
1471 : FOUROBJECTS = 14, // 4 objects
1472 : BIGOBJECT = 15, // Big object
1473 : BLANCSLIDE = 16, // Blank slide
1474 : TITLERIGHTBODYLEFT = 17, // Vertical title on the right, body on the left
1475 : TITLERIGHT2BODIESLEFT = 18 // Vertical title on the right, body on the left split into 2 rows
1476 : };
1477 :
1478 : // the following table describes the placeholder id's (values from reality followed by values taken from the documentation)
1479 : enum class PptPlaceholder
1480 : {
1481 : NONE = 0, // 0 None
1482 : MASTERTITLE = 1, // 1 Master title
1483 : MASTERBODY = 2, // 2 Master body
1484 : MASTERCENTEREDTITLE = 3, // 3 Master centered title
1485 : MASTERSUBTITLE = 4, // 10 Master subtitle
1486 : MASTERNOTESSLIDEIMAGE = 5, // 4 Master notes slide image
1487 : MASTERNOTESBODYIMAGE = 6, // 5 Master notes body image
1488 : MASTERDATE = 7, // 6 Master date
1489 : MASTERSLIDENUMBER = 8, // 7 Master slide number
1490 : MASTERFOOTER = 9, // 8 Master footer
1491 : MASTERHEADER = 10, // 9 Master header
1492 : // 11 Generic text object
1493 : TITLE = 13, // 12 Title
1494 : BODY = 14, // 13 Body
1495 : NOTESBODY = 12, // 14 Notes body
1496 : CENTEREDTITLE = 15, // 15 Centered title
1497 : SUBTITLE = 16, // 16 Subtitle
1498 : VERTICALTEXTTITLE = 17, // 17 Vertical text title
1499 : VERTICALTEXTBODY = 18, // 18 Vertical text body
1500 : NOTESSLIDEIMAGE = 11, // 19 Notes slide image
1501 : OBJECT = 19, // 20 Object (no matter the size)
1502 : GRAPH = 20, // 21 Graph
1503 : TABLE = 21, // 22 Table
1504 : CLIPART = 22, // 23 Clip Art
1505 : ORGANISZATIONCHART = 23, // 24 Organization Chart
1506 : MEDIACLIP = 24 // 25 Media Clip
1507 : };
1508 :
1509 : #endif // INCLUDED_FILTER_MSFILTER_SVDFPPT_HXX
1510 :
1511 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|