diff options
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf81100.docx | bin | 0 -> 19329 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxtablestyleexport.cxx | 22 | ||||
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.cxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/TblStylePrHandler.cxx | 11 |
5 files changed, 42 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf81100.docx b/sw/qa/extras/ooxmlexport/data/tdf81100.docx Binary files differnew file mode 100644 index 000000000000..61038d190c7e --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf81100.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 953f6d3de38b..47d5500a76f4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -968,6 +968,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf58944RepeatingTableHeader, "tdf58944-repeating-t parseDump("/root/page[2]/body/tab/row[2]/cell[1]/txt/text()")); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf81100, "tdf81100.docx") +{ + xmlDocPtr pXmlDoc = parseExport("word/styles.xml"); + CPPUNIT_ASSERT(pXmlDoc); + // keep "repeat table header" setting of table styles + assertXPath(pXmlDoc, "/w:styles/w:style/w:tblStylePr/w:trPr/w:tblHeader", 4); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121597TrackedDeletionOfMultipleParagraphs, "tdf121597.odt") { xmlDocPtr pXmlDoc = parseExport("word/document.xml"); diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx index 050da668447c..b67151ed204b 100644 --- a/sw/source/filter/ww8/docxtablestyleexport.cxx +++ b/sw/source/filter/ww8/docxtablestyleexport.cxx @@ -66,6 +66,8 @@ public: void tableStylePSpacing(const uno::Sequence<beans::PropertyValue>& rSpacing); /// Export of w:tblPr. void tableStyleTablePr(const uno::Sequence<beans::PropertyValue>& rTablePr); + /// Export of w:trPr. + void tableStyleTrPr(const uno::Sequence<beans::PropertyValue>& rTrPr); /// Export of w:tcPr. void tableStyleTcPr(const uno::Sequence<beans::PropertyValue>& rTcPr); /// Export of w:tcBorders (and w:tblBorders). @@ -551,6 +553,22 @@ void DocxTableStyleExport::Impl::tableStyleTablePr( m_pSerializer->endElementNS(XML_w, XML_tblPr); } +void DocxTableStyleExport::Impl::tableStyleTrPr(const uno::Sequence<beans::PropertyValue>& rTrPr) +{ + if (!rTrPr.hasElements()) + return; + + m_pSerializer->startElementNS(XML_w, XML_trPr); + + for (const auto& rProp : rTrPr) + { + if (rProp.Name == "tblHeader") + m_pSerializer->singleElementNS(XML_w, XML_tblHeader); + } + + m_pSerializer->endElementNS(XML_w, XML_trPr); +} + void DocxTableStyleExport::Impl::tableStyleTcPr(const uno::Sequence<beans::PropertyValue>& rTcPr) { if (!rTcPr.hasElements()) @@ -592,6 +610,7 @@ void DocxTableStyleExport::Impl::tableStyleTableStylePr( uno::Sequence<beans::PropertyValue> aPPr; uno::Sequence<beans::PropertyValue> aRPr; uno::Sequence<beans::PropertyValue> aTablePr; + uno::Sequence<beans::PropertyValue> aTrPr; uno::Sequence<beans::PropertyValue> aTcPr; for (const auto& rProp : rTableStylePr) { @@ -603,6 +622,8 @@ void DocxTableStyleExport::Impl::tableStyleTableStylePr( aRPr = rProp.Value.get<uno::Sequence<beans::PropertyValue>>(); else if (rProp.Name == "tblPr") aTablePr = rProp.Value.get<uno::Sequence<beans::PropertyValue>>(); + else if (rProp.Name == "trPr") + aTrPr = rProp.Value.get<uno::Sequence<beans::PropertyValue>>(); else if (rProp.Name == "tcPr") aTcPr = rProp.Value.get<uno::Sequence<beans::PropertyValue>>(); } @@ -618,6 +639,7 @@ void DocxTableStyleExport::Impl::tableStyleTableStylePr( // Even if we have an empty container, write it out, as Word does. m_pSerializer->singleElementNS(XML_w, XML_tblPr); } + tableStyleTrPr(aTrPr); tableStyleTcPr(aTcPr); m_pSerializer->endElementNS(XML_w, XML_tblStylePr); diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 5dcc856ca564..4b305abf17c6 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -577,7 +577,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) pProperties->resolve(*pTblStylePrHandler); StyleSheetEntry* pEntry = m_pImpl->m_pCurrentEntry.get(); TableStyleSheetEntry& rTableEntry = dynamic_cast<TableStyleSheetEntry&>(*pEntry); - rTableEntry.AppendInteropGrabBag(pTblStylePrHandler->getInteropGrabBag("tcPr")); + rTableEntry.AppendInteropGrabBag(pTblStylePrHandler->getInteropGrabBag((nSprmId == NS_ooxml::LN_CT_Style_tcPr) ? OUString("tcPr") : OUString("trPr"))); // This is a <w:tcPr> directly under <w:style>, so it affects the whole table. rTableEntry.pProperties->InsertProps(pTblStylePrHandler->getProperties()); diff --git a/writerfilter/source/dmapper/TblStylePrHandler.cxx b/writerfilter/source/dmapper/TblStylePrHandler.cxx index 92b5e53cc7ee..c47042f30b53 100644 --- a/writerfilter/source/dmapper/TblStylePrHandler.cxx +++ b/writerfilter/source/dmapper/TblStylePrHandler.cxx @@ -137,6 +137,7 @@ void TblStylePrHandler::lcl_sprm(Sprm & rSprm) bool bGrabBag = rSprm.getId() == NS_ooxml::LN_CT_PPrBase || rSprm.getId() == NS_ooxml::LN_EG_RPrBase || rSprm.getId() == NS_ooxml::LN_CT_TblPrBase || + rSprm.getId() == NS_ooxml::LN_CT_TrPrBase || rSprm.getId() == NS_ooxml::LN_CT_TcPrBase; if (bGrabBag) { @@ -151,12 +152,22 @@ void TblStylePrHandler::lcl_sprm(Sprm & rSprm) aSavedGrabBag.push_back(getInteropGrabBag("rPr")); else if (rSprm.getId() == NS_ooxml::LN_CT_TblPrBase) aSavedGrabBag.push_back(getInteropGrabBag("tblPr")); + else if (rSprm.getId() == NS_ooxml::LN_CT_TrPrBase) + aSavedGrabBag.push_back(getInteropGrabBag("trPr")); else if (rSprm.getId() == NS_ooxml::LN_CT_TcPrBase) aSavedGrabBag.push_back(getInteropGrabBag("tcPr")); std::swap(m_aInteropGrabBag, aSavedGrabBag); } } break; + case NS_ooxml::LN_CT_TrPrBase_tblHeader: + { + beans::PropertyValue aValue; + aValue.Name = "tblHeader"; + aValue.Value <<= true; + m_aInteropGrabBag.push_back(aValue); + } + break; default: // Tables specific properties have to handled here m_pTablePropsHandler->SetProperties( m_pProperties ); |