diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-03-15 16:54:03 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-03-15 21:11:43 +0100 |
commit | b1b9049c186dc84641774edc9e27eabd8b6ade76 (patch) | |
tree | 636dfcb555a7f9c41574f60073b4df29e582f43d /writerfilter | |
parent | 5a5142999c4e557b80b09f80d967083a02094b5f (diff) |
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 <caolanm@redhat.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableManager.cxx | 18 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableManager.hxx | 2 |
2 files changed, 15 insertions, 5 deletions
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: |