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