DOCX import: fix position of floating tables

Change-Id: I542acfd3215dcc7bbc2de49c567f73de0cda97a7
diff --git a/sw/qa/extras/ooxmlexport/data/floating-table-position.docx b/sw/qa/extras/ooxmlexport/data/floating-table-position.docx
new file mode 100644
index 0000000..de7a467
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/floating-table-position.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 9514031..a7ea175 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3276,6 +3276,18 @@ DECLARE_OOXMLEXPORT_TEST(testNestedTextFrames, "nested-text-frames.odt")
    assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:t", 3);
}

DECLARE_OOXMLEXPORT_TEST(testFloatingTablePosition, "floating-table-position.docx")
{
    // Position of text frame was wrong, because some conversion was missing.
    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
    uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
    uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
    // This was 3295.
    CPPUNIT_ASSERT_EQUAL(sal_Int32(5964), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
    // This was 4611.
    CPPUNIT_ASSERT_EQUAL(sal_Int32(8133), getProperty<sal_Int32>(xFrame, "VertOrientPosition"));
}

#endif

CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/TablePositionHandler.cxx b/writerfilter/source/dmapper/TablePositionHandler.cxx
index 4c08bc9..6909f71 100644
--- a/writerfilter/source/dmapper/TablePositionHandler.cxx
+++ b/writerfilter/source/dmapper/TablePositionHandler.cxx
@@ -150,7 +150,7 @@ uno::Sequence<beans::PropertyValue> TablePositionHandler::getTablePosition() con
    pFrameProperties[13].Name = "HoriOrientRelation";
    pFrameProperties[13].Value <<= nHoriOrientRelation;
    pFrameProperties[14].Name = "HoriOrientPosition";
    pFrameProperties[14].Value <<= m_nX;
    pFrameProperties[14].Value <<= ConversionHelper::convertTwipToMM100(m_nX);


    // Vertical positioning
@@ -177,7 +177,7 @@ uno::Sequence<beans::PropertyValue> TablePositionHandler::getTablePosition() con
    pFrameProperties[16].Name = "VertOrientRelation";
    pFrameProperties[16].Value <<= nVertOrientRelation;
    pFrameProperties[17].Name = "VertOrientPosition";
    pFrameProperties[17].Value <<= m_nY;
    pFrameProperties[17].Value <<= ConversionHelper::convertTwipToMM100(m_nY);

    return aFrameProperties;
}