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 .
22 #include "importcontext.hxx"
23 #include <queryentry.hxx>
24 #include <queryparam.hxx>
30 class ScXMLDatabaseRangeContext
;
31 class ScXMLDataPilotTableContext
;
32 namespace sax_fastparser
{ class FastAttributeList
; }
34 class ScXMLFilterContext
: public ScXMLImportContext
40 explicit ConnStackItem(bool bOr
);
42 ScQueryParam
& mrQueryParam
;
43 ScXMLDatabaseRangeContext
* pDatabaseRangeContext
;
45 ScAddress aOutputPosition
;
46 ScRange aConditionSourceRangeAddress
;
49 bool bConditionSourceRange
;
50 std::vector
<ConnStackItem
> maConnStack
;
54 ScXMLFilterContext( ScXMLImport
& rImport
,
55 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
57 ScXMLDatabaseRangeContext
* pTempDatabaseRangeContext
);
59 virtual ~ScXMLFilterContext() override
;
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
;
64 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
66 void OpenConnection(bool b
);
67 void CloseConnection();
71 class ScXMLAndContext
: public ScXMLImportContext
73 ScQueryParam
& mrQueryParam
;
74 ScXMLFilterContext
* pFilterContext
;
78 ScXMLAndContext( ScXMLImport
& rImport
,
80 ScXMLFilterContext
* pTempFilterContext
);
82 virtual ~ScXMLAndContext() override
;
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
;
87 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
90 class ScXMLOrContext
: public ScXMLImportContext
92 ScQueryParam
& mrQueryParam
;
93 ScXMLFilterContext
* pFilterContext
;
97 ScXMLOrContext( ScXMLImport
& rImport
,
99 ScXMLFilterContext
* pTempFilterContext
);
101 virtual ~ScXMLOrContext() override
;
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
;
106 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
109 class ScXMLConditionContext
: public ScXMLImportContext
111 ScQueryParam
& mrQueryParam
;
112 ScXMLFilterContext
* pFilterContext
;
114 ScQueryEntry::QueryItemsType maQueryItems
;
116 OUString sConditionValue
;
119 bool bIsCaseSensitive
;
123 ScXMLConditionContext( ScXMLImport
& rImport
, sal_Int32 nElement
,
124 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
125 ScQueryParam
& rParam
,
126 ScXMLFilterContext
* pTempFilterContext
);
128 virtual ~ScXMLConditionContext() override
;
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
;
133 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
135 static void GetOperator(std::u16string_view aOpStr
, ScQueryParam
& rParam
, ScQueryEntry
& rEntry
);
136 void AddSetItem(const ScQueryEntry::Item
& rItem
);
139 class ScXMLSetItemContext
: public ScXMLImportContext
142 ScXMLSetItemContext(ScXMLImport
& rImport
, sal_Int32 nElement
,
143 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
144 ScXMLConditionContext
& rParent
);
146 virtual ~ScXMLSetItemContext() override
;
151 class ScXMLDPFilterContext
: public ScXMLImportContext
153 ScXMLDataPilotTableContext
* pDataPilotTable
;
155 ScQueryParam aFilterFields
;
156 utl::SearchParam::SearchType eSearchType
;
157 sal_uInt8 nFilterFieldCount
;
158 bool bSkipDuplicates
:1;
159 bool bIsCaseSensitive
:1;
160 bool bConnectionOr
:1;
161 bool bNextConnectionOr
:1;
162 ::std::stack
<bool> aConnectionOrStack
;
166 ScXMLDPFilterContext( ScXMLImport
& rImport
,
167 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
168 ScXMLDataPilotTableContext
* pTempDataPilotTableContext
);
170 virtual ~ScXMLDPFilterContext() override
;
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
;
175 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
177 void SetIsCaseSensitive(const bool bTemp
) { bIsCaseSensitive
= bTemp
; }
178 void SetSearchType(const utl::SearchParam::SearchType eTemp
)
180 if (eSearchType
== utl::SearchParam::SearchType::Normal
)
184 void OpenConnection(const bool bVal
)
186 bool bTemp
= bConnectionOr
;
187 bConnectionOr
= bNextConnectionOr
;
188 bNextConnectionOr
= bVal
;
189 aConnectionOrStack
.push(bTemp
);
192 void CloseConnection()
195 if (aConnectionOrStack
.empty())
199 bTemp
= aConnectionOrStack
.top();
200 aConnectionOrStack
.pop();
202 bConnectionOr
= bTemp
;
203 bNextConnectionOr
= bTemp
;
206 bool GetConnection() { bool bTemp
= bConnectionOr
; bConnectionOr
= bNextConnectionOr
; return bTemp
; }
207 void AddFilterField (const ScQueryEntry
& aFilterField
);
210 class ScXMLDPAndContext
: public ScXMLImportContext
212 ScXMLDPFilterContext
* pFilterContext
;
215 ScXMLDPAndContext( ScXMLImport
& rImport
,
216 ScXMLDPFilterContext
* pTempFilterContext
);
218 virtual ~ScXMLDPAndContext() override
;
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
;
223 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
226 class ScXMLDPOrContext
: public ScXMLImportContext
228 ScXMLDPFilterContext
* pFilterContext
;
231 ScXMLDPOrContext( ScXMLImport
& rImport
,
232 ScXMLDPFilterContext
* pTempFilterContext
);
234 virtual ~ScXMLDPOrContext() override
;
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
;
239 virtual void SAL_CALL
endFastElement( sal_Int32 nElement
) override
;
242 class ScXMLDPConditionContext
: public ScXMLImportContext
244 ScXMLDPFilterContext
* pFilterContext
;
247 OUString sConditionValue
;
250 bool bIsCaseSensitive
;
254 ScXMLDPConditionContext( ScXMLImport
& rImport
, sal_Int32 nElement
,
255 const rtl::Reference
<sax_fastparser::FastAttributeList
>& rAttrList
,
256 ScXMLDPFilterContext
* pTempFilterContext
);
258 virtual ~ScXMLDPConditionContext() override
;
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
;
265 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */