LibreOffice Module sd (master) 1
eppt.hxx
Go to the documentation of this file.
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#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>
28
29#include "text.hxx"
30
31#include <com/sun/star/presentation/AnimationEffect.hpp>
32#include <com/sun/star/presentation/ClickAction.hpp>
33
34#include "epptbase.hxx"
35
36namespace com::sun::star::awt { class XControlModel; }
37namespace com::sun::star::beans { class XPropertySet; }
38namespace com::sun::star::beans { struct PropertyValue; }
39namespace com::sun::star::drawing { class XShape; }
40namespace com::sun::star::frame { class XModel; }
41namespace com::sun::star::task { class XStatusIndicator; }
42namespace com::sun::star::text { class XSimpleText; }
43
44class SotStorage;
45
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
50
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
59
60#define EPP_TEXTSTYLE_NORMAL 0x00000001
61#define EPP_TEXTSTYLE_TITLE 0x00000010
62#define EPP_TEXTSTYLE_BODY 0x00000100
63#define EPP_TEXTSTYLE_TEXT 0x00001000
64
66{
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
72
73 EPPTHyperlink( OUString _aURL, sal_uInt32 nT ) :
74 aURL (std::move( _aURL )),
75 nType ( nT ){};
76};
77
79{
81};
82
84{
86 sal_uInt32 nOfsA;
87 sal_uInt32 nOfsB;
88
89 css::uno::Reference< css::awt::XControlModel > xControlModel;
90 css::uno::Reference< css::drawing::XShape > xShape;
91
93 : eType(eT)
94 , nOfsA(nOfs)
95 , nOfsB(0)
96 {}
97};
98
100{
101 std::unique_ptr<SvMemoryStream> pOut;
102};
103
104class TextObjBinary : public TextObj
105{
106public:
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 );
111};
112
113struct CellBorder;
114class PPTWriter final : public PPTWriterBase, public PPTExBulletProvider
115{
116 sal_uInt32 mnCnvrtFlags;
118 sal_uInt32 mnStatMaxValue;
120
121 std::vector<OUString> maSlideNameList;
122 OUString maBaseURI;
123
124 css::uno::Reference< css::text::XSimpleText > mXText; // TextRef of the global text
125 sal_uInt32 mnTextStyle;
126
128 sal_uInt32 mnTextSize;
129
134 std::unique_ptr<PptEscherEx> mpPptEscherEx;
135
136 std::vector<std::unique_ptr<PPTExOleObjEntry>> maExOleObj;
137 sal_uInt32 mnVBAOleOfs;
139 sal_uInt32 mnExEmbed;
140 std::unique_ptr<SvMemoryStream> mpExEmbed;
141
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
147
150
151 std::vector<EPPTHyperlink> maHyperlink;
152
154
155 void ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId );
156
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 );
165
166 public:
167 static void WriteCString( SvStream&, std::u16string_view, sal_uInt32 nInstance = 0 );
168
169 private:
170
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();
185
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* );
200 void ImplCreateShape( sal_uInt32 nType, ShapeFlag nFlags, EscherSolverContainer& );
202
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 );
211
212 bool ImplCloseDocument(); // we write the font, hyper and sound list
213
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;
218
219 public:
221 css::uno::Reference< css::frame::XModel > const & rModel,
222 css::uno::Reference< css::task::XStatusIndicator > const & rStatInd,
223 SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags );
224
225 virtual ~PPTWriter() override;
226
227 bool IsValid() const { return mbStatus; };
228
229 virtual void exportPPTPre( const std::vector< css::beans::PropertyValue >& ) override;
230 virtual void exportPPTPost( ) override;
231};
232
233/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt32 mnExEmbed
Definition: eppt.hxx:139
std::vector< std::unique_ptr< PPTExOleObjEntry > > maExOleObj
Definition: eppt.hxx:136
sal_uInt32 mnDiaMode
Definition: eppt.hxx:144
OUString maBaseURI
Definition: eppt.hxx:122
sal_uInt32 mnCnvrtFlags
Definition: eppt.hxx:116
void ImplCreateTextShape(EscherPropertyContainer &, EscherSolverContainer &, bool bFill)
Definition: epptso.cxx:1589
void ImplCreateDocumentSummaryInformation()
Definition: eppt.cxx:492
sal_uInt32 mnStatMaxValue
Definition: eppt.hxx:118
sal_uInt32 mnTxId
Definition: eppt.hxx:143
sal_uInt32 ImplProgBinaryTag(SvStream *pOutStrm)
Definition: epptso.cxx:216
bool ImplCloseDocument()
Definition: epptso.cxx:376
sal_uInt32 ImplProgBinaryTagContainer(SvStream *pOutStrm, SvMemoryStream *pBinTag)
Definition: epptso.cxx:245
sal_uInt32 ImplDocumentListContainer(SvStream *pOutStrm)
Definition: epptso.cxx:295
css::uno::Reference< css::text::XSimpleText > mXText
Definition: eppt.hxx:124
sal_uInt32 mnPagesWritten
Definition: eppt.hxx:142
bool ImplCreatePresentationPlaceholder(const bool bMaster, const sal_uInt32 StyleInstance, const sal_uInt8 PlaceHolderId)
Definition: epptso.cxx:1526
sal_uInt32 ImplVBAInfoContainer(SvStream *pOutStrm)
Definition: epptso.cxx:132
virtual void ImplWriteSlideMaster(sal_uInt32 nPageNum, css::uno::Reference< css::beans::XPropertySet > const &aXBackgroundPropSet) override
Definition: eppt.cxx:364
bool mbStatus
Definition: eppt.hxx:117
void ImplWriteParagraphs(SvStream &rOutStrm, TextObj &rTextObj)
Definition: epptso.cxx:624
bool mbFontIndependentLineSpacing
Definition: eppt.hxx:127
sal_uInt32 mnVBAOleOfs
Definition: eppt.hxx:137
tools::SvRef< SotStorageStream > mpStrm
Definition: eppt.hxx:132
void ImplWritePortions(SvStream &rOutStrm, TextObj &rTextObj)
Definition: epptso.cxx:763
void ImplCreateTable(css::uno::Reference< css::drawing::XShape > const &rXShape, EscherSolverContainer &aSolverContainer, EscherPropertyContainer &aPropOpt)
Definition: epptso.cxx:3064
void ImplAdjustFirstLineLineSpacing(TextObj &rTextObj, EscherPropertyContainer &rPropOpt)
Definition: epptso.cxx:994
sal_uInt32 mnLatestStatValue
Definition: eppt.hxx:119
void ImplWriteVBA()
Definition: eppt.cxx:1218
std::vector< EPPTHyperlink > maHyperlink
Definition: eppt.hxx:151
bool IsValid() const
Definition: eppt.hxx:227
void ImplWritePage(const PHLayout &rLayout, EscherSolverContainer &rSolver, PageType ePageType, bool bMaster, int nPageNumber=0)
Definition: epptso.cxx:1603
sal_uInt32 mnTextStyle
Definition: eppt.hxx:125
void ImplWriteTextStyleAtom(SvStream &rOut, int nTextInstance, sal_uInt32 nAtomInstance, TextRuleEntry *pTextRule, SvStream &rExtBu, EscherPropertyContainer *)
Definition: epptso.cxx:1025
sal_uInt32 ImplProgTagContainer(SvStream *pOutStrm, SvMemoryStream *pBinTag=nullptr)
Definition: epptso.cxx:274
static bool ImplGetEffect(const css::uno::Reference< css::beans::XPropertySet > &, css::presentation::AnimationEffect &eEffect, css::presentation::AnimationEffect &eTextEffect, bool &bHasSound)
Definition: epptso.cxx:1500
bool ImplCreateCurrentUserStream()
Definition: eppt.cxx:462
void ImplCreateHyperBlob(SvMemoryStream &rStream)
Definition: eppt.cxx:907
ppt::ExSoundCollection maSoundCollection
Definition: eppt.hxx:153
virtual bool ImplCreateDocument() override
Definition: eppt.cxx:658
sal_uInt32 mnTextSize
Definition: eppt.hxx:128
std::vector< OUString > maSlideNameList
Definition: eppt.hxx:121
sal_uInt32 mnShapeMasterBody
Definition: eppt.hxx:149
void ImplWriteExtParaHeader(SvMemoryStream &rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId)
Definition: eppt.cxx:539
static sal_uInt32 ImplOutlineViewInfoContainer(SvStream *pOutStrm)
Definition: epptso.cxx:198
sal_uInt32 ImplInsertBookmarkURL(const OUString &rBookmark, const sal_uInt32 nType, std::u16string_view aStringVer0, std::u16string_view aStringVer1, std::u16string_view aStringVer2, std::u16string_view aStringVer3)
Definition: epptso.cxx:339
virtual void ImplWriteNotes(sal_uInt32 nPageNum) override
Definition: eppt.cxx:1111
std::unique_ptr< PptEscherEx > mpPptEscherEx
Definition: eppt.hxx:134
tools::SvRef< SotStorageStream > mpCurUserStrm
Definition: eppt.hxx:131
sal_uInt32 mnShapeMasterTitle
Definition: eppt.hxx:148
static void ImplCreateHeaderFooterStrings(SvStream &rOut, css::uno::Reference< css::beans::XPropertySet > const &rXPagePropSet)
Definition: eppt.cxx:552
static sal_uInt32 ImplSlideViewInfoContainer(sal_uInt32 nInstance, SvStream *pOutStrm)
Definition: epptso.cxx:149
static void WriteCString(SvStream &, std::u16string_view, sal_uInt32 nInstance=0)
Definition: epptso.cxx:3032
virtual void ImplWriteSlide(sal_uInt32 nPageNum, sal_uInt32 nMasterID, sal_uInt16 nMode, bool bHasBackground, css::uno::Reference< css::beans::XPropertySet > const &aXBackgroundPropSet) override
Definition: eppt.cxx:154
PPTWriter(tools::SvRef< SotStorage > xSvStorage, css::uno::Reference< css::frame::XModel > const &rModel, css::uno::Reference< css::task::XStatusIndicator > const &rStatInd, SvMemoryStream *pVBA, sal_uInt32 nCnvrtFlags)
Definition: eppt.cxx:68
void ImplWriteOLE()
Definition: eppt.cxx:1234
virtual void exportPPTPre(const std::vector< css::beans::PropertyValue > &) override
Definition: eppt.cxx:93
virtual ~PPTWriter() override
Definition: eppt.cxx:449
void ImplCreateShape(sal_uInt32 nType, ShapeFlag nFlags, EscherSolverContainer &)
Definition: epptso.cxx:1582
void ImplWriteBackground(css::uno::Reference< css::beans::XPropertySet > const &rXBackgroundPropSet)
Definition: eppt.cxx:1154
void ImplFlipBoundingBox(EscherPropertyContainer &rPropOpt)
Definition: epptso.cxx:959
sal_uInt32 ImplMasterSlideListContainer(SvStream *pOutStrm)
Definition: epptso.cxx:318
void ImplWriteClickAction(SvStream &rSt, css::presentation::ClickAction eAction, bool bMediaClickAction)
Definition: epptso.cxx:1342
bool ImplCreateCellBorder(const CellBorder *pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2)
Definition: epptso.cxx:2960
std::unique_ptr< SvMemoryStream > mpExEmbed
Definition: eppt.hxx:140
tools::SvRef< SotStorageStream > mpPicStrm
Definition: eppt.hxx:133
virtual bool ImplCreateMainNotes() override
Definition: eppt.cxx:987
virtual void exportPPTPost() override
Definition: eppt.cxx:125
tools::SvRef< SotStorage > mrStg
Definition: eppt.hxx:130
void ImplWriteAtomEnding()
Definition: eppt.cxx:1313
void ImplCreateHeaderFooters(css::uno::Reference< css::beans::XPropertySet > const &rXPagePropSet)
Definition: eppt.cxx:576
bool ImplGetText()
Loads and converts text from shape, value is stored in mnTextSize.
Definition: epptso.cxx:943
SvMemoryStream * mpVBA
Definition: eppt.hxx:138
TextObjBinary(css::uno::Reference< css::text::XSimpleText > const &rXText, int nInstance, FontCollection &rFontCollection, PPTExBulletProvider &rBuProv)
Definition: eppt.hxx:107
void Write(SvStream *pStrm)
Definition: epptso.cxx:3322
void WriteTextSpecInfo(SvStream *pStrm)
Definition: epptso.cxx:3334
PageType
PPTExOleObjEntryType
Definition: eppt.hxx:79
@ OCX_CONTROL
Definition: eppt.hxx:80
@ NORMAL_OLE_OBJECT
Definition: eppt.hxx:80
ShapeFlag
class SAL_NO_VTABLE XPropertySet
PPTExOleObjEntry(PPTExOleObjEntryType eT, sal_uInt32 nOfs)
Definition: eppt.hxx:92
PPTExOleObjEntryType eType
Definition: eppt.hxx:85
sal_uInt32 nOfsB
offset to the EPP_ExOleObjStg
Definition: eppt.hxx:87
css::uno::Reference< css::awt::XControlModel > xControlModel
Definition: eppt.hxx:89
sal_uInt32 nOfsA
offset to the EPP_ExOleObjAtom in mpExEmbed (set at creation)
Definition: eppt.hxx:86
css::uno::Reference< css::drawing::XShape > xShape
Definition: eppt.hxx:90
std::unique_ptr< SvMemoryStream > pOut
Definition: eppt.hxx:101
unsigned char sal_uInt8