From 8cb77fd34ae57f5aef0dce09fe4558db927e56b7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 14 Oct 2013 10:49:26 +0200 Subject: convert sw/source/ui/envelp/*.cxx from String to OUString Change-Id: I47cf96da2ed61430257b23b238a8926c8041a98e --- sw/source/ui/envelp/envimg.cxx | 4 +-- sw/source/ui/envelp/envlop1.cxx | 4 +-- sw/source/ui/envelp/label1.cxx | 66 ++++++++++++++++++---------------------- sw/source/ui/envelp/labelcfg.cxx | 8 ++--- sw/source/ui/envelp/labelexp.cxx | 4 +-- sw/source/ui/envelp/labfmt.cxx | 4 +-- sw/source/ui/envelp/mailmrge.cxx | 8 ++--- 7 files changed, 46 insertions(+), 52 deletions(-) (limited to 'sw') diff --git a/sw/source/ui/envelp/envimg.cxx b/sw/source/ui/envelp/envimg.cxx index ae0c53352002..b421d92bb4ad 100644 --- a/sw/source/ui/envelp/envimg.cxx +++ b/sw/source/ui/envelp/envimg.cxx @@ -53,13 +53,13 @@ SW_DLLPUBLIC OUString MakeSender() SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions(); OUString sRet; - String sSenderToken(SW_RES(STR_SENDER_TOKENS)); + OUString sSenderToken(SW_RES(STR_SENDER_TOKENS)); xub_StrLen nTokenCount = comphelper::string::getTokenCount(sSenderToken, ';'); sal_Int32 nSttPos = 0; bool bLastLength = true; for( xub_StrLen i = 0; i < nTokenCount; i++ ) { - OUString sToken = sSenderToken.GetToken( 0, ';', nSttPos ); + OUString sToken = sSenderToken.getToken( 0, ';', nSttPos ); if (sToken == "COMPANY") { xub_StrLen nOldLen = sRet.getLength(); diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx index 86a64213580d..f2e240a3af48 100644 --- a/sw/source/ui/envelp/envlop1.cxx +++ b/sw/source/ui/envelp/envlop1.cxx @@ -294,8 +294,8 @@ void SwEnvPage::InitDatabaseBox() for (long i = 0; i < aDataNames.getLength(); i++) m_pDatabaseLB->InsertEntry(pDataNames[i]); - String sDBName = sActDBName.getToken( 0, DB_DELIM ); - String sTableName = sActDBName.getToken( 1, DB_DELIM ); + OUString sDBName = sActDBName.getToken( 0, DB_DELIM ); + OUString sTableName = sActDBName.getToken( 1, DB_DELIM ); m_pDatabaseLB->SelectEntry(sDBName); if (pSh->GetNewDBMgr()->GetTableNames(m_pTableLB, sDBName)) { diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index c214c9f396f0..a736545fd232 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -135,7 +135,7 @@ SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet, // Read user label from writer.cfg SwLabItem aItem((const SwLabItem&)rSet.Get( FN_LABEL )); SwLabRec* pRec = new SwLabRec; - const String aTmp( SW_RES( STR_CUSTOM ) ); + const OUString aTmp( SW_RES( STR_CUSTOM ) ); pRec->aMake = pRec->aType = aTmp; pRec->SetFromItem( aItem ); @@ -202,7 +202,7 @@ SwLabRec* SwLabDlg::GetRecord(const OUString &rRecName, sal_Bool bCont) { SwLabRec* pRec = NULL; bool bFound = false; - String sCustom(SW_RES(STR_CUSTOM)); + OUString sCustom(SW_RES(STR_CUSTOM)); const sal_uInt16 nCount = Recs().size(); for (sal_uInt16 i = 0; i < nCount; i++) @@ -302,7 +302,7 @@ void SwLabPage::SetToBusinessCard() IMPL_LINK_NOARG(SwLabPage, AddrHdl) { - String aWriting; + OUString aWriting; if ( m_pAddrBox->IsChecked() ) aWriting = convertLineEnd(MakeSender(), GetSystemLineEnd()); @@ -353,7 +353,7 @@ IMPL_LINK_NOARG(SwLabPage, MakeHdl) m_pHiddenSortTypeBox->Clear(); GetParentSwLabDlg()->TypeIds().clear(); - const String aMake = m_pMakeBox->GetSelectEntry(); + const OUString aMake = m_pMakeBox->GetSelectEntry(); GetParentSwLabDlg()->ReplaceGroup( aMake ); aItem.aLstMake = aMake; @@ -361,11 +361,11 @@ IMPL_LINK_NOARG(SwLabPage, MakeHdl) const sal_uInt16 nCount = GetParentSwLabDlg()->Recs().size(); sal_uInt16 nLstType = 0; - const String sCustom(SW_RES(STR_CUSTOM)); + const OUString sCustom(SW_RES(STR_CUSTOM)); //insert the entries into the sorted list box for ( sal_uInt16 i = 0; i < nCount; ++i ) { - const String aType ( GetParentSwLabDlg()->Recs()[i]->aType ); + const OUString aType ( GetParentSwLabDlg()->Recs()[i]->aType ); bool bInsert = false; if ( GetParentSwLabDlg()->Recs()[i]->aType == sCustom ) { @@ -383,7 +383,7 @@ IMPL_LINK_NOARG(SwLabPage, MakeHdl) if(bInsert) { GetParentSwLabDlg()->TypeIds().push_back(i); - if ( !nLstType && aType == String(aItem.aLstType) ) + if ( !nLstType && aType == OUString(aItem.aLstType) ) nLstType = GetParentSwLabDlg()->TypeIds().size(); } } @@ -420,27 +420,21 @@ void SwLabPage::DisplayFormat() aItem.aLstType = pRec->aType; SETFLDVAL(aField, pRec->lWidth); aField.Reformat(); - const String aWString = aField.GetText(); + const OUString aWString = aField.GetText(); SETFLDVAL(aField, pRec->lHeight); aField.Reformat(); - OUString aText = pRec->aType; - aText += ": "; - aText += aWString; - aText += " x "; - aText += aField.GetText(); - aText += " ("; - aText += OUString::number( pRec->nCols ); - aText += " x "; - aText += OUString::number( pRec->nRows ); - aText += ")"; + OUString aText = pRec->aType + ": " + aWString + + " x " + aField.GetText() + + " (" + OUString::number( pRec->nCols ) + + " x " + OUString::number( pRec->nRows ) + ")"; m_pFormatInfo->SetText(aText); } SwLabRec* SwLabPage::GetSelectedEntryPos() { - String sSelEntry(m_pTypeBox->GetSelectEntry()); + OUString sSelEntry(m_pTypeBox->GetSelectEntry()); return GetParentSwLabDlg()->GetRecord(sSelEntry, m_pContButton->IsChecked()); } @@ -454,10 +448,10 @@ void SwLabPage::InitDatabaseBox() const OUString* pDataNames = aDataNames.getConstArray(); for (long i = 0; i < aDataNames.getLength(); i++) m_pDatabaseLB->InsertEntry(pDataNames[i]); - String sDBName = sActDBName.getToken( 0, DB_DELIM ); - String sTableName = sActDBName.getToken( 1, DB_DELIM ); + OUString sDBName = sActDBName.getToken( 0, DB_DELIM ); + OUString sTableName = sActDBName.getToken( 1, DB_DELIM ); m_pDatabaseLB->SelectEntry(sDBName); - if( sDBName.Len() && GetNewDBMgr()->GetTableNames(m_pTableLB, sDBName)) + if( !sDBName.isEmpty() && GetNewDBMgr()->GetTableNames(m_pTableLB, sDBName)) { m_pTableLB->SelectEntry(sTableName); GetNewDBMgr()->GetColumnNames(m_pDBFieldLB, sActDBName, sTableName); @@ -512,28 +506,28 @@ sal_Bool SwLabPage::FillItemSet(SfxItemSet& rSet) void SwLabPage::Reset(const SfxItemSet& rSet) { aItem = (const SwLabItem&) rSet.Get(FN_LABEL); - String sDBName = aItem.sDBName; + OUString sDBName = aItem.sDBName; - String aWriting(convertLineEnd(aItem.aWriting, GetSystemLineEnd())); + OUString aWriting(convertLineEnd(aItem.aWriting, GetSystemLineEnd())); m_pAddrBox->Check( aItem.bAddr ); m_pWritingEdit->SetText ( aWriting ); for(std::vector::const_iterator i = GetParentSwLabDlg()->Makes().begin(); i != GetParentSwLabDlg()->Makes().end(); ++i) { - if(m_pMakeBox->GetEntryPos(String(*i)) == LISTBOX_ENTRY_NOTFOUND) + if(m_pMakeBox->GetEntryPos(OUString(*i)) == LISTBOX_ENTRY_NOTFOUND) m_pMakeBox->InsertEntry(*i); } m_pMakeBox->SelectEntry( aItem.aMake ); //save the current type - String sType(aItem.aType); + OUString sType(aItem.aType); m_pMakeBox->GetSelectHdl().Call(m_pMakeBox); aItem.aType = sType; //#102806# a newly added make may not be in the type ListBox already - if (m_pTypeBox->GetEntryPos(String(aItem.aType)) == LISTBOX_ENTRY_NOTFOUND && !aItem.aMake.isEmpty()) + if (m_pTypeBox->GetEntryPos(aItem.aType) == LISTBOX_ENTRY_NOTFOUND && !aItem.aMake.isEmpty()) GetParentSwLabDlg()->UpdateGroup( aItem.aMake ); - if (m_pTypeBox->GetEntryPos(String(aItem.aType)) != LISTBOX_ENTRY_NOTFOUND) + if (m_pTypeBox->GetEntryPos(aItem.aType) != LISTBOX_ENTRY_NOTFOUND) { m_pTypeBox->SelectEntry(aItem.aType); m_pTypeBox->GetSelectHdl().Call(m_pTypeBox); @@ -555,7 +549,7 @@ void SwVisitingCardPage::ClearUserData() SvTreeListEntry* pEntry = m_pAutoTextLB->First(); while(pEntry) { - delete (String*)pEntry->GetUserData(); + delete (OUString*)pEntry->GetUserData(); pEntry = m_pAutoTextLB->Next(pEntry); } } @@ -566,7 +560,7 @@ void SwVisitingCardPage::SetUserData( sal_uInt32 nCnt, for( sal_uInt32 i = 0; i < nCnt; ++i ) { SvTreeListEntry* pEntry = m_pAutoTextLB->InsertEntry( pNames[ i ] ); - pEntry->SetUserData( new String( pValues[ i ] )); + pEntry->SetUserData( new OUString( pValues[ i ] )); } } @@ -632,17 +626,17 @@ sal_Bool SwVisitingCardPage::FillItemSet(SfxItemSet& rSet) SvTreeListEntry* pSelEntry = m_pAutoTextLB->FirstSelected(); if(pSelEntry) - aLabItem.sGlossaryBlockName = *(String*)pSelEntry->GetUserData(); + aLabItem.sGlossaryBlockName = *(OUString*)pSelEntry->GetUserData(); rSet.Put(aLabItem); return sal_True; } -static void lcl_SelectBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName) +static void lcl_SelectBlock(SvTreeListBox& rAutoTextLB, const OUString& rBlockName) { SvTreeListEntry* pEntry = rAutoTextLB.First(); while(pEntry) { - if(*(String*)pEntry->GetUserData() == rBlockName) + if(*(OUString*)pEntry->GetUserData() == rBlockName) { rAutoTextLB.Select(pEntry); rAutoTextLB.MakeVisible(pEntry); @@ -652,12 +646,12 @@ static void lcl_SelectBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName } } -static bool lcl_FindBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName) +static bool lcl_FindBlock(SvTreeListBox& rAutoTextLB, const OUString& rBlockName) { SvTreeListEntry* pEntry = rAutoTextLB.First(); while(pEntry) { - if(*(String*)pEntry->GetUserData() == rBlockName) + if(*(OUString*)pEntry->GetUserData() == rBlockName) { rAutoTextLB.Select(pEntry); return true; @@ -702,7 +696,7 @@ void SwVisitingCardPage::Reset(const SfxItemSet& rSet) { SvTreeListEntry* pSelEntry = m_pAutoTextLB->FirstSelected(); if( pSelEntry && - *(String*)pSelEntry->GetUserData() != String(aLabItem.sGlossaryBlockName)) + *(OUString*)pSelEntry->GetUserData() != aLabItem.sGlossaryBlockName) { lcl_SelectBlock(*m_pAutoTextLB, aLabItem.sGlossaryBlockName); AutoTextSelectHdl(m_pAutoTextLB); diff --git a/sw/source/ui/envelp/labelcfg.cxx b/sw/source/ui/envelp/labelcfg.cxx index 6b5d7cac4698..9fe33ee3724d 100644 --- a/sw/source/ui/envelp/labelcfg.cxx +++ b/sw/source/ui/envelp/labelcfg.cxx @@ -182,15 +182,15 @@ static SwLabRec* lcl_CreateSwLabRec(const OUString& rType, const OUString& rMeas pNewRec->aType = rType; //all values are contained as colon-separated 1/100 mm values //except for the continuous flag ('C'/'S') and nCols, nRows (sal_Int32) - String sMeasure(rMeasure); + OUString sMeasure(rMeasure); sal_uInt16 nTokenCount = comphelper::string::getTokenCount(sMeasure, ';'); for(sal_uInt16 i = 0; i < nTokenCount; i++) { - String sToken(sMeasure.GetToken(i, ';' )); - int nVal = sToken.ToInt32(); + OUString sToken(sMeasure.getToken(i, ';' )); + int nVal = sToken.toInt32(); switch(i) { - case 0 : pNewRec->bCont = sToken.GetChar(0) == 'C'; break; + case 0 : pNewRec->bCont = sToken[0] == 'C'; break; case 1 : pNewRec->lHDist = MM100_TO_TWIP(nVal); break; case 2 : pNewRec->lVDist = MM100_TO_TWIP(nVal); break; case 3 : pNewRec->lWidth = MM100_TO_TWIP(nVal); break; diff --git a/sw/source/ui/envelp/labelexp.cxx b/sw/source/ui/envelp/labelexp.cxx index e8b4b8959f29..8a384ed13fd4 100644 --- a/sw/source/ui/envelp/labelexp.cxx +++ b/sw/source/ui/envelp/labelexp.cxx @@ -111,7 +111,7 @@ void SwVisitingCardPage::InitFrameControl() IMPL_LINK_NOARG(SwVisitingCardPage, FrameControlInitializedHdl) { SvTreeListEntry* pSel = m_pAutoTextLB->FirstSelected(); - String sEntry; + OUString sEntry; if( pSel ) sEntry = *(String*)pSel->GetUserData(); uno::Reference< text::XTextCursor > & xCrsr = pExampleFrame->GetTextCursor(); @@ -125,7 +125,7 @@ IMPL_LINK_NOARG(SwVisitingCardPage, FrameControlInitializedHdl) uno::Reference< text::XAutoTextGroup > xGroup; aGroup >>= xGroup; - if( sEntry.Len() && xGroup->hasByName( uEntry ) ) + if( !sEntry.isEmpty() && xGroup->hasByName( uEntry ) ) { uno::Any aEntry(xGroup->getByName(uEntry)); uno::Reference< text::XAutoTextEntry > xEntry; diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index 06b7dd8e3d9f..dc273f535f71 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -608,8 +608,8 @@ SwSaveLabelDlg::SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec) IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl) { SwLabelConfig& rCfg = pLabPage->GetParentSwLabDlg()->GetLabelsConfig(); - String sMake(m_pMakeCB->GetText()); - String sType(m_pTypeED->GetText()); + OUString sMake(m_pMakeCB->GetText()); + OUString sType(m_pTypeED->GetText()); if(rCfg.HasLabel(sMake, sType)) { if ( rCfg.IsPredefinedLabel(sMake, sType) ) diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 4ff7fb8cd5e3..fbddd97bf583 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -365,8 +365,8 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell, aAddressFldLB.SelectEntry(OUString("EMAIL")); - String sPath(pModOpt->GetMailingPath()); - if(!sPath.Len()) + OUString sPath(pModOpt->GetMailingPath()); + if(sPath.isEmpty()) { SvtPathOptions aPathOpt; sPath = aPathOpt.GetWorkPath(); @@ -759,8 +759,8 @@ bool SwMailMergeDlg::ExecQryShell() IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl) { - String sPath( aPathED.GetText() ); - if( !sPath.Len() ) + OUString sPath( aPathED.GetText() ); + if( sPath.isEmpty() ) { SvtPathOptions aPathOpt; sPath = aPathOpt.GetWorkPath(); -- cgit