[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Fri Jun 16 13:09:56 UTC 2017


 sc/source/ui/view/viewfun2.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 9c0cd667da908ec1dde193c83d7d69a31b43e934
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Jun 16 15:06:18 2017 +0200

    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

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 )
     {


More information about the Libreoffice-commits mailing list