LibreOffice
LibreOffice 24.2 SDK API Reference
Public Member Functions | List of all members
XDispatch Interface Referencepublished

serves state information of objects which can be connected to controls (e.g. More...

import"XDispatch.idl";

Inheritance diagram for XDispatch:
XInterface XSelectionFunction InteractionGridControl AutoRecovery theAutoRecovery XNotifyingDispatch ContentHandler

Public Member Functions

void dispatch ([in] com::sun::star::util::URL URL, [in] sequence< com::sun::star::beans::PropertyValue > Arguments)
 dispatches (executes) a URL More...
 
void addStatusListener ([in] XStatusListener Control, [in] com::sun::star::util::URL URL)
 registers a listener of a control for a specific URL at this object to receive status events. More...
 
void removeStatusListener ([in] XStatusListener Control, [in] com::sun::star::util::URL URL)
 unregisters a listener from a control. More...
 
- Public Member Functions inherited from XInterface
any queryInterface ([in] type aType)
 queries for a new interface to an existing UNO object. More...
 
void acquire ()
 increases the reference counter by one. More...
 
void release ()
 decreases the reference counter by one. More...
 

Detailed Description

serves state information of objects which can be connected to controls (e.g.

toolbox controls).

Each state change is to be broadcasted to all registered status listeners. The first notification should be performed synchronously from XDispatch::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 broadcasted whenever this state changes or the control should re-get the value for the URL it is connected to. Additionally, a context-switch-event is to be broadcasted whenever the object may be out of scope, to force the state listener to requery the XDispatch.

See also
Frame
FeatureStateEvent

Member Function Documentation

◆ addStatusListener()

void addStatusListener ( [in] XStatusListener  Control,
[in] com::sun::star::util::URL  URL 
)

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

It is only allowed to register URLs for which this XDispatch was explicitly queried. Additional arguments ("#..." or "?...") will be ignored.

Note: Notifications can't be guaranteed! This will be a part of interface XNotifyingDispatch.

Parameters
Controllistener that wishes to be informed
URLthe URL (without additional arguments) the listener wishes to be registered for. A listener can be registered for more than one URL at the same time.
See also
XStatusListener
XDispatch::removeStatusListener()

◆ dispatch()

void dispatch ( [in] com::sun::star::util::URL  URL,
[in] sequence< com::sun::star::beans::PropertyValue Arguments 
)

dispatches (executes) a URL

It is only allowed to dispatch URLs for which this XDispatch was explicitly queried. Additional arguments ("'#..." or "?...") are allowed.

Parameters
URLfully parsed URL describing the feature which should be dispatched (=executed)
Argumentsoptional arguments for this request (see com::sun::star::document::MediaDescriptor) They depend on the real implementation of the dispatch object.

Controlling synchronous or asynchronous mode happens via readonly boolean Flag SynchronMode

By default, and absent any arguments, "SynchronMode" is considered FALSE and the execution is performed asynchronously (i.e. dispatch() returns immediately, and the action is performed in the background). But when set to TRUE, dispatch() processes the request synchronously

  • this call will block until it has finished.

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;
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);
}

◆ removeStatusListener()

void removeStatusListener ( [in] XStatusListener  Control,
[in] com::sun::star::util::URL  URL 
)

unregisters a listener from a control.

Parameters
Controllistener that wishes to be unregistered
URLURL the listener was registered for. Additional arguments ("#..." or "?...") will be ignored.
See also
XStatusListener
XDispatch::addStatusListener()

The documentation for this interface was generated from the following file: