From b1a3db96dea8d0c2ec57ed843703f7b93b9dd4fe Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Wed, 13 Feb 2019 13:51:14 -0500 Subject: LOK: Move RectangleAndPart to the header This is in preparation to cache them. Change-Id: Ic511caf5a8798750288e9271f6898ab38fe2055f Reviewed-on: https://gerrit.libreoffice.org/67889 Tested-by: Jenkins Reviewed-by: Ashod Nakashian --- desktop/inc/lib/init.hxx | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'desktop/inc') diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx index cb8afa899b76..d5adb7ac411c 100644 --- a/desktop/inc/lib/init.hxx +++ b/desktop/inc/lib/init.hxx @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include @@ -29,6 +31,43 @@ class LOKInteractionHandler; namespace desktop { + /// Represents an invalidated rectangle inside a given document part. + struct RectangleAndPart + { + tools::Rectangle m_aRectangle; + int m_nPart; + + RectangleAndPart() + : m_nPart(INT_MIN) // -1 is reserved to mean "all parts". + { + } + + OString toString() const + { + std::stringstream ss; + ss << m_aRectangle.toString(); + if (m_nPart >= -1) + ss << ", " << m_nPart; + return ss.str().c_str(); + } + + /// Infinite Rectangle is both sides are + /// equal or longer than SfxLokHelper::MaxTwips. + bool isInfinite() const + { + return m_aRectangle.GetWidth() >= SfxLokHelper::MaxTwips && + m_aRectangle.GetHeight() >= SfxLokHelper::MaxTwips; + } + + /// Empty Rectangle is when it has zero dimensions. + bool isEmpty() const + { + return m_aRectangle.IsEmpty(); + } + + static RectangleAndPart Create(const std::string& rPayload); + }; + class DESKTOP_DLLPUBLIC CallbackFlushHandler : public Idle { public: -- cgit