diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-02-03 21:16:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-02-04 12:30:00 +0100 |
commit | 35e43ce1b1f32acab5bba15425fa86fa0edd6c52 (patch) | |
tree | b42c28405bf1a3a72a0b55b70a17218dcfd0ce19 /lotuswordpro/source | |
parent | be936c5896045794b251a63ab1175ac06a36eee5 (diff) |
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 <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro/source')
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.cxx | 24 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwptablelayout.hxx | 15 |
2 files changed, 38 insertions, 1 deletions
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; |