[Libreoffice-commits] core.git: include/svtools svtools/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Feb 14 20:44:49 UTC 2020
include/svtools/unitconv.hxx | 5 --
svtools/source/misc/unitconv.cxx | 92 ---------------------------------------
2 files changed, 1 insertion(+), 96 deletions(-)
New commits:
commit e917918dfb42ef9f95768280918bc42c628de0be
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Feb 14 15:52:14 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Feb 14 21:44:16 2020 +0100
remove recently unused functions
Change-Id: Ie7645d7f9b8350d3a993c40541747dc8ac817ab9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88730
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/svtools/unitconv.hxx b/include/svtools/unitconv.hxx
index f787e0cee42d..2edf1ade815b 100644
--- a/include/svtools/unitconv.hxx
+++ b/include/svtools/unitconv.hxx
@@ -25,8 +25,6 @@
namespace weld { class MetricSpinButton; }
-class MetricField;
-
// macro -----------------------------------------------------------------
// typedef ---------------------------------------------------------------
@@ -36,7 +34,6 @@ typedef long (*FUNC_CONVERT)(long);
// Functions -------------------------------------------------------------
SVT_DLLPUBLIC void SetFieldUnit(weld::MetricSpinButton& rCtrl, FieldUnit eUnit, bool bAll = false);
-SVT_DLLPUBLIC void SetFieldUnit( MetricField& rCtrl, FieldUnit eUnit, bool bAll = false );
SVT_DLLPUBLIC long CalcToUnit( float nIn, MapUnit eUnit );
SVT_DLLPUBLIC long CalcToPoint( long nIn, MapUnit eUnit, sal_uInt16 nFactor );
@@ -47,9 +44,7 @@ SVT_DLLPUBLIC long ControlToItem( long nIn, FieldUnit eCtrl, MapUnit eItem
SVT_DLLPUBLIC FieldUnit MapToFieldUnit( const MapUnit eUnit );
SVT_DLLPUBLIC void SetMetricValue(weld::MetricSpinButton& rField, int lCoreValue, MapUnit eUnit);
-SVT_DLLPUBLIC void SetMetricValue( MetricField& rField, long lCoreValue, MapUnit eUnit );
SVT_DLLPUBLIC int GetCoreValue(const weld::MetricSpinButton& rField, MapUnit eUnit);
-SVT_DLLPUBLIC long GetCoreValue( const MetricField& rField, MapUnit eUnit );
SVT_DLLPUBLIC long PointToTwips( long nIn );
diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx
index ef5494a6f96e..8076b6890196 100644
--- a/svtools/source/misc/unitconv.cxx
+++ b/svtools/source/misc/unitconv.cxx
@@ -19,7 +19,7 @@
#include <svtools/unitconv.hxx>
#include <tools/debug.hxx>
-#include <vcl/field.hxx>
+#include <vcl/outdev.hxx>
#include <vcl/weld.hxx>
void SetFieldUnit(weld::MetricSpinButton& rField, FieldUnit eUnit, bool bAll)
@@ -80,64 +80,6 @@ void SetFieldUnit(weld::MetricSpinButton& rField, FieldUnit eUnit, bool bAll)
}
}
-void SetFieldUnit( MetricField& rField, FieldUnit eUnit, bool bAll )
-{
- sal_Int64 nFirst = rField.Denormalize( rField.GetFirst( FieldUnit::TWIP ) );
- sal_Int64 nLast = rField.Denormalize( rField.GetLast( FieldUnit::TWIP ) );
- sal_Int64 nMin = rField.Denormalize( rField.GetMin( FieldUnit::TWIP ) );
- sal_Int64 nMax = rField.Denormalize( rField.GetMax( FieldUnit::TWIP ) );
-
- if ( !bAll )
- {
- switch ( eUnit )
- {
- case FieldUnit::M:
- case FieldUnit::KM:
- eUnit = FieldUnit::CM;
- break;
-
- case FieldUnit::FOOT:
- case FieldUnit::MILE:
- eUnit = FieldUnit::INCH;
- break;
- default: ;//prevent warning
- }
- }
- rField.SetUnit( eUnit );
- switch( eUnit )
- {
- // _CHAR and _LINE sets the step of "char" and "line" unit, they are same as FieldUnit::MM
- case FieldUnit::CHAR:
- case FieldUnit::LINE:
- case FieldUnit::MM:
- rField.SetSpinSize( 50 );
- break;
-
- case FieldUnit::INCH:
- rField.SetSpinSize( 2 );
- break;
-
- default:
- rField.SetSpinSize( 10 );
- }
-
- if ( FieldUnit::POINT == eUnit )
- {
- if( rField.GetDecimalDigits() > 1 )
- rField.SetDecimalDigits( 1 );
- }
- else
- rField.SetDecimalDigits( 2 );
-
- if ( !bAll )
- {
- rField.SetFirst( rField.Normalize( nFirst ), FieldUnit::TWIP );
- rField.SetLast( rField.Normalize( nLast ), FieldUnit::TWIP );
- rField.SetMin( rField.Normalize( nMin ), FieldUnit::TWIP );
- rField.SetMax( rField.Normalize( nMax ), FieldUnit::TWIP );
- }
-}
-
void SetMetricValue(weld::MetricSpinButton& rField, int nCoreValue, MapUnit eUnit)
{
auto nVal = OutputDevice::LogicToLogic(nCoreValue, eUnit, MapUnit::Map100thMM);
@@ -145,14 +87,6 @@ void SetMetricValue(weld::MetricSpinButton& rField, int nCoreValue, MapUnit eUni
rField.set_value(nVal, FieldUnit::MM_100TH);
}
-void SetMetricValue( MetricField& rField, long nCoreValue, MapUnit eUnit )
-{
- sal_Int64 nVal = OutputDevice::LogicToLogic( nCoreValue, eUnit, MapUnit::Map100thMM );
- nVal = rField.Normalize( nVal );
- rField.SetValue(nVal, FieldUnit::MM_100TH);
-
-}
-
int GetCoreValue(const weld::MetricSpinButton& rField, MapUnit eUnit)
{
int nVal = rField.get_value(FieldUnit::MM_100TH);
@@ -177,30 +111,6 @@ int GetCoreValue(const weld::MetricSpinButton& rField, MapUnit eUnit)
return nUnitVal;
}
-long GetCoreValue( const MetricField& rField, MapUnit eUnit )
-{
- sal_Int64 nVal = rField.GetValue(FieldUnit::MM_100TH);
- // avoid rounding issues
- const sal_Int64 nSizeMask = 0xffffffffff000000LL;
- bool bRoundBefore = true;
- if( nVal >= 0 )
- {
- if( (nVal & nSizeMask) == 0 )
- bRoundBefore = false;
- }
- else
- {
- if( ((-nVal) & nSizeMask ) == 0 )
- bRoundBefore = false;
- }
- if( bRoundBefore )
- nVal = rField.Denormalize( nVal );
- sal_Int64 nUnitVal = OutputDevice::LogicToLogic( static_cast<long>(nVal), MapUnit::Map100thMM, eUnit );
- if( ! bRoundBefore )
- nUnitVal = rField.Denormalize( nUnitVal );
- return static_cast<long>(nUnitVal);
-}
-
long CalcToUnit( float nIn, MapUnit eUnit )
{
// nIn is in Points
More information about the Libreoffice-commits
mailing list