LibreOffice Module sd (master) 1
epptooxml.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
24#include <oox/export/shapes.hxx>
25#include "epptbase.hxx"
26
27using ::sax_fastparser::FSHelperPtr;
28
29namespace model
30{
31class Theme;
32}
33
34namespace oox::core {
35
37{
38 std::vector< sal_Int32 > mnFileIdArray;
39};
40
42{
53};
54
55class PowerPointShapeExport;
56
57class PowerPointExport final : public XmlFilterBase, public PPTWriterBase
58{
60public:
61
62 PowerPointExport(const css::uno::Reference<css::uno::XComponentContext> & rContext, const css::uno::Sequence<css::uno::Any>& rArguments);
63
64 virtual ~PowerPointExport() override;
65
66 // from FilterBase
67 virtual bool importDocument() noexcept override;
68 virtual bool exportDocument() override;
69
70 // only needed for import, leave them empty, refactor later XmlFilterBase to export and import base?
71 virtual oox::vml::Drawing* getVmlDrawing() override { return nullptr; }
72 virtual const oox::drawingml::Theme* getCurrentTheme() const override { return nullptr; }
74 virtual oox::drawingml::chart::ChartConverter* getChartConverter() override { return nullptr; }
75
76 static const char* GetSideDirection( sal_uInt8 nDirection );
77 static const char* GetCornerDirection( sal_uInt8 nDirection );
78 static const char* Get8Direction( sal_uInt8 nDirection );
79 static int GetPPTXLayoutId( int nOffset );
80
81 sal_Int32 GetShapeID(const css::uno::Reference<css::drawing::XShape>& rXShape);
82 sal_Int32 GetNextAnimationNodeID();
83
84 void embedEffectAudio(const FSHelperPtr& pFS, const OUString& sUrl, OUString& sRelId, OUString& sName);
85
86private:
87
88 virtual void ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode,
89 bool bHasBackground, css::uno::Reference< css::beans::XPropertySet > const & aXBackgroundPropSet ) override;
90 virtual void ImplWriteNotes( sal_uInt32 nPageNum ) override;
91 virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum, css::uno::Reference< css::beans::XPropertySet > const & aXBackgroundPropSet ) override;
92 void ImplWritePPTXLayout( sal_Int32 nOffset, sal_uInt32 nMasterNum );
93 static void WriteDefaultColorSchemes(const FSHelperPtr& pFS);
94 void WriteTheme( sal_Int32 nThemeNum, model::Theme* pTheme );
95
96 virtual bool ImplCreateDocument() override;
97 virtual bool ImplCreateMainNotes() override;
98 virtual ::oox::ole::VbaProject* implCreateVbaProject() const override;
99 void WriteNotesMaster();
100
101 bool WriteComments( sal_uInt32 nPageNum );
102 void ImplWriteBackground( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::beans::XPropertySet >& aXBackgroundPropSet );
103 void WriteTransition( const ::sax_fastparser::FSHelperPtr& pFS );
104
105 sal_Int32 GetLayoutFileId( sal_Int32 nOffset, sal_uInt32 nMasterNum );
106
107 // shapes
108 void WriteShapeTree( const ::sax_fastparser::FSHelperPtr& pFS, PageType ePageType, bool bMaster );
109
110 sal_uInt32 GetNewSlideId() { return mnSlideIdMax ++; }
111 sal_uInt32 GetNewSlideMasterId() { return mnSlideMasterIdMax ++; }
112 sal_Int32 GetAuthorIdAndLastIndex( const OUString& sAuthor, sal_Int32& nLastIndex );
113
114 // Write docProps/core.xml and docprops/custom.xml and docprops/app.xml
116
118
119 void AddLayoutIdAndRelation( const ::sax_fastparser::FSHelperPtr& pFS, sal_Int32 nLayoutFileId );
120
121 virtual OUString SAL_CALL getImplementationName() override;
122
123 static void WriteDiagram(const FSHelperPtr& pFS, PowerPointShapeExport& rDML, const css::uno::Reference<css::drawing::XShape>& rXShape, int nDiagramId);
124
130 sal_Int32 CreateNewPlaceholderIndex(const css::uno::Reference<css::drawing::XShape>& rXShape);
131 css::uno::Reference<css::drawing::XShape> GetReferencedPlaceholderXShape(const PlaceholderType eType, PageType ePageType) const;
133
135 bool mbPptm;
136
137 // Export as a template
139
141
143 std::vector< ::sax_fastparser::FSHelperPtr > mpSlidesFSArray;
145
146 sal_uInt32 mnSlideIdMax;
149
150 sal_uInt32 mnDiagramId;
151
152 std::vector<OUString> maRelId;
153
155
157
160 std::unordered_map< css::uno::Reference<css::drawing::XShape>, sal_Int32 > maPlaceholderShapeToIndexMap;
161
163 sal_Int32 nId;
164 sal_Int32 nLastIndex;
165 };
166 typedef std::unordered_map< OUString, struct AuthorComments > AuthorsMap;
168
169 void WriteAuthors();
170
172
174 void WriteVBA();
175
176 void WriteModifyVerifier();
177};
178
179}
180
181
182/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool importDocument() noexcept override
static int GetPPTXLayoutId(int nOffset)
virtual ::oox::ole::VbaProject * implCreateVbaProject() const override
virtual bool ImplCreateDocument() override
sal_Int32 GetAuthorIdAndLastIndex(const OUString &sAuthor, sal_Int32 &nLastIndex)
virtual oox::drawingml::table::TableStyleListPtr getTableStyles() override
Definition: epptooxml.hxx:73
virtual const oox::drawingml::Theme * getCurrentTheme() const override
Definition: epptooxml.hxx:72
LayoutInfo mLayoutInfo[EPP_LAYOUT_SIZE]
Definition: epptooxml.hxx:142
::sax_fastparser::FSHelperPtr mPresentationFS
Definition: epptooxml.hxx:140
std::unordered_map< css::uno::Reference< css::drawing::XShape >, sal_Int32 > maPlaceholderShapeToIndexMap
Map of placeholder indexes for Master placeholders.
Definition: epptooxml.hxx:160
virtual void ImplWriteNotes(sal_uInt32 nPageNum) override
static const char * Get8Direction(sal_uInt8 nDirection)
sal_Int32 GetShapeID(const css::uno::Reference< css::drawing::XShape > &rXShape)
void WriteShapeTree(const ::sax_fastparser::FSHelperPtr &pFS, PageType ePageType, bool bMaster)
virtual bool ImplCreateMainNotes() override
std::unordered_map< OUString, struct AuthorComments > AuthorsMap
Definition: epptooxml.hxx:166
static const char * GetSideDirection(sal_uInt8 nDirection)
void embedEffectAudio(const FSHelperPtr &pFS, const OUString &sUrl, OUString &sRelId, OUString &sName)
virtual void ImplWriteSlide(sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode, bool bHasBackground, css::uno::Reference< css::beans::XPropertySet > const &aXBackgroundPropSet) override
sal_Int32 GetLayoutFileId(sal_Int32 nOffset, sal_uInt32 nMasterNum)
static void WriteDiagram(const FSHelperPtr &pFS, PowerPointShapeExport &rDML, const css::uno::Reference< css::drawing::XShape > &rXShape, int nDiagramId)
void WritePlaceholderReferenceShapes(PowerPointShapeExport &rDML, PageType ePageType)
bool mbPptm
Should we export as .pptm, ie. do we contain macros?
Definition: epptooxml.hxx:135
PowerPointExport(const css::uno::Reference< css::uno::XComponentContext > &rContext, const css::uno::Sequence< css::uno::Any > &rArguments)
std::vector< ::sax_fastparser::FSHelperPtr > mpSlidesFSArray
Definition: epptooxml.hxx:143
::oox::drawingml::ShapeExport::ShapeHashMap maShapeMap
Definition: epptooxml.hxx:156
bool WriteComments(sal_uInt32 nPageNum)
sal_Int32 mnPlaceholderIndexMax
Last used placeholder index.
Definition: epptooxml.hxx:158
sal_uInt32 GetNewSlideMasterId()
Definition: epptooxml.hxx:111
virtual oox::vml::Drawing * getVmlDrawing() override
Definition: epptooxml.hxx:71
virtual void ImplWriteSlideMaster(sal_uInt32 nPageNum, css::uno::Reference< css::beans::XPropertySet > const &aXBackgroundPropSet) override
static void WriteDefaultColorSchemes(const FSHelperPtr &pFS)
void WriteTransition(const ::sax_fastparser::FSHelperPtr &pFS)
css::uno::Reference< css::drawing::XShape > GetReferencedPlaceholderXShape(const PlaceholderType eType, PageType ePageType) const
void ImplWriteBackground(const ::sax_fastparser::FSHelperPtr &pFS, const css::uno::Reference< css::beans::XPropertySet > &aXBackgroundPropSet)
virtual bool exportDocument() override
void AddLayoutIdAndRelation(const ::sax_fastparser::FSHelperPtr &pFS, sal_Int32 nLayoutFileId)
virtual OUString SAL_CALL getImplementationName() override
void ImplWritePPTXLayout(sal_Int32 nOffset, sal_uInt32 nMasterNum)
void WriteVBA()
If this is PPTM, output the VBA stream.
std::vector< OUString > maRelId
Definition: epptooxml.hxx:152
virtual oox::drawingml::chart::ChartConverter * getChartConverter() override
Definition: epptooxml.hxx:74
static const char * GetCornerDirection(sal_uInt8 nDirection)
sal_Int32 CreateNewPlaceholderIndex(const css::uno::Reference< css::drawing::XShape > &rXShape)
Create a new placeholder index for a master placeholder shape.
void WriteTheme(sal_Int32 nThemeNum, model::Theme *pTheme)
virtual ~PowerPointExport() override
std::unordered_map< css::uno::Reference< css::drawing::XShape >, sal_Int32 > ShapeHashMap
PageType
#define EPP_LAYOUT_SIZE
Definition: epptbase.hxx:76
std::shared_ptr< TableStyleList > TableStyleListPtr
std::shared_ptr< FastSerializerHelper > FSHelperPtr
std::vector< sal_Int32 > mnFileIdArray
Definition: epptooxml.hxx:38
unsigned char sal_uInt8