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