openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1499965 - in /openoffice/trunk/main/sw/source/filter/ww8: rtfattributeoutput.cxx rtfattributeoutput.hxx wrtw8nds.cxx
Date Fri, 05 Jul 2013 11:15:39 GMT
Author: alg
Date: Fri Jul  5 11:15:39 2013
New Revision: 1499965

URL: http://svn.apache.org/r1499965
Log:
i118986 reduced mem usage of RTF export

Modified:
    openoffice/trunk/main/sw/source/filter/ww8/rtfattributeoutput.cxx
    openoffice/trunk/main/sw/source/filter/ww8/rtfattributeoutput.hxx
    openoffice/trunk/main/sw/source/filter/ww8/wrtw8nds.cxx

Modified: openoffice/trunk/main/sw/source/filter/ww8/rtfattributeoutput.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/rtfattributeoutput.cxx?rev=1499965&r1=1499964&r2=1499965&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/rtfattributeoutput.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/rtfattributeoutput.cxx Fri Jul  5 11:15:39 2013
@@ -145,6 +145,212 @@ using namespace nsFieldFlags;
 using namespace sw::util;
 using namespace ::com::sun::star;
 
+//////////////////////////////////////////////////////////////////////////////
+
+class MultiBufferEntry
+{
+private:
+public:
+    MultiBufferEntry();
+    virtual ~MultiBufferEntry();
+
+    virtual void writeAndClear(SvStream& rTarget) = 0;
+};
+
+MultiBufferEntry::MultiBufferEntry()
+{
+}
+
+MultiBufferEntry::~MultiBufferEntry()
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+class MultiBufferString : public MultiBufferEntry
+{
+private:
+    rtl::OStringBuffer      maBuffer;
+
+public:
+    MultiBufferString(rtl::OStringBuffer& rBuffer);
+    virtual ~MultiBufferString();
+
+    rtl::OStringBuffer& getBuffer() { return maBuffer; }
+    virtual void writeAndClear(SvStream& rTarget);
+};
+
+MultiBufferString::MultiBufferString(rtl::OStringBuffer& rBuffer)
+:   MultiBufferEntry(),
+    maBuffer(rBuffer)
+{
+}
+
+MultiBufferString::~MultiBufferString()
+{
+}
+
+void MultiBufferString::writeAndClear(SvStream& rTarget)
+{
+    rTarget << maBuffer.makeStringAndClear();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+class MultiBufferHex : public MultiBufferEntry
+{
+private:
+    sal_uInt8*              mpData;
+    sal_uInt32              mnSize;
+    sal_uInt32              mnLimit;
+
+public:
+    MultiBufferHex(
+        const sal_uInt8* pData,
+        sal_uInt32 nSize,
+        sal_uInt32 nLimit = 64);
+    virtual ~MultiBufferHex();
+
+    virtual void writeAndClear(SvStream& rTarget);
+};
+
+MultiBufferHex::MultiBufferHex(
+    const sal_uInt8* pData,
+    sal_uInt32 nSize,
+    sal_uInt32 nLimit)
+:   MultiBufferEntry(),
+    mpData(0),
+    mnSize(nSize),
+    mnLimit(nLimit)
+{
+    if(mnSize)
+    {
+        mpData = new sal_uInt8[mnSize];
+        memcpy(mpData, pData, nSize);
+    }
+}
+
+MultiBufferHex::~MultiBufferHex()
+{
+    if(mpData)
+    {
+        delete mpData;
+    }
+}
+
+void MultiBufferHex::writeAndClear(SvStream& rTarget)
+{
+    if(mpData)
+    {
+        static OString hexArray[16] = {
+            OString('0'), OString('1'), OString('2'), OString('3'), 
+            OString('4'), OString('5'), OString('6'), OString('7'), 
+            OString('8'), OString('9'), OString('a'), OString('b'), 
+            OString('c'), OString('d'), OString('e'), OString('f') };
+
+        for(sal_uInt32 a(0), nBreak(0); a < mnSize; a++, nBreak++)
+        {
+            const sal_uInt8 aData(mpData[a]);
+
+            rTarget << hexArray[aData >> 4];
+            rTarget << hexArray[aData & 0x0f];
+
+            if(mnLimit == nBreak)
+            {
+                static OString aNewLine = OString(RtfExport::sNewLine);
+                nBreak = 0;
+                rTarget << aNewLine;
+            }
+        }
+
+        delete mpData;
+        mpData = 0;
+        mnSize = 0;
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void MultiBuffer::clearContentVector()
+{
+    while(!maContent.empty())
+    {
+        delete maContent.back();
+        maContent.pop_back();
+    }
+}
+
+MultiBuffer::MultiBuffer()
+:   maBuffer(),
+    maContent()
+{
+}
+
+MultiBuffer::~MultiBuffer()
+{
+    clearContentVector();
+}
+
+bool MultiBuffer::empty() const
+{
+    return 0 == maBuffer.getLength() && maContent.empty();
+}
+
+void MultiBuffer::writeAndClear(SvStream& rTarget)
+{
+    for(sal_uInt32 a(0); a < maContent.size(); a++)
+    {
+        maContent[a]->writeAndClear(rTarget);
+    }
+
+    clearContentVector();
+    rTarget << maBuffer.makeStringAndClear();
+}
+
+void MultiBuffer::appendAndClear(MultiBuffer& rSource)
+{
+    if(!rSource.maContent.empty())
+    {
+        if(maBuffer.getLength())
+        {
+            maContent.push_back(new MultiBufferString(maBuffer));
+            maBuffer.setLength(0);
+        }
+
+        for(sal_uInt32 a(0); a < rSource.maContent.size(); a++)
+        {
+            maContent.push_back(rSource.maContent[a]);
+        }
+
+        rSource.maContent.clear();
+    }
+
+    maBuffer.append(rSource.maBuffer.getStr());
+    rSource.maBuffer.setLength(0);
+}
+
+void MultiBuffer::clear()
+{
+    clearContentVector();
+    maBuffer.setLength(0);
+}
+
+void MultiBuffer::appendHexData(const sal_uInt8 *pGraphicAry, sal_uInt32 nSize, sal_uInt32 nLimit)
+{
+    if(nSize)
+    {
+        if(maBuffer.getLength())
+        {
+            maContent.push_back(new MultiBufferString(maBuffer));
+            maBuffer.setLength(0);
+        }
+
+        maContent.push_back(new MultiBufferHex(pGraphicAry, nSize, nLimit));
+    }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
 static OString OutTBLBorderLine(RtfExport &rExport, const SvxBorderLine* pLine, const sal_Char* pStr)
 {
     OStringBuffer aRet;
@@ -291,7 +497,7 @@ void RtfAttributeOutput::StartParagraph(
         }
     }
 
-    OSL_ENSURE(m_aRun.getLength() == 0, "m_aRun is not empty");
+    OSL_ENSURE(m_aRun.empty(), "m_aRun is not empty");
 }
 
 void RtfAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner )
@@ -300,28 +506,32 @@ void RtfAttributeOutput::EndParagraph( w
 
     FinishTableRowCell( pTextNodeInfoInner );
 
-    OStringBuffer aParagraph;
+    MultiBuffer aParagraph;
 
-    aParagraph.append(m_aRun.makeStringAndClear());
-    aParagraph.append(m_aAfterRuns.makeStringAndClear());
+    aParagraph.appendAndClear(m_aRun);
+    aParagraph.getOStringBuffer().append(m_aAfterRuns.makeStringAndClear());
     if (m_bTblAfterCell)
         m_bTblAfterCell = false;
     else
     {
-        aParagraph.append(m_rExport.sNewLine);
-        aParagraph.append(OOO_STRING_SVTOOLS_RTF_PAR);
-        aParagraph.append(' ');
+        aParagraph.getOStringBuffer().append(m_rExport.sNewLine);
+        aParagraph.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_PAR);
+        aParagraph.getOStringBuffer().append(' ');
     }
     if (m_nColBreakNeeded)
     {
-        aParagraph.append(OOO_STRING_SVTOOLS_RTF_COLUMN);
+        aParagraph.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_COLUMN);
         m_nColBreakNeeded = false;
     }
 
     if (!m_bBufferSectionHeaders)
-        m_rExport.Strm() << aParagraph.makeStringAndClear();
+    {
+        aParagraph.writeAndClear(m_rExport.Strm());
+    }
     else
-        m_aSectionHeaders.append(aParagraph.makeStringAndClear());
+    {
+        m_aSectionHeaders.appendAndClear(aParagraph);
+    }
 }
 
 void RtfAttributeOutput::EmptyParagraph()
@@ -343,7 +553,9 @@ void RtfAttributeOutput::StartParagraphP
 
     // output section headers / footers
     if (!m_bBufferSectionHeaders)
-        m_rExport.Strm() << m_aSectionHeaders.makeStringAndClear();
+    {
+        m_aSectionHeaders.writeAndClear(m_rExport.Strm());
+    }
 
     if ( aNextIndex.GetNode().IsTxtNode() )
     {
@@ -358,17 +570,23 @@ void RtfAttributeOutput::StartParagraphP
     }
     m_bBufferSectionBreaks = false;
 
-    OStringBuffer aPar;
+    MultiBuffer aPar;
+
     if (!m_rExport.bRTFFlySyntax)
     {
-        aPar.append(OOO_STRING_SVTOOLS_RTF_PARD);
-        aPar.append(OOO_STRING_SVTOOLS_RTF_PLAIN);
-        aPar.append(' ');
+        aPar.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_PARD);
+        aPar.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_PLAIN);
+        aPar.getOStringBuffer().append(' ');
     }
+
     if (!m_bBufferSectionHeaders)
-        m_rExport.Strm() << aPar.makeStringAndClear();
+    {
+        aPar.writeAndClear(m_rExport.Strm());
+    }
     else
-        m_aSectionHeaders.append(aPar.makeStringAndClear());
+    {
+        m_aSectionHeaders.appendAndClear(aPar);
+    }
 }
 
 void RtfAttributeOutput::EndParagraphProperties()
@@ -382,20 +600,20 @@ void RtfAttributeOutput::StartRun( const
 {
     OSL_TRACE("%s", OSL_THIS_FUNC);
 
-    m_aRun.append('{');
+    m_aRun.getOStringBuffer().append('{');
 
     // if there is some redlining in the document, output it
     Redline( pRedlineData );
 
-    OSL_ENSURE(m_aRunText.getLength() == 0, "m_aRunText is not empty");
+    OSL_ENSURE(m_aRunText.empty(), "m_aRunText is not empty");
 }
 
 void RtfAttributeOutput::EndRun()
 {
     OSL_TRACE("%s", OSL_THIS_FUNC);
-    m_aRun.append(m_rExport.sNewLine);
-    m_aRun.append(m_aRunText.makeStringAndClear());
-    m_aRun.append('}');
+    m_aRun.getOStringBuffer().append(m_rExport.sNewLine);
+    m_aRun.appendAndClear(m_aRunText);
+    m_aRun.getOStringBuffer().append('}');
 }
 
 void RtfAttributeOutput::StartRunProperties()
@@ -408,7 +626,7 @@ void RtfAttributeOutput::EndRunPropertie
 {
     OSL_TRACE("%s", OSL_THIS_FUNC);
     m_aStyles.append(m_aStylesEnd.makeStringAndClear());
-    m_aRun.append(m_aStyles.makeStringAndClear());
+    m_aRun.getOStringBuffer().append(m_aStyles.makeStringAndClear());
 }
 
 void RtfAttributeOutput::RunText( const String& rText, rtl_TextEncoding eCharSet )
@@ -417,9 +635,9 @@ void RtfAttributeOutput::RunText( const 
     RawText( rText, 0, eCharSet );
 }
 
-OStringBuffer& RtfAttributeOutput::RunText()
+rtl::OStringBuffer& RtfAttributeOutput::RunText()
 {
-    return m_aRunText;
+    return m_aRunText.getOStringBuffer();
 }
 
 OStringBuffer& RtfAttributeOutput::Styles()
@@ -430,7 +648,7 @@ OStringBuffer& RtfAttributeOutput::Style
 void RtfAttributeOutput::RawText( const String& rText, bool /*bForceUnicode*/, rtl_TextEncoding eCharSet )
 {
     OSL_TRACE("%s", OSL_THIS_FUNC);
-    m_aRunText.append(m_rExport.OutString(rText, eCharSet));
+    m_aRunText.getOStringBuffer().append(m_rExport.OutString(rText, eCharSet));
 }
 
 void RtfAttributeOutput::StartRuby( const SwTxtNode& /*rNode*/, const SwFmtRuby& /*rRuby*/ )
@@ -478,9 +696,9 @@ bool RtfAttributeOutput::EndURL()
     OSL_TRACE("%s", OSL_THIS_FUNC);
 
     // close the fldrslt group
-    m_aRunText.append('}');
+    m_aRunText.getOStringBuffer().append('}');
     // close the field group
-    m_aRunText.append('}');
+    m_aRunText.getOStringBuffer().append('}');
     return true;
 }
 
@@ -498,20 +716,20 @@ void RtfAttributeOutput::Redline( const 
 
     if (pRedline->GetType() == nsRedlineType_t::REDLINE_INSERT)
     {
-        m_aRun.append(OOO_STRING_SVTOOLS_RTF_REVISED);
-        m_aRun.append(OOO_STRING_SVTOOLS_RTF_REVAUTH);
-        m_aRun.append((sal_Int32)m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor())));
-        m_aRun.append(OOO_STRING_SVTOOLS_RTF_REVDTTM);
+        m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_REVISED);
+        m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_REVAUTH);
+        m_aRun.getOStringBuffer().append((sal_Int32)m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor())));
+        m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_REVDTTM);
     }
     else if(pRedline->GetType() == nsRedlineType_t::REDLINE_DELETE)
     {
-        m_aRun.append(OOO_STRING_SVTOOLS_RTF_DELETED);
-        m_aRun.append(OOO_STRING_SVTOOLS_RTF_REVAUTHDEL);
-        m_aRun.append((sal_Int32)m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor())));
-        m_aRun.append(OOO_STRING_SVTOOLS_RTF_REVDTTMDEL);
+        m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_DELETED);
+        m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_REVAUTHDEL);
+        m_aRun.getOStringBuffer().append((sal_Int32)m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor())));
+        m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_REVDTTMDEL);
     }
-    m_aRun.append((sal_Int32)sw::ms::DateTime2DTTM(pRedline->GetTimeStamp()));
-    m_aRun.append(' ');
+    m_aRun.getOStringBuffer().append((sal_Int32)sw::ms::DateTime2DTTM(pRedline->GetTimeStamp()));
+    m_aRun.getOStringBuffer().append(' ');
 }
 
 void RtfAttributeOutput::FormatDrop( const SwTxtNode& /*rNode*/, const SwFmtDrop& /*rSwFmtDrop*/, sal_uInt16 /*nStyle*/, ww8::WW8TableNodeInfo::Pointer_t /*pTextNodeInfo*/, ww8::WW8TableNodeInfoInner::Pointer_t /*pTextNodeInfoInner*/ )
@@ -524,15 +742,24 @@ void RtfAttributeOutput::ParagraphStyle(
     OSL_TRACE("%s", OSL_THIS_FUNC);
 
     OString *pStyle = m_rExport.GetStyle(nStyle);
-    OStringBuffer aStyle;
-    aStyle.append(OOO_STRING_SVTOOLS_RTF_S);
-    aStyle.append((sal_Int32)nStyle);
+    MultiBuffer aStyle;
+
+    aStyle.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_S);
+    aStyle.getOStringBuffer().append((sal_Int32)nStyle);
+    
     if (pStyle)
-        aStyle.append(pStyle->getStr());
+    {
+        aStyle.getOStringBuffer().append(pStyle->getStr());
+    }
+    
     if (!m_bBufferSectionHeaders)
