summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapperTableManager.cxx
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-05-04 13:42:14 +0200
committerLászló Németh <nemeth@numbertext.org>2020-05-04 17:55:28 +0200
commit81ce88aa80f8e7cde4fdc5b211e9500a3599643c (patch)
treee343d94d8d304e97b82fe42efaabb810b6f3e04f /writerfilter/source/dmapper/DomainMapperTableManager.cxx
parent224c155d89e4d957c0d566a5aea6004a466d54e9 (diff)
tdf#132514 DOCX import: fix lost table style with footer
Table paragraphs collected for table style processing were mixed when both body text and footer contain tables, i.e. clearing paragraph vector at processing the first table resulted missing paragraph vector and table style processing for the other one. Now tables in footer, also nested tables collect their paragraphs in separated table paragraph vectors. Regression from commit 6c5da2cd7af5c2d90e4d8e9635ba8c9989c87923 (tdf#119054 DOCX: fix not table style based bottom margin). Change-Id: Ib8568d8379cfb7da869120cdc7fe12895252d661 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93415 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapperTableManager.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index a1bb10e74850..9e7cf46cca40 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -50,6 +50,7 @@ DomainMapperTableManager::DomainMapperTableManager() :
m_bPushCurrentWidth(false),
m_bTableSizeTypeInserted(false),
m_nLayoutType(0),
+ m_aParagraphsToEndTable(),
m_pTablePropsHandler(new TablePropertiesHandler())
{
m_pTablePropsHandler->SetTableManager( this );
@@ -424,6 +425,11 @@ TablePositionHandler* DomainMapperTableManager::getCurrentTableRealPosition()
return nullptr;
}
+TableParagraphVectorPtr DomainMapperTableManager::getCurrentParagraphs( )
+{
+ return m_aParagraphsToEndTable.top( );
+}
+
void DomainMapperTableManager::setIsInShape(bool bIsInShape)
{
m_bIsInShape = bIsInShape;
@@ -440,6 +446,12 @@ void DomainMapperTableManager::startLevel( )
oCurrentWidth = m_aCellWidths.back()->back();
m_aCellWidths.back()->pop_back();
}
+ std::optional<TableParagraph> oParagraph;
+ if (getTableDepthDifference() > 0 && !m_aParagraphsToEndTable.empty() && !m_aParagraphsToEndTable.top()->empty())
+ {
+ oParagraph = m_aParagraphsToEndTable.top()->back();
+ m_aParagraphsToEndTable.top()->pop_back();
+ }
IntVectorPtr pNewGrid = std::make_shared<vector<sal_Int32>>();
IntVectorPtr pNewSpans = std::make_shared<vector<sal_Int32>>();
@@ -460,10 +472,14 @@ void DomainMapperTableManager::startLevel( )
m_aGridBefore.push_back( 0 );
m_nTableWidth = 0;
m_nLayoutType = 0;
+ TableParagraphVectorPtr pNewParagraphs = std::make_shared<vector<TableParagraph>>();
+ m_aParagraphsToEndTable.push( pNewParagraphs );
// And push it back to the right level.
if (oCurrentWidth)
m_aCellWidths.back()->push_back(*oCurrentWidth);
+ if (oParagraph)
+ m_aParagraphsToEndTable.top()->push_back(*oParagraph);
}
void DomainMapperTableManager::endLevel( )
@@ -508,6 +524,7 @@ void DomainMapperTableManager::endLevel( )
// in the endTable method called in endLevel.
m_aTablePositions.pop_back();
m_aTableStyleNames.pop_back();
+ m_aParagraphsToEndTable.pop();
}
void DomainMapperTableManager::endOfCellAction()