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

           Branch data     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 _SBA_MULTIPLEX_HXX
      21                 :            : #define _SBA_MULTIPLEX_HXX
      22                 :            : 
      23                 :            : #include <com/sun/star/beans/XVetoableChangeListener.hpp>
      24                 :            : #include <com/sun/star/form/XUpdateListener.hpp>
      25                 :            : #include <com/sun/star/form/XErrorListener.hpp>
      26                 :            : #include <com/sun/star/form/XRestoreListener.hpp>
      27                 :            : #include <com/sun/star/form/XInsertListener.hpp>
      28                 :            : #include <com/sun/star/form/XDeleteListener.hpp>
      29                 :            : #include <com/sun/star/form/XPositioningListener.hpp>
      30                 :            : #include <com/sun/star/form/XDatabaseParameterListener.hpp>
      31                 :            : #include <com/sun/star/form/XLoadListener.hpp>
      32                 :            : #include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
      33                 :            : #include <com/sun/star/beans/XPropertiesChangeListener.hpp>
      34                 :            : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
      35                 :            : #include <com/sun/star/form/XSubmitListener.hpp>
      36                 :            : #include <com/sun/star/form/XResetListener.hpp>
      37                 :            : #include <com/sun/star/util/XRefreshListener.hpp>
      38                 :            : #include <com/sun/star/sdb/XSQLErrorListener.hpp>
      39                 :            : #include <com/sun/star/sdb/XRowSetApproveListener.hpp>
      40                 :            : #include <com/sun/star/sdbc/XRowSetListener.hpp>
      41                 :            : #include <com/sun/star/frame/XStatusListener.hpp>
      42                 :            : #include <comphelper/stl_types.hxx>
      43                 :            : #include <comphelper/uno3.hxx>
      44                 :            : #include <cppuhelper/interfacecontainer.hxx>
      45                 :            : #include <cppuhelper/queryinterface.hxx>
      46                 :            : #include <cppuhelper/weak.hxx>
      47                 :            : 
      48                 :            : namespace dbaui
      49                 :            : {
      50                 :            :     //------------------------------------------------------------------
      51                 :            :     // TODO : replace this class if MM provides an WeakSubObject in cppu
      52         [ #  # ]:          0 :     class OSbaWeakSubObject : public ::cppu::OWeakObject
      53                 :            :     {
      54                 :            :     protected:
      55                 :            :         ::cppu::OWeakObject&    m_rParent;
      56                 :            : 
      57                 :            :     public:
      58                 :          0 :         OSbaWeakSubObject(::cppu::OWeakObject& rParent) : m_rParent(rParent) { }
      59                 :            : 
      60                 :          0 :         virtual void SAL_CALL acquire() throw() { m_rParent.acquire(); }
      61                 :          0 :         virtual void SAL_CALL release() throw() { m_rParent.release(); }
      62                 :            :     };
      63                 :            : 
      64                 :            :     //------------------------------------------------------------------
      65                 :            :     // declaration of a listener multiplexer class
      66                 :            :     #define BEGIN_DECLARE_LISTENER_MULTIPLEXER(classname, listenerclass)                    \
      67                 :            :     class classname                                                                         \
      68                 :            :             :public OSbaWeakSubObject                                                           \
      69                 :            :             ,public listenerclass                                                           \
      70                 :            :             ,public ::cppu::OInterfaceContainerHelper                                       \
      71                 :            :     {                                                                                       \
      72                 :            :     public:                                                                                 \
      73                 :            :         classname( ::cppu::OWeakObject& rSource,                                            \
      74                 :            :             ::osl::Mutex& rMutex);                                                          \
      75                 :            :         DECLARE_UNO3_DEFAULTS(classname, OSbaWeakSubObject);                                    \
      76                 :            :         virtual ::com::sun::star::uno::Any  SAL_CALL queryInterface(                        \
      77                 :            :             const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException); \
      78                 :            :                                                                                             \
      79                 :            :         /* ::com::sun::star::lang::XEventListener */                                        \
      80                 :            :         virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);  \
      81                 :            : 
      82                 :            : 
      83                 :            :     #define DECLARE_MULTIPLEXER_VOID_METHOD(methodname, eventtype)                          \
      84                 :            :         virtual void SAL_CALL methodname(const eventtype& e) throw (::com::sun::star::uno::RuntimeException); \
      85                 :            : 
      86                 :            :     #define DECLARE_MULTIPLEXER_BOOL_METHOD(methodname, eventtype)                          \
      87                 :            :         virtual sal_Bool SAL_CALL methodname(const eventtype& e) throw (::com::sun::star::uno::RuntimeException);   \
      88                 :            : 
      89                 :            : 
      90                 :            :     #define END_DECLARE_LISTENER_MULTIPLEXER()                                              \
      91                 :            :     /* resolve ambiguity : both OWeakObject and OInterfaceContainerHelper have these memory operators */    \
      92                 :            :         void * SAL_CALL operator new( size_t size ) throw() { return OSbaWeakSubObject::operator new(size); }   \
      93                 :            :         void SAL_CALL operator delete( void * p ) throw() { OSbaWeakSubObject::operator delete(p); }    \
      94                 :            :     };                                                                                      \
      95                 :            : 
      96                 :            :     //------------------------------------------------------------------
      97                 :            :     // implementation of a listener multiplexer class
      98                 :            : 
      99                 :            :     #define IMPLEMENT_LISTENER_MULTIPLEXER_CORE(classname, listenerclass)                   \
     100                 :            :                                                                                             \
     101                 :            :     /*................................................................*/                    \
     102                 :            :     classname::classname(::cppu::OWeakObject& rSource, ::osl::Mutex& _rMutex)               \
     103                 :            :             :OSbaWeakSubObject(rSource)                                                     \
     104                 :            :             ,OInterfaceContainerHelper(_rMutex)                                             \
     105                 :            :     {                                                                                       \
     106                 :            :     }                                                                                       \
     107                 :            :                                                                                             \
     108                 :            :     ::com::sun::star::uno::Any  SAL_CALL classname::queryInterface(                         \
     109                 :            :         const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException) \
     110                 :            :     {                                                                                       \
     111                 :            :         ::com::sun::star::uno::Any aReturn =                                                \
     112                 :            :             OSbaWeakSubObject::queryInterface(_rType);                                          \
     113                 :            :         if (!aReturn.hasValue())                                                            \
     114                 :            :             aReturn = ::cppu::queryInterface(_rType,                                        \
     115                 :            :                 static_cast< listenerclass* >(this),                                        \
     116                 :            :                 static_cast< ::com::sun::star::lang::XEventListener* >(static_cast< listenerclass* >(this)) \
     117                 :            :             );                                                                              \
     118                 :            :                                                                                             \
     119                 :            :         return aReturn;                                                                     \
     120                 :            :     }                                                                                       \
     121                 :            :     /*................................................................*/                    \
     122                 :            :     void SAL_CALL classname::disposing(const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException)\
     123                 :            :     {                                                                                       \
     124                 :            :     }                                                                                       \
     125                 :            : 
     126                 :            : 
     127                 :            :     #define IMPLEMENT_LISTENER_MULTIPLEXER_VOID_METHOD(classname, listenerclass, methodname, eventtype) \
     128                 :            :     void SAL_CALL classname::methodname(const eventtype& e) throw (::com::sun::star::uno::RuntimeException) \
     129                 :            :     {                                                                                       \
     130                 :            :         eventtype aMulti(e);                                                                \
     131                 :            :         aMulti.Source = &m_rParent;                                                         \
     132                 :            :         ::cppu::OInterfaceIteratorHelper aIt(*this);                                        \
     133                 :            :         while (aIt.hasMoreElements())                                                       \
     134                 :            :             static_cast< listenerclass*>(aIt.next())->methodname(aMulti);               \
     135                 :            :     }                                                                                       \
     136                 :            : 
     137                 :            :     #define IMPLEMENT_LISTENER_MULTIPLEXER_BOOL_METHOD(classname, listenerclass, methodname, eventtype) \
     138                 :            :     /*................................................................*/                    \
     139                 :            :     sal_Bool SAL_CALL classname::methodname(const eventtype& e) throw (::com::sun::star::uno::RuntimeException) \
     140                 :            :     {                                                                                       \
     141                 :            :         eventtype aMulti(e);                                                                \
     142                 :            :         aMulti.Source = &m_rParent;                                                         \
     143                 :            :         ::cppu::OInterfaceIteratorHelper aIt(*this);                                        \
     144                 :            :         sal_Bool bResult = sal_True;                                                        \
     145                 :            :         while (bResult && aIt.hasMoreElements())                                            \
     146                 :            :             bResult = static_cast< listenerclass*>(aIt.next())->methodname(aMulti);     \
     147                 :            :         return bResult;                                                                     \
     148                 :            :     }                                                                                       \
     149                 :            : 
     150                 :            :     //------------------------------------------------------------------
     151                 :            :     // helper for classes which do event multiplexing
     152                 :            :     #define IMPLEMENT_LISTENER_ADMINISTRATION(classname, listenernamespace, listenerdesc, multiplexer, braodcasterclass, broadcaster) \
     153                 :            :     /*................................................................*/                    \
     154                 :            :     void SAL_CALL classname::add##listenerdesc(const ::com::sun::star::uno::Reference< ::com::sun::star::listenernamespace::X##listenerdesc >& l) throw(::com::sun::star::uno::RuntimeException)\
     155                 :            :     {                                                                                       \
     156                 :            :         multiplexer.addInterface(l);                                                            \
     157                 :            :         if (multiplexer.getLength() == 1)                                                   \
     158                 :            :         {                                                                                   \
     159                 :            :             ::com::sun::star::uno::Reference< braodcasterclass > xBroadcaster(broadcaster, ::com::sun::star::uno::UNO_QUERY);   \
     160                 :            :             if (xBroadcaster.is())                                                          \
     161                 :            :                 xBroadcaster->add##listenerdesc(&multiplexer);                              \
     162                 :            :         }                                                                                   \
     163                 :            :     }                                                                                       \
     164                 :            :     /*................................................................*/                    \
     165                 :            :     void SAL_CALL classname::remove##listenerdesc(const ::com::sun::star::uno::Reference< ::com::sun::star::listenernamespace::X##listenerdesc >& l) throw(::com::sun::star::uno::RuntimeException)\
     166                 :            :     {                                                                                       \
     167                 :            :         if (multiplexer.getLength() == 1)                                                   \
     168                 :            :         {                                                                                   \
     169                 :            :             ::com::sun::star::uno::Reference< braodcasterclass > xBroadcaster(broadcaster, ::com::sun::star::uno::UNO_QUERY);   \
     170                 :            :             if (xBroadcaster.is())                                                          \
     171                 :            :                 xBroadcaster->remove##listenerdesc(&multiplexer);                           \
     172                 :            :         }                                                                                   \
     173                 :            :         multiplexer.removeInterface(l);                                                     \
     174                 :            :     }                                                                                       \
     175                 :            : 
     176                 :            : 
     177                 :            :     #define STOP_MULTIPLEXER_LISTENING(listenerdesc, multiplexer, braodcasterclass, broadcaster) \
     178                 :            :     if (multiplexer.getLength())                                                            \
     179                 :            :     {                                                                                   \
     180                 :            :         ::com::sun::star::uno::Reference< braodcasterclass > xBroadcaster(broadcaster, ::com::sun::star::uno::UNO_QUERY);   \
     181                 :            :         if (xBroadcaster.is())                                                          \
     182                 :            :             xBroadcaster->remove##listenerdesc(&multiplexer);                           \
     183                 :            :     }                                                                                   \
     184                 :            : 
     185                 :            :     #define START_MULTIPLEXER_LISTENING(listenerdesc, multiplexer, braodcasterclass, broadcaster) \
     186                 :            :     if (multiplexer.getLength())                                                        \
     187                 :            :     {                                                                                   \
     188                 :            :         ::com::sun::star::uno::Reference< braodcasterclass > xBroadcaster(broadcaster, ::com::sun::star::uno::UNO_QUERY);   \
     189                 :            :         if (xBroadcaster.is())                                                          \
     190                 :            :             xBroadcaster->add##listenerdesc(&multiplexer);                              \
     191                 :            :     }                                                                                   \
     192                 :            : 
     193                 :            : 
     194                 :            : 
     195                 :            :     //------------------------------------------------------------------
     196                 :            :     // declaration of property listener multiplexers
     197                 :            :     // (with support for specialized and unspecialized property listeners)
     198                 :            : 
     199                 :            :     #define DECLARE_PROPERTY_MULTIPLEXER(classname, listenerclass, methodname, eventtype, exceptions)   \
     200                 :            :     class classname                                                                         \
     201                 :            :             :public OSbaWeakSubObject                                                           \
     202                 :            :             ,public listenerclass                                                           \
     203                 :            :     {                                                                                       \
     204                 :            :         typedef ::cppu::OMultiTypeInterfaceContainerHelperVar<                              \
     205                 :            :                 ::rtl::OUString, ::rtl::OUStringHash, ::comphelper::UStringEqual >  ListenerContainerMap;   \
     206                 :            :         ListenerContainerMap    m_aListeners;                                               \
     207                 :            :                                                                                             \
     208                 :            :     public:                                                                                 \
     209                 :            :         classname( ::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex );                    \
     210                 :            :         DECLARE_UNO3_DEFAULTS(classname, OSbaWeakSubObject);                                    \
     211                 :            :         virtual ::com::sun::star::uno::Any  SAL_CALL queryInterface(                        \
     212                 :            :             const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException); \
     213                 :            :                                                                                             \
     214                 :            :         /* ::com::sun::star::lang::XEventListener */                                        \
     215                 :            :         virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw(::com::sun::star::uno::RuntimeException);  \
     216                 :            :                                                                                             \
     217                 :            :         virtual void SAL_CALL methodname(const eventtype& e)  throw exceptions;             \
     218                 :            :                                                                                             \
     219                 :            :     public:                                                                                 \
     220                 :            :         void addInterface(const ::rtl::OUString& rName, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rListener);    \
     221                 :            :         void removeInterface(const ::rtl::OUString& rName, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rListener); \
     222                 :            :                                                                                             \
     223                 :            :         void disposeAndClear();                                                             \
     224                 :            :                                                                                             \
     225                 :            :         sal_Int32 getOverallLen() const;                                                    \
     226                 :            :                                                                                             \
     227                 :            :         ::cppu::OInterfaceContainerHelper* getContainer(const ::rtl::OUString& rName)       \
     228                 :            :             { return m_aListeners.getContainer(rName); }                                    \
     229                 :            :                                                                                             \
     230                 :            :     protected:                                                                              \
     231                 :            :         void Notify(::cppu::OInterfaceContainerHelper& rListeners, const eventtype& e);     \
     232                 :            :     };                                                                                      \
     233                 :            : 
     234                 :            : 
     235                 :            :     //------------------------------------------------------------------
     236                 :            :     // implementation of property listener multiplexers
     237                 :            :     #define IMPLEMENT_PROPERTY_MULTIPLEXER(classname, listenerclass, methodname, eventtype, exceptions) \
     238                 :            :     /*................................................................*/                    \
     239                 :            :     classname::classname(::cppu::OWeakObject& rSource, ::osl::Mutex& rMutex)                \
     240                 :            :             :OSbaWeakSubObject(rSource)                                                     \
     241                 :            :             ,m_aListeners(rMutex)                                                           \
     242                 :            :     {                                                                                       \
     243                 :            :     }                                                                                       \
     244                 :            :                                                                                             \
     245                 :            :     ::com::sun::star::uno::Any  SAL_CALL classname::queryInterface(                         \
     246                 :            :         const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException) \
     247                 :            :     {                                                                                       \
     248                 :            :         ::com::sun::star::uno::Any aReturn =                                                \
     249                 :            :             OSbaWeakSubObject::queryInterface(_rType);                                          \
     250                 :            :         if (!aReturn.hasValue())                                                            \
     251                 :            :             aReturn = ::cppu::queryInterface(_rType,                                        \
     252                 :            :                 static_cast< listenerclass* >(this),                                        \
     253                 :            :                 static_cast< ::com::sun::star::lang::XEventListener* >(static_cast< listenerclass* >(this)) \
     254                 :            :             );                                                                              \
     255                 :            :                                                                                             \
     256                 :            :         return aReturn;                                                                     \
     257                 :            :     }                                                                                       \
     258                 :            :     /*................................................................*/                    \
     259                 :            :     void SAL_CALL classname::disposing(const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException)\
     260                 :            :     {                                                                                       \
     261                 :            :     }                                                                                       \
     262                 :            :                                                                                             \
     263                 :            :     void SAL_CALL classname::methodname(const eventtype& e) throw exceptions                \
     264                 :            :     {                                                                                       \
     265                 :            :         ::cppu::OInterfaceContainerHelper* pListeners = m_aListeners.getContainer(e.PropertyName);  \
     266                 :            :         if (pListeners)                                                                     \
     267                 :            :             Notify(*pListeners, e);                                                         \
     268                 :            :                                                                                             \
     269                 :            :         /* do the notification for the unspecialized listeners, too */                      \
     270                 :            :         pListeners = m_aListeners.getContainer(::rtl::OUString());                          \
     271                 :            :         if (pListeners)                                                                     \
     272                 :            :             Notify(*pListeners, e);                                                         \
     273                 :            :     }                                                                                       \
     274                 :            :                                                                                             \
     275                 :            :     void classname::addInterface(const ::rtl::OUString& rName,                              \
     276                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rListener)    \
     277                 :            :     {                                                                                       \
     278                 :            :         m_aListeners.addInterface(rName, rListener);                                        \
     279                 :            :     }                                                                                       \
     280                 :            :                                                                                             \
     281                 :            :     void classname::removeInterface(const ::rtl::OUString& rName,                           \
     282                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rListener)    \
     283                 :            :     {                                                                                       \
     284                 :            :         m_aListeners.removeInterface(rName, rListener);                                     \
     285                 :            :     }                                                                                       \
     286                 :            :                                                                                             \
     287                 :            :     void classname::disposeAndClear()                                                       \
     288                 :            :     {                                                                                       \
     289                 :            :         ::com::sun::star::lang::EventObject aEvt(m_rParent);                                \
     290                 :            :         m_aListeners.disposeAndClear(aEvt);                                                             \
     291                 :            :     }                                                                                       \
     292                 :            :                                                                                             \
     293                 :            :     sal_Int32 classname::getOverallLen() const                                              \
     294                 :            :     {                                                                                       \
     295                 :            :         sal_Int32 nLen = 0;                                                                 \
     296                 :            :         ::com::sun::star::uno::Sequence< ::rtl::OUString > aContained = m_aListeners.getContainedTypes();   \
     297                 :            :         const ::rtl::OUString* pContained = aContained.getConstArray();                     \
     298                 :            :         for (   sal_Int32 i=0; i<aContained.getLength(); ++i, ++pContained)                 \
     299                 :            :             nLen += m_aListeners.getContainer(*pContained)->getLength();                    \
     300                 :            :         return nLen;                                                                        \
     301                 :            :     }                                                                                       \
     302                 :            :                                                                                             \
     303                 :            :     void classname::Notify(::cppu::OInterfaceContainerHelper& rListeners, const eventtype& e)   \
     304                 :            :     {                                                                                       \
     305                 :            :         eventtype aMulti(e);                                                                \
     306                 :            :         aMulti.Source = &m_rParent;                                                         \
     307                 :            :         ::cppu::OInterfaceIteratorHelper aIt(rListeners);                                   \
     308                 :            :         while (aIt.hasMoreElements())                                                       \
     309                 :            :             static_cast< listenerclass*>(aIt.next())->methodname(aMulti);               \
     310                 :            :     }                                                                                       \
     311                 :            : 
     312                 :            :     //------------------------------------------------------------------
     313                 :            :     // helper for classes which do property event multiplexing
     314                 :            :     #define IMPLEMENT_PROPERTY_LISTENER_ADMINISTRATION(classname, listenerdesc, multiplexer, braodcasterclass, broadcaster) \
     315                 :            :     /*................................................................*/                    \
     316                 :            :     void SAL_CALL classname::add##listenerdesc(const ::rtl::OUString& rName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::X##listenerdesc >& l ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)\
     317                 :            :     {                                                                                       \
     318                 :            :         multiplexer.addInterface(rName, l);                                                 \
     319                 :            :         if (multiplexer.getOverallLen() == 1)                                               \
     320                 :            :         {                                                                                   \
     321                 :            :             ::com::sun::star::uno::Reference< braodcasterclass > xBroadcaster(broadcaster, ::com::sun::star::uno::UNO_QUERY);   \
     322                 :            :             if (xBroadcaster.is())                                                          \
     323                 :            :                 xBroadcaster->add##listenerdesc(::rtl::OUString(), &multiplexer);                           \
     324                 :            :         }                                                                                   \
     325                 :            :     }                                                                                       \
     326                 :            :     /*................................................................*/                    \
     327                 :            :     void SAL_CALL classname::remove##listenerdesc(const ::rtl::OUString& rName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::X##listenerdesc >& l ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)\
     328                 :            :     {                                                                                       \
     329                 :            :         if (multiplexer.getOverallLen() == 1)                                               \
     330                 :            :         {                                                                                   \
     331                 :            :             ::com::sun::star::uno::Reference< braodcasterclass > xBroadcaster(broadcaster, ::com::sun::star::uno::UNO_QUERY);   \
     332                 :            :             if (xBroadcaster.is())                                                          \
     333                 :            :                 xBroadcaster->remove##listenerdesc(::rtl::OUString(), &multiplexer);                        \
     334                 :            :         }                                                                                   \
     335                 :            :         multiplexer.removeInterface(rName, l);                                              \
     336                 :            :     }                                                                                       \
     337                 :            : 
     338                 :            :     #define STOP_PROPERTY_MULTIPLEXER_LISTENING(listenerdesc, multiplexer, braodcasterclass, broadcaster) \
     339                 :            :     if (multiplexer.getOverallLen())                                                        \
     340                 :            :     {                                                                                       \
     341                 :            :         ::com::sun::star::uno::Reference< braodcasterclass > xBroadcaster(broadcaster, ::com::sun::star::uno::UNO_QUERY);   \
     342                 :            :         if (xBroadcaster.is())                                                              \
     343                 :            :             xBroadcaster->remove##listenerdesc(::rtl::OUString(), &multiplexer);                            \
     344                 :            :     }                                                                                       \
     345                 :            : 
     346                 :            :     #define START_PROPERTY_MULTIPLEXER_LISTENING(listenerdesc, multiplexer, braodcasterclass, broadcaster) \
     347                 :            :     if (multiplexer.getOverallLen())                                                        \
     348                 :            :     {                                                                                       \
     349                 :            :         ::com::sun::star::uno::Reference< braodcasterclass > xBroadcaster(broadcaster, ::com::sun::star::uno::UNO_QUERY);   \
     350                 :            :         if (xBroadcaster.is())                                                              \
     351                 :            :             xBroadcaster->add##listenerdesc(::rtl::OUString(), &multiplexer);                               \
     352                 :            :     }                                                                                       \
     353                 :            : 
     354                 :            : 
     355                 :            : 
     356                 :            :     //==================================================================
     357                 :            :     // some listener multiplexers
     358                 :            :     //==================================================================
     359                 :            :     // ::com::sun::star::frame::XStatusListener
     360 [ #  # ][ #  # ]:          0 :     BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXStatusMultiplexer, ::com::sun::star::frame::XStatusListener)
                 [ #  # ]
     361                 :            :         DECLARE_MULTIPLEXER_VOID_METHOD(statusChanged, ::com::sun::star::frame::FeatureStateEvent)
     362                 :            : 
     363                 :            :     private:
     364                 :            :         ::com::sun::star::frame::FeatureStateEvent  m_aLastKnownStatus;
     365                 :            :     public:                                                                                 \
     366                 :          0 :         inline ::com::sun::star::frame::FeatureStateEvent getLastEvent( ) const { return m_aLastKnownStatus; }
     367                 :          0 :     END_DECLARE_LISTENER_MULTIPLEXER()
     368                 :            : 
     369                 :            :     // ::com::sun::star::form::XLoadListener
     370 [ #  # ][ #  # ]:          0 :     BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXLoadMultiplexer, ::com::sun::star::form::XLoadListener)
     371                 :            :         DECLARE_MULTIPLEXER_VOID_METHOD(loaded, ::com::sun::star::lang::EventObject)
     372                 :            :         DECLARE_MULTIPLEXER_VOID_METHOD(unloaded, ::com::sun::star::lang::EventObject)
     373                 :            :         DECLARE_MULTIPLEXER_VOID_METHOD(unloading, ::com::sun::star::lang::EventObject)
     374                 :            :         DECLARE_MULTIPLEXER_VOID_METHOD(reloading, ::com::sun::star::lang::EventObject)
     375                 :            :         DECLARE_MULTIPLEXER_VOID_METHOD(reloaded, ::com::sun::star::lang::EventObject)
     376                 :          0 :     END_DECLARE_LISTENER_MULTIPLEXER()
     377                 :            : 
     378                 :            :     // ::com::sun::star::form::XDatabaseParameterListener
     379 [ #  # ][ #  # ]:          0 :     BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXParameterMultiplexer, ::com::sun::star::form::XDatabaseParameterListener)
     380                 :            :         DECLARE_MULTIPLEXER_BOOL_METHOD(approveParameter, ::com::sun::star::form::DatabaseParameterEvent)
     381                 :          0 :     END_DECLARE_LISTENER_MULTIPLEXER()
     382                 :            : 
     383                 :            :     // ::com::sun::star::form::XSubmitListener
     384 [ #  # ][ #  # ]:          0 :     BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXSubmitMultiplexer, ::com::sun::star::form::XSubmitListener)
     385                 :            :         DECLARE_MULTIPLEXER_BOOL_METHOD(approveSubmit, ::com::sun::star::lang::EventObject)
     386                 :          0 :     END_DECLARE_LISTENER_MULTIPLEXER()
     387                 :            : 
     388                 :            :     // ::com::sun::star::form::XResetListener
     389 [ #  # ][ #  # ]:          0 :     BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXResetMultiplexer, ::com::sun::star::form::XResetListener)
     390                 :            :         DECLARE_MULTIPLEXER_BOOL_METHOD(approveReset, ::com::sun::star::lang::EventObject)
     391                 :            :         DECLARE_MULTIPLEXER_VOID_METHOD(resetted, ::com::sun::star::lang::EventObject)
     392                 :          0 :     END_DECLARE_LISTENER_MULTIPLEXER()
     393                 :            : 
     394                 :            :     // ::com::sun::star::sdbc::XRowSetListener
     395 [ #  # ][ #  # ]:          0 :     BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXRowSetMultiplexer, ::com::sun::star::sdbc::XRowSetListener)
     396                 :            :         DECLARE_MULTIPLEXER_VOID_METHOD(cursorMoved, ::com::sun::star::lang::EventObject)
     397                 :            :         DECLARE_MULTIPLEXER_VOID_METHOD(rowChanged, ::com::sun::star::lang::EventObject)
     398                 :            :         DECLARE_MULTIPLEXER_VOID_METHOD(rowSetChanged, ::com::sun::star::lang::EventObject)
     399                 :          0 :     END_DECLARE_LISTENER_MULTIPLEXER()
     400                 :            : 
     401                 :            :     // ::com::sun::star::sdb::XRowSetApproveListener
     402 [ #  # ][ #  # ]:          0 :     BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXRowSetApproveMultiplexer, ::com::sun::star::sdb::XRowSetApproveListener)
     403                 :            :         DECLARE_MULTIPLEXER_BOOL_METHOD(approveCursorMove, ::com::sun::star::lang::EventObject)
     404                 :            :         DECLARE_MULTIPLEXER_BOOL_METHOD(approveRowChange, ::com::sun::star::sdb::RowChangeEvent)
     405                 :            :         DECLARE_MULTIPLEXER_BOOL_METHOD(approveRowSetChange, ::com::sun::star::lang::EventObject)
     406                 :          0 :     END_DECLARE_LISTENER_MULTIPLEXER()
     407                 :            : 
     408                 :            :     // ::com::sun::star::sdb::XSQLErrorListener
     409 [ #  # ][ #  # ]:          0 :     BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXSQLErrorMultiplexer, ::com::sun::star::sdb::XSQLErrorListener)
     410                 :            :         DECLARE_MULTIPLEXER_VOID_METHOD(errorOccured, ::com::sun::star::sdb::SQLErrorEvent)
     411                 :          0 :     END_DECLARE_LISTENER_MULTIPLEXER()
     412                 :            : 
     413                 :            :     // ::com::sun::star::beans::XPropertyChangeListener
     414 [ #  # ][ #  # ]:          0 :     DECLARE_PROPERTY_MULTIPLEXER(SbaXPropertyChangeMultiplexer, ::com::sun::star::beans::XPropertyChangeListener, propertyChange, ::com::sun::star::beans::PropertyChangeEvent, (::com::sun::star::uno::RuntimeException))
     415                 :            : 
     416                 :            :     // ::com::sun::star::beans::XVetoableChangeListener
     417 [ #  # ][ #  # ]:          0 :     DECLARE_PROPERTY_MULTIPLEXER(SbaXVetoableChangeMultiplexer, ::com::sun::star::beans::XVetoableChangeListener, vetoableChange, ::com::sun::star::beans::PropertyChangeEvent, (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException))
     418                 :            : 
     419                 :            :     // ::com::sun::star::beans::XPropertiesChangeListener
     420 [ #  # ][ #  # ]:          0 :     BEGIN_DECLARE_LISTENER_MULTIPLEXER(SbaXPropertiesChangeMultiplexer, ::com::sun::star::beans::XPropertiesChangeListener)
     421                 :            :         DECLARE_MULTIPLEXER_VOID_METHOD(propertiesChange, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >)
     422                 :          0 :     END_DECLARE_LISTENER_MULTIPLEXER()
     423                 :            :     // the SbaXPropertiesChangeMultiplexer doesn't care about the property names a listener logs on for, it simply
     424                 :            :     // forwards _all_ changes to _all_ listeners
     425                 :            : }
     426                 :            : 
     427                 :            : #endif // _SBA_MULTIPLEXER_HXX
     428                 :            : 
     429                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10