tdf#106541 doc import numbering: default nListLevel to MAXLEVEL
WW8ListManager::nMaxLevel is a valid value meaning "Body Text".
If a valid setting is provided during initialization,
you can't tell if the property set contained the setting
(or at least not so easily).
The other related items (LFOPosition and mnWW8OutlineLevel)
both use out-of-range initializers, so it just makes
sense to do the same here.
This will be especially important to see whether
inheritance should come into play.
This should effectively be a Non-Functional-Change.
Change-Id: I05a2013e72c84653a16d61652fd8f23d3f441521
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114399
Tested-by: Jenkins
Tested-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index a2847bc..83995b2 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4314,7 +4314,7 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage,
, m_nSwNumLevel(0xff)
, m_nWwNumType(0xff)
, m_pChosenWW8OutlineStyle(nullptr)
, m_nListLevel(WW8ListManager::nMaxLevel)
, m_nListLevel(MAXLEVEL)
, m_bNewDoc(bNewDoc)
, m_bSkipImages(bSkipImages)
, m_bReadNoTable(false)
@@ -6038,8 +6038,10 @@ void SwWW8ImplReader::SetOutlineStyles()
}
if (m_pChosenWW8OutlineStyle != nullptr
&& pStyleInf->mnWW8OutlineLevel < WW8ListManager::nMaxLevel
&& pStyleInf->mnWW8OutlineLevel == pStyleInf->m_nListLevel)
{
// LibreOffice's Chapter Numbering only works when outlineLevel == listLevel
const SwNumFormat& rRule
= m_pChosenWW8OutlineStyle->Get(pStyleInf->mnWW8OutlineLevel);
aOutlineRule.Set(pStyleInf->mnWW8OutlineLevel, rRule);
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 8d81b78..97bff17 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -273,7 +273,7 @@ public:
m_nBase( 0 ),
m_nFollow( 0 ),
m_nLFOIndex( USHRT_MAX ),
m_nListLevel(WW8ListManager::nMaxLevel),
m_nListLevel(MAXLEVEL),
mnWW8OutlineLevel( MAXLEVEL ),
m_n81Flags( 0 ),
m_n81BiDiFlags(0),
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 4d005bc..facee87 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -3885,7 +3885,7 @@ void WW8RStyle::PostStyle(SwWW8StyInf const &rSI, bool bOldNoImp)
mpIo->m_bNoAttrImport = bOldNoImp;
// reset the list-remember-fields, if used when reading styles
mpIo->m_nLFOPosition = USHRT_MAX;
mpIo->m_nListLevel = WW8ListManager::nMaxLevel;
mpIo->m_nListLevel = MAXLEVEL;
}
void WW8RStyle::Import1Style( sal_uInt16 nNr )
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index f3b8ad5..678b9bb 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1872,7 +1872,7 @@ void SwWW8ImplReader::Read_ListLevel(sal_uInt16, const sal_uInt8* pData,
if( nLen < 0 )
{
// the current level is finished, what should we do ?
m_nListLevel = WW8ListManager::nMaxLevel;
m_nListLevel = MAXLEVEL;
if (m_xStyles && !m_bVer67)
m_xStyles->mnWwNumLevel = 0;
}
@@ -1902,7 +1902,7 @@ void SwWW8ImplReader::Read_ListLevel(sal_uInt16, const sal_uInt8* pData,
{
RegisterNumFormat(m_nLFOPosition, m_nListLevel);
m_nLFOPosition = USHRT_MAX;
m_nListLevel = WW8ListManager::nMaxLevel;
m_nListLevel = MAXLEVEL;
}
}
}
@@ -1917,7 +1917,7 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData,
{
// the current level is finished, what should we do ?
m_nLFOPosition = USHRT_MAX;
m_nListLevel = WW8ListManager::nMaxLevel;
m_nListLevel = MAXLEVEL;
}
else
{
@@ -1992,13 +1992,20 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData,
// here the stream data is 1-based, we subtract ONE
if (m_nLFOPosition != 2047-1) //Normal ww8+ list behaviour
{
if (WW8ListManager::nMaxLevel == m_nListLevel)
if (WW8ListManager::nMaxLevel <= m_nListLevel)
{
// This looks like a mistake. What should happen here?
// If iLvl is undefined, then treat as level 1? (yes - list-nolevel.doc)
// What about inheritance? (good question - inheritance completely ignored)
// What about if iLvl is specified as Body Text(nMaxLevel)?
assert(MAXLEVEL == m_nListLevel && "Looking for proof document showing a specified body text level should not become numbered.");
m_nListLevel = 0;
}
if (WW8ListManager::nMaxLevel > m_nListLevel)
{
RegisterNumFormat(m_nLFOPosition, m_nListLevel);
m_nLFOPosition = USHRT_MAX;
m_nListLevel = WW8ListManager::nMaxLevel;
m_nListLevel = MAXLEVEL;
}
}
else if (m_xPlcxMan && m_xPlcxMan->HasParaSprm(NS_sprm::LN_PAnld).pSprm)
@@ -2007,6 +2014,7 @@ void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData,
#i8114# Horrific backwards compatible ww7- lists in ww8+
docs
*/
m_nListLevel = std::min<sal_uInt8>(WW8ListManager::nMaxLevel, m_nListLevel);
Read_ANLevelNo(13 /*equiv ww7- sprm no*/, &m_nListLevel, 1);
}
}