sw/qa/extras/layout/data/tdf128959.docx |binary sw/qa/extras/layout/layout.cxx | 21 ++++++++++++++ sw/qa/extras/ooxmlexport/data/tdf130494.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 8 +++++ sw/qa/extras/uiwriter/data2/tdf90069.docx |binary sw/qa/extras/uiwriter/uiwriter2.cxx | 31 ++++++++++++++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 30 +++++++++++++++++++++ 7 files changed, 90 insertions(+)
New commits: commit 364f9ae0a8b7e9724a3bfe77450e02a5607863b8 Author: László Németh <nem...@numbertext.org> AuthorDate: Fri Feb 7 15:06:50 2020 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri May 15 11:50:46 2020 +0200 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) (cherry picked from commit abb9c7db8bcc06f907d39a7811711882161d5803) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport11.cxx Change-Id: I49da23c268436488ff1537771869c38108113c12 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 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf130494.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 7ec5da49be9f..53631de10210 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -1116,6 +1116,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf81100, "tdf81100.docx") assertXPath(pDump, "/root/page[3]/body/tab/row", 1); } +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 3ad763786c8a..5535db1cc1c5 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1805,14 +1805,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 commit 8bb007a4e4d46fd95b5ff5bc63980d05a279db0c Author: László Németh <nem...@numbertext.org> AuthorDate: Tue Jan 28 14:32:54 2020 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri May 15 11:49:37 2020 +0200 tdf#128959 DOCX import: fix missing text lines in tables Orphan/widow line break settings aren't always ignored by Writer table layout code, in this case, in vertically merged cells, resulting missing paragraph lines. As a workaround for interoperability, disable orphan/widow control in cell paragraphs during the DOCX import to get correct layout in Writer, too. (cherry picked from commit 8b13da71aedd094de0d351a4bd5ad43fdb4bddde) Conflicts: sw/qa/extras/layout/layout.cxx Change-Id: I48fdb0a3bb421fd4df2c729e307a7ef483e3e772 diff --git a/sw/qa/extras/layout/data/tdf128959.docx b/sw/qa/extras/layout/data/tdf128959.docx new file mode 100644 index 000000000000..f22f66504478 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf128959.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 3f90898142ac..edeb877111ee 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3769,6 +3769,27 @@ static SwRect lcl_getVisibleFlyObjRect(SwWrtShell* pWrtShell) return aFlyRect; } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128959) +{ + // no orphan/widow control in table cells + SwDoc* pDocument = createDoc("tdf128959.docx"); + CPPUNIT_ASSERT(pDocument); + discardDumpedLayout(); + xmlDocPtr pXmlDoc = parseLayoutDump(); + + // first two lines of the paragraph in the split table cell on the first page + // (these lines were completely lost) + assertXPath( + pXmlDoc, "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/LineBreak[1]", "Line", + "a)Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue "); + assertXPath( + pXmlDoc, "/root/page[1]/body/tab[1]/row[1]/cell[1]/txt[1]/LineBreak[2]", "Line", + "massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit "); + // last line of the paragraph in the split table cell on the second page + assertXPath(pXmlDoc, "/root/page[2]/body/tab[1]/row[1]/cell[1]/txt[1]/LineBreak[1]", "Line", + "amet commodo magna eros quis urna."); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testStableAtPageAnchoredFlyPosition) { // this doc has two page-anchored frames: one tiny on page 3 and one large on page 4. diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index b063fa466ec9..3ad763786c8a 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1802,17 +1802,23 @@ 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 + // fix table paragraph properties if ( xParaProps && m_nTableDepth > 0 ) { uno::Sequence< beans::PropertyValue > aValues = 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) ) { if ( rProp.Name.startsWith("Char") && rProp.Name != "CharStyleName" && rProp.Name != "CharInteropGrabBag" ) xParaProps->setPropertyValue( rProp.Name, rProp.Value ); } + + // tdf#128959 table paragraphs haven't got window and orphan controls + uno::Any aAny = uno::makeAny(static_cast<sal_Int8>(0)); + xParaProps->setPropertyValue("ParaOrphans", aAny); + xParaProps->setPropertyValue("ParaWidows", aAny); } } if( !bKeepLastParagraphProperties ) commit e110b046b99fe2b61b4dc8af552bf59e809bbd18 Author: László Németh <nem...@numbertext.org> AuthorDate: Wed Jan 8 14:26:40 2020 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri May 15 11:41:35 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. (cherry picked from commit 2ab481b038b62b1ff576ac4d49d03c1798cd7f84) Conflicts: sw/qa/extras/uiwriter/uiwriter2.cxx Change-Id: Idb4438c767bdc7e0026fc6e0f0a795d8efdda3c8 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 619088b0ba45..b063fa466ec9 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1801,6 +1801,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