[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - solenv/clang-format sw/CppunitTest_sw_ooxmlexport16.mk sw/Module_sw.mk sw/qa writerfilter/source
Justin Luth (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 22 07:29:30 UTC 2021
solenv/clang-format/blacklist | 1
sw/CppunitTest_sw_ooxmlexport16.mk | 14 ++++
sw/Module_sw.mk | 1
sw/qa/extras/ooxmlexport/data/tdf138892_noNumbering.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 43 +++++++++++++++
writerfilter/source/dmapper/DomainMapper.cxx | 6 +-
writerfilter/source/dmapper/DomainMapper.hxx | 2
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 8 +-
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2
9 files changed, 69 insertions(+), 8 deletions(-)
New commits:
commit fe856843c29e22a73c5218db97db5210cf959720
Author: Justin Luth <justin.luth at collabora.com>
AuthorDate: Tue Dec 15 10:01:03 2020 +0300
Commit: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Thu Apr 22 09:28:56 2021 +0200
tdf#138892 writerfilter: cancel style list if bNoNumbering
This fixes 6.1 regression from tdf#95377's
commit e24e2d2fb02239753c1520a0458b44683ea4cc2e.
Starting in 7.0 (tdf#131321), paragraph styles kept their
numbering property. But even before that, non-paragraphs
marked by bNoNumbering were having their direct numbering
removed, and then finishParagraph applied para-style
numbering since there was no direct numbering.
So, we need to pass the bNoNumbering to finishParagraph
so that it can cancel out a style-assigned numbering.
Change-Id: I0c24af4e9bd0ea3712179a47ed3550f91c8f44b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107738
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth at sil.org>
(cherry picked from commit bfcd952dc7820c4cf8761c4222d29ede039391dc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107795
(cherry picked from commit e901ffcb93d217f2cc09021a3b2fecb36f9884f6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107796
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Justin Luth <justin_luth at sil.org>
(cherry picked from commit 88aa8f5343705008b86ef41512993a00d331a668)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114423
Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 5a1512485d53..b01ce8d1f15a 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -14200,6 +14200,7 @@ sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
diff --git a/sw/CppunitTest_sw_ooxmlexport16.mk b/sw/CppunitTest_sw_ooxmlexport16.mk
new file mode 100644
index 000000000000..4e78cef57760
--- /dev/null
+++ b/sw/CppunitTest_sw_ooxmlexport16.mk
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call sw_ooxmlexport_test,16))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index be2e7e8d86c7..c1dff1df5c5a 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -81,6 +81,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
CppunitTest_sw_ooxmlexport13 \
CppunitTest_sw_ooxmlexport14 \
CppunitTest_sw_ooxmlexport15 \
+ CppunitTest_sw_ooxmlexport16 \
CppunitTest_sw_ooxmlexport_template \
CppunitTest_sw_ooxmlfieldexport \
CppunitTest_sw_ooxmllinks \
diff --git a/sw/qa/extras/ooxmlexport/data/tdf138892_noNumbering.docx b/sw/qa/extras/ooxmlexport/data/tdf138892_noNumbering.docx
new file mode 100644
index 000000000000..5c0a0176e37c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf138892_noNumbering.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
new file mode 100644
index 000000000000..174f2f0f7330
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <swmodeltestbase.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+
+char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/";
+
+class Test : public SwModelTestBase
+{
+public:
+ Test() : SwModelTestBase(DATA_DIRECTORY, "Office Open XML Text") {}
+
+protected:
+ /**
+ * Denylist handling
+ */
+ bool mustTestImportOf(const char* filename) const override {
+ // If the testcase is stored in some other format, it's pointless to test.
+ return OString(filename).endsWith(".docx");
+ }
+};
+
+DECLARE_OOXMLEXPORT_TEST(testTdf138892_noNumbering, "tdf138892_noNumbering.docx")
+{
+ CPPUNIT_ASSERT_MESSAGE("Para1: Bullet point", !getProperty<OUString>(getParagraph(1), "NumberingStyleName").isEmpty());
+ CPPUNIT_ASSERT_MESSAGE("Para2: <blank line>", getProperty<OUString>(getParagraph(2), "NumberingStyleName").isEmpty());
+ CPPUNIT_ASSERT_MESSAGE("Para3: <blank line>", getProperty<OUString>(getParagraph(3), "NumberingStyleName").isEmpty());
+}
+
+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 909f055da826..1bada3877e29 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3527,7 +3527,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
xContext->Erase(PROP_NUMBERING_LEVEL);
}
m_pImpl->SetParaSectpr(false);
- finishParagraph(bRemove);
+ finishParagraph(bRemove, bNoNumbering);
if (bRemove)
m_pImpl->RemoveLastParagraph();
}
@@ -4008,11 +4008,11 @@ void DomainMapper::HandleRedline( Sprm& rSprm )
m_pImpl->SetCurrentRedlineIsRead();
}
-void DomainMapper::finishParagraph(const bool bRemove)
+void DomainMapper::finishParagraph(const bool bRemove, const bool bNoNumbering)
{
if (m_pImpl->m_pSdtHelper->validateDateFormat())
m_pImpl->m_pSdtHelper->createDateContentControl();
- m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH), bRemove);
+ m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH), bRemove, bNoNumbering);
}
} //namespace writerfilter
diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx
index c8281f9334ec..179f06ccd77c 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -161,7 +161,7 @@ private:
// Table
virtual void lcl_entry(writerfilter::Reference<Properties>::Pointer_t ref) override;
- void finishParagraph(const bool bRemove = false);
+ void finishParagraph(const bool bRemove = false, const bool bNoNumbering = false);
static void handleUnderlineType(const Id nId, const ::tools::SvRef<PropertyMap>& rContext);
void handleParaJustification(const sal_Int32 nIntValue, const ::tools::SvRef<PropertyMap>& rContext, const bool bExchangeLeftRight);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 68cf33bfcb08..16b3743ee2fc 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1347,7 +1347,7 @@ static sal_Int32 lcl_getListId(const StyleSheetEntryPtr& rEntry, const StyleShee
return lcl_getListId(pParent, rStyleTable, rNumberingFromBaseStyle);
}
-void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove )
+void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove, const bool bNoNumbering )
{
if (m_bDiscardHeaderFooter)
return;
@@ -1402,7 +1402,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
//apply numbering level/style to paragraph if it was set at the style, but only if the paragraph itself
//does not specify the numbering
const sal_Int16 nListLevel = pStyleSheetProperties->GetListLevel();
- if ( !isNumberingViaRule && nListLevel >= 0 )
+ if ( !bNoNumbering && !isNumberingViaRule && nListLevel >= 0 )
pParaContext->Insert( PROP_NUMBERING_LEVEL, uno::makeAny(nListLevel), false );
bool bNumberingFromBaseStyle = false;
@@ -1410,7 +1410,9 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
auto const pList(GetListTable()->GetList(nListId));
if (pList && nListId >= 0 && !pParaContext->isSet(PROP_NUMBERING_STYLE_NAME))
{
- if ( !isNumberingViaRule )
+ if ( bNoNumbering )
+ pParaContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny(OUString()) );
+ else if ( !isNumberingViaRule )
{
isNumberingViaStyle = true;
// Since LO7.0/tdf#131321 fixed the loss of numbering in styles, this OUGHT to be obsolete,
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 54c80674a7ae..d4a78a2b0237 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -677,7 +677,7 @@ public:
void setParaSdtEndDeferred(bool bParaSdtEndDeferred);
bool isParaSdtEndDeferred() const;
- void finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove = false);
+ void finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove = false, const bool bNoNumbering = false);
void appendTextPortion( const OUString& rString, const PropertyMapPtr& pPropertyMap );
void appendTextContent(const css::uno::Reference<css::text::XTextContent>&, const css::uno::Sequence<css::beans::PropertyValue>&);
void appendOLE( const OUString& rStreamName, const std::shared_ptr<OLEHandler>& pOleHandler );
More information about the Libreoffice-commits
mailing list