diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-08-09 18:45:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-13 08:36:24 +0200 |
commit | aeefec8d794901a7b03b80aab04b7580065a6627 (patch) | |
tree | 2c4dd0bd94dd7792de2cbc3ac0201f0a7c8a6306 /sw | |
parent | dc05dfde93afa45efab6c6ce5d2e41a2563e2404 (diff) |
pass SwNode instead of SwNodeIndex to SwUndoInsert::SwUndoInsert
part of the process of hiding the internals of SwPosition
Change-Id: I00501617d8e602f51fbe6c79ba92654292e30f0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138214
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/inc/UndoInsert.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/undo/unins.cxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh1.cxx | 2 |
4 files changed, 14 insertions, 14 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index fabffeeac236..19af2534a9ae 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2859,7 +2859,7 @@ bool DocumentContentOperationsManager::InsertString( const SwPaM &rRg, const OUS if (bDoesUndo) { m_rDoc.GetIDocumentUndoRedo().AppendUndo( - std::make_unique<SwUndoInsert>(rPos.nNode, + std::make_unique<SwUndoInsert>(rPos.GetNode(), rPos.GetContentIndex(), ins.getLength(), nInsertMode)); } } @@ -2884,7 +2884,7 @@ bool DocumentContentOperationsManager::InsertString( const SwPaM &rRg, const OUS if (!pUndo) { - pUndo = new SwUndoInsert( rPos.nNode, nInsPos, 0, nInsertMode, + pUndo = new SwUndoInsert( rPos.GetNode(), nInsPos, 0, nInsertMode, !rCC.isLetterNumeric( rStr, 0 ) ); m_rDoc.GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndo) ); } @@ -2897,7 +2897,7 @@ bool DocumentContentOperationsManager::InsertString( const SwPaM &rRg, const OUS // if CanGrouping() returns true, everything has already been done if (!pUndo->CanGrouping(ins[i])) { - pUndo = new SwUndoInsert(rPos.nNode, nInsPos, 1, nInsertMode, + pUndo = new SwUndoInsert(rPos.GetNode(), nInsPos, 1, nInsertMode, !rCC.isLetterNumeric(ins, i)); m_rDoc.GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndo) ); } @@ -3433,7 +3433,7 @@ bool DocumentContentOperationsManager::AppendTextNode( SwPosition& rPos ) if (m_rDoc.GetIDocumentUndoRedo().DoesUndo()) { - m_rDoc.GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoInsert>( rPos.nNode ) ); + m_rDoc.GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoInsert>( rPos.GetNode() ) ); } // To-Do - add 'SwExtraRedlineTable' also ? diff --git a/sw/source/core/inc/UndoInsert.hxx b/sw/source/core/inc/UndoInsert.hxx index 82c89d710728..8a313ba50381 100644 --- a/sw/source/core/inc/UndoInsert.hxx +++ b/sw/source/core/inc/UndoInsert.hxx @@ -60,14 +60,14 @@ class SwUndoInsert final : public SwUndo, private SwUndoSaveContent SwDoc * m_pDoc; - void Init(const SwNodeIndex & rNode); + void Init(const SwNode & rNode); std::optional<OUString> GetTextFromDoc() const; public: - SwUndoInsert( const SwNodeIndex& rNode, sal_Int32 nContent, sal_Int32 nLen, + SwUndoInsert( const SwNode& rNode, sal_Int32 nContent, sal_Int32 nLen, const SwInsertFlags nInsertFlags, bool bWDelim = true ); - SwUndoInsert( const SwNodeIndex& rNode ); + SwUndoInsert( const SwNode& rNode ); virtual ~SwUndoInsert() override; virtual void UndoImpl( ::sw::UndoRedoContext & ) override; diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index 0247bfdab876..efc73ab31060 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -84,10 +84,10 @@ std::optional<OUString> SwUndoInsert::GetTextFromDoc() const return aResult; } -void SwUndoInsert::Init(const SwNodeIndex & rNd) +void SwUndoInsert::Init(const SwNode & rNd) { // consider Redline - m_pDoc = &rNd.GetNode().GetDoc(); + m_pDoc = const_cast<SwDoc*>(&rNd.GetDoc()); if( m_pDoc->getIDocumentRedlineAccess().IsRedlineOn() ) { m_pRedlData.reset( new SwRedlineData( RedlineType::Insert, @@ -100,11 +100,11 @@ void SwUndoInsert::Init(const SwNodeIndex & rNd) m_bCacheComment = false; } -SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd, sal_Int32 nCnt, +SwUndoInsert::SwUndoInsert( const SwNode& rNd, sal_Int32 nCnt, sal_Int32 nL, const SwInsertFlags nInsertFlags, bool bWDelim ) - : SwUndo(SwUndoId::TYPING, &rNd.GetNode().GetDoc()), + : SwUndo(SwUndoId::TYPING, &rNd.GetDoc()), m_nNode( rNd.GetIndex() ), m_nContent(nCnt), m_nLen(nL), m_bIsWordDelim( bWDelim ), m_bIsAppend( false ) , m_bWithRsid(false) @@ -113,8 +113,8 @@ SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd, sal_Int32 nCnt, Init(rNd); } -SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd ) - : SwUndo(SwUndoId::SPLITNODE, &rNd.GetNode().GetDoc()), +SwUndoInsert::SwUndoInsert( const SwNode& rNd ) + : SwUndo(SwUndoId::SPLITNODE, &rNd.GetDoc()), m_nNode( rNd.GetIndex() ), m_nContent(0), m_nLen(1), m_bIsWordDelim( false ), m_bIsAppend( true ) , m_bWithRsid(false) diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 7ba0c8d49cd9..86d05ae9b45a 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -1269,7 +1269,7 @@ static bool lcl_FoldedOutlineNodeEndOfParaSplit(SwWrtShell *pThis) if (pDoc->GetIDocumentUndoRedo().DoesUndo()) { pDoc->GetIDocumentUndoRedo().ClearRedo(); - pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsert>(SwNodeIndex(*pNd))); + pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsert>(*pNd)); pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoFormatColl> (SwPaM(*pNd), pNd->GetTextColl(), true, true)); } |