1/*************************************************************************
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * Copyright 2000, 2010 Oracle and/or its affiliates.
5 *
6 * OpenOffice.org - a multi-platform office productivity suite
7 *
8 * This file is part of OpenOffice.org.
9 *
10 * OpenOffice.org is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License version 3
12 * only, as published by the Free Software Foundation.
13 *
14 * OpenOffice.org is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU Lesser General Public License version 3 for more details
18 * (a copy is included in the LICENSE file that accompanied this code).
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * version 3 along with OpenOffice.org.  If not, see
22 * <http://www.openoffice.org/license.html>
23 * for a copy of the LGPLv3 License.
24 *
25************************************************************************/
26
27#ifndef __com_sun_star_document_XDocumentEventBroadcaster_idl__
28#define __com_sun_star_document_XDocumentEventBroadcaster_idl__
29
30#ifndef __com_sun_star_frame_XController2_idl__
31#include <com/sun/star/frame/XController2.idl>
32#endif
33
34#ifndef __com_sun_star_document_DocumentEvent_idl__
35#include <com/sun/star/document/DocumentEvent.idl>
36#endif
37
38#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
39#include <com/sun/star/lang/IllegalArgumentException.idl>
40#endif
41
42#ifndef __com_sun_star_lang_NoSupportException_idl__
43#include <com/sun/star/lang/NoSupportException.idl>
44#endif
45
46//=============================================================================
47
48module com { module sun { module star { module document {
49
50published interface XDocumentEventListener;
51
52//=============================================================================
53
54/** allows to be notified of events happening in an <type>OfficeDocument</type>, and to cause notification
55    of such events.
56
57    <p>This interface is the successor of the XEventBroadcaster interface, which should not be used
58    anymore.</p>
59
60    @see DocumentEvent
61    @since OOo 3.1
62*/
63published interface XDocumentEventBroadcaster
64{
65    /** registers a listener which is notified about document events
66
67        @param _Listener
68            the listener to register. The behaviour of the method is undefined this listener
69            is <NULL/>.
70    */
71    void    addDocumentEventListener( [in] XDocumentEventListener _Listener );
72
73    /** revokes a listener which has previously been registered to be notified about document events.
74
75        @param _Listener
76            the listener to revoke. The behaviour of the method is undefined this listener
77            is <NULL/>.
78    */
79    void    removeDocumentEventListener( [in] XDocumentEventListener _Listener );
80
81    /** causes the broadcaster to notify all registered listeners of the given event
82
83        <p>The method will create a <type>DocumentEvent</type> instance with the given parameters,
84        and fill in the <code>Source</code> member (denoting the broadcaster) as appropriate.</p>
85
86        <p>Whether the actual notification happens synchronously or asynchronously is up to the
87        implementator of this method. However, implementations are encouraged to specify this, for the
88        list of supported event types, in their service contract.</p>
89
90        <p>Implementations might also decide to limit the list of allowed events (means event names) at
91        their own discretion. Again, in this case they're encouraged to document this in their service
92        contract.</p>
93
94        @param _EventName
95            the name of the event to be notified.
96        @param _ViewController
97            the view/controller which the event applies to. May be <NULL/>
98        @param _Supplement
99            supplemental information related to the event.
100
101        @throws ::com::sun::star::lang::IllegalArgumentException
102            if <arg>_EventName</arg> is empty, or if <arg>_EventName</arg> is not supported by the
103            document implementation.
104
105        @throws ::com::sun::star::lang::NoSupportException
106            if the broadcaster implementation does not supported broadcasting events induced externally.
107            This is usually used for components which multiplex events from multiple sources, and thus would
108            be unable to fill in the <code>Source</code> member of the <type>DocumentEvent</type> instance.
109    */
110    void    notifyDocumentEvent(
111                [in] string _EventName,
112                [in] ::com::sun::star::frame::XController2 _ViewController,
113                [in] any _Supplement
114            )
115            raises ( ::com::sun::star::lang::IllegalArgumentException,
116                     ::com::sun::star::lang::NoSupportException );
117};
118
119//=============================================================================
120
121}; }; }; };
122
123//=============================================================================
124
125#endif
126