[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

Vasily Melenchuk (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 22 16:03:43 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf108496.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx          |   10 ++
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx        |   77 ++++++++++++++++++++++
 sw/source/filter/ww8/attributeoutputbase.hxx      |    3 
 sw/source/filter/ww8/docxattributeoutput.cxx      |   49 +++++++++++++-
 sw/source/filter/ww8/docxattributeoutput.hxx      |    5 -
 sw/source/filter/ww8/wrtw8num.cxx                 |   28 ++------
 sw/source/filter/ww8/wrtww8.hxx                   |   10 ++
 sw/source/filter/ww8/ww8atr.cxx                   |   24 +++---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   10 ++
 writerfilter/source/dmapper/NumberingManager.cxx  |    8 +-
 writerfilter/source/dmapper/NumberingManager.hxx  |    4 +
 12 files changed, 184 insertions(+), 44 deletions(-)

New commits:
commit cf13fe3e6f6a40f6db064d65d4514d13a23a31f0
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Fri Apr 17 12:58:59 2020 +0300
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Apr 22 18:03:02 2020 +0200

    tdf#108496: DOCX: redesign of override in lists
    
    List level overrides are not just about numbering,
    it is about numbering restart. Thus some changes to DOCX
    import/export were added.
    
    Improved support for several lists referring the same
    abstract list, especially in situation when one list
    have overrides.
    
    In addition some export cleanup is made: less unnecessary
    list duplications, less level overrides when no properties
    were changed.
    
    Change-Id: Ic7a69bc2e3080b39f5205cb90b46d14247abf305
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92412
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf108496.docx b/sw/qa/extras/ooxmlexport/data/tdf108496.docx
new file mode 100644
index 000000000000..123d9e0a6549
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf108496.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 67b6b5b22000..cced1b33e2ba 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -774,8 +774,14 @@ DECLARE_OOXMLEXPORT_TEST(testNumOverrideLvltext, "num-override-lvltext.docx")
 DECLARE_OOXMLEXPORT_TEST(testNumOverrideStart, "num-override-start.docx")
 {
     uno::Reference<container::XIndexAccess> xRules = getProperty< uno::Reference<container::XIndexAccess> >(getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules");
-    // This was 1, i.e. the numbering on the second level was "1.1", not "1.3".
-    CPPUNIT_ASSERT_EQUAL(sal_Int16(3), comphelper::SequenceAsHashMap(xRules->getByIndex(1))["StartWith"].get<sal_Int16>());
+    // List starts with "1.1"
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(1), comphelper::SequenceAsHashMap(xRules->getByIndex(1))["StartWith"].get<sal_Int16>());
+    // But paragraph starts with "1.3"
+    uno::Reference<beans::XPropertySet> xPara(getParagraph(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), getProperty<sal_Int16>(xPara, "NumberingLevel"));
+    OUString listId;
+    CPPUNIT_ASSERT(xPara->getPropertyValue("ListId") >>= listId);
+    CPPUNIT_ASSERT_EQUAL(OUString("1.3"), getProperty<OUString>(xPara, "ListLabelString"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTextboxRightEdge, "textbox-right-edge.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index fa913eb02718..f3ae46531c2b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -178,6 +178,83 @@ DECLARE_OOXMLEXPORT_TEST(testTdf95848_2, "tdf95848_2.docx")
     }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf108496, "tdf108496.docx")
+{
+    OUString listId;
+    OUString listStyle;
+    // Lists with override
+    {
+        uno::Reference<beans::XPropertySet> xPara(getParagraph(2), uno::UNO_QUERY);
+        CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle);
+        CPPUNIT_ASSERT(listStyle.startsWith("WWNum"));
+        CPPUNIT_ASSERT(xPara->getPropertyValue("ListId") >>= listId);
+        CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty<OUString>(xPara, "ListLabelString"));
+    }
+    {
+        uno::Reference<beans::XPropertySet> xPara(getParagraph(3), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(listStyle, getProperty<OUString>(xPara, "NumberingStyleName"));
+        CPPUNIT_ASSERT_EQUAL(listId, getProperty<OUString>(xPara, "ListId"));
+        CPPUNIT_ASSERT_EQUAL(OUString("2"), getProperty<OUString>(xPara, "ListLabelString"));
+    }
+    {
+        uno::Reference<beans::XPropertySet> xPara(getParagraph(5), uno::UNO_QUERY);
+        // different numbering style
+        OUString listStyle2;
+        CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle2);
+        CPPUNIT_ASSERT(listStyle2.startsWith("WWNum"));
+        CPPUNIT_ASSERT(listStyle2 != listStyle);
+        // restarted numeration due to override
+        CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty<OUString>(xPara, "ListLabelString"));
+        CPPUNIT_ASSERT_EQUAL(listId, getProperty<OUString>(xPara, "ListId"));
+    }
+    {
+        uno::Reference<beans::XPropertySet> xPara(getParagraph(6), uno::UNO_QUERY);
+        // different numbering style
+        OUString listStyle2;
+        CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle2);
+        CPPUNIT_ASSERT(listStyle2.startsWith("WWNum"));
+        // restarted numeration due to override
+        CPPUNIT_ASSERT_EQUAL(OUString("2"), getProperty<OUString>(xPara, "ListLabelString"));
+        CPPUNIT_ASSERT_EQUAL(listId, getProperty<OUString>(xPara, "ListId"));
+    }
+
+    // Lists without override
+    {
+        uno::Reference<beans::XPropertySet> xPara(getParagraph(8), uno::UNO_QUERY);
+        CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle);
+        CPPUNIT_ASSERT(listStyle.startsWith("WWNum"));
+        CPPUNIT_ASSERT(xPara->getPropertyValue("ListId") >>= listId);
+        CPPUNIT_ASSERT_EQUAL(OUString("1"), getProperty<OUString>(xPara, "ListLabelString"));
+    }
+    {
+        uno::Reference<beans::XPropertySet> xPara(getParagraph(9), uno::UNO_QUERY);
+        CPPUNIT_ASSERT_EQUAL(listStyle, getProperty<OUString>(xPara, "NumberingStyleName"));
+        CPPUNIT_ASSERT_EQUAL(listId, getProperty<OUString>(xPara, "ListId"));
+        CPPUNIT_ASSERT_EQUAL(OUString("2"), getProperty<OUString>(xPara, "ListLabelString"));
+    }
+    {
+        uno::Reference<beans::XPropertySet> xPara(getParagraph(11), uno::UNO_QUERY);
+        // different numbering style
+        OUString listStyle2;
+        CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle2);
+        CPPUNIT_ASSERT(listStyle2.startsWith("WWNum"));
+        CPPUNIT_ASSERT(listStyle2 != listStyle);
+        // numeration is continued
+        CPPUNIT_ASSERT_EQUAL(OUString("3"), getProperty<OUString>(xPara, "ListLabelString"));
+        CPPUNIT_ASSERT_EQUAL(listId, getProperty<OUString>(xPara, "ListId"));
+    }
+    {
+        uno::Reference<beans::XPropertySet> xPara(getParagraph(12), uno::UNO_QUERY);
+        // different numbering style
+        OUString listStyle2;
+        CPPUNIT_ASSERT(xPara->getPropertyValue("NumberingStyleName") >>= listStyle2);
+        CPPUNIT_ASSERT(listStyle2.startsWith("WWNum"));
+        // numeration is continued
+        CPPUNIT_ASSERT_EQUAL(OUString("4"), getProperty<OUString>(xPara, "ListLabelString"));
+        CPPUNIT_ASSERT_EQUAL(listId, getProperty<OUString>(xPara, "ListId"));
+    }
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf126723, "tdf126723.docx")
 {
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(getParagraph(2), "ParaLeftMargin"));
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 736f2a72749f..d8b851da17d7 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -348,7 +348,8 @@ public:
     virtual void NumberingDefinition( sal_uInt16 nId, const SwNumRule &rRule ) = 0;
 
     /// Numbering definition that overrides abstract numbering definition
