diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2019-02-13 13:51:14 -0500 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2019-02-22 15:26:21 +0100 |
commit | b1a3db96dea8d0c2ec57ed843703f7b93b9dd4fe (patch) | |
tree | a49bbc76284e104cdfd97ee19e1e3b58aa9c8359 /desktop/inc | |
parent | 18b5a001cc5b306e1548fb70e610bdc1164cf4ca (diff) |
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 <ashnakash@gmail.com>
Diffstat (limited to 'desktop/inc')
-rw-r--r-- | desktop/inc/lib/init.hxx | 39 |
1 files changed, 39 insertions, 0 deletions
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 <LibreOfficeKit/LibreOfficeKitEnums.h> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/lang/XComponent.hpp> +#include <tools/gen.hxx> +#include <sfx2/lokhelper.hxx> #include <desktop/dllapi.h> @@ -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: |