[Libreoffice-commits] core.git: Branch 'private/kohei/sort-ref-update' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Wed Jun 4 13:41:13 PDT 2014
sc/inc/table.hxx | 2 -
sc/source/core/data/table3.cxx | 12 ++--------
sc/source/ui/docshell/dbdocfun.cxx | 43 +++++++++++++++++++++++++++++++++++++
3 files changed, 47 insertions(+), 10 deletions(-)
New commits:
commit 6b2479b0e936221f66719024820442654b33ae53
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Wed Jun 4 16:40:35 2014 -0400
Make reorder by row and reorder by column totally separate.
We'll need to call these directly during undo and redo which is yet to
be worked on.
Change-Id: I2607c370358e1fd21eb9e283567c0be4c7731a48
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 7f3dd31..3b79125 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -1015,7 +1015,7 @@ 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 SortReorder( ScSortInfoArray* pArray, ScProgress* pProgress );
+ void SortReorderByColumn( ScSortInfoArray* pArray, ScProgress* pProgress );
void SortReorderByRow( ScSortInfoArray* pArray, ScProgress* pProgress );
bool CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 0198c62..835fa02 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -564,14 +564,8 @@ public:
}
-void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress* pProgress )
+void ScTable::SortReorderByColumn( ScSortInfoArray* pArray, ScProgress* pProgress )
{
- if (aSortParam.bByRow)
- {
- SortReorderByRow(pArray, pProgress);
- return;
- }
-
size_t nCount = pArray->GetCount();
SCCOLROW nStart = pArray->GetStart();
SCCOLROW nLast = pArray->GetLast();
@@ -1124,7 +1118,7 @@ void ScTable::Sort(const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* p
DecoladeRow(pArray.get(), nRow1, nLastRow);
QuickSort(pArray.get(), nRow1, nLastRow);
- SortReorder(pArray.get(), pProgress);
+ SortReorderByRow(pArray.get(), pProgress);
// #i59745# update position of caption objects of cell notes --> reported at (SortReorder) ScColumn::SwapCellNotes level
}
@@ -1146,7 +1140,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);
- SortReorder(pArray.get(), pProgress);
+ SortReorderByColumn(pArray.get(), pProgress);
// #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 deaf244..f2f3107 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -51,6 +51,48 @@
#include <set>
#include <memory>
+#include <stdio.h>
+#include <string>
+#include <sys/time.h>
+
+namespace {
+
+class stack_printer
+{
+public:
+ explicit stack_printer(const char* msg) :
+ msMsg(msg)
+ {
+ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
+ mfStartTime = getTime();
+ }
+
+ ~stack_printer()
+ {
+ double fEndTime = getTime();
+ fprintf(stdout, "%s: --end (duration: %g sec)\n", msMsg.c_str(), (fEndTime - mfStartTime));
+ }
+
+ void printTime(int line) const
+ {
+ double fEndTime = getTime();
+ fprintf(stdout, "%s: --(%d) (duration: %g sec)\n", msMsg.c_str(), line, (fEndTime - mfStartTime));
+ }
+
+private:
+ double getTime() const
+ {
+ timeval tv;
+ gettimeofday(&tv, NULL);
+ return tv.tv_sec + tv.tv_usec / 1000000.0;
+ }
+
+ ::std::string msMsg;
+ double mfStartTime;
+};
+
+}
+
using namespace ::com::sun::star;
bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange, bool /* bApi */ )
@@ -425,6 +467,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bRecord, bool bApi, bo
bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
bool bRecord, bool bPaint, bool bApi )
{
+ stack_printer __stack_printer__("ScDBDocFunc::Sort");
ScDocShellModificator aModificator( rDocShell );
ScDocument* pDoc = rDocShell.GetDocument();
More information about the Libreoffice-commits
mailing list