summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/userlist.hxx4
-rw-r--r--sc/source/core/data/conditio.cxx19
-rw-r--r--sc/source/core/data/funcdesc.cxx2
-rw-r--r--sc/source/core/tool/rangelst.cxx96
-rw-r--r--sc/source/core/tool/userlist.cxx28
-rw-r--r--sc/source/filter/excel/xelink.cxx2
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx28
-rw-r--r--sc/source/ui/miscdlgs/solveroptions.cxx2
8 files changed, 91 insertions, 90 deletions
diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx
index 0cecf316bcfc..f87f32826ecb 100644
--- a/sc/inc/userlist.hxx
+++ b/sc/inc/userlist.hxx
@@ -55,8 +55,8 @@ public:
size_t GetSubCount() const;
bool GetSubIndex(const OUString& rSubStr, sal_uInt16& rIndex) const;
OUString GetSubStr(sal_uInt16 nIndex) const;
- StringCompare Compare(const OUString& rSubStr1, const OUString& rSubStr2) const;
- StringCompare ICompare(const OUString& rSubStr1, const OUString& rSubStr2) const;
+ sal_Int32 Compare(const OUString& rSubStr1, const OUString& rSubStr2) const;
+ sal_Int32 ICompare(const OUString& rSubStr1, const OUString& rSubStr2) const;
};
/**
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 3ab133c3ddb7..117f2a096372 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1148,8 +1148,7 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos )
OUString aUpVal2( aStrVal2 );
if ( eOp == SC_COND_BETWEEN || eOp == SC_COND_NOTBETWEEN )
- if ( ScGlobal::GetCollator()->compareString( aUpVal1, aUpVal2 )
- == COMPARE_GREATER )
+ if (ScGlobal::GetCollator()->compareString( aUpVal1, aUpVal2 ) > 0)
{
// richtige Reihenfolge fuer Wertebereich
OUString aTemp( aUpVal1 ); aUpVal1 = aUpVal2; aUpVal2 = aTemp;
@@ -1159,11 +1158,11 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos )
{
case SC_COND_EQUAL:
bValid = (ScGlobal::GetCollator()->compareString(
- rArg, aUpVal1 ) == COMPARE_EQUAL);
+ rArg, aUpVal1 ) == 0);
break;
case SC_COND_NOTEQUAL:
bValid = (ScGlobal::GetCollator()->compareString(
- rArg, aUpVal1 ) != COMPARE_EQUAL);
+ rArg, aUpVal1 ) != 0);
break;
case SC_COND_TOP_PERCENT:
case SC_COND_BOTTOM_PERCENT:
@@ -1197,23 +1196,23 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos )
switch ( eOp )
{
case SC_COND_GREATER:
- bValid = ( nCompare == COMPARE_GREATER );
+ bValid = ( nCompare > 0 );
break;
case SC_COND_EQGREATER:
- bValid = ( nCompare == COMPARE_EQUAL || nCompare == COMPARE_GREATER );
+ bValid = ( nCompare >= 0 );
break;
case SC_COND_LESS:
- bValid = ( nCompare == COMPARE_LESS );
+ bValid = ( nCompare < 0 );
break;
case SC_COND_EQLESS:
- bValid = ( nCompare == COMPARE_EQUAL || nCompare == COMPARE_LESS );
+ bValid = ( nCompare <= 0 );
break;
case SC_COND_BETWEEN:
case SC_COND_NOTBETWEEN:
// Test auf NOTBETWEEN:
- bValid = ( nCompare == COMPARE_LESS ||
+ bValid = ( nCompare < 0 ||
ScGlobal::GetCollator()->compareString( rArg,
- aUpVal2 ) == COMPARE_GREATER );
+ aUpVal2 ) > 0 );
if ( eOp == SC_COND_BETWEEN )
bValid = !bValid;
break;
diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx
index 0874b0a5e5c0..21bb8596de8d 100644
--- a/sc/source/core/data/funcdesc.cxx
+++ b/sc/source/core/data/funcdesc.cxx
@@ -394,7 +394,7 @@ bool ScFuncDesc::isParameterOptional(sal_uInt32 _nPos) const
bool ScFuncDesc::compareByName(const ScFuncDesc* a, const ScFuncDesc* b)
{
- return (ScGlobal::GetCaseCollator()->compareString(*a->pFuncName, *b->pFuncName ) == COMPARE_LESS);
+ return (ScGlobal::GetCaseCollator()->compareString(*a->pFuncName, *b->pFuncName ) < 0);
}
//===================================================================
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index ee48e0fa36e7..076b302b88a1 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -1393,66 +1393,68 @@ int SAL_CALL ScRangePairList_QsortNameCompare( const void* p1, const void* p2 )
OUString aStr1, aStr2;
sal_Int32 nComp;
if ( rStartPos1.Tab() == rStartPos2.Tab() )
- nComp = COMPARE_EQUAL;
+ nComp = 0;
else
{
ps1->pDoc->GetName( rStartPos1.Tab(), aStr1 );
ps2->pDoc->GetName( rStartPos2.Tab(), aStr2 );
nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 );
}
- switch ( nComp )
+ if (nComp < 0)
{
- case COMPARE_LESS:
+ return -1;
+ }
+ else if (nComp > 0)
+ {
+ return 1;
+ }
+ else
+ {
+ // gleiche Tabs
+ if ( rStartPos1.Col() < rStartPos2.Col() )
return -1;
- //break;
- case COMPARE_GREATER:
+ if ( rStartPos1.Col() > rStartPos2.Col() )
return 1;
- //break;
- default:
- // gleiche Tabs
- if ( rStartPos1.Col() < rStartPos2.Col() )
- return -1;
- if ( rStartPos1.Col() > rStartPos2.Col() )
- return 1;
- // gleiche Cols
- if ( rStartPos1.Row() < rStartPos2.Row() )
+ // gleiche Cols
+ if ( rStartPos1.Row() < rStartPos2.Row() )
+ return -1;
+ if ( rStartPos1.Row() > rStartPos2.Row() )
+ return 1;
+ // erste Ecke gleich, zweite Ecke
+ {
+ const ScAddress& rEndPos1 = ps1->pPair->GetRange(0).aEnd;
+ const ScAddress& rEndPos2 = ps2->pPair->GetRange(0).aEnd;
+ if ( rEndPos1.Tab() == rEndPos2.Tab() )
+ nComp = 0;
+ else
+ {
+ ps1->pDoc->GetName( rEndPos1.Tab(), aStr1 );
+ ps2->pDoc->GetName( rEndPos2.Tab(), aStr2 );
+ nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 );
+ }
+ if (nComp < 0)
+ {
return -1;
- if ( rStartPos1.Row() > rStartPos2.Row() )
+ }
+ else if (nComp > 0)
+ {
return 1;
- // erste Ecke gleich, zweite Ecke
+ }
+ else
{
- const ScAddress& rEndPos1 = ps1->pPair->GetRange(0).aEnd;
- const ScAddress& rEndPos2 = ps2->pPair->GetRange(0).aEnd;
- if ( rEndPos1.Tab() == rEndPos2.Tab() )
- nComp = COMPARE_EQUAL;
- else
- {
- ps1->pDoc->GetName( rEndPos1.Tab(), aStr1 );
- ps2->pDoc->GetName( rEndPos2.Tab(), aStr2 );
- nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 );
- }
- switch ( nComp )
- {
- case COMPARE_LESS:
- return -1;
- //break;
- case COMPARE_GREATER:
- return 1;
- //break;
- default:
- // gleiche Tabs
- if ( rEndPos1.Col() < rEndPos2.Col() )
- return -1;
- if ( rEndPos1.Col() > rEndPos2.Col() )
- return 1;
- // gleiche Cols
- if ( rEndPos1.Row() < rEndPos2.Row() )
- return -1;
- if ( rEndPos1.Row() > rEndPos2.Row() )
- return 1;
- return 0;
- }
+ // gleiche Tabs
+ if ( rEndPos1.Col() < rEndPos2.Col() )
+ return -1;
+ if ( rEndPos1.Col() > rEndPos2.Col() )
+ return 1;
+ // gleiche Cols
+ if ( rEndPos1.Row() < rEndPos2.Row() )
+ return -1;
+ if ( rEndPos1.Row() > rEndPos2.Row() )
+ return 1;
+ return 0;
}
+ }
}
#ifndef _MSC_VER // MSVC is good enough to warn about unreachable code here.
// Or stupid enough to bother warning about it, depending
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index 4d5ed081f978..a379e2288d13 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -143,7 +143,7 @@ OUString ScUserListData::GetSubStr(sal_uInt16 nIndex) const
return OUString();
}
-StringCompare ScUserListData::Compare(const OUString& rSubStr1, const OUString& rSubStr2) const
+sal_Int32 ScUserListData::Compare(const OUString& rSubStr1, const OUString& rSubStr2) const
{
sal_uInt16 nIndex1, nIndex2;
bool bFound1 = GetSubIndex(rSubStr1, nIndex1);
@@ -153,22 +153,22 @@ StringCompare ScUserListData::Compare(const OUString& rSubStr1, const OUString&
if (bFound2)
{
if (nIndex1 < nIndex2)
- return COMPARE_LESS;
+ return -1;
else if (nIndex1 > nIndex2)
- return COMPARE_GREATER;
+ return 1;
else
- return COMPARE_EQUAL;
+ return 0;
}
else
- return COMPARE_LESS;
+ return -1;
}
else if (bFound2)
- return COMPARE_GREATER;
+ return 1;
else
- return (StringCompare) ScGlobal::GetCaseTransliteration()->compareString( rSubStr1, rSubStr2 );
+ return ScGlobal::GetCaseTransliteration()->compareString( rSubStr1, rSubStr2 );
}
-StringCompare ScUserListData::ICompare(const OUString& rSubStr1, const OUString& rSubStr2) const
+sal_Int32 ScUserListData::ICompare(const OUString& rSubStr1, const OUString& rSubStr2) const
{
sal_uInt16 nIndex1, nIndex2;
bool bFound1 = GetSubIndex(rSubStr1, nIndex1);
@@ -178,19 +178,19 @@ StringCompare ScUserListData::ICompare(const OUString& rSubStr1, const OUString&
if (bFound2)
{
if (nIndex1 < nIndex2)
- return COMPARE_LESS;
+ return -1;
else if (nIndex1 > nIndex2)
- return COMPARE_GREATER;
+ return 1;
else
- return COMPARE_EQUAL;
+ return 0;
}
else
- return COMPARE_LESS;
+ return -1;
}
else if (bFound2)
- return COMPARE_GREATER;
+ return 1;
else
- return (StringCompare) ScGlobal::GetpTransliteration()->compareString( rSubStr1, rSubStr2 );
+ return ScGlobal::GetpTransliteration()->compareString( rSubStr1, rSubStr2 );
}
ScUserList::ScUserList()
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index 29515505e54d..e08b6922a57f 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -839,7 +839,7 @@ typedef ::std::vector< XclExpTabName > XclExpTabNameVec;
inline bool operator<( const XclExpTabName& rArg1, const XclExpTabName& rArg2 )
{
// compare the sheet names only
- return ScGlobal::GetCollator()->compareString( rArg1.first, rArg2.first ) == COMPARE_LESS;
+ return ScGlobal::GetCollator()->compareString( rArg1.first, rArg2.first ) < 0;
}
void XclExpTabInfo::CalcSortedIndexes()
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index f837b42e14d2..3f077d80d4fc 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -1881,7 +1881,7 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, FilterModified)
IMPL_LINK( ScAcceptChgDlg, ColCompareHdl, SvSortData*, pSortData )
{
- StringCompare eCompare=COMPARE_EQUAL;
+ sal_Int32 nCompare = 0;
SCCOL nSortCol= static_cast<SCCOL>(pTheView->GetSortedCol());
if(pSortData)
@@ -1897,11 +1897,10 @@ IMPL_LINK( ScAcceptChgDlg, ColCompareHdl, SvSortData*, pSortData )
if(pLeftData!=NULL && pRightData!=NULL)
{
if(pLeftData->aDateTime < pRightData->aDateTime)
- eCompare=COMPARE_LESS;
+ nCompare = -1;
else if(pLeftData->aDateTime > pRightData->aDateTime)
- eCompare=COMPARE_GREATER;
-
- return eCompare;
+ nCompare = 1;
+ return nCompare;
}
}
else if(CALC_POS==nSortCol)
@@ -1911,24 +1910,24 @@ IMPL_LINK( ScAcceptChgDlg, ColCompareHdl, SvSortData*, pSortData )
if(pLeftData!=NULL && pRightData!=NULL)
{
- eCompare=COMPARE_GREATER;
+ nCompare = 1;
if(pLeftData->nTable < pRightData->nTable)
- eCompare=COMPARE_LESS;
+ nCompare = -1;
else if(pLeftData->nTable == pRightData->nTable)
{
if(pLeftData->nRow < pRightData->nRow)
- eCompare=COMPARE_LESS;
+ nCompare = -1;
else if(pLeftData->nRow == pRightData->nRow)
{
if(pLeftData->nCol < pRightData->nCol)
- eCompare=COMPARE_LESS;
+ nCompare = -1;
else if(pLeftData->nCol == pRightData->nCol)
- eCompare=COMPARE_EQUAL;
+ nCompare = 0;
}
}
- return eCompare;
+ return nCompare;
}
}
@@ -1943,17 +1942,18 @@ IMPL_LINK( ScAcceptChgDlg, ColCompareHdl, SvSortData*, pSortData )
if(nRightKind == SV_ITEM_ID_LBOXSTRING &&
nLeftKind == SV_ITEM_ID_LBOXSTRING )
{
- eCompare= (StringCompare) ScGlobal::GetCaseCollator()->compareString(
+ nCompare = ScGlobal::GetCaseCollator()->compareString(
((SvLBoxString*)pLeftItem)->GetText(),
((SvLBoxString*)pRightItem)->GetText());
- if(eCompare==COMPARE_EQUAL) eCompare=COMPARE_LESS;
+ if (nCompare == 0)
+ nCompare = -1;
}
}
}
- return eCompare;
+ return nCompare;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx
index b2783de353f3..6488c7b46261 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -51,7 +51,7 @@ struct ScSolverOptionsEntry
bool operator< (const ScSolverOptionsEntry& rOther) const
{
- return ( ScGlobal::GetCollator()->compareString( aDescription, rOther.aDescription ) == COMPARE_LESS );
+ return (ScGlobal::GetCollator()->compareString( aDescription, rOther.aDescription ) < 0);
}
};