LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / sd / source / filter / eppt / epptooxml.hxx
blob5ee3248ec81ea81376facf2b397cbe46ed56a232
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 #pragma once
22 #include <oox/core/xmlfilterbase.hxx>
23 #include <oox/vml/vmldrawing.hxx>
24 #include <oox/export/shapes.hxx>
25 #include "epptbase.hxx"
27 using ::sax_fastparser::FSHelperPtr;
29 namespace svx
31 class Theme;
34 namespace oox::core {
36 struct LayoutInfo
38 std::vector< sal_Int32 > mnFileIdArray;
41 enum PlaceholderType
43 None,
44 SlideImage,
45 Notes,
46 Header,
47 Footer,
48 SlideNumber,
49 DateAndTime,
50 Outliner,
51 Title,
52 Subtitle
55 class PowerPointShapeExport;
57 class PowerPointExport final : public XmlFilterBase, public PPTWriterBase
59 friend class PowerPointShapeExport;
60 public:
62 PowerPointExport(const css::uno::Reference<css::uno::XComponentContext> & rContext, const css::uno::Sequence<css::uno::Any>& rArguments);
64 virtual ~PowerPointExport() override;
66 // from FilterBase
67 virtual bool importDocument() noexcept override;
68 virtual bool exportDocument() override;
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; }
73 virtual oox::drawingml::table::TableStyleListPtr getTableStyles() override { return oox::drawingml::table::TableStyleListPtr(); }
74 virtual oox::drawingml::chart::ChartConverter* getChartConverter() override { return nullptr; }
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 );
81 sal_Int32 GetShapeID(const css::uno::Reference<css::drawing::XShape>& rXShape);
82 sal_Int32 GetNextAnimationNodeID();
84 void embedEffectAudio(const FSHelperPtr& pFS, const OUString& sUrl, OUString& sRelId, OUString& sName);
86 private:
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 );
94 /// Export the color set part of a theme.
95 static bool WriteColorSets(const FSHelperPtr& pFS, svx::Theme* pTheme);
97 /// Same as WriteColorSets(), but works from a grab-bag.
98 bool WriteColorSchemes(const FSHelperPtr& pFS, const OUString& rThemePath);
100 static void WriteDefaultColorSchemes(const FSHelperPtr& pFS);
101 void WriteTheme( sal_Int32 nThemeNum, svx::Theme* pTheme );
103 virtual bool ImplCreateDocument() override;
104 virtual bool ImplCreateMainNotes() override;
105 virtual ::oox::ole::VbaProject* implCreateVbaProject() const override;
106 void WriteNotesMaster();
108 bool WriteComments( sal_uInt32 nPageNum );
109 void ImplWriteBackground( const ::sax_fastparser::FSHelperPtr& pFS, const css::uno::Reference< css::beans::XPropertySet >& aXBackgroundPropSet );
110 void WriteTransition( const ::sax_fastparser::FSHelperPtr& pFS );
112 sal_Int32 GetLayoutFileId( sal_Int32 nOffset, sal_uInt32 nMasterNum );
114 // shapes
115 void WriteShapeTree( const ::sax_fastparser::FSHelperPtr& pFS, PageType ePageType, bool bMaster );
117 sal_uInt32 GetNewSlideId() { return mnSlideIdMax ++; }
118 sal_uInt32 GetNewSlideMasterId() { return mnSlideMasterIdMax ++; }
119 sal_Int32 GetAuthorIdAndLastIndex( const OUString& sAuthor, sal_Int32& nLastIndex );
121 // Write docProps/core.xml and docprops/custom.xml and docprops/app.xml
122 void writeDocumentProperties();
124 void WriteCustomSlideShow();
126 void AddLayoutIdAndRelation( const ::sax_fastparser::FSHelperPtr& pFS, sal_Int32 nLayoutFileId );
128 virtual OUString SAL_CALL getImplementationName() override;
130 static void WriteDiagram(const FSHelperPtr& pFS, PowerPointShapeExport& rDML, const css::uno::Reference<css::drawing::XShape>& rXShape, int nDiagramId);
132 /** Create a new placeholder index for a master placeholder shape
134 @param rXShape Master placeholder shape
135 @returns Placeholder index
137 sal_Int32 CreateNewPlaceholderIndex(const css::uno::Reference<css::drawing::XShape>& rXShape);
138 css::uno::Reference<css::drawing::XShape> GetReferencedPlaceholderXShape(const PlaceholderType eType, PageType ePageType) const;
139 void WritePlaceholderReferenceShapes(PowerPointShapeExport& rDML, PageType ePageType);
141 /// Should we export as .pptm, ie. do we contain macros?
142 bool mbPptm;
144 // Export as a template
145 bool mbExportTemplate;
147 ::sax_fastparser::FSHelperPtr mPresentationFS;
149 LayoutInfo mLayoutInfo[EPP_LAYOUT_SIZE];
150 std::vector< ::sax_fastparser::FSHelperPtr > mpSlidesFSArray;
151 sal_Int32 mnLayoutFileIdMax;
153 sal_uInt32 mnSlideIdMax;
154 sal_uInt32 mnSlideMasterIdMax;
155 sal_uInt32 mnAnimationNodeIdMax;
157 sal_uInt32 mnDiagramId;
159 std::vector<OUString> maRelId;
161 bool mbCreateNotes;
163 ::oox::drawingml::ShapeExport::ShapeHashMap maShapeMap;
165 sal_Int32 mnPlaceholderIndexMax; ///< Last used placeholder index
166 /// Map of placeholder indexes for Master placeholders
167 std::unordered_map< css::uno::Reference<css::drawing::XShape>, sal_Int32 > maPlaceholderShapeToIndexMap;
169 struct AuthorComments {
170 sal_Int32 nId;
171 sal_Int32 nLastIndex;
173 typedef std::unordered_map< OUString, struct AuthorComments > AuthorsMap;
174 AuthorsMap maAuthors;
176 void WriteAuthors();
178 void WritePresentationProps();
180 /// If this is PPTM, output the VBA stream.
181 void WriteVBA();
183 void WriteModifyVerifier();
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */