tdf#131098 docx export: write fill property of graphic
[LibreOffice.git] / sd / source / filter / eppt / eppt.hxx
blob1ef07d1dcff4d77fa8e60d7cca1081156571dd28
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 #pragma once
21 #include <memory>
22 #include <utility>
23 #include <vector>
24 #include "escherex.hxx"
25 #include <sal/types.h>
26 #include <sot/storage.hxx>
27 #include "pptexsoundcollection.hxx"
29 #include "text.hxx"
31 #include <com/sun/star/presentation/AnimationEffect.hpp>
32 #include <com/sun/star/presentation/ClickAction.hpp>
34 #include "epptbase.hxx"
36 namespace com::sun::star::awt { class XControlModel; }
37 namespace com::sun::star::beans { class XPropertySet; }
38 namespace com::sun::star::beans { struct PropertyValue; }
39 namespace com::sun::star::drawing { class XShape; }
40 namespace com::sun::star::frame { class XModel; }
41 namespace com::sun::star::task { class XStatusIndicator; }
42 namespace com::sun::star::text { class XSimpleText; }
44 class SotStorage;
46 #define EPP_MAINMASTER_PERSIST_KEY 0x80010000
47 #define EPP_MAINNOTESMASTER_PERSIST_KEY 0x80020000
48 #define EPP_MAINSLIDE_PERSIST_KEY 0x80030000
49 #define EPP_MAINNOTES_PERSIST_KEY 0x80040000
51 #define EPP_Persist_Document 0x80080000
52 #define EPP_Persist_MainMaster 0x80100000
53 #define EPP_Persist_MainNotes 0x80200000
54 #define EPP_Persist_Slide 0x80400000
55 #define EPP_Persist_Notes 0x80800000
56 #define EPP_Persist_CurrentPos 0x81000000
57 #define EPP_Persist_VBAInfoAtom 0x84000000
58 #define EPP_Persist_ExObj 0x88000000
60 #define EPP_TEXTSTYLE_NORMAL 0x00000001
61 #define EPP_TEXTSTYLE_TITLE 0x00000010
62 #define EPP_TEXTSTYLE_BODY 0x00000100
63 #define EPP_TEXTSTYLE_TEXT 0x00001000
65 struct EPPTHyperlink
67 OUString aURL;
68 sal_uInt32 nType; // bit 0-7 : type ( 1: click action to a slide )
69 // ( 2: hyperlink url )
70 // bit 8-23: index
71 // bit 31 : hyperlink is attached to a shape
73 EPPTHyperlink( OUString _aURL, sal_uInt32 nT ) :
74 aURL (std::move( _aURL )),
75 nType ( nT ){};
78 enum PPTExOleObjEntryType
80 NORMAL_OLE_OBJECT, OCX_CONTROL
83 struct PPTExOleObjEntry
85 PPTExOleObjEntryType eType;
86 sal_uInt32 nOfsA; ///< offset to the EPP_ExOleObjAtom in mpExEmbed (set at creation)
87 sal_uInt32 nOfsB; ///< offset to the EPP_ExOleObjStg
89 css::uno::Reference< css::awt::XControlModel > xControlModel;
90 css::uno::Reference< css::drawing::XShape > xShape;
92 PPTExOleObjEntry(PPTExOleObjEntryType eT, sal_uInt32 nOfs)
93 : eType(eT)
94 , nOfsA(nOfs)
95 , nOfsB(0)
99 struct TextRuleEntry
101 std::unique_ptr<SvMemoryStream> pOut;
104 class TextObjBinary : public TextObj
106 public:
107 TextObjBinary( css::uno::Reference< css::text::XSimpleText > const & rXText,
108 int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv ) : TextObj( rXText, nInstance, rFontCollection, rBuProv ) {}
109 void Write( SvStream* pStrm );
110 void WriteTextSpecInfo( SvStream* pStrm );
113 struct CellBorder;
114 class PPTWriter final : public PPTWriterBase, public PPTExBulletProvider
116 sal_uInt32 mnCnvrtFlags;
117 bool mbStatus;
118 sal_uInt32 mnStatMaxValue;
119 sal_uInt32 mnLatestStatValue;
121 std::vector<OUString> maSlideNameList;
122 OUString maBaseURI;
124 css::uno::Reference< css::text::XSimpleText > mXText; // TextRef of the global text
125 sal_uInt32 mnTextStyle;
127 bool mbFontIndependentLineSpacing;
128 sal_uInt32 mnTextSize;
130 rtl::Reference<SotStorage> mrStg;
131 rtl::Reference<SotStorageStream> mpCurUserStrm;
132 rtl::Reference<SotStorageStream> mpStrm;
133 rtl::Reference<SotStorageStream> mpPicStrm;
134 std::unique_ptr<PptEscherEx> mpPptEscherEx;
136 std::vector<std::unique_ptr<PPTExOleObjEntry>> maExOleObj;
137 sal_uInt32 mnVBAOleOfs;
138 SvMemoryStream* mpVBA;
139 sal_uInt32 mnExEmbed;
140 std::unique_ptr<SvMemoryStream> mpExEmbed;
142 sal_uInt32 mnPagesWritten;
143 sal_uInt32 mnTxId; // Identifier determined by the HOST (PP) ????
144 sal_uInt32 mnDiaMode; // 0 -> manual
145 // 1 -> semi-automatic
146 // 2 -> automatic
148 sal_uInt32 mnShapeMasterTitle;
149 sal_uInt32 mnShapeMasterBody;
151 std::vector<EPPTHyperlink> maHyperlink;
153 ppt::ExSoundCollection maSoundCollection;
155 void ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId );
157 sal_uInt32 ImplProgBinaryTag( SvStream* pOutStrm );
158 sal_uInt32 ImplProgBinaryTagContainer( SvStream* pOutStrm, SvMemoryStream* pBinTag );
159 sal_uInt32 ImplProgTagContainer( SvStream* pOutStrm, SvMemoryStream* pBinTag = nullptr );
160 static sal_uInt32 ImplOutlineViewInfoContainer( SvStream* pOutStrm );
161 static sal_uInt32 ImplSlideViewInfoContainer( sal_uInt32 nInstance, SvStream* pOutStrm );
162 sal_uInt32 ImplVBAInfoContainer( SvStream* pOutStrm );
163 sal_uInt32 ImplDocumentListContainer( SvStream* pOutStrm );
164 sal_uInt32 ImplMasterSlideListContainer( SvStream* pOutStrm );
166 public:
167 static void WriteCString( SvStream&, std::u16string_view, sal_uInt32 nInstance = 0 );
169 private:
171 void ImplCreateDocumentSummaryInformation();
172 bool ImplCreateCurrentUserStream();
173 static void ImplCreateHeaderFooterStrings( SvStream& rOut,
174 css::uno::Reference< css::beans::XPropertySet > const & rXPagePropSet );
175 void ImplCreateHeaderFooters( css::uno::Reference< css::beans::XPropertySet > const & rXPagePropSet );
176 virtual bool ImplCreateDocument() override;
177 void ImplCreateHyperBlob( SvMemoryStream& rStream );
178 sal_uInt32 ImplInsertBookmarkURL( const OUString& rBookmark, const sal_uInt32 nType,
179 std::u16string_view aStringVer0, std::u16string_view aStringVer1, std::u16string_view aStringVer2, std::u16string_view aStringVer3 );
180 virtual bool ImplCreateMainNotes() override;
181 void ImplWriteBackground( css::uno::Reference< css::beans::XPropertySet > const & rXBackgroundPropSet );
182 void ImplWriteVBA();
183 void ImplWriteOLE();
184 void ImplWriteAtomEnding();
186 void ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt );
187 bool ImplGetText();
188 bool ImplCreatePresentationPlaceholder( const bool bMaster,
189 const sal_uInt32 StyleInstance, const sal_uInt8 PlaceHolderId );
190 static bool ImplGetEffect( const css::uno::Reference< css::beans::XPropertySet > &,
191 css::presentation::AnimationEffect& eEffect,
192 css::presentation::AnimationEffect& eTextEffect,
193 bool& bHasSound );
194 void ImplWriteClickAction( SvStream& rSt, css::presentation::ClickAction eAction, bool bMediaClickAction );
195 void ImplWriteParagraphs( SvStream& rOutStrm, TextObj& rTextObj );
196 void ImplWritePortions( SvStream& rOutStrm, TextObj& rTextObj );
197 void ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance,
198 TextRuleEntry* pTextRule, SvStream& rExtBu, EscherPropertyContainer* );
199 void ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt );
200 void ImplCreateShape( sal_uInt32 nType, ShapeFlag nFlags, EscherSolverContainer& );
201 void ImplCreateTextShape( EscherPropertyContainer&, EscherSolverContainer&, bool bFill );
203 void ImplWritePage( const PHLayout& rLayout,
204 EscherSolverContainer& rSolver,
205 PageType ePageType,
206 bool bMaster,
207 int nPageNumber = 0 );
208 bool ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 );
209 void ImplCreateTable( css::uno::Reference< css::drawing::XShape > const & rXShape, EscherSolverContainer& aSolverContainer,
210 EscherPropertyContainer& aPropOpt );
212 bool ImplCloseDocument(); // we write the font, hyper and sound list
214 virtual void ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterID, sal_uInt16 nMode,
215 bool bHasBackground, css::uno::Reference< css::beans::XPropertySet > const & aXBackgroundPropSet ) override;
216 virtual void ImplWriteNotes( sal_uInt32 nPageNum ) override;
217 virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum, css::uno::Reference< css::beans::XPropertySet > const & aXBackgroundPropSet ) override;
219 public:
220 PPTWriter( rtl::Reference<SotStorage> xSvStorage,
221 css::uno::Reference< css::frame::XModel > const & rModel,
222 css::uno::Reference< css::task::XStatusIndicator > const & rStatInd,
223 SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags );
225 virtual ~PPTWriter() override;
227 bool IsValid() const { return mbStatus; };
229 virtual void exportPPTPre( const std::vector< css::beans::PropertyValue >& ) override;
230 virtual void exportPPTPost( ) override;
233 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */