xref: /AOO41X/main/udkapi/com/sun/star/script/XEventAttacherManager.idl (revision 408a4873fc8bcc602c90ea4598886bb71abf0675)
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#ifndef __com_sun_star_script_XEventAttacherManager_idl__
24#define __com_sun_star_script_XEventAttacherManager_idl__
25
26#ifndef __com_sun_star_uno_XInterface_idl__
27#include <com/sun/star/uno/XInterface.idl>
28#endif
29
30#ifndef __com_sun_star_script_ScriptEventDescriptor_idl__
31#include <com/sun/star/script/ScriptEventDescriptor.idl>
32#endif
33
34#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
35#include <com/sun/star/lang/IllegalArgumentException.idl>
36#endif
37
38#ifndef __com_sun_star_lang_ServiceNotRegisteredException_idl__
39#include <com/sun/star/lang/ServiceNotRegisteredException.idl>
40#endif
41
42#ifndef __com_sun_star_script_XScriptListener_idl__
43#include <com/sun/star/script/XScriptListener.idl>
44#endif
45
46
47//=============================================================================
48
49 module com {  module sun {  module star {  module script {
50
51//=============================================================================
52/** registers listeners for specified events.
53 */
54published interface XEventAttacherManager: com::sun::star::uno::XInterface
55{
56    //-------------------------------------------------------------------------
57    /** registers one event for an object identified by its index.
58
59        <p>If any object is attached under this index, then this
60        event is attached automatically.</p>
61        <p>Exceptions of type
62        <type scope="com::sun::star::beans">IntrospectionException</type> and
63        <type scope="com::sun::star::script">CannotCreateAdapterException</type>
64        that can be thrown by methods of <type>XEventAttacher</type> are caught
65        and ignored.</p>
66     */
67    void registerScriptEvent( [in] long nIndex,
68             [in] com::sun::star::script::ScriptEventDescriptor aScriptEvent )
69            raises( com::sun::star::lang::IllegalArgumentException );
70
71    //-------------------------------------------------------------------------
72    /** registers several events for an object identified by its index.
73
74        <p>The result is the same as if the method <member>registerScriptEvent
75        </member> was called once for each <type>ScriptEventDescriptor</type>
76        in the sequence.</p>
77
78        <p>If any object is attached under this index, then this
79        event is attached automatically (see <member>attach</member>)</p>
80
81        <p>Exceptions of type
82        <type scope="com::sun::star::beans">IntrospectionException</type> and
83        <type scope="com::sun::star::script">CannotCreateAdapterException</type>
84        that can be thrown by methods of <type>XEventAttacher</type> are caught
85        and ignored.</p>
86
87        @see registerScriptEvent
88        @see attach
89     */
90    void registerScriptEvents( [in] long nIndex,
91             [in] sequence<com::sun::star::script::ScriptEventDescriptor> aScriptEvents )
92            raises( com::sun::star::lang::IllegalArgumentException );
93
94    //-------------------------------------------------------------------------
95    /** revokes the registration of an event.
96
97        <p>The parameters <var>ListenerType</var> and
98        <var>EventMethod</var> are equivalent to the first two
99        members of the <type>ScriptEventDescriptor</type>
100        used to register events. If this event at this index has
101        been attached to any object, it is detached automatically
102        (see <member>attach</member>).</p>
103
104        <p>Exceptions of type
105        <type scope="com::sun::star::beans">IntrospectionException</type> and
106        <type scope="com::sun::star::script">CannotCreateAdapterException</type>
107        that can be thrown by methods of <type>XEventAttacher</type> are caught
108        and ignored.</p>
109
110        @see attach
111     */
112    void revokeScriptEvent( [in] long nIndex,
113             [in] string aListenerType,
114             [in] string aEventMethod,
115             [in] string aRemoveListenerParam )
116            raises( com::sun::star::lang::IllegalArgumentException );
117
118    //-------------------------------------------------------------------------
119    /** revokes all events which are registered for the given index.
120
121        <p>If the events at this index have been attached to any
122        object, they are detached automatically.
123        (see <member>attach</member>).</p>
124
125        @see attach
126     */
127    void revokeScriptEvents( [in] long nIndex )
128            raises( com::sun::star::lang::IllegalArgumentException );
129
130    //-------------------------------------------------------------------------
131    /** creates an empty entry at the given position.
132
133        <p>The index <var>n</var> of all entries with <code>n &amp;gt;=
134        nIndex</code> will be increased by one.</p>
135     */
136    void insertEntry( [in] long nIndex )
137            raises( com::sun::star::lang::IllegalArgumentException );
138
139    //-------------------------------------------------------------------------
140    /** removes the entry at the given position.
141
142        <p>If any events are registered at this index, they will
143        be revoked, too. So if the events at this index have been
144        attached to any object they are detached automatically.
145        (see <member>attach</member>).</p>
146
147        @see attach
148     */
149    void removeEntry( [in] long nIndex )
150            raises( com::sun::star::lang::IllegalArgumentException );
151
152    //-------------------------------------------------------------------------
153    /** @eturns
154            all events registered for the given object index.
155
156        @param Index
157            an index previously inserted with the method insertEntry.
158
159        @throws IllegalArgumentException
160            if Index is not valid.
161     */
162    sequence<com::sun::star::script::ScriptEventDescriptor> getScriptEvents( [in] long Index )
163            raises( com::sun::star::lang::IllegalArgumentException );
164
165    //-------------------------------------------------------------------------
166    /** attaches all the <type>ScriptEvent</type>s which are registered
167        for the given index to the given object.
168
169        <p>Exceptions of type
170        <type scope="com::sun::star::beans">IntrospectionException</type> and
171        <type scope="com::sun::star::script">CannotCreateAdapterException</type>
172        that can be thrown by methods of <type>XEventAttacher</type> are caught
173        and ignored.</p>
174     */
175    void attach( [in] long nIndex,
176             [in] com::sun::star::uno::XInterface xObject,
177             [in] any aHelper )
178            raises( com::sun::star::lang::IllegalArgumentException,
179                    com::sun::star::lang::ServiceNotRegisteredException );
180
181    //-------------------------------------------------------------------------
182    /** detaches all the <type>ScriptEvent</type>s from the given object
183        which are registered at this object for the given index.
184
185        <p>Exceptions of type
186        <type scope="com::sun::star::beans">IntrospectionException</type> and
187        <type scope="com::sun::star::script">CannotCreateAdapterException</type>
188        that can be thrown by methods of <type>XEventAttacher</type> are caught
189        and ignored.</p>
190     */
191    void detach( [in] long nIndex,
192             [in] com::sun::star::uno::XInterface xObject )
193            raises( com::sun::star::lang::IllegalArgumentException );
194
195    //-------------------------------------------------------------------------
196    /** adds an <type>XScriptListener</type> that will be notified when an
197        event takes place. For that a
198        <type>ScriptEventDescriptor</type> is registered at and
199        attached to an object by an <type>XEventAttacherManager</type>.
200
201       <p>It is suggested to allow multiple registration of the same listener,
202        thus for each time a listener is added, it has to be removed.
203
204        @see removeScriptListener
205     */
206    void addScriptListener( [in] com::sun::star::script::XScriptListener xListener )
207            raises( com::sun::star::lang::IllegalArgumentException );
208
209    //-------------------------------------------------------------------------
210    /** removes a <type>XScriptListener</type> from the listener list.
211
212        <p>Nothing happens if the listener is not registered.
213
214       <p>It is suggested to allow multiple registration of the same listener,
215        thus for each time a listener is added, it has to be removed.
216
217        @see addScriptListener
218     */
219    void removeScriptListener( [in] com::sun::star::script::XScriptListener Listener )
220            raises( com::sun::star::lang::IllegalArgumentException );
221
222};
223
224//=============================================================================
225
226}; }; }; };
227
228#endif
229