diff options
-rw-r--r-- | sw/source/core/inc/UndoInsert.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/undo/unins.cxx | 21 |
2 files changed, 12 insertions, 12 deletions
diff --git a/sw/source/core/inc/UndoInsert.hxx b/sw/source/core/inc/UndoInsert.hxx index ae7b6c02dbd5..20bc4be7fdc5 100644 --- a/sw/source/core/inc/UndoInsert.hxx +++ b/sw/source/core/inc/UndoInsert.hxx @@ -26,6 +26,7 @@ #include <svx/svdtypes.hxx> #include <rtl/ustring.hxx> #include <swtypes.hxx> +#include <ndindex.hxx> #include <IDocumentContentOperations.hxx> #include <optional> @@ -41,7 +42,7 @@ enum class MirrorGraph; class SwUndoInsert final : public SwUndo, private SwUndoSaveContent { /// start of Content in UndoNodes for Redo - std::unique_ptr<SwNodeIndex> m_pUndoNodeIndex; + std::optional<SwNodeIndex> m_oUndoNodeIndex; std::optional<OUString> maText; std::optional<OUString> maUndoText; std::unique_ptr<SwRedlineData> m_pRedlData; diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index 6ba42b5327cc..e923db1f2fe9 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -185,13 +185,13 @@ bool SwUndoInsert::CanGrouping( const SwPosition& rPos ) SwUndoInsert::~SwUndoInsert() { - if (m_pUndoNodeIndex) // delete the section from UndoNodes array + if (m_oUndoNodeIndex) // delete the section from UndoNodes array { // Insert saves the content in IconSection - SwNodes& rUNds = m_pUndoNodeIndex->GetNodes(); - rUNds.Delete(*m_pUndoNodeIndex, - rUNds.GetEndOfExtras().GetIndex() - m_pUndoNodeIndex->GetIndex()); - m_pUndoNodeIndex.reset(); + SwNodes& rUNds = m_oUndoNodeIndex->GetNodes(); + rUNds.Delete(*m_oUndoNodeIndex, + rUNds.GetEndOfExtras().GetIndex() - m_oUndoNodeIndex->GetIndex()); + m_oUndoNodeIndex.reset(); } else // the inserted text { @@ -268,9 +268,8 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext) if (!maText) { - m_pUndoNodeIndex.reset( - new SwNodeIndex(m_pDoc->GetNodes().GetEndOfContent())); - MoveToUndoNds(aPaM, m_pUndoNodeIndex.get()); + m_oUndoNodeIndex.emplace(m_pDoc->GetNodes().GetEndOfContent()); + MoveToUndoNds(aPaM, &*m_oUndoNodeIndex); } m_nNode = aPaM.GetPoint()->GetNodeIndex(); m_nContent = aPaM.GetPoint()->GetContentIndex(); @@ -341,9 +340,9 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & rContext) } else { - // re-insert content again (first detach m_pUndoNodeIndex!) - SwNodeOffset const nMvNd = m_pUndoNodeIndex->GetIndex(); - m_pUndoNodeIndex.reset(); + // re-insert content again (first detach m_oUndoNodeIndex!) + SwNodeOffset const nMvNd = m_oUndoNodeIndex->GetIndex(); + m_oUndoNodeIndex.reset(); MoveFromUndoNds(*pTmpDoc, nMvNd, *pPam->GetMark()); } m_nNode = pPam->GetMark()->GetNodeIndex(); |