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 : #ifndef SC_XMLDRANI_HXX
20 : #define SC_XMLDRANI_HXX
21 :
22 : #include <xmloff/xmlictxt.hxx>
23 : #include <xmloff/xmlimp.hxx>
24 : #include <com/sun/star/sheet/DataImportMode.hpp>
25 : #include <com/sun/star/sheet/SubTotalColumn.hpp>
26 : #include <com/sun/star/beans/XPropertySet.hpp>
27 : #include <com/sun/star/beans/PropertyValue.hpp>
28 : #include <com/sun/star/sheet/TableFilterField2.hpp>
29 : #include <com/sun/star/table/CellAddress.hpp>
30 : #include <com/sun/star/table/CellRangeAddress.hpp>
31 : #include <com/sun/star/table/TableOrientation.hpp>
32 :
33 : #include "dbdata.hxx"
34 :
35 : #include <boost/scoped_ptr.hpp>
36 :
37 : class ScDBData;
38 : struct ScQueryParam;
39 : class ScXMLImport;
40 :
41 : class ScXMLDatabaseRangesContext : public SvXMLImportContext
42 : {
43 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
44 10 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
45 :
46 : public:
47 :
48 : ScXMLDatabaseRangesContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
49 : const ::rtl::OUString& rLName,
50 : const ::com::sun::star::uno::Reference<
51 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
52 :
53 : virtual ~ScXMLDatabaseRangesContext();
54 :
55 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
56 : const ::rtl::OUString& rLocalName,
57 : const ::com::sun::star::uno::Reference<
58 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
59 :
60 : virtual void EndElement();
61 : };
62 :
63 0 : struct ScSubTotalRule
64 : {
65 : sal_Int16 nSubTotalRuleGroupFieldNumber;
66 : com::sun::star::uno::Sequence <com::sun::star::sheet::SubTotalColumn> aSubTotalColumns;
67 : };
68 :
69 : class ScXMLDatabaseRangeContext : public SvXMLImportContext
70 : {
71 : boost::scoped_ptr<ScQueryParam> mpQueryParam;
72 : ScRange maRange;
73 : rtl::OUString sDatabaseRangeName;
74 : rtl::OUString sConnectionResource;
75 : rtl::OUString sDatabaseName;
76 : rtl::OUString sSourceObject;
77 : com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue> aSortSequence;
78 : std::vector < ScSubTotalRule > aSubTotalRules;
79 : com::sun::star::table::CellRangeAddress aFilterConditionSourceRangeAddress;
80 : com::sun::star::sheet::DataImportMode nSourceType;
81 : sal_Int32 nRefresh;
82 : sal_Int16 nSubTotalsUserListIndex;
83 : bool mbValidRange;
84 : bool bContainsSort;
85 : bool bContainsSubTotal;
86 : bool bNative;
87 : bool bIsSelection;
88 : bool bKeepFormats;
89 : bool bMoveCells;
90 : bool bStripData;
91 : bool bAutoFilter;
92 : bool bSubTotalsBindFormatsToContent;
93 : bool bSubTotalsIsCaseSensitive;
94 : bool bSubTotalsInsertPageBreaks;
95 : bool bSubTotalsSortGroups;
96 : bool bSubTotalsEnabledUserList;
97 : bool bSubTotalsAscending;
98 : bool bFilterConditionSourceRange;
99 : bool bHasHeader;
100 : bool bByRow;
101 : ScDBCollection::RangeType meRangeType;
102 :
103 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
104 28 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
105 :
106 : ScDBData* ConvertToDBData(const ::rtl::OUString& rName);
107 :
108 : public:
109 :
110 : ScXMLDatabaseRangeContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
111 : const ::rtl::OUString& rLName,
112 : const ::com::sun::star::uno::Reference<
113 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
114 :
115 : virtual ~ScXMLDatabaseRangeContext();
116 :
117 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
118 : const ::rtl::OUString& rLocalName,
119 : const ::com::sun::star::uno::Reference<
120 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
121 :
122 : virtual void EndElement();
123 :
124 0 : void SetDatabaseName(const rtl::OUString sTempDatabaseName) { sDatabaseName = sTempDatabaseName; }
125 0 : void SetConnectionResource(const rtl::OUString sTempConRes) { sConnectionResource = sTempConRes; }
126 0 : void SetSourceObject(const rtl::OUString sTempSourceObject) { sSourceObject = sTempSourceObject; }
127 0 : void SetSourceType(const com::sun::star::sheet::DataImportMode nTempSourceType) { nSourceType = nTempSourceType; }
128 0 : void SetNative(const bool bTempNative) { bNative = bTempNative; }
129 0 : void SetSubTotalsBindFormatsToContent(const bool bTemp ) { bSubTotalsBindFormatsToContent = bTemp; }
130 0 : void SetSubTotalsIsCaseSensitive(const bool bTemp) { bSubTotalsIsCaseSensitive = bTemp; }
131 0 : void SetSubTotalsInsertPageBreaks(const bool bTemp) { bSubTotalsInsertPageBreaks = bTemp; }
132 0 : void SetSubTotalsEnabledUserList(const bool bTemp) { bSubTotalsEnabledUserList = bTemp; }
133 0 : void SetSubTotalsUserListIndex(const sal_Int16 nTemp) { nSubTotalsUserListIndex = nTemp; }
134 0 : void SetSubTotalsAscending(const bool bTemp) { bSubTotalsAscending = bTemp; }
135 0 : void SetSubTotalsSortGroups(const bool bTemp) { bSubTotalsSortGroups = bTemp; }
136 0 : void AddSubTotalRule(const ScSubTotalRule& rRule) { aSubTotalRules.push_back(rRule); }
137 0 : void SetSortSequence(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& aTempSortSequence) { aSortSequence = aTempSortSequence; }
138 0 : void SetFilterConditionSourceRangeAddress(const com::sun::star::table::CellRangeAddress& aTemp) { aFilterConditionSourceRangeAddress = aTemp;
139 0 : bFilterConditionSourceRange = true; }
140 : };
141 :
142 : class ScXMLSourceSQLContext : public SvXMLImportContext
143 : {
144 : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
145 : rtl::OUString sDBName;
146 :
147 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
148 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
149 :
150 : public:
151 :
152 : ScXMLSourceSQLContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
153 : const ::rtl::OUString& rLName,
154 : const ::com::sun::star::uno::Reference<
155 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
156 : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
157 :
158 : virtual ~ScXMLSourceSQLContext();
159 :
160 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
161 : const ::rtl::OUString& rLocalName,
162 : const ::com::sun::star::uno::Reference<
163 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
164 :
165 : virtual void EndElement();
166 : };
167 :
168 : class ScXMLSourceTableContext : public SvXMLImportContext
169 : {
170 : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
171 : rtl::OUString sDBName;
172 :
173 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
174 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
175 :
176 : public:
177 :
178 : ScXMLSourceTableContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
179 : const ::rtl::OUString& rLName,
180 : const ::com::sun::star::uno::Reference<
181 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
182 : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
183 :
184 : virtual ~ScXMLSourceTableContext();
185 :
186 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
187 : const ::rtl::OUString& rLocalName,
188 : const ::com::sun::star::uno::Reference<
189 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
190 :
191 : virtual void EndElement();
192 : };
193 :
194 : class ScXMLSourceQueryContext : public SvXMLImportContext
195 : {
196 : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
197 : rtl::OUString sDBName;
198 :
199 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
200 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
201 :
202 : public:
203 :
204 : ScXMLSourceQueryContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
205 : const ::rtl::OUString& rLName,
206 : const ::com::sun::star::uno::Reference<
207 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
208 : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
209 :
210 : virtual ~ScXMLSourceQueryContext();
211 :
212 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
213 : const ::rtl::OUString& rLocalName,
214 : const ::com::sun::star::uno::Reference<
215 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
216 :
217 : virtual void EndElement();
218 : };
219 :
220 : class ScXMLConResContext : public SvXMLImportContext
221 : {
222 : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
223 :
224 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
225 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
226 :
227 : public:
228 :
229 : ScXMLConResContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
230 : const ::rtl::OUString& rLName,
231 : const ::com::sun::star::uno::Reference<
232 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
233 : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
234 :
235 : virtual ~ScXMLConResContext();
236 :
237 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
238 : const ::rtl::OUString& rLocalName,
239 : const ::com::sun::star::uno::Reference<
240 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
241 :
242 : virtual void EndElement();
243 : };
244 :
245 : class ScXMLSubTotalRulesContext : public SvXMLImportContext
246 : {
247 : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
248 :
249 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
250 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
251 :
252 : public:
253 :
254 : ScXMLSubTotalRulesContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
255 : const ::rtl::OUString& rLName,
256 : const ::com::sun::star::uno::Reference<
257 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
258 : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
259 :
260 : virtual ~ScXMLSubTotalRulesContext();
261 :
262 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
263 : const ::rtl::OUString& rLocalName,
264 : const ::com::sun::star::uno::Reference<
265 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
266 :
267 : virtual void EndElement();
268 : };
269 :
270 : class ScXMLSortGroupsContext : public SvXMLImportContext
271 : {
272 : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
273 :
274 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
275 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
276 :
277 : public:
278 :
279 : ScXMLSortGroupsContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
280 : const ::rtl::OUString& rLName,
281 : const ::com::sun::star::uno::Reference<
282 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
283 : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
284 :
285 : virtual ~ScXMLSortGroupsContext();
286 :
287 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
288 : const ::rtl::OUString& rLocalName,
289 : const ::com::sun::star::uno::Reference<
290 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
291 :
292 : virtual void EndElement();
293 : };
294 :
295 : class ScXMLSubTotalRuleContext : public SvXMLImportContext
296 : {
297 : ScXMLDatabaseRangeContext* pDatabaseRangeContext;
298 : ScSubTotalRule aSubTotalRule;
299 :
300 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
301 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
302 :
303 : public:
304 :
305 : ScXMLSubTotalRuleContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
306 : const ::rtl::OUString& rLName,
307 : const ::com::sun::star::uno::Reference<
308 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
309 : ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
310 :
311 : virtual ~ScXMLSubTotalRuleContext();
312 :
313 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
314 : const ::rtl::OUString& rLocalName,
315 : const ::com::sun::star::uno::Reference<
316 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
317 :
318 : virtual void EndElement();
319 :
320 0 : void AddSubTotalColumn(const com::sun::star::sheet::SubTotalColumn aSubTotalColumn)
321 0 : { aSubTotalRule.aSubTotalColumns.realloc(aSubTotalRule.aSubTotalColumns.getLength() + 1);
322 0 : aSubTotalRule.aSubTotalColumns[aSubTotalRule.aSubTotalColumns.getLength() - 1] = aSubTotalColumn; }
323 : };
324 :
325 : class ScXMLSubTotalFieldContext : public SvXMLImportContext
326 : {
327 : ScXMLSubTotalRuleContext* pSubTotalRuleContext;
328 : rtl::OUString sFieldNumber;
329 : rtl::OUString sFunction;
330 :
331 : const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
332 0 : ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
333 :
334 : public:
335 :
336 : ScXMLSubTotalFieldContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
337 : const ::rtl::OUString& rLName,
338 : const ::com::sun::star::uno::Reference<
339 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
340 : ScXMLSubTotalRuleContext* pSubTotalRuleContext);
341 :
342 : virtual ~ScXMLSubTotalFieldContext();
343 :
344 : virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
345 : const ::rtl::OUString& rLocalName,
346 : const ::com::sun::star::uno::Reference<
347 : ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
348 :
349 : virtual void EndElement();
350 : };
351 :
352 : #endif
353 :
354 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|