LCOV - code coverage report
Current view: top level - forms/source/component - EventThread.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2012-08-25 Functions: 0 4 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 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 _FRM_EVENT_THREAD_HXX_
      30                 :            : #define _FRM_EVENT_THREAD_HXX_
      31                 :            : 
      32                 :            : #include <com/sun/star/lang/XEventListener.hpp>
      33                 :            : #include <com/sun/star/lang/EventObject.hpp>
      34                 :            : #include <com/sun/star/lang/XComponent.hpp>
      35                 :            : #include <com/sun/star/awt/XControl.hpp>
      36                 :            : #include <osl/thread.hxx>
      37                 :            : 
      38                 :            : 
      39                 :            : #include <osl/conditn.hxx>
      40                 :            : #include <cppuhelper/component.hxx>
      41                 :            : #include <comphelper/stl_types.hxx>
      42                 :            : #include <comphelper/uno3.hxx>
      43                 :            : using namespace comphelper;
      44                 :            : 
      45                 :            : //.........................................................................
      46                 :            : namespace frm
      47                 :            : {
      48                 :            : //.........................................................................
      49                 :            : 
      50                 :            : // ***************************************************************************************************
      51                 :            : // ***************************************************************************************************
      52                 :            : 
      53                 :            : typedef ::osl::Thread   OComponentEventThread_TBASE;
      54                 :            : class OComponentEventThread
      55                 :            :             :public OComponentEventThread_TBASE
      56                 :            :             ,public ::com::sun::star::lang::XEventListener
      57                 :            :             ,public ::cppu::OWeakObject
      58                 :            : {
      59                 :            :     DECLARE_STL_VECTOR(::com::sun::star::lang::EventObject*, ThreadEvents);
      60                 :            :     DECLARE_STL_VECTOR(::com::sun::star::uno::Reference< ::com::sun::star::uno::XAdapter> , ThreadObjects);
      61                 :            :     DECLARE_STL_VECTOR(sal_Bool,    ThreadBools);
      62                 :            : 
      63                 :            :     ::osl::Mutex                    m_aMutex;
      64                 :            :     ::osl::Condition                m_aCond;            // Queue filled?
      65                 :            :     ThreadEvents                    m_aEvents;          // EventQueue
      66                 :            :     ThreadObjects                   m_aControls;        // Control for Submit
      67                 :            :     ThreadBools                     m_aFlags;           // Flags for Submit/Reset
      68                 :            : 
      69                 :            :     ::cppu::OComponentHelper*                   m_pCompImpl;    // Implementation of the Control
      70                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>   m_xComp; // ::com::sun::star::lang::XComponent of the Control
      71                 :            : 
      72                 :            : protected:
      73                 :            : 
      74                 :            :     // XThread
      75                 :            :     virtual void SAL_CALL run();
      76                 :            : 
      77                 :            :     virtual void SAL_CALL kill();
      78                 :            :     virtual void SAL_CALL onTerminated();
      79                 :            : 
      80                 :            :     // The following method is called to duplicate the Event while respecting it's type.
      81                 :            :     virtual ::com::sun::star::lang::EventObject* cloneEvent(const ::com::sun::star::lang::EventObject* _pEvt) const = 0;
      82                 :            : 
      83                 :            :     // Edit an Event:
      84                 :            :     // The mutex is not locked, but pCompImpl stays valid in any case.
      85                 :            :     // pEvt can be a derrived type, namely the one that cloneEvent returns.
      86                 :            :     // rControl is only set, if a Control has been passed in addEvent.
      87                 :            :     // Because the Control is only held as a WeakRef, it can disappear in the meantime.
      88                 :            :     virtual void processEvent( ::cppu::OComponentHelper* _pCompImpl,
      89                 :            :                                const ::com::sun::star::lang::EventObject* _pEvt,
      90                 :            :                                const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _rControl,
      91                 :            :                                sal_Bool _bFlag) = 0;
      92                 :            : 
      93                 :            : public:
      94                 :            : 
      95                 :            :     // UNO Anbindung
      96                 :          0 :     DECLARE_UNO3_DEFAULTS(OComponentEventThread, OWeakObject);
      97                 :            :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException);
      98                 :            : 
      99                 :            :     OComponentEventThread(::cppu::OComponentHelper* pCompImpl);
     100                 :            :     virtual ~OComponentEventThread();
     101                 :            : 
     102                 :            :     void addEvent( const ::com::sun::star::lang::EventObject* _pEvt, sal_Bool bFlag = sal_False );
     103                 :            :     void addEvent( const ::com::sun::star::lang::EventObject* _pEvt, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& rControl,
     104                 :            :                    sal_Bool bFlag = sal_False );
     105                 :            : 
     106                 :            :     // ::com::sun::star::lang::XEventListener
     107                 :            :     virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException);
     108                 :            : 
     109                 :            : /* resolve ambiguity : both OWeakObject and OObject have these memory operators */
     110                 :          0 :     void * SAL_CALL operator new( size_t size ) throw() { return osl::Thread::operator new(size); }
     111                 :          0 :     void SAL_CALL operator delete( void * p ) throw() { osl::Thread::operator delete(p); }
     112                 :            : 
     113                 :            : private:
     114                 :            :     void    implStarted( );
     115                 :            :     void    implTerminated( );
     116                 :            : 
     117                 :            :     void    impl_clearEventQueue();
     118                 :            : };
     119                 :            : 
     120                 :            : //.........................................................................
     121                 :            : }   // namespace frm
     122                 :            : //.........................................................................
     123                 :            : 
     124                 :            : #endif // _FRM_EVENT_THREAD_HXX_
     125                 :            : 
     126                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10