1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_XML_XMLFILTI_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_XML_XMLFILTI_HXX
23 #include "importcontext.hxx"
24 #include <queryentry.hxx>
25 #include <queryparam.hxx>
31 class ScXMLDatabaseRangeContext
;
32 class ScXMLDataPilotTableContext
;
33 namespace sax_fastparser
{ class FastAttributeList
; }
35 class ScXMLFilterContext
: public ScXMLImportContext
41 explicit ConnStackItem(bool bOr
);
43 ScQueryParam
& mrQueryParam
;
44 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
46 ScAddress aOutputPosition
;
47 ScRange aConditionSourceRangeAddress
;
50 bool bConditionSourceRange
;
51 std::vector
<ConnStackItem
> maConnStack
;
55 ScXMLFilterContext( ScXMLImport
& rImport
,
56 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
58 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
60 virtual ~ScXMLFilterContext() override
;
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
;
65 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
67 void OpenConnection(bool b
);
68 void CloseConnection();
72 class ScXMLAndContext
: public ScXMLImportContext
74 ScQueryParam
& mrQueryParam
;
75 ScXMLFilterContext
* pFilterContext
;
79 ScXMLAndContext( ScXMLImport
& rImport
,
81 ScXMLFilterContext
* pTempFilterContext
);
83 virtual ~ScXMLAndContext() override
;
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
;
88 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
91 class ScXMLOrContext
: public ScXMLImportContext
93 ScQueryParam
& mrQueryParam
;
94 ScXMLFilterContext
* pFilterContext
;
98 ScXMLOrContext( ScXMLImport
& rImport
,
100 ScXMLFilterContext
* pTempFilterContext
);
102 virtual ~ScXMLOrContext() override
;
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
;
107 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
110 class ScXMLConditionContext
: public ScXMLImportContext
112 ScQueryParam
& mrQueryParam
;
113 ScXMLFilterContext
* pFilterContext
;
115 ScQueryEntry::QueryItemsType maQueryItems
;
117 OUString sConditionValue
;
120 bool bIsCaseSensitive
;
124 ScXMLConditionContext( ScXMLImport
& rImport
, sal_Int32 nElement
,
125 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
126 ScQueryParam
& rParam
,
127 ScXMLFilterContext
* pTempFilterContext
);
129 virtual ~ScXMLConditionContext() override
;
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
;
134 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
136 static void GetOperator(const OUString
& aOpStr
, ScQueryParam
& rParam
, ScQueryEntry
& rEntry
);
137 void AddSetItem(const ScQueryEntry::Item
& rItem
);
140 class ScXMLSetItemContext
: public ScXMLImportContext
143 ScXMLSetItemContext(ScXMLImport
& rImport
, sal_Int32 nElement
,
144 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
145 ScXMLConditionContext
& rParent
);
147 virtual ~ScXMLSetItemContext() override
;
152 class ScXMLDPFilterContext
: public ScXMLImportContext
154 ScXMLDataPilotTableContext
* pDataPilotTable
;
156 ScQueryParam aFilterFields
;
157 utl::SearchParam::SearchType eSearchType
;
158 sal_uInt8 nFilterFieldCount
;
159 bool bSkipDuplicates
:1;
160 bool bIsCaseSensitive
:1;
161 bool bConnectionOr
:1;
162 bool bNextConnectionOr
:1;
163 ::std::stack
<bool> aConnectionOrStack
;
167 ScXMLDPFilterContext( ScXMLImport
& rImport
,
168 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
169 ScXMLDataPilotTableContext
* pTempDataPilotTableContext
);
171 virtual ~ScXMLDPFilterContext() override
;
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
;
176 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
178 void SetIsCaseSensitive(const bool bTemp
) { bIsCaseSensitive
= bTemp
; }
179 void SetSearchType(const utl::SearchParam::SearchType eTemp
)
181 if (eSearchType
== utl::SearchParam::SearchType::Normal
)
185 void OpenConnection(const bool bVal
)
187 bool bTemp
= bConnectionOr
;
188 bConnectionOr
= bNextConnectionOr
;
189 bNextConnectionOr
= bVal
;
190 aConnectionOrStack
.push(bTemp
);
193 void CloseConnection()
196 if (aConnectionOrStack
.empty())
200 bTemp
= aConnectionOrStack
.top();
201 aConnectionOrStack
.pop();
203 bConnectionOr
= bTemp
;
204 bNextConnectionOr
= bTemp
;
207 bool GetConnection() { bool bTemp
= bConnectionOr
; bConnectionOr
= bNextConnectionOr
; return bTemp
; }
208 void AddFilterField (const ScQueryEntry
& aFilterField
);
211 class ScXMLDPAndContext
: public ScXMLImportContext
213 ScXMLDPFilterContext
* pFilterContext
;
216 ScXMLDPAndContext( ScXMLImport
& rImport
,
217 ScXMLDPFilterContext
* pTempFilterContext
);
219 virtual ~ScXMLDPAndContext() override
;
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
;
224 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
227 class ScXMLDPOrContext
: public ScXMLImportContext
229 ScXMLDPFilterContext
* pFilterContext
;
232 ScXMLDPOrContext( ScXMLImport
& rImport
,
233 ScXMLDPFilterContext
* pTempFilterContext
);
235 virtual ~ScXMLDPOrContext() override
;
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
;
240 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
243 class ScXMLDPConditionContext
: public ScXMLImportContext
245 ScXMLDPFilterContext
* pFilterContext
;
248 OUString sConditionValue
;
251 bool bIsCaseSensitive
;
255 ScXMLDPConditionContext( ScXMLImport
& rImport
, sal_Int32 nElement
,
256 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
257 ScXMLDPFilterContext
* pTempFilterContext
);
259 virtual ~ScXMLDPConditionContext() override
;
261 static void getOperatorXML(
262 const OUString
& sTempOperator
, ScQueryOp
& aFilterOperator
, utl::SearchParam::SearchType
& rSearchType
);
263 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
268 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */