LibreOffice Module sc (master)  1
xmlstyli.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_SC_SOURCE_FILTER_XML_XMLSTYLI_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLSTYLI_HXX
22 
23 #include <rtl/ustring.hxx>
24 #include <vector>
25 #include <xmloff/xmlictxt.hxx>
26 #include <xmloff/prstylei.hxx>
27 #include <xmloff/xmlimppr.hxx>
29 #include <xmloff/txtstyli.hxx>
30 #include "xmlimprt.hxx"
31 
33 
35 {
36 protected:
37 
38 public:
39 
43  virtual ~ScXMLCellImportPropertyMapper() override;
44 
46  virtual void finished(
47  ::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override;
48 };
49 
51 {
52 protected:
53 
54 public:
55 
59  virtual ~ScXMLRowImportPropertyMapper() override;
60 
62  virtual void finished(
63  ::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override;
64 };
65 
67 {
68  OUString sDataStyleName;
69  OUString sPageStyle;
71  sal_Int32 nNumberFormat;
73  bool bParentSet;
76 
77  const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
78  ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
79 
80 protected:
81 
82  virtual void SetAttribute( sal_uInt16 nPrefixKey,
83  const OUString& rLocalName,
84  const OUString& rValue ) override;
85 
86 public:
87 
88 
89  XMLTableStyleContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
90  const OUString& rLName,
91  const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList,
92  SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefaultStyle = false );
93  virtual ~XMLTableStyleContext() override;
94 
96  sal_uInt16 nPrefix,
97  const OUString& rLocalName,
98  const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
99 
100  virtual void FillPropertySet(const css::uno::Reference<
101  css::beans::XPropertySet > & rPropSet ) override;
102 
103  virtual void SetDefaults() override;
104 
105  void AddProperty(sal_Int16 nContextID, const css::uno::Any& aValue);
106  XMLPropertyState* FindProperty(const sal_Int16 nContextID);
107 
108  sal_Int32 GetNumberFormat();// { return nNumberFormat; }
109 
110  SCTAB GetLastSheet() const { return nLastSheet; }
111  void SetLastSheet(SCTAB nNew) { nLastSheet = nNew; }
112 
113  void ApplyCondFormat( const css::uno::Sequence<css::table::CellRangeAddress>& xCellRanges );
114 
115 private:
117 };
118 
120 {
121  css::uno::Reference< css::container::XNameContainer > xCellStyles;
122  css::uno::Reference< css::container::XNameContainer > xColumnStyles;
123  css::uno::Reference< css::container::XNameContainer > xRowStyles;
124  css::uno::Reference< css::container::XNameContainer > xTableStyles;
127  sal_Int32 nCellStyleIndex;
130 
135 
136  const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
137  ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
138 
139 protected:
140 
141  // Create a style context.
143  XmlStyleFamily nFamily,
144  sal_uInt16 nPrefix,
145  const OUString& rLocalName,
146  const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
147 
149  XmlStyleFamily nFamily, sal_uInt16 nPrefix,
150  const OUString& rLocalName,
151  const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
152 
153 public:
154 
155  XMLTableStylesContext( SvXMLImport& rImport, bool bAutoStyles );
156  virtual ~XMLTableStylesContext() override;
157 
158  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
159 
161  XmlStyleFamily nFamily ) const override;
162  virtual css::uno::Reference< css::container::XNameContainer >
163  GetStylesContainer( XmlStyleFamily nFamily ) const override;
164  virtual OUString GetServiceName( XmlStyleFamily nFamily ) const override;
165 
166  sal_Int32 GetIndex(const sal_Int16 nContextID);
167 };
168 
170 {
171 protected:
172  virtual SvXMLStyleContext *CreateStyleChildContext( sal_uInt16 nPrefix,
173  const OUString& rLocalName,
174  const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
175 
177  sal_uInt16 nPrefix, const OUString& rLocalName,
178  const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) override;
179 
180  virtual bool InsertStyleFamily( XmlStyleFamily nFamily ) const override;
181 
182 public:
183 
185 
186  virtual ~ScXMLMasterStylesContext() override;
187  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
188 };
189 
191 {
192  css::uno::Reference<css::beans::XPropertySet> xPropSet;
195 
196  void ClearContent(const OUString& rContent);
197 public:
198 
199 
200  ScMasterPageContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
201  const OUString& rLName,
202  const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList,
203  bool bOverwrite );
204  virtual ~ScMasterPageContext() override;
205 
207  sal_uInt16 nPrefix,
208  const OUString& rLocalName,
209  const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList,
210  const bool bFooter,
211  const bool bLeft,
212  const bool bFirst ) override;
213 
214  virtual void Finish( bool bOverwrite ) override;
215 };
216 
218 {
219  sal_Int32 nLastSheet;
220 
221  const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
222  ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
223 
224 public:
225  ScCellTextStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
226  const OUString& rLName,
227  const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList,
228  SvXMLStylesContext& rStyles, XmlStyleFamily nFamily );
229  virtual ~ScCellTextStyleContext() override;
230 
231  // override FillPropertySet to store style information
232  virtual void FillPropertySet(
233  const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override;
234 };
235 
236 #endif
237 
238 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nNumberFormatIndex
Definition: xmlstyli.hxx:125
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlstyli.cxx:699
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:622
ScCellTextStyleContext(SvXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList, SvXMLStylesContext &rStyles, XmlStyleFamily nFamily)
Definition: xmlstyli.cxx:1017
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:653
virtual SvXMLImportContext * CreateHeaderFooterContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList, const bool bFooter, const bool bLeft, const bool bFirst) override
Definition: xmlstyli.cxx:966
XMLTableStylesContext(SvXMLImport &rImport, bool bAutoStyles)
Definition: xmlstyli.cxx:684
SvXMLImport & GetImport()
virtual css::uno::Reference< css::container::XNameContainer > GetStylesContainer(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:761
SCTAB GetLastSheet() const
Definition: xmlstyli.hxx:110
ScXMLCellImportPropertyMapper(const rtl::Reference< XMLPropertySetMapper > &rMapper, SvXMLImport &rImport)
Definition: xmlstyli.cxx:64
SvXMLStylesContext * pStyles
Definition: xmlstyli.hxx:70
void SetLastSheet(SCTAB nNew)
Definition: xmlstyli.hxx:111
sal_Int32 nNumberFormat
Definition: xmlstyli.hxx:71
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet) override
Definition: xmlstyli.cxx:1029
css::uno::Reference< css::container::XNameContainer > xCellStyles
Definition: xmlstyli.hxx:121
virtual void SetAttribute(sal_uInt16 nPrefixKey, const OUString &rLocalName, const OUString &rValue) override
Definition: xmlstyli.cxx:412
sal_Int32 nMasterPageNameIndex
Definition: xmlstyli.hxx:128
XmlStyleFamily
virtual ~ScMasterPageContext() override
Definition: xmlstyli.cxx:962
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet) override
Definition: xmlstyli.cxx:527
void AddProperty(sal_Int16 nContextID, const css::uno::Any &aValue)
Definition: xmlstyli.cxx:566
virtual ~ScXMLRowImportPropertyMapper() override
Definition: xmlstyli.cxx:212
XMLTableStyleContext(ScXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList, SvXMLStylesContext &rStyles, XmlStyleFamily nFamily, bool bDefaultStyle=false)
Definition: xmlstyli.cxx:426
ScConditionalFormat * mpCondFormat
Definition: xmlstyli.hxx:74
virtual ~XMLTableStyleContext() override
Definition: xmlstyli.cxx:441
sal_Int32 nConditionalFormatIndex
Definition: xmlstyli.hxx:126
virtual void finished(::std::vector< XMLPropertyState > &rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex) const override
This method is called when all attributes have been processed.
Definition: xmlstyli.cxx:75
void ApplyCondFormat(const css::uno::Sequence< css::table::CellRangeAddress > &xCellRanges)
Definition: xmlstyli.cxx:483
css::uno::Reference< css::container::XNameContainer > xTableStyles
Definition: xmlstyli.hxx:124
css::uno::Reference< css::beans::XPropertySet > xPropSet
Definition: xmlstyli.hxx:192
sal_Int32 nCellStyleIndex
Definition: xmlstyli.hxx:127
XMLPropertyState * FindProperty(const sal_Int16 nContextID)
Definition: xmlstyli.cxx:577
sal_Int32 GetNumberFormat()
Definition: xmlstyli.cxx:598
virtual void finished(::std::vector< XMLPropertyState > &rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex) const override
This method is called when all attributes have been processed.
Definition: xmlstyli.cxx:216
virtual ~ScXMLCellImportPropertyMapper() override
Definition: xmlstyli.cxx:71
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:937
void SetStyle(const css::uno::Reference< css::style::XStyle > &xStl)
rtl::Reference< SvXMLImportPropertyMapper > xColumnImpPropMapper
Definition: xmlstyli.hxx:132
void ClearContent(const OUString &rContent)
Definition: xmlstyli.cxx:990
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:77
css::uno::Reference< css::container::XNameContainer > xColumnStyles
Definition: xmlstyli.hxx:122
rtl::Reference< SvXMLImportPropertyMapper > xTableImpPropMapper
Definition: xmlstyli.hxx:134
css::uno::Reference< css::container::XNameContainer > xRowStyles
Definition: xmlstyli.hxx:123
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:221
virtual ~ScCellTextStyleContext() override
Definition: xmlstyli.cxx:1025
virtual OUString GetServiceName(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:844
OUString sDataStyleName
Definition: xmlstyli.hxx:68
rtl::Reference< SvXMLImportPropertyMapper > xRowImpPropMapper
Definition: xmlstyli.hxx:133
virtual bool InsertStyleFamily(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:904
ScXMLRowImportPropertyMapper(const rtl::Reference< XMLPropertySetMapper > &rMapper, SvXMLImport &rImport)
Definition: xmlstyli.cxx:205
ScXMLImport & GetScImport()
Definition: xmlstyli.hxx:78
ScXMLImport & GetScImport()
Definition: xmlstyli.hxx:222
virtual ~XMLTableStylesContext() override
Definition: xmlstyli.cxx:695
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlstyli.cxx:946
virtual ~ScXMLMasterStylesContext() override
Definition: xmlstyli.cxx:914
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:709
ScXMLImport & GetScImport()
Definition: xmlstyli.hxx:137
virtual void Finish(bool bOverwrite) override
Definition: xmlstyli.cxx:1008
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:136
rtl::Reference< SvXMLImportPropertyMapper > xCellImpPropMapper
Definition: xmlstyli.hxx:131
ScMasterPageContext(SvXMLImport &rImport, sal_uInt16 nPrfx, const OUString &rLName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList, bool bOverwrite)
Definition: xmlstyli.cxx:952
virtual void SetDefaults() override
Definition: xmlstyli.cxx:552
virtual SvXMLImportContextRef CreateChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:447
virtual SvXMLStyleContext * CreateStyleChildContext(sal_uInt16 nPrefix, const OUString &rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:918
sal_Int32 GetIndex(const sal_Int16 nContextID)
Definition: xmlstyli.cxx:869
sal_Int16 SCTAB
Definition: types.hxx:23
ScXMLMasterStylesContext(SvXMLImport &rImport)
Definition: xmlstyli.cxx:909