fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / filter / eppt / epptbase.hxx
blob2566b98eb9b3c58283fbaab0810a87369c714412
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef EPPT_EPPTBASE_HXX
21 #define EPPT_EPPTBASE_HXX
23 #include <vector>
24 #include <boost/ptr_container/ptr_vector.hpp>
26 #include <vcl/mapmod.hxx>
27 #include <tools/string.hxx>
28 #include <tools/stream.hxx>
29 #include <tools/gen.hxx>
30 #include <com/sun/star/beans/XPropertySet.hpp>
31 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
32 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
33 #include <com/sun/star/drawing/XMasterPageTarget.hpp>
34 #include <com/sun/star/frame/XModel.hpp>
35 #include <com/sun/star/presentation/XPresentationSupplier.hpp>
36 #include <com/sun/star/presentation/FadeEffect.hpp>
37 #include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
39 #include "grouptable.hxx"
41 // PLACEMENT_ID
42 #define EPP_LAYOUT_TITLESLIDE 0 /* The slide is a title slide */
43 #define EPP_LAYOUT_TITLEANDBODYSLIDE 1 /* Title and body slide */
44 #define EPP_LAYOUT_TITLEMASTERSLIDE 2 /* Title master slide */
45 #define EPP_LAYOUT_MASTERSLIDE 3 /* Master slide layout */
46 #define EPP_LAYOUT_MASTERNOTES 4 /* Master notes layout */
47 #define EPP_LAYOUT_NOTESTITLEBODY 5 /* Notes title/body layout */
48 #define EPP_LAYOUT_HANDOUTLAYOUT 6 /* Handout layout, therefore it doesn't have placeholders except header, footer, and date */
49 #define EPP_LAYOUT_ONLYTITLE 7 /* Only title placeholder */
50 #define EPP_LAYOUT_2COLUMNSANDTITLE 8 /* Body of the slide has 2 columns and a title */
51 #define EPP_LAYOUT_2ROWSANDTITLE 9 /* Slide's body has 2 rows and a title */
52 #define EPP_LAYOUT_RIGHTCOLUMN2ROWS 10 /* Body contains 2 columns, right column has 2 rows */
53 #define EPP_LAYOUT_LEFTCOLUMN2ROWS 11 /* Body contains 2 columns, left column has 2 rows */
54 #define EPP_LAYOUT_BOTTOMROW2COLUMNS 12 /* Body contains 2 rows, bottom row has 2 columns */
55 #define EPP_LAYOUT_TOPROW2COLUMN 13 /* Body contains 2 rows, top row has 2 columns */
56 #define EPP_LAYOUT_4OBJECTS 14 /* 4 objects */
57 #define EPP_LAYOUT_BIGOBJECT 15 /* Big object */
58 #define EPP_LAYOUT_BLANCSLIDE 16 /* Blank slide */
59 #define EPP_LAYOUT_TITLERIGHTBODYLEFT 17 /* Vertical title on the right, body on the left */
60 #define EPP_LAYOUT_TITLERIGHT2BODIESLEFT 18 /* Vertical title on the right, body on the left split into 2 rows */
62 #define EPP_LAYOUT_SIZE 25
64 class PptEscherEx;
66 struct PHLayout
68 sal_Int32 nLayout;
69 sal_uInt8 nPlaceHolder[ 8 ];
71 sal_uInt8 nUsedObjectPlaceHolder;
72 sal_uInt8 nTypeOfTitle;
73 sal_uInt8 nTypeOfOutliner;
75 sal_Bool bTitlePossible;
76 sal_Bool bOutlinerPossible;
77 sal_Bool bSecOutlinerPossible;
80 enum PageType { NORMAL = 0, MASTER = 1, NOTICE = 2, UNDEFINED = 3, LAYOUT = 4 };
82 class PropValue
84 protected :
86 ::com::sun::star::uno::Any mAny;
88 ::com::sun::star::uno::Reference
89 < ::com::sun::star::beans::XPropertySet > mXPropSet;
91 sal_Bool ImplGetPropertyValue( const OUString& rString );
92 sal_Bool ImplGetPropertyValue( const ::com::sun::star::uno::Reference
93 < ::com::sun::star::beans::XPropertySet > &, const OUString& );
95 public :
97 PropValue() {}
99 PropValue( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet )
100 : mXPropSet( rXPropSet )
103 ::com::sun::star::uno::Any GetAny() { return mAny; }
105 static sal_Bool GetPropertyValue(
106 ::com::sun::star::uno::Any& rAny,
107 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
108 const String& rPropertyName,
109 sal_Bool bTestPropertyAvailability = sal_False );
111 static ::com::sun::star::beans::PropertyState GetPropertyState(
112 const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > &,
113 const String& rPropertyName );
116 class EscherGraphicProvider;
117 class PPTExBulletProvider
119 friend struct PPTExParaSheet;
121 protected :
123 SvMemoryStream aBuExPictureStream;
124 SvMemoryStream aBuExOutlineStream;
125 SvMemoryStream aBuExMasterStream;
127 EscherGraphicProvider* pGraphicProv;
129 public :
131 sal_uInt16 GetId( const OString& rUniqueId, Size& rGraphicSize );
133 PPTExBulletProvider();
134 ~PPTExBulletProvider();
137 struct FontCollectionEntry
139 String Name;
140 double Scaling;
141 sal_Int16 Family;
142 sal_Int16 Pitch;
143 sal_Int16 CharSet;
145 String Original;
146 sal_Bool bIsConverted;
148 FontCollectionEntry( const String& rName, sal_Int16 nFamily, sal_Int16 nPitch, sal_Int16 nCharSet ) :
149 Scaling ( 1.0 ),
150 Family ( nFamily ),
151 Pitch ( nPitch ),
152 CharSet ( nCharSet ),
153 Original( rName )
155 ImplInit( rName );
158 FontCollectionEntry( const String& rName ) :
159 Scaling ( 1.0 ),
160 Family ( 0 ),
161 Pitch ( 0 ),
162 CharSet ( 0 ),
163 Original( rName )
165 ImplInit( rName );
167 ~FontCollectionEntry();
169 private :
171 FontCollectionEntry() {};
173 void ImplInit( const String& rName );
176 class VirtualDevice;
177 class FontCollection
179 public :
181 FontCollection();
183 ~FontCollection();
185 short GetScriptDirection( const OUString& rText ) const;
187 sal_uInt32 GetId( FontCollectionEntry& rFontDescriptor );
189 inline sal_uInt32 GetCount() const { return maFonts.size(); };
191 const FontCollectionEntry* GetById( sal_uInt32 nId );
193 FontCollectionEntry& GetLast() { return *(maFonts.rbegin()); };
195 private:
197 VirtualDevice* pVDev;
198 boost::ptr_vector<FontCollectionEntry> maFonts;
201 // ------------------------------------------------------------------------
203 #define PPTEX_STYLESHEETENTRYS 9
205 enum PPTExTextAttr
207 ParaAttr_BulletOn,
208 ParaAttr_BuHardFont,
209 ParaAttr_BuHardColor,
210 ParaAttr_BuHardHeight,
211 ParaAttr_BulletChar,
212 ParaAttr_BulletFont,
213 ParaAttr_BulletHeight,
214 ParaAttr_BulletColor,
215 ParaAttr_Adjust,
216 ParaAttr_LineFeed,
217 ParaAttr_UpperDist,
218 ParaAttr_LowerDist,
219 ParaAttr_TextOfs,
220 ParaAttr_BulletOfs,
221 ParaAttr_DefaultTab,
222 ParaAttr_AsianLB_1,
223 ParaAttr_AsianLB_2,
224 ParaAttr_AsianLB_3,
225 ParaAttr_BiDi,
226 CharAttr_Bold,
227 CharAttr_Italic,
228 CharAttr_Underline,
229 CharAttr_Shadow,
230 CharAttr_Strikeout,
231 CharAttr_Embossed,
232 CharAttr_Font,
233 CharAttr_AsianOrComplexFont,
234 CharAttr_Symbol,
235 CharAttr_FontHeight,
236 CharAttr_FontColor,
237 CharAttr_Escapement
240 struct PPTExCharLevel
242 sal_uInt16 mnFlags;
243 sal_uInt16 mnFont;
244 sal_uInt16 mnAsianOrComplexFont;
245 sal_uInt16 mnFontHeight;
246 sal_uInt16 mnEscapement;
247 sal_uInt32 mnFontColor;
250 struct PPTExCharSheet
252 PPTExCharLevel maCharLevel[ 5 ];
254 PPTExCharSheet( int nInstance );
256 void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
257 FontCollection& rFontCollection, int nLevel );
258 void Write( SvStream& rSt, PptEscherEx* pEx, sal_uInt16 nLev, sal_Bool bFirst, sal_Bool bSimpleText,
259 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet );
263 struct PPTExParaLevel
265 sal_Bool mbIsBullet;
266 sal_uInt16 mnBulletChar;
267 sal_uInt16 mnBulletFont;
268 sal_uInt16 mnBulletHeight;
269 sal_uInt32 mnBulletColor;
271 sal_uInt16 mnAdjust;
272 sal_Int16 mnOOAdjust;
273 sal_uInt16 mnLineFeed;
274 sal_uInt16 mnUpperDist;
275 sal_uInt16 mnLowerDist;
276 sal_uInt16 mnTextOfs;
277 sal_uInt16 mnBulletOfs;
278 sal_uInt16 mnDefaultTab;
280 sal_Bool mbExtendedBulletsUsed;
281 sal_uInt16 mnBulletId;
282 sal_uInt16 mnBulletStart;
283 sal_uInt32 mnMappedNumType;
284 sal_uInt32 mnNumberingType;
285 sal_uInt16 mnAsianSettings;
286 sal_uInt16 mnBiDi;
289 struct PPTExParaSheet
291 PPTExBulletProvider& rBuProv;
293 sal_uInt32 mnInstance;
295 PPTExParaLevel maParaLevel[ 5 ];
296 PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv );
298 void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
299 FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel );
300 void Write( SvStream& rSt, PptEscherEx* pEx, sal_uInt16 nLev, sal_Bool bFirst, sal_Bool bSimpleText,
301 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet );
304 class PPTExStyleSheet
307 public :
309 PPTExCharSheet* mpCharSheet[ PPTEX_STYLESHEETENTRYS ];
310 PPTExParaSheet* mpParaSheet[ PPTEX_STYLESHEETENTRYS ];
312 PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv );
313 ~PPTExStyleSheet();
315 PPTExParaSheet& GetParaSheet( int nInstance ) { return *mpParaSheet[ nInstance ]; };
316 PPTExCharSheet& GetCharSheet( int nInstance ) { return *mpCharSheet[ nInstance ]; };
318 void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
319 FontCollection& rFontCollection, int nInstance, int nLevel );
320 sal_Bool IsHardAttribute( sal_uInt32 nInstance, sal_uInt32 nLevel, PPTExTextAttr eAttr, sal_uInt32 nValue );
322 sal_uInt32 SizeOfTxCFStyleAtom() const;
323 void WriteTxCFStyleAtom( SvStream& rSt );
326 // ------------------------------------------------------------------------
328 class PPTWriterBase : public PropValue, public GroupTable
330 protected:
331 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mXModel;
332 ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mXStatusIndicator;
334 sal_Bool mbStatusIndicator;
336 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPagesSupplier > mXDrawPagesSupplier;
337 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPagesSupplier > mXMasterPagesSupplier;
338 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > mXDrawPages;
339 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mXDrawPage;
340 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXPagePropSet;
341 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXBackgroundPropSet;
342 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mXShapes;
343 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXShape;
344 ::com::sun::star::awt::Size maSize;
345 ::com::sun::star::awt::Point maPosition;
346 Rectangle maRect;
347 OString mType;
348 sal_Bool mbPresObj;
349 sal_Bool mbEmptyPresObj;
350 sal_Int32 mnAngle;
352 sal_uInt32 mnPages; ///< number of Slides ( w/o master pages & notes & handout )
353 sal_uInt32 mnMasterPages;
355 Fraction maFraction;
356 MapMode maMapModeSrc;
357 MapMode maMapModeDest;
358 ::com::sun::star::awt::Size maDestPageSize;
359 ::com::sun::star::awt::Size maNotesPageSize;
361 PageType meLatestPageType;
362 std::vector< PPTExStyleSheet* > maStyleSheetList;
363 PPTExStyleSheet* mpStyleSheet;
365 FontCollection maFontCollection;
367 virtual void ImplWriteSlide( sal_uInt32 /* nPageNum */, sal_uInt32 /* nMasterNum */, sal_uInt16 /* nMode */,
368 sal_Bool /* bHasBackground */, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > /* aXBackgroundPropSet */ ) {}
369 virtual void ImplWriteNotes( sal_uInt32 nPageNum ) = 0;
370 virtual void ImplWriteSlideMaster( sal_uInt32 /* nPageNum */, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > /* aXBackgroundPropSet */ ) {}
371 virtual void ImplWriteLayout( sal_Int32 /* nOffset */, sal_uInt32 /* nMasterNum */ ) {}
373 virtual void exportPPTPre( const std::vector< com::sun::star::beans::PropertyValue >& ) {}
374 virtual void exportPPTPost() {}
376 virtual sal_Bool ImplCreateDocument()=0;
377 virtual sal_Bool ImplCreateMainNotes()=0;
379 sal_Bool GetStyleSheets();
380 sal_Bool GetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup = sal_False );
382 sal_Bool CreateMainNotes();
384 ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& );
385 ::com::sun::star::awt::Point MapPoint( const ::com::sun::star::awt::Point& );
386 Rectangle MapRectangle( const ::com::sun::star::awt::Rectangle& );
388 sal_Bool ContainsOtherShapeThanPlaceholders( sal_Bool bForOOMLX );
390 public:
391 PPTWriterBase();
392 PPTWriterBase( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel,
393 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rStatInd );
395 virtual ~PPTWriterBase();
397 void exportPPT(const std::vector< com::sun::star::beans::PropertyValue >&);
399 sal_Bool InitSOIface();
400 sal_Bool GetPageByIndex( sal_uInt32 nIndex, PageType );
401 sal_uInt32 GetMasterIndex( PageType ePageType );
402 sal_Bool SetCurrentStyleSheet( sal_uInt32 nPageNum );
404 sal_Bool GetPresObj() { return mbPresObj; }
406 PHLayout& GetLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const;
407 PHLayout& GetLayout( sal_Int32 nOffset ) const;
408 sal_Int32 GetLayoutOffset( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const;
409 sal_Int32 GetLayoutOffsetFixed( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const;
411 sal_Bool CreateSlide( sal_uInt32 nPageNum );
412 sal_Bool CreateSlideMaster( sal_uInt32 nPageNum );
413 sal_Bool CreateNotes( sal_uInt32 nPageNum );
415 static sal_Int8 GetTransition( sal_Int16 nTransitionType, sal_Int16 nTransitionSubtype, ::com::sun::star::presentation::FadeEffect eEffect, sal_uInt8& nDirection );
416 static sal_Int8 GetTransition( ::com::sun::star::presentation::FadeEffect eEffect, sal_uInt8& nDirection );
419 #define PPT_TRANSITION_TYPE_NONE 0
420 #define PPT_TRANSITION_TYPE_RANDOM 1
421 #define PPT_TRANSITION_TYPE_BLINDS 2
422 #define PPT_TRANSITION_TYPE_CHECKER 3
423 #define PPT_TRANSITION_TYPE_COVER 4
424 #define PPT_TRANSITION_TYPE_DISSOLVE 5
425 #define PPT_TRANSITION_TYPE_FADE 6
426 #define PPT_TRANSITION_TYPE_PULL 7
427 #define PPT_TRANSITION_TYPE_RANDOM_BARS 8
428 #define PPT_TRANSITION_TYPE_STRIPS 9
429 #define PPT_TRANSITION_TYPE_WIPE 10
430 #define PPT_TRANSITION_TYPE_ZOOM 11
431 #define PPT_TRANSITION_TYPE_SPLIT 13
433 // effects, new in xp
434 #define PPT_TRANSITION_TYPE_DIAMOND 17
435 #define PPT_TRANSITION_TYPE_PLUS 18
436 #define PPT_TRANSITION_TYPE_WEDGE 19
437 #define PPT_TRANSITION_TYPE_PUSH 20
438 #define PPT_TRANSITION_TYPE_COMB 21
439 #define PPT_TRANSITION_TYPE_NEWSFLASH 22
440 #define PPT_TRANSITION_TYPE_SMOOTHFADE 23
441 #define PPT_TRANSITION_TYPE_WHEEL 26
442 #define PPT_TRANSITION_TYPE_CIRCLE 27
444 #endif
446 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */