LCOV - code coverage report
Current view: top level - libreoffice/framework/inc/xml - toolboxdocumenthandler.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-12-27 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 __FRAMEWORK_XML_TOOLBOXDOCUMENTHANDLER_HXX_
      21             : #define __FRAMEWORK_XML_TOOLBOXDOCUMENTHANDLER_HXX_
      22             : 
      23             : #include <framework/toolboxconfiguration.hxx>
      24             : 
      25             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      26             : #include <com/sun/star/beans/PropertyValue.hpp>
      27             : 
      28             : #include <threadhelp/threadhelpbase.hxx>
      29             : #include <rtl/ustring.hxx>
      30             : #include <cppuhelper/implbase1.hxx>
      31             : #include <stdtypes.h>
      32             : #include <framework/fwedllapi.h>
      33             : 
      34             : namespace framework{
      35             : 
      36             : //*****************************************************************************************************************
      37             : // Hash code function for using in all hash maps of follow implementation.
      38             : 
      39             : class FWE_DLLPUBLIC OReadToolBoxDocumentHandler : private ThreadHelpBase,   // Struct for right initalization of lock member! Must be first of baseclasses.
      40             :                                     public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler >
      41             : {
      42             :     public:
      43             :         enum ToolBox_XML_Entry
      44             :         {
      45             :             TB_ELEMENT_TOOLBAR,
      46             :             TB_ELEMENT_TOOLBARITEM,
      47             :             TB_ELEMENT_TOOLBARSPACE,
      48             :             TB_ELEMENT_TOOLBARBREAK,
      49             :             TB_ELEMENT_TOOLBARSEPARATOR,
      50             :             TB_ATTRIBUTE_TEXT,
      51             :             TB_ATTRIBUTE_BITMAP,
      52             :             TB_ATTRIBUTE_URL,
      53             :             TB_ATTRIBUTE_ITEMBITS,
      54             :             TB_ATTRIBUTE_VISIBLE,
      55             :             TB_ATTRIBUTE_WIDTH,
      56             :             TB_ATTRIBUTE_USER,
      57             :             TB_ATTRIBUTE_HELPID,
      58             :             TB_ATTRIBUTE_STYLE,
      59             :             TB_ATTRIBUTE_UINAME,
      60             :             TB_ATTRIBUTE_TOOLTIP,
      61             :             TB_XML_ENTRY_COUNT
      62             :         };
      63             : 
      64             :         enum ToolBox_XML_Namespace
      65             :         {
      66             :             TB_NS_TOOLBAR,
      67             :             TB_NS_XLINK,
      68             :             TB_XML_NAMESPACES_COUNT
      69             :         };
      70             : 
      71             :         OReadToolBoxDocumentHandler( const ::com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rItemContainer );
      72             :         virtual ~OReadToolBoxDocumentHandler();
      73             : 
      74             :         // XDocumentHandler
      75             :         virtual void SAL_CALL startDocument(void)
      76             :         throw ( ::com::sun::star::xml::sax::SAXException,
      77             :                 ::com::sun::star::uno::RuntimeException );
      78             : 
      79             :         virtual void SAL_CALL endDocument(void)
      80             :         throw(  ::com::sun::star::xml::sax::SAXException,
      81             :                 ::com::sun::star::uno::RuntimeException );
      82             : 
      83             :         virtual void SAL_CALL startElement(
      84             :             const rtl::OUString& aName,
      85             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs)
      86             :         throw(  ::com::sun::star::xml::sax::SAXException,
      87             :                 ::com::sun::star::uno::RuntimeException );
      88             : 
      89             :         virtual void SAL_CALL endElement(const rtl::OUString& aName)
      90             :         throw(  ::com::sun::star::xml::sax::SAXException,
      91             :                 ::com::sun::star::uno::RuntimeException );
      92             : 
      93             :         virtual void SAL_CALL characters(const rtl::OUString& aChars)
      94             :         throw(  ::com::sun::star::xml::sax::SAXException,
      95             :                 ::com::sun::star::uno::RuntimeException );
      96             : 
      97             :         virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces)
      98             :         throw(  ::com::sun::star::xml::sax::SAXException,
      99             :                 ::com::sun::star::uno::RuntimeException );
     100             : 
     101             :         virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget,
     102             :                                                     const rtl::OUString& aData)
     103             :         throw(  ::com::sun::star::xml::sax::SAXException,
     104             :                 ::com::sun::star::uno::RuntimeException );
     105             : 
     106             :         virtual void SAL_CALL setDocumentLocator(
     107             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator)
     108             :         throw(  ::com::sun::star::xml::sax::SAXException,
     109             :                 ::com::sun::star::uno::RuntimeException );
     110             : 
     111             :     private:
     112             :         ::rtl::OUString getErrorLineString();
     113             : 
     114           0 :         class ToolBoxHashMap : public ::boost::unordered_map<   ::rtl::OUString                 ,
     115             :                                                         ToolBox_XML_Entry               ,
     116             :                                                         OUStringHashCode                ,
     117             :                                                         ::std::equal_to< ::rtl::OUString >  >
     118             :         {
     119             :             public:
     120             :                 inline void free()
     121             :                 {
     122             :                     ToolBoxHashMap().swap( *this );
     123             :                 }
     124             :         };
     125             : 
     126             :         sal_Bool                                                                        m_bToolBarStartFound : 1;
     127             :         sal_Bool                                                                        m_bToolBarEndFound : 1;
     128             :         sal_Bool                                                                        m_bToolBarItemStartFound : 1;
     129             :         sal_Bool                                                                        m_bToolBarSpaceStartFound : 1;
     130             :         sal_Bool                                                                        m_bToolBarBreakStartFound : 1;
     131             :         sal_Bool                                                                        m_bToolBarSeparatorStartFound : 1;
     132             :         ToolBoxHashMap                                                                  m_aToolBoxMap;
     133             :         com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >    m_rItemContainer;
     134             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >        m_xLocator;
     135             : 
     136             :         sal_Int32                                                                       m_nHashCode_Style_Radio;
     137             :         sal_Int32                                                                       m_nHashCode_Style_Auto;
     138             :         sal_Int32                                                                       m_nHashCode_Style_Left;
     139             :         sal_Int32                                                                       m_nHashCode_Style_AutoSize;
     140             :         sal_Int32                                                                       m_nHashCode_Style_DropDown;
     141             :         sal_Int32                                                                       m_nHashCode_Style_Repeat;
     142             :         sal_Int32                                                                       m_nHashCode_Style_DropDownOnly;
     143             :         sal_Int32                                                                       m_nHashCode_Style_Text;
     144             :         sal_Int32                                                                       m_nHashCode_Style_Image;
     145             :         rtl::OUString                                                                   m_aType;
     146             :         rtl::OUString                                                                   m_aLabel;
     147             :         rtl::OUString                                                                   m_aStyle;
     148             :         rtl::OUString                                                                   m_aHelpURL;
     149             :         rtl::OUString                                                                   m_aTooltip;
     150             :         rtl::OUString                                                                   m_aIsVisible;
     151             :         rtl::OUString                                                                   m_aCommandURL;
     152             : };
     153             : 
     154             : 
     155             : class FWE_DLLPUBLIC OWriteToolBoxDocumentHandler : private ThreadHelpBase   // Struct for right initalization of lock member! Must be first of baseclasses.
     156             : {
     157             :     public:
     158             :             OWriteToolBoxDocumentHandler(
     159             :             const ::com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& rItemAccess,
     160             :             ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& rDocumentHandler );
     161             :         virtual ~OWriteToolBoxDocumentHandler();
     162             : 
     163             :         void WriteToolBoxDocument() throw
     164             :             ( ::com::sun::star::xml::sax::SAXException,
     165             :               ::com::sun::star::uno::RuntimeException );
     166             : 
     167             :     protected:
     168             :         virtual void WriteToolBoxItem( const rtl::OUString& aCommandURL, const rtl::OUString& aLabel, const rtl::OUString& aHelpURL, const rtl::OUString& aTooltip, sal_Int16 nStyle,
     169             :                                        sal_Int16 nWidth, sal_Bool bVisible ) throw
     170             :             ( ::com::sun::star::xml::sax::SAXException,
     171             :               ::com::sun::star::uno::RuntimeException );
     172             : 
     173             :         virtual void WriteToolBoxSpace() throw
     174             :             ( ::com::sun::star::xml::sax::SAXException,
     175             :               ::com::sun::star::uno::RuntimeException );
     176             : 
     177             :         virtual void WriteToolBoxBreak() throw
     178             :             ( ::com::sun::star::xml::sax::SAXException,
     179             :               ::com::sun::star::uno::RuntimeException );
     180             : 
     181             :         virtual void WriteToolBoxSeparator() throw
     182             :             ( ::com::sun::star::xml::sax::SAXException,
     183             :               ::com::sun::star::uno::RuntimeException );
     184             : 
     185             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >    m_xWriteDocumentHandler;
     186             :         ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >      m_xEmptyList;
     187             :         com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >           m_rItemAccess;
     188             :         ::rtl::OUString                                                                     m_aXMLToolbarNS;
     189             :         ::rtl::OUString                                                                     m_aXMLXlinkNS;
     190             :         ::rtl::OUString                                                                     m_aAttributeType;
     191             :         ::rtl::OUString                                                                     m_aAttributeURL;
     192             : };
     193             : 
     194             : } // namespace framework
     195             : 
     196             : #endif
     197             : 
     198             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10