LCOV - code coverage report
Current view: top level - framework/inc/xml - statusbardocumenthandler.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 2 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             :  * 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 INCLUDED_FRAMEWORK_INC_XML_STATUSBARDOCUMENTHANDLER_HXX
      21             : #define INCLUDED_FRAMEWORK_INC_XML_STATUSBARDOCUMENTHANDLER_HXX
      22             : 
      23             : #include <framework/statusbarconfiguration.hxx>
      24             : 
      25             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      26             : 
      27             : #include <rtl/ustring.hxx>
      28             : #include <cppuhelper/implbase1.hxx>
      29             : 
      30             : #include <boost/unordered_map.hpp>
      31             : #include <stdtypes.h>
      32             : #include <framework/fwedllapi.h>
      33             : 
      34             : namespace framework{
      35             : 
      36             : // Hash code function for using in all hash maps of follow implementation.
      37             : 
      38             : class FWE_DLLPUBLIC OReadStatusBarDocumentHandler :
      39             :                                         public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler >
      40             : {
      41             :     public:
      42             :         enum StatusBar_XML_Entry
      43             :         {
      44             :             SB_ELEMENT_STATUSBAR,
      45             :             SB_ELEMENT_STATUSBARITEM,
      46             :             SB_ATTRIBUTE_URL,
      47             :             SB_ATTRIBUTE_ALIGN,
      48             :             SB_ATTRIBUTE_STYLE,
      49             :             SB_ATTRIBUTE_AUTOSIZE,
      50             :             SB_ATTRIBUTE_OWNERDRAW,
      51             :             SB_ATTRIBUTE_WIDTH,
      52             :             SB_ATTRIBUTE_OFFSET,
      53             :             SB_ATTRIBUTE_HELPURL,
      54             :             SB_XML_ENTRY_COUNT
      55             :         };
      56             : 
      57             :         enum StatusBar_XML_Namespace
      58             :         {
      59             :             SB_NS_STATUSBAR,
      60             :             SB_NS_XLINK,
      61             :             SB_XML_NAMESPACES_COUNT
      62             :         };
      63             : 
      64             :         OReadStatusBarDocumentHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& aStatusBarItems );
      65             :         virtual ~OReadStatusBarDocumentHandler();
      66             : 
      67             :         // XDocumentHandler
      68             :         virtual void SAL_CALL startDocument(void)
      69             :         throw ( ::com::sun::star::xml::sax::SAXException,
      70             :                 ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      71             : 
      72             :         virtual void SAL_CALL endDocument(void)
      73             :         throw(  ::com::sun::star::xml::sax::SAXException,
      74             :                 ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      75             : 
      76             :         virtual void SAL_CALL startElement(
      77             :             const OUString& aName,
      78             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
      79             :         throw(  ::com::sun::star::xml::sax::SAXException,
      80             :                 ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      81             : 
      82             :         virtual void SAL_CALL endElement(const OUString& aName)
      83             :         throw(  ::com::sun::star::xml::sax::SAXException,
      84             :                 ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      85             : 
      86             :         virtual void SAL_CALL characters(const OUString& aChars)
      87             :         throw(  ::com::sun::star::xml::sax::SAXException,
      88             :                 ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      89             : 
      90             :         virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces)
      91             :         throw(  ::com::sun::star::xml::sax::SAXException,
      92             :                 ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      93             : 
      94             :         virtual void SAL_CALL processingInstruction(const OUString& aTarget,
      95             :                                                     const OUString& aData)
      96             :         throw(  ::com::sun::star::xml::sax::SAXException,
      97             :                 ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
      98             : 
      99             :         virtual void SAL_CALL setDocumentLocator(
     100             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
     101             :         throw(  ::com::sun::star::xml::sax::SAXException,
     102             :                 ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     103             : 
     104             :     private:
     105             :         OUString getErrorLineString();
     106             : 
     107           0 :         class StatusBarHashMap : public ::boost::unordered_map< OUString             ,
     108             :                                                          StatusBar_XML_Entry            ,
     109             :                                                          OUStringHash,
     110             :                                                          ::std::equal_to< OUString > >
     111             :         {
     112             :             public:
     113             :                 inline void free()
     114             :                 {
     115             :                     StatusBarHashMap().swap( *this );
     116             :                 }
     117             :         };
     118             : 
     119             :         bool                                                                            m_bStatusBarStartFound;
     120             :         bool                                                                            m_bStatusBarEndFound;
     121             :         bool                                                                            m_bStatusBarItemStartFound;
     122             :         StatusBarHashMap                                                                    m_aStatusBarMap;
     123             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >    m_aStatusBarItems;
     124             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >            m_xLocator;
     125             : };
     126             : 
     127             : class FWE_DLLPUBLIC OWriteStatusBarDocumentHandler
     128             : {
     129             :     public:
     130             :         OWriteStatusBarDocumentHandler(
     131             :             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rStatusBarItems,
     132             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& rWriteDocHandler );
     133             :         virtual ~OWriteStatusBarDocumentHandler();
     134             : 
     135             :         void WriteStatusBarDocument() throw
     136             :             ( ::com::sun::star::xml::sax::SAXException,
     137             :               ::com::sun::star::uno::RuntimeException );
     138             : 
     139             :     protected:
     140             :         virtual void WriteStatusBarItem(
     141             :             const OUString& rCommandURL,
     142             :             const OUString& rHelpURL,
     143             :             sal_Int16            nOffset,
     144             :             sal_Int16            nStyle,
     145             :             sal_Int16            nWidth ) throw
     146             :             ( ::com::sun::star::xml::sax::SAXException,
     147             :               ::com::sun::star::uno::RuntimeException );
     148             : 
     149             :         ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >       m_aStatusBarItems;
     150             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >    m_xWriteDocumentHandler;
     151             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >      m_xEmptyList;
     152             :         OUString                                                                     m_aXMLStatusBarNS;
     153             :         OUString                                                                     m_aXMLXlinkNS;
     154             :         OUString                                                                     m_aAttributeType;
     155             :         OUString                                                                     m_aAttributeURL;
     156             : };
     157             : 
     158             : } // namespace framework
     159             : 
     160             : #endif
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10