xref: /aoo42x/main/offapi/com/sun/star/frame/XDispatch.idl (revision 6d53c851)
1d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5d1766043SAndrew Rist * distributed with this work for additional information
6d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10d1766043SAndrew Rist *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12d1766043SAndrew Rist *
13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14d1766043SAndrew Rist * software distributed under the License is distributed on an
15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17d1766043SAndrew Rist * specific language governing permissions and limitations
18d1766043SAndrew Rist * under the License.
19d1766043SAndrew Rist *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir#ifndef __com_sun_star_frame_XDispatch_idl__
24cdf0e10cSrcweir#define __com_sun_star_frame_XDispatch_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_util_URL_idl__
31cdf0e10cSrcweir#include <com/sun/star/util/URL.idl>
32cdf0e10cSrcweir#endif
33cdf0e10cSrcweir
34cdf0e10cSrcweir#ifndef __com_sun_star_beans_PropertyValue_idl__
35cdf0e10cSrcweir#include <com/sun/star/beans/PropertyValue.idl>
36cdf0e10cSrcweir#endif
37cdf0e10cSrcweir
38cdf0e10cSrcweir#ifndef __com_sun_star_frame_XStatusListener_idl__
39cdf0e10cSrcweir#include <com/sun/star/frame/XStatusListener.idl>
40cdf0e10cSrcweir#endif
41cdf0e10cSrcweir
42cdf0e10cSrcweir
43cdf0e10cSrcweir//=============================================================================
44cdf0e10cSrcweir
45cdf0e10cSrcweirmodule com {  module sun {  module star {  module frame {
46cdf0e10cSrcweir
47cdf0e10cSrcweir//=============================================================================
48cdf0e10cSrcweir/** serves state information of objects which can be connected to
49cdf0e10cSrcweir        controls (e.g. toolbox controls).
50cdf0e10cSrcweir
51cdf0e10cSrcweir    <p>
52cdf0e10cSrcweir    Each state change is to be broadcasted to all registered
53cdf0e10cSrcweir	status listeners. The first notification should be performed
54cdf0e10cSrcweir    synchronously from <member>XDispatch::addStatusListener()</member>;
55cdf0e10cSrcweir        if not, controls may flicker. State listener must be aware of this
56cdf0e10cSrcweir    synchronous notification.
57cdf0e10cSrcweir    </p>
58cdf0e10cSrcweir
59cdf0e10cSrcweir    <p>
60cdf0e10cSrcweir    The state consists of enabled/disabled and a short descriptive text
61cdf0e10cSrcweir	of the function (e.g. "undo insert character"). It is to be broadcasted
62cdf0e10cSrcweir        whenever this state changes or the control should re-get the value
63cdf0e10cSrcweir	for the URL it is connected to. Additionally, a context-switch-event
64cdf0e10cSrcweir	is to be broadcasted whenever the object may be out of scope,
65cdf0e10cSrcweir    to force the state listener to requery the <type>XDispatch</type>.
66cdf0e10cSrcweir    </p>
67cdf0e10cSrcweir
68cdf0e10cSrcweir    @see Frame
69cdf0e10cSrcweir    @see FeatureStateEvent
70cdf0e10cSrcweir */
71cdf0e10cSrcweirpublished interface XDispatch: com::sun::star::uno::XInterface
72cdf0e10cSrcweir{
73cdf0e10cSrcweir	//-------------------------------------------------------------------------
74cdf0e10cSrcweir	/** dispatches (executes) an URL asynchronously.
75cdf0e10cSrcweir
76cdf0e10cSrcweir        <p>
77cdf0e10cSrcweir        It is only allowed to dispatch URLs for which this <type>XDispatch</type>
78*6d53c851Smseidel        was explicitly queried. Additional arguments ("'#..." or "?...") are allowed.
79cdf0e10cSrcweir        </p>
80cdf0e10cSrcweir
81cdf0e10cSrcweir        @param URL
82cdf0e10cSrcweir            fully parsed URL describing the feature which should be dispatched (=executed)
83cdf0e10cSrcweir
84cdf0e10cSrcweir        @param Arguments
85cdf0e10cSrcweir            optional arguments for this request.
86cdf0e10cSrcweir            They depend on the real implementation of the dipsatch object.
87cdf0e10cSrcweir
88cdf0e10cSrcweir        @example
89cdf0e10cSrcweir            <listing>
90cdf0e10cSrcweir            <i><font COLOR="#949494">// some code for a click-handler (Java)</font></i>
91cdf0e10cSrcweir            void <strong>myOnClick</strong>(<em>String</em> sURL,<em>String</em> sTargetFrame,<em>com.sun.star.beans.PropertyValue[]</em> lArguments)
92cdf0e10cSrcweir            {
93cdf0e10cSrcweir            &nbsp;&nbsp;com.sun.star.util.URL[] aURL = new com.sun.star.util.URL[1];
94cdf0e10cSrcweir            &nbsp;&nbsp;aURL[0] = new com.sun.star.util.URL();
95cdf0e10cSrcweir            &nbsp;&nbsp;aURL[0].Complete = sURL;
96cdf0e10cSrcweir
97cdf0e10cSrcweir            &nbsp;&nbsp;com.sun.star.util.XURLTransformer xParser = (com.sun.star.util.XURLTransformer)UnoRuntime.queryInterface(
98cdf0e10cSrcweir            &nbsp;&nbsp;&nbsp;&nbsp;com.sun.star.util.XURLTransformer.class,
99cdf0e10cSrcweir            &nbsp;&nbsp;&nbsp;&nbsp;mxServiceManager.createInstance("com.sun.star.util.URLTransformer"));
100cdf0e10cSrcweir
101cdf0e10cSrcweir            &nbsp;&nbsp;xParser.parseStrict(aURL);
102cdf0e10cSrcweir
103cdf0e10cSrcweir            &nbsp;&nbsp;com.sun.star.frame.XDispatch xDispatcher = mxFrame.queryDispatch(aURL[0], sTargetFrame, com.sun.star.frame.FrameSearchFlag.GLOBAL);
104cdf0e10cSrcweir
105cdf0e10cSrcweir            &nbsp;&nbsp;if(xDispatcher!=null)
106cdf0e10cSrcweir            &nbsp;&nbsp;&nbsp;&nbsp;xDispatcher.dispatch(aURL[0], lArguments);
107cdf0e10cSrcweir            }
108cdf0e10cSrcweir            </listing>
109cdf0e10cSrcweir	 */
110cdf0e10cSrcweir    [oneway] void dispatch(
111cdf0e10cSrcweir        [in] com::sun::star::util::URL URL,
112cdf0e10cSrcweir        [in] sequence<com::sun::star::beans::PropertyValue> Arguments);
113cdf0e10cSrcweir
114cdf0e10cSrcweir	//-------------------------------------------------------------------------
115cdf0e10cSrcweir        /** registers a listener of a control for a specific URL
116cdf0e10cSrcweir		at this object to receive status events.
117cdf0e10cSrcweir
118cdf0e10cSrcweir        <p>
119cdf0e10cSrcweir        It is only allowed to register URLs for which this <type>XDispatch</type>
120*6d53c851Smseidel        was explicitly queried. Additional arguments ("#..." or "?...") will be ignored.
121cdf0e10cSrcweir        </p>
122cdf0e10cSrcweir        Note: Notifications can't be guaranteed! This will be a part of interface <type>XNotifyingDispatch</type>.
123cdf0e10cSrcweir
124cdf0e10cSrcweir        @param Control
125cdf0e10cSrcweir            listener that wishes to be informed
126cdf0e10cSrcweir
127cdf0e10cSrcweir        @param URL
128cdf0e10cSrcweir            the URL (without additional arguments) the listener wishes to be registered for.
129cdf0e10cSrcweir            A listener can be registered for more than one URL at the same time.
130cdf0e10cSrcweir
131cdf0e10cSrcweir        @see XStatusListener
132cdf0e10cSrcweir        @see XDispatch::removeStatusListener()
133cdf0e10cSrcweir	 */
134cdf0e10cSrcweir    [oneway] void addStatusListener(
135cdf0e10cSrcweir        [in] XStatusListener Control,
136cdf0e10cSrcweir        [in] com::sun::star::util::URL URL);
137cdf0e10cSrcweir
138cdf0e10cSrcweir	//-------------------------------------------------------------------------
139cdf0e10cSrcweir        /** unregisters a listener from a control.
140cdf0e10cSrcweir
141cdf0e10cSrcweir        @param Control
142cdf0e10cSrcweir            listener that wishes to be unregistered
143cdf0e10cSrcweir
144cdf0e10cSrcweir        @param URL
145cdf0e10cSrcweir            URL the listener was registered for.
146cdf0e10cSrcweir            Additional arguments ("#..." or "?...") will be ignored.
147cdf0e10cSrcweir
148cdf0e10cSrcweir        @see XStatusListener
149cdf0e10cSrcweir        @see XDispatch::addStatusListener()
150cdf0e10cSrcweir	 */
151cdf0e10cSrcweir    [oneway] void removeStatusListener(
152cdf0e10cSrcweir        [in] XStatusListener Control,
153cdf0e10cSrcweir        [in] com::sun::star::util::URL URL);
154cdf0e10cSrcweir};
155cdf0e10cSrcweir
156cdf0e10cSrcweir//=============================================================================
157cdf0e10cSrcweir
158cdf0e10cSrcweir}; }; }; };
159cdf0e10cSrcweir
160cdf0e10cSrcweir#endif
161