diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-03-01 18:24:40 +0100 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2019-03-04 11:10:37 +0100 |
commit | 60ea01af8c57f9b03ee1da1196284fa10025c22c (patch) | |
tree | 81193f90b73c2cdf0fd210c44b834b46e5d93868 /sw | |
parent | b891226dcee036fd8aad8320c7007b75b10b23c5 (diff) |
tdf#123313 sw: workaround Undo problem with ToX Update
The problem is that when ToX is updated, CrossRefHeadingBookmarks will
be created for the heading nodes, and SwUndoInsBookmark will be created
at that time, but then nodes will be created for later entries in the
ToX and if the heading is below the ToX then the node index in
SwUndoInsBookmark will not match the node index of the
CrossRefHeadingBookmark.
Thus SwHistoryBookmark::IsEqualBookmark() will cause the mark to be
skipped during Undo instead of deleted, and then it can cause trouble.
Work around that by having SwHistoryBookmark::IsEqualBookmark() not
check the position if it's a CrossRefHeadingBookmark.
Change-Id: I9277978844837accdda35195a863c6163a839b6e
Reviewed-on: https://gerrit.libreoffice.org/68596
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/undo/rolbck.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index b8048539f459..51a4bcdd813f 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -54,6 +54,7 @@ #include <charfmt.hxx> #include <strings.hrc> #include <bookmrk.hxx> +#include <crossrefbookmark.hxx> #include <memory> OUString SwHistoryHint::GetDescription() const @@ -669,9 +670,11 @@ void SwHistoryBookmark::SetInDoc( SwDoc* pDoc, bool ) bool SwHistoryBookmark::IsEqualBookmark(const ::sw::mark::IMark& rBkmk) { - return m_nNode == rBkmk.GetMarkPos().nNode.GetIndex() - && m_nContent == rBkmk.GetMarkPos().nContent.GetIndex() - && m_aName == rBkmk.GetName(); + return m_aName == rBkmk.GetName() + && ( ( m_nNode == rBkmk.GetMarkPos().nNode.GetIndex() + && m_nContent == rBkmk.GetMarkPos().nContent.GetIndex()) + // tdf#123313 these are created in middle of ToX update + || dynamic_cast<sw::mark::CrossRefHeadingBookmark const*>(&rBkmk)); } |