diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-06-15 14:04:57 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-06-15 15:56:08 +0200 |
commit | fdf1db0010104294c01c7780d9daba5adf38450b (patch) | |
tree | 2e91fc6b21f40558883ce67c74d412735da83193 /sw/source | |
parent | bbd6def8df823fcc2f5c6aef4dce775d87eef59f (diff) |
sw XHTML / reqif export: handle multiple lists when detecting header-only lists
The case when the list was at the end of the text node section (body
text, table cell, etc) was already handled, this handles when the list
is followed by a different list.
Change-Id: I131402cb577bd16814f56a5bd6bcad7c99947dbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117246
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/html/htmlnumwriter.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sw/source/filter/html/htmlnumwriter.cxx b/sw/source/filter/html/htmlnumwriter.cxx index 2fa1e6aa3f6b..cfbf024c6acf 100644 --- a/sw/source/filter/html/htmlnumwriter.cxx +++ b/sw/source/filter/html/htmlnumwriter.cxx @@ -99,6 +99,7 @@ Writer& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, // If the list only consists of non-numbered text nodes, then don't start the list. bool bAtLeastOneNumbered = false; sal_uLong nPos = rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex() + 1; + SwNumRule* pNumRule = nullptr; while (true) { const SwNode* pNode = rWrt.m_pDoc->GetNodes()[nPos]; @@ -108,11 +109,13 @@ Writer& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, } const SwTextNode* pTextNode = pNode->GetTextNode(); - if (!pTextNode->GetNumRule()) + if (!pTextNode->GetNumRule() || (pNumRule && pTextNode->GetNumRule() != pNumRule)) { + // Node is not in the same numbering as the previous one. break; } + pNumRule = pTextNode->GetNumRule(); if (pTextNode->IsNumbered()) { bAtLeastOneNumbered = true; @@ -333,6 +336,7 @@ Writer& OutHTML_NumberBulletListEnd( SwHTMLWriter& rWrt, // If the list only consisted of non-numbered text nodes, then don't end the list. bool bAtLeastOneNumbered = false; sal_uLong nPos = rWrt.m_pCurrentPam->GetPoint()->nNode.GetIndex() - 1; + SwNumRule* pNumRule = nullptr; while (true) { const SwNode* pNode = rWrt.m_pDoc->GetNodes()[nPos]; @@ -342,11 +346,13 @@ Writer& OutHTML_NumberBulletListEnd( SwHTMLWriter& rWrt, } const SwTextNode* pTextNode = pNode->GetTextNode(); - if (!pTextNode->GetNumRule()) + if (!pTextNode->GetNumRule() || (pNumRule && pTextNode->GetNumRule() != pNumRule)) { + // Node is not in the same numbering as the next one. break; } + pNumRule = pTextNode->GetNumRule(); if (pTextNode->IsNumbered()) { bAtLeastOneNumbered = true; |