summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2022-08-29 09:07:33 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2022-11-10 10:15:46 +0100
commit3f4e11bd40f60510272df7a285d8a78181af0ccb (patch)
treed3f2ad594143dad546a12d6b5d4e18a360157115 /desktop
parent652df8c733f381cac4e22286acd12a2ec72d41ae (diff)
lok: masterpage: use EditMode as parameter in invalidation callback
Change-Id: I3905fc9e6376ca1cef3e438e7a5f229d3720b1f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138961 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Henry Castro <hcastro@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142501 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/inc/lib/init.hxx16
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx96
-rw-r--r--desktop/source/lib/init.cxx51
3 files changed, 100 insertions, 63 deletions
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index 6abf4bebd852..cd6636ac2242 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -43,6 +43,7 @@ namespace desktop {
{
tools::Rectangle m_aRectangle;
int m_nPart;
+ int m_nMode;
// This is the "EMPTY" rectangle, which somewhat confusingly actually means
// to drop all rectangles (see LOK_CALLBACK_INVALIDATE_TILES documentation),
@@ -51,12 +52,14 @@ namespace desktop {
RectangleAndPart()
: m_nPart(INT_MIN) // -1 is reserved to mean "all parts".
+ , m_nMode(0)
{
}
- RectangleAndPart(const tools::Rectangle* pRect, int nPart)
+ RectangleAndPart(const tools::Rectangle* pRect, int nPart, int nMode)
: m_aRectangle( pRect ? SanitizedRectangle(*pRect) : emptyAllRectangle)
, m_nPart(nPart)
+ , m_nMode(nMode)
{
}
@@ -64,7 +67,7 @@ namespace desktop {
{
if (m_nPart >= -1)
return (isInfinite() ? "EMPTY" : m_aRectangle.toString())
- + ", " + OString::number(m_nPart);
+ + ", " + OString::number(m_nPart) + ", " + OString::number(m_nMode);
else
return (isInfinite() ? "EMPTY" : m_aRectangle.toString());
}
@@ -116,7 +119,7 @@ namespace desktop {
// SfxLockCallbackInterface
virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) override;
virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) override;
- virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) override;
+ virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart, int nMode) override;
virtual void libreOfficeKitViewUpdatedCallback(int nType) override;
virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) override;
virtual void libreOfficeKitViewAddPendingInvalidateTiles() override;
@@ -137,7 +140,12 @@ namespace desktop {
}
CallbackData(const tools::Rectangle* pRect, int viewId)
- : PayloadObject(RectangleAndPart(pRect, viewId))
+ : PayloadObject(RectangleAndPart(pRect, viewId, 0))
+ { // PayloadString will be done on demand
+ }
+
+ CallbackData(const tools::Rectangle* pRect, int part, int mode)
+ : PayloadObject(RectangleAndPart(pRect, part, mode))
{ // PayloadString will be done on demand
}
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 0850a1cb884d..d7089d9243f0 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -1775,11 +1775,11 @@ void DesktopLOKTest::testTileInvalidationCompression()
std::unique_ptr<CallbackFlushHandler> handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, &notifs));
handler->setViewId(SfxLokHelper::getView());
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0");
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0");
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "-100, -50, 500, 650, 0");
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, -32767, -32767, 0");
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "100, 100, 200, 200, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "-100, -50, 500, 650, 0, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, -32767, -32767, 0, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "100, 100, 200, 200, 0, 0");
Scheduler::ProcessEventsToIdle();
@@ -1787,7 +1787,7 @@ void DesktopLOKTest::testTileInvalidationCompression()
size_t i = 0;
CPPUNIT_ASSERT_EQUAL(int(LOK_CALLBACK_INVALIDATE_TILES), std::get<0>(notifs[i]));
- CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 400, 600, 0"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 400, 600, 0, 0"), std::get<1>(notifs[i++]));
}
// Part Number
@@ -1796,11 +1796,11 @@ void DesktopLOKTest::testTileInvalidationCompression()
std::unique_ptr<CallbackFlushHandler> handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, &notifs));
handler->setViewId(SfxLokHelper::getView());
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0");
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 200, 200, 1"); // Different part
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 0, 0, 2"); // Invalid
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "-121, -121, 200, 200, 0"); // Inside first
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, -32767, -32767, 1"); // Invalid
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 200, 200, 1, 0"); // Different part
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 0, 0, 2, 0"); // Invalid
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "-121, -121, 200, 200, 0, 0"); // Inside first
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, -32767, -32767, 1, 0"); // Invalid
Scheduler::ProcessEventsToIdle();
@@ -1808,10 +1808,10 @@ void DesktopLOKTest::testTileInvalidationCompression()
size_t i = 0;
CPPUNIT_ASSERT_EQUAL(int(LOK_CALLBACK_INVALIDATE_TILES), std::get<0>(notifs[i]));
- CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 200, 200, 1"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 200, 200, 1, 0"), std::get<1>(notifs[i++]));
CPPUNIT_ASSERT_EQUAL(int(LOK_CALLBACK_INVALIDATE_TILES), std::get<0>(notifs[i]));
- CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 239, 239, 0"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 239, 239, 0, 0"), std::get<1>(notifs[i++]));
}
// All Parts
@@ -1820,14 +1820,14 @@ void DesktopLOKTest::testTileInvalidationCompression()
std::unique_ptr<CallbackFlushHandler> handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, &notifs));
handler->setViewId(SfxLokHelper::getView());
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0"); // 0
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 200, 200, 1"); // 1: Different part
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 0, 0, -1"); // Invalid
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "-121, -121, 200, 200, -1"); // 0: All parts
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, -32767, -32767, -1"); // Invalid
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "-100, -100, 1200, 1200, -1"); // 0: All parts
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 3"); // Overlapped
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "1000, 1000, 1239, 1239, 2"); // 1: Unique region
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0, 0"); // 0
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 200, 200, 1, 0"); // 1: Different part
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 0, 0, -1, 0"); // Invalid
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "-121, -121, 200, 200, -1, 0"); // 0: All parts
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, -32767, -32767, -1, 0"); // Invalid
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "-100, -100, 1200, 1200, -1, 0"); // 0: All parts
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 3, 0"); // Overlapped
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "1000, 1000, 1239, 1239, 2, 0"); // 1: Unique region
Scheduler::ProcessEventsToIdle();
@@ -1835,10 +1835,10 @@ void DesktopLOKTest::testTileInvalidationCompression()
size_t i = 0;
CPPUNIT_ASSERT_EQUAL(int(LOK_CALLBACK_INVALIDATE_TILES), std::get<0>(notifs[i]));
- CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 1100, 1100, -1"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 1100, 1100, -1, 0"), std::get<1>(notifs[i++]));
CPPUNIT_ASSERT_EQUAL(int(LOK_CALLBACK_INVALIDATE_TILES), std::get<0>(notifs[i]));
- CPPUNIT_ASSERT_EQUAL(std::string("1000, 1000, 1239, 1239, 2"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL(std::string("1000, 1000, 1239, 1239, 2, 0"), std::get<1>(notifs[i++]));
}
// All Parts (partial)
@@ -1847,14 +1847,14 @@ void DesktopLOKTest::testTileInvalidationCompression()
std::unique_ptr<CallbackFlushHandler> handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, &notifs));
handler->setViewId(SfxLokHelper::getView());
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 200, 200, 0"); // 0
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 100, 100, 1"); // 1: Different part
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 0, 0, -1"); // Invalid
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "150, 150, 50, 50, -1"); // 2: All-parts
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, -32767, -32767, -1"); // Invalid
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "150, 150, 40, 40, 3"); // Overlapped w/ 2
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 200, 200, 4"); // 3: Unique
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "1000, 1000, 1239, 1239, 1"); // 4: Unique
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 200, 200, 0, 0"); // 0
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 100, 100, 1, 0"); // 1: Different part
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 0, 0, -1, 0"); // Invalid
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "150, 150, 50, 50, -1, 0"); // 2: All-parts
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, -32767, -32767, -1, 0"); // Invalid
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "150, 150, 40, 40, 3, 0"); // Overlapped w/ 2
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 200, 200, 4, 0"); // 3: Unique
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "1000, 1000, 1239, 1239, 1, 0"); // 4: Unique
Scheduler::ProcessEventsToIdle();
@@ -1862,19 +1862,19 @@ void DesktopLOKTest::testTileInvalidationCompression()
size_t i = 0;
CPPUNIT_ASSERT_EQUAL(int(LOK_CALLBACK_INVALIDATE_TILES), std::get<0>(notifs[i]));
- CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 200, 200, 0"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 200, 200, 0, 0"), std::get<1>(notifs[i++]));
CPPUNIT_ASSERT_EQUAL(int(LOK_CALLBACK_INVALIDATE_TILES), std::get<0>(notifs[i]));
- CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 100, 100, 1"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 100, 100, 1, 0"), std::get<1>(notifs[i++]));
CPPUNIT_ASSERT_EQUAL(int(LOK_CALLBACK_INVALIDATE_TILES), std::get<0>(notifs[i]));
- CPPUNIT_ASSERT_EQUAL(std::string("150, 150, 50, 50, -1"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL(std::string("150, 150, 50, 50, -1, 0"), std::get<1>(notifs[i++]));
CPPUNIT_ASSERT_EQUAL(int(LOK_CALLBACK_INVALIDATE_TILES), std::get<0>(notifs[i]));
- CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 200, 200, 4"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL(std::string("0, 0, 200, 200, 4, 0"), std::get<1>(notifs[i++]));
CPPUNIT_ASSERT_EQUAL(int(LOK_CALLBACK_INVALIDATE_TILES), std::get<0>(notifs[i]));
- CPPUNIT_ASSERT_EQUAL(std::string("1000, 1000, 1239, 1239, 1"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL(std::string("1000, 1000, 1239, 1239, 1, 0"), std::get<1>(notifs[i++]));
}
// Merge with "EMPTY"
@@ -1883,11 +1883,11 @@ void DesktopLOKTest::testTileInvalidationCompression()
std::unique_ptr<CallbackFlushHandler> handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, &notifs));
handler->setViewId(SfxLokHelper::getView());
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0");
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "EMPTY, 0");
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 240, 0");
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "-121, -121, 300, 300, 0");
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, -32767, -32767, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 239, 0, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "EMPTY, 0, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, 239, 240, 0, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "-121, -121, 300, 300, 0, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "0, 0, -32767, -32767, 0, 0");
Scheduler::ProcessEventsToIdle();
@@ -1895,7 +1895,7 @@ void DesktopLOKTest::testTileInvalidationCompression()
size_t i = 0;
CPPUNIT_ASSERT_EQUAL(int(LOK_CALLBACK_INVALIDATE_TILES), std::get<0>(notifs[i]));
- CPPUNIT_ASSERT_EQUAL(std::string("EMPTY, 0"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL(std::string("EMPTY, 0, 0"), std::get<1>(notifs[i++]));
}
}
@@ -1944,8 +1944,8 @@ void DesktopLOKTest::testPartInInvalidation()
std::unique_ptr<CallbackFlushHandler> handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, &notifs));
handler->setViewId(SfxLokHelper::getView());
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "10, 10, 20, 10, 0");
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "20, 10, 20, 10, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "10, 10, 20, 10, 0, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "20, 10, 20, 10, 0, 0");
Scheduler::ProcessEventsToIdle();
@@ -1963,8 +1963,8 @@ void DesktopLOKTest::testPartInInvalidation()
std::unique_ptr<CallbackFlushHandler> handler(new CallbackFlushHandler(pDocument, callbackCompressionTest, &notifs));
handler->setViewId(SfxLokHelper::getView());
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "10, 10, 20, 10, 0");
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "20, 10, 20, 10, 1");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "10, 10, 20, 10, 0, 0");
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "20, 10, 20, 10, 1, 0");
Scheduler::ProcessEventsToIdle();
@@ -2005,7 +2005,7 @@ void DesktopLOKTest::testBinaryCallback()
std::unique_ptr<CallbackFlushHandler> handler(new CallbackFlushHandler(pDocument, callbackBinaryCallbackTest, &notifs));
handler->setViewId(SfxLokHelper::getView());
- handler->libreOfficeKitViewInvalidateTilesCallback(&rect1, INT_MIN);
+ handler->libreOfficeKitViewInvalidateTilesCallback(&rect1, INT_MIN, 0);
Scheduler::ProcessEventsToIdle();
@@ -2019,7 +2019,7 @@ void DesktopLOKTest::testBinaryCallback()
std::unique_ptr<CallbackFlushHandler> handler(new CallbackFlushHandler(pDocument, callbackBinaryCallbackTest, &notifs));
handler->setViewId(SfxLokHelper::getView());
- handler->libreOfficeKitViewInvalidateTilesCallback(nullptr, INT_MIN);
+ handler->libreOfficeKitViewInvalidateTilesCallback(nullptr, INT_MIN, 0);
Scheduler::ProcessEventsToIdle();
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6008820da1bb..d4332d5c2926 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -64,6 +64,7 @@
#include <comphelper/propertyvalue.hxx>
#include <comphelper/scopeguard.hxx>
#include <comphelper/threadpool.hxx>
+#include <comphelper/servicehelper.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <com/sun/star/document/MacroExecMode.hpp>
@@ -422,12 +423,26 @@ RectangleAndPart RectangleAndPart::Create(const std::string& rPayload)
{
aRet.m_aRectangle = tools::Rectangle(0, 0, SfxLokHelper::MaxTwips, SfxLokHelper::MaxTwips);
if (comphelper::LibreOfficeKit::isPartInInvalidation())
- aRet.m_nPart = std::stol(rPayload.substr(6));
+ {
+ int nSeparatorPos = rPayload.find(',', 6);
+ bool bHasMode = nSeparatorPos > 0;
+ if (bHasMode)
+ {
+ aRet.m_nPart = std::stol(rPayload.substr(6, nSeparatorPos - 6));
+ assert(rPayload.length() > o3tl::make_unsigned(nSeparatorPos));
+ aRet.m_nMode = std::stol(rPayload.substr(nSeparatorPos + 1));
+ }
+ else
+ {
+ aRet.m_nPart = std::stol(rPayload.substr(6));
+ aRet.m_nMode = 0;
+ }
+ }
return aRet;
}
- // Read '<left>, <top>, <width>, <height>[, <part>]'. C++ streams are simpler but slower.
+ // Read '<left>, <top>, <width>, <height>[, <part>, <mode>]'. C++ streams are simpler but slower.
const char* pos = rPayload.c_str();
const char* end = rPayload.c_str() + rPayload.size();
tools::Long nLeft = rtl_str_toInt64_WithLength(pos, 10, end - pos);
@@ -447,6 +462,7 @@ RectangleAndPart RectangleAndPart::Create(const std::string& rPayload)
assert(pos < end);
tools::Long nHeight = rtl_str_toInt64_WithLength(pos, 10, end - pos);
tools::Long nPart = INT_MIN;
+ tools::Long nMode = 0;
if (comphelper::LibreOfficeKit::isPartInInvalidation())
{
while( *pos != ',' )
@@ -454,10 +470,20 @@ RectangleAndPart RectangleAndPart::Create(const std::string& rPayload)
++pos;
assert(pos < end);
nPart = rtl_str_toInt64_WithLength(pos, 10, end - pos);
+
+ while( *pos && *pos != ',' )
+ ++pos;
+ if (*pos)
+ {
+ ++pos;
+ assert(pos < end);
+ nMode = rtl_str_toInt64_WithLength(pos, 10, end - pos);
+ }
}
aRet.m_aRectangle = SanitizedRectangle(nLeft, nTop, nWidth, nHeight);
aRet.m_nPart = nPart;
+ aRet.m_nMode = nMode;
return aRet;
}
@@ -1460,9 +1486,9 @@ void CallbackFlushHandler::libreOfficeKitViewCallbackWithViewId(int nType, const
queue(nType, callbackData);
}
-void CallbackFlushHandler::libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart)
+void CallbackFlushHandler::libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart, int nMode)
{
- CallbackData callbackData(pRect, nPart);
+ CallbackData callbackData(pRect, nPart, nMode);
queue(LOK_CALLBACK_INVALIDATE_TILES, callbackData);
}
@@ -1799,14 +1825,15 @@ bool CallbackFlushHandler::processInvalidateTilesEvent(int type, CallbackData& a
{
auto pos2 = toQueue2(pos);
const RectangleAndPart& rcOld = pos2->getRectangleAndPart();
- if (rcOld.isInfinite() && (rcOld.m_nPart == -1 || rcOld.m_nPart == rcNew.m_nPart))
+ if (rcOld.isInfinite() && (rcOld.m_nPart == -1 || rcOld.m_nPart == rcNew.m_nPart) &&
+ (rcOld.m_nMode == rcNew.m_nMode))
{
SAL_INFO("lok", "Skipping queue [" << type << "]: [" << aCallbackData.getPayload()
<< "] since all tiles need to be invalidated.");
return true;
}
- if (rcOld.m_nPart == -1 || rcOld.m_nPart == rcNew.m_nPart)
+ if ((rcOld.m_nPart == -1 || rcOld.m_nPart == rcNew.m_nPart) && (rcOld.m_nMode == rcNew.m_nMode))
{
// If fully overlapping.
if (rcOld.m_aRectangle.Contains(rcNew.m_aRectangle))
@@ -1824,7 +1851,8 @@ bool CallbackFlushHandler::processInvalidateTilesEvent(int type, CallbackData& a
<< "] so removing all with part " << rcNew.m_nPart << ".");
removeAll(LOK_CALLBACK_INVALIDATE_TILES, [&rcNew](const CallbackData& elemData) {
// Remove exiting if new is all-encompassing, or if of the same part.
- return (rcNew.m_nPart == -1 || rcNew.m_nPart == elemData.getRectangleAndPart().m_nPart);
+ return ((rcNew.m_nPart == -1 || rcNew.m_nPart == elemData.getRectangleAndPart().m_nPart)
+ && (rcNew.m_nMode == elemData.getRectangleAndPart().m_nMode));
});
}
else
@@ -1834,7 +1862,8 @@ bool CallbackFlushHandler::processInvalidateTilesEvent(int type, CallbackData& a
SAL_INFO("lok", "Have [" << type << "]: [" << aCallbackData.getPayload() << "] so merging overlapping.");
removeAll(LOK_CALLBACK_INVALIDATE_TILES,[&rcNew](const CallbackData& elemData) {
const RectangleAndPart& rcOld = elemData.getRectangleAndPart();
- if (rcNew.m_nPart != -1 && rcOld.m_nPart != -1 && rcOld.m_nPart != rcNew.m_nPart)
+ if (rcNew.m_nPart != -1 && rcOld.m_nPart != -1 &&
+ (rcOld.m_nPart != rcNew.m_nPart || rcOld.m_nMode != rcNew.m_nMode))
{
SAL_INFO("lok", "Nothing to merge between new: "
<< rcNew.toString() << ", and old: " << rcOld.toString());
@@ -1846,7 +1875,7 @@ bool CallbackFlushHandler::processInvalidateTilesEvent(int type, CallbackData& a
// Don't merge unless fully overlapped.
SAL_INFO("lok", "New " << rcNew.toString() << " has " << rcOld.toString()
<< "?");
- if (rcNew.m_aRectangle.Contains(rcOld.m_aRectangle))
+ if (rcNew.m_aRectangle.Contains(rcOld.m_aRectangle) && rcOld.m_nMode == rcNew.m_nMode)
{
SAL_INFO("lok", "New " << rcNew.toString() << " engulfs old "
<< rcOld.toString() << ".");
@@ -1858,7 +1887,7 @@ bool CallbackFlushHandler::processInvalidateTilesEvent(int type, CallbackData& a
// Don't merge unless fully overlapped.
SAL_INFO("lok", "Old " << rcOld.toString() << " has " << rcNew.toString()
<< "?");
- if (rcOld.m_aRectangle.Contains(rcNew.m_aRectangle))
+ if (rcOld.m_aRectangle.Contains(rcNew.m_aRectangle) && rcOld.m_nMode == rcNew.m_nMode)
{
SAL_INFO("lok", "New " << rcNew.toString() << " engulfs old "
<< rcOld.toString() << ".");
@@ -1869,7 +1898,7 @@ bool CallbackFlushHandler::processInvalidateTilesEvent(int type, CallbackData& a
{
const tools::Rectangle rcOverlap
= rcNew.m_aRectangle.GetIntersection(rcOld.m_aRectangle);
- const bool bOverlap = !rcOverlap.IsEmpty();
+ const bool bOverlap = !rcOverlap.IsEmpty() && rcOld.m_nMode == rcNew.m_nMode;
SAL_INFO("lok", "Merging " << rcNew.toString() << " & " << rcOld.toString()
<< " => " << rcOverlap.toString()
<< " Overlap: " << bOverlap);