Kaydet (Commit) 80e5e65c authored tarafından Ricardo Montania's avatar Ricardo Montania Kaydeden (comit) Thomas Arnhold

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/5907Reviewed-by: 's avatarThomas Arnhold <thomas@arnhold.org>
Tested-by: 's avatarThomas Arnhold <thomas@arnhold.org>
üst 08163c1c
......@@ -3524,7 +3524,7 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
// TODO/MBA: how can we get a BaseURL here?!
OSL_FAIL("No BaseURL!");
OUString aAbs = INetURLObject::GetAbsURL( "", aRel );
DBG_ASSERT( aAbs.getLength(), "Invalid URL!" );
DBG_ASSERT( !aAbs.isEmpty(), "Invalid URL!" );
maStrLink = aAbs;
}
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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(
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment