LCOV - code coverage report
Current view: top level - svx/source/inc - formfeaturedispatcher.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 1 0.0 %
Date: 2014-11-03 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_SVX_SOURCE_INC_FORMFEATUREDISPATCHER_HXX
      21             : #define INCLUDED_SVX_SOURCE_INC_FORMFEATUREDISPATCHER_HXX
      22             : 
      23             : #include <com/sun/star/frame/XDispatch.hpp>
      24             : #include <com/sun/star/lang/DisposedException.hpp>
      25             : #include <com/sun/star/form/runtime/XFormOperations.hpp>
      26             : 
      27             : #include <cppuhelper/implbase1.hxx>
      28             : #include <cppuhelper/interfacecontainer.hxx>
      29             : 
      30             : 
      31             : namespace svx
      32             : {
      33             : 
      34             :     typedef ::cppu::WeakImplHelper1 <   ::com::sun::star::frame::XDispatch
      35             :                                     >   OSingleFeatureDispatcher_Base;
      36             : 
      37           0 :     class OSingleFeatureDispatcher : public OSingleFeatureDispatcher_Base
      38             :     {
      39             :     private:
      40             :         ::osl::Mutex&                       m_rMutex;
      41             :         ::cppu::OInterfaceContainerHelper   m_aStatusListeners;
      42             :         ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >
      43             :                                             m_xFormOperations;
      44             :         const ::com::sun::star::util::URL   m_aFeatureURL;
      45             :         ::com::sun::star::uno::Any          m_aLastKnownState;
      46             :         const sal_Int16                     m_nFormFeature;
      47             :         bool                            m_bLastKnownEnabled;
      48             :         bool                            m_bDisposed;
      49             : 
      50             :     public:
      51             :         /** constructs the dispatcher
      52             : 
      53             :             @param _rFeatureURL
      54             :                 the URL of the feature which this instance is responsible for
      55             : 
      56             :             @param _nFeatureId
      57             :                 the feature which this instance is responsible for
      58             : 
      59             :             @param _rController
      60             :                 the controller which is responsible for providing the state of feature of this instance,
      61             :                 and for executing it. After disposing the dispatcher instance, the controller will
      62             :                 not be accessed anymore
      63             : 
      64             :             @see dispose
      65             :         */
      66             :         OSingleFeatureDispatcher(
      67             :             const ::com::sun::star::util::URL& _rFeatureURL,
      68             :             const sal_Int16 _nFormFeature,
      69             :             const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >& _rxFormOperations,
      70             :             ::osl::Mutex& _rMutex
      71             :         );
      72             : 
      73             :         /** notifies all our listeners of the current state
      74             :         */
      75             :         void    updateAllListeners();
      76             : 
      77             :     protected:
      78             :         // XDispatch
      79             :         virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& _rURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      80             :         virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxControl, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      81             :         virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxControl, const ::com::sun::star::util::URL& _rURL ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      82             : 
      83             :     protected:
      84             :         /** notifies our current state to one or all listeners
      85             : 
      86             :             @param _rxListener
      87             :                 the listener to notify. May be NULL, in this case all our listeners will be
      88             :                 notified with the current state
      89             : 
      90             :             @param _rFreeForNotification
      91             :                 a guard which currently locks our mutex, and which is to be cleared
      92             :                 for actually doing the notification(s)
      93             :         */
      94             :         void    notifyStatus(
      95             :                     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener,
      96             :                     ::osl::ClearableMutexGuard& _rFreeForNotification
      97             :                 );
      98             : 
      99             :     private:
     100             :         /** checks whether our instance is alive
     101             : 
     102             :             If the instance already received a <member>dispose</member> call, then a
     103             :             <type scope="com::sun::star::lang">DisposedException</type> is thrown.
     104             : 
     105             :             @precond
     106             :                 our Mutex is locked - else calling the method would not make sense, since
     107             :                 its result could be out-of-date as soon as it's returned to the caller.
     108             :         */
     109             :         void    checkAlive() const;
     110             : 
     111             :         /** retrieves the current status of our feature, in a format which can be used
     112             :             for UNO notifications
     113             : 
     114             :             @precond
     115             :                 our mutex is locked
     116             :         */
     117             :         void    getUnoState( ::com::sun::star::frame::FeatureStateEvent& /* [out] */ _rState ) const;
     118             :     };
     119             : 
     120             : 
     121             : }   // namespace svx
     122             : 
     123             : 
     124             : #endif
     125             : 
     126             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10