include/LibreOfficeKit/LibreOfficeKitEnums.h | 4 ++ include/sfx2/lokhelper.hxx | 3 + sc/qa/unit/tiledrendering/tiledrendering.cxx | 39 +++++++++++++------------ sc/source/core/data/document.cxx | 13 +++++--- sc/source/ui/docshell/docsh3.cxx | 4 +- sc/source/ui/view/tabview.cxx | 7 ++-- sc/source/ui/view/tabview3.cxx | 3 + sc/source/ui/view/tabview5.cxx | 3 + sd/qa/unit/tiledrendering/tiledrendering.cxx | 2 - sd/source/core/drawdoc2.cxx | 8 +++-- sd/source/ui/sidebar/SlideBackground.cxx | 5 ++- sfx2/source/view/lokhelper.cxx | 20 ++++++++++++ sw/qa/extras/tiledrendering/tiledrendering.cxx | 2 - sw/source/core/view/viewsh.cxx | 12 +++++++ 14 files changed, 91 insertions(+), 34 deletions(-)
New commits: commit fac47ae957e893ea050e38bca3f5a25d83798bfd Author: Tamás Zolnai <[email protected]> AuthorDate: Sat Sep 14 13:22:45 2019 +0200 Commit: Tamás Zolnai <[email protected]> CommitDate: Thu Sep 26 19:43:54 2019 +0200 lok: send an invalidation by document size change It was sent by the kit code earlier. Now we move it to the LO core code, so we can optimize it later. co-author: Michael Meeks <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/79491 Reviewed-by: Tamás Zolnai <[email protected]> Tested-by: Tamás Zolnai <[email protected]> (cherry picked from commit cd7ff1797d754018db1d47888781c9d7ecb24dcf) Change-Id: Id0a8991016dbe8d13891071e2d5b4c9250720da9 Reviewed-on: https://gerrit.libreoffice.org/79617 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Tamás Zolnai <[email protected]> diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index b28b51b0f19a..aea463909da3 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -262,6 +262,10 @@ typedef enum * * Payload format is "width, height", i.e. clients get the new size without * having to do an explicit lok::Document::getDocumentSize() call. + * + * A size change is always preceeded by a series of + * LOK_CALLBACK_INVALIDATE_TILES events invalidating any areas + * need re-rendering to adapt. */ LOK_CALLBACK_DOCUMENT_SIZE_CHANGED = 13, diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 62c024508de1..44664a43041b 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -11,6 +11,7 @@ #define INCLUDED_SFX2_LOKHELPER_HXX #include <vcl/IDialogRenderable.hxx> +#include <vcl/ITiledRenderable.hxx> #include <sfx2/dllapi.h> #include <sfx2/viewsh.hxx> #include <cstddef> @@ -47,6 +48,8 @@ public: vcl::LOKWindowId nWindowId, const OUString& rAction, const std::vector<vcl::LOKPayloadItem>& rPayload = std::vector<vcl::LOKPayloadItem>()); + /// Emits a LOK_CALLBACK_DOCUMENT_SIZE_CHANGED - if @bInvalidateAll - first invalidates all parts + static void notifyDocumentSizeChanged(SfxViewShell const* pThisView, const OString& rPayload, vcl::ITiledRenderable* pDoc, bool bInvalidateAll = true); /// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to setOptionalFeatures() if needed. static void notifyInvalidation(SfxViewShell const* pThisView, const OString& rPayload); /// Emits a LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, but tweaks it according to setOptionalFeatures() if needed. diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 1eb5d28159f1..df43e49b8192 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -513,7 +513,7 @@ public: else { uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aSeq.getLength()); + CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); tools::Rectangle aInvalidationRect; aInvalidationRect.setX(aSeq[0].toInt32()); aInvalidationRect.setY(aSeq[1].toInt32()); @@ -1045,7 +1045,7 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() comphelper::dispatchCommand(".uno:InsertRows", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(1), aView.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 50985, 32212230, 63990), aView.m_aInvalidations[0]); // move on the right @@ -1062,7 +1062,7 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() comphelper::dispatchCommand(".uno:InsertColumns", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(1), aView.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(253650, -15, 32212230, 63990), aView.m_aInvalidations[0]); } @@ -1739,7 +1739,7 @@ void ScTiledRenderingTest::testSheetChangeInvalidation() pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD1); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(size_t(3), aView1.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310720, 268435456), aView1.m_aInvalidations[0]); } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index b54ef92a1410..41ee707ae31e 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -95,6 +95,7 @@ #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <mtvelements.hxx> +#include <sfx2/lokhelper.hxx> using ::editeng::SvxBorderLine; using namespace ::com::sun::star; @@ -569,7 +570,8 @@ bool ScDocument::InsertTab( SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + ScModelObj* pModel = ScModelObj::getImplementation(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); pViewShell = SfxViewShell::GetNext(*pViewShell); } } @@ -739,7 +741,8 @@ bool ScDocument::DeleteTab( SCTAB nTab ) SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + ScModelObj* pModel = ScModelObj::getImplementation(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); pViewShell = SfxViewShell::GetNext(*pViewShell); } } @@ -835,7 +838,8 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets ) SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + ScModelObj* pModel = ScModelObj::getImplementation(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); pViewShell = SfxViewShell::GetNext(*pViewShell); } } @@ -886,7 +890,8 @@ bool ScDocument::RenameTab( SCTAB nTab, const OUString& rName, bool bExternalDoc SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + ScModelObj* pModel = ScModelObj::getImplementation(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); pViewShell = SfxViewShell::GetNext(*pViewShell); } } diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index c57c0ecb52b8..be2eb7bf0cbc 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -68,6 +68,7 @@ #include <comphelper/lok.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <sfx2/lokhelper.hxx> // Redraw - Notifications @@ -173,7 +174,8 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + ScModelObj* pModel = ScModelObj::getImplementation(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); pViewShell = SfxViewShell::GetNext(*pViewShell); } } diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index ba97e144f19e..0e1ac5ec747b 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2563,7 +2563,8 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) std::stringstream ss; ss << aNewSize.Width() << ", " << aNewSize.Height(); OString sSize = ss.str().c_str(); - aViewData.GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sSize.getStr()); + ScModelObj* pModel = ScModelObj::getImplementation(aViewData.GetViewShell()->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel); // New area extended to the bottom of the sheet after last row // excluding overlapping area with aNewColArea @@ -2706,8 +2707,8 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) std::stringstream ss; ss << aNewSize.Width() << ", " << aNewSize.Height(); OString sSize = ss.str().c_str(); - aViewData.GetViewShell()->libreOfficeKitViewCallback( - LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sSize.getStr()); + ScModelObj* pModel = ScModelObj::getImplementation(aViewData.GetViewShell()->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel); } // New area extended to the right of the sheet after last column diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index ca9c6238dd8e..bfb776964f56 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -410,7 +410,8 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) std::stringstream ss; ss << aNewSize.Width() << ", " << aNewSize.Height(); OString sSize = ss.str().c_str(); - aViewData.GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sSize.getStr()); + ScModelObj* pModel = ScModelObj::getImplementation(aViewData.GetViewShell()->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel); // New area extended to the right of the sheet after last column // including overlapping area with aNewRowArea diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 3aabb1bb9f34..d98716d57aad 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -332,7 +332,8 @@ void ScTabView::TabChanged( bool bSameTabButMoved ) ss << aDocSize.Width() << ", " << aDocSize.Height(); OString sRect = ss.str().c_str(); ScTabViewShell* pViewShell = aViewData.GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sRect.getStr()); + ScModelObj* pModel = ScModelObj::getImplementation(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel); } } } diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 0f2cf7bb309b..d9797587ae21 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -255,7 +255,7 @@ static std::vector<OUString> lcl_convertSeparated(const OUString& rString, sal_U static void lcl_convertRectangle(const OUString& rString, ::tools::Rectangle& rRectangle) { uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(rString); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aSeq.getLength()); + CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); rRectangle.setX(aSeq[0].toInt32()); rRectangle.setY(aSeq[1].toInt32()); rRectangle.setWidth(aSeq[2].toInt32()); diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index 91613f50c961..e4053d5afff4 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -61,6 +61,8 @@ #include <imapinfo.hxx> #include <cusshow.hxx> #include <undo/undomanager.hxx> +#include <sfx2/lokhelper.hxx> +#include <unomodel.hxx> #include <DrawDocShell.hxx> #include <FrameView.hxx> @@ -414,7 +416,8 @@ void SdDrawDocument::InsertPage(SdrPage* pPage, sal_uInt16 nPos) SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + SdXImpressDocument* pModel = SdXImpressDocument::getImplementation(this->getUnoModel()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); pViewShell = SfxViewShell::GetNext(*pViewShell); } } @@ -447,7 +450,8 @@ SdrPage* SdDrawDocument::RemovePage(sal_uInt16 nPgNum) SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + SdXImpressDocument* pModel = SdXImpressDocument::getImplementation(this->getUnoModel()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); pViewShell = SfxViewShell::GetNext(*pViewShell); } } diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index efa6defc1495..fb4d58008cbb 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -74,6 +74,8 @@ #include <svl/itemset.hxx> #include <comphelper/lok.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <unomodel.hxx> +#include <sfx2/lokhelper.hxx> using namespace ::com::sun::star; @@ -1026,7 +1028,8 @@ IMPL_LINK_NOARG(SlideBackground, PaperSizeModifyHdl, ListBox&, void) SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + SdXImpressDocument* pModel = SdXImpressDocument::getImplementation(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); pViewShell = SfxViewShell::GetNext(*pViewShell); } } diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 664b2fb16afa..96b41737425c 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -221,6 +221,26 @@ void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, const OStri pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, aBuf.makeStringAndClear().getStr()); } +void SfxLokHelper::notifyDocumentSizeChanged(SfxViewShell const* pThisView, const OString& rPayload, vcl::ITiledRenderable* pDoc, bool bInvalidateAll) +{ + if (!comphelper::LibreOfficeKit::isActive()) + return; + + if (!pDoc) + return; + + if (bInvalidateAll) + { + for (int i = 0; i < pDoc->getParts(); ++i) + { + tools::Rectangle aRectangle(0, 0, 1000000000, 1000000000); + OString sPayload = aRectangle.toString() + OString(", ") + OString::number(i); + pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sPayload.getStr()); + } + } + pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, rPayload.getStr()); +} + void SfxLokHelper::notifyVisCursorInvalidation(OutlinerViewShell const* pThisView, const OString& rRectangle) { OString sPayload; diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index a9ca888840eb..16373bbf2a67 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -259,7 +259,7 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload) uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); if (OString("EMPTY") == pPayload) return; - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aSeq.getLength()); + CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); m_aInvalidation.setX(aSeq[0].toInt32()); m_aInvalidation.setY(aSeq[1].toInt32()); m_aInvalidation.setWidth(aSeq[2].toInt32()); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index c0268da684d9..01757e3d4240 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -20,6 +20,7 @@ #include <config_features.h> #include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> #include <sfx2/viewfrm.hxx> #include <sfx2/progress.hxx> #include <svx/srchdlg.hxx> @@ -74,6 +75,7 @@ #include <wrtsh.hxx> #include <DocumentSettingManager.hxx> +#include <unotxdoc.hxx> #include <view.hxx> #include <PostItMgr.hxx> #include <unotools/configmgr.hxx> @@ -85,6 +87,7 @@ #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <comphelper/lok.hxx> #include <prevwpage.hxx> +#include <sfx2/lokhelper.hxx> #if !HAVE_FEATURE_DESKTOP #include <vcl/sysdata.hxx> @@ -1073,7 +1076,14 @@ void SwViewShell::SizeChgNotify() std::stringstream ss; ss << aDocSize.Width() + 2 * DOCUMENTBORDER << ", " << aDocSize.Height() + 2 * DOCUMENTBORDER; OString sSize = ss.str().c_str(); - GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sSize.getStr()); + + uno::Reference< css::lang::XUnoTunnel > xTunnel(GetSfxViewShell()->GetCurrentDocument(), uno::UNO_QUERY); + if(xTunnel.is()) + { + SwXTextDocument* pXDoc = reinterpret_cast< SwXTextDocument * >( + sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextDocument::getUnoTunnelId()))); + SfxLokHelper::notifyDocumentSizeChanged(GetSfxViewShell(), sSize, pXDoc); + } } } } commit 30a10a422003f87d761351606fd2158703b073f3 Author: Tamás Zolnai <[email protected]> AuthorDate: Fri Sep 13 19:35:40 2019 +0200 Commit: Tamás Zolnai <[email protected]> CommitDate: Thu Sep 26 19:43:42 2019 +0200 sc lok tests: Store all invalidation rectangles. Change-Id: I214a98d1901af0d0c25897ebfbdb644e92714f5c Reviewed-on: https://gerrit.libreoffice.org/79490 Reviewed-by: Tamás Zolnai <[email protected]> Tested-by: Tamás Zolnai <[email protected]> (cherry picked from commit 630d5915819c664aaee5f17066c61939f7ceaefe) Reviewed-on: https://gerrit.libreoffice.org/79616 Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 9db5a4a67a18..1eb5d28159f1 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -444,7 +444,7 @@ public: bool m_bGraphicViewSelection; bool m_bFullInvalidateTiles; bool m_bInvalidateTiles; - tools::Rectangle m_aInvalidation; + std::vector<tools::Rectangle> m_aInvalidations; bool m_bViewLock; OString m_sCellFormula; boost::property_tree::ptree m_aCommentCallbackResult; @@ -512,15 +512,14 @@ public: } else { - if (m_aInvalidation.IsEmpty()) - { - uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aSeq.getLength()); - m_aInvalidation.setX(aSeq[0].toInt32()); - m_aInvalidation.setY(aSeq[1].toInt32()); - m_aInvalidation.setWidth(aSeq[2].toInt32()); - m_aInvalidation.setHeight(aSeq[3].toInt32()); - } + uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aSeq.getLength()); + tools::Rectangle aInvalidationRect; + aInvalidationRect.setX(aSeq[0].toInt32()); + aInvalidationRect.setY(aSeq[1].toInt32()); + aInvalidationRect.setWidth(aSeq[2].toInt32()); + aInvalidationRect.setHeight(aSeq[3].toInt32()); + m_aInvalidations.push_back(aInvalidationRect); m_bInvalidateTiles = true; } } @@ -1042,11 +1041,12 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() // insert row aView.m_bInvalidateTiles = false; - aView.m_aInvalidation = tools::Rectangle(); + aView.m_aInvalidations.clear(); comphelper::dispatchCommand(".uno:InsertRows", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 50985, 32212230, 63990), aView.m_aInvalidation); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 50985, 32212230, 63990), aView.m_aInvalidations[0]); // move on the right for (int i = 0; i < 200; ++i) @@ -1058,11 +1058,12 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() // insert column aView.m_bInvalidateTiles = false; - aView.m_aInvalidation = tools::Rectangle(); + aView.m_aInvalidations.clear(); comphelper::dispatchCommand(".uno:InsertColumns", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(253650, -15, 32212230, 63990), aView.m_aInvalidation); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(253650, -15, 32212230, 63990), aView.m_aInvalidations[0]); } void ScTiledRenderingTest::testCommentCallback() @@ -1709,12 +1710,13 @@ void ScTiledRenderingTest::testPageDownInvalidation() SfxLokHelper::setView(nView1); aView1.m_bInvalidateTiles = false; - aView1.m_aInvalidation = tools::Rectangle(); + aView1.m_aInvalidations.clear(); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, awt::Key::PAGEDOWN, 0); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, awt::Key::PAGEDOWN, 0); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(15, 15, 1230, 225), aView1.m_aInvalidation); + CPPUNIT_ASSERT_EQUAL(size_t(3), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(15, 15, 1230, 225), aView1.m_aInvalidations[0]); } void ScTiledRenderingTest::testSheetChangeInvalidation() @@ -1732,12 +1734,13 @@ void ScTiledRenderingTest::testSheetChangeInvalidation() SfxLokHelper::setView(nView1); aView1.m_bInvalidateTiles = false; - aView1.m_aInvalidation = tools::Rectangle(); + aView1.m_aInvalidations.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(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310720, 268435456), aView1.m_aInvalidation); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310720, 268435456), aView1.m_aInvalidations[0]); } } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
