diff options
author | Justin Luth <justin.luth@collabora.com> | 2019-11-29 22:10:27 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-12-20 10:58:33 +0100 |
commit | acb9d901009d026cb48e6a8b94e6200f05110504 (patch) | |
tree | 402534f6ad8fa82972678fa98a0775e110b5aa30 /writerfilter/source/dmapper/DomainMapper_Impl.hxx | |
parent | 10d345faa087fa49692f38bb2ece22560f423ba7 (diff) |
tdf#123262 writerfilter: completely ignore footnote separators
... except for processing enough to observe the separator exists.
For each footnote reference, the entire footnote.xml file is
parsed every time. The text in the "separator" footnote was
being added to every footnote. The normal case where this is just
a single paragraph was already handled, but this patch generalizes
everything to handle cases of actual text or multiple paragraphs.
Not every footnote has a type, so we can't depend on that to turn
ignoringText ON/OFF. Every footnote has an ID, but theoretically
the ID could be processed before or after the type, and it has
no idea which type it is. Finally, the skipped text has no idea
how many times/paragaphs it needs to skip. So a three-way
control was needed to handle on/used/off. As a safeguard, finishing
the footnote.xml parse (PopFootOrEndnote) ensures that
ignoring won't be left on in the unlikely case that
the separator is the last footnote.
Change-Id: Ia30ca8d3a36417a4691e3b2e1c978720be017030
Reviewed-on: https://gerrit.libreoffice.org/82172
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper_Impl.hxx')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 97f7cddb7f16..f3f9f77ce1cf 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -114,6 +114,13 @@ enum BreakType COLUMN_BREAK }; +enum SkipFootnoteSeparator +{ + OFF, + ON, + SKIPPING +}; + /** * Storage for state that is relevant outside a header/footer, but not inside it. * @@ -505,8 +512,8 @@ private: PropertyMapPtr m_pFootnoteContext; bool m_bHasFootnoteStyle; bool m_bCheckFootnoteStyle; - /// Did we get a <w:separator/> for this footnote already? - bool m_bSeenFootOrEndnoteSeparator; + /// Skip paragraphs from the <w:separator/> footnote + SkipFootnoteSeparator m_eSkipFootnoteState; bool m_bLineNumberingSet; bool m_bIsInFootnoteProperties; @@ -780,8 +787,9 @@ public: void SetCheckFootnoteStyle(bool bVal) { m_bCheckFootnoteStyle = bVal; } const PropertyMapPtr& GetFootnoteContext() const { return m_pFootnoteContext; } - /// Got a <w:separator/>. - void SeenFootOrEndnoteSeparator(); + + SkipFootnoteSeparator GetSkipFootnoteState() const { return m_eSkipFootnoteState; } + void SetSkipFootnoteState(SkipFootnoteSeparator eId) { m_eSkipFootnoteState = eId; } void PushAnnotation(); void PopAnnotation(); @@ -991,8 +999,6 @@ public: /// If the current section has a footnote separator. bool m_bHasFtnSep; - /// If the next newline should be ignored, used by the special footnote separator paragraph. - bool m_bIgnoreNextPara; /// If the next tab should be ignored, used for footnotes. bool m_bCheckFirstFootnoteTab; bool m_bIgnoreNextTab; |