summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-07-08 19:34:11 +0200
committerEike Rathke <erack@redhat.com>2015-07-08 22:21:05 +0200
commitb4317a01a72b2e0944311e6ad407cdf2ac0b1f1a (patch)
tree0dde59e434fdf3ae35adc517136c27d590d78dc8 /sc
parentb6c570aff4c6dc7a469ed0e2c3dff8ce8f9934b8 (diff)
replace implementation of ScRange::PutInOrder() with that of Justify()
It does the same, just more efficicient. Change-Id: Iee2e6a40cf8f8e8be629b458520ae392501af3e9
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/address.cxx33
1 files changed, 18 insertions, 15 deletions
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index fa34c6432293..a3f756d6a327 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -1406,21 +1406,24 @@ ScRange ScRange::Intersection( const ScRange& rOther ) const
void ScRange::PutInOrder()
{
- SCCOL nCol1 = aStart.Col(), nCol2 = aEnd.Col();
- SCROW nRow1 = aStart.Row(), nRow2 = aEnd.Row();
- SCTAB nTab1 = aStart.Tab(), nTab2 = aEnd.Tab();
-
- ::PutInOrder(nCol1, nCol2);
- ::PutInOrder(nRow1, nRow2);
- ::PutInOrder(nTab1, nTab2);
-
- aStart.SetCol(nCol1);
- aStart.SetRow(nRow1);
- aStart.SetTab(nTab1);
-
- aEnd.SetCol(nCol2);
- aEnd.SetRow(nRow2);
- aEnd.SetTab(nTab2);
+ SCCOL nTempCol;
+ if ( aEnd.Col() < (nTempCol = aStart.Col()) )
+ {
+ aStart.SetCol(aEnd.Col());
+ aEnd.SetCol(nTempCol);
+ }
+ SCROW nTempRow;
+ if ( aEnd.Row() < (nTempRow = aStart.Row()) )
+ {
+ aStart.SetRow(aEnd.Row());
+ aEnd.SetRow(nTempRow);
+ }
+ SCTAB nTempTab;
+ if ( aEnd.Tab() < (nTempTab = aStart.Tab()) )
+ {
+ aStart.SetTab(aEnd.Tab());
+ aEnd.SetTab(nTempTab);
+ }
}
void ScRange::Justify()