summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-08-13 16:44:15 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-08-16 15:53:02 +0200
commit581b2cf7960c48e6199bd35be839424113abe533 (patch)
tree5f5d0f4cf0be4d134804cea9738460e92a61e11c
parent76f89b0097c02fa68c36cfc9a31de3b2e9166abc (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>
-rw-r--r--basctl/source/basicide/baside2b.cxx3
-rw-r--r--canvas/source/vcl/textlayout.cxx8
-rw-r--r--chart2/source/controller/accessibility/AccessibleBase.cxx2
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx18
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx2
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx6
-rw-r--r--framework/source/layoutmanager/helpers.cxx8
-rw-r--r--framework/source/layoutmanager/helpers.hxx1
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx6
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx5
-rw-r--r--include/tools/gen.hxx4
-rw-r--r--oox/source/export/drawingml.cxx7
-rw-r--r--oox/source/export/shapes.cxx4
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx20
-rw-r--r--sc/source/core/data/drwlayer.cxx6
-rw-r--r--sc/source/filter/xcl97/xcl97rec.cxx7
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx4
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx4
-rw-r--r--sc/source/ui/Accessibility/AccessibleCell.cxx3
-rw-r--r--sc/source/ui/Accessibility/AccessiblePageHeader.cxx3
-rw-r--r--sc/source/ui/Accessibility/AccessiblePreviewCell.cxx6
-rw-r--r--sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx6
-rw-r--r--sc/source/ui/Accessibility/AccessiblePreviewTable.cxx3
-rw-r--r--sc/source/ui/app/inputwin.cxx4
-rw-r--r--sc/source/ui/unoobj/docuno.cxx14
-rw-r--r--sd/qa/unit/tiledrendering/CallbackRecorder.hxx4
-rw-r--r--sd/qa/unit/tiledrendering/tiledrendering.cxx48
-rw-r--r--sd/source/ui/accessibility/AccessiblePageShape.cxx4
-rw-r--r--sfx2/source/control/emojiviewitem.cxx6
-rw-r--r--sfx2/source/control/thumbnailviewitem.cxx11
-rw-r--r--sfx2/source/doc/SfxRedactionHelper.cxx8
-rw-r--r--svl/source/items/rectitem.cxx12
-rw-r--r--svx/source/accessibility/AccessibleShape.cxx4
-rw-r--r--svx/source/svdraw/svdoashp.cxx2
-rw-r--r--svx/source/table/accessiblecell.cxx2
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx22
-rw-r--r--sw/source/core/doc/textboxhelper.cxx21
-rw-r--r--sw/source/core/layout/flycnt.cxx4
-rw-r--r--sw/source/core/text/porfly.cxx6
-rw-r--r--sw/source/core/text/txtdrop.cxx2
-rw-r--r--sw/source/filter/xml/xmlimp.cxx8
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx4
-rw-r--r--tools/qa/cppunit/test_rectangle.cxx4
-rw-r--r--tools/source/generic/gen.cxx2
-rw-r--r--vcl/backendtest/outputdevice/clip.cxx9
-rw-r--r--vcl/backendtest/outputdevice/common.cxx4
-rw-r--r--vcl/backendtest/outputdevice/line.cxx11
-rw-r--r--vcl/headless/CustomWidgetDraw.cxx2
-rw-r--r--vcl/inc/salvtables.hxx2
-rw-r--r--vcl/qa/cppunit/complextext.cxx4
-rw-r--r--vcl/qt5/Qt5Graphics.cxx2
-rw-r--r--vcl/qt5/Qt5SvpGraphics.cxx4
-rw-r--r--vcl/skia/gdiimpl.cxx4
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx7
-rw-r--r--vcl/source/window/menu.cxx3
-rw-r--r--vcl/unx/gtk3/salnativewidgets-gtk.cxx31
-rw-r--r--vcl/workben/vcldemo.cxx2
58 files changed, 183 insertions, 234 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 3335424583a0..aeb49604cc50 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -401,8 +401,7 @@ void EditorWindow::RequestHelp( const HelpEvent& rHEvt )
Point aTopLeft = GetEditView()->GetWindowPos(aHelpRect.TopLeft());
aTopLeft = GetEditView()->GetWindow()->OutputToScreenPixel(aTopLeft);
- aHelpRect.setX(aTopLeft.X());
- aHelpRect.setY(aTopLeft.Y());
+ aHelpRect.SetPos(aTopLeft);
}
}
}
diff --git a/canvas/source/vcl/textlayout.cxx b/canvas/source/vcl/textlayout.cxx
index b3eaee7f8fa9..9beeee0d34d1 100644
--- a/canvas/source/vcl/textlayout.cxx
+++ b/canvas/source/vcl/textlayout.cxx
@@ -183,10 +183,10 @@ namespace vclcanvas
for (auto const& metric : aMetricVector)
{
aBoundingBoxes[nIndex++] = geometry::RealRectangle2D(
- metric.getX(),
- metric.getY(),
- metric.getX() + metric.getWidth(),
- metric.getY() + metric.getHeight());
+ metric.Left(),
+ metric.Top(),
+ metric.Right(),
+ metric.Bottom());
}
}
return aBoundingBoxes;
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;
diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
index 763e53990276..0918fb1979a1 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
@@ -113,7 +113,7 @@ namespace dbaui
{
::osl::MutexGuard aGuard( m_aMutex );
tools::Rectangle aRect(m_pLine ? m_pLine->GetBoundingRect() : tools::Rectangle());
- return awt::Rectangle(aRect.getX(),aRect.getY(),aRect.getWidth(),aRect.getHeight());
+ return awt::Rectangle(aRect.Left(),aRect.Top(),aRect.getWidth(),aRect.getHeight());
}
awt::Point SAL_CALL OConnectionLineAccess::getLocation( )
{
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 7752a2c2d24c..85e09ab13a51 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -1994,12 +1994,12 @@ public:
if (std::string_view("EMPTY") == pPayload)
return;
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aSeq.getLength());
- m_aOwnCursor.setX(aSeq[0].toInt32());
- m_aOwnCursor.setY(aSeq[1].toInt32());
+ m_aOwnCursor.SetLeft(aSeq[0].toInt32());
+ m_aOwnCursor.SetTop(aSeq[1].toInt32());
m_aOwnCursor.setWidth(aSeq[2].toInt32());
m_aOwnCursor.setHeight(aSeq[3].toInt32());
- if (m_aOwnCursor.getX() == 0 && m_aOwnCursor.getY() == 0)
+ if (m_aOwnCursor.Left() == 0 && m_aOwnCursor.Top() == 0)
m_bZeroCursor = true;
}
break;
diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx
index f5fe1fc48f44..f9b319f4e19e 100644
--- a/framework/source/layoutmanager/helpers.cxx
+++ b/framework/source/layoutmanager/helpers.cxx
@@ -127,14 +127,6 @@ SystemWindow* getTopSystemWindow( const uno::Reference< awt::XWindow >& xWindow
return nullptr;
}
-void setZeroRectangle( ::tools::Rectangle& rRect )
-{
- rRect.setX(0);
- rRect.setY(0);
- rRect.setWidth(0);
- rRect.setHeight(0);
-}
-
// ATTENTION!
// This value is directly copied from the sfx2 project.
// You have to change BOTH values, see sfx2/inc/sfx2/sfxsids.hrc (SID_DOCKWIN_START)
diff --git a/framework/source/layoutmanager/helpers.hxx b/framework/source/layoutmanager/helpers.hxx
index df8c75d85a52..ffa1443eaf4e 100644
--- a/framework/source/layoutmanager/helpers.hxx
+++ b/framework/source/layoutmanager/helpers.hxx
@@ -49,7 +49,6 @@ ToolBox* getToolboxPtr( vcl::Window* pWindow );
vcl::Window* getWindowFromXUIElement( const css::uno::Reference< css::ui::XUIElement >& xUIElement );
SystemWindow* getTopSystemWindow( const css::uno::Reference< css::awt::XWindow >& xWindow );
bool equalRectangles( const css::awt::Rectangle& rRect1, const css::awt::Rectangle& rRect2 );
-void setZeroRectangle( ::tools::Rectangle& rRect );
bool lcl_checkUIElement(const css::uno::Reference< css::ui::XUIElement >& xUIElement,css::awt::Rectangle& _rPosSize, css::uno::Reference< css::awt::XWindow >& _xWindow);
css::uno::Reference< css::awt::XWindowPeer > createToolkitWindow( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::awt::XWindowPeer >& rParent, const char* pService );
WindowAlign ImplConvertAlignment( css::ui::DockingArea aAlignment );
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index b46db52906ff..2d76f8eaf378 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -1140,12 +1140,8 @@ bool LayoutManager::implts_hideStatusBar( bool bStoreState )
void LayoutManager::implts_setOffset( const sal_Int32 nBottomOffset )
{
- ::tools::Rectangle aOffsetRect;
- setZeroRectangle( aOffsetRect );
- aOffsetRect.setHeight( nBottomOffset );
-
if ( m_xToolbarManager.is() )
- m_xToolbarManager->setDockingAreaOffsets( aOffsetRect );
+ m_xToolbarManager->setDockingAreaOffsets({ 0, 0, 0, nBottomOffset });
}
void LayoutManager::implts_setInplaceMenuBar( const Reference< XIndexAccess >& xMergedMenuBar )
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index a994cf36f292..f0dc6025649f 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -57,6 +57,8 @@ ToolbarLayoutManager::ToolbarLayoutManager(
m_xContext( rxContext),
m_xUIElementFactoryManager( xUIElementFactory ),
m_pParentLayouter( pParentLayouter ),
+ m_aDockingArea(0, 0, 0, 0),
+ m_aDockingAreaOffsets(0, 0, 0, 0),
m_eDockOperation( DOCKOP_ON_COLROW ),
m_ePreviewDetection( PREVIEWFRAME_UNKNOWN ),
m_bComponentAttached( false ),
@@ -66,9 +68,6 @@ ToolbarLayoutManager::ToolbarLayoutManager(
m_bLayoutInProgress( false ),
m_bToolbarCreation( false )
{
- // initialize rectangles to zero values
- setZeroRectangle( m_aDockingAreaOffsets );
- setZeroRectangle( m_aDockingArea );
}
ToolbarLayoutManager::~ToolbarLayoutManager()
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 3c97728c7402..1cd3928ab67e 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -568,8 +568,6 @@ public:
friend inline tools::Rectangle operator - ( const tools::Rectangle& rRect, const Point& rPt );
// ONE
- tools::Long getX() const { return nLeft; }
- tools::Long getY() const { return nTop; }
/// Returns the difference between right and left, assuming the range includes one end, but not the other.
tools::Long getWidth() const { return Right() - Left(); }
/// Returns the difference between bottom and top, assuming the range includes one end, but not the other.
@@ -723,7 +721,7 @@ inline std::basic_ostream<charT, traits> & operator <<(
return stream << "EMPTY";
else
return stream << rectangle.GetWidth() << 'x' << rectangle.GetHeight()
- << "@(" << rectangle.getX() << ',' << rectangle.getY() << ")";
+ << "@(" << rectangle.Left() << ',' << rectangle.Top() << ")";
}
}
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 54a7f2f6eab1..196f6a8ae125 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -5319,9 +5319,10 @@ void DrawingML::WriteFromTo(const uno::Reference<css::drawing::XShape>& rXShape,
// aTopLeft needs correction for rotated customshapes
if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE)
{
- const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape
- aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth;
- aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight;
+ // Center of bounding box of the rotated shape
+ const auto aSnapRectCenter(pObj->GetSnapRect().Center());
+ aTopLeft.X = aSnapRectCenter.X() - nHalfWidth;
+ aTopLeft.Y = aSnapRectCenter.Y() - nHalfHeight;
}
// MSO changes the anchor positions at these angles and that does an extra 90 degrees
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 9b6bb4f8ed4f..c53cc494b594 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1347,13 +1347,13 @@ ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& xShape
tools::Rectangle aRect( Point( aStartPoint.X, aStartPoint.Y ), Point( aEndPoint.X, aEndPoint.Y ) );
if( aRect.getWidth() < 0 ) {
bFlipH = true;
- aRect.setX( aEndPoint.X );
+ aRect.SetLeft(aEndPoint.X);
aRect.setWidth( aStartPoint.X - aEndPoint.X );
}
if( aRect.getHeight() < 0 ) {
bFlipV = true;
- aRect.setY( aEndPoint.Y );
+ aRect.SetTop(aEndPoint.Y);
aRect.setHeight( aStartPoint.Y - aEndPoint.Y );
}
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 2ca48dbf6091..18a01a051a17 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -260,8 +260,8 @@ static void lcl_convertRectangle(const OUString& rString, Rectangle& rRectangle)
{
uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(rString);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aSeq.getLength());
- rRectangle.setX(aSeq[0].toInt32());
- rRectangle.setY(aSeq[1].toInt32());
+ rRectangle.SetLeft(aSeq[0].toInt32());
+ rRectangle.SetTop(aSeq[1].toInt32());
rRectangle.setWidth(aSeq[2].toInt32());
rRectangle.setHeight(aSeq[3].toInt32());
}
@@ -469,8 +469,8 @@ struct EditCursorMessage final {
aVal = aTree.get_child("relrect").get_value<std::string>();
aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(aVal.c_str()));
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aSeq.getLength());
- m_aRelRect.setX(aSeq[0].toInt32());
- m_aRelRect.setY(aSeq[1].toInt32());
+ m_aRelRect.SetLeft(aSeq[0].toInt32());
+ m_aRelRect.SetTop(aSeq[1].toInt32());
m_aRelRect.setWidth(aSeq[2].toInt32());
m_aRelRect.setHeight(aSeq[3].toInt32());
}
@@ -529,8 +529,8 @@ struct TextSelectionMessage
aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(aRectString.c_str()));
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aSeq.getLength());
tools::Rectangle aRect;
- aRect.setX(aSeq[0].toInt32());
- aRect.setY(aSeq[1].toInt32());
+ aRect.SetLeft(aSeq[0].toInt32());
+ aRect.SetTop(aSeq[1].toInt32());
aRect.setWidth(aSeq[2].toInt32());
aRect.setHeight(aSeq[3].toInt32());
@@ -621,8 +621,8 @@ public:
uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload));
m_aCellCursorBounds = tools::Rectangle();
if (aSeq.getLength() == 6) {
- m_aCellCursorBounds.setX(aSeq[0].toInt32());
- m_aCellCursorBounds.setY(aSeq[1].toInt32());
+ m_aCellCursorBounds.SetLeft(aSeq[0].toInt32());
+ m_aCellCursorBounds.SetTop(aSeq[1].toInt32());
m_aCellCursorBounds.setWidth(aSeq[2].toInt32());
m_aCellCursorBounds.setHeight(aSeq[3].toInt32());
}
@@ -669,8 +669,8 @@ public:
uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload));
CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5);
tools::Rectangle aInvalidationRect;
- aInvalidationRect.setX(aSeq[0].toInt32());
- aInvalidationRect.setY(aSeq[1].toInt32());
+ aInvalidationRect.SetLeft(aSeq[0].toInt32());
+ aInvalidationRect.SetTop(aSeq[1].toInt32());
aInvalidationRect.setWidth(aSeq[2].toInt32());
aInvalidationRect.setHeight(aSeq[3].toInt32());
m_aInvalidations.push_back(aInvalidationRect);
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 58c9b8585ecf..59eddd4690ef 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -868,9 +868,9 @@ void ScDrawLayer::ResizeLastRectFromAnchor(const SdrObject* pObj, ScDrawObjData&
// Prepare scale relative to top-left of aCurrentCellRect
basegfx::B2DHomMatrix aChange;
- aChange.translate(-aCurrentCellRect.getX(), -aCurrentCellRect.getY());
+ aChange.translate(-aCurrentCellRect.Left(), -aCurrentCellRect.Top());
aChange.scale(fWidthFactor, fHeightFactor);
- aChange.translate(aCurrentCellRect.getX(), aCurrentCellRect.getY());
+ aChange.translate(aCurrentCellRect.Left(), aCurrentCellRect.Top());
// create B2DRange and transform by prepared scale
basegfx::B2DRange aNewRange = vcl::unotools::b2DRectangleFromRectangle(aRect);
@@ -1213,7 +1213,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
}
else
{
- Point aPos( rData.getShapeRect().getX(), rData.getShapeRect().getY() );
+ const Point aPos(rData.getShapeRect().TopLeft());
if ( pObj->GetRelativePos() != aPos )
{
if (bRecording)
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 163a7886cdc4..e16c6d9021bf 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1112,9 +1112,10 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >&
sal_Int16 nHalfWidth = aSize.Width / 2;
sal_Int16 nHalfHeight = aSize.Height / 2;
- const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape
- aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth;
- aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight;
+ // Center of bounding box of the rotated shape
+ const auto aSnapRectCenter(pObj->GetSnapRect().Center());
+ aTopLeft.X = aSnapRectCenter.X() - nHalfWidth;
+ aTopLeft.Y = aSnapRectCenter.Y() - nHalfHeight;
// MSO changes the anchor positions at these angles and that does an extra 90 degrees
// rotation on our shapes, so we output it in such position that MSO
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index db44d246a1a6..b1310fbe953c 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -5173,9 +5173,9 @@ void ScXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
tools::Rectangle aRect(pEmbeddedObj->GetVisArea());
sal_uInt16 i(0);
pProps[i].Name = "VisibleAreaTop";
- pProps[i].Value <<= static_cast<sal_Int32>(aRect.getY());
+ pProps[i].Value <<= static_cast<sal_Int32>(aRect.Top());
pProps[++i].Name = "VisibleAreaLeft";
- pProps[i].Value <<= static_cast<sal_Int32>(aRect.getX());
+ pProps[i].Value <<= static_cast<sal_Int32>(aRect.Left());
pProps[++i].Name = "VisibleAreaWidth";
pProps[i].Value <<= static_cast<sal_Int32>(aRect.getWidth());
pProps[++i].Name = "VisibleAreaHeight";
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index dc9582ed3f88..bb99349387fa 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -737,9 +737,7 @@ void ScXMLImport::SetViewSettings(const uno::Sequence<beans::PropertyValue>& aVi
SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject();
if (pEmbeddedObj)
{
- tools::Rectangle aRect;
- aRect.setX( nLeft );
- aRect.setY( nTop );
+ tools::Rectangle aRect{ nLeft, nTop };
aRect.setWidth( nWidth );
aRect.setHeight( nHeight );
pEmbeddedObj->SetVisArea(aRect);
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index bb434037438a..ed7e718cc5f0 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -156,8 +156,7 @@ tools::Rectangle ScAccessibleCell::GetBoundingBoxOnScreen() const
if (pWindow)
{
tools::Rectangle aRect = pWindow->GetWindowExtentsRelative(nullptr);
- aCellRect.setX(aCellRect.getX() + aRect.getX());
- aCellRect.setY(aCellRect.getY() + aRect.getY());
+ aCellRect.Move(aRect.Left(), aRect.Top());
}
}
return aCellRect;
diff --git a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
index 473835441a6e..a95093203541 100644
--- a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
@@ -309,8 +309,7 @@ tools::Rectangle ScAccessiblePageHeader::GetBoundingBoxOnScreen() const
if (pWindow)
{
tools::Rectangle aRect = pWindow->GetWindowExtentsRelative(nullptr);
- aCellRect.setX(aCellRect.getX() + aRect.getX());
- aCellRect.setY(aCellRect.getY() + aRect.getY());
+ aCellRect.Move(aRect.Left(), aRect.Top());
}
}
return aCellRect;
diff --git a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx
index 544775e79a7a..c420bbbfa0cd 100644
--- a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx
@@ -202,8 +202,7 @@ tools::Rectangle ScAccessiblePreviewCell::GetBoundingBoxOnScreen() const
if (pWindow)
{
tools::Rectangle aRect = pWindow->GetWindowExtentsRelative(nullptr);
- aCellRect.setX(aCellRect.getX() + aRect.getX());
- aCellRect.setY(aCellRect.getY() + aRect.getY());
+ aCellRect.Move(aRect.Left(), aRect.Top());
}
}
return aCellRect;
@@ -223,8 +222,7 @@ tools::Rectangle ScAccessiblePreviewCell::GetBoundingBox() const
if (xAccParentComp.is())
{
tools::Rectangle aParentRect (VCLRectangle(xAccParentComp->getBounds()));
- aCellRect.setX(aCellRect.getX() - aParentRect.getX());
- aCellRect.setY(aCellRect.getY() - aParentRect.getY());
+ aCellRect.Move(-aParentRect.Left(), -aParentRect.Top());
}
}
}
diff --git a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx
index 4a3292360808..1bda4744a39b 100644
--- a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx
@@ -303,8 +303,7 @@ tools::Rectangle ScAccessiblePreviewHeaderCell::GetBoundingBoxOnScreen() const
if (pWindow)
{
tools::Rectangle aRect = pWindow->GetWindowExtentsRelative(nullptr);
- aCellRect.setX(aCellRect.getX() + aRect.getX());
- aCellRect.setY(aCellRect.getY() + aRect.getY());
+ aCellRect.Move(aRect.Left(), aRect.Top());
}
}
return aCellRect;
@@ -328,8 +327,7 @@ tools::Rectangle ScAccessiblePreviewHeaderCell::GetBoundingBox() const
if (xAccParentComp.is())
{
tools::Rectangle aParentRect (VCLRectangle(xAccParentComp->getBounds()));
- aCellRect.setX(aCellRect.getX() - aParentRect.getX());
- aCellRect.setY(aCellRect.getY() - aParentRect.getY());
+ aCellRect.Move(-aParentRect.Left(), -aParentRect.Top());
}
}
return aCellRect;
diff --git a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
index d04abdbeb68e..09f6cf59e522 100644
--- a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx
@@ -588,8 +588,7 @@ tools::Rectangle ScAccessiblePreviewTable::GetBoundingBoxOnScreen() const
if (pWindow)
{
tools::Rectangle aRect = pWindow->GetWindowExtentsRelative(nullptr);
- aCellRect.setX(aCellRect.getX() + aRect.getX());
- aCellRect.setY(aCellRect.getY() + aRect.getY());
+ aCellRect.Move(aRect.Left(), aRect.Top());
}
}
return aCellRect;
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 252e2f21a745..1e7b0225e2ad 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -445,8 +445,8 @@ void ScInputWindow::PixelInvalidate(const tools::Rectangle* pRectangle)
if (pRectangle)
{
- const Point aPos(pRectangle->getX() - GetOutOffXPixel(), pRectangle->getY() - GetOutOffYPixel());
- const tools::Rectangle aRect(aPos, pRectangle->GetSize());
+ tools::Rectangle aRect(*pRectangle);
+ aRect.Move(-GetOutOffXPixel(), -GetOutOffYPixel());
Window::PixelInvalidate(&aRect);
}
else
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 405f6c11842b..a320a76f5ae9 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1845,7 +1845,6 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32
const ScRange* pSelRange = nullptr;
if ( bSinglePageSheets )
{
- awt::Size aPageSize;
SCCOL nStartCol;
SCROW nStartRow;
const ScDocument* pDocument = &pDocShell->GetDocument();
@@ -1864,11 +1863,8 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aStart.Tab()));
- aPageSize.Width = aMMRect.GetWidth();
- aPageSize.Height = aMMRect.GetHeight();
-
- awt::Size aCalcPageSize ( aMMRect.GetSize().Width(), aMMRect.GetSize().Height() );
- awt::Point aCalcPagePos( aMMRect.getX(), aMMRect.getY() );
+ const awt::Size aPageSize(aMMRect.GetWidth(), aMMRect.GetHeight());
+ const awt::Point aCalcPagePos(aMMRect.Left(), aMMRect.Top());
uno::Sequence<beans::PropertyValue> aSequence(5);
beans::PropertyValue* pArray = aSequence.getArray();
@@ -1880,7 +1876,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32
pArray[2].Name = SC_UNONAME_SOURCERANGE;
pArray[2].Value <<= aRangeAddress;
pArray[3].Name = SC_UNONAME_CALCPAGESIZE;
- pArray[3].Value <<= aCalcPageSize;
+ pArray[3].Value <<= aPageSize;
pArray[4].Name = SC_UNONAME_CALCPAGEPOS;
pArray[4].Value <<= aCalcPagePos;
@@ -1981,8 +1977,8 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32
aCellRange.aStart.Col(), aCellRange.aStart.Row(),
aCellRange.aEnd.Col(), aCellRange.aEnd.Row(), aCellRange.aStart.Tab()));
- awt::Size aCalcPageSize ( aMMRect.GetSize().Width(), aMMRect.GetSize().Height() );
- awt::Point aCalcPagePos( aMMRect.getX(), aMMRect.getY() );
+ const awt::Size aCalcPageSize(aMMRect.GetWidth(), aMMRect.GetHeight());
+ const awt::Point aCalcPagePos(aMMRect.Left(), aMMRect.Top());
pArray[2].Name = SC_UNONAME_SOURCERANGE;
pArray[2].Value <<= aRangeAddress;
diff --git a/sd/qa/unit/tiledrendering/CallbackRecorder.hxx b/sd/qa/unit/tiledrendering/CallbackRecorder.hxx
index 7e6c8a42d07d..b3cd21fb3643 100644
--- a/sd/qa/unit/tiledrendering/CallbackRecorder.hxx
+++ b/sd/qa/unit/tiledrendering/CallbackRecorder.hxx
@@ -37,8 +37,8 @@ void lcl_convertRectangle(const OUString& rString, tools::Rectangle& rRectangle)
{
uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(rString);
CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5);
- rRectangle.setX(aSeq[0].toInt32());
- rRectangle.setY(aSeq[1].toInt32());
+ rRectangle.SetLeft(aSeq[0].toInt32());
+ rRectangle.SetTop(aSeq[1].toInt32());
rRectangle.setWidth(aSeq[2].toInt32());
rRectangle.setHeight(aSeq[3].toInt32());
}
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 156c52f7b066..1ed951437ba1 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -293,8 +293,8 @@ void lcl_convertRectangle(const OUString& rString, ::tools::Rectangle& rRectangl
{
uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(rString);
CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5);
- rRectangle.setX(aSeq[0].toInt32());
- rRectangle.setY(aSeq[1].toInt32());
+ rRectangle.SetLeft(aSeq[0].toInt32());
+ rRectangle.SetTop(aSeq[1].toInt32());
rRectangle.setWidth(aSeq[2].toInt32());
rRectangle.setHeight(aSeq[3].toInt32());
}
@@ -941,8 +941,8 @@ public:
uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload));
CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5);
tools::Rectangle aInvalidationRect;
- aInvalidationRect.setX(aSeq[0].toInt32());
- aInvalidationRect.setY(aSeq[1].toInt32());
+ aInvalidationRect.SetLeft(aSeq[0].toInt32());
+ aInvalidationRect.SetTop(aSeq[1].toInt32());
aInvalidationRect.setWidth(aSeq[2].toInt32());
aInvalidationRect.setHeight(aSeq[3].toInt32());
m_aInvalidations.push_back(aInvalidationRect);
@@ -1131,8 +1131,8 @@ void SdTiledRenderingTest::testCursorVisibility_SingleClick()
// Click once outside of the text (in the first quartile) => no editing.
const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
- const auto cornerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 4), o3tl::Length::mm100);
- const auto cornerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 4), o3tl::Length::mm100);
+ const auto cornerX = o3tl::toTwips(aRect.Left() + (aRect.getWidth() / 4), o3tl::Length::mm100);
+ const auto cornerY = o3tl::toTwips(aRect.Top() + (aRect.getHeight() / 4), o3tl::Length::mm100);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
cornerX, cornerY,
1, MOUSE_LEFT, 0);
@@ -1146,8 +1146,8 @@ void SdTiledRenderingTest::testCursorVisibility_SingleClick()
CPPUNIT_ASSERT(!aView1.m_bCursorVisible);
// Click again, now on the text, in the center, to start editing.
- const auto centerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 2), o3tl::Length::mm100);
- const auto centerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 2), o3tl::Length::mm100);
+ const auto centerX = o3tl::toTwips(aRect.Left() + (aRect.getWidth() / 2), o3tl::Length::mm100);
+ const auto centerY = o3tl::toTwips(aRect.Top() + (aRect.getHeight() / 2), o3tl::Length::mm100);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
centerX, centerY,
1, MOUSE_LEFT, 0);
@@ -1180,8 +1180,8 @@ void SdTiledRenderingTest::testCursorVisibility_DoubleClick()
// Double-click outside the text to enter edit mode.
const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
- const auto cornerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 4), o3tl::Length::mm100);
- const auto cornerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 4), o3tl::Length::mm100);
+ const auto cornerX = o3tl::toTwips(aRect.Left() + (aRect.getWidth() / 4), o3tl::Length::mm100);
+ const auto cornerY = o3tl::toTwips(aRect.Top() + (aRect.getHeight() / 4), o3tl::Length::mm100);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
cornerX, cornerY,
2, MOUSE_LEFT, 0);
@@ -1224,8 +1224,8 @@ void SdTiledRenderingTest::testCursorVisibility_MultiView()
SfxLokHelper::setView(nView1);
::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
- const auto centerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 2), o3tl::Length::mm100);
- const auto centerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 2), o3tl::Length::mm100);
+ const auto centerX = o3tl::toTwips(aRect.Left() + (aRect.getWidth() / 2), o3tl::Length::mm100);
+ const auto centerY = o3tl::toTwips(aRect.Top() + (aRect.getHeight() / 2), o3tl::Length::mm100);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
centerX, centerY,
2, MOUSE_LEFT, 0);
@@ -1260,8 +1260,8 @@ void SdTiledRenderingTest::testCursorVisibility_Escape()
// Click once on the text to start editing.
const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
- const auto centerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 2), o3tl::Length::mm100);
- const auto centerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 2), o3tl::Length::mm100);
+ const auto centerX = o3tl::toTwips(aRect.Left() + (aRect.getWidth() / 2), o3tl::Length::mm100);
+ const auto centerY = o3tl::toTwips(aRect.Top() + (aRect.getHeight() / 2), o3tl::Length::mm100);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
centerX, centerY,
1, MOUSE_LEFT, 0);
@@ -1441,10 +1441,10 @@ void SdTiledRenderingTest::testTdf102223()
// select contents of cell
::tools::Rectangle aRect = pTableObject->GetCurrentBoundRect();
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
- o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100),
+ o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
- o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100),
+ o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
Scheduler::ProcessEventsToIdle();
pView->SdrBeginTextEdit(pTableObject);
@@ -1484,10 +1484,10 @@ void SdTiledRenderingTest::testTdf118354()
// Without the fix, it would crash here
::tools::Rectangle aRect = pTableObject->GetCurrentBoundRect();
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
- o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100),
+ o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
- o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100),
+ o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
Scheduler::ProcessEventsToIdle();
@@ -1554,10 +1554,10 @@ void SdTiledRenderingTest::testTdf103083()
// select contents of bullet item
::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
- o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100),
+ o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
- o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100),
+ o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
Scheduler::ProcessEventsToIdle();
pView->SdrBeginTextEdit(pTextObject);
@@ -1643,10 +1643,10 @@ void SdTiledRenderingTest::testTdf104405()
rEditView2.SetSelection(ESelection(0, 0, 0, 3)); // start para, start char, end para, end char.
::tools::Rectangle aRect = pTableObject->GetCurrentBoundRect();
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
- o3tl::toTwips(aRect.getX(), o3tl::Length::mm100), o3tl::toTwips(aRect.getY(), o3tl::Length::mm100),
+ o3tl::toTwips(aRect.Left(), o3tl::Length::mm100), o3tl::toTwips(aRect.Top(), o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
- o3tl::toTwips(aRect.getX(), o3tl::Length::mm100), o3tl::toTwips(aRect.getY(), o3tl::Length::mm100),
+ o3tl::toTwips(aRect.Left(), o3tl::Length::mm100), o3tl::toTwips(aRect.Top(), o3tl::Length::mm100),
1, MOUSE_LEFT, 0);
Scheduler::ProcessEventsToIdle();
@@ -2025,8 +2025,8 @@ void SdTiledRenderingTest::testMultiViewInsertDeletePage2()
// Double-click outside the text to enter edit mode.
const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
- const auto cornerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 4), o3tl::Length::mm100);
- const auto cornerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 4), o3tl::Length::mm100);
+ const auto cornerX = o3tl::toTwips(aRect.Left() + (aRect.getWidth() / 4), o3tl::Length::mm100);
+ const auto cornerY = o3tl::toTwips(aRect.Top() + (aRect.getHeight() / 4), o3tl::Length::mm100);
pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
cornerX, cornerY,
2, MOUSE_LEFT, 0);
diff --git a/sd/source/ui/accessibility/AccessiblePageShape.cxx b/sd/source/ui/accessibility/AccessiblePageShape.cxx
index 6390ce18e3b5..2900019aee49 100644
--- a/sd/source/ui/accessibility/AccessiblePageShape.cxx
+++ b/sd/source/ui/accessibility/AccessiblePageShape.cxx
@@ -119,8 +119,8 @@ awt::Rectangle SAL_CALL AccessiblePageShape::getBounds()
::tools::Rectangle aParentBBox (0,0, aParentSize.Width, aParentSize.Height);
aBBox = aBBox.GetIntersection (aParentBBox);
aBoundingBox = awt::Rectangle (
- aBBox.getX(),
- aBBox.getY(),
+ aBBox.Left(),
+ aBBox.Top(),
aBBox.getWidth(),
aBBox.getHeight());
}
diff --git a/sfx2/source/control/emojiviewitem.cxx b/sfx2/source/control/emojiviewitem.cxx
index f9394ea9435c..ff90325dd4bc 100644
--- a/sfx2/source/control/emojiviewitem.cxx
+++ b/sfx2/source/control/emojiviewitem.cxx
@@ -42,11 +42,11 @@ void EmojiViewItem::calculateItemsPosition (const tools::Long /*nThumbnailHeight
css::lang::Locale() );
Size aRectSize = maDrawArea.GetSize();
- Point aPos = maDrawArea.TopLeft();
+ Point aPos = maDrawArea.TopCenter();
// Calculate text position
- aPos.setY( maDrawArea.getY() + (aRectSize.Height() - aTextDev.getTextHeight())/3 );
- aPos.setX( maDrawArea.Left() + (aRectSize.Width() - aTextDev.getTextWidth(maTitle,0,nMaxTextLength))/2 );
+ aPos.Move(-aTextDev.getTextWidth(maTitle, 0, nMaxTextLength) / 2,
+ (aRectSize.Height() - aTextDev.getTextHeight()) / 3);
maTextPos = aPos;
}
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index e5ed6e3cb7f4..80a1da50a01c 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -125,19 +125,14 @@ void ThumbnailViewItem::calculateItemsPosition (const tools::Long nThumbnailHeig
pAttrs->aFontSize.getX(), pAttrs->aFontSize.getY(),
css::lang::Locale() );
- Size aRectSize = maDrawArea.GetSize();
Size aImageSize = maPreview1.GetSizePixel();
// Calculate thumbnail position
- Point aPos = maDrawArea.TopLeft();
- aPos.setX( maDrawArea.getX() + (aRectSize.Width()-aImageSize.Width())/2 );
- aPos.setY( maDrawArea.getY() + nPadding + (nThumbnailHeight-aImageSize.Height())/2 );
- maPrev1Pos = aPos;
+ const Point aPos = maDrawArea.TopCenter();
+ maPrev1Pos = aPos + Point(-aImageSize.Width() / 2, nPadding + (nThumbnailHeight - aImageSize.Height()) / 2);
// Calculate text position
- aPos.setY( maDrawArea.getY() + nThumbnailHeight + nPadding * 2 );
- aPos.setX( maDrawArea.Left() + (aRectSize.Width() - aTextDev.getTextWidth(maTitle,0,nMaxTextLength))/2 );
- maTextPos = aPos;
+ maTextPos = aPos + Point(-aTextDev.getTextWidth(maTitle, 0, nMaxTextLength) / 2, nThumbnailHeight + nPadding * 2);
}
void ThumbnailViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor,
diff --git a/sfx2/source/doc/SfxRedactionHelper.cxx b/sfx2/source/doc/SfxRedactionHelper.cxx
index ca82fc484767..ca2006534207 100644
--- a/sfx2/source/doc/SfxRedactionHelper.cxx
+++ b/sfx2/source/doc/SfxRedactionHelper.cxx
@@ -154,8 +154,7 @@ tools::Rectangle ImplCalcActionBounds(const MetaAction& rAct, const OutputDevice
{
tools::Rectangle aBoundRect1(
const_cast<OutputDevice&>(rOut).ImplGetTextBoundRect(*pSalLayout1));
- aActionBounds.SetLeft(rOut.PixelToLogic(aBoundRect1).getX()
- + rOut.PixelToLogic(aBoundRect1).getWidth());
+ aActionBounds.SetLeft(rOut.PixelToLogic(aBoundRect1).Right());
}
}
}
@@ -456,8 +455,7 @@ void SfxRedactionHelper::searchInMetaFile(const RedactionTarget& rRedactionTarge
// Calculate the difference between current wrong value and value should it be.
// Add the difference to current value.
// Then increase 10% of the new value to make it look better.
- aNewRect.SetTop(aNewRect.getY() + (aNewRect.getHeight() - aLastFontHeight)
- - aLastFontHeight / 10);
+ aNewRect.SetTop(aNewRect.Bottom() - aLastFontHeight - aLastFontHeight / 10);
aRedactionRectangles.push_back(aNewRect);
}
@@ -502,7 +500,7 @@ void SfxRedactionHelper::addRedactionRectToPage(
"LineStyle", css::uno::makeAny(css::drawing::LineStyle::LineStyle_NONE));
xRectShape->setSize(awt::Size(aNewRectangle.GetWidth(), aNewRectangle.GetHeight()));
- xRectShape->setPosition(awt::Point(aNewRectangle.getX(), aNewRectangle.getY()));
+ xRectShape->setPosition(awt::Point(aNewRectangle.Left(), aNewRectangle.Top()));
xPage->add(xRectShape);
}
diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx
index 1d9d00aa5e48..982b235f116a 100644
--- a/svl/source/items/rectitem.cxx
+++ b/svl/source/items/rectitem.cxx
@@ -78,14 +78,14 @@ bool SfxRectangleItem::QueryValue( css::uno::Any& rVal,
{
case 0:
{
- rVal <<= css::awt::Rectangle( aVal.getX(),
- aVal.getY(),
+ rVal <<= css::awt::Rectangle( aVal.Left(),
+ aVal.Top(),
aVal.getWidth(),
aVal.getHeight() );
break;
}
- case MID_RECT_LEFT: rVal <<= aVal.getX(); break;
- case MID_RECT_RIGHT: rVal <<= aVal.getY(); break;
+ case MID_RECT_LEFT: rVal <<= aVal.Left(); break;
+ case MID_RECT_RIGHT: rVal <<= aVal.Top(); break;
case MID_WIDTH: rVal <<= aVal.getWidth(); break;
case MID_HEIGHT: rVal <<= aVal.getHeight(); break;
default: OSL_FAIL("Wrong MemberID!"); return false;
@@ -112,8 +112,8 @@ bool SfxRectangleItem::PutValue( const css::uno::Any& rVal,
switch ( nMemberId )
{
case 0:
- aVal.setX( aValue.X );
- aVal.setY( aValue.Y );
+ aVal.SetLeft( aValue.X );
+ aVal.SetTop( aValue.Y );
aVal.setWidth( aValue.Width );
aVal.setHeight( aValue.Height );
break;
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx
index 28cb6b7b768f..7cad4582b4f6 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -578,8 +578,8 @@ awt::Rectangle SAL_CALL AccessibleShape::getBounds()
::tools::Rectangle aParentBBox (0,0, aParentSize.Width, aParentSize.Height);
aBBox = aBBox.GetIntersection (aParentBBox);
aBoundingBox = awt::Rectangle (
- aBBox.getX(),
- aBBox.getY(),
+ aBBox.Left(),
+ aBBox.Top(),
aBBox.getWidth(),
aBBox.getHeight());
}
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 534851d43df6..158fd473c9ae 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -2947,7 +2947,7 @@ void SdrObjCustomShape::AdjustToMaxRect(const tools::Rectangle& rMaxRect, bool b
aB2DRange = aB2DPolygon.getB2DRange();
const double fPolygonLeft = aB2DRange.getMinX();
const double fPolygonTop = aB2DRange.getMinY();
- aMathMatrix.translate(rMaxRect.getX() - fPolygonLeft, rMaxRect.getY() - fPolygonTop);
+ aMathMatrix.translate(rMaxRect.Left() - fPolygonLeft, rMaxRect.Top() - fPolygonTop);
// Create a Matrix from aMathMatrix, which is usable with TRSetBaseGeometry
aMathMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx
index 53304962303a..71d0bdf59555 100644
--- a/svx/source/table/accessiblecell.cxx
+++ b/svx/source/table/accessiblecell.cxx
@@ -321,7 +321,7 @@ css::awt::Rectangle SAL_CALL AccessibleCell::getBounds()
awt::Size aParentSize (xParentComponent->getSize());
::tools::Rectangle aParentBBox (0,0, aParentSize.Width, aParentSize.Height);
aBBox = aBBox.GetIntersection (aParentBBox);
- aBoundingBox = awt::Rectangle ( aBBox.getX(), aBBox.getY(), aBBox.getWidth(), aBBox.getHeight());
+ aBoundingBox = awt::Rectangle ( aBBox.Left(), aBBox.Top(), aBBox.getWidth(), aBBox.getHeight());
}
else
{
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index ad09174796af..c87f81b08a8a 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -334,8 +334,8 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
if (std::string_view("EMPTY") == pPayload)
return;
CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5);
- aInvalidation.setX(aSeq[0].toInt32());
- aInvalidation.setY(aSeq[1].toInt32());
+ aInvalidation.SetLeft(aSeq[0].toInt32());
+ aInvalidation.SetTop(aSeq[1].toInt32());
aInvalidation.setWidth(aSeq[2].toInt32());
aInvalidation.setHeight(aSeq[3].toInt32());
if (m_aInvalidation.IsEmpty())
@@ -889,11 +889,11 @@ namespace {
if (std::string_view("EMPTY") == pPayload)
return;
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aSeq.getLength());
- m_aOwnCursor.setX(aSeq[0].toInt32());
- m_aOwnCursor.setY(aSeq[1].toInt32());
+ m_aOwnCursor.SetLeft(aSeq[0].toInt32());
+ m_aOwnCursor.SetTop(aSeq[1].toInt32());
m_aOwnCursor.setWidth(aSeq[2].toInt32());
m_aOwnCursor.setHeight(aSeq[3].toInt32());
- if (m_aOwnCursor.getX() == 0 && m_aOwnCursor.getY() == 0)
+ if (m_aOwnCursor.Left() == 0 && m_aOwnCursor.Top() == 0)
m_bOwnCursorAtOrigin = true;
}
break;
@@ -909,8 +909,8 @@ namespace {
if (std::string_view("EMPTY") == pPayload)
return;
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aSeq.getLength());
- m_aViewCursor.setX(aSeq[0].toInt32());
- m_aViewCursor.setY(aSeq[1].toInt32());
+ m_aViewCursor.SetLeft(aSeq[0].toInt32());
+ m_aViewCursor.SetTop(aSeq[1].toInt32());
m_aViewCursor.setWidth(aSeq[2].toInt32());
m_aViewCursor.setHeight(aSeq[3].toInt32());
}
@@ -1700,8 +1700,8 @@ void SwTiledRenderingTest::testCommentEndTextEdit()
// no unexpected cursor callbacks are emitted at origin (top left corner of
// the document).
aView1.m_bOwnCursorAtOrigin = false;
- pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aBodyCursor.getX(), aBodyCursor.getY(), 1, MOUSE_LEFT, 0);
- pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, aBodyCursor.getX(), aBodyCursor.getY(), 1, MOUSE_LEFT, 0);
+ pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aBodyCursor.Left(), aBodyCursor.Top(), 1, MOUSE_LEFT, 0);
+ pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, aBodyCursor.Left(), aBodyCursor.Top(), 1, MOUSE_LEFT, 0);
Scheduler::ProcessEventsToIdle();
// This failed, the cursor was at 0, 0 at some point during end text edit
// of the comment.
@@ -2969,8 +2969,8 @@ void SwTiledRenderingTest::testTablePaintInvalidate()
pDevice->SetBackground(Wallpaper(COL_TRANSPARENT));
pDevice->SetOutputSizePixelScaleOffsetAndBuffer(Size(nCanvasWidth, nCanvasHeight),
Fraction(1.0), Point(), aPixmap.data());
- pXTextDocument->paintTile(*pDevice, nCanvasWidth, nCanvasHeight, m_aInvalidation.getX(),
- m_aInvalidation.getY(), /*nTileWidth=*/1000,
+ pXTextDocument->paintTile(*pDevice, nCanvasWidth, nCanvasHeight, m_aInvalidation.Left(),
+ m_aInvalidation.Top(), /*nTileWidth=*/1000,
/*nTileHeight=*/1000);
Scheduler::ProcessEventsToIdle();
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index f372c21fb16b..e6d60c795f20 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -817,10 +817,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u
sal_Int32 nValue;
if (aValue >>= nValue)
{
- if (bAdjustX)
- nValue += convertTwipToMm100(aRect.getX());
- else if (bAdjustY)
- nValue += convertTwipToMm100(aRect.getY());
+ nValue += convertTwipToMm100(bAdjustX ? aRect.Left() : aRect.Top());
aValue <<= nValue;
}
}
@@ -925,7 +922,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const&
tools::Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false);
if (!aRect.IsEmpty())
- aOrient.SetPos(aOrient.GetPos() + aRect.getY());
+ aOrient.SetPos(aOrient.GetPos() + aRect.Top());
if (rShape.GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE
&& rShape.GetAnchor().GetPageNum() != 0)
@@ -953,7 +950,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const&
tools::Rectangle aRect = getTextRectangle(&rShape, /*bAbsolute=*/false);
if (!aRect.IsEmpty())
- aOrient.SetPos(aOrient.GetPos() + aRect.getX());
+ aOrient.SetPos(aOrient.GetPos() + aRect.Left());
if (rShape.GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE
&& rShape.GetAnchor().GetPageNum() != 0)
@@ -976,8 +973,8 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const&
{
if (!bInlineAnchored)
{
- aVertOrient.SetPos(aVertOrient.GetPos() + aRect.getY());
- aHoriOrient.SetPos(aHoriOrient.GetPos() + aRect.getX());
+ aVertOrient.SetPos(aVertOrient.GetPos() + aRect.Top());
+ aHoriOrient.SetPos(aHoriOrient.GetPos() + aRect.Left());
aTextBoxSet.Put(aVertOrient);
aTextBoxSet.Put(aHoriOrient);
@@ -1198,10 +1195,10 @@ bool SwTextBoxHelper::doTextBoxPositioning(SwFrameFormat* pShape)
tools::Rectangle aRect(getTextRectangle(pShape, false));
SwFormatHoriOrient aNewHOri(pFormat->GetHoriOrient());
- aNewHOri.SetPos(aRect.getX());
+ aNewHOri.SetPos(aRect.Left());
SwFormatVertOrient aNewVOri(pFormat->GetVertOrient());
- aNewVOri.SetPos(aRect.getY() + pShape->GetVertOrient().GetPos());
+ aNewVOri.SetPos(aRect.Top() + pShape->GetVertOrient().GetPos());
// tdf#140598: Do not apply wrong rectangle position.
if (aRect.TopLeft() != Point(0, 0))
@@ -1220,9 +1217,9 @@ bool SwTextBoxHelper::doTextBoxPositioning(SwFrameFormat* pShape)
if (aRect.TopLeft() != Point(0, 0))
{
SwFormatHoriOrient aNewHOri(pShape->GetHoriOrient());
- aNewHOri.SetPos(aNewHOri.GetPos() + aRect.getX());
+ aNewHOri.SetPos(aNewHOri.GetPos() + aRect.Left());
SwFormatVertOrient aNewVOri(pShape->GetVertOrient());
- aNewVOri.SetPos(aNewVOri.GetPos() + aRect.getY());
+ aNewVOri.SetPos(aNewVOri.GetPos() + aRect.Top());
pFormat->SetFormatAttr(aNewHOri);
pFormat->SetFormatAttr(aNewVOri);
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index c49a12cec791..d36da1909e27 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -538,8 +538,8 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* pRenderContext)
SwFormatHoriOrient aHOri = pShapeFormat->GetHoriOrient();
SwFormatVertOrient aVOri = pShapeFormat->GetVertOrient();
// calc the right position of the shape depending on text area
- aHOri.SetPos(aHOri.GetPos() + aTextRectangle.getX());
- aVOri.SetPos(aVOri.GetPos() + aTextRectangle.getY());
+ aHOri.SetPos(aHOri.GetPos() + aTextRectangle.Left());
+ aVOri.SetPos(aVOri.GetPos() + aTextRectangle.Top());
// save the new position for the shape
GetFormat()->SetFormatAttr(aHOri);
GetFormat()->SetFormatAttr(aVOri);
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index b999e3d7c354..aade772d4bb9 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -375,7 +375,7 @@ void SwFlyCntPortion::SetBase( const SwTextFrame& rFrame, const Point &rBase,
// Both rectangles are absolute, SwFormatHori/VertOrient's position
// is relative to the print area of the anchor text frame.
tools::Rectangle aTextRectangle = SwTextBoxHelper::getTextRectangle(pShape);
- tools::Long nXoffs = SwTextBoxHelper::getTextRectangle(pShape, false).getX();
+ tools::Long nXoffs = SwTextBoxHelper::getTextRectangle(pShape, false).Left();
const auto aPos(pShape->GetAnchor().GetContentAnchor());
SwFormatVertOrient aVert(pTextBox->GetVertOrient());
@@ -388,14 +388,14 @@ void SwFlyCntPortion::SetBase( const SwTextFrame& rFrame, const Point &rBase,
{
aVert.SetVertOrient(css::text::VertOrientation::NONE);
aVert.SetRelationOrient(css::text::RelOrientation::FRAME);
- sal_Int32 const nTop = aTextRectangle.getY() - rFrame.getFrameArea().Top()
+ auto const nTop = aTextRectangle.Top() - rFrame.getFrameArea().Top()
- rFrame.getFramePrintArea().Top();
aVert.SetPos(nTop);
}
else
{
aVert.SetVertOrient(css::text::VertOrientation::NONE);
- aVert.SetPos(SwTextBoxHelper::getTextRectangle(pShape, false).getY());
+ aVert.SetPos(SwTextBoxHelper::getTextRectangle(pShape, false).Top());
}
SwFormatAnchor aNewTxBxAnchor(pTextBox->GetAnchor());
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index ce39a3e9e1dc..306f1b3a633b 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -877,7 +877,7 @@ void SwDropCapCache::CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf
if( rFnt.GetTopBorder() )
{
aRect.setHeight(aRect.GetHeight() + rFnt.GetTopBorderSpace());
- aRect.setY(aRect.getY() - rFnt.GetTopBorderSpace());
+ aRect.setY(aRect.Top() - rFnt.GetTopBorderSpace());
}
if( rFnt.GetBottomBorder() )
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 4e03cb1ae623..858f9416c34b 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1183,25 +1183,25 @@ void SwXMLImport::SetViewSettings(const Sequence < PropertyValue > & aViewProps)
if ( rValue.Name == "ViewAreaTop" )
{
rValue.Value >>= nTmp;
- aRect.setY( static_cast< tools::Long >(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp) );
+ aRect.setY(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp);
}
else if ( rValue.Name == "ViewAreaLeft" )
{
rValue.Value >>= nTmp;
- aRect.setX( static_cast< tools::Long >(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp) );
+ aRect.setX(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp);
}
else if ( rValue.Name == "ViewAreaWidth" )
{
rValue.Value >>= nTmp;
Size aSize( aRect.GetSize() );
- aSize.setWidth( static_cast< tools::Long >(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp) );
+ aSize.setWidth(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp);
aRect.SetSize( aSize );
}
else if ( rValue.Name == "ViewAreaHeight" )
{
rValue.Value >>= nTmp;
Size aSize( aRect.GetSize() );
- aSize.setHeight( static_cast< tools::Long >(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp) );
+ aSize.setHeight(bTwip ? sanitiseMm100ToTwip(nTmp) : nTmp);
aRect.SetSize( aSize );
}
else if ( rValue.Name == "ShowRedlineChanges" )
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 070d579d92bb..344add1435c6 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1006,8 +1006,8 @@ css::awt::Rectangle VCLXToolkit::getWorkArea( )
sal_Int32 nDisplay = Application::GetDisplayBuiltInScreen();
tools::Rectangle aWorkRect = Application::GetScreenPosSizePixel( nDisplay );
css::awt::Rectangle aNotherRect;
- aNotherRect.X = aWorkRect.getX();
- aNotherRect.Y = aWorkRect.getY();
+ aNotherRect.X = aWorkRect.Left();
+ aNotherRect.Y = aWorkRect.Top();
aNotherRect.Width = aWorkRect.getWidth();
aNotherRect.Height = aWorkRect.getHeight();
return aNotherRect;
diff --git a/tools/qa/cppunit/test_rectangle.cxx b/tools/qa/cppunit/test_rectangle.cxx
index b0bbf6ae1469..23bfaf61ec7a 100644
--- a/tools/qa/cppunit/test_rectangle.cxx
+++ b/tools/qa/cppunit/test_rectangle.cxx
@@ -47,8 +47,8 @@ void Test::test_rectangle()
CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetWidth());
CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetHeight());
- // Annoyingly getWidth and getHeight returns the wrong size
- // that was explicitly input.
+ // getWidth and getHeight return the size that excludes one of the bounds,
+ // unlike the ctor and GetWidth / GetHeight that operate on inclusive size
CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.getWidth());
CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.getHeight());
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 5196ef0bd96e..abd32a208d70 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -193,7 +193,7 @@ OString tools::Rectangle::toString() const
// Note that this is not just used for debugging output but the
// format is parsed by external code (passed in callbacks to
// LibreOfficeKit clients). So don't change.
- return OString::number(getX()) + ", " + OString::number(getY()) + ", " + OString::number(getWidth()) + ", " + OString::number(getHeight());
+ return OString::number(Left()) + ", " + OString::number(Top()) + ", " + OString::number(getWidth()) + ", " + OString::number(getHeight());
}
void tools::Rectangle::expand(tools::Long nExpandBy)
diff --git a/vcl/backendtest/outputdevice/clip.cxx b/vcl/backendtest/outputdevice/clip.cxx
index 86064b583610..495b43b6f11f 100644
--- a/vcl/backendtest/outputdevice/clip.cxx
+++ b/vcl/backendtest/outputdevice/clip.cxx
@@ -58,11 +58,10 @@ Bitmap OutputDeviceTestClip::setupClipB2DPolyPolygon()
tools::Rectangle rectangle = maVDRectangle;
rectangle.shrink(2);
mpVirtualDevice->SetClipRegion(vcl::Region(basegfx::B2DPolyPolygon(basegfx::B2DPolygon{
- basegfx::B2DPoint(rectangle.getX(), rectangle.getY()),
- basegfx::B2DPoint(rectangle.getX(), rectangle.getY() + rectangle.getHeight()),
- basegfx::B2DPoint(rectangle.getX() + rectangle.getWidth(),
- rectangle.getY() + rectangle.getHeight()),
- basegfx::B2DPoint(rectangle.getX() + rectangle.getWidth(), rectangle.getY()),
+ basegfx::B2DPoint(rectangle.Left(), rectangle.Top()),
+ basegfx::B2DPoint(rectangle.Left(), rectangle.Bottom()),
+ basegfx::B2DPoint(rectangle.Right(), rectangle.Bottom()),
+ basegfx::B2DPoint(rectangle.Right(), rectangle.Top()),
})));
mpVirtualDevice->SetBackground(constFillColor);
mpVirtualDevice->Erase(maVDRectangle);
diff --git a/vcl/backendtest/outputdevice/common.cxx b/vcl/backendtest/outputdevice/common.cxx
index 8286488fccf2..065919f5b1c5 100644
--- a/vcl/backendtest/outputdevice/common.cxx
+++ b/vcl/backendtest/outputdevice/common.cxx
@@ -135,8 +135,8 @@ std::map<Color, int> collectColors(Bitmap& bitmap, const tools::Rectangle& recta
{
std::map<Color, int> colors;
BitmapScopedWriteAccess pAccess(bitmap);
- for( tools::Long y = rectangle.getY(); y < rectangle.GetHeight(); ++y)
- for( tools::Long x = rectangle.getX(); x < rectangle.GetWidth(); ++x)
+ for (tools::Long y = rectangle.Top(); y < rectangle.Bottom(); ++y)
+ for (tools::Long x = rectangle.Left(); x < rectangle.Right(); ++x)
++colors[pAccess->GetPixel(y, x)]; // operator[] initializes to 0 (default ctor) if creating
return colors;
}
diff --git a/vcl/backendtest/outputdevice/line.cxx b/vcl/backendtest/outputdevice/line.cxx
index ad5995124a71..be9deadf9c33 100644
--- a/vcl/backendtest/outputdevice/line.cxx
+++ b/vcl/backendtest/outputdevice/line.cxx
@@ -126,12 +126,11 @@ Bitmap OutputDeviceTestLine::setupDashedLine()
std::vector<double> stroke({ 2.0, 1.0 });
mpVirtualDevice->DrawPolyLineDirect( basegfx::B2DHomMatrix(),
basegfx::B2DPolygon{
- basegfx::B2DPoint(rectangle.getX(), rectangle.getY()),
- basegfx::B2DPoint(rectangle.getX(), rectangle.getY() + rectangle.getHeight()),
- basegfx::B2DPoint(rectangle.getX() + rectangle.getWidth(),
- rectangle.getY() + rectangle.getHeight()),
- basegfx::B2DPoint(rectangle.getX() + rectangle.getWidth(), rectangle.getY()),
- basegfx::B2DPoint(rectangle.getX(), rectangle.getY())},
+ basegfx::B2DPoint(rectangle.Left(), rectangle.Top()),
+ basegfx::B2DPoint(rectangle.Left(), rectangle.Bottom()),
+ basegfx::B2DPoint(rectangle.Right(), rectangle.Bottom()),
+ basegfx::B2DPoint(rectangle.Right(), rectangle.Top()),
+ basegfx::B2DPoint(rectangle.Left(), rectangle.Top())},
1, 0, &stroke, basegfx::B2DLineJoin::NONE );
return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
diff --git a/vcl/headless/CustomWidgetDraw.cxx b/vcl/headless/CustomWidgetDraw.cxx
index b9341e648700..24a6218a7e9d 100644
--- a/vcl/headless/CustomWidgetDraw.cxx
+++ b/vcl/headless/CustomWidgetDraw.cxx
@@ -307,7 +307,7 @@ bool CustomWidgetDraw::getNativeControlRegion(
{
// Translate to POD rectangle and back.
const rectangle_t aRegion
- = { rBoundingControlRegion.getX(), rBoundingControlRegion.getY(),
+ = { rBoundingControlRegion.Left(), rBoundingControlRegion.Top(),
rBoundingControlRegion.GetWidth(), rBoundingControlRegion.GetHeight() };
if (s_pWidgetImplementation)
{
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 1cca6afd071b..8c3e1a8aee5b 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -821,7 +821,7 @@ public:
m_xMenuButton->SetParent(pEventWindow);
int nButtonWidth = get_menu_button_width();
m_xMenuButton->SetSizePixel(Size(nButtonWidth, rRect.GetHeight()));
- m_xMenuButton->SetPosPixel(Point(rRect.GetWidth() - nButtonWidth, rRect.getY()));
+ m_xMenuButton->SetPosPixel(Point(rRect.GetWidth() - nButtonWidth, rRect.Top()));
}
}
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index 13eb76cb1adb..176fc1ea9df6 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -88,8 +88,8 @@ void VclComplexTextTest::testArabic()
// exact bounding rectangle, not essentially the same as text width/height
tools::Rectangle aBoundRect;
pOutDev->GetTextBoundRect(aBoundRect, aOneTwoThree);
- CPPUNIT_ASSERT_DOUBLES_EQUAL(0, aBoundRect.getX(), 1); // This sometimes equals to 1
- CPPUNIT_ASSERT_DOUBLES_EQUAL(1, aBoundRect.getY(), 1);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(0, aBoundRect.Left(), 1); // This sometimes equals to 1
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(1, aBoundRect.Top(), 1);
CPPUNIT_ASSERT_DOUBLES_EQUAL(71, aBoundRect.getWidth(), 1); // This sometimes equals to 70
CPPUNIT_ASSERT_DOUBLES_EQUAL(15, aBoundRect.getHeight(), 1);
diff --git a/vcl/qt5/Qt5Graphics.cxx b/vcl/qt5/Qt5Graphics.cxx
index c89747f98869..5fb512b98447 100644
--- a/vcl/qt5/Qt5Graphics.cxx
+++ b/vcl/qt5/Qt5Graphics.cxx
@@ -99,7 +99,7 @@ void Qt5Graphics::handleDamage(const tools::Rectangle& rDamagedRegion)
QImage blit(*pImage);
blit.setDevicePixelRatio(1);
Qt5Painter aPainter(*m_pBackend);
- aPainter.drawImage(QPoint(rDamagedRegion.getX(), rDamagedRegion.getY()), blit);
+ aPainter.drawImage(QPoint(rDamagedRegion.Left(), rDamagedRegion.Top()), blit);
aPainter.update(toQRect(rDamagedRegion));
}
diff --git a/vcl/qt5/Qt5SvpGraphics.cxx b/vcl/qt5/Qt5SvpGraphics.cxx
index 8885b9cb533c..9dc9b7e2a5ad 100644
--- a/vcl/qt5/Qt5SvpGraphics.cxx
+++ b/vcl/qt5/Qt5SvpGraphics.cxx
@@ -88,8 +88,8 @@ void Qt5SvpGraphics::handleDamage(const tools::Rectangle& rDamagedRegion)
BitmapBuffer aBuffer;
QImage2BitmapBuffer(*pImage, aBuffer);
- SalTwoRect aTR(0, 0, pImage->width(), pImage->height(), rDamagedRegion.getX(),
- rDamagedRegion.getY(), rDamagedRegion.GetWidth(), rDamagedRegion.GetHeight());
+ SalTwoRect aTR(0, 0, pImage->width(), pImage->height(), rDamagedRegion.Left(),
+ rDamagedRegion.Top(), rDamagedRegion.GetWidth(), rDamagedRegion.GetHeight());
drawBitmap(aTR, &aBuffer, CAIRO_OPERATOR_OVER);
}
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index fbc77b4112ae..858bdfe6895a 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -556,7 +556,7 @@ void SkiaSalGraphicsImpl::setCanvasClipRegion(SkCanvas* canvas, const vcl::Regio
RectangleVector rectangles;
region.GetRegionRectangles(rectangles);
for (const tools::Rectangle& rectangle : rectangles)
- path.addRect(SkRect::MakeXYWH(rectangle.getX(), rectangle.getY(), rectangle.GetWidth(),
+ path.addRect(SkRect::MakeXYWH(rectangle.Left(), rectangle.Top(), rectangle.GetWidth(),
rectangle.GetHeight()));
path.setFillType(SkPathFillType::kEvenOdd);
canvas->clipPath(path);
@@ -1960,7 +1960,7 @@ bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPolygon,
if (rPolyPolygon.IsRect())
{
// Rect->Polygon conversion loses the right and bottom edge, fix that.
- path.addRect(SkRect::MakeXYWH(boundRect.getX(), boundRect.getY(), boundRect.GetWidth(),
+ path.addRect(SkRect::MakeXYWH(boundRect.Left(), boundRect.Top(), boundRect.GetWidth(),
boundRect.GetHeight()));
boundRect.AdjustRight(1);
boundRect.AdjustBottom(1);
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 04af468aa0d6..9dfdd3e08acb 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6212,11 +6212,10 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
// The rectangle is the bounding box of the text, but also includes
// ascent / descent to match the on-screen rendering.
- tools::Rectangle aRectangle;
// This is the top left of the text without ascent / descent.
- aRectangle.SetPos(PixelToLogic(rLayout.GetDrawPosition()));
- aRectangle.setY(aRectangle.getY() - aRefDevFontMetric.GetAscent());
- aRectangle.SetSize(PixelToLogic(Size(rLayout.GetTextWidth(), 0)));
+ tools::Rectangle aRectangle(PixelToLogic(rLayout.GetDrawPosition()),
+ Size(ImplDevicePixelToLogicWidth(rLayout.GetTextWidth()), 0));
+ aRectangle.AdjustTop(-aRefDevFontMetric.GetAscent());
// This includes ascent / descent.
aRectangle.setHeight(aRefDevFontMetric.GetLineHeight());
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 5acb1c795432..a37175b93248 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1716,9 +1716,8 @@ void Menu::ImplPaintMenuTitle(vcl::RenderContext& rRenderContext, const tools::R
// Draw background rectangle
tools::Rectangle aBgRect(rRect);
int nOuterSpaceX = ImplGetSVData()->maNWFData.mnMenuFormatBorderX;
- aBgRect.setX(aBgRect.getX() + SPACE_AROUND_TITLE);
+ aBgRect.Move(SPACE_AROUND_TITLE, SPACE_AROUND_TITLE);
aBgRect.setWidth(aBgRect.getWidth() - 2 * SPACE_AROUND_TITLE - 2 * nOuterSpaceX);
- aBgRect.setY(aBgRect.getY() + SPACE_AROUND_TITLE);
aBgRect.setHeight(nTitleHeight - 2 * SPACE_AROUND_TITLE);
rRenderContext.DrawRect(aBgRect);
diff --git a/vcl/unx/gtk3/salnativewidgets-gtk.cxx b/vcl/unx/gtk3/salnativewidgets-gtk.cxx
index 637ddb031fec..ee9674ae288d 100644
--- a/vcl/unx/gtk3/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/salnativewidgets-gtk.cxx
@@ -215,13 +215,8 @@ tools::Rectangle GtkSalGraphics::NWGetSpinButtonRect( ControlPart nPart, tools::
gint buttonWidth = icon_size + padding.left + padding.right +
border.left + border.right;
- gint buttonHeight = icon_size + padding.top + padding.bottom +
- border.top + border.bottom;
-
- tools::Rectangle buttonRect;
- buttonRect.SetSize(Size(buttonWidth, buttonHeight));
- buttonRect.setY(aAreaRect.Top());
- buttonRect.SetBottom( buttonRect.Top() + aAreaRect.GetHeight() );
+ tools::Rectangle buttonRect(Point(0, aAreaRect.Top()), Size(buttonWidth, 0));
+ buttonRect.setHeight(aAreaRect.GetHeight());
tools::Rectangle partRect(buttonRect);
if ( nPart == ControlPart::ButtonUp )
{
@@ -327,26 +322,26 @@ tools::Rectangle GtkSalGraphics::NWGetScrollButtonRect( ControlPart nPart, tools
if (nPart == ControlPart::ButtonUp)
{
aSize.setHeight( aSize.Height() * nFirst );
- buttonRect.setX(aAreaRect.Left());
- buttonRect.setY(aAreaRect.Top());
+ buttonRect.SetLeft(aAreaRect.Left());
+ buttonRect.SetTop(aAreaRect.Top());
}
else if (nPart == ControlPart::ButtonLeft)
{
aSize.setWidth( aSize.Width() * nFirst );
- buttonRect.setX(aAreaRect.Left());
- buttonRect.setY(aAreaRect.Top());
+ buttonRect.SetLeft(aAreaRect.Left());
+ buttonRect.SetTop(aAreaRect.Top());
}
else if (nPart == ControlPart::ButtonDown)
{
aSize.setHeight( aSize.Height() * nSecond );
- buttonRect.setX(aAreaRect.Left());
- buttonRect.setY(aAreaRect.Top() + aAreaRect.GetHeight() - aSize.Height());
+ buttonRect.SetLeft(aAreaRect.Left());
+ buttonRect.SetTop(aAreaRect.Top() + aAreaRect.GetHeight() - aSize.Height());
}
else if (nPart == ControlPart::ButtonRight)
{
aSize.setWidth( aSize.Width() * nSecond );
- buttonRect.setX(aAreaRect.Left() + aAreaRect.GetWidth() - aSize.Width());
- buttonRect.setY(aAreaRect.Top());
+ buttonRect.SetLeft(aAreaRect.Left() + aAreaRect.GetWidth() - aSize.Width());
+ buttonRect.SetTop(aAreaRect.Top());
}
buttonRect.SetSize(aSize);
@@ -810,10 +805,8 @@ void GtkSalGraphics::PaintOneSpinButton( GtkStyleContext *context,
iconWidth = gdk_pixbuf_get_width(pixbuf)/scale;
iconHeight = gdk_pixbuf_get_height(pixbuf)/scale;
- tools::Rectangle arrowRect;
- arrowRect.SetSize(Size(iconWidth, iconHeight));
- arrowRect.setX( buttonRect.Left() + (buttonRect.GetWidth() - arrowRect.GetWidth()) / 2 );
- arrowRect.setY( buttonRect.Top() + (buttonRect.GetHeight() - arrowRect.GetHeight()) / 2 );
+ tools::Rectangle arrowRect(buttonRect.Center() - Point(iconWidth / 2, iconHeight / 2),
+ Size(iconWidth, iconHeight));
gtk_style_context_save (context);
gtk_style_context_set_scale (context, 1);
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 65896b1f5efc..b909910099c1 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -1782,7 +1782,7 @@ public:
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override
{
mrRenderer.SetSizePixel(GetSizePixel());
- fprintf(stderr, "DemoWin::Paint(%" SAL_PRIdINT64 ",%" SAL_PRIdINT64 ",%" SAL_PRIdINT64 ",%" SAL_PRIdINT64 ")\n", sal_Int64(rRect.getX()), sal_Int64(rRect.getY()), sal_Int64(rRect.getWidth()), sal_Int64(rRect.getHeight()));
+ fprintf(stderr, "DemoWin::Paint(%" SAL_PRIdINT64 ",%" SAL_PRIdINT64 ",%" SAL_PRIdINT64 ",%" SAL_PRIdINT64 ")\n", sal_Int64(rRect.Left()), sal_Int64(rRect.Top()), sal_Int64(rRect.getWidth()), sal_Int64(rRect.getHeight()));
if (mrRenderer.getIterCount() == 0)
mrRenderer.drawToDevice(rRenderContext, GetSizePixel(), false);
else