From 00f99142adfef77b8eb662fb780ab6e7d738ccd5 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Thu, 6 Mar 2008 17:07:03 +0000 Subject: [PATCH] INTEGRATION: CWS odbmacros2 (1.1.4); FILE ADDED 2008/03/05 21:03:48 fs 1.1.4.2: ongoing work - merge all the changes which so far happened on the intermediate branch 'odbmacros_2_5' 2008/02/14 22:25:00 fs 1.1.4.1: file rangeprogressbar.hxx was added on branch cws_src680_odbmacros2 on 2008-03-05 21:03:48 +0000 --- .../ext/macromigration/rangeprogressbar.hxx | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 dbaccess/source/ext/macromigration/rangeprogressbar.hxx diff --git a/dbaccess/source/ext/macromigration/rangeprogressbar.hxx b/dbaccess/source/ext/macromigration/rangeprogressbar.hxx new file mode 100644 index 000000000000..b756f8f8d744 --- /dev/null +++ b/dbaccess/source/ext/macromigration/rangeprogressbar.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: rangeprogressbar.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: kz $ $Date: 2008-03-06 18:07:03 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef DBACCESS_RANGEPROGRESSBAR_HXX +#define DBACCESS_RANGEPROGRESSBAR_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include + +//........................................................................ +namespace dbmm +{ +//........................................................................ + + //==================================================================== + //= RangeProgressBar + //==================================================================== + /** a slight extension of the usual progress bar, which is able to remember a range + */ + class RangeProgressBar : public ProgressBar + { + public: + RangeProgressBar( Window* _pParent, WinBits nWinBits = WB_STDPROGRESSBAR ) + :ProgressBar( _pParent, nWinBits ) + { + } + + RangeProgressBar( Window* _pParent, const ResId& rResId ) + :ProgressBar( _pParent, rResId ) + { + } + + inline void SetRange( sal_uInt32 _nRange ); + inline sal_uInt32 GetRange() const; + + inline void SetValue( sal_uInt32 _nValue ); + inline sal_uInt32 GetValue() const; + + private: + sal_uInt32 m_nRange; + + private: + using ProgressBar::SetValue; + using ProgressBar::GetValue; + }; + + //-------------------------------------------------------------------- + inline void RangeProgressBar::SetRange( sal_uInt32 _nRange ) + { + m_nRange = _nRange; + if ( !m_nRange ) + m_nRange = 100; + } + + //-------------------------------------------------------------------- + inline sal_uInt32 RangeProgressBar::GetRange() const + { + return m_nRange; + } + + //-------------------------------------------------------------------- + inline void RangeProgressBar::SetValue( sal_uInt32 _nValue ) + { + ProgressBar::SetValue( (USHORT)( 100.0 * _nValue / m_nRange ) ); + } + + //-------------------------------------------------------------------- + inline sal_uInt32 RangeProgressBar::GetValue() const + { + return (sal_uInt32)( ProgressBar::GetValue() / 100.0 * m_nRange ); + } + + +//........................................................................ +} // namespace dbmm +//........................................................................ + +#endif // DBACCESS_RANGEPROGRESSBAR_HXX