sw/qa/extras/ww8export/data/tdf37153_considerWrapOnObjPos.doc |binary
 sw/qa/extras/ww8export/ww8export2.cxx                         |   18 ++++++++++
 sw/source/core/layout/tabfrm.cxx                              |    2 -
 3 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 7a9fb40cb07de8c2ea33f92735be5008d30d6704
Author: Justin Luth <justin_l...@sil.org>
Date:   Fri Sep 1 11:04:03 2017 -0400

    tdf#37153 ConsiderWrapOnObjPos: also affect wrap-thru objs
    
    MSO doesn't make a distinction when the wrapping is THROUGH.
    Both DOC and DOCX enable this compatibility setting.
    
    Change-Id: I123801fc83b5f4ac6a26a5ea77ba6dba2c60ec39
    Reviewed-on: https://gerrit.libreoffice.org/41795
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Justin Luth <justin_l...@sil.org>

diff --git a/sw/qa/extras/ww8export/data/tdf37153_considerWrapOnObjPos.doc 
b/sw/qa/extras/ww8export/data/tdf37153_considerWrapOnObjPos.doc
new file mode 100644
index 000000000000..08ba2f9d52cb
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf37153_considerWrapOnObjPos.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index 1aadcb17326f..f9e69f03cf90 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -18,6 +18,7 @@
 #include <com/sun/star/text/XFootnote.hpp>
 #include <com/sun/star/drawing/XControlShape.hpp>
 #include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
 
 #include <ftninfo.hxx>
 #include <pagedesc.hxx>
@@ -49,6 +50,23 @@ DECLARE_WW8EXPORT_TEST(testTdf41542_borderlessPadding, 
"tdf41542_borderlessPaddi
     CPPUNIT_ASSERT_EQUAL( 3, getPages() );
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf37153, "tdf37153_considerWrapOnObjPos.doc")
+{
+    CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, 
getProperty<text::WrapTextMode>(getShape(1), "Surround"));
+
+    uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> 
xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(text::VertOrientation::BOTTOM, 
getProperty<sal_Int16>(xTable->getCellByName("A1"), "VertOrient"));
+
+    //For MSO compatibility, the image should be at the top of the cell, not 
at the bottom - despite VertOrientation::BOTTOM
+    xmlDocPtr pXmlDoc = parseLayoutDump();
+    sal_Int32 nFlyTop  = getXPath(pXmlDoc, 
"/root/page/body/tab/row/cell[1]/txt/anchored/fly/infos/bounds", 
"top").toInt32();
+    CPPUNIT_ASSERT_MESSAGE("FlyTop should be 3820, not 6623", nFlyTop < 4000);
+    sal_Int32 nTextTop  = getXPath(pXmlDoc, 
"/root/page/body/tab/row/cell[2]/txt[1]/infos/bounds", "top").toInt32();
+    CPPUNIT_ASSERT_MESSAGE("TextTop should be 5388", nTextTop > 4000);
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf49102_mergedCellNumbering, 
"tdf49102_mergedCellNumbering.doc")
 {
     CPPUNIT_ASSERT_EQUAL( OUString("2."), 
parseDump("/root/page/body/tab/row[4]/cell/txt/Special[@nType='POR_NUMBER']", 
"rText") );
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 02dcbffa9dcd..df0a1e0bc1bb 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -4979,7 +4979,7 @@ void SwCellFrame::Format( vcl::RenderContext* 
/*pRenderContext*/, const SwBorder
                     const SwFrameFormat& rAnchoredObjFrameFormat = 
pAnchoredObj->GetFrameFormat();
                     const SwFormatSurround &rSur = 
rAnchoredObjFrameFormat.GetSurround();
 
-                    if ( css::text::WrapTextMode_THROUGH != rSur.GetSurround() 
)
+                    if ( bConsiderWrapOnObjPos || 
css::text::WrapTextMode_THROUGH != rSur.GetSurround() )
                     {
                         // frames, which the cell is a lower of, aren't 
relevant
                         if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) 
!=  nullptr )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to