[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/qa writerfilter/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 13 21:21:13 UTC 2020
sw/qa/extras/ooxmlexport/data/tdf132514.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 10 ++++++++
writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 3 --
writerfilter/source/dmapper/DomainMapperTableManager.cxx | 17 +++++++++++++++
writerfilter/source/dmapper/DomainMapperTableManager.hxx | 3 ++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 2 -
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 10 --------
writerfilter/source/dmapper/PropertyMap.hxx | 9 +++++++
8 files changed, 41 insertions(+), 13 deletions(-)
New commits:
commit e640f2e8410b952296fd8101ef88c234c50b90fe
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Mon May 4 13:42:14 2020 +0200
Commit: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Mon Jul 13 23:20:38 2020 +0200
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 at 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 at collabora.com>
(cherry picked from commit 6b812999c944e50ac7a9ac8245800f4cf99421ce)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98642
Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf132514.docx b/sw/qa/extras/ooxmlexport/data/tdf132514.docx
new file mode 100644
index 000000000000..d32f84104e26
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132514.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index bfd67a6ede7a..2b6b4c58307d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -481,6 +481,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf119054, "tdf119054.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "line", "240");
}
+DECLARE_OOXMLEXPORT_TEST(testTdf132514, "tdf132514.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport();
+ if (!pXmlDoc)
+ return;
+ // Keep table style setting, when the footer also contain a table
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:p[2]/w:pPr/w:spacing", "before", "0");
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[2]/w:p[2]/w:pPr/w:spacing", "after", "0");
+}
+
DECLARE_OOXMLEXPORT_TEST(testFdo69636, "fdo69636.docx")
{
/*
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 c16485d48771..0b60c823b9d0 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 );
@@ -431,6 +432,11 @@ TablePositionHandler* DomainMapperTableManager::getCurrentTableRealPosition()
return nullptr;
}
+TableParagraphVectorPtr DomainMapperTableManager::getCurrentParagraphs( )
+{
+ return m_aParagraphsToEndTable.top( );
+}
+
void DomainMapperTableManager::setIsInShape(bool bIsInShape)
{
m_bIsInShape = bIsInShape;
@@ -447,6 +453,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> );
@@ -465,10 +477,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( )
@@ -512,6 +528,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 b3357d97fb45..0777188dedba 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1723,7 +1723,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 483f8f92715c..7291973be2a1 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -418,13 +418,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
{
@@ -1063,9 +1056,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
More information about the Libreoffice-commits
mailing list