2 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: documenteventnotifier.hxx,v $
11 * $Revision: 1.1.2.3 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef DBACCESS_DOCUMENTEVENTNOTIFIER_HXX
32 #define DBACCESS_DOCUMENTEVENTNOTIFIER_HXX
34 /** === begin UNO includes === **/
35 #include <com/sun/star/document/XEventListener.hpp>
36 #include <com/sun/star/document/XDocumentEventListener.hpp>
37 /** === end UNO includes === **/
39 #include <rtl/ref.hxx>
46 //........................................................................
49 //........................................................................
51 class DocumentEventNotifier_Impl
;
52 //====================================================================
53 //= DocumentEventNotifier
54 //====================================================================
55 class DocumentEventNotifier
58 DocumentEventNotifier( ::cppu::OWeakObject
& _rBroadcasterDocument
, ::osl::Mutex
& _rMutex
);
59 ~DocumentEventNotifier();
61 void addLegacyEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::document::XEventListener
>& _Listener
);
62 void removeLegacyEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::document::XEventListener
>& _Listener
);
63 void addDocumentEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::document::XDocumentEventListener
>& _Listener
);
64 void removeDocumentEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::document::XDocumentEventListener
>& _Listener
);
66 /** disposes the instance
68 the mutex is not locked
72 /** tells the instance that its document is completely initialized now.
74 Before you call this method, no notification will actually happen
79 void onDocumentInitialized();
81 /** notifies a document event described by the given parameters
84 the mutex is not locked
86 ->onDocumentInitialized has been called
88 void notifyDocumentEvent(
89 const ::rtl::OUString
& _EventName
,
90 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController2
>& _rxViewController
= NULL
,
91 const ::com::sun::star::uno::Any
& _Supplement
= ::com::sun::star::uno::Any()
94 /** notifies a document event, described by the given parameters, asynchronously
96 Note that no event is actually notified before you called ->onDocumentInitialized.
101 void notifyDocumentEventAsync(
102 const ::rtl::OUString
& _EventName
,
103 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController2
>& _ViewController
= NULL
,
104 const ::com::sun::star::uno::Any
& _Supplement
= ::com::sun::star::uno::Any()
107 /** notifies a document event to all registered listeners
110 the mutex is not locked
112 ->onDocumentInitialized has been called
114 void notifyDocumentEvent(
115 const sal_Char
* _pAsciiEventName
,
116 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController2
>& _rxViewController
= NULL
,
117 const ::com::sun::star::uno::Any
& _rSupplement
= ::com::sun::star::uno::Any()
120 notifyDocumentEvent( ::rtl::OUString::createFromAscii( _pAsciiEventName
), _rxViewController
, _rSupplement
);
123 /** notifies a document event to all registered listeners, asynchronously
125 Note that no event is actually notified before you called ->onDocumentInitialized.
130 void notifyDocumentEventAsync(
131 const sal_Char
* _pAsciiEventName
,
132 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController2
>& _rxViewController
= NULL
,
133 const ::com::sun::star::uno::Any
& _rSupplement
= ::com::sun::star::uno::Any()
136 notifyDocumentEventAsync( ::rtl::OUString::createFromAscii( _pAsciiEventName
), _rxViewController
, _rSupplement
);
140 ::rtl::Reference
< DocumentEventNotifier_Impl
> m_pImpl
;
143 //........................................................................
144 } // namespace dbaccess
145 //........................................................................
147 #endif // DBACCESS_DOCUMENTEVENTNOTIFIER_HXX