[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/qa sw/source

Vasily Melenchuk (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 18 08:07:03 UTC 2019


 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 bd4e3facd59473974b02a17a39a4a0a975d208b0
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Mon Dec 16 16:08:29 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Dec 18 09:05:29 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 <vmiklos at collabora.com>
    (cherry picked from commit 7b26e517d50ca4c34fa7a6291948fb200b2e5d71)
    Reviewed-on: https://gerrit.libreoffice.org/85274

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 6044dfcc463a..6313472bf728 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:
         {


More information about the Libreoffice-commits mailing list