diff --git a/0001-Related-tdf-93676-msword-wraps-slightly-differently-.patch b/0001-Related-tdf-93676-msword-wraps-slightly-differently-.patch index 201e515..2771111 100644 --- a/0001-Related-tdf-93676-msword-wraps-slightly-differently-.patch +++ b/0001-Related-tdf-93676-msword-wraps-slightly-differently-.patch @@ -1,61 +1,49 @@ -From d9aed0bc2e741fa02a6ffdf90193aae7ce471e52 Mon Sep 17 00:00:00 2001 +From 1ff5ecda9ccfcf3e65e90c404db93fcbbefb889e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= -Date: Tue, 8 Sep 2015 09:45:12 +0100 +Date: Mon, 7 Sep 2015 16:37:22 +0100 Subject: [PATCH] Related: tdf#93676 msword wraps slightly differently than us -Change-Id: I688d4d193709d9c9829065c87f0d656a94fd9f16 +Change-Id: I91ba41cb052c38aa3b047cf079090b01bbe93b39 --- - sw/source/filter/ww8/docxsdrexport.cxx | 16 +++++++++++++++- - sw/source/filter/ww8/wrtw8esh.cxx | 2 +- - 2 files changed, 16 insertions(+), 2 deletions(-) + sw/source/filter/ww8/wrtw8esh.cxx | 17 +++++++++++++++-- + 1 file changed, 15 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 +index 763fb44..fd6dfbc 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) - { +@@ -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.4.3 +2.1.0 diff --git a/0002-Related-tdf-93676-msword-wraps-slightly-differently-.patch b/0002-Related-tdf-93676-msword-wraps-slightly-differently-.patch new file mode 100644 index 0000000..90ddc6b --- /dev/null +++ b/0002-Related-tdf-93676-msword-wraps-slightly-differently-.patch @@ -0,0 +1,61 @@ +From d9aed0bc2e741fa02a6ffdf90193aae7ce471e52 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +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.1.0 + diff --git a/libreoffice.spec b/libreoffice.spec index 7707765..9ddc7a2 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -336,6 +336,7 @@ Patch27: 0001-core-fix-build-with-system-boost-1.59.patch Patch28: 0001-Fix-export-of-tdf-93675-to-.docx-as-much-as-is-possi.patch Patch29: 0001-default-to-as-character-caption-contents.patch Patch30: 0001-Related-tdf-93676-msword-wraps-slightly-differently-.patch +Patch31: 0002-Related-tdf-93676-msword-wraps-slightly-differently-.patch %define instdir %{_libdir} %define baseinstdir %{instdir}/libreoffice