-        m_rExport.Strm() << aStyle.makeStringAndClear();
+    {
+        aStyle.writeAndClear(m_rExport.Strm());
+    }
     else
-        m_aSectionHeaders.append(aStyle.makeStringAndClear());
+    {
+        m_aSectionHeaders.appendAndClear(aStyle);
+    }
 }
 
 void RtfAttributeOutput::TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ )
@@ -1379,30 +1606,30 @@ void RtfAttributeOutput::WriteField_Impl
     OSL_TRACE("%s", OSL_THIS_FUNC);
 
     // NEEDSWORK this has beeen tested only with page numbers
-    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_FIELD);
-    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST " ");
-    m_aRunText.append(m_rExport.OutString(rFldCmd, m_rExport.eCurrentEncoding));
-    m_aRunText.append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
+    m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_FIELD);
+    m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST " ");
+    m_aRunText.getOStringBuffer().append(m_rExport.OutString(rFldCmd, m_rExport.eCurrentEncoding));
+    m_aRunText.getOStringBuffer().append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
     if (pFld)
-        m_aRunText.append(m_rExport.OutString(pFld->ExpandField(true), m_rExport.eDefaultEncoding));
-    m_aRunText.append("}}");
+        m_aRunText.getOStringBuffer().append(m_rExport.OutString(pFld->ExpandField(true), m_rExport.eDefaultEncoding));
+    m_aRunText.getOStringBuffer().append("}}");
 }
 
 void RtfAttributeOutput::WriteBookmarks_Impl( std::vector< rtl::OUString >& rStarts, std::vector< rtl::OUString >& rEnds )
 {
     for ( std::vector< OUString >::const_iterator it = rStarts.begin(), end = rStarts.end(); it < end; ++it )
     {
-        m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BKMKSTART " ");
-        m_aRun.append(m_rExport.OutString(*it, m_rExport.eCurrentEncoding));
-        m_aRun.append('}');
+        m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BKMKSTART " ");
+        m_aRun.getOStringBuffer().append(m_rExport.OutString(*it, m_rExport.eCurrentEncoding));
+        m_aRun.getOStringBuffer().append('}');
     }
     rStarts.clear();
 
     for ( std::vector< OUString >::const_iterator it = rEnds.begin(), end = rEnds.end(); it < end; ++it )
     {
-        m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BKMKEND " ");
-        m_aRun.append(m_rExport.OutString(*it, m_rExport.eCurrentEncoding));
-        m_aRun.append('}');
+        m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BKMKEND " ");
+        m_aRun.getOStringBuffer().append(m_rExport.OutString(*it, m_rExport.eCurrentEncoding));
+        m_aRun.getOStringBuffer().append('}');
     }
     rEnds.clear();
 }
@@ -1411,20 +1638,22 @@ void RtfAttributeOutput::WriteHeaderFoot
 {
     OStringBuffer aSectionBreaks = m_aSectionBreaks;
     m_aSectionBreaks.setLength(0);
-    OStringBuffer aRun = m_aRun;
-    m_aRun.setLength(0);
 
-    m_aSectionHeaders.append(bHeader ? OOO_STRING_SVTOOLS_RTF_HEADERY : OOO_STRING_SVTOOLS_RTF_FOOTERY);
-    m_aSectionHeaders.append((sal_Int32)m_rExport.pAktPageDesc->GetMaster().GetULSpace().GetUpper());
-    m_aSectionHeaders.append('{');
-    m_aSectionHeaders.append(pStr);
+    MultiBuffer aTemp;
+    aTemp.appendAndClear(m_aRun);
+
+    m_aSectionHeaders.getOStringBuffer().append(bHeader ? OOO_STRING_SVTOOLS_RTF_HEADERY : OOO_STRING_SVTOOLS_RTF_FOOTERY);
+    m_aSectionHeaders.getOStringBuffer().append((sal_Int32)m_rExport.pAktPageDesc->GetMaster().GetULSpace().GetUpper());
+    m_aSectionHeaders.getOStringBuffer().append('{');
+    m_aSectionHeaders.getOStringBuffer().append(pStr);
     m_bBufferSectionHeaders = true;
     m_rExport.WriteHeaderFooterText(rFmt, bHeader);
     m_bBufferSectionHeaders = false;
-    m_aSectionHeaders.append('}');
-
+    m_aSectionHeaders.getOStringBuffer().append('}');
     m_aSectionBreaks = aSectionBreaks;
-    m_aRun = aRun;
+
+    m_aRun.clear();
+    m_aRun.appendAndClear(aTemp);
 }
 
 void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Point& /*rNdTopLeft*/ )
@@ -1437,16 +1666,16 @@ void RtfAttributeOutput::OutputFlyFrame_
     switch ( rFrame.GetWriterType() )
     {
         case sw::Frame::eTxtBox:
-            OSL_ENSURE(m_aRunText.getLength() == 0, "m_aRunText is not empty");
+            OSL_ENSURE(m_aRunText.empty(), "m_aRunText is not empty");
             m_rExport.mpParentFrame = &rFrame;
             m_rExport.bOutFlyFrmAttrs = m_rExport.bRTFFlySyntax = true;
             m_rExport.OutputFormat( rFrame.GetFrmFmt(), false, false, true );
-            m_rExport.Strm() << m_aRunText.makeStringAndClear();
+            m_aRunText.writeAndClear(m_rExport.Strm());
             m_rExport.Strm() << m_aStyles.makeStringAndClear();
             m_rExport.bOutFlyFrmAttrs = m_rExport.bRTFFlySyntax = false;
             m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_IGNORE;
             m_rExport.OutputFormat( rFrame.GetFrmFmt(), false, false, true );
-            m_rExport.Strm() << m_aRunText.makeStringAndClear();
+            m_aRunText.writeAndClear(m_rExport.Strm());
             m_rExport.Strm() << m_aStyles.makeStringAndClear();
             m_rExport.Strm() << '}';
 
@@ -1456,7 +1685,9 @@ void RtfAttributeOutput::OutputFlyFrame_
                  * OTOH, just drop the contents of m_aRunText in case something
                  * would be there, causing a problem later.
                  */
-                OString aSave = m_aRun.makeStringAndClear();
+                MultiBuffer aTemp;
+                aTemp.appendAndClear(m_aRun);
+
                 m_rExport.bRTFFlySyntax = true;
 
                 const SwFrmFmt& rFrmFmt = rFrame.GetFrmFmt( );
@@ -1467,11 +1698,11 @@ void RtfAttributeOutput::OutputFlyFrame_
                 m_rExport.mpParentFrame = &rFrame;
                 m_rExport.WriteText( );
                 m_rExport.RestoreData();
-
                 m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_PARD;
                 m_rExport.bRTFFlySyntax = false;
-                m_aRun.append(aSave);
-                m_aRunText.setLength(0);
+
+                m_aRun.appendAndClear(aTemp);
+                m_aRunText.clear();
             }
 
             m_rExport.mpParentFrame = NULL;
@@ -1484,9 +1715,9 @@ void RtfAttributeOutput::OutputFlyFrame_
                 m_rExport.bRTFFlySyntax = true;
                 m_rExport.OutputFormat( rFrame.GetFrmFmt(), false, false, true );
                 m_rExport.bRTFFlySyntax = false;
-                m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE);
+                m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE);
                 m_rExport.OutputFormat( rFrame.GetFrmFmt(), false, false, true );
-                m_aRunText.append('}');
+                m_aRunText.getOStringBuffer().append('}');
                 m_rExport.mpParentFrame = NULL;
             }
 
@@ -1511,16 +1742,16 @@ void RtfAttributeOutput::OutputFlyFrame_
                         }
                     }
 
