summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapperTableManager.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2020-06-29 12:33:07 +0300
committerJustin Luth <justin_luth@sil.org>2020-07-07 18:32:16 +0200
commit2ad32b39af2e00ef253a2ef99e033feef416808f (patch)
tree14dbed8a599995624403eb73345680f59b4d61da /writerfilter/source/dmapper/DomainMapperTableManager.cxx
parentc0929d4b558137a20eff1366a4b8202063306f13 (diff)
tdf#129452 writerfilter: preserve gridBefore longer than currentRow
It is a fairly common thing for table operations to need to compare items in the same column (like merged cells for example). In order to determine column information, each row's gridBefore (and merged cells) need to be known. So save that information in the row data - and don't just throw it away after the current row has been analyzed. Good grief. Change-Id: Ie305477f0e3468a4a923095d76f520d97fe99ffe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97432 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapperTableManager.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.cxx26
1 files changed, 7 insertions, 19 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 2d75c971b85a..c16ee820528f 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -40,7 +40,6 @@ DomainMapperTableManager::DomainMapperTableManager() :
m_nRow(0),
m_nCell(),
m_nGridSpan(1),
- m_aGridBefore(),
m_nGridAfter(0),
m_nHeaderRepeat(0),
m_nTableWidth(0),
@@ -354,7 +353,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
}
break;
case NS_ooxml::LN_CT_TrPrBase_gridBefore:
- m_aGridBefore.back( ) = nIntValue;
+ setCurrentGridBefore( nIntValue );
break;
case NS_ooxml::LN_CT_TrPrBase_gridAfter:
m_nGridAfter = nIntValue;
@@ -394,11 +393,6 @@ DomainMapperTableManager::IntVectorPtr const & DomainMapperTableManager::getCurr
return m_aTableGrid.back( );
}
-sal_uInt32 DomainMapperTableManager::getCurrentGridBefore( )
-{
- return m_aGridBefore.back( );
-}
-
DomainMapperTableManager::IntVectorPtr const & DomainMapperTableManager::getCurrentSpans( )
{
return m_aGridSpans.back( );
@@ -469,7 +463,6 @@ void DomainMapperTableManager::startLevel( )
m_aTmpPosition.push_back( pTmpPosition );
m_aTmpTableProperties.push_back( pTmpProperties );
m_nCell.push_back( 0 );
- m_aGridBefore.push_back( 0 );
m_nTableWidth = 0;
m_nLayoutType = 0;
TableParagraphVectorPtr pNewParagraphs = std::make_shared<vector<TableParagraph>>();
@@ -503,7 +496,6 @@ void DomainMapperTableManager::endLevel( )
m_aCellWidths.back()->push_back(*oCurrentWidth);
m_nCell.pop_back( );
- m_aGridBefore.pop_back( );
m_nTableWidth = 0;
m_nLayoutType = 0;
@@ -579,7 +571,6 @@ void DomainMapperTableManager::endOfRowAction()
IntVectorPtr pTmpGridSpans = m_aGridSpans.back();
IntVectorPtr pTmpCellWidths = m_aCellWidths.back();
sal_uInt32 nTmpCell = m_nCell.back();
- sal_uInt32 nTmpGridBefore = m_aGridBefore.back();
TableParagraphVectorPtr pTableParagraphs = getCurrentParagraphs();
// endLevel and startLevel are taking care of the non finished row
@@ -593,12 +584,10 @@ void DomainMapperTableManager::endOfRowAction()
m_aGridSpans.pop_back();
m_aCellWidths.pop_back();
m_nCell.pop_back();
- m_aGridBefore.pop_back();
m_aTableGrid.push_back(pTmpTableGrid);
m_aGridSpans.push_back(pTmpGridSpans);
m_aCellWidths.push_back(pTmpCellWidths);
m_nCell.push_back(nTmpCell);
- m_aGridBefore.push_back(nTmpGridBefore);
m_aParagraphsToEndTable.pop( );
m_aParagraphsToEndTable.push( pTableParagraphs );
}
@@ -652,15 +641,15 @@ void DomainMapperTableManager::endOfRowAction()
IntVectorPtr pCurrentSpans = getCurrentSpans( );
- if( m_aGridBefore.back() > 0 )
+ if ( getCurrentGridBefore() )
{
//fill missing gridBefore elements with '1'
- pCurrentSpans->insert( pCurrentSpans->begin( ), m_aGridBefore.back(), 1 );
+ pCurrentSpans->insert( pCurrentSpans->begin(), getCurrentGridBefore(), 1 );
}
- if( pCurrentSpans->size() < m_aGridBefore.back() + m_nCell.back( ))
+ if ( pCurrentSpans->size() < getCurrentGridBefore() + m_nCell.back() )
{
//fill missing elements with '1'
- pCurrentSpans->insert( pCurrentSpans->end( ), m_aGridBefore.back() + m_nCell.back( ) - pCurrentSpans->size(), 1 );
+ pCurrentSpans->insert( pCurrentSpans->end(), getCurrentGridBefore() + m_nCell.back() - pCurrentSpans->size(), 1 );
}
#ifdef DBG_UTIL
@@ -718,12 +707,12 @@ void DomainMapperTableManager::endOfRowAction()
}
}
}
- uno::Sequence< text::TableColumnSeparator > aSeparators( m_aGridBefore.back() + m_nCell.back( ) - 1 );
+ uno::Sequence< text::TableColumnSeparator > aSeparators( getCurrentGridBefore() + m_nCell.back() - 1 );
text::TableColumnSeparator* pSeparators = aSeparators.getArray();
double nLastRelPos = 0.0;
sal_uInt32 nBorderGridIndex = 0;
- size_t nWidthsBound = m_aGridBefore.back() + m_nCell.back() - 1;
+ size_t nWidthsBound = getCurrentGridBefore() + m_nCell.back() - 1;
if (nWidthsBound)
{
if (nFullWidthRelative == 0)
@@ -840,7 +829,6 @@ void DomainMapperTableManager::endOfRowAction()
++m_nRow;
m_nCell.back( ) = 0;
- m_aGridBefore.back( ) = 0;
getCurrentGrid()->clear();
pCurrentSpans->clear();
pCellWidths->clear();