diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-05-02 09:08:13 +0100 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2019-05-03 16:53:24 +0200 |
commit | ce641ca3aaf0294f1dca92bda9fd6848e6104aad (patch) | |
tree | 3dc81f0189d46aa175b196cf70c871fdca36dd05 | |
parent | tdf#123285 sw_redlinehide: fix SwAutoFormat::DelMoreLinesBlanks() (diff) | |
download | core-ce641ca3aaf0294f1dca92bda9fd6848e6104aad.tar.gz core-ce641ca3aaf0294f1dca92bda9fd6848e6104aad.zip |
tdf#125011 large ui scaling factor overflows spinbutton range
Change-Id: I6e41318a92f02e3cd7fde5c52272582345362533
clamp to target type bounds
Change-Id: I8d3f7653b7e9b64a2f433b4ebfb8a0fef1522e93
Reviewed-on: https://gerrit.libreoffice.org/71637
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit ed67b443d1db273818737ef7996330a8f475361b)
Reviewed-on: https://gerrit.libreoffice.org/71660
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
-rw-r--r-- | sd/source/ui/dlg/copydlg.cxx | 24 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 6 |
2 files changed, 19 insertions, 11 deletions
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index afaf7d89c873..4bf5ca2b54c0 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -94,17 +94,19 @@ void CopyDlg::Reset() // Set Min/Max values ::tools::Rectangle aRect = mpView->GetAllMarkedRect(); Size aPageSize = mpView->GetSdrPageView()->GetPage()->GetSize(); - SetMetricValue( *m_xMtrFldMoveX, long(1000000 / maUIScale), MapUnit::Map100thMM); - double fScaleFactor = m_xMtrFldMoveX->get_value(FieldUnit::NONE)/1000000.0; - - long nPageWidth = aPageSize.Width() * fScaleFactor; - long nPageHeight = aPageSize.Height() * fScaleFactor; - long nRectWidth = aRect.GetWidth() * fScaleFactor; - long nRectHeight = aRect.GetHeight() * fScaleFactor; - m_xMtrFldMoveX->set_range(-nPageWidth, nPageWidth, FieldUnit::NONE); - m_xMtrFldMoveY->set_range(-nPageHeight, nPageHeight, FieldUnit::NONE); - m_xMtrFldWidth->set_range(-nRectWidth, nPageWidth, FieldUnit::NONE); - m_xMtrFldHeight->set_range(-nRectHeight, nPageHeight, FieldUnit::NONE); + + // tdf#125011 draw/impress sizes are in mm_100th already, "normalize" to + // decimal shift by number of decimal places the widgets are using (2) then + // scale by the ui scaling factor + auto nPageWidth = long(m_xMtrFldMoveX->normalize(aPageSize.Width()) / maUIScale); + auto nPageHeight = long(m_xMtrFldMoveX->normalize(aPageSize.Height()) / maUIScale); + auto nRectWidth = long(m_xMtrFldMoveX->normalize(aRect.GetWidth()) / maUIScale); + auto nRectHeight = long(m_xMtrFldMoveX->normalize(aRect.GetHeight()) / maUIScale); + + m_xMtrFldMoveX->set_range(-nPageWidth, nPageWidth, FieldUnit::MM_100TH); + m_xMtrFldMoveY->set_range(-nPageHeight, nPageHeight, FieldUnit::MM_100TH); + m_xMtrFldWidth->set_range(-nRectWidth, nPageWidth, FieldUnit::MM_100TH); + m_xMtrFldHeight->set_range(-nRectHeight, nPageHeight, FieldUnit::MM_100TH); const SfxPoolItem* pPoolItem = nullptr; OUString aStr; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 287200e24986..6f6189d11d57 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -281,7 +281,13 @@ namespace weld double fResult(0.0); bool bRet = MetricFormatter::TextToValue(get_text(), fResult, 0, m_xSpinButton->get_digits(), rLocaleData, m_eSrcUnit); if (bRet) + { + if (fResult > SAL_MAX_INT32) + fResult = SAL_MAX_INT32; + else if (fResult < SAL_MIN_INT32) + fResult = SAL_MIN_INT32; *result = fResult; + } return bRet; } |