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/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>
33 class SvNumberFormatter
;
34 class SvXMLNumFmtHelper
;
36 // special style:style context inside style:page-master context
38 class SdXMLPageMasterStyleContext
: public SvXMLStyleContext
40 sal_Int32 mnBorderBottom
;
41 sal_Int32 mnBorderLeft
;
42 sal_Int32 mnBorderRight
;
43 sal_Int32 mnBorderTop
;
46 css::view::PaperOrientation meOrientation
;
48 const SdXMLImport
& GetSdImport() const { return static_cast<const SdXMLImport
&>(GetImport()); }
49 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
53 SdXMLPageMasterStyleContext(
56 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
);
57 virtual ~SdXMLPageMasterStyleContext() override
;
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
; }
68 // style:page-master context
70 class SdXMLPageMasterContext
: public SvXMLStyleContext
72 rtl::Reference
<SdXMLPageMasterStyleContext
> mxPageMasterStyle
;
74 const SdXMLImport
& GetSdImport() const { return static_cast<const SdXMLImport
&>(GetImport()); }
75 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
79 SdXMLPageMasterContext(
82 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
);
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
;
87 const SdXMLPageMasterStyleContext
* GetPageMasterStyle() const { return mxPageMasterStyle
.get(); }
90 // style:masterpage context
92 class SdXMLMasterPageContext
: public SdXMLGenericPageContext
95 OUString msDisplayName
;
99 SdXMLMasterPageContext(
100 SdXMLImport
& rImport
,
102 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
,
103 css::uno::Reference
< css::drawing::XShapes
> const & rShapes
);
104 virtual ~SdXMLMasterPageContext() override
;
106 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
108 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& AttrList
) override
;
110 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
112 const OUString
& GetDisplayName() const { return msDisplayName
; }
116 // presentation:placeholder context
118 class SdXMLPresentationPlaceholderContext
: public SvXMLImportContext
123 const SdXMLImport
& GetSdImport() const { return static_cast<const SdXMLImport
&>(GetImport()); }
124 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
127 SdXMLPresentationPlaceholderContext(
128 SdXMLImport
& rImport
,
130 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
);
131 virtual ~SdXMLPresentationPlaceholderContext() override
;
133 const OUString
& GetName() const { return msName
; }
134 sal_Int32
GetX() const { return mnX
; }
137 // style:presentation-page-layout context
139 class SdXMLPresentationPageLayoutContext
: public SvXMLStyleContext
141 std::vector
< rtl::Reference
< SdXMLPresentationPlaceholderContext
> >
145 const SdXMLImport
& GetSdImport() const { return static_cast<const SdXMLImport
&>(GetImport()); }
146 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
150 SdXMLPresentationPageLayoutContext(
151 SdXMLImport
& rImport
,
153 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
);
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
;
158 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
160 sal_uInt16
GetTypeId() const { return mnTypeId
; }
163 // office:styles context
165 class SdXMLStylesContext
: public SvXMLStylesContext
167 rtl::Reference
< SvXMLImportPropertyMapper
> xPresImpPropMapper
;
169 std::unique_ptr
<SvXMLNumFmtHelper
> mpNumFmtHelper
;
170 std::unique_ptr
<SvNumberFormatter
> mpNumFormatter
;
172 const SdXMLImport
& GetSdImport() const { return static_cast<const SdXMLImport
&>(GetImport()); }
173 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
175 void ImpSetGraphicStyles() const;
176 void ImpSetCellStyles() const;
177 void ImpSetGraphicStyles( css::uno::Reference
< css::container::XNameAccess
> const & xPageStyles
,
178 XmlStyleFamily nFamily
, std::u16string_view rPrefix
) const;
181 using SvXMLStylesContext::CreateStyleChildContext
;
182 virtual SvXMLStyleContext
* CreateStyleChildContext(
184 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
186 using SvXMLStylesContext::CreateStyleStyleChildContext
;
187 virtual SvXMLStyleContext
*CreateStyleStyleChildContext(
188 XmlStyleFamily nFamily
,
190 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
192 using SvXMLStylesContext::CreateDefaultStyleStyleChildContext
;
193 virtual SvXMLStyleContext
*CreateDefaultStyleStyleChildContext(
194 XmlStyleFamily nFamily
,
196 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
200 SdXMLImport
& rImport
,
203 virtual void SAL_CALL
endFastElement(sal_Int32 nElement
) override
;
204 virtual rtl::Reference
< SvXMLImportPropertyMapper
> GetImportPropertyMapper(XmlStyleFamily nFamily
) const override
;
206 void SetMasterPageStyles(SdXMLMasterPageContext
const & rMaster
) const;
208 css::uno::Reference
< css::container::XNameAccess
> getPageLayouts() const;
211 // office:master-styles context
213 class SdXMLMasterStylesContext
: public SvXMLImportContext
215 std::vector
< rtl::Reference
< SdXMLMasterPageContext
> > maMasterPageList
;
217 const SdXMLImport
& GetSdImport() const { return static_cast<const SdXMLImport
&>(GetImport()); }
218 SdXMLImport
& GetSdImport() { return static_cast<SdXMLImport
&>(GetImport()); }
222 SdXMLMasterStylesContext(SdXMLImport
& rImport
);
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
;
228 // <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl>
230 class SdXMLHeaderFooterDeclContext
: public SvXMLStyleContext
233 SdXMLHeaderFooterDeclContext( SvXMLImport
& rImport
,
234 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
);
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
;
243 OUString maStrDateTimeFormat
;
247 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */