summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorRavindra Vidhate <ravindra.vidhate@synerzip.com>2014-04-28 15:05:54 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-05-06 09:57:59 +0200
commitcbcc6189e300b6aa5e9e8e6883598a4d28b770c0 (patch)
treeb4641e4d761e85ef12944e8a7b5d7b434fe235ed /sw
parenta4ff20eefaa52f97bacbdb2db16ae5b05a71f536 (diff)
fdo#77887 : Floating Table positions are not preserved when doing Export
The margin of the floating table from top of the page is not being preserved correctly and it also get increased. The w:tblpPr tag is also not preserved. Reviewed on: https://gerrit.libreoffice.org/9185 Change-Id: I8a27a4bab94a1afd27a7ba49ca55ff014918fffc
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo77887.docxbin0 -> 39281 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx17
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx57
3 files changed, 74 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo77887.docx b/sw/qa/extras/ooxmlexport/data/fdo77887.docx
new file mode 100644
index 000000000000..cb3f4537dd86
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo77887.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 44b9aa730046..55b08e703b06 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3174,6 +3174,23 @@ DECLARE_OOXMLEXPORT_TEST(testFDO77117, "fdo77117.docx")
CPPUNIT_ASSERT_EQUAL(11.f, getProperty<float>(xShape, "CharHeight"));
}
+DECLARE_OOXMLEXPORT_TEST(testFloatingTable, "fdo77887.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+
+ if (!pXmlDoc)
+ return;
+
+ assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "horzAnchor", "margin");
+ assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "leftFromText", "141");
+ assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "rightFromText", "141");
+ assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "tblpXSpec", "center");
+ assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "tblpY", "2266");
+ assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:tbl[1]/w:tblPr[1]/w:tblpPr[1]", "vertAnchor", "page");
+
+}
+
+
DECLARE_OOXMLEXPORT_TEST(testFDO75431, "fdo75431.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 7fd9a37eba7d..66b1b260441a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2728,6 +2728,63 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
m_aTableStyleConf[ BOX_LINE_LEFT ] = aGrabBagElement->second.get<table::BorderLine2>();
else if( aGrabBagElement->first == "TableStyleRightBorder" )
m_aTableStyleConf[ BOX_LINE_RIGHT ] = aGrabBagElement->second.get<table::BorderLine2>();
+ else if (aGrabBagElement->first == "TablePosition" )
+ {
+ FastAttributeList *attrListTablePos = m_pSerializer->createAttrList( );
+ uno::Sequence<beans::PropertyValue> aTablePosition = aGrabBagElement->second.get<uno::Sequence<beans::PropertyValue> >();
+ for (sal_Int32 i = 0; i < aTablePosition.getLength(); ++i)
+ {
+ if (aTablePosition[i].Name == "vertAnchor")
+ {
+ OString strTemp = OUStringToOString(aTablePosition[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8);
+ attrListTablePos->add( FSNS( XML_w, XML_vertAnchor ), strTemp.getStr() );
+ }
+ else if (aTablePosition[i].Name == "tblpYSpec")
+ {
+ OString strTemp = OUStringToOString(aTablePosition[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8);
+ attrListTablePos->add( FSNS( XML_w, XML_tblpYSpec ), strTemp.getStr() );
+ }
+ else if (aTablePosition[i].Name == "horzAnchor")
+ {
+ OString strTemp = OUStringToOString(aTablePosition[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8);
+ attrListTablePos->add( FSNS( XML_w, XML_horzAnchor ), strTemp.getStr() );
+ }
+ else if (aTablePosition[i].Name == "tblpXSpec")
+ {
+ OString strTemp = OUStringToOString(aTablePosition[i].Value.get<OUString>(), RTL_TEXTENCODING_UTF8);
+ attrListTablePos->add( FSNS( XML_w, XML_tblpXSpec ), strTemp.getStr() );
+ }
+ else if (aTablePosition[i].Name == "bottomFromText")
+ {
+ attrListTablePos->add( FSNS( XML_w, XML_bottomFromText ), OString::number( aTablePosition[i].Value.get<sal_Int32>() ) );
+ }
+ else if (aTablePosition[i].Name == "leftFromText")
+ {
+ attrListTablePos->add( FSNS( XML_w, XML_leftFromText ), OString::number( aTablePosition[i].Value.get<sal_Int32>() ) );
+ }
+ else if (aTablePosition[i].Name == "rightFromText")
+ {
+ attrListTablePos->add( FSNS( XML_w, XML_rightFromText ), OString::number( aTablePosition[i].Value.get<sal_Int32>() ) );
+ }
+ else if (aTablePosition[i].Name == "topFromText")
+ {
+ attrListTablePos->add( FSNS( XML_w, XML_topFromText ), OString::number( aTablePosition[i].Value.get<sal_Int32>() ) );
+ }
+ else if (aTablePosition[i].Name == "tblpX")
+ {
+ attrListTablePos->add( FSNS( XML_w, XML_tblpX ), OString::number( aTablePosition[i].Value.get<sal_Int32>() ) );
+ }
+ else if (aTablePosition[i].Name == "tblpY")
+ {
+ attrListTablePos->add( FSNS( XML_w, XML_tblpY ), OString::number( aTablePosition[i].Value.get<sal_Int32>() ) );
+ }
+ }
+
+ XFastAttributeListRef xAttrListTablePosRef( attrListTablePos );
+
+ m_pSerializer->singleElementNS( XML_w, XML_tblpPr, xAttrListTablePosRef);
+ attrListTablePos = NULL;
+ }
}
// Output the table alignement