summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-02-27 14:43:21 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-02-27 15:22:35 +0100
commit743d90ca384ae71b57eaf2b99fb7da68fc381215 (patch)
tree034e26afbd4eeabed609c763ec7333b0ce5d305c /sw
parent90b33b30756999298fe20bb3006f4742901de8cb (diff)
DOCX export: fix order of table border elements
Change-Id: I17d8634017c5b0374d30501186b338ddedbcd7ea
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/table.odtbin0 -> 8889 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx14
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx10
3 files changed, 22 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/table.odt b/sw/qa/extras/ooxmlexport/data/table.odt
new file mode 100644
index 000000000000..25b2a5fea235
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/table.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 658ef03e6db6..400745ee34f9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -323,6 +323,20 @@ DECLARE_OOXMLEXPORT_TEST(testMathVerticalStacks, "math-vertical_stacks.docx")
// CHECK_FORMULA( "binom {a} {binom {b} {c}}", getFormula( getRun( getParagraph( 4 ), 1 )));
}
+DECLARE_OOXMLEXPORT_TEST(testTable, "table.odt")
+{
+ // Validation test: order of elements were wrong.
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ // Order was: insideH, end, insideV.
+ int nEnd = getXPathPosition(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblBorders", "end");
+ int nInsideH = getXPathPosition(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblBorders", "insideH");
+ int nInsideV = getXPathPosition(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblBorders", "insideV");
+ CPPUNIT_ASSERT(nEnd < nInsideH);
+ CPPUNIT_ASSERT(nInsideH < nInsideV);
+}
+
DECLARE_OOXMLEXPORT_TEST(testTablePosition, "table-position.docx")
{
sal_Int32 xCoordsFromOffice[] = { 2500, -1000, 0, 0 };
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index dea9e5be791b..09bfa06d7d63 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2119,6 +2119,8 @@ static void impl_borders( FSHelperPtr pSerializer, const SvxBoxItem& rBox, const
bExportDistanceFromPageEdge = true;
}
+ bool bWriteInsideH = false;
+ bool bWriteInsideV = false;
for( int i = 0; i < 4; ++i, ++pBrd )
{
const SvxBorderLine* pLn = rBox.GetLine( *pBrd );
@@ -2186,11 +2188,15 @@ static void impl_borders( FSHelperPtr pSerializer, const SvxBoxItem& rBox, const
// When exporting default borders, we need to export these 2 attr
if ( rOptions.bWriteInsideHV) {
if ( i == 2 )
- impl_borderLine( pSerializer, XML_insideH, pLn, 0 );
+ bWriteInsideH = true;
else if ( i == 3 )
- impl_borderLine( pSerializer, XML_insideV, pLn, 0 );
+ bWriteInsideV = true;
}
}
+ if (bWriteInsideH)
+ impl_borderLine( pSerializer, XML_insideH, rBox.GetLine(BOX_LINE_BOTTOM), 0 );
+ if (bWriteInsideV)
+ impl_borderLine( pSerializer, XML_insideV, rBox.GetLine(BOX_LINE_RIGHT), 0 );
if (tagWritten && rOptions.bWriteTag) {
pSerializer->endElementNS( XML_w, rOptions.tag );
}