[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Feb 27 06:22:57 PST 2014
sw/qa/extras/ooxmlexport/data/table.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 14 ++++++++++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 10 ++++++++--
3 files changed, 22 insertions(+), 2 deletions(-)
New commits:
commit 743d90ca384ae71b57eaf2b99fb7da68fc381215
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Feb 27 14:43:21 2014 +0100
DOCX export: fix order of table border elements
Change-Id: I17d8634017c5b0374d30501186b338ddedbcd7ea
diff --git a/sw/qa/extras/ooxmlexport/data/table.odt b/sw/qa/extras/ooxmlexport/data/table.odt
new file mode 100644
index 0000000..25b2a5f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/table.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 658ef03..400745e 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 dea9e5b..09bfa06 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 );
}
More information about the Libreoffice-commits
mailing list