summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-08-26 11:08:20 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-08-26 17:24:26 +0200
commit55accad663d13dff73a0aa57c08ebd0297a8c0fb (patch)
tree3c00ea313a1dfb61b36d54efa94658c4648419e6
parentde399fdf22206f9402a0322ce4851be9cc5e901c (diff)
add back getX()/getY() to tools::Rectangle
581b2cf7960c48e cleaned up some usage of the class and removed getX()/getY(). But that means that the (probably most) common case of treating rectangles as x,y,w,h now doesn't work, and one has to use either left,top,right,bottom (which doesn't always mentally fit), or the IMO weird left,top,width,height. Change-Id: Ie9516f69af48490635346c76821be9a9eedd686c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121079 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
-rw-r--r--include/tools/gen.hxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 63d03b9f788e..f255168b3709 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -571,7 +571,8 @@ public:
friend inline tools::Rectangle operator + ( const tools::Rectangle& rRect, const Point& rPt );
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.
@@ -745,7 +746,7 @@ inline std::basic_ostream<charT, traits> & operator <<(
return stream << "EMPTY";
else
return stream << rectangle.GetWidth() << 'x' << rectangle.GetHeight()
- << "@(" << rectangle.Left() << ',' << rectangle.Top() << ")";
+ << "@(" << rectangle.getX() << ',' << rectangle.getY() << ")";
}
}