LCOV - code coverage report
Current view: top level - libreoffice/unoxml/source/dom - saxbuilder.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-12-27 Functions: 2 2 100.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             : 
      20             : #ifndef DOM_SAXBUILDER_HXX
      21             : #define DOM_SAXBUILDER_HXX
      22             : 
      23             : #include <stack>
      24             : #include <map>
      25             : 
      26             : #include <sal/types.h>
      27             : #include <osl/mutex.hxx>
      28             : #include <cppuhelper/implbase2.hxx>
      29             : #include <com/sun/star/uno/Reference.h>
      30             : #include <com/sun/star/uno/Sequence.h>
      31             : 
      32             : #include <com/sun/star/uno/XInterface.hpp>
      33             : #include <com/sun/star/uno/Exception.hpp>
      34             : #include <com/sun/star/xml/dom/XSAXDocumentBuilder2.hpp>
      35             : #include <com/sun/star/xml/dom/SAXDocumentBuilderState.hpp>
      36             : #include <com/sun/star/xml/dom/XDocument.hpp>
      37             : #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
      38             : #include <com/sun/star/xml/sax/XLocator.hpp>
      39             : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      40             : #include <com/sun/star/lang/XServiceInfo.hpp>
      41             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      42             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      43             : 
      44             : using ::rtl::OUString;
      45             : using namespace com::sun::star::uno;
      46             : using namespace com::sun::star::xml::dom;
      47             : using namespace com::sun::star::xml::sax;
      48             : 
      49             : using com::sun::star::lang::XServiceInfo;
      50             : using com::sun::star::lang::XSingleServiceFactory;
      51             : using com::sun::star::lang::XMultiServiceFactory;
      52             : 
      53             : namespace DOM
      54             : {
      55             : 
      56             :     typedef std::stack< Reference< XNode > > NodeStack;
      57             :     typedef std::map< OUString, OUString > NSMap;
      58             :     typedef std::map< OUString, OUString > AttrMap;
      59             :     typedef std::stack< NSMap > NSStack;
      60             : 
      61          88 :     class  CSAXDocumentBuilder
      62             :         : public ::cppu::WeakImplHelper2< XSAXDocumentBuilder2, XServiceInfo >
      63             :     {
      64             : 
      65             :     private:
      66             :         ::osl::Mutex m_Mutex;
      67             :         const Reference< XMultiServiceFactory > m_aServiceManager;
      68             : 
      69             :         SAXDocumentBuilderState m_aState;
      70             :         NodeStack m_aNodeStack;
      71             :         NSStack m_aNSStack;
      72             : 
      73             :         OUString resolvePrefix(const OUString& aPrefix);
      74             : 
      75             :         Reference< XDocument > m_aDocument;
      76             :         Reference< XDocumentFragment > m_aFragment;
      77             :         Reference< XLocator > m_aLocator;
      78             : 
      79             : 
      80             :     public:
      81             : 
      82             :         // call for factory
      83             :         static Reference< XInterface > getInstance(const Reference < XMultiServiceFactory >& xFactory);
      84             : 
      85             :         // static helpers for service info and component management
      86             :         static const char* aImplementationName;
      87             :     static const char* aSupportedServiceNames[];
      88             :         static OUString _getImplementationName();
      89             :         static Sequence< OUString > _getSupportedServiceNames();
      90             :         static Reference< XInterface > _getInstance(const Reference< XMultiServiceFactory >& rSMgr);
      91             : 
      92             :         CSAXDocumentBuilder(const Reference< XMultiServiceFactory >& mgr);
      93             : 
      94             :         // XServiceInfo
      95             :         virtual OUString SAL_CALL getImplementationName()
      96             :             throw (RuntimeException);
      97             :         virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
      98             :             throw (RuntimeException);
      99             :         virtual Sequence< OUString > SAL_CALL getSupportedServiceNames ()
     100             :             throw (RuntimeException);
     101             : 
     102             :         // XDocumentHandler
     103             :         virtual void SAL_CALL startDocument()
     104             :             throw( RuntimeException, com::sun::star::xml::sax::SAXException );
     105             :         virtual void SAL_CALL endDocument()
     106             :             throw( RuntimeException, com::sun::star::xml::sax::SAXException );
     107             :         virtual void SAL_CALL startElement( const OUString& aName,
     108             :              const Reference< XAttributeList >& xAttribs )
     109             :             throw( RuntimeException, com::sun::star::xml::sax::SAXException );
     110             :         virtual void SAL_CALL endElement( const OUString& aName )
     111             :             throw( RuntimeException, com::sun::star::xml::sax::SAXException );
     112             :         virtual void SAL_CALL characters( const OUString& aChars )
     113             :             throw( RuntimeException, com::sun::star::xml::sax::SAXException );
     114             :         virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces )
     115             :             throw( RuntimeException, com::sun::star::xml::sax::SAXException );
     116             :         virtual void SAL_CALL processingInstruction( const OUString& aTarget,
     117             :              const OUString& aData )
     118             :             throw( RuntimeException, com::sun::star::xml::sax::SAXException );
     119             :         virtual void SAL_CALL setDocumentLocator( const Reference< XLocator >& xLocator )
     120             :             throw( RuntimeException, com::sun::star::xml::sax::SAXException );
     121             : 
     122             : 
     123             :         // XSAXDocumentBuilder
     124             :         virtual SAXDocumentBuilderState SAL_CALL getState()
     125             :             throw (RuntimeException);
     126             :         virtual void SAL_CALL reset()
     127             :             throw (RuntimeException);
     128             :         virtual Reference< XDocument > SAL_CALL getDocument()
     129             :             throw (RuntimeException);
     130             :         virtual Reference< XDocumentFragment > SAL_CALL getDocumentFragment()
     131             :             throw (RuntimeException);
     132             :         virtual void SAL_CALL startDocumentFragment(const Reference< XDocument >& ownerDoc)
     133             :             throw (RuntimeException);
     134             :         virtual void SAL_CALL endDocumentFragment()
     135             :             throw (RuntimeException);
     136             : 
     137             : 
     138             :     };
     139             : }
     140             : 
     141             : #endif
     142             : 
     143             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10