[Libreoffice-commits] core.git: lotuswordpro/qa lotuswordpro/source
Caolán McNamara
caolanm at redhat.com
Sun Mar 25 14:31:04 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 | 2 +-
4 files changed, 16 insertions(+), 5 deletions(-)
New commits:
commit 4df294a2eae0098f61b4b70ec17dde569fbfc2a0
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/51826
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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 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);
}
More information about the Libreoffice-commits
mailing list