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

Caolán McNamara caolanm at redhat.com
Mon Jan 4 14:00:48 PST 2016


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

New commits:
commit a586293844de4d9c0e36dd20b7c157f19ca60a9e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 1 16:57:43 2016 +0000

    guard against infinite recursion in MarginsSameAsParent
    
    (cherry picked from commit e8dc85c2b3fd197aa5d484be3fc2cb25f7bd2412)
    (cherry picked from commit 54fe17fabaa258a48e18c4a19c29da2d2cf634ca)
    
    Change-Id: I09c1ccb850f0cb2365e52ee6ffd293ccf34ad00e
    Reviewed-on: https://gerrit.libreoffice.org/21033
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: David Tardon <dtardon at redhat.com>

diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 53e1261..de77f9c 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -79,6 +79,7 @@
 LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
     : LwpDLNFPVList(objHdr, pStrm)
     , m_bGettingHonorProtection(false)
+    , m_bGettingMarginsSameAsParent(false)
     , m_bGettingHasProtection(false)
     , m_bGettingIsProtected(false)
     , m_bGettingMarginsValue(false)
@@ -726,7 +727,7 @@ bool LwpMiddleLayout::MarginsSameAsParent()
     rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
     if (LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(xBase.get()))
     {
-        pLay->MarginsSameAsParent();
+        pLay->GetMarginsSameAsParent();
     }
     return LwpVirtualLayout::MarginsSameAsParent();
 }
@@ -740,7 +741,7 @@ double LwpMiddleLayout::MarginsValue(const sal_uInt8 &nWhichSide)
     double fValue = 0;
     if((nWhichSide==MARGIN_LEFT)||(nWhichSide==MARGIN_RIGHT))
     {
-        if ( MarginsSameAsParent() )
+        if ( GetMarginsSameAsParent() )
         {
             rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
             if (xParent.is() && !xParent->IsHeader())
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index f540aec..ee46b3d5 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -100,7 +100,6 @@ class LwpVirtualLayout : public LwpDLNFPVList
 public:
     LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
     virtual ~LwpVirtualLayout(){}
-    virtual bool MarginsSameAsParent();
     inline virtual sal_uInt16 GetNumCols(){return 1;}
     virtual double GetColWidth(sal_uInt16 nIndex);
     virtual double GetColGap(sal_uInt16 nIndex);
@@ -123,6 +122,15 @@ public:
         m_bGettingHonorProtection = false;
         return bRet;
     }
+    bool GetMarginsSameAsParent()
+    {
+        if (m_bGettingMarginsSameAsParent)
+            throw std::runtime_error("recursion in layout");
+        m_bGettingMarginsSameAsParent = true;
+        bool bRet = MarginsSameAsParent();
+        m_bGettingMarginsSameAsParent = false;
+        return bRet;
+    }
     bool GetIsProtected()
     {
         if (m_bGettingIsProtected)
@@ -203,8 +211,10 @@ protected:
     virtual bool HonorProtection();
     virtual bool IsProtected();
     virtual double MarginsValue(const sal_uInt8& /*nWhichSide*/){return 0;}
+    virtual bool MarginsSameAsParent();
 protected:
     bool m_bGettingHonorProtection;
+    bool m_bGettingMarginsSameAsParent;
     bool m_bGettingHasProtection;
     bool m_bGettingIsProtected;
     bool m_bGettingMarginsValue;
@@ -318,7 +328,6 @@ class LwpMiddleLayout : public LwpVirtualLayout
 public:
     LwpMiddleLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
     virtual ~LwpMiddleLayout();
-    virtual bool MarginsSameAsParent() SAL_OVERRIDE;
     virtual double MarginsValue(const sal_uInt8& nWhichSide) SAL_OVERRIDE;
     virtual double GetExtMarginsValue(const sal_uInt8& nWhichSide) SAL_OVERRIDE;
     LwpLayoutGeometry* GetGeometry()
@@ -375,6 +384,7 @@ public:
 
 protected:
     void Read() SAL_OVERRIDE;
+    virtual bool MarginsSameAsParent() SAL_OVERRIDE;
 private:
     LwpObjectID m_BasedOnStyle;
     LwpLayoutGeometry* Geometry();


More information about the Libreoffice-commits mailing list