summaryrefslogtreecommitdiff
path: root/desktop/inc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-12-10 18:15:17 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-12-14 14:47:23 +0100
commit18470cb6bff9f682b3b86495d80e9ad54c9b5567 (patch)
tree7fffa6aa0597dba876f9f8debf505ab8cfe64ac0 /desktop/inc
parent70e6d969dcbece69bc9bd5e3a0bc5d878a33ca6a (diff)
fix handling of the "EMPTY" LOK tile invalidation
The LOK_CALLBACK_INVALIDATE_TILES documentation says that invalidate-all message should say "EMPTY", which wasn't converted properly from the MaxTwips rectangle representation. Doing that now needs also changing the testTileInvalidationCompression() test, but that should be a fix of the test, and conceptually it should be the same. Change-Id: I58fcc56ee56d9f6fcdb9298938e8aa7e3609d6db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126651 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'desktop/inc')
-rw-r--r--desktop/inc/lib/init.hxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index 5ebda0a245d6..1ba7e54ff976 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -42,13 +42,18 @@ namespace desktop {
tools::Rectangle m_aRectangle;
int m_nPart;
+ // This is the "EMPTY" rectangle, which somewhat confusingly actually means
+ // to drop all rectangles (see LOK_CALLBACK_INVALIDATE_TILES documentation),
+ // and so it is actually an infinite rectangle and not an empty one.
+ constexpr static tools::Rectangle emptyAllRectangle = {0, 0, SfxLokHelper::MaxTwips, SfxLokHelper::MaxTwips};
+
RectangleAndPart()
: m_nPart(INT_MIN) // -1 is reserved to mean "all parts".
{
}
RectangleAndPart(const tools::Rectangle* pRect, int nPart)
- : m_aRectangle( pRect ? *pRect : tools::Rectangle(0, 0, SfxLokHelper::MaxTwips, SfxLokHelper::MaxTwips))
+ : m_aRectangle( pRect ? *pRect : emptyAllRectangle)
, m_nPart(nPart)
{
}
@@ -56,9 +61,10 @@ namespace desktop {
OString toString() const
{
if (m_nPart >= -1)
- return m_aRectangle.toString() + ", " + OString::number(m_nPart);
+ return (isInfinite() ? "EMPTY" : m_aRectangle.toString())
+ + ", " + OString::number(m_nPart);
else
- return m_aRectangle.toString();
+ return (isInfinite() ? "EMPTY" : m_aRectangle.toString());
}
/// Infinite Rectangle is both sides are