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 #ifndef INCLUDED_SC_SOURCE_FILTER_XML_XMLFILTI_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLFILTI_HXX
22 
23 #include "importcontext.hxx"
24 #include <queryentry.hxx>
25 #include <queryparam.hxx>
26 
27 #include <stack>
28 #include <vector>
29 
30 class ScXMLImport;
33 namespace sax_fastparser { class FastAttributeList; }
34 
36 {
38  {
39  bool mbOr;
41  explicit ConnStackItem(bool bOr);
42  };
45 
51  std::vector<ConnStackItem> maConnStack;
52 
53 public:
54 
57  ScQueryParam& rParam,
58  ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
59 
60  virtual ~ScXMLFilterContext() override;
61 
62  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
63  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
64 
65  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
66 
67  void OpenConnection(bool b);
68  void CloseConnection();
69  bool GetConnection();
70 };
71 
73 {
76 
77 public:
78 
79  ScXMLAndContext( ScXMLImport& rImport,
80  ScQueryParam& rParam,
81  ScXMLFilterContext* pTempFilterContext);
82 
83  virtual ~ScXMLAndContext() override;
84 
85  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
86  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
87 
88  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
89 };
90 
92 {
95 
96 public:
97 
98  ScXMLOrContext( ScXMLImport& rImport,
99  ScQueryParam& rParam,
100  ScXMLFilterContext* pTempFilterContext);
101 
102  virtual ~ScXMLOrContext() override;
103 
104  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
105  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
106 
107  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
108 };
109 
111 {
114 
116  OUString sDataType;
117  OUString sConditionValue;
118  OUString sOperator;
119  sal_Int32 nField;
121 
122 public:
123 
124  ScXMLConditionContext( ScXMLImport& rImport, sal_Int32 nElement,
126  ScQueryParam& rParam,
127  ScXMLFilterContext* pTempFilterContext);
128 
129  virtual ~ScXMLConditionContext() override;
130 
131  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
132  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
133 
134  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
135 
136  static void GetOperator(const OUString& aOpStr, ScQueryParam& rParam, ScQueryEntry& rEntry);
137  void AddSetItem(const ScQueryEntry::Item& rItem);
138 };
139 
141 {
142 public:
143  ScXMLSetItemContext(ScXMLImport& rImport, sal_Int32 nElement,
145  ScXMLConditionContext& rParent);
146 
147  virtual ~ScXMLSetItemContext() override;
148 };
149 
150 // Datapilot (Core)
151 
153 {
155 
163  ::std::stack<bool> aConnectionOrStack;
164 
165 public:
166 
169  ScXMLDataPilotTableContext* pTempDataPilotTableContext);
170 
171  virtual ~ScXMLDPFilterContext() override;
172 
173  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
174  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
175 
176  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
177 
178  void SetIsCaseSensitive(const bool bTemp) { bIsCaseSensitive = bTemp; }
180  {
181  if (eSearchType == utl::SearchParam::SearchType::Normal)
182  eSearchType = eTemp;
183  }
184 
185  void OpenConnection(const bool bVal)
186  {
187  bool bTemp = bConnectionOr;
189  bNextConnectionOr = bVal;
190  aConnectionOrStack.push(bTemp);
191  }
192 
194  {
195  bool bTemp;
196  if (aConnectionOrStack.empty())
197  bTemp = false;
198  else
199  {
200  bTemp = aConnectionOrStack.top();
201  aConnectionOrStack.pop();
202  }
203  bConnectionOr = bTemp;
204  bNextConnectionOr = bTemp;
205  }
206 
207  bool GetConnection() { bool bTemp = bConnectionOr; bConnectionOr = bNextConnectionOr; return bTemp; }
208  void AddFilterField (const ScQueryEntry& aFilterField);
209 };
210 
212 {
214 public:
215 
216  ScXMLDPAndContext( ScXMLImport& rImport,
217  ScXMLDPFilterContext* pTempFilterContext);
218 
219  virtual ~ScXMLDPAndContext() override;
220 
221  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
222  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
223 
224  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
225 };
226 
228 {
230 public:
231 
232  ScXMLDPOrContext( ScXMLImport& rImport,
233  ScXMLDPFilterContext* pTempFilterContext);
234 
235  virtual ~ScXMLDPOrContext() override;
236 
237  virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
238  sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override;
239 
240  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
241 };
242 
244 {
246 
247  OUString sDataType;
248  OUString sConditionValue;
249  OUString sOperator;
250  sal_Int32 nField;
252 
253 public:
254 
255  ScXMLDPConditionContext( ScXMLImport& rImport, sal_Int32 nElement,
257  ScXMLDPFilterContext* pTempFilterContext);
258 
259  virtual ~ScXMLDPConditionContext() override;
260 
261  static void getOperatorXML(
262  const OUString& sTempOperator, ScQueryOp& aFilterOperator, utl::SearchParam::SearchType& rSearchType);
263  virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override;
264 };
265 
266 #endif
267 
268 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void getOperatorXML(const OUString &sTempOperator, ScQueryOp &aFilterOperator, utl::SearchParam::SearchType &rSearchType)
Definition: xmlfilti.cxx:697
ScXMLAndContext(ScXMLImport &rImport, ScQueryParam &rParam, ScXMLFilterContext *pTempFilterContext)
Definition: xmlfilti.cxx:187
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:201
void OpenConnection(bool b)
Definition: xmlfilti.cxx:145
virtual ~ScXMLDPOrContext() override
Definition: xmlfilti.cxx:613
ScXMLConditionContext(ScXMLImport &rImport, sal_Int32 nElement, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScQueryParam &rParam, ScXMLFilterContext *pTempFilterContext)
Definition: xmlfilti.cxx:276
ScXMLFilterContext * pFilterContext
Definition: xmlfilti.hxx:113
ScXMLDPConditionContext(ScXMLImport &rImport, sal_Int32 nElement, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDPFilterContext *pTempFilterContext)
Definition: xmlfilti.cxx:646
void SetIsCaseSensitive(const bool bTemp)
Definition: xmlfilti.hxx:178
std::vector< ConnStackItem > maConnStack
Definition: xmlfilti.hxx:51
ScXMLDPFilterContext * pFilterContext
Definition: xmlfilti.hxx:245
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:97
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:271
virtual ~ScXMLOrContext() override
Definition: xmlfilti.cxx:241
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:245
ScXMLSetItemContext(ScXMLImport &rImport, sal_Int32 nElement, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLConditionContext &rParent)
Definition: xmlfilti.cxx:439
void CloseConnection()
Definition: xmlfilti.cxx:150
ScQueryParam & mrQueryParam
Definition: xmlfilti.hxx:93
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:226
ScXMLOrContext(ScXMLImport &rImport, ScQueryParam &rParam, ScXMLFilterContext *pTempFilterContext)
Definition: xmlfilti.cxx:231
ScQueryParam & mrQueryParam
Definition: xmlfilti.hxx:74
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:733
ScXMLDPOrContext(ScXMLImport &rImport, ScXMLDPFilterContext *pTempFilterContext)
Definition: xmlfilti.cxx:605
bool bConditionSourceRange
Definition: xmlfilti.hxx:50
virtual ~ScXMLConditionContext() override
Definition: xmlfilti.cxx:325
ScXMLFilterContext * pFilterContext
Definition: xmlfilti.hxx:75
ScXMLDPAndContext(ScXMLImport &rImport, ScXMLDPFilterContext *pTempFilterContext)
Definition: xmlfilti.cxx:564
ScXMLDPFilterContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScXMLDataPilotTableContext *pTempDataPilotTableContext)
Definition: xmlfilti.cxx:469
virtual ~ScXMLFilterContext() override
Definition: xmlfilti.cxx:93
ScRange aConditionSourceRangeAddress
Definition: xmlfilti.hxx:47
::std::stack< bool > aConnectionOrStack
Definition: xmlfilti.hxx:163
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:546
OUString sConditionValue
Definition: xmlfilti.hxx:117
This class exists only to provide GetScImport() to its derived classes.
ScQueryParam aFilterFields
Definition: xmlfilti.hxx:156
virtual ~ScXMLDPFilterContext() override
Definition: xmlfilti.cxx:513
virtual ~ScXMLDPConditionContext() override
Definition: xmlfilti.cxx:693
ScAddress aOutputPosition
Definition: xmlfilti.hxx:46
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:576
virtual ~ScXMLSetItemContext() override
Definition: xmlfilti.cxx:465
utl::SearchParam::SearchType eSearchType
Definition: xmlfilti.hxx:157
void SetSearchType(const utl::SearchParam::SearchType eTemp)
Definition: xmlfilti.hxx:179
sal_uInt8 nFilterFieldCount
Definition: xmlfilti.hxx:158
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:406
void OpenConnection(const bool bVal)
Definition: xmlfilti.hxx:185
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:129
void AddFilterField(const ScQueryEntry &aFilterField)
Definition: xmlfilti.cxx:555
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:329
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:617
unsigned char sal_uInt8
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:641
virtual void SAL_CALL endFastElement(sal_Int32 nElement) override
Definition: xmlfilti.cxx:600
ScXMLDatabaseRangeContext * pDatabaseRangeContext
Definition: xmlfilti.hxx:44
ScXMLDPFilterContext * pFilterContext
Definition: xmlfilti.hxx:229
ScXMLDataPilotTableContext * pDataPilotTable
Definition: xmlfilti.hxx:154
void AddSetItem(const ScQueryEntry::Item &rItem)
Definition: xmlfilti.cxx:401
static void GetOperator(const OUString &aOpStr, ScQueryParam &rParam, ScQueryEntry &rEntry)
Definition: xmlfilti.cxx:349
ScQueryOp
Definition: global.hxx:819
ScXMLFilterContext * pFilterContext
Definition: xmlfilti.hxx:94
std::vector< Item > QueryItemsType
Definition: queryentry.hxx:48
ScQueryParam & mrQueryParam
Definition: xmlfilti.hxx:43
virtual ~ScXMLAndContext() override
Definition: xmlfilti.cxx:197
ScXMLFilterContext(ScXMLImport &rImport, const rtl::Reference< sax_fastparser::FastAttributeList > &rAttrList, ScQueryParam &rParam, ScXMLDatabaseRangeContext *pTempDatabaseRangeContext)
Definition: xmlfilti.cxx:40
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:517
ScQueryEntry::QueryItemsType maQueryItems
Definition: xmlfilti.hxx:115
ScXMLDPFilterContext * pFilterContext
Definition: xmlfilti.hxx:213
Each instance of this struct represents a single filtering criteria.
Definition: queryentry.hxx:33
ScQueryParam & mrQueryParam
Definition: xmlfilti.hxx:112
virtual ~ScXMLDPAndContext() override
Definition: xmlfilti.cxx:572