-                    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_FIELD "{");
-                    m_aRunText.append(OOO_STRING_SVTOOLS_RTF_IGNORE);
-                    m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLDINST);
-                    m_aRunText.append(" SHAPE ");
-                    m_aRunText.append("}" "{" OOO_STRING_SVTOOLS_RTF_FLDRSLT);
+                    m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_FIELD "{");
+                    m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_IGNORE);
+                    m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FLDINST);
+                    m_aRunText.getOStringBuffer().append(" SHAPE ");
+                    m_aRunText.getOStringBuffer().append("}" "{" OOO_STRING_SVTOOLS_RTF_FLDRSLT);
 
                     m_rExport.SdrExporter().AddSdrObject( *pSdrObj );
 
-                    m_aRunText.append('}');
-                    m_aRunText.append('}');
+                    m_aRunText.getOStringBuffer().append('}');
+                    m_aRunText.getOStringBuffer().append('}');
 
                     if ( bSwapInPage )
                         const_cast< SdrObject* >( pSdrObj )->SetPage( 0 );
@@ -1532,8 +1763,8 @@ void RtfAttributeOutput::OutputFlyFrame_
                 const SwFrmFmt &rFrmFmt = rFrame.GetFrmFmt();
                 const SdrObject *pObject = rFrmFmt.FindRealSdrObject();
 
-                m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_FIELD);
-                m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST);
+                m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_FIELD);
+                m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST);
 
                 if (pObject && pObject->GetObjInventor() == FmFormInventor)
                 {
@@ -1548,54 +1779,54 @@ void RtfAttributeOutput::OutputFlyFrame_
                         if (xInfo->supportsService(C2U("com.sun.star.form.component.CheckBox")))
                         {
 
-                            m_aRun.append(OUStringToOString(OUString(FieldString(ww::eFORMCHECKBOX)), m_rExport.eCurrentEncoding));
-                            m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{");
-                            m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFTYPE "1"); // 1 = checkbox
+                            m_aRun.getOStringBuffer().append(OUStringToOString(OUString(FieldString(ww::eFORMCHECKBOX)), m_rExport.eCurrentEncoding));
+                            m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{");
+                            m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFTYPE "1"); // 1 = checkbox
                             // checkbox size in half points, this seems to be always 20, see WW8Export::DoCheckBox()
-                            m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFHPS "20");
+                            m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFHPS "20");
 
                             OUString aStr;
                             sName = C2U("Name");
                             if (xPropSetInfo->hasPropertyByName(sName))
                             {
                                 xPropSet->getPropertyValue(sName) >>= aStr;
-                                m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME " ");
-                                m_aRun.append(OUStringToOString(aStr, m_rExport.eCurrentEncoding));
-                                m_aRun.append('}');
+                                m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME " ");
+                                m_aRun.getOStringBuffer().append(OUStringToOString(aStr, m_rExport.eCurrentEncoding));
+                                m_aRun.getOStringBuffer().append('}');
                             }
 
                             sName = C2U("HelpText");
                             if (xPropSetInfo->hasPropertyByName(sName))
                             {
                                 xPropSet->getPropertyValue(sName) >>= aStr;
-                                m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP);
-                                m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " ");
-                                m_aRun.append(OUStringToOString(aStr, m_rExport.eCurrentEncoding));
-                                m_aRun.append('}');
+                                m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP);
+                                m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " ");
+                                m_aRun.getOStringBuffer().append(OUStringToOString(aStr, m_rExport.eCurrentEncoding));
+                                m_aRun.getOStringBuffer().append('}');
                             }
 
                             sName = C2U("HelpF1Text");
                             if (xPropSetInfo->hasPropertyByName(sName))
                             {
                                 xPropSet->getPropertyValue(sName) >>= aStr;
-                                m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT);
-                                m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " ");
-                                m_aRun.append(OUStringToOString(aStr, m_rExport.eCurrentEncoding));
-                                m_aRun.append('}');
+                                m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT);
+                                m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " ");
+                                m_aRun.getOStringBuffer().append(OUStringToOString(aStr, m_rExport.eCurrentEncoding));
+                                m_aRun.getOStringBuffer().append('}');
                             }
 
                             sal_Int16 nTemp = 0;
                             xPropSet->getPropertyValue(C2U("DefaultState")) >>= nTemp;
-                            m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFDEFRES);
-                            m_aRun.append((sal_Int32)nTemp);
+                            m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFDEFRES);
+                            m_aRun.getOStringBuffer().append((sal_Int32)nTemp);
                             xPropSet->getPropertyValue(C2U("State")) >>= nTemp;
-                            m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFRES);
-                            m_aRun.append((sal_Int32)nTemp);
+                            m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFRES);
+                            m_aRun.getOStringBuffer().append((sal_Int32)nTemp);
 
-                            m_aRun.append("}}");
+                            m_aRun.getOStringBuffer().append("}}");
 
                             // field result is empty, ffres already contains the form result
-                            m_aRun.append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
+                            m_aRun.getOStringBuffer().append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
                         }
                         else if (xInfo->supportsService(C2U("com.sun.star.form.component.TextField")))
                         {
@@ -1604,8 +1835,8 @@ void RtfAttributeOutput::OutputFlyFrame_
                             OUString aTmp;
                             const sal_Char* pStr;
 
-                            m_aRun.append(OUStringToOString(OUString(FieldString(ww::eFORMTEXT)), m_rExport.eCurrentEncoding));
-                            m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_DATAFIELD " ");
+                            m_aRun.getOStringBuffer().append(OUStringToOString(OUString(FieldString(ww::eFORMTEXT)), m_rExport.eCurrentEncoding));
+                            m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_DATAFIELD " ");
                             for (int i = 0; i < 8; i++) aBuf.append((sal_Char)0x00);
                             xPropSet->getPropertyValue(C2U("Name")) >>= aTmp;
                             aStr = OUStringToOString(aTmp, m_rExport.eCurrentEncoding);
@@ -1620,33 +1851,33 @@ void RtfAttributeOutput::OutputFlyFrame_
                             aStr = aBuf.makeStringAndClear();
                             pStr = aStr.getStr();
                             for (int i = 0; i < aStr.getLength(); i++, pStr++)
-                                m_aRun.append(m_rExport.OutHex(*pStr, 2));
-                            m_aRun.append('}');
-                            m_aRun.append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
+                                m_aRun.getOStringBuffer().append(m_rExport.OutHex(*pStr, 2));
+                            m_aRun.getOStringBuffer().append('}');
+                            m_aRun.getOStringBuffer().append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
                             xPropSet->getPropertyValue(C2U("Text")) >>= aTmp;
-                            m_aRun.append(OUStringToOString(aTmp, m_rExport.eCurrentEncoding));
-                            m_aRun.append('}');
-                            m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{");
+                            m_aRun.getOStringBuffer().append(OUStringToOString(aTmp, m_rExport.eCurrentEncoding));
+                            m_aRun.getOStringBuffer().append('}');
+                            m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{");
                             sName = C2U("HelpText");
                             if (xPropSetInfo->hasPropertyByName(sName))
                             {
                                 xPropSet->getPropertyValue(sName) >>= aTmp;
-                                m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP);
-                                m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " ");
-                                m_aRun.append(OUStringToOString(aTmp, m_rExport.eCurrentEncoding));
-                                m_aRun.append('}');
+                                m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP);
+                                m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " ");
+                                m_aRun.getOStringBuffer().append(OUStringToOString(aTmp, m_rExport.eCurrentEncoding));
+                                m_aRun.getOStringBuffer().append('}');
                             }
 
                             sName = C2U("HelpF1Text");
                             if (xPropSetInfo->hasPropertyByName(sName))
                             {
                                 xPropSet->getPropertyValue(sName) >>= aTmp;
-                                m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT);
-                                m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " ");
-                                m_aRun.append(OUStringToOString(aTmp, m_rExport.eCurrentEncoding));
-                                m_aRun.append('}');
+                                m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT);
+                                m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " ");
+                                m_aRun.getOStringBuffer().append(OUStringToOString(aTmp, m_rExport.eCurrentEncoding));
+                                m_aRun.getOStringBuffer().append('}');
                             }
