summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2020-06-22 14:55:06 +0200
committerAndras Timar <andras.timar@collabora.com>2020-06-24 13:02:36 +0200
commitdc13c656dc25ed35c31bec7b6c8ae7d0c6b258e3 (patch)
treed98ca126110d596afb43990128828d786c1b3e1f
parentUpdate fontconfig to 2.13.91 (diff)
downloadcore-dc13c656dc25ed35c31bec7b6c8ae7d0c6b258e3.tar.gz
core-dc13c656dc25ed35c31bec7b6c8ae7d0c6b258e3.zip
lok: calc: messed up view when deleting from multiline content
To see the problem was enough to click on the cell with the multiline content (because of wrap text enabled), and press delete. Change-Id: I8288e7739c8513f5fa0bdee5f7eb414b4abac456 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96905 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sc/qa/unit/tiledrendering/data/multiline.odsbin0 -> 10413 bytes
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx42
-rw-r--r--sc/source/ui/docshell/docfunc.cxx17
3 files changed, 59 insertions, 0 deletions
diff --git a/sc/qa/unit/tiledrendering/data/multiline.ods b/sc/qa/unit/tiledrendering/data/multiline.ods
new file mode 100644
index 000000000000..847835690a5f
--- /dev/null
+++ b/sc/qa/unit/tiledrendering/data/multiline.ods
Binary files differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index b3b73fc03b0a..e35233cbc3f0 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -109,6 +109,7 @@ public:
void testGetRowColumnHeadersInvalidation();
void testJumpHorizontallyInvalidation();
void testJumpToLastRowInvalidation();
+ void testDeleteCellMultilineContent();
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
CPPUNIT_TEST(testRowColumnHeaders);
@@ -149,6 +150,7 @@ public:
CPPUNIT_TEST(testGetRowColumnHeadersInvalidation);
CPPUNIT_TEST(testJumpHorizontallyInvalidation);
CPPUNIT_TEST(testJumpToLastRowInvalidation);
+ CPPUNIT_TEST(testDeleteCellMultilineContent);
CPPUNIT_TEST_SUITE_END();
private:
@@ -459,6 +461,7 @@ public:
bool m_bViewLock;
OString m_sCellFormula;
boost::property_tree::ptree m_aCommentCallbackResult;
+ OString m_sInvalidateHeader;
ViewCallback()
: m_bOwnCursorInvalidated(false),
@@ -550,6 +553,10 @@ public:
m_aCommentCallbackResult = m_aCommentCallbackResult.get_child("comment");
}
break;
+ case LOK_CALLBACK_INVALIDATE_HEADER:
+ {
+ m_sInvalidateHeader = pPayload;
+ }
}
}
};
@@ -1944,6 +1951,41 @@ void ScTiledRenderingTest::testRowColumnHeaders()
SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
}
+void ScTiledRenderingTest::testDeleteCellMultilineContent()
+{
+ comphelper::LibreOfficeKit::setActive();
+
+ ScModelObj* pModelObj = createDoc("multiline.ods");
+ CPPUNIT_ASSERT(pModelObj);
+ ScViewData* pViewData = ScDocShell::GetViewData();
+ CPPUNIT_ASSERT(pViewData);
+ ScDocShell* pDocSh = dynamic_cast< ScDocShell* >( pModelObj->GetEmbeddedObject() );
+ CPPUNIT_ASSERT(pDocSh);
+
+ // view #1
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+ CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData));
+
+ aView1.m_sInvalidateHeader = "";
+ ScDocument& rDoc = pDocSh->GetDocument();
+ sal_uInt16 nRow1Height = rDoc.GetRowHeight(static_cast<SCROW>(0), static_cast<SCTAB>(0), false);
+
+ // delete multiline cell content in view #1
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DOWN);
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DOWN);
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DELETE);
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DELETE);
+ Scheduler::ProcessEventsToIdle();
+
+ // check if the row header has been invalidated and if the involved row is of the expected height
+ CPPUNIT_ASSERT_EQUAL(aView1.m_sInvalidateHeader, OString("row"));
+ sal_uInt16 nRow2Height = rDoc.GetRowHeight(static_cast<SCROW>(0), static_cast<SCTAB>(0), false);
+ CPPUNIT_ASSERT_EQUAL(nRow1Height, nRow2Height);
+
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+}
+
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 01670613a776..38af064a918c 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -153,6 +153,20 @@ bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
SCROW nStartRow = rRange.aStart.Row();
SCROW nEndRow = rRange.aEnd.Row();
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while (pViewShell)
+ {
+ ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
+ if (pTabViewShell)
+ {
+ pTabViewShell->GetViewData().GetLOKHeightHelper(nTab)->invalidateByIndex(nStartRow);
+ }
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+ }
+
ScSizeDeviceProvider aProv( &rDocShell );
Fraction aOne(1,1);
@@ -166,6 +180,9 @@ bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
rDocShell.PostPaint(ScRange(0, nStartRow, nTab, MAXCOL, MAXROW, nTab),
PaintPartFlags::Grid | PaintPartFlags::Left);
+ if (comphelper::LibreOfficeKit::isActive())
+ ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, nTab);
+
return bChanged;
}