Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / source / filter / xml / xmldrani.hxx
blobfd70a656ea0b4d2aa75c6142ef23c4246cff19fe
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 #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>
26 #include <dbdata.hxx>
27 #include "importcontext.hxx"
29 #include <memory>
31 namespace sax_fastparser { class FastAttributeList; }
33 struct ScQueryParam;
35 class ScXMLDatabaseRangesContext : public ScXMLImportContext
37 public:
39 ScXMLDatabaseRangesContext( ScXMLImport& rImport );
41 virtual ~ScXMLDatabaseRangesContext() override;
43 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
44 sal_Int32 nElement,
45 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
48 struct ScSubTotalRule
50 sal_Int16 nSubTotalRuleGroupFieldNumber;
51 css::uno::Sequence <css::sheet::SubTotalColumn> aSubTotalColumns;
54 class ScXMLDatabaseRangeContext : public ScXMLImportContext
56 std::unique_ptr<ScQueryParam> mpQueryParam;
57 ScRange maRange;
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;
66 sal_Int32 nRefresh;
67 sal_Int16 nSubTotalsUserListIndex;
68 bool mbValidRange;
69 bool bContainsSort;
70 bool bContainsSubTotal;
71 bool bNative;
72 bool bIsSelection; // TODO: import to document core
73 bool bKeepFormats;
74 bool bMoveCells;
75 bool bStripData;
76 bool bAutoFilter;
77 bool bSubTotalsBindFormatsToContent;
78 bool bSubTotalsIsCaseSensitive;
79 bool bSubTotalsInsertPageBreaks;
80 bool bSubTotalsSortGroups;
81 bool bSubTotalsEnabledUserList;
82 bool bSubTotalsAscending;
83 bool bFilterConditionSourceRange;
84 bool bHasHeader;
85 bool bByRow;
86 ScDBCollection::RangeType meRangeType;
88 std::unique_ptr<ScDBData> ConvertToDBData(const OUString& rName);
90 public:
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;
123 OUString sDBName;
125 public:
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;
142 OUString sDBName;
144 public:
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;
161 OUString sDBName;
163 public:
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
179 public:
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;
192 public:
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
206 public:
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;
220 public:
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;
244 OUString sFunction;
246 public:
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;
257 #endif
259 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */