:: com :: sun :: star :: frame ::

interface XDispatch
Base Interfaces
::com::sun::star::uno::XInterface
  |  
  +--XDispatch
::com::sun::star::uno::XInterface
(referenced interface's summary:)
base interface of all UNO interfaces
Description
serves state information of objects which can be connected to controls (e.g., toolbox controls).

Each state change is to be broadcast to all registered status listeners. The first notification should be performed synchronously from addStatusListener() ; if not, controls may flicker. State listener must be aware of this synchronous notification.

The state consists of enabled/disabled and a short descriptive text of the function (e.g., "undo insert character"). It is to be broadcast whenever this state changes or the control should re-get the value for the URL to which it is connected. Additionally, a context-switch-event is to be broadcast whenever the object may be out of scope, to force the state listener to requery the ::com::sun::star::frame::XDispatch .

See also
::com::sun::star::frame::Frame
See also
::com::sun::star::frame::FeatureStateEvent

Methods' Summary
dispatch dispatches (executes) an URL asynchronously.  
addStatusListener registers a listener of a control for a specific URL to this object to receive status events.  
removeStatusListener unregisters a listener of a control.  
Methods' Details
dispatch
[oneway] void
dispatch( [in] ::com::sun::star::util::URL  URL,
[in] sequence< ::com::sun::star::beans::PropertyValue >  Arguments );

Description
dispatches (executes) an URL asynchronously.

It is only allowed to dispatch URLs for which this ::com::sun::star::frame::XDispatch was explicitely queried. Additional arguments "'#..." or "?...") are allowed.

Parameter URL
full parsed URL wich describe the feature which should be dispatched (executed)
Parameter Arguments
optional arguments for this request They depends from the real implementation of the dipsatch object.
Example
// some code for a click-handler (Java) 
void myOnClick ( String sURL, String sTargetFrame, com.sun.star.beans.PropertyValue[] lArguments) 
{ 
  com.sun.star.util.URL[] aURL = new com.sun.star.util.URL[1]; 
  aURL[0] = new com.sun.star.util.URL(); 
  aURL[0].Complete = sURL; 

  com.sun.star.util.XURLTransformer xParser = (com.sun.star.util.XURLTransformer)UnoRuntime.queryInterface( 
    com.sun.star.util.XURLTransformer.class, 
    mxServiceManager.createInstance("com.sun.star.util.URLTransformer")); 

  xParser.parseStrict(aURL); 

  com.sun.star.frame.XDispatch xDispatcher = mxFrame.queryDispatch(aURL[0], sTargetFrame, com.sun.star.frame.FrameSearchFlag.GLOBAL); 

  if(xDispatcher!=null) 
    xDispatcher.dispatch(aURL[0], lArguments); 
} 
addStatusListener
[oneway] void
addStatusListener( [in] ::com::sun::star::frame::XStatusListener  Control,
[in] ::com::sun::star::util::URL  URL );

Description
registers a listener of a control for a specific URL to this object to receive status events.

It is only allowed to register for URLs for which this ::com::sun::star::frame::XDispatch was explicitely queried. Additional arguments ("#..." or "?...") will be ignored. Note: Notifications can't be guranteed! This will be a part of interface ::com::sun::star::frame::XNotifyingDispatch .

Parameter Control
listener which wish to be informed
Parameter URL
the URL (without additional arguments) for which the listener wish to be registered So a listener can be registered for more then one URLs at the same time.
See also
::com::sun::star::frame::XStatusListener
See also
::com::sun::star::frame::XDispatch::removeStatusListener()
removeStatusListener
[oneway] void
removeStatusListener( [in] ::com::sun::star::frame::XStatusListener  Control,
[in] ::com::sun::star::util::URL  URL );

Description
unregisters a listener of a control.
Parameter Control
listener which wish to be unregistered
Parameter URL
the URL for which the listener was registered Additional arguments ("#..." or "?...") will be ignored.
See also
::com::sun::star::frame::XStatusListener
See also
::com::sun::star::frame::XDispatch::addStatusListener()
Top of Page