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_EPPTOOXML_HXX
21 #define INCLUDED_SD_SOURCE_FILTER_EPPT_EPPTOOXML_HXX
23 #include <oox/core/xmlfilterbase.hxx>
24 #include <oox/vml/vmldrawing.hxx>
25 #include <oox/export/shapes.hxx>
26 #include "epptbase.hxx"
28 using ::sax_fastparser::FSHelperPtr
;
36 std::vector
< sal_Int32
> mnFileIdArray
;
53 class PowerPointShapeExport
;
55 class PowerPointExport final
: public XmlFilterBase
, public PPTWriterBase
57 friend class PowerPointShapeExport
;
60 PowerPointExport(const css::uno::Reference
<css::uno::XComponentContext
> & rContext
, const css::uno::Sequence
<css::uno::Any
>& rArguments
);
62 virtual ~PowerPointExport() override
;
65 virtual bool importDocument() throw() override
;
66 virtual bool exportDocument() override
;
68 // only needed for import, leave them empty, refactor later XmlFilterBase to export and import base?
69 virtual oox::vml::Drawing
* getVmlDrawing() override
{ return nullptr; }
70 virtual const oox::drawingml::Theme
* getCurrentTheme() const override
{ return nullptr; }
71 virtual const oox::drawingml::table::TableStyleListPtr
getTableStyles() override
{ return oox::drawingml::table::TableStyleListPtr(); }
72 virtual oox::drawingml::chart::ChartConverter
* getChartConverter() override
{ return nullptr; }
74 static const char* GetSideDirection( sal_uInt8 nDirection
);
75 static const char* GetCornerDirection( sal_uInt8 nDirection
);
76 static const char* Get8Direction( sal_uInt8 nDirection
);
77 static int GetPPTXLayoutId( int nOffset
);
79 sal_Int32
GetShapeID(const css::uno::Reference
<css::drawing::XShape
>& rXShape
);
80 sal_Int32
GetNextAnimationNodeID();
82 void embedEffectAudio(const FSHelperPtr
& pFS
, const OUString
& sUrl
, OUString
& sRelId
, OUString
& sName
);
86 virtual void ImplWriteSlide( sal_uInt32 nPageNum
, sal_uInt32 nMasterNum
, sal_uInt16 nMode
,
87 bool bHasBackground
, css::uno::Reference
< css::beans::XPropertySet
> const & aXBackgroundPropSet
) override
;
88 virtual void ImplWriteNotes( sal_uInt32 nPageNum
) override
;
89 virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum
, css::uno::Reference
< css::beans::XPropertySet
> const & aXBackgroundPropSet
) override
;
90 void ImplWritePPTXLayout( sal_Int32 nOffset
, sal_uInt32 nMasterNum
);
91 bool WriteColorSchemes(const FSHelperPtr
& pFS
, const OUString
& rThemePath
);
92 static void WriteDefaultColorSchemes(const FSHelperPtr
& pFS
);
93 void WriteTheme( sal_Int32 nThemeNum
);
95 virtual bool ImplCreateDocument() override
;
96 virtual bool ImplCreateMainNotes() override
;
97 virtual ::oox::ole::VbaProject
* implCreateVbaProject() const override
;
98 void WriteNotesMaster();
100 bool WriteComments( sal_uInt32 nPageNum
);
101 void ImplWriteBackground( const ::sax_fastparser::FSHelperPtr
& pFS
, const css::uno::Reference
< css::beans::XPropertySet
>& aXBackgroundPropSet
);
102 void WriteTransition( const ::sax_fastparser::FSHelperPtr
& pFS
);
104 sal_Int32
GetLayoutFileId( sal_Int32 nOffset
, sal_uInt32 nMasterNum
);
107 void WriteShapeTree( const ::sax_fastparser::FSHelperPtr
& pFS
, PageType ePageType
, bool bMaster
);
109 sal_uInt32
GetNewSlideId() { return mnSlideIdMax
++; }
110 sal_uInt32
GetNewSlideMasterId() { return mnSlideMasterIdMax
++; }
111 sal_Int32
GetAuthorIdAndLastIndex( const OUString
& sAuthor
, sal_Int32
& nLastIndex
);
113 // Write docProps/core.xml and docprops/custom.xml and docprops/app.xml
114 void writeDocumentProperties();
116 void AddLayoutIdAndRelation( const ::sax_fastparser::FSHelperPtr
& pFS
, sal_Int32 nLayoutFileId
);
118 virtual OUString SAL_CALL
getImplementationName() override
;
120 static void WriteDiagram(const FSHelperPtr
& pFS
, PowerPointShapeExport
& rDML
, const css::uno::Reference
<css::drawing::XShape
>& rXShape
, int nDiagramId
);
122 /// Should we export as .pptm, ie. do we contain macros?
125 // Export as a template
126 bool mbExportTemplate
;
128 ::sax_fastparser::FSHelperPtr mPresentationFS
;
130 LayoutInfo mLayoutInfo
[EPP_LAYOUT_SIZE
];
131 std::vector
< ::sax_fastparser::FSHelperPtr
> mpSlidesFSArray
;
132 sal_Int32 mnLayoutFileIdMax
;
134 sal_uInt32 mnSlideIdMax
;
135 sal_uInt32 mnSlideMasterIdMax
;
136 sal_uInt32 mnAnimationNodeIdMax
;
138 sal_uInt32 mnDiagramId
;
142 ::oox::drawingml::ShapeExport::ShapeHashMap maShapeMap
;
144 struct AuthorComments
{
146 sal_Int32 nLastIndex
;
148 typedef std::unordered_map
< OUString
, struct AuthorComments
> AuthorsMap
;
149 AuthorsMap maAuthors
;
153 /// If this is PPTM, output the VBA stream.
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */