From 36ccfb710d5bd0608cf033917df6387245f4e9c6 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 29 Jul 2011 23:27:52 +0100 Subject: convert to rtl::OString[Buffer] and simplify --- sw/source/filter/html/htmlfldw.cxx | 50 ++++++++++++++++++------------ sw/source/filter/html/htmltabw.cxx | 62 +++++++++++++++++++++++--------------- 2 files changed, 69 insertions(+), 43 deletions(-) (limited to 'sw') diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 1d2def315b93..0a4638d5c1ff 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -45,6 +45,7 @@ #include "flddat.hxx" #include "htmlfld.hxx" #include "wrthtml.hxx" +#include using namespace nsSwDocInfoSubType; @@ -269,40 +270,51 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pFld, // -Tag ausgeben if( pTypeStr ) { - ByteString sOut( '<' ); - ((((sOut += OOO_STRING_SVTOOLS_HTML_sdfield) += ' ') += OOO_STRING_SVTOOLS_HTML_O_type) += '=') - += pTypeStr; + rtl::OStringBuffer sOut; + sOut.append('<'); + sOut.append(OOO_STRING_SVTOOLS_HTML_sdfield).append(' '). + append(OOO_STRING_SVTOOLS_HTML_O_type).append('='). + append(pTypeStr); if( pSubStr ) - (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_subtype) += '=') += pSubStr; + { + sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_subtype). + append('=').append(pSubStr); + } if( pFmtStr ) - (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_format) += '=') += pFmtStr; + { + sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_format). + append('=').append(pFmtStr); + } if( aName.Len() ) { - (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\""); - rWrt.Strm() << sOut.GetBuffer(); + sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_name). + append(RTL_CONSTASCII_STRINGPARAM("=\"")); + rWrt.Strm() << sOut.makeStringAndClear().getStr(); HTMLOutFuncs::Out_String( rWrt.Strm(), aName, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); - sOut = '\"'; + sOut.append('\"'); } if( aValue.Len() ) { - ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_value) += "=\""; - rWrt.Strm() << sOut.GetBuffer(); + sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_value). + append(RTL_CONSTASCII_STRINGPARAM("=\"")); + rWrt.Strm() << sOut.makeStringAndClear().getStr(); HTMLOutFuncs::Out_String( rWrt.Strm(), aValue, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); - sOut = '\"'; + sOut.append('\"'); } if( bNumFmt ) { OSL_ENSURE( nFmt, "Zahlenformat ist 0" ); - sOut = HTMLOutFuncs::CreateTableDataOptionsValNum( sOut, - bNumValue, dNumValue, nFmt, - *rHTMLWrt.pDoc->GetNumberFormatter(), - rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters ); - + sOut.append(HTMLOutFuncs::CreateTableDataOptionsValNum( + bNumValue, dNumValue, nFmt, + *rHTMLWrt.pDoc->GetNumberFormatter(), rHTMLWrt.eDestEnc, + &rHTMLWrt.aNonConvertableCharacters)); } if( bFixed ) - (sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_sdfixed; - sOut += '>'; - rWrt.Strm() << sOut.GetBuffer(); + { + sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_sdfixed); + } + sOut.append('>'); + rWrt.Strm() << sOut.makeStringAndClear().getStr(); } // Inhalt des Feldes ausgeben diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index 82628e810b8c..26689902c2bd 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -67,6 +67,7 @@ #include #include #endif +#include #include #define MAX_DEPTH (3) @@ -320,17 +321,21 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, } rWrt.OutNewLine(); // / in neue Zeile - ByteString sOut( '<' ); - sOut += (bHead ? OOO_STRING_SVTOOLS_HTML_tableheader : OOO_STRING_SVTOOLS_HTML_tabledata ); + rtl::OStringBuffer sOut; + sOut.append('<'); + sOut.append(bHead ? OOO_STRING_SVTOOLS_HTML_tableheader : OOO_STRING_SVTOOLS_HTML_tabledata); // ROW- und COLSPAN ausgeben if( nRowSpan>1 ) - (((sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_rowspan ) += '=') - += ByteString::CreateFromInt32( nRowSpan ); + { + sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_rowspan). + append('=').append(static_cast(nRowSpan)); + } if( nColSpan > 1 ) - (((sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_colspan ) += '=') - += ByteString::CreateFromInt32( nColSpan ); - + { + sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_colspan). + append('=').append(static_cast(nColSpan)); + } #ifndef PURE_HTML long nWidth = 0; sal_uInt32 nPrcWidth = USHRT_MAX; @@ -378,19 +383,24 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, // WIDTH ausgeben: Aus Layout oder berechnet if( bOutWidth ) { - ((sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_width ) += '='; + sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width). + append('='); if( nPrcWidth != USHRT_MAX ) - (sOut += ByteString::CreateFromInt32(nPrcWidth)) += '%'; + { + sOut.append(static_cast(nPrcWidth)).append('%'); + } else - sOut += ByteString::CreateFromInt32(aPixelSz.Width()); + { + sOut.append(static_cast(aPixelSz.Width())); + } if( !bLayoutExport && nColSpan==1 ) pCol->SetOutWidth( sal_False ); } if( nHeight ) { - (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_height) += '=') - += ByteString::CreateFromInt32(aPixelSz.Height()); + sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_height). + append('=').append(static_cast(aPixelSz.Height())); } #endif @@ -405,13 +415,14 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, sal_Int16 eVertOri = pCell->GetVertOri(); if( text::VertOrientation::TOP==eVertOri || text::VertOrientation::BOTTOM==eVertOri ) { - (((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_valign) += '=') - += (text::VertOrientation::TOP==eVertOri ? OOO_STRING_SVTOOLS_HTML_VA_top : OOO_STRING_SVTOOLS_HTML_VA_bottom); + sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_valign). + append('=').append(text::VertOrientation::TOP==eVertOri ? + OOO_STRING_SVTOOLS_HTML_VA_top : + OOO_STRING_SVTOOLS_HTML_VA_bottom); } } - rWrt.Strm() << sOut.GetBuffer(); - sOut.Erase(); + rWrt.Strm() << sOut.makeStringAndClear().getStr(); rWrt.bTxtAttr = sal_False; rWrt.bOutOpts = sal_True; @@ -433,10 +444,11 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, OutCSS1_TableBGStyleOpt( rWrt, *pBrushItem ); } - ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_style ) += "=\""; - rWrt.Strm() << sOut.GetBuffer( ); + sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_style). + append(RTL_CONSTASCII_STRINGPARAM("=\"")); + rWrt.Strm() << sOut.makeStringAndClear().getStr(); OutCSS1_SvxBox( rWrt, pBox->GetFrmFmt()->GetBox() ); - sOut = '"'; + sOut.append('"'); sal_uInt32 nNumFmt = 0; double nValue = 0.0; @@ -455,11 +467,13 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, } if( bNumFmt || bValue ) - sOut = HTMLOutFuncs::CreateTableDataOptionsValNum( sOut, - bValue, nValue, nNumFmt, *rWrt.pDoc->GetNumberFormatter(), - rWrt.eDestEnc, &rWrt.aNonConvertableCharacters ); - sOut += '>'; - rWrt.Strm() << sOut.GetBuffer(); + { + sOut.append(HTMLOutFuncs::CreateTableDataOptionsValNum(bValue, nValue, + nNumFmt, *rWrt.pDoc->GetNumberFormatter(), rWrt.eDestEnc, + &rWrt.aNonConvertableCharacters)); + } + sOut.append('>'); + rWrt.Strm() << sOut.makeStringAndClear().getStr(); rWrt.bLFPossible = sal_True; rWrt.IncIndentLevel(); // den Inhalt von ... einruecken -- cgit