summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/ww8par.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2021-04-20 19:47:09 +0200
committerJustin Luth <justin_luth@sil.org>2021-06-19 19:58:35 +0200
commitce762a7ab170aa1115cfb0dd68f1c50abf5a86f3 (patch)
tree7936ffcda721be5a893a5f6666ac8a41613420d4 /sw/source/filter/ww8/ww8par.cxx
parent8be08b6d1f53136d899a8aac3ccd401eb18990e9 (diff)
tdf#106541 doc import: inherit style numbering from parent
This patch depends on FOLLOWUP patches. I thought the best way forward is to break the existing unit tests, and then fix them with followup patches. That best proves the validity of each follow-up patch. This patch is especially needed for Chapter Numbering. In LO, Chapter Numbering is treated uniquely with its own special rules that run counter to all other conventions. So special handling is needed to import styles that in MS Word would inherit, but which don't in this special case. Change-Id: I06b737ad96ff73dbd09bef252d09aa42adf2dc76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114401 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw/source/filter/ww8/ww8par.cxx')
-rw-r--r--sw/source/filter/ww8/ww8par.cxx23
1 files changed, 22 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 93b2027b30bf..ec316678e96b 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5914,9 +5914,30 @@ void SwWW8ImplReader::SetOutlineStyles()
// iteration
std::vector<SwWW8StyInf*> aWW8BuiltInHeadingStyles;
{
+ sal_uInt16 nStyle = 0;
std::map<const SwNumRule*, int> aWW8ListStyleCounts;
- for (SwWW8StyInf & rSI : m_vColl)
+ for (SwWW8StyInf& rSI : m_vColl)
{
+ // Copy inherited numbering info since LO drops inheritance after ChapterNumbering
+ // and only applies listLevel via style with the selected ChapterNumbering LFO.
+ bool bReRegister = false;
+ if (rSI.m_nBase && rSI.m_nBase < 10 && rSI.m_nBase < m_vColl.size()
+ && m_vColl[rSI.m_nBase].HasWW8OutlineLevel())
+ {
+ if (rSI.m_nLFOIndex == USHRT_MAX)
+ rSI.m_nLFOIndex = m_vColl[rSI.m_nBase].m_nLFOIndex;
+ if (rSI.m_nListLevel == MAXLEVEL)
+ rSI.m_nListLevel = m_vColl[rSI.m_nBase].m_nListLevel;
+ if (rSI.mnWW8OutlineLevel == MAXLEVEL)
+ rSI.mnWW8OutlineLevel = m_vColl[rSI.m_nBase].mnWW8OutlineLevel;
+ bReRegister = true;
+ }
+
+ if (bReRegister)
+ RegisterNumFormatOnStyle(nStyle);
+
+ ++nStyle; // increment before the first "continue";
+
if (!rSI.IsWW8BuiltInHeadingStyle() || !rSI.HasWW8OutlineLevel())
{
continue;