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

Eike Rathke erack at redhat.com
Sun Dec 7 08:40:06 PST 2014


 sc/inc/sortparam.hxx           |    1 +
 sc/source/core/data/table3.cxx |    1 +
 sc/source/ui/undo/undosort.cxx |   20 +++++++++++++++++++-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit ec1b1af8af7ead149f96c09e16402e66e0973372
Author: Eike Rathke <erack at redhat.com>
Date:   Sun Dec 7 17:32:09 2014 +0100

    add ReorderParam.mbHasHeaders to include in Undo range mark
    
    Undo Sort did not select/mark the original range if it included header
    row/column.
    
    Change-Id: Ie4c800e7a44fd910c871731673093400c6400e4a

diff --git a/sc/inc/sortparam.hxx b/sc/inc/sortparam.hxx
index 4d80a07..ed79c37 100644
--- a/sc/inc/sortparam.hxx
+++ b/sc/inc/sortparam.hxx
@@ -97,6 +97,7 @@ struct SC_DLLPUBLIC ReorderParam
     bool mbPattern;
     bool mbHiddenFiltered;
     bool mbUpdateRefs;
+    bool mbHasHeaders;
 
     /**
      * Reorder the position indices such that it can be used to undo the
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 9981356..04e9d08 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1689,6 +1689,7 @@ void ScTable::Sort(
         pUndo->mbPattern = rSortParam.bIncludePattern;
         pUndo->mbHiddenFiltered = bKeepQuery;
         pUndo->mbUpdateRefs = bUpdateRefs;
+        pUndo->mbHasHeaders = rSortParam.bHasHeader;
     }
 
     // Trim empty leading and trailing column ranges.
diff --git a/sc/source/ui/undo/undosort.cxx b/sc/source/ui/undo/undosort.cxx
index c30cd56..bd8ed83 100644
--- a/sc/source/ui/undo/undosort.cxx
+++ b/sc/source/ui/undo/undosort.cxx
@@ -44,7 +44,25 @@ void UndoSort::Execute( bool bUndo )
         aParam.reverse();
     rDoc.Reorder(aParam, NULL);
 
-    ScUndoUtil::MarkSimpleBlock(pDocShell, maParam.maSortRange);
+    if (maParam.mbHasHeaders)
+    {
+        ScRange aMarkRange( maParam.maSortRange);
+        if (maParam.mbByRow)
+        {
+            if (aMarkRange.aStart.Col() > 0)
+                aMarkRange.aStart.IncCol(-1);
+        }
+        else
+        {
+            if (aMarkRange.aStart.Row() > 0)
+                aMarkRange.aStart.IncRow(-1);
+        }
+        ScUndoUtil::MarkSimpleBlock(pDocShell, aMarkRange);
+    }
+    else
+    {
+        ScUndoUtil::MarkSimpleBlock(pDocShell, maParam.maSortRange);
+    }
 
     rDoc.SetDirty(maParam.maSortRange, true);
     if (!aParam.mbUpdateRefs)


More information about the Libreoffice-commits mailing list