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