diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-05-02 09:08:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-05-02 15:50:56 +0200 |
commit | 128145e227ef91fb2f23893e73d38ae72cf074e5 (patch) | |
tree | 1c52df31d7eee20502463763df4d4fa6b3d942e0 /sd | |
parent | 85cdb6804cc141a05638494cea7cd59d299eb53e (diff) |
tdf#125011 large ui scaling factor overflows spinbutton range
Change-Id: I6e41318a92f02e3cd7fde5c52272582345362533
Reviewed-on: https://gerrit.libreoffice.org/71659
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/dlg/copydlg.cxx | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index 4968f6bf7807..15e2f1933a35 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -88,18 +88,19 @@ void CopyDlg::Reset() // Set Min/Max values ::tools::Rectangle aRect = mpView->GetAllMarkedRect(); Size aPageSize = mpView->GetSdrPageView()->GetPage()->GetSize(); - auto const n1 = m_xMtrFldMoveX->normalize(long(1000000 / maUIScale)); - auto const n2 = m_xMtrFldMoveX->convert_value_from(n1, FieldUnit::MM_100TH); - double fScaleFactor = m_xMtrFldMoveX->convert_value_to(n2, 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; |