summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-15 10:47:44 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-12-15 10:48:37 +0000
commit6d4d9cb5716ed452a5ff3f30c68203e2794c832f (patch)
treebde5cc35b574c73b917fdd36a9dafe8d728b02b1 /lotuswordpro
parentc2fc9536a2734778351b7f2e712255c7df832037 (diff)
more recursion protection
Change-Id: I0a7b6c1037ea9442001b4eb9a9bb96778c0dedb6 (cherry picked from commit e3d2e376426b5237ded121d172324ef4ced5c3e0)
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx5
-rw-r--r--lotuswordpro/source/filter/lwplayout.hxx14
2 files changed, 15 insertions, 4 deletions
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index bb54fc06a9e5..68003a7cad5e 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -76,6 +76,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)
@@ -705,7 +706,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))
@@ -737,7 +738,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 a6585c0f1eb0..bc0e4c383a02 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -100,7 +100,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;}
@@ -138,6 +137,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;}
@@ -190,10 +198,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;
@@ -304,7 +314,7 @@ public:
LwpMiddleLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
virtual ~LwpMiddleLayout();
virtual bool MarginsSameAsParent() override;
- virtual double GetMarginsValue(const sal_uInt8& nWhichSide) override;
+ virtual double MarginsValue(const sal_uInt8& nWhichSide) override;
virtual double GetExtMarginsValue(const sal_uInt8& nWhichSide) override;
LwpLayoutGeometry* GetGeometry();
double GetGeometryHeight();