LibreOffice Module xmloff (master)  1
ximpstyl.hxx
Go to the documentation of this file.
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 <svl/zforlist.hxx>
24 #include <xmloff/xmlictxt.hxx>
25 #include <xmloff/xmlimppr.hxx>
26 #include <xmloff/xmlnumfi.hxx>
27 #include "sdxmlimp_impl.hxx"
28 #include "ximppage.hxx"
29 #include <xmloff/xmlstyle.hxx>
30 #include <com/sun/star/view/PaperOrientation.hpp>
31 #include <memory>
32 #include <vector>
33 
34 class SvNumberFormatter;
35 class SvXMLNumFmtHelper;
36 
37 // special style:style context inside style:page-master context
38 
40 {
41  sal_Int32 mnBorderBottom;
42  sal_Int32 mnBorderLeft;
43  sal_Int32 mnBorderRight;
44  sal_Int32 mnBorderTop;
45  sal_Int32 mnWidth;
46  sal_Int32 mnHeight;
47  css::view::PaperOrientation meOrientation;
48 
49  const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); }
50  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
51 
52 public:
53 
55  SdXMLImport& rImport,
56  sal_Int32 nElement,
57  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
58  virtual ~SdXMLPageMasterStyleContext() override;
59 
60  sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
61  sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
62  sal_Int32 GetBorderRight() const { return mnBorderRight; }
63  sal_Int32 GetBorderTop() const { return mnBorderTop; }
64  sal_Int32 GetWidth() const { return mnWidth; }
65  sal_Int32 GetHeight() const { return mnHeight; }
66  css::view::PaperOrientation GetOrientation() const { return meOrientation; }
67 };
68 
69 // style:page-master context
70 
72 {
74 
75  const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); }
76  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
77 
78 public:
79 
81  SdXMLImport& rImport,
82  sal_Int32 nElement,
83  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
84 
85  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
86  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
87 
88  const SdXMLPageMasterStyleContext* GetPageMasterStyle() const { return mxPageMasterStyle.get(); }
89 };
90 
91 // style:masterpage context
92 
94 {
95  OUString msName;
96  OUString msDisplayName;
97 
98 public:
99 
101  SdXMLImport& rImport,
102  sal_Int32 nElement,
103  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
104  css::uno::Reference< css::drawing::XShapes > const & rShapes);
105  virtual ~SdXMLMasterPageContext() override;
106 
107  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
108  sal_Int32 nElement,
109  const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
110 
111  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
112 
113  const OUString& GetDisplayName() const { return msDisplayName; }
114 
115 };
116 
117 // presentation:placeholder context
118 
120 {
121  OUString msName;
122  sal_Int32 mnX;
123 
124  const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); }
125  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
126 
127 public:
129  SdXMLImport& rImport,
130  sal_Int32 nElement,
131  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
132  virtual ~SdXMLPresentationPlaceholderContext() override;
133 
134  const OUString& GetName() const { return msName; }
135  sal_Int32 GetX() const { return mnX; }
136 };
137 
138 // style:presentation-page-layout context
139 
141 {
142  std::vector< rtl::Reference< SdXMLPresentationPlaceholderContext > >
144  sal_uInt16 mnTypeId;
145 
146  const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); }
147  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
148 
149 public:
150 
152  SdXMLImport& rImport,
153  sal_Int32 nElement,
154  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
155 
156  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
157  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
158 
159  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
160 
161  sal_uInt16 GetTypeId() const { return mnTypeId; }
162 };
163 
164 // office:styles context
165 
167 {
170  std::unique_ptr<SvXMLNumFmtHelper> mpNumFmtHelper;
171  std::unique_ptr<SvNumberFormatter> mpNumFormatter;
172 
173  const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); }
174  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
175 
176  void ImpSetGraphicStyles() const;
177  void ImpSetCellStyles() const;
178  void ImpSetGraphicStyles( css::uno::Reference< css::container::XNameAccess > const & xPageStyles,
179  XmlStyleFamily nFamily, const OUString& rPrefix) const;
180 
181 protected:
184  sal_Int32 nElement,
185  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override;
186 
189  XmlStyleFamily nFamily,
190  sal_Int32 nElement,
191  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override;
192 
195  XmlStyleFamily nFamily,
196  sal_Int32 nElement,
197  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override;
198 public:
199 
201  SdXMLImport& rImport,
202  bool bIsAutoStyle);
203 
204  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
206 
207  void SetMasterPageStyles(SdXMLMasterPageContext const & rMaster) const;
208 
209  css::uno::Reference< css::container::XNameAccess > getPageLayouts() const;
210 };
211 
212 // office:master-styles context
213 
215 {
216  std::vector< rtl::Reference< SdXMLMasterPageContext > > maMasterPageList;
217 
218  const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); }
219  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
220 
221 public:
222 
224 
225  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
226  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
227 
229  sal_uInt16 nPrefix,
230  const OUString& rLocalName,
231  const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
232 };
233 
234 // <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl>
235 
237 {
238 public:
240  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList );
241 
242  virtual bool IsTransient() const override;
243  virtual void SAL_CALL endFastElement(sal_Int32 ) override;
244  virtual void SAL_CALL characters( const OUString& rChars ) override;
245 
246 private:
247  OUString maStrName;
248  OUString maStrText;
250  bool mbFixed;
251 };
252 
253 #endif // INCLUDED_XMLOFF_SOURCE_DRAW_XIMPSTYL_HXX
254 
255 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SvXMLStyleContext * CreateStyleChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: xmlstyle.cxx:331
std::vector< rtl::Reference< SdXMLMasterPageContext > > maMasterPageList
Definition: ximpstyl.hxx:216
SdXMLImport & GetSdImport()
Definition: ximpstyl.hxx:219
rtl::Reference< SdXMLPageMasterStyleContext > mxPageMasterStyle
Definition: ximpstyl.hxx:73
SvXMLImport & GetImport()
Definition: xmlictxt.hxx:59
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpstyl.cxx:421
sal_Int32 GetBorderLeft() const
Definition: ximpstyl.hxx:61
sal_Int32 GetHeight() const
Definition: ximpstyl.hxx:65
SdXMLImport & GetSdImport()
Definition: ximpstyl.hxx:174
XmlStyleFamily
Definition: families.hxx:47
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: ximpstyl.cxx:783
rtl::Reference< SvXMLImportPropertyMapper > xPresImpPropMapper
Definition: ximpstyl.hxx:168
const OUString & GetName() const
Definition: ximpstyl.hxx:134
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:49
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:75
SdXMLPageMasterStyleContext(SdXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:279
sal_uInt16 GetTypeId() const
Definition: ximpstyl.hxx:161
const SdXMLPageMasterStyleContext * GetPageMasterStyle() const
Definition: ximpstyl.hxx:88
const OUString & GetDisplayName() const
Definition: ximpstyl.hxx:113
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:173
std::unique_ptr< SvNumberFormatter > mpNumFormatter
Definition: ximpstyl.hxx:171
void SetMasterPageStyles(SdXMLMasterPageContext const &rMaster) const
Definition: ximpstyl.cxx:1036
SdXMLImport & GetSdImport()
Definition: ximpstyl.hxx:50
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: ximpstyl.cxx:1306
virtual void SAL_CALL endFastElement(sal_Int32) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpstyl.cxx:1410
sal_Int32 GetWidth() const
Definition: ximpstyl.hxx:64
css::view::PaperOrientation GetOrientation() const
Definition: ximpstyl.hxx:66
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: xmlstyle.cxx:461
sal_Int32 GetBorderBottom() const
Definition: ximpstyl.hxx:60
std::vector< rtl::Reference< SdXMLPresentationPlaceholderContext > > maList
Definition: ximpstyl.hxx:143
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpstyl.cxx:892
SdXMLMasterStylesContext(SdXMLImport &rImport)
Definition: ximpstyl.cxx:1300
virtual ~SdXMLMasterPageContext() override
Definition: ximpstyl.cxx:765
void ImpSetCellStyles() const
Definition: ximpstyl.cxx:1076
sal_Int32 GetBorderTop() const
Definition: ximpstyl.hxx:63
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpstyl.cxx:914
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:124
virtual ~SdXMLPresentationPlaceholderContext() override
Definition: ximpstyl.cxx:672
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const override
Definition: ximpstyl.cxx:931
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:146
SdXMLHeaderFooterDeclContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:1378
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:45
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: ximpstyl.cxx:372
SdXMLPageMasterContext(SdXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:361
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Create a children element context.
Definition: ximpstyl.cxx:1363
virtual SvXMLStyleContext * CreateStyleChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpstyl.cxx:838
css::view::PaperOrientation meOrientation
Definition: ximpstyl.hxx:47
css::uno::Reference< css::container::XNameAccess > getPageLayouts() const
Definition: ximpstyl.cxx:1283
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: xmlstyle.cxx:429
SdXMLPresentationPlaceholderContext(SdXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:627
SdXMLImport & GetSdImport()
Definition: ximpstyl.hxx:76
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &AttrList) override
Definition: ximpstyl.cxx:399
SdXMLStylesContext(SdXMLImport &rImport, bool bIsAutoStyle)
Definition: ximpstyl.cxx:827
SdXMLPresentationPageLayoutContext(SdXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:388
sal_Int32 GetBorderRight() const
Definition: ximpstyl.hxx:62
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpstyl.cxx:769
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:218
virtual void SAL_CALL characters(const OUString &rChars) override
This method is called for all characters that are contained in the current element.
Definition: ximpstyl.cxx:1432
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
endFastElement is called before a context will be destructed, but after an elements context has been ...
Definition: ximpstyl.cxx:976
std::unique_ptr< SvXMLNumFmtHelper > mpNumFmtHelper
Definition: ximpstyl.hxx:170
void ImpSetGraphicStyles() const
Definition: ximpstyl.cxx:1062
virtual bool IsTransient() const override
if this method returns true, its parent styles context should not add it to its container.
Definition: ximpstyl.cxx:1405
virtual ~SdXMLPageMasterStyleContext() override
Definition: ximpstyl.cxx:356
SdXMLMasterPageContext(SdXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, css::uno::Reference< css::drawing::XShapes > const &rShapes)
Definition: ximpstyl.cxx:677