sw/source/filter/html/css1atr.cxx | 24 ++++--- sw/source/filter/html/htmldrawwriter.cxx | 8 +- sw/source/filter/html/htmlfldw.cxx | 12 ++- sw/source/filter/html/htmlflywriter.cxx | 31 ++++++--- sw/source/filter/html/htmlftn.cxx | 24 +++++-- sw/source/filter/html/htmlplug.cxx | 26 +++++--- sw/source/filter/html/htmltabw.cxx | 18 +++-- sw/source/filter/html/wrthtml.cxx | 21 ++++-- sw/source/filter/ww8/rtfattributeoutput.cxx | 83 +++++++++++++++++++------- sw/source/filter/ww8/rtfexport.cxx | 5 - sw/source/filter/ww8/rtfsdrexport.cxx | 6 - sw/source/filter/ww8/rtfstringbuffer.cxx | 5 + sw/source/ui/dbui/createaddresslistdialog.cxx | 2 13 files changed, 179 insertions(+), 86 deletions(-)
New commits: commit c0fec0010213e4596b7d22e03b3bcd5fda9efb49 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed May 25 11:22:40 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Jul 23 09:59:26 2022 +0200 elide some makeStringAndClear() calls when we are passing the result to a string_view, it is pointless. Change-Id: If1a1edef1d450f57cdfd35fbc0dbce03898cc4ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134944 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 1520a4e0596a..cee719277383 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -314,7 +314,8 @@ void SwHTMLWriter::OutCSS1_Property( const char *pProp, "p." sCSS2_P_CLASS_leaders " span+span{float:right;padding-left:0.33em;" "background:white;position:relative;z-index:1}"); } - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); IncIndentLevel(); } @@ -359,7 +360,8 @@ void SwHTMLWriter::OutCSS1_Property( const char *pProp, if( m_nCSS1OutMode & CSS1_OUTMODE_ENCODE ) { // for STYLE-Option encode string - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); if( !sVal.empty() ) HTMLOutFuncs::Out_String( Strm(), OUString::createFromAscii(sVal) ); else if( pSVal ) @@ -375,7 +377,7 @@ void SwHTMLWriter::OutCSS1_Property( const char *pProp, } if (!sOut.isEmpty()) - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); } static void AddUnitPropertyValue(OStringBuffer &rOut, tools::Long nVal, @@ -460,7 +462,7 @@ void SwHTMLWriter::OutCSS1_UnitProperty( const char *pProp, tools::Long nVal ) { OStringBuffer sOut; AddUnitPropertyValue(sOut, nVal, m_eCSS1Unit); - OutCSS1_PropertyAscii(pProp, sOut.makeStringAndClear()); + OutCSS1_PropertyAscii(pProp, sOut); } void SwHTMLWriter::OutCSS1_PixelProperty( const char *pProp, tools::Long nVal, @@ -1667,7 +1669,7 @@ static Writer& OutCSS1_SwPageDesc( Writer& rWrt, const SwPageDesc& rPageDesc, AddUnitPropertyValue(sVal, rSz.Width(), rHTMLWrt.GetCSS1Unit()); sVal.append(' '); AddUnitPropertyValue(sVal, rSz.Height(), rHTMLWrt.GetCSS1Unit()); - rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_size, sVal.makeStringAndClear()); + rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_size, sVal); } // Export the distance-Attributes as normally @@ -2332,7 +2334,7 @@ static Writer& OutCSS1_SvxTextLn_SvxCrOut_SvxBlink( Writer& rWrt, } if (!sOut.isEmpty()) - rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_text_decoration, sOut.makeStringAndClear() ); + rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_text_decoration, sOut ); else if( bNone ) rHTMLWrt.OutCSS1_PropertyAscii( sCSS1_P_text_decoration, sCSS1_PV_none ); @@ -2514,8 +2516,8 @@ static Writer& OutCSS1_SvxKerning( Writer& rWrt, const SfxPoolItem& rHt ) sOut.append(OString::number(nValue / 10) + "." + OString::number(nValue % 10) + sCSS1_UNIT_pt); - rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_letter_spacing, - sOut.makeStringAndClear()); + rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_letter_spacing, sOut); + sOut.setLength(0); } else { @@ -3308,7 +3310,7 @@ static void OutCSS1_SvxBorderLine( SwHTMLWriter& rHTMLWrt, // and also the color sOut.append(GetCSS1_Color(pLine->GetColor())); - rHTMLWrt.OutCSS1_PropertyAscii(pProperty, sOut.makeStringAndClear()); + rHTMLWrt.OutCSS1_PropertyAscii(pProperty, sOut); } Writer& OutCSS1_SvxBox( Writer& rWrt, const SfxPoolItem& rHt ) @@ -3371,7 +3373,7 @@ Writer& OutCSS1_SvxBox( Writer& rWrt, const SfxPoolItem& rHt ) sVal.append(' '); AddUnitPropertyValue(sVal, nLeftDist, rHTMLWrt.GetCSS1Unit()); } - rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_padding, sVal.makeStringAndClear()); + rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_padding, sVal); } else { @@ -3639,7 +3641,7 @@ void SwHTMLWriter::OutCSS1_SfxItemSet( const SfxItemSet& rItemSet, break; } if (!sOut.isEmpty()) - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); } Writer& OutCSS1_HintSpanTag( Writer& rWrt, const SfxPoolItem& rHt ) diff --git a/sw/source/filter/html/htmldrawwriter.cxx b/sw/source/filter/html/htmldrawwriter.cxx index 6f8fce4a9de1..41f25cdd446f 100644 --- a/sw/source/filter/html/htmldrawwriter.cxx +++ b/sw/source/filter/html/htmldrawwriter.cxx @@ -249,12 +249,16 @@ Writer& OutHTML_DrawFrameFormatAsMarquee( Writer& rWrt, rItemSet.Get(XATTR_FILLCOLOR).GetColorValue(); sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_bgcolor "="); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_Color( rWrt.Strm(), rFillColor ); } if (!sOut.isEmpty()) - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + { + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); + } // and now ALIGN, HSPACE and VSPACE HtmlFrmOpts nFrameFlags = HTML_FRMOPTS_MARQUEE; diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 222ac3e96589..4454eb73b0a5 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -286,14 +286,16 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, if( !aName.isEmpty() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_name "=\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), aName ); sOut.append('\"'); } if( !aValue.isEmpty() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_value "=\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), aValue ); sOut.append('\"'); } @@ -309,7 +311,8 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_sdfixed); } sOut.append('>'); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); } // output content of the field @@ -560,7 +563,8 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) Color& rColor = SwViewOption::GetFieldShadingsColor(); sOut.append(GetCSS1_Color(rColor)); sOut.append("\">"); - rWrt.Strm().WriteOString(sOut.makeStringAndClear()); + rWrt.Strm().WriteOString(sOut); + sOut.setLength(0); } OutHTML_SwField( rWrt, pField, pTextField->GetTextNode(), diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 00d6db3dc16f..35525b5d93d5 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -432,7 +432,8 @@ void SwHTMLWriter::OutFrameFormat( AllHtmlFlags nMode, const SwFrameFormat& rFra sOut.append("<" + GetNamespace() + aContainerStr + " " OOO_STRING_SVTOOLS_HTML_O_class "=\"" "sd-abs-pos\""); - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); // Output a width for non-draw objects HtmlFrmOpts nFrameFlags = HTML_FRMOPTS_CNTNR; @@ -525,7 +526,8 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, const char *pStr = (nFrameOpts & HtmlFrmOpts::Id) ? OOO_STRING_SVTOOLS_HTML_O_id : OOO_STRING_SVTOOLS_HTML_O_name; sOut.append(OString::Concat(" ") + pStr + "=\""); - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( Strm(), rFrameFormat.GetName() ); sOut.append('\"'); } @@ -534,7 +536,8 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, if( nFrameOpts & HtmlFrmOpts::Dir ) { SvxFrameDirection nDir = GetHTMLDirection( rItemSet ); - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); OutDirection( nDir ); } @@ -542,7 +545,8 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, if( (nFrameOpts & HtmlFrmOpts::Alt) && !rAlternateText.isEmpty() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_alt "=\""); - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( Strm(), rAlternateText ); sOut.append('\"'); } @@ -720,7 +724,10 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, } if (!sOut.isEmpty()) - Strm().WriteOString( sOut.makeStringAndClear() ); + { + Strm().WriteOString( sOut ); + sOut.setLength(0); + } // Insert wrap for graphics that are anchored to a paragraph as // <BR CLEAR=...> in the string @@ -1530,14 +1537,16 @@ Writer& OutHTML_BulletImage( Writer& rWrt, if(!aLink.isEmpty()) { sOut.append(OOO_STRING_SVTOOLS_HTML_O_src "=\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), aLink ); } else { sOut.append("list-style-image: url(" OOO_STRING_SVTOOLS_HTML_O_data ":"); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), aGraphicInBase64 ); sOut.append(");"); } @@ -1545,7 +1554,7 @@ Writer& OutHTML_BulletImage( Writer& rWrt, if (pTag) sOut.append('>'); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); return rWrt; } @@ -1640,7 +1649,8 @@ static Writer & OutHTML_FrameFormatAsMulticol( Writer& rWrt, "=\"" + OString::number(nGutter) + "\""); } - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); // WIDTH HtmlFrmOpts nFrameFlags = HTML_FRMOPTS_MULTICOL; @@ -1727,7 +1737,8 @@ static Writer& OutHTML_FrameFormatAsDivOrSpan( Writer& rWrt, OStringBuffer sOut; sOut.append('<').append(rHTMLWrt.GetNamespace() + aTag); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HtmlFrmOpts nFrameFlags = HTML_FRMOPTS_DIV; if( rHTMLWrt.IsHTMLMode( HTMLMODE_BORDER_NONE ) ) nFrameFlags |= HtmlFrmOpts::SNoBorder; diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx index e0e442de81ac..957a4d45e966 100644 --- a/sw/source/filter/html/htmlftn.cxx +++ b/sw/source/filter/html/htmlftn.cxx @@ -304,20 +304,24 @@ Writer& OutHTML_SwFormatFootnote( Writer& rWrt, const SfxPoolItem& rHt ) OStringBuffer sOut; OString aTag = rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor; sOut.append("<" + aTag + " " OOO_STRING_SVTOOLS_HTML_O_class "=\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), sClass ); sOut.append("\" " OOO_STRING_SVTOOLS_HTML_O_name "=\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), sFootnoteName ); sOut.append(OOO_STRING_SVTOOLS_HTML_FTN_anchor "\" " OOO_STRING_SVTOOLS_HTML_O_href "=\"#"); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), sFootnoteName ); sOut.append(OOO_STRING_SVTOOLS_HTML_FTN_symbol "\""); if( !rFormatFootnote.GetNumStr().isEmpty() ) sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_sdfixed); sOut.append(">"); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_superscript )); HTMLOutFuncs::Out_String( rWrt.Strm(), rFormatFootnote.GetViewNumStr(*rWrt.m_pDoc, nullptr) ); @@ -466,17 +470,21 @@ void SwHTMLWriter::OutFootEndNoteSym( const SwFormatFootnote& rFormatFootnote, OStringBuffer sOut; sOut.append("<" + GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor " " OOO_STRING_SVTOOLS_HTML_O_class "=\""); - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( Strm(), sClass ); sOut.append("\" " OOO_STRING_SVTOOLS_HTML_O_name "=\""); - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( Strm(), sFootnoteName ); sOut.append(OOO_STRING_SVTOOLS_HTML_FTN_symbol "\" " OOO_STRING_SVTOOLS_HTML_O_href "=\"#"); - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( Strm(), sFootnoteName ); sOut.append(OOO_STRING_SVTOOLS_HTML_FTN_anchor "\">"); - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( Strm(), rNum ); HTMLOutFuncs::Out_AsciiTag( Strm(), OStringConcatenation(GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor), false ); diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index c6a939646f3a..5c119d4a7234 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1252,7 +1252,8 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor if( !aURL.isEmpty() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_src "=\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), aURL ); sOut.append('\"'); } @@ -1262,7 +1263,8 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor if( (aAny >>= aType) && !aType.isEmpty() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_type "=\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), aType ); sOut.append('\"'); } @@ -1296,7 +1298,8 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor if( !sCodeBase.isEmpty() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_codebase "=\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), sCodeBase ); sOut.append('\"'); } @@ -1307,7 +1310,8 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor aAny = xSet->getPropertyValue("AppletCode"); aAny >>= aClass; sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_code "=\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), aClass ); sOut.append('\"'); @@ -1318,7 +1322,8 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor if( !aAppletName.isEmpty() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_name "=\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), aAppletName ); sOut.append('\"'); } @@ -1337,7 +1342,8 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor // or the Floating-Frame specifics sOut.append(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_iframe); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); SfxFrameHTMLWriter::Out_FrameDescriptor( rWrt.Strm(), rWrt.GetBaseURL(), xSet ); @@ -1346,7 +1352,8 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor : HTML_FRMOPTS_IFRAME; } - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); // ALT, WIDTH, HEIGHT, HSPACE, VSPACE, ALIGN if( rHTMLWrt.IsHTMLMode( HTMLMODE_ABS_POS_FLY ) && !bHiddenEmbed ) @@ -1402,10 +1409,11 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor sBuf.append("<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_param " " OOO_STRING_SVTOOLS_HTML_O_name "=\""); - rWrt.Strm().WriteOString( sBuf.makeStringAndClear() ); + rWrt.Strm().WriteOString( sBuf ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rWrt.Strm(), rName ); sBuf.append("\" " OOO_STRING_SVTOOLS_HTML_O_value "=\""); - rWrt.Strm().WriteOString( sBuf.makeStringAndClear() ); + rWrt.Strm().WriteOString( sBuf ); HTMLOutFuncs::Out_String( rWrt.Strm(), rValue ).WriteCharPtr( "\">" ); } diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index 6849cbb3244a..ba7d84ff55b5 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -409,7 +409,8 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, } } - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); rWrt.m_bTextAttr = false; rWrt.m_bOutOpts = true; @@ -455,7 +456,8 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, nNumFormat, *rWrt.m_pDoc->GetNumberFormatter())); } sOut.append('>'); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); rWrt.m_bLFPossible = true; rWrt.IncIndentLevel(); // indent the content of <TD>...</TD> @@ -546,7 +548,8 @@ void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt, sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_valign "=\"").append(text::VertOrientation::TOP==eRowVertOri ? OOO_STRING_SVTOOLS_HTML_VA_top : OOO_STRING_SVTOOLS_HTML_VA_bottom) .append("\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); } rWrt.Strm().WriteChar( '>' ); @@ -620,7 +623,8 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, rWrt.m_nDirection = rWrt.GetHTMLDirection( pFrameFormat->GetAttrSet() ); if( rWrt.m_bOutFlyFrame || nOldDirection != rWrt.m_nDirection ) { - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); rWrt.OutDirection( rWrt.m_nDirection ); } @@ -695,7 +699,8 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_cellspacing "=\"" + OString::number(SwHTMLWriter::ToPixel(m_nCellSpacing,false)) + "\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); // output background if( pFrameFormat ) @@ -712,7 +717,8 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, } sOut.append('>'); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); rWrt.IncIndentLevel(); // indent content of table diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 0cede88912d3..a438503f367e 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -706,7 +706,8 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, if( !rName.isEmpty() && !bContinued ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_id "=\""); - rHTMLWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rHTMLWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), rName ); sOut.append('\"'); } @@ -721,7 +722,8 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, if( SectionType::FileLink == rSection.GetType() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_href "=\""); - rHTMLWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rHTMLWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); const OUString& aFName = rSection.GetLinkFileName(); sal_Int32 nIdx{ 0 }; @@ -774,7 +776,8 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, } } - rHTMLWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + rHTMLWrt.Strm().WriteOString( sOut ); + sOut.setLength(0); if( rHTMLWrt.IsHTMLMode( rHTMLWrt.m_bCfgOutStyles ? HTMLMODE_ON : 0 ) ) rHTMLWrt.OutCSS1_SectionFormatOptions( rFormat, pCol ); @@ -1147,7 +1150,8 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs ) // the body won't be indented, because then everything would be indented! OutNewLine(); sOut.append("<" + GetNamespace() + OOO_STRING_SVTOOLS_HTML_body); - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); // language OutLanguage( m_eLang ); @@ -1198,7 +1202,8 @@ void SwHTMLWriter::OutAnchor( const OUString& rName ) if (!mbXHTML) { sOut.append(OOO_STRING_SVTOOLS_HTML_O_name "=\""); - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( Strm(), rName ).WriteCharPtr( "\">" ); } else @@ -1206,7 +1211,8 @@ void SwHTMLWriter::OutAnchor( const OUString& rName ) // XHTML wants 'id' instead of 'name', also the value can't contain // spaces. sOut.append(OOO_STRING_SVTOOLS_HTML_O_id "=\""); - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( Strm(), rName.replace(' ', '_') ).WriteCharPtr( "\">" ); } HTMLOutFuncs::Out_AsciiTag( Strm(), OStringConcatenation(GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor), false ); @@ -1428,7 +1434,8 @@ void SwHTMLWriter::OutLanguage( LanguageType nLang ) else sOut.append(OOO_STRING_SVTOOLS_HTML_O_lang); sOut.append("=\""); - Strm().WriteOString( sOut.makeStringAndClear() ); + Strm().WriteOString( sOut ); + sOut.setLength(0); HTMLOutFuncs::Out_String( Strm(), LanguageTag::convertToBcp47(nLang) ).WriteChar( '"' ); } diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 9d634e73af7a..a8597cb13d40 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -288,7 +288,8 @@ void RtfAttributeOutput::EndParagraph(ww8::WW8TableNodeInfoInner::Pointer_t pTex RtfStringBuffer aParagraph; aParagraph.appendAndClear(m_aRun); - aParagraph->append(m_aAfterRuns.makeStringAndClear()); + aParagraph->append(m_aAfterRuns); + m_aAfterRuns.setLength(0); if (m_bTableAfterCell) m_bTableAfterCell = false; else @@ -329,12 +330,16 @@ void RtfAttributeOutput::SectionBreaks(const SwNode& rNode) OSL_ENSURE(m_aStyles.getLength() == 0, "m_aStyles is not empty"); // output page/section breaks - m_rExport.Strm().WriteOString(m_aSectionBreaks.makeStringAndClear()); + m_rExport.Strm().WriteOString(m_aSectionBreaks); + m_aSectionBreaks.setLength(0); m_bBufferSectionBreaks = true; // output section headers / footers if (!m_bBufferSectionHeaders) - m_rExport.Strm().WriteOString(m_aSectionHeaders.makeStringAndClear()); + { + m_rExport.Strm().WriteOString(m_aSectionHeaders); + m_aSectionHeaders.setLength(0); + } if (aNextIndex.GetNode().IsTextNode()) { @@ -374,7 +379,7 @@ void RtfAttributeOutput::StartParagraphProperties() aPar.append(' '); } if (!m_bBufferSectionHeaders) - m_rExport.Strm().WriteOString(aPar.makeStringAndClear()); + m_rExport.Strm().WriteOString(aPar); else m_aSectionHeaders.append(aPar); } @@ -1014,8 +1019,10 @@ void RtfAttributeOutput::StartTableRow( return; // Empty the previous row closing buffer before starting the new one, // necessary for subtables. - m_rExport.Strm().WriteOString(m_aAfterRuns.makeStringAndClear()); - m_rExport.Strm().WriteOString(m_aRowDefs.makeStringAndClear()); + m_rExport.Strm().WriteOString(m_aAfterRuns); + m_aAfterRuns.setLength(0); + m_rExport.Strm().WriteOString(m_aRowDefs); + m_aRowDefs.setLength(0); } void RtfAttributeOutput::StartTableCell() { m_bTableCellOpen = true; } @@ -1063,7 +1070,10 @@ void RtfAttributeOutput::EndTableRow() m_aAfterRuns.append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_NESTTABLEPROPRS); if (!m_aRowDefs.isEmpty()) - m_aAfterRuns.append(m_aRowDefs.makeStringAndClear()); + { + m_aAfterRuns.append(m_aRowDefs); + m_aRowDefs.setLength(0); + } else if (!m_aTables.empty()) { m_aAfterRuns.append(m_aTables.back()); @@ -1141,7 +1151,8 @@ void RtfAttributeOutput::StartStyles() void RtfAttributeOutput::EndStyles(sal_uInt16 /*nNumberOfStyles*/) { m_rExport.Strm().WriteChar('}'); - m_rExport.Strm().WriteOString(m_aStylesheet.makeStringAndClear()); + m_rExport.Strm().WriteOString(m_aStylesheet); + m_aStylesheet.setLength(0); m_rExport.Strm().WriteChar('}'); } @@ -1236,7 +1247,10 @@ void RtfAttributeOutput::StartSection() m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_SECT OOO_STRING_SVTOOLS_RTF_SECTD); if (!m_bBufferSectionBreaks) - m_rExport.Strm().WriteOString(m_aSectionBreaks.makeStringAndClear()); + { + m_rExport.Strm().WriteOString(m_aSectionBreaks); + m_aSectionBreaks.setLength(0); + } } void RtfAttributeOutput::EndSection() @@ -1380,7 +1394,10 @@ void RtfAttributeOutput::SectionType(sal_uInt8 nBreakCode) } m_aSectionBreaks.append(sType); if (!m_bBufferSectionBreaks) - m_rExport.Strm().WriteOString(m_aSectionBreaks.makeStringAndClear()); + { + m_rExport.Strm().WriteOString(m_aSectionBreaks); + m_aSectionBreaks.setLength(0); + } } void RtfAttributeOutput::SectFootnoteEndnotePr() @@ -1450,7 +1467,8 @@ void RtfAttributeOutput::WriteFootnoteEndnotePr(bool bFootnote, const SwEndNoteI if (!m_bBufferSectionBreaks) { - m_rExport.Strm().WriteOString(m_aSectionBreaks.makeStringAndClear()); + m_rExport.Strm().WriteOString(m_aSectionBreaks); + m_aSectionBreaks.setLength(0); } } @@ -2055,7 +2073,8 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi } m_rExport.Strm().WriteOString(m_aRunText.makeStringAndClear()); - m_rExport.Strm().WriteOString(m_aStyles.makeStringAndClear()); + m_rExport.Strm().WriteOString(m_aStyles); + m_aStyles.setLength(0); m_rExport.m_bOutFlyFrameAttrs = false; m_rExport.SetRTFFlySyntax(false); m_pFlyFrameSize = nullptr; @@ -2901,7 +2920,8 @@ void RtfAttributeOutput::TextFootnote_Impl(const SwFormatFootnote& rFootnote) m_bInRun = bInRunOrig; m_bSingleEmptyRun = bSingleEmptyRunOrig; m_aRun = aRun; - m_aRun->append(m_aSectionHeaders.makeStringAndClear()); + m_aRun->append(m_aSectionHeaders); + m_aSectionHeaders.setLength(0); m_aRun->append("}"); m_aRun->append("}"); @@ -3161,7 +3181,10 @@ void RtfAttributeOutput::FormatFrameSize(const SwFormatFrameSize& rSize) m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_PGHSXN); m_aSectionBreaks.append(static_cast<sal_Int32>(rSize.GetHeight())); if (!m_bBufferSectionBreaks) - m_rExport.Strm().WriteOString(m_aSectionBreaks.makeStringAndClear()); + { + m_rExport.Strm().WriteOString(m_aSectionBreaks); + m_aSectionBreaks.setLength(0); + } } } @@ -3206,7 +3229,10 @@ void RtfAttributeOutput::FormatLRSpace(const SvxLRSpaceItem& rLRSpace) m_aSectionBreaks.append(static_cast<sal_Int32>(rLRSpace.GetGutterMargin())); } if (!m_bBufferSectionBreaks) - m_rExport.Strm().WriteOString(m_aSectionBreaks.makeStringAndClear()); + { + m_rExport.Strm().WriteOString(m_aSectionBreaks); + m_aSectionBreaks.setLength(0); + } } else { @@ -3277,7 +3303,10 @@ void RtfAttributeOutput::FormatULSpace(const SvxULSpaceItem& rULSpace) m_aSectionBreaks.append(static_cast<sal_Int32>(aDistances.m_DyaHdrBottom)); } if (!m_bBufferSectionBreaks) - m_rExport.Strm().WriteOString(m_aSectionBreaks.makeStringAndClear()); + { + m_rExport.Strm().WriteOString(m_aSectionBreaks); + m_aSectionBreaks.setLength(0); + } } else { @@ -3653,7 +3682,10 @@ void RtfAttributeOutput::FormatBox(const SvxBoxItem& rBox) } if (!m_bBufferSectionBreaks) - m_aStyles.append(m_aSectionBreaks.makeStringAndClear()); + { + m_aStyles.append(m_aSectionBreaks); + m_aSectionBreaks.setLength(0); + } } void RtfAttributeOutput::FormatColumns_Impl(sal_uInt16 nCols, const SwFormatCol& rCol, bool bEven, @@ -3720,7 +3752,10 @@ void RtfAttributeOutput::FormatFrameDirection(const SvxFrameDirectionItem& rDire m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_STEXTFLOW); m_aSectionBreaks.append(static_cast<sal_Int32>(1)); if (!m_bBufferSectionBreaks) - m_rExport.Strm().WriteOString(m_aSectionBreaks.makeStringAndClear()); + { + m_rExport.Strm().WriteOString(m_aSectionBreaks); + m_aSectionBreaks.setLength(0); + } } return; } @@ -4074,14 +4109,20 @@ static OString ExportPICT(const SwFlyFrameFormat* pFlyFrameFormat, const Size& r } aRet.append(SAL_NEWLINE_STRING); if (pStream) - pStream->WriteOString(aRet.makeStringAndClear()); + { + pStream->WriteOString(aRet); + aRet.setLength(0); + } if (pStream) msfilter::rtfutil::WriteHex(pGraphicAry, nSize, pStream); else aRet.append(msfilter::rtfutil::WriteHex(pGraphicAry, nSize)); aRet.append('}'); if (pStream) - pStream->WriteOString(aRet.makeStringAndClear()); + { + pStream->WriteOString(aRet); + aRet.setLength(0); + } } return aRet.makeStringAndClear(); } @@ -4313,7 +4354,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat + OString::number(aPoly[i].Y()) + ")"); aFlyProperties.push_back(std::make_pair<OString, OString>( "pWrapPolygonVertices", - "8;" + OString::number(aPoly.GetSize()) + aVerticies.makeStringAndClear())); + "8;" + OString::number(aPoly.GetSize()) + aVerticies)); } } } diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index e3a05b346bda..421ae20061ad 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -701,9 +701,8 @@ ErrCode RtfExport::ExportDocument_Impl() WriteInfo(); WriteUserProps(); // Default TabSize - Strm() - .WriteOString(m_pAttrOutput->GetTabStop().makeStringAndClear()) - .WriteCharPtr(SAL_NEWLINE_STRING); + Strm().WriteOString(m_pAttrOutput->GetTabStop()).WriteCharPtr(SAL_NEWLINE_STRING); + m_pAttrOutput->GetTabStop().setLength(0); // Automatic hyphenation: it's a global setting in Word, it's a paragraph setting in Writer. // Set it's value to "auto" and disable on paragraph level, if no hyphenation is used there. diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx index 5f420ce0f089..1a05356ce37c 100644 --- a/sw/source/filter/ww8/rtfsdrexport.cxx +++ b/sw/source/filter/ww8/rtfsdrexport.cxx @@ -369,8 +369,7 @@ void RtfSdrExport::Commit(EscherPropertyContainer& rProps, const tools::Rectangl { // We know the number of vertices at the end only, so we have to prepend them here. m_aShapeProps.insert(std::pair<OString, OString>( - "pVerticies", - "8;" + OString::number(nVertices) + aVerticies.makeStringAndClear())); + "pVerticies", "8;" + OString::number(nVertices) + aVerticies)); } if (!aSegmentInfo.isEmpty()) m_aShapeProps.insert(std::pair<OString, OString>( @@ -543,7 +542,8 @@ sal_Int32 RtfSdrExport::StartShape() m_rAttrOutput.RunText().append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPINST); - m_rAttrOutput.RunText().append(m_aShapeStyle.makeStringAndClear()); + m_rAttrOutput.RunText().append(m_aShapeStyle); + m_aShapeStyle.setLength(0); // Ignore \shpbxpage, \shpbxmargin, and \shpbxcolumn, in favor of the posrelh property. m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_SHPBXIGNORE); // Ignore \shpbypage, \shpbymargin, and \shpbycolumn, in favor of the posrelh property. diff --git a/sw/source/filter/ww8/rtfstringbuffer.cxx b/sw/source/filter/ww8/rtfstringbuffer.cxx index e6b215a143cd..ae491e45b4f0 100644 --- a/sw/source/filter/ww8/rtfstringbuffer.cxx +++ b/sw/source/filter/ww8/rtfstringbuffer.cxx @@ -22,7 +22,10 @@ RtfStringBufferValue::RtfStringBufferValue(const SwFlyFrameFormat* pFlyFrameForm void RtfStringBufferValue::makeStringAndClear(RtfAttributeOutput* pAttributeOutput) { if (!isGraphic()) - pAttributeOutput->m_rExport.Strm().WriteOString(m_aBuffer.makeStringAndClear()); + { + pAttributeOutput->m_rExport.Strm().WriteOString(m_aBuffer); + m_aBuffer.setLength(0); + } else pAttributeOutput->FlyFrameGraphic(m_pFlyFrameFormat, m_pGrfNode); } diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index a3276c72cedb..c436e533e101 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -409,7 +409,7 @@ void lcl_WriteValues(const std::vector<OUString> *pFields, SvStream* pStream) sLine.append("\t\"" + *aIter + "\""); } } - pStream->WriteByteStringLine( sLine.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); + pStream->WriteByteStringLine( sLine, RTL_TEXTENCODING_UTF8 ); } }