xref: /AOO41X/main/offapi/com/sun/star/frame/XDispatch.idl (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27#ifndef __com_sun_star_frame_XDispatch_idl__
28#define __com_sun_star_frame_XDispatch_idl__
29
30#ifndef __com_sun_star_uno_XInterface_idl__
31#include <com/sun/star/uno/XInterface.idl>
32#endif
33
34#ifndef __com_sun_star_util_URL_idl__
35#include <com/sun/star/util/URL.idl>
36#endif
37
38#ifndef __com_sun_star_beans_PropertyValue_idl__
39#include <com/sun/star/beans/PropertyValue.idl>
40#endif
41
42#ifndef __com_sun_star_frame_XStatusListener_idl__
43#include <com/sun/star/frame/XStatusListener.idl>
44#endif
45
46
47//=============================================================================
48
49module com {  module sun {  module star {  module frame {
50
51//=============================================================================
52/** serves state information of objects which can be connected to
53        controls (e.g. toolbox controls).
54
55    <p>
56    Each state change is to be broadcasted to all registered
57	status listeners. The first notification should be performed
58    synchronously from <member>XDispatch::addStatusListener()</member>;
59        if not, controls may flicker. State listener must be aware of this
60    synchronous notification.
61    </p>
62
63    <p>
64    The state consists of enabled/disabled and a short descriptive text
65	of the function (e.g. "undo insert character"). It is to be broadcasted
66        whenever this state changes or the control should re-get the value
67	for the URL it is connected to. Additionally, a context-switch-event
68	is to be broadcasted whenever the object may be out of scope,
69    to force the state listener to requery the <type>XDispatch</type>.
70    </p>
71
72    @see Frame
73    @see FeatureStateEvent
74 */
75published interface XDispatch: com::sun::star::uno::XInterface
76{
77	//-------------------------------------------------------------------------
78	/** dispatches (executes) an URL asynchronously.
79
80        <p>
81        It is only allowed to dispatch URLs for which this <type>XDispatch</type>
82        was explicitely queried. Additional arguments ("'#..." or "?...") are allowed.
83        </p>
84
85        @param URL
86            fully parsed URL describing the feature which should be dispatched (=executed)
87
88        @param Arguments
89            optional arguments for this request.
90            They depend on the real implementation of the dipsatch object.
91
92        @example
93            <listing>
94            <i><font COLOR="#949494">// some code for a click-handler (Java)</font></i>
95            void <strong>myOnClick</strong>(<em>String</em> sURL,<em>String</em> sTargetFrame,<em>com.sun.star.beans.PropertyValue[]</em> lArguments)
96            {
97            &nbsp;&nbsp;com.sun.star.util.URL[] aURL = new com.sun.star.util.URL[1];
98            &nbsp;&nbsp;aURL[0] = new com.sun.star.util.URL();
99            &nbsp;&nbsp;aURL[0].Complete = sURL;
100
101            &nbsp;&nbsp;com.sun.star.util.XURLTransformer xParser = (com.sun.star.util.XURLTransformer)UnoRuntime.queryInterface(
102            &nbsp;&nbsp;&nbsp;&nbsp;com.sun.star.util.XURLTransformer.class,
103            &nbsp;&nbsp;&nbsp;&nbsp;mxServiceManager.createInstance("com.sun.star.util.URLTransformer"));
104
105            &nbsp;&nbsp;xParser.parseStrict(aURL);
106
107            &nbsp;&nbsp;com.sun.star.frame.XDispatch xDispatcher = mxFrame.queryDispatch(aURL[0], sTargetFrame, com.sun.star.frame.FrameSearchFlag.GLOBAL);
108
109            &nbsp;&nbsp;if(xDispatcher!=null)
110            &nbsp;&nbsp;&nbsp;&nbsp;xDispatcher.dispatch(aURL[0], lArguments);
111            }
112            </listing>
113	 */
114    [oneway] void dispatch(
115        [in] com::sun::star::util::URL URL,
116        [in] sequence<com::sun::star::beans::PropertyValue> Arguments);
117
118	//-------------------------------------------------------------------------
119        /** registers a listener of a control for a specific URL
120		at this object to receive status events.
121
122        <p>
123        It is only allowed to register URLs for which this <type>XDispatch</type>
124        was explicitely queried. Additional arguments ("#..." or "?...") will be ignored.
125        </p>
126        Note: Notifications can't be guaranteed! This will be a part of interface <type>XNotifyingDispatch</type>.
127
128        @param Control
129            listener that wishes to be informed
130
131        @param URL
132            the URL (without additional arguments) the listener wishes to be registered for.
133            A listener can be registered for more than one URL at the same time.
134
135        @see XStatusListener
136        @see XDispatch::removeStatusListener()
137	 */
138    [oneway] void addStatusListener(
139        [in] XStatusListener Control,
140        [in] com::sun::star::util::URL URL);
141
142	//-------------------------------------------------------------------------
143        /** unregisters a listener from a control.
144
145        @param Control
146            listener that wishes to be unregistered
147
148        @param URL
149            URL the listener was registered for.
150            Additional arguments ("#..." or "?...") will be ignored.
151
152        @see XStatusListener
153        @see XDispatch::addStatusListener()
154	 */
155    [oneway] void removeStatusListener(
156        [in] XStatusListener Control,
157        [in] com::sun::star::util::URL URL);
158};
159
160//=============================================================================
161
162}; }; }; };
163
164#endif
165