sw/qa/extras/rtfexport/data/tdf158409.rtf      |   12 ++++++++++++
 sw/qa/extras/rtfexport/rtfexport3.cxx          |    9 +++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    4 ++--
 3 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit e52d61431b43336eca338d4afe061433fb7c97a2
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Wed Dec 6 14:40:15 2023 +0300
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Feb 6 16:51:25 2024 +0100

    tdf#158409: RTF import: use current run props for fields
    
    Fields import was not using current run properties causing
    fallback to used style or default style what is wrong for RTF.
    
    Change-Id: I0189c6122b703a23ff910ee38da78aa05ac4d9f8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160387
    Tested-by: Jenkins
    Reviewed-by: Vasily Melenchuk <vasily.melenc...@cib.de>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163057

diff --git a/sw/qa/extras/rtfexport/data/tdf158409.rtf 
b/sw/qa/extras/rtfexport/data/tdf158409.rtf
new file mode 100644
index 000000000000..a89a5ba95d8a
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf158409.rtf
@@ -0,0 +1,12 @@
+{ tf1
+{\info
+{      itle DocTitle}
+}
+{\stylesheet
+{\qls72 Normal;}
+}
+
+\pards16 {ield{\*ldinst TITLE}}\par
+\pards72 { tfchs16{ield{\*ldinst TITLE}}}\par
+
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx 
b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 435242308a0e..fd25e7e5758d 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -707,6 +707,15 @@ CPPUNIT_TEST_FIXTURE(Test, 
testFloattableOverlapNeverRTFExport)
     
CPPUNIT_ASSERT(!pFly->GetAttrSet().GetWrapInfluenceOnObjPos().GetAllowOverlap());
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf158409, "tdf158409.rtf")
+{
+    uno::Reference<text::XTextRange> xRun = getRun(getParagraph(1), 1, 
"DocTitle");
+    CPPUNIT_ASSERT_EQUAL(8.0, getProperty<double>(xRun, "CharHeight"));
+
+    xRun = getRun(getParagraph(2), 1, "DocTitle");
+    CPPUNIT_ASSERT_EQUAL(8.0, getProperty<double>(xRun, "CharHeight"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 52c8311fcb96..cc85a48ae27b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2342,7 +2342,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& 
rState)
 
             if (m_aStates.top().isFieldLocked())
                 singleChar(cFieldLock);
-            singleChar(cFieldSep);
+            singleChar(cFieldSep, true);
         }
         break;
         case Destination::FIELDRESULT:
@@ -2569,7 +2569,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& 
rState)
             str = OUString::Concat(field) + " \"" + str.replaceAll("\"", 
"\\"") + "\"";
             singleChar(cFieldStart);
             Mapper().utext(str.getStr(), str.getLength());
-            singleChar(cFieldSep);
+            singleChar(cFieldSep, true);
             // no result
             singleChar(cFieldEnd);
         }

Reply via email to