tdf#106541 doc import: always register listLevel
LFO and listLevel are NOT a required pair.
The path on the Paragraph side is safe to re-enter.
This patch makes the style side safe to re-run
with partial information.
If we don't register immediately, then a non-existant LFO
means that we totally lose the provided listLevel.
So just RegisterNumFormat even though it
likely will be run again by Read_LFOPosition.
Change-Id: Iad10cdd1ff7e6fc0a77b01849b3b157703945556
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114400
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 67b4993..d8d6d4e 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -794,7 +794,7 @@ DECLARE_WW8EXPORT_TEST(testTdf106541_inheritChapterNumbering, "tdf106541_inherit
{
// The level and numbering are inherited from Heading 1.
uno::Reference<beans::XPropertySet> xPara(getParagraph(3, "Letter A"), uno::UNO_QUERY);
//TEMPORARY CPPUNIT_ASSERT_EQUAL(OUString("a."), getProperty<OUString>(xPara, "ListLabelString"));
CPPUNIT_ASSERT_EQUAL(OUString("a."), getProperty<OUString>(xPara, "ListLabelString"));
}
DECLARE_WW8EXPORT_TEST(testTdf106541_inheritChapterNumberingB, "tdf106541_inheritChapterNumberingB.doc")
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index a5f363e..7060c85 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1680,21 +1680,20 @@ void SwWW8ImplReader::SetStylesList(sal_uInt16 nStyle, sal_uInt16 nCurrentLFO,
if( !m_pCurrentColl )
return;
// only save the Parameters for now. The actual List will be appended
// at a later point, when the Listdefinitions is read...
if (
(USHRT_MAX > nCurrentLFO) &&
(WW8ListManager::nMaxLevel > nCurrentLevel)
)
{
if (nCurrentLFO < USHRT_MAX)
rStyleInf.m_nLFOIndex = nCurrentLFO;
if (nCurrentLevel < MAXLEVEL)
rStyleInf.m_nListLevel = nCurrentLevel;
// only save the Parameters for now. The actual List will be appended
// at a later point, when the Listdefinitions is read...
if (rStyleInf.m_nLFOIndex < USHRT_MAX && rStyleInf.m_nListLevel < WW8ListManager::nMaxLevel)
{
std::vector<sal_uInt8> aParaSprms;
SwNumRule* pNmRule = m_xLstManager->GetNumRuleForActivation(
nCurrentLFO, nCurrentLevel, aParaSprms);
rStyleInf.m_nLFOIndex, rStyleInf.m_nListLevel, aParaSprms);
if (pNmRule)
UseListIndent(rStyleInf, pNmRule->Get(nCurrentLevel));
UseListIndent(rStyleInf, pNmRule->Get(rStyleInf.m_nListLevel));
}
}
@@ -1881,11 +1880,14 @@ void SwWW8ImplReader::Read_ListLevel(sal_uInt16, const sal_uInt8* pData,
m_xStyles->mnWwNumLevel = m_nListLevel;
}
if (WW8ListManager::nMaxLevel <= m_nListLevel )
// Treat an invalid level as body-level
if (WW8ListManager::nMaxLevel < m_nListLevel)
m_nListLevel = WW8ListManager::nMaxLevel;
else if (USHRT_MAX > m_nLFOPosition)
RegisterNumFormat(m_nLFOPosition, m_nListLevel);
if (USHRT_MAX > m_nLFOPosition)
{
RegisterNumFormat(m_nLFOPosition, m_nListLevel);
assert(false && "m_nLFOPosition is usually reset immediately, so we rarely ever get here.");
m_nLFOPosition = USHRT_MAX;
m_nListLevel = MAXLEVEL;
}