LibreOffice Module sc (master)  1
xmlfilti.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 
20 #pragma once
21 
22 #include "importcontext.hxx"
23 #include <queryentry.hxx>
24 #include <queryparam.hxx>
25 
26 #include <stack>
27 #include <vector>
28 
29 class ScXMLImport;
32 namespace sax_fastparser { class FastAttributeList; }
33 
35 {
37  {
38  bool mbOr;
40  explicit ConnStackItem(bool bOr);
41  };
44 
50  std::vector<ConnStackItem> maConnStack;
51 
52 public:
53 
56  ScQueryParam& rParam,
57  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
58 
59  virtual ~ScXMLFilterContext() override;
60 
61  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
62  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
63 
64  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
65 
66  void OpenConnection(bool b);
67  void CloseConnection();
68  bool GetConnection();
69 };
70 
72 {
75 
76 public:
77 
78  ScXMLAndContext( ScXMLImport& rImport,
79  ScQueryParam& rParam,
80  ScXMLFilterContext* pTempFilterContext);
81 
82  virtual ~ScXMLAndContext() override;
83 
84  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
85  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
86 
87  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
88 };
89 
91 {
94 
95 public:
96 
97  ScXMLOrContext( ScXMLImport& rImport,
98  ScQueryParam& rParam,
99  ScXMLFilterContext* pTempFilterContext);
100 
101  virtual ~ScXMLOrContext() override;
102 
103  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
104  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
105 
106  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
107 };
108 
110 {
113 
115  OUString sDataType;
116  OUString sConditionValue;
117  OUString sOperator;
118  sal_Int32 nField;
120 
121 public:
122 
123  ScXMLConditionContext( ScXMLImport& rImport, sal_Int32 nElement,
125  ScQueryParam& rParam,
126  ScXMLFilterContext* pTempFilterContext);
127 
128  virtual ~ScXMLConditionContext() override;
129 
130  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
131  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
132 
133  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
134 
135  static void GetOperator(std::u16string_view aOpStr, ScQueryParam& rParam, ScQueryEntry& rEntry);
136  void AddSetItem(const ScQueryEntry::Item& rItem);
137 };
138 
140 {
141 public:
142  ScXMLSetItemContext(ScXMLImport& rImport, sal_Int32 nElement,
144  ScXMLConditionContext& rParent);
145 
146  virtual ~ScXMLSetItemContext() override;
147 };
148 
149 // Datapilot (Core)
150 
152 {
154 
162  ::std::stack<bool> aConnectionOrStack;
163 
164 public:
165 
168  ScXMLDataPilotTableContext* pTempDataPilotTableContext);
169 
170  virtual ~ScXMLDPFilterContext() override;
171 
172  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
173  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
174 
175  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
176 
177  void SetIsCaseSensitive(const bool bTemp) { bIsCaseSensitive = bTemp; }
179  {
180  if (eSearchType == utl::SearchParam::SearchType::Normal)
181  eSearchType = eTemp;
182  }
183 
184  void OpenConnection(const bool bVal)
185  {
186  bool bTemp = bConnectionOr;
188  bNextConnectionOr = bVal;
189  aConnectionOrStack.push(bTemp);
190  }
191 
193  {
194  bool bTemp;
195  if (aConnectionOrStack.empty())
196  bTemp = false;
197  else
198  {
199  bTemp = aConnectionOrStack.top();
200  aConnectionOrStack.pop();
201  }
202  bConnectionOr = bTemp;
203  bNextConnectionOr = bTemp;
204  }
205 
206  bool GetConnection() { bool bTemp = bConnectionOr; bConnectionOr = bNextConnectionOr; return bTemp; }
207  void AddFilterField (const ScQueryEntry& aFilterField);
208 };
209 
211 {
213 public:
214 
215  ScXMLDPAndContext( ScXMLImport& rImport,
216  ScXMLDPFilterContext* pTempFilterContext);
217 
218  virtual ~ScXMLDPAndContext() override;
219 
220  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
221  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
222 
223  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
224 };
225 
227 {
229 public:
230 
231  ScXMLDPOrContext( ScXMLImport& rImport,
232  ScXMLDPFilterContext* pTempFilterContext);
233 
234  virtual ~ScXMLDPOrContext() override;
235 
236  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
237  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
238 
239  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
240 };
241 
243 {
245 
246  OUString sDataType;
247  OUString sConditionValue;
248  OUString sOperator;
249  sal_Int32 nField;
251 
252 public:
253 
254  ScXMLDPConditionContext( ScXMLImport& rImport, sal_Int32 nElement,
256  ScXMLDPFilterContext* pTempFilterContext);
257 
258  virtual ~ScXMLDPConditionContext() override;
259 
260  static void getOperatorXML(
261  std::u16string_view sTempOperator, ScQueryOp& aFilterOperator, utl::SearchParam::SearchType& rSearchType);
262  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
263 };
264 
265 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScXMLAndContext(ScXMLImport &rImport, ScQueryParam &rParam, ScXMLFilterContext *pTempFilterContext)
Definition: xmlfilti.cxx:188
static void getOperatorXML(std::u16string_view sTempOperator, ScQueryOp &aFilterOperator, utl::SearchParam::SearchType &rSearchType)
Definition: xmlfilti.cxx:709
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: xmlfilti.cxx:202
void OpenConnection(bool b)
Definition: xmlfilti.cxx:146
virtual ~ScXMLDPOrContext() override
Definition: xmlfilti.cxx:625
ScXMLConditionContext(ScXMLImport &rImport, sal_Int32 nElement, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScQueryParam &rParam, ScXMLFilterContext *pTempFilterContext)
Definition: xmlfilti.cxx:277
ScXMLFilterContext * pFilterContext
Definition: xmlfilti.hxx:112
ScXMLDPConditionContext(ScXMLImport &rImport, sal_Int32 nElement, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDPFilterContext *pTempFilterContext)
Definition: xmlfilti.cxx:658
void SetIsCaseSensitive(const bool bTemp)
Definition: xmlfilti.hxx:177
std::vector< ConnStackItem > maConnStack
Definition: xmlfilti.hxx:50
ScXMLDPFilterContext * pFilterContext
Definition: xmlfilti.hxx:244
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: xmlfilti.cxx:98
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:272
virtual ~ScXMLOrContext() override
Definition: xmlfilti.cxx:242
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: xmlfilti.cxx:246
ScXMLSetItemContext(ScXMLImport &rImport, sal_Int32 nElement, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLConditionContext &rParent)
Definition: xmlfilti.cxx:452
void CloseConnection()
Definition: xmlfilti.cxx:151
ScQueryParam & mrQueryParam
Definition: xmlfilti.hxx:92
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:227
ScXMLOrContext(ScXMLImport &rImport, ScQueryParam &rParam, ScXMLFilterContext *pTempFilterContext)
Definition: xmlfilti.cxx:232
ScQueryParam & mrQueryParam
Definition: xmlfilti.hxx:73
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:745
ScXMLDPOrContext(ScXMLImport &rImport, ScXMLDPFilterContext *pTempFilterContext)
Definition: xmlfilti.cxx:617
bool bConditionSourceRange
Definition: xmlfilti.hxx:49
virtual ~ScXMLConditionContext() override
Definition: xmlfilti.cxx:327
ScXMLFilterContext * pFilterContext
Definition: xmlfilti.hxx:74
ScXMLDPAndContext(ScXMLImport &rImport, ScXMLDPFilterContext *pTempFilterContext)
Definition: xmlfilti.cxx:576
ScXMLDPFilterContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotTableContext *pTempDataPilotTableContext)
Definition: xmlfilti.cxx:482
virtual ~ScXMLFilterContext() override
Definition: xmlfilti.cxx:94
ScRange aConditionSourceRangeAddress
Definition: xmlfilti.hxx:46
::std::stack< bool > aConnectionOrStack
Definition: xmlfilti.hxx:162
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:558
OUString sConditionValue
Definition: xmlfilti.hxx:116
static void GetOperator(std::u16string_view aOpStr, ScQueryParam &rParam, ScQueryEntry &rEntry)
Definition: xmlfilti.cxx:351
This class exists only to provide GetScImport() to its derived classes.
ScQueryParam aFilterFields
Definition: xmlfilti.hxx:155
virtual ~ScXMLDPFilterContext() override
Definition: xmlfilti.cxx:525
virtual ~ScXMLDPConditionContext() override
Definition: xmlfilti.cxx:705
ScAddress aOutputPosition
Definition: xmlfilti.hxx:45
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: xmlfilti.cxx:588
virtual ~ScXMLSetItemContext() override
Definition: xmlfilti.cxx:478
utl::SearchParam::SearchType eSearchType
Definition: xmlfilti.hxx:156
void SetSearchType(const utl::SearchParam::SearchType eTemp)
Definition: xmlfilti.hxx:178
sal_uInt8 nFilterFieldCount
Definition: xmlfilti.hxx:157
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:408
void OpenConnection(const bool bVal)
Definition: xmlfilti.hxx:184
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:130
void AddFilterField(const ScQueryEntry &aFilterField)
Definition: xmlfilti.cxx:567
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: xmlfilti.cxx:331
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: xmlfilti.cxx:629
unsigned char sal_uInt8
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:653
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:612
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmlfilti.hxx:43
ScXMLDPFilterContext * pFilterContext
Definition: xmlfilti.hxx:228
ScXMLDataPilotTableContext * pDataPilotTable
Definition: xmlfilti.hxx:153
void AddSetItem(const ScQueryEntry::Item &rItem)
Definition: xmlfilti.cxx:403
ScQueryOp
Definition: global.hxx:824
ScXMLFilterContext * pFilterContext
Definition: xmlfilti.hxx:93
std::vector< Item > QueryItemsType
Definition: queryentry.hxx:58
ScQueryParam & mrQueryParam
Definition: xmlfilti.hxx:42
virtual ~ScXMLAndContext() override
Definition: xmlfilti.cxx:198
ScXMLFilterContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScQueryParam &rParam, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmlfilti.cxx:41
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: xmlfilti.cxx:529
ScQueryEntry::QueryItemsType maQueryItems
Definition: xmlfilti.hxx:114
ScXMLDPFilterContext * pFilterContext
Definition: xmlfilti.hxx:212
Each instance of this struct represents a single filtering criteria.
Definition: queryentry.hxx:33
ScQueryParam & mrQueryParam
Definition: xmlfilti.hxx:111
virtual ~ScXMLDPAndContext() override
Definition: xmlfilti.cxx:584