1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24#ifndef __com_sun_star_document_XDocumentEventBroadcaster_idl__
25#define __com_sun_star_document_XDocumentEventBroadcaster_idl__
26
27#ifndef __com_sun_star_frame_XController2_idl__
28#include <com/sun/star/frame/XController2.idl>
29#endif
30
31#ifndef __com_sun_star_document_DocumentEvent_idl__
32#include <com/sun/star/document/DocumentEvent.idl>
33#endif
34
35#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
36#include <com/sun/star/lang/IllegalArgumentException.idl>
37#endif
38
39#ifndef __com_sun_star_lang_NoSupportException_idl__
40#include <com/sun/star/lang/NoSupportException.idl>
41#endif
42
43//=============================================================================
44
45module com { module sun { module star { module document {
46
47published interface XDocumentEventListener;
48
49//=============================================================================
50
51/** allows to be notified of events happening in an <type>OfficeDocument</type>, and to cause notification
52    of such events.
53
54    <p>This interface is the successor of the XEventBroadcaster interface, which should not be used
55    anymore.</p>
56
57    @see DocumentEvent
58    @since OOo 3.1
59*/
60published interface XDocumentEventBroadcaster
61{
62    /** registers a listener which is notified about document events
63
64        @param _Listener
65            the listener to register. The behaviour of the method is undefined this listener
66            is <NULL/>.
67    */
68    void    addDocumentEventListener( [in] XDocumentEventListener _Listener );
69
70    /** revokes a listener which has previously been registered to be notified about document events.
71
72        @param _Listener
73            the listener to revoke. The behaviour of the method is undefined this listener
74            is <NULL/>.
75    */
76    void    removeDocumentEventListener( [in] XDocumentEventListener _Listener );
77
78    /** causes the broadcaster to notify all registered listeners of the given event
79
80        <p>The method will create a <type>DocumentEvent</type> instance with the given parameters,
81        and fill in the <code>Source</code> member (denoting the broadcaster) as appropriate.</p>
82
83        <p>Whether the actual notification happens synchronously or asynchronously is up to the
84        implementator of this method. However, implementations are encouraged to specify this, for the
85        list of supported event types, in their service contract.</p>
86
87        <p>Implementations might also decide to limit the list of allowed events (means event names) at
88        their own discretion. Again, in this case they're encouraged to document this in their service
89        contract.</p>
90
91        @param _EventName
92            the name of the event to be notified.
93        @param _ViewController
94            the view/controller which the event applies to. May be <NULL/>
95        @param _Supplement
96            supplemental information related to the event.
97
98        @throws ::com::sun::star::lang::IllegalArgumentException
99            if <arg>_EventName</arg> is empty, or if <arg>_EventName</arg> is not supported by the
100            document implementation.
101
102        @throws ::com::sun::star::lang::NoSupportException
103            if the broadcaster implementation does not supported broadcasting events induced externally.
104            This is usually used for components which multiplex events from multiple sources, and thus would
105            be unable to fill in the <code>Source</code> member of the <type>DocumentEvent</type> instance.
106    */
107    void    notifyDocumentEvent(
108                [in] string _EventName,
109                [in] ::com::sun::star::frame::XController2 _ViewController,
110                [in] any _Supplement
111            )
112            raises ( ::com::sun::star::lang::IllegalArgumentException,
113                     ::com::sun::star::lang::NoSupportException );
114};
115
116//=============================================================================
117
118}; }; }; };
119
120//=============================================================================
121
122#endif
123