LibreOffice Module sc (master)  1
xmldrani.hxx
Go to the documentation of this file.
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 #pragma once
20 
21 #include <com/sun/star/sheet/DataImportMode.hpp>
22 #include <com/sun/star/sheet/SubTotalColumn.hpp>
23 #include <com/sun/star/beans/PropertyValue.hpp>
24 
25 #include <dbdata.hxx>
26 #include "importcontext.hxx"
27 
28 #include <memory>
29 
30 namespace sax_fastparser { class FastAttributeList; }
31 
32 struct ScQueryParam;
33 
35 {
36 public:
37 
39 
40  virtual ~ScXMLDatabaseRangesContext() override;
41 
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;
45 };
46 
48 {
50  css::uno::Sequence <css::sheet::SubTotalColumn> aSubTotalColumns;
51 };
52 
54 {
55  std::unique_ptr<ScQueryParam> mpQueryParam;
59  OUString sDatabaseName;
60  OUString sSourceObject;
61  css::uno::Sequence <css::beans::PropertyValue> aSortSequence;
62  std::vector < ScSubTotalRule > aSubTotalRules;
64  css::sheet::DataImportMode nSourceType;
65  sal_Int32 nRefresh;
70  bool bNative;
71  bool bIsSelection; // TODO: import to document core
73  bool bMoveCells;
74  bool bStripData;
83  bool bHasHeader;
84  bool bByRow;
86 
87  std::unique_ptr<ScDBData> ConvertToDBData(const OUString& rName);
88 
89 public:
90 
93 
94  virtual ~ScXMLDatabaseRangeContext() override;
95 
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;
98 
99  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
100 
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; }
117 };
118 
120 {
122  OUString sDBName;
123 
124 public:
125 
128  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
129 
130  virtual ~ScXMLSourceSQLContext() override;
131 
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;
134 
135  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
136 };
137 
139 {
141  OUString sDBName;
142 
143 public:
144 
147  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
148 
149  virtual ~ScXMLSourceTableContext() override;
150 
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;
153 
154  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
155 };
156 
158 {
160  OUString sDBName;
161 
162 public:
163 
166  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
167 
168  virtual ~ScXMLSourceQueryContext() override;
169 
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;
172 
173  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
174 };
175 
177 {
178 public:
179 
182  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
183 
184  virtual ~ScXMLConResContext() override;
185 };
186 
188 {
190 
191 public:
192 
195  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
196 
197  virtual ~ScXMLSubTotalRulesContext() override;
198 
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;
201 };
202 
204 {
205 public:
206 
209  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
210 
211  virtual ~ScXMLSortGroupsContext() override;
212 };
213 
215 {
218 
219 public:
220 
223  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
224 
225  virtual ~ScXMLSubTotalRuleContext() override;
226 
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;
229 
230  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
231 
232  void AddSubTotalColumn(const css::sheet::SubTotalColumn& rSubTotalColumn)
233  {
234  aSubTotalRule.aSubTotalColumns.realloc(aSubTotalRule.aSubTotalColumns.getLength() + 1);
235  aSubTotalRule.aSubTotalColumns[aSubTotalRule.aSubTotalColumns.getLength() - 1] = rSubTotalColumn;
236  }
237 };
238 
240 {
242  OUString sFieldNumber;
243  OUString sFunction;
244 
245 public:
246 
249  ScXMLSubTotalRuleContext* pSubTotalRuleContext);
250 
251  virtual ~ScXMLSubTotalFieldContext() override;
252 
253  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
254 };
255 
256 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetSubTotalsAscending(const bool bTemp)
Definition: xmldrani.hxx:111
ScXMLSubTotalRuleContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:727
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:121
virtual ~ScXMLDatabaseRangeContext() override
Definition: xmldrani.cxx:190
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldrani.cxx:524
std::unique_ptr< ScDBData > ConvertToDBData(const OUString &rName)
Definition: xmldrani.cxx:241
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:216
ScXMLSourceQueryContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:545
void AddSubTotalColumn(const css::sheet::SubTotalColumn &rSubTotalColumn)
Definition: xmldrani.hxx:232
virtual ~ScXMLSourceSQLContext() override
Definition: xmldrani.cxx:470
std::unique_ptr< ScQueryParam > mpQueryParam
Definition: xmldrani.hxx:55
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:803
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:770
void SetSubTotalsBindFormatsToContent(const bool bTemp)
Definition: xmldrani.hxx:106
void SetSubTotalsSortGroups(const bool bTemp)
Definition: xmldrani.hxx:112
ScXMLSubTotalFieldContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLSubTotalRuleContext *pSubTotalRuleContext)
Definition: xmldrani.cxx:776
virtual ~ScXMLSubTotalFieldContext() override
Definition: xmldrani.cxx:799
void SetSubTotalsInsertPageBreaks(const bool bTemp)
Definition: xmldrani.hxx:108
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldrani.cxx:573
ScSubTotalRule aSubTotalRule
Definition: xmldrani.hxx:217
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:539
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:140
css::sheet::DataImportMode nSourceType
Definition: xmldrani.hxx:64
ScXMLSortGroupsContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:668
ScRange aFilterConditionSourceRangeAddress
Definition: xmldrani.hxx:63
void SetSubTotalsIsCaseSensitive(const bool bTemp)
Definition: xmldrani.hxx:107
ScXMLSubTotalRulesContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:614
ScXMLDatabaseRangeContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList)
Definition: xmldrani.cxx:81
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:588
This class exists only to provide GetScImport() to its derived classes.
virtual ~ScXMLSourceQueryContext() override
Definition: xmldrani.cxx:569
ScXMLConResContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:594
css::uno::Sequence< css::beans::PropertyValue > aSortSequence
Definition: xmldrani.hxx:61
void SetSourceObject(const OUString &sTempSourceObject)
Definition: xmldrani.hxx:103
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:489
virtual ~ScXMLDatabaseRangesContext() override
Definition: xmldrani.cxx:56
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmldrani.cxx:395
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:189
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmldrani.hxx:159
ScXMLSubTotalRuleContext * pSubTotalRuleContext
Definition: xmldrani.hxx:241
ScXMLSourceTableContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:495
virtual ~ScXMLSortGroupsContext() override
Definition: xmldrani.cxx:723
void SetDatabaseName(const OUString &sTempDatabaseName)
Definition: xmldrani.hxx:101
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldrani.cxx:194
virtual ~ScXMLSubTotalRulesContext() override
Definition: xmldrani.cxx:640
virtual ~ScXMLSubTotalRuleContext() override
Definition: xmldrani.cxx:747
sal_Int16 nSubTotalRuleGroupFieldNumber
Definition: xmldrani.hxx:49
void SetConnectionResource(const OUString &sTempConRes)
Definition: xmldrani.hxx:102
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldrani.cxx:61
css::uno::Sequence< css::sheet::SubTotalColumn > aSubTotalColumns
Definition: xmldrani.hxx:50
void SetFilterConditionSourceRangeAddress(const ScRange &aRange)
Definition: xmldrani.hxx:115
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldrani.cxx:474
virtual ~ScXMLConResContext() override
Definition: xmldrani.cxx:610
std::vector< ScSubTotalRule > aSubTotalRules
Definition: xmldrani.hxx:62
void AddSubTotalRule(const ScSubTotalRule &rRule)
Definition: xmldrani.hxx:113
ScDBCollection::RangeType meRangeType
Definition: xmldrani.hxx:85
void SetSubTotalsEnabledUserList(const bool bTemp)
Definition: xmldrani.hxx:109
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldrani.cxx:751
ScXMLDatabaseRangesContext(ScXMLImport &rImport)
Definition: xmldrani.cxx:49
void SetSortSequence(const css::uno::Sequence< css::beans::PropertyValue > &aTempSortSequence)
Definition: xmldrani.hxx:114
virtual ~ScXMLSourceTableContext() override
Definition: xmldrani.cxx:520
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: xmldrani.cxx:644
sal_Int16 nSubTotalsUserListIndex
Definition: xmldrani.hxx:66
void SetNative(const bool bTempNative)
Definition: xmldrani.hxx:105
ScXMLSourceSQLContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmldrani.cxx:443
void SetSubTotalsUserListIndex(const sal_Int16 nTemp)
Definition: xmldrani.hxx:110
void SetSourceType(const css::sheet::DataImportMode nTempSourceType)
Definition: xmldrani.hxx:104