sw/inc/pagedesc.hxx | 6 ++--- sw/inc/undobj.hxx | 4 +-- sw/source/core/doc/docdesc.cxx | 8 +++--- sw/source/core/doc/doclay.cxx | 4 +-- sw/source/core/edit/edfcol.cxx | 2 - sw/source/core/inc/SwUndoPageDesc.hxx | 12 +++++----- sw/source/core/inc/UndoInsert.hxx | 6 ++--- sw/source/core/layout/pagedesc.cxx | 18 +++++++-------- sw/source/core/undo/SwUndoField.cxx | 2 - sw/source/core/undo/SwUndoFmt.cxx | 12 +++++----- sw/source/core/undo/SwUndoPageDesc.cxx | 38 ++++++++++++++------------------ sw/source/core/undo/SwUndoTOXChange.cxx | 2 - sw/source/core/undo/UndoThemeChange.cxx | 2 - sw/source/core/undo/unattr.cxx | 26 ++++++++++----------- sw/source/core/undo/unbkmk.cxx | 12 +++++----- sw/source/core/undo/undel.cxx | 2 - sw/source/core/undo/undobj.cxx | 8 +++--- sw/source/core/undo/undobj1.cxx | 4 +-- sw/source/core/undo/undoflystrattr.cxx | 4 +-- sw/source/core/undo/undraw.cxx | 10 ++++---- sw/source/core/undo/unfmco.cxx | 2 - sw/source/core/undo/unins.cxx | 31 +++++++++++++------------- sw/source/core/undo/unmove.cxx | 4 +-- sw/source/core/undo/unnum.cxx | 18 +++++++-------- sw/source/core/undo/unoutl.cxx | 4 +-- sw/source/core/undo/unovwr.cxx | 4 +-- sw/source/core/undo/unredln.cxx | 6 ++--- sw/source/core/undo/unsect.cxx | 8 +++--- sw/source/core/undo/unsort.cxx | 4 +-- sw/source/core/undo/unspnd.cxx | 2 - sw/source/core/undo/untbl.cxx | 32 +++++++++++++------------- sw/source/core/undo/untblk.cxx | 2 - 32 files changed, 148 insertions(+), 151 deletions(-)
New commits: commit 17c692088d0629c870d21652df1b2603d747ec46 Author: Xisco Fauli <[email protected]> AuthorDate: Mon Jun 2 12:54:19 2025 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Jun 2 18:30:30 2025 +0200 SwUndo: pass SwDoc by ref Change-Id: I928fe502ddcae2e1149862c9972cf30536bd0b3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186131 Reviewed-by: Xisco Fauli <[email protected]> Tested-by: Jenkins diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx index ea7a13bd164c..c213b03bf34c 100644 --- a/sw/inc/pagedesc.hxx +++ b/sw/inc/pagedesc.hxx @@ -180,7 +180,7 @@ class SW_DLLPUBLIC SwPageDesc final SAL_DLLPRIVATE void ResetAllAttr(); - SAL_DLLPRIVATE SwPageDesc(const UIName&, SwFrameFormat*, SwDoc *pDc ); + SAL_DLLPRIVATE SwPageDesc(const UIName&, SwFrameFormat*, SwDoc &rDc ); struct change_name { @@ -378,13 +378,13 @@ class SwPageDescExt public: SwPageDesc m_PageDesc; private: - SwDoc * m_pDoc; + SwDoc& m_rDoc; UIName m_sFollow; void SetPageDesc(const SwPageDesc & rPageDesc); public: - SwPageDescExt(const SwPageDesc & rPageDesc, SwDoc * pDoc); + SwPageDescExt(const SwPageDesc & rPageDesc, SwDoc& rDoc); SwPageDescExt(const SwPageDescExt & rSrc); ~SwPageDescExt(); diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx index 09579b32fab5..976eb1e1facb 100644 --- a/sw/inc/undobj.hxx +++ b/sw/inc/undobj.hxx @@ -85,7 +85,7 @@ public: // should not be public, but ran into trouble in untbl.cxx private: /// Try to obtain the view shell ID of the current view. - static ViewShellId CreateViewShellId(const SwDoc* pDoc); + static ViewShellId CreateViewShellId(const SwDoc& rDoc); // SfxUndoAction virtual void Undo() override; virtual void Redo() override; @@ -95,7 +95,7 @@ private: virtual bool CanRepeat(SfxRepeatTarget &) const override; public: - SwUndo(SwUndoId const nId, const SwDoc* pDoc); + SwUndo(SwUndoId const nId, const SwDoc& rDoc); virtual ~SwUndo() override; SwUndoId GetId() const { return m_nId; } diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index ad41d8faa6fa..0aaa2d2a246d 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -428,7 +428,7 @@ void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged ) if (bStashFirstLeftFoot && rFirstLeftFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, true, true)) rDesc.StashFrameFormat(rChged.GetFirstLeft(), false, true, true); - GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoPageDesc>(rDesc, rChged, this)); + GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoPageDesc>(rDesc, rChged, *this)); } else { @@ -767,7 +767,7 @@ void SwDoc::DelPageDesc( size_t i, bool bBroadcast ) if (GetIDocumentUndoRedo().DoesUndo()) { GetIDocumentUndoRedo().AppendUndo( - std::make_unique<SwUndoPageDescDelete>(rDel, this)); + std::make_unique<SwUndoPageDescDelete>(rDel, *this)); } PreDelPageDesc(&rDel); // #i7983# @@ -793,7 +793,7 @@ SwPageDesc* SwDoc::MakePageDesc(const UIName &rName, const SwPageDesc *pCpy, } else { - pNew = new SwPageDesc( rName, GetDfltFrameFormat(), this ); + pNew = new SwPageDesc( rName, GetDfltFrameFormat(), *this ); // Set the default page format. lcl_DefaultPageFormat( USHRT_MAX, pNew->GetMaster(), pNew->GetLeft(), pNew->GetFirstMaster(), pNew->GetFirstLeft() ); @@ -812,7 +812,7 @@ SwPageDesc* SwDoc::MakePageDesc(const UIName &rName, const SwPageDesc *pCpy, if (GetIDocumentUndoRedo().DoesUndo()) { - GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoPageDescCreate>(pNew, this)); + GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoPageDescCreate>(pNew, *this)); } getIDocumentState().SetModified(); diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 258eb459d745..b6ceedb74674 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -974,7 +974,7 @@ SwDoc::InsertLabel( { pUndo.reset(new SwUndoInsertLabel( eType, rText, rSeparator, rNumberingSeparator, - bBefore, nId, rCharacterStyle, bCpyBrd, this )); + bBefore, nId, rCharacterStyle, bCpyBrd, *this )); } SwFlyFrameFormat *const pNewFormat = lcl_InsertLabel(*this, mpTextFormatCollTable.get(), pUndo.get(), @@ -1257,7 +1257,7 @@ SwFlyFrameFormat* SwDoc::InsertDrawLabel( GetIDocumentUndoRedo().ClearRedo(); pUndo.reset(new SwUndoInsertLabel( SwLabelType::Draw, rText, rSeparator, rNumberSeparator, false, - nId, rCharacterStyle, false, this )); + nId, rCharacterStyle, false, *this )); } SwFlyFrameFormat *const pNewFormat = lcl_InsertDrawLabel( diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index c3cb3b0a6331..8d643b160d5c 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -1676,7 +1676,7 @@ SwUndoParagraphSigning::SwUndoParagraphSigning(SwDoc& rDoc, uno::Reference<text::XTextField> xField, uno::Reference<text::XTextContent> xParent, const bool bRemove) - : SwUndo(SwUndoId::PARA_SIGN_ADD, &rDoc), + : SwUndo(SwUndoId::PARA_SIGN_ADD, rDoc), m_rDoc(rDoc), m_xField(std::move(xField)), m_xParent(std::move(xParent)), diff --git a/sw/source/core/inc/SwUndoPageDesc.hxx b/sw/source/core/inc/SwUndoPageDesc.hxx index ab90a3a65b5f..5d63a7d12d5c 100644 --- a/sw/source/core/inc/SwUndoPageDesc.hxx +++ b/sw/source/core/inc/SwUndoPageDesc.hxx @@ -28,7 +28,7 @@ class SwDoc; class SwUndoPageDesc final : public SwUndo { SwPageDescExt m_aOld, m_aNew; - SwDoc * m_pDoc; + SwDoc& m_rDoc; bool m_bExchange; // To avoid duplication of (header/footer)content nodes for simple page desc changes @@ -38,7 +38,7 @@ class SwUndoPageDesc final : public SwUndo void ExitHeaderFooterEdit(); public: SwUndoPageDesc(const SwPageDesc & aOld, const SwPageDesc & aNew, - SwDoc * pDoc); + SwDoc& rDoc); virtual ~SwUndoPageDesc() override; virtual void UndoImpl( ::sw::UndoRedoContext & ) override; @@ -51,12 +51,12 @@ class SwUndoPageDescCreate final : public SwUndo { const SwPageDesc * m_pDesc; SwPageDescExt m_aNew; - SwDoc * m_pDoc; + SwDoc& m_rDoc; void DoImpl(); public: - SwUndoPageDescCreate(const SwPageDesc * pNew, SwDoc * pDoc); + SwUndoPageDescCreate(const SwPageDesc * pNew, SwDoc& rDoc); virtual ~SwUndoPageDescCreate() override; virtual void UndoImpl( ::sw::UndoRedoContext & ) override; @@ -69,12 +69,12 @@ public: class SwUndoPageDescDelete final : public SwUndo { SwPageDescExt m_aOld; - SwDoc * m_pDoc; + SwDoc& m_rDoc; void DoImpl(); public: - SwUndoPageDescDelete(const SwPageDesc & aOld, SwDoc * pDoc); + SwUndoPageDescDelete(const SwPageDesc & aOld, SwDoc& rDoc); virtual ~SwUndoPageDescDelete() override; virtual void UndoImpl( ::sw::UndoRedoContext & ) override; diff --git a/sw/source/core/inc/UndoInsert.hxx b/sw/source/core/inc/UndoInsert.hxx index 4c7b5a6e4e1f..98a35aa1e3cb 100644 --- a/sw/source/core/inc/UndoInsert.hxx +++ b/sw/source/core/inc/UndoInsert.hxx @@ -58,9 +58,9 @@ class SwUndoInsert final : public SwUndo, private SwUndoSaveContent bool CanGrouping( sal_Unicode cIns ); bool CanGrouping( const SwPosition& rPos ); - SwDoc * m_pDoc; + SwDoc& m_rDoc; - void Init(const SwNode & rNode); + void Init(); std::optional<OUString> GetTextFromDoc() const; public: @@ -193,7 +193,7 @@ public: const bool bBefore, const sal_uInt16 nId, UIName aCharacterStyle, const bool bCpyBrd, - const SwDoc* pDoc ); + const SwDoc& rDoc ); virtual ~SwUndoInsertLabel() override; virtual void UndoImpl( ::sw::UndoRedoContext & ) override; diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index 21ec3c7f2784..ad2f8200c337 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -41,13 +41,13 @@ #include <poolfmt.hxx> #include <calbck.hxx> -SwPageDesc::SwPageDesc(const UIName& rName, SwFrameFormat *pFormat, SwDoc *const pDoc) +SwPageDesc::SwPageDesc(const UIName& rName, SwFrameFormat *pFormat, SwDoc& rDoc) : sw::BroadcastingModify() , m_StyleName( rName ) - , m_Master( pDoc->GetAttrPool(), rName, pFormat ) - , m_Left( pDoc->GetAttrPool(), rName, pFormat ) - , m_FirstMaster( pDoc->GetAttrPool(), rName, pFormat ) - , m_FirstLeft( pDoc->GetAttrPool(), rName, pFormat ) + , m_Master( rDoc.GetAttrPool(), rName, pFormat ) + , m_Left( rDoc.GetAttrPool(), rName, pFormat ) + , m_FirstMaster( rDoc.GetAttrPool(), rName, pFormat ) + , m_FirstLeft( rDoc.GetAttrPool(), rName, pFormat ) , m_aStashedHeader() , m_aStashedFooter() , m_aDepends(*this) @@ -693,16 +693,16 @@ bool SwPageFootnoteInfo::operator==( const SwPageFootnoteInfo& rCmp ) const && m_nBottomDist== rCmp.GetBottomDist(); } -SwPageDescExt::SwPageDescExt(const SwPageDesc & rPageDesc, SwDoc *const pDoc) +SwPageDescExt::SwPageDescExt(const SwPageDesc & rPageDesc, SwDoc& rDoc) : m_PageDesc(rPageDesc) - , m_pDoc(pDoc) + , m_rDoc(rDoc) { SetPageDesc(rPageDesc); } SwPageDescExt::SwPageDescExt(const SwPageDescExt & rSrc) : m_PageDesc(rSrc.m_PageDesc) - , m_pDoc(rSrc.m_pDoc) + , m_rDoc(rSrc.m_rDoc) { SetPageDesc(rSrc.m_PageDesc); } @@ -741,7 +741,7 @@ SwPageDescExt::operator SwPageDesc() const { SwPageDesc aResult(m_PageDesc); - SwPageDesc * pPageDesc = m_pDoc->FindPageDesc(m_sFollow); + SwPageDesc * pPageDesc = m_rDoc.FindPageDesc(m_sFollow); if ( nullptr != pPageDesc ) aResult.SetFollow(pPageDesc); diff --git a/sw/source/core/undo/SwUndoField.cxx b/sw/source/core/undo/SwUndoField.cxx index 57d615e04f8a..9eee2723b723 100644 --- a/sw/source/core/undo/SwUndoField.cxx +++ b/sw/source/core/undo/SwUndoField.cxx @@ -34,7 +34,7 @@ using namespace ::com::sun::star::uno; SwUndoField::SwUndoField(const SwPosition & rPos ) - : SwUndo(SwUndoId::FIELD, &rPos.GetDoc()) + : SwUndo(SwUndoId::FIELD, rPos.GetDoc()) { m_nNodeIndex = rPos.GetNodeIndex(); m_nOffset = rPos.GetContentIndex(); diff --git a/sw/source/core/undo/SwUndoFmt.cxx b/sw/source/core/undo/SwUndoFmt.cxx index 042b22f5a61d..138786338558 100644 --- a/sw/source/core/undo/SwUndoFmt.cxx +++ b/sw/source/core/undo/SwUndoFmt.cxx @@ -31,7 +31,7 @@ SwUndoFormatCreate::SwUndoFormatCreate (SwUndoId nUndoId, SwFormat * _pNew, SwFormat const * _pDerivedFrom, SwDoc& rDoc) - : SwUndo(nUndoId, &rDoc), m_pNew(_pNew), + : SwUndo(nUndoId, rDoc), m_pNew(_pNew), m_rDoc(rDoc), m_nId(0), m_bAuto(false) { if (_pDerivedFrom) @@ -96,7 +96,7 @@ SwRewriter SwUndoFormatCreate::GetRewriter() const SwUndoFormatDelete::SwUndoFormatDelete (SwUndoId nUndoId, SwFormat const * _pOld, SwDoc& rDoc) - : SwUndo(nUndoId, &rDoc), + : SwUndo(nUndoId, rDoc), m_rDoc(rDoc), m_sOldName(_pOld->GetName()), m_aOldSet(_pOld->GetAttrSet()) { @@ -148,7 +148,7 @@ SwUndoRenameFormat::SwUndoRenameFormat(SwUndoId nUndoId, UIName _sOldName, UIName _sNewName, SwDoc& rDoc) - : SwUndo(nUndoId, &rDoc), m_sOldName(std::move(_sOldName)), + : SwUndo(nUndoId, rDoc), m_sOldName(std::move(_sOldName)), m_sNewName(std::move(_sNewName)), m_rDoc(rDoc) { } @@ -374,7 +374,7 @@ SwFormat * SwUndoRenameFrameFormat::Find(const UIName & rName) const SwUndoNumruleCreate::SwUndoNumruleCreate(const SwNumRule * _pNew, SwDoc& rDoc) - : SwUndo(SwUndoId::NUMRULE_CREATE, &rDoc), m_pNew(_pNew), m_aNew(*_pNew), m_rDoc(rDoc), + : SwUndo(SwUndoId::NUMRULE_CREATE, rDoc), m_pNew(_pNew), m_aNew(*_pNew), m_rDoc(rDoc), m_bInitialized(false) { } @@ -412,7 +412,7 @@ SwRewriter SwUndoNumruleCreate::GetRewriter() const SwUndoNumruleDelete::SwUndoNumruleDelete(const SwNumRule & rRule, SwDoc& rDoc) - : SwUndo(SwUndoId::NUMRULE_DELETE, &rDoc), m_aOld(rRule), m_rDoc(rDoc) + : SwUndo(SwUndoId::NUMRULE_DELETE, rDoc), m_aOld(rRule), m_rDoc(rDoc) { } @@ -438,7 +438,7 @@ SwRewriter SwUndoNumruleDelete::GetRewriter() const SwUndoNumruleRename::SwUndoNumruleRename(UIName _aOldName, UIName _aNewName, SwDoc& rDoc) - : SwUndo(SwUndoId::NUMRULE_RENAME, &rDoc), m_aOldName(std::move(_aOldName)), m_aNewName(std::move(_aNewName)), + : SwUndo(SwUndoId::NUMRULE_RENAME, rDoc), m_aOldName(std::move(_aOldName)), m_aNewName(std::move(_aNewName)), m_rDoc(rDoc) { } diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx b/sw/source/core/undo/SwUndoPageDesc.cxx index 51cac584daf4..f61db8b38336 100644 --- a/sw/source/core/undo/SwUndoPageDesc.cxx +++ b/sw/source/core/undo/SwUndoPageDesc.cxx @@ -32,15 +32,13 @@ SwUndoPageDesc::SwUndoPageDesc(const SwPageDesc & _aOld, const SwPageDesc & _aNew, - SwDoc * _pDoc) + SwDoc& rDoc) : SwUndo( _aOld.GetName() != _aNew.GetName() ? SwUndoId::RENAME_PAGEDESC : SwUndoId::CHANGE_PAGEDESC, - _pDoc ), - m_aOld(_aOld, _pDoc), m_aNew(_aNew, _pDoc), m_pDoc(_pDoc), m_bExchange( false ) + rDoc ), + m_aOld(_aOld, rDoc), m_aNew(_aNew, rDoc), m_rDoc(rDoc), m_bExchange( false ) { - OSL_ENSURE(nullptr != m_pDoc, "no document?"); - /* The page description changes. If there are no header/footer content changes like header on/off or change from shared content @@ -219,7 +217,7 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes void SwUndoPageDesc::ExitHeaderFooterEdit() { - SwEditShell* pESh = m_pDoc->GetEditShell(); + SwEditShell* pESh = m_rDoc.GetEditShell(); if (!pESh) return; if (pESh->IsHeaderFooterEdit()) @@ -231,7 +229,7 @@ void SwUndoPageDesc::UndoImpl(::sw::UndoRedoContext &) // Move (header/footer)content node responsibility from new page descriptor to old one again. if( m_bExchange ) ExchangeContentNodes( m_aNew.m_PageDesc, m_aOld.m_PageDesc ); - m_pDoc->ChgPageDesc(m_aOld.GetName(), SwPageDesc(m_aOld)); + m_rDoc.ChgPageDesc(m_aOld.GetName(), SwPageDesc(m_aOld)); ExitHeaderFooterEdit(); } @@ -240,7 +238,7 @@ void SwUndoPageDesc::RedoImpl(::sw::UndoRedoContext &) // Move (header/footer)content node responsibility from old page descriptor to new one again. if( m_bExchange ) ExchangeContentNodes( m_aOld.m_PageDesc, m_aNew.m_PageDesc ); - m_pDoc->ChgPageDesc(m_aNew.GetName(), SwPageDesc(m_aNew)); + m_rDoc.ChgPageDesc(m_aNew.GetName(), SwPageDesc(m_aNew)); ExitHeaderFooterEdit(); } @@ -256,11 +254,10 @@ SwRewriter SwUndoPageDesc::GetRewriter() const } SwUndoPageDescCreate::SwUndoPageDescCreate(const SwPageDesc * pNew, - SwDoc * _pDoc) - : SwUndo(SwUndoId::CREATE_PAGEDESC, _pDoc), m_pDesc(pNew), m_aNew(*pNew, _pDoc), - m_pDoc(_pDoc) + SwDoc& rDoc) + : SwUndo(SwUndoId::CREATE_PAGEDESC, rDoc), m_pDesc(pNew), m_aNew(*pNew, rDoc), + m_rDoc(rDoc) { - OSL_ENSURE(nullptr != m_pDoc, "no document?"); } SwUndoPageDescCreate::~SwUndoPageDescCreate() @@ -275,13 +272,13 @@ void SwUndoPageDescCreate::UndoImpl(::sw::UndoRedoContext &) m_pDesc = nullptr; } - m_pDoc->DelPageDesc(m_aNew.GetName(), true); + m_rDoc.DelPageDesc(m_aNew.GetName(), true); } void SwUndoPageDescCreate::DoImpl() { SwPageDesc aPageDesc(m_aNew); - m_pDoc->MakePageDesc(m_aNew.GetName(), &aPageDesc, false); + m_rDoc.MakePageDesc(m_aNew.GetName(), &aPageDesc, false); } void SwUndoPageDescCreate::RedoImpl(::sw::UndoRedoContext &) @@ -291,7 +288,7 @@ void SwUndoPageDescCreate::RedoImpl(::sw::UndoRedoContext &) void SwUndoPageDescCreate::RepeatImpl(::sw::RepeatContext &) { - ::sw::UndoGuard const undoGuard(m_pDoc->GetIDocumentUndoRedo()); + ::sw::UndoGuard const undoGuard(m_rDoc.GetIDocumentUndoRedo()); DoImpl(); } @@ -308,10 +305,9 @@ SwRewriter SwUndoPageDescCreate::GetRewriter() const } SwUndoPageDescDelete::SwUndoPageDescDelete(const SwPageDesc & _aOld, - SwDoc * _pDoc) - : SwUndo(SwUndoId::DELETE_PAGEDESC, _pDoc), m_aOld(_aOld, _pDoc), m_pDoc(_pDoc) + SwDoc& rDoc) + : SwUndo(SwUndoId::DELETE_PAGEDESC, rDoc), m_aOld(_aOld, rDoc), m_rDoc(rDoc) { - OSL_ENSURE(nullptr != m_pDoc, "no document?"); } SwUndoPageDescDelete::~SwUndoPageDescDelete() @@ -321,12 +317,12 @@ SwUndoPageDescDelete::~SwUndoPageDescDelete() void SwUndoPageDescDelete::UndoImpl(::sw::UndoRedoContext &) { SwPageDesc aPageDesc(m_aOld); - m_pDoc->MakePageDesc(m_aOld.GetName(), &aPageDesc, false); + m_rDoc.MakePageDesc(m_aOld.GetName(), &aPageDesc, false); } void SwUndoPageDescDelete::DoImpl() { - m_pDoc->DelPageDesc(m_aOld.GetName(), true); + m_rDoc.DelPageDesc(m_aOld.GetName(), true); } void SwUndoPageDescDelete::RedoImpl(::sw::UndoRedoContext &) @@ -336,7 +332,7 @@ void SwUndoPageDescDelete::RedoImpl(::sw::UndoRedoContext &) void SwUndoPageDescDelete::RepeatImpl(::sw::RepeatContext &) { - ::sw::UndoGuard const undoGuard(m_pDoc->GetIDocumentUndoRedo()); + ::sw::UndoGuard const undoGuard(m_rDoc.GetIDocumentUndoRedo()); DoImpl(); } diff --git a/sw/source/core/undo/SwUndoTOXChange.cxx b/sw/source/core/undo/SwUndoTOXChange.cxx index 5223e9993eca..c9aeff4b92c9 100644 --- a/sw/source/core/undo/SwUndoTOXChange.cxx +++ b/sw/source/core/undo/SwUndoTOXChange.cxx @@ -36,7 +36,7 @@ namespace SwUndoTOXChange::SwUndoTOXChange(const SwDoc& rDoc, SwTOXBaseSection const& rTOX, SwTOXBase const& rNew) - : SwUndo(SwUndoId::TOXCHANGE, &rDoc) + : SwUndo(SwUndoId::TOXCHANGE, rDoc) , m_Old(rTOX) , m_New(rNew) , m_nNodeIndex(GetSectionNodeIndex(rTOX)) diff --git a/sw/source/core/undo/UndoThemeChange.cxx b/sw/source/core/undo/UndoThemeChange.cxx index 8e26106873e7..b78500b6ce03 100644 --- a/sw/source/core/undo/UndoThemeChange.cxx +++ b/sw/source/core/undo/UndoThemeChange.cxx @@ -21,7 +21,7 @@ namespace sw UndoThemeChange::UndoThemeChange(SwDoc& rDocument, std::shared_ptr<model::ColorSet> const& pOldColorSet, std::shared_ptr<model::ColorSet> const& pNewColorSet) - : SwUndo(SwUndoId::CHANGE_THEME, &rDocument) + : SwUndo(SwUndoId::CHANGE_THEME, rDocument) , mrDocument(rDocument) , mpOldColorSet(pOldColorSet) , mpNewColorSet(pNewColorSet) diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index cf50d3195844..497dff2088fe 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -130,7 +130,7 @@ SwDocModifyAndUndoGuard::~SwDocModifyAndUndoGuard() SwUndoFormatAttr::SwUndoFormatAttr( SfxItemSet&& rOldSet, SwFormat& rChgFormat, bool bSaveDrawPt ) - : SwUndo( SwUndoId::INSFMTATTR, rChgFormat.GetDoc() ) + : SwUndo( SwUndoId::INSFMTATTR, *rChgFormat.GetDoc() ) , m_sFormatName ( rChgFormat.GetName() ) // #i56253# , m_oOldSet( std::move( rOldSet ) ) @@ -146,7 +146,7 @@ SwUndoFormatAttr::SwUndoFormatAttr( SfxItemSet&& rOldSet, SwUndoFormatAttr::SwUndoFormatAttr( const SfxPoolItem& rItem, SwFormat& rChgFormat, bool bSaveDrawPt ) - : SwUndo( SwUndoId::INSFMTATTR, rChgFormat.GetDoc() ) + : SwUndo( SwUndoId::INSFMTATTR, *rChgFormat.GetDoc() ) , m_sFormatName(rChgFormat.GetName()) , m_oOldSet( rChgFormat.GetAttrSet().CloneAsValue( false ) ) , m_nAnchorContentOffset( 0 ) @@ -564,7 +564,7 @@ bool SwUndoFormatAttr::RestoreFlyAnchor(::sw::UndoRedoContext & rContext) SwUndoFormatResetAttr::SwUndoFormatResetAttr( SwFormat& rChangedFormat, const std::vector<sal_uInt16>& rIds ) - : SwUndo( SwUndoId::RESETATTR, rChangedFormat.GetDoc() ) + : SwUndo( SwUndoId::RESETATTR, *rChangedFormat.GetDoc() ) , m_pChangedFormat( &rChangedFormat ) , m_aSet(*rChangedFormat.GetAttrSet().GetPool()) { @@ -609,14 +609,14 @@ void SwUndoFormatResetAttr::BroadcastStyleChange() } SwUndoResetAttr::SwUndoResetAttr( const SwPaM& rRange, sal_uInt16 nFormatId ) - : SwUndo( SwUndoId::RESETATTR, &rRange.GetDoc() ), SwUndRng( rRange ) + : SwUndo( SwUndoId::RESETATTR, rRange.GetDoc() ), SwUndRng( rRange ) , m_pHistory( new SwHistory ) , m_nFormatId( nFormatId ) { } SwUndoResetAttr::SwUndoResetAttr( const SwPosition& rPos, sal_uInt16 nFormatId ) - : SwUndo( SwUndoId::RESETATTR, &rPos.GetDoc() ) + : SwUndo( SwUndoId::RESETATTR, rPos.GetDoc() ) , m_pHistory( new SwHistory ) , m_nFormatId( nFormatId ) { @@ -744,7 +744,7 @@ void SwUndoResetAttr::SetAttrs( o3tl::sorted_vector<sal_uInt16> && rAttrs ) SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxPoolItem& rAttr, const SetAttrMode nFlags ) - : SwUndo( SwUndoId::INSATTR, &rRange.GetDoc() ), SwUndRng( rRange ) + : SwUndo( SwUndoId::INSATTR, rRange.GetDoc() ), SwUndRng( rRange ) , m_AttrSet( rRange.GetDoc().GetAttrPool(), rAttr.Which(), rAttr.Which() ) , m_pHistory( new SwHistory ) , m_nNodeIndex( NODE_OFFSET_MAX ) @@ -766,7 +766,7 @@ SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxPoolItem& rAttr, SwUndoAttr::SwUndoAttr( const SwPaM& rRange, SfxItemSet aSet, const SetAttrMode nFlags ) - : SwUndo( SwUndoId::INSATTR, &rRange.GetDoc() ), SwUndRng( rRange ) + : SwUndo( SwUndoId::INSATTR, rRange.GetDoc() ), SwUndRng( rRange ) , m_AttrSet(std::move( aSet )) , m_pHistory( new SwHistory ) , m_nNodeIndex( NODE_OFFSET_MAX ) @@ -969,7 +969,7 @@ void SwUndoAttr::RemoveIdx( SwDoc& rDoc ) } SwUndoDefaultAttr::SwUndoDefaultAttr( const SfxItemSet& rSet, const SwDoc& rDoc ) - : SwUndo( SwUndoId::SETDEFTATTR, &rDoc ) + : SwUndo( SwUndoId::SETDEFTATTR, rDoc ) { const SvxTabStopItem* pItem = rSet.GetItemIfSet( RES_PARATR_TABSTOP, false ); if( pItem ) @@ -1018,7 +1018,7 @@ void SwUndoDefaultAttr::RedoImpl(::sw::UndoRedoContext & rContext) SwUndoMoveLeftMargin::SwUndoMoveLeftMargin( const SwPaM& rPam, bool bFlag, bool bMod ) - : SwUndo( bFlag ? SwUndoId::INC_LEFTMARGIN : SwUndoId::DEC_LEFTMARGIN, &rPam.GetDoc() ) + : SwUndo( bFlag ? SwUndoId::INC_LEFTMARGIN : SwUndoId::DEC_LEFTMARGIN, rPam.GetDoc() ) , SwUndRng( rPam ) , m_pHistory( new SwHistory ) , m_bModulus( bMod ) @@ -1060,7 +1060,7 @@ void SwUndoMoveLeftMargin::RepeatImpl(::sw::RepeatContext & rContext) SwUndoChangeFootNote::SwUndoChangeFootNote( const SwPaM& rRange, OUString aText, bool const bIsEndNote) - : SwUndo( SwUndoId::CHGFTN, &rRange.GetDoc() ), SwUndRng( rRange ) + : SwUndo( SwUndoId::CHGFTN, rRange.GetDoc() ), SwUndRng( rRange ) , m_pHistory( new SwHistory() ) , m_Text(std::move( aText )) , m_bEndNote( bIsEndNote ) @@ -1098,7 +1098,7 @@ void SwUndoChangeFootNote::RepeatImpl(::sw::RepeatContext & rContext) } SwUndoFootNoteInfo::SwUndoFootNoteInfo( const SwFootnoteInfo &rInfo, const SwDoc& rDoc ) - : SwUndo( SwUndoId::FTNINFO, &rDoc ) + : SwUndo( SwUndoId::FTNINFO, rDoc ) , m_pFootNoteInfo( new SwFootnoteInfo( rInfo ) ) { } @@ -1124,7 +1124,7 @@ void SwUndoFootNoteInfo::RedoImpl(::sw::UndoRedoContext & rContext) } SwUndoEndNoteInfo::SwUndoEndNoteInfo( const SwEndNoteInfo &rInfo, const SwDoc& rDoc ) - : SwUndo( SwUndoId::FTNINFO, &rDoc ) + : SwUndo( SwUndoId::FTNINFO, rDoc ) , m_pEndNoteInfo( new SwEndNoteInfo( rInfo ) ) { } @@ -1150,7 +1150,7 @@ void SwUndoEndNoteInfo::RedoImpl(::sw::UndoRedoContext & rContext) } SwUndoDontExpandFormat::SwUndoDontExpandFormat( const SwPosition& rPos ) - : SwUndo( SwUndoId::DONTEXPAND, &rPos.GetDoc() ) + : SwUndo( SwUndoId::DONTEXPAND, rPos.GetDoc() ) , m_nNodeIndex( rPos.GetNodeIndex() ) , m_nContentIndex( rPos.GetContentIndex() ) { diff --git a/sw/source/core/undo/unbkmk.cxx b/sw/source/core/undo/unbkmk.cxx index a13aaaf0668c..4970ac288978 100644 --- a/sw/source/core/undo/unbkmk.cxx +++ b/sw/source/core/undo/unbkmk.cxx @@ -37,7 +37,7 @@ SwUndoBookmark::SwUndoBookmark( SwUndoId nUndoId, const ::sw::mark::MarkBase& rBkmk ) - : SwUndo( nUndoId, &rBkmk.GetMarkPos().GetDoc() ) + : SwUndo( nUndoId, rBkmk.GetMarkPos().GetDoc() ) , m_pHistoryBookmark(new SwHistoryBookmark(rBkmk, true, rBkmk.IsExpanded())) { } @@ -106,7 +106,7 @@ void SwUndoDeleteBookmark::RedoImpl(::sw::UndoRedoContext & rContext) } SwUndoRenameBookmark::SwUndoRenameBookmark( SwMarkName aOldName, SwMarkName aNewName, const SwDoc& rDoc ) - : SwUndo( SwUndoId::BOOKMARK_RENAME, &rDoc ) + : SwUndo( SwUndoId::BOOKMARK_RENAME, rDoc ) , m_sOldName(std::move( aOldName )) , m_sNewName(std::move( aNewName )) { @@ -153,7 +153,7 @@ void SwUndoRenameBookmark::RedoImpl(::sw::UndoRedoContext & rContext) } SwUndoInsNoTextFieldmark::SwUndoInsNoTextFieldmark(const ::sw::mark::Fieldmark& rFieldmark) - : SwUndo(SwUndoId::INSERT, &rFieldmark.GetMarkPos().GetDoc()) + : SwUndo(SwUndoId::INSERT, rFieldmark.GetMarkPos().GetDoc()) , m_pHistoryNoTextFieldmark(new SwHistoryNoTextFieldmark(rFieldmark)) { } @@ -169,7 +169,7 @@ void SwUndoInsNoTextFieldmark::RedoImpl(::sw::UndoRedoContext & rContext) } SwUndoDelNoTextFieldmark::SwUndoDelNoTextFieldmark(const ::sw::mark::Fieldmark& rFieldmark) - : SwUndo(SwUndoId::DELETE, &rFieldmark.GetMarkPos().GetDoc()) + : SwUndo(SwUndoId::DELETE, rFieldmark.GetMarkPos().GetDoc()) , m_pHistoryNoTextFieldmark(new SwHistoryNoTextFieldmark(rFieldmark)) { } @@ -187,7 +187,7 @@ void SwUndoDelNoTextFieldmark::RedoImpl(::sw::UndoRedoContext & rContext) } SwUndoInsTextFieldmark::SwUndoInsTextFieldmark(const ::sw::mark::Fieldmark& rFieldmark) - : SwUndo(SwUndoId::INSERT, &rFieldmark.GetMarkPos().GetDoc()) + : SwUndo(SwUndoId::INSERT, rFieldmark.GetMarkPos().GetDoc()) , m_pHistoryTextFieldmark(new SwHistoryTextFieldmark(rFieldmark)) { } @@ -203,7 +203,7 @@ void SwUndoInsTextFieldmark::RedoImpl(::sw::UndoRedoContext & rContext) } SwUndoDelTextFieldmark::SwUndoDelTextFieldmark(const ::sw::mark::Fieldmark& rFieldmark) - : SwUndo(SwUndoId::DELETE, &rFieldmark.GetMarkPos().GetDoc()) + : SwUndo(SwUndoId::DELETE, rFieldmark.GetMarkPos().GetDoc()) , m_pHistoryTextFieldmark(new SwHistoryTextFieldmark(rFieldmark)) { } diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 6d71d440ef1d..8a7464fd4e9d 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -177,7 +177,7 @@ SwUndoDelete::SwUndoDelete( SwDeleteFlags const flags, bool bFullPara, bool bCalledByTableCpy ) - : SwUndo(SwUndoId::DELETE, &rPam.GetDoc()), + : SwUndo(SwUndoId::DELETE, rPam.GetDoc()), SwUndRng( rPam ), m_nNode(0), m_nNdDiff(0), diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 6447a280b45b..1e6c1d1c26de 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -148,19 +148,19 @@ void SwUndo::RemoveIdxRel( SwNodeOffset nIdx, const SwPosition& rPos ) ::PaMCorrRel( *rPos.GetNode().GetNodes()[nIdx], rPos ); } -SwUndo::SwUndo(SwUndoId const nId, const SwDoc* pDoc) +SwUndo::SwUndo(SwUndoId const nId, const SwDoc& rDoc) : m_nId(nId), m_nOrigRedlineFlags(RedlineFlags::NONE) - , m_nViewShellId(CreateViewShellId(pDoc)) + , m_nViewShellId(CreateViewShellId(rDoc)) , m_isRepeatIgnored(false) , m_bCacheComment(true) { } -ViewShellId SwUndo::CreateViewShellId(const SwDoc* pDoc) +ViewShellId SwUndo::CreateViewShellId(const SwDoc& rDoc) { ViewShellId nRet(-1); - if (const SwDocShell* pDocShell = pDoc->GetDocShell()) + if (const SwDocShell* pDocShell = rDoc.GetDocShell()) { if (const SwView* pView = pDocShell->GetView()) nRet = pView->GetViewShellId(); diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx index 8d1feece9563..4b85c743f739 100644 --- a/sw/source/core/undo/undobj1.cxx +++ b/sw/source/core/undo/undobj1.cxx @@ -43,7 +43,7 @@ #include <svx/svdobj.hxx> SwUndoFlyBase::SwUndoFlyBase( SwFrameFormat* pFormat, SwUndoId nUndoId ) - : SwUndo(nUndoId, pFormat->GetDoc()) + : SwUndo(nUndoId, *pFormat->GetDoc()) , m_pFrameFormat(pFormat) , m_nNodePagePos(0) , m_nContentPos(0) @@ -482,7 +482,7 @@ void SwUndoDelLayFormat::RedoForRollback() } SwUndoSetFlyFormat::SwUndoSetFlyFormat( SwFrameFormat& rFlyFormat, const SwFrameFormat& rNewFrameFormat ) - : SwUndo( SwUndoId::SETFLYFRMFMT, rFlyFormat.GetDoc() ), SwClient( &rFlyFormat ), m_pFrameFormat( &rFlyFormat ), + : SwUndo( SwUndoId::SETFLYFRMFMT, *rFlyFormat.GetDoc() ), SwClient( &rFlyFormat ), m_pFrameFormat( &rFlyFormat ), m_DerivedFromFormatName( rFlyFormat.IsDefault() ? UIName(u""_ustr) : rFlyFormat.DerivedFrom()->GetName() ), m_NewFormatName( rNewFrameFormat.GetName() ), m_oItemSet( std::in_place, *rFlyFormat.GetAttrSet().GetPool(), diff --git a/sw/source/core/undo/undoflystrattr.cxx b/sw/source/core/undo/undoflystrattr.cxx index 60d8da4e95af..bb94d9c8b4d9 100644 --- a/sw/source/core/undo/undoflystrattr.cxx +++ b/sw/source/core/undo/undoflystrattr.cxx @@ -26,7 +26,7 @@ SwUndoFlyStrAttr::SwUndoFlyStrAttr( SwFlyFrameFormat& rFlyFrameFormat, const SwUndoId eUndoId, OUString sOldStr, OUString sNewStr ) - : SwUndo( eUndoId, rFlyFrameFormat.GetDoc() ), + : SwUndo( eUndoId, *rFlyFrameFormat.GetDoc() ), mrFlyFrameFormat( rFlyFrameFormat ), msOldStr(std::move( sOldStr )), msNewStr(std::move( sNewStr )) @@ -90,7 +90,7 @@ SwRewriter SwUndoFlyStrAttr::GetRewriter() const SwUndoFlyDecorative::SwUndoFlyDecorative(SwFlyFrameFormat& rFlyFrameFormat, bool const isDecorative) - : SwUndo(SwUndoId::FLYFRMFMT_DECORATIVE, rFlyFrameFormat.GetDoc()) + : SwUndo(SwUndoId::FLYFRMFMT_DECORATIVE, *rFlyFrameFormat.GetDoc()) , m_rFlyFrameFormat(rFlyFrameFormat) , m_IsDecorative(isDecorative) { diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx index 2365c9b57156..df283be167e2 100644 --- a/sw/source/core/undo/undraw.cxx +++ b/sw/source/core/undo/undraw.cxx @@ -67,7 +67,7 @@ void SwDoc::AddDrawUndo( std::unique_ptr<SdrUndoAction> pUndo ) } SwSdrUndo::SwSdrUndo( std::unique_ptr<SdrUndoAction> pUndo, const SdrMarkList* pMrkLst, const SwDoc& rDoc ) - : SwUndo( SwUndoId::DRAWUNDO, &rDoc ), m_pSdrUndo( std::move(pUndo) ) + : SwUndo( SwUndoId::DRAWUNDO, rDoc ), m_pSdrUndo( std::move(pUndo) ) { if( pMrkLst && pMrkLst->GetMarkCount() ) m_pMarkList.reset( new SdrMarkList( *pMrkLst ) ); @@ -169,7 +169,7 @@ static void lcl_RestoreAnchor( SwFrameFormat* pFormat, SwNodeOffset nNodePos ) } SwUndoDrawGroup::SwUndoDrawGroup( sal_uInt16 nCnt, const SwDoc& rDoc ) - : SwUndo( SwUndoId::DRAWGROUP, &rDoc ), m_nSize( nCnt + 1 ), m_bDeleteFormat( true ) + : SwUndo( SwUndoId::DRAWGROUP, rDoc ), m_nSize( nCnt + 1 ), m_bDeleteFormat( true ) { m_pObjArray.reset( new SwUndoGroupObjImpl[ m_nSize ] ); } @@ -347,7 +347,7 @@ void SwUndoDrawGroup::SetGroupFormat( SwDrawFrameFormat* pFormat ) } SwUndoDrawUnGroup::SwUndoDrawUnGroup( SdrObjGroup* pObj, const SwDoc& rDoc ) - : SwUndo( SwUndoId::DRAWUNGROUP, &rDoc ), m_bDeleteFormat( false ) + : SwUndo( SwUndoId::DRAWUNGROUP, rDoc ), m_bDeleteFormat( false ) { m_nSize = o3tl::narrowing<sal_uInt16>(pObj->GetSubList()->GetObjCount()) + 1; m_pObjArray.reset( new SwUndoGroupObjImpl[ m_nSize ] ); @@ -523,7 +523,7 @@ void SwUndoDrawUnGroup::AddObj( sal_uInt16 nPos, SwDrawFrameFormat* pFormat ) } SwUndoDrawUnGroupConnectToLayout::SwUndoDrawUnGroupConnectToLayout(const SwDoc& rDoc) - : SwUndo( SwUndoId::DRAWUNGROUP, &rDoc ) + : SwUndo( SwUndoId::DRAWUNGROUP, rDoc ) { } @@ -570,7 +570,7 @@ void SwUndoDrawUnGroupConnectToLayout::AddFormatAndObj( SwDrawFrameFormat* pDraw } SwUndoDrawDelete::SwUndoDrawDelete( sal_uInt16 nCnt, const SwDoc& rDoc ) - : SwUndo( SwUndoId::DRAWDELETE, &rDoc ), m_bDeleteFormat( true ) + : 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/unfmco.cxx b/sw/source/core/undo/unfmco.cxx index 7ea43d0d5fef..118cf98f399e 100644 --- a/sw/source/core/undo/unfmco.cxx +++ b/sw/source/core/undo/unfmco.cxx @@ -27,7 +27,7 @@ SwUndoFormatColl::SwUndoFormatColl( const SwPaM& rRange, const SwFormatColl* pColl, const bool bReset, const bool bResetListAttrs ) - : SwUndo( SwUndoId::SETFMTCOLL, &rRange.GetDoc() ), + : SwUndo( SwUndoId::SETFMTCOLL, rRange.GetDoc() ), SwUndRng( rRange ), mpHistory( new SwHistory ), mbReset( bReset ), diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index 5083cf6d3220..fe5fdb385216 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -62,7 +62,7 @@ std::optional<OUString> SwUndoInsert::GetTextFromDoc() const { std::optional<OUString> aResult; - SwNodeIndex aNd( m_pDoc->GetNodes(), m_nNode); + SwNodeIndex aNd( m_rDoc.GetNodes(), m_nNode); SwContentNode* pCNd = aNd.GetNode().GetContentNode(); if( pCNd->IsTextNode() ) @@ -84,15 +84,14 @@ std::optional<OUString> SwUndoInsert::GetTextFromDoc() const return aResult; } -void SwUndoInsert::Init(const SwNode & rNd) +void SwUndoInsert::Init() { // consider Redline - m_pDoc = const_cast<SwDoc*>(&rNd.GetDoc()); - if( m_pDoc->getIDocumentRedlineAccess().IsRedlineOn() ) + if( m_rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) { m_pRedlData.reset( new SwRedlineData( RedlineType::Insert, - m_pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() ) ); - SetRedlineFlags( m_pDoc->getIDocumentRedlineAccess().GetRedlineFlags() ); + m_rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() ) ); + SetRedlineFlags( m_rDoc.getIDocumentRedlineAccess().GetRedlineFlags() ); } maUndoText = GetTextFromDoc(); @@ -104,23 +103,25 @@ SwUndoInsert::SwUndoInsert( const SwNode& rNd, sal_Int32 nCnt, sal_Int32 nL, const SwInsertFlags nInsertFlags, bool bWDelim ) - : SwUndo(SwUndoId::TYPING, &rNd.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) , m_nInsertFlags(nInsertFlags) + , m_rDoc(const_cast<SwDoc&>(rNd.GetDoc())) { - Init(rNd); + Init(); } SwUndoInsert::SwUndoInsert( const SwNode& rNd ) - : SwUndo(SwUndoId::SPLITNODE, &rNd.GetDoc()), + : SwUndo(SwUndoId::SPLITNODE, rNd.GetDoc()), m_nNode( rNd.GetIndex() ), m_nContent(0), m_nLen(1), m_bIsWordDelim( false ), m_bIsAppend( true ) , m_bWithRsid(false) , m_nInsertFlags(SwInsertFlags::EMPTYEXPAND) + , m_rDoc(const_cast<SwDoc&>(rNd.GetDoc())) { - Init(rNd); + Init(); } // Check if the next Insert can be combined with the current one. If so @@ -268,7 +269,7 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext) if (!maText) { - m_oUndoNodeIndex.emplace(m_pDoc->GetNodes().GetEndOfContent()); + m_oUndoNodeIndex.emplace(m_rDoc.GetNodes().GetEndOfContent()); MoveToUndoNds(aPaM, &*m_oUndoNodeIndex); } m_nNode = aPaM.GetPoint()->GetNodeIndex(); @@ -505,7 +506,7 @@ public: SwUndoReplace::SwUndoReplace(SwPaM const& rPam, OUString const& rIns, bool const bRegExp) - : SwUndo( SwUndoId::REPLACE, &rPam.GetDoc() ) + : SwUndo( SwUndoId::REPLACE, rPam.GetDoc() ) , m_pImpl(std::make_unique<Impl>(rPam, rIns, bRegExp)) { } @@ -766,7 +767,7 @@ void SwUndoReplace::Impl::SetEnd(SwPaM const& rPam) } SwUndoReRead::SwUndoReRead( const SwPaM& rPam, const SwGrfNode& rGrfNd ) - : SwUndo( SwUndoId::REREAD, &rPam.GetDoc() ), mnPosition( rPam.GetPoint()->GetNodeIndex() ) + : SwUndo( SwUndoId::REREAD, rPam.GetDoc() ), mnPosition( rPam.GetPoint()->GetNodeIndex() ) { SaveGraphicData( rGrfNd ); } @@ -841,8 +842,8 @@ SwUndoInsertLabel::SwUndoInsertLabel( const SwLabelType eTyp, const sal_uInt16 nInitId, UIName aCharacterStyle, const bool bCpyBorder, - const SwDoc* pDoc ) - : SwUndo( SwUndoId::INSERTLABEL, pDoc ), + const SwDoc& rDoc ) + : SwUndo( SwUndoId::INSERTLABEL, rDoc ), m_sText(std::move( aText )), m_sSeparator(std::move( aSeparator )), m_sNumberSeparator(std::move( aNumberSeparator )),//#i61007# order of captions diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx index 0ea6443f611a..cfa29b79321c 100644 --- a/sw/source/core/undo/unmove.cxx +++ b/sw/source/core/undo/unmove.cxx @@ -27,7 +27,7 @@ // MOVE SwUndoMove::SwUndoMove( const SwPaM& rRange, const SwPosition& rMvPos ) - : SwUndo( SwUndoId::MOVE, &rRange.GetDoc() ) + : SwUndo( SwUndoId::MOVE, rRange.GetDoc() ) , SwUndRng( rRange ) , m_nDestStartNode(0) , m_nDestEndNode(0) @@ -93,7 +93,7 @@ SwUndoMove::SwUndoMove( const SwPaM& rRange, const SwPosition& rMvPos ) SwUndoMove::SwUndoMove( SwDoc& rDoc, const SwNodeRange& rRg, const SwNode& rMvPos ) - : SwUndo(SwUndoId::MOVE, &rDoc) + : SwUndo(SwUndoId::MOVE, rDoc) , m_nDestStartNode(0) , m_nDestEndNode(0) , m_nInsPosNode(0) diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx index 2ae994d45a37..bd5814da76d3 100644 --- a/sw/source/core/undo/unnum.cxx +++ b/sw/source/core/undo/unnum.cxx @@ -31,14 +31,14 @@ SwUndoInsNum::SwUndoInsNum( const SwNumRule& rOldRule, const SwNumRule& rNewRule, const SwDoc& rDoc, SwUndoId nUndoId) - : SwUndo( nUndoId, &rDoc ), + : SwUndo( nUndoId, rDoc ), m_aNumRule( rNewRule ), m_pOldNumRule( new SwNumRule( rOldRule )), m_nLRSavePos( 0 ) { } SwUndoInsNum::SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule ) - : SwUndo( SwUndoId::INSNUM, &rPam.GetDoc() ), SwUndRng( rPam ), + : SwUndo( SwUndoId::INSNUM, rPam.GetDoc() ), SwUndRng( rPam ), m_aNumRule( rRule ), m_nLRSavePos( 0 ) { @@ -46,7 +46,7 @@ SwUndoInsNum::SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule ) SwUndoInsNum::SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule, UIName aReplaceRule ) - : SwUndo( SwUndoId::INSNUM, &rPos.GetNode().GetDoc() ), + : SwUndo( SwUndoId::INSNUM, rPos.GetNode().GetDoc() ), m_aNumRule( rRule ), m_sReplaceRule(std::move( aReplaceRule )), m_nLRSavePos( 0 ) { @@ -154,7 +154,7 @@ void SwUndoInsNum::SaveOldNumRule( const SwNumRule& rOld ) } SwUndoDelNum::SwUndoDelNum( const SwPaM& rPam ) - : SwUndo( SwUndoId::DELNUM, &rPam.GetDoc() ), SwUndRng( rPam ) + : SwUndo( SwUndoId::DELNUM, rPam.GetDoc() ), SwUndRng( rPam ) { if (m_nEndNode > m_nSttNode) m_aNodes.reserve( std::min<sal_Int32>(sal_Int32(m_nEndNode - m_nSttNode), 255) ); @@ -205,7 +205,7 @@ void SwUndoDelNum::AddNode( const SwTextNode& rNd ) } SwUndoMoveNum::SwUndoMoveNum( const SwPaM& rPam, SwNodeOffset nOff, bool bIsOutlMv ) - : SwUndo( bIsOutlMv ? SwUndoId::OUTLINE_UD : SwUndoId::MOVENUM, &rPam.GetDoc() ), + : SwUndo( bIsOutlMv ? SwUndoId::OUTLINE_UD : SwUndoId::MOVENUM, rPam.GetDoc() ), SwUndRng( rPam ), m_nNewStart( 0 ), m_nOffset( nOff ) { @@ -254,7 +254,7 @@ void SwUndoMoveNum::RepeatImpl(::sw::RepeatContext & rContext) } SwUndoNumUpDown::SwUndoNumUpDown( const SwPaM& rPam, short nOff ) - : SwUndo( nOff > 0 ? SwUndoId::NUMUP : SwUndoId::NUMDOWN, &rPam.GetDoc() ), + : SwUndo( nOff > 0 ? SwUndoId::NUMUP : SwUndoId::NUMDOWN, rPam.GetDoc() ), SwUndRng( rPam ), m_nOffset( nOff ) { @@ -281,7 +281,7 @@ void SwUndoNumUpDown::RepeatImpl(::sw::RepeatContext & rContext) SwUndoNumOrNoNum::SwUndoNumOrNoNum( const SwNode& rIdx, bool bOldNum, bool bNewNum) - : SwUndo( SwUndoId::NUMORNONUM, &rIdx.GetDoc() ), + : SwUndo( SwUndoId::NUMORNONUM, rIdx.GetDoc() ), m_nIndex( rIdx.GetIndex() ), mbNewNum(bNewNum), mbOldNum(bOldNum) { @@ -325,14 +325,14 @@ void SwUndoNumOrNoNum::RepeatImpl(::sw::RepeatContext & rContext) } SwUndoNumRuleStart::SwUndoNumRuleStart( const SwPosition& rPos, bool bFlg ) - : SwUndo( SwUndoId::SETNUMRULESTART, &rPos.GetDoc() ), + : SwUndo( SwUndoId::SETNUMRULESTART, rPos.GetDoc() ), m_nIndex( rPos.GetNodeIndex() ), m_nOldStart( USHRT_MAX ), m_nNewStart( USHRT_MAX ), m_bSetStartValue( false ), m_bFlag( bFlg ) { } SwUndoNumRuleStart::SwUndoNumRuleStart( const SwPosition& rPos, sal_uInt16 nStt ) - : SwUndo(SwUndoId::SETNUMRULESTART, &rPos.GetDoc()) + : SwUndo(SwUndoId::SETNUMRULESTART, rPos.GetDoc()) , m_nIndex(rPos.GetNodeIndex()) , m_nOldStart(USHRT_MAX) , m_nNewStart(nStt) diff --git a/sw/source/core/undo/unoutl.cxx b/sw/source/core/undo/unoutl.cxx index 2144c7dd78cf..364e1a903c84 100644 --- a/sw/source/core/undo/unoutl.cxx +++ b/sw/source/core/undo/unoutl.cxx @@ -25,7 +25,7 @@ SwUndoOutlineLeftRight::SwUndoOutlineLeftRight( const SwPaM& rPam, short nOff ) - : SwUndo( SwUndoId::OUTLINE_LR, &rPam.GetDoc() ), SwUndRng( rPam ), m_nOffset( nOff ) + : SwUndo( SwUndoId::OUTLINE_LR, rPam.GetDoc() ), SwUndRng( rPam ), m_nOffset( nOff ) { } @@ -49,7 +49,7 @@ void SwUndoOutlineLeftRight::RepeatImpl(::sw::RepeatContext & rContext) SwUndoOutlineEdit::SwUndoOutlineEdit(const SwNumRule& rOldRule, const SwNumRule& rNewRule, const SwDoc& rDoc) - : SwUndo(SwUndoId::OUTLINE_EDIT, &rDoc) + : SwUndo(SwUndoId::OUTLINE_EDIT, rDoc) , m_aNewNumRule(rNewRule) , m_aOldNumRule(rOldRule) { diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx index a669831b51ab..78f6c5de0e52 100644 --- a/sw/source/core/undo/unovwr.cxx +++ b/sw/source/core/undo/unovwr.cxx @@ -41,7 +41,7 @@ using namespace ::com::sun::star::uno; SwUndoOverwrite::SwUndoOverwrite( SwDoc& rDoc, SwPosition& rPos, sal_Unicode cIns ) - : SwUndo(SwUndoId::OVERWRITE, &rDoc), + : SwUndo(SwUndoId::OVERWRITE, rDoc), m_bGroup( false ) { SwTextNode *const pTextNd = rPos.GetNode().GetTextNode(); @@ -340,7 +340,7 @@ struct UndoTransliterate_Data SwUndoTransliterate::SwUndoTransliterate( const SwPaM& rPam, const utl::TransliterationWrapper& rTrans ) - : SwUndo( SwUndoId::TRANSLITERATE, &rPam.GetDoc() ), SwUndRng( rPam ), m_nType( rTrans.getType() ) + : SwUndo( SwUndoId::TRANSLITERATE, rPam.GetDoc() ), SwUndRng( rPam ), m_nType( rTrans.getType() ) { } diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 8be50337fe8b..e47468615a12 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -38,7 +38,7 @@ #include <docedt.hxx> SwUndoRedline::SwUndoRedline( SwUndoId nUsrId, const SwPaM& rRange, sal_Int8 nDepth ) - : SwUndo( SwUndoId::REDLINE, &rRange.GetDoc() ), SwUndRng( rRange ), + : SwUndo( SwUndoId::REDLINE, rRange.GetDoc() ), SwUndRng( rRange ), mnUserId( nUsrId ), mbHiddenRedlines( false ), mnDepth( nDepth ) @@ -478,7 +478,7 @@ void SwUndoRejectRedline::RepeatImpl(::sw::RepeatContext & rContext) } SwUndoCompDoc::SwUndoCompDoc( const SwPaM& rRg, bool bIns ) - : SwUndo( SwUndoId::COMPAREDOC, &rRg.GetDoc() ), SwUndRng( rRg ), + : SwUndo( SwUndoId::COMPAREDOC, rRg.GetDoc() ), SwUndRng( rRg ), m_bInsert( bIns ) { SwDoc& rDoc = rRg.GetDoc(); @@ -491,7 +491,7 @@ SwUndoCompDoc::SwUndoCompDoc( const SwPaM& rRg, bool bIns ) } SwUndoCompDoc::SwUndoCompDoc( const SwRangeRedline& rRedl ) - : SwUndo( SwUndoId::COMPAREDOC, &rRedl.GetDoc() ), SwUndRng( rRedl ), + : SwUndo( SwUndoId::COMPAREDOC, rRedl.GetDoc() ), SwUndRng( rRedl ), // for MergeDoc the corresponding inverse is needed m_bInsert( RedlineType::Delete == rRedl.GetType() ) { diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index 3aa830214d5a..ae46c09763af 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -78,7 +78,7 @@ SwUndoInsSection::SwUndoInsSection( SwPaM const& rPam, SwSectionData const& rNewData, SfxItemSet const*const pSet, std::tuple<SwTOXBase const*, sw::RedlineMode, sw::FieldmarkMode, sw::ParagraphBreakMode> const*const pTOXBase) - : SwUndo( SwUndoId::INSSECTION, &rPam.GetDoc() ), SwUndRng( rPam ) + : SwUndo( SwUndoId::INSSECTION, rPam.GetDoc() ), SwUndRng( rPam ) , m_pSectionData(new SwSectionData(rNewData)) , m_pAttrSet( (pSet && pSet->Count()) ? new SfxItemSet( *pSet ) : nullptr ) , m_nSectionNodePos(0) @@ -345,7 +345,7 @@ std::unique_ptr<SwUndo> MakeUndoDelSection(SwSectionFormat const& rFormat) SwUndoDelSection::SwUndoDelSection( SwSectionFormat const& rSectionFormat, SwSection const& rSection, SwNodeIndex const*const pIndex) - : SwUndo( SwUndoId::DELSECTION, rSectionFormat.GetDoc() ) + : SwUndo( SwUndoId::DELSECTION, *rSectionFormat.GetDoc() ) , m_pSectionData( new SwSectionData(rSection) ) , m_pTOXBase( dynamic_cast<const SwTOXBaseSection*>( &rSection) != nullptr ? new SwTOXBase(static_cast<SwTOXBaseSection const&>(rSection)) @@ -453,7 +453,7 @@ MakeUndoUpdateSection(SwSectionFormat const& rFormat, bool const bOnlyAttr) SwUndoUpdateSection::SwUndoUpdateSection( SwSection const& rSection, SwNodeIndex const*const pIndex, bool const bOnlyAttr) - : SwUndo( SwUndoId::CHGSECTION, &pIndex->GetNode().GetDoc() ) + : SwUndo( SwUndoId::CHGSECTION, pIndex->GetNode().GetDoc() ) , m_pSectionData( new SwSectionData(rSection) ) , m_oAttrSet( ::lcl_GetAttrSet(rSection) ) , m_nStartNode( pIndex->GetIndex() ) @@ -526,7 +526,7 @@ void SwUndoUpdateSection::RedoImpl(::sw::UndoRedoContext & rContext) SwUndoUpdateIndex::SwUndoUpdateIndex(SwTOXBaseSection & rTOX) - : SwUndo(SwUndoId::INSSECTION, rTOX.GetFormat()->GetDoc()) + : SwUndo(SwUndoId::INSSECTION, *rTOX.GetFormat()->GetDoc()) , m_pSaveSectionOriginal(new SwUndoSaveSection) , m_pSaveSectionUpdated(new SwUndoSaveSection) , m_nStartIndex(rTOX.GetFormat()->GetSectionNode()->GetIndex() + 1) diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx index bf188918a435..2c45c7f4f54b 100644 --- a/sw/source/core/undo/unsort.cxx +++ b/sw/source/core/undo/unsort.cxx @@ -31,7 +31,7 @@ #include <node2lay.hxx> SwUndoSort::SwUndoSort(const SwPaM& rRg, const SwSortOptions& rOpt) - : SwUndo(SwUndoId::SORT_TXT, &rRg.GetDoc()) + : SwUndo(SwUndoId::SORT_TXT, rRg.GetDoc()) , SwUndRng(rRg) , m_nTableNode(0) { @@ -40,7 +40,7 @@ SwUndoSort::SwUndoSort(const SwPaM& rRg, const SwSortOptions& rOpt) SwUndoSort::SwUndoSort( SwNodeOffset nStt, SwNodeOffset nEnd, const SwTableNode& rTableNd, const SwSortOptions& rOpt, bool bSaveTable ) - : SwUndo(SwUndoId::SORT_TBL, &rTableNd.GetDoc()) + : SwUndo(SwUndoId::SORT_TBL, rTableNd.GetDoc()) { m_nSttNode = nStt; m_nEndNode = nEnd; diff --git a/sw/source/core/undo/unspnd.cxx b/sw/source/core/undo/unspnd.cxx index f16bd1e66e38..60f2e791d27b 100644 --- a/sw/source/core/undo/unspnd.cxx +++ b/sw/source/core/undo/unspnd.cxx @@ -39,7 +39,7 @@ SwUndoSplitNode::SwUndoSplitNode( SwDoc& rDoc, const SwPosition& rPos, bool bChkTable ) - : SwUndo( SwUndoId::SPLITNODE, &rDoc ), m_nNode( rPos.GetNodeIndex() ), + : SwUndo( SwUndoId::SPLITNODE, rDoc ), m_nNode( rPos.GetNodeIndex() ), m_nContent( rPos.GetContentIndex() ), m_bTableFlag( false ), m_bCheckTableStart( bChkTable ) { diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index d68d6ac2858d..2374cd6175d5 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -238,7 +238,7 @@ SwUndoInsTable::SwUndoInsTable( const SwPosition& rPos, sal_uInt16 nCl, sal_uInt const SwTableAutoFormat* pTAFormat, const std::vector<sal_uInt16> *pColArr, const UIName & rName) - : SwUndo( SwUndoId::INSTABLE, &rPos.GetDoc() ), + : SwUndo( SwUndoId::INSTABLE, rPos.GetDoc() ), m_aInsTableOptions( rInsTableOpts ), m_nStartNode( rPos.GetNodeIndex() ), m_nRows( nRw ), m_nColumns( nCl ), m_nAdjust( nAdj ) { @@ -426,7 +426,7 @@ SwTableToTextSave::SwTableToTextSave( SwDoc& rDoc, SwNodeOffset nNd, SwNodeOffse } SwUndoTableToText::SwUndoTableToText( const SwTable& rTable, sal_Unicode cCh ) - : SwUndo( SwUndoId::TABLETOTEXT, rTable.GetFrameFormat()->GetDoc() ), + : SwUndo( SwUndoId::TABLETOTEXT, *rTable.GetFrameFormat()->GetDoc() ), m_sTableName( rTable.GetFrameFormat()->GetName() ), m_nStartNode( 0 ), m_nEndNode( 0 ), m_cSeparator( cCh ), m_nHeadlineRepeat( rTable.GetRowsToRepeat() ) @@ -719,7 +719,7 @@ SwUndoTextToTable::SwUndoTextToTable( const SwPaM& rRg, const SwInsertTableOptions& rInsTableOpts, sal_Unicode cCh, sal_uInt16 nAdj, const SwTableAutoFormat* pAFormat ) - : SwUndo( SwUndoId::TEXTTOTABLE, &rRg.GetDoc() ), SwUndRng( rRg ), m_aInsertTableOpts( rInsTableOpts ), + : SwUndo( SwUndoId::TEXTTOTABLE, rRg.GetDoc() ), SwUndRng( rRg ), m_aInsertTableOpts( rInsTableOpts ), m_pHistory( nullptr ), m_cSeparator( cCh ), m_nAdjust( nAdj ) { if( pAFormat ) @@ -846,7 +846,7 @@ SwHistory& SwUndoTextToTable::GetHistory() SwUndoTableHeadline::SwUndoTableHeadline( const SwTable& rTable, sal_uInt16 nOldHdl, sal_uInt16 nNewHdl ) - : SwUndo( SwUndoId::TABLEHEADLINE, rTable.GetFrameFormat()->GetDoc() ), + : SwUndo( SwUndoId::TABLEHEADLINE, *rTable.GetFrameFormat()->GetDoc() ), m_nOldHeadline( nOldHdl ), m_nNewHeadline( nNewHdl ) { @@ -1370,7 +1370,7 @@ void SaveBox::CreateNew( SwTable& rTable, SwTableLine& rParent, SaveTable& rSTab // UndoObject for attribute changes on table SwUndoAttrTable::SwUndoAttrTable( const SwTableNode& rTableNd, bool bClearTabCols ) - : SwUndo( SwUndoId::TABLE_ATTR, &rTableNd.GetDoc() ), + : SwUndo( SwUndoId::TABLE_ATTR, rTableNd.GetDoc() ), m_nStartNode( rTableNd.GetIndex() ) { m_bClearTableCol = bClearTabCols; @@ -1408,7 +1408,7 @@ void SwUndoAttrTable::RedoImpl(::sw::UndoRedoContext & rContext) // UndoObject for AutoFormat on Table SwUndoTableAutoFormat::SwUndoTableAutoFormat( const SwTableNode& rTableNd, const SwTableAutoFormat& rAFormat ) - : SwUndo( SwUndoId::TABLE_AUTOFMT, &rTableNd.GetDoc() ) + : SwUndo( SwUndoId::TABLE_AUTOFMT, rTableNd.GetDoc() ) , m_TableStyleName(rTableNd.GetTable().GetTableStyleName()) , m_nStartNode( rTableNd.GetIndex() ) , m_bSaveContentAttr( false ) @@ -1483,7 +1483,7 @@ SwUndoTableNdsChg::SwUndoTableNdsChg( SwUndoId nAction, const SwTableNode& rTableNd, tools::Long nMn, tools::Long nMx, sal_uInt16 nCnt, bool bFlg, bool bSmHght ) - : SwUndo( nAction, &rTableNd.GetDoc() ), + : SwUndo( nAction, rTableNd.GetDoc() ), m_nMin( nMn ), m_nMax( nMx ), m_nSttNode( rTableNd.GetIndex() ), m_nCount( nCnt ), @@ -1850,7 +1850,7 @@ void SwUndoTableNdsChg::RedoImpl(::sw::UndoRedoContext & rContext) } SwUndoTableMerge::SwUndoTableMerge( const SwPaM& rTableSel ) - : SwUndo( SwUndoId::TABLE_MERGE, &rTableSel.GetDoc() ), SwUndRng( rTableSel ) + : SwUndo( SwUndoId::TABLE_MERGE, rTableSel.GetDoc() ), SwUndRng( rTableSel ) { const SwTableNode* pTableNd = rTableSel.GetPointNode().FindTableNode(); assert(pTableNd && "Where is the TableNode?"); @@ -2060,7 +2060,7 @@ void SwUndoTableMerge::SaveCollection( const SwTableBox& rBox ) SwUndoTableNumFormat::SwUndoTableNumFormat( const SwTableBox& rBox, const SfxItemSet* pNewSet ) - : SwUndo(SwUndoId::TBLNUMFMT, rBox.GetFrameFormat()->GetDoc()) + : SwUndo(SwUndoId::TBLNUMFMT, *rBox.GetFrameFormat()->GetDoc()) , m_nFormatIdx(getSwDefaultTextFormat()) , m_nNewFormatIdx(0) , m_fNum(0.0) @@ -2361,7 +2361,7 @@ void UndoTableCpyTable_Entry::dumpAsXml(xmlTextWriterPtr pWriter) const } SwUndoTableCpyTable::SwUndoTableCpyTable(const SwDoc& rDoc) - : SwUndo( SwUndoId::TBLCPYTBL, &rDoc ) + : SwUndo( SwUndoId::TBLCPYTBL, rDoc ) { } @@ -2783,7 +2783,7 @@ bool SwUndoTableCpyTable::IsEmpty() const } SwUndoCpyTable::SwUndoCpyTable(const SwDoc& rDoc) - : SwUndo( SwUndoId::CPYTBL, &rDoc ), m_nTableNode( 0 ) + : SwUndo( SwUndoId::CPYTBL, rDoc ), m_nTableNode( 0 ) { } @@ -2823,7 +2823,7 @@ void SwUndoCpyTable::RedoImpl(::sw::UndoRedoContext & rContext) SwUndoSplitTable::SwUndoSplitTable( const SwTableNode& rTableNd, std::unique_ptr<SwSaveRowSpan> pRowSp, SplitTable_HeadlineOption eMode, bool bNewSize ) - : SwUndo( SwUndoId::SPLIT_TABLE, &rTableNd.GetDoc() ), + : SwUndo( SwUndoId::SPLIT_TABLE, rTableNd.GetDoc() ), m_nTableNode( rTableNd.GetIndex() ), m_nOffset( 0 ), mpSaveRowSpan( std::move(pRowSp) ), m_nMode( eMode ), m_nFormulaEnd( 0 ), m_bCalcNewSize( bNewSize ) { @@ -2952,7 +2952,7 @@ void SwUndoSplitTable::SaveFormula( SwHistory& rHistory ) SwUndoMergeTable::SwUndoMergeTable( const SwTableNode& rTableNd, const SwTableNode& rDelTableNd, bool bWithPrv ) - : SwUndo( SwUndoId::MERGE_TABLE, &rTableNd.GetDoc() ), + : SwUndo( SwUndoId::MERGE_TABLE, rTableNd.GetDoc() ), m_bWithPrev( bWithPrv ) { // memorize end node of the last table cell that'll stay in position @@ -3108,7 +3108,7 @@ void CheckTable( const SwTable& rTable ) #endif SwUndoTableStyleMake::SwUndoTableStyleMake(TableStyleName aName, const SwDoc& rDoc) - : SwUndo(SwUndoId::TBLSTYLE_CREATE, &rDoc), + : SwUndo(SwUndoId::TBLSTYLE_CREATE, rDoc), m_sName(std::move(aName)) { } @@ -3141,7 +3141,7 @@ SwRewriter SwUndoTableStyleMake::GetRewriter() const } SwUndoTableStyleDelete::SwUndoTableStyleDelete(std::unique_ptr<SwTableAutoFormat> pAutoFormat, std::vector<SwTable*>&& rAffectedTables, const SwDoc& rDoc) - : SwUndo(SwUndoId::TBLSTYLE_DELETE, &rDoc), + : SwUndo(SwUndoId::TBLSTYLE_DELETE, rDoc), m_pAutoFormat(std::move(pAutoFormat)), m_rAffectedTables(std::move(rAffectedTables)) { } @@ -3171,7 +3171,7 @@ SwRewriter SwUndoTableStyleDelete::GetRewriter() const } SwUndoTableStyleUpdate::SwUndoTableStyleUpdate(const SwTableAutoFormat& rNewFormat, const SwTableAutoFormat& rOldFormat, const SwDoc& rDoc) - : SwUndo(SwUndoId::TBLSTYLE_UPDATE, &rDoc) + : SwUndo(SwUndoId::TBLSTYLE_UPDATE, rDoc) , m_pOldFormat(new SwTableAutoFormat(rOldFormat)) , m_pNewFormat(new SwTableAutoFormat(rNewFormat)) { } diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index 8c5288aed0bd..551155baa87a 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -65,7 +65,7 @@ GetFlysAnchoredAt(SwDoc & rDoc, SwNodeOffset const nSttNode, bool const isAtPage //note: parameter is SwPam just so we can init SwUndRng, the End is ignored! SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam ) - : SwUndo( nUndoId, &rPam.GetDoc() ) + : SwUndo( nUndoId, rPam.GetDoc() ) , SwUndRng( rPam ) , m_pTextFormatColl(nullptr) , m_pLastNodeColl(nullptr)
