revert tdf#76817 ooxmlimport: connect Heading to existing numbers

tdf#50774 has an example document which was broken by 6.1 commit
8e9e705de29a1a3d9b964c9350aa2a3a17cce6f9.

Reverting does a couple of things:
-go back to previous behaviour (right or wrong) - no regression.
-gives an opportunity to find documents broken by reverting -
i.e. it will give an indication as to which state has more broken
docs. Can be re-visited in 6.2.
-gives me an option to escape from this horrible mess without causing
a regression in a production release of LO.

Change-Id: Ib594b76d5533a0c4807cf70ef706c107e52cddcf
Reviewed-on: https://gerrit.libreoffice.org/54293
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 0442456..0dc6ebe 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -348,10 +348,13 @@ DECLARE_OOXMLEXPORT_TEST(testNumberingFont, "numbering-font.docx")

DECLARE_OOXMLEXPORT_TEST(testTdf106541_noinheritChapterNumbering, "tdf106541_noinheritChapterNumbering.odt")
{
    // in LO, it appears that styles based on the Chapter Numbering style explicitly sets the
    // numbering style/outline level to 0 by default, and prevents inheriting directly from "Outline" style.
    // in LO, it appears that styles based on the Chapter Numbering style explicitly set the
    // numbering style/outline level to 0 by default, and that LO prevents inheriting directly from "Outline" style.
    // Adding this preventative unit test to ensure that any fix for tdf106541 doesn't make incorrect assumptions.
    CPPUNIT_ASSERT_EQUAL(OUString("Outline"), getProperty<OUString>(getParagraph(1), "NumberingStyleName"));

//reverting tdf#76817 hard-codes the numbering style on the paragraph, preventing RT of "Outline" style
//    CPPUNIT_ASSERT_EQUAL(OUString("Outline"), getProperty<OUString>(getParagraph(1), "NumberingStyleName"));

    OUString sPara3NumberingStyle = getProperty<OUString>(getParagraph(3), "NumberingStyleName");
    CPPUNIT_ASSERT_EQUAL(sPara3NumberingStyle, getProperty<OUString>(getParagraph(4), "NumberingStyleName"));

@@ -719,7 +722,9 @@ DECLARE_OOXMLEXPORT_TEST(testOOxmlOutlineNumberTypes, "outline-number-types.odt"

DECLARE_OOXMLEXPORT_TEST(testNumParentStyle, "num-parent-style.docx")
{
    CPPUNIT_ASSERT_EQUAL(OUString("Outline"), getProperty<OUString>(getParagraph(4), "NumberingStyleName"));
//reverting tdf#76817 hard-codes the numbering style on the paragraph, preventing RT of "Outline" style
//I think this unit test is wrong, but I will revert to its original claim.
    CPPUNIT_ASSERT(getProperty<OUString>(getParagraph(4), "NumberingStyleName").startsWith("WWNum"));
}

DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, "num-override-lvltext.docx")
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 409c708..f84f375 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1132,8 +1132,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap )
        sal_Int32 nListId = pEntry ? lcl_getListId(pEntry, GetStyleSheetTable()) : -1;
        if( pStyleSheetProperties && nListId >= 0 )
        {
            if ( !pEntry->bIsChapterNumbering )
                pParaContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny( ListDef::GetStyleName( nListId ) ), false);
            pParaContext->Insert( PROP_NUMBERING_STYLE_NAME, uno::makeAny( ListDef::GetStyleName( nListId ) ), false);

            // Indent properties from the paragraph style have priority
            // over the ones from the numbering styles in Word
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 8e14b3a..f3679f8 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -625,7 +625,6 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
                        xOutlines->getChapterNumberingRules( );

                    StyleSheetEntryPtr pParaStyle = pAbsLevel->GetParaStyle( );
                    pParaStyle->bIsChapterNumbering = true;
                    aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HEADING_STYLE_NAME), pParaStyle->sConvertedStyleName));

                    xOutlineRules->replaceByIndex(nLevel, uno::makeAny(comphelper::containerToSequence(aLvlProps)));
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 398a7ab..7e28500 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -56,7 +56,6 @@ typedef ::std::map< OUString, OUString> StringPairMap_t;
StyleSheetEntry::StyleSheetEntry() :
        sStyleIdentifierD()
        ,bIsDefaultStyle(false)
        ,bIsChapterNumbering(false)
        ,bInvalidHeight(false)
        ,bHasUPE(false)
        ,nStyleTypeCode(STYLE_TYPE_UNKNOWN)
@@ -75,7 +74,6 @@ TableStyleSheetEntry::TableStyleSheetEntry( StyleSheetEntry const & rEntry ):
    StyleSheetEntry( )
{
    bIsDefaultStyle = rEntry.bIsDefaultStyle;
    bIsChapterNumbering = rEntry.bIsChapterNumbering;
    bInvalidHeight = rEntry.bInvalidHeight;
    bHasUPE = rEntry.bHasUPE;
    nStyleTypeCode = STYLE_TYPE_TABLE;
diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx
index 767a16a..dc1f0ac 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.hxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.hxx
@@ -55,7 +55,6 @@ class StyleSheetEntry
public:
    OUString sStyleIdentifierD;   // WW8 name
    bool            bIsDefaultStyle;
    bool            bIsChapterNumbering;  //LO built-in Chapter Numbering "Outline" list style
    bool            bInvalidHeight;
    bool            bHasUPE; //universal property expansion
    StyleType       nStyleTypeCode; //sgc