[Libreoffice-commits] core.git: sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Apr 20 08:44:12 UTC 2017
sw/qa/extras/ooxmlexport/data/tdf106690-cell.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 12 ++++++++++++
writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 5 +++++
writerfilter/source/dmapper/DomainMapperTableHandler.hxx | 2 ++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 5 +++++
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 4 ++++
writerfilter/source/dmapper/TableManager.cxx | 4 ++++
7 files changed, 32 insertions(+)
New commits:
commit 41bc9d4d467495c9fbf05c920a41fa299ac0ace3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Apr 20 09:12:36 2017 +0200
Related: tdf#106690 DOCX import: don't reduce auto-space accross cells
As suggested at <https://gerrit.libreoffice.org/#/c/36142/>, and it
indeed matches the Word behavior.
Change-Id: I1ba5b70fc5a7acab52fa4baf816e9f6cd2f913ba
Reviewed-on: https://gerrit.libreoffice.org/36719
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf106690-cell.docx b/sw/qa/extras/ooxmlexport/data/tdf106690-cell.docx
new file mode 100644
index 000000000000..e2ea6f4b0931
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf106690-cell.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index a7d53cf39661..3311f1b68184 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -70,6 +70,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106690, "tdf106690.docx")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(494), getProperty<sal_Int32>(getParagraph(2), "ParaTopMargin"));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf106690Cell, "tdf106690-cell.docx")
+{
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+ // This was 0, bottom margin of the second paragraph in the A1 table cell
+ // had a reduced auto-space, just because of a next paragraph in the A2
+ // cell.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(494), getProperty<sal_Int32>(getParagraphOfText(2, xCell->getText()), "ParaBottomMargin"));
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf106970, "tdf106970.docx")
{
// The second paragraph (first numbered one) had 0 bottom margin:
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 8fa604a3710c..b79a1d71214b 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1266,6 +1266,11 @@ void DomainMapperTableHandler::setHadFootOrEndnote(bool bHadFootOrEndnote)
m_bHadFootOrEndnote = bHadFootOrEndnote;
}
+DomainMapper_Impl& DomainMapperTableHandler::getDomainMapperImpl()
+{
+ return m_rDMapper_Impl;
+}
+
}}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx
index 83dafa49a776..4881f37a8d9d 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx
@@ -116,6 +116,8 @@ public:
void endCell(const css::uno::Reference< css::text::XTextRange > & end);
void setHadFootOrEndnote(bool bHadFootOrEndnote);
+
+ DomainMapper_Impl& getDomainMapperImpl();
};
}}
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index c9369de68e31..912bb6672977 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2181,6 +2181,11 @@ bool DomainMapper_Impl::IsDiscardHeaderFooter()
return m_bDiscardHeaderFooter;
}
+void DomainMapper_Impl::ClearPreviousParagraph()
+{
+ m_xPreviousParagraph.clear();
+}
+
sal_Int16 lcl_ParseNumberingType( const OUString& rCommand )
{
sal_Int16 nRet = style::NumberingType::PAGE_DESCRIPTOR;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 82547b14325b..de7c95dda550 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -882,6 +882,10 @@ public:
void SetParaAutoBefore(bool bParaAutoBefore) { m_bParaAutoBefore = bParaAutoBefore; }
+ /// Forget about the previous paragraph, as it's not inside the same
+ /// start/end node.
+ void ClearPreviousParagraph();
+
private:
void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType);
std::vector<css::uno::Reference< css::drawing::XShape > > m_vTextFramesForChaining ;
diff --git a/writerfilter/source/dmapper/TableManager.cxx b/writerfilter/source/dmapper/TableManager.cxx
index c14ec25b0d28..32b77410e332 100644
--- a/writerfilter/source/dmapper/TableManager.cxx
+++ b/writerfilter/source/dmapper/TableManager.cxx
@@ -19,6 +19,7 @@
#include <TableManager.hxx>
#include <DomainMapperTableHandler.hxx>
+#include <DomainMapper_Impl.hxx>
#include <util.hxx>
namespace writerfilter
@@ -201,6 +202,9 @@ void TableManager::closeCell(const css::uno::Reference<css::text::XTextRange>& r
TableData::Pointer_t pTableData = mTableDataStack.top();
pTableData->endCell(rHandle);
+
+ if (mpTableDataHandler)
+ mpTableDataHandler->getDomainMapperImpl().ClearPreviousParagraph();
}
}
More information about the Libreoffice-commits
mailing list