Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / source / filter / xml / xmldrani.hxx
bloba35074117c285a42040204bbff5791f04786fb90
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
21 #include <com/sun/star/sheet/DataImportMode.hpp>
22 #include <com/sun/star/sheet/SubTotalColumn.hpp>
23 #include <com/sun/star/beans/PropertyValue.hpp>
25 #include <dbdata.hxx>
26 #include "importcontext.hxx"
28 #include <memory>
30 namespace sax_fastparser { class FastAttributeList; }
32 struct ScQueryParam;
34 class ScXMLDatabaseRangesContext : public ScXMLImportContext
36 public:
38 ScXMLDatabaseRangesContext( ScXMLImport& rImport );
40 virtual ~ScXMLDatabaseRangesContext() override;
42 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
43 sal_Int32 nElement,
44 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
47 struct ScSubTotalRule
49 sal_Int16 nSubTotalRuleGroupFieldNumber;
50 css::uno::Sequence <css::sheet::SubTotalColumn> aSubTotalColumns;
53 class ScXMLDatabaseRangeContext : public ScXMLImportContext
55 std::unique_ptr<ScQueryParam> mpQueryParam;
56 ScRange maRange;
57 OUString sDatabaseRangeName;
58 OUString sConnectionResource;
59 OUString sDatabaseName;
60 OUString sSourceObject;
61 css::uno::Sequence <css::beans::PropertyValue> aSortSequence;
62 std::vector < ScSubTotalRule > aSubTotalRules;
63 ScRange aFilterConditionSourceRangeAddress;
64 css::sheet::DataImportMode nSourceType;
65 sal_Int32 nRefresh;
66 sal_Int16 nSubTotalsUserListIndex;
67 bool mbValidRange;
68 bool bContainsSort;
69 bool bContainsSubTotal;
70 bool bNative;
71 bool bIsSelection; // TODO: import to document core
72 bool bKeepFormats;
73 bool bMoveCells;
74 bool bStripData;
75 bool bAutoFilter;
76 bool bSubTotalsBindFormatsToContent;
77 bool bSubTotalsIsCaseSensitive;
78 bool bSubTotalsInsertPageBreaks;
79 bool bSubTotalsSortGroups;
80 bool bSubTotalsEnabledUserList;
81 bool bSubTotalsAscending;
82 bool bFilterConditionSourceRange;
83 bool bHasHeader;
84 bool bByRow;
85 ScDBCollection::RangeType meRangeType;
87 std::unique_ptr<ScDBData> ConvertToDBData(const OUString& rName);
89 public:
91 ScXMLDatabaseRangeContext( ScXMLImport& rImport,
92 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList );
94 virtual ~ScXMLDatabaseRangeContext() override;
96 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
97 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
99 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
101 void SetDatabaseName(const OUString& sTempDatabaseName) { sDatabaseName = sTempDatabaseName; }
102 void SetConnectionResource(const OUString& sTempConRes) { sConnectionResource = sTempConRes; }
103 void SetSourceObject(const OUString& sTempSourceObject) { sSourceObject = sTempSourceObject; }
104 void SetSourceType(const css::sheet::DataImportMode nTempSourceType) { nSourceType = nTempSourceType; }
105 void SetNative(const bool bTempNative) { bNative = bTempNative; }
106 void SetSubTotalsBindFormatsToContent(const bool bTemp ) { bSubTotalsBindFormatsToContent = bTemp; }
107 void SetSubTotalsIsCaseSensitive(const bool bTemp) { bSubTotalsIsCaseSensitive = bTemp; }
108 void SetSubTotalsInsertPageBreaks(const bool bTemp) { bSubTotalsInsertPageBreaks = bTemp; }
109 void SetSubTotalsEnabledUserList(const bool bTemp) { bSubTotalsEnabledUserList = bTemp; }
110 void SetSubTotalsUserListIndex(const sal_Int16 nTemp) { nSubTotalsUserListIndex = nTemp; }
111 void SetSubTotalsAscending(const bool bTemp) { bSubTotalsAscending = bTemp; }
112 void SetSubTotalsSortGroups(const bool bTemp) { bSubTotalsSortGroups = bTemp; }
113 void AddSubTotalRule(const ScSubTotalRule& rRule) { aSubTotalRules.push_back(rRule); }
114 void SetSortSequence(const css::uno::Sequence <css::beans::PropertyValue>& aTempSortSequence) { aSortSequence = aTempSortSequence; }
115 void SetFilterConditionSourceRangeAddress(const ScRange& aRange) { aFilterConditionSourceRangeAddress = aRange;
116 bFilterConditionSourceRange = true; }
119 class ScXMLSourceSQLContext : public ScXMLImportContext
121 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
122 OUString sDBName;
124 public:
126 ScXMLSourceSQLContext( ScXMLImport& rImport,
127 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
128 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
130 virtual ~ScXMLSourceSQLContext() override;
132 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
133 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
135 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
138 class ScXMLSourceTableContext : public ScXMLImportContext
140 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
141 OUString sDBName;
143 public:
145 ScXMLSourceTableContext( ScXMLImport& rImport,
146 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
147 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
149 virtual ~ScXMLSourceTableContext() override;
151 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
152 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
154 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
157 class ScXMLSourceQueryContext : public ScXMLImportContext
159 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
160 OUString sDBName;
162 public:
164 ScXMLSourceQueryContext( ScXMLImport& rImport,
165 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
166 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
168 virtual ~ScXMLSourceQueryContext() override;
170 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
171 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
173 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
176 class ScXMLConResContext : public ScXMLImportContext
178 public:
180 ScXMLConResContext( ScXMLImport& rImport,
181 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
182 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
184 virtual ~ScXMLConResContext() override;
187 class ScXMLSubTotalRulesContext : public ScXMLImportContext
189 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
191 public:
193 ScXMLSubTotalRulesContext( ScXMLImport& rImport,
194 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
195 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
197 virtual ~ScXMLSubTotalRulesContext() override;
199 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
200 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
203 class ScXMLSortGroupsContext : public ScXMLImportContext
205 public:
207 ScXMLSortGroupsContext( ScXMLImport& rImport,
208 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
209 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
211 virtual ~ScXMLSortGroupsContext() override;
214 class ScXMLSubTotalRuleContext : public ScXMLImportContext
216 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
217 ScSubTotalRule aSubTotalRule;
219 public:
221 ScXMLSubTotalRuleContext( ScXMLImport& rImport,
222 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
223 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
225 virtual ~ScXMLSubTotalRuleContext() override;
227 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
228 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
230 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
232 void AddSubTotalColumn(const css::sheet::SubTotalColumn& rSubTotalColumn)
234 aSubTotalRule.aSubTotalColumns.realloc(aSubTotalRule.aSubTotalColumns.getLength() + 1);
235 aSubTotalRule.aSubTotalColumns.getArray()[aSubTotalRule.aSubTotalColumns.getLength() - 1] = rSubTotalColumn;
239 class ScXMLSubTotalFieldContext : public ScXMLImportContext
241 ScXMLSubTotalRuleContext* pSubTotalRuleContext;
242 OUString sFieldNumber;
243 OUString sFunction;
245 public:
247 ScXMLSubTotalFieldContext( ScXMLImport& rImport,
248 const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList,
249 ScXMLSubTotalRuleContext* pSubTotalRuleContext);
251 virtual ~ScXMLSubTotalFieldContext() override;
253 virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
256 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */