writerfilter/source/dmapper/DomainMapperTableManager.cxx | 18 ++++++++++----- writerfilter/source/dmapper/DomainMapperTableManager.hxx | 2 + 2 files changed, 15 insertions(+), 5 deletions(-)
New commits: commit b1b9049c186dc84641774edc9e27eabd8b6ade76 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Mar 15 16:54:03 2020 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Mar 15 21:11:43 2020 +0100 cid#1460667 rework to avoid Assign instead of compare Change-Id: Icda6543d674b826ec344d3f1570b5463df9dcf29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90535 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index ae2d012072c3..891a00d4a63c 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -517,6 +517,18 @@ void DomainMapperTableManager::endOfCellAction() ++m_nCell.back( ); } +bool DomainMapperTableManager::shouldInsertRow(IntVectorPtr pCellWidths, IntVectorPtr pTableGrid, size_t nGrids, bool& rIsIncompleteGrid) +{ + if (pCellWidths->empty()) + return false; + if (m_nLayoutType == NS_ooxml::LN_Value_doc_ST_TblLayout_fixed) + return true; + if (pCellWidths->size() == (nGrids + m_nGridAfter)) + return true; + rIsIncompleteGrid = true; + return nGrids + m_nGridAfter > pTableGrid->size(); +} + void DomainMapperTableManager::endOfRowAction() { #ifdef DBG_UTIL @@ -716,11 +728,7 @@ void DomainMapperTableManager::endOfRowAction() #endif insertRowProps(pPropMap); } - else if ( !pCellWidths->empty() && - ( m_nLayoutType == NS_ooxml::LN_Value_doc_ST_TblLayout_fixed - || pCellWidths->size() == ( nGrids + m_nGridAfter ) - || ((bIsIncompleteGrid = true) && nGrids + m_nGridAfter > pTableGrid->size()) ) - ) + else if (shouldInsertRow(pCellWidths, pTableGrid, nGrids, bIsIncompleteGrid)) { // If we're here, then the number of cells does not equal to the amount // defined by the grid, even after taking care of diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx index edf24a3a84e3..0801e9dd9280 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx @@ -67,6 +67,8 @@ class DomainMapperTableManager : public TableManager std::unique_ptr<TablePropertiesHandler> m_pTablePropsHandler; PropertyMapPtr m_pStyleProps; + bool shouldInsertRow(IntVectorPtr pCellWidths, IntVectorPtr pTableGrid, size_t nGrids, bool& rIsIncompleteGrid); + virtual void clearData() override; public: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits