sw/qa/extras/uiwriter/data2/tdf90069.docx |binary sw/qa/extras/uiwriter/uiwriter2.cxx | 31 ++++++++++++++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 13 +++++++++ 3 files changed, 44 insertions(+)
New commits: commit 725de1dadf1eb35771278e2f671eb36056153454 Author: László Németh <nem...@numbertext.org> AuthorDate: Wed Jan 8 14:26:40 2020 +0100 Commit: Gabor Kelemen <kelemen.gab...@nisz.hu> CommitDate: Thu Jun 11 13:46:47 2020 +0200 tdf#90069 DOCX: fix character style of new table rows DOCX table import didn't set paragraph level character styles on paragraph level, only on text portions, resulting default character style in the newly inserted table rows instead of copying the style of the previous table row. Change-Id: Idb4438c767bdc7e0026fc6e0f0a795d8efdda3c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86429 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> Tested-by: László Németh <nem...@numbertext.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96086 Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu> diff --git a/sw/qa/extras/uiwriter/data2/tdf90069.docx b/sw/qa/extras/uiwriter/data2/tdf90069.docx new file mode 100644 index 000000000000..719502a67e78 Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf90069.docx differ diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 6472929fc5ab..949c04514da8 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -49,6 +49,7 @@ #include <postithelper.hxx> #include <fmtcntnt.hxx> #include <shellio.hxx> +#include <editeng/fontitem.hxx> namespace { @@ -2469,4 +2470,34 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf129655) xmlDocPtr pXmlDoc = parseLayoutDump(); assertXPath(pXmlDoc, "//fly/txt[@WritingMode='Vertical']", 1); } + +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf90069) +{ + SwDoc* pDoc = createDoc("tdf90069.docx"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + SwDocShell* pDocShell = pTextDoc->GetDocShell(); + CPPUNIT_ASSERT(pDocShell); + + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell); + + sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + + lcl_dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {}); + pWrtShell->Down(false); + pWrtShell->Insert("foo"); + + SwTextNode* pTextNodeA1 = static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex]); + CPPUNIT_ASSERT(pTextNodeA1->GetText().startsWith("Insert")); + nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwTextNode* pTextNodeA2 = static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex]); + CPPUNIT_ASSERT_EQUAL(OUString("foo"), pTextNodeA2->GetText()); + CPPUNIT_ASSERT_EQUAL(true, pTextNodeA2->GetSwAttrSet().HasItem(RES_CHRATR_FONT)); + OUString sFontName = pTextNodeA2->GetSwAttrSet().GetItem(RES_CHRATR_FONT)->GetFamilyName(); + CPPUNIT_ASSERT_EQUAL(OUString("Lohit Devanagari"), sFontName); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index a04af3c1c8aa..666bd9b46ffb 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1785,6 +1785,19 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con } } } + + // tdf#90069 in tables, apply paragraph level character style also on + // paragraph level to support its copy during insertion of new table rows + if ( xParaProps && m_nTableDepth > 0 ) + { + uno::Sequence< beans::PropertyValue > aValues = pParaContext->GetPropertyValues(false); + + for( const auto& rProp : std::as_const(aValues) ) + { + if ( rProp.Name.startsWith("Char") && rProp.Name != "CharStyleName" && rProp.Name != "CharInteropGrabBag" ) + xParaProps->setPropertyValue( rProp.Name, rProp.Value ); + } + } } if( !bKeepLastParagraphProperties ) rAppendContext.pLastParagraphProperties = pToBeSavedProperties; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits