nss: upgrade to release 3.73
[LibreOffice.git] / sc / source / filter / xml / xmlstyli.hxx
blobe867b4969ae113cb6325757197c86f29df56f3db
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_XML_XMLSTYLI_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLSTYLI_HXX
23 #include <rtl/ustring.hxx>
24 #include <vector>
25 #include <xmloff/xmlictxt.hxx>
26 #include <xmloff/prstylei.hxx>
27 #include <xmloff/xmlimppr.hxx>
28 #include <xmloff/XMLTextMasterPageContext.hxx>
29 #include <xmloff/txtstyli.hxx>
30 #include "xmlimprt.hxx"
32 class ScConditionalFormat;
34 class ScXMLCellImportPropertyMapper : public SvXMLImportPropertyMapper
36 protected:
38 public:
40 ScXMLCellImportPropertyMapper(
41 const rtl::Reference< XMLPropertySetMapper >& rMapper,
42 SvXMLImport& rImport);
43 virtual ~ScXMLCellImportPropertyMapper() override;
45 /** This method is called when all attributes have been processed. It may be used to remove items that are incomplete */
46 virtual void finished(
47 ::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override;
50 class ScXMLRowImportPropertyMapper : public SvXMLImportPropertyMapper
52 protected:
54 public:
56 ScXMLRowImportPropertyMapper(
57 const rtl::Reference< XMLPropertySetMapper >& rMapper,
58 SvXMLImport& rImport);
59 virtual ~ScXMLRowImportPropertyMapper() override;
61 /** This method is called when all attributes have been processed. It may be used to remove items that are incomplete */
62 virtual void finished(
63 ::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override;
66 class XMLTableStyleContext : public XMLPropStyleContext
68 OUString sDataStyleName;
69 OUString sPageStyle;
70 SvXMLStylesContext* pStyles;
71 sal_Int32 nNumberFormat;
72 SCTAB nLastSheet;
73 bool bParentSet;
74 ScConditionalFormat* mpCondFormat;
75 bool mbDeleteCondFormat;
77 const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
78 ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
80 protected:
82 virtual void SetAttribute( sal_uInt16 nPrefixKey,
83 const OUString& rLocalName,
84 const OUString& rValue ) override;
86 public:
88 XMLTableStyleContext( ScXMLImport& rImport,
89 SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefaultStyle = false );
90 virtual ~XMLTableStyleContext() override;
92 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
93 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
95 virtual void FillPropertySet(const css::uno::Reference<
96 css::beans::XPropertySet > & rPropSet ) override;
98 virtual void SetDefaults() override;
100 void AddProperty(sal_Int16 nContextID, const css::uno::Any& aValue);
101 XMLPropertyState* FindProperty(const sal_Int16 nContextID);
103 sal_Int32 GetNumberFormat();// { return nNumberFormat; }
105 SCTAB GetLastSheet() const { return nLastSheet; }
106 void SetLastSheet(SCTAB nNew) { nLastSheet = nNew; }
108 void ApplyCondFormat( const css::uno::Sequence<css::table::CellRangeAddress>& xCellRanges );
110 private:
111 using XMLPropStyleContext::SetStyle;
114 class XMLTableStylesContext : public SvXMLStylesContext
116 css::uno::Reference< css::container::XNameContainer > xCellStyles;
117 css::uno::Reference< css::container::XNameContainer > xColumnStyles;
118 css::uno::Reference< css::container::XNameContainer > xRowStyles;
119 css::uno::Reference< css::container::XNameContainer > xTableStyles;
120 sal_Int32 nNumberFormatIndex;
121 sal_Int32 nConditionalFormatIndex;
122 sal_Int32 nCellStyleIndex;
123 sal_Int32 nMasterPageNameIndex;
124 bool bAutoStyles;
126 rtl::Reference < SvXMLImportPropertyMapper > xCellImpPropMapper;
127 rtl::Reference < SvXMLImportPropertyMapper > xColumnImpPropMapper;
128 rtl::Reference < SvXMLImportPropertyMapper > xRowImpPropMapper;
129 rtl::Reference < SvXMLImportPropertyMapper > xTableImpPropMapper;
131 const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
132 ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
134 protected:
136 // Create a style context.
137 using SvXMLStylesContext::CreateStyleStyleChildContext;
138 virtual SvXMLStyleContext *CreateStyleStyleChildContext(
139 XmlStyleFamily nFamily,
140 sal_Int32 nElement,
141 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
143 using SvXMLStylesContext::CreateDefaultStyleStyleChildContext;
144 virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
145 XmlStyleFamily nFamily, sal_Int32 nElement,
146 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
148 public:
150 XMLTableStylesContext( SvXMLImport& rImport, bool bAutoStyles );
151 virtual ~XMLTableStylesContext() override;
153 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
155 virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper(
156 XmlStyleFamily nFamily ) const override;
157 virtual css::uno::Reference< css::container::XNameContainer >
158 GetStylesContainer( XmlStyleFamily nFamily ) const override;
159 virtual OUString GetServiceName( XmlStyleFamily nFamily ) const override;
161 sal_Int32 GetIndex(const sal_Int16 nContextID);
164 class ScXMLMasterStylesContext : public SvXMLStylesContext
166 protected:
167 virtual SvXMLStyleContext *CreateStyleChildContext( sal_Int32 nElement,
168 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
170 using SvXMLStylesContext::CreateStyleStyleChildContext;
171 virtual SvXMLStyleContext *CreateStyleStyleChildContext( XmlStyleFamily nFamily,
172 sal_Int32 nElement,
173 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
175 virtual bool InsertStyleFamily( XmlStyleFamily nFamily ) const override;
177 public:
179 ScXMLMasterStylesContext( SvXMLImport& rImport );
181 virtual ~ScXMLMasterStylesContext() override;
182 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
185 class ScMasterPageContext : public XMLTextMasterPageContext
187 css::uno::Reference<css::beans::XPropertySet> xPropSet;
188 bool bContainsRightHeader;
189 bool bContainsRightFooter;
191 void ClearContent(const OUString& rContent);
192 public:
195 ScMasterPageContext( SvXMLImport& rImport, sal_Int32 nElement,
196 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
197 bool bOverwrite );
198 virtual ~ScMasterPageContext() override;
200 virtual SvXMLImportContext *CreateHeaderFooterContext(
201 sal_Int32 nElement,
202 const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
203 const bool bFooter,
204 const bool bLeft,
205 const bool bFirst ) override;
207 virtual void Finish( bool bOverwrite ) override;
210 class ScCellTextStyleContext : public XMLTextStyleContext
212 sal_Int32 nLastSheet;
214 const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
215 ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
217 public:
218 ScCellTextStyleContext( SvXMLImport& rImport,
219 SvXMLStylesContext& rStyles, XmlStyleFamily nFamily );
220 virtual ~ScCellTextStyleContext() override;
222 // override FillPropertySet to store style information
223 virtual void FillPropertySet(
224 const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override;
227 #endif
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */