1f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f8e07b45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f8e07b45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f8e07b45SAndrew Rist  * distributed with this work for additional information
6f8e07b45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f8e07b45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f8e07b45SAndrew Rist  * "License"); you may not use this file except in compliance
9f8e07b45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f8e07b45SAndrew Rist  *
11f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f8e07b45SAndrew Rist  *
13f8e07b45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f8e07b45SAndrew Rist  * software distributed under the License is distributed on an
15f8e07b45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f8e07b45SAndrew Rist  * KIND, either express or implied.  See the License for the
17f8e07b45SAndrew Rist  * specific language governing permissions and limitations
18f8e07b45SAndrew Rist  * under the License.
19f8e07b45SAndrew Rist  *
20f8e07b45SAndrew Rist  *************************************************************/
21f8e07b45SAndrew Rist 
22f8e07b45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_______________________________________________
28cdf0e10cSrcweir // include files of own module
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <helper/statusindicatorfactory.hxx>
31cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
32cdf0e10cSrcweir #include <macros/xinterface.hxx>
33cdf0e10cSrcweir #include <macros/xtypeprovider.hxx>
34cdf0e10cSrcweir #include <macros/debug.hxx>
35cdf0e10cSrcweir #include <macros/generic.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir //_______________________________________________
38cdf0e10cSrcweir // include UNO interfaces
39cdf0e10cSrcweir #include <com/sun/star/task/XStatusIndicator.hpp>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir //_______________________________________________
42cdf0e10cSrcweir // include all others
43cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
44cdf0e10cSrcweir #include <cppuhelper/weakref.hxx>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir //_______________________________________________
47cdf0e10cSrcweir // namespace
48cdf0e10cSrcweir 
49cdf0e10cSrcweir namespace framework{
50cdf0e10cSrcweir 
51cdf0e10cSrcweir //_______________________________________________
52cdf0e10cSrcweir // definitions
53cdf0e10cSrcweir 
54cdf0e10cSrcweir //_______________________________________________
55cdf0e10cSrcweir /**
56cdf0e10cSrcweir 	@short          implement a status indicator object
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	@descr			With this indicator you can show a message and a progress ...
59cdf0e10cSrcweir 					but you share the output device with other indicator objects,
60cdf0e10cSrcweir                     if this instances was created by the same factory.
61cdf0e10cSrcweir 					Then the last created object has full access to device.
62cdf0e10cSrcweir                     All others change her internal data structure only.
63cdf0e10cSrcweir 
64cdf0e10cSrcweir                     All objects of this StatusIndicator class calls a c++ interface
65cdf0e10cSrcweir                     on the StatusIndicatorFactory (where they was created).
66cdf0e10cSrcweir                     The factory holds all data structures and paints the progress.
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	@devstatus		ready to use
69cdf0e10cSrcweir     @threadsafe     yes
70cdf0e10cSrcweir */
71cdf0e10cSrcweir class StatusIndicator : public  css::lang::XTypeProvider
72cdf0e10cSrcweir                       , public  css::task::XStatusIndicator
73*07a3d7f1SPedro Giffuni                       , private ThreadHelpBase                  // Order of baseclasses is necessary for right initializaton!
74cdf0e10cSrcweir                       , public  ::cppu::OWeakObject             // => XInterface
75cdf0e10cSrcweir {
76cdf0e10cSrcweir     //-------------------------------------------
77cdf0e10cSrcweir     // member
78cdf0e10cSrcweir     private:
79cdf0e10cSrcweir 
80cdf0e10cSrcweir         /** @short  weak reference to our factory
81cdf0e10cSrcweir             @descr  All our interface calls will be forwarded
82cdf0e10cSrcweir                     to a suitable c++ interface on this factory.
83cdf0e10cSrcweir                     But we dont hold our factory alive. They
84cdf0e10cSrcweir                     correspond with e.g. with a Frame service and
85cdf0e10cSrcweir                     will be owned by him. If the frame will be closed
86cdf0e10cSrcweir                     he close our factory too ...
87cdf0e10cSrcweir          */
88cdf0e10cSrcweir         css::uno::WeakReference< css::task::XStatusIndicatorFactory > m_xFactory;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     //-------------------------------------------
91cdf0e10cSrcweir     // c++ interface
92cdf0e10cSrcweir     public:
93cdf0e10cSrcweir 
94cdf0e10cSrcweir         //----------------------------------------
95cdf0e10cSrcweir         /** @short  initialize new instance of this class.
96cdf0e10cSrcweir 
97cdf0e10cSrcweir             @param  pFactory
98cdf0e10cSrcweir                     pointer to our factory
99cdf0e10cSrcweir          */
100cdf0e10cSrcweir         StatusIndicator(StatusIndicatorFactory* pFactory);
101cdf0e10cSrcweir 
102cdf0e10cSrcweir         //----------------------------------------
103cdf0e10cSrcweir         /** @short  does nothing real ....
104cdf0e10cSrcweir          */
105cdf0e10cSrcweir         virtual ~StatusIndicator();
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     //-------------------------------------------
108cdf0e10cSrcweir     // uno interface
109cdf0e10cSrcweir     public:
110cdf0e10cSrcweir 
111cdf0e10cSrcweir         //---------------------------------------
112cdf0e10cSrcweir         // XInterface, XTypeProvider
113cdf0e10cSrcweir         FWK_DECLARE_XINTERFACE
114cdf0e10cSrcweir         FWK_DECLARE_XTYPEPROVIDER
115cdf0e10cSrcweir 
116cdf0e10cSrcweir         //---------------------------------------
117cdf0e10cSrcweir         // XStatusIndicator
118cdf0e10cSrcweir         virtual void SAL_CALL start(const ::rtl::OUString& sText ,
119cdf0e10cSrcweir                                           sal_Int32        nRange)
120cdf0e10cSrcweir             throw(css::uno::RuntimeException);
121cdf0e10cSrcweir 
122cdf0e10cSrcweir         virtual void SAL_CALL end()
123cdf0e10cSrcweir             throw(css::uno::RuntimeException);
124cdf0e10cSrcweir 
125cdf0e10cSrcweir         virtual void SAL_CALL reset()
126cdf0e10cSrcweir             throw(css::uno::RuntimeException);
127cdf0e10cSrcweir 
128cdf0e10cSrcweir         virtual void SAL_CALL setText(const ::rtl::OUString& sText)
129cdf0e10cSrcweir             throw(css::uno::RuntimeException);
130cdf0e10cSrcweir 
131cdf0e10cSrcweir         virtual void SAL_CALL setValue(sal_Int32 nValue)
132cdf0e10cSrcweir             throw(css::uno::RuntimeException);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir }; // class StatusIndicator
135cdf0e10cSrcweir 
136cdf0e10cSrcweir } // namespace framework
137cdf0e10cSrcweir 
138cdf0e10cSrcweir #endif // __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_
139