merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / core / dataaccess / documenteventnotifier.hxx
blob0c85a0b5291091fe035b3ea2b5936f0a5f78b12e
2 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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>
41 namespace cppu
43 class OWeakObject;
46 //........................................................................
47 namespace dbaccess
49 //........................................................................
51 class DocumentEventNotifier_Impl;
52 //====================================================================
53 //= DocumentEventNotifier
54 //====================================================================
55 class DocumentEventNotifier
57 public:
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
67 @precond
68 the mutex is not locked
70 void disposing();
72 /** tells the instance that its document is completely initialized now.
74 Before you call this method, no notification will actually happen
76 @precond
77 the mutex is locked
79 void onDocumentInitialized();
81 /** notifies a document event described by the given parameters
83 @precond
84 the mutex is not locked
85 @precond
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.
98 @precond
99 the mutex is locked
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
109 @precond
110 the mutex is not locked
111 @precond
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.
127 @precond
128 the mutex is locked
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 );
139 private:
140 ::rtl::Reference< DocumentEventNotifier_Impl > m_pImpl;
143 //........................................................................
144 } // namespace dbaccess
145 //........................................................................
147 #endif // DBACCESS_DOCUMENTEVENTNOTIFIER_HXX