Kaydet (Commit) 96819276 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) David Tardon

more recursion protection

(cherry picked from commit e3d2e376)
(cherry picked from commit 6d4d9cb5)

Change-Id: I0a7b6c1037ea9442001b4eb9a9bb96778c0dedb6
Reviewed-on: https://gerrit.libreoffice.org/20718Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst 71efb50c
......@@ -81,6 +81,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)
......@@ -731,7 +732,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))
......@@ -763,7 +764,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
......
......@@ -104,7 +104,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;}
......@@ -142,6 +141,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;}
......@@ -194,10 +202,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;
......@@ -309,7 +319,7 @@ public:
LwpMiddleLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm );
virtual ~LwpMiddleLayout();
virtual bool MarginsSameAsParent() SAL_OVERRIDE;
virtual double GetMarginsValue(const sal_uInt8& nWhichSide) SAL_OVERRIDE;
virtual double MarginsValue(const sal_uInt8& nWhichSide) SAL_OVERRIDE;
virtual double GetExtMarginsValue(const sal_uInt8& nWhichSide) SAL_OVERRIDE;
LwpLayoutGeometry* GetGeometry();
double GetGeometryHeight();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment