summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/tabpages/border.cxx10
-rw-r--r--cui/source/tabpages/grfpage.cxx5
-rw-r--r--cui/source/tabpages/transfrm.cxx3
-rw-r--r--include/svx/transfrmhelper.hxx10
-rw-r--r--include/vcl/field.hxx26
-rw-r--r--include/vcl/fieldvalues.hxx67
-rw-r--r--sc/source/core/data/drwlayer.cxx6
-rw-r--r--sc/source/ui/inc/tpdefaults.hxx1
-rw-r--r--sc/source/ui/view/colrowba.cxx4
-rw-r--r--svtools/source/control/ctrlbox.cxx5
-rw-r--r--svx/inc/pch/precompiled_svx.hxx4
-rw-r--r--svx/source/dialog/compressgraphicdialog.cxx5
-rw-r--r--svx/source/dialog/dlgunit.hxx5
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.cxx3
-rw-r--r--svx/source/stbctrls/pszctrl.cxx4
-rw-r--r--sw/source/ui/frmdlg/column.cxx5
-rw-r--r--sw/source/ui/misc/pgfnote.cxx8
-rw-r--r--sw/source/uibase/utlui/prcntfld.cxx16
-rw-r--r--vcl/source/control/field.cxx297
-rw-r--r--vcl/source/window/builder.cxx3
20 files changed, 266 insertions, 221 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);
diff --git a/include/svx/transfrmhelper.hxx b/include/svx/transfrmhelper.hxx
index 0c9b7e958107..9e683d44522f 100644
--- a/include/svx/transfrmhelper.hxx
+++ b/include/svx/transfrmhelper.hxx
@@ -24,18 +24,18 @@
#include <tools/fract.hxx>
#include <tools/fldunit.hxx>
#include <tools/mapunit.hxx>
-#include <vcl/field.hxx>
+#include <vcl/fieldvalues.hxx>
namespace TransfrmHelper
{
inline void ConvertRect(basegfx::B2DRange& rRange, const sal_uInt16 nDigits, const MapUnit ePoolUnit, const FieldUnit eDlgUnit)
{
const basegfx::B2DPoint aTopLeft(
- static_cast<double>(MetricField::ConvertValue(basegfx::fround(rRange.getMinX()), nDigits, ePoolUnit, eDlgUnit)),
- static_cast<double>(MetricField::ConvertValue(basegfx::fround(rRange.getMinY()), nDigits, ePoolUnit, eDlgUnit)));
+ static_cast<double>(vcl::ConvertValue(basegfx::fround(rRange.getMinX()), nDigits, ePoolUnit, eDlgUnit)),
+ static_cast<double>(vcl::ConvertValue(basegfx::fround(rRange.getMinY()), nDigits, ePoolUnit, eDlgUnit)));
const basegfx::B2DPoint aBottomRight(
- static_cast<double>(MetricField::ConvertValue(basegfx::fround(rRange.getMaxX()), nDigits, ePoolUnit, eDlgUnit)),
- static_cast<double>(MetricField::ConvertValue(basegfx::fround(rRange.getMaxY()), nDigits, ePoolUnit, eDlgUnit)));
+ static_cast<double>(vcl::ConvertValue(basegfx::fround(rRange.getMaxX()), nDigits, ePoolUnit, eDlgUnit)),
+ static_cast<double>(vcl::ConvertValue(basegfx::fround(rRange.getMaxY()), nDigits, ePoolUnit, eDlgUnit)));
rRange = basegfx::B2DRange(aTopLeft, aBottomRight);
}
diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx
index 81fd9e5b8023..c011132f4c81 100644
--- a/include/vcl/field.hxx
+++ b/include/vcl/field.hxx
@@ -448,32 +448,6 @@ public:
void SetLast(sal_Int64 last) { SetLast(last, FieldUnit::NONE); }
sal_Int64 GetLast( FieldUnit eOutUnit ) const;
- static sal_Int64 ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
- FieldUnit eInUnit, FieldUnit eOutUnit );
- static sal_Int64 ConvertValue( sal_Int64 nValue, sal_uInt16 nDecDigits,
- MapUnit eInUnit, FieldUnit eOutUnit );
-
- // for backwards compatibility
- // caution: conversion to double loses precision
- static double ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
- FieldUnit eInUnit, FieldUnit eOutUnit );
- static double ConvertDoubleValue( double nValue, sal_uInt16 nDecDigits,
- FieldUnit eInUnit, MapUnit eOutUnit );
- static double ConvertDoubleValue( double nValue, sal_uInt16 nDecDigits,
- MapUnit eInUnit, FieldUnit eOutUnit );
-
- // for backwards compatibility
- // caution: conversion to double loses precision
- static double ConvertDoubleValue( sal_Int64 nValue, sal_Int64 nBaseValue, sal_uInt16 nDecDigits,
- FieldUnit eInUnit, FieldUnit eOutUnit )
- { return ConvertDoubleValue( static_cast<double>(nValue), nBaseValue, nDecDigits, eInUnit, eOutUnit ); }
- static double ConvertDoubleValue( sal_Int64 nValue, sal_uInt16 nDecDigits,
- FieldUnit eInUnit, MapUnit eOutUnit )
- { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); }
- static double ConvertDoubleValue( sal_Int64 nValue, sal_uInt16 nDecDigits,
- MapUnit eInUnit, FieldUnit eOutUnit )
- { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); }
-
virtual bool set_property(const OString &rKey, const OUString &rValue) override;
virtual void dispose() override;
diff --git a/include/vcl/fieldvalues.hxx b/include/vcl/fieldvalues.hxx
new file mode 100644
index 000000000000..e36b0590ae71
--- /dev/null
+++ b/include/vcl/fieldvalues.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_FIELDVALUES_HXX
+#define INCLUDED_VCL_FIELDVALUES_HXX
+
+#include <vcl/dllapi.h>
+#include <tools/fldunit.hxx>
+#include <tools/mapunit.hxx>
+
+namespace vcl
+{
+VCL_DLLPUBLIC sal_Int64 ConvertValue(sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
+ FieldUnit eInUnit, FieldUnit eOutUnit);
+VCL_DLLPUBLIC sal_Int64 ConvertValue(sal_Int64 nValue, sal_uInt16 nDecDigits, MapUnit eInUnit,
+ FieldUnit eOutUnit);
+
+// for backwards compatibility
+// caution: conversion to double loses precision
+VCL_DLLPUBLIC double ConvertDoubleValue(double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
+ FieldUnit eInUnit, FieldUnit eOutUnit);
+VCL_DLLPUBLIC double ConvertDoubleValue(double nValue, sal_uInt16 nDecDigits, FieldUnit eInUnit,
+ MapUnit eOutUnit);
+VCL_DLLPUBLIC double ConvertDoubleValue(double nValue, sal_uInt16 nDecDigits, MapUnit eInUnit,
+ FieldUnit eOutUnit);
+
+// for backwards compatibility
+// caution: conversion to double loses precision
+inline double ConvertDoubleValue(sal_Int64 nValue, sal_Int64 nBaseValue, sal_uInt16 nDecDigits,
+ FieldUnit eInUnit, FieldUnit eOutUnit)
+{
+ return ConvertDoubleValue(static_cast<double>(nValue), nBaseValue, nDecDigits, eInUnit,
+ eOutUnit);
+}
+
+inline double ConvertDoubleValue(sal_Int64 nValue, sal_uInt16 nDecDigits, FieldUnit eInUnit,
+ MapUnit eOutUnit)
+{
+ return ConvertDoubleValue(static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit);
+}
+
+inline double ConvertDoubleValue(sal_Int64 nValue, sal_uInt16 nDecDigits, MapUnit eInUnit,
+ FieldUnit eOutUnit)
+{
+ return ConvertDoubleValue(static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit);
+}
+}
+
+#endif // INCLUDED_VCL_FIELDVALUES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 395bb62149d4..e9deb74010bc 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -67,7 +67,7 @@
#include <table.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <vcl/field.hxx>
+#include <vcl/fieldvalues.hxx>
#include <memory>
namespace com::sun::star::embed { class XEmbeddedObject; }
@@ -200,13 +200,13 @@ ScTabSizeChangedHint::~ScTabSizeChangedHint()
static long TwipsToHmm (long nVal)
{
- return static_cast< long >( MetricField::ConvertDoubleValue (static_cast<sal_Int64>(nVal), 0, 0,
+ return static_cast< long >( vcl::ConvertDoubleValue (static_cast<sal_Int64>(nVal), 0, 0,
FieldUnit::TWIP, FieldUnit::MM_100TH) );
}
static long HmmToTwips (long nVal)
{
- return static_cast< long > ( MetricField::ConvertDoubleValue (static_cast<sal_Int64>(nVal), 0, 0,
+ return static_cast< long > ( vcl::ConvertDoubleValue (static_cast<sal_Int64>(nVal), 0, 0,
FieldUnit::MM_100TH, FieldUnit::TWIP) );
}
diff --git a/sc/source/ui/inc/tpdefaults.hxx b/sc/source/ui/inc/tpdefaults.hxx
index ecbedc188c90..b830173686a2 100644
--- a/sc/source/ui/inc/tpdefaults.hxx
+++ b/sc/source/ui/inc/tpdefaults.hxx
@@ -11,7 +11,6 @@
#define INCLUDED_SC_SOURCE_UI_INC_TPDEFAULTS_HXX
#include <sfx2/tabdlg.hxx>
-#include <vcl/field.hxx>
class ScTpDefaultsOptions : public SfxTabPage
{
diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx
index 444db6ac4eef..b0dd221a118b 100644
--- a/sc/source/ui/view/colrowba.cxx
+++ b/sc/source/ui/view/colrowba.cxx
@@ -18,7 +18,7 @@
*/
#include <unotools/localedatawrapper.hxx>
-#include <vcl/field.hxx>
+#include <vcl/fieldvalues.hxx>
#include <colrowba.hxx>
#include <document.hxx>
@@ -39,7 +39,7 @@ static OUString lcl_MetricString( long nTwips, const OUString& rText )
{
FieldUnit eUserMet = SC_MOD()->GetAppOptions().GetAppMetric();
- sal_Int64 nUserVal = MetricField::ConvertValue( nTwips*100, 1, 2, FieldUnit::TWIP, eUserMet );
+ sal_Int64 nUserVal = vcl::ConvertValue( nTwips*100, 1, 2, FieldUnit::TWIP, eUserMet );
OUString aStr = rText + " "
+ ScGlobal::pLocaleData->getNum( nUserVal, 2 )
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index f1b0c7e7ba3c..cbb8f349f0d7 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -26,6 +26,7 @@
#include <vcl/event.hxx>
#include <vcl/svapp.hxx>
#include <vcl/field.hxx>
+#include <vcl/fieldvalues.hxx>
#include <vcl/settings.hxx>
#include <vcl/image.hxx>
#include <vcl/virdev.hxx>
@@ -1135,7 +1136,7 @@ OUString FontSizeBox::format_number(int nValue) const
void FontSizeBox::SetValue(int nNewValue, FieldUnit eInUnit)
{
- auto nTempValue = MetricField::ConvertValue(nNewValue, 0, GetDecimalDigits(), eInUnit, GetUnit());
+ auto nTempValue = vcl::ConvertValue(nNewValue, 0, GetDecimalDigits(), eInUnit, GetUnit());
if (nTempValue < nMin)
nTempValue = nMin;
else if (nTempValue > nMax)
@@ -1173,7 +1174,7 @@ int FontSizeBox::get_value() const
FontSizeNames aFontSizeNames(Application::GetSettings().GetUILanguageTag().getLanguageType());
auto nValue = aFontSizeNames.Name2Size(aStr);
if (nValue)
- return MetricField::ConvertValue(nValue, 0, GetDecimalDigits(), GetUnit(), GetUnit());
+ return vcl::ConvertValue(nValue, 0, GetDecimalDigits(), GetUnit(), GetUnit());
}
const SvtSysLocale aSysLocale;
diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx
index 3581e2087a00..f08526683f9f 100644
--- a/svx/inc/pch/precompiled_svx.hxx
+++ b/svx/inc/pch/precompiled_svx.hxx
@@ -13,7 +13,7 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-02-13 20:23:51 using:
+ Generated on 2020-02-14 10:26:10 using:
./bin/update_pch svx svx --cutoff=3 --exclude:system --exclude:module --include:local
If after updating build fails, use the following command to locate conflicting headers:
@@ -86,7 +86,7 @@
#include <vcl/errcode.hxx>
#include <vcl/errinf.hxx>
#include <vcl/event.hxx>
-#include <vcl/field.hxx>
+#include <vcl/fieldvalues.hxx>
#include <vcl/font.hxx>
#include <vcl/gdimtf.hxx>
#include <vcl/graph.hxx>
diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx
index 184934342a0c..14b4c809f04a 100644
--- a/svx/source/dialog/compressgraphicdialog.cxx
+++ b/svx/source/dialog/compressgraphicdialog.cxx
@@ -18,6 +18,7 @@
*/
#include "dlgunit.hxx"
+#include <vcl/fieldvalues.hxx>
#include <vcl/graph.hxx>
#include <vcl/graphicfilter.hxx>
#include <vcl/virdev.hxx>
@@ -219,12 +220,12 @@ void CompressGraphicsDialog::UpdateResolutionLB()
double CompressGraphicsDialog::GetViewWidthInch() const
{
- return static_cast<double>(MetricField::ConvertValue(m_aViewSize100mm.Width(), 2, MapUnit::Map100thMM, FieldUnit::INCH)) / 100.0;
+ return static_cast<double>(vcl::ConvertValue(m_aViewSize100mm.Width(), 2, MapUnit::Map100thMM, FieldUnit::INCH)) / 100.0;
}
double CompressGraphicsDialog::GetViewHeightInch() const
{
- return static_cast<double>(MetricField::ConvertValue(m_aViewSize100mm.Height(), 2, MapUnit::Map100thMM, FieldUnit::INCH)) / 100.0;
+ return static_cast<double>(vcl::ConvertValue(m_aViewSize100mm.Height(), 2, MapUnit::Map100thMM, FieldUnit::INCH)) / 100.0;
}
BmpScaleFlag CompressGraphicsDialog::GetSelectedInterpolationType() const
diff --git a/svx/source/dialog/dlgunit.hxx b/svx/source/dialog/dlgunit.hxx
index 914e52d54388..108e2b5e3062 100644
--- a/svx/source/dialog/dlgunit.hxx
+++ b/svx/source/dialog/dlgunit.hxx
@@ -20,13 +20,14 @@
#ifndef INCLUDED_SVX_SOURCE_DIALOG_DLGUNIT_HXX
#define INCLUDED_SVX_SOURCE_DIALOG_DLGUNIT_HXX
+#include <rtl/ustrbuf.hxx>
#include <svx/svdtrans.hxx>
-#include <vcl/field.hxx>
+#include <vcl/fieldvalues.hxx>
inline OUString GetUnitString( long nVal_100, FieldUnit eFieldUnit, sal_Unicode cSep )
{
OUStringBuffer aVal = OUString::number(
- MetricField::ConvertValue(nVal_100, 2, MapUnit::Map100thMM, eFieldUnit));
+ vcl::ConvertValue(nVal_100, 2, MapUnit::Map100thMM, eFieldUnit));
while( aVal.getLength() < 3 )
aVal.insert( 0, "0" );
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index eb22debd13e6..7d87dca1c488 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -38,6 +38,7 @@
#include <unotools/localedatawrapper.hxx>
#include <unotools/viewoptions.hxx>
#include <vcl/canvastools.hxx>
+#include <vcl/fieldvalues.hxx>
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
#include <svl/aeitem.hxx>
@@ -995,7 +996,7 @@ void PosSizePropertyPanel::SetPosSizeMinMax()
fRight -= maRect.getWidth();
fBottom -= maRect.getHeight();
- 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);
diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx
index 8d2c4110863d..72e5d3f530be 100644
--- a/svx/source/stbctrls/pszctrl.cxx
+++ b/svx/source/stbctrls/pszctrl.cxx
@@ -21,7 +21,7 @@
#include <vcl/builder.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
-#include <vcl/field.hxx>
+#include <vcl/fieldvalues.hxx>
#include <vcl/status.hxx>
#include <vcl/menu.hxx>
#include <vcl/image.hxx>
@@ -70,7 +70,7 @@ OUString SvxPosSizeStatusBarControl::GetMetricStr_Impl( long nVal )
OUString sMetric;
const sal_Unicode cSep = Application::GetSettings().GetLocaleDataWrapper().getNumDecimalSep()[0];
- sal_Int64 nConvVal = MetricField::ConvertValue( nVal * 100, 0, 0, FieldUnit::MM_100TH, eOutUnit );
+ sal_Int64 nConvVal = vcl::ConvertValue( nVal * 100, 0, 0, FieldUnit::MM_100TH, eOutUnit );
if ( nConvVal < 0 && ( nConvVal / 100 == 0 ) )
sMetric += "-";
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index d9338a058a11..05aa0ab855d7 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -35,6 +35,7 @@
#include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx>
#include <vcl/event.hxx>
+#include <vcl/fieldvalues.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
@@ -489,7 +490,7 @@ SwColumnPage::SwColumnPage(weld::Container* pPage, weld::DialogController* pCont
SvxBorderLineStyle::DASHED );
sal_Int64 nLineWidth = m_xLineWidthEdit->get_value(FieldUnit::POINT);
- nLineWidth = static_cast<long>(MetricField::ConvertDoubleValue(
+ nLineWidth = static_cast<long>(vcl::ConvertDoubleValue(
nLineWidth,
m_xLineWidthEdit->get_digits(),
FieldUnit::POINT, MapUnit::MapTwip ));
@@ -686,7 +687,7 @@ IMPL_LINK_NOARG( SwColumnPage, UpdateColMgr, weld::MetricSpinButton&, void )
m_xLineColorLbl->set_sensitive(bEnable);
sal_Int64 nLineWidth = m_xLineWidthEdit->get_value(FieldUnit::PERCENT);
- nLineWidth = static_cast<long>(MetricField::ConvertDoubleValue(
+ nLineWidth = static_cast<long>(vcl::ConvertDoubleValue(
nLineWidth,
m_xLineWidthEdit->get_digits(),
m_xLineWidthEdit->get_unit(), MapUnit::MapTwip ));
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
index b2398c80d649..a90b15e2a26d 100644
--- a/sw/source/ui/misc/pgfnote.cxx
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -21,7 +21,7 @@
#include <fmtfsize.hxx>
#include <hintids.hxx>
#include <svtools/unitconv.hxx>
-#include <vcl/field.hxx>
+#include <vcl/fieldvalues.hxx>
#include <unotools/localedatawrapper.hxx>
#include <unotools/syslocale.hxx>
#include <editeng/borderline.hxx>
@@ -84,7 +84,7 @@ IMPL_LINK_NOARG(SwFootNotePage, HeightModify, weld::MetricSpinButton&, void)
IMPL_LINK_NOARG(SwFootNotePage, LineWidthChanged_Impl, weld::MetricSpinButton&, void)
{
sal_Int64 nVal = m_xLineWidthEdit->get_value(FieldUnit::NONE);
- nVal = static_cast<sal_Int64>(MetricField::ConvertDoubleValue(
+ nVal = static_cast<sal_Int64>(vcl::ConvertDoubleValue(
nVal,
m_xLineWidthEdit->get_digits(),
m_xLineWidthEdit->get_unit(), MapUnit::MapTwip ));
@@ -170,7 +170,7 @@ void SwFootNotePage::Reset(const SfxItemSet *rSet)
// Separator width
m_xLineWidthEdit->connect_value_changed(LINK(this, SwFootNotePage, LineWidthChanged_Impl));
- sal_Int64 nWidthPt = static_cast<sal_Int64>(MetricField::ConvertDoubleValue(
+ sal_Int64 nWidthPt = static_cast<sal_Int64>(vcl::ConvertDoubleValue(
sal_Int64( pFootnoteInfo->GetLineWidth() ), m_xLineWidthEdit->get_digits(),
MapUnit::MapTwip, m_xLineWidthEdit->get_unit( ) ));
m_xLineWidthEdit->set_value(nWidthPt, FieldUnit::NONE);
@@ -236,7 +236,7 @@ bool SwFootNotePage::FillItemSet(SfxItemSet *rSet)
// Separator width
sal_Int64 nWidth = m_xLineWidthEdit->get_value(FieldUnit::NONE);
- nWidth = static_cast<long>(MetricField::ConvertDoubleValue(
+ nWidth = static_cast<long>(vcl::ConvertDoubleValue(
nWidth,
m_xLineWidthEdit->get_digits(),
m_xLineWidthEdit->get_unit(), MapUnit::MapTwip ));
diff --git a/sw/source/uibase/utlui/prcntfld.cxx b/sw/source/uibase/utlui/prcntfld.cxx
index d3b039613a8a..2cefdc4ff7bc 100644
--- a/sw/source/uibase/utlui/prcntfld.cxx
+++ b/sw/source/uibase/utlui/prcntfld.cxx
@@ -18,7 +18,7 @@
*/
#include <prcntfld.hxx>
-#include <vcl/field.hxx>
+#include <vcl/fieldvalues.hxx>
SwPercentField::SwPercentField(std::unique_ptr<weld::MetricSpinButton> pControl)
: m_pField(std::move(pControl))
@@ -65,7 +65,7 @@ void SwPercentField::ShowPercent(bool bPercent)
m_pField->set_unit(FieldUnit::PERCENT);
m_pField->set_digits(0);
- int nCurrentWidth = MetricField::ConvertValue(nOldMin, 0, nOldDigits, eOldUnit, FieldUnit::TWIP);
+ int nCurrentWidth = vcl::ConvertValue(nOldMin, 0, nOldDigits, eOldUnit, FieldUnit::TWIP);
// round to 0.5 percent
int nPercent = nRefValue ? (((nCurrentWidth * 10) / nRefValue + 5) / 10) : 0;
@@ -73,7 +73,7 @@ void SwPercentField::ShowPercent(bool bPercent)
m_pField->set_increments(5, 10, FieldUnit::NONE);
if (nOldValue != nLastValue)
{
- nCurrentWidth = MetricField::ConvertValue(nOldValue, 0, nOldDigits, eOldUnit, FieldUnit::TWIP);
+ nCurrentWidth = vcl::ConvertValue(nOldValue, 0, nOldDigits, eOldUnit, FieldUnit::TWIP);
nPercent = nRefValue ? (((nCurrentWidth * 10) / nRefValue + 5) / 10) : 0;
m_pField->set_value(nPercent, FieldUnit::NONE);
nLastPercent = nPercent;
@@ -114,12 +114,12 @@ void SwPercentField::set_value(int nNewValue, FieldUnit eInUnit)
int nPercent, nCurrentWidth;
if(eInUnit == FieldUnit::TWIP)
{
- nCurrentWidth = MetricField::ConvertValue(nNewValue, 0, nOldDigits, FieldUnit::TWIP, FieldUnit::TWIP);
+ nCurrentWidth = vcl::ConvertValue(nNewValue, 0, nOldDigits, FieldUnit::TWIP, FieldUnit::TWIP);
}
else
{
int nValue = Convert(nNewValue, eInUnit, eOldUnit);
- nCurrentWidth = MetricField::ConvertValue(nValue, 0, nOldDigits, eOldUnit, FieldUnit::TWIP);
+ nCurrentWidth = vcl::ConvertValue(nValue, 0, nOldDigits, eOldUnit, FieldUnit::TWIP);
}
nPercent = nRefValue ? (((nCurrentWidth * 10) / nRefValue + 5) / 10) : 0;
m_pField->set_value(nPercent, FieldUnit::NONE);
@@ -206,7 +206,7 @@ int SwPercentField::Convert(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit)
if (eOutUnit == FieldUnit::TWIP) // Only convert if necessary
return NormalizePercent(nTwipValue);
else
- return MetricField::ConvertValue(NormalizePercent(nTwipValue), 0, nOldDigits, FieldUnit::TWIP, eOutUnit);
+ return vcl::ConvertValue(NormalizePercent(nTwipValue), 0, nOldDigits, FieldUnit::TWIP, eOutUnit);
}
if (eOutUnit == FieldUnit::PERCENT)
@@ -218,11 +218,11 @@ int SwPercentField::Convert(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit)
if (eInUnit == FieldUnit::TWIP) // Only convert if necessary
nCurrentWidth = nValue;
else
- nCurrentWidth = MetricField::ConvertValue(nValue, 0, nOldDigits, eInUnit, FieldUnit::TWIP);
+ nCurrentWidth = vcl::ConvertValue(nValue, 0, nOldDigits, eInUnit, FieldUnit::TWIP);
// Round to 0.5 percent
return nRefValue ? (((nCurrentWidth * 1000) / nRefValue + 5) / 10) : 0;
}
- return MetricField::ConvertValue(nValue, 0, nOldDigits, eInUnit, eOutUnit);
+ return vcl::ConvertValue(nValue, 0, nOldDigits, eInUnit, eOutUnit);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index da2218a684e4..4d7d08447323 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -27,6 +27,7 @@
#include <comphelper/string.hxx>
#include <vcl/builder.hxx>
+#include <vcl/fieldvalues.hxx>
#include <vcl/toolkit/field.hxx>
#include <vcl/event.hxx>
#include <vcl/svapp.hxx>
@@ -1140,22 +1141,25 @@ static double nonValueDoubleToValueDouble( double nValue )
return rtl::math::isFinite( nValue ) ? nValue : 0.0;
}
-sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
- FieldUnit eInUnit, FieldUnit eOutUnit )
+namespace vcl
{
- double nDouble = nonValueDoubleToValueDouble( ConvertDoubleValue(
- static_cast<double>(nValue), mnBaseValue, nDecDigits, eInUnit, eOutUnit ) );
- sal_Int64 nLong ;
+ sal_Int64 ConvertValue(sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
+ FieldUnit eInUnit, FieldUnit eOutUnit)
+ {
+ double nDouble = nonValueDoubleToValueDouble(vcl::ConvertDoubleValue(
+ static_cast<double>(nValue), mnBaseValue, nDecDigits, eInUnit, eOutUnit));
+ sal_Int64 nLong ;
- // caution: precision loss in double cast
- if ( nDouble <= double(SAL_MIN_INT64) )
- nLong = SAL_MIN_INT64;
- else if ( nDouble >= double(SAL_MAX_INT64) )
- nLong = SAL_MAX_INT64;
- else
- nLong = static_cast<sal_Int64>( nDouble );
+ // caution: precision loss in double cast
+ if ( nDouble <= double(SAL_MIN_INT64) )
+ nLong = SAL_MIN_INT64;
+ else if ( nDouble >= double(SAL_MAX_INT64) )
+ nLong = SAL_MAX_INT64;
+ else
+ nLong = static_cast<sal_Int64>( nDouble );
- return nLong;
+ return nLong;
+ }
}
namespace {
@@ -1208,146 +1212,149 @@ double convertValue( double nValue, long nDigits, FieldUnit eInUnit, FieldUnit e
}
-sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_uInt16 nDigits,
- MapUnit eInUnit, FieldUnit eOutUnit )
+namespace vcl
{
- if ( !checkConversionUnits(eInUnit, eOutUnit) )
+ sal_Int64 ConvertValue( sal_Int64 nValue, sal_uInt16 nDigits,
+ MapUnit eInUnit, FieldUnit eOutUnit )
{
- OSL_FAIL( "invalid parameters" );
- return nValue;
- }
+ if ( !checkConversionUnits(eInUnit, eOutUnit) )
+ {
+ OSL_FAIL( "invalid parameters" );
+ return nValue;
+ }
- long nDecDigits = nDigits;
- FieldUnit eFieldUnit = ImplMap2FieldUnit( eInUnit, nDecDigits );
+ long nDecDigits = nDigits;
+ FieldUnit eFieldUnit = ImplMap2FieldUnit( eInUnit, nDecDigits );
- // Avoid sal_Int64 <-> double conversion issues if possible:
- if (eFieldUnit == eOutUnit && nDigits == 0)
- {
- return nValue;
- }
+ // Avoid sal_Int64 <-> double conversion issues if possible:
+ if (eFieldUnit == eOutUnit && nDigits == 0)
+ {
+ return nValue;
+ }
- return static_cast<sal_Int64>(
- nonValueDoubleToValueDouble(
- convertValue( nValue, nDecDigits, eFieldUnit, eOutUnit ) ) );
-}
+ return static_cast<sal_Int64>(
+ nonValueDoubleToValueDouble(
+ convertValue( nValue, nDecDigits, eFieldUnit, eOutUnit ) ) );
+ }
-double MetricField::ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
- FieldUnit eInUnit, FieldUnit eOutUnit )
-{
- if ( eInUnit != eOutUnit )
+ double ConvertDoubleValue(double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits,
+ FieldUnit eInUnit, FieldUnit eOutUnit)
{
- sal_Int64 nMult = 1, nDiv = 1;
-
- if (eInUnit == FieldUnit::PERCENT)
+ if ( eInUnit != eOutUnit )
{
- if ( (mnBaseValue <= 0) || (nValue <= 0) )
- return nValue;
- nDiv = 100 * ImplPower10(nDecDigits);
+ sal_Int64 nMult = 1, nDiv = 1;
- nMult = mnBaseValue;
- }
- else if ( eOutUnit == FieldUnit::PERCENT ||
- eOutUnit == FieldUnit::CUSTOM ||
- eOutUnit == FieldUnit::NONE ||
- eOutUnit == FieldUnit::DEGREE ||
- eOutUnit == FieldUnit::SECOND ||
- eOutUnit == FieldUnit::MILLISECOND ||
- eOutUnit == FieldUnit::PIXEL ||
- eInUnit == FieldUnit::CUSTOM ||
- eInUnit == FieldUnit::NONE ||
- eInUnit == FieldUnit::DEGREE ||
- eInUnit == FieldUnit::MILLISECOND ||
- eInUnit == FieldUnit::PIXEL )
- return nValue;
- else
- {
- if (eOutUnit == FieldUnit::MM_100TH)
- eOutUnit = FieldUnit::NONE;
- if (eInUnit == FieldUnit::MM_100TH)
- eInUnit = FieldUnit::NONE;
+ if (eInUnit == FieldUnit::PERCENT)
+ {
+ if ( (mnBaseValue <= 0) || (nValue <= 0) )
+ return nValue;
+ nDiv = 100 * ImplPower10(nDecDigits);
- nDiv = aImplFactor[sal_uInt16(eInUnit)][sal_uInt16(eOutUnit)];
- nMult = aImplFactor[sal_uInt16(eOutUnit)][sal_uInt16(eInUnit)];
+ nMult = mnBaseValue;
+ }
+ else if ( eOutUnit == FieldUnit::PERCENT ||
+ eOutUnit == FieldUnit::CUSTOM ||
+ eOutUnit == FieldUnit::NONE ||
+ eOutUnit == FieldUnit::DEGREE ||
+ eOutUnit == FieldUnit::SECOND ||
+ eOutUnit == FieldUnit::MILLISECOND ||
+ eOutUnit == FieldUnit::PIXEL ||
+ eInUnit == FieldUnit::CUSTOM ||
+ eInUnit == FieldUnit::NONE ||
+ eInUnit == FieldUnit::DEGREE ||
+ eInUnit == FieldUnit::MILLISECOND ||
+ eInUnit == FieldUnit::PIXEL )
+ return nValue;
+ else
+ {
+ if (eOutUnit == FieldUnit::MM_100TH)
+ eOutUnit = FieldUnit::NONE;
+ if (eInUnit == FieldUnit::MM_100TH)
+ eInUnit = FieldUnit::NONE;
- SAL_WARN_IF( nMult <= 0, "vcl", "illegal *" );
- SAL_WARN_IF( nDiv <= 0, "vcl", "illegal /" );
- }
+ nDiv = aImplFactor[sal_uInt16(eInUnit)][sal_uInt16(eOutUnit)];
+ nMult = aImplFactor[sal_uInt16(eOutUnit)][sal_uInt16(eInUnit)];
- if ( nMult != 1 && nMult > 0 )
- nValue *= nMult;
- if ( nDiv != 1 && nDiv > 0 )
- {
- nValue += ( nValue < 0 ) ? (-nDiv/2) : (nDiv/2);
- nValue /= nDiv;
- }
- }
+ SAL_WARN_IF( nMult <= 0, "vcl", "illegal *" );
+ SAL_WARN_IF( nDiv <= 0, "vcl", "illegal /" );
+ }
- return nValue;
-}
+ if ( nMult != 1 && nMult > 0 )
+ nValue *= nMult;
+ if ( nDiv != 1 && nDiv > 0 )
+ {
+ nValue += ( nValue < 0 ) ? (-nDiv/2) : (nDiv/2);
+ nValue /= nDiv;
+ }
+ }
-double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits,
- MapUnit eInUnit, FieldUnit eOutUnit )
-{
- if ( !checkConversionUnits(eInUnit, eOutUnit) )
- {
- OSL_FAIL( "invalid parameters" );
return nValue;
}
- long nDecDigits = nDigits;
- FieldUnit eFieldUnit = ImplMap2FieldUnit( eInUnit, nDecDigits );
-
- return convertValue(nValue, nDecDigits, eFieldUnit, eOutUnit);
-}
-
-double MetricField::ConvertDoubleValue( double nValue, sal_uInt16 nDigits,
- FieldUnit eInUnit, MapUnit eOutUnit )
-{
- if ( eInUnit == FieldUnit::PERCENT ||
- eInUnit == FieldUnit::CUSTOM ||
- eInUnit == FieldUnit::NONE ||
- eInUnit == FieldUnit::DEGREE ||
- eInUnit == FieldUnit::SECOND ||
- eInUnit == FieldUnit::MILLISECOND ||
- eInUnit == FieldUnit::PIXEL ||
- eOutUnit == MapUnit::MapPixel ||
- eOutUnit == MapUnit::MapSysFont ||
- eOutUnit == MapUnit::MapAppFont ||
- eOutUnit == MapUnit::MapRelative )
+ double ConvertDoubleValue(double nValue, sal_uInt16 nDigits,
+ MapUnit eInUnit, FieldUnit eOutUnit)
{
- OSL_FAIL( "invalid parameters" );
- return nValue;
- }
+ if ( !checkConversionUnits(eInUnit, eOutUnit) )
+ {
+ OSL_FAIL( "invalid parameters" );
+ return nValue;
+ }
- long nDecDigits = nDigits;
- FieldUnit eFieldUnit = ImplMap2FieldUnit( eOutUnit, nDecDigits );
+ long nDecDigits = nDigits;
+ FieldUnit eFieldUnit = ImplMap2FieldUnit( eInUnit, nDecDigits );
- if ( nDecDigits < 0 )
- {
- nValue *= ImplPower10(-nDecDigits);
- }
- else
- {
- nValue /= ImplPower10(nDecDigits);
+ return convertValue(nValue, nDecDigits, eFieldUnit, eOutUnit);
}
- if ( eFieldUnit != eInUnit )
+ double ConvertDoubleValue(double nValue, sal_uInt16 nDigits,
+ FieldUnit eInUnit, MapUnit eOutUnit)
{
- sal_Int64 nDiv = aImplFactor[sal_uInt16(eInUnit)][sal_uInt16(eFieldUnit)];
- sal_Int64 nMult = aImplFactor[sal_uInt16(eFieldUnit)][sal_uInt16(eInUnit)];
+ if ( eInUnit == FieldUnit::PERCENT ||
+ eInUnit == FieldUnit::CUSTOM ||
+ eInUnit == FieldUnit::NONE ||
+ eInUnit == FieldUnit::DEGREE ||
+ eInUnit == FieldUnit::SECOND ||
+ eInUnit == FieldUnit::MILLISECOND ||
+ eInUnit == FieldUnit::PIXEL ||
+ eOutUnit == MapUnit::MapPixel ||
+ eOutUnit == MapUnit::MapSysFont ||
+ eOutUnit == MapUnit::MapAppFont ||
+ eOutUnit == MapUnit::MapRelative )
+ {
+ OSL_FAIL( "invalid parameters" );
+ return nValue;
+ }
- SAL_WARN_IF( nMult <= 0, "vcl", "illegal *" );
- SAL_WARN_IF( nDiv <= 0, "vcl", "illegal /" );
+ long nDecDigits = nDigits;
+ FieldUnit eFieldUnit = ImplMap2FieldUnit( eOutUnit, nDecDigits );
- if( nMult != 1 && nMult > 0 )
- nValue *= nMult;
- if( nDiv != 1 && nDiv > 0 )
+ if ( nDecDigits < 0 )
{
- nValue += (nValue < 0) ? (-nDiv/2) : (nDiv/2);
- nValue /= nDiv;
+ nValue *= ImplPower10(-nDecDigits);
}
+ else
+ {
+ nValue /= ImplPower10(nDecDigits);
+ }
+
+ if ( eFieldUnit != eInUnit )
+ {
+ sal_Int64 nDiv = aImplFactor[sal_uInt16(eInUnit)][sal_uInt16(eFieldUnit)];
+ sal_Int64 nMult = aImplFactor[sal_uInt16(eFieldUnit)][sal_uInt16(eInUnit)];
+
+ SAL_WARN_IF( nMult <= 0, "vcl", "illegal *" );
+ SAL_WARN_IF( nDiv <= 0, "vcl", "illegal /" );
+
+ if( nMult != 1 && nMult > 0 )
+ nValue *= nMult;
+ if( nDiv != 1 && nDiv > 0 )
+ {
+ nValue += (nValue < 0) ? (-nDiv/2) : (nDiv/2);
+ nValue /= nDiv;
+ }
+ }
+ return nValue;
}
- return nValue;
}
bool MetricFormatter::TextToValue(const OUString& rStr, double& rValue, sal_Int64 nBaseValue,
@@ -1363,7 +1370,7 @@ bool MetricFormatter::TextToValue(const OUString& rStr, double& rValue, sal_Int6
// Recalculate unit
// caution: conversion to double loses precision
- rValue = MetricField::ConvertDoubleValue( static_cast<double>(nValue), nBaseValue, nDecDigits, eEntryUnit, eUnit );
+ rValue = vcl::ConvertDoubleValue(static_cast<double>(nValue), nBaseValue, nDecDigits, eEntryUnit, eUnit);
return true;
}
@@ -1461,7 +1468,7 @@ OUString MetricFormatter::CreateFieldText( sal_Int64 nValue ) const
void MetricFormatter::SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit )
{
// convert to previously configured units
- nNewValue = MetricField::ConvertValue( nNewValue, 0, GetDecimalDigits(), eInUnit, meUnit );
+ nNewValue = vcl::ConvertValue( nNewValue, 0, GetDecimalDigits(), eInUnit, meUnit );
NumericFormatter::SetUserValue( nNewValue );
}
@@ -1479,7 +1486,7 @@ sal_Int64 MetricFormatter::GetValueFromStringUnit(const OUString& rStr, FieldUni
nTempValue = static_cast<double>(mnMin);
// convert to requested units
- return MetricField::ConvertValue(static_cast<sal_Int64>(nTempValue), 0, GetDecimalDigits(), meUnit, eOutUnit);
+ return vcl::ConvertValue(static_cast<sal_Int64>(nTempValue), 0, GetDecimalDigits(), meUnit, eOutUnit);
}
sal_Int64 MetricFormatter::GetValueFromString(const OUString& rStr) const
@@ -1501,36 +1508,31 @@ void MetricFormatter::SetValue( sal_Int64 nValue )
void MetricFormatter::SetMin( sal_Int64 nNewMin, FieldUnit eInUnit )
{
// convert to requested units
- NumericFormatter::SetMin( MetricField::ConvertValue( nNewMin, 0, GetDecimalDigits(),
- eInUnit, meUnit ) );
+ NumericFormatter::SetMin(vcl::ConvertValue(nNewMin, 0, GetDecimalDigits(), eInUnit, meUnit));
}
sal_Int64 MetricFormatter::GetMin( FieldUnit eOutUnit ) const
{
// convert to requested units
- return MetricField::ConvertValue( NumericFormatter::GetMin(), 0,
- GetDecimalDigits(), meUnit, eOutUnit );
+ return vcl::ConvertValue(NumericFormatter::GetMin(), 0, GetDecimalDigits(), meUnit, eOutUnit);
}
void MetricFormatter::SetMax( sal_Int64 nNewMax, FieldUnit eInUnit )
{
// convert to requested units
- NumericFormatter::SetMax( MetricField::ConvertValue( nNewMax, 0, GetDecimalDigits(),
- eInUnit, meUnit ) );
+ NumericFormatter::SetMax(vcl::ConvertValue(nNewMax, 0, GetDecimalDigits(), eInUnit, meUnit));
}
sal_Int64 MetricFormatter::GetMax( FieldUnit eOutUnit ) const
{
// convert to requested units
- return MetricField::ConvertValue( NumericFormatter::GetMax(), 0,
- GetDecimalDigits(), meUnit, eOutUnit );
+ return vcl::ConvertValue(NumericFormatter::GetMax(), 0, GetDecimalDigits(), meUnit, eOutUnit);
}
sal_Int64 MetricFormatter::GetBaseValue() const
{
// convert to requested units
- return MetricField::ConvertValue( 0, 0, GetDecimalDigits(),
- meUnit, FieldUnit::NONE );
+ return vcl::ConvertValue(0, 0, GetDecimalDigits(), meUnit, FieldUnit::NONE);
}
void MetricFormatter::Reformat()
@@ -1557,8 +1559,8 @@ void MetricFormatter::Reformat()
sal_Int64 MetricFormatter::GetCorrectedValue( FieldUnit eOutUnit ) const
{
// convert to requested units
- return MetricField::ConvertValue( 0/*nCorrectedValue*/, 0, GetDecimalDigits(),
- meUnit, eOutUnit );
+ return vcl::ConvertValue(0/*nCorrectedValue*/, 0, GetDecimalDigits(),
+ meUnit, eOutUnit);
}
MetricField::MetricField(vcl::Window* pParent, WinBits nWinStyle)
@@ -1609,31 +1611,27 @@ void MetricField::SetUnit( FieldUnit nNewUnit )
void MetricField::SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit )
{
// convert
- nNewFirst = MetricField::ConvertValue( nNewFirst, 0, GetDecimalDigits(),
- eInUnit, meUnit );
+ nNewFirst = vcl::ConvertValue(nNewFirst, 0, GetDecimalDigits(), eInUnit, meUnit);
mnFirst = nNewFirst;
}
sal_Int64 MetricField::GetFirst( FieldUnit eOutUnit ) const
{
// convert
- return MetricField::ConvertValue( mnFirst, 0, GetDecimalDigits(),
- meUnit, eOutUnit );
+ return vcl::ConvertValue(mnFirst, 0, GetDecimalDigits(), meUnit, eOutUnit);
}
void MetricField::SetLast( sal_Int64 nNewLast, FieldUnit eInUnit )
{
// convert
- nNewLast = MetricField::ConvertValue( nNewLast, 0, GetDecimalDigits(),
- eInUnit, meUnit );
+ nNewLast = vcl::ConvertValue(nNewLast, 0, GetDecimalDigits(), eInUnit, meUnit);
mnLast = nNewLast;
}
sal_Int64 MetricField::GetLast( FieldUnit eOutUnit ) const
{
// convert
- return MetricField::ConvertValue( mnLast, 0, GetDecimalDigits(),
- meUnit, eOutUnit );
+ return vcl::ConvertValue(mnLast, 0, GetDecimalDigits(), meUnit, eOutUnit);
}
bool MetricField::PreNotify( NotifyEvent& rNEvt )
@@ -1807,8 +1805,7 @@ void MetricBox::ReformatAll()
void MetricBox::InsertValue( sal_Int64 nValue, FieldUnit eInUnit, sal_Int32 nPos )
{
// convert to previously configured units
- nValue = MetricField::ConvertValue( nValue, 0, GetDecimalDigits(),
- eInUnit, meUnit );
+ nValue = vcl::ConvertValue(nValue, 0, GetDecimalDigits(), eInUnit, meUnit);
ComboBox::InsertEntry( CreateFieldText( nValue ), nPos );
}
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 3cf4cccef262..5987856e1e6b 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -26,6 +26,7 @@
#include <vcl/toolkit/dialog.hxx>
#include <vcl/edit.hxx>
#include <vcl/toolkit/field.hxx>
+#include <vcl/fieldvalues.hxx>
#include <vcl/fmtfield.hxx>
#include <vcl/fixed.hxx>
#include <vcl/toolkit/fixedhyper.hxx>
@@ -303,7 +304,7 @@ namespace weld
int MetricSpinButton::ConvertValue(int nValue, FieldUnit eInUnit, FieldUnit eOutUnit) const
{
- return MetricField::ConvertValue(nValue, 0, m_xSpinButton->get_digits(), eInUnit, eOutUnit);
+ return vcl::ConvertValue(nValue, 0, m_xSpinButton->get_digits(), eInUnit, eOutUnit);
}
IMPL_LINK(MetricSpinButton, spin_button_input, int*, result, bool)