Rebased ref, commits from common ancestor: commit 6b96a048f2d602f8e0e04ed1017ace2d2edd5365 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Tue Sep 24 16:10:16 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:41 2019 +0200
sc lok: Optimize invalidation triggered by ScTabView::TabChanged() method We don't need to invalidate all parts of the document. It's enough to invalidate only that sheet which we changed to. Change-Id: I2c3aeb226c83bef473b0b33444b625e93d111b01 diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 59700cfccc9c..2dd5dcfbb2cd 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -453,6 +453,7 @@ public: bool m_bFullInvalidateTiles; bool m_bInvalidateTiles; std::vector<tools::Rectangle> m_aInvalidations; + std::vector<int> m_aInvalidationsParts; bool m_bViewLock; OString m_sCellFormula; boost::property_tree::ptree m_aCommentCallbackResult; @@ -542,6 +543,8 @@ public: aInvalidationRect.setWidth(aSeq[2].toInt32()); aInvalidationRect.setHeight(aSeq[3].toInt32()); m_aInvalidations.push_back(aInvalidationRect); + if (aSeq.getLength() == 5) + m_aInvalidationsParts.push_back(aSeq[4].toInt32()); m_bInvalidateTiles = true; } } @@ -1696,12 +1699,16 @@ void ScTiledRenderingTest::testSheetChangeInvalidation() SfxLokHelper::setView(nView1); aView1.m_bInvalidateTiles = false; aView1.m_aInvalidations.clear(); + aView1.m_aInvalidationsParts.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(size_t(3), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310720, 268435456), aView1.m_aInvalidations[0]); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[1]); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidationsParts.size()); + CPPUNIT_ASSERT_EQUAL(pModelObj->getPart(), aView1.m_aInvalidationsParts[0]); } void ScTiledRenderingTest::testInsertDeletePageInvalidation() @@ -1729,7 +1736,7 @@ void ScTiledRenderingTest::testInsertDeletePageInvalidation() comphelper::dispatchCommand(".uno:Insert", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(8), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(size_t(6), aView1.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); CPPUNIT_ASSERT_EQUAL(2, pModelObj->getParts()); diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 3ece4d760efb..9d611736f1bb 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -327,8 +327,14 @@ void ScTabView::TabChanged( bool bSameTabButMoved ) ss << aDocSize.Width() << ", " << aDocSize.Height(); OString sRect = ss.str().c_str(); ScTabViewShell* pViewShell = aViewData.GetViewShell(); + + // Invalidate first + tools::Rectangle aRectangle(0, 0, 1000000000, 1000000000); + OString sPayload = aRectangle.toString() + OString(", ") + OString::number(aViewData.GetTabNo()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sPayload.getStr()); + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument()); - SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel, false); } } } commit e9620868f652d8b81b648994287468b2d575606e Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sun Sep 22 13:21:46 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:40 2019 +0200 sd lok: Test invalidation after adding\removing slide Change-Id: I4677d78b1bfad36a7b3bde4651b9900e617b6422 diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 80d77b9fd04e..9422355835b2 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -121,6 +121,7 @@ public: void testCutSelectionChange(); void testRegenerateDiagram(); void testLanguageAllText(); + void testInsertDeletePageInvalidation(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testCreateDestroy); @@ -171,6 +172,7 @@ public: CPPUNIT_TEST(testCutSelectionChange); CPPUNIT_TEST(testRegenerateDiagram); CPPUNIT_TEST(testLanguageAllText); + CPPUNIT_TEST(testInsertDeletePageInvalidation); CPPUNIT_TEST_SUITE_END(); @@ -972,6 +974,7 @@ public: bool m_bCursorVisibleChanged; bool m_bViewLock; bool m_bTilesInvalidated; + std::vector<tools::Rectangle> m_aInvalidations; std::map<int, bool> m_aViewCursorInvalidations; std::map<int, bool> m_aViewCursorVisibilities; bool m_bViewSelectionSet; @@ -1009,6 +1012,18 @@ public: case LOK_CALLBACK_INVALIDATE_TILES: { m_bTilesInvalidated = true; + OString text(pPayload); + if (!text.startsWith("EMPTY")) + { + uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); + CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); + 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); + } } break; case LOK_CALLBACK_GRAPHIC_SELECTION: @@ -2271,6 +2286,33 @@ void SdTiledRenderingTest::testRegenerateDiagram() CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), pActualPage->GetObj(0)->GetSubList()->GetObjCount()); } +void SdTiledRenderingTest::testInsertDeletePageInvalidation() +{ + // Load the document. + comphelper::LibreOfficeKit::setActive(); + SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp"); + ViewCallback aView1; + CPPUNIT_ASSERT_EQUAL(8, pXImpressDocument->getParts()); + + // Insert slide + aView1.m_bTilesInvalidated = false; + aView1.m_aInvalidations.clear(); + comphelper::dispatchCommand(".uno:InsertPage", uno::Sequence<beans::PropertyValue>()); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(aView1.m_bTilesInvalidated); + CPPUNIT_ASSERT_EQUAL(9, pXImpressDocument->getParts()); + CPPUNIT_ASSERT_EQUAL(size_t(9), aView1.m_aInvalidations.size()); + + // Delete slide + aView1.m_bTilesInvalidated = false; + aView1.m_aInvalidations.clear(); + comphelper::dispatchCommand(".uno:DeletePage", uno::Sequence<beans::PropertyValue>()); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(aView1.m_bTilesInvalidated); + CPPUNIT_ASSERT_EQUAL(8, pXImpressDocument->getParts()); + CPPUNIT_ASSERT_EQUAL(size_t(8), aView1.m_aInvalidations.size()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); commit c0c09475abc25d43c5915071d65badec026b26b9 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sun Sep 22 13:20:49 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:40 2019 +0200 lok: deduplicate code related to notifyDocumentSizeChanged() call Change-Id: Ia4cef7b23fc682ec32aeb9be4dcdd582464c64e9 co-author: Michael Meeks <michael.me...@collabora.com> diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index cae234e6a164..4973fba83e19 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -49,6 +49,8 @@ public: 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_DOCUMENT_SIZE_CHANGED for all views - if @bInvalidateAll - first invalidates all parts + static void notifyDocumentSizeChangedAllViews(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/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 81cdc056daf1..e94d0b4f0db5 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -584,13 +584,8 @@ bool ScDocument::InsertTab( if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer()) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument()); - SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(this->GetDocumentShell()->GetModel()); + SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel); } } @@ -755,13 +750,8 @@ bool ScDocument::DeleteTab( SCTAB nTab ) if (comphelper::LibreOfficeKit::isActive()) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument()); - SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(this->GetDocumentShell()->GetModel()); + SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel); } bValid = true; @@ -852,13 +842,8 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets ) if (comphelper::LibreOfficeKit::isActive()) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument()); - SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(this->GetDocumentShell()->GetModel()); + SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel); } bValid = true; @@ -904,13 +889,8 @@ bool ScDocument::RenameTab( SCTAB nTab, const OUString& rName, bool bExternalDoc if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer()) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument()); - SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(this->GetDocumentShell()->GetModel()); + SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel); } } } diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index c9267f436ebe..cf0fecf46fd6 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -172,13 +172,8 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa // the document size too - cell size affects that, obviously) if ((nPart & (PaintPartFlags::Top | PaintPartFlags::Left)) && comphelper::LibreOfficeKit::isActive()) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument()); - SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(this->GetModel()); + SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel); } } diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index 8bde30f2380e..5fdde48063c3 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -398,13 +398,8 @@ void SdDrawDocument::InsertPage(SdrPage* pPage, sal_uInt16 nPos) if (comphelper::LibreOfficeKit::isActive() && static_cast<SdPage*>(pPage)->GetPageKind() == PageKind::Standard) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - SdXImpressDocument* pModel = comphelper::getUnoTunnelImplementation<SdXImpressDocument>(this->getUnoModel()); - SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + SdXImpressDocument* pDoc = comphelper::getUnoTunnelImplementation<SdXImpressDocument>(this->getUnoModel()); + SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc); } } @@ -432,13 +427,8 @@ SdrPage* SdDrawDocument::RemovePage(sal_uInt16 nPgNum) if (comphelper::LibreOfficeKit::isActive() && static_cast<SdPage*>(pPage)->GetPageKind() == PageKind::Standard) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - SdXImpressDocument* pModel = comphelper::getUnoTunnelImplementation<SdXImpressDocument>(this->getUnoModel()); - SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + SdXImpressDocument* pDoc = comphelper::getUnoTunnelImplementation<SdXImpressDocument>(this->getUnoModel()); + SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc); } return pPage; diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index 493c1984ed25..550fc741bf3c 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -1009,11 +1009,10 @@ IMPL_LINK_NOARG(SlideBackground, PaperSizeModifyHdl, ListBox&, void) if (comphelper::LibreOfficeKit::isActive()) { SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) + if (pViewShell) { - SdXImpressDocument* pModel = comphelper::getUnoTunnelImplementation<SdXImpressDocument>(pViewShell->GetCurrentDocument()); - SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); - pViewShell = SfxViewShell::GetNext(*pViewShell); + SdXImpressDocument* pDoc = comphelper::getUnoTunnelImplementation<SdXImpressDocument>(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc); } } } diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 60ff1e0fba1e..5aa3316c4c3f 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -242,6 +242,19 @@ void SfxLokHelper::notifyDocumentSizeChanged(SfxViewShell const* pThisView, cons pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, rPayload.getStr()); } +void SfxLokHelper::notifyDocumentSizeChangedAllViews(vcl::ITiledRenderable* pDoc, bool bInvalidateAll) +{ + if (!comphelper::LibreOfficeKit::isActive()) + return; + + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) + { + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pDoc, bInvalidateAll); + pViewShell = SfxViewShell::GetNext(*pViewShell); + } +} + void SfxLokHelper::notifyVisCursorInvalidation(OutlinerViewShell const* pThisView, const OString& rRectangle) { OString sPayload; commit c17b06fe0f1805b8cb3266483f38899b41bd734b Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sat Sep 21 16:44:32 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:40 2019 +0200 sc lok: Optimize invalidation triggered by ScTabView::SetCursor() method Don't call a full invalidation, rather use invalidation only on the new area. Make sure that the invalidation is called first. Change-Id: Ibdcc71a81f852acbd40a710204540ebd8df77907 diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index a2f3e800f72e..59700cfccc9c 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1809,9 +1809,8 @@ void ScTiledRenderingTest::testJumpHorizontallyInvalidation() pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD2); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 39525, 13005), aView1.m_aInvalidations[1]); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 39525, 13005), aView1.m_aInvalidations[0]); } void ScTiledRenderingTest::testJumpToLastRowInvalidation() @@ -1833,9 +1832,8 @@ void ScTiledRenderingTest::testJumpToLastRowInvalidation() pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DOWN | KEY_MOD1); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 26775, 127500255), aView1.m_aInvalidations[1]); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 26775, 127500255), aView1.m_aInvalidations[0]); } } diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index c5228c7ab0a7..91d4a93ef3f6 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -399,14 +399,6 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) if (pDocSh) { - // Provide size in the payload, so clients don't have to - // call lok::Document::getDocumentSize(). - std::stringstream ss; - ss << aNewSize.Width() << ", " << aNewSize.Height(); - OString sSize = ss.str().c_str(); - ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(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 tools::Rectangle aNewColArea(aOldSize.getWidth(), 0, aNewSize.getWidth(), aNewSize.getHeight()); @@ -425,6 +417,14 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) { SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewRowArea.toString()); } + + // Provide size in the payload, so clients don't have to + // call lok::Document::getDocumentSize(). + std::stringstream ss; + ss << aNewSize.Width() << ", " << aNewSize.Height(); + OString sSize = ss.str().c_str(); + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false); } } } commit b1a36b269aa8d0c018a6388fcd5d03bd8d8ac5c3 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sat Sep 21 16:39:46 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:40 2019 +0200 sc lok: Test invalidation triggered by jumping to the last row in the sheet Change-Id: I27e9a1cea465fab2c129754b2ebba978919c2bca diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index acd017773b54..a2f3e800f72e 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -104,6 +104,7 @@ public: void testInsertDeletePageInvalidation(); void testGetRowColumnHeadersInvalidation(); void testJumpHorizontallyInvalidation(); + void testJumpToLastRowInvalidation(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -143,6 +144,7 @@ public: CPPUNIT_TEST(testInsertDeletePageInvalidation); CPPUNIT_TEST(testGetRowColumnHeadersInvalidation); CPPUNIT_TEST(testJumpHorizontallyInvalidation); + CPPUNIT_TEST(testJumpToLastRowInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -1812,6 +1814,30 @@ void ScTiledRenderingTest::testJumpHorizontallyInvalidation() CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 39525, 13005), aView1.m_aInvalidations[1]); } +void ScTiledRenderingTest::testJumpToLastRowInvalidation() +{ + comphelper::LibreOfficeKit::setActive(); + + ScModelObj* pModelObj = createDoc("empty.ods"); + ScViewData* pViewData = ScDocShell::GetViewData(); + CPPUNIT_ASSERT(pViewData); + + int nView1 = SfxLokHelper::getView(); + ViewCallback aView1; + CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData)); + + SfxLokHelper::setView(nView1); + aView1.m_bInvalidateTiles = false; + aView1.m_aInvalidations.clear(); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DOWN | KEY_MOD1); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DOWN | KEY_MOD1); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); + CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 26775, 127500255), aView1.m_aInvalidations[1]); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); commit f1f804a426227550e4f01b19dd22691c4e8d214a Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sat Sep 21 16:13:14 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:40 2019 +0200 sc lok: Test invalidation triggered by jumping horizontally in the sheet Change-Id: Ia3d3b3f3020151939b8fb1cf48635303dc49892e diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 35e61c791db6..acd017773b54 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -103,6 +103,7 @@ public: void testSheetChangeInvalidation(); void testInsertDeletePageInvalidation(); void testGetRowColumnHeadersInvalidation(); + void testJumpHorizontallyInvalidation(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -141,6 +142,7 @@ public: CPPUNIT_TEST(testSheetChangeInvalidation); CPPUNIT_TEST(testInsertDeletePageInvalidation); CPPUNIT_TEST(testGetRowColumnHeadersInvalidation); + CPPUNIT_TEST(testJumpHorizontallyInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -1783,6 +1785,33 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation() CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[0]); } +void ScTiledRenderingTest::testJumpHorizontallyInvalidation() +{ + comphelper::LibreOfficeKit::setActive(); + + ScModelObj* pModelObj = createDoc("empty.ods"); + ScViewData* pViewData = ScDocShell::GetViewData(); + CPPUNIT_ASSERT(pViewData); + + int nView1 = SfxLokHelper::getView(); + ViewCallback aView1; + CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData)); + + SfxLokHelper::setView(nView1); + aView1.m_bInvalidateTiles = false; + aView1.m_aInvalidations.clear(); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD2); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD2); + Scheduler::ProcessEventsToIdle(); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD2); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD2); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); + CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 39525, 13005), aView1.m_aInvalidations[1]); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); commit fe2904e09c403d9e1bd1cd9d9ab1fe76e9834b69 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sat Sep 21 15:48:44 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:40 2019 +0200 sc lok: Optimize invalidation triggered by getRowColumnHeaders() method Don't call a full invalidation, rather use invalidation only on the new area. Make sure that the invalidation is called first. Change-Id: I89d1c6342ed8e95fe738a876a76ca6feda031962 diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index a22cca344966..35e61c791db6 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1761,9 +1761,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation() pModelObj->getRowColumnHeaders(tools::Rectangle(0, 15, 19650, 5400)); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[1]); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[0]); // Extend area top-to-bottom aView1.m_bInvalidateTiles = false; @@ -1771,9 +1770,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation() pModelObj->getRowColumnHeaders(tools::Rectangle(0, 5400, 19650, 9800)); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[1]); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[0]); // Extend area left-to-right aView1.m_bInvalidateTiles = false; @@ -1781,9 +1779,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation() pModelObj->getRowColumnHeaders(tools::Rectangle(5400, 5400, 25050, 9800)); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[1]); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[0]); } } diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 5116fd17e6fc..8e83b17ed267 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2555,14 +2555,6 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) SAL_INFO("sc.lok.header", "Row Header: a new height: " << aNewSize.Height()); if (pDocSh) { - // Provide size in the payload, so clients don't have to - // call lok::Document::getDocumentSize(). - std::stringstream ss; - ss << aNewSize.Width() << ", " << aNewSize.Height(); - OString sSize = ss.str().c_str(); - ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(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 tools::Rectangle aNewRowArea(0, aOldSize.getHeight(), aOldSize.getWidth(), aNewSize.getHeight()); @@ -2573,6 +2565,14 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) UpdateSelectionOverlay(); SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewRowArea.toString()); } + + // Provide size in the payload, so clients don't have to + // call lok::Document::getDocumentSize(). + std::stringstream ss; + ss << aNewSize.Width() << ", " << aNewSize.Height(); + OString sSize = ss.str().c_str(); + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false); } } @@ -2697,17 +2697,6 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) if (pDocSh) { - if (aOldSize != aNewSize) - { - // Provide size in the payload, so clients don't have to - // call lok::Document::getDocumentSize(). - std::stringstream ss; - ss << aNewSize.Width() << ", " << aNewSize.Height(); - OString sSize = ss.str().c_str(); - ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(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 tools::Rectangle aNewColArea(aOldSize.getWidth(), 0, aNewSize.getWidth(), aNewSize.getHeight()); @@ -2718,6 +2707,17 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) UpdateSelectionOverlay(); SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewColArea.toString()); } + + if (aOldSize != aNewSize) + { + // Provide size in the payload, so clients don't have to + // call lok::Document::getDocumentSize(). + std::stringstream ss; + ss << aNewSize.Width() << ", " << aNewSize.Height(); + OString sSize = ss.str().c_str(); + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false); + } } } commit 5fc64a88f9a7e42a4ba4727231b6444fa9cee9c0 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sat Sep 21 15:46:38 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:40 2019 +0200 sc lok: Test invalidation triggered by getRowColumnHeaders() method Change-Id: Ie9961688333b3ddd10562d62606dfe01b173534d diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 5c6d74541c81..a22cca344966 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -102,6 +102,7 @@ public: void testPageDownInvalidation(); void testSheetChangeInvalidation(); void testInsertDeletePageInvalidation(); + void testGetRowColumnHeadersInvalidation(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -139,6 +140,7 @@ public: CPPUNIT_TEST(testPageDownInvalidation); CPPUNIT_TEST(testSheetChangeInvalidation); CPPUNIT_TEST(testInsertDeletePageInvalidation); + CPPUNIT_TEST(testGetRowColumnHeadersInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -1741,6 +1743,49 @@ void ScTiledRenderingTest::testInsertDeletePageInvalidation() CPPUNIT_ASSERT_EQUAL(1, pModelObj->getParts()); } +void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation() +{ + comphelper::LibreOfficeKit::setActive(); + + ScModelObj* pModelObj = createDoc("empty.ods"); + ScViewData* pViewData = ScDocShell::GetViewData(); + CPPUNIT_ASSERT(pViewData); + + int nView1 = SfxLokHelper::getView(); + ViewCallback aView1; + CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData)); + + SfxLokHelper::setView(nView1); + aView1.m_bInvalidateTiles = false; + aView1.m_aInvalidations.clear(); + pModelObj->getRowColumnHeaders(tools::Rectangle(0, 15, 19650, 5400)); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); + CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[1]); + + // Extend area top-to-bottom + aView1.m_bInvalidateTiles = false; + aView1.m_aInvalidations.clear(); + pModelObj->getRowColumnHeaders(tools::Rectangle(0, 5400, 19650, 9800)); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); + CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[1]); + + // Extend area left-to-right + aView1.m_bInvalidateTiles = false; + aView1.m_aInvalidations.clear(); + pModelObj->getRowColumnHeaders(tools::Rectangle(5400, 5400, 25050, 9800)); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); + CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[1]); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); commit bd20bb08c9ad8a3ea66a4c85b00b6c9697e2626e Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Tue Sep 17 17:58:26 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:40 2019 +0200 sc lok: Test invalidation after adding\removing sheet Change-Id: Id69f19a1170c04faae800b5ae7678ffe243263d6 diff --git a/sc/qa/unit/tiledrendering/data/insert_delete_sheet.ods b/sc/qa/unit/tiledrendering/data/insert_delete_sheet.ods new file mode 100644 index 000000000000..b0ee4e005e48 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/insert_delete_sheet.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 000050262011..5c6d74541c81 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -101,6 +101,7 @@ public: void testInvalidationLoop(); void testPageDownInvalidation(); void testSheetChangeInvalidation(); + void testInsertDeletePageInvalidation(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -137,6 +138,7 @@ public: CPPUNIT_TEST(testInvalidationLoop); CPPUNIT_TEST(testPageDownInvalidation); CPPUNIT_TEST(testSheetChangeInvalidation); + CPPUNIT_TEST(testInsertDeletePageInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -1696,6 +1698,49 @@ void ScTiledRenderingTest::testSheetChangeInvalidation() CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310720, 268435456), aView1.m_aInvalidations[0]); } +void ScTiledRenderingTest::testInsertDeletePageInvalidation() +{ + comphelper::LibreOfficeKit::setActive(); + + ScModelObj* pModelObj = createDoc("insert_delete_sheet.ods"); + // the document has 1 sheet + CPPUNIT_ASSERT_EQUAL(1, pModelObj->getParts()); + ScViewData* pViewData = ScDocShell::GetViewData(); + CPPUNIT_ASSERT(pViewData); + + int nView1 = SfxLokHelper::getView(); + ViewCallback aView1; + CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData)); + + SfxLokHelper::setView(nView1); + aView1.m_bInvalidateTiles = false; + aView1.m_aInvalidations.clear(); + + uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({ + { "Name", uno::Any(OUString("")) }, + { "Index", uno::Any(sal_Int32(1)) } + })); + comphelper::dispatchCommand(".uno:Insert", aArgs); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); + CPPUNIT_ASSERT_EQUAL(size_t(8), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); + CPPUNIT_ASSERT_EQUAL(2, pModelObj->getParts()); + + // Delete sheet + aView1.m_bInvalidateTiles = false; + aView1.m_aInvalidations.clear(); + uno::Sequence<beans::PropertyValue> aArgs2( comphelper::InitPropertySequence({ + { "Index", uno::Any(sal_Int32(1)) } + })); + comphelper::dispatchCommand(".uno:Remove", aArgs2); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); + CPPUNIT_ASSERT_EQUAL(size_t(5), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); + CPPUNIT_ASSERT_EQUAL(1, pModelObj->getParts()); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); commit 668901e16b33426181316bf767aeca5488c26102 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sat Sep 14 13:22:45 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:40 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. Change-Id: Id0a8991016dbe8d13891071e2d5b4c9250720da9 co-author: Michael Meeks <michael.me...@collabora.com> diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 44bf83eab205..3839c6fa8e2e 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 b45a06b95766..cae234e6a164 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 <vcl/event.hxx> #include <sfx2/dllapi.h> #include <sfx2/viewsh.hxx> @@ -46,6 +47,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 29437d8e91b9..000050262011 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -527,7 +527,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()); @@ -1014,7 +1014,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 @@ -1031,7 +1031,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]); } @@ -1692,7 +1692,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 9e9a3f0a25c7..81cdc056daf1 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -98,6 +98,7 @@ #include <vcl/uitest/eventdescription.hxx> #include <mtvelements.hxx> +#include <sfx2/lokhelper.hxx> using ::editeng::SvxBorderLine; using namespace ::com::sun::star; @@ -586,7 +587,8 @@ bool ScDocument::InsertTab( SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); pViewShell = SfxViewShell::GetNext(*pViewShell); } } @@ -756,7 +758,8 @@ bool ScDocument::DeleteTab( SCTAB nTab ) SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); pViewShell = SfxViewShell::GetNext(*pViewShell); } } @@ -852,7 +855,8 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets ) SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); pViewShell = SfxViewShell::GetNext(*pViewShell); } } @@ -903,7 +907,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 = comphelper::getUnoTunnelImplementation<ScModelObj>(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 bd648ada28cb..c9267f436ebe 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -69,6 +69,7 @@ #include <comphelper/lok.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <sfx2/lokhelper.hxx> // Redraw - Notifications @@ -174,7 +175,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 = comphelper::getUnoTunnelImplementation<ScModelObj>(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 0005a3b2da07..5116fd17e6fc 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2560,7 +2560,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 = comphelper::getUnoTunnelImplementation<ScModelObj>(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 @@ -2703,8 +2704,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 = comphelper::getUnoTunnelImplementation<ScModelObj>(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 f9dbc14bbd76..c5228c7ab0a7 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -404,7 +404,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 = comphelper::getUnoTunnelImplementation<ScModelObj>(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 84afe610ff35..3ece4d760efb 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -327,7 +327,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 = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel); } } } diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index e5783a1731b3..80d77b9fd04e 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -262,7 +262,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 b7c1ae455d42..8bde30f2380e 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -53,6 +53,8 @@ #include <stlpool.hxx> #include <anminfo.hxx> #include <undo/undomanager.hxx> +#include <sfx2/lokhelper.hxx> +#include <unomodel.hxx> #include <DrawDocShell.hxx> @@ -399,7 +401,8 @@ void SdDrawDocument::InsertPage(SdrPage* pPage, sal_uInt16 nPos) SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + SdXImpressDocument* pModel = comphelper::getUnoTunnelImplementation<SdXImpressDocument>(this->getUnoModel()); + SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel); pViewShell = SfxViewShell::GetNext(*pViewShell); } } @@ -432,7 +435,8 @@ SdrPage* SdDrawDocument::RemovePage(sal_uInt16 nPgNum) SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + SdXImpressDocument* pModel = comphelper::getUnoTunnelImplementation<SdXImpressDocument>(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 066a6c6f8a90..493c1984ed25 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -57,6 +57,8 @@ #include <editeng/sizeitem.hxx> #include <comphelper/lok.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <unomodel.hxx> +#include <sfx2/lokhelper.hxx> using namespace ::com::sun::star; @@ -1009,7 +1011,8 @@ IMPL_LINK_NOARG(SlideBackground, PaperSizeModifyHdl, ListBox&, void) SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + SdXImpressDocument* pModel = comphelper::getUnoTunnelImplementation<SdXImpressDocument>(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 55b157ef6cb2..60ff1e0fba1e 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -222,6 +222,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 b7d7c5d2bd28..35eca8185934 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -264,7 +264,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 e20d7de4a4a1..6ec563446366 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -74,6 +74,7 @@ #include <wrtsh.hxx> #include <DocumentSettingManager.hxx> +#include <unotxdoc.hxx> #include <view.hxx> #include <PostItMgr.hxx> #include <unotools/configmgr.hxx> @@ -85,6 +86,7 @@ #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <comphelper/lok.hxx> #include <prevwpage.hxx> +#include <sfx2/lokhelper.hxx> #if !HAVE_FEATURE_DESKTOP #include <vcl/sysdata.hxx> @@ -1065,7 +1067,9 @@ 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()); + + SwXTextDocument* pModel = comphelper::getUnoTunnelImplementation<SwXTextDocument>(GetSfxViewShell()->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(GetSfxViewShell(), sSize, pModel); } } } commit c5e58c1703ea397ed20816e4dfd21ad197eb68fd Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Sep 13 19:35:40 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:39 2019 +0200 sc lok tests: Store all invalidation rectangles. Change-Id: I214a98d1901af0d0c25897ebfbdb644e92714f5c diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 93f683ffc985..29437d8e91b9 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; @@ -526,15 +526,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; } } @@ -1011,11 +1010,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) @@ -1027,11 +1027,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() @@ -1663,12 +1664,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() @@ -1685,12 +1687,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]); } } commit 6962aedee0fc245ad5a4fc2c277e6b1abe8ac6e4 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Sep 13 17:44:36 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:39 2019 +0200 sc lok: Test invalidation after sheet change Change-Id: I799089fc65d92fe72d7e76afbcd44bd4161d25f4 diff --git a/sc/qa/unit/tiledrendering/data/two_sheets.ods b/sc/qa/unit/tiledrendering/data/two_sheets.ods new file mode 100644 index 000000000000..6aa1d03be62c Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/two_sheets.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 9f1c0435108b..93f683ffc985 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -100,6 +100,7 @@ public: void testVbaRangeCopyPaste(); void testInvalidationLoop(); void testPageDownInvalidation(); + void testSheetChangeInvalidation(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -135,6 +136,7 @@ public: CPPUNIT_TEST(testVbaRangeCopyPaste); CPPUNIT_TEST(testInvalidationLoop); CPPUNIT_TEST(testPageDownInvalidation); + CPPUNIT_TEST(testSheetChangeInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -1669,6 +1671,28 @@ void ScTiledRenderingTest::testPageDownInvalidation() CPPUNIT_ASSERT_EQUAL(tools::Rectangle(15, 15, 1230, 225), aView1.m_aInvalidation); } +void ScTiledRenderingTest::testSheetChangeInvalidation() +{ + comphelper::LibreOfficeKit::setActive(); + + ScModelObj* pModelObj = createDoc("two_sheets.ods"); + ScViewData* pViewData = ScDocShell::GetViewData(); + CPPUNIT_ASSERT(pViewData); + + int nView1 = SfxLokHelper::getView(); + ViewCallback aView1; + CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData)); + + SfxLokHelper::setView(nView1); + aView1.m_bInvalidateTiles = false; + aView1.m_aInvalidation = tools::Rectangle(); + 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_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); commit d14218297ee9fe38512f3ce5f83b4a1363e22d0d Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Sep 13 17:19:57 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:39 2019 +0200 sc lok: Test also the invalidation rectangle in case of row/column insertion Change-Id: I5dffc0521ae7ef3ddd47574a85457ddcec2a0566 diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 9cb36f2d6133..9f1c0435108b 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1009,9 +1009,11 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() // insert row aView.m_bInvalidateTiles = false; + aView.m_aInvalidation = tools::Rectangle(); comphelper::dispatchCommand(".uno:InsertRows", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 50985, 32212230, 63990), aView.m_aInvalidation); // move on the right for (int i = 0; i < 200; ++i) @@ -1023,9 +1025,11 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() // insert column aView.m_bInvalidateTiles = false; + aView.m_aInvalidation = tools::Rectangle(); comphelper::dispatchCommand(".uno:InsertColumns", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(253650, -15, 32212230, 63990), aView.m_aInvalidation); } void ScTiledRenderingTest::testCommentCallback() commit ca3a1ece7e7862d55f24830d6172e58fea53ed6c Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Sep 13 15:59:54 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue Sep 24 19:43:39 2019 +0200 sc lok: Add unit test about inalidation triggered by PageDown Change-Id: Id54a679b60e440f17371a3a532928bd161077e90 diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 3a6e91ab9c51..9cb36f2d6133 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -37,6 +37,7 @@ #include <vcl/virdev.hxx> #include <vcl/unohelp2.hxx> #include <sc.hrc> +#include <comphelper/string.hxx> #include <chrono> #include <cstddef> @@ -98,6 +99,7 @@ public: void testFilterDlg(); void testVbaRangeCopyPaste(); void testInvalidationLoop(); + void testPageDownInvalidation(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -132,6 +134,7 @@ public: CPPUNIT_TEST(testFilterDlg); CPPUNIT_TEST(testVbaRangeCopyPaste); CPPUNIT_TEST(testInvalidationLoop); + CPPUNIT_TEST(testPageDownInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -439,6 +442,7 @@ public: bool m_bGraphicViewSelection; bool m_bFullInvalidateTiles; bool m_bInvalidateTiles; + tools::Rectangle m_aInvalidation; bool m_bViewLock; OString m_sCellFormula; boost::property_tree::ptree m_aCommentCallbackResult; @@ -520,6 +524,15 @@ 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()); + } m_bInvalidateTiles = true; } } @@ -1630,6 +1643,28 @@ void ScTiledRenderingTest::testInvalidationLoop() Scheduler::ProcessEventsToIdle(); } +void ScTiledRenderingTest::testPageDownInvalidation() +{ + comphelper::LibreOfficeKit::setActive(); + + ScModelObj* pModelObj = createDoc("empty.ods"); + ScViewData* pViewData = ScDocShell::GetViewData(); + CPPUNIT_ASSERT(pViewData); + + int nView1 = SfxLokHelper::getView(); + ViewCallback aView1; + CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData)); + + SfxLokHelper::setView(nView1); + aView1.m_bInvalidateTiles = false; + aView1.m_aInvalidation = tools::Rectangle(); + 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_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); commit a5698f1a0fb8bf8775f1a098ae9ee09de968d632 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Sep 24 17:04:21 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Sep 24 18:45:40 2019 +0200 Related: tdf#124600 sw anchored object allow overlap: add ODT filter Expose the AllowOverlap shape property as <style:graphic-properties loext:allow-overlap="..."/>. Change-Id: I6b6e08c67224ac7d4fb87046ea8accf94cdb583f Reviewed-on: https://gerrit.libreoffice.org/79462 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 098dc30fecad..3276d0b8b9c2 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -2494,6 +2494,7 @@ namespace xmloff { namespace token { // Tokens have been renamed and <XML_ITERATIVE> has been added (#i35017#) XML_ONCE_SUCCESSIVE, XML_ONCE_CONCURRENT, + XML_ALLOW_OVERLAP, // Names for OOo format only XML_N_OFFICE_OOO, diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng index a8b2b55ef20f..089152aaf23b 100644 --- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng +++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng @@ -914,6 +914,12 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. <rng:ref name="nonNegativeInteger"/> </rng:attribute> </rng:optional> + <!-- TODO no proposal --> + <rng:optional> + <rng:attribute name="loext:allow-overlap"> + <rng:ref name="boolean"/> + </rng:attribute> + </rng:optional> </rng:interleave> </rng:define> diff --git a/sw/qa/extras/odfexport/data/allow-overlap.odt b/sw/qa/extras/odfexport/data/allow-overlap.odt new file mode 100644 index 000000000000..b23f5b360b85 Binary files /dev/null and b/sw/qa/extras/odfexport/data/allow-overlap.odt differ diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 3d4d0e245451..93f38ca440c1 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -2093,6 +2093,17 @@ DECLARE_ODFEXPORT_TEST(testRubyPosition, "ruby-position.odt") } } +DECLARE_ODFEXPORT_TEST(testAllowOverlap, "allow-overlap.odt") +{ + uno::Reference<drawing::XShape> xShape = getShape(1); + // Without the accompanying fix in place, this test would have failed with: + // - Expression: !getProperty<bool>(xShape, "AllowOverlap") + // i.e. the custom AllowOverlap=false shape property was lost on import/export. + CPPUNIT_ASSERT(!getProperty<bool>(xShape, "AllowOverlap")); + xShape = getShape(2); + CPPUNIT_ASSERT(!getProperty<bool>(xShape, "AllowOverlap")); +} + DECLARE_ODFEXPORT_TEST(testSignatureLineProperties, "signatureline-properties.fodt") { uno::Reference<drawing::XShape> xShape = getShape(1); diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 5ce4b8d8f1a5..1063b9ee7791 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -2494,6 +2494,7 @@ namespace xmloff { namespace token { // Tokens have been renamed and <XML_ITERATIVE> has been added (#i35017#) TOKEN( "once-successive", XML_ONCE_SUCCESSIVE ), TOKEN( "once-concurrent", XML_ONCE_CONCURRENT ), + TOKEN( "allow-overlap", XML_ALLOW_OVERLAP ), // Names for OOo format only TOKEN( "http://openoffice.org/2000/office", XML_N_OFFICE_OOO ), diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 2cd5005dfc64..0136cfee7fce 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -856,6 +856,7 @@ XMLPropertyMapEntry const aXMLFramePropMap[] = MG_E( "IsFollowingTextFlow", STYLE, FLOW_WITH_TEXT, XML_TYPE_BOOL, 0 ), // #i28701# - RES_WRAP_INFLUENCE_ON_OBJPOS MG_E( "WrapInfluenceOnPosition", DRAW, WRAP_INFLUENCE_ON_POSITION, XML_TYPE_WRAP_INFLUENCE_ON_POSITION, 0 ), + MAP_EXT("AllowOverlap", XML_NAMESPACE_LO_EXT, XML_ALLOW_OVERLAP, XML_TYPE_BOOL|XML_TYPE_PROP_GRAPHIC, 0), // special entries for floating frames MG_E( "", DRAW, FRAME_DISPLAY_SCROLLBAR, XML_TYPE_BOOL|MID_FLAG_NO_PROPERTY|MID_FLAG_MULTI_PROPERTY, CTF_FRAME_DISPLAY_SCROLLBAR ), @@ -907,6 +908,7 @@ XMLPropertyMapEntry const aXMLShapePropMap[] = MG_E( "HoriOrientRelation", STYLE, HORIZONTAL_REL, XML_TYPE_TEXT_HORIZONTAL_REL_FRAME|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_SHAPE_HORIZONTALREL_FRAME ), // RES_WRAP_INFLUENCE_ON_OBJPOS (#i28701#) MG_ED( "WrapInfluenceOnPosition", DRAW, WRAP_INFLUENCE_ON_POSITION, XML_TYPE_WRAP_INFLUENCE_ON_POSITION, 0 ), + MAP_EXT("AllowOverlap", XML_NAMESPACE_LO_EXT, XML_ALLOW_OVERLAP, XML_TYPE_BOOL|XML_TYPE_PROP_GRAPHIC, 0), // UserDefinedAttributes is already contained in the map this one is // chained to. diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt index dbd6f59945b9..5bce19e510af 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -2356,6 +2356,7 @@ shrink-to-fit wrap-influence-on-position once-successive once-concurrent +allow-overlap N_OFFICE_OOO_DUMMY N_META_OOO_DUMMY N_STYLE_OOO_DUMMY commit 75923e132479b64320f78c6913e5d7241c69ad26 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Sep 24 12:03:39 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Sep 24 17:33:48 2019 +0200 drop SwTOXEntryTabPage::EventNotify Change-Id: If1bf562ad7e385b4faf0a32b02ac33c8095df8de Reviewed-on: https://gerrit.libreoffice.org/79454 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index dbaa2c0d2243..d8527538469b 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -2182,25 +2182,6 @@ void SwTOXEntryTabPage::SetFocus2theAllBtn() m_xAllLevelsPB->grab_focus(); } -bool SwTOXEntryTabPage::EventNotify( NotifyEvent& rNEvt ) -{ - if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) - { - const KeyEvent& rKEvt = *rNEvt.GetKeyEvent(); - vcl::KeyCode aCode = rKEvt.GetKeyCode(); - if ( (aCode.GetCode() == KEY_F4) && aCode.IsShift() && !aCode.IsMod1() && !aCode.IsMod2() ) - { - if (SwTOXWidget* pActiveControl = m_xTokenWIN->GetActiveControl()) - { - pActiveControl->GrabFocus(); - } - } - - } - - return SfxTabPage::EventNotify(rNEvt); -} - // This function initializes the default value in the Token // put here the UI dependent initializations IMPL_LINK(SwTOXEntryTabPage, InsertTokenHdl, weld::Button&, rBtn, void) diff --git a/sw/source/uibase/inc/swuicnttab.hxx b/sw/source/uibase/inc/swuicnttab.hxx index 84b90945e2ac..b3613020a1db 100644 --- a/sw/source/uibase/inc/swuicnttab.hxx +++ b/sw/source/uibase/inc/swuicnttab.hxx @@ -404,7 +404,6 @@ public: void PreTokenButtonRemoved(const SwFormToken& rToken); void SetFocus2theAllBtn(); - virtual bool EventNotify( NotifyEvent& rNEvt ) override; }; class SwTOXStylesTabPage : public SfxTabPage commit d61214b7a864fb5006f1efa579383f3cc1c5f9cd Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Sep 24 12:24:19 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Sep 24 17:23:43 2019 +0200 copy to clipboard without intermediate vcl::Window Change-Id: I36d26e583e08ef66564e232b54fa00a468a280c6 Reviewed-on: https://gerrit.libreoffice.org/79453 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index ca22e820f569..5fa49a106d6a 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -2088,7 +2088,7 @@ void OfaAutoCompleteTabPage::CopyToClipboard() const #endif } pCntnr->CopyByteString( SotClipboardFormatId::STRING, sData.makeStringAndClear() ); - pCntnr->CopyToClipboard( static_cast<vcl::Window*>(const_cast<OfaAutoCompleteTabPage *>(this)) ); + pCntnr->CopyToClipboard(GetSystemClipboard()); } } diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx index 3373f3e032a9..8d5e47548592 100644 --- a/include/vcl/transfer.hxx +++ b/include/vcl/transfer.hxx @@ -250,8 +250,13 @@ public: void PrepareOLE( const TransferableObjectDescriptor& rObjDesc ); + void CopyToClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard> &rClipboard) const; + void CopyToSelection(const css::uno::Reference<css::datatransfer::clipboard::XClipboard> &rClipboard) const; + + // convenience versions of the above which extract the XClipboard from the pWindow void CopyToClipboard( vcl::Window *pWindow ) const; void CopyToSelection( vcl::Window *pWindow ) const; + void StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions ); static void ClearSelection( vcl::Window *pWindow ); diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index f91f0aff0699..4415dc6fcf01 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -916,17 +916,10 @@ void TransferableHelper::PrepareOLE( const TransferableObjectDescriptor& rObjDes AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR ); } - -void TransferableHelper::CopyToClipboard( vcl::Window *pWindow ) const +void TransferableHelper::CopyToClipboard(const Reference<XClipboard>& rClipboard) const { - DBG_ASSERT( pWindow, "Window pointer is NULL" ); - Reference< XClipboard > xClipboard; - - if( pWindow ) - xClipboard = pWindow->GetClipboard(); - - if( xClipboard.is() ) - mxClipboard = xClipboard; + if( rClipboard.is() ) + mxClipboard = rClipboard; if( !(mxClipboard.is() && !mxTerminateListener.is()) ) return; @@ -945,16 +938,20 @@ void TransferableHelper::CopyToClipboard( vcl::Window *pWindow ) const } } - -void TransferableHelper::CopyToSelection( vcl::Window *pWindow ) const +void TransferableHelper::CopyToClipboard( vcl::Window *pWindow ) const { DBG_ASSERT( pWindow, "Window pointer is NULL" ); - Reference< XClipboard > xSelection; + Reference< XClipboard > xClipboard; if( pWindow ) - xSelection = pWindow->GetPrimarySelection(); + xClipboard = pWindow->GetClipboard(); + + CopyToClipboard(xClipboard); +} - if( !(xSelection.is() && !mxTerminateListener.is()) ) +void TransferableHelper::CopyToSelection(const Reference<XClipboard>& rSelection) const +{ + if( !(rSelection.is() && !mxTerminateListener.is()) ) return; try @@ -964,13 +961,23 @@ void TransferableHelper::CopyToSelection( vcl::Window *pWindow ) const Reference< XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); xDesktop->addTerminateListener( pThis->mxTerminateListener ); - xSelection->setContents( pThis, pThis ); + rSelection->setContents( pThis, pThis ); } catch( const css::uno::Exception& ) { } } +void TransferableHelper::CopyToSelection( vcl::Window *pWindow ) const +{ + DBG_ASSERT( pWindow, "Window pointer is NULL" ); + Reference< XClipboard > xSelection; + + if( pWindow ) + xSelection = pWindow->GetPrimarySelection(); + + CopyToSelection(xSelection); +} void TransferableHelper::StartDrag( vcl::Window* pWindow, sal_Int8 nDnDSourceActions ) commit 8eb8636e02d23c6d23bcdbd0257b095ea844fbed Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Sep 24 13:21:34 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Sep 24 17:12:12 2019 +0200 drop OGeneralPageWizard::GetFocus Change-Id: I0ad65590053460f23f1a6dcaace24d47dbbf39b1 Reviewed-on: https://gerrit.libreoffice.org/79457 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index 5fe9655c37e9..c703a2fdba8d 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -504,15 +504,6 @@ namespace dbaui return eOpenExisting; } - void OGeneralPageWizard::GetFocus() - { - OGeneralPage::GetFocus(); - if ( m_xLB_DocumentList && m_xLB_DocumentList->get_sensitive() ) - m_xLB_DocumentList->grab_focus(); - else if ( m_xDatasourceType && m_xDatasourceType->get_sensitive() ) - m_xDatasourceType->grab_focus(); - } - void OGeneralPageWizard::implInitControls( const SfxItemSet& _rSet, bool _bSaveValue ) { OGeneralPage::implInitControls( _rSet, _bSaveValue ); diff --git a/dbaccess/source/ui/dlg/generalpage.hxx b/dbaccess/source/ui/dlg/generalpage.hxx index 2b18c1c80ca9..4200b16483d2 100644 --- a/dbaccess/source/ui/dlg/generalpage.hxx +++ b/dbaccess/source/ui/dlg/generalpage.hxx @@ -162,8 +162,6 @@ namespace dbaui private: virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) override; - virtual void GetFocus() override; - virtual void implInitControls( const SfxItemSet& _rSet, bool _bSaveValue ) override; virtual OUString getDatasourceName( const SfxItemSet& _rSet ) override; virtual bool approveDatasourceType( ::dbaccess::DATASOURCE_TYPE eType, OUString& _inout_rDisplayName ) override; commit a53bad1909ba3571453f0e7281f4b435084e18f0 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Sep 24 10:34:34 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Sep 24 17:11:34 2019 +0200 get environment RTL mode without vcl::Window Change-Id: Iec6ffe6e5012b6853b4190f3172cbb9b0d0cc913 Reviewed-on: https://gerrit.libreoffice.org/79451 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index e5117feb6f02..9ab9b5261720 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -22,6 +22,7 @@ #include <svl/style.hxx> #include <sfx2/objsh.hxx> #include <vcl/mnemonic.hxx> +#include <vcl/settings.hxx> #include <svx/flagsdef.hxx> #include <svx/svxids.hrc> @@ -1307,7 +1308,7 @@ void SvxParaAlignTabPage::UpdateExample_Impl() { case SvxFrameDirection::Environment : if ( !m_xRight->get_active() ) - m_aExampleWin.EnableRTL( IsRTLEnabled() /*false*/ ); + m_aExampleWin.EnableRTL( AllSettings::GetLayoutRTL() ); break; case SvxFrameDirection::Horizontal_RL_TB : if ( !m_xLeft->get_active() ) commit 435023376b7f07c974fa348782cff058f60ceba3 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Sep 24 12:10:21 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Sep 24 17:11:09 2019 +0200 use GetDefDialogParent as an arbitrary parent for temp widget Change-Id: I7226481c7d501c88ac937760ba464b1b11260f7e Reviewed-on: https://gerrit.libreoffice.org/79452 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx index 1e19b0d0667f..7defa0a2b08e 100644 --- a/cui/source/tabpages/grfpage.cxx +++ b/cui/source/tabpages/grfpage.cxx @@ -33,6 +33,7 @@ #include <strings.hrc> #include <vcl/field.hxx> #include <vcl/settings.hxx> +#include <vcl/svapp.hxx> #include <svtools/unitconv.hxx> #define CM_1_TO_TWIP 567 @@ -631,7 +632,7 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound ) // display original size const FieldUnit eMetric = GetModuleFieldUnit( GetItemSet() ); - ScopedVclPtrInstance< MetricField > aFld(this, WB_HIDE); + ScopedVclPtrInstance< MetricField > aFld(Application::GetDefDialogParent(), WB_HIDE); SetFieldUnit( *aFld, eMetric ); aFld->SetDecimalDigits(m_xWidthMF->get_digits()); aFld->SetMax( LONG_MAX - 1 ); diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 9908ab6a8477..e1e42ba1ef64 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -18,6 +18,7 @@ */ #include <memory> +#include <vcl/svapp.hxx> #include <vcl/waitobj.hxx> #include <rtl/ustring.hxx> #include <sfx2/sfxsids.hrc> @@ -393,7 +394,7 @@ IMPL_LINK_NOARG(SwLabPage, TypeHdl, weld::ComboBox&, void) void SwLabPage::DisplayFormat() { - ScopedVclPtrInstance< MetricField > aField(this, WinBits(0)); + ScopedVclPtrInstance< MetricField > aField(Application::GetDefDialogParent(), WinBits(0)); FieldUnit aMetric = ::GetDfltMetric(false); SetMetric(*aField, aMetric); aField->SetDecimalDigits(2); commit 6f3c7c4506c1df1319bac2c1cc0899dda827f65f Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Sep 23 16:41:48 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Sep 24 16:32:13 2019 +0200 set correct parent Change-Id: I133cccc72896021c38f90efa3f9819fd5410d836 Reviewed-on: https://gerrit.libreoffice.org/79419 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 36cb6917599b..53fc71f2a69d 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -562,7 +562,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, SavePasswordHdl, weld::Button&, void) xMasterPasswd->removeMasterPassword(); uno::Reference<task::XInteractionHandler> xTmpHandler(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), - VCLUnoHelper::GetInterface(GetParentDialog()))); + GetDialogController()->getDialog()->GetXWindow())); if ( xMasterPasswd->changeMasterPassword(xTmpHandler) ) { @@ -580,7 +580,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, SavePasswordHdl, weld::Button&, void) } else { - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetDialogFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, m_sPasswordStoringDeactivateStr)); xQueryBox->set_default_response(RET_NO); @@ -620,7 +620,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordHdl, weld::Button&, void) if ( xMasterPasswd->isPersistentStoringAllowed() ) { uno::Reference<task::XInteractionHandler> xTmpHandler(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), - VCLUnoHelper::GetInterface(GetParentDialog()))); + GetDialogController()->getDialog()->GetXWindow())); xMasterPasswd->changeMasterPassword(xTmpHandler); } } @@ -636,7 +636,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MasterPasswordCBHdl, weld::Button&, void) task::PasswordContainer::create(comphelper::getProcessComponentContext())); uno::Reference<task::XInteractionHandler> xTmpHandler(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), - VCLUnoHelper::GetInterface(GetParentDialog()))); + GetDialogController()->getDialog()->GetXWindow())); if ( m_xMasterPasswordCB->get_active() ) { @@ -681,7 +681,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, ShowPasswordsHdl, weld::Button&, void) task::PasswordContainer::create(comphelper::getProcessComponentContext())); uno::Reference<task::XInteractionHandler> xTmpHandler(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), - VCLUnoHelper::GetInterface(GetParentDialog()))); + GetDialogController()->getDialog()->GetXWindow())); if ( xMasterPasswd->isPersistentStoringAllowed() && xMasterPasswd->authorizateWithMasterPassword(xTmpHandler) ) { @@ -723,7 +723,7 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, MacroSecPBHdl, weld::Button&, void) { Reference< security::XDocumentDigitalSignatures > xD( security::DocumentDigitalSignatures::createDefault(comphelper::getProcessComponentContext() ) ); - xD->setParentWindow(VCLUnoHelper::GetInterface(GetParentDialog())); + xD->setParentWindow(GetDialogController()->getDialog()->GetXWindow()); xD->manageTrustedSources(); } catch (const Exception&) @@ -945,7 +945,7 @@ IMPL_LINK_NOARG(SvxEMailTabPage, FileDialogHdl_Impl, weld::Button&, void) { if (!pImpl->bROProgram) { - FileDialogHelper aHelper(css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, GetFrameWeld()); + FileDialogHelper aHelper(css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, GetDialogFrameWeld()); OUString sPath = m_xMailerURLED->get_text(); if ( sPath.isEmpty() ) sPath = "/usr/bin"; diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 5f536acf4d37..676ce162a16b 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -298,9 +298,10 @@ IMPL_LINK( SvxJavaOptionsPage, DialogClosedHdl, DialogClosedEvent*, pEvt, void ) } } -IMPL_LINK_NOARG(SvxJavaOptionsPage, ExpertConfigHdl_Impl, weld::Button&, void) +IMPL_STATIC_LINK_NOARG(SvxJavaOptionsPage, ExpertConfigHdl_Impl, weld::Button&, void) { - ScopedVclPtrInstance<CuiAboutConfigTabPage> pExpertConfigDlg(GetParentDialog()); + //TODO weld this one too + ScopedVclPtrInstance<CuiAboutConfigTabPage> pExpertConfigDlg(nullptr); pExpertConfigDlg->Reset();//initialize and reset function if( RET_OK == pExpertConfigDlg->Execute() ) diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx index 6345c5a53120..ad84b0d1a17c 100644 --- a/cui/source/options/optjava.hxx +++ b/cui/source/options/optjava.hxx @@ -95,7 +95,7 @@ private: DECL_LINK(StartFolderPickerHdl, void *, void); DECL_LINK(DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void); - DECL_LINK(ExpertConfigHdl_Impl, weld::Button&, void); + DECL_STATIC_LINK(SvxJavaOptionsPage, ExpertConfigHdl_Impl, weld::Button&, void); void ClearJavaInfo(); void ClearJavaList(); diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 152117aaceb5..b66ef21e8332 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -3104,7 +3104,7 @@ void SvxCharTwoLinesPage::Initialize() void SvxCharTwoLinesPage::SelectCharacter(weld::TreeView* pBox) { bool bStart = pBox == m_xStartBracketLB.get(); - SvxCharacterMap aDlg(GetFrameWeld(), nullptr, nullptr); + SvxCharacterMap aDlg(GetDialogFrameWeld(), nullptr, nullptr); aDlg.DisableFontSelection(); if (aDlg.run() == RET_OK) diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index 58d4e8627475..f3df9bcec989 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -1256,7 +1256,7 @@ DeactivateRC SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet ) if ( ePaper != PAPER_SCREEN_4_3 && ePaper != PAPER_SCREEN_16_9 && ePaper != PAPER_SCREEN_16_10 && IsMarginOutOfRange() ) { - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetDialogFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, m_xPrintRangeQueryText->get_label())); xQueryBox->set_default_response(RET_NO); diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index deb1503f8743..e711b5fde586 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -1188,7 +1188,7 @@ IMPL_LINK_NOARG(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl, weld::Button&, void) ErrorHandler::GetErrorString(ERRCODE_IO_NOTSUPPORTED, msg); //TODO: handle failure std::unique_ptr<weld::MessageDialog>( Application::CreateMessageDialog( - GetFrameWeld(), VclMessageType::Error, VclButtonsType::Ok, msg)) + GetDialogFrameWeld(), VclMessageType::Error, VclButtonsType::Ok, msg)) ->run(); return; } diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx index f38ef51c443a..12833f3dd248 100644 --- a/sc/source/ui/optdlg/tpcalc.cxx +++ b/sc/source/ui/optdlg/tpcalc.cxx @@ -182,7 +182,7 @@ bool ScTpCalcOptions::FillItemSet( SfxItemSet* rCoreAttrs ) xBatch->commit(); SolarMutexGuard aGuard; if (svtools::executeRestartDialog( - comphelper::getProcessComponentContext(), GetFrameWeld(), + comphelper::getProcessComponentContext(), GetDialogFrameWeld(), svtools::RESTART_REASON_THREADING)) GetDialogController()->response(RET_OK); } @@ -208,7 +208,7 @@ DeactivateRC ScTpCalcOptions::DeactivatePage( SfxItemSet* pSetP ) if ( nReturn == DeactivateRC::KeepPage ) { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetDialogFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, ScResId(STR_INVALID_EPS))); xBox->run(); diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx index c948608ae76b..97ea25373814 100644 --- a/sc/source/ui/optdlg/tpformula.cxx +++ b/sc/source/ui/optdlg/tpformula.cxx @@ -114,7 +114,7 @@ void ScTpFormulaOptions::UpdateCustomCalcRadioButtons(bool bDefault) void ScTpFormulaOptions::LaunchCustomCalcSettings() { - ScCalcOptionsDialog aDlg(GetFrameWeld(), maCurrentConfig, maCurrentDocOptions.IsWriteCalcConfig()); + ScCalcOptionsDialog aDlg(GetDialogFrameWeld(), maCurrentConfig, maCurrentDocOptions.IsWriteCalcConfig()); if (aDlg.run() == RET_OK) { maCurrentConfig = aDlg.GetConfig(); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits