Kaydet (Commit) 25c0988b authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#8095 avoid recurse to death

Change-Id: I0acb0f68f64bb95a4510a330d463badd2cf8a84a
Reviewed-on: https://gerrit.libreoffice.org/53663Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst da0956b2
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
LwpCellLayout::LwpCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm) LwpCellLayout::LwpCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm)
: LwpMiddleLayout(objHdr, pStrm) : LwpMiddleLayout(objHdr, pStrm)
, m_bConvertCell(false)
, crowid(0) , crowid(0)
, ccolid(0) , ccolid(0)
, cType(LDT_NONE) , cType(LDT_NONE)
...@@ -891,11 +892,11 @@ rtl::Reference<XFCell> LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sa ...@@ -891,11 +892,11 @@ rtl::Reference<XFCell> LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sa
LwpCellLayout *pDefault = dynamic_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle().obj().get()); LwpCellLayout *pDefault = dynamic_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle().obj().get());
if (pDefault) if (pDefault)
{ {
xXFCell = pDefault->ConvertCell(aTableID, nRow, nCol); xXFCell = pDefault->DoConvertCell(aTableID, nRow, nCol);
} }
else else
{ {
xXFCell = pConnCell->ConvertCell(aTableID, nRow, nCol); xXFCell = pConnCell->DoConvertCell(aTableID, nRow, nCol);
} }
xXFCell->SetColumnSpaned(pConnCell->GetNumcols()); xXFCell->SetColumnSpaned(pConnCell->GetNumcols());
} }
......
...@@ -89,7 +89,15 @@ public: ...@@ -89,7 +89,15 @@ public:
LwpCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm); LwpCellLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm);
virtual ~LwpCellLayout() override; virtual ~LwpCellLayout() override;
virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CELL_LAYOUT;} 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_uInt16 GetRowID(){return crowid;}
sal_uInt8 GetColID(){return ccolid;} sal_uInt8 GetColID(){return ccolid;}
void RegisterStyle() override; void RegisterStyle() override;
...@@ -114,10 +122,12 @@ protected: ...@@ -114,10 +122,12 @@ protected:
OUString const & GetCellStyleName(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout); OUString const & GetCellStyleName(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
void RegisterDefaultCell(); void RegisterDefaultCell();
virtual LwpCellBorderType GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout); 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 LwpCellLayout * GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout);
static sal_uInt16 GetLeftColID(sal_uInt16 nCol){return nCol - 1; }; static sal_uInt16 GetLeftColID(sal_uInt16 nCol){return nCol - 1; };
virtual sal_uInt16 GetBelowRowID(sal_uInt16 nRow){return nRow + 1; }; virtual sal_uInt16 GetBelowRowID(sal_uInt16 nRow){return nRow + 1; };
bool m_bConvertCell;
sal_uInt16 crowid; sal_uInt16 crowid;
sal_uInt8 ccolid; sal_uInt8 ccolid;
LwpObjectID cLayNumerics; LwpObjectID cLayNumerics;
...@@ -147,11 +157,11 @@ public: ...@@ -147,11 +157,11 @@ public:
virtual ~LwpHiddenCellLayout() override; virtual ~LwpHiddenCellLayout() override;
virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_HIDDEN_CELL_LAYOUT;} virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_HIDDEN_CELL_LAYOUT;}
virtual void Parse(IXFStream* pOutputStream) override; virtual void Parse(IXFStream* pOutputStream) override;
virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
void RegisterStyle() override {} void RegisterStyle() override {}
virtual void SetCellMap() override; virtual void SetCellMap() override;
private: private:
void Read() override; void Read() override;
virtual rtl::Reference<XFCell> ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol) override;
LwpObjectID cconnectedlayout; LwpObjectID cconnectedlayout;
}; };
...@@ -166,7 +176,6 @@ public: ...@@ -166,7 +176,6 @@ public:
virtual ~LwpConnectedCellLayout() override; virtual ~LwpConnectedCellLayout() override;
virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CONNECTED_CELL_LAYOUT;} virtual LWP_LAYOUT_TYPE GetLayoutType () override { return LWP_CONNECTED_CELL_LAYOUT;}
virtual void Parse(IXFStream* pOutputStream) override; 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_uInt16 GetNumrows(){return m_nRealrowspan;}
sal_uInt8 GetNumcols(){return m_nRealcolspan;} sal_uInt8 GetNumcols(){return m_nRealcolspan;}
virtual void SetCellMap() override; virtual void SetCellMap() override;
...@@ -175,6 +184,7 @@ protected: ...@@ -175,6 +184,7 @@ protected:
void Read() override; void Read() override;
virtual sal_uInt16 GetBelowRowID(sal_uInt16 nRow) override {return nRow + m_nRealrowspan; }; 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 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_uInt16 cnumrows;
sal_uInt8 cnumcols; sal_uInt8 cnumcols;
sal_uInt16 m_nRealrowspan; sal_uInt16 m_nRealrowspan;
......
...@@ -232,7 +232,7 @@ void LwpRowLayout::ConvertRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt8 ...@@ -232,7 +232,7 @@ void LwpRowLayout::ConvertRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt8
{ {
sal_uInt8 nColID = m_ConnCellList[nMarkConnCell]->GetColID() sal_uInt8 nColID = m_ConnCellList[nMarkConnCell]->GetColID()
+m_ConnCellList[nMarkConnCell]->GetNumcols()-1; +m_ConnCellList[nMarkConnCell]->GetNumcols()-1;
xXFCell = m_ConnCellList[nMarkConnCell]->ConvertCell( xXFCell = m_ConnCellList[nMarkConnCell]->DoConvertCell(
pTable->GetObjectID(), pTable->GetObjectID(),
crowid+m_ConnCellList[nMarkConnCell]->GetNumrows()-1, crowid+m_ConnCellList[nMarkConnCell]->GetNumrows()-1,
m_ConnCellList[nMarkConnCell]->GetColID()); m_ConnCellList[nMarkConnCell]->GetColID());
...@@ -401,7 +401,7 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa ...@@ -401,7 +401,7 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
nCellEndCol = i+pConnCell->GetNumcols()-1; nCellEndCol = i+pConnCell->GetNumcols()-1;
i = nCellEndCol; i = nCellEndCol;
} }
xCell = pCellLayout->ConvertCell(pTable->GetObjectID(),crowid,i); xCell = pCellLayout->DoConvertCell(pTable->GetObjectID(),crowid,i);
break; break;
} }
rCellID = pCellLayout->GetNext(); rCellID = pCellLayout->GetNext();
...@@ -414,7 +414,7 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa ...@@ -414,7 +414,7 @@ void LwpRowLayout::ConvertCommonRow(rtl::Reference<XFTable> const & pXFTable, sa
LwpCellLayout * pDefaultCell = pTableLayout->GetDefaultCellLayout(); LwpCellLayout * pDefaultCell = pTableLayout->GetDefaultCellLayout();
if (pDefaultCell) if (pDefaultCell)
{ {
xCell = pDefaultCell->ConvertCell( xCell = pDefaultCell->DoConvertCell(
pTable->GetObjectID(),crowid, i); pTable->GetObjectID(),crowid, i);
} }
else else
......
...@@ -1361,7 +1361,7 @@ void LwpTableLayout::ConvertDefaultRow(rtl::Reference<XFTable> const & pXFTable, ...@@ -1361,7 +1361,7 @@ void LwpTableLayout::ConvertDefaultRow(rtl::Reference<XFTable> const & pXFTable,
rtl::Reference<XFCell> xCell; rtl::Reference<XFCell> xCell;
if (m_pDefaultCellLayout) if (m_pDefaultCellLayout)
{ {
xCell = m_pDefaultCellLayout->ConvertCell( xCell = m_pDefaultCellLayout->DoConvertCell(
GetTable()->GetObjectID(),nRowID,j+nStartCol); GetTable()->GetObjectID(),nRowID,j+nStartCol);
} }
else else
......
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