Related: fdo#38838 remove UniString::CompareIgnoreCaseToAscii

Change-Id: I4a9b34d63d2534a35aa9a878b8c2bec15262c2be
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index d5b7030..74e7e19 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -105,9 +105,9 @@ bool IsValidSbxName( const OUString& rName )
    return true;
}

static bool StringCompareLessThan( const String& rStr1, const String& rStr2 )
static bool StringCompareLessThan( const OUString& rStr1, const OUString& rStr2 )
{
    return (rStr1.CompareIgnoreCaseToAscii( rStr2 ) == COMPARE_LESS);
    return (rStr1.compareToIgnoreAsciiCase( rStr2 ) < 0);
}

//----------------------------------------------------------------------------
@@ -115,7 +115,7 @@ static bool StringCompareLessThan( const String& rStr1, const String& rStr2 )
Sequence< OUString > GetMergedLibraryNames( const Reference< script::XLibraryContainer >& xModLibContainer, const Reference< script::XLibraryContainer >& xDlgLibContainer )
{
    // create a sorted list of module library names
    ::std::vector<String> aModLibList;
    ::std::vector<OUString> aModLibList;
    if ( xModLibContainer.is() )
    {
        Sequence< OUString > aModLibNames = xModLibContainer->getElementNames();
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 41c2491..5087fda 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -588,11 +588,11 @@ namespace
struct TabBarSortHelper
{
    sal_uInt16      nPageId;
    String          aPageText;
    OUString        aPageText;

    bool operator < (TabBarSortHelper const& rComp) const
    {
        return aPageText.CompareIgnoreCaseToAscii(rComp.aPageText) == COMPARE_LESS;
        return aPageText.compareToIgnoreAsciiCase(rComp.aPageText) < 0;
    }
};

diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 8952742..1b9e4d7 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -216,21 +216,21 @@ void CheckBox::SetMode (ObjectMode::Mode e)

//----------------------------------------------------------------------------

SvTreeListEntry* CheckBox::DoInsertEntry( const String& rStr, sal_uLong nPos )
SvTreeListEntry* CheckBox::DoInsertEntry( const OUString& rStr, sal_uLong nPos )
{
    return SvTabListBox::InsertEntryToColumn( rStr, nPos, 0 );
}

//----------------------------------------------------------------------------

SvTreeListEntry* CheckBox::FindEntry( const String& rName )
SvTreeListEntry* CheckBox::FindEntry( const OUString& rName )
{
    sal_uLong nCount = GetEntryCount();
    for ( sal_uLong i = 0; i < nCount; i++ )
    {
        SvTreeListEntry* pEntry = GetEntry( i );
        DBG_ASSERT( pEntry, "pEntry?!" );
        if ( rName.CompareIgnoreCaseToAscii( GetEntryText( pEntry, 0 ) ) == COMPARE_EQUAL )
        if ( rName.equalsIgnoreAsciiCase( GetEntryText( pEntry, 0 ) ) )
            return pEntry;
    }
    return 0;
diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx
index 34de345..8d1576b 100644
--- a/basctl/source/basicide/moduldlg.hxx
+++ b/basctl/source/basicide/moduldlg.hxx
@@ -134,8 +134,8 @@ public:
    CheckBox( Window* pParent, const ResId& rResId );
    ~CheckBox();

    SvTreeListEntry*    DoInsertEntry( const String& rStr, sal_uLong nPos = LISTBOX_APPEND );
    SvTreeListEntry*    FindEntry( const String& rName );
    SvTreeListEntry*    DoInsertEntry( const OUString& rStr, sal_uLong nPos = LISTBOX_APPEND );
    SvTreeListEntry*    FindEntry( const OUString& rName );

    void            CheckEntryPos( sal_uLong nPos );
    bool            IsChecked( sal_uLong nPos ) const;
diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx
index 17cc607..8851d14 100644
--- a/basctl/source/basicide/scriptdocument.cxx
+++ b/basctl/source/basicide/scriptdocument.cxx
@@ -127,9 +127,9 @@ namespace basctl
    //====================================================================
    namespace
    {
        static bool StringCompareLessThan( const String& lhs, const String& rhs )
        static bool StringCompareLessThan( const OUString& lhs, const OUString& rhs )
        {
            return ( lhs.CompareIgnoreCaseToAscii( rhs ) == COMPARE_LESS );
            return ( lhs.compareToIgnoreAsciiCase( rhs ) < 0 );
        }

        class FilterDocuments : public docs::IDocumentDescriptorFilter
diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx
index 7a4ac8d..e0b5b08 100644
--- a/cui/source/options/optpath.cxx
+++ b/cui/source/options/optpath.cxx
@@ -489,14 +489,14 @@ void SvxPathTabPage::ChangeCurrentEntry( const String& _rFolder )
    aNewObj.removeFinalSlash();

    // then the new path also an URL else system path
    String sNewPathStr = bURL ? aPathStr : aNewObj.getFSysPath( INetURLObject::FSYS_DETECT );
    OUString sNewPathStr = bURL ? aPathStr : aNewObj.getFSysPath( INetURLObject::FSYS_DETECT );

    bool bChanged =
#ifdef UNX
// Unix is case sensitive
        ( sNewPathStr != sWritable );
#else
        ( sNewPathStr.CompareIgnoreCaseToAscii( sWritable ) != COMPARE_EQUAL );
        ( !sNewPathStr.equalsIgnoreAsciiCase( sWritable ) );
#endif

    if ( bChanged )
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 51ce476..199a13c 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -1447,19 +1447,19 @@ SvtFileDialogFilter_Impl* SvtFileDialog::FindFilter_Impl
    while ( nFilter-- )
    {
        SvtFileDialogFilter_Impl* pFilter = &(*pList)[ nFilter ];
        const String& rType = pFilter->GetType();
        String aSingleType = rType;
        const OUString& rType = pFilter->GetType();
        OUString aSingleType = rType;

        if ( _bMultiExt )
        {
            sal_Int32 nIdx = 0;
            while ( !pFoundFilter && nIdx != -1 )
            {
                aSingleType = rType.GetToken( 0, FILEDIALOG_DEF_EXTSEP, nIdx );
                aSingleType = rType.getToken( 0, FILEDIALOG_DEF_EXTSEP, nIdx );
#ifdef UNX
                if ( aSingleType == _rFilter )
#else
                if ( aSingleType.CompareIgnoreCaseToAscii( _rFilter ) == COMPARE_EQUAL )
                if ( aSingleType.equalsIgnoreAsciiCase( _rFilter ) )
#endif
                    pFoundFilter = pFilter;
            }
@@ -1467,7 +1467,7 @@ SvtFileDialogFilter_Impl* SvtFileDialog::FindFilter_Impl
#ifdef UNX
        else if ( rType == _rFilter )
#else
        else if ( rType.CompareIgnoreCaseToAscii( _rFilter ) == COMPARE_EQUAL )
        else if ( rType.equalsIgnoreAsciiCase( _rFilter ) )
#endif
            pFoundFilter = pFilter;

diff --git a/include/tools/string.hxx b/include/tools/string.hxx
index eedb3bd..435ca9b 100644
--- a/include/tools/string.hxx
+++ b/include/tools/string.hxx
@@ -229,10 +229,6 @@ public:
                                   xub_StrLen nLen = STRING_LEN ) const;
    StringCompare       CompareToAscii( const sal_Char* pAsciiStr,
                                        xub_StrLen nLen = STRING_LEN ) const;
    StringCompare       CompareIgnoreCaseToAscii( const UniString& rStr,
                                                  xub_StrLen nLen = STRING_LEN ) const;
    StringCompare       CompareIgnoreCaseToAscii( const sal_Char* pAsciiStr,
                                                  xub_StrLen nLen = STRING_LEN ) const;
    sal_Bool            Equals( const UniString& rStr ) const;
    sal_Bool            EqualsAscii( const sal_Char* pAsciiStr ) const;
    sal_Bool            EqualsIgnoreCaseAscii( const UniString& rStr ) const;
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index a22ef9b..c1d9d36 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1542,8 +1542,8 @@ namespace {
/** Functor for case-insensitive string comparison, usable in maps etc. */
struct IgnoreCaseCompare
{
    inline bool operator()( const String& rName1, const String& rName2 ) const
        { return rName1.CompareIgnoreCaseToAscii( rName2 ) == COMPARE_LESS; }
    inline bool operator()( const OUString& rName1, const OUString& rName2 ) const
        { return rName1.compareToIgnoreAsciiCase( rName2 ) < 0; }
};

} // namespace
@@ -1551,7 +1551,7 @@ struct IgnoreCaseCompare
void XclImpXFBuffer::CreateUserStyles()
{
    // calculate final names of all styles
    typedef ::std::map< String, XclImpStyle*, IgnoreCaseCompare > CellStyleNameMap;
    typedef ::std::map< OUString, XclImpStyle*, IgnoreCaseCompare > CellStyleNameMap;
    typedef ::std::vector< XclImpStyle* > XclImpStyleVector;

    CellStyleNameMap aCellStyles;
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 565fc90..f28039b 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1021,12 +1021,12 @@ void ScHTMLLayoutParser::TableDataOn( ImportInfo* pInfo )
            {
                bHorJustifyCenterTH = false;
                SvxCellHorJustify eVal;
                const String& rOptVal = rOption.GetString();
                if ( rOptVal.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_AL_right ) == COMPARE_EQUAL )
                const OUString& rOptVal = rOption.GetString();
                if ( rOptVal.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_AL_right )  )
                    eVal = SVX_HOR_JUSTIFY_RIGHT;
                else if ( rOptVal.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_AL_center ) == COMPARE_EQUAL )
                else if ( rOptVal.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_AL_center ) )
                    eVal = SVX_HOR_JUSTIFY_CENTER;
                else if ( rOptVal.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_AL_left ) == COMPARE_EQUAL )
                else if ( rOptVal.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_AL_left ) )
                    eVal = SVX_HOR_JUSTIFY_LEFT;
                else
                    eVal = SVX_HOR_JUSTIFY_STANDARD;
@@ -1037,12 +1037,12 @@ void ScHTMLLayoutParser::TableDataOn( ImportInfo* pInfo )
            case HTML_O_VALIGN:
            {
                SvxCellVerJustify eVal;
                const String& rOptVal = rOption.GetString();
                if ( rOptVal.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_VA_top ) == COMPARE_EQUAL )
                const OUString& rOptVal = rOption.GetString();
                if ( rOptVal.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_VA_top ) )
                    eVal = SVX_VER_JUSTIFY_TOP;
                else if ( rOptVal.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_VA_middle ) == COMPARE_EQUAL )
                else if ( rOptVal.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_VA_middle ) )
                    eVal = SVX_VER_JUSTIFY_CENTER;
                else if ( rOptVal.CompareIgnoreCaseToAscii( OOO_STRING_SVTOOLS_HTML_VA_bottom ) == COMPARE_EQUAL )
                else if ( rOptVal.equalsIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_VA_bottom ) )
                    eVal = SVX_VER_JUSTIFY_BOTTOM;
                else
                    eVal = SVX_VER_JUSTIFY_STANDARD;
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index a49e789..85f4c72 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -237,7 +237,7 @@ public:
struct QuickHelpData
{
    /// Strings that at least partially match an input word.
    std::vector<String> m_aHelpStrings;
    std::vector<OUString> m_aHelpStrings;
    /// Index of the current help string.
    sal_uInt16 nCurArrPos;
    /// Length of the input word associated with the help data.
@@ -5796,17 +5796,17 @@ namespace {

struct CompareIgnoreCaseAscii
{
    bool operator()(const String& s1, const String& s2) const
    bool operator()(const OUString& s1, const OUString& s2) const
    {
        return s1.CompareIgnoreCaseToAscii(s2) == COMPARE_LESS;
        return s1.compareToIgnoreAsciiCase(s2) < 0;
    }
};

struct EqualIgnoreCaseAscii
{
    bool operator()(const String& s1, const String& s2) const
    bool operator()(const OUString& s1, const OUString& s2) const
    {
        return s1.CompareIgnoreCaseToAscii(s2) == COMPARE_EQUAL;
        return s1.equalsIgnoreAsciiCase(s2);
    }
};

@@ -5819,7 +5819,7 @@ void QuickHelpData::SortAndFilter()
               m_aHelpStrings.end(),
               CompareIgnoreCaseAscii() );

