lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp |binary lotuswordpro/source/filter/lwptablelayout.cxx | 24 ++++++++++++++++++++++- lotuswordpro/source/filter/lwptablelayout.hxx | 15 ++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-)
New commits: commit 35e43ce1b1f32acab5bba15425fa86fa0edd6c52 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Feb 3 21:16:27 2020 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Feb 4 12:30:00 2020 +0100 ofz#20507 infinite table conversion Change-Id: I779ab29d93491a296156fcc14557755754c2afdf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87924 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp b/lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp new file mode 100644 index 000000000000..26fc903db6bc Binary files /dev/null and b/lotuswordpro/qa/cppunit/data/pass/ofz20507-1.lwp differ diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index 0698b1b56a7e..6cf91d345506 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -81,10 +81,12 @@ #include <xfilter/xffloatframe.hxx> #include "lwpframelayout.hxx" #include <xfilter/xfparastyle.hxx> -#include <memory> #include <o3tl/sorted_vector.hxx> #include <sal/log.hxx> +#include <algorithm> +#include <memory> + LwpSuperTableLayout::LwpSuperTableLayout(LwpObjectHeader const &objHdr, LwpSvStream* pStrm) : LwpPlacableLayout(objHdr, pStrm) { @@ -1057,6 +1059,14 @@ bool LwpTableLayout::FindSplitColMark(XFTable* pXFTable, sal_uInt8* pCellMark, return bFindFlag; } +static bool operator==(const TableConvertAttempt& a, const TableConvertAttempt& b) +{ + return a.mnStartRow == b.mnStartRow && + a.mnEndRow == b.mnEndRow && + a.mnStartCol== b.mnStartCol && + a.mnEndCol == b.mnEndCol; +} + /** * @short convert word pro table to SODC table * @param pXFTable - pointer of table @@ -1068,6 +1078,16 @@ bool LwpTableLayout::FindSplitColMark(XFTable* pXFTable, sal_uInt8* pCellMark, void LwpTableLayout::ConvertTable(rtl::Reference<XFTable> const & pXFTable, sal_uInt16 nStartRow, sal_uInt16 nEndRow,sal_uInt8 nStartCol,sal_uInt8 nEndCol) { + TableConvertAttempt aConversionAttempt(nStartRow, nEndRow, nStartCol, nEndCol); + auto itr = std::find(m_aConvertingStack.begin(), m_aConvertingStack.end(), aConversionAttempt); + if (itr != m_aConvertingStack.end()) + { + SAL_WARN("lwp", "already trying to convert this range"); + return; + } + + m_aConvertingStack.push_back(aConversionAttempt); + //out put column info TO BE CHANGED ConvertColumn(pXFTable,nStartCol,nEndCol); @@ -1096,6 +1116,8 @@ void LwpTableLayout::ConvertTable(rtl::Reference<XFTable> const & pXFTable, sal_ } } } + + m_aConvertingStack.pop_back(); } /** diff --git a/lotuswordpro/source/filter/lwptablelayout.hxx b/lotuswordpro/source/filter/lwptablelayout.hxx index 5e232dba73b4..9cc0c885aa49 100644 --- a/lotuswordpro/source/filter/lwptablelayout.hxx +++ b/lotuswordpro/source/filter/lwptablelayout.hxx @@ -81,6 +81,19 @@ class LwpRowHeadingLayout; class LwpConnectedCellLayout; class LwpColumnLayout; +struct TableConvertAttempt +{ + sal_uInt16 mnStartRow; + sal_uInt16 mnEndRow; + sal_uInt8 mnStartCol; + sal_uInt8 mnEndCol; + + TableConvertAttempt(sal_uInt16 nStartRow, sal_uInt16 nEndRow, sal_uInt8 nStartCol, sal_uInt8 nEndCol) + : mnStartRow(nStartRow), mnEndRow(nEndRow), mnStartCol(nStartCol), mnEndCol(nEndCol) + { + } +}; + /** * @brief * VO_TABLELAYOUT object and functions for registering styles and converting tables @@ -115,6 +128,8 @@ protected: sal_uInt16 m_nRows; sal_uInt16 m_nCols; + std::vector<TableConvertAttempt> m_aConvertingStack; + private: //CColumnLayoutHead cColumnLayout; LwpObjectID m_ColumnLayout; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits