summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorRicardo Montania <ricardo@linuxafundo.com.br>2013-09-10 23:03:56 +0000
committerThomas Arnhold <thomas@arnhold.org>2013-09-11 09:34:18 +0000
commit80e5e65c93a405f54089c59cf18e04486f9634b7 (patch)
treeaa88dc32b166b98b42452756f54267b0f2a6830f /sc
parent08163c1cb3039e42f093e6485f8321d6381446ec (diff)
String cleanup
Conflicts: cui/source/tabpages/backgrnd.cxx editeng/source/items/frmitems.cxx editeng/source/items/numitem.cxx include/editeng/brushitem.hxx include/svx/xoutbmp.hxx sc/source/filter/html/htmlexp.cxx sc/source/filter/html/htmlexp2.cxx svx/source/core/extedit.cxx svx/source/core/graphichelper.cxx svx/source/sidebar/nbdtmg.cxx sw/source/ui/shells/txtnum.cxx Change-Id: I1f548a01574a18e3f3a402ee491358fa36b349e7 Reviewed-on: https://gerrit.libreoffice.org/5907 Reviewed-by: Thomas Arnhold <thomas@arnhold.org> Tested-by: Thomas Arnhold <thomas@arnhold.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/stylehelper.cxx5
-rw-r--r--sc/source/filter/html/htmlexp.cxx65
-rw-r--r--sc/source/filter/html/htmlexp2.cxx16
-rw-r--r--sc/source/filter/inc/htmlexp.hxx16
4 files changed, 44 insertions, 58 deletions
diff --git a/sc/source/core/tool/stylehelper.cxx b/sc/source/core/tool/stylehelper.cxx
index a5e5b5bb194e..8cfd6798504b 100644
--- a/sc/source/core/tool/stylehelper.cxx
+++ b/sc/source/core/tool/stylehelper.cxx
@@ -124,10 +124,7 @@ OUString ScStyleNameConversion::DisplayToProgrammaticName( const OUString& rDisp
{
// add the (user) suffix if the display name matches any style's programmatic name
// or if it already contains the suffix
-
- String aRet(rDispName);
- aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SC_SUFFIX_USER ) );
- return aRet;
+ return rDispName + SC_SUFFIX_USER;
}
return rDispName;
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index e0a7185c6ec2..f5e2713d7d1a 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -125,7 +125,6 @@ const sal_Char ScHTMLExport::sIndentSource[nIndentMax+1] =
<< GetIndentStr())
#define OUT_SP_CSTR_ASS( s ) rStrm << ' ' << s << '='
-#define APPEND_SPACE( s ) s.AppendAscii(" ")
#define GLOBSTR(id) ScGlobal::GetRscString( id )
@@ -163,7 +162,7 @@ static OString lcl_getColGroupString(sal_Int32 nSpan, sal_Int32 nWidth)
}
-static void lcl_AddStamp( String& rStr, const String& rName,
+static void lcl_AddStamp( OUString& rStr, const OUString& rName,
const ::com::sun::star::util::DateTime& rDateTime,
const LocaleDataWrapper& rLoc )
{
@@ -172,33 +171,30 @@ static void lcl_AddStamp( String& rStr, const String& rName,
rDateTime.NanoSeconds);
DateTime aDateTime(aD,aT);
- String aStrDate = rLoc.getDate( aDateTime );
- String aStrTime = rLoc.getTime( aDateTime );
+ OUString aStrDate = rLoc.getDate( aDateTime );
+ OUString aStrTime = rLoc.getTime( aDateTime );
- rStr += GLOBSTR( STR_BY );
- APPEND_SPACE( rStr );
- if (rName.Len())
+ rStr += GLOBSTR( STR_BY ) + " ";
+ if (!rName.isEmpty())
rStr += rName;
else
- rStr.AppendAscii( "???" );
- APPEND_SPACE( rStr );
- rStr += GLOBSTR( STR_ON );
- APPEND_SPACE( rStr );
- if (aStrDate.Len())
+ rStr += "???";
+ rStr += " " + GLOBSTR( STR_ON ) + " ";
+ if (!aStrDate.isEmpty())
rStr += aStrDate;
else
- rStr.AppendAscii( "???" );
- rStr.AppendAscii( ", " );
- if (aStrTime.Len())
+ rStr += "???";
+ rStr += ", ";
+ if (!aStrTime.isEmpty())
rStr += aStrTime;
else
- rStr.AppendAscii( "???" );
+ rStr += "???";
}
static OString lcl_makeHTMLColorTriplet(const Color& rColor)
{
- OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("\"#"));
+ OStringBuffer aStr( "\"#" );
// <font COLOR="#00FF40">hello</font>
sal_Char buf[64];
sal_Char* p = buf;
@@ -259,7 +255,7 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const String& rBaseURL, ScDocument
if( pItem )
{
aCId = ((const SfxStringItem *)pItem)->GetValue();
- OSL_ENSURE( aCId.Len(), "CID without length!" );
+ OSL_ENSURE( !aCId.isEmpty(), "CID without length!" );
}
}
}
@@ -356,8 +352,7 @@ void ScHTMLExport::WriteHeader()
if (!xDocProps->getPrintedBy().isEmpty())
{
OUT_COMMENT( GLOBSTR( STR_DOC_INFO ) );
- String aStrOut( GLOBSTR( STR_DOC_PRINTED ) );
- aStrOut.AppendAscii( ": " );
+ OUString aStrOut = ( GLOBSTR( STR_DOC_PRINTED ) ) + ": ";
lcl_AddStamp( aStrOut, xDocProps->getPrintedBy(),
xDocProps->getPrintDate(), *ScGlobal::pLocaleData );
OUT_COMMENT( aStrOut );
@@ -567,7 +562,7 @@ void ScHTMLExport::WriteBody()
if ( bAll && GPOS_NONE != pBrushItem->GetGraphicPos() )
{
OUString aLink = pBrushItem->GetGraphicLink();
- String aGrfNm;
+ OUString aGrfNm;
// Embedded graphic -> write using WriteGraphic
if( aLink.isEmpty() )
@@ -577,10 +572,8 @@ void ScHTMLExport::WriteBody()
{
// Save graphic as (JPG) file
aGrfNm = aStreamPath;
- OUString aTmp(aGrfNm);
- sal_uInt16 nErr = XOutBitmap::WriteGraphic( *pGrf, aTmp,
- OUString("JPG"), XOUTBMP_USE_NATIVE_IF_POSSIBLE );
- aGrfNm = aTmp;
+ sal_uInt16 nErr = XOutBitmap::WriteGraphic( *pGrf, aGrfNm,
+ "JPG", XOUTBMP_USE_NATIVE_IF_POSSIBLE );
if( !nErr ) // Contains errors, as we have nothing to output
{
aGrfNm = URIHelper::SmartRel2Abs(
@@ -1251,8 +1244,8 @@ bool ScHTMLExport::WriteFieldText( const EditTextObject* pData )
}
-sal_Bool ScHTMLExport::CopyLocalFileToINet( String& rFileNm,
- const String& rTargetNm, sal_Bool bFileToFile )
+sal_Bool ScHTMLExport::CopyLocalFileToINet( OUString& rFileNm,
+ const OUString& rTargetNm, sal_Bool bFileToFile )
{
sal_Bool bRet = false;
INetURLObject aFileUrl, aTargetUrl;
@@ -1281,8 +1274,8 @@ sal_Bool ScHTMLExport::CopyLocalFileToINet( String& rFileNm,
SvFileStream aTmp( aFileUrl.PathToFileName(), STREAM_READ );
- String aSrc = rFileNm;
- String aDest = aTargetUrl.GetPartBeforeLastName();
+ OUString aSrc = rFileNm;
+ OUString aDest = aTargetUrl.GetPartBeforeLastName();
aDest += String(aFileUrl.GetName());
if( bFileToFile )
@@ -1321,23 +1314,19 @@ sal_Bool ScHTMLExport::CopyLocalFileToINet( String& rFileNm,
}
-void ScHTMLExport::MakeCIdURL( String& rURL )
+void ScHTMLExport::MakeCIdURL( OUString& rURL )
{
- if( !aCId.Len() )
+ if( aCId.isEmpty() )
return;
INetURLObject aURLObj( rURL );
if( INET_PROT_FILE != aURLObj.GetProtocol() )
return;
- String aLastName( aURLObj.GetLastName() );
- OSL_ENSURE( aLastName.Len(), "filename without length!" );
- aLastName.ToLowerAscii();
+ OUString aLastName( aURLObj.GetLastName().toAsciiLowerCase() );
+ OSL_ENSURE( !aLastName.isEmpty(), "filename without length!" );
- rURL.AssignAscii( "cid:" );
- rURL += aLastName;
- rURL.AppendAscii( "." );
- rURL += aCId;
+ rURL = "cid:" + aLastName + "." + aCId;
}
diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx
index 37edba56a813..a5bce9c71e09 100644
--- a/sc/source/filter/html/htmlexp2.cxx
+++ b/sc/source/filter/html/htmlexp2.cxx
@@ -151,7 +151,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
nXOutFlags |= XOUTBMP_MIRROR_HORZ;
if ( bVMirr )
nXOutFlags |= XOUTBMP_MIRROR_VERT;
- String aLinkName;
+ OUString aLinkName;
if ( pSGO->IsLinkedGraphic() )
aLinkName = pSGO->GetFileName();
WriteImage( aLinkName, pSGO->GetGraphic(), aOpt, nXOutFlags );
@@ -163,7 +163,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pObject)->GetGraphic();
if ( pGraphic )
{
- String aLinkName;
+ OUString aLinkName;
WriteImage( aLinkName, *pGraphic, aOpt );
pE->bWritten = sal_True;
}
@@ -173,7 +173,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
{
Graphic aGraph( SdrExchangeView::GetObjGraphic(
pDoc->GetDrawLayer(), pObject ) );
- String aLinkName;
+ OUString aLinkName;
WriteImage( aLinkName, aGraph, aOpt );
pE->bWritten = sal_True;
}
@@ -181,19 +181,19 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
}
-void ScHTMLExport::WriteImage( String& rLinkName, const Graphic& rGrf,
+void ScHTMLExport::WriteImage( OUString& rLinkName, const Graphic& rGrf,
const OString& rImgOptions, sal_uLong nXOutFlags )
{
// Embedded graphic -> create an image file
- if( !rLinkName.Len() )
+ if( rLinkName.isEmpty() )
{
- if( aStreamPath.Len() > 0 )
+ if( !aStreamPath.isEmpty() )
{
// Save as a PNG
OUString aGrfNm( aStreamPath );
nXOutFlags |= XOUTBMP_USE_NATIVE_IF_POSSIBLE;
sal_uInt16 nErr = XOutBitmap::WriteGraphic( rGrf, aGrfNm,
- OUString( "PNG" ), nXOutFlags );
+ "PNG", nXOutFlags );
// If it worked, create a URL for the IMG tag
if( !nErr )
@@ -225,7 +225,7 @@ void ScHTMLExport::WriteImage( String& rLinkName, const Graphic& rGrf,
// If a URL was set, output the IMG tag.
// <IMG SRC="..."[ rImgOptions]>
- if( rLinkName.Len() )
+ if( !rLinkName.isEmpty() )
{
rStrm << '<' << OOO_STRING_SVTOOLS_HTML_image << ' ' << OOO_STRING_SVTOOLS_HTML_O_src << "=\"";
HTMLOutFuncs::Out_String( rStrm, URIHelper::simpleNormalizedMakeRelative(
diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx
index c33651cf1ea7..9256b99fc06a 100644
--- a/sc/source/filter/inc/htmlexp.hxx
+++ b/sc/source/filter/inc/htmlexp.hxx
@@ -96,9 +96,9 @@ class ScHTMLExport : public ScExportBase
boost::ptr_vector< ScHTMLGraphEntry > aGraphList;
ScHTMLStyle aHTMLStyle;
- String aBaseURL;
- String aStreamPath;
- String aCId; // Content-Id fuer Mail-Export
+ OUString aBaseURL;
+ OUString aStreamPath;
+ OUString aCId; // Content-Id fuer Mail-Export
OutputDevice* pAppWin; // fuer Pixelei
boost::scoped_ptr< std::map<String, String> > pFileNameMap; // fuer CopyLocalFileToINet
OUString aNonConvertibleChars; // collect nonconvertible characters
@@ -122,7 +122,7 @@ class ScHTMLExport : public ScExportBase
void WriteTables();
void WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
void WriteGraphEntry( ScHTMLGraphEntry* );
- void WriteImage( String& rLinkName,
+ void WriteImage( OUString& rLinkName,
const Graphic&, const OString& rImgOptions,
sal_uLong nXOutFlags = 0 );
// nXOutFlags fuer XOutBitmap::WriteGraphic
@@ -131,10 +131,10 @@ class ScHTMLExport : public ScExportBase
bool WriteFieldText( const EditTextObject* pData );
// kopiere ggfs. eine lokale Datei ins Internet
- sal_Bool CopyLocalFileToINet( String& rFileNm,
- const String& rTargetNm, sal_Bool bFileToFile = false );
- sal_Bool HasCId() { return aCId.Len() > 0; }
- void MakeCIdURL( String& rURL );
+ sal_Bool CopyLocalFileToINet( OUString& rFileNm,
+ const OUString& rTargetNm, sal_Bool bFileToFile = false );
+ sal_Bool HasCId() { return !aCId.isEmpty(); }
+ void MakeCIdURL( OUString& rURL );
void PrepareGraphics( ScDrawLayer*, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow,