[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 2 commits - include/sfx2 sc/source sd/qa sd/source sfx2/source
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Sat Sep 28 01:33:50 UTC 2019
include/sfx2/lokhelper.hxx | 2 +
sc/source/core/data/document.cxx | 36 ++++------------------
sc/source/ui/docshell/docsh3.cxx | 9 +----
sd/qa/unit/tiledrendering/tiledrendering.cxx | 44 +++++++++++++++++++++++++++
sd/source/core/drawdoc2.cxx | 18 ++---------
sd/source/ui/sidebar/SlideBackground.cxx | 5 +--
sfx2/source/view/lokhelper.cxx | 13 +++++++
7 files changed, 75 insertions(+), 52 deletions(-)
New commits:
commit 39372e828d846fa2a6befe19b388595f159bc2fa
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Sep 27 19:38:57 2019 +0200
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Sat Sep 28 03:33:29 2019 +0200
sd lok: Test invalidation after adding\removing slide
Reviewed-on: https://gerrit.libreoffice.org/79499
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
(cherry picked from commit 2984856798d8ad98b96e6a57bfcc701bc52876e8)
Change-Id: I4677d78b1bfad36a7b3bde4651b9900e617b6422
Reviewed-on: https://gerrit.libreoffice.org/79625
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/79768
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 6ad6faa8c866..39bf8ed654c1 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -117,6 +117,7 @@ public:
void testTdf115873Group();
void testCutSelectionChange();
void testLanguageAllText();
+ void testInsertDeletePageInvalidation();
CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -164,6 +165,7 @@ public:
CPPUNIT_TEST(testTdf115873Group);
CPPUNIT_TEST(testCutSelectionChange);
CPPUNIT_TEST(testLanguageAllText);
+ CPPUNIT_TEST(testInsertDeletePageInvalidation);
CPPUNIT_TEST_SUITE_END();
@@ -966,6 +968,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;
@@ -994,6 +997,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:
@@ -2269,6 +2284,35 @@ void SdTiledRenderingTest::testCutSelectionChange()
comphelper::LibreOfficeKit::setActive(false);
}
+void SdTiledRenderingTest::testInsertDeletePageInvalidation()
+{
+ // Load the document.
+ comphelper::LibreOfficeKit::setActive();
+ SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &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());
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();
commit 06c87baac5c1e9414e3888adc0ec067d5c124d4a
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Sep 26 11:35:39 2019 +0200
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Sat Sep 28 03:33:14 2019 +0200
lok: deduplicate code related to notifyDocumentSizeChanged() call
co-author: Michael Meeks <michael.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/79498
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
(cherry picked from commit e9260633df07b6796b19bc92523671cb345597a1)
Change-Id: Ia4cef7b23fc682ec32aeb9be4dcdd582464c64e9
Reviewed-on: https://gerrit.libreoffice.org/79624
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/79767
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 8a5503d85c2c..2a7f36bfd9bc 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -51,6 +51,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 d7b973e88b4c..a2e149bc9a3d 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -592,13 +592,8 @@ bool ScDocument::InsertTab(
if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer())
{
- SfxViewShell* pViewShell = SfxViewShell::GetFirst();
- while (pViewShell)
- {
- ScModelObj* pModel = ScModelObj::getImplementation(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
+ ScModelObj* pModel = ScModelObj::getImplementation(this->GetDocumentShell()->GetModel());
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
}
@@ -772,13 +767,8 @@ bool ScDocument::DeleteTab( SCTAB nTab )
if (comphelper::LibreOfficeKit::isActive())
{
- SfxViewShell* pViewShell = SfxViewShell::GetFirst();
- while (pViewShell)
- {
- ScModelObj* pModel = ScModelObj::getImplementation(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
+ ScModelObj* pModel = ScModelObj::getImplementation(this->GetDocumentShell()->GetModel());
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
bValid = true;
@@ -882,13 +872,8 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets )
if (comphelper::LibreOfficeKit::isActive())
{
- SfxViewShell* pViewShell = SfxViewShell::GetFirst();
- while (pViewShell)
- {
- ScModelObj* pModel = ScModelObj::getImplementation(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
+ ScModelObj* pModel = ScModelObj::getImplementation(this->GetDocumentShell()->GetModel());
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
bValid = true;
@@ -934,13 +919,8 @@ bool ScDocument::RenameTab( SCTAB nTab, const OUString& rName, bool bExternalDoc
if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer())
{
- SfxViewShell* pViewShell = SfxViewShell::GetFirst();
- while (pViewShell)
- {
- ScModelObj* pModel = ScModelObj::getImplementation(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
+ ScModelObj* pModel = ScModelObj::getImplementation(this->GetDocumentShell()->GetModel());
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
}
}
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 70a43e3def5a..bdda87803ffe 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -168,13 +168,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 = ScModelObj::getImplementation(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
+ ScModelObj* pModel = ScModelObj::getImplementation(this->GetModel());
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
}
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 7aabcc7007c4..689db17d3181 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -412,13 +412,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 = SdXImpressDocument::getImplementation(this->getUnoModel());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
+ SdXImpressDocument* pModel = SdXImpressDocument::getImplementation(this->getUnoModel());
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
}
@@ -446,13 +441,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 = SdXImpressDocument::getImplementation(this->getUnoModel());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
- }
+ SdXImpressDocument* pModel = SdXImpressDocument::getImplementation(this->getUnoModel());
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
return pPage;
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index af300693ccb3..3bc0c739600a 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -1021,11 +1021,10 @@ IMPL_LINK_NOARG(SlideBackground, PaperSizeModifyHdl, ListBox&, void)
if (comphelper::LibreOfficeKit::isActive())
{
SfxViewShell* pViewShell = SfxViewShell::GetFirst();
- while (pViewShell)
+ if (pViewShell)
{
SdXImpressDocument* pModel = SdXImpressDocument::getImplementation(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, "", pModel);
- pViewShell = SfxViewShell::GetNext(*pViewShell);
+ SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
}
}
}
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 790227f8487c..8421ec1620c4 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -222,6 +222,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;
More information about the Libreoffice-commits
mailing list