summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-12 20:16:40 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-15 09:33:15 +0200
commit3932c8184a8c93a17c0c7429d5dd9597b087e076 (patch)
treeffcfb7ae123a9bc385573fa39fca6776e38e9bc4 /tools
parentee13cd374f9c4957ddc2fd502e278689a6587ab5 (diff)
make tools::Rectangle::getWidth return 0 when empty
Change-Id: I5c7565309d380cdbe60a078d2c97f7dd1fae4274 Reviewed-on: https://gerrit.libreoffice.org/75517 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/generic/gen.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 3783fa347c55..5755929bd502 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -303,4 +303,9 @@ long tools::Rectangle::Bottom() const
return nBottom == RECT_EMPTY ? nTop : nBottom;
}
+/// Returns the difference between right and left, assuming the range includes one end, but not the other.
+long tools::Rectangle::getWidth() const
+{
+ return nRight == RECT_EMPTY ? 0 : nRight - nLeft;
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */