summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-13 10:40:10 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-12-13 10:40:38 +0000
commitc617765c305e43f699487016b02afaf5f65e4d64 (patch)
treeb4489d9211af622f72988442a9faa86e6ff6b01a /lotuswordpro
parenta505944f54421ed112f594ea14d29b6ea7a47f85 (diff)
recursion protection
Change-Id: I66fda143ba1f0fa6f2638a8bd4936c75a6c40980 (cherry picked from commit 4e6df6de1a95b6b4194cf930cabaae7fde3b6960)
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwpcelllayout.cxx6
-rw-r--r--lotuswordpro/source/filter/lwpframelayout.cxx2
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx6
-rw-r--r--lotuswordpro/source/filter/lwplayout.hxx12
4 files changed, 19 insertions, 7 deletions
diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx
index 76faa62786af..0a8356de2be0 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.cxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.cxx
@@ -645,7 +645,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
{
bool bProtected = false;
// judge current cell
- if (IsProtected())
+ if (GetIsProtected())
{
bProtected = true;
}
@@ -653,7 +653,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
{
// judge base on
LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(GetBasedOnStyle().get());
- if (pBase && pBase->IsProtected())
+ if (pBase && pBase->GetIsProtected())
{
bProtected = true;
}
@@ -663,7 +663,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
LwpTableLayout * pTableLayout = pTable ? dynamic_cast<LwpTableLayout *>(pTable->GetTableLayout()) : nullptr;
LwpSuperTableLayout * pSuper = pTableLayout ? pTableLayout->GetSuperTableLayout() : nullptr;
- if (pSuper && pSuper->IsProtected())
+ if (pSuper && pSuper->GetIsProtected())
{
bProtected = true;
}
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index 165d9e50600b..b31791aca1aa 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -397,7 +397,7 @@ void LwpFrame::ApplyBackColor(XFFrameStyle* pFrameStyle)
*/
void LwpFrame::ApplyProtect(XFFrameStyle* pFrameStyle)
{
- if(m_pLayout->IsProtected())
+ if(m_pLayout->GetIsProtected())
{
pFrameStyle->SetProtect(true,true,true);
}
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 86a1863f4f61..3e58fa90de8f 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -74,6 +74,8 @@
LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
: LwpDLNFPVList(objHdr, pStrm)
, m_bGettingHonorProtection(false)
+ , m_bGettingHasProtection(false)
+ , m_bGettingIsProtected(false)
, m_nAttributes(0)
, m_nAttributes2(0)
, m_nAttributes3(0)
@@ -1267,7 +1269,7 @@ bool LwpMiddleLayout::IsProtected()
}
else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> (GetBasedOnStyle().get()))
{
- bProtected = pLay->IsProtected();
+ bProtected = pLay->GetIsProtected();
}
else
bProtected = LwpVirtualLayout::IsProtected();
@@ -1276,7 +1278,7 @@ bool LwpMiddleLayout::IsProtected()
if(pParent && !pParent->IsHeader())
{
/* If a parent's protected then none of its children can be accessed. */
- if(pParent->IsProtected())
+ if(pParent->GetIsProtected())
return true;
if(pParent->GetHonorProtection())
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index e9c039aa46dd..1419043c6dcf 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -120,7 +120,15 @@ public:
m_bGettingHonorProtection = false;
return bRet;
}
- virtual bool IsProtected();
+ bool GetIsProtected()
+ {
+ if (m_bGettingIsProtected)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingIsProtected = true;
+ bool bRet = IsProtected();
+ m_bGettingIsProtected = false;
+ return bRet;
+ }
bool GetHasProtection()
{
if (m_bGettingHasProtection)
@@ -181,9 +189,11 @@ protected:
void Read() override;
bool HasProtection();
virtual bool HonorProtection();
+ virtual bool IsProtected();
protected:
bool m_bGettingHonorProtection;
bool m_bGettingHasProtection;
+ bool m_bGettingIsProtected;
sal_uInt32 m_nAttributes;
sal_uInt32 m_nAttributes2;
sal_uInt32 m_nAttributes3;