Related: fdo#38838 remove UniString::EqualsAscii
Change-Id: I55c85c1c44452c7fb6ac40591aea7177d054affe
diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx
index fc15b09..f596531 100644
--- a/comphelper/source/misc/string.cxx
+++ b/comphelper/source/misc/string.cxx
@@ -417,6 +417,38 @@ sal_Int32 indexOfAny(OUString const& rIn,
return -1;
}
OUString setToken(const OUString& rIn, sal_Int32 nToken, sal_Unicode cTok,
const OUString& rNewToken)
{
const sal_Unicode* pStr = rIn.getStr();
sal_Int32 nLen = rIn.getLength();
sal_Int32 nTok = 0;
sal_Int32 nFirstChar = 0;
sal_Int32 i = 0;
// Determine token position and length
while ( i < nLen )
{
// Increase token count if match
if (*pStr == cTok)
{
++nTok;
if (nTok == nToken)
nFirstChar = i+1;
else if (nTok > nToken)
break;
}
++pStr,
++i;
}
if (nTok >= nToken)
return rIn.replaceAt(nFirstChar, i-nFirstChar, rNewToken);
return rIn;
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx
index e599509..73f3ab9 100644
--- a/include/comphelper/string.hxx
+++ b/include/comphelper/string.hxx
@@ -285,6 +285,17 @@ COMPHELPER_DLLPUBLIC inline OUStringBuffer& padToLength(
return detail::padToLength(rBuffer, nLength, cFill);
}
/** Replace a token in a string
@param rIn OUString in which the token is to be replaced
@param nToken which nToken to replace
@param cTok token delimiter
@param rNewToken replacement token
@return original string with token nToken replaced by rNewToken
*/
COMPHELPER_DLLPUBLIC OUString setToken(const OUString& rIn, sal_Int32 nToken, sal_Unicode cTok,
const OUString& rNewToken);
/** Find any of a list of code units in the string.
@param rIn OUString to search
@param pChars 0-terminated array of sal_Unicode code units to search for
diff --git a/include/tools/string.hxx b/include/tools/string.hxx
index 75aa0b8..008a822 100644
--- a/include/tools/string.hxx
+++ b/include/tools/string.hxx
@@ -230,11 +230,8 @@ public:
StringCompare CompareToAscii( 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 Equals( const UniString& rStr,
xub_StrLen nIndex, xub_StrLen nLen ) const;
sal_Bool EqualsAscii( const sal_Char* pAsciiStr,
xub_StrLen nIndex, xub_StrLen nLen ) const;
xub_StrLen Match( const UniString& rStr ) const;
diff --git a/sw/inc/iodetect.hxx b/sw/inc/iodetect.hxx
index 39ca15f..b47ba35 100644
--- a/sw/inc/iodetect.hxx
+++ b/sw/inc/iodetect.hxx
@@ -46,20 +46,19 @@
struct SwIoDetect
{
const sal_Char* pName;
sal_uInt16 nLen;
const OUString sName;
inline SwIoDetect( const sal_Char *pN, sal_uInt16 nL )
: pName( pN ), nLen( nL )
{}
inline int IsFilter( const String& rNm ) const
SwIoDetect(const OUString &rN)
: sName(rN)
{
return pName && rNm.EqualsAscii( pName, 0, nLen );
}
const sal_Char* IsReader( const sal_Char* pHeader, sal_uLong nLen_,
const String &rFileName, const String& rUserData ) const;
bool IsFilter( const OUString& rNm ) const
{
return rNm.startsWith(sName);
}
OUString IsReader(const sal_Char* pHeader, sal_uLong nLen_) const;
};
enum ReaderWriterEnum {
diff --git a/sw/inc/shellres.hxx b/sw/inc/shellres.hxx
index 793cad6..66e81f8 100644
--- a/sw/inc/shellres.hxx
+++ b/sw/inc/shellres.hxx
@@ -57,7 +57,7 @@ struct SW_DLLPUBLIC ShellResource : public Resource
//Names of TOXs.
String aTOXIndexName;
String aTOXUserName;
OUString aTOXUserName;
String aTOXContentName;
String aTOXIllustrationsName;
String aTOXObjectsName;
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index f411842..14dc73c 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2590,44 +2590,40 @@ SwXTextFieldMasters::~SwXTextFieldMasters()
Falls wir grosszuegig werden wollen, dann koennte man com.sun.star.text
auch optional weglassen
-----------------------------------------------------------------------*/
static sal_uInt16 lcl_GetIdByName( String& rName, String& rTypeName )
static sal_uInt16 lcl_GetIdByName( OUString& rName, OUString& rTypeName )
{
if( rName.EqualsAscii( COM_TEXT_FLDMASTER, 0, RTL_CONSTASCII_LENGTH(COM_TEXT_FLDMASTER ))
|| rName.EqualsAscii( COM_TEXT_FLDMASTER_CC, 0, RTL_CONSTASCII_LENGTH(COM_TEXT_FLDMASTER_CC )))
rName.Erase(0, 30);
if (rName.startsWith(COM_TEXT_FLDMASTER) || rName.startsWith(COM_TEXT_FLDMASTER_CC))
rName = rName.copy(30);
sal_uInt16 nResId = USHRT_MAX;
sal_Int32 nFound = 0;
rTypeName = rName.GetToken( 0, '.', nFound );
if(rTypeName.EqualsAscii("User"))
rTypeName = rName.getToken( 0, '.', nFound );
if (rTypeName == "User")
nResId = RES_USERFLD;
else if(rTypeName.EqualsAscii("DDE"))
else if (rTypeName == "DDE")
nResId = RES_DDEFLD;
else if(rTypeName.EqualsAscii("SetExpression"))
else if (rTypeName == "SetExpression")
{
nResId = RES_SETEXPFLD;
String sFldTypName( rName.GetToken( 1, '.' ));
String sFldTypName( rName.getToken( 1, '.' ));
String sUIName( SwStyleNameMapper::GetSpecialExtraUIName( sFldTypName ) );
if( sUIName != sFldTypName )
rName.SetToken( 1, '.', sUIName );
rName = comphelper::string::setToken(rName, 1, '.', sUIName);
}
else if(rTypeName.EqualsAscii("DataBase"))
else if (rTypeName == "DataBase")
{
rName.Erase( 0, RTL_CONSTASCII_LENGTH( "DataBase." ));
rName = rName.copy(RTL_CONSTASCII_LENGTH("DataBase."));
sal_uInt16 nDotCount = comphelper::string::getTokenCount(rName, '.');
if( 2 <= nDotCount )
{
// #i51815#
//rName.SearchAndReplace('.', DB_DELIM);
//rName.SetChar( rName.SearchBackward( '.' ), DB_DELIM );
rName = OUString("DataBase.") + rName;
nResId = RES_DBFLD;
}
}
else if( rTypeName.EqualsAscii("Bibliography"))
else if (rTypeName == "Bibliography")
nResId = RES_AUTHORITY;
return nResId;
}
@@ -2639,12 +2635,12 @@ uno::Any SwXTextFieldMasters::getByName(const OUString& rName)
if(!GetDoc())
throw uno::RuntimeException();
String sName(rName), sTypeName;
OUString sName(rName), sTypeName;
sal_uInt16 nResId = lcl_GetIdByName( sName, sTypeName );
if( USHRT_MAX == nResId )
throw container::NoSuchElementException();
sName.Erase(0, sTypeName.Len()+1);
sName = sName.copy(sTypeName.getLength()+1);
SwFieldType* pType = GetDoc()->GetFldType(nResId, sName, sal_True);
if(!pType)
throw container::NoSuchElementException();
@@ -2726,12 +2722,12 @@ sal_Bool SwXTextFieldMasters::hasByName(const OUString& rName) throw( uno::Runti
if(!GetDoc())
throw uno::RuntimeException();
String sName(rName), sTypeName;
OUString sName(rName), sTypeName;
sal_uInt16 nResId = lcl_GetIdByName( sName, sTypeName );
sal_Bool bRet = sal_False;
if( USHRT_MAX != nResId )
{
sName.Erase(0, sTypeName.Len()+1);
sName = sName.copy(sTypeName.getLength()+1);
bRet = USHRT_MAX != nResId && 0 != GetDoc()->GetFldType(nResId, sName, sal_True);
}
return bRet;
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 0dad757..d392908 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -160,11 +160,11 @@ static void
lcl_ConvertTOUNameToUserName(OUString& rTmp)
{
ShellResource* pShellRes = ViewShell::GetShellRes();
if(rTmp.equalsAscii(cUserDefined))
if (rTmp.equalsAscii(cUserDefined))
{
rTmp = pShellRes->aTOXUserName;
}
else if(!pShellRes->aTOXUserName.EqualsAscii(cUserDefined) &&
else if (!pShellRes->aTOXUserName.equalsAscii(cUserDefined) &&
USER_AND_SUFFIXLEN == rTmp.getLength())
{
//make sure that in non-English versions the " (user)" suffix is removed
diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx
index 6bb1643..ea681fa 100644
--- a/sw/source/filter/basflt/iodetect.cxx
+++ b/sw/source/filter/basflt/iodetect.cxx
@@ -29,21 +29,20 @@ bool IsDocShellRegistered();
SwIoDetect aFilterDetect[] =
{
SwIoDetect( FILTER_RTF, STRING_LEN ),
SwIoDetect( FILTER_BAS, STRING_LEN ),
SwIoDetect( sWW6, STRING_LEN ),
SwIoDetect( FILTER_WW8, STRING_LEN ),
SwIoDetect( sRtfWH, STRING_LEN ),
SwIoDetect( sHTML, 4 ),
SwIoDetect( sWW1, STRING_LEN ),
SwIoDetect( sWW5, STRING_LEN ),
SwIoDetect( FILTER_XML, 4 ),
SwIoDetect( FILTER_TEXT_DLG, 8 ),
SwIoDetect( FILTER_TEXT, 4 )
SwIoDetect( FILTER_RTF ),
SwIoDetect( FILTER_BAS ),
SwIoDetect( sWW6 ),
SwIoDetect( FILTER_WW8 ),
SwIoDetect( sRtfWH ),
SwIoDetect( sHTML ),
SwIoDetect( sWW1 ),
SwIoDetect( sWW5 ),
SwIoDetect( FILTER_XML ),
SwIoDetect( FILTER_TEXT_DLG ),
SwIoDetect( FILTER_TEXT )
};
const sal_Char* SwIoDetect::IsReader(const sal_Char* pHeader, sal_uLong nLen_,
const String & /*rFileName*/, const String& /*rUserData*/) const
OUString SwIoDetect::IsReader(const sal_Char* pHeader, sal_uLong nLen_) const
{
// Filter erkennung
struct W1_FIB
@@ -63,12 +62,11 @@ const sal_Char* SwIoDetect::IsReader(const sal_Char* pHeader, sal_uLong nLen_,
};
int bRet = sal_False;
OString aName( pName );
if ( sHTML == aName )
if ( sHTML == sName )
bRet = HTMLParser::IsHTMLFormat( pHeader, sal_True, RTL_TEXTENCODING_DONTKNOW );
else if ( FILTER_RTF == aName )
else if ( FILTER_RTF == sName )
bRet = 0 == strncmp( "{\\rtf", pHeader, 5 );
else if ( sWW5 == aName )
else if ( sWW5 == sName )
{
W1_FIB *pW1Header = (W1_FIB*)pHeader;
if (pW1Header->wIdentGet() == 0xA5DC && pW1Header->nFibGet() == 0x65)
@@ -76,17 +74,17 @@ const sal_Char* SwIoDetect::IsReader(const sal_Char* pHeader, sal_uLong nLen_,
else if (pW1Header->wIdentGet() == 0xA5DB && pW1Header->nFibGet() == 0x2D)
bRet = true; /*WW2*/
}
else if ( sWW1 == aName )
else if ( sWW1 == sName )
{
bRet = (( ((W1_FIB*)pHeader)->wIdentGet() == 0xA59C
&& ((W1_FIB*)pHeader)->nFibGet() == 0x21)
&& ((W1_FIB*)pHeader)->fComplexGet() == 0);
}
else if ( FILTER_TEXT == aName )
else if ( FILTER_TEXT == sName )
bRet = SwIoSystem::IsDetectableText(pHeader, nLen_);
else if ( FILTER_TEXT_DLG == aName)
else if ( FILTER_TEXT_DLG == sName)
bRet = SwIoSystem::IsDetectableText( pHeader, nLen_, 0, 0, 0, true);
return bRet ? pName : 0;
return bRet ? sName : OUString();
}
const String SwIoSystem::GetSubStorageName( const SfxFilter& rFltr )
@@ -244,8 +242,8 @@ sal_Bool SwIoSystem::IsFileFilter(SfxMedium& rMedium, const String& rFmtName)
{
if (aFilterDetect[i].IsFilter(rFmtName))
{
bRet = 0 != aFilterDetect[i].IsReader( aBuffer, nBytesRead,
rMedium.GetPhysicalName(), rUserData );
OUString sFilter(aFilterDetect[i].IsReader(aBuffer, nBytesRead));
bRet = !sFilter.isEmpty();
break;
}
}
@@ -382,14 +380,12 @@ const SfxFilter* SwIoSystem::GetFileFilter(const String& rFileName,
/* nie erkannt und es wird auch der ASCII-Filter returnt. */
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
{
const SfxFilter* pFilterTmp = 0;
const sal_Char* pNm;
for( sal_uInt16 n = 0; n < MAXFILTER; ++n )
{
String sEmptyUserData;
pNm = aFilterDetect[n].IsReader(aBuffer, nBytesRead, rFileName, sEmptyUserData);
pFilterTmp = pNm ? SwIoSystem::GetFilterOfFormat(OUString::createFromAscii(pNm), pFCntnr) : 0;
if (pNm && pFilterTmp)
OUString sNm(aFilterDetect[n].IsReader(aBuffer, nBytesRead));
const SfxFilter* pFilterTmp =
sNm.isEmpty() ? 0 : SwIoSystem::GetFilterOfFormat(sNm, pFCntnr);
if (pFilterTmp)
{
return pFilterTmp;
}
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index 0254957..915887f 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -1692,7 +1692,7 @@ _HTMLAttr **SwHTMLParser::GetAttrTabEntry( sal_uInt16 nWhich )
void SwHTMLParser::NewStyle()
{
String sType;
OUString sType;
const HTMLOptions& rOptions2 = GetOptions();
for (size_t i = rOptions2.size(); i; )
@@ -1702,8 +1702,8 @@ void SwHTMLParser::NewStyle()
sType = rOption.GetString();
}
bIgnoreRawData = sType.Len() &&
!sType.GetToken(0,';').EqualsAscii(sCSS_mimetype);
bIgnoreRawData = !sType.getLength() &&
!sType.getToken(0,';').equalsAscii(sCSS_mimetype);
}
void SwHTMLParser::EndStyle()
@@ -1778,8 +1778,7 @@ void SwHTMLParser::InsertLink()
}
else
{
OUString sRel;
String sHRef, sType;
OUString sRel, sHRef, sType;
const HTMLOptions& rOptions2 = GetOptions();
for (size_t i = rOptions2.size(); i; )
@@ -1799,9 +1798,9 @@ void SwHTMLParser::InsertLink()
}
}
if( sHRef.Len() && sRel.equalsIgnoreAsciiCase( "STYLESHEET" ) &&
( !sType.Len() ||
sType.GetToken(0,';').EqualsAscii(sCSS_mimetype) ) )
if( !sHRef.isEmpty() && sRel.equalsIgnoreAsciiCase( "STYLESHEET" ) &&
( sType.isEmpty() ||
sType.getToken(0,';').equalsAscii(sCSS_mimetype) ) )
{
if( GetMedium() )
{
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index d180338..dac331c 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -489,7 +489,8 @@ void SwHTMLParser::InsertEmbed()
#if HAVE_FEATURE_JAVA
void SwHTMLParser::NewObject()
{
String aClassID, aName, aStandBy, aId, aStyle, aClass;
OUString aClassID;
String aName, aStandBy, aId, aStyle, aClass;
Size aSize( USHRT_MAX, USHRT_MAX );
Size aSpace( 0, 0 );
sal_Int16 eVertOri = text::VertOrientation::TOP;
@@ -581,10 +582,10 @@ void SwHTMLParser::NewObject()
// Java applets are supported.
sal_Bool bIsApplet = sal_False;
if( !bDeclare && aClassID.Len() == 42 &&
aClassID.EqualsAscii( "clsid:", 0, 6 ) )
if( !bDeclare && aClassID.getLength() == 42 &&
aClassID.startsWith("clsid:") )
{
aClassID.Erase( 0, 6 );
aClassID = aClassID.copy(6);
SvGlobalName aCID;
if( aCID.MakeId( aClassID ) )
{
diff --git a/sw/source/filter/ww8/styles.cxx b/sw/source/filter/ww8/styles.cxx
index 71b322d..b3fce48 100644
--- a/sw/source/filter/ww8/styles.cxx
+++ b/sw/source/filter/ww8/styles.cxx
@@ -31,11 +31,11 @@ namespace
class SameName: public std::unary_function<const sal_Char*, bool>
{
private:
const String &mrName;
const OUString &mrName;
public:
explicit SameName(const String &rName) : mrName(rName) {}
explicit SameName(const OUString &rName) : mrName(rName) {}
bool operator() (const sal_Char *pEntry) const
{ return mrName.EqualsAscii(pEntry); }
{ return mrName.equalsAscii(pEntry); }
};
const sal_Char **GetStiNames() throw()
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 471964a..bdd05e9 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3452,9 +3452,9 @@ MSWordSections& WW8Export::Sections() const
return *pSepx;
}
SwWW8Writer::SwWW8Writer(const String& rFltName, const String& rBaseURL)
SwWW8Writer::SwWW8Writer(const OUString& rFltName, const OUString& rBaseURL)
: StgWriter(),
m_bWrtWW8( rFltName.EqualsAscii( FILTER_WW8 ) ),
m_bWrtWW8( rFltName == FILTER_WW8 ),
m_pExport( NULL ),
mpMedium( 0 )
{
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index b7f4c5c..72735c3e 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -858,7 +858,7 @@ friend void WW8_WrtRedlineAuthor::Write(Writer &rWrt);
SfxMedium *mpMedium;
public:
SwWW8Writer( const String& rFltName, const String& rBaseURL );
SwWW8Writer(const OUString& rFltName, const OUString& rBaseURL);
virtual ~SwWW8Writer();
virtual sal_uLong WriteStorage();
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 4023dcb..bc60d6e 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2051,18 +2051,18 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, OUString& rStr )
//helper function
//For MS MacroButton field, the symbol in plain text is always "(" (0x28),
//which should be mapped according to the macro type
bool ConvertMacroSymbol( const String& rName, OUString& rReference )
bool ConvertMacroSymbol( const OUString& rName, OUString& rReference )
{
bool bConverted = false;
if( rReference == "(" )
{
bConverted = true;
sal_Unicode cSymbol = sal_Unicode(); // silence false warning
if( rName.EqualsAscii( "CheckIt" ) )
if (rName == "CheckIt")
cSymbol = 0xF06F;
else if( rName.EqualsAscii( "UncheckIt" ) )
else if (rName == "UncheckIt")
cSymbol = 0xF0FE;
else if( rName.EqualsAscii( "ShowExample" ) )
else if (rName == "ShowExample")
cSymbol = 0xF02A;
//else if... : todo
else
diff --git a/sw/source/ui/envelp/envimg.cxx b/sw/source/ui/envelp/envimg.cxx
index 63be879..b31c1d9 100644
--- a/sw/source/ui/envelp/envimg.cxx
+++ b/sw/source/ui/envelp/envimg.cxx
@@ -59,34 +59,34 @@ SW_DLLPUBLIC String MakeSender()
bool bLastLength = true;
for( xub_StrLen i = 0; i < nTokenCount; i++ )
{
String sToken = sSenderToken.GetToken( 0, ';', nSttPos );
if(sToken.EqualsAscii("COMPANY"))
OUString sToken = sSenderToken.GetToken( 0, ';', nSttPos );
if (sToken == "COMPANY")
{
xub_StrLen nOldLen = sRet.Len();
sRet += (String)rUserOpt.GetCompany();
bLastLength = sRet.Len() != nOldLen;
}
else if(sToken.EqualsAscii("CR"))
else if (sToken == "CR")
{
if(bLastLength)
sRet +=NEXTLINE;
bLastLength = true;
}
else if(sToken.EqualsAscii("FIRSTNAME"))
else if (sToken == "FIRSTNAME")
sRet += (String)rUserOpt.GetFirstName();
else if(sToken.EqualsAscii("LASTNAME"))
else if (sToken == "LASTNAME")
sRet += (String)rUserOpt.GetLastName();
else if(sToken.EqualsAscii("ADDRESS"))
else if (sToken == "ADDRESS")
sRet += (String)rUserOpt.GetStreet();
else if(sToken.EqualsAscii("COUNTRY"))
else if (sToken == "COUNTRY")
sRet += (String)rUserOpt.GetCountry();
else if(sToken.EqualsAscii("POSTALCODE"))
else if (sToken == "POSTALCODE")
sRet += (String)rUserOpt.GetZip();
else if(sToken.EqualsAscii("CITY"))
else if (sToken == "CITY")
sRet += (String)rUserOpt.GetCity();
else if(sToken.EqualsAscii("STATEPROV"))
else if (sToken == "STATEPROV")
sRet += (String)rUserOpt.GetState();
else if(sToken.Len()) //spaces
else if (!sToken.isEmpty()) //spaces
sRet += sToken;
}
return sRet;
diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx
index aba46b3..e71e398 100644
--- a/sw/source/ui/fldui/changedb.cxx
+++ b/sw/source/ui/fldui/changedb.cxx
@@ -253,19 +253,12 @@ IMPL_LINK_NOARG(SwChangeDBDlg, TreeSelectHdl)
--------------------------------------------------------------------*/
void SwChangeDBDlg::ShowDBName(const SwDBData& rDBData)
{
String sTmp(rDBData.sDataSource);
String sName;
sTmp += '.';
sTmp += (String)rDBData.sCommand;
OUString sTmp(rDBData.sDataSource);
sTmp += ".";
sTmp += rDBData.sCommand;
for (sal_uInt16 i = 0; i < sTmp.Len(); i++)
{
sName += sTmp.GetChar(i);
if (sTmp.GetChar(i) == '~')
sName += '~';
}
if (sName.EqualsAscii(".")) //empty
OUString sName(sTmp.replaceAll("~", "~~"));
if (sName == ".") //empty
sName = SW_RESSTR(SW_STR_NONE);
m_pDocDBNameFT->SetText(sName);
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 3064a95..53d55c0 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -1088,8 +1088,8 @@ void SwTOXSelectTabPage::ApplyTOXDescription()
}
else if(TOX_AUTHORITIES == aCurType.eType)
{
String sBrackets(rDesc.GetAuthBrackets());
if(!sBrackets.Len() || sBrackets.EqualsAscii(" "))
OUString sBrackets(rDesc.GetAuthBrackets());
if(sBrackets.isEmpty() || sBrackets == " ")
m_pBracketLB->SelectEntryPos(0);
else
m_pBracketLB->SelectEntry(sBrackets);
diff --git a/sw/source/ui/shells/langhelper.cxx b/sw/source/ui/shells/langhelper.cxx
index 3361575..bea63a8 100644
--- a/sw/source/ui/shells/langhelper.cxx
+++ b/sw/source/ui/shells/langhelper.cxx
@@ -111,7 +111,7 @@ namespace SwLangHelper
EditEngine * pEditEngine = rEditView.GetEditEngine();
// get the language
String aNewLangTxt;
OUString aNewLangTxt;
SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, SID_LANGUAGE_STATUS , sal_False );
if (pItem)
@@ -122,7 +122,7 @@ namespace SwLangHelper
//!! SwTextShell got destroyed meanwhile.)
SfxViewFrame *pViewFrame = rView.GetViewFrame();
if (aNewLangTxt.EqualsAscii( "*" ))
if (aNewLangTxt == "*" )
{
// open the dialog "Tools/Options/Language Settings - Language"
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
@@ -136,7 +136,7 @@ namespace SwLangHelper
else
{
// setting the new language...
if (aNewLangTxt.Len() > 0)
if (!aNewLangTxt.isEmpty())
{
const OUString aSelectionLangPrefix("Current_");
const OUString aParagraphLangPrefix("Paragraph_");
@@ -144,26 +144,26 @@ namespace SwLangHelper
const String aStrNone( OUString("LANGUAGE_NONE") );
const String aStrResetLangs( OUString("RESET_LANGUAGES") );
xub_StrLen nPos = 0;
sal_Int32 nPos = 0;
bool bForSelection = true;
bool bForParagraph = false;
if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 )))
if (-1 != (nPos = aNewLangTxt.indexOf( aSelectionLangPrefix, 0 )))
{
// ... for the current selection
aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.getLength() );
aNewLangTxt = aNewLangTxt.replaceAt(nPos, aSelectionLangPrefix.getLength(), "");
bForSelection = true;
}
else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 )))
else if (-1 != (nPos = aNewLangTxt.indexOf( aParagraphLangPrefix , 0 )))
{
// ... for the current paragraph language
aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.getLength() );
aNewLangTxt = aNewLangTxt.replaceAt(nPos, aParagraphLangPrefix.getLength(), "");
bForSelection = true;
bForParagraph = true;
}
else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 )))
else if (-1 != (nPos = aNewLangTxt.indexOf( aDocumentLangPrefix , 0 )))
{
// ... as default document language
aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.getLength() );
aNewLangTxt = aNewLangTxt.replaceAt(nPos, aDocumentLangPrefix.getLength(), "");
bForSelection = false;
}
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index c018b5f..af18041 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -291,7 +291,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
case SID_LANGUAGE_STATUS:
{
// get the language
String aNewLangTxt;
OUString aNewLangTxt;
SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_LANGUAGE_STATUS , sal_False );
if (pItem2)
aNewLangTxt = pItem2->GetValue();
@@ -301,7 +301,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
//!! SwTextShell got destroyed meanwhile.)
SfxViewFrame *pViewFrame = GetView().GetViewFrame();
if (aNewLangTxt.EqualsAscii( "*" ))
if (aNewLangTxt == "*")
{
// open the dialog "Tools/Options/Language Settings - Language"
// to set the documents default language
@@ -326,7 +326,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
rWrtSh.Push();
// setting the new language...
if (aNewLangTxt.Len() > 0)
if (!aNewLangTxt.isEmpty())
{
const OUString aSelectionLangPrefix("Current_");
const OUString aParagraphLangPrefix("Paragraph_");
@@ -340,26 +340,26 @@ void SwTextShell::Execute(SfxRequest &rReq)
RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
0 );
xub_StrLen nPos = 0;
sal_Int32 nPos = 0;
bool bForSelection = true;
bool bForParagraph = false;
if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 )))
if (-1 != (nPos = aNewLangTxt.indexOf( aSelectionLangPrefix, 0 )))
{
// ... for the current selection
aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.getLength() );
aNewLangTxt = aNewLangTxt.replaceAt(nPos, aSelectionLangPrefix.getLength(), "");
bForSelection = true;
}
else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 )))
else if (-1 != (nPos = aNewLangTxt.indexOf(aParagraphLangPrefix, 0)))
{
// ... for the current paragraph language
aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.getLength() );
aNewLangTxt = aNewLangTxt.replaceAt(nPos, aParagraphLangPrefix.getLength(), "");
bForSelection = true;
bForParagraph = true;
}
else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 )))
else if (-1 != (nPos = aNewLangTxt.indexOf(aDocumentLangPrefix, 0)))
{
// ... as default document language
aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.getLength() );
aNewLangTxt = aNewLangTxt.replaceAt(nPos, aDocumentLangPrefix.getLength(), "");
bForSelection = false;
}
diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx
index 56e7122..5ae3967 100644
--- a/tools/source/string/strascii.cxx
+++ b/tools/source/string/strascii.cxx
@@ -47,19 +47,6 @@ static void ImplCopyAsciiStr( sal_Unicode* pDest, const sal_Char* pSrc,
}
}
static sal_Int32 ImplStringCompareAscii( const sal_Unicode* pStr1, const sal_Char* pStr2 )
{
sal_Int32 nRet;
while ( ((nRet = ((sal_Int32)*pStr1)-((sal_Int32)((unsigned char)*pStr2))) == 0) &&
*pStr2 )
{
++pStr1,
++pStr2;
}
return nRet;
}
static sal_Int32 ImplStringCompareAscii( const sal_Unicode* pStr1, const sal_Char* pStr2,
xub_StrLen nCount )
{
@@ -181,29 +168,6 @@ StringCompare UniString::CompareToAscii( const sal_Char* pAsciiStr,
return COMPARE_GREATER;
}
sal_Bool UniString::EqualsAscii( const sal_Char* pAsciiStr ) const
{
DBG_CHKTHIS( UniString, DbgCheckUniString );
DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ),
"UniString::EqualsAscii() - pAsciiStr include characters > 127" );
return (ImplStringCompareAscii( mpData->maStr, pAsciiStr ) == 0);
}
sal_Bool UniString::EqualsAscii( const sal_Char* pAsciiStr,
xub_StrLen nIndex, xub_StrLen nLen ) const
{
DBG_CHKTHIS( UniString, DbgCheckUniString );
DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, nLen ),
"UniString::EqualsAscii() - pAsciiStr include characters > 127" );
// Are there enough codes for comparing?
if ( nIndex > mpData->mnLen )
return (*pAsciiStr == 0);
return (ImplStringCompareAscii( mpData->maStr+nIndex, pAsciiStr, nLen ) == 0);
}
xub_StrLen UniString::SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex ) const
{
DBG_CHKTHIS( UniString, DbgCheckUniString );