[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source
Eike Rathke
erack at redhat.com
Wed Jul 8 13:23:00 PDT 2015
sc/inc/address.hxx | 3 +--
sc/source/core/data/document.cxx | 4 ++--
sc/source/core/data/markdata.cxx | 2 +-
sc/source/core/tool/address.cxx | 28 ++++++----------------------
sc/source/core/tool/compiler.cxx | 2 +-
sc/source/core/tool/interpr3.cxx | 2 +-
sc/source/core/tool/interpr4.cxx | 2 +-
sc/source/filter/excel/xehelper.cxx | 2 +-
sc/source/filter/excel/xename.cxx | 2 +-
sc/source/ui/app/inputhdl.cxx | 2 +-
sc/source/ui/app/scmod.cxx | 2 +-
sc/source/ui/docshell/externalrefmgr.cxx | 2 +-
sc/source/ui/miscdlgs/optsolver.cxx | 2 +-
sc/source/ui/unoobj/cellsuno.cxx | 10 +++++-----
sc/source/ui/unoobj/chart2uno.cxx | 2 +-
sc/source/ui/unoobj/cursuno.cxx | 18 +++++++++---------
sc/source/ui/view/gridwin.cxx | 6 +++---
sc/source/ui/view/gridwin4.cxx | 2 +-
sc/source/ui/view/tabview3.cxx | 2 +-
sc/source/ui/view/tabvwsh3.cxx | 4 ++--
sc/source/ui/view/viewfun2.cxx | 4 ++--
21 files changed, 43 insertions(+), 60 deletions(-)
New commits:
commit 5ee9e2983a4b0f3df31e7f8ea4695c2c789edc56
Author: Eike Rathke <erack at redhat.com>
Date: Wed Jul 8 22:02:48 2015 +0200
remove ScRange::Justify() and replace calls with PutInOrder()
Change-Id: I350050ac085b1f220d5288d33c253ba0c9a5fd2c
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index f6650d4..9c062b8 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -540,15 +540,14 @@ public:
inline void GetVars( SCCOL& nCol1, SCROW& nRow1, SCTAB& nTab1,
SCCOL& nCol2, SCROW& nRow2, SCTAB& nTab2 ) const;
+ SC_DLLPUBLIC void PutInOrder();
// The document for the maximum defined sheet number
SC_DLLPUBLIC bool Move( SCsCOL aDeltaX, SCsROW aDeltaY, SCsTAB aDeltaZ, ScDocument* pDocument = NULL );
- SC_DLLPUBLIC void Justify();
SC_DLLPUBLIC void ExtendTo( const ScRange& rRange );
SC_DLLPUBLIC bool Intersects( const ScRange& rRange ) const; // do two ranges intersect?
ScRange Intersection( const ScRange& rOther ) const;
- void PutInOrder();
inline bool operator==( const ScRange& rRange ) const;
inline bool operator!=( const ScRange& rRange ) const;
inline bool operator<( const ScRange& rRange ) const;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index c8e9a0e..95655f2 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2008,7 +2008,7 @@ void ScDocument::CopyToDocument(const ScRange& rRange,
const ScMarkData* pMarks, bool bColRowFlags)
{
ScRange aNewRange = rRange;
- aNewRange.Justify();
+ aNewRange.PutInOrder();
if( pDestDoc->aDocName.isEmpty() )
pDestDoc->aDocName = aDocName;
@@ -2041,7 +2041,7 @@ void ScDocument::UndoToDocument(const ScRange& rRange,
sc::AutoCalcSwitch aAutoCalcSwitch(*this, false);
ScRange aNewRange = rRange;
- aNewRange.Justify();
+ aNewRange.PutInOrder();
SCTAB nTab1 = aNewRange.aStart.Tab();
SCTAB nTab2 = aNewRange.aEnd.Tab();
diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx
index 55537b2..28c18d7 100644
--- a/sc/source/core/data/markdata.cxx
+++ b/sc/source/core/data/markdata.cxx
@@ -99,7 +99,7 @@ void ScMarkData::ResetMark()
void ScMarkData::SetMarkArea( const ScRange& rRange )
{
aMarkRange = rRange;
- aMarkRange.Justify();
+ aMarkRange.PutInOrder();
if ( !bMarked )
{
// Upon creation of a document ScFormatShell GetTextAttrState
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index a3f756d..81e4047 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -1426,25 +1426,6 @@ void ScRange::PutInOrder()
}
}
-void ScRange::Justify()
-{
- 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::ExtendTo( const ScRange& rRange )
{
OSL_ENSURE( rRange.IsValid(), "ScRange::ExtendTo - cannot extend to invalid range" );
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e75bce8..0583f71 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5287,7 +5287,7 @@ bool ScCompiler::HandleTableRef()
else
{
aColRange.aEnd = mpToken->GetSingleRef()->toAbs( aPos);
- aColRange.Justify();
+ aColRange.PutInOrder();
bCol2Rel = mpToken->GetSingleRef()->IsColRel();
bCol2RelName = mpToken->GetSingleRef()->IsRelName();
}
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 47ac91e..f064f65 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3692,7 +3692,7 @@ void ScInterpreter::GetNumberSequenceArray( sal_uInt8 nParamCount, vector<double
if (nGlobalError)
break;
- aRange.Justify();
+ aRange.PutInOrder();
SCSIZE nCellCount = aRange.aEnd.Col() - aRange.aStart.Col() + 1;
nCellCount *= aRange.aEnd.Row() - aRange.aStart.Row() + 1;
rArray.reserve( rArray.size() + nCellCount);
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 72e0ce1..08c76b8 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1308,7 +1308,7 @@ void ScInterpreter::DoubleRefToRange( const ScComplexRefData & rCRef,
rRange.aStart.Set( nCol, nRow, nTab );
SingleRefToVars( rCRef.Ref2, nCol, nRow, nTab);
rRange.aEnd.Set( nCol, nRow, nTab );
- rRange.Justify();
+ rRange.PutInOrder();
if (! pDok->aTableOpList.empty() && !bDontCheckForTableOp )
{
if ( IsTableOpInRange( rRange ) )
diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx
index 0109d5e..ab144bb 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -203,7 +203,7 @@ bool XclExpAddressConverter::CheckRange( const ScRange& rScRange, bool bWarn )
bool XclExpAddressConverter::ValidateRange( ScRange& rScRange, bool bWarn )
{
- rScRange.Justify();
+ rScRange.PutInOrder();
// check start position
bool bValidStart = CheckAddress( rScRange.aStart, bWarn );
diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx
index d6347bc..3070752 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -601,7 +601,7 @@ void XclExpNameManagerImpl::CreateBuiltInNames()
// Calc document does not care about sheet index in print ranges
aRange.aStart.SetTab( nScTab );
aRange.aEnd.SetTab( nScTab );
- aRange.Justify();
+ aRange.PutInOrder();
aRangeList.Append( aRange );
}
// create the NAME record (do not warn if ranges are shrunken)
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index e2a7bc0..001aa27 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -339,7 +339,7 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew )
ColorData nNewColor = pRangeFindList->FindColor( rNew, nIndex );
ScRange aJustified = rNew;
- aJustified.Justify(); // Always display Ref in the Formula the right way
+ aJustified.PutInOrder(); // Always display Ref in the Formula the right way
ScDocument* pDoc = pDocView->GetViewData().GetDocument();
const ScAddress::Details aAddrDetails( pDoc, aCursorPos );
OUString aNewStr(aJustified.Format(rData.nFlags, pDoc, aAddrDetails));
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index c135b53..754ba8b 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1723,7 +1723,7 @@ void ScModule::SetReference( const ScRange& rRef, ScDocument* pDoc,
// In RefDialogs we also trigger the ZoomIn, if the Ref's Start and End are different
ScRange aNew = rRef;
- aNew.Justify(); // Always in the right direction
+ aNew.PutInOrder(); // Always in the right direction
if( nCurRefDlgId )
{
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 042201d..ce77550 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2170,7 +2170,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokensFromSr
}
ScRange aRange(rRange);
- aRange.Justify();
+ aRange.PutInOrder();
SCTAB nTabSpan = aRange.aEnd.Tab() - aRange.aStart.Tab();
vector<ScExternalRefCache::SingleRangeData> aCacheData;
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index 7f960ac..bb55b6f 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -896,7 +896,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal
for ( size_t nRangePos=0, nRange = aVarRanges.size(); nRangePos < nRange; ++nRangePos )
{
ScRange aRange(*aVarRanges[ nRangePos ] );
- aRange.Justify();
+ aRange.PutInOrder();
SCTAB nTab = aRange.aStart.Tab();
// resolve into single cells
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index b7922d6..6f0a835 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1414,7 +1414,7 @@ ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR) :
--m_refCount;
ScRange aCellRange(rR);
- aCellRange.Justify();
+ aCellRange.PutInOrder();
aRanges.Append( aCellRange );
if (pDocShell) // Null if created with createInstance
@@ -1705,7 +1705,7 @@ void ScCellRangesBase::InitInsertRange(ScDocShell* pDocSh, const ScRange& rR)
pDocShell = pDocSh;
ScRange aCellRange(rR);
- aCellRange.Justify();
+ aCellRange.PutInOrder();
aRanges.RemoveAll();
aRanges.Append( aCellRange );
@@ -1727,7 +1727,7 @@ void ScCellRangesBase::AddRange(const ScRange& rRange, const bool bMergeRanges)
void ScCellRangesBase::SetNewRange(const ScRange& rNew)
{
ScRange aCellRange(rNew);
- aCellRange.Justify();
+ aCellRange.PutInOrder();
aRanges.RemoveAll();
aRanges.Append( aCellRange );
@@ -4792,7 +4792,7 @@ ScCellRangeObj::ScCellRangeObj(ScDocShell* pDocSh, const ScRange& rR) :
pRangePropSet( lcl_GetRangePropertySet() ),
aRange( rR )
{
- aRange.Justify(); // Anfang / Ende richtig
+ aRange.PutInOrder(); // Anfang / Ende richtig
}
ScCellRangeObj::~ScCellRangeObj()
@@ -4809,7 +4809,7 @@ void ScCellRangeObj::RefChanged()
{
const ScRange* pFirst = rRanges[0];
aRange = ScRange(*pFirst);
- aRange.Justify();
+ aRange.PutInOrder();
}
}
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index d98cea5..755b7aa 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -3125,7 +3125,7 @@ public:
ScRange r;
bool bExternal = ScRefTokenHelper::isExternalRef(pToken);
ScRefTokenHelper::getRangeFromToken(r, pToken, ScAddress(), bExternal);
- r.Justify();
+ r.PutInOrder();
mnCols += r.aEnd.Col() - r.aStart.Col() + 1;
mnRows += r.aEnd.Row() - r.aStart.Row() + 1;
}
diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx
index 285042f..fd30a8a 100644
--- a/sc/source/ui/unoobj/cursuno.cxx
+++ b/sc/source/ui/unoobj/cursuno.cxx
@@ -100,7 +100,7 @@ void SAL_CALL ScCellCursorObj::collapseToCurrentRegion() throw(uno::RuntimeExcep
OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
ScRange aOneRange( *rRanges[ 0 ] );
- aOneRange.Justify();
+ aOneRange.PutInOrder();
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
@@ -126,7 +126,7 @@ void SAL_CALL ScCellCursorObj::collapseToCurrentArray()
OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
ScRange aOneRange( *rRanges[ 0 ] );
- aOneRange.Justify();
+ aOneRange.PutInOrder();
ScAddress aCursor(aOneRange.aStart); // use the start address of the range
ScDocShell* pDocSh = GetDocShell();
@@ -210,7 +210,7 @@ void SAL_CALL ScCellCursorObj::collapseToSize( sal_Int32 nColumns, sal_Int32 nRo
OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
ScRange aNewRange( *rRanges[ 0 ] );
- aNewRange.Justify(); //! wirklich?
+ aNewRange.PutInOrder(); //! wirklich?
long nEndX = aNewRange.aStart.Col() + nColumns - 1;
long nEndY = aNewRange.aStart.Row() + nRows - 1;
@@ -223,7 +223,7 @@ void SAL_CALL ScCellCursorObj::collapseToSize( sal_Int32 nColumns, sal_Int32 nRo
aNewRange.aEnd.SetCol((SCCOL)nEndX);
aNewRange.aEnd.SetRow((SCROW)nEndY);
- aNewRange.Justify(); //! wirklich?
+ aNewRange.PutInOrder(); //! wirklich?
SetNewRange( aNewRange );
}
@@ -299,7 +299,7 @@ void SAL_CALL ScCellCursorObj::gotoStart() throw(uno::RuntimeException, std::exc
OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
ScRange aOneRange( *rRanges[ 0 ]);
- aOneRange.Justify();
+ aOneRange.PutInOrder();
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
@@ -327,7 +327,7 @@ void SAL_CALL ScCellCursorObj::gotoEnd() throw(uno::RuntimeException, std::excep
OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
ScRange aOneRange( *rRanges[ 0 ] );
- aOneRange.Justify();
+ aOneRange.PutInOrder();
ScDocShell* pDocSh = GetDocShell();
if ( pDocSh )
{
@@ -352,7 +352,7 @@ void SAL_CALL ScCellCursorObj::gotoNext() throw(uno::RuntimeException, std::exce
OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
ScRange aOneRange( *rRanges[ 0 ] );
- aOneRange.Justify();
+ aOneRange.PutInOrder();
ScAddress aCursor(aOneRange.aStart); // bei Block immer den Start nehmen
ScMarkData aMark; // not used with bMarked=FALSE
@@ -374,7 +374,7 @@ void SAL_CALL ScCellCursorObj::gotoPrevious() throw(uno::RuntimeException, std::
OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
ScRange aOneRange( *rRanges[ 0 ] );
- aOneRange.Justify();
+ aOneRange.PutInOrder();
ScAddress aCursor(aOneRange.aStart); // bei Block immer den Start nehmen
ScMarkData aMark; // not used with bMarked=FALSE
@@ -396,7 +396,7 @@ void SAL_CALL ScCellCursorObj::gotoOffset( sal_Int32 nColumnOffset, sal_Int32 nR
const ScRangeList& rRanges = GetRangeList();
OSL_ENSURE( rRanges.size() == 1, "Range? Ranges?" );
ScRange aOneRange( *rRanges[ 0 ] );
- aOneRange.Justify();
+ aOneRange.PutInOrder();
if ( aOneRange.aStart.Col() + nColumnOffset >= 0 &&
aOneRange.aEnd.Col() + nColumnOffset <= MAXCOL &&
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 5acc912..c6ba729 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5068,8 +5068,8 @@ static void lcl_PaintRefChanged( ScDocShell* pDocSh, const ScRange& rOldUn, cons
ScRange aOld = rOldUn;
ScRange aNew = rNewUn;
- aOld.Justify();
- aNew.Justify();
+ aOld.PutInOrder();
+ aNew.PutInOrder();
if ( aOld.aStart == aOld.aEnd ) //! Tab ignorieren?
pDocSh->GetDocument().ExtendMerge(aOld);
@@ -5255,7 +5255,7 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp )
}
if ( bUp )
- aNew.Justify(); // beim ButtonUp wieder richtigherum
+ aNew.PutInOrder(); // beim ButtonUp wieder richtigherum
if ( aNew != aOld )
{
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 4357f52..9a0dfd6 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -855,7 +855,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
ScRangeFindData& rData = pRangeFinder->GetObject(i);
ScRange aRef = rData.aRef;
- aRef.Justify();
+ aRef.PutInOrder();
if ( aRef.aStart.Tab() >= nTab && aRef.aEnd.Tab() <= nTab )
aOutputData.DrawRefMark( aRef.aStart.Col(), aRef.aStart.Row(),
aRef.aEnd.Col(), aRef.aEnd.Row(),
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 3229f08..80f7858 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2028,7 +2028,7 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO
void ScTabView::PaintRangeFinderEntry (ScRangeFindData* pData, const SCTAB nTab)
{
ScRange aRef = pData->aRef;
- aRef.Justify(); // Justify fuer die Abfragen unten
+ aRef.PutInOrder(); // PutInOrder fuer die Abfragen unten
if ( aRef.aStart == aRef.aEnd ) //! Tab ignorieren?
aViewData.GetDocument()->ExtendMerge(aRef);
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 8fdce44..f0fc87f 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -360,9 +360,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
{
ScRange aOldMark;
rMark.GetMarkArea( aOldMark );
- aOldMark.Justify();
+ aOldMark.PutInOrder();
ScRange aCurrent = aScRange;
- aCurrent.Justify();
+ aCurrent.PutInOrder();
bNothing = ( aCurrent == aOldMark );
}
else
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 9919956..ce0457a 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1503,7 +1503,7 @@ void ScViewFunc::FillCrossDblClick()
{
ScRange aRange;
GetViewData().GetSimpleArea( aRange );
- aRange.Justify();
+ aRange.PutInOrder();
SCTAB nTab = GetViewData().GetCurPos().Tab();
SCCOL nStartX = aRange.aStart.Col();
@@ -1563,7 +1563,7 @@ void ScViewFunc::ConvertFormulaToValue()
{
ScRange aRange;
GetViewData().GetSimpleArea(aRange);
- aRange.Justify();
+ aRange.PutInOrder();
ScDocShell* pDocSh = GetViewData().GetDocShell();
pDocSh->GetDocFunc().ConvertFormulaToValue(aRange, true, true);
commit b4317a01a72b2e0944311e6ad407cdf2ac0b1f1a
Author: Eike Rathke <erack at redhat.com>
Date: Wed Jul 8 19:34:11 2015 +0200
replace implementation of ScRange::PutInOrder() with that of Justify()
It does the same, just more efficicient.
Change-Id: Iee2e6a40cf8f8e8be629b458520ae392501af3e9
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index fa34c64..a3f756d 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()
More information about the Libreoffice-commits
mailing list