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_HELPER_STATUSINDICATOR_HXX_
25 #define __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_
26 
27 //_______________________________________________
28 // include files of own module
29 
30 #include <helper/statusindicatorfactory.hxx>
31 #include <threadhelp/threadhelpbase.hxx>
32 #include <macros/xinterface.hxx>
33 #include <macros/xtypeprovider.hxx>
34 #include <macros/debug.hxx>
35 #include <macros/generic.hxx>
36 
37 //_______________________________________________
38 // include UNO interfaces
39 #include <com/sun/star/task/XStatusIndicator.hpp>
40 
41 //_______________________________________________
42 // include all others
43 #include <cppuhelper/weak.hxx>
44 #include <cppuhelper/weakref.hxx>
45 
46 //_______________________________________________
47 // namespace
48 
49 namespace framework{
50 
51 //_______________________________________________
52 // definitions
53 
54 //_______________________________________________
55 /**
56 	@short          implement a status indicator object
57 
58 	@descr			With this indicator you can show a message and a progress ...
59 					but you share the output device with other indicator objects,
60                     if this instances was created by the same factory.
61 					Then the last created object has full access to device.
62                     All others change her internal data structure only.
63 
64                     All objects of this StatusIndicator class calls a c++ interface
65                     on the StatusIndicatorFactory (where they was created).
66                     The factory holds all data structures and paints the progress.
67 
68 	@devstatus		ready to use
69     @threadsafe     yes
70 */
71 class StatusIndicator : public  css::lang::XTypeProvider
72                       , public  css::task::XStatusIndicator
73                       , private ThreadHelpBase                  // Order of baseclasses is necessary for right initializaton!
74                       , public  ::cppu::OWeakObject             // => XInterface
75 {
76     //-------------------------------------------
77     // member
78     private:
79 
80         /** @short  weak reference to our factory
81             @descr  All our interface calls will be forwarded
82                     to a suitable c++ interface on this factory.
83                     But we dont hold our factory alive. They
84                     correspond with e.g. with a Frame service and
85                     will be owned by him. If the frame will be closed
86                     he close our factory too ...
87          */
88         css::uno::WeakReference< css::task::XStatusIndicatorFactory > m_xFactory;
89 
90     //-------------------------------------------
91     // c++ interface
92     public:
93 
94         //----------------------------------------
95         /** @short  initialize new instance of this class.
96 
97             @param  pFactory
98                     pointer to our factory
99          */
100         StatusIndicator(StatusIndicatorFactory* pFactory);
101 
102         //----------------------------------------
103         /** @short  does nothing real ....
104          */
105         virtual ~StatusIndicator();
106 
107     //-------------------------------------------
108     // uno interface
109     public:
110 
111         //---------------------------------------
112         // XInterface, XTypeProvider
113         FWK_DECLARE_XINTERFACE
114         FWK_DECLARE_XTYPEPROVIDER
115 
116         //---------------------------------------
117         // XStatusIndicator
118         virtual void SAL_CALL start(const ::rtl::OUString& sText ,
119                                           sal_Int32        nRange)
120             throw(css::uno::RuntimeException);
121 
122         virtual void SAL_CALL end()
123             throw(css::uno::RuntimeException);
124 
125         virtual void SAL_CALL reset()
126             throw(css::uno::RuntimeException);
127 
128         virtual void SAL_CALL setText(const ::rtl::OUString& sText)
129             throw(css::uno::RuntimeException);
130 
131         virtual void SAL_CALL setValue(sal_Int32 nValue)
132             throw(css::uno::RuntimeException);
133 
134 }; // class StatusIndicator
135 
136 } // namespace framework
137 
138 #endif // __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_
139