    std::vector<String>::iterator it = std::unique( m_aHelpStrings.begin(),
    std::vector<OUString>::iterator it = std::unique( m_aHelpStrings.begin(),
                                                    m_aHelpStrings.end(),
                                                    EqualIgnoreCaseAscii() );
    m_aHelpStrings.erase( it, m_aHelpStrings.end() );
diff --git a/sw/source/ui/inc/gloslst.hxx b/sw/source/ui/inc/gloslst.hxx
index aa9f6d4..1c83e7d 100644
--- a/sw/source/ui/inc/gloslst.hxx
+++ b/sw/source/ui/inc/gloslst.hxx
@@ -56,7 +56,7 @@ public:
        SwGlossaryList();
        ~SwGlossaryList();

    bool HasLongName(const String& rBegin, std::vector<String> *pLongNames);
    bool HasLongName(const OUString& rBegin, std::vector<OUString> *pLongNames);
    sal_Bool            GetShortName(const String& rLongName,
                                        String& rShortName, String& rGroupName );

diff --git a/sw/source/ui/uno/unoatxt.cxx b/sw/source/ui/uno/unoatxt.cxx
index 6ffb983..6210faf 100644
--- a/sw/source/ui/uno/unoatxt.cxx
+++ b/sw/source/ui/uno/unoatxt.cxx
@@ -600,12 +600,12 @@ sal_Bool SwXAutoTextGroup::hasByName(const OUString& rName)
    else
        throw uno::RuntimeException();

    for( sal_uInt16 i = 0; i < nCount; i++ )
    for( sal_uInt16 i = 0; i < nCount; ++i )
    {
        String sCompare(pGlosGroup->GetShortName(i));
        if(COMPARE_EQUAL == sCompare.CompareIgnoreCaseToAscii(String(rName)))
        OUString sCompare(pGlosGroup->GetShortName(i));
        if(sCompare.equalsIgnoreAsciiCase(rName))
        {
            bRet = sal_True;
            bRet = true;
            break;
        }
    }
diff --git a/sw/source/ui/utlui/gloslst.cxx b/sw/source/ui/utlui/gloslst.cxx
index 5308845..37ef6eb9 100644
--- a/sw/source/ui/utlui/gloslst.cxx
+++ b/sw/source/ui/utlui/gloslst.cxx
@@ -378,13 +378,13 @@ void SwGlossaryList::FillGroup(AutoTextGroup* pGroup, SwGlossaries* pGlossaries)
// Give back all (not exceeding FIND_MAX_GLOS) found modules
// with matching beginning.

bool SwGlossaryList::HasLongName(const String& rBegin, std::vector<String> *pLongNames)
bool SwGlossaryList::HasLongName(const OUString& rBegin, std::vector<OUString> *pLongNames)
{
    if(!bFilled)
        Update();
    sal_uInt16 nFound = 0;
    sal_uInt16 nCount = aGroupArr.size();
    sal_uInt16 nBeginLen = rBegin.Len();
    sal_Int32 nBeginLen = rBegin.getLength();
    const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();

    for(sal_uInt16 i = 0; i < nCount; i++ )
diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx
index 83094ff..5fcea9f 100644
--- a/tools/source/string/strascii.cxx
+++ b/tools/source/string/strascii.cxx
@@ -313,24 +313,6 @@ StringCompare UniString::CompareToAscii( const sal_Char* pAsciiStr,
        return COMPARE_GREATER;
}

StringCompare UniString::CompareIgnoreCaseToAscii( const sal_Char* pAsciiStr,
                                                   xub_StrLen nLen ) const
{
    DBG_CHKTHIS( UniString, DbgCheckUniString );
    DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, nLen ),
                "UniString::CompareIgnoreCaseToAscii() - pAsciiStr include characters > 127" );

    // compare strings
    sal_Int32 nCompare = ImplStringICompareAscii( mpData->maStr, pAsciiStr, nLen );

    if ( nCompare == 0 )
        return COMPARE_EQUAL;
    else if ( nCompare < 0 )
        return COMPARE_LESS;
    else
        return COMPARE_GREATER;
}

sal_Bool UniString::EqualsAscii( const sal_Char* pAsciiStr ) const
{
    DBG_CHKTHIS( UniString, DbgCheckUniString );
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
index 2bc8280..4d081bd 100644
--- a/tools/source/string/tustring.cxx
+++ b/tools/source/string/tustring.cxx
@@ -172,31 +172,6 @@ sal_Bool STRING::EqualsIgnoreCaseAscii( const STRING& rStr, xub_StrLen nIndex, x
    return (ImplStringICompareWithoutZero( mpData->maStr+nIndex, rStr.mpData->maStr, nLen ) == 0);
}

StringCompare STRING::CompareIgnoreCaseToAscii( const STRING& rStr,
                                                xub_StrLen nLen ) const
{
    DBG_CHKTHIS( STRING, DBGCHECKSTRING );
    DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );

    if ( mpData == rStr.mpData )
        return COMPARE_EQUAL;

    // determine maximal length
    if ( mpData->mnLen < nLen )
        nLen = static_cast< xub_StrLen >(mpData->mnLen+1);
    if ( rStr.mpData->mnLen < nLen )
        nLen = static_cast< xub_StrLen >(rStr.mpData->mnLen+1);

    sal_Int32 nCompare = ImplStringICompareWithoutZero( mpData->maStr, rStr.mpData->maStr, nLen );

    if ( nCompare == 0 )
        return COMPARE_EQUAL;
    else if ( nCompare < 0 )
        return COMPARE_LESS;
    else
        return COMPARE_GREATER;
}

STRING& STRING::Insert( STRCODE c, xub_StrLen nIndex )
{
    DBG_CHKTHIS( STRING, DBGCHECKSTRING );