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 css::awt::XControlModel
47 , public css::awt::XProgressBar
53 ProgressBar( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
55 virtual ~ProgressBar() override
;
59 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& aType
) override
;
61 /**_______________________________________________________________________________________________________
62 @short increment refcount
65 @onerror A RuntimeException is thrown.
68 virtual void SAL_CALL
acquire() throw() override
;
70 /**_______________________________________________________________________________________________________
71 @short decrement refcount
74 @onerror A RuntimeException is thrown.
77 virtual void SAL_CALL
release() throw() override
;
81 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() override
;
85 css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& aType
) override
;
89 virtual void SAL_CALL
setForegroundColor( sal_Int32 nColor
) override
;
91 virtual void SAL_CALL
setBackgroundColor( sal_Int32 nColor
) override
;
93 virtual void SAL_CALL
setValue( sal_Int32 nValue
) override
;
95 virtual void SAL_CALL
setRange(
100 virtual sal_Int32 SAL_CALL
getValue() override
;
104 virtual void SAL_CALL
setPosSize(
114 virtual sal_Bool SAL_CALL
setModel(
115 const css::uno::Reference
< css::awt::XControlModel
>& xModel
118 virtual css::uno::Reference
< css::awt::XControlModel
> SAL_CALL
getModel() override
;
122 static const css::uno::Sequence
< OUString
> impl_getStaticSupportedServiceNames();
124 static const OUString
impl_getStaticImplementationName();
128 virtual void impl_paint(
131 const css::uno::Reference
< css::awt::XGraphics
>& xGraphics
134 void impl_recalcRange();
138 bool m_bHorizontal
; // orientation for steps [true=horizontal/false=vertical]
139 css::awt::Size m_aBlockSize
; // width and height of a block [>=0,0]
140 sal_Int32 m_nForegroundColor
; // (alpha,r,g,b)
141 sal_Int32 m_nBackgroundColor
; // (alpha,r,g,b)
142 sal_Int32 m_nMinRange
; // lowest value = 0% [long, <_nMaxRange]
143 sal_Int32 m_nMaxRange
; // highest value = 100% [long, >_nMinRange]
144 double m_nBlockValue
; // value for one block [long, >0]
145 sal_Int32 m_nValue
; // value for progress [long]
147 }; // class ProgressBar
149 } // namespace unocontrols
151 #endif // INCLUDED_UNOCONTROLS_SOURCE_INC_PROGRESSBAR_HXX
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */