summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-07-04 14:27:38 +0200
committerEike Rathke <erack@redhat.com>2018-07-04 16:48:16 +0200
commit94af1b1100e8b48f755ec66b190d2017aae1dc00 (patch)
treebb27f0f4cb8660687a5b6efbfc47e43e26932e42
parentc625bc9aa485c747de54b0cb479abbbf79789b36 (diff)
Check for HasAttrFlags::Protected instead ATTR_PROTECTION, tdf#68290 follow-up
ATTR_PROTECTION at ScAttrArray is not sufficient as also conditional formatting may apply protection to otherwise unprotected cells. This now actually enables travelling Enter->Right in the sample document of tdf#68290 to advance to the next row / first col if at the end of a row for such protected cells. This matches what the ScTabView::MoveCursorRel() call then does via ScTabView::SkipCursorHorizontal() and ScTabView::SkipCursorVertical() (additionally checking protection options for selectable cells which should be done in ScTable::GetNextPos() as well). Actually when getting things straight the call to MoveCursorRel() may not be needed anymore and MoveCursorAbs() could be sufficient, but *only* if we can differentiate between viewshell cursor travel and UNO gotoNext()/gotoPrevious() calls. Change-Id: I0fcb0ecd748bbde982b260db4f4696166cfc5e78 Reviewed-on: https://gerrit.libreoffice.org/56947 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
-rw-r--r--sc/source/core/data/table1.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index fe0473590d7b..4506d3e17fe0 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1304,7 +1304,10 @@ bool ScTable::ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
if (bMarked && !rMark.IsCellMarked(nCol,nRow))
return false;
- if (bUnprotected && GetAttr(nCol,nRow,ATTR_PROTECTION)->GetProtection())
+ /* TODO: for cursor movement *only* this should even take the protection
+ * options (select locked, select unlocked) into account, see
+ * ScTabView::SkipCursorHorizontal() and ScTabView::SkipCursorVertical(). */
+ if (bUnprotected && pDocument->HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HasAttrFlags::Protected))
return false;
if (bMarked || bUnprotected) //TODO: also in other case ???