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 <com/sun/star/sheet/DataImportMode.hpp>
23 #include <com/sun/star/sheet/SubTotalColumn.hpp>
24 #include <com/sun/star/beans/PropertyValue.hpp>
27 #include "importcontext.hxx"
31 namespace sax_fastparser
{ class FastAttributeList
; }
35 class ScXMLDatabaseRangesContext
: public ScXMLImportContext
39 ScXMLDatabaseRangesContext( ScXMLImport
& rImport
);
41 virtual ~ScXMLDatabaseRangesContext() override
;
43 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
45 const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
50 sal_Int16 nSubTotalRuleGroupFieldNumber
;
51 css::uno::Sequence
<css::sheet::SubTotalColumn
> aSubTotalColumns
;
54 class ScXMLDatabaseRangeContext
: public ScXMLImportContext
56 std::unique_ptr
<ScQueryParam
> mpQueryParam
;
58 OUString sDatabaseRangeName
;
59 OUString sConnectionResource
;
60 OUString sDatabaseName
;
61 OUString sSourceObject
;
62 css::uno::Sequence
<css::beans::PropertyValue
> aSortSequence
;
63 std::vector
< ScSubTotalRule
> aSubTotalRules
;
64 ScRange aFilterConditionSourceRangeAddress
;
65 css::sheet::DataImportMode nSourceType
;
67 sal_Int16 nSubTotalsUserListIndex
;
70 bool bContainsSubTotal
;
72 bool bIsSelection
; // TODO: import to document core
77 bool bSubTotalsBindFormatsToContent
;
78 bool bSubTotalsIsCaseSensitive
;
79 bool bSubTotalsInsertPageBreaks
;
80 bool bSubTotalsSortGroups
;
81 bool bSubTotalsEnabledUserList
;
82 bool bSubTotalsAscending
;
83 bool bFilterConditionSourceRange
;
86 ScDBCollection::RangeType meRangeType
;
88 std::unique_ptr
<ScDBData
> ConvertToDBData(const OUString
& rName
);
92 ScXMLDatabaseRangeContext( ScXMLImport
& rImport
,
93 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
);
95 virtual ~ScXMLDatabaseRangeContext() override
;
97 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
98 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
100 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
102 void SetDatabaseName(const OUString
& sTempDatabaseName
) { sDatabaseName
= sTempDatabaseName
; }
103 void SetConnectionResource(const OUString
& sTempConRes
) { sConnectionResource
= sTempConRes
; }
104 void SetSourceObject(const OUString
& sTempSourceObject
) { sSourceObject
= sTempSourceObject
; }
105 void SetSourceType(const css::sheet::DataImportMode nTempSourceType
) { nSourceType
= nTempSourceType
; }
106 void SetNative(const bool bTempNative
) { bNative
= bTempNative
; }
107 void SetSubTotalsBindFormatsToContent(const bool bTemp
) { bSubTotalsBindFormatsToContent
= bTemp
; }
108 void SetSubTotalsIsCaseSensitive(const bool bTemp
) { bSubTotalsIsCaseSensitive
= bTemp
; }
109 void SetSubTotalsInsertPageBreaks(const bool bTemp
) { bSubTotalsInsertPageBreaks
= bTemp
; }
110 void SetSubTotalsEnabledUserList(const bool bTemp
) { bSubTotalsEnabledUserList
= bTemp
; }
111 void SetSubTotalsUserListIndex(const sal_Int16 nTemp
) { nSubTotalsUserListIndex
= nTemp
; }
112 void SetSubTotalsAscending(const bool bTemp
) { bSubTotalsAscending
= bTemp
; }
113 void SetSubTotalsSortGroups(const bool bTemp
) { bSubTotalsSortGroups
= bTemp
; }
114 void AddSubTotalRule(const ScSubTotalRule
& rRule
) { aSubTotalRules
.push_back(rRule
); }
115 void SetSortSequence(const css::uno::Sequence
<css::beans::PropertyValue
>& aTempSortSequence
) { aSortSequence
= aTempSortSequence
; }
116 void SetFilterConditionSourceRangeAddress(const ScRange
& aRange
) { aFilterConditionSourceRangeAddress
= aRange
;
117 bFilterConditionSourceRange
= true; }
120 class ScXMLSourceSQLContext
: public ScXMLImportContext
122 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
127 ScXMLSourceSQLContext( ScXMLImport
& rImport
,
128 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
129 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
131 virtual ~ScXMLSourceSQLContext() override
;
133 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
134 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
136 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
139 class ScXMLSourceTableContext
: public ScXMLImportContext
141 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
146 ScXMLSourceTableContext( ScXMLImport
& rImport
,
147 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
148 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
150 virtual ~ScXMLSourceTableContext() override
;
152 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
153 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
155 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
158 class ScXMLSourceQueryContext
: public ScXMLImportContext
160 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
165 ScXMLSourceQueryContext( ScXMLImport
& rImport
,
166 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
167 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
169 virtual ~ScXMLSourceQueryContext() override
;
171 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
172 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
174 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
177 class ScXMLConResContext
: public ScXMLImportContext
181 ScXMLConResContext( ScXMLImport
& rImport
,
182 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
183 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
185 virtual ~ScXMLConResContext() override
;
188 class ScXMLSubTotalRulesContext
: public ScXMLImportContext
190 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
194 ScXMLSubTotalRulesContext( ScXMLImport
& rImport
,
195 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
196 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
198 virtual ~ScXMLSubTotalRulesContext() override
;
200 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
201 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
204 class ScXMLSortGroupsContext
: public ScXMLImportContext
208 ScXMLSortGroupsContext( ScXMLImport
& rImport
,
209 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
210 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
212 virtual ~ScXMLSortGroupsContext() override
;
215 class ScXMLSubTotalRuleContext
: public ScXMLImportContext
217 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
218 ScSubTotalRule aSubTotalRule
;
222 ScXMLSubTotalRuleContext( ScXMLImport
& rImport
,
223 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
224 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
226 virtual ~ScXMLSubTotalRuleContext() override
;
228 virtual css::uno::Reference
< css::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext(
229 sal_Int32 nElement
, const css::uno::Reference
< css::xml::sax::XFastAttributeList
>& xAttrList
) override
;
231 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
233 void AddSubTotalColumn(const css::sheet::SubTotalColumn
& rSubTotalColumn
)
235 aSubTotalRule
.aSubTotalColumns
.realloc(aSubTotalRule
.aSubTotalColumns
.getLength() + 1);
236 aSubTotalRule
.aSubTotalColumns
[aSubTotalRule
.aSubTotalColumns
.getLength() - 1] = rSubTotalColumn
;
240 class ScXMLSubTotalFieldContext
: public ScXMLImportContext
242 ScXMLSubTotalRuleContext
* pSubTotalRuleContext
;
243 OUString sFieldNumber
;
248 ScXMLSubTotalFieldContext( ScXMLImport
& rImport
,
249 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
250 ScXMLSubTotalRuleContext
* pSubTotalRuleContext
);
252 virtual ~ScXMLSubTotalFieldContext() override
;
254 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
259 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */