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, ...@@ -3524,7 +3524,7 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
// TODO/MBA: how can we get a BaseURL here?! // TODO/MBA: how can we get a BaseURL here?!
OSL_FAIL("No BaseURL!"); OSL_FAIL("No BaseURL!");
OUString aAbs = INetURLObject::GetAbsURL( "", aRel ); OUString aAbs = INetURLObject::GetAbsURL( "", aRel );
DBG_ASSERT( aAbs.getLength(), "Invalid URL!" ); DBG_ASSERT( !aAbs.isEmpty(), "Invalid URL!" );
maStrLink = aAbs; maStrLink = aAbs;
} }
......
...@@ -124,10 +124,7 @@ OUString ScStyleNameConversion::DisplayToProgrammaticName( const OUString& rDisp ...@@ -124,10 +124,7 @@ OUString ScStyleNameConversion::DisplayToProgrammaticName( const OUString& rDisp
{ {
// add the (user) suffix if the display name matches any style's programmatic name // add the (user) suffix if the display name matches any style's programmatic name
// or if it already contains the suffix // or if it already contains the suffix
return rDispName + SC_SUFFIX_USER;
String aRet(rDispName);
aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SC_SUFFIX_USER ) );
return aRet;
} }
return rDispName; return rDispName;
......
...@@ -125,7 +125,6 @@ const sal_Char ScHTMLExport::sIndentSource[nIndentMax+1] = ...@@ -125,7 +125,6 @@ const sal_Char ScHTMLExport::sIndentSource[nIndentMax+1] =
<< GetIndentStr()) << GetIndentStr())
#define OUT_SP_CSTR_ASS( s ) rStrm << ' ' << s << '=' #define OUT_SP_CSTR_ASS( s ) rStrm << ' ' << s << '='
#define APPEND_SPACE( s ) s.AppendAscii(" ")
#define GLOBSTR(id) ScGlobal::GetRscString( id ) #define GLOBSTR(id) ScGlobal::GetRscString( id )
...@@ -163,7 +162,7 @@ static OString lcl_getColGroupString(sal_Int32 nSpan, sal_Int32 nWidth) ...@@ -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 ::com::sun::star::util::DateTime& rDateTime,
const LocaleDataWrapper& rLoc ) const LocaleDataWrapper& rLoc )
{ {
...@@ -172,33 +171,30 @@ static void lcl_AddStamp( String& rStr, const String& rName, ...@@ -172,33 +171,30 @@ static void lcl_AddStamp( String& rStr, const String& rName,
rDateTime.NanoSeconds); rDateTime.NanoSeconds);
DateTime aDateTime(aD,aT); DateTime aDateTime(aD,aT);
String aStrDate = rLoc.getDate( aDateTime ); OUString aStrDate = rLoc.getDate( aDateTime );
String aStrTime = rLoc.getTime( aDateTime ); OUString aStrTime = rLoc.getTime( aDateTime );
rStr += GLOBSTR( STR_BY ); rStr += GLOBSTR( STR_BY ) + " ";
APPEND_SPACE( rStr ); if (!rName.isEmpty())
if (rName.Len())
rStr += rName; rStr += rName;
else else
rStr.AppendAscii( "???" ); rStr += "???";
APPEND_SPACE( rStr ); rStr += " " + GLOBSTR( STR_ON ) + " ";
rStr += GLOBSTR( STR_ON ); if (!aStrDate.isEmpty())
APPEND_SPACE( rStr );
if (aStrDate.Len())
rStr += aStrDate; rStr += aStrDate;
else else
rStr.AppendAscii( "???" ); rStr += "???";
rStr.AppendAscii( ", " ); rStr += ", ";
if (aStrTime.Len()) if (!aStrTime.isEmpty())
rStr += aStrTime; rStr += aStrTime;
else else
rStr.AppendAscii( "???" ); rStr += "???";
} }
static OString lcl_makeHTMLColorTriplet(const Color& rColor) static OString lcl_makeHTMLColorTriplet(const Color& rColor)
{ {
OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("\"#")); OStringBuffer aStr( "\"#" );
// <font COLOR="#00FF40">hello</font> // <font COLOR="#00FF40">hello</font>
sal_Char buf[64]; sal_Char buf[64];
sal_Char* p = buf; sal_Char* p = buf;
...@@ -259,7 +255,7 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const String& rBaseURL, ScDocument ...@@ -259,7 +255,7 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const String& rBaseURL, ScDocument
if( pItem ) if( pItem )
{ {
aCId = ((const SfxStringItem *)pItem)->GetValue(); 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() ...@@ -356,8 +352,7 @@ void ScHTMLExport::WriteHeader()
if (!xDocProps->getPrintedBy().isEmpty()) if (!xDocProps->getPrintedBy().isEmpty())
{ {
OUT_COMMENT( GLOBSTR( STR_DOC_INFO ) ); OUT_COMMENT( GLOBSTR( STR_DOC_INFO ) );
String aStrOut( GLOBSTR( STR_DOC_PRINTED ) ); OUString aStrOut = ( GLOBSTR( STR_DOC_PRINTED ) ) + ": ";
aStrOut.AppendAscii( ": " );
lcl_AddStamp( aStrOut, xDocProps->getPrintedBy(), lcl_AddStamp( aStrOut, xDocProps->getPrintedBy(),
xDocProps->getPrintDate(), *ScGlobal::pLocaleData ); xDocProps->getPrintDate(), *ScGlobal::pLocaleData );
OUT_COMMENT( aStrOut ); OUT_COMMENT( aStrOut );
...@@ -567,7 +562,7 @@ void ScHTMLExport::WriteBody() ...@@ -567,7 +562,7 @@ void ScHTMLExport::WriteBody()
if ( bAll && GPOS_NONE != pBrushItem->GetGraphicPos() ) if ( bAll && GPOS_NONE != pBrushItem->GetGraphicPos() )
{ {
OUString aLink = pBrushItem->GetGraphicLink(); OUString aLink = pBrushItem->GetGraphicLink();
String aGrfNm; OUString aGrfNm;
// Embedded graphic -> write using WriteGraphic // Embedded graphic -> write using WriteGraphic
if( aLink.isEmpty() ) if( aLink.isEmpty() )
...@@ -577,10 +572,8 @@ void ScHTMLExport::WriteBody() ...@@ -577,10 +572,8 @@ void ScHTMLExport::WriteBody()
{ {
// Save graphic as (JPG) file // Save graphic as (JPG) file
aGrfNm = aStreamPath; aGrfNm = aStreamPath;
OUString aTmp(aGrfNm); sal_uInt16 nErr = XOutBitmap::WriteGraphic( *pGrf, aGrfNm,
sal_uInt16 nErr = XOutBitmap::WriteGraphic( *pGrf, aTmp, "JPG", XOUTBMP_USE_NATIVE_IF_POSSIBLE );
OUString("JPG"), XOUTBMP_USE_NATIVE_IF_POSSIBLE );
aGrfNm = aTmp;
if( !nErr ) // Contains errors, as we have nothing to output if( !nErr ) // Contains errors, as we have nothing to output
{ {
aGrfNm = URIHelper::SmartRel2Abs( aGrfNm = URIHelper::SmartRel2Abs(
...@@ -1251,8 +1244,8 @@ bool ScHTMLExport::WriteFieldText( const EditTextObject* pData ) ...@@ -1251,8 +1244,8 @@ bool ScHTMLExport::WriteFieldText( const EditTextObject* pData )
} }
sal_Bool ScHTMLExport::CopyLocalFileToINet( String& rFileNm, sal_Bool ScHTMLExport::CopyLocalFileToINet( OUString& rFileNm,
const String& rTargetNm, sal_Bool bFileToFile ) const OUString& rTargetNm, sal_Bool bFileToFile )
{ {
sal_Bool bRet = false; sal_Bool bRet = false;
INetURLObject aFileUrl, aTargetUrl; INetURLObject aFileUrl, aTargetUrl;
...@@ -1281,8 +1274,8 @@ sal_Bool ScHTMLExport::CopyLocalFileToINet( String& rFileNm, ...@@ -1281,8 +1274,8 @@ sal_Bool ScHTMLExport::CopyLocalFileToINet( String& rFileNm,
SvFileStream aTmp( aFileUrl.PathToFileName(), STREAM_READ ); SvFileStream aTmp( aFileUrl.PathToFileName(), STREAM_READ );
String aSrc = rFileNm; OUString aSrc = rFileNm;
String aDest = aTargetUrl.GetPartBeforeLastName(); OUString aDest = aTargetUrl.GetPartBeforeLastName();
aDest += String(aFileUrl.GetName()); aDest += String(aFileUrl.GetName());
if( bFileToFile ) if( bFileToFile )
...@@ -1321,23 +1314,19 @@ sal_Bool ScHTMLExport::CopyLocalFileToINet( String& rFileNm, ...@@ -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; return;
INetURLObject aURLObj( rURL ); INetURLObject aURLObj( rURL );
if( INET_PROT_FILE != aURLObj.GetProtocol() ) if( INET_PROT_FILE != aURLObj.GetProtocol() )
return; return;
String aLastName( aURLObj.GetLastName() ); OUString aLastName( aURLObj.GetLastName().toAsciiLowerCase() );
OSL_ENSURE( aLastName.Len(), "filename without length!" ); OSL_ENSURE( !aLastName.isEmpty(), "filename without length!" );
aLastName.ToLowerAscii();
rURL.AssignAscii( "cid:" ); rURL = "cid:" + aLastName + "." + aCId;
rURL += aLastName;
rURL.AppendAscii( "." );
rURL += aCId;
} }
......
...@@ -151,7 +151,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE ) ...@@ -151,7 +151,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
nXOutFlags |= XOUTBMP_MIRROR_HORZ; nXOutFlags |= XOUTBMP_MIRROR_HORZ;
if ( bVMirr ) if ( bVMirr )
nXOutFlags |= XOUTBMP_MIRROR_VERT; nXOutFlags |= XOUTBMP_MIRROR_VERT;
String aLinkName; OUString aLinkName;
if ( pSGO->IsLinkedGraphic() ) if ( pSGO->IsLinkedGraphic() )
aLinkName = pSGO->GetFileName(); aLinkName = pSGO->GetFileName();
WriteImage( aLinkName, pSGO->GetGraphic(), aOpt, nXOutFlags ); WriteImage( aLinkName, pSGO->GetGraphic(), aOpt, nXOutFlags );
...@@ -163,7 +163,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE ) ...@@ -163,7 +163,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pObject)->GetGraphic(); const Graphic* pGraphic = static_cast<SdrOle2Obj*>(pObject)->GetGraphic();
if ( pGraphic ) if ( pGraphic )
{ {
String aLinkName; OUString aLinkName;
WriteImage( aLinkName, *pGraphic, aOpt ); WriteImage( aLinkName, *pGraphic, aOpt );
pE->bWritten = sal_True; pE->bWritten = sal_True;
} }
...@@ -173,7 +173,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE ) ...@@ -173,7 +173,7 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE )
{ {
Graphic aGraph( SdrExchangeView::GetObjGraphic( Graphic aGraph( SdrExchangeView::GetObjGraphic(
pDoc->GetDrawLayer(), pObject ) ); pDoc->GetDrawLayer(), pObject ) );
String aLinkName; OUString aLinkName;
WriteImage( aLinkName, aGraph, aOpt ); WriteImage( aLinkName, aGraph, aOpt );
pE->bWritten = sal_True; pE->bWritten = sal_True;
} }
...@@ -181,19 +181,19 @@ void ScHTMLExport::WriteGraphEntry( ScHTMLGraphEntry* pE ) ...@@ -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 ) const OString& rImgOptions, sal_uLong nXOutFlags )
{ {
// Embedded graphic -> create an image file // Embedded graphic -> create an image file
if( !rLinkName.Len() ) if( rLinkName.isEmpty() )
{ {
if( aStreamPath.Len() > 0 ) if( !aStreamPath.isEmpty() )
{ {
// Save as a PNG // Save as a PNG
OUString aGrfNm( aStreamPath ); OUString aGrfNm( aStreamPath );
nXOutFlags |= XOUTBMP_USE_NATIVE_IF_POSSIBLE; nXOutFlags |= XOUTBMP_USE_NATIVE_IF_POSSIBLE;
sal_uInt16 nErr = XOutBitmap::WriteGraphic( rGrf, aGrfNm, sal_uInt16 nErr = XOutBitmap::WriteGraphic( rGrf, aGrfNm,
OUString( "PNG" ), nXOutFlags ); "PNG", nXOutFlags );
// If it worked, create a URL for the IMG tag // If it worked, create a URL for the IMG tag
if( !nErr ) if( !nErr )
...@@ -225,7 +225,7 @@ void ScHTMLExport::WriteImage( String& rLinkName, const Graphic& rGrf, ...@@ -225,7 +225,7 @@ void ScHTMLExport::WriteImage( String& rLinkName, const Graphic& rGrf,
// If a URL was set, output the IMG tag. // If a URL was set, output the IMG tag.
// <IMG SRC="..."[ rImgOptions]> // <IMG SRC="..."[ rImgOptions]>
if( rLinkName.Len() ) if( !rLinkName.isEmpty() )
{ {
rStrm << '<' << OOO_STRING_SVTOOLS_HTML_image << ' ' << OOO_STRING_SVTOOLS_HTML_O_src << "=\""; rStrm << '<' << OOO_STRING_SVTOOLS_HTML_image << ' ' << OOO_STRING_SVTOOLS_HTML_O_src << "=\"";
HTMLOutFuncs::Out_String( rStrm, URIHelper::simpleNormalizedMakeRelative( HTMLOutFuncs::Out_String( rStrm, URIHelper::simpleNormalizedMakeRelative(
......
...@@ -96,9 +96,9 @@ class ScHTMLExport : public ScExportBase ...@@ -96,9 +96,9 @@ class ScHTMLExport : public ScExportBase
boost::ptr_vector< ScHTMLGraphEntry > aGraphList; boost::ptr_vector< ScHTMLGraphEntry > aGraphList;
ScHTMLStyle aHTMLStyle; ScHTMLStyle aHTMLStyle;
String aBaseURL; OUString aBaseURL;
String aStreamPath; OUString aStreamPath;
String aCId; // Content-Id fuer Mail-Export OUString aCId; // Content-Id fuer Mail-Export
OutputDevice* pAppWin; // fuer Pixelei OutputDevice* pAppWin; // fuer Pixelei
boost::scoped_ptr< std::map<String, String> > pFileNameMap; // fuer CopyLocalFileToINet boost::scoped_ptr< std::map<String, String> > pFileNameMap; // fuer CopyLocalFileToINet
OUString aNonConvertibleChars; // collect nonconvertible characters OUString aNonConvertibleChars; // collect nonconvertible characters
...@@ -122,7 +122,7 @@ class ScHTMLExport : public ScExportBase ...@@ -122,7 +122,7 @@ class ScHTMLExport : public ScExportBase
void WriteTables(); void WriteTables();
void WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab ); void WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab );
void WriteGraphEntry( ScHTMLGraphEntry* ); void WriteGraphEntry( ScHTMLGraphEntry* );
void WriteImage( String& rLinkName, void WriteImage( OUString& rLinkName,
const Graphic&, const OString& rImgOptions, const Graphic&, const OString& rImgOptions,
sal_uLong nXOutFlags = 0 ); sal_uLong nXOutFlags = 0 );
// nXOutFlags fuer XOutBitmap::WriteGraphic // nXOutFlags fuer XOutBitmap::WriteGraphic
...@@ -131,10 +131,10 @@ class ScHTMLExport : public ScExportBase ...@@ -131,10 +131,10 @@ class ScHTMLExport : public ScExportBase
bool WriteFieldText( const EditTextObject* pData ); bool WriteFieldText( const EditTextObject* pData );
// kopiere ggfs. eine lokale Datei ins Internet // kopiere ggfs. eine lokale Datei ins Internet
sal_Bool CopyLocalFileToINet( String& rFileNm, sal_Bool CopyLocalFileToINet( OUString& rFileNm,
const String& rTargetNm, sal_Bool bFileToFile = false ); const OUString& rTargetNm, sal_Bool bFileToFile = false );
sal_Bool HasCId() { return aCId.Len() > 0; } sal_Bool HasCId() { return !aCId.isEmpty(); }
void MakeCIdURL( String& rURL ); void MakeCIdURL( OUString& rURL );
void PrepareGraphics( ScDrawLayer*, SCTAB nTab, void PrepareGraphics( ScDrawLayer*, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow, 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