xref: /aoo41x/main/framework/inc/jobs/jobresult.hxx (revision f8e07b45)
1*f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f8e07b45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f8e07b45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f8e07b45SAndrew Rist  * distributed with this work for additional information
6*f8e07b45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f8e07b45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f8e07b45SAndrew Rist  * "License"); you may not use this file except in compliance
9*f8e07b45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f8e07b45SAndrew Rist  *
11*f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f8e07b45SAndrew Rist  *
13*f8e07b45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f8e07b45SAndrew Rist  * software distributed under the License is distributed on an
15*f8e07b45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f8e07b45SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f8e07b45SAndrew Rist  * specific language governing permissions and limitations
18*f8e07b45SAndrew Rist  * under the License.
19*f8e07b45SAndrew Rist  *
20*f8e07b45SAndrew Rist  *************************************************************/
21*f8e07b45SAndrew Rist 
22*f8e07b45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __FRAMEWORK_JOBS_JOBRESULT_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_JOBS_JOBRESULT_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_______________________________________
28cdf0e10cSrcweir // my own includes
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
31cdf0e10cSrcweir #include <macros/debug.hxx>
32cdf0e10cSrcweir #include <stdtypes.h>
33cdf0e10cSrcweir #include <general.h>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir //_______________________________________
36cdf0e10cSrcweir // interface includes
37cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp>
38cdf0e10cSrcweir #include <com/sun/star/frame/DispatchResultEvent.hpp>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir //_______________________________________
41cdf0e10cSrcweir // other includes
42cdf0e10cSrcweir #include <rtl/ustring.hxx>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir //_______________________________________
45cdf0e10cSrcweir // namespace
46cdf0e10cSrcweir 
47cdf0e10cSrcweir namespace framework{
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //_______________________________________
50cdf0e10cSrcweir // public const
51cdf0e10cSrcweir 
52cdf0e10cSrcweir //_______________________________________
53cdf0e10cSrcweir /**
54cdf0e10cSrcweir     @short  represent a result of a finished job execution
55cdf0e10cSrcweir     @descr  Such result instance transport all neccessarry
56cdf0e10cSrcweir             data from the code place where the job was finished
57cdf0e10cSrcweir             to the outside code, where e.g. listener must be notified.
58cdf0e10cSrcweir  */
59cdf0e10cSrcweir class JobResult : private ThreadHelpBase
60cdf0e10cSrcweir {
61cdf0e10cSrcweir     //___________________________________
62cdf0e10cSrcweir     // types
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     public:
65cdf0e10cSrcweir 
66cdf0e10cSrcweir         /**
67cdf0e10cSrcweir             These enum values are used to build a flag mask of possible set
68cdf0e10cSrcweir             parts of an analyzed pure job execution result.
69cdf0e10cSrcweir             An user of this class can decide, if a member of us can be valid
70cdf0e10cSrcweir             or not. So it can indicate, if a job used the special part inside
71cdf0e10cSrcweir             his returned result protocol.
72cdf0e10cSrcweir             To be usable as flags - it must be values of set {0,1,2,4,8,16 ...}!
73cdf0e10cSrcweir          */
74cdf0e10cSrcweir         enum EParts
75cdf0e10cSrcweir         {
76cdf0e10cSrcweir             E_NOPART            =   0,
77cdf0e10cSrcweir             E_ARGUMENTS         =   1,
78cdf0e10cSrcweir             E_DEACTIVATE        =   2,
79cdf0e10cSrcweir             E_DISPATCHRESULT    =   4
80cdf0e10cSrcweir         };
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     //___________________________________
83cdf0e10cSrcweir     // member
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     private:
86cdf0e10cSrcweir 
87cdf0e10cSrcweir         /** hold the original pure result, which was given back by an
88cdf0e10cSrcweir             executed job
89cdf0e10cSrcweir             We analyze it and use it to set all our other members.
90cdf0e10cSrcweir          */
91cdf0e10cSrcweir         css::uno::Any m_aPureResult;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir         /**
94cdf0e10cSrcweir             an user of us must know, which (possible) parts of
95cdf0e10cSrcweir             a "pure result" was realy set by an executed job.
96cdf0e10cSrcweir             Means which other members of this class are valid.
97cdf0e10cSrcweir             This mask can be used to find it out.
98cdf0e10cSrcweir          */
99cdf0e10cSrcweir         sal_uInt32 m_eParts;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir         /**
102cdf0e10cSrcweir             a job can have persistent data
103cdf0e10cSrcweir             They are part of the pure result and will be used to
104cdf0e10cSrcweir             write it to the configuration. But that's part of any
105cdf0e10cSrcweir             user of us. We provide this information here only.
106cdf0e10cSrcweir          */
107cdf0e10cSrcweir         css::uno::Sequence< css::beans::NamedValue > m_lArguments;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir         /**
110cdf0e10cSrcweir             an executed job can force his deactivation
111cdf0e10cSrcweir             But we provide this information here only.
112cdf0e10cSrcweir             Doing so is part of any user of us.
113cdf0e10cSrcweir          */
114cdf0e10cSrcweir         sal_Bool m_bDeactivate;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir         /**
117cdf0e10cSrcweir             represent the part "DispatchResult"
118cdf0e10cSrcweir             It's a full filled event type, which was given
119cdf0e10cSrcweir             back by the executed job. Any user of us can send
120cdf0e10cSrcweir             it to his registered result listener directly.
121cdf0e10cSrcweir          */
122cdf0e10cSrcweir         css::frame::DispatchResultEvent m_aDispatchResult;
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     //___________________________________
125cdf0e10cSrcweir     // native interface
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     public:
128cdf0e10cSrcweir 
129cdf0e10cSrcweir                  JobResult(                                         );
130cdf0e10cSrcweir                  JobResult( const com::sun::star::uno::Any& aResult );
131cdf0e10cSrcweir                  JobResult( const JobResult&                rCopy   );
132cdf0e10cSrcweir         virtual ~JobResult(                                         );
133cdf0e10cSrcweir 
134cdf0e10cSrcweir         void operator=( const JobResult& rCopy );
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         sal_Bool                                     existPart        ( sal_uInt32 eParts ) const;
137cdf0e10cSrcweir         css::uno::Sequence< css::beans::NamedValue > getArguments     (                   ) const;
138cdf0e10cSrcweir         css::frame::DispatchResultEvent              getDispatchResult(                   ) const;
139cdf0e10cSrcweir };
140cdf0e10cSrcweir 
141cdf0e10cSrcweir } // namespace framework
142cdf0e10cSrcweir 
143cdf0e10cSrcweir #endif // __FRAMEWORK_JOBS_JOBRESULT_HXX_
144