From 8f8c71f4633bab43b2a2b3251b0c6ab69ab8b21a Mon Sep 17 00:00:00 2001 From: László Németh Date: Wed, 18 Mar 2020 13:56:17 +0100 Subject: tdf#105215 DOCX import: fix paragraph-length direct formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in table cells. Paragraph-level direct character formatting (w:p/w:pPr/w:rPr) overwrote portion formatting (w:r/w:rPr), if the same formatting was applied on all portions of the paragraph. Note: with this fix, portion level direct character formatting overwrites the paragraph-level direct formatting also in the table row inserted below the actual row, like MSO does. Regression from commit 2ab481b038b62b1ff576ac4d49d03c1798cd7f84 (tdf#90069 DOCX: fix character style of new table rows) See also commit 0045b6f36e5e1445d699f87a0f6597d665b4cfe4 (tdf#130690: DOCX import: fix lost text formatting in cells) Change-Id: Ice47b93e73aed28b09334eda2f26283c68bd0bd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90700 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 5ac6f02fdc6015a5d78071570dee310febf95fc6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103200 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen --- sw/qa/extras/ooxmlexport/data/tdf105215.docx | Bin 0 -> 5654 bytes sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 14 ++++++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf105215.docx diff --git a/sw/qa/extras/ooxmlexport/data/tdf105215.docx b/sw/qa/extras/ooxmlexport/data/tdf105215.docx new file mode 100644 index 000000000000..e464d460b2e1 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf105215.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 6c596b7d1ca3..a10d253c287f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -1150,6 +1150,20 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130690, "tdf130690.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[2]/w:rPr/w:highlight", 0); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf105215, "tdf105215.docx") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:pPr/w:rPr/w:rFonts", "ascii", "Linux Libertine G"); + + // These were "Linux Libertine G" + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r/w:rPr", 5); + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r[1]/w:rPr/w:rFonts", "ascii", "Lohit Devanagari"); + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r[2]/w:rPr/w:rFonts", "ascii", "Lohit Devanagari"); + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r[3]/w:rPr/w:rFonts", "ascii", "Lohit Devanagari"); + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r[4]/w:rPr/w:rFonts", "ascii", "Lohit Devanagari"); + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:r[5]/w:rPr/w:rFonts", "ascii", "Lohit Devanagari"); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121597TrackedDeletionOfMultipleParagraphs, "tdf121597.odt") { xmlDocPtr pXmlDoc = parseExport("word/document.xml"); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 10f587bb750c..96dfd3d0bee5 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1812,7 +1812,8 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con // all text portions contain the same value, so next setPropertyValue() won't overwrite part of them xRunProperties->getPropertyState(rParaProp.Name) == css::beans::PropertyState_DIRECT_VALUE ) { - xParaProps->setPropertyValue( rParaProp.Name, rParaProp.Value ); + uno::Reference xRunPropertySet(xCur, uno::UNO_QUERY); + xParaProps->setPropertyValue( rParaProp.Name, xRunPropertySet->getPropertyValue(rParaProp.Name) ); } } -- cgit