sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 5 ++--- sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 7 ++++--- writerfilter/source/dmapper/StyleSheetTable.cxx | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-)
New commits: commit 0b5bf474d873fce11cc0f78d73f7e9656c95ffe8 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Mon Mar 16 12:34:30 2020 +0300 Commit: Justin Luth <justin_l...@sil.org> CommitDate: Tue Mar 17 16:52:05 2020 +0100 tdf#131071 writerfilter: tableStyle uses DocDefaults It is kinda surprising to me, but the tableStyle actually includes DocDefaults in its style properties. You would expect that to be irrelevant, because if even the default style specifies a setting, it overrides the table style. Therefore they would either both match DocDefaults, or the style would have specified a value (thus overriding tablestyle). But in the specific default case of overrideTableStyleSizeAndJustification == false, a left alignment or a fontsize of 11 or 12 are overridden by the table style. Perhaps this should ONLY import those two settings in DocDefaults, but obviously the concept is there, so it shouldn't hurt to import the whole thing as that likely is the correct response for other situations as well. Change-Id: Ie2494855fa37c9a21d27d0e15f4da1fa0a216be6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90558 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 45d7c26addeb..48e6788b2687 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -347,9 +347,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf118947_tableStyle, "tdf118947_tableStyle.docx") xParaEnum = xParaEnumAccess->createEnumeration(); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("Notice that this is 8pt font in compatibility mode."), xPara->getString()); - // Even though not specified, Table-Style distributes the DocDefault font/justification unless overrideTableStyleFontSizeAndJustification. - // DocDefault is 8pt. - //CPPUNIT_ASSERT_EQUAL_MESSAGE("Compat mode has 8pt font size", 8.f, getProperty<float>(xPara, "CharHeight")); + // Even though not specified, Table-Style distributes the properties in DocDefault. DocDefault fontsize is 8pt. + CPPUNIT_ASSERT_EQUAL_MESSAGE("Compat mode has 8pt font size", 8.f, getProperty<float>(getRun(xPara,1), "CharHeight")); CPPUNIT_ASSERT_EQUAL_MESSAGE("Normal has 0pt space below paragraph", sal_Int32(0), getProperty<sal_Int32>(xPara, "ParaBottomMargin")); CPPUNIT_ASSERT_EQUAL_MESSAGE("Table sets 10pt space above paragraph", sal_Int32(353), getProperty<sal_Int32>(xPara, "ParaTopMargin")); CPPUNIT_ASSERT_EQUAL_MESSAGE("Table style sets 0 right margin", sal_Int32(0), getProperty<sal_Int32>(xPara, "ParaRightMargin")); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index cbaa68ff0d0e..9b416057ecf0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -459,9 +459,10 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128752, "tdf128752.docx") DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf119054, "tdf119054.docx") { xmlDocPtr pXmlDoc = parseExport(); - // Don't overwrite before and after spacing of Heading2 by table style - assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "before"); - assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "after"); + // Don't overwrite before and after spacing of Heading2 by table style. + // Heading2 overrides table style's values from DocDefaults. + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "before", "0"); + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "after", "360"); // Use table style based single line spacing instead of the docDefaults' 254 assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "line", "240"); } diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index e6e4b93acdf4..f3dfe000c55b 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -1208,6 +1208,10 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) // If this is a table style, save its contents as-is for roundtrip purposes. TableStyleSheetEntry* pTableEntry = static_cast<TableStyleSheetEntry *>(pEntry.get()); aTableStylesVec.push_back(pTableEntry->GetInteropGrabBag()); + + // if DocDefaults exist, MS Word includes these in the table style definition. + pEntry->pProperties->InsertProps( m_pImpl->m_pDefaultCharProps, /*bOverwrite=*/false ); + pEntry->pProperties->InsertProps( m_pImpl->m_pDefaultParaProps, /*bOverwrite=*/false ); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits