sd/source/ui/dlg/diactrl.cxx | 2 +- svtools/source/control/ctrlbox.cxx | 2 +- vcl/source/control/field.cxx | 4 ++-- vcl/source/window/builder.cxx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
New commits: commit bb821267b55541e515087b598054502ec450840b Author: Mike Kaganski <[email protected]> AuthorDate: Sat Oct 11 23:38:36 2025 +0500 Commit: Adolfo Jayme Barrientos <[email protected]> CommitDate: Sun Oct 12 23:20:13 2025 +0200 tdf#168709: round double value instead of truncation Regression from commit cfff893b9c82843a90aac4ecdb3a3936721b74a0 (Move unit conversion code to o3tl, and unify on that in more places, 2021-02-14). Change-Id: If18e8537cd03d3fd516bd164c6a816f1bba38f7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192235 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> (cherry picked from commit dd544837226d9af2a777c145f91972fd0b755587) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192254 Reviewed-by: Adolfo Jayme Barrientos <[email protected]> diff --git a/sd/source/ui/dlg/diactrl.cxx b/sd/source/ui/dlg/diactrl.cxx index 3c99dca8cd62..64740c4ff691 100644 --- a/sd/source/ui/dlg/diactrl.cxx +++ b/sd/source/ui/dlg/diactrl.cxx @@ -127,7 +127,7 @@ IMPL_LINK(SdPagesField, spin_button_input, const OUString&, rText, std::optional else if (fResult < SAL_MIN_INT32) fResult = SAL_MIN_INT32; - return std::optional<int>(fResult); + return std::optional<int>(std::round(fResult)); } IMPL_LINK_NOARG(SdPagesField, ModifyHdl, weld::SpinButton&, void) diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index c0d84e429d70..73683698db52 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1410,7 +1410,7 @@ int FontSizeBox::get_value() const else if (fResult > nMax) fResult = nMax; } - return fResult; + return std::round(fResult); } SvxBorderLineStyle SvtLineListBox::GetSelectEntryStyle() const diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 7f69fb078d59..b79c77e440a5 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -1223,7 +1223,7 @@ void MetricFormatter::ImplMetricReformat( const OUString& rStr, double& rValue, nTempVal = static_cast<double>(GetMax()); else if ( nTempVal < GetMin()) nTempVal = static_cast<double>(GetMin()); - rOutStr = CreateFieldText( static_cast<sal_Int64>(nTempVal) ); + rOutStr = CreateFieldText( static_cast<sal_Int64>(std::round(nTempVal)) ); } MetricFormatter::MetricFormatter(Edit* pEdit) @@ -1323,7 +1323,7 @@ sal_Int64 MetricFormatter::GetValueFromStringUnit(const OUString& rStr, FieldUni nTempValue = static_cast<double>(mnMin); // convert to requested units - return vcl::ConvertValue(static_cast<sal_Int64>(nTempValue), 0, GetDecimalDigits(), meUnit, eOutUnit); + return vcl::ConvertValue(static_cast<sal_Int64>(std::round(nTempValue)), 0, GetDecimalDigits(), meUnit, eOutUnit); } sal_Int64 MetricFormatter::GetValueFromString(const OUString& rStr) const diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 4e220954840e..a50581f12ea1 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -390,7 +390,7 @@ namespace weld else if (fResult < SAL_MIN_INT32) fResult = SAL_MIN_INT32; - return std::optional<int>(fResult); + return std::optional<int>(std::round(fResult)); } EntryTreeView::EntryTreeView(std::unique_ptr<Entry> xEntry, std::unique_ptr<TreeView> xTreeView)
