LibreOffice
LibreOffice 24.2 SDK API Reference
|
defines a processor for synchronous commands, which are executed in a specific execution environment. More...
import"XCommandProcessor.idl";
Public Member Functions | |
long | createCommandIdentifier () |
creates a unique identifier for a command. More... | |
any | execute ([in] Command aCommand, [in] long CommandId, [in] XCommandEnvironment Environment) raises ( com::sun::star::uno::Exception, CommandAbortedException ) |
executes a command. More... | |
void | abort ([in] long CommandId) |
ends the command associated with the given id. 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... | |
defines a processor for synchronous commands, which are executed in a specific execution environment.
void abort | ( | [in] long | CommandId | ) |
ends the command associated with the given id.
Not every command can be aborted. It's up to the implementation to decide whether this method will actually end the processing of the command or simply do nothing.
CommandId | is a unique id for the command to abort. This must be the identifier passed to XCommandProcessor::execute() for the command to abort. |
long createCommandIdentifier | ( | ) |
creates a unique identifier for a command.
This identifier can be used to abort the execution of the command associated with that identifier. Note that it is generally not necessary to obtain a new id for each command, because commands are executed synchronously. So the id for a command is valid again after a command previously associated with this id has finished. In fact you only should get one identifier per thread and assign it to every command executed by that thread.
Also, after a call to XCommandProcessor::abort(), an identifier should not be used any longer (and instead be released by a call to XCommandProcessor2::releaseCommandIdentifier()), because it may well abort all further calls to XCommandProcessor::execute().
To avoid ever-increasing resource consumption, the identifier should be released via XCommandProcessor2::releaseCommandIdentifier() when it is no longer used.
any execute | ( | [in] Command | aCommand, |
[in] long | CommandId, | ||
[in] XCommandEnvironment | Environment | ||
) | |||
raises | ( | com::sun::star::uno::Exception, | |
CommandAbortedException | |||
) |
executes a command.
Common command definitions can be found in the specification of the service Content.
aCommand | is the command to execute. |
CommandId | is a unique id for the command. This identifier was obtained by calling XCommandProcessor::createCommandIdentifier(). A value of zero can be used, if the command never shall be aborted. Different threads MUST NOT share one command identifier (except 0 ). This can easily achieved, if every thread that wants to use an XCommandProcessor, obtains exactly one identifier using XCommandProcessor::createCommandIdentifier(). This identifier can be used for every call to XCommandProcessor::execute() done by that thread. |
Environment | is the execution environment. |
CommandAbortedException | to indicate that the command was aborted. |
DuplicateCommandIdentifierException | to indicate that two threads tried to use the same command identifier |
Exception | if an error occurred during the execution of the command. |