summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-08-13 12:55:45 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-01-25 14:41:53 +0100
commit2e163669a84eda5e310820c256879065dfbb893a (patch)
tree7477dc726cd455ab4c60d915292867376783272e /sw
parent898919ecd6c3e9d6244b3eee6837efd7ae272cd9 (diff)
ofz#9858 Bad-cast
use a SwUnoCursor for the LastAnchorPos around here Change-Id: I9b2b18e88aa0816e3386d7b95b4fd386d13af77f Reviewed-on: https://gerrit.libreoffice.org/58927 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 8e7620584ff81813f97d24192d01830834fece4d)
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 91b2f6c3d733..487e98791c32 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -70,6 +70,7 @@
#include <frmatr.hxx>
#include <itabenum.hxx>
+#include <unocrsr.hxx>
#include <iostream>
#include <memory>
@@ -197,8 +198,12 @@ sal_uInt16 SwWW8ImplReader::End_Footnote()
sChar += OUStringLiteral1(pText->GetText()[--nPos]);
m_pPaM->SetMark();
--m_pPaM->GetMark()->nContent;
+ std::shared_ptr<SwUnoCursor> xLastAnchorCursor(m_pLastAnchorPos ? m_rDoc.CreateUnoCursor(*m_pLastAnchorPos) : nullptr);
+ m_pLastAnchorPos.reset();
m_rDoc.getIDocumentContentOperations().DeleteRange( *m_pPaM );
m_pPaM->DeleteMark();
+ if (xLastAnchorCursor)
+ m_pLastAnchorPos.reset(new SwPosition(*xLastAnchorCursor->GetPoint()));
SwFormatFootnote aFootnote(rDesc.meType == MAN_EDN);
pFN = pText->InsertItem(aFootnote, nPos, nPos);
}