diff options
-rw-r--r-- | include/tools/gen.hxx | 2 | ||||
-rw-r--r-- | tools/source/generic/gen.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/mtfxmldump.cxx | 5 |
3 files changed, 10 insertions, 3 deletions
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index 54a438bfa161..dd0514396567 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -386,7 +386,7 @@ public: Rectangle( const Point& rLT, const Size& rSize ); long Left() const { return nLeft; } - long Right() const { return nRight; } + long Right() const; long Top() const { return nTop; } long Bottom() const { return nBottom; } diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index fc927f50e41e..459687dc961a 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <algorithm> +#include <cassert> #include <sstream> #include <o3tl/safeint.hxx> #include <tools/gen.hxx> @@ -291,4 +292,9 @@ void tools::Rectangle::setY( long y ) nTop = y; } +long tools::Rectangle::Right() const +{ + return nRight == RECT_EMPTY ? nLeft : nRight; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx index 8c168a89d4c4..c679b08e86e6 100644 --- a/vcl/source/gdi/mtfxmldump.cxx +++ b/vcl/source/gdi/mtfxmldump.cxx @@ -459,8 +459,9 @@ void writeRectangle(tools::XmlWriter& rWriter, tools::Rectangle const& rRectangl { rWriter.attribute("left", rRectangle.Left()); rWriter.attribute("top", rRectangle.Top()); - rWriter.attribute("right", rRectangle.Right()); - rWriter.attribute("bottom", rRectangle.Bottom()); + // FIXME what should we write for empty? + rWriter.attribute("right", rRectangle.IsWidthEmpty() ? -32767 : rRectangle.Right()); + rWriter.attribute("bottom", rRectangle.IsHeightEmpty() ? -32767 : rRectangle.Bottom()); } void writeLineInfo(tools::XmlWriter& rWriter, LineInfo const& rLineInfo) |