sw/qa/extras/rtfexport/data/tdf128320.odt |binary sw/qa/extras/rtfexport/rtfexport5.cxx | 25 +++++++++++++++++++++++++ sw/source/filter/ww8/rtfattributeoutput.cxx | 13 ++++++------- 3 files changed, 31 insertions(+), 7 deletions(-)
New commits: commit 7b26e517d50ca4c34fa7a6291948fb200b2e5d71 Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Mon Dec 16 16:08:29 2019 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Dec 17 09:06:30 2019 +0100 tdf#128320: RTF export: do not write shape attrs for postponed shape If graphical object is postponed (here stored in m_aRunText for later writing) it is wrong to write shape attributes right now. Anyway they wll be written during shape output in a correct destination. Change-Id: I1835485870648d4f1e363d34a3f58e390672442f Reviewed-on: https://gerrit.libreoffice.org/85227 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/rtfexport/data/tdf128320.odt b/sw/qa/extras/rtfexport/data/tdf128320.odt new file mode 100644 index 000000000000..bbeca771308f Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf128320.odt differ diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index 2a44ad72f1ff..640cff9bec39 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -1139,6 +1139,31 @@ DECLARE_RTFEXPORT_TEST(testTdf116371, "tdf116371.odt") CPPUNIT_ASSERT_DOUBLES_EQUAL(4700.0, getProperty<double>(xShape, "RotateAngle"), 10); } +DECLARE_RTFEXPORT_TEST(testTdf128320, "tdf128320.odt") +{ + // Shape does exist in RTF output + auto xShape(getShape(1)); + CPPUNIT_ASSERT(xShape.is()); + + // Let's see what is inside output RTF file + SvStream* pStream = maTempFile.GetStream(StreamMode::READ); + CPPUNIT_ASSERT(pStream); + OString aRtfContent(read_uInt8s_ToOString(*pStream, pStream->TellEnd())); + + // There are some RTF tokens for shape props + // They are much more inside, but let's use \shpwr2 as an inducator + sal_Int32 nPos = aRtfContent.indexOf("\\shpwr2", 0); + CPPUNIT_ASSERT(nPos > 0); + + // It goes AFTER shape instruction (sadly here we do not check if it is contaned inside) + sal_Int32 nPosShp = aRtfContent.indexOf("\\shpinst", 0); + CPPUNIT_ASSERT(nPosShp > 0); + + // But there are no more shape properties! + nPos = aRtfContent.indexOf("\\shpwr2", nPos + 1); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), nPos); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 8150c14fcd0b..570f018788b8 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1977,7 +1977,12 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi } break; case ww8::Frame::eGraphic: - if (!rFrame.IsInline()) + if (pGrfNode) + { + m_aRunText.append(dynamic_cast<const SwFlyFrameFormat*>(&rFrame.GetFrameFormat()), + pGrfNode); + } + else if (!rFrame.IsInline()) { m_rExport.m_pParentFrame = &rFrame; m_rExport.SetRTFFlySyntax(true); @@ -1988,12 +1993,6 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi m_aRunText->append('}'); m_rExport.m_pParentFrame = nullptr; } - - if (pGrfNode) - { - m_aRunText.append(dynamic_cast<const SwFlyFrameFormat*>(&rFrame.GetFrameFormat()), - pGrfNode); - } break; case ww8::Frame::eDrawing: { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits