diff options
-rw-r--r-- | desktop/inc/lib/init.hxx | 16 | ||||
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 96 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 51 | ||||
-rw-r--r-- | include/editeng/outliner.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/lokcallback.hxx | 3 | ||||
-rw-r--r-- | include/sfx2/viewsh.hxx | 2 | ||||
-rw-r--r-- | include/test/lokcallback.hxx | 4 | ||||
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/view/tabview5.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 4 | ||||
-rw-r--r-- | test/source/lokcallback.cxx | 4 |
12 files changed, 125 insertions, 76 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, ¬ifs)); 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, ¬ifs)); 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, ¬ifs)); 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, ¬ifs)); 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, ¬ifs)); 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, ¬ifs)); 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, ¬ifs)); 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, ¬ifs)); 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, ¬ifs)); 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); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index c6d57f09a086..aa2cad367c26 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -370,7 +370,7 @@ class SAL_NO_VTABLE SAL_DLLPUBLIC_RTTI OutlinerViewShell public: virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const = 0; virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) const = 0; - virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const = 0; + virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart, int nMode) const = 0; virtual void libreOfficeKitViewUpdatedCallback(int nType) const = 0; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const = 0; virtual void libreOfficeKitViewAddPendingInvalidateTiles() = 0; diff --git a/include/sfx2/lokcallback.hxx b/include/sfx2/lokcallback.hxx index cf97f083e792..02546b8b4d22 100644 --- a/include/sfx2/lokcallback.hxx +++ b/include/sfx2/lokcallback.hxx @@ -39,7 +39,8 @@ public: // LOK_CALLBACK_INVALIDATE_TILES // nPart is either part, -1 for all-parts, or INT_MIN if // comphelper::LibreOfficeKit::isPartInInvalidation() is not set - virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) + virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart, + int nMode) = 0; // A message of the given type should be sent, for performance purpose only a notification // is given here, details about the message should be queried from SfxViewShell when necessary. diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 6196faa4ca4a..975076a1fd51 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -350,7 +350,7 @@ public: /// Invokes the registered callback, if there are any. virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const override; virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) const override; - virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const override; + virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart, int nMode) const override; virtual void libreOfficeKitViewUpdatedCallback(int nType) const override; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const override; // Performs any pending calls to libreOfficeKitViewInvalidateTilesCallback() as necessary. diff --git a/include/test/lokcallback.hxx b/include/test/lokcallback.hxx index 75a8977938bc..1908838a6cdf 100644 --- a/include/test/lokcallback.hxx +++ b/include/test/lokcallback.hxx @@ -34,8 +34,8 @@ public: 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; diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 0408e0e731c5..8ca176d8d6cb 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -572,6 +572,7 @@ public: std::vector<tools::Rectangle> m_aInvalidations; tools::Rectangle m_aCellCursorBounds; std::vector<int> m_aInvalidationsParts; + std::vector<int> m_aInvalidationsMode; bool m_bViewLock; OString m_sCellFormula; boost::property_tree::ptree m_aCommentCallbackResult; @@ -671,15 +672,18 @@ public: else { uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); - CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); + CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 6); tools::Rectangle aInvalidationRect; aInvalidationRect.SetLeft(aSeq[0].toInt32()); aInvalidationRect.SetTop(aSeq[1].toInt32()); aInvalidationRect.setWidth(aSeq[2].toInt32()); aInvalidationRect.setHeight(aSeq[3].toInt32()); m_aInvalidations.push_back(aInvalidationRect); - if (aSeq.getLength() == 5) + if (aSeq.getLength() == 6) + { m_aInvalidationsParts.push_back(aSeq[4].toInt32()); + m_aInvalidationsMode.push_back(aSeq[5].toInt32()); + } m_bInvalidateTiles = true; } } @@ -1908,6 +1912,7 @@ void ScTiledRenderingTest::testSheetChangeInvalidation() aView1.m_bInvalidateTiles = false; aView1.m_aInvalidations.clear(); aView1.m_aInvalidationsParts.clear(); + aView1.m_aInvalidationsMode.clear(); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD1); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD1); Scheduler::ProcessEventsToIdle(); @@ -1921,6 +1926,9 @@ void ScTiledRenderingTest::testSheetChangeInvalidation() CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidationsParts.size()); CPPUNIT_ASSERT_EQUAL(pModelObj->getPart(), aView1.m_aInvalidationsParts[0]); CPPUNIT_ASSERT_EQUAL(pModelObj->getPart(), aView1.m_aInvalidationsParts[1]); + CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidationsMode.size()); + CPPUNIT_ASSERT_EQUAL(pModelObj->getEditMode(), aView1.m_aInvalidationsMode[0]); + CPPUNIT_ASSERT_EQUAL(pModelObj->getEditMode(), aView1.m_aInvalidationsMode[1]); comphelper::LibreOfficeKit::setPartInInvalidation(oldPartInInvalidation); } diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 245feb8f71f8..6b9dd1d616b4 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -345,7 +345,7 @@ void ScTabView::TabChanged( bool bSameTabButMoved ) // Invalidate first tools::Rectangle aRectangle(0, 0, 1000000000, 1000000000); - pViewShell->libreOfficeKitViewInvalidateTilesCallback(&aRectangle, aViewData.GetTabNo()); + pViewShell->libreOfficeKitViewInvalidateTilesCallback(&aRectangle, aViewData.GetTabNo(), 0); ScModelObj* pModel = comphelper::getFromUnoTunnel<ScModelObj>(pViewShell->GetCurrentDocument()); SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel, false); diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index c631aa8d6257..b6b5a7895744 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -551,7 +551,8 @@ void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, tools::Rect return; const int nPart = comphelper::LibreOfficeKit::isPartInInvalidation() ? pThisView->getPart() : INT_MIN; - pThisView->libreOfficeKitViewInvalidateTilesCallback(pRect, nPart); + const int nMode = comphelper::LibreOfficeKit::isPartInInvalidation() ? pThisView->getEditMode() : 0; + pThisView->libreOfficeKitViewInvalidateTilesCallback(pRect, nPart, nMode); } void SfxLokHelper::notifyDocumentSizeChanged(SfxViewShell const* pThisView, const OString& rPayload, vcl::ITiledRenderable* pDoc, bool bInvalidateAll) @@ -564,7 +565,7 @@ void SfxLokHelper::notifyDocumentSizeChanged(SfxViewShell const* pThisView, cons for (int i = 0; i < pDoc->getParts(); ++i) { tools::Rectangle aRectangle(0, 0, 1000000000, 1000000000); - pThisView->libreOfficeKitViewInvalidateTilesCallback(&aRectangle, i); + pThisView->libreOfficeKitViewInvalidateTilesCallback(&aRectangle, i, 0); } } pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, rPayload.getStr()); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index c21790aa9be5..108574d410e2 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1482,12 +1482,12 @@ static bool ignoreLibreOfficeKitViewCallback(int nType, const SfxViewShell_Impl* return false; } -void SfxViewShell::libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const +void SfxViewShell::libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart, int nMode) const { if (ignoreLibreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, pImpl.get())) return; if (pImpl->m_pLibreOfficeKitViewCallback) - pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewInvalidateTilesCallback(pRect, nPart); + pImpl->m_pLibreOfficeKitViewCallback->libreOfficeKitViewInvalidateTilesCallback(pRect, nPart, nMode); else SAL_INFO( "sfx.view", diff --git a/test/source/lokcallback.cxx b/test/source/lokcallback.cxx index d7500cb74443..5af844f089ad 100644 --- a/test/source/lokcallback.cxx +++ b/test/source/lokcallback.cxx @@ -59,7 +59,7 @@ void TestLokCallbackWrapper::libreOfficeKitViewCallbackWithViewId(int nType, con } void TestLokCallbackWrapper::libreOfficeKitViewInvalidateTilesCallback( - const tools::Rectangle* pRect, int nPart) + const tools::Rectangle* pRect, int nPart, int nMode) { OStringBuffer buf(64); if (pRect) @@ -70,6 +70,8 @@ void TestLokCallbackWrapper::libreOfficeKitViewInvalidateTilesCallback( { buf.append(", "); buf.append(static_cast<sal_Int32>(nPart)); + buf.append(", "); + buf.append(static_cast<sal_Int32>(nMode)); } callCallback(LOK_CALLBACK_INVALIDATE_TILES, buf.makeStringAndClear().getStr(), NO_VIEWID); } |