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 1b0b11db497f76faf576d28e11860c3502f8deb2
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Wed Dec 6 14:40:15 2023 +0300
Commit:     Vasily Melenchuk <vasily.melenc...@cib.de>
CommitDate: Tue Feb 6 13:27:06 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>

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 0c7365260b56..e88461102dfb 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -709,6 +709,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"));
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 2da578e181c4..0853cfa1b600 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2359,7 +2359,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& 
rState)
 
             if (m_aStates.top().isFieldLocked())
                 singleChar(cFieldLock);
-            singleChar(cFieldSep);
+            singleChar(cFieldSep, true);
         }
         break;
         case Destination::FIELDRESULT:
@@ -2586,7 +2586,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