summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-05-04 13:42:14 +0200
committerAndras Timar <andras.timar@collabora.com>2020-05-17 11:47:36 +0200
commited4d8eeca8754c91e22050a4717ec9975f1f8f36 (patch)
tree5aee06ed8889ac23543e91216c1a7f782afc5fdd /writerfilter
parent1a2db42562feec95af98e43d76107058e8e68102 (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. (Note: only missing bottom paragraph margin and line spacing were the problems here, not all table style based paragraph settings, as in branch 'master'.) 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). Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93415 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 81ce88aa80f8e7cde4fdc5b211e9500a3599643c) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport6.cxx writerfilter/source/dmapper/DomainMapperTableHandler.cxx writerfilter/source/dmapper/DomainMapperTableManager.cxx writerfilter/source/dmapper/DomainMapper_Impl.cxx writerfilter/source/dmapper/PropertyMap.hxx Change-Id: Ib8568d8379cfb7da869120cdc7fe12895252d661 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93525 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx3
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.cxx17
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.hxx3
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx2
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx10
-rw-r--r--writerfilter/source/dmapper/PropertyMap.hxx9
6 files changed, 31 insertions, 13 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index a0b214a76555..5a0ee4eb8b16 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1026,7 +1026,7 @@ void DomainMapperTableHandler::ApplyParaProperty(css::beans::PropertyValues aTab
if (pTableProp != aTableProperties.end())
{
uno::Any aValue = pTableProp->Value;
- for (const auto& rParaProp : m_rDMapper_Impl.m_aParagraphsToEndTable)
+ for (const auto& rParaProp : *m_rDMapper_Impl.getTableManager().getCurrentParagraphs())
{
// there is no direct paragraph formatting
if (!rParaProp.m_pPropertyMap->isSet(eId))
@@ -1224,7 +1224,6 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel, bool bTab
m_aCellProperties.clear();
m_aRowProperties.clear();
m_bHadFootOrEndnote = false;
- m_rDMapper_Impl.m_aParagraphsToEndTable.clear();
#ifdef DBG_UTIL
TagLogger::getInstance().endElement();
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index f4d025739915..618ca603efe6 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -57,6 +57,7 @@ DomainMapperTableManager::DomainMapperTableManager() :
m_bPushCurrentWidth(false),
m_bTableSizeTypeInserted(false),
m_nLayoutType(0),
+ m_aParagraphsToEndTable(),
m_pTablePropsHandler(new TablePropertiesHandler())
{
m_pTablePropsHandler->SetTableManager( this );
@@ -430,6 +431,11 @@ TablePositionHandler* DomainMapperTableManager::getCurrentTableRealPosition()
return nullptr;
}
+TableParagraphVectorPtr DomainMapperTableManager::getCurrentParagraphs( )
+{
+ return m_aParagraphsToEndTable.top( );
+}
+
void DomainMapperTableManager::setIsInShape(bool bIsInShape)
{
m_bIsInShape = bIsInShape;
@@ -446,6 +452,12 @@ void DomainMapperTableManager::startLevel( )
oCurrentWidth = m_aCellWidths.back()->back();
m_aCellWidths.back()->pop_back();
}
+ boost::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( new vector<sal_Int32> );
IntVectorPtr pNewSpans( new vector<sal_Int32> );
@@ -464,10 +476,14 @@ void DomainMapperTableManager::startLevel( )
m_aGridBefore.push_back( 0 );
m_nTableWidth = 0;
m_nLayoutType = 0;
+ TableParagraphVectorPtr pNewParagraphs( new 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( )
@@ -511,6 +527,7 @@ void DomainMapperTableManager::endLevel( )
// Pop back the table position after endLevel as it's used
// in the endTable method called in endLevel.
m_aTablePositions.pop_back();
+ m_aParagraphsToEndTable.pop();
}
void DomainMapperTableManager::endOfCellAction()
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
index 219986870ef3..a3a8487b22d9 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
@@ -65,6 +65,8 @@ class DomainMapperTableManager : public TableManager
bool m_bTableSizeTypeInserted;
/// Table layout algorithm, IOW if we should consider fixed column width or not.
sal_uInt32 m_nLayoutType;
+ /// Collected table paragraphs for table style handling
+ std::stack< TableParagraphVectorPtr > m_aParagraphsToEndTable;
std::unique_ptr<TablePropertiesHandler> m_pTablePropsHandler;
PropertyMapPtr m_pStyleProps;
@@ -94,6 +96,7 @@ public:
IntVectorPtr const & getCurrentSpans( );
IntVectorPtr const & getCurrentCellWidths( );
sal_uInt32 getCurrentGridBefore( );
+ TableParagraphVectorPtr getCurrentParagraphs( );
/// Turn the attributes collected so far in m_aTableLook into a property and clear the container.
void finishTableLook();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 5535db1cc1c5..d37082120bdd 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1739,7 +1739,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
if (xParaProps && m_nTableDepth > 0)
{
TableParagraph aPending{pParaContext, xParaProps};
- m_aParagraphsToEndTable.push_back(aPending);
+ getTableManager().getCurrentParagraphs()->push_back(aPending);
}
// tdf#118521 set paragraph top or bottom margin based on the paragraph style
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 6b1548af83fd..a37b4913bb5b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -422,13 +422,6 @@ struct SymbolData
{ }
};
-/// Information about a paragraph to be finished after a table end.
-struct TableParagraph
-{
- PropertyMapPtr m_pPropertyMap;
- css::uno::Reference<css::beans::XPropertySet> m_rPropertySet;
-};
-
class DomainMapper;
class DomainMapper_Impl final
{
@@ -1069,9 +1062,6 @@ public:
bool m_bIsActualParagraphFramed;
std::vector<css::uno::Any> aFramedRedlines;
- /// Table paragraph properties may need style update based on table style
- std::vector<TableParagraph> m_aParagraphsToEndTable;
-
private:
void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType);
// Start a new index section; if needed, finish current paragraph
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index 64e9969fa038..608496083636 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -576,6 +576,15 @@ public:
typedef tools::SvRef< TablePropertyMap > TablePropertyMapPtr;
+/// Information about a paragraph to be finished after a table end.
+struct TableParagraph
+{
+ PropertyMapPtr m_pPropertyMap;
+ css::uno::Reference<css::beans::XPropertySet> m_rPropertySet;
+};
+
+typedef std::shared_ptr< std::vector<TableParagraph> > TableParagraphVectorPtr;
+
} // namespace dmapper
} // namespace writerfilter