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