LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/ui/utlui - prcntfld.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 260 0.4 %
Date: 2013-07-09 Functions: 2 31 6.5 %
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             : 
      21             : #include "prcntfld.hxx"
      22             : 
      23           0 : PercentField::PercentField( Window* pWin, const ResId& rResId ) :
      24             :         MetricField ( pWin, rResId ),
      25             : 
      26             :         nOldMax     (0),
      27             :         nOldMin     (0),
      28             :         nLastPercent(-1),
      29             :         nLastValue  (-1),
      30             :         eOldUnit    (FUNIT_NONE),
      31           0 :         bLockAutoCalculation(sal_False)
      32             : {
      33             : 
      34           0 :     nOldSpinSize = GetSpinSize();
      35           0 :     nRefValue = DenormalizePercent(MetricField::GetMax(FUNIT_TWIP));
      36           0 :     nOldDigits = GetDecimalDigits();
      37           0 :     SetCustomUnitText(OUString('%'));
      38           0 : }
      39             : 
      40           0 : PercentFieldWrap::PercentFieldWrap()
      41             :     : nOldMax(0)
      42             :     , nOldMin(0)
      43             :     , nLastPercent(-1)
      44             :     , nLastValue(-1)
      45             :     , eOldUnit(FUNIT_NONE)
      46           0 :     , bLockAutoCalculation(sal_False)
      47             : {
      48           0 : }
      49             : 
      50           0 : void PercentFieldWrap::set(MetricField *pField)
      51             : {
      52           0 :     m_pField = pField;
      53           0 :     nOldSpinSize = m_pField->GetSpinSize();
      54           0 :     nRefValue = DenormalizePercent(m_pField->GetMax(FUNIT_TWIP));
      55           0 :     nOldDigits = m_pField->GetDecimalDigits();
      56           0 :     m_pField->SetCustomUnitText(OUString('%'));
      57           0 : }
      58             : 
      59           0 : void PercentField::SetRefValue(sal_Int64 nValue)
      60             : {
      61           0 :     sal_Int64 nRealValue = GetRealValue(eOldUnit);
      62             : 
      63           0 :     nRefValue = nValue;
      64             : 
      65           0 :     if (!bLockAutoCalculation && (GetUnit() == FUNIT_CUSTOM))
      66           0 :         SetPrcntValue(nRealValue, eOldUnit);
      67           0 : }
      68             : 
      69           0 : void PercentFieldWrap::SetRefValue(sal_Int64 nValue)
      70             : {
      71           0 :     sal_Int64 nRealValue = GetRealValue(eOldUnit);
      72             : 
      73           0 :     nRefValue = nValue;
      74             : 
      75           0 :     if (!bLockAutoCalculation && (m_pField->GetUnit() == FUNIT_CUSTOM))
      76           0 :         SetPrcntValue(nRealValue, eOldUnit);
      77           0 : }
      78             : 
      79           0 : void PercentField::ShowPercent(sal_Bool bPercent)
      80             : {
      81           0 :     if ((bPercent && GetUnit() == FUNIT_CUSTOM) ||
      82           0 :         (!bPercent && GetUnit() != FUNIT_CUSTOM))
      83           0 :         return;
      84             : 
      85             :     sal_Int64 nOldValue;
      86             : 
      87           0 :     if (bPercent)
      88             :     {
      89             :         sal_Int64 nAktWidth, nPercent;
      90             : 
      91           0 :         nOldValue = GetValue();
      92             : 
      93           0 :         eOldUnit = GetUnit();
      94           0 :         nOldDigits = GetDecimalDigits();
      95           0 :         nOldMin = GetMin();
      96           0 :         nOldMax = GetMax();
      97           0 :         nOldSpinSize = GetSpinSize();
      98           0 :         nOldBaseValue = GetBaseValue();
      99           0 :         SetUnit(FUNIT_CUSTOM);
     100           0 :         SetDecimalDigits( 0 );
     101             : 
     102           0 :         nAktWidth = ConvertValue(nOldMin, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
     103             :         // round to 0.5 percent
     104           0 :         nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
     105             : 
     106           0 :         MetricField::SetMin(std::max(static_cast< sal_Int64 >(1), nPercent));
     107           0 :         MetricField::SetMax(100);
     108           0 :         SetSpinSize(5);
     109           0 :         MetricField::SetBaseValue(0);
     110           0 :         if (nOldValue != nLastValue)
     111             :         {
     112           0 :             nAktWidth = ConvertValue(nOldValue, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
     113           0 :             nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
     114           0 :             MetricFormatter::SetValue(nPercent);
     115           0 :             nLastPercent = nPercent;
     116           0 :             nLastValue = nOldValue;
     117             :         }
     118             :         else
     119           0 :             MetricFormatter::SetValue(nLastPercent);
     120             :     }
     121             :     else
     122             :     {
     123           0 :         sal_Int64 nOldPercent = GetValue(FUNIT_CUSTOM);
     124             : 
     125           0 :         nOldValue = Convert(GetValue(), GetUnit(), eOldUnit);
     126             : 
     127           0 :         SetUnit(eOldUnit);
     128           0 :         SetDecimalDigits(nOldDigits);
     129           0 :         MetricField::SetMin(nOldMin);
     130           0 :         MetricField::SetMax(nOldMax);
     131           0 :         SetSpinSize(nOldSpinSize);
     132           0 :         MetricField::SetBaseValue(nOldBaseValue);
     133             : 
     134           0 :         if (nOldPercent != nLastPercent)
     135             :         {
     136           0 :             SetPrcntValue(nOldValue, eOldUnit);
     137           0 :             nLastPercent = nOldPercent;
     138           0 :             nLastValue = nOldValue;
     139             :         }
     140             :         else
     141           0 :             SetPrcntValue(nLastValue, eOldUnit);
     142             :     }
     143             : }
     144             : 
     145           0 : void PercentFieldWrap::ShowPercent(bool bPercent)
     146             : {
     147           0 :     if ((bPercent && m_pField->GetUnit() == FUNIT_CUSTOM) ||
     148           0 :         (!bPercent && m_pField->GetUnit() != FUNIT_CUSTOM))
     149           0 :         return;
     150             : 
     151             :     sal_Int64 nOldValue;
     152             : 
     153           0 :     if (bPercent)
     154             :     {
     155             :         sal_Int64 nAktWidth, nPercent;
     156             : 
     157           0 :         nOldValue = GetValue();
     158             : 
     159           0 :         eOldUnit = m_pField->GetUnit();
     160           0 :         nOldDigits = m_pField->GetDecimalDigits();
     161           0 :         nOldMin = m_pField->GetMin();
     162           0 :         nOldMax = m_pField->GetMax();
     163           0 :         nOldSpinSize = m_pField->GetSpinSize();
     164           0 :         nOldBaseValue = m_pField->GetBaseValue();
     165           0 :         m_pField->SetUnit(FUNIT_CUSTOM);
     166           0 :         m_pField->SetDecimalDigits( 0 );
     167             : 
     168           0 :         nAktWidth = m_pField->ConvertValue(nOldMin, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
     169             :         // round to 0.5 percent
     170           0 :         nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
     171             : 
     172           0 :         m_pField->SetMin(std::max(static_cast< sal_Int64 >(1), nPercent));
     173           0 :         m_pField->SetMax(100);
     174           0 :         m_pField->SetSpinSize(5);
     175           0 :         m_pField->SetBaseValue(0);
     176           0 :         if (nOldValue != nLastValue)
     177             :         {
     178           0 :             nAktWidth = m_pField->ConvertValue(nOldValue, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
     179           0 :             nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
     180           0 :             m_pField->SetValue(nPercent);
     181           0 :             nLastPercent = nPercent;
     182           0 :             nLastValue = nOldValue;
     183             :         }
     184             :         else
     185           0 :             m_pField->SetValue(nLastPercent);
     186             :     }
     187             :     else
     188             :     {
     189           0 :         sal_Int64 nOldPercent = GetValue(FUNIT_CUSTOM);
     190             : 
     191           0 :         nOldValue = Convert(GetValue(), m_pField->GetUnit(), eOldUnit);
     192             : 
     193           0 :         m_pField->SetUnit(eOldUnit);
     194           0 :         m_pField->SetDecimalDigits(nOldDigits);
     195           0 :         m_pField->SetMin(nOldMin);
     196           0 :         m_pField->SetMax(nOldMax);
     197           0 :         m_pField->SetSpinSize(nOldSpinSize);
     198           0 :         m_pField->SetBaseValue(nOldBaseValue);
     199             : 
     200           0 :         if (nOldPercent != nLastPercent)
     201             :         {
     202           0 :             SetPrcntValue(nOldValue, eOldUnit);
     203           0 :             nLastPercent = nOldPercent;
     204           0 :             nLastValue = nOldValue;
     205             :         }
     206             :         else
     207           0 :             SetPrcntValue(nLastValue, eOldUnit);
     208             :     }
     209             : }
     210             : 
     211           0 : void PercentField::SetValue(sal_Int64 nNewValue, FieldUnit eInUnit)
     212             : {
     213           0 :    MetricFormatter::SetValue(nNewValue, eInUnit);
     214           0 : }
     215             : 
     216           0 : void PercentField::SetPrcntValue(sal_Int64 nNewValue, FieldUnit eInUnit)
     217             : {
     218           0 :     if (GetUnit() != FUNIT_CUSTOM || eInUnit == FUNIT_CUSTOM)
     219           0 :         MetricFormatter::SetValue(Convert(nNewValue, eInUnit, GetUnit()));
     220             : 
     221             :     else
     222             :     {
     223             :         // Overwrite output value, do not restore later
     224             :         sal_Int64 nPercent, nAktWidth;
     225           0 :         if(eInUnit == FUNIT_TWIP)
     226             :         {
     227           0 :             nAktWidth = ConvertValue(nNewValue, 0, nOldDigits, FUNIT_TWIP, FUNIT_TWIP);
     228             :         }
     229             :         else
     230             :         {
     231           0 :             sal_Int64 nValue = Convert(nNewValue, eInUnit, eOldUnit);
     232           0 :             nAktWidth = ConvertValue(nValue, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
     233             :         }
     234           0 :         nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
     235           0 :         MetricFormatter::SetValue(nPercent);
     236             :     }
     237           0 : }
     238             : 
     239           0 : void PercentFieldWrap::SetPrcntValue(sal_Int64 nNewValue, FieldUnit eInUnit)
     240             : {
     241           0 :     if (m_pField->GetUnit() != FUNIT_CUSTOM || eInUnit == FUNIT_CUSTOM)
     242           0 :         m_pField->SetValue(Convert(nNewValue, eInUnit, m_pField->GetUnit()));
     243             :     else
     244             :     {
     245             :         // Overwrite output value, do not restore later
     246             :         sal_Int64 nPercent, nAktWidth;
     247           0 :         if(eInUnit == FUNIT_TWIP)
     248             :         {
     249           0 :             nAktWidth = m_pField->ConvertValue(nNewValue, 0, nOldDigits, FUNIT_TWIP, FUNIT_TWIP);
     250             :         }
     251             :         else
     252             :         {
     253           0 :             sal_Int64 nValue = Convert(nNewValue, eInUnit, eOldUnit);
     254           0 :             nAktWidth = m_pField->ConvertValue(nValue, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
     255             :         }
     256           0 :         nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
     257           0 :         m_pField->SetValue(nPercent);
     258             :     }
     259           0 : }
     260             : 
     261           0 : void PercentField::SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit )
     262             : {
     263           0 :     if (GetUnit() != FUNIT_CUSTOM || eInUnit == FUNIT_CUSTOM)
     264           0 :         MetricField::SetUserValue(Convert(nNewValue, eInUnit, GetUnit()),FUNIT_NONE);
     265             : 
     266             :     else
     267             :     {
     268             :         // Overwrite output value, do not restore later
     269             :         sal_Int64 nPercent, nAktWidth;
     270           0 :         if(eInUnit == FUNIT_TWIP)
     271             :         {
     272           0 :             nAktWidth = ConvertValue(nNewValue, 0, nOldDigits, FUNIT_TWIP, FUNIT_TWIP);
     273             :         }
     274             :         else
     275             :         {
     276           0 :             sal_Int64 nValue = Convert(nNewValue, eInUnit, eOldUnit);
     277           0 :             nAktWidth = ConvertValue(nValue, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
     278             :         }
     279           0 :         nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
     280           0 :         MetricField::SetUserValue(nPercent,FUNIT_NONE);
     281             :     }
     282             : 
     283           0 : }
     284             : 
     285           0 : void PercentField::SetBaseValue(sal_Int64 nNewValue, FieldUnit eInUnit)
     286             : {
     287           0 :     if (GetUnit() == FUNIT_CUSTOM)
     288           0 :         nOldBaseValue = ConvertValue(nNewValue, 0, nOldDigits, eInUnit, eOldUnit);
     289             :     else
     290           0 :         MetricField::SetBaseValue(nNewValue, eInUnit);
     291           0 : }
     292             : 
     293           0 : sal_Int64 PercentField::GetValue( FieldUnit eOutUnit )
     294             : {
     295           0 :     return Convert(MetricField::GetValue(), GetUnit(), eOutUnit);
     296             : }
     297             : 
     298           0 : sal_Int64 PercentFieldWrap::GetValue(FieldUnit eOutUnit)
     299             : {
     300           0 :     return Convert(m_pField->GetValue(), m_pField->GetUnit(), eOutUnit);
     301             : }
     302             : 
     303           0 : void PercentField::SetMin(sal_Int64 nNewMin, FieldUnit eInUnit)
     304             : {
     305           0 :     if (GetUnit() != FUNIT_CUSTOM)
     306           0 :         MetricField::SetMin(nNewMin, eInUnit);
     307             :     else
     308             :     {
     309           0 :         if (eInUnit == FUNIT_NONE)
     310           0 :             eInUnit = eOldUnit;
     311           0 :         nOldMin = Convert(nNewMin, eInUnit, eOldUnit);
     312             : 
     313           0 :         sal_Int64 nPercent = Convert(nNewMin, eInUnit, FUNIT_CUSTOM);
     314           0 :         MetricField::SetMin(std::max( static_cast< sal_Int64 >(1), nPercent));
     315             :     }
     316           0 : }
     317             : 
     318           0 : void PercentFieldWrap::SetMin(sal_Int64 nNewMin, FieldUnit eInUnit)
     319             : {
     320           0 :     if (m_pField->GetUnit() != FUNIT_CUSTOM)
     321           0 :         m_pField->SetMin(nNewMin, eInUnit);
     322             :     else
     323             :     {
     324           0 :         if (eInUnit == FUNIT_NONE)
     325           0 :             eInUnit = eOldUnit;
     326           0 :         nOldMin = Convert(nNewMin, eInUnit, eOldUnit);
     327             : 
     328           0 :         sal_Int64 nPercent = Convert(nNewMin, eInUnit, FUNIT_CUSTOM);
     329           0 :         m_pField->SetMin(std::max( static_cast< sal_Int64 >(1), nPercent));
     330             :     }
     331           0 : }
     332             : 
     333           0 : void PercentField::SetMax(sal_Int64 nNewMax, FieldUnit eInUnit)
     334             : {
     335           0 :     if (GetUnit() != FUNIT_CUSTOM)
     336           0 :         MetricField::SetMax(nNewMax, eInUnit);
     337             :     else
     338             :     {
     339           0 :         if (eInUnit == FUNIT_NONE)
     340           0 :             eInUnit = eOldUnit;
     341             :     }
     342           0 : }
     343             : 
     344           0 : void PercentFieldWrap::SetMax(sal_Int64 nNewMax, FieldUnit eInUnit)
     345             : {
     346           0 :     if (m_pField->GetUnit() != FUNIT_CUSTOM)
     347           0 :         m_pField->SetMax(nNewMax, eInUnit);
     348             :     else
     349             :     {
     350           0 :         if (eInUnit == FUNIT_NONE)
     351           0 :             eInUnit = eOldUnit;
     352             :     }
     353           0 : }
     354             : 
     355           0 : sal_Int64 PercentField::NormalizePercent(sal_Int64 nValue)
     356             : {
     357           0 :     if (GetUnit() != FUNIT_CUSTOM)
     358           0 :         nValue = MetricField::Normalize(nValue);
     359             :     else
     360           0 :         nValue = nValue * ImpPower10(nOldDigits);
     361             : 
     362           0 :     return nValue;
     363             : }
     364             : 
     365           0 : sal_Int64 PercentFieldWrap::NormalizePercent(sal_Int64 nValue)
     366             : {
     367           0 :     if (m_pField->GetUnit() != FUNIT_CUSTOM)
     368           0 :         nValue = m_pField->Normalize(nValue);
     369             :     else
     370           0 :         nValue = nValue * ImpPower10(nOldDigits);
     371           0 :     return nValue;
     372             : }
     373             : 
     374           0 : sal_Int64 PercentField::DenormalizePercent(sal_Int64 nValue)
     375             : {
     376           0 :     if (GetUnit() != FUNIT_CUSTOM)
     377           0 :         nValue = MetricField::Denormalize(nValue);
     378             :     else
     379             :     {
     380           0 :         sal_Int64 nFactor = ImpPower10(nOldDigits);
     381           0 :         nValue = ((nValue+(nFactor/2)) / nFactor);
     382             :     }
     383             : 
     384           0 :     return nValue;
     385             : }
     386             : 
     387           0 : sal_Int64 PercentFieldWrap::DenormalizePercent(sal_Int64 nValue)
     388             : {
     389           0 :     if (m_pField->GetUnit() != FUNIT_CUSTOM)
     390           0 :         nValue = m_pField->Denormalize(nValue);
     391             :     else
     392             :     {
     393           0 :         sal_Int64 nFactor = ImpPower10(nOldDigits);
     394           0 :         nValue = ((nValue+(nFactor/2)) / nFactor);
     395             :     }
     396           0 :     return nValue;
     397             : }
     398             : 
     399           0 : sal_Bool PercentField::IsValueModified()
     400             : {
     401           0 :     if (GetUnit() == FUNIT_CUSTOM)
     402           0 :         return sal_True;
     403             :     else
     404           0 :         return MetricField::IsValueModified();
     405             : }
     406             : 
     407           0 : sal_Int64 PercentField::ImpPower10( sal_uInt16 n )
     408             : {
     409             :     sal_uInt16 i;
     410           0 :     sal_Int64   nValue = 1;
     411             : 
     412           0 :     for ( i=0; i < n; i++ )
     413           0 :         nValue *= 10;
     414             : 
     415           0 :     return nValue;
     416             : }
     417             : 
     418           0 : sal_Int64 PercentFieldWrap::ImpPower10(sal_uInt16 n)
     419             : {
     420           0 :     sal_Int64 nValue = 1;
     421             : 
     422           0 :     for (sal_uInt16 i=0; i < n; ++i)
     423           0 :         nValue *= 10;
     424             : 
     425           0 :     return nValue;
     426             : }
     427             : 
     428           0 : sal_Int64 PercentField::GetRealValue(FieldUnit eOutUnit)
     429             : {
     430           0 :     if (GetUnit() != FUNIT_CUSTOM)
     431           0 :         return GetValue(eOutUnit);
     432             :     else
     433           0 :         return Convert(GetValue(), GetUnit(), eOutUnit);
     434             : }
     435             : 
     436           0 : sal_Int64 PercentFieldWrap::GetRealValue(FieldUnit eOutUnit)
     437             : {
     438           0 :     if (m_pField->GetUnit() != FUNIT_CUSTOM)
     439           0 :         return GetValue(eOutUnit);
     440             :     else
     441           0 :         return Convert(GetValue(), m_pField->GetUnit(), eOutUnit);
     442             : }
     443             : 
     444           0 : sal_Int64 PercentField::Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit)
     445             : {
     446           0 :     if (eInUnit == eOutUnit ||
     447           0 :         (eInUnit == FUNIT_NONE && eOutUnit == GetUnit()) ||
     448           0 :         (eOutUnit == FUNIT_NONE && eInUnit == GetUnit()))
     449           0 :         return nValue;
     450             : 
     451           0 :     if (eInUnit == FUNIT_CUSTOM)
     452             :     {
     453             :         // Convert to metric
     454           0 :         sal_Int64 nTwipValue = (nRefValue * nValue + 50) / 100;
     455             : 
     456           0 :         if (eOutUnit == FUNIT_TWIP) // Only convert if necessary
     457           0 :             return NormalizePercent(nTwipValue);
     458             :         else
     459           0 :             return ConvertValue(NormalizePercent(nTwipValue), 0, nOldDigits, FUNIT_TWIP, eOutUnit);
     460             :     }
     461             : 
     462           0 :     if (eOutUnit == FUNIT_CUSTOM)
     463             :     {
     464             :         // Convert to percent
     465             :         sal_Int64 nAktWidth;
     466           0 :         nValue = DenormalizePercent(nValue);
     467             : 
     468           0 :         if (eInUnit == FUNIT_TWIP)  // Only convert if necessary
     469           0 :             nAktWidth = nValue;
     470             :         else
     471           0 :             nAktWidth = ConvertValue(nValue, 0, nOldDigits, eInUnit, FUNIT_TWIP);
     472             :         // Round to 0.5 percent
     473           0 :         return ((nAktWidth * 1000) / nRefValue + 5) / 10;
     474             :     }
     475             : 
     476           0 :     return ConvertValue(nValue, 0, nOldDigits, eInUnit, eOutUnit);
     477             : }
     478             : 
     479           0 : sal_Int64 PercentFieldWrap::Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit)
     480             : {
     481           0 :     if (eInUnit == eOutUnit ||
     482           0 :         (eInUnit == FUNIT_NONE && eOutUnit == m_pField->GetUnit()) ||
     483           0 :         (eOutUnit == FUNIT_NONE && eInUnit == m_pField->GetUnit()))
     484           0 :         return nValue;
     485             : 
     486           0 :     if (eInUnit == FUNIT_CUSTOM)
     487             :     {
     488             :         // Convert to metric
     489           0 :         sal_Int64 nTwipValue = (nRefValue * nValue + 50) / 100;
     490             : 
     491           0 :         if (eOutUnit == FUNIT_TWIP) // Only convert if necessary
     492           0 :             return NormalizePercent(nTwipValue);
     493             :         else
     494           0 :             return m_pField->ConvertValue(NormalizePercent(nTwipValue), 0, nOldDigits, FUNIT_TWIP, eOutUnit);
     495             :     }
     496             : 
     497           0 :     if (eOutUnit == FUNIT_CUSTOM)
     498             :     {
     499             :         // Convert to percent
     500             :         sal_Int64 nAktWidth;
     501           0 :         nValue = DenormalizePercent(nValue);
     502             : 
     503           0 :         if (eInUnit == FUNIT_TWIP)  // Only convert if necessary
     504           0 :             nAktWidth = nValue;
     505             :         else
     506           0 :             nAktWidth = m_pField->ConvertValue(nValue, 0, nOldDigits, eInUnit, FUNIT_TWIP);
     507             :         // Round to 0.5 percent
     508           0 :         return ((nAktWidth * 1000) / nRefValue + 5) / 10;
     509             :     }
     510             : 
     511           0 :     return m_pField->ConvertValue(nValue, 0, nOldDigits, eInUnit, eOutUnit);
     512          99 : }
     513             : 
     514             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10