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

Caolán McNamara caolanm at redhat.com
Tue Apr 10 08:50:13 UTC 2018


 lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp |binary
 lotuswordpro/source/filter/lwplayout.cxx        |    5 +++--
 lotuswordpro/source/filter/lwplayout.hxx        |   14 ++++++++++++--
 lotuswordpro/source/filter/lwppagelayout.cxx    |    4 ++--
 4 files changed, 17 insertions(+), 6 deletions(-)

New commits:
commit d7608726fbdc42749c35a3a49d094cd0c5c3476d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 25 14:01:25 2018 +0100

    ofz#7109 infinite regress
    
    Change-Id: Iac0bd81c9b0e3ac6b005bb0065895ca1b4ca4233
    Reviewed-on: https://gerrit.libreoffice.org/51827
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp
new file mode 100644
index 000000000000..f48c5bb718a4
Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp differ
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 7fd1060afaf2..7a1dddda5954 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -79,6 +79,7 @@ LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader const &objHdr, LwpSvStream* p
     , m_bGettingMarginsSameAsParent(false)
     , m_bGettingHasProtection(false)
     , m_bGettingIsProtected(false)
+    , m_bGettingIsAutoGrowDown(false)
     , m_bGettingMarginsValue(false)
     , m_bGettingExtMarginsValue(false)
     , m_bGettingUsePrinterSettings(false)
@@ -399,7 +400,7 @@ LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType)
 */
 bool LwpVirtualLayout::IsFitGraphic()
 {
-    return IsAutoGrowRight() && !IsAutoGrowLeft() && IsAutoGrowDown();
+    return IsAutoGrowRight() && !IsAutoGrowLeft() && GetIsAutoGrowDown();
 }
 
 /**
@@ -1164,7 +1165,7 @@ bool LwpMiddleLayout::IsAutoGrowDown()
         rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
         if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
         {
-            return pLay->IsAutoGrowDown();
+            return pLay->GetIsAutoGrowDown();
         }
     }
     return LwpVirtualLayout::IsAutoGrowDown();
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index aba59615360b..560822c858c6 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -103,7 +103,6 @@ public:
     virtual double GetColGap(sal_uInt16 nIndex);
     virtual bool IsAutoGrow(){ return false;}
     virtual bool IsAutoGrowUp(){ return false;}
-    virtual bool IsAutoGrowDown(){ return false;}
     virtual bool IsAutoGrowLeft(){ return false;}
     virtual bool IsAutoGrowRight(){ return false;}
     bool IsFitGraphic();
@@ -137,6 +136,15 @@ public:
         m_bGettingIsProtected = false;
         return bRet;
     }
+    bool GetIsAutoGrowDown()
+    {
+        if (m_bGettingIsAutoGrowDown)
+            throw std::runtime_error("recursion in layout");
+        m_bGettingIsAutoGrowDown = true;
+        bool bRet = IsAutoGrowDown();
+        m_bGettingIsAutoGrowDown = false;
+        return bRet;
+    }
     bool GetHasProtection()
     {
         if (m_bGettingHasProtection)
@@ -216,6 +224,7 @@ protected:
     bool HasProtection();
     virtual bool HonorProtection();
     virtual bool IsProtected();
+    virtual bool IsAutoGrowDown(){ return false;}
     virtual double MarginsValue(sal_uInt8 /*nWhichSide*/){return 0;}
     virtual double ExtMarginsValue(sal_uInt8 /*nWhichSide*/){return 0;}
     virtual bool MarginsSameAsParent();
@@ -224,6 +233,7 @@ protected:
     bool m_bGettingMarginsSameAsParent;
     bool m_bGettingHasProtection;
     bool m_bGettingIsProtected;
+    bool m_bGettingIsAutoGrowDown;
     bool m_bGettingMarginsValue;
     bool m_bGettingExtMarginsValue;
     bool m_bGettingUsePrinterSettings;
@@ -351,7 +361,6 @@ public:
     LwpColor* GetBackColor();
     virtual bool IsAutoGrow() override;
     virtual bool IsAutoGrowUp() override;
-    virtual bool IsAutoGrowDown() override;
     virtual bool IsAutoGrowLeft() override;
     virtual bool IsAutoGrowRight() override;
     virtual sal_uInt8 GetContentOrientation() override;
@@ -389,6 +398,7 @@ protected:
     virtual bool MarginsSameAsParent() override;
     virtual double MarginsValue(sal_uInt8 nWhichSide) override;
     virtual double ExtMarginsValue(sal_uInt8 nWhichSide) override;
+    virtual bool IsAutoGrowDown() override;
 private:
     LwpObjectID m_BasedOnStyle;
     LwpLayoutGeometry* Geometry();
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index fc5d77ab90de..cb78e32d5136 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -467,7 +467,7 @@ void LwpPageLayout::ConvertFillerPageText(XFContentContainer* pCont)
         //get fillerpage story from division info
         LwpDocument* pDoc = m_pFoundry->GetDocument();
         LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pDoc->GetDivInfoID().obj().get());
-        LwpStory* pStory = dynamic_cast<LwpStory*>(pDivInfo->GetFillerPageTextID().obj().get());
+        LwpStory* pStory = pDivInfo ? dynamic_cast<LwpStory*>(pDivInfo->GetFillerPageTextID().obj().get()) : nullptr;
 
         //parse fillerpage story
         if(pStory)
@@ -772,7 +772,7 @@ void LwpHeaderLayout::ParseMargins(XFHeaderStyle* ph1)
 {
     //Set height: from top of header to top of body, including the spacing between header and body
     double height = GetGeometryHeight()- GetMarginsValue(MARGIN_TOP);
-    if( IsAutoGrowDown() )
+    if (GetIsAutoGrowDown())
     {
         ph1->SetMinHeight(height);
     }


More information about the Libreoffice-commits mailing list