tdf#106541 doc import: prevent inheriting when LFO == 0

When LFO == 0, that is a special case that means that
numbering should be disabled. (This can similarly be
accomplished by setting Lvl to 9 - Body text,
except doing so here could mess up Lvl inheritance).

If the LFO is a negative number, that indicates something
different with formatting that we don't currently handle,
but it still means cancel numbering. So at this point
just treat them all the same as if they were LFO 0.

Change-Id: I1bab06c6b766175a3982bf3a7b19f7b321df807e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117480
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index d8d6d4e..4428744 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -783,9 +783,9 @@ DECLARE_WW8EXPORT_TEST(testTdf106541_cancelOutline, "tdf106541_cancelOutline.doc
{
    // The ability to cancel numbering must not be lost.
    uno::Reference<beans::XPropertySet> xPara(getParagraph(1, "Cancelled by style"), uno::UNO_QUERY);
    //TEMPORARY CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString"));
    CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString"));
    xPara.set(getParagraph(2, "Cancelled by inherited style"), uno::UNO_QUERY);
    //TEMPORARY CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString"));
    CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString"));
    xPara.set(getParagraph(4, "Cancelled by direct paragraph formatting"), uno::UNO_QUERY);
    CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(xPara, "ListLabelString"));
}
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 7060c85..5f36371 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1936,6 +1936,12 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData,

                // reset/blank the indent
                m_pCurrentColl->SetFormatAttr(SvxLRSpaceItem(RES_LR_SPACE));

                // These sprmPIlfos are supposed to indicate "cancel" numbering.
                // Since m_nLFOPosition is "data - 1", then zero becomes USHRT_MAX
                // which is no good since that indicates "unspecified, available for inheritance".
                // So instead use USHRT_MAX-1 for indicating an explicit "cancel numbering".
                RegisterNumFormat(USHRT_MAX-1, MAXLEVEL);
            }
            else if (SwTextNode* pTextNode = m_pPaM->GetNode().GetTextNode())
            {