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 
89  SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefaultStyle = false );
90  virtual ~XMLTableStyleContext() override;
91 
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;
94 
95  virtual void FillPropertySet(const css::uno::Reference<
96  css::beans::XPropertySet > & rPropSet ) override;
97 
98  virtual void SetDefaults() override;
99 
100  void AddProperty(sal_Int16 nContextID, const css::uno::Any& aValue);
101  XMLPropertyState* FindProperty(const sal_Int16 nContextID);
102 
103  sal_Int32 GetNumberFormat();// { return nNumberFormat; }
104 
105  SCTAB GetLastSheet() const { return nLastSheet; }
106  void SetLastSheet(SCTAB nNew) { nLastSheet = nNew; }
107 
108  void ApplyCondFormat( const css::uno::Sequence<css::table::CellRangeAddress>& xCellRanges );
109 
110 private:
112 };
113 
115 {
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;
122  sal_Int32 nCellStyleIndex;
125 
130 
131  const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
132  ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
133 
134 protected:
135 
136  // Create a style context.
139  XmlStyleFamily nFamily,
140  sal_Int32 nElement,
141  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
142 
145  XmlStyleFamily nFamily, sal_Int32 nElement,
146  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
147 
148 public:
149 
150  XMLTableStylesContext( SvXMLImport& rImport, bool bAutoStyles );
151  virtual ~XMLTableStylesContext() override;
152 
153  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
154 
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;
160 
161  sal_Int32 GetIndex(const sal_Int16 nContextID);
162 };
163 
165 {
166 protected:
167  virtual SvXMLStyleContext *CreateStyleChildContext( sal_Int32 nElement,
168  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
169 
172  sal_Int32 nElement,
173  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
174 
175  virtual bool InsertStyleFamily( XmlStyleFamily nFamily ) const override;
176 
177 public:
178 
180 
181  virtual ~ScXMLMasterStylesContext() override;
182  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
183 };
184 
186 {
187  css::uno::Reference<css::beans::XPropertySet> xPropSet;
190 
191  void ClearContent(const OUString& rContent);
192 public:
193 
194 
195  ScMasterPageContext( SvXMLImport& rImport, sal_Int32 nElement,
196  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
197  bool bOverwrite );
198  virtual ~ScMasterPageContext() override;
199 
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;
206 
207  virtual void Finish( bool bOverwrite ) override;
208 };
209 
211 {
212  sal_Int32 nLastSheet;
213 
214  const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
215  ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
216 
217 public:
219  SvXMLStylesContext& rStyles, XmlStyleFamily nFamily );
220  virtual ~ScCellTextStyleContext() override;
221 
222  // override FillPropertySet to store style information
223  virtual void FillPropertySet(
224  const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override;
225 };
226 
227 #endif
228 
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nNumberFormatIndex
Definition: xmlstyli.hxx:120
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlstyli.cxx:680
ScCellTextStyleContext(SvXMLImport &rImport, SvXMLStylesContext &rStyles, XmlStyleFamily nFamily)
Definition: xmlstyli.cxx:994
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:608
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:437
virtual SvXMLStyleContext * CreateStyleChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:899
virtual SvXMLStyleContext * CreateDefaultStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:637
XMLTableStylesContext(SvXMLImport &rImport, bool bAutoStyles)
Definition: xmlstyli.cxx:665
SvXMLImport & GetImport()
virtual css::uno::Reference< css::container::XNameContainer > GetStylesContainer(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:742
SCTAB GetLastSheet() const
Definition: xmlstyli.hxx:105
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:106
sal_Int32 nNumberFormat
Definition: xmlstyli.hxx:71
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet) override
Definition: xmlstyli.cxx:1005
css::uno::Reference< css::container::XNameContainer > xCellStyles
Definition: xmlstyli.hxx:116
virtual void SetAttribute(sal_uInt16 nPrefixKey, const OUString &rLocalName, const OUString &rValue) override
Definition: xmlstyli.cxx:404
sal_Int32 nMasterPageNameIndex
Definition: xmlstyli.hxx:123
XmlStyleFamily
virtual ~ScMasterPageContext() override
Definition: xmlstyli.cxx:940
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:944
virtual void FillPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet) override
Definition: xmlstyli.cxx:513
void AddProperty(sal_Int16 nContextID, const css::uno::Any &aValue)
Definition: xmlstyli.cxx:552
virtual ~ScXMLRowImportPropertyMapper() override
Definition: xmlstyli.cxx:212
ScConditionalFormat * mpCondFormat
Definition: xmlstyli.hxx:74
virtual ~XMLTableStyleContext() override
Definition: xmlstyli.cxx:431
sal_Int32 nConditionalFormatIndex
Definition: xmlstyli.hxx:121
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
ScMasterPageContext(SvXMLImport &rImport, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList, bool bOverwrite)
Definition: xmlstyli.cxx:930
XMLTableStyleContext(ScXMLImport &rImport, SvXMLStylesContext &rStyles, XmlStyleFamily nFamily, bool bDefaultStyle=false)
Definition: xmlstyli.cxx:418
void ApplyCondFormat(const css::uno::Sequence< css::table::CellRangeAddress > &xCellRanges)
Definition: xmlstyli.cxx:469
css::uno::Reference< css::container::XNameContainer > xTableStyles
Definition: xmlstyli.hxx:119
css::uno::Reference< css::beans::XPropertySet > xPropSet
Definition: xmlstyli.hxx:187
sal_Int32 nCellStyleIndex
Definition: xmlstyli.hxx:122
XMLPropertyState * FindProperty(const sal_Int16 nContextID)
Definition: xmlstyli.cxx:563
sal_Int32 GetNumberFormat()
Definition: xmlstyli.cxx:584
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 * 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:127
void ClearContent(const OUString &rContent)
Definition: xmlstyli.cxx:967
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:77
css::uno::Reference< css::container::XNameContainer > xColumnStyles
Definition: xmlstyli.hxx:117
rtl::Reference< SvXMLImportPropertyMapper > xTableImpPropMapper
Definition: xmlstyli.hxx:129
css::uno::Reference< css::container::XNameContainer > xRowStyles
Definition: xmlstyli.hxx:118
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:214
virtual ~ScCellTextStyleContext() override
Definition: xmlstyli.cxx:1001
virtual OUString GetServiceName(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:825
OUString sDataStyleName
Definition: xmlstyli.hxx:68
rtl::Reference< SvXMLImportPropertyMapper > xRowImpPropMapper
Definition: xmlstyli.hxx:128
virtual bool InsertStyleFamily(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:885
ScXMLRowImportPropertyMapper(const rtl::Reference< XMLPropertySetMapper > &rMapper, SvXMLImport &rImport)
Definition: xmlstyli.cxx:205
ScXMLImport & GetScImport()
Definition: xmlstyli.hxx:78
ScXMLImport & GetScImport()
Definition: xmlstyli.hxx:215
virtual ~XMLTableStylesContext() override
Definition: xmlstyli.cxx:676
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlstyli.cxx:924
virtual ~ScXMLMasterStylesContext() override
Definition: xmlstyli.cxx:895
virtual rtl::Reference< SvXMLImportPropertyMapper > GetImportPropertyMapper(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:690
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
ScXMLImport & GetScImport()
Definition: xmlstyli.hxx:132
virtual void Finish(bool bOverwrite) override
Definition: xmlstyli.cxx:985
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:131
rtl::Reference< SvXMLImportPropertyMapper > xCellImpPropMapper
Definition: xmlstyli.hxx:126
virtual void SetDefaults() override
Definition: xmlstyli.cxx:538
sal_Int32 GetIndex(const sal_Int16 nContextID)
Definition: xmlstyli.cxx:850
sal_Int16 SCTAB
Definition: types.hxx:23
ScXMLMasterStylesContext(SvXMLImport &rImport)
Definition: xmlstyli.cxx:890
virtual SvXMLStyleContext * CreateStyleStyleChildContext(XmlStyleFamily nFamily, sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmlstyli.cxx:916