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/awt/XProgressBar.hpp>
25 #include <tools/color.hxx>
27 #include <basecontrol.hxx>
29 namespace unocontrols
{
31 #define PROGRESSBAR_FREESPACE 4
32 #define PROGRESSBAR_DEFAULT_HORIZONTAL true
33 #define PROGRESSBAR_DEFAULT_BLOCKDIMENSION Size(1,1)
34 #define PROGRESSBAR_DEFAULT_BACKGROUNDCOLOR sal_Int32(Color( 0x00, 0xC0, 0xC0, 0xC0 )) // lightgray
35 #define PROGRESSBAR_DEFAULT_FOREGROUNDCOLOR sal_Int32(Color( 0x00, 0x00, 0x00, 0x80 )) // blue
36 #define PROGRESSBAR_DEFAULT_MINRANGE INT_MIN
37 #define PROGRESSBAR_DEFAULT_MAXRANGE INT_MAX
38 #define PROGRESSBAR_DEFAULT_BLOCKVALUE 1
39 #define PROGRESSBAR_DEFAULT_VALUE PROGRESSBAR_DEFAULT_MINRANGE
40 #define PROGRESSBAR_LINECOLOR_BRIGHT sal_Int32(Color( 0x00, 0xFF, 0xFF, 0xFF )) // white
41 #define PROGRESSBAR_LINECOLOR_SHADOW sal_Int32(Color( 0x00, 0x00, 0x00, 0x00 )) // black
43 class ProgressBar
: public css::awt::XControlModel
44 , public css::awt::XProgressBar
49 ProgressBar( const css::uno::Reference
< css::uno::XComponentContext
>& rxContext
);
51 virtual ~ProgressBar() override
;
55 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& aType
) override
;
58 @short increment refcount
61 @onerror A RuntimeException is thrown.
64 virtual void SAL_CALL
acquire() throw() override
;
67 @short decrement refcount
70 @onerror A RuntimeException is thrown.
73 virtual void SAL_CALL
release() throw() override
;
77 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes() override
;
81 css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& aType
) override
;
85 virtual void SAL_CALL
setForegroundColor( sal_Int32 nColor
) override
;
87 virtual void SAL_CALL
setBackgroundColor( sal_Int32 nColor
) override
;
89 virtual void SAL_CALL
setValue( sal_Int32 nValue
) override
;
91 virtual void SAL_CALL
setRange(
96 virtual sal_Int32 SAL_CALL
getValue() override
;
100 virtual void SAL_CALL
setPosSize(
110 virtual sal_Bool SAL_CALL
setModel(
111 const css::uno::Reference
< css::awt::XControlModel
>& xModel
114 virtual css::uno::Reference
< css::awt::XControlModel
> SAL_CALL
getModel() override
;
118 static const css::uno::Sequence
< OUString
> impl_getStaticSupportedServiceNames();
120 static const OUString
impl_getStaticImplementationName();
123 virtual void impl_paint(
126 const css::uno::Reference
< css::awt::XGraphics
>& xGraphics
129 void impl_recalcRange();
132 bool m_bHorizontal
; // orientation for steps [true=horizontal/false=vertical]
133 css::awt::Size m_aBlockSize
; // width and height of a block [>=0,0]
134 Color m_nForegroundColor
; // (alpha,r,g,b)
135 Color m_nBackgroundColor
; // (alpha,r,g,b)
136 sal_Int32 m_nMinRange
; // lowest value = 0% [long, <_nMaxRange]
137 sal_Int32 m_nMaxRange
; // highest value = 100% [long, >_nMinRange]
138 double m_nBlockValue
; // value for one block [long, >0]
139 sal_Int32 m_nValue
; // value for progress [long]
145 #endif // INCLUDED_UNOCONTROLS_SOURCE_INC_PROGRESSBAR_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */