LCOV - code coverage report
Current view: top level - dbaccess/source/ext/macromigration - rangeprogressbar.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 14 0.0 %
Date: 2014-04-14 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_RANGEPROGRESSBAR_HXX
      21             : #define INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_RANGEPROGRESSBAR_HXX
      22             : 
      23             : #include <vcl/prgsbar.hxx>
      24             : 
      25             : namespace dbmm
      26             : {
      27             : 
      28             :     // RangeProgressBar
      29             :     /** a slight extension of the usual progress bar, which is able to remember a range
      30             :     */
      31           0 :     class RangeProgressBar : public ProgressBar
      32             :     {
      33             :     public:
      34             :         RangeProgressBar( Window* _pParent, WinBits nWinBits = WB_STDPROGRESSBAR )
      35             :             : ProgressBar( _pParent, nWinBits )
      36             :             , m_nRange(0)
      37             :         { }
      38             : 
      39           0 :         RangeProgressBar( Window* _pParent, const ResId& rResId )
      40             :             : ProgressBar( _pParent, rResId )
      41           0 :             , m_nRange(0)
      42           0 :         { }
      43             : 
      44             :         inline  void        SetRange( sal_uInt32 _nRange );
      45             :         inline  sal_uInt32  GetRange() const;
      46             : 
      47             :         inline  void        SetValue( sal_uInt32 _nValue );
      48             :         inline  sal_uInt32  GetValue() const;
      49             : 
      50             :     private:
      51             :         sal_uInt32  m_nRange;
      52             : 
      53             :     private:
      54             :         using ProgressBar::SetValue;
      55             :         using ProgressBar::GetValue;
      56             :     };
      57             : 
      58           0 :     inline void RangeProgressBar::SetRange( sal_uInt32 _nRange )
      59             :     {
      60           0 :         m_nRange = _nRange;
      61           0 :         if ( !m_nRange )
      62           0 :             m_nRange = 100;
      63           0 :     }
      64             : 
      65           0 :     inline sal_uInt32 RangeProgressBar::GetRange() const
      66             :     {
      67           0 :         return m_nRange;
      68             :     }
      69             : 
      70           0 :     inline void RangeProgressBar::SetValue( sal_uInt32 _nValue )
      71             :     {
      72           0 :         ProgressBar::SetValue( (sal_uInt16)( 100.0 * _nValue / m_nRange ) );
      73           0 :     }
      74             : 
      75             :     inline sal_uInt32 RangeProgressBar::GetValue() const
      76             :     {
      77             :         return (sal_uInt32)( ProgressBar::GetValue() / 100.0 * m_nRange );
      78             :     }
      79             : 
      80             : } // namespace dbmm
      81             : 
      82             : #endif // INCLUDED_DBACCESS_SOURCE_EXT_MACROMIGRATION_RANGEPROGRESSBAR_HXX
      83             : 
      84             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10