LCOV - code coverage report
Current view: top level - xmloff/source/transform - TransformerContext.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 6 6 100.0 %
Date: 2012-08-25 Functions: 6 6 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 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                 :            : 
      29                 :            : #ifndef _XMLOFF_TRANSFORMERCONTEXT_HXX
      30                 :            : #define _XMLOFF_TRANSFORMERCONTEXT_HXX
      31                 :            : 
      32                 :            : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      33                 :            : #include <tools/solar.h>
      34                 :            : #include <salhelper/simplereferenceobject.hxx>
      35                 :            : #include <rtl/ustring.hxx>
      36                 :            : #include <tools/rtti.hxx>
      37                 :            : #include <xmloff/xmltoken.hxx>
      38                 :            : 
      39                 :            : class SvXMLNamespaceMap;
      40                 :            : class XMLTransformerBase;
      41                 :            : 
      42                 :            : class XMLTransformerContext : public ::salhelper::SimpleReferenceObject
      43                 :            : {
      44                 :            :     friend class XMLTransformerBase;
      45                 :            : 
      46                 :            :     XMLTransformerBase& m_rTransformer;
      47                 :            : 
      48                 :            :     ::rtl::OUString m_aQName;
      49                 :            : 
      50                 :            :     SvXMLNamespaceMap   *m_pRewindMap;
      51                 :            : 
      52                 :      15509 :     SvXMLNamespaceMap  *GetRewindMap() const { return m_pRewindMap; }
      53                 :        135 :     void SetRewindMap( SvXMLNamespaceMap *p ) { m_pRewindMap = p; }
      54                 :            : 
      55                 :            : protected:
      56                 :            : 
      57                 :      41469 :     XMLTransformerBase& GetTransformer() { return m_rTransformer; }
      58                 :         36 :     const XMLTransformerBase& GetTransformer() const { return m_rTransformer; }
      59                 :            : 
      60                 :        344 :     void SetQName( const ::rtl::OUString& rQName ) { m_aQName = rQName; }
      61                 :            : 
      62                 :            : public:
      63                 :            :     TYPEINFO();
      64                 :            : 
      65                 :       1786 :     const ::rtl::OUString& GetQName() const { return m_aQName; }
      66                 :            :     sal_Bool HasQName( sal_uInt16 nPrefix,
      67                 :            :                        ::xmloff::token::XMLTokenEnum eToken ) const;
      68                 :            :     sal_Bool HasNamespace( sal_uInt16 nPrefix ) const;
      69                 :            : 
      70                 :            :     // A contexts constructor does anything that is required if an element
      71                 :            :     // starts. Namespace processing has been done already.
      72                 :            :     // Note that virtual methods cannot be used inside constructors. Use
      73                 :            :     // StartElement instead if this is required.
      74                 :            :     XMLTransformerContext( XMLTransformerBase& rTransformer,
      75                 :            :                         const ::rtl::OUString& rQName );
      76                 :            : 
      77                 :            :     // A contexts destructor does anything that is required if an element
      78                 :            :     // ends. By default, nothing is done.
      79                 :            :     // Note that virtual methods cannot be used inside destructors. Use
      80                 :            :     // EndElement instead if this is required.
      81                 :            :     virtual ~XMLTransformerContext();
      82                 :            : 
      83                 :            :     // Create a children element context. By default, the import's
      84                 :            :     // CreateContext method is called to create a new default context.
      85                 :            :     virtual XMLTransformerContext *CreateChildContext( sal_uInt16 nPrefix,
      86                 :            :                                    const ::rtl::OUString& rLocalName,
      87                 :            :                                    const ::rtl::OUString& rQName,
      88                 :            :                                    const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
      89                 :            : 
      90                 :            :     // StartElement is called after a context has been constructed and
      91                 :            :     // before a elements context is parsed. It may be used for actions that
      92                 :            :     // require virtual methods. The default is to do nothing.
      93                 :            :     virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
      94                 :            : 
      95                 :            :     // EndElement is called before a context will be destructed, but
      96                 :            :     // after a elements context has been parsed. It may be used for actions
      97                 :            :     // that require virtual methods. The default is to do nothing.
      98                 :            :     virtual void EndElement();
      99                 :            : 
     100                 :            :     // This method is called for all characters that are contained in the
     101                 :            :     // current element. The default is to ignore them.
     102                 :            :     virtual void Characters( const ::rtl::OUString& rChars );
     103                 :            : 
     104                 :            :     // Is the current context a persistent one (i.e. one that saves is content
     105                 :            :     // rather than exporting it directly?
     106                 :            :     virtual sal_Bool IsPersistent() const;
     107                 :            : 
     108                 :            :     // Export the whole element. By default, nothing is done here
     109                 :            :     virtual void Export();
     110                 :            : 
     111                 :            :     // Export the element content. By default, nothing is done here
     112                 :            :     virtual void ExportContent();
     113                 :            : };
     114                 :            : 
     115                 :            : 
     116                 :            : #endif  //  _XMLOFF_TRANSFORMERCONTEXT_HXX
     117                 :            : 
     118                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10