/src/libreoffice/xmloff/source/draw/ximpstyl.hxx
Line | Count | Source |
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 | | |
22 | | #include <svl/numformat.hxx> |
23 | | #include <xmloff/xmlictxt.hxx> |
24 | | #include <xmloff/xmlimppr.hxx> |
25 | | #include <xmloff/xmlnumfi.hxx> |
26 | | #include "sdxmlimp_impl.hxx" |
27 | | #include "ximppage.hxx" |
28 | | #include <xmloff/xmlstyle.hxx> |
29 | | #include <com/sun/star/view/PaperOrientation.hpp> |
30 | | #include <com/sun/star/drawing/XDrawPages2.hpp> |
31 | | #include <memory> |
32 | | #include <vector> |
33 | | |
34 | | // special style:style context inside style:page-master context |
35 | | |
36 | | class SdXMLPageMasterStyleContext: public SvXMLStyleContext |
37 | | { |
38 | | sal_Int32 mnBorderBottom; |
39 | | sal_Int32 mnBorderLeft; |
40 | | sal_Int32 mnBorderRight; |
41 | | sal_Int32 mnBorderTop; |
42 | | sal_Int32 mnWidth; |
43 | | sal_Int32 mnHeight; |
44 | | css::view::PaperOrientation meOrientation; |
45 | | |
46 | 0 | const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); } |
47 | 5.92k | SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); } |
48 | | |
49 | | public: |
50 | | |
51 | | SdXMLPageMasterStyleContext( |
52 | | SdXMLImport& rImport, |
53 | | sal_Int32 nElement, |
54 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList); |
55 | | virtual ~SdXMLPageMasterStyleContext() override; |
56 | | |
57 | 2.08k | sal_Int32 GetBorderBottom() const { return mnBorderBottom; } |
58 | 2.08k | sal_Int32 GetBorderLeft() const { return mnBorderLeft; } |
59 | 2.08k | sal_Int32 GetBorderRight() const { return mnBorderRight; } |
60 | 2.08k | sal_Int32 GetBorderTop() const { return mnBorderTop; } |
61 | 2.08k | sal_Int32 GetWidth() const { return mnWidth; } |
62 | 2.08k | sal_Int32 GetHeight() const { return mnHeight; } |
63 | 2.08k | css::view::PaperOrientation GetOrientation() const { return meOrientation; } |
64 | | }; |
65 | | |
66 | | // style:page-master context |
67 | | |
68 | | class SdXMLPageMasterContext: public SvXMLStyleContext |
69 | | { |
70 | | rtl::Reference<SdXMLPageMasterStyleContext> mxPageMasterStyle; |
71 | | |
72 | 0 | const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); } |
73 | 1.37k | SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); } |
74 | | |
75 | | public: |
76 | | |
77 | | SdXMLPageMasterContext( |
78 | | SdXMLImport& rImport, |
79 | | sal_Int32 nElement, |
80 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList); |
81 | | |
82 | | virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( |
83 | | sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; |
84 | | |
85 | 2.15k | const SdXMLPageMasterStyleContext* GetPageMasterStyle() const { return mxPageMasterStyle.get(); } |
86 | | }; |
87 | | |
88 | | // style:masterpage context |
89 | | |
90 | | class SdXMLMasterPageContext: public SdXMLGenericPageContext |
91 | | { |
92 | | OUString msName; |
93 | | OUString msDisplayName; |
94 | | |
95 | | public: |
96 | | |
97 | | // called for normal master page |
98 | | SdXMLMasterPageContext( |
99 | | SdXMLImport& rImport, |
100 | | sal_Int32 nElement, |
101 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, |
102 | | css::uno::Reference< css::drawing::XDrawPages2 > const & xMasterPages); |
103 | | // Called for handout master page |
104 | | SdXMLMasterPageContext( |
105 | | SdXMLImport& rImport, |
106 | | sal_Int32 nElement, |
107 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, |
108 | | css::uno::Reference< css::drawing::XShapes > const & rShapes); |
109 | | virtual ~SdXMLMasterPageContext() override; |
110 | | |
111 | | virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( |
112 | | sal_Int32 nElement, |
113 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; |
114 | | |
115 | | virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; |
116 | | |
117 | 20.5k | const OUString& GetDisplayName() const { return msDisplayName; } |
118 | | |
119 | | }; |
120 | | |
121 | | // presentation:placeholder context |
122 | | |
123 | | class SdXMLPresentationPlaceholderContext: public SvXMLImportContext |
124 | | { |
125 | | OUString msName; |
126 | | sal_Int32 mnX; |
127 | | |
128 | 0 | const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); } |
129 | 2.81k | SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); } |
130 | | |
131 | | public: |
132 | | SdXMLPresentationPlaceholderContext( |
133 | | SdXMLImport& rImport, |
134 | | sal_Int32 nElement, |
135 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList); |
136 | | virtual ~SdXMLPresentationPlaceholderContext() override; |
137 | | |
138 | 1.47k | const OUString& GetName() const { return msName; } |
139 | 6 | sal_Int32 GetX() const { return mnX; } |
140 | | }; |
141 | | |
142 | | // style:presentation-page-layout context |
143 | | |
144 | | class SdXMLPresentationPageLayoutContext: public SvXMLStyleContext |
145 | | { |
146 | | std::vector< rtl::Reference< SdXMLPresentationPlaceholderContext > > |
147 | | maList; |
148 | | sal_uInt16 mnTypeId; |
149 | | |
150 | 0 | const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); } |
151 | 3.21k | SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); } |
152 | | |
153 | | public: |
154 | | |
155 | | SdXMLPresentationPageLayoutContext( |
156 | | SdXMLImport& rImport, |
157 | | sal_Int32 nElement, |
158 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList); |
159 | | |
160 | | virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( |
161 | | sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; |
162 | | |
163 | | virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; |
164 | | |
165 | 347 | sal_uInt16 GetTypeId() const { return mnTypeId; } |
166 | | }; |
167 | | |
168 | | // office:styles context |
169 | | |
170 | | class SdXMLStylesContext : public SvXMLStylesContext |
171 | | { |
172 | | bool mbIsAutoStyle; |
173 | | std::unique_ptr<SvXMLNumFmtHelper> mpNumFmtHelper; |
174 | | std::unique_ptr<SvNumberFormatter> mpNumFormatter; |
175 | | |
176 | 113k | const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); } |
177 | 33.2k | SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); } |
178 | | |
179 | | void ImpSetGraphicStyles() const; |
180 | | void ImpSetCellStyles() const; |
181 | | void ImpSetGraphicStyles( css::uno::Reference< css::container::XNameAccess > const & xPageStyles, |
182 | | XmlStyleFamily nFamily, const OUString& rPrefix) const; |
183 | | |
184 | | protected: |
185 | | using SvXMLStylesContext::CreateStyleChildContext; |
186 | | virtual SvXMLStyleContext* CreateStyleChildContext( |
187 | | sal_Int32 nElement, |
188 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override; |
189 | | |
190 | | using SvXMLStylesContext::CreateStyleStyleChildContext; |
191 | | virtual SvXMLStyleContext *CreateStyleStyleChildContext( |
192 | | XmlStyleFamily nFamily, |
193 | | sal_Int32 nElement, |
194 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override; |
195 | | |
196 | | using SvXMLStylesContext::CreateDefaultStyleStyleChildContext; |
197 | | virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext( |
198 | | XmlStyleFamily nFamily, |
199 | | sal_Int32 nElement, |
200 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override; |
201 | | public: |
202 | | |
203 | | SdXMLStylesContext( |
204 | | SdXMLImport& rImport, |
205 | | bool bIsAutoStyle); |
206 | | |
207 | | virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; |
208 | | virtual SvXMLImportPropertyMapper* GetImportPropertyMapper(XmlStyleFamily nFamily) const override; |
209 | | |
210 | | void SetMasterPageStyles(SdXMLMasterPageContext const & rMaster) const; |
211 | | |
212 | | css::uno::Reference< css::container::XNameAccess > getPageLayouts() const; |
213 | | }; |
214 | | |
215 | | // office:master-styles context |
216 | | |
217 | | class SdXMLMasterStylesContext : public SvXMLImportContext |
218 | | { |
219 | | std::vector< rtl::Reference< SdXMLMasterPageContext > > maMasterPageList; |
220 | | |
221 | 0 | const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); } |
222 | 64.2k | SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); } |
223 | | |
224 | | public: |
225 | | |
226 | | SdXMLMasterStylesContext(SdXMLImport& rImport); |
227 | | |
228 | | virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( |
229 | | sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; |
230 | | }; |
231 | | |
232 | | // <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl> |
233 | | |
234 | | class SdXMLHeaderFooterDeclContext : public SvXMLStyleContext |
235 | | { |
236 | | public: |
237 | | SdXMLHeaderFooterDeclContext( SvXMLImport& rImport, |
238 | | const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); |
239 | | |
240 | | virtual bool IsTransient() const override; |
241 | | virtual void SAL_CALL endFastElement(sal_Int32 ) override; |
242 | | virtual void SAL_CALL characters( const OUString& rChars ) override; |
243 | | |
244 | | private: |
245 | | OUString maStrName; |
246 | | OUString maStrText; |
247 | | OUString maStrDateTimeFormat; |
248 | | bool mbFixed; |
249 | | }; |
250 | | |
251 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |