diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-06-13 23:15:08 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-06-14 15:46:53 +0200 |
commit | 82bbf63582bdf28e7918e58ebf6657a9144bc9f3 (patch) | |
tree | 65ce64ae4961e1de726ec8cdf1aadfed82526a29 /include | |
parent | ed2ca47393d06786bc055c3c6fa7f84c0f952f14 (diff) |
tdf#155823: Improve the check if the list id is not required
The implementation introduced in commit 8f48f91009caa86d896f247059874242ed18bf39
(SwNumRule::HasContinueList) was a bit naive: it assumed that maTextNodeList is
sorted (it is not, and so, valid cases to avoid the id were missed); it assumed
that a given list can only consist of items of a single numbering style, and so
only tested the list of nodes referenced from maTextNodeList of given SwNumRule.
I.e., this implementation targeted a special case of a list style fully covering
a single continuous list.
This skipped ids for list items with list styles, in which maTextNodeList passed
the check in HasContinueList, but which were followed by items with a different
list style, continuing the same list. This constellation outputs continue-list
attribute in the following items (see XMLTextParagraphExport::exportListChange),
which references the skipped id. The resulting ODF is an invalid XML (an xml:id
is missing that is referenced), and also does not allow to continue such a list.
The change tries to fix this, using a list of nodes in XMLTextParagraphExport,
and analyzing if the list of the current paragraph has a continuation that needs
to reference this list id. Two new hidden properties introduced in SwXParagraph
and SwXTextDocument: "ODFExport_NodeIndex" and "ODFExport_ListNodes", resp. They
allow to pipe the data to the export. The previous special casing of property
state for "ListId", used in SwNumRule::HasContinueList, is removed together with
the mentioned function.
The intention is to have a logic allowing to detect 100% cases where the list id
is required, and where it's not required.
A related unit test for tdf#149668 was fixed to not rely on the mentioned ListId
property state workaround, and moved from sw/qa/core/unocore to xmloff/qa/unit.
Change-Id: If6a6ac7a3dfe0b2ea143229678a603875153eedb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153044
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/xmloff/txtparae.hxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx index 1ba8b0b1a0c8..af23376d1160 100644 --- a/include/xmloff/txtparae.hxx +++ b/include/xmloff/txtparae.hxx @@ -112,6 +112,9 @@ class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public XMLStyleExport XMLTextListsHelper* mpTextListsHelper; ::std::vector< std::unique_ptr<XMLTextListsHelper> > maTextListsHelperStack; + struct DocumentListNodes; + std::unique_ptr<DocumentListNodes> mpDocumentListNodes; + o3tl::sorted_vector<css::uno::Reference<css::text::XTextFrame>> maFrameRecurseGuard; o3tl::sorted_vector<css::uno::Reference<css::drawing::XShape>> maShapeRecurseGuard; @@ -537,6 +540,9 @@ public: void PopTextListsHelper(); private: + bool ShouldSkipListId(const css::uno::Reference<css::text::XTextContent>& xTextContent); + bool ExportListId() const; + XMLTextParagraphExport(XMLTextParagraphExport const &) = delete; }; |