LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/xml - xmlnexpi.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 7 100.0 %
Date: 2012-12-27 Functions: 9 10 90.0 %
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 SC_XMLNEXPI_HXX
      20             : #define SC_XMLNEXPI_HXX
      21             : 
      22             : #include <xmloff/xmlictxt.hxx>
      23             : #include <xmloff/xmlimp.hxx>
      24             : #include "address.hxx"
      25             : 
      26             : #include <boost/shared_ptr.hpp>
      27             : 
      28             : class ScXMLImport;
      29             : struct ScMyNamedExpression;
      30             : class ScRangeName;
      31             : 
      32             : class ScXMLNamedExpressionsContext : public SvXMLImportContext
      33             : {
      34             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
      35          45 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
      36             : 
      37             : public:
      38             : 
      39          17 :     class Inserter
      40             :     {
      41             :     public:
      42          17 :         virtual ~Inserter() {}
      43             :         virtual void insert(ScMyNamedExpression* pExp) = 0;
      44             :     };
      45             : 
      46             :     /**
      47             :      * Global named expressions are inserted into ScXMLImport, which does the
      48             :      * bulk insertion at the end of the import.
      49             :      */
      50          26 :     class GlobalInserter : public Inserter
      51             :     {
      52             :     public:
      53             :         GlobalInserter(ScXMLImport& rImport);
      54             :         virtual void insert(ScMyNamedExpression* pExp);
      55             :     private:
      56             :         ScXMLImport& mrImport;
      57             :     };
      58             : 
      59             :     /**
      60             :      * Sheet local named expressions are inserted directly into ScRangeName
      61             :      * instance of that sheet.  TODO: the global ones should be inserted the
      62             :      * same way for efficiency.
      63             :      */
      64           8 :     class SheetLocalInserter : public Inserter
      65             :     {
      66             :     public:
      67             :         SheetLocalInserter(ScXMLImport& rImport, SCTAB nTab);
      68             :         virtual void insert(ScMyNamedExpression* pExp);
      69             :     private:
      70             :         ScXMLImport& mrImport;
      71             :         SCTAB mnTab;
      72             :     };
      73             : 
      74             :     ScXMLNamedExpressionsContext(
      75             :         ScXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
      76             :         const ::com::sun::star::uno::Reference<
      77             :             ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
      78             :         Inserter* pInserter );
      79             : 
      80             :     virtual ~ScXMLNamedExpressionsContext();
      81             : 
      82             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
      83             :                                      const ::rtl::OUString& rLocalName,
      84             :                                      const ::com::sun::star::uno::Reference<
      85             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
      86             : 
      87             :     virtual void EndElement();
      88             : 
      89             : private:
      90             :     ::boost::shared_ptr<Inserter> mpInserter;
      91             : };
      92             : 
      93             : class ScXMLNamedRangeContext : public SvXMLImportContext
      94             : {
      95             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
      96          60 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
      97             : 
      98             : public:
      99             : 
     100             :     ScXMLNamedRangeContext(
     101             :         ScXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
     102             :         const ::com::sun::star::uno::Reference<
     103             :             ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     104             :         ScXMLNamedExpressionsContext::Inserter* pInserter );
     105             : 
     106             :     virtual ~ScXMLNamedRangeContext();
     107             : 
     108             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     109             :                                      const ::rtl::OUString& rLocalName,
     110             :                                      const ::com::sun::star::uno::Reference<
     111             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
     112             : 
     113             :     virtual void EndElement();
     114             : 
     115             : private:
     116             :     ScXMLNamedExpressionsContext::Inserter* mpInserter;
     117             : };
     118             : 
     119             : class ScXMLNamedExpressionContext : public SvXMLImportContext
     120             : {
     121             :     const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
     122          10 :     ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
     123             : 
     124             : public:
     125             : 
     126             :     ScXMLNamedExpressionContext(
     127             :         ScXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
     128             :         const ::com::sun::star::uno::Reference<
     129             :             ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
     130             :         ScXMLNamedExpressionsContext::Inserter* pInserter );
     131             : 
     132             :     virtual ~ScXMLNamedExpressionContext();
     133             : 
     134             :     virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
     135             :                                      const ::rtl::OUString& rLocalName,
     136             :                                      const ::com::sun::star::uno::Reference<
     137             :                                           ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
     138             : 
     139             :     virtual void EndElement();
     140             : 
     141             : private:
     142             :     ScXMLNamedExpressionsContext::Inserter* mpInserter;
     143             : };
     144             : 
     145             : #endif
     146             : 
     147             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10