Kaydet (Commit) 128145e2 authored tarafından Caolán McNamara's avatar Caolán McNamara

tdf#125011 large ui scaling factor overflows spinbutton range

Change-Id: I6e41318a92f02e3cd7fde5c52272582345362533
Reviewed-on: https://gerrit.libreoffice.org/71659
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 85cdb680
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment