LCOV - code coverage report
Current view: top level - svx/source/inc - formfeaturedispatcher.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-08-25 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 4 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef SVX_FMDISPATCH_HXX
      30                 :            : #define SVX_FMDISPATCH_HXX
      31                 :            : 
      32                 :            : #include <com/sun/star/frame/XDispatch.hpp>
      33                 :            : #include <com/sun/star/lang/DisposedException.hpp>
      34                 :            : #include <com/sun/star/form/runtime/XFormOperations.hpp>
      35                 :            : 
      36                 :            : #include <cppuhelper/implbase1.hxx>
      37                 :            : #include <cppuhelper/interfacecontainer.hxx>
      38                 :            : 
      39                 :            : //........................................................................
      40                 :            : namespace svx
      41                 :            : {
      42                 :            : //........................................................................
      43                 :            : 
      44                 :            :     //====================================================================
      45                 :            :     //= OSingleFeatureDispatcher
      46                 :            :     //====================================================================
      47                 :            :     typedef ::cppu::WeakImplHelper1 <   ::com::sun::star::frame::XDispatch
      48                 :            :                                     >   OSingleFeatureDispatcher_Base;
      49                 :            : 
      50 [ #  # ][ #  # ]:          0 :     class OSingleFeatureDispatcher : public OSingleFeatureDispatcher_Base
      51                 :            :     {
      52                 :            :     private:
      53                 :            :         ::osl::Mutex&                       m_rMutex;
      54                 :            :         ::cppu::OInterfaceContainerHelper   m_aStatusListeners;
      55                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >
      56                 :            :                                             m_xFormOperations;
      57                 :            :         const ::com::sun::star::util::URL   m_aFeatureURL;
      58                 :            :         ::com::sun::star::uno::Any          m_aLastKnownState;
      59                 :            :         const sal_Int16                     m_nFormFeature;
      60                 :            :         sal_Bool                            m_bLastKnownEnabled;
      61                 :            :         sal_Bool                            m_bDisposed;
      62                 :            : 
      63                 :            :     public:
      64                 :            :         /** constructs the dispatcher
      65                 :            : 
      66                 :            :             @param _rFeatureURL
      67                 :            :                 the URL of the feature which this instance is responsible for
      68                 :            : 
      69                 :            :             @param _nFeatureId
      70                 :            :                 the feature which this instance is responsible for
      71                 :            : 
      72                 :            :             @param _rController
      73                 :            :                 the controller which is responsible for providing the state of feature of this instance,
      74                 :            :                 and for executing it. After disposing the dispatcher instance, the controller will
      75                 :            :                 not be accessed anymore
      76                 :            : 
      77                 :            :             @see dispose
      78                 :            :         */
      79                 :            :         OSingleFeatureDispatcher(
      80                 :            :             const ::com::sun::star::util::URL& _rFeatureURL,
      81                 :            :             const sal_Int16 _nFormFeature,
      82                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormOperations >& _rxFormOperations,
      83                 :            :             ::osl::Mutex& _rMutex
      84                 :            :         );
      85                 :            : 
      86                 :            :         /** notifies all our listeners of the current state
      87                 :            :         */
      88                 :            :         void    updateAllListeners();
      89                 :            : 
      90                 :            :     protected:
      91                 :            :         // XDispatch
      92                 :            :         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);
      93                 :            :         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);
      94                 :            :         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);
      95                 :            : 
      96                 :            :     protected:
      97                 :            :         /** notifies our current state to one or all listeners
      98                 :            : 
      99                 :            :             @param _rxListener
     100                 :            :                 the listener to notify. May be NULL, in this case all our listeners will be
     101                 :            :                 notified with the current state
     102                 :            : 
     103                 :            :             @param _rFreeForNotification
     104                 :            :                 a guard which currently locks our mutex, and which is to be cleared
     105                 :            :                 for actually doing the notification(s)
     106                 :            :         */
     107                 :            :         void    notifyStatus(
     108                 :            :                     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _rxListener,
     109                 :            :                     ::osl::ClearableMutexGuard& _rFreeForNotification
     110                 :            :                 );
     111                 :            : 
     112                 :            :     private:
     113                 :            :         /** checks whether our instance is alive
     114                 :            : 
     115                 :            :             If the instance already received a <member>dispose</member> call, then a
     116                 :            :             <type scope="com::sun::star::lang">DisposedException</type> is thrown.
     117                 :            : 
     118                 :            :             @precond
     119                 :            :                 our Mutex is locked - else calling the method would not make sense, since
     120                 :            :                 it's result could be out-of-date as soon as it's returned to the caller.
     121                 :            :         */
     122                 :            :         void    checkAlive() const SAL_THROW((::com::sun::star::lang::DisposedException));
     123                 :            : 
     124                 :            :         /** retrieves the current status of our feature, in a format which can be used
     125                 :            :             for UNO notifications
     126                 :            : 
     127                 :            :             @precond
     128                 :            :                 our mutex is locked
     129                 :            :         */
     130                 :            :         void    getUnoState( ::com::sun::star::frame::FeatureStateEvent& /* [out] */ _rState ) const;
     131                 :            :     };
     132                 :            : 
     133                 :            : //........................................................................
     134                 :            : }   // namespace svx
     135                 :            : //........................................................................
     136                 :            : 
     137                 :            : #endif
     138                 :            : 
     139                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10