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 #pragma once
21 
22 #include <rtl/ustring.hxx>
23 #include <vector>
24 #include <xmloff/xmlictxt.hxx>
25 #include <xmloff/prstylei.hxx>
26 #include <xmloff/xmlimppr.hxx>
28 #include <xmloff/txtstyli.hxx>
29 #include "xmlimprt.hxx"
30 
32 
34 {
35 protected:
36 
37 public:
38 
42  virtual ~ScXMLCellImportPropertyMapper() override;
43 
45  virtual void finished(
46  ::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override;
47 };
48 
50 {
51 protected:
52 
53 public:
54 
58  virtual ~ScXMLRowImportPropertyMapper() override;
59 
61  virtual void finished(
62  ::std::vector< XMLPropertyState >& rProperties, sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override;
63 };
64 
66 {
67  OUString sDataStyleName;
68  OUString sPageStyle;
70  sal_Int32 nNumberFormat;
72  bool bParentSet;
75 
76  const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
77  ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
78 
79 protected:
80 
81  virtual void SetAttribute( sal_Int32 nElement,
82  const OUString& rValue ) override;
83 
84 public:
85 
87  SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, bool bDefaultStyle = false );
88  virtual ~XMLTableStyleContext() override;
89 
90  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
91  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
92 
93  virtual void FillPropertySet(const css::uno::Reference<
94  css::beans::XPropertySet > & rPropSet ) override;
95 
96  virtual void SetDefaults() override;
97 
98  void AddProperty(sal_Int16 nContextID, const css::uno::Any& aValue);
99  XMLPropertyState* FindProperty(const sal_Int16 nContextID);
100 
101  sal_Int32 GetNumberFormat();// { return nNumberFormat; }
102 
103  SCTAB GetLastSheet() const { return nLastSheet; }
104  void SetLastSheet(SCTAB nNew) { nLastSheet = nNew; }
105 
106  void ApplyCondFormat( const css::uno::Sequence<css::table::CellRangeAddress>& xCellRanges );
107 
108 private:
110 };
111 
113 {
114  css::uno::Reference< css::container::XNameContainer > xCellStyles;
115  css::uno::Reference< css::container::XNameContainer > xColumnStyles;
116  css::uno::Reference< css::container::XNameContainer > xRowStyles;
117  css::uno::Reference< css::container::XNameContainer > xTableStyles;
120  sal_Int32 nCellStyleIndex;
123 
128 
129  const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
130  ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
131 
132 protected:
133 
134  // Create a style context.
137  XmlStyleFamily nFamily,
138  sal_Int32 nElement,
139  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
140 
143  XmlStyleFamily nFamily, sal_Int32 nElement,
144  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
145 
146 public:
147 
148  XMLTableStylesContext( SvXMLImport& rImport, bool bAutoStyles );
149  virtual ~XMLTableStylesContext() override;
150 
151  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
152 
154  XmlStyleFamily nFamily ) const override;
155  virtual css::uno::Reference< css::container::XNameContainer >
156  GetStylesContainer( XmlStyleFamily nFamily ) const override;
157  virtual OUString GetServiceName( XmlStyleFamily nFamily ) const override;
158 
159  sal_Int32 GetIndex(const sal_Int16 nContextID);
160 };
161 
163 {
164 protected:
165  virtual SvXMLStyleContext *CreateStyleChildContext( sal_Int32 nElement,
166  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
167 
170  sal_Int32 nElement,
171  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
172 
173  virtual bool InsertStyleFamily( XmlStyleFamily nFamily ) const override;
174 
175 public:
176 
178 
179  virtual ~ScXMLMasterStylesContext() override;
180  virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
181 };
182 
184 {
185  css::uno::Reference<css::beans::XPropertySet> xPropSet;
188 
189  void ClearContent(const OUString& rContent);
190 public:
191 
192 
193  ScMasterPageContext( SvXMLImport& rImport, sal_Int32 nElement,
194  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
195  bool bOverwrite );
196  virtual ~ScMasterPageContext() override;
197 
199  sal_Int32 nElement,
200  const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList,
201  const bool bFooter,
202  const bool bLeft,
203  const bool bFirst ) override;
204 
205  virtual void Finish( bool bOverwrite ) override;
206 };
207 
209 {
210  sal_Int32 nLastSheet;
211 
212  const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
213  ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
214 
215 public:
217  SvXMLStylesContext& rStyles, XmlStyleFamily nFamily );
218  virtual ~ScCellTextStyleContext() override;
219 
220  // override FillPropertySet to store style information
221  virtual void FillPropertySet(
222  const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override;
223 };
224 
225 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nNumberFormatIndex
Definition: xmlstyli.hxx:118
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:103
ScXMLCellImportPropertyMapper(const rtl::Reference< XMLPropertySetMapper > &rMapper, SvXMLImport &rImport)
Definition: xmlstyli.cxx:63
SvXMLStylesContext * pStyles
Definition: xmlstyli.hxx:69
void SetLastSheet(SCTAB nNew)
Definition: xmlstyli.hxx:104
sal_Int32 nNumberFormat
Definition: xmlstyli.hxx:70
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:114
sal_Int32 nMasterPageNameIndex
Definition: xmlstyli.hxx:121
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:73
virtual ~XMLTableStyleContext() override
Definition: xmlstyli.cxx:429
sal_Int32 nConditionalFormatIndex
Definition: xmlstyli.hxx:119
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:117
css::uno::Reference< css::beans::XPropertySet > xPropSet
Definition: xmlstyli.hxx:185
sal_Int32 nCellStyleIndex
Definition: xmlstyli.hxx:120
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:125
void ClearContent(const OUString &rContent)
Definition: xmlstyli.cxx:964
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:76
css::uno::Reference< css::container::XNameContainer > xColumnStyles
Definition: xmlstyli.hxx:115
rtl::Reference< SvXMLImportPropertyMapper > xTableImpPropMapper
Definition: xmlstyli.hxx:127
css::uno::Reference< css::container::XNameContainer > xRowStyles
Definition: xmlstyli.hxx:116
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:212
virtual ~ScCellTextStyleContext() override
Definition: xmlstyli.cxx:998
virtual OUString GetServiceName(XmlStyleFamily nFamily) const override
Definition: xmlstyli.cxx:822
OUString sDataStyleName
Definition: xmlstyli.hxx:67
rtl::Reference< SvXMLImportPropertyMapper > xRowImpPropMapper
Definition: xmlstyli.hxx:126
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:77
ScXMLImport & GetScImport()
Definition: xmlstyli.hxx:213
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:130
virtual void Finish(bool bOverwrite) override
Definition: xmlstyli.cxx:982
const ScXMLImport & GetScImport() const
Definition: xmlstyli.hxx:129
rtl::Reference< SvXMLImportPropertyMapper > xCellImpPropMapper
Definition: xmlstyli.hxx:124
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:22
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