summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2020-04-17 12:58:59 +0300
committerAndras Timar <andras.timar@collabora.com>2020-05-06 22:26:59 +0200
commitc53e212accd8b95ede9a707f44cf88bfbf1ea922 (patch)
tree4ba0723429e818fe02e9bbd47378990e6aecbea5
parentd93ad67b43e4c7e6e60cc142bc3733f742c81bda (diff)
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@CIB.de> Change-Id: I35937449bd563eacceb3753e62b9ff7245f12b89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92739 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93455
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf108496.docxbin0 -> 19421 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx10
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport13.cxx77
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx3
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx53
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx5
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx28
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx10
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx24
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx10
-rw-r--r--writerfilter/source/dmapper/NumberingManager.cxx8
-rw-r--r--writerfilter/source/dmapper/NumberingManager.hxx4
12 files changed, 187 insertions, 45 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf108496.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 10cb4292ef90..e144e6178129 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -789,8 +789,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 47db568932bd..e586a666dff4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -176,6 +176,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 70509ed47806..3d8daa633daa 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 13e55ca1ec84..832dab20d9ff 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6651,9 +6651,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 empty 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));
@@ -6664,12 +6696,25 @@ void DocxAttributeOutput::OverrideNumberingDefinition(
? WW8ListManager::nMinLevel : WW8ListManager::nMaxLevel);
for (sal_uInt8 nLevel = 0; nLevel < nLevels; ++nLevel)
{
- // only export it if it differs from abstract numbering definition
- if (rRule.Get(nLevel) != rAbstractRule.Get(nLevel))
+ const auto levelOverride = rLevelOverrides.find(nLevel);
+ bool bListsAreDifferent = lcl_ListLevelsAreDifferentForExport(rRule.Get(nLevel), rAbstractRule.Get(nLevel));
+
+ // Export list override only if it is different to abstract one
+ // or we have a level numbering override
+ if (bListsAreDifferent || levelOverride != rLevelOverrides.end())
{
m_pSerializer->startElementNS(XML_w, XML_lvlOverride, FSNS(XML_w, XML_ilvl), OString::number(nLevel));
- GetExport().NumberingLevel(rRule, nLevel);
+ if (bListsAreDifferent)
+ {
+ 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 478b69a2a362..b5a5508f02de 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -329,8 +329,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 d9f284c3380b..e665a253ca3e 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -61,24 +61,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,
@@ -109,7 +91,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)
@@ -128,6 +109,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 )
@@ -248,7 +236,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 8c9c324d0509..45c444c1f0b3 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.
@@ -655,7 +659,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
@@ -669,6 +672,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 cc272ff062e5..3b9bff97bde3 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3611,20 +3611,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));
@@ -3634,7 +3628,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);
@@ -3643,6 +3637,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 b04c69d27030..215234f55e89 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1674,6 +1674,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 62ca40c99e1a..32dead60a100 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -101,6 +101,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_Lvl_numFmt:
m_nNFC = nValue;
break;
@@ -623,7 +626,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)));
@@ -1076,9 +1078,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 4b2083922420..c0e68d9327a5 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
sal_Int16 m_nXChFollow; //LN_IXCHFOLLOW
OUString m_sBulletChar;
@@ -59,6 +60,7 @@ public:
ListLevel() :
m_nIStartAt(-1)
+ ,m_nStartOverride(-1)
,m_nNFC(-1)
,m_nXChFollow(SvxNumberFormat::LISTTAB)
,m_nTabstop( 0 )
@@ -77,7 +79,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;