summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-06-16 15:06:18 +0200
committerEike Rathke <erack@redhat.com>2017-06-16 15:09:25 +0200
commit9c0cd667da908ec1dde193c83d7d69a31b43e934 (patch)
tree381957745e3316d51ba4acf4efea363e5ae64e3d
parent08f6f9dded1b142b858c455da03319abac691655 (diff)
Resolves: tdf#71339 include selected top/left empty rows/columns in AutoSum
Keep the exclusion for determining the direction, but include them in the final formula result and selection. Change-Id: Ic752229bad17ac25de9ef598f3da32e0fd257fd1
-rw-r--r--sc/source/ui/view/viewfun2.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index fca59b3e8425..3d67909bc3b7 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -633,7 +633,8 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor
if ( !pDoc->IsBlockEmpty( nTab, nCol, nStartRow, nCol, nSumEndRow ) )
{
ScRangeList aRangeList;
- const ScRange aRange( nCol, nStartRow, nTab, nCol, nSumEndRow, nTab );
+ // Include the originally selected start row.
+ const ScRange aRange( nCol, rRange.aStart.Row(), nTab, nCol, nSumEndRow, nTab );
if ( lcl_GetAutoSumForColumnRange( pDoc, aRangeList, aRange ) )
{
const OUString aFormula = GetAutoSumFormula(
@@ -667,7 +668,8 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor
if ( !pDoc->IsBlockEmpty( nTab, nStartCol, nRow, nSumEndCol, nRow ) )
{
ScRangeList aRangeList;
- const ScRange aRange( nStartCol, nRow, nTab, nSumEndCol, nRow, nTab );
+ // Include the originally selected start column.
+ const ScRange aRange( rRange.aStart.Col(), nRow, nTab, nSumEndCol, nRow, nTab );
if ( lcl_GetAutoSumForRowRange( pDoc, aRangeList, aRange ) )
{
const OUString aFormula = GetAutoSumFormula( aRangeList, bSubTotal, ScAddress(nInsCol, nRow, nTab) );
@@ -678,7 +680,7 @@ bool ScViewFunc::AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor
}
// set new mark range and cursor position
- const ScRange aMarkRange( nStartCol, nStartRow, nTab, nMarkEndCol, nMarkEndRow, nTab );
+ const ScRange aMarkRange( rRange.aStart.Col(), rRange.aStart.Row(), nTab, nMarkEndCol, nMarkEndRow, nTab );
MarkRange( aMarkRange, false, bContinue );
if ( bSetCursor )
{