[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Tue Dec 15 03:01:45 PST 2015


 lotuswordpro/source/filter/lwplayout.cxx |    5 +++--
 lotuswordpro/source/filter/lwplayout.hxx |   14 ++++++++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

New commits:
commit 968192760af54797a28da34895feaefca48121ac
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 15 10:47:44 2015 +0000

    more recursion protection
    
    (cherry picked from commit e3d2e376426b5237ded121d172324ef4ced5c3e0)
    (cherry picked from commit 6d4d9cb5716ed452a5ff3f30c68203e2794c832f)
    
    Change-Id: I0a7b6c1037ea9442001b4eb9a9bb96778c0dedb6
    Reviewed-on: https://gerrit.libreoffice.org/20718
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index b2022c1..a0d3a510 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -81,6 +81,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
     , m_bGettingHonorProtection(false)
     , m_bGettingHasProtection(false)
     , m_bGettingIsProtected(false)
+    , m_bGettingMarginsValue(false)
     , m_nAttributes(0)
     , m_nAttributes2(0)
     , m_nAttributes3(0)
@@ -731,7 +732,7 @@ bool LwpMiddleLayout::MarginsSameAsParent()
 * @descr:   Get margin
 * @param:   nWhichSide - 0: left, 1: right, 2:top, 3: bottom
 */
-double LwpMiddleLayout::GetMarginsValue(const sal_uInt8 &nWhichSide)
+double LwpMiddleLayout::MarginsValue(const sal_uInt8 &nWhichSide)
 {
     double fValue = 0;
     if((nWhichSide==MARGIN_LEFT)||(nWhichSide==MARGIN_RIGHT))
@@ -763,7 +764,7 @@ double LwpMiddleLayout::GetMarginsValue(const sal_uInt8 &nWhichSide)
         fValue = pStyle->GetMarginsValue(nWhichSide);
         return fValue;
     }
-    return LwpVirtualLayout::GetMarginsValue(nWhichSide);
+    return LwpVirtualLayout::MarginsValue(nWhichSide);
 }
 /**
  * @descr:  Get extmargin value
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index a7bcf1e..c8bcaa3 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -104,7 +104,6 @@ public:
     inline virtual sal_uInt16 GetNumCols(){return 1;}
     virtual double GetColWidth(sal_uInt16 nIndex);
     virtual double GetColGap(sal_uInt16 nIndex);
-    virtual double GetMarginsValue(const sal_uInt8& /*nWhichSide*/){return 0;}
     virtual double GetExtMarginsValue(const sal_uInt8& /*nWhichSide*/){return 0;}
     virtual bool IsAutoGrow(){ return false;}
     virtual bool IsAutoGrowUp(){ return false;}
@@ -142,6 +141,15 @@ public:
         m_bGettingHasProtection = false;
         return bRet;
     }
+    double GetMarginsValue(const sal_uInt8& nWhichSide)
+    {
+        if (m_bGettingMarginsValue)
+            throw std::runtime_error("recursion in layout");
+        m_bGettingMarginsValue = true;
+        bool fRet = MarginsValue(nWhichSide);
+        m_bGettingMarginsValue = false;
+        return fRet;
+    }
     OUString GetStyleName(){ return m_StyleName;}
     bool IsComplex();
     virtual bool IsAnchorPage(){ return false;}
@@ -194,10 +202,12 @@ protected:
     bool HasProtection();
     virtual bool HonorProtection();
     virtual bool IsProtected();
+    virtual double MarginsValue(const sal_uInt8& /*nWhichSide*/){return 0;}
 protected:
     bool m_bGettingHonorProtection;
     bool m_bGettingHasProtection;
     bool m_bGettingIsProtected;
+    bool m_bGettingMarginsValue;
     sal_uInt32 m_nAttributes;
     sal_uInt32 m_nAttributes2;
     sal_uInt32 m_nAttributes3;
@@ -309,7 +319,7 @@ public:
     LwpMiddleLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
     virtual ~LwpMiddleLayout();
     virtual bool MarginsSameAsParent() SAL_OVERRIDE;
-    virtual double GetMarginsValue(const sal_uInt8& nWhichSide) SAL_OVERRIDE;
+    virtual double MarginsValue(const sal_uInt8& nWhichSide) SAL_OVERRIDE;
     virtual double GetExtMarginsValue(const sal_uInt8& nWhichSide) SAL_OVERRIDE;
     LwpLayoutGeometry* GetGeometry();
     double GetGeometryHeight();


More information about the Libreoffice-commits mailing list