-                            m_aRun.append("}");
+                            m_aRun.getOStringBuffer().append("}");
                         }
                         else if (xInfo->supportsService(C2U("com.sun.star.form.component.ListBox")))
                         {
@@ -1654,76 +1885,76 @@ void RtfAttributeOutput::OutputFlyFrame_
                             uno::Sequence<sal_Int16> aIntSeq;
                             uno::Sequence<OUString> aStrSeq;
 
-                            m_aRun.append(OUStringToOString(OUString(FieldString(ww::eFORMDROPDOWN)), m_rExport.eCurrentEncoding));
-                            m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{");
-                            m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFTYPE "2"); // 2 = list
-                            m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX);
+                            m_aRun.getOStringBuffer().append(OUStringToOString(OUString(FieldString(ww::eFORMDROPDOWN)), m_rExport.eCurrentEncoding));
+                            m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{");
+                            m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFTYPE "2"); // 2 = list
+                            m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX);
 
                             xPropSet->getPropertyValue(C2U("DefaultSelection")) >>= aIntSeq;
                             if( aIntSeq.getLength() )
                             {
-                                m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFDEFRES);
+                                m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFDEFRES);
                                 // a dropdown list can have only one 'selected item by default'
-                                m_aRun.append((sal_Int32)aIntSeq[0]);
+                                m_aRun.getOStringBuffer().append((sal_Int32)aIntSeq[0]);
                             }
 
                             xPropSet->getPropertyValue(C2U("SelectedItems")) >>= aIntSeq;
                             if( aIntSeq.getLength() )
                             {
-                                m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFRES);
+                                m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFRES);
                                 // a dropdown list can have only one 'currently selected item'
-                                m_aRun.append((sal_Int32)aIntSeq[0]);
+                                m_aRun.getOStringBuffer().append((sal_Int32)aIntSeq[0]);
                             }
 
                             sName = C2U("Name");
                             if (xPropSetInfo->hasPropertyByName(sName))
                             {
                                 xPropSet->getPropertyValue(sName) >>= aStr;
-                                m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME " ");
-                                m_aRun.append(OUStringToOString(aStr, m_rExport.eCurrentEncoding));
-                                m_aRun.append('}');
+                                m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME " ");
+                                m_aRun.getOStringBuffer().append(OUStringToOString(aStr, m_rExport.eCurrentEncoding));
+                                m_aRun.getOStringBuffer().append('}');
                             }
 
                             sName = C2U("HelpText");
                             if (xPropSetInfo->hasPropertyByName(sName))
                             {
                                 xPropSet->getPropertyValue(sName) >>= aStr;
-                                m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP);
-                                m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " ");
-                                m_aRun.append(OUStringToOString(aStr, m_rExport.eCurrentEncoding));
-                                m_aRun.append('}');
+                                m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP);
+                                m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " ");
+                                m_aRun.getOStringBuffer().append(OUStringToOString(aStr, m_rExport.eCurrentEncoding));
+                                m_aRun.getOStringBuffer().append('}');
                             }
 
                             sName = C2U("HelpF1Text");
                             if (xPropSetInfo->hasPropertyByName(sName))
                             {
                                 xPropSet->getPropertyValue(sName) >>= aStr;
-                                m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT);
-                                m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " ");
-                                m_aRun.append(OUStringToOString(aStr, m_rExport.eCurrentEncoding));
-                                m_aRun.append('}');
+                                m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT);
+                                m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " ");
+                                m_aRun.getOStringBuffer().append(OUStringToOString(aStr, m_rExport.eCurrentEncoding));
+                                m_aRun.getOStringBuffer().append('}');
                             }
 
 
                             xPropSet->getPropertyValue(C2U("StringItemList")) >>= aStrSeq;
                             sal_uInt32 nListItems = aStrSeq.getLength();
                             for (sal_uInt32 i = 0; i < nListItems; i++)
-                                m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFL " ")
+                                m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFL " ")
                                     .append(OUStringToOString(aStrSeq[i], m_rExport.eCurrentEncoding)).append('}');
 
-                            m_aRun.append("}}");
+                            m_aRun.getOStringBuffer().append("}}");
 
                             // field result is empty, ffres already contains the form result
-                            m_aRun.append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
+                            m_aRun.getOStringBuffer().append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " ");
                         }
                         else
                             OSL_TRACE("%s unhandled form control: '%s'", OSL_THIS_FUNC,
                                     OUStringToOString(xInfo->getImplementationName(), m_rExport.eCurrentEncoding).getStr());
-                        m_aRun.append('}');
+                        m_aRun.getOStringBuffer().append('}');
                     }
                 }
 
-                m_aRun.append('}');
+                m_aRun.getOStringBuffer().append('}');
             }
             break;
         case sw::Frame::eOle:
@@ -2261,21 +2492,21 @@ void RtfAttributeOutput::TextCharFormat(
 void RtfAttributeOutput::WriteTextFootnoteNumStr(const SwFmtFtn& rFootnote)
 {
     if (!rFootnote.GetNumStr().Len())
-        m_aRun.append(OOO_STRING_SVTOOLS_RTF_CHFTN);
+        m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_CHFTN);
     else
-        m_aRun.append(m_rExport.OutString(rFootnote.GetNumStr(), m_rExport.eCurrentEncoding));
+        m_aRun.getOStringBuffer().append(m_rExport.OutString(rFootnote.GetNumStr(), m_rExport.eCurrentEncoding));
 }
 
 void RtfAttributeOutput::TextFootnote_Impl( const SwFmtFtn& rFootnote )
 {
     OSL_TRACE("%s start", OSL_THIS_FUNC);
 
-    m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_SUPER " ");
+    m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_SUPER " ");
     WriteTextFootnoteNumStr(rFootnote);
-    m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FOOTNOTE);
+    m_aRun.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FOOTNOTE);
     if( rFootnote.IsEndNote() )
-        m_aRun.append(OOO_STRING_SVTOOLS_RTF_FTNALT);
-    m_aRun.append(' ');
+        m_aRun.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FTNALT);
+    m_aRun.getOStringBuffer().append(' ');
     WriteTextFootnoteNumStr(rFootnote);
 
     /*
@@ -2284,18 +2515,22 @@ void RtfAttributeOutput::TextFootnote_Im
      * 2) Buffer the output of the whole paragraph, as we do so for section headers already.
      */
     const SwNodeIndex* pIndex = rFootnote.GetTxtFtn()->GetStartNode();
-    OStringBuffer aRun = m_aRun;
-    m_aRun.setLength(0);
+    MultiBuffer aTemp;
+    aTemp.appendAndClear(m_aRun);
+
     m_bBufferSectionHeaders = true;
     m_rExport.WriteSpecialText( pIndex->GetIndex() + 1,
             pIndex->GetNode().EndOfSectionIndex(),
             !rFootnote.IsEndNote() ? TXT_FTN : TXT_EDN);
     m_bBufferSectionHeaders = false;
-    m_aRun = aRun;
-    m_aRun.append(m_aSectionHeaders.makeStringAndClear());
 
-    m_aRun.append("}");
-    m_aRun.append("}");
+    m_aRun.clear();
+    m_aRun.appendAndClear(aTemp);
+
+    m_aRun.appendAndClear(m_aSectionHeaders);
+
+    m_aRun.getOStringBuffer().append("}");
+    m_aRun.getOStringBuffer().append("}");
 
     OSL_TRACE("%s end", OSL_THIS_FUNC);
 }
@@ -2567,8 +2802,8 @@ void RtfAttributeOutput::FormatFrameSize
     {
         if( rSize.GetWidth() )
         {
-            m_aRunText.append(OOO_STRING_SVTOOLS_RTF_ABSW);
-            m_aRunText.append((sal_Int32)rSize.GetWidth());
+            m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_ABSW);
+            m_aRunText.getOStringBuffer().append((sal_Int32)rSize.GetWidth());
         }
 
         if( rSize.GetHeight() )
