Blame SOURCES/0001-negative-after-text-indents-ignored-by-msword-for-ap.patch

ebc4bd
From b5ce50d1d07394f6b59b028373120369c83d5d66 Mon Sep 17 00:00:00 2001
ebc4bd
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
ebc4bd
Date: Tue, 7 Apr 2015 09:56:43 +0100
ebc4bd
Subject: [PATCH] negative after-text indents ignored by msword for apos
ebc4bd
ebc4bd
Change-Id: I33e178f23bc4b1372c4c329954b301ae68902154
ebc4bd
---
ebc4bd
 sw/source/filter/ww8/ww8graf.cxx |  3 +++
ebc4bd
 sw/source/filter/ww8/ww8par.hxx  |  2 ++
ebc4bd
 sw/source/filter/ww8/ww8par6.cxx | 26 ++++++++++++++++++++++++++
ebc4bd
 3 files changed, 31 insertions(+)
ebc4bd
ebc4bd
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
ebc4bd
index 456ce25..3a11d1e 100644
ebc4bd
--- a/sw/source/filter/ww8/ww8graf.cxx
ebc4bd
+++ b/sw/source/filter/ww8/ww8graf.cxx
ebc4bd
@@ -2905,7 +2905,10 @@ SwFlyFrmFmt* SwWW8ImplReader::ConvertDrawTextToFly(SdrObject* &rpObject,
ebc4bd
             MoveOutsideFly(pRetFrmFmt, aSave.GetStartPos(),!bJoined);
ebc4bd
 
ebc4bd
             aSave.Restore( this );
ebc4bd
+
ebc4bd
+            StripNegativeAfterIndent(pRetFrmFmt);
ebc4bd
         }
ebc4bd
+
ebc4bd
     }
ebc4bd
     return pRetFrmFmt;
ebc4bd
 }
ebc4bd
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
ebc4bd
index a7fdff5..0a34059 100644
ebc4bd
--- a/sw/source/filter/ww8/ww8par.hxx
ebc4bd
+++ b/sw/source/filter/ww8/ww8par.hxx
ebc4bd
@@ -1488,6 +1488,7 @@ private:
ebc4bd
     bool IsDropCap();
ebc4bd
     bool IsListOrDropcap() { return (!pAktItemSet  || bDropCap); };
ebc4bd
 
ebc4bd
+    //Apo == Absolutely Positioned Object, MSWord's old-style frames
ebc4bd
     WW8FlyPara *ConstructApo(const ApoTestResults &rApo,
ebc4bd
         const WW8_TablePos *pTabPos);
ebc4bd
     bool StartApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos, SvxULSpaceItem* pULSpaceItem = 0);
ebc4bd
@@ -1495,6 +1496,7 @@ private:
ebc4bd
     bool TestSameApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
ebc4bd
     ApoTestResults TestApo(int nCellLevel, bool bTableRowEnd,
ebc4bd
         const WW8_TablePos *pTabPos);
ebc4bd
+    void StripNegativeAfterIndent(SwFrmFmt *pFlyFmt) const;
ebc4bd
 
ebc4bd
     void EndSpecial();
ebc4bd
     bool ProcessSpecial(bool &rbReSync, WW8_CP nStartCp);
ebc4bd
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
ebc4bd
index 418e130..b63e639 100644
ebc4bd
--- a/sw/source/filter/ww8/ww8par6.cxx
ebc4bd
+++ b/sw/source/filter/ww8/ww8par6.cxx
ebc4bd
@@ -2430,6 +2430,32 @@ bool SwWW8ImplReader::JoinNode(SwPaM &rPam, bool bStealAttr)
ebc4bd
     return bRet;
ebc4bd
 }
ebc4bd
 
ebc4bd
+//In auto-width word frames negative after-indent values are ignored
ebc4bd
+void SwWW8ImplReader::StripNegativeAfterIndent(SwFrmFmt *pFlyFmt) const
ebc4bd
+{
ebc4bd
+    const SwNodeIndex* pSttNd = pFlyFmt->GetCntnt().GetCntntIdx();
ebc4bd
+    if (!pSttNd)
ebc4bd
+        return;
ebc4bd
+
ebc4bd
+    SwNodeIndex aIdx(*pSttNd, 1);
ebc4bd
+    SwNodeIndex aEnd(*pSttNd->GetNode().EndOfSectionNode());
ebc4bd
+    while (aIdx < aEnd)
ebc4bd
+    {
ebc4bd
+        SwTxtNode *pNd = aIdx.GetNode().GetTxtNode();
ebc4bd
+        if (pNd)
ebc4bd
+        {
ebc4bd
+            const SvxLRSpaceItem& rLR = ItemGet<SvxLRSpaceItem>(*pNd, RES_LR_SPACE);
ebc4bd
+            if (rLR.GetRight() < 0)
ebc4bd
+            {
ebc4bd
+                SvxLRSpaceItem aLR(rLR);
ebc4bd
+                aLR.SetRight(0);
ebc4bd
+                pNd->SetAttr(aLR);
ebc4bd
+            }
ebc4bd
+        }
ebc4bd
+        ++aIdx;
ebc4bd
+    }
ebc4bd
+}
ebc4bd
+
ebc4bd
 void SwWW8ImplReader::StopApo()
ebc4bd
 {
ebc4bd
     OSL_ENSURE(pWFlyPara, "no pWFlyPara to close");
ebc4bd
-- 
ebc4bd
1.9.3
ebc4bd