xref: /aoo41x/main/framework/inc/jobs/jobresult.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef __FRAMEWORK_JOBS_JOBRESULT_HXX_
29 #define __FRAMEWORK_JOBS_JOBRESULT_HXX_
30 
31 //_______________________________________
32 // my own includes
33 
34 #include <threadhelp/threadhelpbase.hxx>
35 #include <macros/debug.hxx>
36 #include <stdtypes.h>
37 #include <general.h>
38 
39 //_______________________________________
40 // interface includes
41 #include <com/sun/star/beans/NamedValue.hpp>
42 #include <com/sun/star/frame/DispatchResultEvent.hpp>
43 
44 //_______________________________________
45 // other includes
46 #include <rtl/ustring.hxx>
47 
48 //_______________________________________
49 // namespace
50 
51 namespace framework{
52 
53 //_______________________________________
54 // public const
55 
56 //_______________________________________
57 /**
58     @short  represent a result of a finished job execution
59     @descr  Such result instance transport all neccessarry
60             data from the code place where the job was finished
61             to the outside code, where e.g. listener must be notified.
62  */
63 class JobResult : private ThreadHelpBase
64 {
65     //___________________________________
66     // types
67 
68     public:
69 
70         /**
71             These enum values are used to build a flag mask of possible set
72             parts of an analyzed pure job execution result.
73             An user of this class can decide, if a member of us can be valid
74             or not. So it can indicate, if a job used the special part inside
75             his returned result protocol.
76             To be usable as flags - it must be values of set {0,1,2,4,8,16 ...}!
77          */
78         enum EParts
79         {
80             E_NOPART            =   0,
81             E_ARGUMENTS         =   1,
82             E_DEACTIVATE        =   2,
83             E_DISPATCHRESULT    =   4
84         };
85 
86     //___________________________________
87     // member
88 
89     private:
90 
91         /** hold the original pure result, which was given back by an
92             executed job
93             We analyze it and use it to set all our other members.
94          */
95         css::uno::Any m_aPureResult;
96 
97         /**
98             an user of us must know, which (possible) parts of
99             a "pure result" was realy set by an executed job.
100             Means which other members of this class are valid.
101             This mask can be used to find it out.
102          */
103         sal_uInt32 m_eParts;
104 
105         /**
106             a job can have persistent data
107             They are part of the pure result and will be used to
108             write it to the configuration. But that's part of any
109             user of us. We provide this information here only.
110          */
111         css::uno::Sequence< css::beans::NamedValue > m_lArguments;
112 
113         /**
114             an executed job can force his deactivation
115             But we provide this information here only.
116             Doing so is part of any user of us.
117          */
118         sal_Bool m_bDeactivate;
119 
120         /**
121             represent the part "DispatchResult"
122             It's a full filled event type, which was given
123             back by the executed job. Any user of us can send
124             it to his registered result listener directly.
125          */
126         css::frame::DispatchResultEvent m_aDispatchResult;
127 
128     //___________________________________
129     // native interface
130 
131     public:
132 
133                  JobResult(                                         );
134                  JobResult( const com::sun::star::uno::Any& aResult );
135                  JobResult( const JobResult&                rCopy   );
136         virtual ~JobResult(                                         );
137 
138         void operator=( const JobResult& rCopy );
139 
140         sal_Bool                                     existPart        ( sal_uInt32 eParts ) const;
141         css::uno::Sequence< css::beans::NamedValue > getArguments     (                   ) const;
142         css::frame::DispatchResultEvent              getDispatchResult(                   ) const;
143 };
144 
145 } // namespace framework
146 
147 #endif // __FRAMEWORK_JOBS_JOBRESULT_HXX_
148