summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-25 14:01:25 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-03-25 16:30:41 +0200
commit4df294a2eae0098f61b4b70ec17dde569fbfc2a0 (patch)
tree03ca7a6da34d59ee23790c946a35e566b317c87c /lotuswordpro
parentf365b17bf170c8ed1baae299a2d719774fcc4305 (diff)
ofz#7109 infinite regress
Change-Id: Iac0bd81c9b0e3ac6b005bb0065895ca1b4ca4233 Reviewed-on: https://gerrit.libreoffice.org/51826 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/qa/cppunit/data/fail/recurse-4.lwpbin0 -> 15012 bytes
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx5
-rw-r--r--lotuswordpro/source/filter/lwplayout.hxx14
-rw-r--r--lotuswordpro/source/filter/lwppagelayout.cxx2
4 files changed, 16 insertions, 5 deletions
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
--- /dev/null
+++ b/lotuswordpro/qa/cppunit/data/fail/recurse-4.lwp
Binary files differ
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 5f24dfa64932..7931f7b0dee4 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)
@@ -421,7 +422,7 @@ LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType)
*/
bool LwpVirtualLayout::IsFitGraphic()
{
- return IsAutoGrowRight() && !IsAutoGrowLeft() && IsAutoGrowDown();
+ return IsAutoGrowRight() && !IsAutoGrowLeft() && GetIsAutoGrowDown();
}
/**
@@ -1149,7 +1150,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 4ec293c06cbb..a1e9db694e29 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;
@@ -353,7 +363,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;
@@ -388,6 +397,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 de414e5ed50c..efa9de8fc2d8 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -781,7 +781,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);
}