From 267cb3b0f7ea47d503463b48fb4aa5387e6caef4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 11 Oct 2013 16:18:45 +0200 Subject: convert sw/source/ui/shells/*.cxx from String to OUString Change-Id: I8321849c7964bfb3aeb894e68819755aaf883c44 --- sw/source/ui/shells/annotsh.cxx | 30 +++++++++++----------- sw/source/ui/shells/basesh.cxx | 10 ++++---- sw/source/ui/shells/drwbassh.cxx | 2 +- sw/source/ui/shells/drwtxtex.cxx | 8 +++--- sw/source/ui/shells/drwtxtsh.cxx | 14 +++++----- sw/source/ui/shells/frmsh.cxx | 4 +-- sw/source/ui/shells/langhelper.cxx | 10 ++++---- sw/source/ui/shells/tabsh.cxx | 2 +- sw/source/ui/shells/textfld.cxx | 52 +++++++++++++++++++------------------- sw/source/ui/shells/textsh.cxx | 28 ++++++++++---------- sw/source/ui/shells/textsh1.cxx | 48 +++++++++++++++++------------------ sw/source/ui/shells/textsh2.cxx | 12 ++++----- sw/source/ui/shells/txtattr.cxx | 4 +-- 13 files changed, 111 insertions(+), 113 deletions(-) (limited to 'sw') diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 823bda44515d..d80109c30352 100644 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -1049,8 +1049,8 @@ void SwAnnotationShell::StateInsert(SfxItemSet &rSet) } else { - String sSel(pOLV->GetSelected()); - sSel.Erase(255); + OUString sSel(pOLV->GetSelected()); + sSel = sSel.copy(0, std::min(255, sSel.getLength())); aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' ')); } @@ -1145,10 +1145,10 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet) else { SvtUserOptions aUserOpt; - String sAuthor; - if( !(sAuthor = aUserOpt.GetFullName()).Len()) - if( !(sAuthor = aUserOpt.GetID()).Len() ) - sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR )); + OUString sAuthor; + if( (sAuthor = aUserOpt.GetFullName()).isEmpty() && + (sAuthor = aUserOpt.GetID()).isEmpty() ) + sAuthor = SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ); if (sAuthor == pPostItMgr->GetActiveSidebarWin()->GetAuthor()) rSet.DisableItem(nWhich); } @@ -1198,11 +1198,11 @@ void SwAnnotationShell::ExecLingu(SfxRequest &rReq) } case SID_THES: { - String aReplaceText; + OUString aReplaceText; SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); if (pItem2) aReplaceText = pItem2->GetValue(); - if (aReplaceText.Len() > 0) + if (!aReplaceText.isEmpty()) ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText ); break; } @@ -1635,8 +1635,8 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) if( pArgs ) pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem); - String sSym; - String sFontName; + OUString sSym; + OUString sFontName; if ( pItem ) { sSym = ((const SfxStringItem*)pItem)->GetValue(); @@ -1660,12 +1660,12 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( SID_ATTR_CHAR_FONT, GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) )); - if (!sFontName.Len()) + if (sFontName.isEmpty()) sFontName = aSetDlgFont.GetFamilyName(); } Font aFont(sFontName, Size(1,1)); - if( !sSym.Len() ) + if( sSym.isEmpty() ) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); @@ -1673,8 +1673,8 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) aAllSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) ); SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions()); - String sSymbolFont = aOpt.GetSymbolFont(); - if( sSymbolFont.Len() ) + OUString sSymbolFont = aOpt.GetSymbolFont(); + if( !sSymbolFont.isEmpty() ) aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) ); else aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) ); @@ -1707,7 +1707,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) delete( pDlg ); } - if( sSym.Len() ) + if( !sSym.isEmpty() ) { // do not flicker pOLV->HideCursor(); diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index a4ffed05acb2..e4823c5d24c7 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -702,7 +702,7 @@ void SwBaseShell::Execute(SfxRequest &rReq) { SwWait aWait( *rView.GetDocShell(), sal_True ); - String aGrfName, aFltName; + OUString aGrfName, aFltName; const Graphic aGrf( pGalleryItem->GetGraphic() ); if ( nSelType & nsSelectionType::SEL_GRF ) @@ -768,13 +768,13 @@ void SwBaseShell::Execute(SfxRequest &rReq) { aInsTblOpts.mnInsMode = 0; // Delimiter - String sDelim = static_cast< const SfxStringItem* >(pItem)->GetValue(); - if(sDelim.Len()) - cDelim = sDelim.GetChar(0); + OUString sDelim = static_cast< const SfxStringItem* >(pItem)->GetValue(); + if(!sDelim.isEmpty()) + cDelim = sDelim[0]; // AutoFormat if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_2, sal_True, &pItem)) { - String sAutoFmt = static_cast< const SfxStringItem* >(pItem)->GetValue(); + OUString sAutoFmt = static_cast< const SfxStringItem* >(pItem)->GetValue(); pAutoFmtTbl = new SwTableAutoFmtTbl; pAutoFmtTbl->Load(); diff --git a/sw/source/ui/shells/drwbassh.cxx b/sw/source/ui/shells/drwbassh.cxx index 81c804d2a214..ecee1ed97b29 100644 --- a/sw/source/ui/shells/drwbassh.cxx +++ b/sw/source/ui/shells/drwbassh.cxx @@ -615,7 +615,7 @@ IMPL_LINK( SwDrawBaseShell, CheckGroupShapeNameHdl, AbstractSvxNameDialog*, pNam const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); OSL_ENSURE(rMarkList.GetMarkCount() == 1, "wrong draw selection"); SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - const String sCurrentName = pObj->GetName(); + const OUString sCurrentName = pObj->GetName(); OUString sNewName; pNameDialog->GetName(sNewName); long nRet = 0; diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index 910497d489e4..c30db2c2c476 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -137,11 +137,11 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case SID_THES: { - String aReplaceText; + OUString aReplaceText; SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False ); if (pItem2) aReplaceText = pItem2->GetValue(); - if (aReplaceText.Len() > 0) + if (!aReplaceText.isEmpty()) ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText ); break; } @@ -1012,8 +1012,8 @@ void SwDrawTextShell::StateInsert(SfxItemSet &rSet) } else { - String sSel(pOLV->GetSelected()); - sSel.Erase(255); + OUString sSel(pOLV->GetSelected()); + sSel = sSel.copy(0, std::min(255, sSel.getLength())); aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' ')); } diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx index 9f5d599d0a11..eb960c506fb4 100644 --- a/sw/source/ui/shells/drwtxtsh.cxx +++ b/sw/source/ui/shells/drwtxtsh.cxx @@ -694,8 +694,8 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) if( pArgs ) pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem); - String sSym; - String sFontName; + OUString sSym; + OUString sFontName; if ( pItem ) { sSym = ((const SfxStringItem*)pItem)->GetValue(); @@ -719,19 +719,19 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( SID_ATTR_CHAR_FONT, GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) )); - if (!sFontName.Len()) + if (sFontName.isEmpty()) sFontName = aSetDlgFont.GetFamilyName(); } Font aFont(sFontName, Size(1,1)); - if(!sSym.Len()) + if(sSym.isEmpty()) { SfxAllItemSet aAllSet( GetPool() ); aAllSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) ); SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions()); - String sSymbolFont = aOpt.GetSymbolFont(); - if( sSymbolFont.Len() ) + OUString sSymbolFont = aOpt.GetSymbolFont(); + if( !sSymbolFont.isEmpty() ) aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) ); else aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) ); @@ -764,7 +764,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) delete( pDlg ); } - if( sSym.Len() ) + if( !sSym.isEmpty() ) { // do not flicker pOLV->HideCursor(); diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx index 85213730d698..db079a832afc 100644 --- a/sw/source/ui/shells/frmsh.cxx +++ b/sw/source/ui/shells/frmsh.cxx @@ -191,8 +191,8 @@ void SwFrameShell::Execute(SfxRequest &rReq) if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_HYPERLINK_SETLINK, sal_False, &pItem)) { const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem; - const String& rURL = rHLinkItem.GetURL(); - const String& rTarget = rHLinkItem.GetTargetFrame(); + const OUString& rURL = rHLinkItem.GetURL(); + const OUString& rTarget = rHLinkItem.GetTargetFrame(); SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL ); rSh.GetFlyFrmAttr( aSet ); diff --git a/sw/source/ui/shells/langhelper.cxx b/sw/source/ui/shells/langhelper.cxx index 3ba13b4ca481..aa5e771ac19e 100644 --- a/sw/source/ui/shells/langhelper.cxx +++ b/sw/source/ui/shells/langhelper.cxx @@ -67,12 +67,12 @@ namespace SwLangHelper // the value of used script types const sal_uInt16 nScriptType =pOLV->GetSelectedScriptType(); - String aScriptTypesInUse( OUString::number( nScriptType ) );//pEditEngine->GetScriptType(aSelection) + OUString aScriptTypesInUse( OUString::number( nScriptType ) );//pEditEngine->GetScriptType(aSelection) SvtLanguageTable aLangTable; // get keyboard language - String aKeyboardLang; + OUString aKeyboardLang; LanguageType nLang = LANGUAGE_DONTKNOW; Window* pWin = rEditView.GetWindow(); @@ -82,7 +82,7 @@ namespace SwLangHelper aKeyboardLang = aLangTable.GetString( nLang ); // get the language that is in use - String aCurrentLang = OUString("*"); + OUString aCurrentLang("*"); SfxItemSet aSet(pOLV->GetAttribs()); nLang = SwLangHelper::GetCurrentLanguage( aSet,nScriptType ); if (nLang != LANGUAGE_DONTKNOW) @@ -141,8 +141,8 @@ namespace SwLangHelper const OUString aSelectionLangPrefix("Current_"); const OUString aParagraphLangPrefix("Paragraph_"); const OUString aDocumentLangPrefix("Default_"); - const String aStrNone( OUString("LANGUAGE_NONE") ); - const String aStrResetLangs( OUString("RESET_LANGUAGES") ); + const OUString aStrNone("LANGUAGE_NONE"); + const OUString aStrResetLangs("RESET_LANGUAGES"); sal_Int32 nPos = 0; bool bForSelection = true; diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx index 68738b5691f9..81dd8c334590 100644 --- a/sw/source/ui/shells/tabsh.cxx +++ b/sw/source/ui/shells/tabsh.cxx @@ -634,7 +634,7 @@ void SwTableShell::Execute(SfxRequest &rReq) ((SwTblBoxNumFormat&)aBoxSet.Get( RES_BOXATR_FORMAT )).GetValue() )); - String sCurText( rSh.GetTableBoxText() ); + OUString sCurText( rSh.GetTableBoxText() ); aCoreSet.Put( SvxNumberInfoItem( pFormatter, ((SwTblBoxValue&)aBoxSet.Get( RES_BOXATR_VALUE)).GetValue(), diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx index c2666c8c43b2..c027e9f26fab 100644 --- a/sw/source/ui/shells/textfld.cxx +++ b/sw/source/ui/shells/textfld.cxx @@ -70,7 +70,7 @@ using namespace nsSwDocInfoSubType; extern bool bNoInterrupt; // in mainwn.cxx -static String& lcl_AppendRedlineStr( String& rStr, sal_uInt16 nRedlId ) +static OUString& lcl_AppendRedlineStr( OUString& rStr, sal_uInt16 nRedlId ) { sal_uInt16 nResId = 0; switch( nRedlId ) @@ -148,11 +148,11 @@ void SwTextShell::ExecField(SfxRequest &rReq) if(pFld && pFld->GetTyp()->Which() == RES_MACROFLD) { - const String& rMacro = ((SwMacroField*)pFld)->GetMacro(); - sal_uInt16 nPos = rMacro.Search('.', 0); - if(nPos != STRING_NOTFOUND) + const OUString& rMacro = ((SwMacroField*)pFld)->GetMacro(); + sal_Int32 nPos = rMacro.indexOf('.'); + if(nPos != -1) { - SvxMacro aMacro( rMacro.Copy(nPos + 1), rMacro.Copy(0,nPos), STARBASIC ); + SvxMacro aMacro( rMacro.copy(nPos + 1), rMacro.copy(0,nPos), STARBASIC ); rSh.ExecMacro(aMacro); } } @@ -192,14 +192,14 @@ void SwTextShell::ExecField(SfxRequest &rReq) { sal_uLong nFormat = 0; sal_uInt16 nType = 0; - String aPar1 = ((SfxStringItem *)pItem)->GetValue(); - String aPar2; + OUString aPar1 = ((SfxStringItem *)pItem)->GetValue(); + OUString aPar2; sal_Int32 nCommand = 0; if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE, sal_False, &pItem )) nType = ((SfxUInt16Item *)pItem)->GetValue(); - aPar1 += DB_DELIM; + aPar1 += OUString(DB_DELIM); if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_1, sal_False, &pItem )) { @@ -208,9 +208,9 @@ void SwTextShell::ExecField(SfxRequest &rReq) if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_3, sal_False, &pItem )) nCommand = ((SfxInt32Item*)pItem)->GetValue(); - aPar1 += DB_DELIM; + aPar1 += OUString(DB_DELIM); aPar1 += OUString::number(nCommand); - aPar1 += DB_DELIM; + aPar1 += OUString(DB_DELIM); if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_2, sal_False, &pItem )) { @@ -239,8 +239,8 @@ void SwTextShell::ExecField(SfxRequest &rReq) sal_uLong nFormat = 0; sal_uInt16 nType = 0; sal_uInt16 nSubType = 0; - String aPar1 = ((SfxStringItem *)pItem)->GetValue(); - String aPar2; + OUString aPar1 = ((SfxStringItem *)pItem)->GetValue(); + OUString aPar2; sal_Unicode cSeparator = ' '; if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE, @@ -258,9 +258,9 @@ void SwTextShell::ExecField(SfxRequest &rReq) if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_3, sal_False, &pItem )) { - String sTmp = ((SfxStringItem *)pItem)->GetValue(); - if(sTmp.Len()) - cSeparator = sTmp.GetChar(0); + OUString sTmp = ((SfxStringItem *)pItem)->GetValue(); + if(!sTmp.isEmpty()) + cSeparator = sTmp[0]; } SwInsertFld_Data aData(nType, nSubType, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator ); bRes = aFldMgr.InsertFld( aData ); @@ -337,10 +337,10 @@ void SwTextShell::ExecField(SfxRequest &rReq) if (bNew || GetView().GetPostItMgr()->IsAnswer()) { SvtUserOptions aUserOpt; - String sAuthor; - if( !(sAuthor = aUserOpt.GetFullName()).Len()) - if( !(sAuthor = aUserOpt.GetID()).Len() ) - sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR )); + OUString sAuthor; + if( (sAuthor = aUserOpt.GetFullName()).isEmpty()) + if( (sAuthor = aUserOpt.GetID()).isEmpty() ) + sAuthor = SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ); // Save the current selection, it will be required later for fieldmark insertion. SwPaM& rCurrPam = rSh.GetCurrentShellCursor(); @@ -457,7 +457,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) OSL_ENSURE(pDlg, "Dialogdiet fail!"); pDlg->HideAuthor(); - String sTitle(SW_RES(STR_REDLINE_COMMENT)); + OUString sTitle(SW_RES(STR_REDLINE_COMMENT)); ::lcl_AppendRedlineStr( sTitle, pRedline->GetType() ); pDlg->SetText(sTitle); @@ -475,7 +475,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) if ( pDlg->Execute() == RET_OK ) { const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); - String sMsg(((const SvxPostItTextItem&)pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue()); + OUString sMsg(((const SvxPostItTextItem&)pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue()); // Insert or change a comment rSh.SetRedlineComment(sMsg); @@ -706,9 +706,9 @@ void SwTextShell::StateField( SfxItemSet &rSet ) void SwTextShell::InsertHyperlink(const SvxHyperlinkItem& rHlnkItem) { - const String& rName = rHlnkItem.GetName(); - const String& rURL = rHlnkItem.GetURL(); - const String& rTarget = rHlnkItem.GetTargetFrame(); + const OUString& rName = rHlnkItem.GetName(); + const OUString& rURL = rHlnkItem.GetURL(); + const OUString& rTarget = rHlnkItem.GetTargetFrame(); sal_uInt16 nType = (sal_uInt16)rHlnkItem.GetInsertMode(); nType &= ~HLINK_HTMLMODE; const SvxMacroTableDtor* pMacroTbl = rHlnkItem.GetMacroTbl(); @@ -808,7 +808,7 @@ IMPL_LINK( SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog *, pBtn ) GetAppLangDateTimeString( pRedline->GetRedlineData().GetTimeStamp() )); - String sTitle(SW_RES(STR_REDLINE_COMMENT)); + OUString sTitle(SW_RES(STR_REDLINE_COMMENT)); ::lcl_AppendRedlineStr( sTitle, pRedline->GetType() ); pDlg->SetText(sTitle); @@ -855,7 +855,7 @@ IMPL_LINK( SwTextShell, RedlinePrevHdl, AbstractSvxPostItDialog *, pBtn ) GetAppLangDateTimeString( pRedline->GetRedlineData().GetTimeStamp() )); - String sTitle(SW_RES(STR_REDLINE_COMMENT)); + OUString sTitle(SW_RES(STR_REDLINE_COMMENT)); ::lcl_AppendRedlineStr( sTitle, pRedline->GetType() ); pDlg->SetText(sTitle); diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index 487110f74a23..266c03b0c7df 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -217,7 +217,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) if ( ERRCODE_NONE == aDlg.Execute() ) { // Determine URL - String aStrURL( aDlg.GetPath() ); + OUString aStrURL( aDlg.GetPath() ); aStrURL = URIHelper::SmartRel2Abs( INetURLObject(), aStrURL, URIHelper::GetMaybeFileHdl() ); @@ -265,7 +265,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) svt::EmbeddedObjectRef xObj; if( nSlot == SID_INSERT_PLUGIN && ( pClassLocationItem || pCommandsItem ) ) { - String sClassLocation; + OUString sClassLocation; if(pClassLocationItem) sClassLocation = pClassLocationItem->GetValue(); @@ -287,7 +287,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) { try { - if ( sClassLocation.Len() ) + if ( !sClassLocation.isEmpty() ) xSet->setPropertyValue("PluginURL", uno::makeAny( OUString( @@ -757,7 +757,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) rSh.StartAction(); rSh.CreateCrsr(); rSh.SwCrsrShell::SelectTxtAttr(RES_TXTATR_INETFMT,sal_True); - String sLinkName = rSh.GetSelTxt(); + OUString sLinkName = rSh.GetSelTxt(); aHLinkItem.SetName(sLinkName); aHLinkItem.SetInsertMode(HLINK_FIELD); rSh.DestroyCrsr(); @@ -765,8 +765,8 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) } else { - String sReturn = rSh.GetSelTxt(); - sReturn.Erase(255); + OUString sReturn = rSh.GetSelTxt(); + sReturn = sReturn.copy(0, std::min(255, sReturn.getLength())); aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' ')); } @@ -929,7 +929,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) if( pArgs ) pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem); - String aChars, aFontName; + OUString aChars, aFontName; if ( pItem ) { aChars = ((const SfxStringItem*)pItem)->GetValue(); @@ -959,20 +959,20 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) aFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( RES_CHRATR_FONT, GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) )); - if (!aFontName.Len()) + if (aFontName.isEmpty()) aFontName = aFont.GetFamilyName(); } Font aNewFont(aFontName, Size(1,1)); // Size only because CTOR. - if( !aChars.Len() ) + if( aChars.isEmpty() ) { // Set selected font as default. SfxAllItemSet aAllSet( rSh.GetAttrPool() ); aAllSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) ); SwViewOption aOpt(*GetShell().GetViewOptions()); - String sSymbolFont = aOpt.GetSymbolFont(); - if( !aFontName.Len() && sSymbolFont.Len() ) + OUString sSymbolFont = aOpt.GetSymbolFont(); + if( aFontName.isEmpty() && !sSymbolFont.isEmpty() ) aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) ); else aAllSet.Put( SfxStringItem( SID_FONT_NAME, aFont.GetFamilyName() ) ); @@ -1003,7 +1003,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) delete pDlg; } - if( aChars.Len() ) + if( !aChars.isEmpty() ) { rSh.StartAllAction(); @@ -1063,7 +1063,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) } rSh.SetMark(); - rSh.ExtendSelection( sal_False, aChars.Len() ); + rSh.ExtendSelection( sal_False, aChars.getLength() ); rSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND | nsSetAttrMode::SETATTR_NOFORMATATTR ); if( !rSh.IsCrsrPtAtEnd() ) rSh.SwapPam(); @@ -1084,7 +1084,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) rSh.EndAllAction(); rSh.EndUndo(); - if ( aChars.Len() ) + if ( !aChars.isEmpty() ) { rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), aChars ) ); rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aNewFont.GetName() ) ); diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index 61e91358b5ad..add6747cd2fd 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -211,15 +211,15 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const // The old item is for unknown reasons back in the set again. if( !bSelectionPut && SFX_ITEM_SET == aTmpSet.GetItemState(FN_PARAM_SELECTION, sal_False, &pSelectionItem) ) { - String sInsert = ((const SfxStringItem*)pSelectionItem)->GetValue(); - bInsert = sInsert.Len() != 0; + OUString sInsert = ((const SfxStringItem*)pSelectionItem)->GetValue(); + bInsert = !sInsert.isEmpty(); if(bInsert) { - nInsert = sInsert.Len(); + nInsert = sInsert.getLength(); rWrtSh.StartAction(); rWrtSh.Insert( sInsert ); rWrtSh.SetMark(); - rWrtSh.ExtendSelection(sal_False, sInsert.Len()); + rWrtSh.ExtendSelection(sal_False, sInsert.getLength()); SfxRequest aReq( rWrtSh.GetView().GetViewFrame(), FN_INSERT_STRING ); aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sInsert ) ); aReq.Done(); @@ -259,8 +259,8 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const static short lcl_AskRedlineMode(Window *pWin) { MessBox aQBox( pWin, 0, - String( SW_RES( STR_REDLINE_TITLE ) ), - String( SW_RES( STR_REDLINE_MSG ) ) ); + OUString( SW_RES( STR_REDLINE_TITLE ) ), + OUString( SW_RES( STR_REDLINE_MSG ) ) ); aQBox.SetImage( QueryBox::GetStandardImage() ); sal_uInt16 nBtnFlags = BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | @@ -328,8 +328,8 @@ void SwTextShell::Execute(SfxRequest &rReq) const OUString aSelectionLangPrefix("Current_"); const OUString aParagraphLangPrefix("Paragraph_"); const OUString aDocumentLangPrefix("Default_"); - const String aStrNone( OUString("LANGUAGE_NONE") ); - const String aStrResetLangs( OUString("RESET_LANGUAGES") ); + const OUString aStrNone("LANGUAGE_NONE"); + const OUString aStrResetLangs("RESET_LANGUAGES"); SfxItemSet aCoreSet( GetPool(), RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE, @@ -404,15 +404,15 @@ void SwTextShell::Execute(SfxRequest &rReq) case SID_THES: { // replace word/selection with text from selected sub menu entry - String aReplaceText; + OUString aReplaceText; SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES , sal_False ); if (pItem2) aReplaceText = pItem2->GetValue(); - if (aReplaceText.Len() > 0) + if (!aReplaceText.isEmpty()) { SwView &rView2 = rWrtSh.GetView(); const bool bSelection = rWrtSh.HasSelection(); - const String aLookUpText = rView2.GetThesaurusLookUpText( bSelection ); + const OUString aLookUpText = rView2.GetThesaurusLookUpText( bSelection ); rView2.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection ); } } @@ -426,7 +426,7 @@ void SwTextShell::Execute(SfxRequest &rReq) case FN_INSERT_FOOTNOTE: case FN_INSERT_ENDNOTE: { - String aStr; + OUString aStr; SFX_REQUEST_ARG( rReq, pFont, SfxStringItem, FN_PARAM_1 , sal_False ); SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, nSlot , sal_False ); if ( pNameItem ) @@ -745,7 +745,7 @@ void SwTextShell::Execute(SfxRequest &rReq) pVFrame->GetBindings().InvalidateAll( sal_True ); } - String sFormula(((const SfxStringItem*)pItem)->GetValue()); + OUString sFormula(((const SfxStringItem*)pItem)->GetValue()); SwFldMgr aFldMgr; rWrtSh.StartAllAction(); sal_Bool bDelSel; @@ -761,7 +761,7 @@ void SwTextShell::Execute(SfxRequest &rReq) if( !bDelSel && aFldMgr.GetCurFld() && TYP_FORMELFLD == aFldMgr.GetCurTypeId() ) aFldMgr.UpdateCurFld( aFldMgr.GetCurFld()->GetFormat(), aEmptyStr, sFormula ); - else if( sFormula.Len() ) + else if( !sFormula.isEmpty() ) { if( rWrtSh.IsCrsrInTbl() ) { @@ -994,7 +994,7 @@ void SwTextShell::Execute(SfxRequest &rReq) if( SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_DROP, sal_False, &pItem )) { - String sCharStyleName; + OUString sCharStyleName; if(((const SwFmtDrop*)pItem)->GetCharFmt()) sCharStyleName = ((const SwFmtDrop*)pItem)->GetCharFmt()->GetName(); pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName)); @@ -1212,7 +1212,7 @@ void SwTextShell::Execute(SfxRequest &rReq) case FN_INSERT_PAGEFOOTER: if(pArgs && pArgs->Count()) { - String sStyleName; + OUString sStyleName; if(pItem) sStyleName = ((const SfxStringItem*)pItem)->GetValue(); sal_Bool bOn = sal_True; @@ -1333,19 +1333,19 @@ void SwTextShell::GetState( SfxItemSet &rSet ) case SID_LANGUAGE_STATUS: { // the value of used script types - String aScriptTypesInUse( OUString::number( rSh.GetScriptType() ) ); + OUString aScriptTypesInUse( OUString::number( rSh.GetScriptType() ) ); SvtLanguageTable aLangTable; // get keyboard language - String aKeyboardLang; + OUString aKeyboardLang; SwEditWin& rEditWin = GetView().GetEditWin(); LanguageType nLang = rEditWin.GetInputLanguage(); if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM) aKeyboardLang = aLangTable.GetString( nLang ); // get the language that is in use - String aCurrentLang = OUString("*"); + OUString aCurrentLang = OUString("*"); nLang = SwLangHelper::GetCurrentLanguage( rSh ); if (nLang != LANGUAGE_DONTKNOW) aCurrentLang = aLangTable.GetString( nLang ); @@ -1367,7 +1367,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) case SID_THES: { // is there a valid selection to get text from? - String aText; + OUString aText; bool bValid = !rSh.HasSelection() || (rSh.IsSelOnePara() && !rSh.IsMultiSelection()); // prevent context menu from showing when cursor is not in or at the end of a word @@ -1380,18 +1380,16 @@ void SwTextShell::GetState( SfxItemSet &rSet ) LanguageType nLang = rSh.GetCurLang(); LanguageTag aLanguageTag( nLang); lang::Locale aLocale( aLanguageTag.getLocale()); - String aLangText( aLanguageTag.getBcp47() ); + OUString aLangText( aLanguageTag.getBcp47() ); // set word and locale to look up as status value - OUString aStatusVal( aText ); - aStatusVal += "#"; - aStatusVal += aLangText; + OUString aStatusVal = aText + "#" + aLangText; rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable "Thesaurus" context menu entry if there is nothing to look up uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); - if (aText.Len() == 0 || + if (aText.isEmpty() || !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) rSet.DisableItem( SID_THES ); } diff --git a/sw/source/ui/shells/textsh2.cxx b/sw/source/ui/shells/textsh2.cxx index 003de77d8549..1b66e8d0bc4f 100644 --- a/sw/source/ui/shells/textsh2.cxx +++ b/sw/source/ui/shells/textsh2.cxx @@ -197,13 +197,13 @@ void SwTextShell::ExecDB(SfxRequest &rReq) OUString sColumnName; if(pColumnNameItem) ((SfxUsrAnyItem*)pColumnNameItem)->GetValue() >>= sColumnName; - String sDBName = sSourceArg; - sDBName += DB_DELIM; - sDBName += (String)sCommandArg; - sDBName += DB_DELIM; + OUString sDBName = sSourceArg; + sDBName += OUString(DB_DELIM); + sDBName += sCommandArg; + sDBName += OUString(DB_DELIM); sDBName += OUString::number(nCommandTypeArg); - sDBName += DB_DELIM; - sDBName += (String)sColumnName; + sDBName += OUString(DB_DELIM); + sDBName += sColumnName; SwFldMgr aFldMgr(GetShellPtr()); SwInsertFld_Data aData(TYP_DBFLD, 0, sDBName, aEmptyStr, 0); diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx index d5b8e3d06990..347966092828 100644 --- a/sw/source/ui/shells/txtattr.cxx +++ b/sw/source/ui/shells/txtattr.cxx @@ -423,12 +423,12 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq) case FN_DROP_CHAR_STYLE_NAME: if( pItem ) { - String sCharStyleName = ((const SfxStringItem*)pItem)->GetValue(); + OUString sCharStyleName = ((const SfxStringItem*)pItem)->GetValue(); SfxItemSet aSet(GetPool(), RES_PARATR_DROP, RES_PARATR_DROP, 0L); rSh.GetCurAttr(aSet); SwFmtDrop aDropItem((const SwFmtDrop&)aSet.Get(RES_PARATR_DROP)); SwCharFmt* pFmt = 0; - if(sCharStyleName.Len()) + if(!sCharStyleName.isEmpty()) pFmt = rSh.FindCharFmtByName( sCharStyleName ); aDropItem.SetCharFmt( pFmt ); aSet.Put(aDropItem); -- cgit