[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sw/qa writerfilter/source
Justin Luth
justin_luth at sil.org
Fri Feb 2 08:56:54 UTC 2018
sw/qa/extras/ooxmlexport/data/section_break_numbering.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 18 +++++++++++++
writerfilter/source/dmapper/DomainMapper.cxx | 4 ++
3 files changed, 21 insertions(+), 1 deletion(-)
New commits:
commit 4b282dc07884f39d31edffb256e608e91eb266b3
Author: Justin Luth <justin_luth at sil.org>
Date: Tue Dec 20 13:51:26 2016 +0300
related to tdf#97417: fix unit test's early para numbering
The unit test's first blank page already started the paragraph
numbering. Setting it so that a contentless, single paragraph
section will not display numbering. In fact, no dummy paragraph
should have numbering, but that would get complicated.
This is in preparation for tdf#104710.
Reviewed-on: https://gerrit.libreoffice.org/32235
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
(cherry picked from commit c829e01e973ac32fb625925ce83f843ad30d94db)
Reviewed-on: https://gerrit.libreoffice.org/32326
Reviewed-by: Justin Luth <justin_luth at sil.org>
Change-Id: I98c9926cb3cd1e3fe3cd43bf46cab22bfbec7eba
Reviewed-on: https://gerrit.libreoffice.org/49035
Reviewed-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/qa/extras/ooxmlexport/data/section_break_numbering.docx b/sw/qa/extras/ooxmlexport/data/section_break_numbering.docx
new file mode 100755
index 000000000000..8b5378a771e5
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/section_break_numbering.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 3d9d749ed458..90968b7a53d0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -842,6 +842,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103982, "tdf103982.docx")
CPPUNIT_ASSERT(nDistB >= 0);
}
+DECLARE_OOXMLEXPORT_TEST(testTdf97417, "section_break_numbering.docx")
+{
+ uno::Reference<beans::XPropertySet> xProps(getParagraph(1), uno::UNO_QUERY_THROW);
+ auto prop = xProps->getPropertyValue("NumberingRules");
+
+ CPPUNIT_ASSERT_MESSAGE("1st page: first paragraph erroneous numbering",
+ !xProps->getPropertyValue("NumberingRules").hasValue());
+ // paragraph with numbering and section break was removed by writerfilter
+ // but its numbering was copied to all following paragraphs
+ CPPUNIT_ASSERT_MESSAGE("2nd page: first paragraph missing numbering",
+ getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(2), "NumberingRules").is());
+ xProps = uno::Reference<beans::XPropertySet>(getParagraph(3), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_MESSAGE("2nd page: second paragraph erroneous numbering",
+ !xProps->getPropertyValue("NumberingRules").hasValue());
+
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index eec33d46246f..e364d23f0091 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3277,7 +3277,9 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
// If the paragraph contains only the section properties and it has
// no runs, we should not create a paragraph for it in Writer, unless that would remove the whole section.
bool bRemove = !m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() && !bSingleParagraph && !m_pImpl->GetIsDummyParaAddedForTableInSection();
- PropertyMapPtr xContext = bRemove ? m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) : PropertyMapPtr();
+
+ const bool bNoNumbering = bRemove || (!m_pImpl->GetParaChanged() && m_pImpl->GetParaSectpr() && bSingleParagraph);
+ PropertyMapPtr xContext = bNoNumbering ? m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH) : PropertyMapPtr();
if (xContext)
{
// tdf#97417 delete numbering of the paragraph
More information about the Libreoffice-commits
mailing list