-    virtual void OverrideNumberingDefinition(SwNumRule const&, sal_uInt16 /*nNum*/, sal_uInt16 /*nAbstractNum*/)
+    virtual void OverrideNumberingDefinition(SwNumRule const&, sal_uInt16 /*nNum*/, sal_uInt16 /*nAbstractNum*/,
+        const std::map< size_t, size_t > & /*rLevelOverrides*/)
     { assert(false); } // TODO implement for WW8/RTF
 
     /// Start of the abstract numbering definition instance.
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3e574e5bcc59..c7321e19a99a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6699,9 +6699,41 @@ void DocxAttributeOutput::NumberingDefinition( sal_uInt16 nId, const SwNumRule &
     m_pSerializer->endElementNS( XML_w, XML_num );
 }
 
+// Not all attibutes of SwNumFormat are important for export, so can't just use embedded in
+// that classes comparison.
+static bool lcl_ListLevelsAreDifferentForExport(const SwNumFormat & rFormat1, const SwNumFormat & rFormat2)
+{
+    if (rFormat1 == rFormat2)
+        // They are equal, nothing to do
+        return false;
+
+    if (!rFormat1.GetCharFormat() != !rFormat2.GetCharFormat())
+        // One has charformat, other not. they are different
+        return true;
+
+    if (rFormat1.GetCharFormat() && rFormat2.GetCharFormat())
+    {
+        const SwAttrSet & a1 = rFormat1.GetCharFormat()->GetAttrSet();
+        const SwAttrSet & a2 = rFormat2.GetCharFormat()->GetAttrSet();
+
+        if (!(a1 == a2))
+            // Difference in charformat: they are different
+            return true;
+    }
+
+    // Compare numformats with emoty charformats
+    SwNumFormat modified1 = rFormat1;
+    SwNumFormat modified2 = rFormat2;
+    modified1.SetCharFormatName(OUString());
+    modified2.SetCharFormatName(OUString());
+    modified1.SetCharFormat(nullptr);
+    modified2.SetCharFormat(nullptr);
+    return modified1 != modified2;
+}
+
 void DocxAttributeOutput::OverrideNumberingDefinition(
         SwNumRule const& rRule,
-        sal_uInt16 const nNum, sal_uInt16 const nAbstractNum)
+        sal_uInt16 const nNum, sal_uInt16 const nAbstractNum, const std::map< size_t, size_t > & rLevelOverrides )
 {
     m_pSerializer->startElementNS(XML_w, XML_num, FSNS(XML_w, XML_numId), OString::number(nNum));
 
@@ -6712,12 +6744,23 @@ void DocxAttributeOutput::OverrideNumberingDefinition(
         ? WW8ListManager::nMinLevel : WW8ListManager::nMaxLevel);
     for (sal_uInt8 nLevel = 0; nLevel < nLevels; ++nLevel)
     {
+        const auto levelOverride = rLevelOverrides.find(nLevel);
         // only export it if it differs from abstract numbering definition
-        if (rRule.Get(nLevel) != rAbstractRule.Get(nLevel))
+        if ( lcl_ListLevelsAreDifferentForExport(rRule.Get(nLevel),rAbstractRule.Get(nLevel)) ||
+            levelOverride != rLevelOverrides.end() )
         {
             m_pSerializer->startElementNS(XML_w, XML_lvlOverride, FSNS(XML_w, XML_ilvl), OString::number(nLevel));
 
-            GetExport().NumberingLevel(rRule, nLevel);
+            if (rRule.Get(nLevel) != rAbstractRule.Get(nLevel))
+            {
+                GetExport().NumberingLevel(rRule, nLevel);
+            }
+            if (levelOverride != rLevelOverrides.end())
+            {
+                // list numbering restart override
+                m_pSerializer->singleElementNS(XML_w, XML_startOverride,
+                    FSNS(XML_w, XML_val), OString::number(levelOverride->second));
+            }
 
             m_pSerializer->endElementNS(XML_w, XML_lvlOverride);
         }
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index ddd73764bfe0..b8272d81603c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -330,8 +330,9 @@ public:
     virtual void NumberingDefinition( sal_uInt16 nId, const SwNumRule &rRule ) override;
 
     /// Numbering definition that overrides abstract numbering definition
-    virtual void OverrideNumberingDefinition(SwNumRule const& rRule,
-            sal_uInt16 nNum, sal_uInt16 nAbstractNum) override;
+    virtual void OverrideNumberingDefinition( SwNumRule const& rRule,
+            sal_uInt16 nNum, sal_uInt16 nAbstractNum,
+            const std::map< size_t, size_t > & rLevelOverrides ) override;
 
     /// Start of the abstract numbering definition instance.
     virtual void StartAbstractNumbering( sal_uInt16 nId ) override;
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 4e986197faff..d0babf006ed3 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -56,24 +56,6 @@ SwNumRule* MSWordExportBase::DuplicateNumRuleImpl(const SwNumRule *pRule)
     return pMyNumRule;
 }
 
-sal_uInt16 MSWordExportBase::DuplicateNumRule( const SwNumRule *pRule, sal_uInt8 nLevel, sal_uInt16 nVal )
-{
-    sal_uInt16 nNumId = USHRT_MAX;
-
-    SwNumRule *const pMyNumRule = DuplicateNumRuleImpl(pRule);
-
-    SwNumFormat aNumFormat( pMyNumRule->Get( nLevel ) );
-    aNumFormat.SetStart( nVal );
-    pMyNumRule->Set( nLevel, aNumFormat );
-
-    nNumId = GetNumberingId( *pMyNumRule );
-
-    // Map the old list to our new list
-    m_aRuleDuplicates[GetNumberingId( *pRule )] = nNumId;
-
-    return nNumId;
-}
-
 // multiple SwList can be based on the same SwNumRule; ensure one w:abstractNum
 // per SwList
 sal_uInt16 MSWordExportBase::DuplicateAbsNum(OUString const& rListId,
@@ -104,7 +86,6 @@ sal_uInt16 MSWordExportBase::OverrideNumRule(
         OUString const& rListId,
         SwNumRule const& rAbstractRule)
 {
-    assert(&rExistingRule != &rAbstractRule);
     auto const numdef = GetNumberingId(rExistingRule);
     auto const absnumdef = rListId == rAbstractRule.GetDefaultListId()
         ? GetNumberingId(rAbstractRule)
@@ -123,6 +104,13 @@ sal_uInt16 MSWordExportBase::OverrideNumRule(
     return it->second;
 }
 
+void MSWordExportBase::AddListLevelOverride(sal_uInt16 nListId,
+    sal_uInt16 nLevelNum,
+    sal_uInt16 nStartAt)
+{
+    m_ListLevelOverrides[nListId][nLevelNum] = nStartAt;
+}
+
 sal_uInt16 MSWordExportBase::GetNumberingId( const SwNumRule& rNumRule )
 {
     if ( !m_pUsedNumTable )
@@ -243,7 +231,7 @@ void MSWordExportBase::NumberingDefinitions()
             assert(it != m_OverridingNums.end());
             pRule = (*m_pUsedNumTable)[it->second.first];
             assert(pRule);
-            AttrOutput().OverrideNumberingDefinition(*pRule, n + 1, it->second.second + 1);
+            AttrOutput().OverrideNumberingDefinition(*pRule, n + 1, it->second.second + 1, m_ListLevelOverrides[n]);
         }
     }
 }
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 8010aab28951..d950aa7e1fee 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -467,6 +467,10 @@ public:
     /// list-id -> abstractnumdef index
     std::map<OUString, size_t> m_Lists;
 
+    /// Map of maps for list levels overrides
+    /// listid -> level number -> restart value
+    std::map < size_t, std::map<size_t, size_t> > m_ListLevelOverrides;
+
     const SwTextNode *m_pTopNodeOfHdFtPage; ///< Top node of host page when in hd/ft
     std::map< sal_uInt16, sal_uInt16 > m_aRuleDuplicates; //map to Duplicated numrules
     std::stack< sal_Int32 > m_aCurrentCharPropStarts; ///< To remember the position in a run.
@@ -656,7 +660,6 @@ public:
     /// List is set to restart at a particular value so for export make a
     /// completely new list based on this one and export that instead,
     /// which duplicates words behaviour in this respect.
-    sal_uInt16 DuplicateNumRule( const SwNumRule *pRule, sal_uInt8 nLevel, sal_uInt16 nVal );
     SwNumRule * DuplicateNumRuleImpl(const SwNumRule *pRule);
 
     /// check if a new abstractNum is needed for this list
@@ -670,6 +673,11 @@ public:
                                OUString const& rListId,
                                SwNumRule const& rAbstractRule);
 
+    /// Store list level overrides (restart of list)
+    void AddListLevelOverride(sal_uInt16 nListId,
+                              sal_uInt16 nLevelNum,
+                              sal_uInt16 nStartAt);
+
     /// Access to the attribute output class.
     virtual AttributeOutputBase& AttrOutput() const = 0;
 
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index de0dbd2a3ed1..9be12a69ef1e 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3591,20 +3591,14 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule )
 
                         nLvl = static_cast< sal_uInt8 >(nLevel);
 
-                        if ( pTextNd->IsListRestart() )
-                        {
-                            sal_uInt16 nStartWith = static_cast< sal_uInt16 >( pTextNd->GetActualListStartValue() );
-                            nNumId = GetExport().DuplicateNumRule( pRule, nLvl, nStartWith );
-                            if ( USHRT_MAX != nNumId )
-                                ++nNumId;
-                        }
-                        else if (GetExport().GetExportFormat() == MSWordExportBase::DOCX) // FIXME
+                        if (GetExport().GetExportFormat() == MSWordExportBase::DOCX) // FIXME
                         {
                             // tdf#95848 find the abstract list definition
                             OUString const listId(pTextNd->GetListId());
                             if (!listId.isEmpty()
-                                // default list id uses the 1:1 mapping
-                                && listId != pRule->GetDefaultListId())
+                                && (listId != pRule->GetDefaultListId() // default list id uses the 1:1 mapping
+                                    || pTextNd->IsListRestart())    // or restarting previous list
+                                )
                             {
                                 SwList const*const pList(
                                     GetExport().m_pDoc->getIDocumentListsAccess().getListByName(listId));
@@ -3614,7 +3608,7 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule )
                                         GetExport().m_pDoc->FindNumRulePtr(
                                             pList->GetDefaultListStyleName()));
                                     assert(pAbstractRule);
-                                    if (pAbstractRule == pRule)
+                                    if (pAbstractRule == pRule && !pTextNd->IsListRestart())
                                     {
                                         // different list, but no override
                                         nNumId = GetExport().DuplicateAbsNum(listId, *pAbstractRule);
@@ -3623,6 +3617,14 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule )
                                     {
                                         nNumId = GetExport().OverrideNumRule(
                                                 *pRule, listId, *pAbstractRule);
+
+                                        if (pTextNd->IsListRestart())
+                                        {
+                                            // For restarted lists we should also keep value for
+                                            // future w:lvlOverride / w:startOverride
+                                            GetExport().AddListLevelOverride(nNumId, pTextNd->GetActualListLevel(),
+                                                pTextNd->GetActualListStartValue());
+                                        }
                                     }
                                     assert(nNumId != USHRT_MAX);
                                     ++nNumId;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3bbc3c8e00ff..d75ab67b2222 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1700,6 +1700,16 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
                                     m_xPreviousParagraph->setPropertyValue("ListId", uno::makeAny(listId));
                                 }
                             }
+                            if (pList->GetCurrentLevel())
+                            {
+                                sal_Int16 nOverrideLevel = pList->GetCurrentLevel()->GetStartOverride();
+                                if (nOverrideLevel != -1)
+                                {
+                                    // Restart list, it is overriden
+                                    m_xPreviousParagraph->setPropertyValue("ParaIsNumberingRestart", uno::makeAny(true));
+                                    m_xPreviousParagraph->setPropertyValue("NumberingStartValue", uno::makeAny(nOverrideLevel));
+                                }
+                            }
                         }
                     }
 
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 5bb17c39ebd3..b855028c40f0 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -100,6 +100,9 @@ void ListLevel::SetValue( Id nId, sal_Int32 nValue )
         case NS_ooxml::LN_CT_Lvl_start:
             m_nIStartAt = nValue;
         break;
