Kaydet (Commit) 9e0004f2 authored tarafından Caolán McNamara's avatar Caolán McNamara

recurse protection for XFConvert

Change-Id: Ib6008d4b07159acad26c7baeb775702119c12e3b
üst c5bee7b8
......@@ -187,7 +187,7 @@ void LwpFootnote::XFConvert(XFContentContainer * pCont)
LwpContent* pContent = FindFootnoteContent();
if(pContent)
{
pContent->XFConvert(pCont);
pContent->DoXFConvert(pCont);
}
}
......
......@@ -835,7 +835,7 @@ void LwpFrameLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart
rtl::Reference<LwpObject> content = m_Content.obj();
if (content.is())
{
content->XFConvert(pXFFrame);
content->DoXFConvert(pXFFrame);
//set frame size according to ole size
ApplyGraphicSize(pXFFrame);
}
......@@ -1103,7 +1103,7 @@ void LwpGroupLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart
while (pLayout && pLayout != this)
{
pLayout->XFConvert(pXFFrame);
pLayout->DoXFConvert(pXFFrame);
pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
}
......
......@@ -180,7 +180,7 @@ void LwpFribFrame::XFConvert(XFContentContainer* pCont)
}
}
pLayout->XFConvert(pXFContentContainer);
pLayout->DoXFConvert(pXFContentContainer);
if(m_bRevisionFlag)
{
......
......@@ -181,7 +181,7 @@ void LwpNoteLayout::XFConvert(XFContentContainer * pCont)
LwpVirtualLayout* pTextLayout = GetTextLayout();
if(pTextLayout)
{
pTextLayout->XFConvert(pCont);
pTextLayout->DoXFConvert(pCont);
}
}
......@@ -290,7 +290,7 @@ void LwpNoteTextLayout::XFConvert(XFContentContainer * pCont)
rtl::Reference<LwpObject> pContent = m_Content.obj();
if(pContent.is())
{
pContent->XFConvert(pCont);
pContent->DoXFConvert(pCont);
}
}
......
......@@ -62,6 +62,7 @@
LwpObject::LwpObject(LwpObjectHeader objHdr, LwpSvStream* pStrm)
: m_ObjHdr(objHdr), m_pObjStrm(nullptr), m_pFoundry(nullptr)
, m_pStrm(pStrm), m_bRegisteringStyle(false), m_bParsingStyle(false)
, m_bConvertingContent(false)
{
m_pObjStrm = new LwpObjectStream(pStrm, m_ObjHdr.IsCompressed(),
static_cast<sal_uInt16>(m_ObjHdr.GetSize()) );
......
......@@ -92,10 +92,12 @@ protected:
LwpSvStream* m_pStrm;
bool m_bRegisteringStyle;
bool m_bParsingStyle;
bool m_bConvertingContent;
protected:
virtual void Read();
virtual void RegisterStyle();
virtual void Parse(IXFStream* pOutputStream);
virtual void XFConvert(XFContentContainer* pCont);
public:
void QuickRead();
//calls RegisterStyle but bails if DoRegisterStyle is called
......@@ -118,8 +120,16 @@ public:
Parse(pOutputStream);
m_bParsingStyle = false;
}
virtual void XFConvert(XFContentContainer* pCont);
//calls XFConvert but bails if DoXFConvert is called
//on the same object recursively
void DoXFConvert(XFContentContainer* pCont)
{
if (m_bConvertingContent)
throw std::runtime_error("recursion in parsing");
m_bConvertingContent = true;
XFConvert(pCont);
m_bConvertingContent = false;
}
LwpFoundry* GetFoundry(){return m_pFoundry;}
void SetFoundry(LwpFoundry* pFoundry){m_pFoundry = pFoundry;}
......
......@@ -889,7 +889,7 @@ void LwpHeaderLayout::RegisterStyle(XFMasterPage* mp1)
RegisterChildStyle();
//End
pChangeMgr->SetHeadFootChange(pHeader);
pStory->XFConvert(pHeader);
pStory->DoXFConvert(pHeader);
pChangeMgr->SetHeadFootFribMap(false);
}
......@@ -1042,7 +1042,7 @@ void LwpFooterLayout::RegisterStyle(XFMasterPage* mp1)
pChangeMgr->SetHeadFootChange(pFooter);
pStory->XFConvert(pFooter);
pStory->DoXFConvert(pFooter);
pChangeMgr->SetHeadFootFribMap(false);
}
......
......@@ -314,7 +314,7 @@ void LwpStory::XFConvertFrameInCell(XFContentContainer* pCont)
pCont->FindFirstContent(enumXFContentPara));
XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get());
if(pXFFirtPara)
xFrameLayout->XFConvert(pXFFirtPara);
xFrameLayout->DoXFConvert(pXFFirtPara);
}
xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get()));
}
......@@ -338,7 +338,7 @@ void LwpStory::XFConvertFrameInPage(XFContentContainer* pCont)
|| xFrameLayout->IsSuperTable()
|| xFrameLayout->IsGroupHead())))
{
xFrameLayout->XFConvert(pCont);
xFrameLayout->DoXFConvert(pCont);
}
xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get()));
}
......@@ -358,7 +358,7 @@ void LwpStory::XFConvertFrameInFrame(XFContentContainer* pCont)
{
if (xFrameLayout->IsAnchorFrame())
{
xFrameLayout->XFConvert(pCont);
xFrameLayout->DoXFConvert(pCont);
}
xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get()));
}
......@@ -383,7 +383,7 @@ void LwpStory::XFConvertFrameInHeaderFooter(XFContentContainer* pCont)
pCont->FindFirstContent(enumXFContentPara));
XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get());
if(pXFFirtPara)
xFrameLayout->XFConvert(pXFFirtPara);
xFrameLayout->DoXFConvert(pXFFirtPara);
}
xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get()));
}
......
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