LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/framework/inc/services - ContextChangeEventMultiplexer.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2013-07-09 Functions: 3 3 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             : #ifndef __FRAMEWORK_SERVICES_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_
      20             : #define __FRAMEWORK_SERVICES_CONTEXT_CHANGE_EVENT_MULTIPLEXER_HXX_
      21             : 
      22             : #include <com/sun/star/ui/XContextChangeEventMultiplexer.hpp>
      23             : 
      24             : #include <cppuhelper/compbase4.hxx>
      25             : #include <cppuhelper/basemutex.hxx>
      26             : 
      27             : #include "macros/xserviceinfo.hxx"
      28             : 
      29             : #include <map>
      30             : #include <boost/noncopyable.hpp>
      31             : 
      32             : 
      33             : namespace
      34             : {
      35             :     typedef ::cppu::WeakComponentImplHelper4 <
      36             :         css::ui::XContextChangeEventMultiplexer,
      37             :         css::lang::XSingleComponentFactory,
      38             :         css::lang::XServiceInfo,
      39             :         css::lang::XEventListener
      40             :         > ContextChangeEventMultiplexerInterfaceBase;
      41             : }
      42             : 
      43             : 
      44             : namespace css = ::com::sun::star;
      45             : namespace cssu = ::com::sun::star::uno;
      46             : namespace cssl = ::com::sun::star::lang;
      47             : 
      48             : namespace framework {
      49             : 
      50             : class ContextChangeEventMultiplexer
      51             :     : private ::boost::noncopyable,
      52             :       private ::cppu::BaseMutex,
      53             :       public ContextChangeEventMultiplexerInterfaceBase
      54             : {
      55             : public:
      56             :     ContextChangeEventMultiplexer(const cssu::Reference<css::uno::XComponentContext>& rxContext);
      57             :     virtual ~ContextChangeEventMultiplexer (void);
      58             : 
      59             :     virtual void SAL_CALL disposing (void);
      60             : 
      61             :     // XContextChangeEventMultiplexer
      62             :     virtual void SAL_CALL addContextChangeEventListener (
      63             :         const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener,
      64             :         const cssu::Reference<cssu::XInterface>& rxEventFocus)
      65             :         throw(cssu::RuntimeException, cssl::IllegalArgumentException);
      66             :     virtual void SAL_CALL removeContextChangeEventListener (
      67             :         const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener,
      68             :         const cssu::Reference<cssu::XInterface>& rxEventFocus)
      69             :         throw(cssu::RuntimeException, cssl::IllegalArgumentException);
      70             :     virtual void SAL_CALL removeAllContextChangeEventListeners (
      71             :         const cssu::Reference<css::ui::XContextChangeEventListener>& rxListener)
      72             :         throw(cssu::RuntimeException, cssl::IllegalArgumentException);
      73             :     virtual void SAL_CALL broadcastContextChangeEvent (
      74             :         const css::ui::ContextChangeEventObject& rContextChangeEventObject,
      75             :         const cssu::Reference<cssu::XInterface>& rxEventFocus)
      76             :         throw(cssu::RuntimeException);
      77             : 
      78             :     // XSingleComponentFactory
      79             :     virtual cssu::Reference<cssu::XInterface> SAL_CALL createInstanceWithContext (
      80             :         const cssu::Reference<cssu::XComponentContext>& rxContext)
      81             :         throw (cssu::Exception, cssu::RuntimeException);
      82             :     virtual cssu::Reference<cssu::XInterface > SAL_CALL createInstanceWithArgumentsAndContext (
      83             :         const cssu::Sequence<cssu::Any>& rArguments,
      84             :         const cssu::Reference<cssu::XComponentContext>& rxContext)
      85             :         throw (cssu::Exception, cssu::RuntimeException);
      86             : 
      87             :     // XServiceInfo
      88             :     virtual ::rtl::OUString SAL_CALL getImplementationName (void)
      89             :         throw (cssu::RuntimeException);
      90             :     virtual sal_Bool SAL_CALL supportsService  (
      91             :         const ::rtl::OUString& rsServiceName)
      92             :         throw (cssu::RuntimeException);
      93             :     virtual cssu::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void)
      94             :         throw (cssu::RuntimeException);
      95             : 
      96             :     // XEventListener
      97             :     virtual void SAL_CALL disposing (
      98             :         const css::lang::EventObject& rEvent)
      99             :         throw (cssu::RuntimeException);
     100             : 
     101             :     static ::rtl::OUString SAL_CALL impl_getStaticImplementationName (void);
     102             :     static cssu::Reference<cssu::XInterface> SAL_CALL impl_createFactory (
     103             :         const cssu::Reference<cssl::XMultiServiceFactory>& xServiceManager);
     104             : 
     105             : private:
     106             :     typedef ::std::vector<cssu::Reference<css::ui::XContextChangeEventListener> > ListenerContainer;
     107        6270 :     class FocusDescriptor
     108             :     {
     109             :     public:
     110             :         ListenerContainer maListeners;
     111             :         ::rtl::OUString msCurrentApplicationName;
     112             :         ::rtl::OUString msCurrentContextName;
     113             :     };
     114             :     typedef ::std::map<cssu::Reference<cssu::XInterface>, FocusDescriptor> ListenerMap;
     115             :     ListenerMap maListeners;
     116             : 
     117             :     /** Notify all listeners in the container that is associated with
     118             :         the given event focus.
     119             : 
     120             :         Typically called twice from broadcastEvent(), once for the
     121             :         given event focus and onece for NULL.
     122             :     */
     123             :     void BroadcastEventToSingleContainer (
     124             :         const css::ui::ContextChangeEventObject& rEventObject,
     125             :         const cssu::Reference<cssu::XInterface>& rxEventFocus);
     126             :     FocusDescriptor* GetFocusDescriptor (
     127             :         const cssu::Reference<cssu::XInterface>& rxEventFocus,
     128             :         const bool bCreateWhenMissing);
     129             : 
     130             :     static cssu::Sequence< ::rtl::OUString > SAL_CALL static_GetSupportedServiceNames (void);
     131             :     static cssu::Reference<cssu::XInterface> SAL_CALL static_CreateInstance (
     132             :         const cssu::Reference<cssu::XComponentContext>& rxComponentContext)
     133             :         throw (cssu::Exception);
     134             : };
     135             : 
     136             : } // end of namespace framework
     137             : 
     138             : #endif
     139             : 
     140             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10