summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2019-09-26 12:43:02 +0200
committerLászló Németh <nemeth@numbertext.org>2019-10-01 16:36:33 +0200
commit93ebf6a85f699e0594e05374ac37f8e582292d4f (patch)
treea6fcf52102be873b37332afd47b7ecda1e6ee578 /sw
parent8f5f2ec5d1055f2bb81ad05e23280c51f5e6eb27 (diff)
tdf#81100 DOCX: keep "repeat table header" table style setting
during round trip by grab-bagging //tblStylePr/trPr/tblHeader. Change-Id: Id9d3150ca48031791aeda19c126bc4d4ac16fb8f Reviewed-on: https://gerrit.libreoffice.org/79597 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf81100.docxbin0 -> 19329 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx8
-rw-r--r--sw/source/filter/ww8/docxtablestyleexport.cxx22
3 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf81100.docx b/sw/qa/extras/ooxmlexport/data/tdf81100.docx
new file mode 100644
index 000000000000..61038d190c7e
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf81100.docx
Binary files differ
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);