summaryrefslogtreecommitdiff
path: root/include/tools
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2022-06-02 22:35:15 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2022-06-04 19:30:10 +0200
commit434d471e9b8e54626af332974268ffd8fce4a78e (patch)
tree67c9acf28cf98699d09a1cb0e7a83375a3eca32f /include/tools
parenta717b1a8b625e4f0d520f16c546252ffb0679c98 (diff)
Rectangle: move inline definition into functions
... and add GetPos() as TopLeft() alias. Change-Id: Ia2c169d40ed121e829802835011648281f48f585 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135424 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'include/tools')
-rw-r--r--include/tools/gen.hxx68
1 files changed, 36 insertions, 32 deletions
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 6d4548065495..20da07cb99af 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -495,7 +495,7 @@ public:
constexpr Rectangle( tools::Long nLeft, tools::Long nTop );
constexpr Rectangle( const Point& rLT, const Size& rSize );
- inline constexpr static Rectangle Justify(const Point& rLT, const Point& rRB);
+ constexpr inline static Rectangle Justify(const Point& rLT, const Point& rRB);
constexpr tools::Long Left() const { return nLeft; }
constexpr tools::Long Right() const { return IsWidthEmpty() ? nLeft : nRight; }
@@ -531,41 +531,13 @@ public:
inline void SetPos( const Point& rPoint );
void SetSize( const Size& rSize );
+ constexpr Point GetPos() const { return TopLeft(); }
constexpr Size GetSize() const { return { GetWidth(), GetHeight() }; }
/// Returns the difference between right and left, assuming the range is inclusive.
- constexpr tools::Long GetWidth() const
- {
- tools::Long n = 0;
-
- if (!IsWidthEmpty())
- {
- n = nRight - nLeft;
- if (n < 0)
- n--;
- else
- n++;
- }
-
- return n;
- }
-
+ constexpr inline tools::Long GetWidth() const;
/// Returns the difference between bottom and top, assuming the range is inclusive.
- constexpr tools::Long GetHeight() const
- {
- tools::Long n = 0;
-
- if (!IsHeightEmpty())
- {
- n = nBottom - nTop;
- if (n < 0)
- n--;
- else
- n++;
- }
-
- return n;
- }
+ constexpr inline tools::Long GetHeight() const;
tools::Rectangle& Union( const tools::Rectangle& rRect );
tools::Rectangle& Intersection( const tools::Rectangle& rRect );
@@ -691,6 +663,38 @@ inline void tools::Rectangle::SetPos( const Point& rPoint )
SetPosY(rPoint.Y());
}
+constexpr inline tools::Long tools::Rectangle::GetWidth() const
+{
+ tools::Long n = 0;
+
+ if (!IsWidthEmpty())
+ {
+ n = nRight - nLeft;
+ if (n < 0)
+ n--;
+ else
+ n++;
+ }
+
+ return n;
+}
+
+constexpr inline tools::Long tools::Rectangle::GetHeight() const
+{
+ tools::Long n = 0;
+
+ if (!IsHeightEmpty())
+ {
+ n = nBottom - nTop;
+ if (n < 0)
+ n--;
+ else
+ n++;
+ }
+
+ return n;
+}
+
inline tools::Rectangle tools::Rectangle::GetUnion( const tools::Rectangle& rRect ) const
{
tools::Rectangle aTmpRect( *this );