diff options
Diffstat (limited to 'sc/source/filter/xml/xmlfilti.hxx')
-rw-r--r-- | sc/source/filter/xml/xmlfilti.hxx | 357 |
1 files changed, 357 insertions, 0 deletions
diff --git a/sc/source/filter/xml/xmlfilti.hxx b/sc/source/filter/xml/xmlfilti.hxx new file mode 100644 index 000000000000..ec5f93655ca6 --- /dev/null +++ b/sc/source/filter/xml/xmlfilti.hxx @@ -0,0 +1,357 @@ +/************************************************************************* + * + * $RCSfile: xmlfilti.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: hr $ $Date: 2000-09-18 16:45:15 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef SC_XMLFILTI_HXX +#define SC_XMLFILTI_HXX + +#ifndef _XMLOFF_XMLICTXT_HXX +#include <xmloff/xmlictxt.hxx> +#endif +#ifndef _XMLOFF_XMLIMP_HXX +#include <xmloff/xmlimp.hxx> +#endif +#ifndef _COM_SUN_STAR_TABLE_CELLADDRESS_HPP_ +#include <com/sun/star/table/CellAddress.hpp> +#endif +#ifndef _COM_SUN_STAR_TABLE_CELLRANGEADDRESS_HPP_ +#include <com/sun/star/table/CellRangeAddress.hpp> +#endif +#ifndef _COM_SUN_STAR_SHEET_FILTEROPERATOR_HPP_ +#include <com/sun/star/sheet/FilterOperator.hpp> +#endif +#ifndef _COM_SUN_STAR_SHEET_TABLEFILTERFIELD_HPP_ +#include <com/sun/star/sheet/TableFilterField.hpp> +#endif +#ifndef _STACK_HXX +#include <tools/stack.hxx> +#endif + +#include "xmldrani.hxx" +#include "xmldpimp.hxx" + +class ScXMLImport; + +class ScXMLFilterContext : public SvXMLImportContext +{ + ScXMLDatabaseRangeContext* pDatabaseRangeContext; + + com::sun::star::uno::Sequence <com::sun::star::sheet::TableFilterField> aFilterFields; + com::sun::star::table::CellAddress aOutputPosition; + com::sun::star::table::CellRangeAddress aConditionSourceRangeAddress; + sal_Int16 nUserListIndex; + sal_Bool bSkipDuplicates; + sal_Bool bCopyOutputData; + sal_Bool bUseRegularExpressions; + sal_Bool bIsCaseSensitive; + sal_Bool bEnabledUserList; + sal_Bool bConnectionOr; + sal_Bool bNextConnectionOr; + sal_Bool bConditionSourceRange; + Stack aConnectionOrStack; + + const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } + ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } + +public: + + ScXMLFilterContext( ScXMLImport& rImport, USHORT nPrfx, + const NAMESPACE_RTL(OUString)& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ScXMLDatabaseRangeContext* pTempDatabaseRangeContext); + + virtual ~ScXMLFilterContext(); + + virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, + const NAMESPACE_RTL(OUString)& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + + virtual void EndElement(); + + void SetIsCaseSensitive(const sal_Bool bTemp) { bIsCaseSensitive = bTemp; } + void SetUseRegularExpressions(const sal_Bool bTemp) { if (!bUseRegularExpressions) bUseRegularExpressions = sal_True;} + void OpenConnection(const sal_Bool bTemp) { sal_Bool* pTemp = new sal_Bool; *pTemp = bConnectionOr; + bConnectionOr = bNextConnectionOr; bNextConnectionOr = bTemp; + aConnectionOrStack.Push(pTemp);} + void CloseConnection() { sal_Bool* pTemp = static_cast <sal_Bool*> (aConnectionOrStack.Pop()); bConnectionOr = *pTemp; bNextConnectionOr = *pTemp; delete pTemp;} + sal_Bool GetConnection() { sal_Bool bTemp = bConnectionOr; bConnectionOr = bNextConnectionOr; return bTemp; } + void AddFilterField (const com::sun::star::sheet::TableFilterField aFilterField) { aFilterFields.realloc(aFilterFields.getLength() + 1); + aFilterFields[aFilterFields.getLength() - 1] = aFilterField; } +}; + +class ScXMLAndContext : public SvXMLImportContext +{ + ScXMLFilterContext* pFilterContext; + + const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } + ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } + +public: + + ScXMLAndContext( ScXMLImport& rImport, USHORT nPrfx, + const NAMESPACE_RTL(OUString)& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ScXMLFilterContext* pTempFilterContext); + + virtual ~ScXMLAndContext(); + + virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, + const NAMESPACE_RTL(OUString)& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + + virtual void EndElement(); +}; + +class ScXMLOrContext : public SvXMLImportContext +{ + ScXMLFilterContext* pFilterContext; + + const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } + ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } + +public: + + ScXMLOrContext( ScXMLImport& rImport, USHORT nPrfx, + const NAMESPACE_RTL(OUString)& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ScXMLFilterContext* pTempFilterContext); + + virtual ~ScXMLOrContext(); + + virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, + const NAMESPACE_RTL(OUString)& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + + virtual void EndElement(); +}; + +class ScXMLConditionContext : public SvXMLImportContext +{ + ScXMLFilterContext* pFilterContext; + + rtl::OUString sDataType; + rtl::OUString sConditionValue; + rtl::OUString sOperator; + sal_Int32 nField; + sal_Bool bIsCaseSensitive; + + const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } + ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } + +public: + + ScXMLConditionContext( ScXMLImport& rImport, USHORT nPrfx, + const NAMESPACE_RTL(OUString)& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ScXMLFilterContext* pTempFilterContext); + + virtual ~ScXMLConditionContext(); + + virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, + const NAMESPACE_RTL(OUString)& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + + void getOperatorXML(const rtl::OUString sTempOperator, com::sun::star::sheet::FilterOperator& aFilterOperator, sal_Bool& bUseRegularExpressions) const; + virtual void EndElement(); +}; + +// Datapilot (Core) + +class ScXMLDPFilterContext : public SvXMLImportContext +{ + ScXMLDataPilotTableContext* pDataPilotTable; + + ScQueryParam aFilterFields; + ScAddress aOutputPosition; + ScRange aConditionSourceRangeAddress; + sal_Int16 nUserListIndex; + sal_Bool bSkipDuplicates; + sal_Bool bCopyOutputData; + sal_Bool bUseRegularExpressions; + sal_Bool bIsCaseSensitive; + sal_Bool bEnabledUserList; + sal_Bool bConnectionOr; + sal_Bool bNextConnectionOr; + sal_Bool bConditionSourceRange; + Stack aConnectionOrStack; + + const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } + ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } + +public: + + ScXMLDPFilterContext( ScXMLImport& rImport, USHORT nPrfx, + const NAMESPACE_RTL(OUString)& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ScXMLDataPilotTableContext* pTempDataPilotTableContext); + + virtual ~ScXMLDPFilterContext(); + + virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, + const NAMESPACE_RTL(OUString)& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + + virtual void EndElement(); + + void SetIsCaseSensitive(const sal_Bool bTemp) { bIsCaseSensitive = bTemp; } + void SetUseRegularExpressions(const sal_Bool bTemp) { if (!bUseRegularExpressions) bUseRegularExpressions = sal_True;} + void OpenConnection(const sal_Bool bTemp) { sal_Bool* pTemp = new sal_Bool; *pTemp = bConnectionOr; + bConnectionOr = bNextConnectionOr; bNextConnectionOr = bTemp; + aConnectionOrStack.Push(pTemp);} + void CloseConnection() { sal_Bool* pTemp = static_cast <sal_Bool*> (aConnectionOrStack.Pop()); bConnectionOr = *pTemp; bNextConnectionOr = *pTemp; delete pTemp;} + sal_Bool GetConnection() { sal_Bool bTemp = bConnectionOr; bConnectionOr = bNextConnectionOr; return bTemp; } + void AddFilterField (const ScQueryEntry& aFilterField) { aFilterFields.Resize(aFilterFields.GetEntryCount() + 1); + ScQueryEntry aEntry = aFilterFields.GetEntry(aFilterFields.GetEntryCount() - 1); + aEntry = aFilterField; } +}; + +class ScXMLDPAndContext : public SvXMLImportContext +{ + ScXMLDPFilterContext* pFilterContext; + + const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } + ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } + +public: + + ScXMLDPAndContext( ScXMLImport& rImport, USHORT nPrfx, + const NAMESPACE_RTL(OUString)& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ScXMLDPFilterContext* pTempFilterContext); + + virtual ~ScXMLDPAndContext(); + + virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, + const NAMESPACE_RTL(OUString)& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + + virtual void EndElement(); +}; + +class ScXMLDPOrContext : public SvXMLImportContext +{ + ScXMLDPFilterContext* pFilterContext; + + const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } + ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } + +public: + + ScXMLDPOrContext( ScXMLImport& rImport, USHORT nPrfx, + const NAMESPACE_RTL(OUString)& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ScXMLDPFilterContext* pTempFilterContext); + + virtual ~ScXMLDPOrContext(); + + virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, + const NAMESPACE_RTL(OUString)& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + + virtual void EndElement(); +}; + +class ScXMLDPConditionContext : public SvXMLImportContext +{ + ScXMLDPFilterContext* pFilterContext; + + rtl::OUString sDataType; + rtl::OUString sConditionValue; + rtl::OUString sOperator; + sal_Int32 nField; + sal_Bool bIsCaseSensitive; + + const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } + ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } + +public: + + ScXMLDPConditionContext( ScXMLImport& rImport, USHORT nPrfx, + const NAMESPACE_RTL(OUString)& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ScXMLDPFilterContext* pTempFilterContext); + + virtual ~ScXMLDPConditionContext(); + + virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, + const NAMESPACE_RTL(OUString)& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + + void getOperatorXML(const rtl::OUString sTempOperator, ScQueryOp& aFilterOperator, sal_Bool& bUseRegularExpressions, + double& dVal) const; + virtual void EndElement(); +}; + +#endif |