LCOV - code coverage report
Current view: top level - dbaccess/source/ext/macromigration - rangeprogressbar.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 14 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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 DBACCESS_RANGEPROGRESSBAR_HXX
      21                 :            : #define DBACCESS_RANGEPROGRESSBAR_HXX
      22                 :            : 
      23                 :            : #include <svtools/prgsbar.hxx>
      24                 :            : 
      25                 :            : //........................................................................
      26                 :            : namespace dbmm
      27                 :            : {
      28                 :            : //........................................................................
      29                 :            : 
      30                 :            :     //====================================================================
      31                 :            :     //= RangeProgressBar
      32                 :            :     //====================================================================
      33                 :            :     /** a slight extension of the usual progress bar, which is able to remember a range
      34                 :            :     */
      35                 :          0 :     class RangeProgressBar : public ProgressBar
      36                 :            :     {
      37                 :            :     public:
      38                 :            :         RangeProgressBar( Window* _pParent, WinBits nWinBits = WB_STDPROGRESSBAR )
      39                 :            :             :ProgressBar( _pParent, nWinBits )
      40                 :            :         {
      41                 :            :         }
      42                 :            : 
      43                 :          0 :         RangeProgressBar( Window* _pParent, const ResId& rResId )
      44                 :          0 :             :ProgressBar( _pParent, rResId )
      45                 :            :         {
      46                 :          0 :         }
      47                 :            : 
      48                 :            :         inline  void        SetRange( sal_uInt32 _nRange );
      49                 :            :         inline  sal_uInt32  GetRange() const;
      50                 :            : 
      51                 :            :         inline  void        SetValue( sal_uInt32 _nValue );
      52                 :            :         inline  sal_uInt32  GetValue() const;
      53                 :            : 
      54                 :            :     private:
      55                 :            :         sal_uInt32  m_nRange;
      56                 :            : 
      57                 :            :     private:
      58                 :            :         using ProgressBar::SetValue;
      59                 :            :         using ProgressBar::GetValue;
      60                 :            :     };
      61                 :            : 
      62                 :            :     //--------------------------------------------------------------------
      63                 :          0 :     inline void RangeProgressBar::SetRange( sal_uInt32 _nRange )
      64                 :            :     {
      65                 :          0 :         m_nRange = _nRange;
      66                 :          0 :         if ( !m_nRange )
      67                 :          0 :             m_nRange = 100;
      68                 :          0 :     }
      69                 :            : 
      70                 :            :     //--------------------------------------------------------------------
      71                 :          0 :     inline sal_uInt32 RangeProgressBar::GetRange() const
      72                 :            :     {
      73                 :          0 :         return m_nRange;
      74                 :            :     }
      75                 :            : 
      76                 :            :     //--------------------------------------------------------------------
      77                 :          0 :     inline void RangeProgressBar::SetValue( sal_uInt32 _nValue )
      78                 :            :     {
      79                 :          0 :         ProgressBar::SetValue( (sal_uInt16)( 100.0 * _nValue / m_nRange ) );
      80                 :          0 :     }
      81                 :            : 
      82                 :            :     //--------------------------------------------------------------------
      83                 :            :     inline sal_uInt32 RangeProgressBar::GetValue() const
      84                 :            :     {
      85                 :            :         return (sal_uInt32)( ProgressBar::GetValue() / 100.0 * m_nRange );
      86                 :            :     }
      87                 :            : 
      88                 :            : 
      89                 :            : //........................................................................
      90                 :            : } // namespace dbmm
      91                 :            : //........................................................................
      92                 :            : 
      93                 :            : #endif // DBACCESS_RANGEPROGRESSBAR_HXX
      94                 :            : 
      95                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10