[Libreoffice-commits] core.git: sw/qa writerfilter/source

Zolnai Tamás tamas.zolnai at collabora.com
Mon Feb 17 17:26:41 CET 2014


 sw/qa/extras/ooxmlexport/data/floating-table-position.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                   |   12 ++++++++++++
 writerfilter/source/dmapper/TablePositionHandler.cxx       |    4 ++--
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit f4ae06c6b558628457f3abdade1f2a705bf8b886
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Feb 17 14:43:15 2014 +0100

    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
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/floating-table-position.docx 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;
 }


More information about the Libreoffice-commits mailing list