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_Int32 nElement,
83  const OUString& rValue ) override;
84 
85 public:
86 
88  SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefaultStyle = false );
89  virtual ~XMLTableStyleContext() override;
90 
91  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
92  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
93 
94  virtual void FillPropertySet(const css::uno::Reference<
95  css::beans::XPropertySet > & rPropSet ) override;
96 
97  virtual void SetDefaults() override;
98 
99  void AddProperty(sal_Int16 nContextID, const css::uno::Any& aValue);
100  XMLPropertyState* FindProperty(const sal_Int16 nContextID);
101 
102  sal_Int32 GetNumberFormat();// { return nNumberFormat; }
103 
104  SCTAB GetLastSheet() const { return nLastSheet; }
105  void SetLastSheet(SCTAB nNew) { nLastSheet = nNew; }
106 
107  void ApplyCondFormat( const css::uno::Sequence<css::table::CellRangeAddress>& xCellRanges );
108 
109 private:
111 };
112 
114 {
115  css::uno::Reference< css::container::XNameContainer > xCellStyles;
116  css::uno::Reference< css::container::XNameContainer > xColumnStyles;
117  css::uno::Reference< css::container::XNameContainer > xRowStyles;
118  css::uno::Reference< css::container::XNameContainer > xTableStyles;
121  sal_Int32 nCellStyleIndex;
124 
129 
130  const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
131  ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
132 
133 protected:
134 
135  // Create a style context.
138  XmlStyleFamily nFamily,
139  sal_Int32 nElement,
140  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
141 
144  XmlStyleFamily nFamily, sal_Int32 nElement,
145  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
146 
147 public:
148 
149  XMLTableStylesContext( SvXMLImport& rImport, bool bAutoStyles );
150  virtual ~XMLTableStylesContext() override;
151 
152  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
153 
155  XmlStyleFamily nFamily ) const override;
156  virtual css::uno::Reference< css::container::XNameContainer >
157  GetStylesContainer( XmlStyleFamily nFamily ) const override;
158  virtual OUString GetServiceName( XmlStyleFamily nFamily ) const override;
159 
160  sal_Int32 GetIndex(const sal_Int16 nContextID);
161 };
162 
164 {
165 protected:
166  virtual SvXMLStyleContext *CreateStyleChildContext( sal_Int32 nElement,
167  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
168 
171  sal_Int32 nElement,
172  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
173 
174  virtual bool InsertStyleFamily( XmlStyleFamily nFamily ) const override;
175 
176 public:
177 
179 
180  virtual ~ScXMLMasterStylesContext() override;
181  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
182 };
183 
185 {
186  css::uno::Reference<css::beans::XPropertySet> xPropSet;
189 
190  void ClearContent(const OUString& rContent);
191 public:
192 
193 
194  ScMasterPageContext( SvXMLImport& rImport, sal_Int32 nElement,
195  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
196  bool bOverwrite );
197  virtual ~ScMasterPageContext() override;
198 
200  sal_Int32 nElement,
201  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
202  const bool bFooter,
203  const bool bLeft,
204  const bool bFirst ) override;
205 
206  virtual void Finish( bool bOverwrite ) override;
207 };
208 
210 {
211  sal_Int32 nLastSheet;
212 
213  const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
214  ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
215 
216 public:
218  SvXMLStylesContext& rStyles, XmlStyleFamily nFamily );
219  virtual ~ScCellTextStyleContext() override;
220 
221  // override FillPropertySet to store style information
222  virtual void FillPropertySet(
223  const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override;
224 };
225 
226 #endif
227 
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nNumberFormatIndex
Definition: xmlstyli.hxx:119
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlstyli.cxx:678
ScCellTextStyleContext(SvXMLImport &rImport, SvXMLStylesContext &rStyles, XmlStyleFamily nFamily)
Definition: xmlstyli.cxx:991
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:606
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: xmlstyli.cxx:435
virtual SvXMLStyleContext * CreateStyleChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:896
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:635
XMLTableStylesContext(SvXMLImport &rImport, bool bAutoStyles)
Definition: xmlstyli.cxx:663
SvXMLImport & GetImport()
virtual css::uno::Reference< css::container::XNameContainer > GetStylesContainer(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:739
virtual void SetAttribute(sal_Int32 nElement, const OUString &rValue) override
Definition: xmlstyli.cxx:399
SCTAB GetLastSheet() const
Definition: xmlstyli.hxx:104
ScXMLCellImportPropertyMapper(const rtl::Reference< XMLPropertySetMapper > &rMapper, SvXMLImport &rImport)
Definition: xmlstyli.cxx:63
SvXMLStylesContext * pStyles
Definition: xmlstyli.hxx:70
void SetLastSheet(SCTAB nNew)
Definition: xmlstyli.hxx:105
sal_Int32 nNumberFormat
Definition: xmlstyli.hxx:71
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet) override
Definition: xmlstyli.cxx:1002
css::uno::Reference< css::container::XNameContainer > xCellStyles
Definition: xmlstyli.hxx:115
sal_Int32 nMasterPageNameIndex
Definition: xmlstyli.hxx:122
XmlStyleFamily
virtual ~ScMasterPageContext() override
Definition: xmlstyli.cxx:937
virtual SvXMLImportContext * CreateHeaderFooterContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, const bool bFooter, const bool bLeft, const bool bFirst) override
Definition: xmlstyli.cxx:941
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet) override
Definition: xmlstyli.cxx:511
void AddProperty(sal_Int16 nContextID, const css::uno::Any &aValue)
Definition: xmlstyli.cxx:550
virtual ~ScXMLRowImportPropertyMapper() override
Definition: xmlstyli.cxx:211
ScConditionalFormat * mpCondFormat
Definition: xmlstyli.hxx:74
virtual ~XMLTableStyleContext() override
Definition: xmlstyli.cxx:429
sal_Int32 nConditionalFormatIndex
Definition: xmlstyli.hxx:120
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:74
ScMasterPageContext(SvXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, bool bOverwrite)
Definition: xmlstyli.cxx:927
XMLTableStyleContext(ScXMLImport &rImport, SvXMLStylesContext &rStyles, XmlStyleFamily nFamily, bool bDefaultStyle=false)
Definition: xmlstyli.cxx:416
void ApplyCondFormat(const css::uno::Sequence< css::table::CellRangeAddress > &xCellRanges)
Definition: xmlstyli.cxx:467
css::uno::Reference< css::container::XNameContainer > xTableStyles
Definition: xmlstyli.hxx:118
css::uno::Reference< css::beans::XPropertySet > xPropSet
Definition: xmlstyli.hxx:186
sal_Int32 nCellStyleIndex
Definition: xmlstyli.hxx:121
XMLPropertyState * FindProperty(const sal_Int16 nContextID)
Definition: xmlstyli.cxx:561
sal_Int32 GetNumberFormat()
Definition: xmlstyli.cxx:582
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:215
virtual ~ScXMLCellImportPropertyMapper() override
Definition: xmlstyli.cxx:70
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
void SetStyle(const css::uno::Reference< css::style::XStyle > &xStl)
rtl::Reference< SvXMLImportPropertyMapper > xColumnImpPropMapper
Definition: xmlstyli.hxx:126
void ClearContent(const OUString &rContent)
Definition: xmlstyli.cxx:964
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:77
css::uno::Reference< css::container::XNameContainer > xColumnStyles
Definition: xmlstyli.hxx:116
rtl::Reference< SvXMLImportPropertyMapper > xTableImpPropMapper
Definition: xmlstyli.hxx:128
css::uno::Reference< css::container::XNameContainer > xRowStyles
Definition: xmlstyli.hxx:117
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:213
virtual ~ScCellTextStyleContext() override
Definition: xmlstyli.cxx:998
virtual OUString GetServiceName(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:822
OUString sDataStyleName
Definition: xmlstyli.hxx:68
rtl::Reference< SvXMLImportPropertyMapper > xRowImpPropMapper
Definition: xmlstyli.hxx:127
virtual bool InsertStyleFamily(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:882
ScXMLRowImportPropertyMapper(const rtl::Reference< XMLPropertySetMapper > &rMapper, SvXMLImport &rImport)
Definition: xmlstyli.cxx:204
ScXMLImport & GetScImport()
Definition: xmlstyli.hxx:78
ScXMLImport & GetScImport()
Definition: xmlstyli.hxx:214
virtual ~XMLTableStylesContext() override
Definition: xmlstyli.cxx:674
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlstyli.cxx:921
virtual ~ScXMLMasterStylesContext() override
Definition: xmlstyli.cxx:892
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:687
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
ScXMLImport & GetScImport()
Definition: xmlstyli.hxx:131
virtual void Finish(bool bOverwrite) override
Definition: xmlstyli.cxx:982
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:130
rtl::Reference< SvXMLImportPropertyMapper > xCellImpPropMapper
Definition: xmlstyli.hxx:125
virtual void SetDefaults() override
Definition: xmlstyli.cxx:536
sal_Int32 GetIndex(const sal_Int16 nContextID)
Definition: xmlstyli.cxx:847
sal_Int16 SCTAB
Definition: types.hxx:23
ScXMLMasterStylesContext(SvXMLImport &rImport)
Definition: xmlstyli.cxx:887
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:913