update dev300-m58
[ooovba.git] / dbaccess / source / ext / macromigration / rangeprogressbar.hxx
blob285dd951672f577199743f0da979a0dd8a79e0ed
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rangeprogressbar.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef DBACCESS_RANGEPROGRESSBAR_HXX
32 #define DBACCESS_RANGEPROGRESSBAR_HXX
34 /** === begin UNO includes === **/
35 /** === end UNO includes === **/
37 #include <svtools/prgsbar.hxx>
39 //........................................................................
40 namespace dbmm
42 //........................................................................
44 //====================================================================
45 //= RangeProgressBar
46 //====================================================================
47 /** a slight extension of the usual progress bar, which is able to remember a range
49 class RangeProgressBar : public ProgressBar
51 public:
52 RangeProgressBar( Window* _pParent, WinBits nWinBits = WB_STDPROGRESSBAR )
53 :ProgressBar( _pParent, nWinBits )
57 RangeProgressBar( Window* _pParent, const ResId& rResId )
58 :ProgressBar( _pParent, rResId )
62 inline void SetRange( sal_uInt32 _nRange );
63 inline sal_uInt32 GetRange() const;
65 inline void SetValue( sal_uInt32 _nValue );
66 inline sal_uInt32 GetValue() const;
68 private:
69 sal_uInt32 m_nRange;
71 private:
72 using ProgressBar::SetValue;
73 using ProgressBar::GetValue;
76 //--------------------------------------------------------------------
77 inline void RangeProgressBar::SetRange( sal_uInt32 _nRange )
79 m_nRange = _nRange;
80 if ( !m_nRange )
81 m_nRange = 100;
84 //--------------------------------------------------------------------
85 inline sal_uInt32 RangeProgressBar::GetRange() const
87 return m_nRange;
90 //--------------------------------------------------------------------
91 inline void RangeProgressBar::SetValue( sal_uInt32 _nValue )
93 ProgressBar::SetValue( (USHORT)( 100.0 * _nValue / m_nRange ) );
96 //--------------------------------------------------------------------
97 inline sal_uInt32 RangeProgressBar::GetValue() const
99 return (sal_uInt32)( ProgressBar::GetValue() / 100.0 * m_nRange );
103 //........................................................................
104 } // namespace dbmm
105 //........................................................................
107 #endif // DBACCESS_RANGEPROGRESSBAR_HXX