diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-02-14 09:38:50 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-02-14 14:31:50 +0100 |
commit | 8389dc88a48b366ad7f3dd84129467175e18ab40 (patch) | |
tree | 2de192eab43601ee8b145215504ed6aa2b9db243 /cui | |
parent | f67e5ef9a5c71f3b35b1c67eb72794e44cc15410 (diff) |
split out MetricField value conversion functions
Change-Id: I67a33bd2a5cb06dc66e471918b5c378044a2eff2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88679
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/tabpages/border.cxx | 10 | ||||
-rw-r--r-- | cui/source/tabpages/grfpage.cxx | 5 | ||||
-rw-r--r-- | cui/source/tabpages/transfrm.cxx | 3 |
3 files changed, 10 insertions, 8 deletions
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index b75e91d1bd66..8d8dd161a204 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -29,7 +29,7 @@ #include <svx/dlgutil.hxx> #include <dialmgr.hxx> #include <sfx2/htmlmode.hxx> -#include <vcl/field.hxx> +#include <vcl/fieldvalues.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <svx/flagsdef.hxx> @@ -734,7 +734,7 @@ void SvxBorderTabPage::Reset( const SfxItemSet* rSet ) if( bWidthEq ) { // Determine the width first as some styles can be missing depending on it - sal_Int64 nWidthPt = static_cast<sal_Int64>(MetricField::ConvertDoubleValue( + sal_Int64 nWidthPt = static_cast<sal_Int64>(vcl::ConvertDoubleValue( sal_Int64( nWidth ), m_xLineWidthMF->get_digits(), MapUnit::MapTwip, FieldUnit::POINT )); m_xLineWidthMF->set_value(nWidthPt, FieldUnit::POINT); @@ -1158,7 +1158,7 @@ IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, ColorListBox&, rColorBox, void) IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthHdl_Impl, weld::MetricSpinButton&, void) { sal_Int64 nVal = m_xLineWidthMF->get_value(FieldUnit::NONE); - nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue( + nVal = static_cast<sal_Int64>(vcl::ConvertDoubleValue( nVal, m_xLineWidthMF->get_digits(), FieldUnit::POINT, MapUnit::MapTwip )); @@ -1171,7 +1171,7 @@ IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthHdl_Impl, weld::MetricSpinButton&, IMPL_LINK_NOARG(SvxBorderTabPage, SelStyleHdl_Impl, SvtLineListBox&, void) { sal_Int64 nVal = m_xLineWidthMF->get_value(FieldUnit::NONE); - nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue( + nVal = static_cast<sal_Int64>(vcl::ConvertDoubleValue( nVal, m_xLineWidthMF->get_digits(), FieldUnit::POINT, MapUnit::MapTwip )); @@ -1352,7 +1352,7 @@ void SvxBorderTabPage::FillLineListBox_Impl() } sal_Int64 nVal = m_xLineWidthMF->get_value(FieldUnit::NONE); - nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue(nVal, m_xLineWidthMF->get_digits(), + nVal = static_cast<sal_Int64>(vcl::ConvertDoubleValue(nVal, m_xLineWidthMF->get_digits(), m_xLineWidthMF->get_unit(), MapUnit::MapTwip)); m_xLbLineStyle->SetWidth( nVal ); } diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx index 586f9806ce8d..d44610dd23b1 100644 --- a/cui/source/tabpages/grfpage.cxx +++ b/cui/source/tabpages/grfpage.cxx @@ -32,6 +32,7 @@ #include <svx/svxids.hrc> #include <strings.hrc> #include <vcl/field.hxx> +#include <vcl/fieldvalues.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <svtools/unitconv.hxx> @@ -590,7 +591,7 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound ) SID_ATTR_GRAF_CROP ) )); sal_Int64 nSpin = m_xLeftMF->normalize(aOrigSize.Width()) / 20; - nSpin = MetricField::ConvertValue( nSpin, aOrigSize.Width(), 0, + nSpin = vcl::ConvertValue( nSpin, aOrigSize.Width(), 0, eUnit, m_xLeftMF->get_unit()); // if the margin is too big, it is set to 1/3 on both pages @@ -618,7 +619,7 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound ) m_xLeftMF->set_increments(nSpin, nSpin * 10, FieldUnit::NONE); m_xRightMF->set_increments(nSpin, nSpin * 10, FieldUnit::NONE); nSpin = m_xTopMF->normalize(aOrigSize.Height()) / 20; - nSpin = MetricField::ConvertValue( nSpin, aOrigSize.Width(), 0, + nSpin = vcl::ConvertValue( nSpin, aOrigSize.Width(), 0, eUnit, m_xLeftMF->get_unit() ); m_xTopMF->set_increments(nSpin, nSpin * 10, FieldUnit::NONE); m_xBottomMF->set_increments(nSpin, nSpin * 10, FieldUnit::NONE); diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index fc4743fbde2d..cdf93c57be0c 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -38,6 +38,7 @@ #include <svl/rectitem.hxx> #include <swpossizetabpage.hxx> #include <vcl/canvastools.hxx> +#include <vcl/fieldvalues.hxx> // static ---------------------------------------------------------------- @@ -1289,7 +1290,7 @@ void SvxPositionSizeTabPage::SetMinMaxPosition() } } - const double fMaxLong(static_cast<double>(MetricField::ConvertValue( LONG_MAX, 0, MapUnit::Map100thMM, meDlgUnit ) - 1)); + const double fMaxLong(static_cast<double>(vcl::ConvertValue( LONG_MAX, 0, MapUnit::Map100thMM, meDlgUnit ) - 1)); fLeft = std::clamp(fLeft, -fMaxLong, fMaxLong); fRight = std::clamp(fRight, -fMaxLong, fMaxLong); fTop = std::clamp(fTop, - fMaxLong, fMaxLong); |