From 0acbf9404a40e5ca87642af299218846d51cf009 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Thu, 11 Feb 2016 03:49:37 +0530 Subject: tdf#82396:Incorrect behavior on update of Size values in sidebar Added limits for Width and Height Change-Id: I2aa80c86aeca826009b4594e5e9a0d5ed7f67ef9 Reviewed-on: https://gerrit.libreoffice.org/22274 Tested-by: Jenkins Reviewed-by: Katarina Behrens --- svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 11 +++++++++-- svx/source/sidebar/possize/PosSizePropertyPanel.hxx | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'svx/source/sidebar') diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index 026fb8c55aaa..11e4f005ffa2 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -917,7 +917,7 @@ void PosSizePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem* SetFieldUnit( *mpMtrPosY, meDlgUnit, true ); if(bPosYBlank) mpMtrPosY->SetText(OUString()); - SetPosXYMinMax(); + SetPosSizeMinMax(); if (mpMtrWidth->GetText().isEmpty()) bWidthBlank = true; @@ -1051,7 +1051,7 @@ void PosSizePropertyPanel::DisableControls() } } -void PosSizePropertyPanel::SetPosXYMinMax() +void PosSizePropertyPanel::SetPosSizeMinMax() { SdrPageView* pPV = mpView->GetSdrPageView(); if (!pPV) @@ -1096,6 +1096,13 @@ void PosSizePropertyPanel::SetPosXYMinMax() mpMtrPosY->SetFirst(basegfx::fround64(fTop)); mpMtrPosY->SetMax(basegfx::fround64(fBottom)); mpMtrPosY->SetLast(basegfx::fround64(fBottom)); + + double fMaxWidth = maWorkArea.getWidth() - (maRect.getMinX() - fLeft); + double fMaxHeight = maWorkArea.getHeight() - (maRect.getMinY() - fTop); + mpMtrWidth->SetMax(basegfx::fround64(fMaxWidth)); + mpMtrWidth->SetLast(basegfx::fround64(fMaxWidth)); + mpMtrHeight->SetMax(basegfx::fround64(fMaxHeight)); + mpMtrHeight->SetLast(basegfx::fround64(fMaxHeight)); } void PosSizePropertyPanel::UpdateUIScale() diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx index 5aa420116325..21ada21e093d 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx @@ -167,7 +167,7 @@ private: void MetricState( SfxItemState eState, const SfxPoolItem* pState ); static FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ); void DisableControls(); - void SetPosXYMinMax(); + void SetPosSizeMinMax(); /** Check if the UI scale has changed and handle such a change. UI scale is an SD only feature. The UI scale is represented by items -- cgit