[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/qa writerfilter/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Sun Aug 4 17:43:50 UTC 2019


 sw/qa/extras/rtfimport/data/tdf126173.rtf         |   85 ++++++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx              |    7 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    2 
 3 files changed, 93 insertions(+), 1 deletion(-)

New commits:
commit 16d9cf03cf22abe2b7d89a92b2fe5c4d92581b3a
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Jul 8 21:25:44 2019 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Aug 4 19:43:12 2019 +0200

    tdf#126173 RTF import: fix lost SHAPE fields
    
    Commit 5a5d55a8a0f82406a8001015a723596f21d3562c (fdo#82860 RTF import:
    fix handling of SHAPE fields, 2014-10-15) already tried to handle this,
    but aCode is the shape command + its parameters (SHAPE  \* MERGEFORMAT)
    for the bugdoc, while what we want is just the shape command.
    
    The field variable already contains a tokenized version, which was used
    previously only to decide if a field is unhandled or not.
    
    Reuse that for the shape comparison, so bugdoc's shape with parameters
    also appears.
    
    Change-Id: I7e044b94bcfab490c956b33c11dd6c69443939f5
    Reviewed-on: https://gerrit.libreoffice.org/75243
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 9a15a75dfa7ab8c5d51c411e0e39d68d22b7587a)
    Reviewed-on: https://gerrit.libreoffice.org/75288
    Reviewed-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>
    (cherry picked from commit 0e6fdee15df8928c33308b353a7b80de150aca6b)
    Reviewed-on: https://gerrit.libreoffice.org/75295
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    (cherry picked from commit 45cf5d55221b92e395948cb2e36d6ae6f056b1a3)
    Reviewed-on: https://gerrit.libreoffice.org/76919
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sw/qa/extras/rtfimport/data/tdf126173.rtf b/sw/qa/extras/rtfimport/data/tdf126173.rtf
new file mode 100644
index 000000000000..f4990516c1d5
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf126173.rtf
@@ -0,0 +1,85 @@
+{\rtf1
+\pard\plain
+{\field\fldlock
+{\*\fldinst 
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid6882621 \hich\af31506\dbch\af31505\loch\f31506  SHAPE  \\* MERGEFORMAT }
+}
+{\fldrslt 
+{
+\rtlch\fcs1 \af1 \ltrch\fcs0 \lang1024\langfe1024\noproof\insrsid11561886 
+{\shp
+{\*\shpinst\shpleft0\shptop0\shpright2565\shpbottom1380\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplockanchor\shplid1026
+{\sp
+{\sn shapeType}
+{\sv 202}
+}
+{\sp
+{\sn fillColor}
+{\sv 16777215}
+}
+{\sp
+{\sn fRecolorFillAsPicture}
+{\sv 0}
+}
+{\sp
+{\sn fUseShapeAnchor}
+{\sv 0}
+}
+{\sp
+{\sn fFilled}
+{\sv 1}
+}
+{\sp
+{\sn lineWidth}
+{\sv 6350}
+}
+{\sp
+{\sn fLine}
+{\sv 1}
+}
+{\sp
+{\sn wzName}
+{\sv Text Box 1}
+}
+{\sp
+{\sn posrelh}
+{\sv 3}
+}
+{\sp
+{\sn posrelv}
+{\sv 3}
+}
+{\sp
+{\sn fLayoutInCell}
+{\sv 1}
+}
+{\sp
+{\sn fAllowOverlap}
+{\sv 1}
+}
+{\sp
+{\sn fBehindDocument}
+{\sv 0}
+}
+{\sp
+{\sn fHidden}
+{\sv 0}
+}
+{\sp
+{\sn fPseudoInline}
+{\sv 1}
+}
+{\shptxt 
+\ltrpar \pard\plain \ltrpar\ql \li0\ri0\sa160\sl259\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af1\afs22\alang1025 \ltrch\fcs0 
+\fs22\lang1033\langfe2052\loch\af31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp2052 
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid3175535 \hich\af31506\dbch\af31505\loch\f31506 test
+\par }
+}
+}
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid6882621 
+}
+}
+}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 5db5dbc2792c..c107563ffec2 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -959,6 +959,13 @@ DECLARE_RTFIMPORT_TEST(testUnbalancedColumns, "unbalanced-columns.rtf")
                          getProperty<bool>(xTextSections->getByIndex(0), "DontBalanceTextColumns"));
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf126173, "tdf126173.rtf")
+{
+    // Without the accompanying fix in place, this test would have failed, as the TextFrame was lost
+    // on import.
+    CPPUNIT_ASSERT(getShape(1).is());
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo84685, "fdo84685.rtf")
 {
     // index mark was not imported
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 235b07e241e2..ee458bc918b7 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4876,7 +4876,7 @@ void DomainMapper_Impl::CloseFieldCommand()
                  */
                 OUString aCode( pContext->GetCommand().trim() );
                 // Don't waste resources on wrapping shapes inside a fieldmark.
-                if (aCode != "SHAPE" && m_xTextFactory.is() && !m_aTextAppendStack.empty())
+                if (std::get<0>(field) != "SHAPE" && m_xTextFactory.is() && !m_aTextAppendStack.empty())
                 {
                     xFieldInterface = m_xTextFactory->createInstance("com.sun.star.text.Fieldmark");
                     const uno::Reference<text::XTextContent> xTextContent(xFieldInterface, uno::UNO_QUERY_THROW);


More information about the Libreoffice-commits mailing list