include/tools/gen.hxx        |    2 +-
 tools/source/generic/gen.cxx |    5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 3932c8184a8c93a17c0c7429d5dd9597b087e076
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jul 12 20:16:40 2019 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jul 15 09:33:15 2019 +0200

    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.gran...@collabora.co.uk>

diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 63d13e146336..9dea74be4caa 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -455,7 +455,7 @@ public:
     long                getX() const { return nLeft; }
     long                getY() const { return nTop; }
     /// Returns the difference between right and left, assuming the range 
includes one end, but not the other.
-    long                getWidth() const { return nRight - nLeft; }
+    long                getWidth() const;
     /// Returns the difference between bottom and top, assuming the range 
includes one end, but not the other.
     long                getHeight() const { return nBottom - nTop; }
     /// Set the left edge of the rectangle to x, preserving the width
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: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to