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 #pragma once
21 
22 #include <svl/zforlist.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 <memory>
31 #include <vector>
32 
33 class SvNumberFormatter;
34 class SvXMLNumFmtHelper;
35 
36 // special style:style context inside style:page-master context
37 
39 {
40  sal_Int32 mnBorderBottom;
41  sal_Int32 mnBorderLeft;
42  sal_Int32 mnBorderRight;
43  sal_Int32 mnBorderTop;
44  sal_Int32 mnWidth;
45  sal_Int32 mnHeight;
46  css::view::PaperOrientation meOrientation;
47 
48  const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); }
49  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
50 
51 public:
52 
54  SdXMLImport& rImport,
55  sal_Int32 nElement,
56  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
57  virtual ~SdXMLPageMasterStyleContext() override;
58 
59  sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
60  sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
61  sal_Int32 GetBorderRight() const { return mnBorderRight; }
62  sal_Int32 GetBorderTop() const { return mnBorderTop; }
63  sal_Int32 GetWidth() const { return mnWidth; }
64  sal_Int32 GetHeight() const { return mnHeight; }
65  css::view::PaperOrientation GetOrientation() const { return meOrientation; }
66 };
67 
68 // style:page-master context
69 
71 {
73 
74  const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); }
75  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
76 
77 public:
78 
80  SdXMLImport& rImport,
81  sal_Int32 nElement,
82  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
83 
84  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
85  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
86 
87  const SdXMLPageMasterStyleContext* GetPageMasterStyle() const { return mxPageMasterStyle.get(); }
88 };
89 
90 // style:masterpage context
91 
93 {
94  OUString msName;
95  OUString msDisplayName;
96 
97 public:
98 
100  SdXMLImport& rImport,
101  sal_Int32 nElement,
102  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList,
103  css::uno::Reference< css::drawing::XShapes > const & rShapes);
104  virtual ~SdXMLMasterPageContext() override;
105 
106  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
107  sal_Int32 nElement,
108  const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
109 
110  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
111 
112  const OUString& GetDisplayName() const { return msDisplayName; }
113 
114 };
115 
116 // presentation:placeholder context
117 
119 {
120  OUString msName;
121  sal_Int32 mnX;
122 
123  const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); }
124  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
125 
126 public:
128  SdXMLImport& rImport,
129  sal_Int32 nElement,
130  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
131  virtual ~SdXMLPresentationPlaceholderContext() override;
132 
133  const OUString& GetName() const { return msName; }
134  sal_Int32 GetX() const { return mnX; }
135 };
136 
137 // style:presentation-page-layout context
138 
140 {
141  std::vector< rtl::Reference< SdXMLPresentationPlaceholderContext > >
143  sal_uInt16 mnTypeId;
144 
145  const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); }
146  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
147 
148 public:
149 
151  SdXMLImport& rImport,
152  sal_Int32 nElement,
153  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
154 
155  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
156  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
157 
158  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
159 
160  sal_uInt16 GetTypeId() const { return mnTypeId; }
161 };
162 
163 // office:styles context
164 
166 {
169  std::unique_ptr<SvXMLNumFmtHelper> mpNumFmtHelper;
170  std::unique_ptr<SvNumberFormatter> mpNumFormatter;
171 
172  const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); }
173  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
174 
175  void ImpSetGraphicStyles() const;
176  void ImpSetCellStyles() const;
177  void ImpSetGraphicStyles( css::uno::Reference< css::container::XNameAccess > const & xPageStyles,
178  XmlStyleFamily nFamily, const OUString& rPrefix) const;
179 
180 protected:
183  sal_Int32 nElement,
184  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override;
185 
188  XmlStyleFamily nFamily,
189  sal_Int32 nElement,
190  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override;
191 
194  XmlStyleFamily nFamily,
195  sal_Int32 nElement,
196  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList) override;
197 public:
198 
200  SdXMLImport& rImport,
201  bool bIsAutoStyle);
202 
203  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
205 
206  void SetMasterPageStyles(SdXMLMasterPageContext const & rMaster) const;
207 
208  css::uno::Reference< css::container::XNameAccess > getPageLayouts() const;
209 };
210 
211 // office:master-styles context
212 
214 {
215  std::vector< rtl::Reference< SdXMLMasterPageContext > > maMasterPageList;
216 
217  const SdXMLImport& GetSdImport() const { return static_cast<const SdXMLImport&>(GetImport()); }
218  SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); }
219 
220 public:
221 
223 
224  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
225  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
226 };
227 
228 // <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl>
229 
231 {
232 public:
234  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList );
235 
236  virtual bool IsTransient() const override;
237  virtual void SAL_CALL endFastElement(sal_Int32 ) override;
238  virtual void SAL_CALL characters( const OUString& rChars ) override;
239 
240 private:
241  OUString maStrName;
242  OUString maStrText;
244  bool mbFixed;
245 };
246 
247 /* 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:311
std::vector< rtl::Reference< SdXMLMasterPageContext > > maMasterPageList
Definition: ximpstyl.hxx:215
SdXMLImport & GetSdImport()
Definition: ximpstyl.hxx:218
rtl::Reference< SdXMLPageMasterStyleContext > mxPageMasterStyle
Definition: ximpstyl.hxx:72
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:60
sal_Int32 GetHeight() const
Definition: ximpstyl.hxx:64
SdXMLImport & GetSdImport()
Definition: ximpstyl.hxx:173
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:782
rtl::Reference< SvXMLImportPropertyMapper > xPresImpPropMapper
Definition: ximpstyl.hxx:167
const OUString & GetName() const
Definition: ximpstyl.hxx:133
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:48
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:74
SdXMLPageMasterStyleContext(SdXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:280
sal_uInt16 GetTypeId() const
Definition: ximpstyl.hxx:160
const SdXMLPageMasterStyleContext * GetPageMasterStyle() const
Definition: ximpstyl.hxx:87
const OUString & GetDisplayName() const
Definition: ximpstyl.hxx:112
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:172
std::unique_ptr< SvNumberFormatter > mpNumFormatter
Definition: ximpstyl.hxx:170
void SetMasterPageStyles(SdXMLMasterPageContext const &rMaster) const
Definition: ximpstyl.cxx:1032
SdXMLImport & GetSdImport()
Definition: ximpstyl.hxx:49
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:1302
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:1400
sal_Int32 GetWidth() const
Definition: ximpstyl.hxx:63
css::view::PaperOrientation GetOrientation() const
Definition: ximpstyl.hxx:65
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: xmlstyle.cxx:441
sal_Int32 GetBorderBottom() const
Definition: ximpstyl.hxx:59
std::vector< rtl::Reference< SdXMLPresentationPlaceholderContext > > maList
Definition: ximpstyl.hxx:142
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpstyl.cxx:891
SdXMLMasterStylesContext(SdXMLImport &rImport)
Definition: ximpstyl.cxx:1296
virtual ~SdXMLMasterPageContext() override
Definition: ximpstyl.cxx:764
void ImpSetCellStyles() const
Definition: ximpstyl.cxx:1072
sal_Int32 GetBorderTop() const
Definition: ximpstyl.hxx:62
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpstyl.cxx:911
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:123
virtual ~SdXMLPresentationPlaceholderContext() override
Definition: ximpstyl.cxx:671
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const override
Definition: ximpstyl.cxx:927
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:145
SdXMLHeaderFooterDeclContext(SvXMLImport &rImport, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:1369
This class deliberately does not support XWeak, to improve performance when loading large documents...
Definition: xmlictxt.hxx:44
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 SvXMLStyleContext * CreateStyleChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: ximpstyl.cxx:837
css::view::PaperOrientation meOrientation
Definition: ximpstyl.hxx:46
css::uno::Reference< css::container::XNameAccess > getPageLayouts() const
Definition: ximpstyl.cxx:1279
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: xmlstyle.cxx:409
SdXMLPresentationPlaceholderContext(SdXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: ximpstyl.cxx:627
SdXMLImport & GetSdImport()
Definition: ximpstyl.hxx:75
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:826
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:61
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:768
const SdXMLImport & GetSdImport() const
Definition: ximpstyl.hxx:217
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:1422
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:972
std::unique_ptr< SvXMLNumFmtHelper > mpNumFmtHelper
Definition: ximpstyl.hxx:169
void ImpSetGraphicStyles() const
Definition: ximpstyl.cxx:1058
virtual bool IsTransient() const override
if this method returns true, its parent styles context should not add it to its container.
Definition: ximpstyl.cxx:1395
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:676