update dev300-m58
[ooovba.git] / sc / source / filter / xml / xmlfilti.hxx
blobe9793c6b357ec6f243fe23f8fa7c602598664a50
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlfilti.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_XMLFILTI_HXX
32 #define SC_XMLFILTI_HXX
34 #include <xmloff/xmlictxt.hxx>
35 #include <xmloff/xmlimp.hxx>
36 #include <com/sun/star/table/CellAddress.hpp>
37 #include <com/sun/star/table/CellRangeAddress.hpp>
38 #include <com/sun/star/sheet/FilterOperator.hpp>
39 #include <com/sun/star/sheet/FilterOperator2.hpp>
40 #include <com/sun/star/sheet/TableFilterField2.hpp>
41 #include <tools/stack.hxx>
43 #include "xmldrani.hxx"
44 #include "xmldpimp.hxx"
46 class ScXMLImport;
48 class ScXMLFilterContext : public SvXMLImportContext
50 ScXMLDatabaseRangeContext* pDatabaseRangeContext;
52 com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField2> aFilterFields;
53 com::sun::star::table::CellAddress aOutputPosition;
54 com::sun::star::table::CellRangeAddress aConditionSourceRangeAddress;
55 sal_Int16 nUserListIndex;
56 sal_Bool bSkipDuplicates;
57 sal_Bool bCopyOutputData;
58 sal_Bool bUseRegularExpressions;
59 sal_Bool bIsCaseSensitive;
60 sal_Bool bEnabledUserList;
61 sal_Bool bConnectionOr;
62 sal_Bool bNextConnectionOr;
63 sal_Bool bConditionSourceRange;
64 Stack aConnectionOrStack;
66 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
67 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
69 public:
71 ScXMLFilterContext( ScXMLImport& rImport, USHORT nPrfx,
72 const ::rtl::OUString& rLName,
73 const ::com::sun::star::uno::Reference<
74 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
75 ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
77 virtual ~ScXMLFilterContext();
79 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
80 const ::rtl::OUString& rLocalName,
81 const ::com::sun::star::uno::Reference<
82 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
84 virtual void EndElement();
86 void SetIsCaseSensitive(const sal_Bool bTemp) { bIsCaseSensitive = bTemp; }
87 void SetUseRegularExpressions(const sal_Bool bTemp) { if (!bUseRegularExpressions) bUseRegularExpressions = bTemp;}
88 void OpenConnection(const sal_Bool bTemp) { sal_Bool* pTemp = new sal_Bool; *pTemp = bConnectionOr;
89 bConnectionOr = bNextConnectionOr; bNextConnectionOr = bTemp;
90 aConnectionOrStack.Push(pTemp);}
91 void CloseConnection() { sal_Bool* pTemp = static_cast <sal_Bool*> (aConnectionOrStack.Pop()); bConnectionOr = *pTemp; bNextConnectionOr = *pTemp; delete pTemp;}
92 sal_Bool GetConnection() { sal_Bool bTemp = bConnectionOr; bConnectionOr = bNextConnectionOr; return bTemp; }
93 void AddFilterField(const com::sun::star::sheet::TableFilterField2 aFilterField) { aFilterFields.realloc(aFilterFields.getLength() + 1);
94 aFilterFields[aFilterFields.getLength() - 1] = aFilterField; }
97 class ScXMLAndContext : public SvXMLImportContext
99 ScXMLFilterContext* pFilterContext;
101 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
102 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
104 public:
106 ScXMLAndContext( ScXMLImport& rImport, USHORT nPrfx,
107 const ::rtl::OUString& rLName,
108 const ::com::sun::star::uno::Reference<
109 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
110 ScXMLFilterContext* pTempFilterContext);
112 virtual ~ScXMLAndContext();
114 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
115 const ::rtl::OUString& rLocalName,
116 const ::com::sun::star::uno::Reference<
117 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
119 virtual void EndElement();
122 class ScXMLOrContext : public SvXMLImportContext
124 ScXMLFilterContext* pFilterContext;
126 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
127 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
129 public:
131 ScXMLOrContext( ScXMLImport& rImport, USHORT nPrfx,
132 const ::rtl::OUString& rLName,
133 const ::com::sun::star::uno::Reference<
134 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
135 ScXMLFilterContext* pTempFilterContext);
137 virtual ~ScXMLOrContext();
139 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
140 const ::rtl::OUString& rLocalName,
141 const ::com::sun::star::uno::Reference<
142 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
144 virtual void EndElement();
147 class ScXMLConditionContext : public SvXMLImportContext
149 ScXMLFilterContext* pFilterContext;
151 rtl::OUString sDataType;
152 rtl::OUString sConditionValue;
153 rtl::OUString sOperator;
154 sal_Int32 nField;
155 sal_Bool bIsCaseSensitive;
157 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
158 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
160 public:
162 ScXMLConditionContext( ScXMLImport& rImport, USHORT nPrfx,
163 const ::rtl::OUString& rLName,
164 const ::com::sun::star::uno::Reference<
165 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
166 ScXMLFilterContext* pTempFilterContext);
168 virtual ~ScXMLConditionContext();
170 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
171 const ::rtl::OUString& rLocalName,
172 const ::com::sun::star::uno::Reference<
173 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
175 void getOperatorXML(const rtl::OUString sTempOperator, sal_Int32& aFilterOperator, sal_Bool& bUseRegularExpressions) const;
176 virtual void EndElement();
179 // Datapilot (Core)
181 class ScXMLDPFilterContext : public SvXMLImportContext
183 ScXMLDataPilotTableContext* pDataPilotTable;
185 ScQueryParam aFilterFields;
186 ScAddress aOutputPosition;
187 ScRange aConditionSourceRangeAddress;
188 sal_uInt8 nFilterFieldCount;
189 sal_Int16 nUserListIndex;
190 sal_Bool bSkipDuplicates;
191 sal_Bool bCopyOutputData;
192 sal_Bool bUseRegularExpressions;
193 sal_Bool bIsCaseSensitive;
194 sal_Bool bEnabledUserList;
195 sal_Bool bConnectionOr;
196 sal_Bool bNextConnectionOr;
197 sal_Bool bConditionSourceRange;
198 Stack aConnectionOrStack;
200 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
201 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
203 public:
205 ScXMLDPFilterContext( ScXMLImport& rImport, USHORT nPrfx,
206 const ::rtl::OUString& rLName,
207 const ::com::sun::star::uno::Reference<
208 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
209 ScXMLDataPilotTableContext* pTempDataPilotTableContext);
211 virtual ~ScXMLDPFilterContext();
213 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
214 const ::rtl::OUString& rLocalName,
215 const ::com::sun::star::uno::Reference<
216 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
218 virtual void EndElement();
220 void SetIsCaseSensitive(const sal_Bool bTemp) { bIsCaseSensitive = bTemp; }
221 void SetUseRegularExpressions(const sal_Bool bTemp) { if (!bUseRegularExpressions) bUseRegularExpressions = bTemp;}
222 void OpenConnection(const sal_Bool bTemp) { sal_Bool* pTemp = new sal_Bool; *pTemp = bConnectionOr;
223 bConnectionOr = bNextConnectionOr; bNextConnectionOr = bTemp;
224 aConnectionOrStack.Push(pTemp);}
225 void CloseConnection() { sal_Bool* pTemp = static_cast <sal_Bool*> (aConnectionOrStack.Pop()); bConnectionOr = *pTemp; bNextConnectionOr = *pTemp; delete pTemp;}
226 sal_Bool GetConnection() { sal_Bool bTemp = bConnectionOr; bConnectionOr = bNextConnectionOr; return bTemp; }
227 void AddFilterField (const ScQueryEntry& aFilterField);
230 class ScXMLDPAndContext : public SvXMLImportContext
232 ScXMLDPFilterContext* pFilterContext;
234 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
235 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
237 public:
239 ScXMLDPAndContext( ScXMLImport& rImport, USHORT nPrfx,
240 const ::rtl::OUString& rLName,
241 const ::com::sun::star::uno::Reference<
242 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
243 ScXMLDPFilterContext* pTempFilterContext);
245 virtual ~ScXMLDPAndContext();
247 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
248 const ::rtl::OUString& rLocalName,
249 const ::com::sun::star::uno::Reference<
250 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
252 virtual void EndElement();
255 class ScXMLDPOrContext : public SvXMLImportContext
257 ScXMLDPFilterContext* pFilterContext;
259 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
260 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
262 public:
264 ScXMLDPOrContext( ScXMLImport& rImport, USHORT nPrfx,
265 const ::rtl::OUString& rLName,
266 const ::com::sun::star::uno::Reference<
267 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
268 ScXMLDPFilterContext* pTempFilterContext);
270 virtual ~ScXMLDPOrContext();
272 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
273 const ::rtl::OUString& rLocalName,
274 const ::com::sun::star::uno::Reference<
275 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
277 virtual void EndElement();
280 class ScXMLDPConditionContext : public SvXMLImportContext
282 ScXMLDPFilterContext* pFilterContext;
284 rtl::OUString sDataType;
285 rtl::OUString sConditionValue;
286 rtl::OUString sOperator;
287 sal_Int32 nField;
288 sal_Bool bIsCaseSensitive;
290 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
291 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
293 public:
295 ScXMLDPConditionContext( ScXMLImport& rImport, USHORT nPrfx,
296 const ::rtl::OUString& rLName,
297 const ::com::sun::star::uno::Reference<
298 ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
299 ScXMLDPFilterContext* pTempFilterContext);
301 virtual ~ScXMLDPConditionContext();
303 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
304 const ::rtl::OUString& rLocalName,
305 const ::com::sun::star::uno::Reference<
306 ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
308 void getOperatorXML(const rtl::OUString sTempOperator, ScQueryOp& aFilterOperator, sal_Bool& bUseRegularExpressions,
309 double& dVal) const;
310 virtual void EndElement();
313 #endif