ofz#8095 avoid recurse to death

Change-Id: I0acb0f68f64bb95a4510a330d463badd2cf8a84a
Reviewed-on: https://gerrit.libreoffice.org/53663
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2018-04-30 15:31:51 +01:00
parent da0956b279
commit 25c0988b87
5 changed files with 20 additions and 9 deletions

Binary file not shown.

View File

@ -76,6 +76,7 @@
LwpCellLayout::LwpCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
: LwpMiddleLayout(objHdr, pStrm)
, m_bConvertCell(false)
, crowid(0)
, ccolid(0)
, cType(LDT_NONE)
@ -891,11 +892,11 @@ rtl::Reference<XFCell> LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sa
LwpCellLayout *pDefault = dynamic_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle().obj().get());
if (pDefault)
{
xXFCell = pDefault->ConvertCell(aTableID, nRow, nCol);
xXFCell = pDefault->DoConvertCell(aTableID, nRow, nCol);
}
else
{
xXFCell = pConnCell->ConvertCell(aTableID, nRow, nCol);
xXFCell = pConnCell->DoConvertCell(aTableID, nRow, nCol);
}
xXFCell->SetColumnSpaned(pConnCell->GetNumcols());
}

View File

@ -89,7 +89,15 @@ public:
LwpCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
virtual ~LwpCellLayout() override;
virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CELL_LAYOUT;}
virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol);
rtl::Reference<XFCell> DoConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
{
if (m_bConvertCell)
throw std::runtime_error("recursion in page divisions");
m_bConvertCell = true;
rtl::Reference<XFCell> aRet = ConvertCell(aTableID, nRow, nCol);
m_bConvertCell = false;
return aRet;
}
sal_uInt16 GetRowID(){return crowid;}
sal_uInt8 GetColID(){return ccolid;}
void RegisterStyle() override;
@ -114,10 +122,12 @@ protected:
OUString const & GetCellStyleName(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
void RegisterDefaultCell();
virtual LwpCellBorderType GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol);
static LwpCellLayout * GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
static sal_uInt16 GetLeftColID(sal_uInt16 nCol){return nCol - 1; };
virtual sal_uInt16 GetBelowRowID(sal_uInt16 nRow){return nRow + 1; };
bool m_bConvertCell;
sal_uInt16 crowid;
sal_uInt8 ccolid;
LwpObjectID cLayNumerics;
@ -147,11 +157,11 @@ public:
virtual ~LwpHiddenCellLayout() override;
virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_HIDDEN_CELL_LAYOUT;}
virtual void Parse(IXFStream* pOutputStream) override;
virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
void RegisterStyle() override {}
virtual void SetCellMap() override;
private:
void Read() override;
virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
LwpObjectID cconnectedlayout;
};
@ -166,7 +176,6 @@ public:
virtual ~LwpConnectedCellLayout() override;
virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CONNECTED_CELL_LAYOUT;}
virtual void Parse(IXFStream* pOutputStream) override;
virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
sal_uInt16 GetNumrows(){return m_nRealrowspan;}
sal_uInt8 GetNumcols(){return m_nRealcolspan;}
virtual void SetCellMap() override;
@ -175,6 +184,7 @@ protected:
void Read() override;
virtual sal_uInt16 GetBelowRowID(sal_uInt16 nRow) override {return nRow + m_nRealrowspan; };
virtual LwpCellBorderType GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout) override;
virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
sal_uInt16 cnumrows;
sal_uInt8 cnumcols;
sal_uInt16 m_nRealrowspan;

View File

@ -232,7 +232,7 @@ void LwpRowLayout::ConvertRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt8
{
sal_uInt8 nColID = m_ConnCellList[nMarkConnCell]->GetColID()
+m_ConnCellList[nMarkConnCell]->GetNumcols()-1;
xXFCell = m_ConnCellList[nMarkConnCell]->ConvertCell(
xXFCell = m_ConnCellList[nMarkConnCell]->DoConvertCell(
pTable->GetObjectID(),
crowid+m_ConnCellList[nMarkConnCell]->GetNumrows()-1,
m_ConnCellList[nMarkConnCell]->GetColID());
@ -401,7 +401,7 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
nCellEndCol = i+pConnCell->GetNumcols()-1;
i = nCellEndCol;
}
xCell = pCellLayout->ConvertCell(pTable->GetObjectID(),crowid,i);
xCell = pCellLayout->DoConvertCell(pTable->GetObjectID(),crowid,i);
break;
}
rCellID = pCellLayout->GetNext();
@ -414,7 +414,7 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
LwpCellLayout * pDefaultCell = pTableLayout->GetDefaultCellLayout();
if (pDefaultCell)
{
xCell = pDefaultCell->ConvertCell(
xCell = pDefaultCell->DoConvertCell(
pTable->GetObjectID(),crowid, i);
}
else

View File

@ -1361,7 +1361,7 @@ void LwpTableLayout::ConvertDefaultRow(rtl::Reference<XFTable> const & pXFTable,
rtl::Reference<XFCell> xCell;
if (m_pDefaultCellLayout)
{
xCell = m_pDefaultCellLayout->ConvertCell(
xCell = m_pDefaultCellLayout->DoConvertCell(
GetTable()->GetObjectID(),nRowID,j+nStartCol);
}
else