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
28*cdf0e10cSrcweir#ifndef __com_sun_star_ucb_XCommandProcessor_idl__
29*cdf0e10cSrcweir#define __com_sun_star_ucb_XCommandProcessor_idl__
30*cdf0e10cSrcweir
31*cdf0e10cSrcweir#ifndef __com_sun_star_uno_XInterface_idl__
32*cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
33*cdf0e10cSrcweir#endif
34*cdf0e10cSrcweir
35*cdf0e10cSrcweir#ifndef __com_sun_star_ucb_XCommandEnvironment_idl__
36*cdf0e10cSrcweir#include <com/sun/star/ucb/XCommandEnvironment.idl>
37*cdf0e10cSrcweir#endif
38*cdf0e10cSrcweir
39*cdf0e10cSrcweir#ifndef __com_sun_star_ucb_Command_idl__
40*cdf0e10cSrcweir#include <com/sun/star/ucb/Command.idl>
41*cdf0e10cSrcweir#endif
42*cdf0e10cSrcweir
43*cdf0e10cSrcweir#ifndef __com_sun_star_ucb_CommandAbortedException_idl__
44*cdf0e10cSrcweir#include <com/sun/star/ucb/CommandAbortedException.idl>
45*cdf0e10cSrcweir#endif
46*cdf0e10cSrcweir
47*cdf0e10cSrcweir//=============================================================================
48*cdf0e10cSrcweir
49*cdf0e10cSrcweirmodule com { module sun { module star { module ucb {
50*cdf0e10cSrcweir
51*cdf0e10cSrcweir//=============================================================================
52*cdf0e10cSrcweir/** defines a processor for synchronous commands, which are executed in a
53*cdf0e10cSrcweir    specific execution environment.
54*cdf0e10cSrcweir
55*cdf0e10cSrcweir	@version  1.0
56*cdf0e10cSrcweir	@author   Kai Sommerfeld
57*cdf0e10cSrcweir
58*cdf0e10cSrcweir    @see com::sun::star::ucb::XCommandProcessor2
59*cdf0e10cSrcweir    for the improved version of this interface.
60*cdf0e10cSrcweir
61*cdf0e10cSrcweir	@see	  Command
62*cdf0e10cSrcweir	@see      XCommandEnvironment
63*cdf0e10cSrcweir	@see      XContent
64*cdf0e10cSrcweir*/
65*cdf0e10cSrcweirpublished interface XCommandProcessor : com::sun::star::uno::XInterface
66*cdf0e10cSrcweir{
67*cdf0e10cSrcweir	//-------------------------------------------------------------------------
68*cdf0e10cSrcweir	/** creates a unique identifier for a command.
69*cdf0e10cSrcweir
70*cdf0e10cSrcweir	    <p>This identifier can be used to abort the execution of the command
71*cdf0e10cSrcweir		accociated with that identifier. Note that it is generally not
72*cdf0e10cSrcweir		necessary to obtain a new id for each command, because commands are
73*cdf0e10cSrcweir		executed synchronously. So the id for a command is valid again after a
74*cdf0e10cSrcweir		command previously associated with this id has finished. In fact you
75*cdf0e10cSrcweir		only should get one identifier per thread and assign it to every
76*cdf0e10cSrcweir		command executed by that thread.</p>
77*cdf0e10cSrcweir
78*cdf0e10cSrcweir        <p>Also, after a call to <member>XCommandProcessor::abort</member>, an
79*cdf0e10cSrcweir        identifier should not be used any longer (and instead be released by a
80*cdf0e10cSrcweir        call to <member>XCommandProcessor2::releaseCommandIdentifier</member>),
81*cdf0e10cSrcweir		because it may well abort <em>all</em> further calls to
82*cdf0e10cSrcweir        <member>XCommandProcessor::execute</member>.</p>
83*cdf0e10cSrcweir
84*cdf0e10cSrcweir        <p>To avoid ever-increasing resource consumption, the identifier
85*cdf0e10cSrcweir        should be released via
86*cdf0e10cSrcweir        <member>XCommandProcessor2::releaseCommandIdentifier</member>
87*cdf0e10cSrcweir        when it is no longer used.</p>
88*cdf0e10cSrcweir
89*cdf0e10cSrcweir		@returns
90*cdf0e10cSrcweir		a command identifier.
91*cdf0e10cSrcweir	*/
92*cdf0e10cSrcweir	long createCommandIdentifier();
93*cdf0e10cSrcweir
94*cdf0e10cSrcweir	//-------------------------------------------------------------------------
95*cdf0e10cSrcweir	/** executes a command.
96*cdf0e10cSrcweir
97*cdf0e10cSrcweir		<p>Common command definitions can be found in the soecification of the
98*cdf0e10cSrcweir		service	<type>Content</type>.
99*cdf0e10cSrcweir
100*cdf0e10cSrcweir		@param aCommand
101*cdf0e10cSrcweir		is the command to execute.
102*cdf0e10cSrcweir
103*cdf0e10cSrcweir		@param CommandId
104*cdf0e10cSrcweir		is a unique id for the command. This identifier was obtained by calling
105*cdf0e10cSrcweir		<member>XCommandProcessor::createCommandIdentifier</member>. A value of
106*cdf0e10cSrcweir        zero can be used, if the command never shall be aborted. Different
107*cdf0e10cSrcweir        threads MUST NOT share one command identifier (except <code>0</code>).
108*cdf0e10cSrcweir        This can easily achieved, if every thread that wants to use an
109*cdf0e10cSrcweir        <type>XCommandProcessor</type>, obtains exactly one identifier
110*cdf0e10cSrcweir        using <member>XCommandProcessor::createCommandIdentifier</member>.
111*cdf0e10cSrcweir        This identifier can be used for every call to
112*cdf0e10cSrcweir        <member>XCommandProcessor::execute</member> done by that thread.
113*cdf0e10cSrcweir
114*cdf0e10cSrcweir		@param Environment
115*cdf0e10cSrcweir		is the execution environment.
116*cdf0e10cSrcweir
117*cdf0e10cSrcweir		@returns
118*cdf0e10cSrcweir		the result according to the specification of the command.
119*cdf0e10cSrcweir
120*cdf0e10cSrcweir		@throws CommandAbortedException
121*cdf0e10cSrcweir		to indicate that the command was aborted.
122*cdf0e10cSrcweir
123*cdf0e10cSrcweir        @throws DuplicateCommandIdentifierException
124*cdf0e10cSrcweir        to indicate that two threads tried to use the same command identifier
125*cdf0e10cSrcweir
126*cdf0e10cSrcweir		@throws Exception
127*cdf0e10cSrcweir		if an error occured during the execution of the command.
128*cdf0e10cSrcweir	*/
129*cdf0e10cSrcweir	any execute( [in] Command aCommand,
130*cdf0e10cSrcweir				 [in] long CommandId,
131*cdf0e10cSrcweir				 [in] XCommandEnvironment Environment )
132*cdf0e10cSrcweir		raises ( com::sun::star::uno::Exception, CommandAbortedException );
133*cdf0e10cSrcweir
134*cdf0e10cSrcweir	//-------------------------------------------------------------------------
135*cdf0e10cSrcweir	/** ends the command associated with the given id.
136*cdf0e10cSrcweir
137*cdf0e10cSrcweir        <p>Not every command can be aborted. It's up to the implementation
138*cdf0e10cSrcweir        to decide whether this method will actually end the processing of
139*cdf0e10cSrcweir        the command or simply do nothing.
140*cdf0e10cSrcweir
141*cdf0e10cSrcweir		@param CommandId
142*cdf0e10cSrcweir		is a unique id for the command to abort. This must be the identifier
143*cdf0e10cSrcweir		passed to <member>XCommandProcessor::execute</member> for the command
144*cdf0e10cSrcweir		to abort.
145*cdf0e10cSrcweir	*/
146*cdf0e10cSrcweir	[oneway] void abort( [in] long CommandId );
147*cdf0e10cSrcweir};
148*cdf0e10cSrcweir
149*cdf0e10cSrcweir//=============================================================================
150*cdf0e10cSrcweir
151*cdf0e10cSrcweir}; }; }; };
152*cdf0e10cSrcweir
153*cdf0e10cSrcweir#endif
154