1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _ASYNCEVENTNOTIFIER_HXX_
29 #define _ASYNCEVENTNOTIFIER_HXX_
31 //------------------------------------------------------------------------
33 //------------------------------------------------------------------------
35 #include <osl/mutex.hxx>
36 #include <osl/conditn.hxx>
37 #include <cppuhelper/interfacecontainer.h>
40 #pragma warning(push, 1)
49 #include "eventnotification.hxx"
51 //---------------------------------------------
53 //---------------------------------------------
55 class CAsyncEventNotifier
58 CAsyncEventNotifier(cppu::OBroadcastHelper
& rBroadcastHelper
);
59 ~CAsyncEventNotifier();
61 bool SAL_CALL
startup(bool bCreateSuspended
= true);
62 void SAL_CALL
shutdown();
64 // notifications may be added the
65 // the event queue but will only
66 // be notified to the clients after
70 // resume notifying events
73 // this class is responsible for the memory management of
74 // the CEventNotification instance
75 void SAL_CALL
notifyEvent(CEventNotification
* EventNotification
);
77 void SAL_CALL
addListener (const ::com::sun::star::uno::Type
& aType
,
78 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xListener
);
79 void SAL_CALL
removeListener(const ::com::sun::star::uno::Type
& aType
,
80 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xListener
);
83 size_t SAL_CALL
getEventListSize();
84 void SAL_CALL
resetNotifyEvent();
85 CEventNotification
* SAL_CALL
getNextEventRecord();
86 void SAL_CALL
removeNextEventRecord();
90 static unsigned int WINAPI
ThreadProc(LPVOID pParam
);
93 std::list
<CEventNotification
*> m_EventList
;
97 ::cppu::OBroadcastHelper
& m_rBroadcastHelper
;
99 HANDLE
& m_NotifyEvent
;
100 HANDLE
& m_ResumeNotifying
;
103 // prevent copy and assignment
105 CAsyncEventNotifier( const CAsyncEventNotifier
& );
106 CAsyncEventNotifier
& operator=( const CAsyncEventNotifier
& );