1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SC_SOURCE_FILTER_XML_XMLDRANI_HXX
20 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLDRANI_HXX
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>
34 #include "xmlimprt.hxx"
36 #include <boost/scoped_ptr.hpp>
41 class ScXMLDatabaseRangesContext
: public SvXMLImportContext
43 const ScXMLImport
& GetScImport() const { return static_cast<const ScXMLImport
&>(GetImport()); }
44 ScXMLImport
& GetScImport() { return static_cast<ScXMLImport
&>(GetImport()); }
48 ScXMLDatabaseRangesContext( ScXMLImport
& rImport
, sal_uInt16 nPrfx
,
49 const OUString
& rLName
,
50 const ::com::sun::star::uno::Reference
<
51 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
53 virtual ~ScXMLDatabaseRangesContext();
55 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
56 const OUString
& rLocalName
,
57 const ::com::sun::star::uno::Reference
<
58 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
60 virtual void EndElement() SAL_OVERRIDE
;
65 sal_Int16 nSubTotalRuleGroupFieldNumber
;
66 com::sun::star::uno::Sequence
<com::sun::star::sheet::SubTotalColumn
> aSubTotalColumns
;
69 class ScXMLDatabaseRangeContext
: public SvXMLImportContext
71 boost::scoped_ptr
<ScQueryParam
> mpQueryParam
;
73 OUString sDatabaseRangeName
;
74 OUString sConnectionResource
;
75 OUString sDatabaseName
;
76 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
;
82 sal_Int16 nSubTotalsUserListIndex
;
85 bool bContainsSubTotal
;
92 bool bSubTotalsBindFormatsToContent
;
93 bool bSubTotalsIsCaseSensitive
;
94 bool bSubTotalsInsertPageBreaks
;
95 bool bSubTotalsSortGroups
;
96 bool bSubTotalsEnabledUserList
;
97 bool bSubTotalsAscending
;
98 bool bFilterConditionSourceRange
;
101 ScDBCollection::RangeType meRangeType
;
103 const ScXMLImport
& GetScImport() const { return static_cast<const ScXMLImport
&>(GetImport()); }
104 ScXMLImport
& GetScImport() { return static_cast<ScXMLImport
&>(GetImport()); }
106 ScDBData
* ConvertToDBData(const OUString
& rName
);
110 ScXMLDatabaseRangeContext( ScXMLImport
& rImport
, sal_uInt16 nPrfx
,
111 const OUString
& rLName
,
112 const ::com::sun::star::uno::Reference
<
113 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
115 virtual ~ScXMLDatabaseRangeContext();
117 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
118 const OUString
& rLocalName
,
119 const ::com::sun::star::uno::Reference
<
120 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
122 virtual void EndElement() SAL_OVERRIDE
;
124 void SetDatabaseName(const OUString
& sTempDatabaseName
) { sDatabaseName
= sTempDatabaseName
; }
125 void SetConnectionResource(const OUString
& sTempConRes
) { sConnectionResource
= sTempConRes
; }
126 void SetSourceObject(const OUString
& sTempSourceObject
) { sSourceObject
= sTempSourceObject
; }
127 void SetSourceType(const com::sun::star::sheet::DataImportMode nTempSourceType
) { nSourceType
= nTempSourceType
; }
128 void SetNative(const bool bTempNative
) { bNative
= bTempNative
; }
129 void SetSubTotalsBindFormatsToContent(const bool bTemp
) { bSubTotalsBindFormatsToContent
= bTemp
; }
130 void SetSubTotalsIsCaseSensitive(const bool bTemp
) { bSubTotalsIsCaseSensitive
= bTemp
; }
131 void SetSubTotalsInsertPageBreaks(const bool bTemp
) { bSubTotalsInsertPageBreaks
= bTemp
; }
132 void SetSubTotalsEnabledUserList(const bool bTemp
) { bSubTotalsEnabledUserList
= bTemp
; }
133 void SetSubTotalsUserListIndex(const sal_Int16 nTemp
) { nSubTotalsUserListIndex
= nTemp
; }
134 void SetSubTotalsAscending(const bool bTemp
) { bSubTotalsAscending
= bTemp
; }
135 void SetSubTotalsSortGroups(const bool bTemp
) { bSubTotalsSortGroups
= bTemp
; }
136 void AddSubTotalRule(const ScSubTotalRule
& rRule
) { aSubTotalRules
.push_back(rRule
); }
137 void SetSortSequence(const com::sun::star::uno::Sequence
<com::sun::star::beans::PropertyValue
>& aTempSortSequence
) { aSortSequence
= aTempSortSequence
; }
138 void SetFilterConditionSourceRangeAddress(const com::sun::star::table::CellRangeAddress
& aTemp
) { aFilterConditionSourceRangeAddress
= aTemp
;
139 bFilterConditionSourceRange
= true; }
142 class ScXMLSourceSQLContext
: public SvXMLImportContext
144 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
147 const ScXMLImport
& GetScImport() const { return static_cast<const ScXMLImport
&>(GetImport()); }
148 ScXMLImport
& GetScImport() { return static_cast<ScXMLImport
&>(GetImport()); }
152 ScXMLSourceSQLContext( ScXMLImport
& rImport
, sal_uInt16 nPrfx
,
153 const OUString
& rLName
,
154 const ::com::sun::star::uno::Reference
<
155 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
156 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
158 virtual ~ScXMLSourceSQLContext();
160 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
161 const OUString
& rLocalName
,
162 const ::com::sun::star::uno::Reference
<
163 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
165 virtual void EndElement() SAL_OVERRIDE
;
168 class ScXMLSourceTableContext
: public SvXMLImportContext
170 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
173 const ScXMLImport
& GetScImport() const { return static_cast<const ScXMLImport
&>(GetImport()); }
174 ScXMLImport
& GetScImport() { return static_cast<ScXMLImport
&>(GetImport()); }
178 ScXMLSourceTableContext( ScXMLImport
& rImport
, sal_uInt16 nPrfx
,
179 const OUString
& rLName
,
180 const ::com::sun::star::uno::Reference
<
181 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
182 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
184 virtual ~ScXMLSourceTableContext();
186 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
187 const OUString
& rLocalName
,
188 const ::com::sun::star::uno::Reference
<
189 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
191 virtual void EndElement() SAL_OVERRIDE
;
194 class ScXMLSourceQueryContext
: public SvXMLImportContext
196 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
199 const ScXMLImport
& GetScImport() const { return static_cast<const ScXMLImport
&>(GetImport()); }
200 ScXMLImport
& GetScImport() { return static_cast<ScXMLImport
&>(GetImport()); }
204 ScXMLSourceQueryContext( ScXMLImport
& rImport
, sal_uInt16 nPrfx
,
205 const OUString
& rLName
,
206 const ::com::sun::star::uno::Reference
<
207 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
208 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
210 virtual ~ScXMLSourceQueryContext();
212 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
213 const OUString
& rLocalName
,
214 const ::com::sun::star::uno::Reference
<
215 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
217 virtual void EndElement() SAL_OVERRIDE
;
220 class ScXMLConResContext
: public SvXMLImportContext
222 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
224 const ScXMLImport
& GetScImport() const { return static_cast<const ScXMLImport
&>(GetImport()); }
225 ScXMLImport
& GetScImport() { return static_cast<ScXMLImport
&>(GetImport()); }
229 ScXMLConResContext( ScXMLImport
& rImport
, sal_uInt16 nPrfx
,
230 const OUString
& rLName
,
231 const ::com::sun::star::uno::Reference
<
232 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
233 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
235 virtual ~ScXMLConResContext();
237 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
238 const OUString
& rLocalName
,
239 const ::com::sun::star::uno::Reference
<
240 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
242 virtual void EndElement() SAL_OVERRIDE
;
245 class ScXMLSubTotalRulesContext
: public SvXMLImportContext
247 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
249 const ScXMLImport
& GetScImport() const { return static_cast<const ScXMLImport
&>(GetImport()); }
250 ScXMLImport
& GetScImport() { return static_cast<ScXMLImport
&>(GetImport()); }
254 ScXMLSubTotalRulesContext( ScXMLImport
& rImport
, sal_uInt16 nPrfx
,
255 const OUString
& rLName
,
256 const ::com::sun::star::uno::Reference
<
257 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
258 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
260 virtual ~ScXMLSubTotalRulesContext();
262 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
263 const OUString
& rLocalName
,
264 const ::com::sun::star::uno::Reference
<
265 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
267 virtual void EndElement() SAL_OVERRIDE
;
270 class ScXMLSortGroupsContext
: public SvXMLImportContext
272 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
274 const ScXMLImport
& GetScImport() const { return static_cast<const ScXMLImport
&>(GetImport()); }
275 ScXMLImport
& GetScImport() { return static_cast<ScXMLImport
&>(GetImport()); }
279 ScXMLSortGroupsContext( ScXMLImport
& rImport
, sal_uInt16 nPrfx
,
280 const OUString
& rLName
,
281 const ::com::sun::star::uno::Reference
<
282 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
283 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
285 virtual ~ScXMLSortGroupsContext();
287 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
288 const OUString
& rLocalName
,
289 const ::com::sun::star::uno::Reference
<
290 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
292 virtual void EndElement() SAL_OVERRIDE
;
295 class ScXMLSubTotalRuleContext
: public SvXMLImportContext
297 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
298 ScSubTotalRule aSubTotalRule
;
300 const ScXMLImport
& GetScImport() const { return static_cast<const ScXMLImport
&>(GetImport()); }
301 ScXMLImport
& GetScImport() { return static_cast<ScXMLImport
&>(GetImport()); }
305 ScXMLSubTotalRuleContext( ScXMLImport
& rImport
, sal_uInt16 nPrfx
,
306 const OUString
& rLName
,
307 const ::com::sun::star::uno::Reference
<
308 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
309 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
311 virtual ~ScXMLSubTotalRuleContext();
313 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
314 const OUString
& rLocalName
,
315 const ::com::sun::star::uno::Reference
<
316 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
318 virtual void EndElement() SAL_OVERRIDE
;
320 void AddSubTotalColumn(const com::sun::star::sheet::SubTotalColumn
& rSubTotalColumn
)
321 { aSubTotalRule
.aSubTotalColumns
.realloc(aSubTotalRule
.aSubTotalColumns
.getLength() + 1);
322 aSubTotalRule
.aSubTotalColumns
[aSubTotalRule
.aSubTotalColumns
.getLength() - 1] = rSubTotalColumn
; }
325 class ScXMLSubTotalFieldContext
: public SvXMLImportContext
327 ScXMLSubTotalRuleContext
* pSubTotalRuleContext
;
328 OUString sFieldNumber
;
331 const ScXMLImport
& GetScImport() const { return static_cast<const ScXMLImport
&>(GetImport()); }
332 ScXMLImport
& GetScImport() { return static_cast<ScXMLImport
&>(GetImport()); }
336 ScXMLSubTotalFieldContext( ScXMLImport
& rImport
, sal_uInt16 nPrfx
,
337 const OUString
& rLName
,
338 const ::com::sun::star::uno::Reference
<
339 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
340 ScXMLSubTotalRuleContext
* pSubTotalRuleContext
);
342 virtual ~ScXMLSubTotalFieldContext();
344 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
345 const OUString
& rLocalName
,
346 const ::com::sun::star::uno::Reference
<
347 ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
349 virtual void EndElement() SAL_OVERRIDE
;
354 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */