LCOV - code coverage report
Current view: top level - sc/source/filter/xml - xmlnexpi.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 7 100.0 %
Date: 2012-08-25 Functions: 9 10 90.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef SC_XMLNEXPI_HXX
      29                 :            : #define SC_XMLNEXPI_HXX
      30                 :            : 
      31                 :            : #include <xmloff/xmlictxt.hxx>
      32                 :            : #include <xmloff/xmlimp.hxx>
      33                 :            : #include "address.hxx"
      34                 :            : 
      35                 :            : #include <boost/shared_ptr.hpp>
      36                 :            : 
      37                 :            : class ScXMLImport;
      38                 :            : struct ScMyNamedExpression;
      39                 :            : class ScRangeName;
      40                 :            : 
      41                 :            : class ScXMLNamedExpressionsContext : public SvXMLImportContext
      42                 :            : {
      43                 :            :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
      44                 :        211 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
      45                 :            : 
      46                 :            : public:
      47                 :            : 
      48                 :         63 :     class Inserter
      49                 :            :     {
      50                 :            :     public:
      51         [ -  + ]:         63 :         virtual ~Inserter() {}
      52                 :            :         virtual void insert(ScMyNamedExpression* pExp) = 0;
      53                 :            :     };
      54                 :            : 
      55                 :            :     /**
      56                 :            :      * Global named expressions are inserted into ScXMLImport, which does the
      57                 :            :      * bulk insertion at the end of the import.
      58                 :            :      */
      59         [ -  + ]:        102 :     class GlobalInserter : public Inserter
      60                 :            :     {
      61                 :            :     public:
      62                 :            :         GlobalInserter(ScXMLImport& rImport);
      63                 :            :         virtual void insert(ScMyNamedExpression* pExp);
      64                 :            :     private:
      65                 :            :         ScXMLImport& mrImport;
      66                 :            :     };
      67                 :            : 
      68                 :            :     /**
      69                 :            :      * Sheet local named expressions are inserted directly into ScRangeName
      70                 :            :      * instance of that sheet.  TODO: the global ones should be inserted the
      71                 :            :      * same way for efficiency.
      72                 :            :      */
      73         [ -  + ]:         24 :     class SheetLocalInserter : public Inserter
      74                 :            :     {
      75                 :            :     public:
      76                 :            :         SheetLocalInserter(ScXMLImport& rImport, SCTAB nTab);
      77                 :            :         virtual void insert(ScMyNamedExpression* pExp);
      78                 :            :     private:
      79                 :            :         ScXMLImport& mrImport;
      80                 :            :         SCTAB mnTab;
      81                 :            :     };
      82                 :            : 
      83                 :            :     ScXMLNamedExpressionsContext(
      84                 :            :         ScXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
      85                 :            :         const ::com::sun::star::uno::Reference<
      86                 :            :             ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
      87                 :            :         Inserter* pInserter );
      88                 :            : 
      89                 :            :     virtual ~ScXMLNamedExpressionsContext();
      90                 :            : 
      91                 :            :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
      92                 :            :                                      const ::rtl::OUString& rLocalName,
      93                 :            :                                      const ::com::sun::star::uno::Reference<
      94                 :            :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
      95                 :            : 
      96                 :            :     virtual void EndElement();
      97                 :            : 
      98                 :            : private:
      99                 :            :     ::boost::shared_ptr<Inserter> mpInserter;
     100                 :            : };
     101                 :            : 
     102                 :            : class ScXMLNamedRangeContext : public SvXMLImportContext
     103                 :            : {
     104                 :            :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     105                 :        340 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
     106                 :            : 
     107                 :            : public:
     108                 :            : 
     109                 :            :     ScXMLNamedRangeContext(
     110                 :            :         ScXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
     111                 :            :         const ::com::sun::star::uno::Reference<
     112                 :            :             ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     113                 :            :         ScXMLNamedExpressionsContext::Inserter* pInserter );
     114                 :            : 
     115                 :            :     virtual ~ScXMLNamedRangeContext();
     116                 :            : 
     117                 :            :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     118                 :            :                                      const ::rtl::OUString& rLocalName,
     119                 :            :                                      const ::com::sun::star::uno::Reference<
     120                 :            :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
     121                 :            : 
     122                 :            :     virtual void EndElement();
     123                 :            : 
     124                 :            : private:
     125                 :            :     ScXMLNamedExpressionsContext::Inserter* mpInserter;
     126                 :            : };
     127                 :            : 
     128                 :            : class ScXMLNamedExpressionContext : public SvXMLImportContext
     129                 :            : {
     130                 :            :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     131                 :         30 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
     132                 :            : 
     133                 :            : public:
     134                 :            : 
     135                 :            :     ScXMLNamedExpressionContext(
     136                 :            :         ScXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
     137                 :            :         const ::com::sun::star::uno::Reference<
     138                 :            :             ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     139                 :            :         ScXMLNamedExpressionsContext::Inserter* pInserter );
     140                 :            : 
     141                 :            :     virtual ~ScXMLNamedExpressionContext();
     142                 :            : 
     143                 :            :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     144                 :            :                                      const ::rtl::OUString& rLocalName,
     145                 :            :                                      const ::com::sun::star::uno::Reference<
     146                 :            :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
     147                 :            : 
     148                 :            :     virtual void EndElement();
     149                 :            : 
     150                 :            : private:
     151                 :            :     ScXMLNamedExpressionsContext::Inserter* mpInserter;
     152                 :            : };
     153                 :            : 
     154                 :            : #endif
     155                 :            : 
     156                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10