summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-02-07 15:06:50 +0100
committerGabor Kelemen <kelemen.gabor2@nisz.hu>2020-09-23 19:20:11 +0200
commit4af97fd43ae8761b39a8e7bdb49915177d5c07ea (patch)
tree07190fda2b388a2dee896983b7484a907f813546
parent28c8c7727bb8d9f1f15f8ca334a000b97cf71132 (diff)
tdf#130494: DOCX import: limit paragraph-level character property
expansion for the whole table paragraph based on the last character context. regression from 2ab481b038b62b1ff576ac4d49d03c1798cd7f84 (tdf#90069 DOCX: fix character style of new table rows) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88199 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit abb9c7db8bcc06f907d39a7811711882161d5803) Change-Id: I49da23c268436488ff1537771869c38108113c12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103198 Tested-by: Gabor Kelemen <kelemen.gabor2@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gabor2@nisz.hu>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf130494.docxbin0 -> 17455 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx8
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx19
3 files changed, 23 insertions, 4 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf130494.docx b/sw/qa/extras/ooxmlexport/data/tdf130494.docx
new file mode 100644
index 000000000000..bc2050feaa55
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf130494.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index cf2766ac2b45..0a3d0a7b8aa3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -1133,6 +1133,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf88496, "tdf88496.docx")
CPPUNIT_ASSERT_EQUAL(3, getPages());
}
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf130494, "tdf130494.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:pPr/w:rPr/w:highlight", "val", "yellow");
+ // keep direct formatting of table cell paragraph with removed highlighting
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r/w:rPr/w:highlight", 0);
+}
+
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 67ec8b869544..b62f83c9b8c6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1801,14 +1801,25 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
// fix table paragraph properties
if ( xParaProps && m_nTableDepth > 0 )
{
- uno::Sequence< beans::PropertyValue > aValues = pParaContext->GetPropertyValues(false);
+ uno::Sequence< beans::PropertyValue > aParaProps = pParaContext->GetPropertyValues(false);
// tdf#90069 in tables, apply paragraph level character style also on
// paragraph level to support its copy during insertion of new table rows
- for( const auto& rProp : std::as_const(aValues) )
+ for( const auto& rParaProp : std::as_const(aParaProps) )
{
- if ( rProp.Name.startsWith("Char") && rProp.Name != "CharStyleName" && rProp.Name != "CharInteropGrabBag" )
- xParaProps->setPropertyValue( rProp.Name, rProp.Value );
+ if ( m_pLastCharacterContext.get() && rParaProp.Name.startsWith("Char") && rParaProp.Name != "CharStyleName" && rParaProp.Name != "CharInteropGrabBag" )
+ {
+ const uno::Sequence< beans::PropertyValue > aLastCharProps = m_pLastCharacterContext->GetPropertyValues( );
+
+ for( const auto& rLastCharProp : std::as_const(aLastCharProps) )
+ {
+ if ( rLastCharProp == rParaProp )
+ {
+ xParaProps->setPropertyValue( rParaProp.Name, rParaProp.Value );
+ break;
+ }
+ }
+ }
}
// tdf#128959 table paragraphs haven't got window and orphan controls