@@ -2576,8 +2811,8 @@ void RtfAttributeOutput::FormatFrameSize
             long nH = rSize.GetHeight();
             if( ATT_FIX_SIZE == rSize.GetHeightSizeType() )
                 nH = -nH;
-            m_aRunText.append(OOO_STRING_SVTOOLS_RTF_ABSH);
-            m_aRunText.append((sal_Int32)nH);
+            m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_ABSH);
+            m_aRunText.getOStringBuffer().append((sal_Int32)nH);
         }
     }
     else if (m_rExport.bOutPageDescs)
@@ -2703,8 +2938,8 @@ void RtfAttributeOutput::FormatSurround(
         if( bGold )
             eSurround = SURROUND_PARALLEL;
         RTFSurround aMC( bGold, static_cast< sal_uInt8 >(eSurround) );
-        m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLYMAINCNT);
-        m_aRunText.append( (sal_Int32) aMC.GetValue() );
+        m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FLYMAINCNT);
+        m_aRunText.getOStringBuffer().append( (sal_Int32) aMC.GetValue() );
     }
 }
 
@@ -2714,25 +2949,25 @@ void RtfAttributeOutput::FormatVertOrien
 
     if ( m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax )
     {
-        m_aRunText.append(OOO_STRING_SVTOOLS_RTF_PVPARA);
+        m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_PVPARA);
 
         switch (rFlyVert.GetVertOrient())
         {
             case text::VertOrientation::TOP:
             case text::VertOrientation::LINE_TOP:
-                m_aRunText.append(OOO_STRING_SVTOOLS_RTF_POSYT);
+                m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_POSYT);
                 break;
             case text::VertOrientation::BOTTOM:
             case text::VertOrientation::LINE_BOTTOM:
-                m_aRunText.append(OOO_STRING_SVTOOLS_RTF_POSYB);
+                m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_POSYB);
                 break;
             case text::VertOrientation::CENTER:
             case text::VertOrientation::LINE_CENTER:
-                m_aRunText.append(OOO_STRING_SVTOOLS_RTF_POSYC);
+                m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_POSYC);
                 break;
             case text::VertOrientation::NONE:
-                m_aRunText.append(OOO_STRING_SVTOOLS_RTF_POSY);
-                m_aRunText.append((sal_Int32)rFlyVert.GetPos());
+                m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_POSY);
+                m_aRunText.getOStringBuffer().append((sal_Int32)rFlyVert.GetPos());
                 break;
             default:
                 break;
@@ -2741,8 +2976,8 @@ void RtfAttributeOutput::FormatVertOrien
     else if ( !m_rExport.bRTFFlySyntax )
     {
         RTFVertOrient aVO( static_cast< sal_uInt16 >(rFlyVert.GetVertOrient()), static_cast< sal_uInt16 >(rFlyVert.GetRelationOrient()) );
-        m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLYVERT);
-        m_aRunText.append((sal_Int32)aVO.GetValue());
+        m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FLYVERT);
+        m_aRunText.getOStringBuffer().append((sal_Int32)aVO.GetValue());
     }
 }
 
@@ -2752,7 +2987,7 @@ void RtfAttributeOutput::FormatHorizOrie
 
     if ( m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax )
     {
-        m_aRunText.append(OOO_STRING_SVTOOLS_RTF_PHCOL);
+        m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_PHCOL);
 
         const char* pS = 0;
         switch(rFlyHori.GetHoriOrient())
@@ -2767,20 +3002,20 @@ void RtfAttributeOutput::FormatHorizOrie
                 pS = OOO_STRING_SVTOOLS_RTF_POSXC;
                 break;
             case text::HoriOrientation::NONE:
-                m_aRunText.append(OOO_STRING_SVTOOLS_RTF_POSX);
-                m_aRunText.append((sal_Int32)rFlyHori.GetPos());
+                m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_POSX);
+                m_aRunText.getOStringBuffer().append((sal_Int32)rFlyHori.GetPos());
                 break;
             default:
                 break;
         }
         if (pS)
-            m_aRunText.append(pS);
+            m_aRunText.getOStringBuffer().append(pS);
     } else if ( !m_rExport.bRTFFlySyntax )
     {
         RTFHoriOrient aHO( static_cast< sal_uInt16 >(rFlyHori.GetHoriOrient()),
                 static_cast< sal_uInt16 >(rFlyHori.GetRelationOrient()) );
-        m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLYHORZ);
-        m_aRunText.append((sal_Int32)aHO.GetValue());
+        m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FLYHORZ);
+        m_aRunText.getOStringBuffer().append((sal_Int32)aHO.GetValue());
     }
 }
 
@@ -2791,17 +3026,17 @@ void RtfAttributeOutput::FormatAnchor( c
     if ( !m_rExport.bRTFFlySyntax )
     {
         sal_uInt16 nId = static_cast< sal_uInt16 >(rAnchor.GetAnchorId());
-        m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLYANCHOR);
-        m_aRunText.append((sal_Int32)nId);
+        m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FLYANCHOR);
+        m_aRunText.getOStringBuffer().append((sal_Int32)nId);
         switch( nId )
         {
             case FLY_AT_PAGE:
-                m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLYPAGE);
-                m_aRunText.append((sal_Int32)rAnchor.GetPageNum());
+                m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FLYPAGE);
+                m_aRunText.getOStringBuffer().append((sal_Int32)rAnchor.GetPageNum());
                 break;
             case FLY_AT_PARA:
             case FLY_AS_CHAR:
-                m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLYCNTNT);
+                m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_FLYCNTNT);
                 break;
         }
     }
@@ -2978,20 +3213,20 @@ void RtfAttributeOutput::PostitField( co
 
     const SwPostItField& rPFld = *(SwPostItField*)pFld;
 
-    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ATNID " ");
-    m_aRunText.append(OUStringToOString(OUString(rPFld.GetPar1()), m_rExport.eCurrentEncoding));
-    m_aRunText.append("}");
-    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ATNAUTHOR " ");
-    m_aRunText.append(OUStringToOString(OUString(rPFld.GetPar1()), m_rExport.eCurrentEncoding));
-    m_aRunText.append("}");
-    m_aRunText.append(OOO_STRING_SVTOOLS_RTF_CHATN);
-
-    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ANNOTATION);
-    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ATNDATE " ");
-    m_aRunText.append((sal_Int32)sw::ms::DateTime2DTTM(rPFld.GetDate()));
-    m_aRunText.append('}');
-    m_aRunText.append(OUStringToOString(OUString(rPFld.GetTxt()), m_rExport.eCurrentEncoding));
-    m_aRunText.append('}');
+    m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ATNID " ");
+    m_aRunText.getOStringBuffer().append(OUStringToOString(OUString(rPFld.GetPar1()), m_rExport.eCurrentEncoding));
+    m_aRunText.getOStringBuffer().append("}");
+    m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ATNAUTHOR " ");
+    m_aRunText.getOStringBuffer().append(OUStringToOString(OUString(rPFld.GetPar1()), m_rExport.eCurrentEncoding));
+    m_aRunText.getOStringBuffer().append("}");
+    m_aRunText.getOStringBuffer().append(OOO_STRING_SVTOOLS_RTF_CHATN);
+
+    m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ANNOTATION);
+    m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ATNDATE " ");
+    m_aRunText.getOStringBuffer().append((sal_Int32)sw::ms::DateTime2DTTM(rPFld.GetDate()));
+    m_aRunText.getOStringBuffer().append('}');
+    m_aRunText.getOStringBuffer().append(OUStringToOString(OUString(rPFld.GetTxt()), m_rExport.eCurrentEncoding));
+    m_aRunText.getOStringBuffer().append('}');
 }
 
 bool RtfAttributeOutput::DropdownField( const SwField* /*pFld*/ )
@@ -3199,26 +3434,34 @@ void lcl_AppendSP( OStringBuffer& rBuffe
     rBuffer.append( "}}" );
 }
 
-static OString ExportPICT( const SwFlyFrmFmt* pFlyFrmFmt, const Size &rOrig, const Size &rRendered, const Size &rMapped,
-    const SwCropGrf &rCr, const char *pBLIPType, const sal_uInt8 *pGraphicAry,
-    unsigned long nSize, const RtfExport& rExport )
+void ExportPICT( 
+    MultiBuffer& rTarget, 
+    const SwFlyFrmFmt* pFlyFrmFmt, 
+    const Size &rOrig, 
+    const Size &rRendered, 
+    const Size &rMapped,
+    const SwCropGrf &rCr, 
+    const char *pBLIPType, 
+    const sal_uInt8 *pGraphicAry,
+    unsigned long nSize, 
+    const RtfExport& rExport )
 {
-    OStringBuffer aRet;
     bool bIsWMF = (const char *)pBLIPType == (const char *)OOO_STRING_SVTOOLS_RTF_WMETAFILE ? true : false;
     if (pBLIPType && nSize && pGraphicAry)
     {
-        aRet.append("{" OOO_STRING_SVTOOLS_RTF_PICT);
+        rtl::OStringBuffer& rBuffer = rTarget.getOStringBuffer();
+        rBuffer.append("{" OOO_STRING_SVTOOLS_RTF_PICT);
 
         if( pFlyFrmFmt )
         {
             String sDescription = pFlyFrmFmt->GetObjDescription();
             //write picture properties - wzDescription at first
             //looks like: "{\*\picprop{\sp{\sn PropertyName}{\sv PropertyValue}}}"
-            aRet.append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_PICPROP );//"{\*\picprop
-            lcl_AppendSP( aRet, "wzDescription", sDescription, rExport );
+            rBuffer.append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_PICPROP );//"{\*\picprop
+            lcl_AppendSP( rBuffer, "wzDescription", sDescription, rExport );
             String sName = pFlyFrmFmt->GetObjTitle();
-            lcl_AppendSP( aRet, "wzName", sName, rExport );
-            aRet.append( "}" ); //"}"
+            lcl_AppendSP( rBuffer, "wzName", sName, rExport );
+            rBuffer.append( "}" ); //"}"
         }
 
         long nXCroppedSize = rOrig.Width()-(rCr.GetLeft() + rCr.GetRight());
@@ -3233,41 +3476,46 @@ static OString ExportPICT( const SwFlyFr
         //Given the original size and taking cropping into account
         //first, how much has the original been scaled to get the
         //final rendered size
-        aRet.append(OOO_STRING_SVTOOLS_RTF_PICSCALEX);
-        aRet.append((sal_Int32)((100 * rRendered.Width()) / nXCroppedSize));
-        aRet.append(OOO_STRING_SVTOOLS_RTF_PICSCALEY);
-        aRet.append((sal_Int32)((100 * rRendered.Height()) / nYCroppedSize));
-
-        aRet.append(OOO_STRING_SVTOOLS_RTF_PICCROPL);
-        aRet.append((sal_Int32)rCr.GetLeft());
-        aRet.append(OOO_STRING_SVTOOLS_RTF_PICCROPR);
-        aRet.append((sal_Int32)rCr.GetRight());
-        aRet.append(OOO_STRING_SVTOOLS_RTF_PICCROPT);
-        aRet.append((sal_Int32)rCr.GetTop());
-        aRet.append(OOO_STRING_SVTOOLS_RTF_PICCROPB);
-        aRet.append((sal_Int32)rCr.GetBottom());
-
-        aRet.append(OOO_STRING_SVTOOLS_RTF_PICW);
-        aRet.append((sal_Int32)rMapped.Width());
-        aRet.append(OOO_STRING_SVTOOLS_RTF_PICH);
-        aRet.append((sal_Int32)rMapped.Height());
-
-        aRet.append(OOO_STRING_SVTOOLS_RTF_PICWGOAL);
-        aRet.append((sal_Int32)rOrig.Width());
-        aRet.append(OOO_STRING_SVTOOLS_RTF_PICHGOAL);
-        aRet.append((sal_Int32)rOrig.Height());
+        rBuffer.append(OOO_STRING_SVTOOLS_RTF_PICSCALEX);
+        rBuffer.append((sal_Int32)((100 * rRendered.Width()) / nXCroppedSize));
+        rBuffer.append(OOO_STRING_SVTOOLS_RTF_PICSCALEY);
+        rBuffer.append((sal_Int32)((100 * rRendered.Height()) / nYCroppedSize));
+
+        rBuffer.append(OOO_STRING_SVTOOLS_RTF_PICCROPL);
+        rBuffer.append((sal_Int32)rCr.GetLeft());
+        rBuffer.append(OOO_STRING_SVTOOLS_RTF_PICCROPR);
+        rBuffer.append((sal_Int32)rCr.GetRight());
+        rBuffer.append(OOO_STRING_SVTOOLS_RTF_PICCROPT);
+        rBuffer.append((sal_Int32)rCr.GetTop());
+        rBuffer.append(OOO_STRING_SVTOOLS_RTF_PICCROPB);
+        rBuffer.append((sal_Int32)rCr.GetBottom());
+
+        rBuffer.append(OOO_STRING_SVTOOLS_RTF_PICW);
+        rBuffer.append((sal_Int32)rMapped.Width());
+        rBuffer.append(OOO_STRING_SVTOOLS_RTF_PICH);
+        rBuffer.append((sal_Int32)rMapped.Height());
+
+        rBuffer.append(OOO_STRING_SVTOOLS_RTF_PICWGOAL);
+        rBuffer.append((sal_Int32)rOrig.Width());
+        rBuffer.append(OOO_STRING_SVTOOLS_RTF_PICHGOAL);
+        rBuffer.append((sal_Int32)rOrig.Height());
 
-        aRet.append(pBLIPType);
+        rBuffer.append(pBLIPType);
         if (bIsWMF)
         {
-            aRet.append((sal_Int32)8);
+            rBuffer.append((sal_Int32)8);
             StripMetafileHeader(pGraphicAry, nSize);
         }
-        aRet.append(RtfExport::sNewLine);
-        aRet.append(WriteHex(pGraphicAry, nSize));
-        aRet.append('}');
+        rBuffer.append(RtfExport::sNewLine);
+
+        // append binary data for later streaming
+        // anotation: it is okay to append further to the remembered rBuffer since
+        // the address of this basic buffer at MultiBuffer does not change; it will
+        // be reset to length zero, though, after this call
+        rTarget.appendHexData(pGraphicAry, nSize);
+
+        rBuffer.append('}');
     }
-    return aRet.makeStringAndClear();
 }
 
 void RtfAttributeOutput::FlyFrameOLEData( SwOLENode& rOLENode )
@@ -3282,11 +3530,11 @@ void RtfAttributeOutput::FlyFrameOLEData
     if (SotExchange::IsMath(aObjName))
     {
         // ObjectHeader
-        m_aRunText.append(WriteHex(0x00000501)); // OLEVersion
-        m_aRunText.append(WriteHex(0x00000002)); // FormatID
-        m_aRunText.append(WriteHex(OString("Equation.3"))); // ClassName
-        m_aRunText.append(WriteHex(0x00000000)); // TopicName
-        m_aRunText.append(WriteHex(0x00000000)); // ItemName
+        m_aRunText.getOStringBuffer().append(WriteHex(0x00000501)); // OLEVersion
+        m_aRunText.getOStringBuffer().append(WriteHex(0x00000002)); // FormatID
+        m_aRunText.getOStringBuffer().append(WriteHex(OString("Equation.3"))); // ClassName
+        m_aRunText.getOStringBuffer().append(WriteHex(0x00000000)); // TopicName
+        m_aRunText.getOStringBuffer().append(WriteHex(0x00000000)); // ItemName
 
         // NativeData
         SvMemoryStream *pStream = new SvMemoryStream;
@@ -3295,10 +3543,13 @@ void RtfAttributeOutput::FlyFrameOLEData
         pStream->Seek(STREAM_SEEK_TO_END);
         sal_uInt32 nNativeDataSize = pStream->Tell();
         const sal_uInt8* pNativeData = (sal_uInt8*)pStream->GetData();
-        m_aRunText.append(WriteHex(nNativeDataSize));
-        m_aRunText.append(RtfExport::sNewLine);
-        m_aRunText.append(WriteHex(pNativeData, nNativeDataSize, 126));
-        m_aRunText.append(RtfExport::sNewLine);
+        m_aRunText.getOStringBuffer().append(WriteHex(nNativeDataSize));
+        m_aRunText.getOStringBuffer().append(RtfExport::sNewLine);
+
+        // append binary data for later streaming
+        m_aRunText.appendHexData(pNativeData, nNativeDataSize, 126);
+
+        m_aRunText.getOStringBuffer().append(RtfExport::sNewLine);
         delete pStream;
 
         // MetaFilePresentationObject
@@ -3309,7 +3560,9 @@ void RtfAttributeOutput::FlyFrameOLEData
         pStream->Seek(STREAM_SEEK_TO_END);
         sal_uInt32 nPresentationDataSize = pStream->Tell();
         const sal_uInt8* pPresentationData = (sal_uInt8*)pStream->GetData();
-        m_aRunText.append(WriteHex(pPresentationData, nPresentationDataSize, 126));
+
+        // append binary data for later streaming
+        m_aRunText.appendHexData(pPresentationData, nPresentationDataSize, 126);
     }
 }
 
