Line data Source code
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 : #ifndef INCLUDED_XMLOFF_SOURCE_DRAW_XIMPSTYL_HXX
21 : #define INCLUDED_XMLOFF_SOURCE_DRAW_XIMPSTYL_HXX
22 :
23 : #include <xmloff/xmlictxt.hxx>
24 : #include "sdxmlimp_impl.hxx"
25 : #include "ximppage.hxx"
26 : #include <xmloff/xmlstyle.hxx>
27 : #include <com/sun/star/view/PaperOrientation.hpp>
28 : #include <vector>
29 :
30 : class SvNumberFormatter;
31 : class SvXMLNumFmtHelper;
32 :
33 : // special style:style context inside style:page-master context
34 :
35 : class SdXMLPageMasterStyleContext: public SvXMLStyleContext
36 : {
37 : sal_Int32 mnBorderBottom;
38 : sal_Int32 mnBorderLeft;
39 : sal_Int32 mnBorderRight;
40 : sal_Int32 mnBorderTop;
41 : sal_Int32 mnWidth;
42 : sal_Int32 mnHeight;
43 : com::sun::star::view::PaperOrientation meOrientation;
44 :
45 : const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
46 0 : SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
47 :
48 : public:
49 : TYPEINFO_OVERRIDE();
50 :
51 : SdXMLPageMasterStyleContext(
52 : SdXMLImport& rImport,
53 : sal_uInt16 nPrfx,
54 : const OUString& rLName,
55 : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
56 : virtual ~SdXMLPageMasterStyleContext();
57 :
58 0 : sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
59 0 : sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
60 0 : sal_Int32 GetBorderRight() const { return mnBorderRight; }
61 0 : sal_Int32 GetBorderTop() const { return mnBorderTop; }
62 0 : sal_Int32 GetWidth() const { return mnWidth; }
63 0 : sal_Int32 GetHeight() const { return mnHeight; }
64 0 : com::sun::star::view::PaperOrientation GetOrientation() const { return meOrientation; }
65 : };
66 :
67 : // style:page-master context
68 :
69 : class SdXMLPageMasterContext: public SvXMLStyleContext
70 : {
71 : OUString msName;
72 : SdXMLPageMasterStyleContext*mpPageMasterStyle;
73 :
74 : const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
75 0 : SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
76 :
77 : public:
78 : TYPEINFO_OVERRIDE();
79 :
80 : SdXMLPageMasterContext(
81 : SdXMLImport& rImport,
82 : sal_uInt16 nPrfx,
83 : const OUString& rLName,
84 : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
85 : virtual ~SdXMLPageMasterContext();
86 :
87 : virtual SvXMLImportContext *CreateChildContext(
88 : sal_uInt16 nPrefix, const OUString& rLocalName,
89 : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
90 :
91 : const OUString& GetName() const { return msName; }
92 0 : const SdXMLPageMasterStyleContext* GetPageMasterStyle() const { return mpPageMasterStyle; }
93 : };
94 :
95 : // style:masterpage context
96 :
97 : class SdXMLMasterPageContext: public SdXMLGenericPageContext
98 : {
99 : OUString msPageMasterName;
100 : OUString msName;
101 : OUString msDisplayName;
102 : OUString msStyleName;
103 :
104 : public:
105 : TYPEINFO_OVERRIDE();
106 :
107 : SdXMLMasterPageContext(
108 : SdXMLImport& rImport,
109 : sal_uInt16 nPrfx,
110 : const OUString& rLName,
111 : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
112 : com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
113 : virtual ~SdXMLMasterPageContext();
114 :
115 : virtual SvXMLImportContext *CreateChildContext(
116 : sal_uInt16 nPrefix, const OUString& rLocalName,
117 : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
118 :
119 : virtual void EndElement() SAL_OVERRIDE;
120 :
121 : const OUString& GetPageMasterName() const { return msPageMasterName; }
122 : const OUString& GetEncodedName() const { return msName; }
123 0 : const OUString& GetDisplayName() const { return msDisplayName; }
124 :
125 : };
126 : typedef ::std::vector< SdXMLMasterPageContext* > ImpMasterPageList;
127 :
128 : // presentation:placeholder context
129 :
130 : class SdXMLPresentationPlaceholderContext: public SvXMLImportContext
131 : {
132 : OUString msName;
133 : sal_Int32 mnX;
134 : sal_Int32 mnY;
135 : sal_Int32 mnWidth;
136 : sal_Int32 mnHeight;
137 :
138 : const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
139 0 : SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
140 :
141 : public:
142 : SdXMLPresentationPlaceholderContext(
143 : SdXMLImport& rImport,
144 : sal_uInt16 nPrfx,
145 : const OUString& rLName,
146 : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
147 : virtual ~SdXMLPresentationPlaceholderContext();
148 :
149 0 : const OUString& GetName() const { return msName; }
150 0 : sal_Int32 GetX() const { return mnX; }
151 : sal_Int32 GetY() const { return mnY; }
152 : sal_Int32 GetWidth() const { return mnWidth; }
153 : sal_Int32 GetHeight() const { return mnHeight; }
154 : };
155 : typedef ::std::vector< SdXMLPresentationPlaceholderContext* > ImpPlaceholderList;
156 :
157 : // style:presentation-page-layout context
158 :
159 : class SdXMLPresentationPageLayoutContext: public SvXMLStyleContext
160 : {
161 : OUString msName;
162 : ImpPlaceholderList maList;
163 : sal_uInt16 mnTypeId;
164 :
165 : const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
166 0 : SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
167 :
168 : public:
169 : TYPEINFO_OVERRIDE();
170 :
171 : SdXMLPresentationPageLayoutContext(
172 : SdXMLImport& rImport,
173 : sal_uInt16 nPrfx,
174 : const OUString& rLName,
175 : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
176 : virtual ~SdXMLPresentationPageLayoutContext();
177 :
178 : virtual SvXMLImportContext *CreateChildContext(
179 : sal_uInt16 nPrefix, const OUString& rLocalName,
180 : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
181 :
182 : virtual void EndElement() SAL_OVERRIDE;
183 0 : sal_uInt16 GetTypeId() const { return mnTypeId; }
184 : };
185 :
186 : // office:styles context
187 :
188 : class SdXMLStylesContext : public SvXMLStylesContext
189 : {
190 : UniReference< SvXMLImportPropertyMapper > xPresImpPropMapper;
191 : sal_Bool mbIsAutoStyle;
192 : SvXMLNumFmtHelper* mpNumFmtHelper;
193 : SvNumberFormatter* mpNumFormatter;
194 :
195 0 : const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
196 0 : SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
197 :
198 : void ImpSetGraphicStyles() const;
199 : void ImpSetCellStyles() const;
200 : void ImpSetGraphicStyles( com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& xPageStyles,
201 : sal_uInt16 nFamily, const OUString& rPrefix) const;
202 :
203 : protected:
204 : virtual SvXMLStyleContext* CreateStyleChildContext(
205 : sal_uInt16 nPrefix,
206 : const OUString& rLocalName,
207 : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList) SAL_OVERRIDE;
208 :
209 : virtual SvXMLStyleContext *CreateStyleStyleChildContext(
210 : sal_uInt16 nFamily,
211 : sal_uInt16 nPrefix,
212 : const OUString& rLocalName,
213 : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList) SAL_OVERRIDE;
214 :
215 : virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
216 : sal_uInt16 nFamily, sal_uInt16 nPrefix,
217 : const OUString& rLocalName,
218 : const ::com::sun::star::uno::Reference<
219 : ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
220 : public:
221 : TYPEINFO_OVERRIDE();
222 :
223 : SdXMLStylesContext(
224 : SdXMLImport& rImport,
225 : sal_uInt16 nPrfx,
226 : const OUString& rLName,
227 : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
228 : sal_Bool bIsAutoStyle);
229 : virtual ~SdXMLStylesContext();
230 :
231 : virtual sal_uInt16 GetFamily( const OUString& rFamily ) const SAL_OVERRIDE;
232 : virtual void EndElement() SAL_OVERRIDE;
233 : virtual UniReference< SvXMLImportPropertyMapper > GetImportPropertyMapper(sal_uInt16 nFamily) const SAL_OVERRIDE;
234 :
235 : void SetMasterPageStyles(SdXMLMasterPageContext& rMaster) const;
236 :
237 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getPageLayouts() const;
238 : };
239 :
240 : // office:master-styles context
241 :
242 : class SdXMLMasterStylesContext : public SvXMLImportContext
243 : {
244 : ImpMasterPageList maMasterPageList;
245 :
246 : const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
247 0 : SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
248 :
249 : public:
250 : TYPEINFO_OVERRIDE();
251 :
252 : SdXMLMasterStylesContext(
253 : SdXMLImport& rImport,
254 : sal_uInt16 nPrfx,
255 : const OUString& rLName);
256 : virtual ~SdXMLMasterStylesContext();
257 :
258 : virtual SvXMLImportContext* CreateChildContext(
259 : sal_uInt16 nPrefix,
260 : const OUString& rLocalName,
261 : const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
262 :
263 : const ImpMasterPageList& GetMasterPageList() const { return maMasterPageList; }
264 : };
265 :
266 : // <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl>
267 :
268 0 : class SdXMLHeaderFooterDeclContext : public SvXMLStyleContext
269 : {
270 : public:
271 : SdXMLHeaderFooterDeclContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
272 : const OUString& rLName,
273 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
274 :
275 : virtual bool IsTransient() const SAL_OVERRIDE;
276 : virtual void EndElement() SAL_OVERRIDE;
277 : virtual void Characters( const OUString& rChars ) SAL_OVERRIDE;
278 :
279 : private:
280 : OUString maStrName;
281 : OUString maStrText;
282 : OUString maStrDateTimeFormat;
283 : sal_Bool mbFixed;
284 : };
285 :
286 : #endif // INCLUDED_XMLOFF_SOURCE_DRAW_XIMPSTYL_HXX
287 :
288 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|