[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/source

Eike Rathke erack at redhat.com
Wed Jul 4 18:44:42 UTC 2018


 sc/source/core/data/table1.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 867dec9f720b7f704aef4fd3d560b8015fc776a7
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jul 4 14:27:38 2018 +0200

    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 at redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 94af1b1100e8b48f755ec66b190d2017aae1dc00)
    Reviewed-on: https://gerrit.libreoffice.org/56953

diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index e7faf4d87f10..65b1b288fce7 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1303,7 +1303,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 ???


More information about the Libreoffice-commits mailing list