diff options
25 files changed, 247 insertions, 190 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index 2ec03287ba9d..89b8df411f87 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -1485,7 +1485,7 @@ sal_uInt16 SfxAcceleratorConfigPage::MapKeyCodeToPos(const KeyCode& aKey) const } //----------------------------------------------- -String SfxAcceleratorConfigPage::GetLabel4Command(const String& sCommand) +OUString SfxAcceleratorConfigPage::GetLabel4Command(const OUString& sCommand) { try { @@ -1516,10 +1516,10 @@ String SfxAcceleratorConfigPage::GetLabel4Command(const String& sCommand) else { String aRet(OUString("Symbols: ")); - xub_StrLen nPos = sCommand.SearchAscii(".uno:InsertSymbol?Symbols:string="); + sal_Int32 nPos = sCommand.indexOf(".uno:InsertSymbol?Symbols:string="); if ( nPos == 0 ) { - aRet += String( sCommand, 34, sCommand.Len()-34 ); + aRet += sCommand.copy(34, sCommand.getLength()-34); return aRet; } } diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx index 2911204fbbb2..e8c33f5ebb46 100644 --- a/cui/source/dialogs/cuihyperdlg.cxx +++ b/cui/source/dialogs/cuihyperdlg.cxx @@ -272,8 +272,8 @@ sal_uInt16 SvxHpLinkDlg::SetPage ( SvxHyperlinkItem* pItem ) { sal_uInt16 nPageId = RID_SVXPAGE_HYPERLINK_INTERNET; - String aStrURL ( pItem->GetURL() ); - INetURLObject aURL ( aStrURL ); + OUString aStrURL(pItem->GetURL()); + INetURLObject aURL(aStrURL); INetProtocol eProtocolTyp = aURL.GetProtocol(); switch ( eProtocolTyp ) @@ -295,12 +295,12 @@ sal_uInt16 SvxHpLinkDlg::SetPage ( SvxHyperlinkItem* pItem ) sal_Char const sNewsSrvScheme[] = "news://"; // TODO news:// is nonsense - if ( aStrURL.SearchAscii( sNewsSrvScheme ) == 0 ) + if (aStrURL.startsWith(sNewsSrvScheme)) nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT; else { sal_Char const sHash[] = "#"; - if( aStrURL.SearchAscii( sHash ) == 0 ) + if (aStrURL.startsWith(sHash)) nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT; else { diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx index f554ef00afbb..ca83ae3658c8 100644 --- a/cui/source/dialogs/hldocntp.cxx +++ b/cui/source/dialogs/hldocntp.cxx @@ -151,7 +151,7 @@ SvxHyperlinkNewDocTp::~SvxHyperlinkNewDocTp () |************************************************************************/ -void SvxHyperlinkNewDocTp::FillDlgFields ( String& /*aStrURL*/ ) +void SvxHyperlinkNewDocTp::FillDlgFields(const OUString& /*rStrURL*/) { } diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx index a5ab744552c4..e8e9275e579f 100644 --- a/cui/source/dialogs/hldoctp.cxx +++ b/cui/source/dialogs/hldoctp.cxx @@ -92,18 +92,18 @@ SvxHyperlinkDocTp::~SvxHyperlinkDocTp () |* |************************************************************************/ -void SvxHyperlinkDocTp::FillDlgFields ( String& aStrURL ) +void SvxHyperlinkDocTp::FillDlgFields(const OUString& rStrURL) { - INetURLObject aURL ( aStrURL ); + INetURLObject aURL(rStrURL); - String aStrMark; - xub_StrLen nPos = aStrURL.SearchAscii( sHash ); + sal_Int32 nPos = rStrURL.indexOf(sHash); // path - maCbbPath.SetText ( aStrURL.Copy( 0, ( nPos == STRING_NOTFOUND ? aStrURL.Len() : nPos ) ) ); + maCbbPath.SetText ( rStrURL.copy( 0, ( nPos == -1 ? rStrURL.getLength() : nPos ) ) ); // set target in document at editfield - if ( nPos != STRING_NOTFOUND && nPos<aStrURL.Len()-1 ) - aStrMark = aStrURL.Copy( nPos+1, aStrURL.Len() ); + OUString aStrMark; + if ( nPos != -1 && nPos < rStrURL.getLength()-1 ) + aStrMark = rStrURL.copy( nPos+1, rStrURL.getLength() ); maEdTarget.SetText ( aStrMark ); ModifiedPathHdl_Impl ( NULL ); diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx index 520b7f4d4f12..01470e57ee1b 100644 --- a/cui/source/dialogs/hlinettp.cxx +++ b/cui/source/dialogs/hlinettp.cxx @@ -112,13 +112,13 @@ SvxHyperlinkInternetTp::~SvxHyperlinkInternetTp () |* |************************************************************************/ -void SvxHyperlinkInternetTp::FillDlgFields ( String& aStrURL ) +void SvxHyperlinkInternetTp::FillDlgFields(const OUString& rStrURL) { - INetURLObject aURL( aStrURL ); - String aStrScheme = GetSchemeFromURL( aStrURL ); + INetURLObject aURL(rStrURL); + OUString aStrScheme(GetSchemeFromURL(rStrURL)); // set additional controls for FTP: Username / Password - if ( aStrScheme.SearchAscii( sFTPScheme ) == 0 ) + if (aStrScheme.startsWith(sFTPScheme)) { if ( aURL.GetUser().toAsciiLowerCase().startsWith( sAnonymous ) ) setAnonymousFTPUser(); @@ -135,9 +135,9 @@ void SvxHyperlinkInternetTp::FillDlgFields ( String& aStrURL ) if ( aURL.GetProtocol() != INET_PROT_NOT_VALID ) maCbbTarget.SetText( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ); else - maCbbTarget.SetText( aStrURL ); // #77696# + maCbbTarget.SetText(rStrURL); // #77696# - SetScheme( aStrScheme ); + SetScheme(aStrScheme); } void SvxHyperlinkInternetTp::setAnonymousFTPUser() @@ -179,9 +179,9 @@ void SvxHyperlinkInternetTp::GetCurentItemData ( OUString& rStrURL, String& aStr GetDataFromCommonFields( aStrName, aStrIntName, aStrFrame, eMode ); } -String SvxHyperlinkInternetTp::CreateAbsoluteURL() const +OUString SvxHyperlinkInternetTp::CreateAbsoluteURL() const { - String aStrURL = maCbbTarget.GetText(); + OUString aStrURL(maCbbTarget.GetText()); INetURLObject aURL(aStrURL); @@ -275,11 +275,10 @@ IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl) /************************************************************************* |************************************************************************/ -void SvxHyperlinkInternetTp::SetScheme( const String& aScheme ) +void SvxHyperlinkInternetTp::SetScheme(const OUString& rScheme) { - //if aScheme is empty or unknown the default beaviour is like it where HTTP - - sal_Bool bFTP = aScheme.SearchAscii( sFTPScheme ) == 0; + //if rScheme is empty or unknown the default beaviour is like it where HTTP + sal_Bool bFTP = rScheme.startsWith(sFTPScheme); sal_Bool bInternet = !(bFTP); //update protocol button selection: @@ -287,7 +286,7 @@ void SvxHyperlinkInternetTp::SetScheme( const String& aScheme ) maRbtLinktypInternet.Check(bInternet); //update target: - RemoveImproperProtocol(aScheme); + RemoveImproperProtocol(rScheme); maCbbTarget.SetSmartProtocol( GetSmartProtocolFromButtons() ); //show/hide special fields for FTP: @@ -298,7 +297,7 @@ void SvxHyperlinkInternetTp::SetScheme( const String& aScheme ) maCbAnonymous.Show( bFTP ); //update 'link target in document'-window and opening-button - if( aScheme.SearchAscii( sHTTPScheme ) == 0 || aScheme.Len() == 0 ) + if (rScheme.startsWith(sHTTPScheme) || rScheme.isEmpty()) { maBtTarget.Enable(); if ( mbMarkWndOpen ) @@ -319,15 +318,15 @@ void SvxHyperlinkInternetTp::SetScheme( const String& aScheme ) |* |************************************************************************/ -void SvxHyperlinkInternetTp::RemoveImproperProtocol(const String& aProperScheme) +void SvxHyperlinkInternetTp::RemoveImproperProtocol(const OUString& aProperScheme) { String aStrURL ( maCbbTarget.GetText() ); if ( aStrURL != aEmptyStr ) { - String aStrScheme = GetSchemeFromURL( aStrURL ); - if ( aStrScheme != aEmptyStr && aStrScheme != aProperScheme ) + OUString aStrScheme(GetSchemeFromURL(aStrURL)); + if ( !aStrScheme.isEmpty() && aStrScheme != aProperScheme ) { - aStrURL.Erase ( 0, aStrScheme.Len() ); + aStrURL.Erase ( 0, aStrScheme.getLength() ); maCbbTarget.SetText ( aStrURL ); } } @@ -357,8 +356,8 @@ INetProtocol SvxHyperlinkInternetTp::GetSmartProtocolFromButtons() const IMPL_LINK_NOARG(SvxHyperlinkInternetTp, Click_SmartProtocol_Impl) { - String aScheme = GetSchemeFromButtons(); - SetScheme( aScheme ); + OUString aScheme = GetSchemeFromButtons(); + SetScheme(aScheme); return( 0L ); } diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx index ef36989d5679..fed79ae034ab 100644 --- a/cui/source/dialogs/hlmailtp.cxx +++ b/cui/source/dialogs/hlmailtp.cxx @@ -92,13 +92,13 @@ SvxHyperlinkMailTp::~SvxHyperlinkMailTp () |* |************************************************************************/ -void SvxHyperlinkMailTp::FillDlgFields ( String& aStrURL ) +void SvxHyperlinkMailTp::FillDlgFields(const OUString& rStrURL) { - INetURLObject aURL( aStrURL ); - OUString aStrScheme = GetSchemeFromURL( aStrURL ); + INetURLObject aURL(rStrURL); + OUString aStrScheme = GetSchemeFromURL(rStrURL); // set URL-field and additional controls - OUString aStrURLc ( aStrURL ); + OUString aStrURLc (rStrURL); // set additional controls for EMail: if ( aStrScheme.startsWith( INET_MAILTO_SCHEME ) ) { @@ -197,19 +197,19 @@ void SvxHyperlinkMailTp::SetInitFocus() /************************************************************************* |************************************************************************/ -void SvxHyperlinkMailTp::SetScheme( const String& aScheme ) +void SvxHyperlinkMailTp::SetScheme(const OUString& rScheme) { - //if aScheme is empty or unknown the default beaviour is like it where MAIL + //if rScheme is empty or unknown the default beaviour is like it where MAIL const sal_Char sNewsScheme[] = INET_NEWS_SCHEME; - sal_Bool bMail = aScheme.SearchAscii( sNewsScheme ) != 0; + bool bMail = rScheme.startsWith(sNewsScheme); //update protocol button selection: maRbtMail.Check(bMail); maRbtNews.Check(!bMail); //update target: - RemoveImproperProtocol(aScheme); + RemoveImproperProtocol(rScheme); maCbbReceiver.SetSmartProtocol( GetSmartProtocolFromButtons() ); //show/hide special fields for MAIL: diff --git a/cui/source/inc/acccfg.hxx b/cui/source/inc/acccfg.hxx index 417a456cdc0c..a23c50fcb48d 100644 --- a/cui/source/inc/acccfg.hxx +++ b/cui/source/inc/acccfg.hxx @@ -160,9 +160,9 @@ private: DECL_LINK(LoadHdl, void *); DECL_LINK(SaveHdl, void *); - String GetLabel4Command(const String& sCommand); + OUString GetLabel4Command(const OUString& rCommand); void InitAccCfg(); - sal_uInt16 MapKeyCodeToPos( const KeyCode &rCode ) const; + sal_uInt16 MapKeyCodeToPos( const KeyCode &rCode ) const; css::uno::Reference< css::frame::XModel > SearchForAlreadyLoadedDoc(const String& sName); void StartFileDialog( WinBits nBits, const String& rTitle ); diff --git a/cui/source/inc/hldocntp.hxx b/cui/source/inc/hldocntp.hxx index 9ae773810a5b..67ad2c1f48e4 100644 --- a/cui/source/inc/hldocntp.hxx +++ b/cui/source/inc/hldocntp.hxx @@ -47,7 +47,7 @@ private: Image GetImage( sal_uInt16 nId ); protected: - void FillDlgFields ( String& aStrURL ); + void FillDlgFields(const OUString& rStrURL); void GetCurentItemData ( OUString& rStrURL, String& aStrName, String& aStrIntName, String& aStrFrame, SvxLinkInsertMode& eMode ); diff --git a/cui/source/inc/hldoctp.hxx b/cui/source/inc/hldoctp.hxx index 0ef62b25e6e2..b263bc5a3068 100644 --- a/cui/source/inc/hldoctp.hxx +++ b/cui/source/inc/hldoctp.hxx @@ -62,7 +62,7 @@ private: EPathType GetPathType ( const OUString& rStrPath ); protected: - void FillDlgFields ( String& aStrURL ); + void FillDlgFields(const OUString& rStrURL); void GetCurentItemData ( OUString& rStrURL, String& aStrName, String& aStrIntName, String& aStrFrame, SvxLinkInsertMode& eMode ); diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx index 419465d455f7..ee3c8aa1ce0d 100644 --- a/cui/source/inc/hlinettp.hxx +++ b/cui/source/inc/hlinettp.hxx @@ -61,19 +61,19 @@ private: DECL_LINK(TimeoutHdl_Impl , void *); ///< Handler for timer -timeout - void SetScheme( const String& aScheme ); - void RemoveImproperProtocol(const String& aProperScheme); + void SetScheme(const OUString& rScheme); + void RemoveImproperProtocol(const OUString& rProperScheme); String GetSchemeFromButtons() const; INetProtocol GetSmartProtocolFromButtons() const; - String CreateAbsoluteURL() const; + OUString CreateAbsoluteURL() const; void setAnonymousFTPUser(); void setFTPUser(const String& rUser, const String& rPassword); void RefreshMarkWindow(); protected: - virtual void FillDlgFields ( String& aStrURL ); + virtual void FillDlgFields(const OUString& rStrURL); virtual void GetCurentItemData ( OUString& rStrURL, String& aStrName, String& aStrIntName, String& aStrFrame, SvxLinkInsertMode& eMode ); diff --git a/cui/source/inc/hlmailtp.hxx b/cui/source/inc/hlmailtp.hxx index 0cbc6b2acbaf..d76799ecc3ad 100644 --- a/cui/source/inc/hlmailtp.hxx +++ b/cui/source/inc/hlmailtp.hxx @@ -43,7 +43,7 @@ private: DECL_LINK (ClickAdrBookHdl_Impl , void * ); ///< Button : Address book DECL_LINK (ModifiedReceiverHdl_Impl, void * ); ///< Combobox "receiver" modified - void SetScheme( const String& aScheme ); + void SetScheme(const OUString& rScheme); void RemoveImproperProtocol(const String& aProperScheme); String GetSchemeFromButtons() const; INetProtocol GetSmartProtocolFromButtons() const; @@ -51,7 +51,7 @@ private: String CreateAbsoluteURL() const; protected: - virtual void FillDlgFields ( String& aStrURL ); + virtual void FillDlgFields(const OUString& rStrURL); virtual void GetCurentItemData ( OUString& rStrURL, String& aStrName, String& aStrIntName, String& aStrFrame, SvxLinkInsertMode& eMode ); diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx index 945c104cce29..a4b37c9a13ac 100644 --- a/cui/source/inc/hltpbase.hxx +++ b/cui/source/inc/hltpbase.hxx @@ -104,7 +104,7 @@ protected: void InitStdControls (); virtual void FillStandardDlgFields ( SvxHyperlinkItem* pHyperlinkItem ); - virtual void FillDlgFields ( String& aStrURL ) = 0; + virtual void FillDlgFields(const OUString& rStrURL) = 0; virtual void GetCurentItemData ( OUString& rStrURL, String& aStrName, String& aStrIntName, String& aStrFrame, SvxLinkInsertMode& eMode ) = 0; diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 1cccc7bfa633..ee0083c9a2e4 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -590,10 +590,10 @@ sal_Bool SvxAutoCorrect::FnChgToEnEmDash( bool bEnDash = (eLang == LANGUAGE_HUNGARIAN || eLang == LANGUAGE_FINNISH); if( ((cEmDash && !bEnDash) || (cEnDash && bEnDash)) && 4 <= nEndPos - nSttPos ) { - String sTmp( rTxt.copy( nSttPos, nEndPos - nSttPos ) ); - xub_StrLen nFndPos = sTmp.SearchAscii( "--" ); - if( STRING_NOTFOUND != nFndPos && nFndPos && - nFndPos + 2 < sTmp.Len() && + OUString sTmp( rTxt.copy( nSttPos, nEndPos - nSttPos ) ); + sal_Int32 nFndPos = sTmp.indexOf("--"); + if( nFndPos != -1 && nFndPos && + nFndPos + 2 < sTmp.getLength() && ( rCC.isLetterNumeric( sTmp, nFndPos - 1 ) || lcl_IsInAsciiArr( sImplEndSkipChars, rTxt[ nFndPos - 1 ] )) && ( rCC.isLetterNumeric( sTmp, nFndPos + 2 ) || diff --git a/include/tools/string.hxx b/include/tools/string.hxx index f962823f033b..7f0e8d94204d 100644 --- a/include/tools/string.hxx +++ b/include/tools/string.hxx @@ -105,6 +105,8 @@ private: TOOLS_DLLPRIVATE inline void ImplCopyData(); TOOLS_DLLPRIVATE inline sal_Unicode * ImplCopyStringData(sal_Unicode *); + TOOLS_DLLPRIVATE xub_StrLen SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex ) const; + UniString( const int* pDummy ); // not implemented: to prevent UniString( NULL ) UniString(int); // not implemented; to detect misuses of // UniString(sal_Unicode) @@ -239,7 +241,6 @@ public: xub_StrLen Search( sal_Unicode c, xub_StrLen nIndex = 0 ) const; xub_StrLen Search( const UniString& rStr, xub_StrLen nIndex = 0 ) const; - xub_StrLen SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex = 0 ) const; xub_StrLen SearchAndReplace( sal_Unicode c, sal_Unicode cRep, xub_StrLen nIndex = 0 ); diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx index c82a2375c915..7e47ebcc694e 100644 --- a/padmin/source/prtsetup.cxx +++ b/padmin/source/prtsetup.cxx @@ -735,9 +735,10 @@ IMPL_LINK( RTSFontSubstPage, ClickBtnHdl, Button*, pButton ) { for( int i = 0; i < m_aSubstitutionsBox.GetSelectEntryCount(); i++ ) { - String aEntry( m_aSubstitutionsBox.GetSelectEntry( i ) ); - sal_uInt16 nPos = aEntry.SearchAscii( " -> " ); - aEntry.Erase( nPos ); + OUString aEntry( m_aSubstitutionsBox.GetSelectEntry( i ) ); + sal_Int32 nPos = aEntry.indexOf(" -> "); + if (nPos != -1) + aEntry = aEntry.copy(0, nPos); m_pParent->m_aJobData.m_aFontSubstitutes.erase( aEntry ); } update(); diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 8a7367024902..4943bd702cc1 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -337,7 +337,7 @@ private: bool IsString(); bool IsReference( const String& ); bool IsSingleReference( const String& ); - bool IsPredetectedReference( const String& ); + bool IsPredetectedReference(const OUString&); bool IsDoubleReference( const String& ); bool IsMacro( const String& ); bool IsNamedRange( const String& ); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 1a9a9a8c9884..bf04a4a3c6a6 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2575,11 +2575,11 @@ bool ScCompiler::IsString() return false; } -bool ScCompiler::IsPredetectedReference( const String& rName ) +bool ScCompiler::IsPredetectedReference(const OUString& rName) { // Speedup documents with lots of broken references, e.g. sheet deleted. - xub_StrLen nPos = rName.SearchAscii( "#REF!"); - if (nPos != STRING_NOTFOUND) + sal_Int32 nPos = rName.indexOf("#REF!"); + if (nPos != -1) { /* TODO: this may be enhanced by reusing scan information from * NextSymbol(), the positions of quotes and special characters found @@ -2592,18 +2592,18 @@ bool ScCompiler::IsPredetectedReference( const String& rName ) { // Per ODFF the correct string for a reference error is just #REF!, // so pass it on. - if (rName.Len() == 5) + if (rName.getLength() == 5) return IsErrorConstant( rName); return false; // #REF!.AB42 or #REF!42 or #REF!#REF! } - sal_Unicode c = rName.GetChar(nPos-1); // before #REF! + sal_Unicode c = rName[nPos-1]; // before #REF! if ('$' == c) { if (nPos == 1) return false; // $#REF!.AB42 or $#REF!42 or $#REF!#REF! - c = rName.GetChar(nPos-2); // before $#REF! + c = rName[nPos-2]; // before $#REF! } - sal_Unicode c2 = rName.GetChar(nPos+5); // after #REF! + sal_Unicode c2 = rName[nPos+5]; // after #REF! switch (c) { case '.': @@ -3285,14 +3285,14 @@ void ScCompiler::AutoCorrectParsedSymbol() } else { - String aSymbol( aCorrectedSymbol ); + OUString aSymbol( aCorrectedSymbol ); String aDoc; - xub_StrLen nPosition; - if ( aSymbol.GetChar(0) == '\'' - && ((nPosition = aSymbol.SearchAscii( "'#" )) != STRING_NOTFOUND) ) + sal_Int32 nPosition; + if ( aSymbol[0] == '\'' + && ((nPosition = aSymbol.indexOf( "'#" )) != -1) ) { // Split off 'Doc'#, may be d:\... or whatever - aDoc = aSymbol.Copy( 0, nPosition + 2 ); - aSymbol.Erase( 0, nPosition + 2 ); + aDoc = aSymbol.copy(0, nPosition + 2); + aSymbol = aSymbol.copy(nPosition + 2); } xub_StrLen nRefs = comphelper::string::getTokenCount(aSymbol, ':'); bool bColons; @@ -3300,7 +3300,7 @@ void ScCompiler::AutoCorrectParsedSymbol() { // duplicated or too many ':'? B:2::C10 => B2:C10 bColons = true; sal_Int32 nIndex = 0; - String aTmp1( aSymbol.GetToken( 0, ':', nIndex ) ); + String aTmp1( aSymbol.getToken( 0, ':', nIndex ) ); xub_StrLen nLen1 = aTmp1.Len(); String aSym, aTmp2; bool bLastAlp, bNextNum; @@ -3309,7 +3309,7 @@ void ScCompiler::AutoCorrectParsedSymbol() xub_StrLen nCount = nRefs; for ( xub_StrLen j=1; j<nCount; j++ ) { - aTmp2 = aSymbol.GetToken( 0, ':', nIndex ); + aTmp2 = aSymbol.getToken( 0, ':', nIndex ); xub_StrLen nLen2 = aTmp2.Len(); if ( nLen1 || nLen2 ) { @@ -3365,8 +3365,8 @@ void ScCompiler::AutoCorrectParsedSymbol() const ScAddress::Details aDetails( pConv->meConv, aPos ); if ( nRefs == 2 ) { - aRef[0] = aSymbol.GetToken( 0, ':' ); - aRef[1] = aSymbol.GetToken( 1, ':' ); + aRef[0] = aSymbol.getToken( 0, ':' ); + aRef[1] = aSymbol.getToken( 1, ':' ); } else aRef[0] = aSymbol; diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index d183cab84643..d738c0185736 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -448,31 +448,34 @@ XclExpHyperlink::~XclExpHyperlink() String XclExpHyperlink::BuildFileName( sal_uInt16& rnLevel, bool& rbRel, const String& rUrl, const XclExpRoot& rRoot ) const { - String aDosName( INetURLObject( rUrl ).getFSysPath( INetURLObject::FSYS_DOS ) ); + OUString aDosName( INetURLObject( rUrl ).getFSysPath( INetURLObject::FSYS_DOS ) ); rnLevel = 0; rbRel = rRoot.IsRelUrl(); if( rbRel ) { // try to convert to relative file name - String aTmpName( aDosName ); + OUString aTmpName( aDosName ); aDosName = INetURLObject::GetRelURL( rRoot.GetBasePath(), rUrl, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_WITH_CHARSET ); - if( aDosName.SearchAscii( INET_FILE_SCHEME ) == 0 ) + if (aDosName.startsWith(INET_FILE_SCHEME)) { // not converted to rel -> back to old, return absolute flag aDosName = aTmpName; rbRel = false; } - else if( aDosName.SearchAscii( "./" ) == 0 ) + else if (aDosName.startsWith("./")) { - aDosName.Erase( 0, 2 ); + aDosName = aDosName.copy(2); } else { - while( aDosName.SearchAndReplaceAscii( "../", EMPTY_STRING ) == 0 ) + while (aDosName.startsWith("../")) + { + aDosName = aDosName.copy(3); ++rnLevel; + } } } return aDosName; diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx index dea09cae1458..bf89601a2d08 100644 --- a/sw/source/filter/inc/fltshell.hxx +++ b/sw/source/filter/inc/fltshell.hxx @@ -664,7 +664,7 @@ public: bool IsFlagSet(SwFltControlStack::Flags no) const { return aStack.IsFlagSet(no); } - void ConvertUStr( String& rInOut ); + OUString ConvertUStr(const OUString& rInOut); OUString QuoteStr( const OUString& rIn ); // folgende status kann die shell verwalten: diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index eb789ae9a8fe..f8f858c8c3f1 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -1127,9 +1127,9 @@ SwFltShell& SwFltShell::operator << ( const String& rStr ) return *this; } -void SwFltShell::ConvertUStr( String& rInOut ) +OUString SwFltShell::ConvertUStr(const OUString& rInOut) { - rInOut = GetAppCharClass().uppercase( rInOut ); + return GetAppCharClass().uppercase(rInOut); } // QuoteString() wandelt CRs abhaengig von nFieldIniFlags in '\n' oder "\0x0d" @@ -1255,7 +1255,7 @@ SwFltShell& SwFltShell::SetStyle( sal_uInt16 nStyle ) SwFltShell& SwFltShell::operator << (SwFltBookmark& aBook) { - ConvertUStr( aBook.aName ); + aBook.aName = ConvertUStr(aBook.aName); aBook.aVal = QuoteStr(aBook.aVal); aEndStack.NewAttr(*pPaM->GetPoint(), aBook); return *this; diff --git a/sw/source/filter/ww1/w1class.hxx b/sw/source/filter/ww1/w1class.hxx index 804220ba7e6d..337929e724ff 100644 --- a/sw/source/filter/ww1/w1class.hxx +++ b/sw/source/filter/ww1/w1class.hxx @@ -164,7 +164,7 @@ public: } sal_Bool GetError() { return !bOK; } sal_Unicode Out( Ww1Shell&, sal_uLong& ); - sal_Unicode Out( String&, sal_uLong=0xffffffff); + sal_Unicode Out( OUString&, sal_uLong=0xffffffff); sal_Unicode Out( sal_Unicode& ); friend std::ostream& operator <<(std::ostream&, Ww1PlainText&); String& Fill( String&, sal_uLong=0, sal_uLong=0xffffffff ); @@ -1209,7 +1209,7 @@ public: class Ww1Fields : public Ww1PlcFields { sal_uInt16 nPlcIndex; - String sErgebnis; // das von word errechnete ergebniss + OUString sErgebnis; // das von word errechnete ergebniss SwField* pField; sal_uLong Where(sal_uInt16 nIndex) // innerhalb des textes { return Ww1PlcFields::Where(nIndex) - rFib.GetFIB().fcMinGet(); } @@ -1545,7 +1545,7 @@ public: // innerhalb des textes sal_uLong Where() { return pDoc->Where(); } void Fill( sal_Unicode& rChr ) { pDoc->Out( rChr ); } - sal_uInt8 Fill( String& rStr, sal_uLong ulLen) + sal_uInt8 Fill( OUString& rStr, sal_uLong ulLen) { ulLen += pDoc->Where(); return sal::static_int_cast< sal_uInt8 >(pDoc->Out(rStr, ulLen)); diff --git a/sw/source/filter/ww1/w1filter.cxx b/sw/source/filter/ww1/w1filter.cxx index 00d32aa3e3a3..3200edc74756 100644 --- a/sw/source/filter/ww1/w1filter.cxx +++ b/sw/source/filter/ww1/w1filter.cxx @@ -426,7 +426,7 @@ void Ww1Fields::Stop( Ww1Shell& rOut, Ww1Manager& rMan, sal_Unicode& c) // gelten auch wirklich eingelesen werden und dem feld // zugeordnet werden. } - if (sErgebnis.Len()) + if (!sErgebnis.isEmpty()) rOut << sErgebnis; } } @@ -434,17 +434,17 @@ void Ww1Fields::Stop( Ww1Shell& rOut, Ww1Manager& rMan, sal_Unicode& c) enum WWDateTime{ WW_DONTKNOW = 0x0, WW_DATE = 0x1, WW_TIME = 0x2, WW_BOTH = 0x3 }; -static WWDateTime GetTimeDatePara( const String& rForm, +static WWDateTime GetTimeDatePara( const OUString& rForm, SwTimeFormat* pTime = 0, SwDateFormat* pDate = 0 ) { WWDateTime eDT = WW_BOTH; - if( STRING_NOTFOUND == rForm.Search( 'H' )) // H -> 24h + if (rForm.indexOf('H') != -1) // H -> 24h { if( pTime ) *pTime = TF_SSMM_24; } - else if( STRING_NOTFOUND == rForm.Search( 'H' )) // h -> 24h + else if (rForm.indexOf('H') != -1) // h -> 24h { if( pTime ) *pTime = TF_SSMM_12; @@ -454,13 +454,13 @@ static WWDateTime GetTimeDatePara( const String& rForm, eDT = (WWDateTime)( eDT & ~(sal_uInt16)WW_TIME ); } - xub_StrLen nDPos = 0; - while( STRING_NOTFOUND != nDPos ) + sal_Int32 nDPos = 0; + while (1) { - nDPos = rForm.Search( 'M', nDPos ); // M -> Datum - if( !nDPos ) + nDPos = rForm.indexOf('M', nDPos); // M -> Datum + if (nDPos == 0 || nDPos == -1) break; - sal_Unicode cPrev = rForm.GetChar( nDPos - 1 ); + sal_Unicode cPrev = rForm[nDPos - 1]; // ignoriere dabei "AM", "aM", "PM", "pM" if( 'a' != cPrev && 'A' != cPrev && 'p' != cPrev && 'P' != cPrev ) break; @@ -468,7 +468,7 @@ static WWDateTime GetTimeDatePara( const String& rForm, ++nDPos; } - if( STRING_NOTFOUND != nDPos ) // Monat -> Datum ? + if (nDPos != -1) // Monat -> Datum ? { static SwDateFormat const aDateA[32] = { @@ -482,32 +482,32 @@ static WWDateTime GetTimeDatePara( const String& rForm, DFF_DDDMMMY, DFF_DDDMMMY, DFF_DDDMMMYY, DFF_DDDMMMYY }; - bool bHasDay = STRING_NOTFOUND != rForm.Search( 't' ) || - STRING_NOTFOUND != rForm.Search( 'T' ) || - STRING_NOTFOUND != rForm.Search( 'd' ) || - STRING_NOTFOUND != rForm.Search( 'D' ); + bool bHasDay = rForm.indexOf('t') != -1 || + rForm.indexOf('T') != -1 || + rForm.indexOf('d') != -1 || + rForm.indexOf('D') != -1; - sal_Bool bLongDayOfWeek= STRING_NOTFOUND != rForm.SearchAscii( "tttt" ) || - STRING_NOTFOUND != rForm.SearchAscii( "TTTT" ) || - STRING_NOTFOUND != rForm.SearchAscii( "dddd" ) || - STRING_NOTFOUND != rForm.SearchAscii( "DDDD" ); + sal_Bool bLongDayOfWeek = rForm.indexOf("tttt") != -1 || + rForm.indexOf("TTTT") != -1 || + rForm.indexOf("dddd") != -1 || + rForm.indexOf("DDDD") != -1; - sal_Bool bDayOfWeek = STRING_NOTFOUND != rForm.SearchAscii( "ttt" ) || - STRING_NOTFOUND != rForm.SearchAscii( "TTT" ) || - STRING_NOTFOUND != rForm.SearchAscii( "ddd" ) || - STRING_NOTFOUND != rForm.SearchAscii( "DDD" ); + sal_Bool bDayOfWeek = rForm.indexOf("ttt") != -1 || + rForm.indexOf("TTT") != -1 || + rForm.indexOf("ddd") != -1 || + rForm.indexOf("DDD") != -1; // M, MM -> numeric month // MMM, MMMM -> text. month - sal_Bool bLitMonth = STRING_NOTFOUND != rForm.SearchAscii( "MMM" ); + sal_Bool bLitMonth = rForm.indexOf("MMM") != -1; // MMMM -> full month - sal_Bool bFullMonth = STRING_NOTFOUND != rForm.SearchAscii( "MMMM" ); + sal_Bool bFullMonth = rForm.indexOf("MMMM") != -1; // jj, JJ -> 2-col-year // jjjj, JJJJ -> 4-col-year - sal_Bool bFullYear = STRING_NOTFOUND != rForm.SearchAscii( "jjj" ) || - STRING_NOTFOUND != rForm.SearchAscii( "JJJ" ) || - STRING_NOTFOUND != rForm.SearchAscii( "yyy" ) || - STRING_NOTFOUND != rForm.SearchAscii( "YYY" ); + sal_Bool bFullYear = rForm.indexOf("jjj") != -1 || + rForm.indexOf("JJJ") != -1 || + rForm.indexOf("yyy") != -1 || + rForm.indexOf("YYY") != -1; sal_uInt16 i = ( bLitMonth & 1 ) | ( ( bFullYear & 1 ) << 1 ) @@ -537,7 +537,7 @@ extern void sw3io_ConvertFromOldField( SwDoc& rDoc, sal_uInt16& rWhich, void Ww1Fields::Out(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 nDepth) { String sType; // der typ als string - String sFormel; // die formel + OUString sFormel; // die formel String sFormat; String sDTFormat; // Datum / Zeit-Format W1_FLD* pData = GetData(); // die an den plc gebunden daten @@ -548,15 +548,21 @@ void Ww1Fields::Out(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 nDepth) OSL_ENSURE(c==19, "Ww1Fields"); // sollte auch beginn sein if (pData->chGet()==19 && c == 19) { - String aStr; + OUString aStr; c = rMan.Fill( aStr, GetLength() ); OSL_ENSURE(Ww1PlainText::IsChar(c), "Ww1Fields"); - xub_StrLen pos = aStr.Search(' '); + sal_Int32 pos = aStr.indexOf(' '); // get type out of text - sType = aStr.Copy( 0, pos ); - aStr.Erase( 0, pos ); - if ( pos != STRING_NOTFOUND ) - aStr.Erase(0, 1); + if ( pos != -1 ) + { + sType = aStr.copy(0, pos); + aStr = aStr.copy(pos+1); + } + else + { + sType = aStr; + aStr = ""; + } sFormel += aStr; sal_uInt8 rbType = pData->fltGet(); do { @@ -571,8 +577,7 @@ void Ww1Fields::Out(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 nDepth) Out(rOut, rMan, nDepth+1); rMan.Fill(c); OSL_ENSURE(c==21, "Ww1PlainText"); - sFormel.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "Ww" )); - sFormel += OUString::number( nPlcIndex ); + sFormel += "Ww" + OUString::number(nPlcIndex); c = rMan.Fill(aStr, GetLength()); OSL_ENSURE(Ww1PlainText::IsChar(c), "Ww1PlainText"); sFormel += aStr; @@ -581,13 +586,19 @@ void Ww1Fields::Out(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 nDepth) while (pData->chGet()==19); // get format out of text - pos = sFormel.SearchAscii( "\\*" ); - sFormat = sFormel.Copy( pos ); - sFormel.Erase( pos ); + pos = sFormel.indexOf("\\*"); + if (pos != -1) + { + sFormat = sFormel.copy(pos); + sFormel = sFormel.copy(0, pos); + } - pos = sFormel.SearchAscii( "\\@" ); - sDTFormat = sFormel.Copy( pos ); - sFormel.Erase( pos ); + pos = sFormel.indexOf( "\\@" ); + if (pos != -1) + { + sDTFormat = sFormel.copy(pos); + sFormel = sFormel.copy(0, pos); + } // der formelteil ist zuende, kommt ein ergebnisteil? if( pData->chGet() == 20 ) @@ -596,7 +607,7 @@ void Ww1Fields::Out(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 nDepth) OSL_ENSURE(c==20, "Ww1PlainText"); c = rMan.Fill(sErgebnis, GetLength()); if (!Ww1PlainText::IsChar(c)) - sErgebnis += c; //~ mdt: sonderzeichenbenhandlung + sErgebnis += OUString(c); //~ mdt: sonderzeichenbenhandlung ++(*this); pData = GetData(); } @@ -614,7 +625,7 @@ oncemore: switch (rbType) { case 3: // bookmark reference - rOut.ConvertUStr( sFormel ); + sFormel = rOut.ConvertUStr(sFormel); pField = new SwGetRefField( (SwGetRefFieldType*) rOut.GetSysFldType( RES_GETREFFLD ), sFormel, @@ -625,13 +636,21 @@ oncemore: break; case 6: // set command { - pos = aStr.Search(' '); - String aName( aStr.Copy( 0, pos )); - aStr.Erase(0, pos ); - aStr.Erase(0, 1); - if( !aName.Len() ) + pos = aStr.indexOf(' '); + OUString aName; + if (pos != -1) + { + aName = aStr.copy(0, pos); + aStr = aStr.copy(pos+1); + } + else + { + aName = aStr; + aStr = ""; + } + if (aName.isEmpty()) break; - rOut.ConvertUStr( aName ); + aName = rOut.ConvertUStr(aName); SwFieldType* pFT = rOut.GetDoc().InsertFldType( SwSetExpFieldType( &rOut.GetDoc(), aName, nsSwGetSetExpType::GSE_STRING ) ); pField = new SwSetExpField((SwSetExpFieldType*)pFT, aStr); @@ -643,11 +662,20 @@ oncemore: break; case 14: // info var { - pos = aStr.Search(' '); - String aSubType( aStr.Copy( 0, pos )); - aStr.Erase(0, pos ); - aStr.Erase(0, 1); - rOut.ConvertUStr( aSubType ); + OUString aSubType; + pos = aStr.indexOf(' '); + if (pos != -1) + { + aSubType = aStr.copy(0, pos); + aStr = aStr.copy(pos+1); + } + else + { + aSubType = aStr; + aStr = ""; + } + + aSubType = rOut.ConvertUStr(aSubType); // ganz grosze schiete: der typ 'info' kann einem der @@ -655,7 +683,7 @@ oncemore: // das eingentliche feld der doc-info. // kein ';' benutzen mit folgendem macro: #define IS(sd, se, t) \ - if (aSubType.EqualsAscii( sd ) || aSubType.EqualsAscii( se)) \ + if (aSubType == sd || aSubType == se) \ rbType = t; \ else @@ -827,13 +855,22 @@ oncemore: break; case 36: // print command, Einfuegendatei { - pos = aStr.Search(' '); - String aFName( aStr.Copy( 0, pos )); - aStr.Erase(0, pos ); - aStr.Erase(0, 1); - if( !aFName.Len() ) + OUString aFName; + pos = aStr.indexOf(' '); + if (pos != -1) + { + aFName = aStr.copy(0, pos); + aStr = aStr.copy(pos+1); + } + else + { + aFName = aStr; + aStr = ""; + } + + if(aFName.isEmpty()) break; - aFName.SearchAndReplaceAscii( "\\\\", OUString('\\') ); + aFName = aFName.replaceFirst("\\\\", "\\"); aFName = URIHelper::SmartRel2Abs( INetURLObject(rOut.GetBaseURL()), aFName ); @@ -854,11 +891,20 @@ oncemore: break; case 38: // ask command { - pos = aStr.Search(' '); - String aName( aStr.Copy( 0, pos )); - aStr.Erase(0, pos ); - aStr.Erase(0, 1); - if( !aName.Len() ) + OUString aName; + pos = aStr.indexOf(' '); + if (pos != -1) + { + aName = aStr.copy(0, pos); + aStr = aStr.copy(pos+1); + } + else + { + aName = aStr; + aStr = ""; + } + + if (aName.isEmpty()) break; SwFieldType* pFT = rOut.GetDoc().InsertFldType( @@ -875,11 +921,20 @@ oncemore: break; case 51: // macro button { - pos = aStr.Search(' '); - OUString aName( aStr.Copy( 0, pos )); - aStr.Erase(0, pos ); - aStr.Erase(0, 1); - if( aName.isEmpty() || !aStr.Len() ) + OUString aName; + pos = aStr.indexOf(' '); + if (pos != -1) + { + aName = aStr.copy(0, pos); + aStr = aStr.copy(pos+1); + } + else + { + aName = aStr; + aStr = ""; + } + + if (aName.isEmpty() || aStr.isEmpty()) break; pField = new SwMacroField( (SwMacroFieldType*) @@ -889,7 +944,7 @@ oncemore: break; case 55: // read tiff / or better: import anything { - const sal_Unicode* pFormel = sFormel.GetBuffer(); + const sal_Unicode* pFormel = sFormel.getStr(); const sal_Unicode* pDot = 0; String sName; while (*pFormel != '\0' && *pFormel != ' ') @@ -966,8 +1021,8 @@ oncemore: bKnown = false; break; } - if( bKnown || sErgebnis.EqualsAscii( "\270" )) - this->sErgebnis.Erase(); + if( bKnown || sErgebnis == "\270" ) + this->sErgebnis = ""; else this->sErgebnis = sErgebnis; } @@ -1244,10 +1299,10 @@ sal_Unicode Ww1PlainText::Out( Ww1Shell& rOut, sal_uLong& ulEnd ) return Ww1PlainText::MinChar; } -sal_Unicode Ww1PlainText::Out( String& rStr, sal_uLong ulEnd ) +sal_Unicode Ww1PlainText::Out(OUString& rStr, sal_uLong ulEnd) { // wie Out(Shell..., jedoch ausgabe auf einen string - rStr.Erase(); + rStr = ""; if (ulEnd > Count()) ulEnd = Count(); while (ulSeek < ulEnd) @@ -1255,7 +1310,7 @@ sal_Unicode Ww1PlainText::Out( String& rStr, sal_uLong ulEnd ) sal_Unicode c = (*this)[ulSeek]; ++(*this); if( Ww1PlainText::IsChar(c) ) - rStr += c; + rStr += OUString(c); else return c; } diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 79e85f950a33..93e7d07a702d 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -100,7 +100,7 @@ static OUString lcl_getFlatURL( uno::Reference<beans::XPropertySet>& xSourceProp { OUString sDBURL; xSourceProperties->getPropertyValue("URL") >>= sDBURL; - if(String(sDBURL).SearchAscii("sdbc:flat:") == 0) + if (sDBURL.startsWith("sdbc:flat:")) { uno::Sequence<OUString> aFilters; xSourceProperties->getPropertyValue("TableFilter") >>= aFilters; @@ -125,7 +125,7 @@ static OUString lcl_getFlatURL( uno::Reference<beans::XPropertySet>& xSourceProp } if(!sCharSet.compareToAscii( cUTF8 )) { - sURL = String(sDBURL).Copy( 10 ); + sURL = sDBURL.copy(10); //#i97577# at this point the 'URL' can also be a file name! sURL = URIHelper::SmartRel2Abs( INetURLObject(), sURL ); sURL += "/"; diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 41ec2904cf4e..3187c821636a 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -596,7 +596,7 @@ SwVisitingCardPage::SwVisitingCardPage(Window* pParent, const SfxItemSet& rSet) SwVisitingCardPage::~SwVisitingCardPage() { for(sal_uInt16 i = 0; i < m_pAutoTextGroupLB->GetEntryCount(); i++) - delete (String*)m_pAutoTextGroupLB->GetEntryData( i ); + delete (OUString*)m_pAutoTextGroupLB->GetEntryData( i ); m_xAutoText = 0; ClearUserData(); @@ -623,11 +623,11 @@ int SwVisitingCardPage::DeactivatePage(SfxItemSet* _pSet) sal_Bool SwVisitingCardPage::FillItemSet(SfxItemSet& rSet) { - String* pGroup = (String*)m_pAutoTextGroupLB->GetEntryData( + const OUString* pGroup = (const OUString*)m_pAutoTextGroupLB->GetEntryData( m_pAutoTextGroupLB->GetSelectEntryPos()); OSL_ENSURE(pGroup, "no group selected?"); - if(pGroup) + if (pGroup) aLabItem.sGlossaryGroup = *pGroup; SvTreeListEntry* pSelEntry = m_pAutoTextLB->FirstSelected(); @@ -674,8 +674,7 @@ void SwVisitingCardPage::Reset(const SfxItemSet& rSet) bool bFound = false; sal_uInt16 i; for(i = 0; i < m_pAutoTextGroupLB->GetEntryCount() && !bFound; i++) - if( String(aLabItem.sGlossaryGroup) == - *(String*)m_pAutoTextGroupLB->GetEntryData( i )) + if( aLabItem.sGlossaryGroup == *(const OUString*)m_pAutoTextGroupLB->GetEntryData( i )) { bFound = true; break; @@ -686,7 +685,7 @@ void SwVisitingCardPage::Reset(const SfxItemSet& rSet) // initially search for a group starting with "crd" which is the name of the // business card AutoTexts for(i = 0; i < m_pAutoTextGroupLB->GetEntryCount() && !bFound; i++) - if(0 == (*(String*)m_pAutoTextGroupLB->GetEntryData( i )).SearchAscii( "crd") ) + if (((const OUString*)m_pAutoTextGroupLB->GetEntryData(i))->startsWith("crd")) { bFound = true; break; diff --git a/sw/source/ui/envelp/labelexp.cxx b/sw/source/ui/envelp/labelexp.cxx index b8ae603439a2..716d95055fb6 100644 --- a/sw/source/ui/envelp/labelexp.cxx +++ b/sw/source/ui/envelp/labelexp.cxx @@ -73,9 +73,8 @@ void SwVisitingCardPage::InitFrameControl() uno::Any aTitle = xPrSet->getPropertyValue( uTitleName ); OUString uTitle; aTitle >>= uTitle; - String sGroup(pGroups[i]); sal_uInt16 nEntry = m_pAutoTextGroupLB->InsertEntry(uTitle); - m_pAutoTextGroupLB->SetEntryData(nEntry, new String(sGroup)); + m_pAutoTextGroupLB->SetEntryData(nEntry, new OUString(pGroups[i])); } } catch (const Exception&) @@ -86,11 +85,11 @@ void SwVisitingCardPage::InitFrameControl() { if(LISTBOX_ENTRY_NOTFOUND == m_pAutoTextGroupLB->GetSelectEntryPos()) m_pAutoTextGroupLB->SelectEntryPos(0); - String sCurGroupName( - *(String*)m_pAutoTextGroupLB->GetEntryData(m_pAutoTextGroupLB->GetSelectEntryPos())); - if(m_xAutoText->hasByName(sCurGroupName)) + const OUString *pCurGroupName( + (const OUString*)m_pAutoTextGroupLB->GetEntryData(m_pAutoTextGroupLB->GetSelectEntryPos())); + if(m_xAutoText->hasByName(*pCurGroupName)) { - uno::Any aGroup = m_xAutoText->getByName(sCurGroupName); + uno::Any aGroup = m_xAutoText->getByName(*pCurGroupName); try { uno::Reference< text::XAutoTextGroup > xGroup; @@ -120,9 +119,9 @@ IMPL_LINK_NOARG(SwVisitingCardPage, FrameControlInitializedHdl) if(LISTBOX_ENTRY_NOTFOUND != m_pAutoTextGroupLB->GetSelectEntryPos()) { - String sGroup( *(String*)m_pAutoTextGroupLB->GetEntryData( + const OUString *pGroup( (const OUString*)m_pAutoTextGroupLB->GetEntryData( m_pAutoTextGroupLB->GetSelectEntryPos() ) ); - uno::Any aGroup = m_xAutoText->getByName(sGroup); + uno::Any aGroup = m_xAutoText->getByName(*pGroup); uno::Reference< text::XAutoTextGroup > xGroup; aGroup >>= xGroup; @@ -148,9 +147,9 @@ IMPL_LINK( SwVisitingCardPage, AutoTextSelectHdl, void*, pBox ) { if (m_pAutoTextGroupLB == pBox) { - String sGroup( *(String*)m_pAutoTextGroupLB->GetEntryData( + const OUString *pGroup( (const OUString*)m_pAutoTextGroupLB->GetEntryData( m_pAutoTextGroupLB->GetSelectEntryPos())); - uno::Any aGroup = m_xAutoText->getByName(sGroup); + uno::Any aGroup = m_xAutoText->getByName(*pGroup); uno::Reference< text::XAutoTextGroup > xGroup; aGroup >>= xGroup; |