tdf#141966 writerfilter CN: set minimum threshold
I have found that in both DOC and DOCX numbering bugs,
many can be fixed simply by not assigning Chapter Numbering
at all. So set a minimum threshold to deter useless assignments.
[Note that a LO round-trip should save as numId 1,
and thus a single entry would make it qualify.
For Word-authored documents, this threshold means
at least 3 Heading X styles (which matches LO default workflow)
or 6 out of 9 Levels defined for non-heading styles.]
Change-Id: Ic3d1c800a703721e7ab5302e274ee1eeda496ac0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118543
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 98c6345..6211863 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -1181,8 +1181,9 @@ ListDef::Pointer ListsManager::GetList( sal_Int32 nId )
void ListsManager::CreateNumberingRules( )
{
// Try to determine which numId would best work as LO's Chapter Numbering Outline rule.
// (The best fix for many import bugs is just to prevent ANY assignment as chapter numbering.)
sal_Int16 nChosenAsChapterNumberingId = -1;
sal_uInt16 nHighestWeight = 0;
sal_uInt16 nHighestWeight = 5; // arbitrarily chosen minimum threshold
for (const auto& rList : m_aLists)
{
sal_uInt16 nWeight = rList->GetChapterNumberingWeight();