sc/Library_sc.mk                    |    1 +
 sc/inc/document.hxx                 |    3 ++-
 sc/inc/refhint.hxx                  |   12 ++++++------
 sc/inc/sortparam.hxx                |   13 +++++++++++++
 sc/inc/table.hxx                    |    8 +++++---
 sc/inc/tokenarray.hxx               |    8 ++++++--
 sc/inc/types.hxx                    |    3 +--
 sc/inc/undosort.hxx                 |   34 ++++++++++++++++++++++++++++++++++
 sc/qa/unit/ucalc.cxx                |   12 ++++++------
 sc/source/core/data/documen3.cxx    |    5 +++--
 sc/source/core/data/formulacell.cxx |    9 ++++++---
 sc/source/core/data/table3.cxx      |   25 ++++++++++++++-----------
 sc/source/core/tool/refhint.cxx     |    8 ++++----
 sc/source/core/tool/token.cxx       |   14 +++++++-------
 sc/source/ui/docshell/dbdocfun.cxx  |   18 +++++++++++++++++-
 sc/source/ui/undo/undosort.cxx      |   34 ++++++++++++++++++++++++++++++++++
 16 files changed, 159 insertions(+), 48 deletions(-)

New commits:
commit 9e66aa3a2bb1b103442166cb642ff6085f38b770
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Fri Jun 27 16:24:36 2014 -0400

    Set up a new undo sort mechanism.  It's empty for now.
    
    Change-Id: I14a235f050d64d64d1102a688a304249afacf802

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 8e42c63..639946a 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -518,6 +518,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
     sc/source/ui/undo/undodraw \
     sc/source/ui/undo/undoolk \
     sc/source/ui/undo/undorangename \
+    sc/source/ui/undo/undosort \
     sc/source/ui/undo/undostyl \
     sc/source/ui/undo/undotab \
     sc/source/ui/undo/undoutil \
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 5897fe3..848e162 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -79,6 +79,7 @@ class CellValues;
 class RowHeightContext;
 struct SetFormulaDirtyContext;
 class RefMovedHint;
+struct SortUndoParam;
 
 }
 
@@ -1675,7 +1676,7 @@ public:
     SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const;
     SC_DLLPUBLIC SvNumberFormatter* CreateFormatTable() const;
 
-    void            Sort( SCTAB nTab, const ScSortParam& rSortParam, bool 
bKeepQuery, ScProgress* pProgress );
+    void Sort( SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery, 
ScProgress* pProgress, sc::SortUndoParam* pUndo );
     SCSIZE          Query( SCTAB nTab, const ScQueryParam& rQueryParam, bool 
bKeepSub );
     SC_DLLPUBLIC bool           CreateQueryParam( SCCOL nCol1, SCROW nRow1, 
SCCOL nCol2, SCROW nRow2,
                                         SCTAB nTab, ScQueryParam& rQueryParam 
);
diff --git a/sc/inc/sortparam.hxx b/sc/inc/sortparam.hxx
index 55b09a6..df3a449 100644
--- a/sc/inc/sortparam.hxx
+++ b/sc/inc/sortparam.hxx
@@ -78,6 +78,19 @@ struct SC_DLLPUBLIC ScSortParam
     inline sal_uInt16 GetSortKeyCount() const { return maKeyState.size(); }
 };
 
+namespace sc {
+
+struct SC_DLLPUBLIC SortUndoParam
+{
+    ScRange maSortRange;
+    std::vector<SCCOLROW> maOldIndices;
+    bool mbHasHeader;
+    bool mbByRow;
+    bool mbIncludePattern;
+};
+
+}
+
 #endif // INCLUDED_SC_INC_SORTPARAM_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 580b738..649d8e6 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -73,6 +73,7 @@ class RowHeightContext;
 class CompileFormulaContext;
 struct SetFormulaDirtyContext;
 class RefMovedHint;
+struct SortUndoParam;
 
 }
 
@@ -824,7 +825,8 @@ public:
     void        StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
     void        ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
 
