You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libreoffice/0001-Related-tdf-93676-mswo...

50 lines
2.2 KiB

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