LCOV - code coverage report
Current view: top level - include/toolkit/controls - eventcontainer.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 5 5 100.0 %
Date: 2014-11-03 Functions: 4 5 80.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_TOOLKIT_CONTROLS_EVENTCONTAINER_HXX
      21             : #define INCLUDED_TOOLKIT_CONTROLS_EVENTCONTAINER_HXX
      22             : 
      23             : #include <osl/diagnose.h>
      24             : #include <com/sun/star/container/XNameContainer.hpp>
      25             : #include <com/sun/star/container/XContainer.hpp>
      26             : 
      27             : #include <toolkit/helper/listenermultiplexer.hxx>
      28             : 
      29             : #include <boost/unordered_map.hpp>
      30             : #include <cppuhelper/implbase2.hxx>
      31             : typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
      32             :                                  ::com::sun::star::container::XContainer > NameContainerHelper;
      33             : 
      34             : 
      35             : namespace toolkit
      36             : {
      37             : 
      38             : // Hashtable to optimize
      39             : typedef boost::unordered_map
      40             : <
      41             :     OUString,
      42             :     sal_Int32,
      43             :     OUStringHash
      44             : >
      45             : NameContainerNameMap;
      46             : 
      47             : 
      48           6 : class NameContainer_Impl : public NameContainerHelper
      49             : {
      50             :     NameContainerNameMap mHashMap;
      51             :     ::com::sun::star::uno::Sequence< OUString > mNames;
      52             :     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > mValues;
      53             :     sal_Int32 mnElementCount;
      54             :     ::com::sun::star::uno::Type mType;
      55             : 
      56             :     ContainerListenerMultiplexer maContainerListeners;
      57             : 
      58             : public:
      59          60 :     NameContainer_Impl( ::com::sun::star::uno::Type const & aType )
      60             :         : mnElementCount( 0 ),
      61             :           mType( aType ),
      62          60 :           maContainerListeners( *this )
      63             :     {
      64          60 :     }
      65             : 
      66             :     // Methods XElementAccess
      67             :     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  )
      68             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      69             :     virtual sal_Bool SAL_CALL hasElements(  )
      70             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      71             : 
      72             :     // Methods XNameAccess
      73             :     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName )
      74             :         throw(::com::sun::star::container::NoSuchElementException,
      75             :               ::com::sun::star::lang::WrappedTargetException,
      76             :               ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      77             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames(  )
      78             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      79             :     virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
      80             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      81             : 
      82             :     // Methods XNameReplace
      83             :     virtual void SAL_CALL replaceByName( const OUString& aName, const ::com::sun::star::uno::Any& aElement )
      84             :         throw(::com::sun::star::lang::IllegalArgumentException,
      85             :               ::com::sun::star::container::NoSuchElementException,
      86             :               ::com::sun::star::lang::WrappedTargetException,
      87             :               ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      88             : 
      89             :     // Methods XNameContainer
      90             :     virtual void SAL_CALL insertByName( const OUString& aName, const ::com::sun::star::uno::Any& aElement )
      91             :         throw(::com::sun::star::lang::IllegalArgumentException,
      92             :               ::com::sun::star::container::ElementExistException,
      93             :               ::com::sun::star::lang::WrappedTargetException,
      94             :               ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             :     virtual void SAL_CALL removeByName( const OUString& Name )
      96             :         throw(::com::sun::star::container::NoSuchElementException,
      97             :               ::com::sun::star::lang::WrappedTargetException,
      98             :               ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      99             : 
     100             :     // Methods XContainer
     101             :     void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener )
     102             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     103             :     void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener )
     104             :         throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     105             : };
     106             : 
     107          12 : class ScriptEventContainer : public NameContainer_Impl
     108             : {
     109             : public:
     110             :     ScriptEventContainer( void );
     111             : };
     112             : 
     113             : 
     114             : }   // namespace toolkit_namecontainer
     115             : 
     116             : #endif // INCLUDED_TOOLKIT_CONTROLS_EVENTCONTAINER_HXX
     117             : 
     118             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10