summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-15 10:47:44 +0000
committerAndras Timar <andras.timar@collabora.com>2015-12-21 13:16:03 +0100
commit1bdffc782838b4b0e2e0e5c619f9bf14f18596f5 (patch)
tree6977c892f779cdad00543d73239ebbfdaf7005f0 /lotuswordpro
parenta0baa4fd8bac5fbf6a437e4c84b8261c648b08d0 (diff)
more recursion protection
(cherry picked from commit e3d2e376426b5237ded121d172324ef4ced5c3e0) (cherry picked from commit 6d4d9cb5716ed452a5ff3f30c68203e2794c832f) Change-Id: I0a7b6c1037ea9442001b4eb9a9bb96778c0dedb6 Reviewed-on: https://gerrit.libreoffice.org/20718 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com> (cherry picked from commit 968192760af54797a28da34895feaefca48121ac)
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 b2022c1e48a2..a0d3a5101ed3 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -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
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index a7bcf1eb4932..c8bcaa317967 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -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();