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 _EPPT_HXX_
21 : #define _EPPT_HXX_
22 : #include <vector>
23 : #include "escherex.hxx"
24 : #include <tools/solar.h>
25 : #include <sot/storage.hxx>
26 : #include <tools/gen.hxx>
27 : #include <vcl/graph.hxx>
28 : #include <unotools/fontcvt.hxx>
29 : #include <tools/string.hxx>
30 : #include "pptexanimations.hxx"
31 : #include <pptexsoundcollection.hxx>
32 :
33 : #include "text.hxx"
34 :
35 : // ------------------------------------------------------------------------
36 :
37 : #include <vcl/mapmod.hxx>
38 : #include <com/sun/star/uno/Any.hxx>
39 : #include <com/sun/star/frame/XModel.hpp>
40 : #include <com/sun/star/drawing/FillStyle.hpp>
41 : #include <com/sun/star/drawing/LineStyle.hpp>
42 : #include <com/sun/star/drawing/DashStyle.hpp>
43 : #include <com/sun/star/drawing/HatchStyle.hpp>
44 : #include <com/sun/star/drawing/LineEndType.hpp>
45 : #include <com/sun/star/drawing/Alignment.hpp>
46 : #include <com/sun/star/drawing/TextAdjust.hpp>
47 : #include <com/sun/star/drawing/CircleKind.hpp>
48 : #include <com/sun/star/drawing/PolygonKind.hpp>
49 : #include <com/sun/star/drawing/PolygonFlags.hpp>
50 : #include <com/sun/star/drawing/XUniversalShapeDescriptor.hpp>
51 : #include <com/sun/star/drawing/XShapeGrouper.hpp>
52 : #include <com/sun/star/text/XSimpleText.hpp>
53 : #include <com/sun/star/drawing/XConnectorShape.hpp>
54 : #include <com/sun/star/drawing/BezierPoint.hpp>
55 : #include <com/sun/star/drawing/Hatch.hpp>
56 : #include <com/sun/star/drawing/LineDash.hpp>
57 : #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
58 : #include <com/sun/star/presentation/XPresentationSupplier.hpp>
59 : #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
60 : #include <com/sun/star/drawing/XMasterPageTarget.hpp>
61 : #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
62 : #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
63 : #include <com/sun/star/awt/XGraphics.hpp>
64 : #include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
65 : #include <com/sun/star/presentation/AnimationEffect.hpp>
66 : #include <com/sun/star/presentation/FadeEffect.hpp>
67 : #include <com/sun/star/presentation/ClickAction.hpp>
68 : #include <com/sun/star/presentation/AnimationSpeed.hpp>
69 : #include <com/sun/star/presentation/PresentationRange.hpp>
70 : #include <com/sun/star/text/XTextFieldsSupplier.hpp>
71 : #include <com/sun/star/text/XTextField.hpp>
72 : #include <com/sun/star/container/XNamed.hpp>
73 : #include <com/sun/star/awt/FontDescriptor.hpp>
74 : #include <com/sun/star/container/XIndexContainer.hpp>
75 : #include <com/sun/star/awt/XControlModel.hpp>
76 : #include <com/sun/star/style/TabStop.hpp>
77 : #include <com/sun/star/beans/XPropertySet.hpp>
78 : #include <com/sun/star/beans/XPropertyState.hpp>
79 : #include <com/sun/star/beans/XPropertySetInfo.hpp>
80 : #include <com/sun/star/awt/FontFamily.hpp>
81 : #include <com/sun/star/awt/FontPitch.hpp>
82 : #include <com/sun/star/awt/CharSet.hpp>
83 : #include <com/sun/star/text/WritingMode.hpp>
84 : #include <com/sun/star/lang/Locale.hpp>
85 :
86 : #include <epptbase.hxx>
87 :
88 : #define EPP_MAINMASTER_PERSIST_KEY 0x80010000
89 : #define EPP_MAINNOTESMASTER_PERSIST_KEY 0x80020000
90 : #define EPP_MAINSLIDE_PERSIST_KEY 0x80030000
91 : #define EPP_MAINNOTES_PERSIST_KEY 0x80040000
92 :
93 : #define EPP_Persist_Document 0x80080000
94 : #define EPP_Persist_MainMaster 0x80100000
95 : #define EPP_Persist_MainNotes 0x80200000
96 : #define EPP_Persist_Slide 0x80400000
97 : #define EPP_Persist_Notes 0x80800000
98 : #define EPP_Persist_CurrentPos 0x81000000
99 : #define EPP_Persist_VBAInfoAtom 0x84000000
100 : #define EPP_Persist_ExObj 0x88000000
101 :
102 : #define EPP_TEXTSTYLE_NORMAL 0x00000001
103 : #define EPP_TEXTSTYLE_TITLE 0x00000010
104 : #define EPP_TEXTSTYLE_BODY 0x00000100
105 : #define EPP_TEXTSTYLE_TEXT 0x00001000
106 :
107 0 : struct EPPTHyperlink
108 : {
109 : String aURL;
110 : sal_uInt32 nType; // bit 0-7 : type ( 1: click action to a slide )
111 : // ( 2: hyperlink url )
112 : // bit 8-23: index
113 : // bit 31 : hyperlink is attached to a shape
114 :
115 0 : EPPTHyperlink( const String rURL, sal_uInt32 nT ) :
116 : aURL ( rURL ),
117 0 : nType ( nT ){};
118 : };
119 :
120 : enum PPTExOleObjEntryType
121 : {
122 : NORMAL_OLE_OBJECT, OCX_CONTROL
123 : };
124 :
125 0 : struct PPTExOleObjEntry
126 : {
127 : PPTExOleObjEntryType eType;
128 : sal_uInt32 nOfsA; ///< offset to the EPP_ExOleObjAtom in mpExEmbed (set at creation)
129 : sal_uInt32 nOfsB; ///< offset to the EPP_ExOleObjStg
130 :
131 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xControlModel;
132 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape;
133 :
134 0 : PPTExOleObjEntry( PPTExOleObjEntryType eT, sal_uInt32 nOfs ) :
135 : eType ( eT ),
136 0 : nOfsA ( nOfs ) {};
137 : };
138 :
139 : struct TextRuleEntry
140 : {
141 : int nPageNumber;
142 : SvMemoryStream* pOut;
143 :
144 0 : TextRuleEntry( int nPg ) :
145 : nPageNumber( nPg ),
146 0 : pOut ( NULL ){};
147 :
148 0 : ~TextRuleEntry() { delete pOut; };
149 : };
150 :
151 0 : class TextObjBinary : public TextObj
152 : {
153 : public:
154 0 : TextObjBinary( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > &
155 0 : rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv ) : TextObj( rXText, nInstance, rFontCollection, rBuProv ) {}
156 : void Write( SvStream* pStrm );
157 : void WriteTextSpecInfo( SvStream* pStrm );
158 : };
159 :
160 : // ------------------------------------------------------------------------
161 :
162 : struct CellBorder;
163 : class PPTWriter : public PPTWriterBase, public PPTExBulletProvider
164 : {
165 : sal_uInt32 mnCnvrtFlags;
166 : sal_Bool mbStatus;
167 : sal_Bool mbUseNewAnimations;
168 : sal_uInt32 mnStatMaxValue;
169 : sal_uInt32 mnLatestStatValue;
170 :
171 : std::vector<rtl::OUString> maSlideNameList;
172 : rtl::OUString maBaseURI;
173 :
174 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > mXText; // TextRef des globalen Text
175 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > mXCursor;
176 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > mXCursorText; // TextRef des Teilstuecks des Cursors
177 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXCursorPropSet; // die Properties des Teilstueckes
178 : ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > mXTextField;
179 : sal_uInt32 mnTextStyle;
180 :
181 : sal_Bool mbFontIndependentLineSpacing;
182 : sal_uInt32 mnTextSize;
183 :
184 : SvStorageRef mrStg;
185 : SvStream* mpCurUserStrm;
186 : SvStream* mpStrm;
187 : SvStream* mpPicStrm;
188 : PptEscherEx* mpPptEscherEx;
189 :
190 : std::vector<PPTExOleObjEntry*> maExOleObj;
191 : sal_uInt32 mnVBAOleOfs;
192 : SvMemoryStream* mpVBA;
193 : sal_uInt32 mnExEmbed;
194 : SvMemoryStream* mpExEmbed;
195 :
196 : sal_uInt32 mnDrawings; // anzahl Slides + masterpages + notes + handout
197 : sal_uInt32 mnPagesWritten;
198 : sal_uInt32 mnUniqueSlideIdentifier;
199 : sal_uInt32 mnTxId; // Identifier determined by the HOST (PP) ????
200 : sal_uInt32 mnDiaMode; // 0 -> manuell
201 : // 1 -> halbautomatisch
202 : // 2 -> automatisch
203 :
204 : sal_uInt32 mnShapeMasterTitle;
205 : sal_uInt32 mnShapeMasterBody;
206 :
207 : std::vector<EPPTHyperlink> maHyperlink;
208 :
209 : ppt::ExSoundCollection maSoundCollection;
210 :
211 : void ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId );
212 :
213 : sal_uInt32 ImplProgBinaryTag( SvStream* pOutStrm = NULL );
214 : sal_uInt32 ImplProgBinaryTagContainer( SvStream* pOutStrm = NULL, SvMemoryStream* pBinTag = NULL );
215 : sal_uInt32 ImplProgTagContainer( SvStream* pOutStrm = NULL, SvMemoryStream* pBinTag = NULL );
216 : sal_uInt32 ImplOutlineViewInfoContainer( SvStream* pOutStrm = NULL );
217 : sal_uInt32 ImplSlideViewInfoContainer( sal_uInt32 nInstance, SvStream* pOutStrm = NULL );
218 : sal_uInt32 ImplVBAInfoContainer( SvStream* pOutStrm = NULL );
219 : sal_uInt32 ImplDocumentListContainer( SvStream* pOutStrm = NULL );
220 : sal_uInt32 ImplMasterSlideListContainer( SvStream* pOutStrm = NULL );
221 :
222 : public:
223 : static void WriteCString( SvStream&, const String&, sal_uInt32 nInstance = 0 );
224 :
225 : protected:
226 :
227 : sal_Bool ImplCreateDocumentSummaryInformation();
228 : sal_Bool ImplCreateCurrentUserStream();
229 : void ImplCreateHeaderFooterStrings( SvStream& rOut,
230 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet );
231 : void ImplCreateHeaderFooters( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet );
232 : virtual sal_Bool ImplCreateDocument();
233 : sal_Bool ImplCreateHyperBlob( SvMemoryStream& rStream );
234 : sal_uInt32 ImplInsertBookmarkURL( const String& rBookmark, const sal_uInt32 nType,
235 : const String& rStringVer0, const String& rStringVer1, const String& rStringVer2, const String& rStringVer3 );
236 : virtual sal_Bool ImplCreateMainNotes();
237 : sal_Bool ImplCreateNotes( sal_uInt32 nPageNum );
238 : void ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXBackgroundPropSet );
239 : void ImplWriteVBA();
240 : void ImplWriteOLE();
241 : sal_Bool ImplWriteAtomEnding();
242 :
243 : void ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt );
244 : sal_Bool ImplGetText();
245 : sal_Bool ImplCreatePresentationPlaceholder( const sal_Bool bMaster, const PageType PageType,
246 : const sal_uInt32 StyleInstance, const sal_uInt8 PlaceHolderId );
247 : sal_Bool ImplGetEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
248 : ::com::sun::star::presentation::AnimationEffect& eEffect,
249 : ::com::sun::star::presentation::AnimationEffect& eTextEffect,
250 : sal_Bool& bHasSound );
251 : void ImplWriteObjectEffect( SvStream& rSt,
252 : ::com::sun::star::presentation::AnimationEffect eEffect,
253 : ::com::sun::star::presentation::AnimationEffect eTextEffect,
254 : sal_uInt16 nOrder );
255 : void ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentation::ClickAction eAction, sal_Bool bMediaClickAction );
256 : void ImplWriteParagraphs( SvStream& rOutStrm, TextObj& rTextObj );
257 : void ImplWritePortions( SvStream& rOutStrm, TextObj& rTextObj );
258 : void ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance,
259 : TextRuleEntry* pTextRule, SvStream& rExtBu, EscherPropertyContainer* );
260 : void ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt );
261 : void ImplCreateShape( sal_uInt32 nType, sal_uInt32 nFlags, EscherSolverContainer& );
262 : void ImplCreateTextShape( EscherPropertyContainer&, EscherSolverContainer&, sal_Bool bFill );
263 :
264 : void ImplWritePage( const PHLayout& rLayout,
265 : EscherSolverContainer& rSolver,
266 : PageType ePageType,
267 : sal_Bool bMaster,
268 : int nPageNumber = 0 );
269 : void ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 );
270 : void ImplCreateTable( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer,
271 : EscherPropertyContainer& aPropOpt );
272 :
273 : sal_Bool ImplCloseDocument(); // die font-, hyper-, Soundliste wird geschrieben ..
274 :
275 : virtual void ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterID, sal_uInt16 nMode,
276 : sal_Bool bHasBackground, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
277 : virtual void ImplWriteNotes( sal_uInt32 nPageNum );
278 : virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet );
279 :
280 : public:
281 : PPTWriter( SvStorageRef& rSvStorage,
282 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel,
283 : ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rStatInd,
284 : SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags );
285 :
286 : ~PPTWriter();
287 :
288 0 : sal_Bool IsValid() const { return mbStatus; };
289 :
290 : virtual void exportPPTPre( const std::vector< com::sun::star::beans::PropertyValue >& );
291 : virtual void exportPPTPost( );
292 : };
293 :
294 : #endif
295 :
296 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|