diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-08-13 16:44:15 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-08-16 15:53:02 +0200 |
commit | 581b2cf7960c48e6199bd35be839424113abe533 (patch) | |
tree | 5f5d0f4cf0be4d134804cea9738460e92a61e11c /chart2/source/controller | |
parent | 76f89b0097c02fa68c36cfc9a31de3b2e9166abc (diff) |
Drop tools::Rectangle::getX/getY, which are just duplicates of Left/Top
The change allowed to simplify many places where previously this API was
used, to avoid inefficient calculations (e.g., moving rectangle keeping
its size, and then immediately changing the size).
Change-Id: Ica2dc594d91cae83e2c2740c1f4fb23f44998916
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120461
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'chart2/source/controller')
-rw-r--r-- | chart2/source/controller/accessibility/AccessibleBase.cxx | 2 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Window.cxx | 18 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartWindow.cxx | 4 |
3 files changed, 11 insertions, 13 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index e5ca33bff4be..8b539d9dc644 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -655,7 +655,7 @@ awt::Rectangle SAL_CALL AccessibleBase::getBounds() awt::Point aOffset( aParentLocOnScreen.X - aULOnScreen.X, aParentLocOnScreen.Y - aULOnScreen.Y ); - return awt::Rectangle( aRect.getX() - aOffset.X, aRect.getY() - aOffset.Y, + return awt::Rectangle( aRect.Left() - aOffset.X, aRect.Top() - aOffset.Y, aRect.getWidth(), aRect.getHeight()); } } diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index c7af79a03da8..73b7ad46a9d9 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -871,9 +871,9 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID() , getModel() - , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight()) - , awt::Rectangle(aOldObjectRect.getX(), aOldObjectRect.getY(), 0, 0) - , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) ); + , awt::Rectangle(aObjectRect.Left(),aObjectRect.Top(),aObjectRect.getWidth(),aObjectRect.getHeight()) + , awt::Rectangle(aOldObjectRect.Left(), aOldObjectRect.Top(), 0, 0) + , awt::Rectangle(aPageRect.Left(),aPageRect.Top(),aPageRect.getWidth(),aPageRect.getHeight()) ); if( bMoved || bChanged ) { @@ -1522,16 +1522,16 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) { tools::Rectangle aRect = pObj->GetSnapRect(); awt::Size aPageSize(ChartModelHelper::getPageSize(getModel())); - if ((fShiftAmountX > 0.0 && (aRect.getX() + fShiftAmountX + aRect.getWidth() > aPageSize.Width)) || - (fShiftAmountX < 0.0 && (aRect.getX() + fShiftAmountX < 0)) || - (fShiftAmountY > 0.0 && (aRect.getY() + fShiftAmountY + aRect.getHeight() > aPageSize.Height)) || - (fShiftAmountY < 0.0 && (aRect.getY() + fShiftAmountY < 0))) + if ((fShiftAmountX > 0.0 && (aRect.Right() + fShiftAmountX > aPageSize.Width)) || + (fShiftAmountX < 0.0 && (aRect.Left() + fShiftAmountX < 0)) || + (fShiftAmountY > 0.0 && (aRect.Bottom() + fShiftAmountY > aPageSize.Height)) || + (fShiftAmountY < 0.0 && (aRect.Top() + fShiftAmountY < 0))) bReturn = false; else bReturn = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID(), getModel(), - awt::Rectangle(aRect.getX() + fShiftAmountX, aRect.getY() + fShiftAmountY, aRect.getWidth(), aRect.getHeight()), - awt::Rectangle(aRect.getX(), aRect.getY(), 0, 0), + awt::Rectangle(aRect.Left() + fShiftAmountX, aRect.Top() + fShiftAmountY, aRect.getWidth(), aRect.getHeight()), + awt::Rectangle(aRect.Left(), aRect.Top(), 0, 0), awt::Rectangle(0, 0, aPageSize.Width, aPageSize.Height)); } } diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx index 556cc81dcdeb..811016de28c1 100644 --- a/chart2/source/controller/main/ChartWindow.cxx +++ b/chart2/source/controller/main/ChartWindow.cxx @@ -38,9 +38,7 @@ namespace { ::tools::Rectangle lcl_AWTRectToVCLRect( const css::awt::Rectangle & rAWTRect ) { - ::tools::Rectangle aResult; - aResult.setX( rAWTRect.X ); - aResult.setY( rAWTRect.Y ); + ::tools::Rectangle aResult(rAWTRect.X, rAWTRect.Y); aResult.setWidth( rAWTRect.Width ); aResult.setHeight( rAWTRect.Height ); return aResult; |