[Libreoffice-commits] core.git: sd/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu May 2 13:51:45 UTC 2019


 sd/source/ui/dlg/copydlg.cxx |   25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

New commits:
commit 128145e227ef91fb2f23893e73d38ae72cf074e5
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu May 2 09:08:13 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu May 2 15:50:56 2019 +0200

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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;


More information about the Libreoffice-commits mailing list