+        case NS_ooxml::LN_CT_NumLvl_startOverride:
+            m_nStartOverride = nValue;
+            break;
         case NS_ooxml::LN_CT_NumFmt_val:
             m_nNFC = nValue;
         break;
@@ -633,7 +636,6 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
 
                 aLvlProps.push_back(comphelper::makePropertyValue(getPropertyName(PROP_POSITION_AND_SPACE_MODE), sal_Int16(text::PositionAndSpaceMode::LABEL_ALIGNMENT)));
 
-
                 // Replace the numbering rules for the level
                 m_xNumRules->replaceByIndex(nLevel, uno::makeAny(comphelper::containerToSequence(aLvlProps)));
 
@@ -1107,9 +1109,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm )
                 {
                     if (ListLevel::Pointer pCurrentLevel = m_pCurrentDefinition->GetCurrentLevel())
                     {
-                        // <w:num> -> <w:lvlOverride> -> <w:startOverride> is the non-abstract equivalent of
-                        // <w:abstractNum> -> <w:lvl> -> <w:start>
-                        pCurrentLevel->SetValue(NS_ooxml::LN_CT_Lvl_start, nIntValue);
+                        pCurrentLevel->SetValue(NS_ooxml::LN_CT_NumLvl_startOverride, nIntValue);
                     }
                 }
             }
diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx
index 9dc034eff2b6..c337b88e9872 100644
--- a/writerfilter/source/dmapper/NumberingManager.hxx
+++ b/writerfilter/source/dmapper/NumberingManager.hxx
@@ -43,6 +43,7 @@ class StyleSheetEntry;
 class ListLevel : public PropertyMap
 {
     sal_Int32                                     m_nIStartAt;       //LN_CT_Lvl_start
+    sal_Int32                                     m_nStartOverride;
     sal_Int32                                     m_nNFC;            //LN_CT_Lvl_numFmt
     /// LN_CT_NumFmt_format, in case m_nNFC is custom.
     OUString m_aCustomNumberFormat;
@@ -61,6 +62,7 @@ public:
 
     ListLevel() :
         m_nIStartAt(-1)
+        ,m_nStartOverride(-1)
         ,m_nNFC(-1)
         ,m_nXChFollow(SvxNumberFormat::LISTTAB)
         ,m_nTabstop( 0 )
@@ -80,7 +82,9 @@ public:
     // Getters
     const OUString& GetBulletChar( ) const { return m_sBulletChar; };
     const tools::SvRef< StyleSheetEntry >& GetParaStyle( ) const { return m_pParaStyle; };
+    sal_Int32 GetStartAt() const { return m_nIStartAt; };
     bool isOutlineNumbering() const { return m_outline; }
+    sal_Int32 GetStartOverride() const { return m_nStartOverride; };
     /// Determines if SetValue() was called at least once.
     bool HasValues() const;
 


More information about the Libreoffice-commits mailing list