1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
21 #define _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
23 #include <com/sun/star/lang/XServiceName.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include "basecontrol.hxx"
28 //____________________________________________________________________________________________________________
30 //____________________________________________________________________________________________________________
32 namespace unocontrols
{
34 #define SERVICENAME_PROGRESSBAR "com.sun.star.awt.XProgressBar"
35 #define IMPLEMENTATIONNAME_PROGRESSBAR "stardiv.UnoControls.ProgressBar"
36 #define PROGRESSBAR_FREESPACE 4
37 #define PROGRESSBAR_DEFAULT_HORIZONTAL sal_True
38 #define PROGRESSBAR_DEFAULT_BLOCKDIMENSION Size(1,1)
39 #define PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lightgray
40 #define PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x80 ) // blue
41 #define PROGRESSBAR_DEFAULT_MINRANGE INT_MIN
42 #define PROGRESSBAR_DEFAULT_MAXRANGE INT_MAX
43 #define PROGRESSBAR_DEFAULT_BLOCKVALUE 1
44 #define PROGRESSBAR_DEFAULT_VALUE PROGRESSBAR_DEFAULT_MINRANGE
45 #define PROGRESSBAR_LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
46 #define PROGRESSBAR_LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
48 class ProgressBar
: public ::com::sun::star::awt::XControlModel
49 , public ::com::sun::star::awt::XProgressBar
53 //____________________________________________________________________________________________________________
55 //____________________________________________________________________________________________________________
59 //________________________________________________________________________________________________________
61 //________________________________________________________________________________________________________
63 /**_________________________________________________________________________________________________________
76 ProgressBar( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
78 /**_________________________________________________________________________________________________________
91 virtual ~ProgressBar();
93 //__________________________________________________________________________________________________________
95 //__________________________________________________________________________________________________________
97 /**_________________________________________________________________________________________________________
110 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& aType
)
111 throw( ::com::sun::star::uno::RuntimeException
);
113 /**_______________________________________________________________________________________________________
114 @short increment refcount
124 @onerror A RuntimeException is thrown.
127 virtual void SAL_CALL
acquire() throw();
129 /**_______________________________________________________________________________________________________
130 @short decrement refcount
140 @onerror A RuntimeException is thrown.
143 virtual void SAL_CALL
release() throw();
145 //__________________________________________________________________________________________________________
147 //__________________________________________________________________________________________________________
149 /**_________________________________________________________________________________________________________
162 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
163 throw( ::com::sun::star::uno::RuntimeException
);
165 //__________________________________________________________________________________________________________
167 //__________________________________________________________________________________________________________
169 /**_________________________________________________________________________________________________________
182 ::com::sun::star::uno::Any SAL_CALL
queryAggregation( const ::com::sun::star::uno::Type
& aType
)
183 throw( ::com::sun::star::uno::RuntimeException
);
185 //________________________________________________________________________________________________________
187 //________________________________________________________________________________________________________
189 /**_________________________________________________________________________________________________________
202 virtual void SAL_CALL
setForegroundColor( sal_Int32 nColor
)
203 throw( ::com::sun::star::uno::RuntimeException
);
205 /**_________________________________________________________________________________________________________
218 virtual void SAL_CALL
setBackgroundColor( sal_Int32 nColor
)
219 throw( ::com::sun::star::uno::RuntimeException
);
221 /**_________________________________________________________________________________________________________
234 virtual void SAL_CALL
setValue( sal_Int32 nValue
) throw( ::com::sun::star::uno::RuntimeException
);
236 /**_________________________________________________________________________________________________________
249 virtual void SAL_CALL
setRange(
252 ) throw( ::com::sun::star::uno::RuntimeException
);
254 /**_________________________________________________________________________________________________________
267 virtual sal_Int32 SAL_CALL
getValue() throw( ::com::sun::star::uno::RuntimeException
);
269 //__________________________________________________________________________________________________________
271 //__________________________________________________________________________________________________________
273 /**_________________________________________________________________________________________________________
286 virtual void SAL_CALL
setPosSize(
292 ) throw( ::com::sun::star::uno::RuntimeException
);
294 //__________________________________________________________________________________________________________
296 //__________________________________________________________________________________________________________
298 /**_________________________________________________________________________________________________________
311 virtual sal_Bool SAL_CALL
setModel(
312 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& xModel
313 ) throw( ::com::sun::star::uno::RuntimeException
);
315 /**_________________________________________________________________________________________________________
328 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> SAL_CALL
getModel()
329 throw( ::com::sun::star::uno::RuntimeException
);
331 //__________________________________________________________________________________________________________
333 //__________________________________________________________________________________________________________
335 /**_________________________________________________________________________________________________________
348 static const ::com::sun::star::uno::Sequence
< OUString
> impl_getStaticSupportedServiceNames();
350 /**_________________________________________________________________________________________________________
363 static const OUString
impl_getStaticImplementationName();
365 //____________________________________________________________________________________________________________
367 //____________________________________________________________________________________________________________
371 /**_________________________________________________________________________________________________________
384 virtual void impl_paint(
387 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>& xGraphics
390 /**_________________________________________________________________________________________________________
403 void impl_recalcRange();
405 //____________________________________________________________________________________________________________
407 //____________________________________________________________________________________________________________
411 sal_Bool m_bHorizontal
; // orientation for steps [true=horizontal/false=vertikal]
412 ::com::sun::star::awt::Size m_aBlockSize
; // width and height of a block [>=0,0]
413 sal_Int32 m_nForegroundColor
; // (alpha,r,g,b)
414 sal_Int32 m_nBackgroundColor
; // (alpha,r,g,b)
415 sal_Int32 m_nMinRange
; // lowest value = 0% [long, <_nMaxRange]
416 sal_Int32 m_nMaxRange
; // highest value = 100% [long, >_nMinRange]
417 double m_nBlockValue
; // value for one block [long, >0]
418 sal_Int32 m_nValue
; // value for progress [long]
420 }; // class ProgressBar
422 } // namespace unocontrols
424 #endif // #ifndef _UNOCONTROLS_PROGRESSBAR_CTRL_HXX
426 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */