Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef SC_XMLDRANI_HXX
29 : : #define SC_XMLDRANI_HXX
30 : :
31 : : #include <xmloff/xmlictxt.hxx>
32 : : #include <xmloff/xmlimp.hxx>
33 : : #include <com/sun/star/sheet/DataImportMode.hpp>
34 : : #include <com/sun/star/sheet/SubTotalColumn.hpp>
35 : : #include <com/sun/star/beans/XPropertySet.hpp>
36 : : #include <com/sun/star/beans/PropertyValue.hpp>
37 : : #include <com/sun/star/sheet/TableFilterField2.hpp>
38 : : #include <com/sun/star/table/CellAddress.hpp>
39 : : #include <com/sun/star/table/CellRangeAddress.hpp>
40 : : #include <com/sun/star/table/TableOrientation.hpp>
41 : :
42 : : #include "dbdata.hxx"
43 : :
44 : : #include <boost/scoped_ptr.hpp>
45 : :
46 : : class ScDBData;
47 : : struct ScQueryParam;
48 : : class ScXMLImport;
49 : :
50 : : class ScXMLDatabaseRangesContext : public SvXMLImportContext
51 : : {
52 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
53 : 60 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
54 : :
55 : : public:
56 : :
57 : : ScXMLDatabaseRangesContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
58 : : const ::rtl::OUString& rLName,
59 : : const ::com::sun::star::uno::Reference<
60 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
61 : :
62 : : virtual ~ScXMLDatabaseRangesContext();
63 : :
64 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
65 : : const ::rtl::OUString& rLocalName,
66 : : const ::com::sun::star::uno::Reference<
67 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
68 : :
69 : : virtual void EndElement();
70 : : };
71 : :
72 : 0 : struct ScSubTotalRule
73 : : {
74 : : sal_Int16 nSubTotalRuleGroupFieldNumber;
75 : : com::sun::star::uno::Sequence <com::sun::star::sheet::SubTotalColumn> aSubTotalColumns;
76 : : };
77 : :
78 : : class ScXMLDatabaseRangeContext : public SvXMLImportContext
79 : : {
80 : : boost::scoped_ptr<ScQueryParam> mpQueryParam;
81 : : ScRange maRange;
82 : : rtl::OUString sDatabaseRangeName;
83 : : rtl::OUString sConnectionResource;
84 : : rtl::OUString sDatabaseName;
85 : : rtl::OUString sSourceObject;
86 : : com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue> aSortSequence;
87 : : std::vector < ScSubTotalRule > aSubTotalRules;
88 : : com::sun::star::table::CellRangeAddress aFilterConditionSourceRangeAddress;
89 : : com::sun::star::sheet::DataImportMode nSourceType;
90 : : sal_Int32 nRefresh;
91 : : sal_Int16 nSubTotalsUserListIndex;
92 : : sal_Int16 nSubTotalRuleGroupFieldNumber;
93 : : bool mbValidRange;
94 : : bool bContainsSort;
95 : : bool bContainsSubTotal;
96 : : bool bNative;
97 : : bool bIsSelection;
98 : : bool bKeepFormats;
99 : : bool bMoveCells;
100 : : bool bStripData;
101 : : bool bAutoFilter;
102 : : bool bSubTotalsBindFormatsToContent;
103 : : bool bSubTotalsIsCaseSensitive;
104 : : bool bSubTotalsInsertPageBreaks;
105 : : bool bSubTotalsSortGroups;
106 : : bool bSubTotalsEnabledUserList;
107 : : bool bSubTotalsAscending;
108 : : bool bFilterConditionSourceRange;
109 : : bool bHasHeader;
110 : : bool bByRow;
111 : : ScDBCollection::RangeType meRangeType;
112 : :
113 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
114 : 186 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
115 : :
116 : : ScDBData* ConvertToDBData(const ::rtl::OUString& rName);
117 : :
118 : : public:
119 : :
120 : : ScXMLDatabaseRangeContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
121 : : const ::rtl::OUString& rLName,
122 : : const ::com::sun::star::uno::Reference<
123 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
124 : :
125 : : virtual ~ScXMLDatabaseRangeContext();
126 : :
127 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
128 : : const ::rtl::OUString& rLocalName,
129 : : const ::com::sun::star::uno::Reference<
130 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
131 : :
132 : : virtual void EndElement();
133 : :
134 : 0 : void SetDatabaseName(const rtl::OUString sTempDatabaseName) { sDatabaseName = sTempDatabaseName; }
135 : 0 : void SetConnectionResource(const rtl::OUString sTempConRes) { sConnectionResource = sTempConRes; }
136 : 0 : void SetSourceObject(const rtl::OUString sTempSourceObject) { sSourceObject = sTempSourceObject; }
137 : 0 : void SetSourceType(const com::sun::star::sheet::DataImportMode nTempSourceType) { nSourceType = nTempSourceType; }
138 : 0 : void SetNative(const bool bTempNative) { bNative = bTempNative; }
139 : 0 : void SetSubTotalsBindFormatsToContent(const bool bTemp ) { bSubTotalsBindFormatsToContent = bTemp; }
140 : 0 : void SetSubTotalsIsCaseSensitive(const bool bTemp) { bSubTotalsIsCaseSensitive = bTemp; }
141 : 0 : void SetSubTotalsInsertPageBreaks(const bool bTemp) { bSubTotalsInsertPageBreaks = bTemp; }
142 : 0 : void SetSubTotalsEnabledUserList(const bool bTemp) { bSubTotalsEnabledUserList = bTemp; }
143 : 0 : void SetSubTotalsUserListIndex(const sal_Int16 nTemp) { nSubTotalsUserListIndex = nTemp; }
144 : 0 : void SetSubTotalsAscending(const bool bTemp) { bSubTotalsAscending = bTemp; }
145 : 0 : void SetSubTotalsSortGroups(const bool bTemp) { bSubTotalsSortGroups = bTemp; }
146 : 0 : void AddSubTotalRule(const ScSubTotalRule& rRule) { aSubTotalRules.push_back(rRule); }
147 : 0 : void SetSortSequence(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& aTempSortSequence) { aSortSequence = aTempSortSequence; }
148 : 0 : void SetFilterConditionSourceRangeAddress(const com::sun::star::table::CellRangeAddress& aTemp) { aFilterConditionSourceRangeAddress = aTemp;
149 : 0 : bFilterConditionSourceRange = true; }
150 : : };
151 : :
152 : : class ScXMLSourceSQLContext : public SvXMLImportContext
153 : : {
154 : : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
155 : : rtl::OUString sDBName;
156 : :
157 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
158 : 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
159 : :
160 : : public:
161 : :
162 : : ScXMLSourceSQLContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
163 : : const ::rtl::OUString& rLName,
164 : : const ::com::sun::star::uno::Reference<
165 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
166 : : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
167 : :
168 : : virtual ~ScXMLSourceSQLContext();
169 : :
170 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
171 : : const ::rtl::OUString& rLocalName,
172 : : const ::com::sun::star::uno::Reference<
173 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
174 : :
175 : : virtual void EndElement();
176 : : };
177 : :
178 : : class ScXMLSourceTableContext : public SvXMLImportContext
179 : : {
180 : : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
181 : : rtl::OUString sDBName;
182 : :
183 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
184 : 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
185 : :
186 : : public:
187 : :
188 : : ScXMLSourceTableContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
189 : : const ::rtl::OUString& rLName,
190 : : const ::com::sun::star::uno::Reference<
191 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
192 : : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
193 : :
194 : : virtual ~ScXMLSourceTableContext();
195 : :
196 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
197 : : const ::rtl::OUString& rLocalName,
198 : : const ::com::sun::star::uno::Reference<
199 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
200 : :
201 : : virtual void EndElement();
202 : : };
203 : :
204 : : class ScXMLSourceQueryContext : public SvXMLImportContext
205 : : {
206 : : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
207 : : rtl::OUString sDBName;
208 : :
209 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
210 : 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
211 : :
212 : : public:
213 : :
214 : : ScXMLSourceQueryContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
215 : : const ::rtl::OUString& rLName,
216 : : const ::com::sun::star::uno::Reference<
217 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
218 : : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
219 : :
220 : : virtual ~ScXMLSourceQueryContext();
221 : :
222 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
223 : : const ::rtl::OUString& rLocalName,
224 : : const ::com::sun::star::uno::Reference<
225 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
226 : :
227 : : virtual void EndElement();
228 : : };
229 : :
230 : : class ScXMLConResContext : public SvXMLImportContext
231 : : {
232 : : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
233 : :
234 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
235 : 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
236 : :
237 : : public:
238 : :
239 : : ScXMLConResContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
240 : : const ::rtl::OUString& rLName,
241 : : const ::com::sun::star::uno::Reference<
242 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
243 : : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
244 : :
245 : : virtual ~ScXMLConResContext();
246 : :
247 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
248 : : const ::rtl::OUString& rLocalName,
249 : : const ::com::sun::star::uno::Reference<
250 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
251 : :
252 : : virtual void EndElement();
253 : : };
254 : :
255 : : class ScXMLSubTotalRulesContext : public SvXMLImportContext
256 : : {
257 : : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
258 : :
259 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
260 : 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
261 : :
262 : : public:
263 : :
264 : : ScXMLSubTotalRulesContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
265 : : const ::rtl::OUString& rLName,
266 : : const ::com::sun::star::uno::Reference<
267 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
268 : : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
269 : :
270 : : virtual ~ScXMLSubTotalRulesContext();
271 : :
272 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
273 : : const ::rtl::OUString& rLocalName,
274 : : const ::com::sun::star::uno::Reference<
275 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
276 : :
277 : : virtual void EndElement();
278 : : };
279 : :
280 : : class ScXMLSortGroupsContext : public SvXMLImportContext
281 : : {
282 : : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
283 : :
284 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
285 : 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
286 : :
287 : : public:
288 : :
289 : : ScXMLSortGroupsContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
290 : : const ::rtl::OUString& rLName,
291 : : const ::com::sun::star::uno::Reference<
292 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
293 : : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
294 : :
295 : : virtual ~ScXMLSortGroupsContext();
296 : :
297 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
298 : : const ::rtl::OUString& rLocalName,
299 : : const ::com::sun::star::uno::Reference<
300 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
301 : :
302 : : virtual void EndElement();
303 : : };
304 : :
305 : : class ScXMLSubTotalRuleContext : public SvXMLImportContext
306 : : {
307 : : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
308 : : ScSubTotalRule aSubTotalRule;
309 : :
310 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
311 : 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
312 : :
313 : : public:
314 : :
315 : : ScXMLSubTotalRuleContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
316 : : const ::rtl::OUString& rLName,
317 : : const ::com::sun::star::uno::Reference<
318 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
319 : : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
320 : :
321 : : virtual ~ScXMLSubTotalRuleContext();
322 : :
323 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
324 : : const ::rtl::OUString& rLocalName,
325 : : const ::com::sun::star::uno::Reference<
326 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
327 : :
328 : : virtual void EndElement();
329 : :
330 : 0 : void AddSubTotalColumn(const com::sun::star::sheet::SubTotalColumn aSubTotalColumn)
331 : 0 : { aSubTotalRule.aSubTotalColumns.realloc(aSubTotalRule.aSubTotalColumns.getLength() + 1);
332 : 0 : aSubTotalRule.aSubTotalColumns[aSubTotalRule.aSubTotalColumns.getLength() - 1] = aSubTotalColumn; }
333 : : };
334 : :
335 : : class ScXMLSubTotalFieldContext : public SvXMLImportContext
336 : : {
337 : : ScXMLSubTotalRuleContext* pSubTotalRuleContext;
338 : : rtl::OUString sFieldNumber;
339 : : rtl::OUString sFunction;
340 : :
341 : : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
342 : 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
343 : :
344 : : public:
345 : :
346 : : ScXMLSubTotalFieldContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
347 : : const ::rtl::OUString& rLName,
348 : : const ::com::sun::star::uno::Reference<
349 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
350 : : ScXMLSubTotalRuleContext* pSubTotalRuleContext);
351 : :
352 : : virtual ~ScXMLSubTotalFieldContext();
353 : :
354 : : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
355 : : const ::rtl::OUString& rLocalName,
356 : : const ::com::sun::star::uno::Reference<
357 : : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
358 : :
359 : : virtual void EndElement();
360 : : };
361 : :
362 : : #endif
363 : :
364 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|