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 dd544837226d9af2a777c145f91972fd0b755587 Author: Mike Kaganski <[email protected]> AuthorDate: Sat Oct 11 23:38:36 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Sat Oct 11 22:41:02 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]> 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 9df628bab74d..55f1893ebce6 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1409,7 +1409,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 374abc63ccea..7d10dbb691ef 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -1222,7 +1222,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) @@ -1322,7 +1322,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 63358954925a..9496ff1f7589 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -393,7 +393,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)