-    void        Sort(const ScSortParam& rSortParam, bool bKeepQuery, 
ScProgress* pProgress);
+    void Sort(
+        const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress, 
sc::SortUndoParam* pUndo );
     bool ValidQuery(
         SCROW nRow, const ScQueryParam& rQueryParam, ScRefCellValue* pCell = 
NULL,
         bool* pbTestEqualCondition = NULL);
@@ -1019,8 +1021,8 @@ private:
     short       Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2) 
const;
     ScSortInfoArray* CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2, bool 
bKeepQuery );
     void        QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi);
-    void SortReorderByColumn( ScSortInfoArray* pArray, ScProgress* pProgress );
-    void SortReorderByRow( ScSortInfoArray* pArray, ScProgress* pProgress );
+    void SortReorderByColumn( ScSortInfoArray* pArray, ScProgress* pProgress, 
sc::SortUndoParam* pUndo );
+    void SortReorderByRow( ScSortInfoArray* pArray, ScProgress* pProgress, 
sc::SortUndoParam* pUndo );
 
     bool        CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW 
nRow2, ScQueryParam& rQueryParam);
     bool        CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW 
nRow2, ScQueryParam& rQueryParam);
diff --git a/sc/inc/undosort.hxx b/sc/inc/undosort.hxx
new file mode 100644
index 0000000..d7a4512
--- /dev/null
+++ b/sc/inc/undosort.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SC_UNDOSORT_HXX
+#define INCLUDED_SC_UNDOSORT_HXX
+
+#include <undobase.hxx>
+#include <sortparam.hxx>
+
+namespace sc {
+
+class UndoSort : public ScSimpleUndo
+{
+    SortUndoParam maParam;
+
+public:
+    UndoSort( ScDocShell* pDocSh, const SortUndoParam& rParam );
+
+    virtual OUString GetComment() const;
+    virtual void Undo();
+    virtual void Redo();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index d412abd..b852010 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4810,7 +4810,7 @@ void Test::testSortWithFormulaRefs()
     aSortData.maKeyState[0].bDoSort = true;
     aSortData.maKeyState[0].nField = 0;
 
-    m_pDoc->Sort(0, aSortData, false, NULL);
+    m_pDoc->Sort(0, aSortData, false, NULL, NULL);
 
     for (size_t i = 0; i < SAL_N_ELEMENTS(aResults); ++i)
     {
@@ -4845,7 +4845,7 @@ void Test::testSortWithStrings()
     aParam.maKeyState[0].bAscending = true;
     aParam.maKeyState[0].nField = 1;
 
-    m_pDoc->Sort(0, aParam, false, NULL);
+    m_pDoc->Sort(0, aParam, false, NULL, NULL);
 
     CPPUNIT_ASSERT_EQUAL(OUString("Header"), 
m_pDoc->GetString(ScAddress(1,1,0)));
     CPPUNIT_ASSERT_EQUAL(OUString("Val1"), 
m_pDoc->GetString(ScAddress(1,2,0)));
@@ -4853,7 +4853,7 @@ void Test::testSortWithStrings()
 
     aParam.maKeyState[0].bAscending = false;
 
-    m_pDoc->Sort(0, aParam, false, NULL);
+    m_pDoc->Sort(0, aParam, false, NULL, NULL);
 
     CPPUNIT_ASSERT_EQUAL(OUString("Header"), 
m_pDoc->GetString(ScAddress(1,1,0)));
     CPPUNIT_ASSERT_EQUAL(OUString("Val2"), 
m_pDoc->GetString(ScAddress(1,2,0)));
@@ -4896,7 +4896,7 @@ void Test::testSort()
     aSortData.maKeyState[0].nField = 1;
     aSortData.maKeyState[0].bAscending = true;
 
-    m_pDoc->Sort(0, aSortData, false, NULL);
+    m_pDoc->Sort(0, aSortData, false, NULL, NULL);
 
     double nVal = m_pDoc->GetValue(1,0,0);
     ASSERT_DOUBLES_EQUAL(nVal, 1.0);
@@ -4929,7 +4929,7 @@ void Test::testSort()
     aSortData.nRow2 = aDataRange.aEnd.Row();
     aSortData.bHasHeader = true;
     aSortData.maKeyState[0].nField = 0;
-    m_pDoc->Sort(0, aSortData, false, NULL);
+    m_pDoc->Sort(0, aSortData, false, NULL, NULL);
 
     // Title should stay at the top, numbers should be sorted numerically,
     // numbers always come before strings, and empty cells always occur at the
@@ -5059,7 +5059,7 @@ void Test::testSortInFormulaGroup()
     aSortData.maKeyState[0].nField = 0;
     aSortData.maKeyState[0].bAscending = true;
 
-    m_pDoc->Sort(0, aSortData, false, NULL);
+    m_pDoc->Sort(0, aSortData, false, NULL, NULL);
 
     static struct {
         SCCOL nCol;
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 766125c..38162ce 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1335,13 +1335,14 @@ bool ScDocument::UpdateOutlineRow( SCROW nStartRow, 
SCROW nEndRow, SCTAB nTab, b
     return false;
 }
 
-void ScDocument::Sort(SCTAB nTab, const ScSortParam& rSortParam, bool 
bKeepQuery, ScProgress* pProgress)
+void ScDocument::Sort(
+    SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* 
pProgress, sc::SortUndoParam* pUndo )
 {
     if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && 
maTabs[nTab] )
     {
         bool bOldEnableIdle = IsIdleEnabled();
         EnableIdle(false);
-        maTabs[nTab]->Sort(rSortParam, bKeepQuery, pProgress);
+        maTabs[nTab]->Sort(rSortParam, bKeepQuery, pProgress, pUndo);
         EnableIdle(bOldEnableIdle);
     }
 }
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 1ffc739..1283ee1 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -560,7 +560,8 @@ public:
 
 }
 
-void ScTable::SortReorderByColumn( ScSortInfoArray* pArray, ScProgress* 
pProgress )
+void ScTable::SortReorderByColumn(
+    ScSortInfoArray* pArray, ScProgress* pProgress, sc::SortUndoParam* pUndo )
 {
     size_t nCount = pArray->GetCount();
     SCCOLROW nStart = pArray->GetStart();
@@ -637,7 +638,8 @@ void ScTable::SortReorderByColumn( ScSortInfoArray* pArray, 
ScProgress* pProgres
     }
 }
 
-void ScTable::SortReorderByRow( ScSortInfoArray* pArray, ScProgress* pProgress 
)
+void ScTable::SortReorderByRow(
+    ScSortInfoArray* pArray, ScProgress* pProgress, sc::SortUndoParam* pUndo )
 {
     SCROW nRow1 = pArray->GetStart();
     SCROW nRow2 = pArray->GetLast();
@@ -1090,7 +1092,8 @@ void ScTable::DecoladeRow( ScSortInfoArray* pArray, SCROW 
nRow1, SCROW nRow2 )
     }
 }
 
-void ScTable::Sort(const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* 
pProgress)
+void ScTable::Sort(
+    const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress, 
sc::SortUndoParam* pUndo )
 {
     aSortParam = rSortParam;
     InitSortCollator( rSortParam );
@@ -1114,7 +1117,7 @@ void ScTable::Sort(const ScSortParam& rSortParam, bool 
bKeepQuery, ScProgress* p
                 DecoladeRow(pArray.get(), nRow1, nLastRow);
 
             QuickSort(pArray.get(), nRow1, nLastRow);
-            SortReorderByRow(pArray.get(), pProgress);
+            SortReorderByRow(pArray.get(), pProgress, pUndo);
 
             // #i59745# update position of caption objects of cell notes --> 
reported at (SortReorder) ScColumn::SwapCellNotes level
         }
@@ -1136,7 +1139,7 @@ void ScTable::Sort(const ScSortParam& rSortParam, bool 
bKeepQuery, ScProgress* p
             boost::scoped_ptr<ScSortInfoArray> 
pArray(CreateSortInfoArray(nCol1, nLastCol, bKeepQuery));
 
             QuickSort(pArray.get(), nCol1, nLastCol);
-            SortReorderByColumn(pArray.get(), pProgress);
+            SortReorderByColumn(pArray.get(), pProgress, pUndo);
 
             // #i59745# update position of caption objects of cell notes --> 
reported at (SortReorder) ScColumn::SwapCellNotes level
         }
diff --git a/sc/source/ui/docshell/dbdocfun.cxx 
b/sc/source/ui/docshell/dbdocfun.cxx
index b422213..a57809b 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -47,6 +47,7 @@
 #include "queryentry.hxx"
 #include "markdata.hxx"
 #include "progress.hxx"
+#include <undosort.hxx>
 
 #include <set>
 #include <memory>
@@ -474,7 +475,9 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& 
rSortParam,
     if (bRecord && !rDoc.IsUndoEnabled())
         bRecord = false;
 
+#if 0
     ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer();
+#endif
 
     ScDBData* pDBData = rDoc.GetDBAtArea( nTab, rSortParam.nCol1, 
rSortParam.nRow1,
                                                     rSortParam.nCol2, 
rSortParam.nRow2 );
@@ -549,6 +552,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& 
rSortParam,
     if ( aQueryParam.GetEntry(0).bDoQuery )
         bRepeatQuery = true;
 
+#if 0
     ScUndoSort* pUndoAction = 0;
     if ( bRecord )
     {
@@ -586,12 +590,22 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& 
rSortParam,
         if( pDrawLayer )
             pDrawLayer->BeginCalcUndo(false);
     }
+#endif
+
+    sc::SortUndoParam aUndoParam;
 
     // don't call ScDocument::Sort with an empty SortParam (may be empty here 
if bCopy is set)
     if (aLocalParam.GetSortKeyCount() && aLocalParam.maKeyState[0].bDoSort)
     {
         ScProgress aProgress(&rDocShell, 
ScGlobal::GetRscString(STR_PROGRESS_SORTING), 0);
-        rDoc.Sort( nTab, aLocalParam, bRepeatQuery, &aProgress );
+        rDoc.Sort(nTab, aLocalParam, bRepeatQuery, &aProgress, &aUndoParam);
+    }
+
+    if (bRecord)
+    {
+        // Set up an undo object.
+        sc::UndoSort* pUndoAction = new sc::UndoSort(&rDocShell, aUndoParam);
+        rDocShell.GetUndoManager()->AddUndoAction(pUndoAction);
     }
 
     pDBData->SetSortParam(rSortParam);
@@ -620,9 +634,11 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& 
rSortParam,
     if (!bUniformRowHeight)
         rDocShell.AdjustRowHeight(nStartRow, aLocalParam.nRow2, nTab);
 
+#if 0
     // #i59745# set collected drawing undo actions at sorting undo action
     if( pUndoAction && pDrawLayer )
         pUndoAction->SetDrawUndoAction( pDrawLayer->GetCalcUndo() );
+#endif
 
     aModificator.SetDocumentModified();
 
diff --git a/sc/source/ui/undo/undosort.cxx b/sc/source/ui/undo/undosort.cxx
new file mode 100644
index 0000000..09671bc
--- /dev/null
+++ b/sc/source/ui/undo/undosort.cxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <undosort.hxx>
+#include <globstr.hrc>
+#include <global.hxx>
+
+namespace sc {
+
+UndoSort::UndoSort( ScDocShell* pDocSh, const SortUndoParam& rParam ) :
+    ScSimpleUndo(pDocSh), maParam(rParam) {}
+
+OUString UndoSort::GetComment() const
+{
+    return ScGlobal::GetRscString(STR_UNDO_SORT);
+}
+
+void UndoSort::Undo()
+{
+}
+
+void UndoSort::Redo()
+{
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d0d3b29ebdec86b0a6a34ecefdaebf4b1cd8b338
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Fri Jun 27 14:30:33 2014 -0400

    Use one map type for both column and row mapping.
    
    Change-Id: I7581ece97113acc88ff12fabec66c46c706bad3e

diff --git a/sc/inc/refhint.hxx b/sc/inc/refhint.hxx
index 81449ad..1eff906 100644
--- a/sc/inc/refhint.hxx
+++ b/sc/inc/refhint.hxx
@@ -61,16 +61,16 @@ public:
 
 class RefColReorderHint : public RefHint
 {
-    const sc::ColReorderMapType& mrColMap;
+    const sc::ColRowReorderMapType& mrColMap;
     SCTAB mnTab;
     SCROW mnRow1;
     SCROW mnRow2;
 
 public:
-    RefColReorderHint( const sc::ColReorderMapType& rColMap, SCTAB nTab, SCROW 
nRow1, SCROW nRow2 );
+    RefColReorderHint( const sc::ColRowReorderMapType& rColMap, SCTAB nTab, 
SCROW nRow1, SCROW nRow2 );
     virtual ~RefColReorderHint();
 
-    const sc::ColReorderMapType& getColMap() const;
+    const sc::ColRowReorderMapType& getColMap() const;
 
     SCTAB getTab() const;
     SCROW getStartRow() const;
@@ -79,16 +79,16 @@ public:
 
 class RefRowReorderHint : public RefHint
 {
-    const sc::RowReorderMapType& mrRowMap;
+    const sc::ColRowReorderMapType& mrRowMap;
     SCTAB mnTab;
     SCCOL mnCol1;
     SCCOL mnCol2;
 
 public:
-    RefRowReorderHint( const sc::RowReorderMapType& rRowMap, SCTAB nTab, SCCOL 
nCol1, SCCOL nCol2 );
+    RefRowReorderHint( const sc::ColRowReorderMapType& rRowMap, SCTAB nTab, 
SCCOL nCol1, SCCOL nCol2 );
     virtual ~RefRowReorderHint();
 
-    const sc::RowReorderMapType& getRowMap() const;
+    const sc::ColRowReorderMapType& getRowMap() const;
 
     SCTAB getTab() const;
     SCCOL getStartColumn() const;
diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index 375dd3a..8ae6145 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -168,9 +168,13 @@ public:
      * @param nRow2 bottom row of reordered range.
      * @param rColMap old-to-new column mapping.
      */
-    void MoveReferenceColReorder( const ScAddress& rPos, SCTAB nTab, SCROW 
nRow1, SCROW nRow2, const sc::ColReorderMapType& rColMap );
+    void MoveReferenceColReorder(
+        const ScAddress& rPos, SCTAB nTab, SCROW nRow1, SCROW nRow2,
+        const sc::ColRowReorderMapType& rColMap );
 
-    void MoveReferenceRowReorder( const ScAddress& rPos, SCTAB nTab, SCCOL 
nCol1, SCCOL nCol2, const sc::RowReorderMapType& rRowMap );
+    void MoveReferenceRowReorder(
+        const ScAddress& rPos, SCTAB nTab, SCCOL nCol1, SCCOL nCol2,
+        const sc::ColRowReorderMapType& rRowMap );
 
     /**
      * Adjust all references in named expression. In named expression, we only
diff --git a/sc/inc/types.hxx b/sc/inc/types.hxx
index 976baaf..37784dc 100644
--- a/sc/inc/types.hxx
+++ b/sc/inc/types.hxx
@@ -98,8 +98,7 @@ struct RangeMatrix
     bool isRangeValid() const;
 };
 
-typedef boost::unordered_map<SCCOL,SCCOL> ColReorderMapType;
-typedef boost::unordered_map<SCROW,SCROW> RowReorderMapType;
+typedef boost::unordered_map<SCCOLROW,SCCOLROW> ColRowReorderMapType;
 
 }
 
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index b107464..1ffc739 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -542,8 +542,8 @@ public:
     }
 };
 
-typedef ReorderNotifier<sc::RefColReorderHint, sc::ColReorderMapType, SCROW> 
ColReorderNotifier;
-typedef ReorderNotifier<sc::RefRowReorderHint, sc::RowReorderMapType, SCROW> 
RowReorderNotifier;
+typedef ReorderNotifier<sc::RefColReorderHint, sc::ColRowReorderMapType, 
SCCOL> ColReorderNotifier;
+typedef ReorderNotifier<sc::RefRowReorderHint, sc::ColRowReorderMapType, 
SCROW> RowReorderNotifier;
 
 class FormulaGroupPosCollector : std::unary_function<SvtListener*, void>
 {
@@ -603,13 +603,13 @@ void ScTable::SortReorderByColumn( ScSortInfoArray* 
pArray, ScProgress* pProgres
         aCol[nCol].ResetFormulaCellPositions(aSortParam.nRow1, 
aSortParam.nRow2);
 
     // Set up column reorder map (for later broadcasting of reference updates).
-    sc::ColReorderMapType aColMap;
+    sc::ColRowReorderMapType aColMap;
     const std::vector<SCCOLROW>& rOldIndices = pArray->GetOldIndices();
     for (size_t i = 0, n = rOldIndices.size(); i < n; ++i)
     {
         SCCOL nNew = i + nStart;
         SCCOL nOld = rOldIndices[i];
-        aColMap.insert(sc::ColReorderMapType::value_type(nOld, nNew));
+        aColMap.insert(sc::ColRowReorderMapType::value_type(nOld, nNew));
     }
 
     // Collect all listeners within sorted range ahead of time.
@@ -817,13 +817,13 @@ void ScTable::SortReorderByRow( ScSortInfoArray* pArray, 
ScProgress* pProgress )
     }
 
     // Set up row reorder map (for later broadcasting of reference updates).
-    sc::RowReorderMapType aRowMap;
+    sc::ColRowReorderMapType aRowMap;
     const std::vector<SCCOLROW>& rOldIndices = pArray->GetOldIndices();
     for (size_t i = 0, n = rOldIndices.size(); i < n; ++i)
     {
         SCROW nNew = i + nRow1;
         SCROW nOld = rOldIndices[i];
-        aRowMap.insert(sc::RowReorderMapType::value_type(nOld, nNew));
+        aRowMap.insert(sc::ColRowReorderMapType::value_type(nOld, nNew));
     }
 
     // Collect all listeners within sorted range ahead of time.
diff --git a/sc/source/core/tool/refhint.cxx b/sc/source/core/tool/refhint.cxx
index 8e5540a..533a41b 100644
--- a/sc/source/core/tool/refhint.cxx
+++ b/sc/source/core/tool/refhint.cxx
@@ -34,12 +34,12 @@ const ScAddress& RefMovedHint::getDelta() const
     return maMoveDelta;
 }
 
-RefColReorderHint::RefColReorderHint( const sc::ColReorderMapType& rColMap, 
SCTAB nTab, SCROW nRow1, SCROW nRow2 ) :
+RefColReorderHint::RefColReorderHint( const sc::ColRowReorderMapType& rColMap, 
SCTAB nTab, SCROW nRow1, SCROW nRow2 ) :
     RefHint(ColumnReordered), mrColMap(rColMap), mnTab(nTab), mnRow1(nRow1), 
mnRow2(nRow2) {}
 
 RefColReorderHint::~RefColReorderHint() {}
 
-const sc::ColReorderMapType& RefColReorderHint::getColMap() const
+const sc::ColRowReorderMapType& RefColReorderHint::getColMap() const
 {
     return mrColMap;
 }
@@ -59,12 +59,12 @@ SCROW RefColReorderHint::getEndRow() const
     return mnRow2;
 }
 
-RefRowReorderHint::RefRowReorderHint( const sc::RowReorderMapType& rRowMap, 
SCTAB nTab, SCCOL nCol1, SCCOL nCol2 ) :
+RefRowReorderHint::RefRowReorderHint( const sc::ColRowReorderMapType& rRowMap, 
SCTAB nTab, SCCOL nCol1, SCCOL nCol2 ) :
     RefHint(RowReordered), mrRowMap(rRowMap), mnTab(nTab), mnCol1(nCol1), 
mnCol2(nCol2) {}
 
 RefRowReorderHint::~RefRowReorderHint() {}
 
-const sc::RowReorderMapType& RefRowReorderHint::getRowMap() const
+const sc::ColRowReorderMapType& RefRowReorderHint::getRowMap() const
 {
     return mrRowMap;
 }
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index fcf76a2..54e233c 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2883,7 +2883,7 @@ void ScTokenArray::MoveReference(
 }
 
 void ScTokenArray::MoveReferenceColReorder(
-    const ScAddress& rPos, SCTAB nTab, SCROW nRow1, SCROW nRow2, const 
sc::ColReorderMapType& rColMap )
+    const ScAddress& rPos, SCTAB nTab, SCROW nRow1, SCROW nRow2, const 
sc::ColRowReorderMapType& rColMap )
 {
     FormulaToken** p = pCode;
     FormulaToken** pEnd = p + static_cast<size_t>(nLen);
@@ -2900,7 +2900,7 @@ void ScTokenArray::MoveReferenceColReorder(
                 if (aAbs.Tab() == nTab && nRow1 <= aAbs.Row() && aAbs.Row() <= 
nRow2)
                 {
                     // Inside reordered row range.
-                    sc::ColReorderMapType::const_iterator it = 
rColMap.find(aAbs.Col());
+                    sc::ColRowReorderMapType::const_iterator it = 
rColMap.find(aAbs.Col());
                     if (it != rColMap.end())
                     {
                         // This column is reordered.
@@ -2928,7 +2928,7 @@ void ScTokenArray::MoveReferenceColReorder(
                 if (aAbs.aStart.Tab() == nTab && nRow1 <= aAbs.aStart.Row() && 
aAbs.aEnd.Row() <= nRow2)
                 {
                     // Inside reordered row range.
-                    sc::ColReorderMapType::const_iterator it = 
rColMap.find(aAbs.aStart.Col());
+                    sc::ColRowReorderMapType::const_iterator it = 
rColMap.find(aAbs.aStart.Col());
                     if (it != rColMap.end())
                     {
                         // This column is reordered.
@@ -2946,7 +2946,7 @@ void ScTokenArray::MoveReferenceColReorder(
     }
 }
 
-void ScTokenArray::MoveReferenceRowReorder( const ScAddress& rPos, SCTAB nTab, 
SCCOL nCol1, SCCOL nCol2, const sc::RowReorderMapType& rRowMap )
+void ScTokenArray::MoveReferenceRowReorder( const ScAddress& rPos, SCTAB nTab, 
SCCOL nCol1, SCCOL nCol2, const sc::ColRowReorderMapType& rRowMap )
 {
     FormulaToken** p = pCode;
     FormulaToken** pEnd = p + static_cast<size_t>(nLen);
@@ -2963,7 +2963,7 @@ void ScTokenArray::MoveReferenceRowReorder( const 
ScAddress& rPos, SCTAB nTab, S
                 if (aAbs.Tab() == nTab && nCol1 <= aAbs.Col() && aAbs.Col() <= 
nCol2)
                 {
                     // Inside reordered column range.
-                    sc::RowReorderMapType::const_iterator it = 
rRowMap.find(aAbs.Row());
+                    sc::ColRowReorderMapType::const_iterator it = 
rRowMap.find(aAbs.Row());
                     if (it != rRowMap.end())
                     {
                         // This column is reordered.
@@ -2991,7 +2991,7 @@ void ScTokenArray::MoveReferenceRowReorder( const 
ScAddress& rPos, SCTAB nTab, S
                 if (aAbs.aStart.Tab() == nTab && nCol1 <= aAbs.aStart.Col() && 
aAbs.aEnd.Col() <= nCol2)
                 {
                     // Inside reordered column range.
-                    sc::RowReorderMapType::const_iterator it = 
rRowMap.find(aAbs.aStart.Row());
+                    sc::ColRowReorderMapType::const_iterator it = 
rRowMap.find(aAbs.aStart.Row());
                     if (it != rRowMap.end())
                     {
                         // This row is reordered.
commit d736cf6c5655cdf722c6ac57fca0d41f45a70c39
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Fri Jun 27 14:03:18 2014 -0400

    Dis-ambiguate these two MoveReference(...) methods.
    
    Change-Id: I08503b1e8ec20c3a236d4ee823efae84a4be54a1

diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx
index 082f152..375dd3a 100644
--- a/sc/inc/tokenarray.hxx
+++ b/sc/inc/tokenarray.hxx
@@ -168,9 +168,9 @@ public:
      * @param nRow2 bottom row of reordered range.
      * @param rColMap old-to-new column mapping.
      */
-    void MoveReference( const ScAddress& rPos, SCTAB nTab, SCROW nRow1, SCROW 
nRow2, const sc::ColReorderMapType& rColMap );
+    void MoveReferenceColReorder( const ScAddress& rPos, SCTAB nTab, SCROW 
nRow1, SCROW nRow2, const sc::ColReorderMapType& rColMap );
 
-    void MoveReference( const ScAddress& rPos, SCTAB nTab, SCCOL nCol1, SCCOL 
nCol2, const sc::RowReorderMapType& rRowMap );
+    void MoveReferenceRowReorder( const ScAddress& rPos, SCTAB nTab, SCCOL 
nCol1, SCCOL nCol2, const sc::RowReorderMapType& rRowMap );
 
     /**
      * Adjust all references in named expression. In named expression, we only
diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 0285630..60d9866 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1944,8 +1944,11 @@ void ScFormulaCell::Notify( const SfxHint& rHint )
                 const sc::RefColReorderHint& rRefColReorder =
                     static_cast<const sc::RefColReorderHint&>(rRefHint);
                 if (!IsShared() || IsSharedTop())
-                    pCode->MoveReference(
-                        aPos, rRefColReorder.getTab(), 
rRefColReorder.getStartRow(), rRefColReorder.getEndRow(), 
rRefColReorder.getColMap());
+                    pCode->MoveReferenceColReorder(
+                        aPos, rRefColReorder.getTab(),
+                        rRefColReorder.getStartRow(),
+                        rRefColReorder.getEndRow(),
+                        rRefColReorder.getColMap());
             }
             break;
             case sc::RefHint::RowReordered:
@@ -1953,7 +1956,7 @@ void ScFormulaCell::Notify( const SfxHint& rHint )
                 const sc::RefRowReorderHint& rRefRowReorder =
                     static_cast<const sc::RefRowReorderHint&>(rRefHint);
                 if (!IsShared() || IsSharedTop())
-                    pCode->MoveReference(
+                    pCode->MoveReferenceRowReorder(
                         aPos, rRefRowReorder.getTab(),
                         rRefRowReorder.getStartColumn(),
                         rRefRowReorder.getEndColumn(),
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index cf406a0..fcf76a2 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2882,7 +2882,7 @@ void ScTokenArray::MoveReference(
     }
 }
 
-void ScTokenArray::MoveReference(
+void ScTokenArray::MoveReferenceColReorder(
     const ScAddress& rPos, SCTAB nTab, SCROW nRow1, SCROW nRow2, const 
sc::ColReorderMapType& rColMap )
 {
     FormulaToken** p = pCode;
@@ -2946,7 +2946,7 @@ void ScTokenArray::MoveReference(
     }
 }
 
-void ScTokenArray::MoveReference( const ScAddress& rPos, SCTAB nTab, SCCOL 
nCol1, SCCOL nCol2, const sc::RowReorderMapType& rRowMap )
+void ScTokenArray::MoveReferenceRowReorder( const ScAddress& rPos, SCTAB nTab, 
SCCOL nCol1, SCCOL nCol2, const sc::RowReorderMapType& rRowMap )
 {
     FormulaToken** p = pCode;
     FormulaToken** pEnd = p + static_cast<size_t>(nLen);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to