LCOV - code coverage report
Current view: top level - sc/source/filter/xml - xmldrani.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 7 30 23.3 %
Date: 2014-11-03 Functions: 7 29 24.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             : #ifndef INCLUDED_SC_SOURCE_FILTER_XML_XMLDRANI_HXX
      20             : #define INCLUDED_SC_SOURCE_FILTER_XML_XMLDRANI_HXX
      21             : 
      22             : #include <xmloff/xmlictxt.hxx>
      23             : #include <xmloff/xmlimp.hxx>
      24             : #include <com/sun/star/sheet/DataImportMode.hpp>
      25             : #include <com/sun/star/sheet/SubTotalColumn.hpp>
      26             : #include <com/sun/star/beans/XPropertySet.hpp>
      27             : #include <com/sun/star/beans/PropertyValue.hpp>
      28             : #include <com/sun/star/sheet/TableFilterField2.hpp>
      29             : #include <com/sun/star/table/CellAddress.hpp>
      30             : #include <com/sun/star/table/CellRangeAddress.hpp>
      31             : #include <com/sun/star/table/TableOrientation.hpp>
      32             : 
      33             : #include "dbdata.hxx"
      34             : #include "xmlimprt.hxx"
      35             : 
      36             : #include <boost/scoped_ptr.hpp>
      37             : 
      38             : class ScDBData;
      39             : struct ScQueryParam;
      40             : 
      41             : class ScXMLDatabaseRangesContext : public SvXMLImportContext
      42             : {
      43             :     const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
      44          80 :     ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
      45             : 
      46             : public:
      47             : 
      48             :     ScXMLDatabaseRangesContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
      49             :                         const OUString& rLName,
      50             :                         const ::com::sun::star::uno::Reference<
      51             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
      52             : 
      53             :     virtual ~ScXMLDatabaseRangesContext();
      54             : 
      55             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
      56             :                                      const OUString& rLocalName,
      57             :                                      const ::com::sun::star::uno::Reference<
      58             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
      59             : 
      60             :     virtual void EndElement() SAL_OVERRIDE;
      61             : };
      62             : 
      63           0 : struct ScSubTotalRule
      64             : {
      65             :     sal_Int16 nSubTotalRuleGroupFieldNumber;
      66             :     com::sun::star::uno::Sequence <com::sun::star::sheet::SubTotalColumn> aSubTotalColumns;
      67             : };
      68             : 
      69             : class ScXMLDatabaseRangeContext : public SvXMLImportContext
      70             : {
      71             :     boost::scoped_ptr<ScQueryParam> mpQueryParam;
      72             :     ScRange maRange;
      73             :     OUString   sDatabaseRangeName;
      74             :     OUString   sConnectionResource;
      75             :     OUString   sDatabaseName;
      76             :     OUString   sSourceObject;
      77             :     com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue> aSortSequence;
      78             :     std::vector < ScSubTotalRule > aSubTotalRules;
      79             :     com::sun::star::table::CellRangeAddress aFilterConditionSourceRangeAddress;
      80             :     com::sun::star::sheet::DataImportMode nSourceType;
      81             :     sal_Int32       nRefresh;
      82             :     sal_Int16       nSubTotalsUserListIndex;
      83             :     bool            mbValidRange;
      84             :     bool            bContainsSort;
      85             :     bool            bContainsSubTotal;
      86             :     bool            bNative;
      87             :     bool            bIsSelection;
      88             :     bool            bKeepFormats;
      89             :     bool            bMoveCells;
      90             :     bool            bStripData;
      91             :     bool            bAutoFilter;
      92             :     bool            bSubTotalsBindFormatsToContent;
      93             :     bool            bSubTotalsIsCaseSensitive;
      94             :     bool            bSubTotalsInsertPageBreaks;
      95             :     bool            bSubTotalsSortGroups;
      96             :     bool            bSubTotalsEnabledUserList;
      97             :     bool            bSubTotalsAscending;
      98             :     bool            bFilterConditionSourceRange;
      99             :     bool            bHasHeader;
     100             :     bool            bByRow;
     101             :     ScDBCollection::RangeType meRangeType;
     102             : 
     103             :     const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
     104         246 :     ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
     105             : 
     106             :     ScDBData* ConvertToDBData(const OUString& rName);
     107             : 
     108             : public:
     109             : 
     110             :     ScXMLDatabaseRangeContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     111             :                         const OUString& rLName,
     112             :                         const ::com::sun::star::uno::Reference<
     113             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList);
     114             : 
     115             :     virtual ~ScXMLDatabaseRangeContext();
     116             : 
     117             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     118             :                                      const OUString& rLocalName,
     119             :                                      const ::com::sun::star::uno::Reference<
     120             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
     121             : 
     122             :     virtual void EndElement() SAL_OVERRIDE;
     123             : 
     124           2 :     void SetDatabaseName(const OUString& sTempDatabaseName) { sDatabaseName = sTempDatabaseName; }
     125           0 :     void SetConnectionResource(const OUString& sTempConRes) { sConnectionResource = sTempConRes; }
     126           2 :     void SetSourceObject(const OUString& sTempSourceObject) { sSourceObject = sTempSourceObject; }
     127           2 :     void SetSourceType(const com::sun::star::sheet::DataImportMode nTempSourceType) { nSourceType = nTempSourceType; }
     128           0 :     void SetNative(const bool bTempNative) { bNative = bTempNative; }
     129           0 :     void SetSubTotalsBindFormatsToContent(const bool bTemp ) { bSubTotalsBindFormatsToContent = bTemp; }
     130           0 :     void SetSubTotalsIsCaseSensitive(const bool bTemp) { bSubTotalsIsCaseSensitive = bTemp; }
     131           0 :     void SetSubTotalsInsertPageBreaks(const bool bTemp) { bSubTotalsInsertPageBreaks = bTemp; }
     132           0 :     void SetSubTotalsEnabledUserList(const bool bTemp) { bSubTotalsEnabledUserList = bTemp; }
     133           0 :     void SetSubTotalsUserListIndex(const sal_Int16 nTemp) { nSubTotalsUserListIndex = nTemp; }
     134           0 :     void SetSubTotalsAscending(const bool bTemp) { bSubTotalsAscending = bTemp; }
     135           0 :     void SetSubTotalsSortGroups(const bool bTemp) { bSubTotalsSortGroups = bTemp; }
     136           0 :     void AddSubTotalRule(const ScSubTotalRule& rRule) { aSubTotalRules.push_back(rRule); }
     137           4 :     void SetSortSequence(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& aTempSortSequence) { aSortSequence = aTempSortSequence; }
     138           0 :     void SetFilterConditionSourceRangeAddress(const com::sun::star::table::CellRangeAddress& aTemp) { aFilterConditionSourceRangeAddress = aTemp;
     139           0 :                                                                                                     bFilterConditionSourceRange = true; }
     140             : };
     141             : 
     142             : class ScXMLSourceSQLContext : public SvXMLImportContext
     143             : {
     144             :     ScXMLDatabaseRangeContext*  pDatabaseRangeContext;
     145             :     OUString               sDBName;
     146             : 
     147             :     const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
     148           0 :     ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
     149             : 
     150             : public:
     151             : 
     152             :     ScXMLSourceSQLContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     153             :                         const OUString& rLName,
     154             :                         const ::com::sun::star::uno::Reference<
     155             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     156             :                                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
     157             : 
     158             :     virtual ~ScXMLSourceSQLContext();
     159             : 
     160             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     161             :                                      const OUString& rLocalName,
     162             :                                      const ::com::sun::star::uno::Reference<
     163             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
     164             : 
     165             :     virtual void EndElement() SAL_OVERRIDE;
     166             : };
     167             : 
     168             : class ScXMLSourceTableContext : public SvXMLImportContext
     169             : {
     170             :     ScXMLDatabaseRangeContext*  pDatabaseRangeContext;
     171             :     OUString               sDBName;
     172             : 
     173             :     const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
     174           6 :     ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
     175             : 
     176             : public:
     177             : 
     178             :     ScXMLSourceTableContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     179             :                         const OUString& rLName,
     180             :                         const ::com::sun::star::uno::Reference<
     181             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     182             :                                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
     183             : 
     184             :     virtual ~ScXMLSourceTableContext();
     185             : 
     186             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     187             :                                      const OUString& rLocalName,
     188             :                                      const ::com::sun::star::uno::Reference<
     189             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
     190             : 
     191             :     virtual void EndElement() SAL_OVERRIDE;
     192             : };
     193             : 
     194             : class ScXMLSourceQueryContext : public SvXMLImportContext
     195             : {
     196             :     ScXMLDatabaseRangeContext*  pDatabaseRangeContext;
     197             :     OUString               sDBName;
     198             : 
     199             :     const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
     200           0 :     ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
     201             : 
     202             : public:
     203             : 
     204             :     ScXMLSourceQueryContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     205             :                         const OUString& rLName,
     206             :                         const ::com::sun::star::uno::Reference<
     207             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     208             :                                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
     209             : 
     210             :     virtual ~ScXMLSourceQueryContext();
     211             : 
     212             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     213             :                                      const OUString& rLocalName,
     214             :                                      const ::com::sun::star::uno::Reference<
     215             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
     216             : 
     217             :     virtual void EndElement() SAL_OVERRIDE;
     218             : };
     219             : 
     220             : class ScXMLConResContext : public SvXMLImportContext
     221             : {
     222             :     ScXMLDatabaseRangeContext*  pDatabaseRangeContext;
     223             : 
     224             :     const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
     225           0 :     ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
     226             : 
     227             : public:
     228             : 
     229             :     ScXMLConResContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     230             :                         const OUString& rLName,
     231             :                         const ::com::sun::star::uno::Reference<
     232             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     233             :                                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
     234             : 
     235             :     virtual ~ScXMLConResContext();
     236             : 
     237             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     238             :                                      const OUString& rLocalName,
     239             :                                      const ::com::sun::star::uno::Reference<
     240             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
     241             : 
     242             :     virtual void EndElement() SAL_OVERRIDE;
     243             : };
     244             : 
     245             : class ScXMLSubTotalRulesContext : public SvXMLImportContext
     246             : {
     247             :     ScXMLDatabaseRangeContext* pDatabaseRangeContext;
     248             : 
     249             :     const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
     250           0 :     ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
     251             : 
     252             : public:
     253             : 
     254             :     ScXMLSubTotalRulesContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     255             :                         const OUString& rLName,
     256             :                         const ::com::sun::star::uno::Reference<
     257             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     258             :                                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
     259             : 
     260             :     virtual ~ScXMLSubTotalRulesContext();
     261             : 
     262             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     263             :                                      const OUString& rLocalName,
     264             :                                      const ::com::sun::star::uno::Reference<
     265             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
     266             : 
     267             :     virtual void EndElement() SAL_OVERRIDE;
     268             : };
     269             : 
     270             : class ScXMLSortGroupsContext : public SvXMLImportContext
     271             : {
     272             :     ScXMLDatabaseRangeContext* pDatabaseRangeContext;
     273             : 
     274             :     const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
     275           0 :     ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
     276             : 
     277             : public:
     278             : 
     279             :     ScXMLSortGroupsContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     280             :                         const OUString& rLName,
     281             :                         const ::com::sun::star::uno::Reference<
     282             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     283             :                                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
     284             : 
     285             :     virtual ~ScXMLSortGroupsContext();
     286             : 
     287             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     288             :                                      const OUString& rLocalName,
     289             :                                      const ::com::sun::star::uno::Reference<
     290             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
     291             : 
     292             :     virtual void EndElement() SAL_OVERRIDE;
     293             : };
     294             : 
     295             : class ScXMLSubTotalRuleContext : public SvXMLImportContext
     296             : {
     297             :     ScXMLDatabaseRangeContext*  pDatabaseRangeContext;
     298             :     ScSubTotalRule              aSubTotalRule;
     299             : 
     300             :     const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
     301           0 :     ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
     302             : 
     303             : public:
     304             : 
     305             :     ScXMLSubTotalRuleContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     306             :                         const OUString& rLName,
     307             :                         const ::com::sun::star::uno::Reference<
     308             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     309             :                                         ScXMLDatabaseRangeContext* pTempDatabaseRangeContext);
     310             : 
     311             :     virtual ~ScXMLSubTotalRuleContext();
     312             : 
     313             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     314             :                                      const OUString& rLocalName,
     315             :                                      const ::com::sun::star::uno::Reference<
     316             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
     317             : 
     318             :     virtual void EndElement() SAL_OVERRIDE;
     319             : 
     320           0 :     void AddSubTotalColumn(const com::sun::star::sheet::SubTotalColumn aSubTotalColumn)
     321           0 :     { aSubTotalRule.aSubTotalColumns.realloc(aSubTotalRule.aSubTotalColumns.getLength() + 1);
     322           0 :     aSubTotalRule.aSubTotalColumns[aSubTotalRule.aSubTotalColumns.getLength() - 1] = aSubTotalColumn; }
     323             : };
     324             : 
     325             : class ScXMLSubTotalFieldContext : public SvXMLImportContext
     326             : {
     327             :     ScXMLSubTotalRuleContext* pSubTotalRuleContext;
     328             :     OUString sFieldNumber;
     329             :     OUString sFunction;
     330             : 
     331             :     const ScXMLImport& GetScImport() const { return static_cast<const ScXMLImport&>(GetImport()); }
     332           0 :     ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
     333             : 
     334             : public:
     335             : 
     336             :     ScXMLSubTotalFieldContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
     337             :                         const OUString& rLName,
     338             :                         const ::com::sun::star::uno::Reference<
     339             :                                         ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     340             :                                         ScXMLSubTotalRuleContext* pSubTotalRuleContext);
     341             : 
     342             :     virtual ~ScXMLSubTotalFieldContext();
     343             : 
     344             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     345             :                                      const OUString& rLocalName,
     346             :                                      const ::com::sun::star::uno::Reference<
     347             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
     348             : 
     349             :     virtual void EndElement() SAL_OVERRIDE;
     350             : };
     351             : 
     352             : #endif
     353             : 
     354             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10