[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - lotuswordpro/source
Caolán McNamara
caolanm at redhat.com
Tue Dec 15 02:49:12 PST 2015
lotuswordpro/source/filter/lwplayout.cxx | 5 +++--
lotuswordpro/source/filter/lwplayout.hxx | 14 ++++++++++++--
2 files changed, 15 insertions(+), 4 deletions(-)
New commits:
commit 6d4d9cb5716ed452a5ff3f30c68203e2794c832f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Dec 15 10:47:44 2015 +0000
more recursion protection
Change-Id: I0a7b6c1037ea9442001b4eb9a9bb96778c0dedb6
(cherry picked from commit e3d2e376426b5237ded121d172324ef4ced5c3e0)
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index bb54fc0..68003a7 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 a6585c0..bc0e4c3 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();
More information about the Libreoffice-commits
mailing list