bump product version to 6.3.0.0.beta1
[LibreOffice.git] / UnoControls / source / inc / progressbar.hxx
blob77b7e7ff48526aa429f9f0bbb583a76d73dd4822
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
45 , public BaseControl
47 public:
49 ProgressBar( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
51 virtual ~ProgressBar() override;
53 // XInterface
55 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
57 /**
58 @short increment refcount
59 @seealso XInterface
60 @seealso release()
61 @onerror A RuntimeException is thrown.
64 virtual void SAL_CALL acquire() throw() override;
66 /**
67 @short decrement refcount
68 @seealso XInterface
69 @seealso acquire()
70 @onerror A RuntimeException is thrown.
73 virtual void SAL_CALL release() throw() override;
75 // XTypeProvider
77 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
79 // XAggregation
81 css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
83 // XProgressBar
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(
92 sal_Int32 nMin ,
93 sal_Int32 nMax
94 ) override;
96 virtual sal_Int32 SAL_CALL getValue() override;
98 // XWindow
100 virtual void SAL_CALL setPosSize(
101 sal_Int32 nX ,
102 sal_Int32 nY ,
103 sal_Int32 nWidth ,
104 sal_Int32 nHeight ,
105 sal_Int16 nFlags
106 ) override;
108 // XControl
110 virtual sal_Bool SAL_CALL setModel(
111 const css::uno::Reference< css::awt::XControlModel >& xModel
112 ) override;
114 virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override;
116 // BaseControl
118 static const css::uno::Sequence< OUString > impl_getStaticSupportedServiceNames();
120 static const OUString impl_getStaticImplementationName();
122 protected:
123 virtual void impl_paint(
124 sal_Int32 nX ,
125 sal_Int32 nY ,
126 const css::uno::Reference< css::awt::XGraphics >& xGraphics
127 ) override;
129 void impl_recalcRange();
131 private:
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: */