[Libreoffice-commits] core.git: sw/qa sw/source
Justin Luth
justin_luth at sil.org
Mon Sep 4 16:10:11 UTC 2017
sw/qa/extras/ooxmlexport/data/tdf37153_considerWrapOnObjPos.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 18 ++++++++++
sw/source/core/layout/tabfrm.cxx | 4 +-
3 files changed, 20 insertions(+), 2 deletions(-)
New commits:
commit e56f61c4637c09afbf125fa02f131b0c49e36351
Author: Justin Luth <justin_luth at sil.org>
Date: Fri Sep 1 22:37:13 2017 -0400
tdf#37153 ConsiderWrapOnObjPos: always affect anchoring cell
MSO doesn't make a distinction where the object is located -
whether it is contained within the boundaries of the anchoring
cell or not. It always affects the anchoring cell's vertical
orientation.
Both DOC and DOCX enable this compatibility setting.
Change-Id: Ifa066d3549b1a6183360b5b01c659e41c681d492
Reviewed-on: https://gerrit.libreoffice.org/41821
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf37153_considerWrapOnObjPos.docx b/sw/qa/extras/ooxmlexport/data/tdf37153_considerWrapOnObjPos.docx
new file mode 100644
index 000000000000..d89baaf084a2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf37153_considerWrapOnObjPos.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 7dbd94bb910f..43639f622cac 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/view/XViewSettingsSupplier.hpp>
#include <com/sun/star/style/LineSpacing.hpp>
#include <com/sun/star/style/LineSpacingMode.hpp>
@@ -568,6 +569,23 @@ DECLARE_OOXMLEXPORT_TEST(testTdf99227, "tdf99227.docx")
assertXPath(pXmlDoc, "//w:footnote/w:p/w:r/w:drawing", 1);
}
+DECLARE_OOXMLEXPORT_TEST(testTdf37153, "tdf37153_considerWrapOnObjPos.docx")
+{
+ 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 textbox 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 2865, not 5649", nFlyTop < sal_Int32(3000));
+ sal_Int32 nTextTop = getXPath(pXmlDoc, "/root/page/body/tab/row/cell[2]/txt[1]/infos/bounds", "top").toInt32();
+ CPPUNIT_ASSERT_MESSAGE("TextTop should be 3856", nTextTop > 3000);
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf82173_footnoteStyle, "tdf82173_footnoteStyle.docx")
{
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 34420867ca42..efcc0df63223 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -4974,7 +4974,8 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
for (SwAnchoredObject* pAnchoredObj : *pPg->GetSortedObjs())
{
SwRect aTmp( pAnchoredObj->GetObjRect() );
- if ( aTmp.IsOver( aRect ) )
+ const SwFrame* pAnch = pAnchoredObj->GetAnchorFrame();
+ if ( (bConsiderWrapOnObjPos && IsAnLower( pAnch )) || (!bConsiderWrapOnObjPos && aTmp.IsOver( aRect )) )
{
const SwFrameFormat& rAnchoredObjFrameFormat = pAnchoredObj->GetFrameFormat();
const SwFormatSurround &rSur = rAnchoredObjFrameFormat.GetSurround();
@@ -4990,7 +4991,6 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
continue;
}
- const SwFrame* pAnch = pAnchoredObj->GetAnchorFrame();
// #i43913#
// #i52904# - no vertical alignment,
// if object, anchored inside cell, has temporarily
More information about the Libreoffice-commits
mailing list