1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
4 * This file is part of the LibreOffice project.
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 * This file incorporates work covered by the following license notice:
12 * Licensed to the Apache Software Foundation (ASF) under one or more
13 * contributor license agreements. See the NOTICE file distributed
14 * with this work for additional information regarding copyright
15 * ownership. The ASF licenses this file to you under the Apache
16 * License, Version 2.0 (the "License"); you may not use this file
17 * except in compliance with the License. You may obtain a copy of
18 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #ifndef INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTNOTIFIER_HXX
22 #define INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTNOTIFIER_HXX
24 #include <com/sun/star/document/XEventListener.hpp>
25 #include <com/sun/star/document/XDocumentEventListener.hpp>
27 #include <rtl/ref.hxx>
37 class DocumentEventNotifier_Impl
;
38 // DocumentEventNotifier
39 class DocumentEventNotifier
42 DocumentEventNotifier( ::cppu::OWeakObject
& _rBroadcasterDocument
, ::osl::Mutex
& _rMutex
);
43 ~DocumentEventNotifier();
45 void addLegacyEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::document::XEventListener
>& _Listener
);
46 void removeLegacyEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::document::XEventListener
>& _Listener
);
47 void addDocumentEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::document::XDocumentEventListener
>& _Listener
);
48 void removeDocumentEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::document::XDocumentEventListener
>& _Listener
);
50 /** disposes the instance
52 the mutex is not locked
56 /** tells the instance that its document is completely initialized now.
58 Before you call this method, no notification will actually happen
63 void onDocumentInitialized();
65 /** notifies a document event described by the given parameters
68 the mutex is not locked
70 ->onDocumentInitialized has been called
72 void notifyDocumentEvent(
73 const OUString
& _EventName
,
74 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController2
>& _rxViewController
= NULL
,
75 const ::com::sun::star::uno::Any
& _Supplement
= ::com::sun::star::uno::Any()
78 /** notifies a document event, described by the given parameters, asynchronously
80 Note that no event is actually notified before you called ->onDocumentInitialized.
85 void notifyDocumentEventAsync(
86 const OUString
& _EventName
,
87 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController2
>& _ViewController
= NULL
,
88 const ::com::sun::star::uno::Any
& _Supplement
= ::com::sun::star::uno::Any()
91 /** notifies a document event to all registered listeners
94 the mutex is not locked
96 ->onDocumentInitialized has been called
98 void notifyDocumentEvent(
99 const sal_Char
* _pAsciiEventName
,
100 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XController2
>& _rxViewController
= NULL
,
101 const ::com::sun::star::uno::Any
& _rSupplement
= ::com::sun::star::uno::Any()
104 notifyDocumentEvent( OUString::createFromAscii( _pAsciiEventName
), _rxViewController
, _rSupplement
);
107 /** notifies a document event to all registered listeners, asynchronously
109 Note that no event is actually notified before you called ->onDocumentInitialized.
114 void notifyDocumentEventAsync(
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 notifyDocumentEventAsync( OUString::createFromAscii( _pAsciiEventName
), _rxViewController
, _rSupplement
);
124 ::rtl::Reference
< DocumentEventNotifier_Impl
> m_pImpl
;
127 } // namespace dbaccess
129 #endif // INCLUDED_DBACCESS_SOURCE_CORE_DATAACCESS_DOCUMENTEVENTNOTIFIER_HXX
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */