diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-10-05 11:45:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-10-05 21:24:57 +0200 |
commit | 38746ee9dfe6db8029a844576c3395b54167c3e9 (patch) | |
tree | 177e718cae20fedc07a942871b90f8ce1888dcbb | |
parent | 54759fdbba24f1a552f635fc803078b8ce83dade (diff) |
SwUndoDelete::CanGrouping never passed a null SwDoc*
ditto:
SwUndoOverwrite::CanGrouping
SwUndoTOXChange ctor
SwUndoDefaultAttr ctor
SwUndoFootNoteInfo ctor
SwUndoEndNoteInfo ctor
SwUndoRenameBookmark ctor
SwSdrUndo ctor
SwUndoDrawGroup ctor
SwUndoDrawUnGroup ctor
SwUndoDrawUnGroupConnectToLayout ctor
SwUndoDrawDelete ctor
SwUndoOverwrite ctor
SwUndoSplitNode ctor
SwUndoTableCpyTable ctor
SwUndoCpyTable ctor
SwUndoTableStyleMake ctor
SwUndoTableStyleDelete ctor
SwUndoTableStyleUpdate ctor
Change-Id: I138729e37777c7960017f9004c31a533f86315a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103961
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
23 files changed, 114 insertions, 114 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index e63b0cf41bfe..52b67a9c3768 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2672,13 +2672,13 @@ bool DocumentContentOperationsManager::Overwrite( const SwPaM &rRg, const OUStri if (pUndoOW) { // if CanGrouping() returns true it's already merged - bMerged = pUndoOW->CanGrouping( &m_rDoc, rPt, c ); + bMerged = pUndoOW->CanGrouping(m_rDoc, rPt, c); } } if (!bMerged) { m_rDoc.GetIDocumentUndoRedo().AppendUndo( - std::make_unique<SwUndoOverwrite>(&m_rDoc, rPt, c) ); + std::make_unique<SwUndoOverwrite>(m_rDoc, rPt, c) ); } } else @@ -3130,7 +3130,7 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b // insert the Undo object (currently only for TextNode) if( pNode->IsTextNode() ) { - pUndo = new SwUndoSplitNode( &m_rDoc, rPos, bChkTableStart ); + pUndo = new SwUndoSplitNode( m_rDoc, rPos, bChkTableStart ); m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndo>(pUndo)); } } @@ -4160,7 +4160,7 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam) dynamic_cast<SwUndoDelete *>(pLastUndo) ); if (pUndoDelete) { - bMerged = pUndoDelete->CanGrouping( &m_rDoc, rPam ); + bMerged = pUndoDelete->CanGrouping(m_rDoc, rPam); // if CanGrouping() returns true it's already merged } } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index a346a4c3148a..87aecbdf908d 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1709,7 +1709,7 @@ void SwDoc::AppendUndoForInsertFromDB( const SwPaM& rPam, bool bIsTable ) const SwTableNode* pTableNd = rPam.GetPoint()->nNode.GetNode().FindTableNode(); if( pTableNd ) { - std::unique_ptr<SwUndoCpyTable> pUndo(new SwUndoCpyTable(this)); + std::unique_ptr<SwUndoCpyTable> pUndo(new SwUndoCpyTable(*this)); pUndo->SetTableSttIdx( pTableNd->GetIndex() ); GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) ); } @@ -1730,7 +1730,7 @@ void SwDoc::ChangeTOX(SwTOXBase & rTOX, const SwTOXBase & rNew) if (GetIDocumentUndoRedo().DoesUndo()) { GetIDocumentUndoRedo().AppendUndo( - std::make_unique<SwUndoTOXChange>(this, rTOXSect, rNew)); + std::make_unique<SwUndoTOXChange>(*this, rTOXSect, rNew)); } rTOX = rNew; diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 271ad9bcc0fc..b7076c9e82e1 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -856,7 +856,7 @@ namespace sw::mark if (m_rDoc.GetIDocumentUndoRedo().DoesUndo()) { m_rDoc.GetIDocumentUndoRedo().AppendUndo( - std::make_unique<SwUndoRenameBookmark>(sOldName, rNewName, &m_rDoc)); + std::make_unique<SwUndoRenameBookmark>(sOldName, rNewName, m_rDoc)); } m_rDoc.getIDocumentState().SetModified(); } diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index cdc449943fca..98f3680ec134 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -198,7 +198,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) std::unique_ptr<SwUndoDrawGroup> pUndo; if (GetIDocumentUndoRedo().DoesUndo()) - pUndo.reset(new SwUndoDrawGroup( static_cast<sal_uInt16>(rMrkList.GetMarkCount()) , this)); + pUndo.reset(new SwUndoDrawGroup( static_cast<sal_uInt16>(rMrkList.GetMarkCount()), *this)); // #i53320# bool bGroupMembersNotPositioned( false ); @@ -316,7 +316,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) SwUndoDrawUnGroup* pUndo = nullptr; if( bUndo ) { - pUndo = new SwUndoDrawUnGroup( static_cast<SdrObjGroup*>(pObj), this ); + pUndo = new SwUndoDrawUnGroup( static_cast<SdrObjGroup*>(pObj), *this ); GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndo>(pUndo)); } @@ -346,7 +346,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) SwUndoDrawUnGroupConnectToLayout* pUndo = nullptr; if( bUndo ) { - pUndo = new SwUndoDrawUnGroupConnectToLayout(this); + pUndo = new SwUndoDrawUnGroupConnectToLayout(*this); GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndo>(pUndo)); } @@ -417,7 +417,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) { std::unique_ptr<SwUndoDrawDelete> pUndo; if (GetIDocumentUndoRedo().DoesUndo()) - pUndo.reset(new SwUndoDrawDelete( static_cast<sal_uInt16>(rMrkList.GetMarkCount()), this )); + pUndo.reset(new SwUndoDrawDelete( static_cast<sal_uInt16>(rMrkList.GetMarkCount()), *this )); // Destroy ContactObjects, save formats. for( size_t i = 0; i < rMrkList.GetMarkCount(); ++i ) diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 008f0beea2b2..1e030f1a0639 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -599,7 +599,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) { if (GetIDocumentUndoRedo().DoesUndo()) { - GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoDefaultAttr>( aOld, this ) ); + GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoDefaultAttr>( aOld, *this ) ); } const SfxPoolItem* pTmpItem; diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index 90899b91a002..eca8d5713f36 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -297,7 +297,7 @@ void SwDoc::SetFootnoteInfo(const SwFootnoteInfo& rInfo) if (GetIDocumentUndoRedo().DoesUndo()) { - GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoFootNoteInfo>(rOld, this) ); + GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoFootNoteInfo>(rOld, *this) ); } bool bFootnotePos = rInfo.m_ePos != rOld.m_ePos; @@ -369,7 +369,7 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo) if(GetIDocumentUndoRedo().DoesUndo()) { GetIDocumentUndoRedo().AppendUndo( - std::make_unique<SwUndoEndNoteInfo>( GetEndNoteInfo(), this ) ); + std::make_unique<SwUndoEndNoteInfo>( GetEndNoteInfo(), *this ) ); } bool bNumChg = rInfo.m_nFootnoteOffset != GetEndNoteInfo().m_nFootnoteOffset; diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index dcd662f4c163..6b1f09b69b90 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -4300,7 +4300,7 @@ bool SwDoc::InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes, if (bUndo) { GetIDocumentUndoRedo().ClearRedo(); - pUndo.reset(new SwUndoCpyTable(this)); + pUndo.reset(new SwUndoCpyTable(*this)); } { @@ -4329,7 +4329,7 @@ bool SwDoc::InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes, if (bUndo) { GetIDocumentUndoRedo().ClearRedo(); - pUndo.reset(new SwUndoTableCpyTable(this)); + pUndo.reset(new SwUndoTableCpyTable(*this)); GetIDocumentUndoRedo().DoUndo(false); } @@ -4582,7 +4582,7 @@ SwTableAutoFormat* SwDoc::MakeTableStyle(const OUString& rName, bool bBroadcast) if (GetIDocumentUndoRedo().DoesUndo()) { GetIDocumentUndoRedo().AppendUndo( - std::make_unique<SwUndoTableStyleMake>(rName, this)); + std::make_unique<SwUndoTableStyleMake>(rName, *this)); } if (bBroadcast) @@ -4618,7 +4618,7 @@ std::unique_ptr<SwTableAutoFormat> SwDoc::DelTableStyle(const OUString& rName, b if (GetIDocumentUndoRedo().DoesUndo()) { GetIDocumentUndoRedo().AppendUndo( - std::make_unique<SwUndoTableStyleDelete>(std::move(pReleasedFormat), vAffectedTables, this)); + std::make_unique<SwUndoTableStyleDelete>(std::move(pReleasedFormat), vAffectedTables, *this)); } } @@ -4649,7 +4649,7 @@ void SwDoc::ChgTableStyle(const OUString& rName, const SwTableAutoFormat& rNewFo if (GetIDocumentUndoRedo().DoesUndo()) { GetIDocumentUndoRedo().AppendUndo( - std::make_unique<SwUndoTableStyleUpdate>(*pFormat, aOldFormat, this)); + std::make_unique<SwUndoTableStyleUpdate>(*pFormat, aOldFormat, *this)); } } diff --git a/sw/source/core/inc/SwUndoTOXChange.hxx b/sw/source/core/inc/SwUndoTOXChange.hxx index a593bfd6da0a..a871e7135472 100644 --- a/sw/source/core/inc/SwUndoTOXChange.hxx +++ b/sw/source/core/inc/SwUndoTOXChange.hxx @@ -35,7 +35,7 @@ private: sal_uLong const m_nNodeIndex; public: - SwUndoTOXChange(const SwDoc* pDoc, SwTOXBaseSection const& rTOX, const SwTOXBase & rNew); + SwUndoTOXChange(const SwDoc& rDoc, SwTOXBaseSection const& rTOX, const SwTOXBase & rNew); virtual ~SwUndoTOXChange() override; virtual void UndoImpl( ::sw::UndoRedoContext & ) override; diff --git a/sw/source/core/inc/UndoAttribute.hxx b/sw/source/core/inc/UndoAttribute.hxx index 35247cf4d16f..dc53f6add668 100644 --- a/sw/source/core/inc/UndoAttribute.hxx +++ b/sw/source/core/inc/UndoAttribute.hxx @@ -201,7 +201,7 @@ class SwUndoDefaultAttr : public SwUndo public: // registers at the format and saves old attributes - SwUndoDefaultAttr( const SfxItemSet& rOldSet, const SwDoc* pDoc ); + SwUndoDefaultAttr( const SfxItemSet& rOldSet, const SwDoc& rDoc ); virtual ~SwUndoDefaultAttr() override; @@ -232,7 +232,7 @@ class SwUndoFootNoteInfo : public SwUndo std::unique_ptr<SwFootnoteInfo> m_pFootNoteInfo; public: - SwUndoFootNoteInfo( const SwFootnoteInfo &rInfo, const SwDoc* pDoc ); + SwUndoFootNoteInfo( const SwFootnoteInfo &rInfo, const SwDoc& rDoc ); virtual ~SwUndoFootNoteInfo() override; @@ -245,7 +245,7 @@ class SwUndoEndNoteInfo : public SwUndo std::unique_ptr<SwEndNoteInfo> m_pEndNoteInfo; public: - SwUndoEndNoteInfo( const SwEndNoteInfo &rInfo, const SwDoc* pDoc ); + SwUndoEndNoteInfo( const SwEndNoteInfo &rInfo, const SwDoc& rDoc ); virtual ~SwUndoEndNoteInfo() override; diff --git a/sw/source/core/inc/UndoBookmark.hxx b/sw/source/core/inc/UndoBookmark.hxx index 68f47d204cf6..6d44bda440be 100644 --- a/sw/source/core/inc/UndoBookmark.hxx +++ b/sw/source/core/inc/UndoBookmark.hxx @@ -86,7 +86,7 @@ class SwUndoRenameBookmark : public SwUndo const OUString m_sNewName; public: - SwUndoRenameBookmark( const OUString& rOldName, const OUString& rNewName, const SwDoc* pDoc ); + SwUndoRenameBookmark( const OUString& rOldName, const OUString& rNewName, const SwDoc& rDoc ); virtual ~SwUndoRenameBookmark() override; private: diff --git a/sw/source/core/inc/UndoDelete.hxx b/sw/source/core/inc/UndoDelete.hxx index 2faf346fee3c..6ecc3385a2af 100644 --- a/sw/source/core/inc/UndoDelete.hxx +++ b/sw/source/core/inc/UndoDelete.hxx @@ -87,7 +87,7 @@ public: */ virtual SwRewriter GetRewriter() const override; - bool CanGrouping( SwDoc*, const SwPaM& ); + bool CanGrouping( SwDoc&, const SwPaM& ); void SetTableDelLastNd() { m_bTableDelLastNd = true; } diff --git a/sw/source/core/inc/UndoDraw.hxx b/sw/source/core/inc/UndoDraw.hxx index ee8f37ef2db6..f4117a6fd61e 100644 --- a/sw/source/core/inc/UndoDraw.hxx +++ b/sw/source/core/inc/UndoDraw.hxx @@ -39,7 +39,7 @@ class SwSdrUndo : public SwUndo std::unique_ptr<SdrMarkList> m_pMarkList; // MarkList for all selected SdrObjects public: - SwSdrUndo( std::unique_ptr<SdrUndoAction> , const SdrMarkList* pMarkList, const SwDoc* pDoc ); + SwSdrUndo( std::unique_ptr<SdrUndoAction> , const SdrMarkList* pMarkList, const SwDoc& rDoc ); virtual ~SwSdrUndo() override; @@ -56,7 +56,7 @@ class SwUndoDrawGroup : public SwUndo bool m_bDeleteFormat; public: - SwUndoDrawGroup( sal_uInt16 nCnt, const SwDoc* pDoc ); + SwUndoDrawGroup( sal_uInt16 nCnt, const SwDoc& rDoc ); virtual ~SwUndoDrawGroup() override; @@ -85,7 +85,7 @@ class SwUndoDrawUnGroup : public SwUndo bool m_bDeleteFormat; public: - SwUndoDrawUnGroup( SdrObjGroup*, const SwDoc* pDoc ); + SwUndoDrawUnGroup( SdrObjGroup*, const SwDoc& rDoc ); virtual ~SwUndoDrawUnGroup() override; @@ -101,7 +101,7 @@ private: std::vector< std::pair< SwDrawFrameFormat*, SdrObject* > > m_aDrawFormatsAndObjs; public: - SwUndoDrawUnGroupConnectToLayout(const SwDoc* pDoc); + SwUndoDrawUnGroupConnectToLayout(const SwDoc& rDoc); virtual ~SwUndoDrawUnGroupConnectToLayout() override; @@ -119,7 +119,7 @@ class SwUndoDrawDelete : public SwUndo bool m_bDeleteFormat; public: - SwUndoDrawDelete( sal_uInt16 nCnt, const SwDoc* pDoc ); + SwUndoDrawDelete( sal_uInt16 nCnt, const SwDoc& rDoc ); virtual ~SwUndoDrawDelete() override; diff --git a/sw/source/core/inc/UndoOverwrite.hxx b/sw/source/core/inc/UndoOverwrite.hxx index af798e8d44b0..f348ecd6c79f 100644 --- a/sw/source/core/inc/UndoOverwrite.hxx +++ b/sw/source/core/inc/UndoOverwrite.hxx @@ -41,7 +41,7 @@ class SwUndoOverwrite: public SwUndo, private SwUndoSaveContent bool m_bGroup : 1; // TRUE: is already grouped; evaluated in CanGrouping() public: - SwUndoOverwrite( SwDoc*, SwPosition&, sal_Unicode cIns ); + SwUndoOverwrite( SwDoc&, SwPosition&, sal_Unicode cIns ); virtual ~SwUndoOverwrite() override; @@ -62,7 +62,7 @@ public: */ virtual SwRewriter GetRewriter() const override; - bool CanGrouping( SwDoc*, SwPosition&, sal_Unicode cIns ); + bool CanGrouping( SwDoc&, SwPosition&, sal_Unicode cIns ); }; struct UndoTransliterate_Data; diff --git a/sw/source/core/inc/UndoSplitMove.hxx b/sw/source/core/inc/UndoSplitMove.hxx index de158ed5e642..1a8546238c12 100644 --- a/sw/source/core/inc/UndoSplitMove.hxx +++ b/sw/source/core/inc/UndoSplitMove.hxx @@ -33,7 +33,7 @@ class SwUndoSplitNode: public SwUndo sal_uInt32 m_nParRsid; public: - SwUndoSplitNode( SwDoc* pDoc, const SwPosition& rPos, bool bChkTable ); + SwUndoSplitNode( SwDoc& rDoc, const SwPosition& rPos, bool bChkTable ); virtual ~SwUndoSplitNode() override; diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx index 331786b4e933..b5e925e48fbf 100644 --- a/sw/source/core/inc/UndoTable.hxx +++ b/sw/source/core/inc/UndoTable.hxx @@ -275,7 +275,7 @@ class SwUndoTableCpyTable : public SwUndo const SwPosition& rPos, bool& rJoin, bool bRedo ); public: - SwUndoTableCpyTable(const SwDoc* pDoc); + SwUndoTableCpyTable(const SwDoc& rDoc); virtual ~SwUndoTableCpyTable() override; @@ -296,7 +296,7 @@ class SwUndoCpyTable : public SwUndo sal_uLong m_nTableNode; public: - SwUndoCpyTable(const SwDoc* pDoc); + SwUndoCpyTable(const SwDoc& rDoc); virtual ~SwUndoCpyTable() override; @@ -374,7 +374,7 @@ class SwUndoTableStyleMake : public SwUndo OUString m_sName; std::unique_ptr<SwTableAutoFormat> m_pAutoFormat; public: - SwUndoTableStyleMake(const OUString& rName, const SwDoc* pDoc); + SwUndoTableStyleMake(const OUString& rName, const SwDoc& rDoc); virtual ~SwUndoTableStyleMake() override; @@ -389,7 +389,7 @@ class SwUndoTableStyleDelete : public SwUndo std::unique_ptr<SwTableAutoFormat> m_pAutoFormat; std::vector<SwTable*> m_rAffectedTables; public: - SwUndoTableStyleDelete(std::unique_ptr<SwTableAutoFormat> pAutoFormat, const std::vector<SwTable*>& rAffectedTables, const SwDoc* pDoc); + SwUndoTableStyleDelete(std::unique_ptr<SwTableAutoFormat> pAutoFormat, const std::vector<SwTable*>& rAffectedTables, const SwDoc& rDoc); virtual ~SwUndoTableStyleDelete() override; @@ -403,7 +403,7 @@ class SwUndoTableStyleUpdate : public SwUndo { std::unique_ptr<SwTableAutoFormat> m_pOldFormat, m_pNewFormat; public: - SwUndoTableStyleUpdate(const SwTableAutoFormat& rNewFormat, const SwTableAutoFormat& rOldFormat, const SwDoc* pDoc); + SwUndoTableStyleUpdate(const SwTableAutoFormat& rNewFormat, const SwTableAutoFormat& rOldFormat, const SwDoc& rDoc); virtual ~SwUndoTableStyleUpdate() override; diff --git a/sw/source/core/undo/SwUndoTOXChange.cxx b/sw/source/core/undo/SwUndoTOXChange.cxx index c88182b7a522..a2112f5b372b 100644 --- a/sw/source/core/undo/SwUndoTOXChange.cxx +++ b/sw/source/core/undo/SwUndoTOXChange.cxx @@ -34,9 +34,9 @@ namespace } } -SwUndoTOXChange::SwUndoTOXChange(const SwDoc *pDoc, +SwUndoTOXChange::SwUndoTOXChange(const SwDoc& rDoc, SwTOXBaseSection const& rTOX, SwTOXBase const& rNew) - : SwUndo(SwUndoId::TOXCHANGE, pDoc) + : SwUndo(SwUndoId::TOXCHANGE, &rDoc) , m_Old(rTOX) , m_New(rNew) , m_nNodeIndex(GetSectionNodeIndex(rTOX)) diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index 3cbdebd6a989..4df433c34e4e 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -837,8 +837,8 @@ void SwUndoAttr::RemoveIdx( SwDoc& rDoc ) } } -SwUndoDefaultAttr::SwUndoDefaultAttr( const SfxItemSet& rSet, const SwDoc* pDoc ) - : SwUndo( SwUndoId::SETDEFTATTR, pDoc ) +SwUndoDefaultAttr::SwUndoDefaultAttr( const SfxItemSet& rSet, const SwDoc& rDoc ) + : SwUndo( SwUndoId::SETDEFTATTR, &rDoc ) { const SfxPoolItem* pItem; if( SfxItemState::SET == rSet.GetItemState( RES_PARATR_TABSTOP, false, &pItem ) ) { @@ -964,8 +964,8 @@ void SwUndoChangeFootNote::RepeatImpl(::sw::RepeatContext & rContext) rDoc.SetCurFootnote(rContext.GetRepeatPaM(), m_Text, m_bEndNote); } -SwUndoFootNoteInfo::SwUndoFootNoteInfo( const SwFootnoteInfo &rInfo, const SwDoc* pDoc ) - : SwUndo( SwUndoId::FTNINFO, pDoc ) +SwUndoFootNoteInfo::SwUndoFootNoteInfo( const SwFootnoteInfo &rInfo, const SwDoc& rDoc ) + : SwUndo( SwUndoId::FTNINFO, &rDoc ) , m_pFootNoteInfo( new SwFootnoteInfo( rInfo ) ) { } @@ -990,8 +990,8 @@ void SwUndoFootNoteInfo::RedoImpl(::sw::UndoRedoContext & rContext) m_pFootNoteInfo.reset( pInf ); } -SwUndoEndNoteInfo::SwUndoEndNoteInfo( const SwEndNoteInfo &rInfo, const SwDoc* pDoc ) - : SwUndo( SwUndoId::FTNINFO, pDoc ) +SwUndoEndNoteInfo::SwUndoEndNoteInfo( const SwEndNoteInfo &rInfo, const SwDoc& rDoc ) + : SwUndo( SwUndoId::FTNINFO, &rDoc ) , m_pEndNoteInfo( new SwEndNoteInfo( rInfo ) ) { } diff --git a/sw/source/core/undo/unbkmk.cxx b/sw/source/core/undo/unbkmk.cxx index 973f15566bba..5372899623f3 100644 --- a/sw/source/core/undo/unbkmk.cxx +++ b/sw/source/core/undo/unbkmk.cxx @@ -100,8 +100,8 @@ void SwUndoDeleteBookmark::RedoImpl(::sw::UndoRedoContext & rContext) ResetInDoc( rContext.GetDoc() ); } -SwUndoRenameBookmark::SwUndoRenameBookmark( const OUString& rOldName, const OUString& rNewName, const SwDoc* pDoc ) - : SwUndo( SwUndoId::BOOKMARK_RENAME, pDoc ) +SwUndoRenameBookmark::SwUndoRenameBookmark( const OUString& rOldName, const OUString& rNewName, const SwDoc& rDoc ) + : SwUndo( SwUndoId::BOOKMARK_RENAME, &rDoc ) , m_sOldName( rOldName ) , m_sNewName( rNewName ) { diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 6d671234bec9..f86988496778 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -514,7 +514,7 @@ bool SwUndoDelete::SaveContent( const SwPosition* pStt, const SwPosition* pEnd, return true; // move Nodes lying in between } -bool SwUndoDelete::CanGrouping( SwDoc* pDoc, const SwPaM& rDelPam ) +bool SwUndoDelete::CanGrouping( SwDoc& rDoc, const SwPaM& rDelPam ) { // Is Undo greater than one Node (that is Start and EndString)? if( !m_aSttStr || m_aSttStr->isEmpty() || m_aEndStr ) @@ -564,7 +564,7 @@ bool SwUndoDelete::CanGrouping( SwDoc* pDoc, const SwPaM& rDelPam ) // tdf#132725 - if at-char/at-para flys would be deleted, don't group! // DelContentIndex() would be called at the wrong time here, the indexes // in the stored SwHistoryTextFlyCnt would be wrong when Undo is invoked - if (IsFlySelectedByCursor(*pDoc, *pStt, *pEnd)) + if (IsFlySelectedByCursor(rDoc, *pStt, *pEnd)) { return false; } @@ -580,7 +580,7 @@ bool SwUndoDelete::CanGrouping( SwDoc* pDoc, const SwPaM& rDelPam ) if( !bOk ) return false; - pDoc->getIDocumentRedlineAccess().DeleteRedline( rDelPam, false, RedlineType::Any ); + rDoc.getIDocumentRedlineAccess().DeleteRedline( rDelPam, false, RedlineType::Any ); } // Both 'deletes' can be consolidated, so 'move' the related character diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx index e66e325d23ee..f355d8263df3 100644 --- a/sw/source/core/undo/undraw.cxx +++ b/sw/source/core/undo/undraw.cxx @@ -62,12 +62,12 @@ void SwDoc::AddDrawUndo( std::unique_ptr<SdrUndoAction> pUndo ) if( pSh && pSh->HasDrawView() ) pMarkList = &pSh->GetDrawView()->GetMarkedObjectList(); - GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwSdrUndo>(std::move(pUndo), pMarkList, this) ); + GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwSdrUndo>(std::move(pUndo), pMarkList, *this) ); } } -SwSdrUndo::SwSdrUndo( std::unique_ptr<SdrUndoAction> pUndo, const SdrMarkList* pMrkLst, const SwDoc* pDoc ) - : SwUndo( SwUndoId::DRAWUNDO, pDoc ), m_pSdrUndo( std::move(pUndo) ) +SwSdrUndo::SwSdrUndo( std::unique_ptr<SdrUndoAction> pUndo, const SdrMarkList* pMrkLst, const SwDoc& rDoc ) + : SwUndo( SwUndoId::DRAWUNDO, &rDoc ), m_pSdrUndo( std::move(pUndo) ) { if( pMrkLst && pMrkLst->GetMarkCount() ) m_pMarkList.reset( new SdrMarkList( *pMrkLst ) ); @@ -174,8 +174,8 @@ static void lcl_RestoreAnchor( SwFrameFormat* pFormat, sal_uLong nNodePos ) } } -SwUndoDrawGroup::SwUndoDrawGroup( sal_uInt16 nCnt, const SwDoc* pDoc ) - : SwUndo( SwUndoId::DRAWGROUP, pDoc ), m_nSize( nCnt + 1 ), m_bDeleteFormat( true ) +SwUndoDrawGroup::SwUndoDrawGroup( sal_uInt16 nCnt, const SwDoc& rDoc ) + : SwUndo( SwUndoId::DRAWGROUP, &rDoc ), m_nSize( nCnt + 1 ), m_bDeleteFormat( true ) { m_pObjArray.reset( new SwUndoGroupObjImpl[ m_nSize ] ); } @@ -305,8 +305,8 @@ void SwUndoDrawGroup::SetGroupFormat( SwDrawFrameFormat* pFormat ) m_pObjArray[0].pFormat = pFormat; } -SwUndoDrawUnGroup::SwUndoDrawUnGroup( SdrObjGroup* pObj, const SwDoc* pDoc ) - : SwUndo( SwUndoId::DRAWUNGROUP, pDoc ), m_bDeleteFormat( false ) +SwUndoDrawUnGroup::SwUndoDrawUnGroup( SdrObjGroup* pObj, const SwDoc& rDoc ) + : SwUndo( SwUndoId::DRAWUNGROUP, &rDoc ), m_bDeleteFormat( false ) { m_nSize = static_cast<sal_uInt16>(pObj->GetSubList()->GetObjCount()) + 1; m_pObjArray.reset( new SwUndoGroupObjImpl[ m_nSize ] ); @@ -424,8 +424,8 @@ void SwUndoDrawUnGroup::AddObj( sal_uInt16 nPos, SwDrawFrameFormat* pFormat ) rSave.pObj = nullptr; } -SwUndoDrawUnGroupConnectToLayout::SwUndoDrawUnGroupConnectToLayout(const SwDoc* pDoc) - : SwUndo( SwUndoId::DRAWUNGROUP, pDoc ) +SwUndoDrawUnGroupConnectToLayout::SwUndoDrawUnGroupConnectToLayout(const SwDoc& rDoc) + : SwUndo( SwUndoId::DRAWUNGROUP, &rDoc ) { } @@ -471,8 +471,8 @@ void SwUndoDrawUnGroupConnectToLayout::AddFormatAndObj( SwDrawFrameFormat* pDraw m_aDrawFormatsAndObjs.emplace_back( pDrawFrameFormat, pDrawObject ); } -SwUndoDrawDelete::SwUndoDrawDelete( sal_uInt16 nCnt, const SwDoc* pDoc ) - : SwUndo( SwUndoId::DRAWDELETE, pDoc ), m_bDeleteFormat( true ) +SwUndoDrawDelete::SwUndoDrawDelete( sal_uInt16 nCnt, const SwDoc& rDoc ) + : SwUndo( SwUndoId::DRAWDELETE, &rDoc ), m_bDeleteFormat( true ) { m_pObjArray.reset( new SwUndoGroupObjImpl[ nCnt ] ); m_pMarkList.reset( new SdrMarkList() ); diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx index b2c1454b1995..7c11f4596690 100644 --- a/sw/source/core/undo/unovwr.cxx +++ b/sw/source/core/undo/unovwr.cxx @@ -38,9 +38,9 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::uno; -SwUndoOverwrite::SwUndoOverwrite( SwDoc* pDoc, SwPosition& rPos, +SwUndoOverwrite::SwUndoOverwrite( SwDoc& rDoc, SwPosition& rPos, sal_Unicode cIns ) - : SwUndo(SwUndoId::OVERWRITE, pDoc), + : SwUndo(SwUndoId::OVERWRITE, &rDoc), m_bGroup( false ) { SwTextNode *const pTextNd = rPos.nNode.GetNode().GetTextNode(); @@ -50,7 +50,7 @@ SwUndoOverwrite::SwUndoOverwrite( SwDoc* pDoc, SwPosition& rPos, m_nStartNode = rPos.nNode.GetIndex(); m_nStartContent = rPos.nContent.GetIndex(); - if( !pDoc->getIDocumentRedlineAccess().IsIgnoreRedline() && !pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() ) + if( !rDoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() ) { SwPaM aPam( rPos.nNode, rPos.nContent.GetIndex(), rPos.nNode, rPos.nContent.GetIndex()+1 ); @@ -61,7 +61,7 @@ SwUndoOverwrite::SwUndoOverwrite( SwDoc* pDoc, SwPosition& rPos, } if (m_nStartContent < nTextNdLen) { - pDoc->getIDocumentRedlineAccess().DeleteRedline(aPam, false, RedlineType::Any); + rDoc.getIDocumentRedlineAccess().DeleteRedline(aPam, false, RedlineType::Any); } } @@ -99,7 +99,7 @@ SwUndoOverwrite::~SwUndoOverwrite() { } -bool SwUndoOverwrite::CanGrouping( SwDoc* pDoc, SwPosition& rPos, +bool SwUndoOverwrite::CanGrouping( SwDoc& rDoc, SwPosition& rPos, sal_Unicode cIns ) { // What is with only inserted characters? @@ -140,7 +140,7 @@ bool SwUndoOverwrite::CanGrouping( SwDoc* pDoc, SwPosition& rPos, if( !bOk ) return false; - pDoc->getIDocumentRedlineAccess().DeleteRedline( aPam, false, RedlineType::Any ); + rDoc.getIDocumentRedlineAccess().DeleteRedline( aPam, false, RedlineType::Any ); } // both 'overwrites' can be combined so 'move' the corresponding character @@ -177,22 +177,22 @@ bool SwUndoOverwrite::CanGrouping( SwDoc* pDoc, SwPosition& rPos, void SwUndoOverwrite::UndoImpl(::sw::UndoRedoContext & rContext) { - SwDoc *const pDoc = & rContext.GetDoc(); - SwPaM *const pCurrentPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); + SwDoc& rDoc = rContext.GetDoc(); + SwPaM& rCurrentPam(rContext.GetCursorSupplier().CreateNewShellCursor()); - pCurrentPam->DeleteMark(); - pCurrentPam->GetPoint()->nNode = m_nStartNode; - SwTextNode* pTextNd = pCurrentPam->GetNode().GetTextNode(); + rCurrentPam.DeleteMark(); + rCurrentPam.GetPoint()->nNode = m_nStartNode; + SwTextNode* pTextNd = rCurrentPam.GetNode().GetTextNode(); assert(pTextNd); - SwIndex& rIdx = pCurrentPam->GetPoint()->nContent; + SwIndex& rIdx = rCurrentPam.GetPoint()->nContent; rIdx.Assign( pTextNd, m_nStartContent ); - SwAutoCorrExceptWord* pACEWord = pDoc->GetAutoCorrExceptWord(); + SwAutoCorrExceptWord* pACEWord = rDoc.GetAutoCorrExceptWord(); if( pACEWord ) { if( 1 == m_aInsStr.getLength() && 1 == m_aDelStr.getLength() ) - pACEWord->CheckChar( *pCurrentPam->GetPoint(), m_aDelStr[0] ); - pDoc->SetAutoCorrExceptWord( nullptr ); + pACEWord->CheckChar( *rCurrentPam.GetPoint(), m_aDelStr[0] ); + rDoc.SetAutoCorrExceptWord( nullptr ); } // If there was not only an overwrite but also an insert, delete the surplus @@ -228,53 +228,53 @@ void SwUndoOverwrite::UndoImpl(::sw::UndoRedoContext & rContext) { if( pTextNd->GetpSwpHints() ) pTextNd->ClearSwpHintsArr( false ); - m_pHistory->TmpRollback( pDoc, 0, false ); + m_pHistory->TmpRollback( &rDoc, 0, false ); } - if( pCurrentPam->GetMark()->nContent.GetIndex() != m_nStartContent ) + if( rCurrentPam.GetMark()->nContent.GetIndex() != m_nStartContent ) { - pCurrentPam->SetMark(); - pCurrentPam->GetMark()->nContent = m_nStartContent; + rCurrentPam.SetMark(); + rCurrentPam.GetMark()->nContent = m_nStartContent; } if( m_pRedlSaveData ) - SetSaveData( *pDoc, *m_pRedlSaveData ); + SetSaveData( rDoc, *m_pRedlSaveData ); } void SwUndoOverwrite::RepeatImpl(::sw::RepeatContext & rContext) { - SwPaM *const pCurrentPam = & rContext.GetRepeatPaM(); - if( m_aInsStr.isEmpty() || pCurrentPam->HasMark() ) + SwPaM& rCurrentPam = rContext.GetRepeatPaM(); + if( m_aInsStr.isEmpty() || rCurrentPam.HasMark() ) return; SwDoc & rDoc = rContext.GetDoc(); { ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); - rDoc.getIDocumentContentOperations().Overwrite(*pCurrentPam, OUString(m_aInsStr[0])); + rDoc.getIDocumentContentOperations().Overwrite(rCurrentPam, OUString(m_aInsStr[0])); } for( sal_Int32 n = 1; n < m_aInsStr.getLength(); ++n ) - rDoc.getIDocumentContentOperations().Overwrite( *pCurrentPam, OUString(m_aInsStr[n]) ); + rDoc.getIDocumentContentOperations().Overwrite(rCurrentPam, OUString(m_aInsStr[n])); } void SwUndoOverwrite::RedoImpl(::sw::UndoRedoContext & rContext) { - SwDoc *const pDoc = & rContext.GetDoc(); - SwPaM *const pCurrentPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); + SwDoc& rDoc = rContext.GetDoc(); + SwPaM& rCurrentPam(rContext.GetCursorSupplier().CreateNewShellCursor()); - pCurrentPam->DeleteMark(); - pCurrentPam->GetPoint()->nNode = m_nStartNode; - SwTextNode* pTextNd = pCurrentPam->GetNode().GetTextNode(); + rCurrentPam.DeleteMark(); + rCurrentPam.GetPoint()->nNode = m_nStartNode; + SwTextNode* pTextNd = rCurrentPam.GetNode().GetTextNode(); assert(pTextNd); - SwIndex& rIdx = pCurrentPam->GetPoint()->nContent; + SwIndex& rIdx = rCurrentPam.GetPoint()->nContent; if( m_pRedlSaveData ) { rIdx.Assign( pTextNd, m_nStartContent ); - pCurrentPam->SetMark(); - pCurrentPam->GetMark()->nContent += m_aDelStr.getLength(); - pDoc->getIDocumentRedlineAccess().DeleteRedline( *pCurrentPam, false, RedlineType::Any ); - pCurrentPam->DeleteMark(); + rCurrentPam.SetMark(); + rCurrentPam.GetMark()->nContent += m_aDelStr.getLength(); + rDoc.getIDocumentRedlineAccess().DeleteRedline( rCurrentPam, false, RedlineType::Any ); + rCurrentPam.DeleteMark(); } rIdx.Assign( pTextNd, !m_aDelStr.isEmpty() ? m_nStartContent+1 : m_nStartContent ); @@ -301,10 +301,10 @@ void SwUndoOverwrite::RedoImpl(::sw::UndoRedoContext & rContext) // get back old start position from UndoNodes array if( m_pHistory ) m_pHistory->SetTmpEnd( m_pHistory->Count() ); - if( pCurrentPam->GetMark()->nContent.GetIndex() != m_nStartContent ) + if( rCurrentPam.GetMark()->nContent.GetIndex() != m_nStartContent ) { - pCurrentPam->SetMark(); - pCurrentPam->GetMark()->nContent = m_nStartContent; + rCurrentPam.SetMark(); + rCurrentPam.GetMark()->nContent = m_nStartContent; } } diff --git a/sw/source/core/undo/unspnd.cxx b/sw/source/core/undo/unspnd.cxx index 089883803e4d..771c2650de86 100644 --- a/sw/source/core/undo/unspnd.cxx +++ b/sw/source/core/undo/unspnd.cxx @@ -34,9 +34,9 @@ // SPLITNODE -SwUndoSplitNode::SwUndoSplitNode( SwDoc* pDoc, const SwPosition& rPos, +SwUndoSplitNode::SwUndoSplitNode( SwDoc& rDoc, const SwPosition& rPos, bool bChkTable ) - : SwUndo( SwUndoId::SPLITNODE, pDoc ), m_nNode( rPos.nNode.GetIndex() ), + : SwUndo( SwUndoId::SPLITNODE, &rDoc ), m_nNode( rPos.nNode.GetIndex() ), m_nContent( rPos.nContent.GetIndex() ), m_bTableFlag( false ), m_bCheckTableStart( bChkTable ) { @@ -53,10 +53,10 @@ SwUndoSplitNode::SwUndoSplitNode( SwDoc* pDoc, const SwPosition& rPos, } } // consider Redline - if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() ) + if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) { - m_pRedlineData.reset( new SwRedlineData( RedlineType::Insert, pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() ) ); - SetRedlineFlags( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() ); + m_pRedlineData.reset( new SwRedlineData( RedlineType::Insert, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() ) ); + SetRedlineFlags( rDoc.getIDocumentRedlineAccess().GetRedlineFlags() ); } m_nParRsid = pTextNd->GetParRsid(); diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 9654a9561ff4..7a70f07eb0ab 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -2321,8 +2321,8 @@ UndoTableCpyTable_Entry::UndoTableCpyTable_Entry( const SwTableBox& rBox ) { } -SwUndoTableCpyTable::SwUndoTableCpyTable(const SwDoc* pDoc) - : SwUndo( SwUndoId::TBLCPYTBL, pDoc ) +SwUndoTableCpyTable::SwUndoTableCpyTable(const SwDoc& rDoc) + : SwUndo( SwUndoId::TBLCPYTBL, &rDoc ) { } @@ -2729,8 +2729,8 @@ bool SwUndoTableCpyTable::IsEmpty() const return !m_pInsRowUndo && m_vArr.empty(); } -SwUndoCpyTable::SwUndoCpyTable(const SwDoc* pDoc) - : SwUndo( SwUndoId::CPYTBL, pDoc ), m_nTableNode( 0 ) +SwUndoCpyTable::SwUndoCpyTable(const SwDoc& rDoc) + : SwUndo( SwUndoId::CPYTBL, &rDoc ), m_nTableNode( 0 ) { } @@ -3065,8 +3065,8 @@ void CheckTable( const SwTable& rTable ) } #endif -SwUndoTableStyleMake::SwUndoTableStyleMake(const OUString& rName, const SwDoc* pDoc) - : SwUndo(SwUndoId::TBLSTYLE_CREATE, pDoc), +SwUndoTableStyleMake::SwUndoTableStyleMake(const OUString& rName, const SwDoc& rDoc) + : SwUndo(SwUndoId::TBLSTYLE_CREATE, &rDoc), m_sName(rName) { } @@ -3098,8 +3098,8 @@ SwRewriter SwUndoTableStyleMake::GetRewriter() const return aResult; } -SwUndoTableStyleDelete::SwUndoTableStyleDelete(std::unique_ptr<SwTableAutoFormat> pAutoFormat, const std::vector<SwTable*>& rAffectedTables, const SwDoc* pDoc) - : SwUndo(SwUndoId::TBLSTYLE_DELETE, pDoc), +SwUndoTableStyleDelete::SwUndoTableStyleDelete(std::unique_ptr<SwTableAutoFormat> pAutoFormat, const std::vector<SwTable*>& rAffectedTables, const SwDoc& rDoc) + : SwUndo(SwUndoId::TBLSTYLE_DELETE, &rDoc), m_pAutoFormat(std::move(pAutoFormat)), m_rAffectedTables(rAffectedTables) { } @@ -3128,8 +3128,8 @@ SwRewriter SwUndoTableStyleDelete::GetRewriter() const return aResult; } -SwUndoTableStyleUpdate::SwUndoTableStyleUpdate(const SwTableAutoFormat& rNewFormat, const SwTableAutoFormat& rOldFormat, const SwDoc* pDoc) - : SwUndo(SwUndoId::TBLSTYLE_UPDATE, pDoc) +SwUndoTableStyleUpdate::SwUndoTableStyleUpdate(const SwTableAutoFormat& rNewFormat, const SwTableAutoFormat& rOldFormat, const SwDoc& rDoc) + : SwUndo(SwUndoId::TBLSTYLE_UPDATE, &rDoc) , m_pOldFormat(new SwTableAutoFormat(rOldFormat)) , m_pNewFormat(new SwTableAutoFormat(rNewFormat)) { } |