diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-10-09 09:50:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-10-09 13:17:27 +0100 |
commit | 5089bdb234a93bcb62b597c18b8ab66048246b13 (patch) | |
tree | 0983967d89d9662b8484c88d2590cfdd7362fa43 /sw | |
parent | 0ba03a38f022ca8d3705ae1370bb1d739e1e973f (diff) |
Related: fdo#38838 remove UniString::EqualsAscii
Change-Id: I55c85c1c44452c7fb6ac40591aea7177d054affe
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/iodetect.hxx | 17 | ||||
-rw-r--r-- | sw/inc/shellres.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unofield.cxx | 36 | ||||
-rw-r--r-- | sw/source/core/unocore/unoidx.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/basflt/iodetect.cxx | 54 | ||||
-rw-r--r-- | sw/source/filter/html/htmlcss1.cxx | 15 | ||||
-rw-r--r-- | sw/source/filter/html/htmlplug.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/styles.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/envelp/envimg.cxx | 22 | ||||
-rw-r--r-- | sw/source/ui/fldui/changedb.cxx | 17 | ||||
-rw-r--r-- | sw/source/ui/index/cnttab.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/shells/langhelper.cxx | 20 | ||||
-rw-r--r-- | sw/source/ui/shells/textsh1.cxx | 20 |
16 files changed, 112 insertions, 128 deletions
diff --git a/sw/inc/iodetect.hxx b/sw/inc/iodetect.hxx index 39ca15f55268..b47ba35fb175 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 ) - {} + SwIoDetect(const OUString &rN) + : sName(rN) + { + } - inline int IsFilter( const String& rNm ) const + bool IsFilter( const OUString& rNm ) const { - return pName && rNm.EqualsAscii( pName, 0, nLen ); + return rNm.startsWith(sName); } - const sal_Char* IsReader( const sal_Char* pHeader, sal_uLong nLen_, - const String &rFileName, const String& rUserData ) const; + 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 793cad60d561..66e81f8cfed3 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 f411842f575d..14dc73c7b387 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 0dad7574ecb8..d3929088baad 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 6bb1643a4821..ea681fa9884b 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 0254957df955..915887f7833f 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 d18033870cc5..dac331cced69 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 71b322d5f399..b3fce4839b03 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 471964a8f136..bdd05e920bdb 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 b7f4c5cb6050..72735c3e243c 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 4023dcb67e62..bc60d6ed4b01 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 63be8798743c..b31c1d9fe740 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 aba46b36483e..e71e3988135b 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 3064a955a695..53d55c0cf4b4 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 336157533c61..bea63a82aebe 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 c018b5f15021..af18041f63ea 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; } |