nss: upgrade to release 3.73
[LibreOffice.git] / sd / source / filter / eppt / epptooxml.hxx
blob56b70a0d9d5830a668ad4d9b7117dff2c9988e36
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 #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;
30 namespace oox::core {
32 struct LayoutInfo
34 std::vector< sal_Int32 > mnFileIdArray;
37 enum PlaceholderType
39 None,
40 SlideImage,
41 Notes,
42 Header,
43 Footer,
44 SlideNumber,
45 DateAndTime,
46 Outliner,
47 Title,
48 Subtitle
51 class PowerPointShapeExport;
53 class PowerPointExport final : public XmlFilterBase, public PPTWriterBase
55 friend class PowerPointShapeExport;
56 public:
58 PowerPointExport(const css::uno::Reference<css::uno::XComponentContext> & rContext, const css::uno::Sequence<css::uno::Any>& rArguments);
60 virtual ~PowerPointExport() override;
62 // from FilterBase
63 virtual bool importDocument() throw() override;
64 virtual bool exportDocument() override;
66 // only needed for import, leave them empty, refactor later XmlFilterBase to export and import base?
67 virtual oox::vml::Drawing* getVmlDrawing() override { return nullptr; }
68 virtual const oox::drawingml::Theme* getCurrentTheme() const override { return nullptr; }
69 virtual oox::drawingml::table::TableStyleListPtr getTableStyles() override { return oox::drawingml::table::TableStyleListPtr(); }
70 virtual oox::drawingml::chart::ChartConverter* getChartConverter() override { return nullptr; }
72 static const char* GetSideDirection( sal_uInt8 nDirection );
73 static const char* GetCornerDirection( sal_uInt8 nDirection );
74 static const char* Get8Direction( sal_uInt8 nDirection );
75 static int GetPPTXLayoutId( int nOffset );
77 sal_Int32 GetShapeID(const css::uno::Reference<css::drawing::XShape>& rXShape);
78 sal_Int32 GetNextAnimationNodeID();
80 void embedEffectAudio(const FSHelperPtr& pFS, const OUString& sUrl, OUString& sRelId, OUString& sName);
82 private:
84 virtual void ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode,
85 bool bHasBackground, css::uno::Reference< css::beans::XPropertySet > const & aXBackgroundPropSet ) override;
86 virtual void ImplWriteNotes( sal_uInt32 nPageNum ) override;
87 virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum, css::uno::Reference< css::beans::XPropertySet > const & aXBackgroundPropSet ) override;
88 void ImplWritePPTXLayout( sal_Int32 nOffset, sal_uInt32 nMasterNum );
89 bool WriteColorSchemes(const FSHelperPtr& pFS, const OUString& rThemePath);
90 static void WriteDefaultColorSchemes(const FSHelperPtr& pFS);
91 void WriteTheme( sal_Int32 nThemeNum );
93 virtual bool ImplCreateDocument() override;
94 virtual bool ImplCreateMainNotes() override;
95 virtual ::oox::ole::VbaProject* implCreateVbaProject() const override;
96 void WriteNotesMaster();
98 bool WriteComments( sal_uInt32 nPageNum );
99 void ImplWriteBackground( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::beans::XPropertySet >& aXBackgroundPropSet );
100 void WriteTransition( const ::sax_fastparser::FSHelperPtr& pFS );
102 sal_Int32 GetLayoutFileId( sal_Int32 nOffset, sal_uInt32 nMasterNum );
104 // shapes
105 void WriteShapeTree( const ::sax_fastparser::FSHelperPtr& pFS, PageType ePageType, bool bMaster );
107 sal_uInt32 GetNewSlideId() { return mnSlideIdMax ++; }
108 sal_uInt32 GetNewSlideMasterId() { return mnSlideMasterIdMax ++; }
109 sal_Int32 GetAuthorIdAndLastIndex( const OUString& sAuthor, sal_Int32& nLastIndex );
111 // Write docProps/core.xml and docprops/custom.xml and docprops/app.xml
112 void writeDocumentProperties();
114 void AddLayoutIdAndRelation( const ::sax_fastparser::FSHelperPtr& pFS, sal_Int32 nLayoutFileId );
116 virtual OUString SAL_CALL getImplementationName() override;
118 static void WriteDiagram(const FSHelperPtr& pFS, PowerPointShapeExport& rDML, const css::uno::Reference<css::drawing::XShape>& rXShape, int nDiagramId);
120 /// Should we export as .pptm, ie. do we contain macros?
121 bool mbPptm;
123 // Export as a template
124 bool mbExportTemplate;
126 ::sax_fastparser::FSHelperPtr mPresentationFS;
128 LayoutInfo mLayoutInfo[EPP_LAYOUT_SIZE];
129 std::vector< ::sax_fastparser::FSHelperPtr > mpSlidesFSArray;
130 sal_Int32 mnLayoutFileIdMax;
132 sal_uInt32 mnSlideIdMax;
133 sal_uInt32 mnSlideMasterIdMax;
134 sal_uInt32 mnAnimationNodeIdMax;
136 sal_uInt32 mnDiagramId;
138 bool mbCreateNotes;
140 ::oox::drawingml::ShapeExport::ShapeHashMap maShapeMap;
142 struct AuthorComments {
143 sal_Int32 nId;
144 sal_Int32 nLastIndex;
146 typedef std::unordered_map< OUString, struct AuthorComments > AuthorsMap;
147 AuthorsMap maAuthors;
149 void WriteAuthors();
151 /// If this is PPTM, output the VBA stream.
152 void WriteVBA();
158 #endif
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */