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