eb9ad22
From 1ff5ecda9ccfcf3e65e90c404db93fcbbefb889e Mon Sep 17 00:00:00 2001
3abc148
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
eb9ad22
Date: Mon, 7 Sep 2015 16:37:22 +0100
3abc148
Subject: [PATCH] Related: tdf#93676 msword wraps slightly differently than us
3abc148
eb9ad22
Change-Id: I91ba41cb052c38aa3b047cf079090b01bbe93b39
3abc148
---
eb9ad22
 sw/source/filter/ww8/wrtw8esh.cxx | 17 +++++++++++++++--
eb9ad22
 1 file changed, 15 insertions(+), 2 deletions(-)
3abc148
3abc148
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
eb9ad22
index 763fb44..fd6dfbc 100644
3abc148
--- a/sw/source/filter/ww8/wrtw8esh.cxx
3abc148
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
eb9ad22
@@ -803,6 +803,19 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
eb9ad22
 
eb9ad22
             SwTwips nLeft = aRect.Left() + nThick;
eb9ad22
             SwTwips nRight = aRect.Right() - nThick;
eb9ad22
+            SwTwips nTop = aRect.Top() + nThick;
eb9ad22
+            SwTwips nBottom = aRect.Bottom() - nThick;
eb9ad22
+
eb9ad22
+            // tdf#93675, 0 below line/paragraph and/or top line/paragraph with
eb9ad22
+            // wrap top+bottom or other wraps is affecting the line directly
eb9ad22
+            // above the anchor line, which seems odd, but a tiny adjustment
eb9ad22
+            // here to bring the top down convinces msoffice to wrap like us
eb9ad22
+            if (nTop < 8 && !rFrameFormat.IsInline() &&
eb9ad22
+                rVOr.GetVertOrient() == text::VertOrientation::NONE &&
eb9ad22
+                rVOr.GetRelationOrient() == text::RelOrientation::FRAME)
eb9ad22
+            {
eb9ad22
+                nTop = 8;
eb9ad22
+            }
eb9ad22
 
eb9ad22
             //Nasty swap for bidi if necessary
eb9ad22
             rWrt.MiserableRTLFrameFormatHack(nLeft, nRight, rFrameFormat);
eb9ad22
@@ -811,9 +824,9 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
eb9ad22
             //(most of) the border is outside the graphic is word, so
eb9ad22
             //change dimensions to fit
eb9ad22
             SwWW8Writer::WriteLong(*rWrt.pTableStrm, nLeft);
eb9ad22
-            SwWW8Writer::WriteLong(*rWrt.pTableStrm,aRect.Top() + nThick);
eb9ad22
+            SwWW8Writer::WriteLong(*rWrt.pTableStrm, nTop);
eb9ad22
             SwWW8Writer::WriteLong(*rWrt.pTableStrm, nRight);
eb9ad22
-            SwWW8Writer::WriteLong(*rWrt.pTableStrm,aRect.Bottom() - nThick);
eb9ad22
+            SwWW8Writer::WriteLong(*rWrt.pTableStrm, nBottom);
eb9ad22
 
eb9ad22
             //fHdr/bx/by/wr/wrk/fRcaSimple/fBelowText/fAnchorLock
eb9ad22
             sal_uInt16 nFlags=0;
3abc148
-- 
eb9ad22
2.1.0
3abc148