[PATCH] String.AppendAscii Drop
Ricardo Montania (via Code Review)
gerrit at gerrit.libreoffice.org
Mon May 13 12:18:02 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3892
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/92/3892/1
String.AppendAscii Drop
Change-Id: I12175a81f0a74546b5e00633176f204b9a3fb35c
---
M formula/source/ui/dlg/formula.cxx
M framework/source/uielement/langselectionmenucontroller.cxx
M linguistic/source/misc2.cxx
M linguistic/workben/sspellimp.cxx
M lotuswordpro/source/filter/lwptblformula.cxx
M padmin/source/adddlg.cxx
M padmin/source/cmddlg.cxx
M padmin/source/padialog.cxx
M padmin/source/prtsetup.cxx
M reportdesign/source/ui/dlg/AddField.cxx
M sc/source/core/data/stlpool.cxx
11 files changed, 66 insertions(+), 84 deletions(-)
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 51bb4e4..fa82027 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -823,11 +823,11 @@
// 2. Page or Edit: show selected function
xub_StrLen nFStart = pData->GetFStart();
- String aFormula = m_pHelper->getCurrentFormula();
+ OUString aFormula = m_pHelper->getCurrentFormula();
xub_StrLen nNextFStart = nFStart;
xub_StrLen nNextFEnd = 0;
- aFormula.AppendAscii(RTL_CONSTASCII_STRINGPARAM( " )" ));
+ aFormula += " )";
DeleteArgs();
const IFunctionDescription* pOldFuncDesc = pFuncDesc;
sal_Bool bTestFlag = sal_False;
@@ -1035,8 +1035,8 @@
const IFunctionDescription* pDesc = pFuncPage->GetFuncDesc(nFunc);
m_pHelper->insertEntryToLRUList(pDesc);
- String aFuncName = pFuncPage->GetSelFunctionName();
- aFuncName.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "()" ));
+ OUString aFuncName = pFuncPage->GetSelFunctionName();
+ aFuncName += "()";
m_pHelper->setCurrentFormula(aFuncName);
pMEdit->ReplaceSelected(aFuncName);
@@ -1433,11 +1433,11 @@
aStr += aFtEditName.GetText();
aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "( " ) );
if( pParaWin->GetActiveLine() > 0 )
- aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "...; " ) );
+ aStr += "...; ";
aStr += pParaWin->GetActiveArgName();
if( pParaWin->GetActiveLine() + 1 < nArgs )
- aStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "; ..." ));
- aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " )" ) );
+ aStr += "; ...";
+ aStr += " )";
m_pParent->SetText( MnemonicGenerator::EraseAllMnemonicChars( aStr ) );
}
diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx
index 28a67b9..5bcbbf3 100644
--- a/framework/source/uielement/langselectionmenucontroller.cxx
+++ b/framework/source/uielement/langselectionmenucontroller.cxx
@@ -207,23 +207,23 @@
if ( pVCLPopupMenu )
pPopupMenu = (PopupMenu *)pVCLPopupMenu->GetMenu();
- String aCmd;
- String aCmd_Dialog;
- String aCmd_Language;
+ OUString aCmd;
+ OUString aCmd_Dialog;
+ OUString aCmd_Language;
if( eMode == MODE_SetLanguageSelectionMenu )
{
- aCmd_Dialog.AppendAscii(".uno:FontDialog?Language:string=*");
- aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Current_");
+ aCmd_Dialog += ".uno:FontDialog?Language:string=*";
+ aCmd_Language += ".uno:LanguageStatus?Language:string=Current_";
}
else if ( eMode == MODE_SetLanguageParagraphMenu )
{
- aCmd_Dialog.AppendAscii(".uno:FontDialogForParagraph");
- aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Paragraph_");
+ aCmd_Dialog += ".uno:FontDialogForParagraph";
+ aCmd_Language += ".uno:LanguageStatus?Language:string=Paragraph_";
}
else if ( eMode == MODE_SetLanguageAllTextMenu )
{
- aCmd_Dialog.AppendAscii(".uno:LanguageStatus?Language:string=*");
- aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Default_");
+ aCmd_Dialog += ".uno:LanguageStatus?Language:string=*";
+ aCmd_Language += ".uno:LanguageStatus?Language:string=Default_";
}
SvtLanguageTable aLanguageTable;
@@ -264,15 +264,13 @@
// entry for LANGUAGE_NONE
++nItemId;
pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_NONE )) );
- aCmd=aCmd_Language;
- aCmd.AppendAscii("LANGUAGE_NONE");
+ aCmd = aCmd_Language + "LANGUAGE_NONE";
pPopupMenu->SetItemCommand( nItemId, aCmd );
// entry for 'Reset to default language'
++nItemId;
pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_RESET_TO_DEFAULT_LANGUAGE )) );
- aCmd=aCmd_Language;
- aCmd.AppendAscii("RESET_LANGUAGES");
+ aCmd = aCmd_Language + "RESET_LANGUAGES";
pPopupMenu->SetItemCommand( nItemId, aCmd );
// entry for opening the Format/Character dialog
diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx
index d3ed550..dc5645c 100644
--- a/linguistic/source/misc2.cxx
+++ b/linguistic/source/misc2.cxx
@@ -73,12 +73,12 @@
uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
try
{
- String aInternal( rPathPrefix );
- String aUser( rPathPrefix );
- String aWriteable( rPathPrefix );
- aInternal .AppendAscii( "_internal" );
- aUser .AppendAscii( "_user" );
- aWriteable.AppendAscii( "_writable" );
+ OUString aInternal( rPathPrefix );
+ OUString aUser( rPathPrefix );
+ OUString aWriteable( rPathPrefix );
+ aInternal += "_internal";
+ aUser += "_user";
+ aWriteable+= "_writable";
uno::Reference< util::XPathSettings > xPathSettings =
util::PathSettings::create( xContext );
diff --git a/linguistic/workben/sspellimp.cxx b/linguistic/workben/sspellimp.cxx
index 4bbf3f3..160f1f4 100644
--- a/linguistic/workben/sspellimp.cxx
+++ b/linguistic/workben/sspellimp.cxx
@@ -450,9 +450,8 @@
{
try
{
- String aImpl( '/' );
- aImpl += SpellChecker::getImplementationName_Static().getStr();
- aImpl.AppendAscii( "/UNO/SERVICES" );
+ OUString aImpl( '/' );
+ aImpl += SpellChecker::getImplementationName_Static().getStr() + "/UNO/SERVICES";
Reference< registry::XRegistryKey > xNewKey =
pRegistryKey->createKey( aImpl );
Sequence< OUString > aServices =
diff --git a/lotuswordpro/source/filter/lwptblformula.cxx b/lotuswordpro/source/filter/lwptblformula.cxx
index a9988bc..7a5475b 100644
--- a/lotuswordpro/source/filter/lwptblformula.cxx
+++ b/lotuswordpro/source/filter/lwptblformula.cxx
@@ -485,12 +485,11 @@
*/
OUString LwpFormulaCellAddr::ToString(LwpTableLayout* pCellsMap)
{
- String aCellAddr;
- aCellAddr.AppendAscii("<");//<
-
+ OUString aCellAddr;
+ aCellAddr += "<";//<
aCellAddr += LwpFormulaTools::GetCellAddr(m_aRow,m_aCol,pCellsMap);
+ aCellAddr += ">";//>
- aCellAddr.AppendAscii(">");//>
return aCellAddr;
}
@@ -521,14 +520,13 @@
*/
OUString LwpFormulaCellRangeAddr::ToString(LwpTableLayout* pCellsMap)
{
- String aCellAddr;
- aCellAddr.AppendAscii("<");//<
+ OUString aCellAddr;
+ aCellAddr += "<"; //<
aCellAddr += LwpFormulaTools::GetCellAddr(m_aStartRow,m_aStartCol,pCellsMap);
- aCellAddr.AppendAscii(":");
+ aCellAddr += ":";
aCellAddr += LwpFormulaTools::GetCellAddr(m_aEndRow,m_aEndCol,pCellsMap);
-
- aCellAddr.AppendAscii(">");//>
+ aCellAddr += ">"; //>
return aCellAddr;
}
@@ -602,24 +600,22 @@
*/
OUString LwpFormulaFunc::ToString(LwpTableLayout* pCellsMap)
{
- String aFormula;
+ OUString aFormula;
- String aFuncName = LwpFormulaTools::GetName(m_nTokenType);
- aFormula += aFuncName;
- aFormula.AppendAscii(" ");//Append a blank space
+ OUString aFuncName = LwpFormulaTools::GetName(m_nTokenType);
+ aFormula += aFuncName + " "; //Append a blank space
//Append args
vector<LwpFormulaArg*>::iterator aItr;
for (aItr=m_aArgs.begin();aItr!=m_aArgs.end();++aItr)
{
- aFormula.Append( (*aItr)->ToArgString(pCellsMap) );
- aFormula.AppendAscii("|");//separator
+ aFormula += (*aItr)->ToArgString(pCellsMap) + "|"; //separator
}
//erase the last "|"
if (!m_aArgs.empty())
{
- aFormula.Erase(aFormula.Len()-1,1);
+ aFormula = aFormula.replaceAt(aFormula.getLength()-1,1,aFormula);
}
else
{
@@ -638,22 +634,18 @@
*/
OUString LwpFormulaOp::ToString(LwpTableLayout* pCellsMap)
{
- String aFormula;
+ OUString aFormula;
if (2==m_aArgs.size())
{
vector<LwpFormulaArg*>::iterator aItr = m_aArgs.end();
--aItr;
- aFormula.Append( (*aItr)->ToArgString(pCellsMap) );
- aFormula.AppendAscii(" ");
-
- String aFuncName = LwpFormulaTools::GetName(m_nTokenType);
- aFormula.Append(aFuncName);
-
- aFormula.AppendAscii(" ");
+ aFormula += (*aItr)->ToArgString(pCellsMap) + " ";
+ OUString aFuncName = LwpFormulaTools::GetName(m_nTokenType);
+ aFormula += aFuncName + " ";
--aItr;
- aFormula.Append( (*aItr)->ToArgString(pCellsMap) );
+ aFormula += (*aItr)->ToArgString(pCellsMap);
}
else
{
diff --git a/padmin/source/adddlg.cxx b/padmin/source/adddlg.cxx
index 4adb755..e5ef2fd 100644
--- a/padmin/source/adddlg.cxx
+++ b/padmin/source/adddlg.cxx
@@ -274,10 +274,10 @@
FindFiles( aPPDDir, aFiles, OUString( "PS;PPD;PS.GZ;PPD.GZ" ), true );
for( file = aFiles.begin(); file != aFiles.end(); ++file )
{
- String aFile( aPPDDir );
- if( aFile.GetChar( aFile.Len() ) != '/' )
- aFile.AppendAscii( "/" );
- aFile.Append( *file );
+ OUString aFile( aPPDDir );
+ if( aFile[ aFile.getLength() ] != '/' )
+ aFile += "/";
+ aFile += *file;
int nPos = file->SearchBackward( '.' );
if( file->Copy( 0, nPos ) == String( aPPD ) )
diff --git a/padmin/source/cmddlg.cxx b/padmin/source/cmddlg.cxx
index c9b21ed..966f793b 100644
--- a/padmin/source/cmddlg.cxx
+++ b/padmin/source/cmddlg.cxx
@@ -529,9 +529,8 @@
void RTSCommandPage::ConnectCommand()
{
- String aString( m_aConnectedTo.GetText().getToken( 0, ':' ) );
- aString.AppendAscii( ": " );
- aString += m_aCommandsCB.GetText();
+ OUString aString( m_aConnectedTo.GetText().getToken( 0, ':' ) );
+ aString += ": " + m_aCommandsCB.GetText();
m_aConnectedTo.SetText( aString );
}
diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx
index c6adfc9..f4c2387 100644
--- a/padmin/source/padialog.cxx
+++ b/padmin/source/padialog.cxx
@@ -254,10 +254,8 @@
if( !aDev.isEmpty() )
{
const PrinterInfo& rInfo = m_rPIManager.getPrinterInfo( aDev );
- String aDriver( rInfo.m_aPrinterName );
- aDriver.AppendAscii( " (" );
- aDriver += String( rInfo.m_aDriverName );
- aDriver.Append( ')' );
+ OUString aDriver( rInfo.m_aPrinterName );
+ aDriver += " (" + rInfo.m_aDriverName + ")";
m_aDriver.SetText( aDriver );
m_aCommand.SetText( rInfo.m_aCommand );
m_aComment.SetText( rInfo.m_aComment );
@@ -707,12 +705,10 @@
if( bAutoQueue )
continue;
- String aEntry( *it );
+ OUString aEntry( *it );
if( *it == m_rPIManager.getDefaultPrinter() )
{
- aEntry.AppendAscii( " (" );
- aEntry += m_aDefPrt;
- aEntry.AppendAscii( ")" );
+ aEntry += " (" + OUString( m_aDefPrt ) + ")";
}
int nPos =
m_aDevicesLB.InsertEntry( aEntry,
diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx
index 53d09ce..c8e2ac9 100644
--- a/padmin/source/prtsetup.cxx
+++ b/padmin/source/prtsetup.cxx
@@ -708,9 +708,8 @@
for( it = m_pParent->m_aJobData.m_aFontSubstitutes.begin();
it != m_pParent->m_aJobData.m_aFontSubstitutes.end(); ++it )
{
- String aEntry( it->first );
- aEntry.AppendAscii( " -> " );
- aEntry.Append( String( it->second ) );
+ OUString aEntry( it->first );
+ aEntry += " -> " + it->second;
m_aSubstitutionsBox.InsertEntry( aEntry );
}
}
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx
index 54ff5c2..d849d01 100644
--- a/reportdesign/source/ui/dlg/AddField.cxx
+++ b/reportdesign/source/ui/dlg/AddField.cxx
@@ -320,7 +320,7 @@
m_aActions.EnableItem(m_aActions.GetItemId(j),sal_False);
}
- String aTitle(ModuleRes(RID_STR_FIELDSELECTION));
+ OUString aTitle(ModuleRes(RID_STR_FIELDSELECTION));
SetText(aTitle);
if ( m_xRowSet.is() )
{
@@ -357,8 +357,7 @@
lcl_addToList( *m_pListBox, aParamNames );
// set title
- aTitle.AppendAscii(" ");
- aTitle += m_aCommandName.getStr();
+ aTitle += " " + OUString( m_aCommandName.getStr() );
SetText( aTitle );
if ( !m_aCommandName.isEmpty() )
{
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 99f14d6..5f7923c 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -241,7 +241,7 @@
Color aColBlack ( COL_BLACK );
Color aColGrey ( COL_LIGHTGRAY );
- String aStr;
+ OUString aStr;
xub_StrLen nStrLen;
String aHelpFile;//XXX JN welcher Text???
SfxItemSet* pSet = NULL;
@@ -388,9 +388,9 @@
// Fusszeile:
// [leer][Seite \SEITE\][leer]
//----------------------------------------
- aStr = SCSTR( STR_PAGE ); aStr += ' ';
+ aStr = SCSTR( STR_PAGE ) + " ";
pEdEngine->SetText( aStr );
- nStrLen = aStr.Len();
+ nStrLen = aStr.getLength();
pEdEngine->QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) );
pTxtObj = pEdEngine->CreateTextObject();
pFooterItem->SetLeftArea ( *pEmptyTxtObj );
@@ -437,7 +437,7 @@
// Kopfzeile:
// [\TABELLE\ (\DATEI\)][leer][\DATUM\, \ZEIT\]
//----------------------------------------
- aStr = OUString(" ()");
+ aStr = " ()";
pEdEngine->SetText( aStr );
pEdEngine->QuickInsertField( SvxFieldItem(SvxFileField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) );
pEdEngine->QuickInsertField( SvxFieldItem(SvxTableField(), EE_FEATURE_FIELD), ESelection() );
@@ -445,7 +445,7 @@
pHeaderItem->SetLeftArea( *pTxtObj );
pHeaderItem->SetCenterArea( *pEmptyTxtObj );
DELETEZ( pTxtObj );
- aStr = OUString(", ");
+ aStr = ", ";
pEdEngine->SetText( aStr );
pEdEngine->QuickInsertField( SvxFieldItem(SvxTimeField(), EE_FEATURE_FIELD), ESelection(0,2,0,2) );
pEdEngine->QuickInsertField( SvxFieldItem(SvxDateField(Date( Date::SYSTEM ),SVXDATETYPE_VAR), EE_FEATURE_FIELD),
@@ -459,10 +459,10 @@
// Fusszeile:
// [leer][Seite: \SEITE\ / \SEITEN\][leer]
//----------------------------------------
- aStr = SCSTR( STR_PAGE ); aStr += ' ';
- nStrLen = aStr.Len();
- aStr.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" / "));
- xub_StrLen nStrLen2 = aStr.Len();
+ aStr = SCSTR( STR_PAGE ) + " ";
+ nStrLen = aStr.getLength();
+ aStr += " / ";
+ xub_StrLen nStrLen2 = aStr.getLength();
pEdEngine->SetText( aStr );
pEdEngine->QuickInsertField( SvxFieldItem(SvxPagesField(), EE_FEATURE_FIELD), ESelection(0,nStrLen2,0,nStrLen2) );
pEdEngine->QuickInsertField( SvxFieldItem(SvxPageField(), EE_FEATURE_FIELD), ESelection(0,nStrLen,0,nStrLen) );
--
To view, visit https://gerrit.libreoffice.org/3892
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I12175a81f0a74546b5e00633176f204b9a3fb35c
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Ricardo Montania <ricardo at linuxafundo.com.br>
More information about the LibreOffice
mailing list