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