@@ -3336,21 +3589,21 @@ void RtfAttributeOutput::FlyFrameOLE( co
     nSize = aStream.Tell();
     pGraphicAry = (sal_uInt8*)aStream.GetData();
 
-    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_OBJECT OOO_STRING_SVTOOLS_RTF_OBJEMB);
+    m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_OBJECT OOO_STRING_SVTOOLS_RTF_OBJEMB);
 
     // export the object data in the appropriate format; RTF requires the usage of the OLE 1.0 format
-    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_OBJDATA " ");
+    m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_OBJDATA " ");
     FlyFrameOLEData(rOLENode);
-    m_aRunText.append("}{" OOO_STRING_SVTOOLS_RTF_RESULT);
+    m_aRunText.getOStringBuffer().append("}{" OOO_STRING_SVTOOLS_RTF_RESULT);
 
     SwTwips nHeight = aSize.Height();
     nHeight/=20; //nHeight was in twips, want it in half points, but then half of total height.
     long nFontHeight = ((const SvxFontHeightItem&)m_rExport.GetItem(RES_CHRATR_FONTSIZE)).GetHeight();
     nHeight-=nFontHeight/20;
-    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_DN).append(nHeight);
-    m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT);
-    m_aRunText.append(ExportPICT( pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport ));
-    m_aRunText.append("}}}}");
+    m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_DN).append(nHeight);
+    m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT);
+    ExportPICT( m_aRunText, pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport );
+    m_aRunText.getOStringBuffer().append("}}}}");
 }
 
 void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const SwGrfNode& rGrfNode, const Size& rSize )
@@ -3423,10 +3676,12 @@ void RtfAttributeOutput::FlyFrameGraphic
        */
     bool bIsWMF = (const sal_Char*)pBLIPType == (const sal_Char*)OOO_STRING_SVTOOLS_RTF_WMETAFILE ? true : false;
     if (!bIsWMF)
-        m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT);
+        m_aRunText.getOStringBuffer().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT);
 
     if (pBLIPType)
-        m_aRunText.append(ExportPICT( pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport));
+    {
+        ExportPICT( m_aRunText, pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport);
+    }
     else
     {
         aStream.Seek(0);
@@ -3436,12 +3691,12 @@ void RtfAttributeOutput::FlyFrameGraphic
         nSize = aStream.Tell();
         pGraphicAry = (sal_uInt8*)aStream.GetData();
 
-        m_aRunText.append(ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport ));
+        ExportPICT( m_aRunText, pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport );
     }
 
     if (!bIsWMF)
     {
-        m_aRunText.append("}" "{" OOO_STRING_SVTOOLS_RTF_NONSHPPICT);
+        m_aRunText.getOStringBuffer().append("}" "{" OOO_STRING_SVTOOLS_RTF_NONSHPPICT);
 
         aStream.Seek(0);
         GraphicConverter::Export(aStream, aGraphic, CVT_WMF);
@@ -3450,12 +3705,12 @@ void RtfAttributeOutput::FlyFrameGraphic
         nSize = aStream.Tell();
         pGraphicAry = (sal_uInt8*)aStream.GetData();
 
-        m_aRunText.append(ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport ));
+        ExportPICT( m_aRunText, pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport );
 
-        m_aRunText.append('}');
+        m_aRunText.getOStringBuffer().append('}');
     }
 
-    m_aRunText.append(m_rExport.sNewLine);
+    m_aRunText.getOStringBuffer().append(m_rExport.sNewLine);
 }
 
 /* vi:set shiftwidth=4 expandtab: */

Modified: openoffice/trunk/main/sw/source/filter/ww8/rtfattributeoutput.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/rtfattributeoutput.hxx?rev=1499965&r1=1499964&r2=1499965&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/rtfattributeoutput.hxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/rtfattributeoutput.hxx Fri Jul  5 11:15:39 2013
@@ -42,6 +42,32 @@ class SwOLENode;
 class SdrObject;
 class SwFlyFrmFmt;
 
+//////////////////////////////////////////////////////////////////////////////
+class MultiBufferEntry;
+
+class MultiBuffer
+{
+private:
+    rtl::OStringBuffer                  maBuffer;
+    std::vector< MultiBufferEntry* >    maContent;
+
+    void clearContentVector();
+
+public:
+    MultiBuffer();
+    virtual ~MultiBuffer();
+
+    rtl::OStringBuffer& getOStringBuffer() { return maBuffer; }
+
+    bool empty() const;
+    void writeAndClear(SvStream& rTarget);
+    void appendAndClear(MultiBuffer& rSource);
+    void clear();
+    void appendHexData(const sal_uInt8 *pGraphicAry, sal_uInt32 nSize, sal_uInt32 nLimit = 64);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
 class RtfAttributeOutput : public AttributeOutputBase
 {
 public:
@@ -474,8 +500,8 @@ private:
      * This is needed because the call order is: run text, run properties, paragraph properties.
      * What we need is the opposite.
      */
-    rtl::OStringBuffer m_aRun;
-    rtl::OStringBuffer m_aRunText;
+    MultiBuffer     m_aRun;
+    MultiBuffer     m_aRunText;
     /*
      * This is written after runs.
      */
@@ -540,7 +566,7 @@ private:
      * m_aSectionHeaders.
      */
     bool m_bBufferSectionHeaders;
-    rtl::OStringBuffer m_aSectionHeaders;
+    MultiBuffer     m_aSectionHeaders;
 
     /*
      * Support for starting multiple tables at the same cell.

Modified: openoffice/trunk/main/sw/source/filter/ww8/wrtw8nds.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/filter/ww8/wrtw8nds.cxx?rev=1499965&r1=1499964&r2=1499965&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/filter/ww8/wrtw8nds.cxx (original)
+++ openoffice/trunk/main/sw/source/filter/ww8/wrtw8nds.cxx Fri Jul  5 11:15:39 2013
@@ -657,9 +657,10 @@ const SfxPoolItem* WW8SwAttrIter::HasTex
 {
     const SfxPoolItem* pRet = 0;
     const SwpHints* pTxtAttrs = rNd.GetpSwpHints();
-    xub_StrLen nTmpSwPos = m_rExport.m_aCurrentCharPropStarts.top();
     if (pTxtAttrs)
     {
+        xub_StrLen nTmpSwPos = m_rExport.m_aCurrentCharPropStarts.size() ? 
+            m_rExport.m_aCurrentCharPropStarts.top() : 0;
         for (sal_uInt16 i = 0; i < pTxtAttrs->Count(); ++i)
         {
             const SwTxtAttr* pHt = (*pTxtAttrs)[i];



Mime
View raw message