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 INCLUDED_UNOCONTROLS_SOURCE_INC_PROGRESSBAR_HXX
21 #define INCLUDED_UNOCONTROLS_SOURCE_INC_PROGRESSBAR_HXX
23 #include <com/sun/star/lang/XServiceName.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <vcl/vclptr.hxx>
28 #include "basecontrol.hxx"
32 namespace unocontrols
{
34 #define PROGRESSBAR_FREESPACE 4
35 #define PROGRESSBAR_DEFAULT_HORIZONTAL true
36 #define PROGRESSBAR_DEFAULT_BLOCKDIMENSION Size(1,1)
37 #define PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR TRGB_COLORDATA( 0x00, 0xC0, 0xC0, 0xC0 ) // lightgray
38 #define PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x80 ) // blue
39 #define PROGRESSBAR_DEFAULT_MINRANGE INT_MIN
40 #define PROGRESSBAR_DEFAULT_MAXRANGE INT_MAX
41 #define PROGRESSBAR_DEFAULT_BLOCKVALUE 1
42 #define PROGRESSBAR_DEFAULT_VALUE PROGRESSBAR_DEFAULT_MINRANGE
43 #define PROGRESSBAR_LINECOLOR_BRIGHT TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF ) // white
44 #define PROGRESSBAR_LINECOLOR_SHADOW TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 ) // black
46 class ProgressBar
: public ::com::sun::star::awt::XControlModel
47 , public ::com::sun::star::awt::XProgressBar
57 /**_________________________________________________________________________________________________________
70 ProgressBar( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
72 /**_________________________________________________________________________________________________________
85 virtual ~ProgressBar();
89 /**_________________________________________________________________________________________________________
102 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& aType
)
103 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
105 /**_______________________________________________________________________________________________________
106 @short increment refcount
109 @onerror A RuntimeException is thrown.
112 virtual void SAL_CALL
acquire() throw() SAL_OVERRIDE
;
114 /**_______________________________________________________________________________________________________
115 @short decrement refcount
118 @onerror A RuntimeException is thrown.
121 virtual void SAL_CALL
release() throw() SAL_OVERRIDE
;
125 /**_________________________________________________________________________________________________________
138 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
139 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
143 /**_________________________________________________________________________________________________________
156 ::com::sun::star::uno::Any SAL_CALL
queryAggregation( const ::com::sun::star::uno::Type
& aType
)
157 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
161 /**_________________________________________________________________________________________________________
174 virtual void SAL_CALL
setForegroundColor( sal_Int32 nColor
)
175 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
177 /**_________________________________________________________________________________________________________
190 virtual void SAL_CALL
setBackgroundColor( sal_Int32 nColor
)
191 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
193 /**_________________________________________________________________________________________________________
206 virtual void SAL_CALL
setValue( sal_Int32 nValue
) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
208 /**_________________________________________________________________________________________________________
221 virtual void SAL_CALL
setRange(
224 ) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
226 /**_________________________________________________________________________________________________________
239 virtual sal_Int32 SAL_CALL
getValue() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
243 /**_________________________________________________________________________________________________________
256 virtual void SAL_CALL
setPosSize(
262 ) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
266 /**_________________________________________________________________________________________________________
279 virtual sal_Bool SAL_CALL
setModel(
280 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& xModel
281 ) throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
283 /**_________________________________________________________________________________________________________
296 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> SAL_CALL
getModel()
297 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
301 /**_________________________________________________________________________________________________________
314 static const ::com::sun::star::uno::Sequence
< OUString
> impl_getStaticSupportedServiceNames();
316 /**_________________________________________________________________________________________________________
329 static const OUString
impl_getStaticImplementationName();
335 /**_________________________________________________________________________________________________________
348 virtual void impl_paint(
351 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>& xGraphics
354 /**_________________________________________________________________________________________________________
367 void impl_recalcRange();
373 bool m_bHorizontal
; // orientation for steps [true=horizontal/false=vertikal]
374 ::com::sun::star::awt::Size m_aBlockSize
; // width and height of a block [>=0,0]
375 sal_Int32 m_nForegroundColor
; // (alpha,r,g,b)
376 sal_Int32 m_nBackgroundColor
; // (alpha,r,g,b)
377 sal_Int32 m_nMinRange
; // lowest value = 0% [long, <_nMaxRange]
378 sal_Int32 m_nMaxRange
; // highest value = 100% [long, >_nMinRange]
379 double m_nBlockValue
; // value for one block [long, >0]
380 sal_Int32 m_nValue
; // value for progress [long]
382 }; // class ProgressBar
384 } // namespace unocontrols
386 #endif // INCLUDED_UNOCONTROLS_SOURCE_INC_PROGRESSBAR_HXX
388 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */