diff options
author | Eike Rathke <erack@redhat.com> | 2014-12-07 17:32:09 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-12-07 17:39:34 +0100 |
commit | ec1b1af8af7ead149f96c09e16402e66e0973372 (patch) | |
tree | 5e1fff5a429bd8cf62632cae3273b0f23155301b /sc | |
parent | 3f28f67084f12fd806e05020ed8bac8d5a05c025 (diff) |
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
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/sortparam.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/undo/undosort.cxx | 20 |
3 files changed, 21 insertions, 1 deletions
diff --git a/sc/inc/sortparam.hxx b/sc/inc/sortparam.hxx index 4d80a07adaf1..ed79c37406f6 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 99813566074a..04e9d08378e7 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 c30cd5620106..bd8ed8343640 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) |