summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-03-18 13:56:17 +0100
committerLászló Németh <nemeth@numbertext.org>2020-03-19 10:38:31 +0100
commit5ac6f02fdc6015a5d78071570dee310febf95fc6 (patch)
treeadfe36fd5156b86bfd46e5b14221698f98ad7924
parente354b3fb803397fef2a6309fc0cf714a315bedee (diff)
tdf#105215 DOCX import: fix paragraph-length direct formatting
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 <nemeth@numbertext.org>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf105215.docxbin0 -> 5654 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx14
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx3
3 files changed, 16 insertions, 1 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf105215.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 543e228dad45..5cdea4d7ba82 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -1171,6 +1171,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 c8095f2fa689..9e76c5259618 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1869,7 +1869,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<beans::XPropertySet> xRunPropertySet(xCur, uno::UNO_QUERY);
+ xParaProps->setPropertyValue( rParaProp.Name, xRunPropertySet->getPropertyValue(rParaProp.Name) );
}
}