1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: progressbar.hxx,v $
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 //____________________________________________________________________________________________________________
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 //____________________________________________________________________________________________________________
66 //____________________________________________________________________________________________________________
68 #define SERVICENAME_PROGRESSBAR "com.sun.star.awt.XProgressBar"
69 #define IMPLEMENTATIONNAME_PROGRESSBAR "stardiv.UnoControls.ProgressBar"
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 //____________________________________________________________________________________________________________
84 //____________________________________________________________________________________________________________
86 class ProgressBar
: public UNO3_XCONTROLMODEL
87 , public UNO3_XPROGRESSBAR
91 //____________________________________________________________________________________________________________
93 //____________________________________________________________________________________________________________
97 //________________________________________________________________________________________________________
99 //________________________________________________________________________________________________________
101 /**_________________________________________________________________________________________________________
114 ProgressBar( const UNO3_REFERENCE
< UNO3_XMULTISERVICEFACTORY
>& xFactory
);
116 /**_________________________________________________________________________________________________________
129 virtual ~ProgressBar();
131 //__________________________________________________________________________________________________________
133 //__________________________________________________________________________________________________________
135 /**_________________________________________________________________________________________________________
148 virtual UNO3_ANY SAL_CALL
queryInterface( const UNO3_TYPE
& aType
) throw( UNO3_RUNTIMEEXCEPTION
);
150 /**_______________________________________________________________________________________________________
151 @short increment refcount
161 @onerror A RuntimeException is thrown.
164 virtual void SAL_CALL
acquire() throw();
166 /**_______________________________________________________________________________________________________
167 @short decrement refcount
177 @onerror A RuntimeException is thrown.
180 virtual void SAL_CALL
release() throw();
182 //__________________________________________________________________________________________________________
184 //__________________________________________________________________________________________________________
186 /**_________________________________________________________________________________________________________
199 virtual UNO3_SEQUENCE
< UNO3_TYPE
> SAL_CALL
getTypes() throw( UNO3_RUNTIMEEXCEPTION
);
201 //__________________________________________________________________________________________________________
203 //__________________________________________________________________________________________________________
205 /**_________________________________________________________________________________________________________
218 UNO3_ANY SAL_CALL
queryAggregation( const UNO3_TYPE
& aType
) throw( UNO3_RUNTIMEEXCEPTION
);
220 //________________________________________________________________________________________________________
222 //________________________________________________________________________________________________________
224 /**_________________________________________________________________________________________________________
237 virtual void SAL_CALL
setForegroundColor( sal_Int32 nColor
) throw( UNO3_RUNTIMEEXCEPTION
);
239 /**_________________________________________________________________________________________________________
252 virtual void SAL_CALL
setBackgroundColor( sal_Int32 nColor
) throw( UNO3_RUNTIMEEXCEPTION
);
254 /**_________________________________________________________________________________________________________
267 virtual void SAL_CALL
setValue( sal_Int32 nValue
) throw( UNO3_RUNTIMEEXCEPTION
);
269 /**_________________________________________________________________________________________________________
282 virtual void SAL_CALL
setRange( sal_Int32 nMin
,
283 sal_Int32 nMax
) throw( UNO3_RUNTIMEEXCEPTION
);
285 /**_________________________________________________________________________________________________________
298 virtual sal_Int32 SAL_CALL
getValue() throw( UNO3_RUNTIMEEXCEPTION
);
300 //__________________________________________________________________________________________________________
302 //__________________________________________________________________________________________________________
304 /**_________________________________________________________________________________________________________
317 virtual void SAL_CALL
setPosSize( sal_Int32 nX
,
321 sal_Int16 nFlags
) throw( UNO3_RUNTIMEEXCEPTION
);
323 //__________________________________________________________________________________________________________
325 //__________________________________________________________________________________________________________
327 /**_________________________________________________________________________________________________________
340 virtual sal_Bool SAL_CALL
setModel( const UNO3_REFERENCE
< UNO3_XCONTROLMODEL
>& xModel
) throw( UNO3_RUNTIMEEXCEPTION
);
342 /**_________________________________________________________________________________________________________
355 virtual UNO3_REFERENCE
< UNO3_XCONTROLMODEL
> SAL_CALL
getModel() throw( UNO3_RUNTIMEEXCEPTION
);
357 //__________________________________________________________________________________________________________
359 //__________________________________________________________________________________________________________
361 /**_________________________________________________________________________________________________________
374 static const UNO3_SEQUENCE
< UNO3_OUSTRING
> impl_getStaticSupportedServiceNames();
376 /**_________________________________________________________________________________________________________
389 static const UNO3_OUSTRING
impl_getStaticImplementationName();
391 //____________________________________________________________________________________________________________
393 //____________________________________________________________________________________________________________
397 /**_________________________________________________________________________________________________________
410 virtual void impl_paint( sal_Int32 nX
,
412 const UNO3_REFERENCE
< UNO3_XGRAPHICS
>& xGraphics
);
414 /**_________________________________________________________________________________________________________
427 void impl_recalcRange();
429 //____________________________________________________________________________________________________________
431 //____________________________________________________________________________________________________________
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