1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_SD_SOURCE_FILTER_EPPT_EPPT_HXX
21 #define INCLUDED_SD_SOURCE_FILTER_EPPT_EPPT_HXX
24 #include "escherex.hxx"
25 #include <sal/types.h>
26 #include "pptexsoundcollection.hxx"
30 #include <com/sun/star/presentation/AnimationEffect.hpp>
31 #include <com/sun/star/presentation/ClickAction.hpp>
33 #include "epptbase.hxx"
35 namespace com
{ namespace sun
{ namespace star
{ namespace awt
{ class XControlModel
; } } } }
36 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{ class XPropertySet
; } } } }
37 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{ struct PropertyValue
; } } } }
38 namespace com
{ namespace sun
{ namespace star
{ namespace drawing
{ class XShape
; } } } }
39 namespace com
{ namespace sun
{ namespace star
{ namespace frame
{ class XModel
; } } } }
40 namespace com
{ namespace sun
{ namespace star
{ namespace task
{ class XStatusIndicator
; } } } }
41 namespace com
{ namespace sun
{ namespace star
{ namespace text
{ class XSimpleText
; } } } }
45 #define EPP_MAINMASTER_PERSIST_KEY 0x80010000
46 #define EPP_MAINNOTESMASTER_PERSIST_KEY 0x80020000
47 #define EPP_MAINSLIDE_PERSIST_KEY 0x80030000
48 #define EPP_MAINNOTES_PERSIST_KEY 0x80040000
50 #define EPP_Persist_Document 0x80080000
51 #define EPP_Persist_MainMaster 0x80100000
52 #define EPP_Persist_MainNotes 0x80200000
53 #define EPP_Persist_Slide 0x80400000
54 #define EPP_Persist_Notes 0x80800000
55 #define EPP_Persist_CurrentPos 0x81000000
56 #define EPP_Persist_VBAInfoAtom 0x84000000
57 #define EPP_Persist_ExObj 0x88000000
59 #define EPP_TEXTSTYLE_NORMAL 0x00000001
60 #define EPP_TEXTSTYLE_TITLE 0x00000010
61 #define EPP_TEXTSTYLE_BODY 0x00000100
62 #define EPP_TEXTSTYLE_TEXT 0x00001000
67 sal_uInt32
const nType
; // bit 0-7 : type ( 1: click action to a slide )
68 // ( 2: hyperlink url )
70 // bit 31 : hyperlink is attached to a shape
72 EPPTHyperlink( const OUString
& rURL
, sal_uInt32 nT
) :
77 enum PPTExOleObjEntryType
79 NORMAL_OLE_OBJECT
, OCX_CONTROL
82 struct PPTExOleObjEntry
84 PPTExOleObjEntryType
const eType
;
85 sal_uInt32
const nOfsA
; ///< offset to the EPP_ExOleObjAtom in mpExEmbed (set at creation)
86 sal_uInt32 nOfsB
; ///< offset to the EPP_ExOleObjStg
88 css::uno::Reference
< css::awt::XControlModel
> xControlModel
;
89 css::uno::Reference
< css::drawing::XShape
> xShape
;
91 PPTExOleObjEntry(PPTExOleObjEntryType eT
, sal_uInt32 nOfs
)
100 std::unique_ptr
<SvMemoryStream
> pOut
;
103 class TextObjBinary
: public TextObj
106 TextObjBinary( css::uno::Reference
< css::text::XSimpleText
> const & rXText
,
107 int nInstance
, FontCollection
& rFontCollection
, PPTExBulletProvider
& rBuProv
) : TextObj( rXText
, nInstance
, rFontCollection
, rBuProv
) {}
108 void Write( SvStream
* pStrm
);
109 void WriteTextSpecInfo( SvStream
* pStrm
);
113 class PPTWriter final
: public PPTWriterBase
, public PPTExBulletProvider
115 sal_uInt32
const mnCnvrtFlags
;
117 sal_uInt32 mnStatMaxValue
;
118 sal_uInt32 mnLatestStatValue
;
120 std::vector
<OUString
> maSlideNameList
;
123 css::uno::Reference
< css::text::XSimpleText
> mXText
; // TextRef of the global text
124 sal_uInt32 mnTextStyle
;
126 bool mbFontIndependentLineSpacing
;
127 sal_uInt32 mnTextSize
;
129 tools::SvRef
<SotStorage
> mrStg
;
130 std::unique_ptr
<SvStream
> mpCurUserStrm
;
131 std::unique_ptr
<SvStream
> mpStrm
;
132 std::unique_ptr
<SvStream
> mpPicStrm
;
133 std::unique_ptr
<PptEscherEx
> mpPptEscherEx
;
135 std::vector
<std::unique_ptr
<PPTExOleObjEntry
>> maExOleObj
;
136 sal_uInt32 mnVBAOleOfs
;
137 SvMemoryStream
* mpVBA
;
138 sal_uInt32 mnExEmbed
;
139 std::unique_ptr
<SvMemoryStream
> mpExEmbed
;
141 sal_uInt32 mnPagesWritten
;
142 sal_uInt32 mnTxId
; // Identifier determined by the HOST (PP) ????
143 sal_uInt32 mnDiaMode
; // 0 -> manual
144 // 1 -> semi-automatic
147 sal_uInt32 mnShapeMasterTitle
;
148 sal_uInt32 mnShapeMasterBody
;
150 std::vector
<EPPTHyperlink
> maHyperlink
;
152 ppt::ExSoundCollection maSoundCollection
;
154 void ImplWriteExtParaHeader( SvMemoryStream
& rSt
, sal_uInt32 nRef
, sal_uInt32 nInstance
, sal_uInt32 nSlideId
);
156 sal_uInt32
ImplProgBinaryTag( SvStream
* pOutStrm
);
157 sal_uInt32
ImplProgBinaryTagContainer( SvStream
* pOutStrm
, SvMemoryStream
* pBinTag
);
158 sal_uInt32
ImplProgTagContainer( SvStream
* pOutStrm
, SvMemoryStream
* pBinTag
= nullptr );
159 static sal_uInt32
ImplOutlineViewInfoContainer( SvStream
* pOutStrm
);
160 static sal_uInt32
ImplSlideViewInfoContainer( sal_uInt32 nInstance
, SvStream
* pOutStrm
);
161 sal_uInt32
ImplVBAInfoContainer( SvStream
* pOutStrm
);
162 sal_uInt32
ImplDocumentListContainer( SvStream
* pOutStrm
);
163 sal_uInt32
ImplMasterSlideListContainer( SvStream
* pOutStrm
);
166 static void WriteCString( SvStream
&, const OUString
&, sal_uInt32 nInstance
= 0 );
170 void ImplCreateDocumentSummaryInformation();
171 bool ImplCreateCurrentUserStream();
172 static void ImplCreateHeaderFooterStrings( SvStream
& rOut
,
173 css::uno::Reference
< css::beans::XPropertySet
> const & rXPagePropSet
);
174 void ImplCreateHeaderFooters( css::uno::Reference
< css::beans::XPropertySet
> const & rXPagePropSet
);
175 virtual bool ImplCreateDocument() override
;
176 void ImplCreateHyperBlob( SvMemoryStream
& rStream
);
177 sal_uInt32
ImplInsertBookmarkURL( const OUString
& rBookmark
, const sal_uInt32 nType
,
178 const OUString
& rStringVer0
, const OUString
& rStringVer1
, const OUString
& rStringVer2
, const OUString
& rStringVer3
);
179 virtual bool ImplCreateMainNotes() override
;
180 void ImplWriteBackground( css::uno::Reference
< css::beans::XPropertySet
> const & rXBackgroundPropSet
);
183 void ImplWriteAtomEnding();
185 void ImplFlipBoundingBox( EscherPropertyContainer
& rPropOpt
);
187 bool ImplCreatePresentationPlaceholder( const bool bMaster
,
188 const sal_uInt32 StyleInstance
, const sal_uInt8 PlaceHolderId
);
189 static bool ImplGetEffect( const css::uno::Reference
< css::beans::XPropertySet
> &,
190 css::presentation::AnimationEffect
& eEffect
,
191 css::presentation::AnimationEffect
& eTextEffect
,
193 void ImplWriteClickAction( SvStream
& rSt
, css::presentation::ClickAction eAction
, bool bMediaClickAction
);
194 void ImplWriteParagraphs( SvStream
& rOutStrm
, TextObj
& rTextObj
);
195 void ImplWritePortions( SvStream
& rOutStrm
, TextObj
& rTextObj
);
196 void ImplWriteTextStyleAtom( SvStream
& rOut
, int nTextInstance
, sal_uInt32 nAtomInstance
,
197 TextRuleEntry
* pTextRule
, SvStream
& rExtBu
, EscherPropertyContainer
* );
198 void ImplAdjustFirstLineLineSpacing( TextObj
& rTextObj
, EscherPropertyContainer
& rPropOpt
);
199 void ImplCreateShape( sal_uInt32 nType
, ShapeFlag nFlags
, EscherSolverContainer
& );
200 void ImplCreateTextShape( EscherPropertyContainer
&, EscherSolverContainer
&, bool bFill
);
202 void ImplWritePage( const PHLayout
& rLayout
,
203 EscherSolverContainer
& rSolver
,
206 int nPageNumber
= 0 );
207 bool ImplCreateCellBorder( const CellBorder
* pCellBorder
, sal_Int32 nX1
, sal_Int32 nY1
, sal_Int32 nX2
, sal_Int32 nY2
);
208 void ImplCreateTable( css::uno::Reference
< css::drawing::XShape
> const & rXShape
, EscherSolverContainer
& aSolverContainer
,
209 EscherPropertyContainer
& aPropOpt
);
211 bool ImplCloseDocument(); // we write the font, hyper and sound list
213 virtual void ImplWriteSlide( sal_uInt32 nPageNum
, sal_uInt32 nMasterID
, sal_uInt16 nMode
,
214 bool bHasBackground
, css::uno::Reference
< css::beans::XPropertySet
> const & aXBackgroundPropSet
) override
;
215 virtual void ImplWriteNotes( sal_uInt32 nPageNum
) override
;
216 virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum
, css::uno::Reference
< css::beans::XPropertySet
> const & aXBackgroundPropSet
) override
;
219 PPTWriter( tools::SvRef
<SotStorage
> const & rSvStorage
,
220 css::uno::Reference
< css::frame::XModel
> const & rModel
,
221 css::uno::Reference
< css::task::XStatusIndicator
> const & rStatInd
,
222 SvMemoryStream
* pVBA
, sal_uInt32 nCnvrtFlags
);
224 virtual ~PPTWriter() override
;
226 bool IsValid() const { return mbStatus
; };
228 virtual void exportPPTPre( const std::vector
< css::beans::PropertyValue
>& ) override
;
229 virtual void exportPPTPost( ) override
;
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */