[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Fri Nov 15 08:08:23 UTC 2019
sw/source/filter/ww8/rtfattributeoutput.cxx | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit 63c1dff6d2392cc2a632b78327dfa53edb081602
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Nov 14 14:35:06 2019 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Nov 15 09:07:06 2019 +0100
sw: RTF export: fix invalid RTF for shapes and text frames
RtfAttributeOutput::OutputFlyFrame_Impl() writes SdrObject into
m_aRunText buffer, but for a text frame it writes directly
into m_rExport.Strm(), also writing m_aRunText into it in the middle.
So if you have both SdrObject and text frame at the same anchor
position, first the shape goes into the buffer and then the first part
of the text frame is written to the stream before it and the last part
after it, and we get this:
sw/source/filter/ww8/rtfattributeoutput.cxx:1886: m_aRunText is not empty
And Word refuses to open the file with a funny error message about
running out of memory.
Reportedly this is a regression from commit
d53dd70b15f0e3f7c8a05a93f8fcd70e1147c1f7 but really it was broken
already in commit a8b59ef5951fe76b0b733ecef739173c1d104f6f.
Change-Id: If01465dee71b63531b46c39dd557066f804c425d
Reviewed-on: https://gerrit.libreoffice.org/82702
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
Tested-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 4652b911c4376048a452709c953197e1a879a921)
Reviewed-on: https://gerrit.libreoffice.org/82736
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 427b110a5e02..b9fe1aa50902 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1887,7 +1887,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi
if (RtfSdrExport::isTextBox(rFrame.GetFrameFormat()))
break;
- OSL_ENSURE(m_aRunText.getLength() == 0, "m_aRunText is not empty");
+ assert(m_aRunText.getLength() == 0 && "this will corrupt the document");
m_rExport.m_pParentFrame = &rFrame;
m_rExport.Strm().WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_SHP);
@@ -1954,11 +1954,15 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi
m_rExport.OutputFormat(rFrame.GetFrameFormat(), false, false, true);
m_aRunText->append('}');
m_rExport.m_pParentFrame = nullptr;
+ m_rExport.Strm().WriteOString(m_aRunText.makeStringAndClear());
}
if (pGrfNode)
+ {
m_aRunText.append(dynamic_cast<const SwFlyFrameFormat*>(&rFrame.GetFrameFormat()),
pGrfNode);
+ m_rExport.Strm().WriteOString(m_aRunText.makeStringAndClear());
+ }
break;
case ww8::Frame::eDrawing:
{
@@ -1976,6 +1980,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi
m_aRunText->append('}');
m_aRunText->append('}');
+ m_rExport.Strm().WriteOString(m_aRunText.makeStringAndClear());
}
}
break;
More information about the Libreoffice-commits
mailing list