Update ooo320-m1
[ooovba.git] / UnoControls / source / inc / progressbar.hxx
blob7a50b9d5f130c2f4cbda13f65a540ec00857a743
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: progressbar.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
32 #define _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
34 //____________________________________________________________________________________________________________
35 // includes of other projects
36 //____________________________________________________________________________________________________________
38 #include <com/sun/star/lang/XServiceName.hpp>
39 #include <com/sun/star/lang/XServiceInfo.hpp>
41 //____________________________________________________________________________________________________________
42 // includes of my own project
43 //____________________________________________________________________________________________________________
44 #include "basecontrol.hxx"
46 //____________________________________________________________________________________________________________
47 // namespaces
48 //____________________________________________________________________________________________________________
50 namespace unocontrols{
52 #define UNO3_REFERENCE ::com::sun::star::uno::Reference
53 #define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
54 #define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
55 #define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
56 #define UNO3_XPROGRESSBAR ::com::sun::star::awt::XProgressBar
57 #define UNO3_ANY ::com::sun::star::uno::Any
58 #define UNO3_TYPE ::com::sun::star::uno::Type
59 #define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
60 #define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
61 #define UNO3_OUSTRING ::rtl::OUString
62 #define UNO3_SIZE ::com::sun::star::awt::Size
64 //____________________________________________________________________________________________________________
65 // defines
66 //____________________________________________________________________________________________________________
68 #define SERVICENAME_PROGRESSBAR "com.sun.star.awt.XProgressBar"
69 #define IMPLEMENTATIONNAME_PROGRESSBAR "stardiv.UnoControls.ProgressBar"
70 #define FREESPACE 4
71 #define DEFAULT_HORIZONTAL sal_True
72 #define DEFAULT_BLOCKDIMENSION Size(1,1)
73 #define DEFAULT_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lightgray
74 #define DEFAULT_FOREGROUNDCOLOR TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x80 ) // blue
75 #define DEFAULT_MINRANGE INT_MIN
76 #define DEFAULT_MAXRANGE INT_MAX
77 #define DEFAULT_BLOCKVALUE 1
78 #define DEFAULT_VALUE DEFAULT_MINRANGE
79 #define LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
80 #define LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
82 //____________________________________________________________________________________________________________
83 // classes
84 //____________________________________________________________________________________________________________
86 class ProgressBar : public UNO3_XCONTROLMODEL
87 , public UNO3_XPROGRESSBAR
88 , public BaseControl
91 //____________________________________________________________________________________________________________
92 // public methods
93 //____________________________________________________________________________________________________________
95 public:
97 //________________________________________________________________________________________________________
98 // construct/destruct
99 //________________________________________________________________________________________________________
101 /**_________________________________________________________________________________________________________
102 @short
103 @descr
105 @seealso
107 @param
109 @return
111 @onerror
114 ProgressBar( const UNO3_REFERENCE< UNO3_XMULTISERVICEFACTORY >& xFactory );
116 /**_________________________________________________________________________________________________________
117 @short
118 @descr
120 @seealso
122 @param
124 @return
126 @onerror
129 virtual ~ProgressBar();
131 //__________________________________________________________________________________________________________
132 // XInterface
133 //__________________________________________________________________________________________________________
135 /**_________________________________________________________________________________________________________
136 @short
137 @descr
139 @seealso
141 @param
143 @return
145 @onerror
148 virtual UNO3_ANY SAL_CALL queryInterface( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
150 /**_______________________________________________________________________________________________________
151 @short increment refcount
152 @descr -
154 @seealso XInterface
155 @seealso release()
157 @param -
159 @return -
161 @onerror A RuntimeException is thrown.
164 virtual void SAL_CALL acquire() throw();
166 /**_______________________________________________________________________________________________________
167 @short decrement refcount
168 @descr -
170 @seealso XInterface
171 @seealso acquire()
173 @param -
175 @return -
177 @onerror A RuntimeException is thrown.
180 virtual void SAL_CALL release() throw();
182 //__________________________________________________________________________________________________________
183 // XTypeProvider
184 //__________________________________________________________________________________________________________
186 /**_________________________________________________________________________________________________________
187 @short
188 @descr
190 @seealso
192 @param
194 @return
196 @onerror
199 virtual UNO3_SEQUENCE< UNO3_TYPE > SAL_CALL getTypes() throw( UNO3_RUNTIMEEXCEPTION );
201 //__________________________________________________________________________________________________________
202 // XAggregation
203 //__________________________________________________________________________________________________________
205 /**_________________________________________________________________________________________________________
206 @short
207 @descr
209 @seealso
211 @param
213 @return
215 @onerror
218 UNO3_ANY SAL_CALL queryAggregation( const UNO3_TYPE& aType ) throw( UNO3_RUNTIMEEXCEPTION );
220 //________________________________________________________________________________________________________
221 // XProgressBar
222 //________________________________________________________________________________________________________
224 /**_________________________________________________________________________________________________________
225 @short
226 @descr
228 @seealso
230 @param
232 @return
234 @onerror
237 virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION );
239 /**_________________________________________________________________________________________________________
240 @short
241 @descr
243 @seealso
245 @param
247 @return
249 @onerror
252 virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( UNO3_RUNTIMEEXCEPTION );
254 /**_________________________________________________________________________________________________________
255 @short
256 @descr
258 @seealso
260 @param
262 @return
264 @onerror
267 virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( UNO3_RUNTIMEEXCEPTION );
269 /**_________________________________________________________________________________________________________
270 @short
271 @descr
273 @seealso
275 @param
277 @return
279 @onerror
282 virtual void SAL_CALL setRange( sal_Int32 nMin ,
283 sal_Int32 nMax ) throw( UNO3_RUNTIMEEXCEPTION );
285 /**_________________________________________________________________________________________________________
286 @short
287 @descr
289 @seealso
291 @param
293 @return
295 @onerror
298 virtual sal_Int32 SAL_CALL getValue() throw( UNO3_RUNTIMEEXCEPTION );
300 //__________________________________________________________________________________________________________
301 // XWindow
302 //__________________________________________________________________________________________________________
304 /**_________________________________________________________________________________________________________
305 @short
306 @descr
308 @seealso
310 @param
312 @return
314 @onerror
317 virtual void SAL_CALL setPosSize( sal_Int32 nX ,
318 sal_Int32 nY ,
319 sal_Int32 nWidth ,
320 sal_Int32 nHeight ,
321 sal_Int16 nFlags ) throw( UNO3_RUNTIMEEXCEPTION );
323 //__________________________________________________________________________________________________________
324 // XControl
325 //__________________________________________________________________________________________________________
327 /**_________________________________________________________________________________________________________
328 @short
329 @descr
331 @seealso
333 @param
335 @return
337 @onerror
340 virtual sal_Bool SAL_CALL setModel( const UNO3_REFERENCE< UNO3_XCONTROLMODEL >& xModel ) throw( UNO3_RUNTIMEEXCEPTION );
342 /**_________________________________________________________________________________________________________
343 @short
344 @descr
346 @seealso
348 @param
350 @return
352 @onerror
355 virtual UNO3_REFERENCE< UNO3_XCONTROLMODEL > SAL_CALL getModel() throw( UNO3_RUNTIMEEXCEPTION );
357 //__________________________________________________________________________________________________________
358 // BaseControl
359 //__________________________________________________________________________________________________________
361 /**_________________________________________________________________________________________________________
362 @short
363 @descr
365 @seealso
367 @param
369 @return
371 @onerror
374 static const UNO3_SEQUENCE< UNO3_OUSTRING > impl_getStaticSupportedServiceNames();
376 /**_________________________________________________________________________________________________________
377 @short
378 @descr
380 @seealso
382 @param
384 @return
386 @onerror
389 static const UNO3_OUSTRING impl_getStaticImplementationName();
391 //____________________________________________________________________________________________________________
392 // protected methods
393 //____________________________________________________________________________________________________________
395 protected:
397 /**_________________________________________________________________________________________________________
398 @short
399 @descr
401 @seealso
403 @param
405 @return
407 @onerror
410 virtual void impl_paint( sal_Int32 nX ,
411 sal_Int32 nY ,
412 const UNO3_REFERENCE< UNO3_XGRAPHICS >& xGraphics );
414 /**_________________________________________________________________________________________________________
415 @short
416 @descr
418 @seealso
420 @param
422 @return
424 @onerror
427 void impl_recalcRange();
429 //____________________________________________________________________________________________________________
430 // private variables
431 //____________________________________________________________________________________________________________
433 private:
435 sal_Bool m_bHorizontal ; // orientation for steps [true=horizontal/false=vertikal]
436 UNO3_SIZE m_aBlockSize ; // width and height of a block [>=0,0]
437 sal_Int32 m_nForegroundColor ; // (alpha,r,g,b)
438 sal_Int32 m_nBackgroundColor ; // (alpha,r,g,b)
439 sal_Int32 m_nMinRange ; // lowest value = 0% [long, <_nMaxRange]
440 sal_Int32 m_nMaxRange ; // highest value = 100% [long, >_nMinRange]
441 double m_nBlockValue ; // value for one block [long, >0]
442 sal_Int32 m_nValue ; // value for progress [long]
444 }; // class ProgressBar
446 } // namespace unocontrols
448 #endif // #ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX