LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/ui/inc - prcntfld.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 18 0.0 %
Date: 2013-07-09 Functions: 0 19 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             : #ifndef _PRCNTFLD_HXX
      20             : #define _PRCNTFLD_HXX
      21             : 
      22             : #include <vcl/field.hxx>
      23             : #include "swdllapi.h"
      24             : #include "uitool.hxx"
      25             : 
      26             : //Wraps a MetricField with extra features, preferred to PercentField
      27             : class SW_DLLPUBLIC PercentFieldWrap
      28             : {
      29             :     MetricField* m_pField;
      30             : 
      31             :     sal_Int64   nRefValue;      // 100% value for conversion (in Twips)
      32             :     sal_Int64   nOldMax;
      33             :     sal_Int64   nOldMin;
      34             :     sal_Int64   nOldSpinSize;
      35             :     sal_Int64   nOldBaseValue;
      36             :     sal_Int64   nLastPercent;
      37             :     sal_Int64   nLastValue;
      38             :     sal_uInt16  nOldDigits;
      39             :     FieldUnit   eOldUnit;
      40             :     bool bLockAutoCalculation; //prevent recalcution of percent values when the
      41             :                                //reference value is changed
      42             : 
      43             :     SW_DLLPRIVATE sal_Int64      ImpPower10(sal_uInt16 n);
      44             : 
      45             : public:
      46             : 
      47             :     PercentFieldWrap();
      48             :     void set(MetricField *pField);
      49             :     const MetricField* get() const { return m_pField; }
      50           0 :     MetricField* get() { return m_pField; }
      51           0 :     void SetUpHdl(const Link& rLink) { m_pField->SetUpHdl(rLink); }
      52           0 :     void SetDownHdl(const Link& rLink) { m_pField->SetDownHdl(rLink); }
      53           0 :     void SetLoseFocusHdl(const Link& rLink) { m_pField->SetLoseFocusHdl(rLink); }
      54           0 :     void SetMetric(FieldUnit eUnit) { ::SetMetric(*m_pField, eUnit); }
      55           0 :     void Enable(bool bEnable = true, bool bChild = true) { m_pField->Enable(bEnable, bChild); }
      56           0 :     bool HasFocus() const { return m_pField->HasFocus(); }
      57           0 :     void SetAccessibleName(const OUString& rName) { m_pField->SetAccessibleName(rName); }
      58           0 :     void SetText(const OUString& rStr) { m_pField->SetText(rStr); }
      59           0 :     void SaveValue() { m_pField->SaveValue(); }
      60           0 :     void ClearModifyFlag() { m_pField->ClearModifyFlag(); }
      61           0 :     OUString GetSavedValue() const { return m_pField->GetSavedValue(); }
      62           0 :     OUString GetText() const { return m_pField->GetText(); }
      63           0 :     void SetMetricFieldMin(sal_Int64 nNewMin) { m_pField->SetMin(nNewMin); }
      64           0 :     void SetMetricFieldMax(sal_Int64 nNewMax) { m_pField->SetMax(nNewMax); }
      65             : 
      66             :     void SetValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
      67             : 
      68           0 :     void SetLast(sal_Int64 nNewLast) { m_pField->SetLast(nNewLast); }
      69             : 
      70             :     void SetPrcntValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
      71             : 
      72             :     void SetUserValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
      73             : 
      74             :     void SetBaseValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
      75             : 
      76             :     sal_Int64 GetValue(FieldUnit eOutUnit = FUNIT_NONE);
      77             : 
      78             :     bool IsValueModified();
      79             : 
      80             :     void SetMax(sal_Int64 nNewMax, FieldUnit eInUnit = FUNIT_NONE);
      81             : 
      82             :     void SetMin(sal_Int64 nNewMin, FieldUnit eInUnit = FUNIT_NONE);
      83             : 
      84             :     sal_Int64 NormalizePercent(sal_Int64 nValue);
      85             :     sal_Int64 DenormalizePercent(sal_Int64 nValue);
      86             : 
      87             :     void SetRefValue(sal_Int64 nValue);
      88             :     sal_Int64 GetRefValue() const { return nRefValue; }
      89             :     sal_Int64 GetRealValue(FieldUnit eOutUnit = FUNIT_NONE);
      90             : 
      91             :     sal_Int64 Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit);
      92             : 
      93             :     void ShowPercent(bool bPercent);
      94             : 
      95             :     sal_uInt16 GetOldDigits() const {return nOldDigits;}
      96             : 
      97             :     void LockAutoCalculation(bool bLock) {bLockAutoCalculation = bLock;}
      98             :     bool IsAutoCalculationLocked() const {return bLockAutoCalculation;}
      99             : };
     100             : 
     101             : 
     102           0 : class SW_DLLPUBLIC PercentField : public MetricField
     103             : {
     104             :     sal_Int64   nRefValue;      // 100% value for conversion (in Twips)
     105             :     sal_Int64   nOldMax;
     106             :     sal_Int64   nOldMin;
     107             :     sal_Int64   nOldSpinSize;
     108             :     sal_Int64   nOldBaseValue;
     109             :     sal_Int64   nLastPercent;
     110             :     sal_Int64   nLastValue;
     111             :     sal_uInt16      nOldDigits;
     112             :     FieldUnit   eOldUnit;
     113             :     sal_Bool    bLockAutoCalculation; //prevent recalcution of percent values when the
     114             :                                         //reference value is changed
     115             : 
     116             :     SW_DLLPRIVATE sal_Int64      ImpPower10(sal_uInt16 n);
     117             : 
     118             :     using MetricField::SetValue;
     119             :     using MetricField::GetValue;
     120             :     using MetricFormatter::SetUserValue;
     121             :     using MetricFormatter::SetBaseValue;
     122             :     using MetricFormatter::SetMax;
     123             :     using MetricFormatter::SetMin;
     124             :     using NumericFormatter::IsValueModified;
     125             : 
     126             : public:
     127             : 
     128             :     virtual void  SetValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
     129             : 
     130             :     PercentField( Window* pWin, const ResId& rResId );
     131             : 
     132             :     void        SetPrcntValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
     133             : 
     134             :     void        SetUserValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
     135             : 
     136             :     void        SetBaseValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
     137             : 
     138             :     sal_Int64        GetValue(FieldUnit eOutUnit = FUNIT_NONE);
     139             : 
     140             :     sal_Bool        IsValueModified();
     141             : 
     142             :     //using NumericFormatter::SetMax;
     143             :     void        SetMax(sal_Int64 nNewMax, FieldUnit eInUnit = FUNIT_NONE);
     144             : 
     145             :     //using NumericFormatter::SetMin;
     146             :     void        SetMin(sal_Int64 nNewMin, FieldUnit eInUnit = FUNIT_NONE);
     147             : 
     148             :     sal_Int64        NormalizePercent(sal_Int64 nValue);
     149             :     sal_Int64        DenormalizePercent(sal_Int64 nValue);
     150             : 
     151             :     void        SetRefValue(sal_Int64 nValue);
     152             :     inline sal_Int64 GetRefValue() const { return nRefValue; }
     153             :     sal_Int64   GetRealValue(FieldUnit eOutUnit = FUNIT_NONE);
     154             : 
     155             :     sal_Int64   Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit);
     156             : 
     157             :     void        ShowPercent(sal_Bool bPercent);
     158             : 
     159             :     sal_uInt16      GetOldDigits() const {return nOldDigits;}
     160             : 
     161           0 :     void        LockAutoCalculation(sal_Bool bLock) {bLockAutoCalculation = bLock;}
     162             :     sal_Bool    IsAutoCalculationLocked()const {return bLockAutoCalculation;}
     163             : };
     164             : 
     165             : #endif // _PRCNTFLD_HXX
     166             : 
     167             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10