summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2023-12-06 14:40:15 +0300
committerVasily Melenchuk <vasily.melenchuk@cib.de>2024-02-06 13:27:06 +0100
commit1b0b11db497f76faf576d28e11860c3502f8deb2 (patch)
tree943995c039a0185565a92051f37be7b0a4816a45
parent4b2e61cb8b5429e08f43c5a70eaa1dd27c40ddab (diff)
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.melenchuk@cib.de>
-rw-r--r--sw/qa/extras/rtfexport/data/tdf158409.rtf12
-rw-r--r--sw/qa/extras/rtfexport/rtfexport3.cxx9
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx4
3 files changed, 23 insertions, 2 deletions
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 @@
+{\rtf1
+{\info
+{\title DocTitle}
+}
+{\stylesheet
+{\ql\fs72 Normal;}
+}
+
+\pard\fs16 {\field{\*\fldinst TITLE}}\par
+\pard\fs72 {\rtfch\fs16{\field{\*\fldinst 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);
}