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...

62 lines
2.8 KiB

From d9aed0bc2e741fa02a6ffdf90193aae7ce471e52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Tue, 8 Sep 2015 09:45:12 +0100
Subject: [PATCH] Related: tdf#93676 msword wraps slightly differently than us
Change-Id: I688d4d193709d9c9829065c87f0d656a94fd9f16
---
sw/source/filter/ww8/docxsdrexport.cxx | 16 +++++++++++++++-
sw/source/filter/ww8/wrtw8esh.cxx | 2 +-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 02b134a..71a357e 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -516,6 +516,21 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
}
m_pImpl->m_pSerializer->endElementNS(XML_wp, XML_positionH);
m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_positionV, XML_relativeFrom, relativeFromV, FSEND);
+
+ sal_Int64 nTwipstoEMU = TwipsToEMU(aPos.Y);
+
+ // 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 (nTwipstoEMU == 0 &&
+ (strcmp(relativeFromV, "line") == 0 || strcmp(relativeFromV, "paragraph") == 0) &&
+ (!alignV || strcmp(alignV, "top") == 0))
+ {
+ alignV = NULL;
+ nTwipstoEMU = 635;
+ }
+
if (alignV != NULL)
{
m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_align, FSEND);
@@ -525,7 +540,6 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
else
{
m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_posOffset, FSEND);
- sal_Int64 nTwipstoEMU = TwipsToEMU(aPos.Y);
if (nTwipstoEMU > MAX_INTEGER_VALUE)
{
nTwipstoEMU = MAX_INTEGER_VALUE;
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index fd6dfbc..2b7cebe 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -810,7 +810,7 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
// 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() &&
+ if (nTop == 0 && !rFrameFormat.IsInline() &&
rVOr.GetVertOrient() == text::VertOrientation::NONE &&
rVOr.GetRelationOrient() == text::RelOrientation::FRAME)
{
--
2.4.3