LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/xml - xmlfilti.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 25 12.0 %
Date: 2012-12-27 Functions: 3 13 23.1 %
Legend: Lines: hit not hit

          Line data    Source code
       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 SC_XMLFILTI_HXX
      21             : #define SC_XMLFILTI_HXX
      22             : 
      23             : #include <xmloff/xmlictxt.hxx>
      24             : #include <xmloff/xmlimp.hxx>
      25             : #include <com/sun/star/table/CellAddress.hpp>
      26             : #include <com/sun/star/table/CellRangeAddress.hpp>
      27             : #include <com/sun/star/sheet/FilterOperator.hpp>
      28             : #include <com/sun/star/sheet/FilterOperator2.hpp>
      29             : #include <com/sun/star/sheet/TableFilterField2.hpp>
      30             : 
      31             : #include "xmldrani.hxx"
      32             : #include "xmldpimp.hxx"
      33             : #include "queryentry.hxx"
      34             : 
      35             : #include <vector>
      36             : 
      37             : class ScXMLImport;
      38             : struct ScQueryParam;
      39             : 
      40             : class ScXMLFilterContext : public SvXMLImportContext
      41             : {
      42             :     struct ConnStackItem
      43             :     {
      44             :         bool mbOr;
      45             :         int  mnCondCount;
      46             :         ConnStackItem(bool bOr);
      47             :     };
      48             :     ScQueryParam& mrQueryParam;
      49             :     ScXMLDatabaseRangeContext* pDatabaseRangeContext;
      50             : 
      51             :     com::sun::star::table::CellAddress aOutputPosition;
      52             :     com::sun::star::table::CellRangeAddress aConditionSourceRangeAddress;
      53             :     bool        bSkipDuplicates;
      54             :     bool        bCopyOutputData;
      55             :     bool        bConditionSourceRange;
      56             :     std::vector<ConnStackItem> maConnStack;
      57             : 
      58             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
      59           4 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
      60             : 
      61             : public:
      62             : 
      63             :     ScXMLFilterContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
      64             :                         const ::rtl::OUString& rLName,
      65             :                         const ::com::sun::star::uno::Reference<
      66             :                             ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
      67             :                         ScQueryParam& rParam,
      68             :                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
      69             : 
      70             :     virtual ~ScXMLFilterContext();
      71             : 
      72             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
      73             :                                      const ::rtl::OUString& rLocalName,
      74             :                                      const ::com::sun::star::uno::Reference<
      75             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
      76             : 
      77             :     virtual void EndElement();
      78             : 
      79             :     void OpenConnection(bool b);
      80             :     void CloseConnection();
      81             :     bool GetConnection();
      82             : };
      83             : 
      84             : class ScXMLAndContext : public SvXMLImportContext
      85             : {
      86             :     ScQueryParam& mrQueryParam;
      87             :     ScXMLFilterContext* pFilterContext;
      88             : 
      89             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
      90           0 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
      91             : 
      92             : public:
      93             : 
      94             :     ScXMLAndContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
      95             :                      const ::rtl::OUString& rLName,
      96             :                      const ::com::sun::star::uno::Reference<
      97             :                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
      98             :                      ScQueryParam& rParam,
      99             :                      ScXMLFilterContext* pTempFilterContext);
     100             : 
     101             :     virtual ~ScXMLAndContext();
     102             : 
     103             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     104             :                                      const ::rtl::OUString& rLocalName,
     105             :                                      const ::com::sun::star::uno::Reference<
     106             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
     107             : 
     108             :     virtual void EndElement();
     109             : };
     110             : 
     111             : class ScXMLOrContext : public SvXMLImportContext
     112             : {
     113             :     ScQueryParam& mrQueryParam;
     114             :     ScXMLFilterContext* pFilterContext;
     115             : 
     116             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     117           2 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
     118             : 
     119             : public:
     120             : 
     121             :     ScXMLOrContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     122             :                     const ::rtl::OUString& rLName,
     123             :                     const ::com::sun::star::uno::Reference<
     124             :                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     125             :                     ScQueryParam& rParam,
     126             :                     ScXMLFilterContext* pTempFilterContext);
     127             : 
     128             :     virtual ~ScXMLOrContext();
     129             : 
     130             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     131             :                                      const ::rtl::OUString& rLocalName,
     132             :                                      const ::com::sun::star::uno::Reference<
     133             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
     134             : 
     135             :     virtual void EndElement();
     136             : };
     137             : 
     138             : class ScXMLConditionContext : public SvXMLImportContext
     139             : {
     140             :     ScQueryParam& mrQueryParam;
     141             :     ScXMLFilterContext* pFilterContext;
     142             : 
     143             :     ScQueryEntry::QueryItemsType maQueryItems;
     144             :     rtl::OUString sDataType;
     145             :     rtl::OUString sConditionValue;
     146             :     rtl::OUString sOperator;
     147             :     sal_Int32   nField;
     148             :     bool        bIsCaseSensitive;
     149             : 
     150             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     151           4 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
     152             : 
     153             : public:
     154             : 
     155             :     ScXMLConditionContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     156             :                            const ::rtl::OUString& rLName,
     157             :                            const ::com::sun::star::uno::Reference<
     158             :                                ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     159             :                            ScQueryParam& rParam,
     160             :                            ScXMLFilterContext* pTempFilterContext);
     161             : 
     162             :     virtual ~ScXMLConditionContext();
     163             : 
     164             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     165             :                                      const ::rtl::OUString& rLocalName,
     166             :                                      const ::com::sun::star::uno::Reference<
     167             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
     168             : 
     169             :     virtual void EndElement();
     170             : 
     171             :     void GetOperator(const rtl::OUString& aOpStr, ScQueryParam& rParam, ScQueryEntry& rEntry) const;
     172             :     void AddSetItem(const ScQueryEntry::Item& rItem);
     173             : };
     174             : 
     175             : class ScXMLSetItemContext : public SvXMLImportContext
     176             : {
     177             :     const ScXMLImport& GetScImport() const;
     178             :     ScXMLImport& GetScImport();
     179             : public:
     180             :     ScXMLSetItemContext(ScXMLImport& rImport, sal_uInt16 nPrfx,
     181             :                         const ::rtl::OUString& rLName,
     182             :                         const ::com::sun::star::uno::Reference<
     183             :                             ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     184             :                         ScXMLConditionContext& rParent);
     185             : 
     186             :     virtual ~ScXMLSetItemContext();
     187             : 
     188             :     virtual SvXMLImportContext *CreateChildContext(
     189             :         sal_uInt16 nPrefix,
     190             :         const ::rtl::OUString& rLocalName,
     191             :         const ::com::sun::star::uno::Reference<
     192             :             ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
     193             : 
     194             :     virtual void EndElement();
     195             : };
     196             : 
     197             : // Datapilot (Core)
     198             : 
     199             : class ScXMLDPFilterContext : public SvXMLImportContext
     200             : {
     201             :     ScXMLDataPilotTableContext* pDataPilotTable;
     202             : 
     203             :     ScQueryParam    aFilterFields;
     204             :     ScAddress       aOutputPosition;
     205             :     ScRange         aConditionSourceRangeAddress;
     206             :     sal_uInt8   nFilterFieldCount;
     207             :     bool        bSkipDuplicates:1;
     208             :     bool        bCopyOutputData:1;
     209             :     bool        bUseRegularExpressions:1;
     210             :     bool        bIsCaseSensitive:1;
     211             :     bool        bConnectionOr:1;
     212             :     bool        bNextConnectionOr:1;
     213             :     bool        bConditionSourceRange:1;
     214             :     ::std::stack<bool>  aConnectionOrStack;
     215             : 
     216             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     217           0 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
     218             : 
     219             : public:
     220             : 
     221             :     ScXMLDPFilterContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     222             :                         const ::rtl::OUString& rLName,
     223             :                         const ::com::sun::star::uno::Reference<
     224             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     225             :                                         ScXMLDataPilotTableContext* pTempDataPilotTableContext);
     226             : 
     227             :     virtual ~ScXMLDPFilterContext();
     228             : 
     229             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     230             :                                      const ::rtl::OUString& rLocalName,
     231             :                                      const ::com::sun::star::uno::Reference<
     232             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
     233             : 
     234             :     virtual void EndElement();
     235             : 
     236           0 :     void SetIsCaseSensitive(const bool bTemp) { bIsCaseSensitive = bTemp; }
     237           0 :     void SetUseRegularExpressions(const bool bTemp) { if (!bUseRegularExpressions) bUseRegularExpressions = bTemp;}
     238             : 
     239           0 :     void OpenConnection(const bool bVal)
     240             :     {
     241           0 :         bool bTemp = bConnectionOr;
     242           0 :         bConnectionOr = bNextConnectionOr;
     243           0 :         bNextConnectionOr = bVal;
     244           0 :         aConnectionOrStack.push(bTemp);
     245           0 :     }
     246             : 
     247           0 :     void CloseConnection()
     248             :     {
     249             :         bool bTemp;
     250           0 :         if (aConnectionOrStack.empty())
     251           0 :             bTemp = false;
     252             :         else
     253             :         {
     254           0 :             bTemp = aConnectionOrStack.top();
     255           0 :             aConnectionOrStack.pop();
     256             :         }
     257           0 :         bConnectionOr = bTemp;
     258           0 :         bNextConnectionOr = bTemp;
     259           0 :     }
     260             : 
     261           0 :     bool GetConnection() { bool bTemp = bConnectionOr; bConnectionOr = bNextConnectionOr; return bTemp; }
     262             :     void AddFilterField (const ScQueryEntry& aFilterField);
     263             : };
     264             : 
     265             : class ScXMLDPAndContext : public SvXMLImportContext
     266             : {
     267             :     ScXMLDPFilterContext* pFilterContext;
     268             : 
     269             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     270           0 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
     271             : 
     272             : public:
     273             : 
     274             :     ScXMLDPAndContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     275             :                         const ::rtl::OUString& rLName,
     276             :                         const ::com::sun::star::uno::Reference<
     277             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     278             :                                         ScXMLDPFilterContext* pTempFilterContext);
     279             : 
     280             :     virtual ~ScXMLDPAndContext();
     281             : 
     282             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     283             :                                      const ::rtl::OUString& rLocalName,
     284             :                                      const ::com::sun::star::uno::Reference<
     285             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
     286             : 
     287             :     virtual void EndElement();
     288             : };
     289             : 
     290             : class ScXMLDPOrContext : public SvXMLImportContext
     291             : {
     292             :     ScXMLDPFilterContext* pFilterContext;
     293             : 
     294             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     295           0 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
     296             : 
     297             : public:
     298             : 
     299             :     ScXMLDPOrContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     300             :                         const ::rtl::OUString& rLName,
     301             :                         const ::com::sun::star::uno::Reference<
     302             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     303             :                                         ScXMLDPFilterContext* pTempFilterContext);
     304             : 
     305             :     virtual ~ScXMLDPOrContext();
     306             : 
     307             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     308             :                                      const ::rtl::OUString& rLocalName,
     309             :                                      const ::com::sun::star::uno::Reference<
     310             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
     311             : 
     312             :     virtual void EndElement();
     313             : };
     314             : 
     315             : class ScXMLDPConditionContext : public SvXMLImportContext
     316             : {
     317             :     ScXMLDPFilterContext* pFilterContext;
     318             : 
     319             :     rtl::OUString sDataType;
     320             :     rtl::OUString sConditionValue;
     321             :     rtl::OUString sOperator;
     322             :     sal_Int32   nField;
     323             :     bool        bIsCaseSensitive;
     324             : 
     325             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     326           0 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
     327             : 
     328             : public:
     329             : 
     330             :     ScXMLDPConditionContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     331             :                         const ::rtl::OUString& rLName,
     332             :                         const ::com::sun::star::uno::Reference<
     333             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     334             :                                         ScXMLDPFilterContext* pTempFilterContext);
     335             : 
     336             :     virtual ~ScXMLDPConditionContext();
     337             : 
     338             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     339             :                                      const ::rtl::OUString& rLocalName,
     340             :                                      const ::com::sun::star::uno::Reference<
     341             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
     342             : 
     343             :     void getOperatorXML(
     344             :         const rtl::OUString sTempOperator, ScQueryOp& aFilterOperator, bool& bUseRegularExpressions) const;
     345             :     virtual void EndElement();
     346             : };
     347             : 
     348             : #endif
     349             : 
     350             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10