[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - svx/source sw/source
Armin Le Grand
alg at apache.org
Fri Jul 5 05:07:42 PDT 2013
svx/source/unodraw/unoprov.cxx | 22
sw/source/filter/ww8/rtfattributeoutput.cxx | 771 ++++++++++++++++++----------
sw/source/filter/ww8/rtfattributeoutput.hxx | 32 +
sw/source/filter/ww8/wrtw8nds.cxx | 3
4 files changed, 562 insertions(+), 266 deletions(-)
New commits:
commit 17b9c8d605cddf49adbbd0237a1e863fe7fd12e0
Author: Armin Le Grand <alg at apache.org>
Date: Fri Jul 5 11:15:39 2013 +0000
i118986 reduced mem usage of RTF export
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 0561e6e..ecb6b34 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -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( ww8::WW8TableNodeInfo::Pointer_t pTextN
}
}
- 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( ww8::WW8TableNodeInfoInner::Pointer_t pTe
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::StartParagraphProperties( const SwTxtNode& rNode )
// 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::StartParagraphProperties( const SwTxtNode& rNode )
}
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 SwRedlineData* pRedlineData )
{
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::EndRunProperties( const SwRedlineData* /*pRedlineData*/
{
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 String& rText, rtl_TextEncoding eCharSet
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::Styles()
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 SwRedlineData* pRedline )
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( sal_uInt16 nStyle )
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( const SwField* pFld, ww::eField /*eTyp
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::WriteHeaderFooter_Impl( const SwFrmFmt& rFmt, bool bHea
{
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_Impl( const sw::Frame& rFrame, const Poi
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_Impl( const sw::Frame& rFrame, const Poi
* 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_Impl( const sw::Frame& rFrame, const Poi
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_Impl( const sw::Frame& rFrame, const Poi
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_Impl( const sw::Frame& rFrame, const Poi
}
}
- 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_Impl( const sw::Frame& rFrame, const Poi
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_Impl( const sw::Frame& rFrame, const Poi
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_Impl( const sw::Frame& rFrame, const Poi
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_Impl( const sw::Frame& rFrame, const Poi
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_Impl( const sw::Frame& rFrame, const Poi
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( const SwFmtCharFmt& rCharFmt )
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_Impl( const SwFmtFtn& rFootnote )
* 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( const SwFmtFrmSize& rSize )
{
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( const SwFmtFrmSize& rSize )
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( const SwFmtSurround& rSurround )
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::FormatVertOrientation( const SwFmtVertOrient& rFlyVert
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::FormatVertOrientation( const SwFmtVertOrient& rFlyVert
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::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHori
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::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHori
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( const SwFmtAnchor& rAnchor )
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( const SwField* pFld )
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.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.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_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& rBuffer,
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 SwFlyFrmFmt* pFlyFrmFmt, const Size &rOrig, con
//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());
-
- aRet.append(pBLIPType);
+ 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());
+
+ 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( SwOLENode& rOLENode )
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( SwOLENode& rOLENode )
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( SwOLENode& rOLENode )
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( const SwFlyFrmFmt* pFlyFrmFmt, SwOLENode&
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( const SwFlyFrmFmt* pFlyFrmFmt, const S
*/
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( const SwFlyFrmFmt* pFlyFrmFmt, const S
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( const SwFlyFrmFmt* pFlyFrmFmt, const S
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: */
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index e2746c7..dfd85b5 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -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.
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 0b886c1..bf7c1af 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -657,9 +657,10 @@ const SfxPoolItem* WW8SwAttrIter::HasTextItem( sal_uInt16 nWhich ) const
{
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];
commit 8d4d9f11b6c205407136d5feb9668c748b9794e1
Author: Armin Le Grand <alg at apache.org>
Date: Fri Jul 5 10:48:40 2013 +0000
i122469 reordering of color name defines
Patch by: hanya
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index 2d09509..3067089 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -1230,16 +1230,30 @@ bool SvxUnoConvertResourceString( int nSourceResIds, int nDestResIds, int nCount
return sal_False;
}
+//////////////////////////////////////////////////////////////////////////////
+// #122649# Some comments on the below arrays:
+// - They need to have the same order and count of items
+// - They are used to translate between translated and non-translated color names
+// - To make longer names be found which start with the same basic string,
+// these have to be in front of others
+//
+// It would be nice to:
+// - evtl. organize these in a single array with 2-dimensional inner to elliminate
+// the possibility to define it wrong
+// - change the compare to also work when a shorter name is in front of a longer one
+
static sal_uInt16 __READONLY_DATA SvxUnoColorNameDefResId[] =
{
RID_SVXSTR_COLOR_BLUEGREY_DEF,
RID_SVXSTR_COLOR_BLACK_DEF,
+ RID_SVXSTR_COLOR_BLUE_CLASSIC_DEF,
RID_SVXSTR_COLOR_BLUE_DEF,
RID_SVXSTR_COLOR_GREEN_DEF,
RID_SVXSTR_COLOR_CYAN_DEF,
RID_SVXSTR_COLOR_RED_DEF,
RID_SVXSTR_COLOR_MAGENTA_DEF,
RID_SVXSTR_COLOR_GREY_DEF,
+ RID_SVXSTR_COLOR_YELLOWGREEN_DEF,
RID_SVXSTR_COLOR_YELLOW_DEF,
RID_SVXSTR_COLOR_WHITE_DEF,
RID_SVXSTR_COLOR_ORANGE_DEF,
@@ -1253,22 +1267,22 @@ static sal_uInt16 __READONLY_DATA SvxUnoColorNameDefResId[] =
RID_SVXSTR_COLOR_CHART_DEF,
RID_SVXSTR_COLOR_PURPLE_DEF,
RID_SVXSTR_COLOR_SKYBLUE_DEF,
- RID_SVXSTR_COLOR_YELLOWGREEN_DEF,
RID_SVXSTR_COLOR_PINK_DEF,
RID_SVXSTR_COLOR_TURQUOISE_DEF,
- RID_SVXSTR_COLOR_BLUE_CLASSIC_DEF
};
static sal_uInt16 __READONLY_DATA SvxUnoColorNameResId[] =
{
RID_SVXSTR_COLOR_BLUEGREY,
RID_SVXSTR_COLOR_BLACK,
+ RID_SVXSTR_COLOR_BLUE_CLASSIC,
RID_SVXSTR_COLOR_BLUE,
RID_SVXSTR_COLOR_GREEN,
RID_SVXSTR_COLOR_CYAN,
RID_SVXSTR_COLOR_RED,
RID_SVXSTR_COLOR_MAGENTA,
RID_SVXSTR_COLOR_GREY,
+ RID_SVXSTR_COLOR_YELLOWGREEN,
RID_SVXSTR_COLOR_YELLOW,
RID_SVXSTR_COLOR_WHITE,
RID_SVXSTR_COLOR_ORANGE,
@@ -1282,12 +1296,12 @@ static sal_uInt16 __READONLY_DATA SvxUnoColorNameResId[] =
RID_SVXSTR_COLOR_CHART,
RID_SVXSTR_COLOR_PURPLE,
RID_SVXSTR_COLOR_SKYBLUE,
- RID_SVXSTR_COLOR_YELLOWGREEN,
RID_SVXSTR_COLOR_PINK,
RID_SVXSTR_COLOR_TURQUOISE,
- RID_SVXSTR_COLOR_BLUE_CLASSIC
};
+//////////////////////////////////////////////////////////////////////////////
+
bool SvxUnoConvertResourceString( sal_uInt16* pSourceResIds, sal_uInt16* pDestResIds, int nCount, String& rString ) throw()
{
int i = 0;
More information about the Libreoffice-commits
mailing list