1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
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>
34 // special style:style context inside style:page-master context
36 class SdXMLPageMasterStyleContext
: public SvXMLStyleContext
38 sal_Int32 mnBorderBottom
;
39 sal_Int32 mnBorderLeft
;
40 sal_Int32 mnBorderRight
;
41 sal_Int32 mnBorderTop
;
44 css::view::PaperOrientation meOrientation
;
46 const SdXMLImport
& GetSdImport() const { return static_cast<const SdXMLImport
&>(GetImport()); }
47 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
51 SdXMLPageMasterStyleContext(
54 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
);
55 virtual ~SdXMLPageMasterStyleContext() override
;
57 sal_Int32
GetBorderBottom() const { return mnBorderBottom
; }
58 sal_Int32
GetBorderLeft() const { return mnBorderLeft
; }
59 sal_Int32
GetBorderRight() const { return mnBorderRight
; }
60 sal_Int32
GetBorderTop() const { return mnBorderTop
; }
61 sal_Int32
GetWidth() const { return mnWidth
; }
62 sal_Int32
GetHeight() const { return mnHeight
; }
63 css::view::PaperOrientation
GetOrientation() const { return meOrientation
; }
66 // style:page-master context
68 class SdXMLPageMasterContext
: public SvXMLStyleContext
70 rtl::Reference
<SdXMLPageMasterStyleContext
> mxPageMasterStyle
;
72 const SdXMLImport
& GetSdImport() const { return static_cast<const SdXMLImport
&>(GetImport()); }
73 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
77 SdXMLPageMasterContext(
80 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
);
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
;
85 const SdXMLPageMasterStyleContext
* GetPageMasterStyle() const { return mxPageMasterStyle
.get(); }
88 // style:masterpage context
90 class SdXMLMasterPageContext
: public SdXMLGenericPageContext
93 OUString msDisplayName
;
97 // called for normal master page
98 SdXMLMasterPageContext(
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
,
107 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
,
108 css::uno::Reference
< css::drawing::XShapes
> const & rShapes
);
109 virtual ~SdXMLMasterPageContext() override
;
111 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
113 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
115 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
117 const OUString
& GetDisplayName() const { return msDisplayName
; }
121 // presentation:placeholder context
123 class SdXMLPresentationPlaceholderContext
: public SvXMLImportContext
128 const SdXMLImport
& GetSdImport() const { return static_cast<const SdXMLImport
&>(GetImport()); }
129 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
132 SdXMLPresentationPlaceholderContext(
133 SdXMLImport
& rImport
,
135 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
);
136 virtual ~SdXMLPresentationPlaceholderContext() override
;
138 const OUString
& GetName() const { return msName
; }
139 sal_Int32
GetX() const { return mnX
; }
142 // style:presentation-page-layout context
144 class SdXMLPresentationPageLayoutContext
: public SvXMLStyleContext
146 std::vector
< rtl::Reference
< SdXMLPresentationPlaceholderContext
> >
150 const SdXMLImport
& GetSdImport() const { return static_cast<const SdXMLImport
&>(GetImport()); }
151 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
155 SdXMLPresentationPageLayoutContext(
156 SdXMLImport
& rImport
,
158 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
);
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
;
163 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
165 sal_uInt16
GetTypeId() const { return mnTypeId
; }
168 // office:styles context
170 class SdXMLStylesContext
: public SvXMLStylesContext
172 rtl::Reference
< SvXMLImportPropertyMapper
> xPresImpPropMapper
;
174 std::unique_ptr
<SvXMLNumFmtHelper
> mpNumFmtHelper
;
175 std::unique_ptr
<SvNumberFormatter
> mpNumFormatter
;
177 const SdXMLImport
& GetSdImport() const { return static_cast<const SdXMLImport
&>(GetImport()); }
178 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
180 void ImpSetGraphicStyles() const;
181 void ImpSetCellStyles() const;
182 void ImpSetGraphicStyles( css::uno::Reference
< css::container::XNameAccess
> const & xPageStyles
,
183 XmlStyleFamily nFamily
, const OUString
& rPrefix
) const;
186 using SvXMLStylesContext::CreateStyleChildContext
;
187 virtual SvXMLStyleContext
* CreateStyleChildContext(
189 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
191 using SvXMLStylesContext::CreateStyleStyleChildContext
;
192 virtual SvXMLStyleContext
*CreateStyleStyleChildContext(
193 XmlStyleFamily nFamily
,
195 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
197 using SvXMLStylesContext::CreateDefaultStyleStyleChildContext
;
198 virtual SvXMLStyleContext
*CreateDefaultStyleStyleChildContext(
199 XmlStyleFamily nFamily
,
201 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
205 SdXMLImport
& rImport
,
208 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
209 virtual rtl::Reference
< SvXMLImportPropertyMapper
> GetImportPropertyMapper(XmlStyleFamily nFamily
) const override
;
211 void SetMasterPageStyles(SdXMLMasterPageContext
const & rMaster
) const;
213 css::uno::Reference
< css::container::XNameAccess
> getPageLayouts() const;
216 // office:master-styles context
218 class SdXMLMasterStylesContext
: public SvXMLImportContext
220 std::vector
< rtl::Reference
< SdXMLMasterPageContext
> > maMasterPageList
;
222 const SdXMLImport
& GetSdImport() const { return static_cast<const SdXMLImport
&>(GetImport()); }
223 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
227 SdXMLMasterStylesContext(SdXMLImport
& rImport
);
229 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
230 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
233 // <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl>
235 class SdXMLHeaderFooterDeclContext
: public SvXMLStyleContext
238 SdXMLHeaderFooterDeclContext( SvXMLImport
& rImport
,
239 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
);
241 virtual bool IsTransient() const override
;
242 virtual void SAL_CALL
endFastElement(sal_Int32
) override
;
243 virtual void SAL_CALL
characters( const OUString
& rChars
) override
;
248 OUString maStrDateTimeFormat
;
252 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */