LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/sax/tools - documenthandleradapter.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 85 0.0 %
Date: 2012-12-27 Functions: 0 31 0.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             : /*
       4             :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       5             :  *
       6             :  * The contents of this file are subject to the Mozilla Public License Version
       7             :  * 1.1 (the "License"); you may not use this file except in compliance with
       8             :  * the License. You may obtain a copy of the License at
       9             :  * http://www.mozilla.org/MPL/
      10             :  *
      11             :  * Software distributed under the License is distributed on an "AS IS" basis,
      12             :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      13             :  * for the specific language governing rights and limitations under the
      14             :  * License.
      15             :  *
      16             :  * The Initial Developer of the Original Code is
      17             :  *       [ Peter Jentsch <pjotr@guineapics.de> ]
      18             :  *
      19             :  * Portions created by the Initial Developer are Copyright (C) 2010 the
      20             :  * Initial Developer. All Rights Reserved.
      21             :  *
      22             :  * Contributor(s): Peter Jentsch <pjotr@guineapics.de>
      23             :  *
      24             :  * Alternatively, the contents of this file may be used under the terms of
      25             :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      26             :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      27             :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      28             :  * instead of those above.
      29             :  */
      30             : 
      31             : #ifndef _DOCUMENTHANDLERADAPTER_H_
      32             : #define _DOCUMENTHANDLERADAPTER_H_
      33             : 
      34             : #include <com/sun/star/xml/sax/SAXException.hpp>
      35             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      36             : #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
      37             : 
      38             : namespace sax
      39             : {
      40             :     /**
      41             :      * DocumentHandlerAdapter provides a base class for simple decorators to XDocumentHandlers.
      42             :      * It forwards all method calls to a delegate. An inheriting class only needs to override the
      43             :      * methods it actually wants to modify.
      44             :      *
      45             :      * See filters/source/odfflatxml/FlatXml.cxx for an example.
      46             :      */
      47             :     class DocumentHandlerAdapter : public ::com::sun::star::xml::sax::XDocumentHandler
      48             :     {
      49             :     public:
      50             :         // XDocumentHandler
      51             :         virtual void SAL_CALL
      52           0 :         startDocument(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
      53             :         {
      54           0 :             m_handler->startDocument();
      55           0 :         }
      56             : 
      57             :         virtual void SAL_CALL
      58           0 :         endDocument(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
      59             :         {
      60           0 :             m_handler->endDocument();
      61           0 :         }
      62             : 
      63             :         virtual void SAL_CALL
      64           0 :         startElement(const ::rtl::OUString& aName,
      65             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs)
      66             :                 throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
      67             :         {
      68           0 :             m_handler->startElement(aName, xAttribs);
      69           0 :         }
      70             : 
      71             :         virtual void SAL_CALL
      72           0 :         endElement(const ::rtl::OUString& aName) throw (::com::sun::star::xml::sax::SAXException,
      73             :                 ::com::sun::star::uno::RuntimeException)
      74             :         {
      75           0 :             m_handler->endElement(aName);
      76           0 :         }
      77             : 
      78             :         virtual void SAL_CALL
      79           0 :         characters(const ::rtl::OUString& aChars) throw (::com::sun::star::xml::sax::SAXException,
      80             :                 ::com::sun::star::uno::RuntimeException)
      81             :         {
      82           0 :             m_handler->characters(aChars);
      83           0 :         }
      84             : 
      85             :         virtual void SAL_CALL
      86           0 :         ignorableWhitespace(const ::rtl::OUString& aWhitespaces) throw (::com::sun::star::xml::sax::SAXException,
      87             :                 ::com::sun::star::uno::RuntimeException)
      88             :         {
      89           0 :             m_handler->ignorableWhitespace(aWhitespaces);
      90           0 :         }
      91             :         virtual void SAL_CALL
      92           0 :         processingInstruction(const ::rtl::OUString& aTarget, const ::rtl::OUString& aData)
      93             :                 throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
      94             :         {
      95           0 :             m_handler->processingInstruction(aTarget, aData);
      96           0 :         }
      97             :         virtual void SAL_CALL
      98           0 :         setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator)
      99             :                 throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
     100             :         {
     101           0 :             m_handler->setDocumentLocator(xLocator);
     102           0 :         }
     103             :         DocumentHandlerAdapter(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& delegate);
     104           0 :         DocumentHandlerAdapter() :
     105           0 :             m_handler(::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > (0, ::com::sun::star::uno::UNO_QUERY))
     106             :         {
     107           0 :         }
     108             :         ;
     109             : 
     110             :     protected:
     111             :         virtual void SAL_CALL
     112           0 :         setDelegate(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& delegate)
     113             :         {
     114           0 :             m_handler = delegate;
     115           0 :         }
     116             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > SAL_CALL
     117           0 :         getDelegate()
     118             :         {
     119           0 :             return m_handler;
     120             :         }
     121             :         virtual
     122           0 :         ~DocumentHandlerAdapter()
     123           0 :         {
     124             : 
     125           0 :         }
     126             : 
     127             :     private:
     128             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_handler;
     129             : 
     130             :     };
     131             : 
     132             :     /**
     133             :      * ExtendedDocumentHandlerAdapter provides a base class for simple decorators to XExtendedDocumentHandlers.
     134             :      * It forwards all method calls to a delegate. An inheriting class only needs to override the
     135             :      * methods it actually wants to modify.
     136             :      */
     137             :     class ExtendedDocumentHandlerAdapter : public ::com::sun::star::xml::sax::XExtendedDocumentHandler
     138             : 
     139             :     {
     140             : 
     141             :     public:
     142             :         // XDocumentHandler
     143             :         virtual void SAL_CALL
     144           0 :         startDocument(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
     145             :         {
     146           0 :             m_handler->startDocument();
     147           0 :         }
     148             : 
     149             :         virtual void SAL_CALL
     150           0 :         endDocument(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
     151             :         {
     152           0 :             m_handler->endDocument();
     153           0 :         }
     154             : 
     155             :         virtual void SAL_CALL
     156           0 :         startElement(const ::rtl::OUString& aName,
     157             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs)
     158             :                 throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
     159             :         {
     160           0 :             m_handler->startElement(aName, xAttribs);
     161           0 :         }
     162             : 
     163             :         virtual void SAL_CALL
     164           0 :         endElement(const ::rtl::OUString& aName) throw (::com::sun::star::xml::sax::SAXException,
     165             :                 ::com::sun::star::uno::RuntimeException)
     166             :         {
     167           0 :             m_handler->endElement(aName);
     168           0 :         }
     169             : 
     170             :         virtual void SAL_CALL
     171           0 :         characters(const ::rtl::OUString& aChars) throw (::com::sun::star::xml::sax::SAXException,
     172             :                 ::com::sun::star::uno::RuntimeException)
     173             :         {
     174           0 :             m_handler->characters(aChars);
     175           0 :         }
     176             : 
     177             :         virtual void SAL_CALL
     178           0 :         ignorableWhitespace(const ::rtl::OUString& aWhitespaces) throw (::com::sun::star::xml::sax::SAXException,
     179             :                 ::com::sun::star::uno::RuntimeException)
     180             :         {
     181           0 :             m_handler->ignorableWhitespace(aWhitespaces);
     182           0 :         }
     183             :         virtual void SAL_CALL
     184           0 :         processingInstruction(const ::rtl::OUString& aTarget, const ::rtl::OUString& aData)
     185             :                 throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
     186             :         {
     187           0 :             m_handler->processingInstruction(aTarget, aData);
     188           0 :         }
     189             :         virtual void SAL_CALL
     190           0 :         setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator)
     191             :                 throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
     192             :         {
     193           0 :             m_handler->setDocumentLocator(xLocator);
     194           0 :         }
     195             :         // XExtendedDocumentHandler
     196             :         virtual void SAL_CALL
     197           0 :         startCDATA(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
     198             :         {
     199           0 :             m_handler->startCDATA();
     200           0 :         }
     201             :         virtual void SAL_CALL
     202           0 :         endCDATA(void) throw (::com::sun::star::uno::RuntimeException)
     203             :         {
     204           0 :             m_handler->endCDATA();
     205           0 :         }
     206             :         virtual void SAL_CALL
     207           0 :         comment(const ::rtl::OUString& sComment) throw (::com::sun::star::xml::sax::SAXException,
     208             :                 ::com::sun::star::uno::RuntimeException)
     209             :         {
     210           0 :             m_handler->comment(sComment);
     211           0 :         }
     212             :         virtual void SAL_CALL
     213           0 :         unknown(const ::rtl::OUString& sString) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
     214             :         {
     215           0 :             m_handler->unknown(sString);
     216           0 :         }
     217             :         virtual void SAL_CALL
     218           0 :         allowLineBreak(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
     219             :         {
     220           0 :             m_handler->allowLineBreak();
     221           0 :         }
     222             :     protected:
     223           0 :         ExtendedDocumentHandlerAdapter() :
     224           0 :             m_handler(::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > (0, ::com::sun::star::uno::UNO_QUERY))
     225             :         {
     226           0 :         }
     227             :         ExtendedDocumentHandlerAdapter(
     228             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > delegate) :
     229             :             m_handler(delegate)
     230             :         {
     231             :         }
     232             : 
     233             :         virtual void SAL_CALL
     234           0 :         setDelegate(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler >& delegate)
     235             :         {
     236           0 :             m_handler = delegate;
     237           0 :         }
     238             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > SAL_CALL
     239           0 :         getDelegate()
     240             :         {
     241           0 :             return m_handler;
     242             :         }
     243             :         virtual
     244           0 :         ~ExtendedDocumentHandlerAdapter()
     245           0 :         {
     246             : 
     247           0 :         }
     248             : 
     249             :     private:
     250             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > m_handler;
     251             :     };
     252             : }
     253             : #endif /* _DOCUMENTHANDLERADAPTER_H_ */
     254             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10