1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef DBA_XMLSTYLEIMPORT_HXX
25 #define DBA_XMLSTYLEIMPORT_HXX
26 
27 #ifndef _RTL_USTRING_HXX_
28 #include <rtl/ustring.hxx>
29 #endif
30 #ifndef _XMLOFF_XMLIMP_HXX
31 #include <xmloff/xmlimp.hxx>
32 #endif
33 #ifndef _XMLOFF_XMLICTXT_HXX
34 #include <xmloff/xmlictxt.hxx>
35 #endif
36 #ifndef _XMLOFF_PROPMAPPINGTYPES_HXX
37 #include <xmloff/maptype.hxx>
38 #endif
39 #ifndef _XMLOFF_PRSTYLEI_HXX_
40 #include <xmloff/prstylei.hxx>
41 #endif
42 #ifndef _XMLOFF_XMLIMPPR_HXX
43 #include <xmloff/xmlimppr.hxx>
44 #endif
45 #ifndef _XMLTEXTMASTERPAGECONTEXT_HXX
46 #include <xmloff/XMLTextMasterPageContext.hxx>
47 #endif
48 #ifndef _XMLTEXTMASTERSTYLESCONTEXT_HXX
49 #include <xmloff/XMLTextMasterStylesContext.hxx>
50 #endif
51 #ifndef _XMLOFF_CONTEXTID_HXX_
52 #include <xmloff/contextid.hxx>
53 #endif
54 #ifndef _XMLOFF_FORMS_CONTROLPROPERTYHDL_HXX_
55 #include <xmloff/controlpropertyhdl.hxx>
56 #endif
57 #include <vector>
58 
59 namespace dbaxml
60 {
61 	class ODBFilter;
62 
63 	class OTableStyleContext : public XMLPropStyleContext
64 	{
65 		::rtl::OUString				m_sDataStyleName;
66 		::rtl::OUString				sPageStyle;
67 		const rtl::OUString			sNumberFormat;
68 		SvXMLStylesContext*			pStyles;
69 		//	std::vector<ScXMLMapContent>	aMaps;
70 		com::sun::star::uno::Any	aConditionalFormat;
71 		sal_Int32					m_nNumberFormat;
72 		sal_Bool					bConditionalFormatCreated : 1;
73 		sal_Bool					bParentSet : 1;
74 
75 		ODBFilter& GetOwnImport();
76 
77 	protected:
78 
79 		virtual void SetAttribute( sal_uInt16 nPrefixKey,
80 								const ::rtl::OUString& rLocalName,
81 								const ::rtl::OUString& rValue );
82 
83 	public:
84 
85 		TYPEINFO();
86 
87 		OTableStyleContext( ODBFilter& rImport, sal_uInt16 nPrfx,
88 				const ::rtl::OUString& rLName,
89 				const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
90 				SvXMLStylesContext& rStyles, sal_uInt16 nFamily, sal_Bool bDefaultStyle = sal_False );
91 
92 		virtual ~OTableStyleContext();
93 
94 
95 		virtual void FillPropertySet(const ::com::sun::star::uno::Reference<
96 					::com::sun::star::beans::XPropertySet > & rPropSet );
97 
98 		virtual void SetDefaults();
99 
100   		void AddProperty(sal_Int16 nContextID, const com::sun::star::uno::Any& aValue);
101 
GetNumberFormat()102 		sal_Int32 GetNumberFormat() { return m_nNumberFormat; }
103 	};
104 
105 	class OTableStylesContext : public SvXMLStylesContext
106 	{
107 		const ::rtl::OUString sTableStyleServiceName;
108         const ::rtl::OUString sColumnStyleServiceName;
109         const ::rtl::OUString sCellStyleServiceName;
110 		sal_Int32 m_nNumberFormatIndex;
111 		sal_Int32 nMasterPageNameIndex;
112 		sal_Bool bAutoStyles : 1;
113 
114 		mutable UniReference < SvXMLImportPropertyMapper > m_xTableImpPropMapper;
115         mutable UniReference < SvXMLImportPropertyMapper > m_xColumnImpPropMapper;
116         mutable UniReference < SvXMLImportPropertyMapper > m_xCellImpPropMapper;
117 
118 		ODBFilter& GetOwnImport();
119 
120 	protected:
121 
122 		// Create a style context.
123 		virtual SvXMLStyleContext *CreateStyleStyleChildContext(
124 				sal_uInt16 nFamily,
125 				sal_uInt16 nPrefix,
126 				const ::rtl::OUString& rLocalName,
127 				const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
128 
129 	public:
130 
131 		TYPEINFO();
132 
133 		OTableStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx ,
134 				const ::rtl::OUString& rLName ,
135 				const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
136 				const sal_Bool bAutoStyles );
137 		virtual ~OTableStylesContext();
138 
139 		virtual void EndElement();
140 
141 		virtual UniReference < SvXMLImportPropertyMapper > GetImportPropertyMapper(
142 							sal_uInt16 nFamily ) const;
143 		virtual ::com::sun::star::uno::Reference <
144 						::com::sun::star::container::XNameContainer >
145 			GetStylesContainer( sal_uInt16 nFamily ) const;
146 		virtual ::rtl::OUString GetServiceName( sal_uInt16 nFamily ) const;
147 
148 		sal_Int32 GetIndex(const sal_Int16 nContextID);
149 	};
150 // -----------------------------------------------------------------------------
151 } // dbaxml
152 // -----------------------------------------------------------------------------
153 #endif // DBA_XMLSTYLEIMPORT_HXX
154