Line data Source code
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_REPORTDESIGN_SOURCE_FILTER_XML_XMLSTYLEIMPORT_HXX
21 : #define INCLUDED_REPORTDESIGN_SOURCE_FILTER_XML_XMLSTYLEIMPORT_HXX
22 :
23 : #include <rtl/ustring.hxx>
24 : #include <xmloff/xmlimp.hxx>
25 : #include <xmloff/xmlictxt.hxx>
26 : #include <xmloff/maptype.hxx>
27 : #include <xmloff/prstylei.hxx>
28 : #include <xmloff/xmlimppr.hxx>
29 : #include <xmloff/XMLTextMasterPageContext.hxx>
30 : #include <xmloff/XMLTextMasterStylesContext.hxx>
31 : #include <xmloff/contextid.hxx>
32 : #include <xmloff/controlpropertyhdl.hxx>
33 : #include <vector>
34 :
35 : namespace rptxml
36 : {
37 : class ORptFilter;
38 :
39 : class OControlStyleContext : public XMLPropStyleContext
40 : {
41 : OUString m_sDataStyleName;
42 : OUString sPageStyle;
43 : const OUString sNumberFormat;
44 : SvXMLStylesContext* pStyles;
45 : // std::vector<ScXMLMapContent> aMaps;
46 : com::sun::star::uno::Any aConditionalFormat;
47 : sal_Int32 m_nNumberFormat;
48 : ORptFilter& m_rImport;
49 : bool bConditionalFormatCreated : 1;
50 : bool bParentSet : 1;
51 :
52 0 : ORptFilter& GetOwnImport() const { return m_rImport;}
53 :
54 : OControlStyleContext(const OControlStyleContext&);
55 : void operator =(const OControlStyleContext&);
56 : protected:
57 :
58 : virtual void SetAttribute( sal_uInt16 nPrefixKey,
59 : const OUString& rLocalName,
60 : const OUString& rValue ) SAL_OVERRIDE;
61 :
62 : public:
63 :
64 : TYPEINFO_OVERRIDE();
65 :
66 : OControlStyleContext( ORptFilter& rImport, sal_uInt16 nPrfx,
67 : const OUString& rLName,
68 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
69 : SvXMLStylesContext& rStyles, sal_uInt16 nFamily, bool bDefaultStyle = false );
70 :
71 : virtual ~OControlStyleContext();
72 :
73 :
74 : virtual void FillPropertySet(const ::com::sun::star::uno::Reference<
75 : ::com::sun::star::beans::XPropertySet > & rPropSet ) SAL_OVERRIDE;
76 :
77 : virtual void SetDefaults() SAL_OVERRIDE;
78 :
79 : void AddProperty(sal_Int16 nContextID, const com::sun::star::uno::Any& aValue);
80 :
81 : sal_Int32 GetNumberFormat() { return m_nNumberFormat; }
82 : };
83 :
84 : class OReportStylesContext : public SvXMLStylesContext
85 : {
86 : const OUString m_sTableStyleFamilyName;
87 : const OUString m_sColumnStyleFamilyName;
88 : const OUString m_sRowStyleFamilyName;
89 : const OUString m_sCellStyleFamilyName;
90 : ORptFilter& m_rImport;
91 : sal_Int32 m_nNumberFormatIndex;
92 : bool bAutoStyles : 1;
93 :
94 : //mutable rtl::Reference < SvXMLImportPropertyMapper > m_xControlImpPropMapper;
95 : mutable rtl::Reference < SvXMLImportPropertyMapper > m_xCellImpPropMapper;
96 : mutable rtl::Reference < SvXMLImportPropertyMapper > m_xColumnImpPropMapper;
97 : mutable rtl::Reference < SvXMLImportPropertyMapper > m_xRowImpPropMapper;
98 : mutable rtl::Reference < SvXMLImportPropertyMapper > m_xTableImpPropMapper;
99 :
100 : mutable ::com::sun::star::uno::Reference <
101 : ::com::sun::star::container::XNameContainer > m_xCellStyles;
102 : mutable ::com::sun::star::uno::Reference <
103 : ::com::sun::star::container::XNameContainer > m_xColumnStyles;
104 : mutable ::com::sun::star::uno::Reference <
105 : ::com::sun::star::container::XNameContainer > m_xRowStyles;
106 : mutable ::com::sun::star::uno::Reference <
107 : ::com::sun::star::container::XNameContainer > m_xTableStyles;
108 :
109 0 : ORptFilter& GetOwnImport() const { return m_rImport;}
110 :
111 : OReportStylesContext(const OReportStylesContext&);
112 : void operator =(const OReportStylesContext&);
113 : protected:
114 :
115 : // Create a style context.
116 : virtual SvXMLStyleContext *CreateStyleStyleChildContext(
117 : sal_uInt16 nFamily,
118 : sal_uInt16 nPrefix,
119 : const OUString& rLocalName,
120 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
121 :
122 : virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
123 : sal_uInt16 nFamily, sal_uInt16 nPrefix,
124 : const OUString& rLocalName,
125 : const ::com::sun::star::uno::Reference<
126 : ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
127 :
128 : public:
129 :
130 : TYPEINFO_OVERRIDE();
131 :
132 : OReportStylesContext( ORptFilter& rImport, sal_uInt16 nPrfx ,
133 : const OUString& rLName ,
134 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
135 : const bool bAutoStyles );
136 : virtual ~OReportStylesContext();
137 :
138 : virtual void EndElement() SAL_OVERRIDE;
139 :
140 : virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper(
141 : sal_uInt16 nFamily ) const SAL_OVERRIDE;
142 : virtual ::com::sun::star::uno::Reference <
143 : ::com::sun::star::container::XNameContainer >
144 : GetStylesContainer( sal_uInt16 nFamily ) const SAL_OVERRIDE;
145 : virtual OUString GetServiceName( sal_uInt16 nFamily ) const SAL_OVERRIDE;
146 : virtual sal_uInt16 GetFamily( const OUString& rFamily ) const SAL_OVERRIDE;
147 :
148 : sal_Int32 GetIndex(const sal_Int16 nContextID);
149 : };
150 :
151 : } // rptxml
152 :
153 : #endif // INCLUDED_REPORTDESIGN_SOURCE_FILTER_XML_XMLSTYLEIMPORT_HXX
154 :
155 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|