summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMartin van Zijl <martin.vanzijl@gmail.com>2018-11-22 09:42:34 +1300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-01-14 07:05:44 +0100
commit4824d5ea717eedd245421272f25d99c0f72642bb (patch)
tree8e6db0c927b090e8a97acc56b2798e3297b73b55 /sc
parent101cd1b9cfb2b080a838f3253e6d7f37f483a372 (diff)
tdf#119804 allow sort when header row protected
Change-Id: I303c11f8dbe4ccd302961b4afc0f67cd9c5d2582 Reviewed-on: https://gerrit.libreoffice.org/66133 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 5060c53ff205..aec29c4434e8 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -504,7 +504,18 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
nTab = aLocalParam.nDestTab;
}
- ScEditableTester aTester( &rDoc, nTab, aLocalParam.nCol1,aLocalParam.nRow1,
+ // tdf#119804: If there is a header row/column, it won't be affected by
+ // sorting; so we can exclude it from the test.
+ SCROW nStartingRowToEdit = aLocalParam.nRow1;
+ SCROW nStartingColToEdit = aLocalParam.nCol1;
+ if ( aLocalParam.bHasHeader )
+ {
+ if ( aLocalParam.bByRow )
+ nStartingRowToEdit++;
+ else
+ nStartingColToEdit++;
+ }
+ ScEditableTester aTester( &rDoc, nTab, nStartingColToEdit,nStartingRowToEdit,
aLocalParam.nCol2,aLocalParam.nRow2 );
if (!aTester.IsEditable())
{