sw/inc/pam.hxx | 2 sw/inc/redline.hxx | 2 sw/source/core/access/accpara.cxx | 6 sw/source/core/crsr/findattr.cxx | 24 +- sw/source/core/crsr/findcoll.cxx | 18 - sw/source/core/crsr/findtxt.cxx | 18 - sw/source/core/crsr/pam.cxx | 20 +- sw/source/core/crsr/swcrsr.cxx | 66 +++---- sw/source/core/crsr/trvlfnfl.cxx | 6 sw/source/core/crsr/trvlreg.cxx | 4 sw/source/core/crsr/trvltbl.cxx | 4 sw/source/core/crsr/viscrs.cxx | 4 sw/source/core/doc/CntntIdxStore.cxx | 76 ++++---- sw/source/core/doc/DocumentContentOperationsManager.cxx | 26 +- sw/source/core/doc/DocumentRedlineManager.cxx | 22 +- sw/source/core/doc/docbm.cxx | 2 sw/source/core/doc/doccomp.cxx | 30 +-- sw/source/core/doc/docedt.cxx | 20 +- sw/source/core/doc/docnew.cxx | 2 sw/source/core/doc/docnum.cxx | 2 sw/source/core/doc/docredln.cxx | 149 +++++++--------- sw/source/core/doc/extinput.cxx | 24 +- sw/source/core/doc/swserv.cxx | 2 sw/source/core/frmedt/fecopy.cxx | 4 sw/source/core/frmedt/tblsel.cxx | 4 sw/source/core/txtnode/atrfld.cxx | 8 sw/source/core/undo/unattr.cxx | 20 +- sw/source/core/undo/undel.cxx | 32 +-- sw/source/core/undo/undobj.cxx | 16 - sw/source/core/undo/unfmco.cxx | 2 sw/source/core/undo/unins.cxx | 4 sw/source/core/undo/unmove.cxx | 12 - sw/source/core/undo/unnum.cxx | 8 sw/source/core/undo/unoutl.cxx | 2 sw/source/core/undo/unovwr.cxx | 2 sw/source/core/undo/unredln.cxx | 22 +- sw/source/core/undo/unsect.cxx | 4 sw/source/core/undo/unsort.cxx | 4 sw/source/core/undo/unspnd.cxx | 16 - sw/source/core/undo/untbl.cxx | 6 sw/source/core/undo/untblk.cxx | 44 ++-- sw/source/core/unocore/unocrsr.cxx | 14 - sw/source/core/unocore/unocrsrhelper.cxx | 92 ++++----- sw/source/core/unocore/unodraw.cxx | 2 sw/source/core/unocore/unofield.cxx | 2 sw/source/core/unocore/unoidx.cxx | 8 sw/source/core/unocore/unoobj.cxx | 108 +++++------ sw/source/core/unocore/unoobj2.cxx | 52 ++--- sw/source/core/unocore/unoparagraph.cxx | 6 sw/source/core/unocore/unoport.cxx | 4 sw/source/core/unocore/unoportenum.cxx | 67 +++---- sw/source/core/unocore/unoredline.cxx | 10 - sw/source/core/unocore/unorefmk.cxx | 8 sw/source/core/unocore/unotbl.cxx | 48 ++--- sw/source/filter/basflt/shellio.cxx | 8 sw/source/filter/writer/writer.cxx | 6 sw/source/filter/ww8/wrtww8.cxx | 2 sw/source/filter/ww8/ww8atr.cxx | 2 sw/source/filter/ww8/ww8par5.cxx | 2 sw/source/filter/xml/swxml.cxx | 2 sw/source/filter/xml/xmlimp.cxx | 2 sw/source/uibase/dochdl/swdtflvr.cxx | 2 sw/source/uibase/shells/textfld.cxx | 2 sw/source/uibase/uno/unotxdoc.cxx | 6 sw/source/uibase/uno/unotxvw.cxx | 4 65 files changed, 594 insertions(+), 604 deletions(-)
New commits: commit 93099409f3e9894b7a40182f775d76757fa2fb5b Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Sep 30 10:10:08 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Sep 30 14:27:41 2020 +0200 SwPaM::GetDoc can return a reference instead and remove discovered redundant null checks Change-Id: Iac8ad7821d9acfcc9550a96402c02ac248f16f2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103672 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx index 6c87f3559b78..0f80752a276a 100644 --- a/sw/inc/pam.hxx +++ b/sw/inc/pam.hxx @@ -240,7 +240,7 @@ public: void Normalize(bool bPointFirst = true); /// @return the document (SwDoc) at which the PaM is registered - SwDoc* GetDoc() const { return &m_pPoint->nNode.GetNode().GetDoc(); } + SwDoc& GetDoc() const { return m_pPoint->nNode.GetNode().GetDoc(); } SwPosition& GetBound( bool bOne = true ) { return bOne ? m_Bound1 : m_Bound2; } diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index b3193395ebd9..3019d6d8a302 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -262,7 +262,7 @@ public: void MaybeNotifyRedlinePositionModification(long nTop); }; -void MaybeNotifyRedlineModification(SwRangeRedline* pRedline, SwDoc* pDoc); +void MaybeNotifyRedlineModification(SwRangeRedline& rRedline, SwDoc& rDoc); /// Base object for 'Redlines' that are not of 'Ranged' type (like table row insert\delete) class SW_DLLPUBLIC SwExtraRedline diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 7a8fb42f0c7a..001c32ade91b 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1650,7 +1650,7 @@ void SwAccessibleParagraph::_getRunAttributesImpl( } // retrieve character attributes for the created PaM <pPaM> - SfxItemSet aSet( pPaM->GetDoc()->GetAttrPool(), + SfxItemSet aSet( pPaM->GetDoc().GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END -1>{} ); // #i82637# // From the perspective of the a11y API the character attributes, which @@ -1661,7 +1661,7 @@ void SwAccessibleParagraph::_getRunAttributesImpl( { if ( pTextNode->HasSwAttrSet() ) { - SfxItemSet aAutomaticParaStyleCharAttrs( pPaM->GetDoc()->GetAttrPool(), + SfxItemSet aAutomaticParaStyleCharAttrs( pPaM->GetDoc().GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END -1>{} ); aAutomaticParaStyleCharAttrs.Put( *(pTextNode->GetpSwAttrSet()), false ); aSet.Put( aAutomaticParaStyleCharAttrs ); @@ -1669,7 +1669,7 @@ void SwAccessibleParagraph::_getRunAttributesImpl( } // get character attributes at <pPaM> and merge these into <aSet> { - SfxItemSet aCharAttrsAtPaM( pPaM->GetDoc()->GetAttrPool(), + SfxItemSet aCharAttrsAtPaM( pPaM->GetDoc().GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END -1>{} ); SwUnoCursorHelper::GetCursorAttr(*pPaM, aCharAttrsAtPaM, true); aSet.Put( aCharAttrsAtPaM ); diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 8d1cafd41c64..5824a83007fd 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -1057,7 +1057,7 @@ static bool FindAttrsImpl(SwPaM & rSearchPam, // check which text/char attributes are searched SwAttrCheckArr aCmpArr( rSet, bSrchForward, bNoColls ); - SfxItemSet aOtherSet( rSearchPam.GetDoc()->GetAttrPool(), + SfxItemSet aOtherSet( rSearchPam.GetDoc().GetAttrPool(), svl::Items<RES_PARATR_BEGIN, RES_GRFATR_END-1>{} ); aOtherSet.Put( rSet, false ); // got all invalid items @@ -1347,7 +1347,7 @@ int SwFindParaAttr::DoFind(SwPaM & rCursor, SwMoveFnCollection const & fnMove, xRepl = sw::ReplaceBackReferences(*pSearchOpt, &rCursor, m_pLayout); sw::ReplaceImpl(rCursor, xRepl ? *xRepl : pSearchOpt->replaceString, bRegExp, - *m_rCursor.GetDoc(), m_pLayout); + m_rCursor.GetDoc(), m_pLayout); m_rCursor.SaveTableBoxContent( rCursor.GetPoint() ); @@ -1372,7 +1372,7 @@ int SwFindParaAttr::DoFind(SwPaM & rCursor, SwMoveFnCollection const & fnMove, // they are not in ReplaceSet if( !pSet->Count() ) { - rCursor.GetDoc()->getIDocumentContentOperations().InsertItemSet( + rCursor.GetDoc().getIDocumentContentOperations().InsertItemSet( rCursor, *pReplSet, SetAttrMode::DEFAULT, m_pLayout); } else @@ -1392,7 +1392,7 @@ int SwFindParaAttr::DoFind(SwPaM & rCursor, SwMoveFnCollection const & fnMove, pItem = aIter.NextItem(); } while (pItem); aSet.Put( *pReplSet ); - rCursor.GetDoc()->getIDocumentContentOperations().InsertItemSet( + rCursor.GetDoc().getIDocumentContentOperations().InsertItemSet( rCursor, aSet, SetAttrMode::DEFAULT, m_pLayout); } @@ -1417,30 +1417,30 @@ sal_uLong SwCursor::FindAttrs( const SfxItemSet& rSet, bool bNoCollections, SwRootFrame const*const pLayout) { // switch off OLE-notifications - SwDoc* pDoc = GetDoc(); - Link<bool,void> aLnk( pDoc->GetOle2Link() ); - pDoc->SetOle2Link( Link<bool,void>() ); + SwDoc& rDoc = GetDoc(); + Link<bool,void> aLnk( rDoc.GetOle2Link() ); + rDoc.SetOle2Link( Link<bool,void>() ); bool bReplace = ( pSearchOpt && ( !pSearchOpt->replaceString.isEmpty() || !rSet.Count() ) ) || (pReplSet && pReplSet->Count()); - bool const bStartUndo = pDoc->GetIDocumentUndoRedo().DoesUndo() && bReplace; + bool const bStartUndo = rDoc.GetIDocumentUndoRedo().DoesUndo() && bReplace; if (bStartUndo) { - pDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::REPLACE, nullptr ); + rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::REPLACE, nullptr ); } SwFindParaAttr aSwFindParaAttr( rSet, bNoCollections, pSearchOpt, pReplSet, *this, pLayout ); sal_uLong nRet = FindAll( aSwFindParaAttr, nStart, nEnd, eFndRngs, bCancel ); - pDoc->SetOle2Link( aLnk ); + rDoc.SetOle2Link( aLnk ); if( nRet && bReplace ) - pDoc->getIDocumentState().SetModified(); + rDoc.getIDocumentState().SetModified(); if (bStartUndo) { - pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::REPLACE, nullptr ); + rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::REPLACE, nullptr ); } return nRet; diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx index 8385e0a4cf24..ad43b7afec44 100644 --- a/sw/source/core/crsr/findcoll.cxx +++ b/sw/source/core/crsr/findcoll.cxx @@ -59,7 +59,7 @@ int SwFindParaFormatColl::DoFind(SwPaM & rCursor, SwMoveFnCollection const & fnM nRet = FIND_NOT_FOUND; else if( pReplColl ) { - rCursor.GetDoc()->SetTextFormatColl(rCursor, + rCursor.GetDoc().SetTextFormatColl(rCursor, const_cast<SwTextFormatColl*>(pReplColl), true, false, m_pLayout); nRet = FIND_NO_RING; } @@ -78,12 +78,12 @@ sal_uLong SwCursor::FindFormat( const SwTextFormatColl& rFormatColl, SwDocPositi SwRootFrame const*const pLayout) { // switch off OLE-notifications - SwDoc* pDoc = GetDoc(); - Link<bool,void> aLnk( pDoc->GetOle2Link() ); - pDoc->SetOle2Link( Link<bool,void>() ); + SwDoc& rDoc = GetDoc(); + Link<bool,void> aLnk( rDoc.GetOle2Link() ); + rDoc.SetOle2Link( Link<bool,void>() ); bool const bStartUndo = - pDoc->GetIDocumentUndoRedo().DoesUndo() && pReplFormatColl; + rDoc.GetIDocumentUndoRedo().DoesUndo() && pReplFormatColl; if (bStartUndo) { SwRewriter aRewriter; @@ -91,21 +91,21 @@ sal_uLong SwCursor::FindFormat( const SwTextFormatColl& rFormatColl, SwDocPositi aRewriter.AddRule(UndoArg2, SwResId(STR_YIELDS)); aRewriter.AddRule(UndoArg3, pReplFormatColl->GetName()); - pDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::UI_REPLACE_STYLE, + rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::UI_REPLACE_STYLE, &aRewriter ); } SwFindParaFormatColl aSwFindParaFormatColl(rFormatColl, pReplFormatColl, pLayout); sal_uLong nRet = FindAll( aSwFindParaFormatColl, nStart, nEnd, eFndRngs, bCancel ); - pDoc->SetOle2Link( aLnk ); + rDoc.SetOle2Link( aLnk ); if( nRet && pReplFormatColl ) - pDoc->getIDocumentState().SetModified(); + rDoc.getIDocumentState().SetModified(); if (bStartUndo) { - pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::END, nullptr); + rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::END, nullptr); } return nRet; } diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 047e3db0127b..f19f3ff908eb 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -976,7 +976,7 @@ int SwFindParaText::DoFind(SwPaM & rCursor, SwMoveFnCollection const & fnMove, xRepl = sw::ReplaceBackReferences(m_rSearchOpt, &rCursor, m_pLayout); bool const bReplaced = sw::ReplaceImpl(rCursor, xRepl ? *xRepl : m_rSearchOpt.replaceString, - bRegExp, *m_rCursor.GetDoc(), m_pLayout); + bRegExp, m_rCursor.GetDoc(), m_pLayout); m_rCursor.SaveTableBoxContent( rCursor.GetPoint() ); @@ -1016,14 +1016,14 @@ sal_uLong SwCursor::Find_Text( const i18nutil::SearchOptions2& rSearchOpt, bool SwRootFrame const*const pLayout) { // switch off OLE-notifications - SwDoc* pDoc = GetDoc(); - Link<bool,void> aLnk( pDoc->GetOle2Link() ); - pDoc->SetOle2Link( Link<bool,void>() ); + SwDoc& rDoc = GetDoc(); + Link<bool,void> aLnk( rDoc.GetOle2Link() ); + rDoc.SetOle2Link( Link<bool,void>() ); - bool const bStartUndo = pDoc->GetIDocumentUndoRedo().DoesUndo() && bReplace; + bool const bStartUndo = rDoc.GetIDocumentUndoRedo().DoesUndo() && bReplace; if (bStartUndo) { - pDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::REPLACE, nullptr ); + rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::REPLACE, nullptr ); } bool bSearchSel = 0 != (rSearchOpt.searchFlag & SearchFlags::REG_NOT_BEGINOFLINE); @@ -1031,15 +1031,15 @@ sal_uLong SwCursor::Find_Text( const i18nutil::SearchOptions2& rSearchOpt, bool eFndRngs = static_cast<FindRanges>(eFndRngs | FindRanges::InSel); SwFindParaText aSwFindParaText(rSearchOpt, bSearchInNotes, bReplace, *this, pLayout); sal_uLong nRet = FindAll( aSwFindParaText, nStart, nEnd, eFndRngs, bCancel ); - pDoc->SetOle2Link( aLnk ); + rDoc.SetOle2Link( aLnk ); if( nRet && bReplace ) - pDoc->getIDocumentState().SetModified(); + rDoc.getIDocumentState().SetModified(); if (bStartUndo) { SwRewriter rewriter(MakeUndoReplaceRewriter( nRet, rSearchOpt.searchString, rSearchOpt.replaceString)); - pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::REPLACE, & rewriter ); + rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::REPLACE, & rewriter ); } return nRet; } diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index fb7aa7cd38a5..e73885ff6008 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -698,7 +698,7 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const // (TextNd, SectNd, TextNd, EndNd, TextNd ) if( nSttIdx + 3 < nEndIdx ) { - const SwSectionFormats& rFormats = GetDoc()->GetSections(); + const SwSectionFormats& rFormats = GetDoc().GetSections(); for( SwSectionFormats::size_type n = rFormats.size(); n; ) { const SwSectionFormat* pFormat = rFormats[ --n ]; @@ -719,9 +719,9 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const } } - const SwDoc *pDoc = GetDoc(); + const SwDoc& rDoc = GetDoc(); // Legacy text/combo/checkbox: never return read-only when inside these form fields. - const IDocumentMarkAccess* pMarksAccess = pDoc->getIDocumentMarkAccess(); + const IDocumentMarkAccess* pMarksAccess = rDoc.getIDocumentMarkAccess(); sw::mark::IFieldmark* pA = GetPoint() ? pMarksAccess->getFieldmarkFor( *GetPoint( ) ) : nullptr; sw::mark::IFieldmark* pB = GetMark() ? pMarksAccess->getFieldmarkFor( *GetMark( ) ) : pA; // prevent the user from accidentally deleting the field itself when modifying the text. @@ -744,7 +744,7 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const // touches fields, or fully encloses it), then don't disable editing bRet = !( ( !pA || bAtStartA ) && ( !pB || bAtStartB ) ); } - if( !bRet && pDoc->GetDocumentSettingManager().get( DocumentSettingId::PROTECT_FORM ) && (pA || pB) ) + if( !bRet && rDoc.GetDocumentSettingManager().get( DocumentSettingId::PROTECT_FORM ) && (pA || pB) ) { // Form protection case bRet = ( pA == nullptr ) || ( pB == nullptr ) || bAtStartA || bAtStartB; @@ -760,20 +760,20 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const if (!bRet) { // Paragraph Signatures and Classification fields are read-only. - if (pDoc && pDoc->GetEditShell()) - bRet = pDoc->GetEditShell()->IsCursorInParagraphMetadataField(); + if (rDoc.GetEditShell()) + bRet = rDoc.GetEditShell()->IsCursorInParagraphMetadataField(); } if (!bRet && - pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_BOOKMARKS)) + rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_BOOKMARKS)) { - if (pDoc->getIDocumentMarkAccess()->isBookmarkDeleted(*this)) + if (rDoc.getIDocumentMarkAccess()->isBookmarkDeleted(*this)) { return true; } } if (!bRet && - pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FIELDS)) + rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FIELDS)) { SwPosition const& rStart(*Start()); SwPosition const& rEnd(*End()); @@ -817,7 +817,7 @@ SwContentNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFnCollection const & bool const bInReadOnly, SwRootFrame const*const i_pLayout) { SwRootFrame const*const pLayout(i_pLayout ? i_pLayout : - rPam.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()); + rPam.GetDoc().getIDocumentLayoutAccess().GetCurrentLayout()); SwContentNode * pNd = nullptr; if( ((*rPam.GetPoint()).*fnMove.fnCmpOp)( *rPam.GetMark() ) || ( *rPam.GetPoint() == *rPam.GetMark() && rbFirst ) ) diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 2e1a19338a52..e3c45e3b808e 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -81,7 +81,7 @@ struct PercentHdl } explicit PercentHdl( const SwPaM& rPam ) - : pDSh( rPam.GetDoc()->GetDocShell() ) + : pDSh( rPam.GetDoc().GetDocShell() ) { sal_uLong nStt, nEnd; if( rPam.GetPoint()->nNode == rPam.GetMark()->nNode ) @@ -183,7 +183,7 @@ void SwCursor::RestoreState() bool SwCursor::IsNoContent() const { return GetPoint()->nNode.GetIndex() < - GetDoc()->GetNodes().GetEndOfExtras().GetIndex(); + GetDoc().GetNodes().GetEndOfExtras().GetIndex(); } bool SwCursor::IsSelOvrCheck(SwCursorSelOverFlags) @@ -194,7 +194,7 @@ bool SwCursor::IsSelOvrCheck(SwCursorSelOverFlags) // extracted from IsSelOvr() bool SwTableCursor::IsSelOvrCheck(SwCursorSelOverFlags eFlags) { - SwNodes& rNds = GetDoc()->GetNodes(); + SwNodes& rNds = GetDoc().GetNodes(); // check sections of nodes array if( (SwCursorSelOverFlags::CheckNodeSection & eFlags) && HasMark() ) @@ -223,8 +223,8 @@ namespace bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) { - SwDoc* pDoc = GetDoc(); - SwNodes& rNds = pDoc->GetNodes(); + SwDoc& rDoc = GetDoc(); + SwNodes& rNds = rDoc.GetNodes(); bool bSkipOverHiddenSections = IsSkipOverHiddenSections(); bool bSkipOverProtectSections = IsSkipOverProtectSections(); @@ -236,7 +236,7 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) if (m_vSavePos.back().nNode != GetPoint()->nNode.GetIndex() && // (1997) in UI-ReadOnly everything is allowed - ( !pDoc->GetDocShell() || !pDoc->GetDocShell()->IsReadOnlyUI() )) + ( !rDoc.GetDocShell() || !rDoc.GetDocShell()->IsReadOnlyUI() )) { // check new sections SwNodeIndex& rPtIdx = GetPoint()->nNode; @@ -308,7 +308,7 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) nEndIdx = nTmp; } - const SwSectionFormats& rFormats = pDoc->GetSections(); + const SwSectionFormats& rFormats = rDoc.GetSections(); for( SwSectionFormats::size_type n = 0; n < rFormats.size(); ++n ) { const SwSectionFormat* pFormat = rFormats[n]; @@ -336,7 +336,7 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) const SwNode* pNd = &GetPoint()->nNode.GetNode(); if( pNd->IsContentNode() && !dynamic_cast<SwUnoCursor*>(this) ) { - const SwContentFrame* pFrame = static_cast<const SwContentNode*>(pNd)->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); + const SwContentFrame* pFrame = static_cast<const SwContentNode*>(pNd)->getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ); if ( (SwCursorSelOverFlags::ChangePos & eFlags) //allowed to change position if it's a bad one && pFrame && pFrame->isFrameAreaDefinitionValid() && !pFrame->getFrameArea().Height() //a bad zero height position @@ -357,7 +357,7 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) if( !pFrame ) { bGoNxt = !bGoNxt; - pFrame = static_cast<const SwContentNode*>(pNd)->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); + pFrame = static_cast<const SwContentNode*>(pNd)->getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ); while ( pFrame && 0 == pFrame->getFrameArea().Height() ) { pFrame = bGoNxt ? pFrame->GetNextContentFrame() @@ -434,7 +434,7 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags ) pNd = &GetMark()->nNode.GetNode(); if( pNd->IsContentNode() - && !static_cast<const SwContentNode*>(pNd)->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) + && !static_cast<const SwContentNode*>(pNd)->getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ) && !dynamic_cast<SwUnoCursor*>(this) ) { DeleteMark(); @@ -717,18 +717,18 @@ SetPrevCursor: /// Return <true> if cursor can be set to this position bool SwCursor::IsAtValidPos( bool bPoint ) const { - const SwDoc* pDoc = GetDoc(); + const SwDoc& rDoc = GetDoc(); const SwPosition* pPos = bPoint ? GetPoint() : GetMark(); const SwNode* pNd = &pPos->nNode.GetNode(); - if( pNd->IsContentNode() && !static_cast<const SwContentNode*>(pNd)->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) && + if( pNd->IsContentNode() && !static_cast<const SwContentNode*>(pNd)->getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ) && !dynamic_cast<const SwUnoCursor*>(this) ) { return false; } // #i45129# - in UI-ReadOnly everything is allowed - if( !pDoc->GetDocShell() || !pDoc->GetDocShell()->IsReadOnlyUI() ) + if( !rDoc.GetDocShell() || !rDoc.GetDocShell()->IsReadOnlyUI() ) return true; const bool bCursorInReadOnly = IsReadOnlyAvailable(); @@ -763,8 +763,8 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCurso SwPaM& aRegion, FindRanges eFndRngs, bool bInReadOnly, bool& bCancel ) { - SwDoc* pDoc = pCurrentCursor->GetDoc(); - bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + SwDoc& rDoc = pCurrentCursor->GetDoc(); + bool const bDoesUndo = rDoc.GetIDocumentUndoRedo().DoesUndo(); int nFndRet = 0; sal_uLong nFound = 0; const bool bSrchBkwrd = &fnMove == &fnMoveBackward; @@ -780,7 +780,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCurso while( pCurrentCursor != ( pTmpCursor = pTmpCursor->GetNext() )) ++nCursorCnt; if( nCursorCnt && !bIsUnoCursor ) - pPHdl.reset(new PercentHdl( 0, nCursorCnt, pDoc->GetDocShell() )); + pPHdl.reset(new PercentHdl( 0, nCursorCnt, rDoc.GetDocShell() )); } else pSaveCursor = pSaveCursor->GetPrev(); @@ -829,14 +829,14 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCurso } if ((coSrchRplcThreshold == nFound) - && pDoc->GetIDocumentUndoRedo().DoesUndo() + && rDoc.GetIDocumentUndoRedo().DoesUndo() && rParas.IsReplaceMode()) { short nRet = pCurrentCursor->MaxReplaceArived(); if( RET_YES == nRet ) { - pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); - pDoc->GetIDocumentUndoRedo().DoUndo(false); + rDoc.GetIDocumentUndoRedo().DelAllUndoObj(); + rDoc.GetIDocumentUndoRedo().DoUndo(false); } else { @@ -880,7 +880,7 @@ static sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurrentCurso if( nFound && !pFndRing ) // if no ring should be created pFndRing = pCurrentCursor->Create(); - pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); + rDoc.GetIDocumentUndoRedo().DoUndo(bDoesUndo); return nFound; } @@ -890,7 +890,7 @@ static bool lcl_MakeSelFwrd( const SwNode& rSttNd, const SwNode& rEndNd, if( rSttNd.GetIndex() + 1 == rEndNd.GetIndex() ) return false; - SwNodes& rNds = rPam.GetDoc()->GetNodes(); + SwNodes& rNds = rPam.GetDoc().GetNodes(); rPam.DeleteMark(); SwContentNode* pCNd; if( !bFirst ) @@ -922,7 +922,7 @@ static bool lcl_MakeSelBkwrd( const SwNode& rSttNd, const SwNode& rEndNd, if( rEndNd.GetIndex() + 1 == rSttNd.GetIndex() ) return false; - SwNodes& rNds = rPam.GetDoc()->GetNodes(); + SwNodes& rNds = rPam.GetDoc().GetNodes(); rPam.DeleteMark(); SwContentNode* pCNd; if( !bFirst ) @@ -966,7 +966,7 @@ sal_uLong SwCursor::FindAll( SwFindParas& rParas, std::unique_ptr<SvxSearchItem> xSearchItem; SwCursor* pFndRing = nullptr; - SwNodes& rNds = GetDoc()->GetNodes(); + SwNodes& rNds = GetDoc().GetNodes(); // search in sections? if( FindRanges::InSel & eFndRngs ) @@ -1106,7 +1106,7 @@ void SwCursor::FillFindPos( SwDocPositions ePos, SwPosition& rPos ) const { bool bIsStart = true; SwContentNode* pCNd = nullptr; - SwNodes& rNds = GetDoc()->GetNodes(); + SwNodes& rNds = GetDoc().GetNodes(); switch( ePos ) { @@ -1431,7 +1431,7 @@ bool SwCursor::SelectWordWT( SwViewShell const * pViewShell, sal_Int16 nWordType if (pTextNd) { // Should we select the whole fieldmark? - const IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( ); + const IDocumentMarkAccess* pMarksAccess = GetDoc().getIDocumentMarkAccess( ); sw::mark::IFieldmark const*const pMark(pMarksAccess->getFieldmarkFor(*GetPoint())); if (pMark && (IDocumentMarkAccess::GetType(*pMark) == IDocumentMarkAccess::MarkType::TEXT_FIELDMARK || IDocumentMarkAccess::GetType(*pMark) == IDocumentMarkAccess::MarkType::DATE_FIELDMARK)) @@ -1708,7 +1708,7 @@ SwCursor::DoSetBidiLevelLeftRight( Point aPt; std::pair<Point, bool> const tmp(aPt, true); pSttFrame = rTNd.getLayoutFrame( - GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), GetPoint(), &tmp); if( pSttFrame ) { @@ -1854,7 +1854,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, SwNodeIndex aNewIdx( *pTableBox->GetSttNd() ); rPtIdx = aNewIdx; - GetDoc()->GetNodes().GoNextSection( &rPtIdx, false, false ); + GetDoc().GetNodes().GoNextSection( &rPtIdx, false, false ); SwContentNode* pContentNode = GetContentNode(); if ( pContentNode ) { @@ -1887,7 +1887,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, SwNodeIndex aNewIdx( *pTableBox->GetSttNd() ); rPtIdx = aNewIdx; - GetDoc()->GetNodes().GoNextSection( &rPtIdx, false, false ); + GetDoc().GetNodes().GoNextSection( &rPtIdx, false, false ); SwContentNode* pContentNode = GetContentNode(); if ( pContentNode ) { @@ -1907,7 +1907,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, Point aPt; std::pair<Point, bool> const tmp(aPt, true); const SwContentFrame* pEndFrame = rTmpNode.GetTextNode()->getLayoutFrame( - GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), + GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), GetPoint(), &tmp); if ( pEndFrame ) { @@ -2073,7 +2073,7 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt, //Update cursor to change nUpDownX. if ( aOldPos.nContent.GetIndex() == nOffset ) { - GetDoc()->GetEditShell()->UpdateCursor(); + GetDoc().GetEditShell()->UpdateCursor(); bRet = false; } else{ @@ -2200,7 +2200,7 @@ bool SwCursor::GoPrevNextCell( bool bNext, sal_uInt16 nCnt ) ++rPtIdx; if( !rPtIdx.GetNode().IsContentNode() ) - GetDoc()->GetNodes().GoNextSection( &rPtIdx, true, false ); + GetDoc().GetNodes().GoNextSection( &rPtIdx, true, false ); GetPoint()->nContent.Assign( GetContentNode(), 0 ); return !IsInProtectTable( true ); @@ -2216,7 +2216,7 @@ bool SwCursor::GotoTable( const OUString& rName ) bool bRet = false; if ( !HasMark() ) { - SwTable* pTmpTable = SwTable::FindTable( GetDoc()->FindTableFormatByName( rName ) ); + SwTable* pTmpTable = SwTable::FindTable( GetDoc().FindTableFormatByName( rName ) ); if( pTmpTable ) { // a table in a normal nodes array @@ -2391,7 +2391,7 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pCurrentCursor ) SwSelBoxes aTmp(m_SelectedBoxes); // compare old and new ones - SwNodes& rNds = pCurrentCursor->GetDoc()->GetNodes(); + SwNodes& rNds = pCurrentCursor->GetDoc().GetNodes(); const SwStartNode* pSttNd; SwPaM* pCur = pCurrentCursor; do { diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx index 9baa0761c06a..c93faffff95b 100644 --- a/sw/source/core/crsr/trvlfnfl.cxx +++ b/sw/source/core/crsr/trvlfnfl.cxx @@ -67,7 +67,7 @@ bool SwCursor::GotoFootnoteText() SwCursorSaveState aSaveState( *this ); GetPoint()->nNode = *static_cast<SwTextFootnote*>(pFootnote)->GetStartNode(); - SwContentNode* pCNd = GetDoc()->GetNodes().GoNextSection( + SwContentNode* pCNd = GetDoc().GetNodes().GoNextSection( &GetPoint()->nNode, true, !IsReadOnlyAvailable() ); if( pCNd ) @@ -188,7 +188,7 @@ static bool CmpL( const SwTextFootnote& rFootnote, sal_uLong nNd, sal_Int32 nCnt bool SwCursor::GotoNextFootnoteAnchor() { - const SwFootnoteIdxs& rFootnoteArr = GetDoc()->GetFootnoteIdxs(); + const SwFootnoteIdxs& rFootnoteArr = GetDoc().GetFootnoteIdxs(); const SwTextFootnote* pTextFootnote = nullptr; size_t nPos = 0; @@ -261,7 +261,7 @@ bool SwCursor::GotoNextFootnoteAnchor() bool SwCursor::GotoPrevFootnoteAnchor() { - const SwFootnoteIdxs& rFootnoteArr = GetDoc()->GetFootnoteIdxs(); + const SwFootnoteIdxs& rFootnoteArr = GetDoc().GetFootnoteIdxs(); const SwTextFootnote* pTextFootnote = nullptr; size_t nPos = 0; diff --git a/sw/source/core/crsr/trvlreg.cxx b/sw/source/core/crsr/trvlreg.cxx index 1648caf8f162..190edf13f0a8 100644 --- a/sw/source/core/crsr/trvlreg.cxx +++ b/sw/source/core/crsr/trvlreg.cxx @@ -38,7 +38,7 @@ bool GotoPrevRegion( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosRegi aIdx.Assign( *pNd, - 1 ); SwNodeIndex aOldIdx = aIdx; - sal_uLong nLastNd = rCurrentCursor.GetDoc()->GetNodes().Count() - 1; + sal_uLong nLastNd = rCurrentCursor.GetDoc().GetNodes().Count() - 1; do { while( aIdx.GetIndex() ) { @@ -245,7 +245,7 @@ bool SwCursorShell::MoveRegion( SwWhichRegion fnWhichRegion, SwMoveFnCollection bool SwCursor::GotoRegion( const OUString& rName ) { bool bRet = false; - const SwSectionFormats& rFormats = GetDoc()->GetSections(); + const SwSectionFormats& rFormats = GetDoc().GetSections(); for( SwSectionFormats::size_type n = rFormats.size(); n; ) { const SwSectionFormat* pFormat = rFormats[ --n ]; diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 533f17907b05..835304a9e6c9 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -500,7 +500,7 @@ bool GotoPrevTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable } SwNodeIndex aOldIdx = aIdx; - sal_uLong nLastNd = rCurrentCursor.GetDoc()->GetNodes().Count() - 1; + sal_uLong nLastNd = rCurrentCursor.GetDoc().GetNodes().Count() - 1; do { while( aIdx.GetIndex() && nullptr == ( pTableNd = aIdx.GetNode().StartOfSectionNode()->GetTableNode()) ) @@ -569,7 +569,7 @@ bool GotoNextTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable aIdx.Assign( *pTableNd->EndOfSectionNode(), 1 ); SwNodeIndex aOldIdx = aIdx; - sal_uLong nLastNd = rCurrentCursor.GetDoc()->GetNodes().Count() - 1; + sal_uLong nLastNd = rCurrentCursor.GetDoc().GetNodes().Count() - 1; do { while( aIdx.GetIndex() < nLastNd && nullptr == ( pTableNd = aIdx.GetNode().GetTableNode()) ) diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 9a949d6479a2..c4d88972bb70 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -842,7 +842,7 @@ void SwShellTableCursor::FillRects() SwRegionRects aReg( GetShell()->VisArea() ); if (comphelper::LibreOfficeKit::isActive()) aReg = GetShell()->getIDocumentLayoutAccess().GetCurrentLayout()->getFrameArea(); - SwNodes& rNds = GetDoc()->GetNodes(); + SwNodes& rNds = GetDoc().GetNodes(); SwFrame* pEndFrame = nullptr; for (size_t n = 0; n < m_SelectedBoxes.size(); ++n) { @@ -908,7 +908,7 @@ bool SwShellTableCursor::IsInside( const Point& rPt ) const if (m_SelectedBoxes.empty() || m_bParked || !GetPoint()->nNode.GetIndex()) return false; - SwNodes& rNds = GetDoc()->GetNodes(); + SwNodes& rNds = GetDoc().GetNodes(); for (size_t n = 0; n < m_SelectedBoxes.size(); ++n) { SwNodeIndex aIdx( *m_SelectedBoxes[n]->GetSttNd() ); diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx index 57e700182662..145126ea3633 100644 --- a/sw/source/core/doc/CntntIdxStore.cxx +++ b/sw/source/core/doc/CntntIdxStore.cxx @@ -142,11 +142,11 @@ namespace } virtual void Save(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit=false) override { - SaveBkmks(&rDoc, nNode, nContent); - SaveRedlines(&rDoc, nNode, nContent); - SaveFlys(&rDoc, nNode, nContent, bSaveFlySplit); - SaveUnoCursors(&rDoc, nNode, nContent); - SaveShellCursors(&rDoc, nNode, nContent); + SaveBkmks(rDoc, nNode, nContent); + SaveRedlines(rDoc, nNode, nContent); + SaveFlys(rDoc, nNode, nContent, bSaveFlySplit); + SaveUnoCursors(rDoc, nNode, nContent); + SaveShellCursors(rDoc, nNode, nContent); } virtual void Restore(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false, RestoreMode eMode = RestoreMode::All) override { @@ -154,14 +154,14 @@ namespace updater_t aUpdater = OffsetUpdater(pCNd, nOffset); if (eMode & RestoreMode::NonFlys) { - RestoreBkmks(&rDoc, aUpdater); - RestoreRedlines(&rDoc, aUpdater); + RestoreBkmks(rDoc, aUpdater); + RestoreRedlines(rDoc, aUpdater); RestoreUnoCursors(aUpdater); RestoreShellCursors(aUpdater); } if (eMode & RestoreMode::Flys) { - RestoreFlys(&rDoc, aUpdater, bAuto); + RestoreFlys(rDoc, aUpdater, bAuto); } } virtual void Restore(SwNode& rNd, sal_Int32 nLen, sal_Int32 nCorrLen, RestoreMode eMode = RestoreMode::All) override @@ -171,27 +171,27 @@ namespace updater_t aUpdater = LimitUpdater(pCNd, nLen, nCorrLen); if (eMode & RestoreMode::NonFlys) { - RestoreBkmks(&rDoc, aUpdater); - RestoreRedlines(&rDoc, aUpdater); + RestoreBkmks(rDoc, aUpdater); + RestoreRedlines(rDoc, aUpdater); RestoreUnoCursors(aUpdater); RestoreShellCursors(aUpdater); } if (eMode & RestoreMode::Flys) { - RestoreFlys(&rDoc, aUpdater, false); + RestoreFlys(rDoc, aUpdater, false); } } private: - void SaveBkmks(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent); - void RestoreBkmks(SwDoc* pDoc, updater_t const & rUpdater); - void SaveRedlines(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent); - void RestoreRedlines(SwDoc* pDoc, updater_t const & rUpdater); - void SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit); - void RestoreFlys(SwDoc* pDoc, updater_t const & rUpdater, bool bAuto); - void SaveUnoCursors(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent); + void SaveBkmks(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent); + void RestoreBkmks(SwDoc& rDoc, updater_t const & rUpdater); + void SaveRedlines(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent); + void RestoreRedlines(SwDoc& rDoc, updater_t const & rUpdater); + void SaveFlys(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit); + void RestoreFlys(SwDoc& rDoc, updater_t const & rUpdater, bool bAuto); + void SaveUnoCursors(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent); void RestoreUnoCursors(updater_t const & rUpdater); - void SaveShellCursors(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent); + void SaveShellCursors(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent); void RestoreShellCursors(updater_t const & rUpdater); static const SwPosition& GetRightMarkPos(::sw::mark::IMark const * pMark, bool bOther) { return bOther ? pMark->GetOtherMarkPos() : pMark->GetMarkPos(); }; @@ -227,9 +227,9 @@ namespace #endif } -void ContentIdxStoreImpl::SaveBkmks(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent) +void ContentIdxStoreImpl::SaveBkmks(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent) { - IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess(); const IDocumentMarkAccess::const_iterator_t ppBkmkEnd = pMarkAccess->getAllMarksEnd(); for( IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->getAllMarksBegin(); @@ -264,9 +264,9 @@ void ContentIdxStoreImpl::SaveBkmks(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCon } } -void ContentIdxStoreImpl::RestoreBkmks(SwDoc* pDoc, updater_t const & rUpdater) +void ContentIdxStoreImpl::RestoreBkmks(SwDoc& rDoc, updater_t const & rUpdater) { - IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess(); for (const MarkEntry& aEntry : m_aBkmkEntries) { if (MarkBase *const pMark = pMarkAccess->getAllMarksBegin().get()[aEntry.m_nIdx]) @@ -283,9 +283,9 @@ void ContentIdxStoreImpl::RestoreBkmks(SwDoc* pDoc, updater_t const & rUpdater) } } -void ContentIdxStoreImpl::SaveRedlines(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent) +void ContentIdxStoreImpl::SaveRedlines(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent) { - SwRedlineTable const & rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + SwRedlineTable const & rRedlineTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); long int nIdx = 0; for (const SwRangeRedline* pRdl : rRedlineTable) { @@ -311,9 +311,9 @@ void ContentIdxStoreImpl::SaveRedlines(SwDoc* pDoc, sal_uLong nNode, sal_Int32 n } } -void ContentIdxStoreImpl::RestoreRedlines(SwDoc* pDoc, updater_t const & rUpdater) +void ContentIdxStoreImpl::RestoreRedlines(SwDoc& rDoc, updater_t const & rUpdater) { - const SwRedlineTable& rRedlTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + const SwRedlineTable& rRedlTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); for (const MarkEntry& aEntry : m_aRedlineEntries) { SwPosition* const pPos = aEntry.m_bOther @@ -323,12 +323,12 @@ void ContentIdxStoreImpl::RestoreRedlines(SwDoc* pDoc, updater_t const & rUpdate } } -void ContentIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit) +void ContentIdxStoreImpl::SaveFlys(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit) { - SwContentNode *pNode = pDoc->GetNodes()[nNode]->GetContentNode(); + SwContentNode *pNode = rDoc.GetNodes()[nNode]->GetContentNode(); if( !pNode ) return; - SwFrame* pFrame = pNode->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); + SwFrame* pFrame = pNode->getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ); if( pFrame ) { // sw_redlinehide: this looks like an invalid optimisation if merged, @@ -338,7 +338,7 @@ void ContentIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCont return; // if we have a layout and no DrawObjs, we can skip this } MarkEntry aSave = { 0, false, 0 }; - for (const SwFrameFormat* pFrameFormat : *pDoc->GetSpzFrameFormats()) + for (const SwFrameFormat* pFrameFormat : *rDoc.GetSpzFrameFormats()) { if ( RES_FLYFRMFMT == pFrameFormat->Which() || RES_DRAWFRMFMT == pFrameFormat->Which() ) { @@ -369,9 +369,9 @@ void ContentIdxStoreImpl::SaveFlys(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCont } } -void ContentIdxStoreImpl::RestoreFlys(SwDoc* pDoc, updater_t const & rUpdater, bool bAuto) +void ContentIdxStoreImpl::RestoreFlys(SwDoc& rDoc, updater_t const & rUpdater, bool bAuto) { - SwFrameFormats* pSpz = pDoc->GetSpzFrameFormats(); + SwFrameFormats* pSpz = rDoc.GetSpzFrameFormats(); for (const MarkEntry& aEntry : m_aFlyEntries) { if(!aEntry.m_bOther) @@ -400,10 +400,10 @@ void ContentIdxStoreImpl::RestoreFlys(SwDoc* pDoc, updater_t const & rUpdater, b } } -void ContentIdxStoreImpl::SaveUnoCursors(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent) +void ContentIdxStoreImpl::SaveUnoCursors(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent) { - pDoc->cleanupUnoCursorTable(); - for (const auto& pWeakUnoCursor : pDoc->mvUnoCursorTable) + rDoc.cleanupUnoCursorTable(); + for (const auto& pWeakUnoCursor : rDoc.mvUnoCursorTable) { auto pUnoCursor(pWeakUnoCursor.lock()); if(!pUnoCursor) @@ -431,9 +431,9 @@ void ContentIdxStoreImpl::RestoreUnoCursors(updater_t const & rUpdater) } } -void ContentIdxStoreImpl::SaveShellCursors(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent) +void ContentIdxStoreImpl::SaveShellCursors(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent) { - SwCursorShell* pShell = pDoc->GetEditShell(); + SwCursorShell* pShell = rDoc.GetEditShell(); if( !pShell ) return; for(SwViewShell& rCurShell : pShell->GetRingContainer()) diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 267a02c0a1d4..fd7dd06a6cfa 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -142,7 +142,7 @@ namespace { SwNodeIndex const& rStart(rSourcePaM.Start()->nNode); // Special handling for SwDoc::AppendDoc - if (rSourcePaM.GetDoc()->GetNodes().GetEndOfExtras().GetIndex() + 1 + if (rSourcePaM.GetDoc().GetNodes().GetEndOfExtras().GetIndex() + 1 == rStart.GetIndex()) { rDelCount = 1; @@ -233,9 +233,9 @@ namespace sw // TODO: use SaveBookmark (from DelBookmarks) void CopyBookmarks(const SwPaM& rPam, SwPosition& rCpyPam) { - const SwDoc* pSrcDoc = rPam.GetDoc(); + const SwDoc& rSrcDoc = rPam.GetDoc(); SwDoc* pDestDoc = rCpyPam.GetDoc(); - const IDocumentMarkAccess* const pSrcMarkAccess = pSrcDoc->getIDocumentMarkAccess(); + const IDocumentMarkAccess* const pSrcMarkAccess = rSrcDoc.getIDocumentMarkAccess(); ::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo()); const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End(); @@ -336,12 +336,12 @@ namespace { void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam ) { - const SwDoc* pSrcDoc = rPam.GetDoc(); - const SwRedlineTable& rTable = pSrcDoc->getIDocumentRedlineAccess().GetRedlineTable(); + const SwDoc& rSrcDoc = rPam.GetDoc(); + const SwRedlineTable& rTable = rSrcDoc.getIDocumentRedlineAccess().GetRedlineTable(); if( rTable.empty() ) return; - SwDoc* pDestDoc = rCpyPam.GetDoc(); + SwDoc& rDestDoc = rCpyPam.GetDoc(); SwPosition* pCpyStt = rCpyPam.Start(), *pCpyEnd = rCpyPam.End(); std::unique_ptr<SwPaM> pDelPam; const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End(); @@ -350,7 +350,7 @@ namespace SwNodeIndex aCorrIdx(InitDelCount(rPam, nDelCount)); SwRedlineTable::size_type n = 0; - pSrcDoc->getIDocumentRedlineAccess().GetRedline( *pStt, &n ); + rSrcDoc.getIDocumentRedlineAccess().GetRedline( *pStt, &n ); for( ; n < rTable.size(); ++n ) { const SwRangeRedline* pRedl = rTable[ n ]; @@ -405,19 +405,19 @@ namespace if( !pDelPam ) return; - RedlineFlags eOld = pDestDoc->getIDocumentRedlineAccess().GetRedlineFlags(); - pDestDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld | RedlineFlags::Ignore ); + RedlineFlags eOld = rDestDoc.getIDocumentRedlineAccess().GetRedlineFlags(); + rDestDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld | RedlineFlags::Ignore ); - ::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo()); + ::sw::UndoGuard const undoGuard(rDestDoc.GetIDocumentUndoRedo()); do { - pDestDoc->getIDocumentContentOperations().DeleteAndJoin( *pDelPam->GetNext() ); + rDestDoc.getIDocumentContentOperations().DeleteAndJoin( *pDelPam->GetNext() ); if( !pDelPam->IsMultiSelection() ) break; delete pDelPam->GetNext(); } while( true ); - pDestDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + rDestDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); } void lcl_DeleteRedlines( const SwNodeRange& rRg, SwNodeRange const & rCpyRg ) @@ -508,7 +508,7 @@ namespace sw sal_uLong const nStartNode(rPam.Start()->nNode.GetIndex()); sal_uLong const nEndNode(rPam.End()->nNode.GetIndex()); SwNodes const& rNodes(rPam.GetPoint()->nNode.GetNodes()); - IDocumentMarkAccess const& rIDMA(*rPam.GetDoc()->getIDocumentMarkAccess()); + IDocumentMarkAccess const& rIDMA(*rPam.GetDoc().getIDocumentMarkAccess()); std::stack<std::tuple<sw::mark::IFieldmark const*, bool, sal_uLong, sal_Int32>> startedFields; diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index bbf4e816616e..3ab124787506 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -367,17 +367,17 @@ namespace if (pToNode != nullptr && pFromNode != nullptr && pToNode != pFromNode) { const SwPaM aPam(*pToNode); - SwDoc* pDoc = aPam.GetDoc(); + SwDoc& rDoc = aPam.GetDoc(); // using Undo, copy paragraph style SwTextFormatColl* pFromColl = pFromNode->GetTextColl(); SwTextFormatColl* pToColl = pToNode->GetTextColl(); if (bCopy && pFromColl != pToColl) - pDoc->SetTextFormatColl(aPam, pFromColl); + rDoc.SetTextFormatColl(aPam, pFromColl); // using Undo, remove direct paragraph formatting of the "To" paragraph, // and apply here direct paragraph formatting of the "From" paragraph SfxItemSet aTmp( - pDoc->GetAttrPool(), + rDoc.GetAttrPool(), svl::Items< RES_PARATR_BEGIN, RES_PARATR_END - 3, // skip RSID and GRABBAG RES_PARATR_LIST_BEGIN, RES_UL_SPACE, // skip PAGEDESC and BREAK @@ -401,7 +401,7 @@ namespace } if (bCopy && !bSameSet) - pDoc->getIDocumentContentOperations().InsertItemSet(aPam, aTmp2); + rDoc.getIDocumentContentOperations().InsertItemSet(aPam, aTmp2); else if (!bCopy && (!bSameSet || pFromColl != pToColl)) return new SwRedlineExtraData_FormatColl( pFromColl->GetName(), USHRT_MAX, &aTmp2 ); } @@ -480,7 +480,7 @@ namespace break; case RedlineType::Delete: { - SwDoc& rDoc = *pRedl->GetDoc(); + SwDoc& rDoc = pRedl->GetDoc(); const SwPosition *pDelStt = nullptr, *pDelEnd = nullptr; bool bDelRedl = false; switch( eCmp ) @@ -582,7 +582,7 @@ namespace { bool bRet = true; SwRangeRedline* pRedl = rArr[ rPos ]; - SwDoc& rDoc = *pRedl->GetDoc(); + SwDoc& rDoc = pRedl->GetDoc(); SwPosition *pRStt = nullptr, *pREnd = nullptr; SwComparePosition eCmp = SwComparePosition::Outside; if( pSttRng && pEndRng ) @@ -909,11 +909,11 @@ namespace SwPosition* pStt = rPam.Start(), * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark() : rPam.GetPoint(); - SwDoc* pDoc = rPam.GetDoc(); + SwDoc& rDoc = rPam.GetDoc(); if( !pStt->nContent.GetIndex() && - !pDoc->GetNodes()[ pStt->nNode.GetIndex() - 1 ]->IsContentNode() ) + !rDoc.GetNodes()[ pStt->nNode.GetIndex() - 1 ]->IsContentNode() ) { - const SwRangeRedline* pRedl = pDoc->getIDocumentRedlineAccess().GetRedline( *pStt, nullptr ); + const SwRangeRedline* pRedl = rDoc.getIDocumentRedlineAccess().GetRedline( *pStt, nullptr ); if( pRedl ) { const SwPosition* pRStt = pRedl->Start(); @@ -923,10 +923,10 @@ namespace } } if( pEnd->nNode.GetNode().IsContentNode() && - !pDoc->GetNodes()[ pEnd->nNode.GetIndex() + 1 ]->IsContentNode() && + !rDoc.GetNodes()[ pEnd->nNode.GetIndex() + 1 ]->IsContentNode() && pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetContentNode()->Len() ) { - const SwRangeRedline* pRedl = pDoc->getIDocumentRedlineAccess().GetRedline( *pEnd, nullptr ); + const SwRangeRedline* pRedl = rDoc.getIDocumentRedlineAccess().GetRedline( *pEnd, nullptr ); if( pRedl ) { const SwPosition* pREnd = pRedl->End(); diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index b9ab931ddc1b..749c473d8c56 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -527,7 +527,7 @@ void IDocumentMarkAccess::DeleteFieldmarkCommand(::sw::mark::IFieldmark const& r } SwPaM pam(sw::mark::FindFieldSep(rMark), rMark.GetMarkStart()); ++pam.GetPoint()->nContent; // skip CH_TXT_ATR_FIELDSTART - pam.GetDoc()->getIDocumentContentOperations().DeleteAndJoin(pam); + pam.GetDoc().getIDocumentContentOperations().DeleteAndJoin(pam); } namespace sw::mark diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 2b820d8d0500..6c4ff48e09ff 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1381,7 +1381,7 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine, SwPaM aCpyPam( rSrcNd, nSrcFrom ); aCpyPam.SetMark(); aCpyPam.GetPoint()->nContent = nSrcTo; - aCpyPam.GetDoc()->getIDocumentContentOperations().CopyRange( aCpyPam, *aPam.GetPoint(), + aCpyPam.GetDoc().getIDocumentContentOperations().CopyRange( aCpyPam, *aPam.GetPoint(), SwCopyFlags::CheckPosInFly); rDstDoc.GetIDocumentUndoRedo().DoUndo( bUndo ); @@ -1942,24 +1942,24 @@ SaveMergeRedline::SaveMergeRedline( const SwNode& rDstNd, sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline) { sal_uInt16 nIns = 0; - SwDoc* pDoc = pDestRedl->GetDoc(); + SwDoc& rDoc = pDestRedl->GetDoc(); if( RedlineType::Insert == pDestRedl->GetType() ) { // the part was inserted so copy it from the SourceDoc - ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); + ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); SwNodeIndex aSaveNd( pDestRedl->GetPoint()->nNode, -1 ); const sal_Int32 nSaveCnt = pDestRedl->GetPoint()->nContent.GetIndex(); - RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore); + RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); + rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore); - pSrcRedl->GetDoc()->getIDocumentContentOperations().CopyRange( + pSrcRedl->GetDoc().getIDocumentContentOperations().CopyRange( *const_cast<SwPaM*>(static_cast<const SwPaM*>(pSrcRedl)), *pDestRedl->GetPoint(), SwCopyFlags::CheckPosInFly); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); pDestRedl->SetMark(); ++aSaveNd; @@ -1979,10 +1979,10 @@ sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline) SwRedlineTable::size_type n = 0; // find the first redline for StartPos - if( !pDoc->getIDocumentRedlineAccess().GetRedline( *pDStt, &n ) && n ) + if( !rDoc.getIDocumentRedlineAccess().GetRedline( *pDStt, &n ) && n ) --n; - const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + const SwRedlineTable& rRedlineTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); for( ; n < rRedlineTable.size(); ++n ) { SwRangeRedline* pRedl = rRedlineTable[ n ]; @@ -2020,14 +2020,14 @@ sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline) *pCpyRedl->GetPoint() = *pRStt; std::unique_ptr<SwUndoCompDoc> pUndo; - if (pDoc->GetIDocumentUndoRedo().DoesUndo()) + if (rDoc.GetIDocumentUndoRedo().DoesUndo()) pUndo.reset(new SwUndoCompDoc( *pCpyRedl )); // now modify doc: append redline, undo (and count) - pDoc->getIDocumentRedlineAccess().AppendRedline( pCpyRedl, true ); + rDoc.getIDocumentRedlineAccess().AppendRedline( pCpyRedl, true ); if( pUndo ) { - pDoc->GetIDocumentUndoRedo().AppendUndo(std::move(pUndo)); + rDoc.GetIDocumentUndoRedo().AppendUndo(std::move(pUndo)); } ++nIns; @@ -2056,15 +2056,15 @@ sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline) if( pDestRedl ) { std::unique_ptr<SwUndoCompDoc> pUndo; - if (pDoc->GetIDocumentUndoRedo().DoesUndo()) + if (rDoc.GetIDocumentUndoRedo().DoesUndo()) pUndo.reset(new SwUndoCompDoc( *pDestRedl )); // now modify doc: append redline, undo (and count) IDocumentRedlineAccess::AppendResult const result( - pDoc->getIDocumentRedlineAccess().AppendRedline(pDestRedl, true)); + rDoc.getIDocumentRedlineAccess().AppendRedline(pDestRedl, true)); if( pUndo ) { - pDoc->GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) ); + rDoc.GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) ); } ++nIns; diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 70b09b5be20d..00d1dd842f6d 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -364,7 +364,7 @@ bool sw_JoinText( SwPaM& rPam, bool bJoinPrev ) if( pTextNd && pTextNd->CanJoinNext( &aIdx ) ) { - SwDoc* pDoc = rPam.GetDoc(); + SwDoc& rDoc = rPam.GetDoc(); if( bJoinPrev ) { // We do not need to handle xmlids in this case, because @@ -373,7 +373,7 @@ bool sw_JoinText( SwPaM& rPam, bool bJoinPrev ) { // If PageBreaks are deleted/set, it must not be added to the Undo history! // Also, deleting the Node is not added to the Undo history! - ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); + ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); /* PageBreaks, PageDesc, ColumnBreaks */ // If we need to change something about the logic to copy the PageBreaks, @@ -398,7 +398,7 @@ bool sw_JoinText( SwPaM& rPam, bool bJoinPrev ) if( pOldTextNd->HasSwAttrSet() ) { const SfxPoolItem* pItem; - SfxItemSet aSet( pDoc->GetAttrPool(), aBreakSetRange ); + SfxItemSet aSet( rDoc.GetAttrPool(), aBreakSetRange ); const SfxItemSet* pSet = pOldTextNd->GetpSwAttrSet(); if( SfxItemState::SET == pSet->GetItemState( RES_BREAK, false, &pItem ) ) @@ -412,17 +412,17 @@ bool sw_JoinText( SwPaM& rPam, bool bJoinPrev ) pOldTextNd->FormatToTextAttr( pTextNd ); const std::shared_ptr< sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create()); - pContentStore->Save(*pDoc, aOldIdx.GetIndex(), SAL_MAX_INT32); + pContentStore->Save(rDoc, aOldIdx.GetIndex(), SAL_MAX_INT32); SwIndex aAlphaIdx(pTextNd); pOldTextNd->CutText( pTextNd, aAlphaIdx, SwIndex(pOldTextNd), pOldTextNd->Len() ); SwPosition aAlphaPos( aIdx, aAlphaIdx ); - pDoc->CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, true ); + rDoc.CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, true ); // move all Bookmarks/TOXMarks if( !pContentStore->Empty() ) - pContentStore->Restore( *pDoc, aIdx.GetIndex() ); + pContentStore->Restore( rDoc, aIdx.GetIndex() ); // If the passed PaM is not in the Cursor ring, // treat it separately (e.g. when it's being called from AutoFormat) @@ -438,7 +438,7 @@ bool sw_JoinText( SwPaM& rPam, bool bJoinPrev ) { sw::MoveDeletedPrevFrames(*pOldTextNd, *pTextNd); } - pDoc->GetNodes().Delete( aOldIdx ); + rDoc.GetNodes().Delete( aOldIdx ); sw::CheckResetRedlineMergeFlag(*pTextNd, eOldMergeFlag == SwNode::Merge::NonFirst ? sw::Recreate::Predecessor @@ -469,13 +469,13 @@ bool sw_JoinText( SwPaM& rPam, bool bJoinPrev ) if( pDelNd->HasSwAttrSet() ) { // only copy the character attributes - SfxItemSet aTmpSet( pDoc->GetAttrPool(), aCharFormatSetRange ); + SfxItemSet aTmpSet( rDoc.GetAttrPool(), aCharFormatSetRange ); aTmpSet.Put( *pDelNd->GetpSwAttrSet() ); pTextNd->SetAttr( aTmpSet ); } } - pDoc->CorrRel( aIdx, *rPam.GetPoint(), 0, true ); + rDoc.CorrRel( aIdx, *rPam.GetPoint(), 0, true ); // #i100466# adjust given <rPam>, if it does not belong to the cursors if ( pDelNd == rPam.GetBound().nContent.GetIdxReg() ) { @@ -817,7 +817,7 @@ uno::Reference< XHyphenatedWord > SwDoc::Hyphenate( SwPaM *pPam, const Point &rCursorPos, sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) { - OSL_ENSURE(this == pPam->GetDoc(), "SwDoc::Hyphenate: strangers in the night"); + OSL_ENSURE(this == &pPam->GetDoc(), "SwDoc::Hyphenate: strangers in the night"); if( *pPam->GetPoint() > *pPam->GetMark() ) pPam->Exchange(); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 38b997d6c9ca..6bad04a7180c 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -1178,7 +1178,7 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu SwPaM aPaM(SwPosition(aIndexBefore), SwPosition(rInsPos.nNode)); - aPaM.GetDoc()->MakeUniqueNumRules(aPaM); + aPaM.GetDoc().MakeUniqueNumRules(aPaM); // Update the rsid of each pasted text node SwNodes &rDestNodes = GetNodes(); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index c1b5d550ca1f..b0a38c0f406e 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1236,7 +1236,7 @@ namespace void SwDoc::MakeUniqueNumRules(const SwPaM & rPaM) { - OSL_ENSURE( rPaM.GetDoc() == this, "need same doc" ); + OSL_ENSURE( &rPaM.GetDoc() == this, "need same doc" ); std::map<SwNumRule *, ListStyleData> aMyNumRuleMap; diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index c700d39d731d..9abe6b839423 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -387,11 +387,11 @@ void SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRangeRe // When this notify method is called text invalidation is not done yet // Calling FillRects updates the text area so invalidation will not run on the correct rects // So we need to do an own invalidation here. It invalidates text frames containing the redlining - SwDoc* pDoc = pRedline->GetDoc(); + SwDoc& rDoc = pRedline->GetDoc(); SwViewShell* pSh; - if( pDoc && !pDoc->IsInDtor() ) + if( !rDoc.IsInDtor() ) { - pSh = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(); + pSh = rDoc.getIDocumentLayoutAccess().GetCurrentViewShell(); if( pSh ) for(SwNodeIndex nIdx = pStartPos->nNode; nIdx <= pEndPos->nNode; ++nIdx) { @@ -608,7 +608,7 @@ void SwRedlineTable::Remove( size_type nP ) LOKRedlineNotification(RedlineNotification::Remove, maVector[nP]); SwDoc* pDoc = nullptr; if( !nP && 1 == size() ) - pDoc = maVector.front()->GetDoc(); + pDoc = &maVector.front()->GetDoc(); maVector.erase( maVector.begin() + nP ); @@ -771,15 +771,15 @@ SwRedlineExtraData* SwRedlineExtraData_FormatColl::CreateNew() const void SwRedlineExtraData_FormatColl::Reject( SwPaM& rPam ) const { - SwDoc* pDoc = rPam.GetDoc(); + SwDoc& rDoc = rPam.GetDoc(); // What about Undo? Is it turned off? SwTextFormatColl* pColl = USHRT_MAX == m_nPoolId - ? pDoc->FindTextFormatCollByName( m_sFormatNm ) - : pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( m_nPoolId ); + ? rDoc.FindTextFormatCollByName( m_sFormatNm ) + : rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool( m_nPoolId ); - RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld & ~RedlineFlags(RedlineFlags::On | RedlineFlags::Ignore)); + RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); + rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld & ~RedlineFlags(RedlineFlags::On | RedlineFlags::Ignore)); SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() ); @@ -805,12 +805,12 @@ void SwRedlineExtraData_FormatColl::Reject( SwPaM& rPam ) const } if( pColl ) - pDoc->SetTextFormatColl( aPam, pColl, false ); + rDoc.SetTextFormatColl( aPam, pColl, false ); if( m_pSet ) - pDoc->getIDocumentContentOperations().InsertItemSet( aPam, *m_pSet ); + rDoc.getIDocumentContentOperations().InsertItemSet( aPam, *m_pSet ); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); } bool SwRedlineExtraData_FormatColl::operator == ( const SwRedlineExtraData& r) const @@ -857,19 +857,19 @@ SwRedlineExtraData* SwRedlineExtraData_Format::CreateNew() const void SwRedlineExtraData_Format::Reject( SwPaM& rPam ) const { - SwDoc* pDoc = rPam.GetDoc(); + SwDoc& rDoc = rPam.GetDoc(); - RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld & ~RedlineFlags(RedlineFlags::On | RedlineFlags::Ignore)); + RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); + rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld & ~RedlineFlags(RedlineFlags::On | RedlineFlags::Ignore)); // Actually we need to reset the Attribute here! for( const auto& rWhichId : m_aWhichIds ) { - pDoc->getIDocumentContentOperations().InsertPoolItem( rPam, *GetDfltAttr( rWhichId ), + rDoc.getIDocumentContentOperations().InsertPoolItem( rPam, *GetDfltAttr( rWhichId ), SetAttrMode::DONTEXPAND ); } - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); } bool SwRedlineExtraData_Format::operator == ( const SwRedlineExtraData& rCmp ) const @@ -978,7 +978,7 @@ sal_uInt32 SwRangeRedline::s_nLastId = 1; SwRangeRedline::SwRangeRedline(RedlineType eTyp, const SwPaM& rPam ) : SwPaM( *rPam.GetMark(), *rPam.GetPoint() ), - m_pRedlineData( new SwRedlineData( eTyp, GetDoc()->getIDocumentRedlineAccess().GetRedlineAuthor() ) ), + m_pRedlineData( new SwRedlineData( eTyp, GetDoc().getIDocumentRedlineAccess().GetRedlineAuthor() ) ), m_pContentSect( nullptr ), m_nId( s_nLastId++ ) { @@ -1027,24 +1027,24 @@ SwRangeRedline::~SwRangeRedline() if( m_pContentSect ) { // delete the ContentSection - if( !GetDoc()->IsInDtor() ) - GetDoc()->getIDocumentContentOperations().DeleteSection( &m_pContentSect->GetNode() ); + if( !GetDoc().IsInDtor() ) + GetDoc().getIDocumentContentOperations().DeleteSection( &m_pContentSect->GetNode() ); delete m_pContentSect; } delete m_pRedlineData; } -void MaybeNotifyRedlineModification(SwRangeRedline* pRedline, SwDoc* pDoc) +void MaybeNotifyRedlineModification(SwRangeRedline& rRedline, SwDoc& rDoc) { if (!comphelper::LibreOfficeKit::isActive()) return; - const SwRedlineTable& rRedTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + const SwRedlineTable& rRedTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); for (SwRedlineTable::size_type i = 0; i < rRedTable.size(); ++i) { - if (rRedTable[i] == pRedline) + if (rRedTable[i] == &rRedline) { - SwRedlineTable::LOKRedlineNotification(RedlineNotification::Modify, pRedline); + SwRedlineTable::LOKRedlineNotification(RedlineNotification::Modify, &rRedline); break; } } @@ -1067,7 +1067,7 @@ void SwRangeRedline::SetStart( const SwPosition& rPos, SwPosition* pSttPtr ) if( !pSttPtr ) pSttPtr = Start(); *pSttPtr = rPos; - MaybeNotifyRedlineModification(this, GetDoc()); + MaybeNotifyRedlineModification(*this, GetDoc()); } void SwRangeRedline::SetEnd( const SwPosition& rPos, SwPosition* pEndPtr ) @@ -1075,7 +1075,7 @@ void SwRangeRedline::SetEnd( const SwPosition& rPos, SwPosition* pEndPtr ) if( !pEndPtr ) pEndPtr = End(); *pEndPtr = rPos; - MaybeNotifyRedlineModification(this, GetDoc()); + MaybeNotifyRedlineModification(*this, GetDoc()); } /// Do we have a valid Selection? @@ -1096,7 +1096,7 @@ bool SwRangeRedline::HasValidRange() const void SwRangeRedline::CallDisplayFunc(size_t nMyPos) { - RedlineFlags eShow = RedlineFlags::ShowMask & GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags(); + RedlineFlags eShow = RedlineFlags::ShowMask & GetDoc().getIDocumentRedlineAccess().GetRedlineFlags(); if (eShow == (RedlineFlags::ShowInsert | RedlineFlags::ShowDelete)) Show(0, nMyPos); else if (eShow == RedlineFlags::ShowInsert) @@ -1110,10 +1110,10 @@ void SwRangeRedline::Show(sal_uInt16 nLoop, size_t nMyPos) if( 1 > nLoop ) return; - SwDoc* pDoc = GetDoc(); - RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore); - ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); + SwDoc& rDoc = GetDoc(); + RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); + rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore); + ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); switch( GetType() ) { @@ -1134,15 +1134,15 @@ void SwRangeRedline::Show(sal_uInt16 nLoop, size_t nMyPos) default: break; } - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); } void SwRangeRedline::Hide(sal_uInt16 nLoop, size_t nMyPos) { - SwDoc* pDoc = GetDoc(); - RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore); - ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); + SwDoc& rDoc = GetDoc(); + RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); + rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore); + ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); switch( GetType() ) { @@ -1170,17 +1170,17 @@ void SwRangeRedline::Hide(sal_uInt16 nLoop, size_t nMyPos) default: break; } - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); } void SwRangeRedline::ShowOriginal(sal_uInt16 nLoop, size_t nMyPos) { - SwDoc* pDoc = GetDoc(); - RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); + SwDoc& rDoc = GetDoc(); + RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); SwRedlineData* pCur; - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore); - ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); + rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore); + ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); // Determine the Type, it's the first on Stack for( pCur = m_pRedlineData; pCur->m_pNext; ) @@ -1212,7 +1212,7 @@ void SwRangeRedline::ShowOriginal(sal_uInt16 nLoop, size_t nMyPos) default: break; } - pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); + rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld ); } // trigger the Layout @@ -1229,7 +1229,7 @@ void SwRangeRedline::InvalidateRange(Invalidation const eWhy) sal_Int32 nTmp2 = nSttCnt; nSttCnt = nEndCnt; nEndCnt = nTmp2; } - SwNodes& rNds = GetDoc()->GetNodes(); + SwNodes& rNds = GetDoc().GetNodes(); for (sal_uLong n(nSttNd); n <= nEndNd; ++n) { SwNode* pNode = rNds[n]; @@ -1310,7 +1310,7 @@ void SwRangeRedline::MoveToSection() const SwPosition* pStt = Start(), * pEnd = pStt == GetPoint() ? GetMark() : GetPoint(); - SwDoc* pDoc = GetDoc(); + SwDoc& rDoc = GetDoc(); SwPaM aPam( *pStt, *pEnd ); SwContentNode* pCSttNd = pStt->nNode.GetNode().GetContentNode(); SwContentNode* pCEndNd = pEnd->nNode.GetNode().GetContentNode(); @@ -1319,7 +1319,7 @@ void SwRangeRedline::MoveToSection() { // In order to not move other Redlines' indices, we set them // to the end (is exclusive) - const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + const SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); for(SwRangeRedline* pRedl : rTable) { if( pRedl->GetBound() == *pStt ) @@ -1330,14 +1330,14 @@ void SwRangeRedline::MoveToSection() } SwStartNode* pSttNd; - SwNodes& rNds = pDoc->GetNodes(); + SwNodes& rNds = rDoc.GetNodes(); if( pCSttNd || pCEndNd ) { SwTextFormatColl* pColl = (pCSttNd && pCSttNd->IsTextNode() ) ? pCSttNd->GetTextNode()->GetTextColl() : (pCEndNd && pCEndNd->IsTextNode() ) ? pCEndNd->GetTextNode()->GetTextColl() - : pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD); + : rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD); pSttNd = rNds.MakeTextSection( SwNodeIndex( rNds.GetEndOfRedlines() ), SwNormalStartNode, pColl ); @@ -1346,12 +1346,12 @@ void SwRangeRedline::MoveToSection() SwNodeIndex aNdIdx( *pTextNd ); SwPosition aPos( aNdIdx, SwIndex( pTextNd )); if( pCSttNd && pCEndNd ) - pDoc->getIDocumentContentOperations().MoveAndJoin( aPam, aPos ); + rDoc.getIDocumentContentOperations().MoveAndJoin( aPam, aPos ); else { if( pCSttNd && !pCEndNd ) m_bDelLastPara = true; - pDoc->getIDocumentContentOperations().MoveRange( aPam, aPos, + rDoc.getIDocumentContentOperations().MoveRange( aPam, aPos, SwMoveFlags::DEFAULT ); } } @@ -1360,7 +1360,7 @@ void SwRangeRedline::MoveToSection() pSttNd = SwNodes::MakeEmptySection( SwNodeIndex( rNds.GetEndOfRedlines() ) ); SwPosition aPos( *pSttNd->EndOfSectionNode() ); - pDoc->getIDocumentContentOperations().MoveRange( aPam, aPos, + rDoc.getIDocumentContentOperations().MoveRange( aPam, aPos, SwMoveFlags::DEFAULT ); } m_pContentSect = new SwNodeIndex( *pSttNd ); @@ -1386,23 +1386,23 @@ void SwRangeRedline::CopyToSection() SwContentNode* pCEndNd = pEnd->nNode.GetNode().GetContentNode(); SwStartNode* pSttNd; - SwDoc* pDoc = GetDoc(); - SwNodes& rNds = pDoc->GetNodes(); + SwDoc& rDoc = GetDoc(); + SwNodes& rNds = rDoc.GetNodes(); - bool bSaveCopyFlag = pDoc->IsCopyIsMove(), - bSaveRdlMoveFlg = pDoc->getIDocumentRedlineAccess().IsRedlineMove(); - pDoc->SetCopyIsMove( true ); + bool bSaveCopyFlag = rDoc.IsCopyIsMove(), + bSaveRdlMoveFlg = rDoc.getIDocumentRedlineAccess().IsRedlineMove(); + rDoc.SetCopyIsMove( true ); // The IsRedlineMove() flag causes the behaviour of the // DocumentContentOperationsManager::CopyFlyInFlyImpl() method to change, // which will eventually be called by the CopyRange() below. - pDoc->getIDocumentRedlineAccess().SetRedlineMove(true); + rDoc.getIDocumentRedlineAccess().SetRedlineMove(true); if( pCSttNd ) { SwTextFormatColl* pColl = pCSttNd->IsTextNode() ? pCSttNd->GetTextNode()->GetTextColl() - : pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD); + : rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD); pSttNd = rNds.MakeTextSection( SwNodeIndex( rNds.GetEndOfRedlines() ), SwNormalStartNode, pColl ); @@ -1410,7 +1410,7 @@ void SwRangeRedline::CopyToSection() SwNodeIndex aNdIdx( *pSttNd, 1 ); SwTextNode* pTextNd = aNdIdx.GetNode().GetTextNode(); SwPosition aPos( aNdIdx, SwIndex( pTextNd )); - pDoc->getIDocumentContentOperations().CopyRange(*this, aPos, SwCopyFlags::CheckPosInFly); + rDoc.getIDocumentContentOperations().CopyRange(*this, aPos, SwCopyFlags::CheckPosInFly); // Take over the style from the EndNode if needed // We don't want this in Doc::Copy @@ -1433,20 +1433,19 @@ void SwRangeRedline::CopyToSection() if( pCEndNd ) { SwPosition aPos( *pSttNd->EndOfSectionNode() ); - pDoc->getIDocumentContentOperations().CopyRange(*this, aPos, SwCopyFlags::CheckPosInFly); + rDoc.getIDocumentContentOperations().CopyRange(*this, aPos, SwCopyFlags::CheckPosInFly); } else { SwNodeIndex aInsPos( *pSttNd->EndOfSectionNode() ); SwNodeRange aRg( pStt->nNode, 0, pEnd->nNode, 1 ); - pDoc->GetDocumentContentOperationsManager().CopyWithFlyInFly(aRg, aInsPos); + rDoc.GetDocumentContentOperationsManager().CopyWithFlyInFly(aRg, aInsPos); } } m_pContentSect = new SwNodeIndex( *pSttNd ); - pDoc->SetCopyIsMove( bSaveCopyFlag ); - pDoc->getIDocumentRedlineAccess().SetRedlineMove( bSaveRdlMoveFlg ); - + rDoc.SetCopyIsMove( bSaveCopyFlag ); + rDoc.getIDocumentRedlineAccess().SetRedlineMove( bSaveRdlMoveFlg ); } void SwRangeRedline::DelCopyOfSection(size_t nMyPos) @@ -1457,7 +1456,7 @@ void SwRangeRedline::DelCopyOfSection(size_t nMyPos) const SwPosition* pStt = Start(), * pEnd = pStt == GetPoint() ? GetMark() : GetPoint(); - SwDoc* pDoc = GetDoc(); + SwDoc& rDoc = GetDoc(); SwPaM aPam( *pStt, *pEnd ); SwContentNode* pCSttNd = pStt->nNode.GetNode().GetContentNode(); SwContentNode* pCEndNd = pEnd->nNode.GetNode().GetContentNode(); @@ -1466,7 +1465,7 @@ void SwRangeRedline::DelCopyOfSection(size_t nMyPos) { // In order to not move other Redlines' indices, we set them // to the end (is exclusive) - const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + const SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); for(SwRangeRedline* pRedl : rTable) { if( pRedl->GetBound() == *pStt ) @@ -1480,13 +1479,13 @@ void SwRangeRedline::DelCopyOfSection(size_t nMyPos) { // #i100466# - force a <join next> on <delete and join> operation // tdf#125319 - rather not? - pDoc->getIDocumentContentOperations().DeleteAndJoin(aPam/*, true*/); + rDoc.getIDocumentContentOperations().DeleteAndJoin(aPam/*, true*/); } else if( pCSttNd || pCEndNd ) { if( pCSttNd && !pCEndNd ) m_bDelLastPara = true; - pDoc->getIDocumentContentOperations().DeleteRange( aPam ); + rDoc.getIDocumentContentOperations().DeleteRange( aPam ); if( m_bDelLastPara ) { @@ -1496,7 +1495,7 @@ void SwRangeRedline::DelCopyOfSection(size_t nMyPos) // table are sorted and the pEnd position is an endnode (see // bDelLastPara condition above), only redlines before the // current ones can be affected. - const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + const SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); size_t n = nMyPos; for( bool bBreak = false; !bBreak && n > 0; ) { @@ -1521,12 +1520,12 @@ void SwRangeRedline::DelCopyOfSection(size_t nMyPos) aPam.GetBound().nContent.Assign( nullptr, 0 ); aPam.GetBound( false ).nContent.Assign( nullptr, 0 ); aPam.DeleteMark(); - pDoc->getIDocumentContentOperations().DelFullPara( aPam ); + rDoc.getIDocumentContentOperations().DelFullPara( aPam ); } } else { - pDoc->getIDocumentContentOperations().DeleteRange( aPam ); + rDoc.getIDocumentContentOperations().DeleteRange( aPam ); } if( pStt == GetPoint() ) @@ -1539,8 +1538,8 @@ void SwRangeRedline::MoveFromSection(size_t nMyPos) { if( m_pContentSect ) { - SwDoc* pDoc = GetDoc(); - const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + SwDoc& rDoc = GetDoc(); + const SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); std::vector<SwPosition*> aBeforeArr, aBehindArr; bool bBreak = false; SwRedlineTable::size_type n; @@ -1602,11 +1601,11 @@ void SwRangeRedline::MoveFromSection(size_t nMyPos) { --aPos.nNode; - pDoc->getIDocumentContentOperations().AppendTextNode( aPos ); + rDoc.getIDocumentContentOperations().AppendTextNode( aPos ); } else { - pDoc->getIDocumentContentOperations().MoveRange( aPam, aPos, + rDoc.getIDocumentContentOperations().MoveRange( aPam, aPos, SwMoveFlags::ALLFLYS ); } @@ -1640,7 +1639,7 @@ void SwRangeRedline::MoveFromSection(size_t nMyPos) // Note: Such condition is e.g. a "delete" change tracking only containing a table. if ( &m_pContentSect->GetNode() == pKeptContentSectNode ) { - pDoc->getIDocumentContentOperations().DeleteSection( &m_pContentSect->GetNode() ); + rDoc.getIDocumentContentOperations().DeleteSection( &m_pContentSect->GetNode() ); } delete m_pContentSect; m_pContentSect = nullptr; diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index 83325d73ecd1..9ddcf0a935b8 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -46,8 +46,8 @@ SwExtTextInput::SwExtTextInput( const SwPaM& rPam, Ring* pRing ) SwExtTextInput::~SwExtTextInput() { - SwDoc *const pDoc = GetDoc(); - if (pDoc->IsInDtor()) { return; /* #i58606# */ } + SwDoc& rDoc = GetDoc(); + if (rDoc.IsInDtor()) { return; /* #i58606# */ } SwTextNode* pTNd = GetPoint()->nNode.GetNode().GetTextNode(); if( !pTNd ) @@ -60,8 +60,8 @@ SwExtTextInput::~SwExtTextInput() return; // Prevent IME edited text being grouped with non-IME edited text. - bool bKeepGroupUndo = pDoc->GetIDocumentUndoRedo().DoesGroupUndo(); - pDoc->GetIDocumentUndoRedo().DoGroupUndo(false); + bool bKeepGroupUndo = rDoc.GetIDocumentUndoRedo().DoesGroupUndo(); + rDoc.GetIDocumentUndoRedo().DoGroupUndo(false); if( nEndCnt < nSttCnt ) { std::swap(nSttCnt, nEndCnt); @@ -84,10 +84,10 @@ SwExtTextInput::~SwExtTextInput() if( m_bInsText ) { rIdx = nSttCnt; - pDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::OVERWRITE, nullptr ); - pDoc->getIDocumentContentOperations().Overwrite( *this, sText.copy( 0, nOWLen ) ); - pDoc->getIDocumentContentOperations().InsertString( *this, sText.copy( nOWLen ) ); - pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::OVERWRITE, nullptr ); + rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::OVERWRITE, nullptr ); + rDoc.getIDocumentContentOperations().Overwrite( *this, sText.copy( 0, nOWLen ) ); + rDoc.getIDocumentContentOperations().InsertString( *this, sText.copy( nOWLen ) ); + rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::OVERWRITE, nullptr ); } } else @@ -96,7 +96,7 @@ SwExtTextInput::~SwExtTextInput() if( m_bInsText ) { rIdx = nSttCnt; - pDoc->getIDocumentContentOperations().Overwrite( *this, sText ); + rDoc.getIDocumentContentOperations().Overwrite( *this, sText ); } } } @@ -106,10 +106,10 @@ SwExtTextInput::~SwExtTextInput() if( m_bInsText ) { - pDoc->getIDocumentContentOperations().InsertString( *this, sText ); + rDoc.getIDocumentContentOperations().InsertString( *this, sText ); } } - pDoc->GetIDocumentUndoRedo().DoGroupUndo(bKeepGroupUndo); + rDoc.GetIDocumentUndoRedo().DoGroupUndo(bKeepGroupUndo); if (m_eInputLanguage == LANGUAGE_DONTKNOW) return; @@ -128,7 +128,7 @@ SwExtTextInput::~SwExtTextInput() SvxLanguageItem aLangItem( m_eInputLanguage, nWhich ); rIdx = nSttCnt; GetMark()->nContent = nEndCnt; - pDoc->getIDocumentContentOperations().InsertPoolItem(*this, aLangItem ); + rDoc.getIDocumentContentOperations().InsertPoolItem(*this, aLangItem ); } } diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx index 3eb3840a1c03..100e8b6a3f2c 100644 --- a/sw/source/core/doc/swserv.cxx +++ b/sw/source/core/doc/swserv.cxx @@ -275,7 +275,7 @@ void SwServerObject::SetDdeBookmark( ::sw::mark::IMark& rBookmark) } SwDataChanged::SwDataChanged( const SwPaM& rPam ) - : m_pPam( &rPam ), m_pPos( nullptr ), m_pDoc( rPam.GetDoc() ) + : m_pPam( &rPam ), m_pPos( nullptr ), m_pDoc( &rPam.GetDoc() ) { m_nContent = rPam.GetPoint()->nContent.GetIndex(); } diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 3b68e1760787..0716d652fa05 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -804,7 +804,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bNestedTable ) ++aIndexBefore; SwPaM aPaM(SwPosition(aIndexBefore), SwPosition(rInsPos.nNode)); - aPaM.GetDoc()->MakeUniqueNumRules(aPaM); + aPaM.GetDoc().MakeUniqueNumRules(aPaM); } } SaveTableBoxContent( &rInsPos ); @@ -1045,7 +1045,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bNestedTable ) SwPaM aPaM(SwPosition(aIndexBefore), SwPosition(rInsPos.nNode)); - aPaM.GetDoc()->MakeUniqueNumRules(aPaM); + aPaM.GetDoc().MakeUniqueNumRules(aPaM); // Update the rsid of each pasted text node. SwNodes &rDestNodes = GetDoc()->GetNodes(); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index d0b0572e1a02..cc4e546d4306 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -137,7 +137,7 @@ void GetTableSelCrs( const SwTableCursor& rTableCursor, SwSelBoxes& rBoxes ) if (rTableCursor.IsChgd() || !rTableCursor.GetSelectedBoxesCount()) { SwTableCursor* pTCursor = const_cast<SwTableCursor*>(&rTableCursor); - pTCursor->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->MakeTableCursors( *pTCursor ); + pTCursor->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout()->MakeTableCursors( *pTCursor ); } if (rTableCursor.GetSelectedBoxesCount()) @@ -903,7 +903,7 @@ bool IsEmptyBox( const SwTableBox& rBox, SwPaM& rPam ) if( bRet ) { // now check for paragraph bound flies - const SwFrameFormats& rFormats = *rPam.GetDoc()->GetSpzFrameFormats(); + const SwFrameFormats& rFormats = *rPam.GetDoc().GetSpzFrameFormats(); sal_uLong nSttIdx = rPam.GetPoint()->nNode.GetIndex(), nEndIdx = rBox.GetSttNd()->EndOfSectionIndex(), nIdx; diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 6cf067288341..be1aff542c13 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -230,16 +230,16 @@ void SwFormatField::SwClientNotify( const SwModify& rModify, const SfxHint& rHin // replace field content by text SwPaM* pPaM = pFieldHint->m_pPaM; - SwDoc* pDoc = pPaM->GetDoc(); + SwDoc& rDoc = pPaM->GetDoc(); const SwTextNode& rTextNode = mpTextField->GetTextNode(); pPaM->GetPoint()->nNode = rTextNode; pPaM->GetPoint()->nContent.Assign( const_cast<SwTextNode*>(&rTextNode), mpTextField->GetStart() ); - OUString const aEntry(mpField->ExpandField(pDoc->IsClipBoard(), pFieldHint->m_pLayout)); + OUString const aEntry(mpField->ExpandField(rDoc.IsClipBoard(), pFieldHint->m_pLayout)); pPaM->SetMark(); pPaM->Move( fnMoveForward ); - pDoc->getIDocumentContentOperations().DeleteRange( *pPaM ); - pDoc->getIDocumentContentOperations().InsertString( *pPaM, aEntry ); + rDoc.getIDocumentContentOperations().DeleteRange( *pPaM ); + rDoc.getIDocumentContentOperations().InsertString( *pPaM, aEntry ); } else if (const auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>( &rHint )) { if( !mpTextField ) diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index ba6608b7a92b..68fb64f903bd 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -531,7 +531,7 @@ void SwUndoFormatResetAttr::RedoImpl(::sw::UndoRedoContext &) } 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 ) { @@ -645,8 +645,8 @@ void SwUndoResetAttr::SetAttrs( const std::set<sal_uInt16> &rAttrs ) SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxPoolItem& rAttr, const SetAttrMode nFlags ) - : SwUndo( SwUndoId::INSATTR, rRange.GetDoc() ), SwUndRng( rRange ) - , m_AttrSet( rRange.GetDoc()->GetAttrPool(), {{rAttr.Which(), rAttr.Which()}} ) + : SwUndo( SwUndoId::INSATTR, &rRange.GetDoc() ), SwUndRng( rRange ) + , m_AttrSet( rRange.GetDoc().GetAttrPool(), {{rAttr.Which(), rAttr.Which()}} ) , m_pHistory( new SwHistory ) , m_nNodeIndex( ULONG_MAX ) , m_nInsertFlags( nFlags ) @@ -665,7 +665,7 @@ SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxPoolItem& rAttr, SwUndoAttr::SwUndoAttr( const SwPaM& rRange, const SfxItemSet& rSet, const SetAttrMode nFlags ) - : SwUndo( SwUndoId::INSATTR, rRange.GetDoc() ), SwUndRng( rRange ) + : SwUndo( SwUndoId::INSATTR, &rRange.GetDoc() ), SwUndRng( rRange ) , m_AttrSet( rSet ) , m_pHistory( new SwHistory ) , m_nNodeIndex( ULONG_MAX ) @@ -687,19 +687,19 @@ SwUndoAttr::~SwUndoAttr() void SwUndoAttr::SaveRedlineData( const SwPaM& rPam, bool bIsContent ) { - SwDoc* pDoc = rPam.GetDoc(); - if ( pDoc->getIDocumentRedlineAccess().IsRedlineOn() ) { + SwDoc& rDoc = rPam.GetDoc(); + if ( rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) { m_pRedlineData.reset( new SwRedlineData( bIsContent ? RedlineType::Insert : RedlineType::Format, - pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() ) ); + rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() ) ); } m_pRedlineSaveData.reset( new SwRedlineSaveDatas ); if ( !FillSaveDataForFormat( rPam, *m_pRedlineSaveData )) m_pRedlineSaveData.reset(); - SetRedlineFlags( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() ); + SetRedlineFlags( rDoc.getIDocumentRedlineAccess().GetRedlineFlags() ); if ( bIsContent ) { m_nNodeIndex = rPam.GetPoint()->nNode.GetIndex(); } @@ -885,7 +885,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 ) @@ -927,7 +927,7 @@ void SwUndoMoveLeftMargin::RepeatImpl(::sw::RepeatContext & rContext) SwUndoChangeFootNote::SwUndoChangeFootNote( const SwPaM& rRange, const OUString& rText, bool const bIsEndNote) - : SwUndo( SwUndoId::CHGFTN, rRange.GetDoc() ), SwUndRng( rRange ) + : SwUndo( SwUndoId::CHGFTN, &rRange.GetDoc() ), SwUndRng( rRange ) , m_pHistory( new SwHistory() ) , m_Text( rText ) , m_bEndNote( bIsEndNote ) diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 37304f3fdba8..6d671234bec9 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -173,7 +173,7 @@ SwUndoDelete::SwUndoDelete( SwPaM& rPam, bool bFullPara, bool bCalledByTableCpy ) - : SwUndo(SwUndoId::DELETE, rPam.GetDoc()), + : SwUndo(SwUndoId::DELETE, &rPam.GetDoc()), SwUndRng( rPam ), m_nNode(0), m_nNdDiff(0), @@ -193,9 +193,9 @@ SwUndoDelete::SwUndoDelete( m_bCacheComment = false; - SwDoc * pDoc = rPam.GetDoc(); + SwDoc& rDoc = rPam.GetDoc(); - if( !pDoc->getIDocumentRedlineAccess().IsIgnoreRedline() && !pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() ) + if( !rDoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() ) { m_pRedlSaveData.reset(new SwRedlineSaveDatas); if( !FillSaveData( rPam, *m_pRedlSaveData )) @@ -220,13 +220,13 @@ SwUndoDelete::SwUndoDelete( DelContentIndex( *rPam.GetMark(), *rPam.GetPoint(), DelContentType(DelContentType::AllMask | DelContentType::CheckNoCntnt) ); - ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); + ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); DelBookmarks(pStt->nNode, pEnd->nNode); } else { DelContentIndex( *rPam.GetMark(), *rPam.GetPoint() ); - ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); + ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); if (m_nEndNode - m_nSttNode > 1) // check for fully selected nodes { SwNodeIndex const start(pStt->nNode, +1); @@ -252,7 +252,7 @@ SwUndoDelete::SwUndoDelete( } else if (m_pRedlSaveData) { - DelFullParaMoveFrames(*pDoc, *this, *m_pRedlSaveData); + DelFullParaMoveFrames(rDoc, *this, *m_pRedlSaveData); } bool bMoveNds = *pStt != *pEnd // any area still existent? @@ -298,12 +298,12 @@ SwUndoDelete::SwUndoDelete( if( bMoveNds ) // Do Nodes exist that need to be moved? { - SwNodes& rNds = pDoc->GetUndoManager().GetUndoNodes(); - SwNodes& rDocNds = pDoc->GetNodes(); + SwNodes& rNds = rDoc.GetUndoManager().GetUndoNodes(); + SwNodes& rDocNds = rDoc.GetNodes(); SwNodeRange aRg( rDocNds, m_nSttNode - m_nNdDiff, rDocNds, m_nEndNode - m_nNdDiff ); if( !bFullPara && !pEndTextNd && - &aRg.aEnd.GetNode() != &pDoc->GetNodes().GetEndOfContent() ) + &aRg.aEnd.GetNode() != &rDoc.GetNodes().GetEndOfContent() ) { SwNode* pNode = aRg.aEnd.GetNode().StartOfSectionNode(); if( pNode->GetIndex() >= m_nSttNode - m_nNdDiff ) @@ -332,8 +332,8 @@ SwUndoDelete::SwUndoDelete( ++m_nReplaceDummy; SwNodeRange aMvRg( *pEndTextNd, 0, *pEndTextNd, 1 ); SwPosition aSplitPos( *pEndTextNd ); - ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo()); - pDoc->getIDocumentContentOperations().SplitNode( aSplitPos, false ); + ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo()); + rDoc.getIDocumentContentOperations().SplitNode( aSplitPos, false ); rDocNds.MoveNodes( aMvRg, rDocNds, aRg.aEnd ); --aRg.aEnd; } @@ -356,8 +356,8 @@ SwUndoDelete::SwUndoDelete( { SwNodeRange aMvRg( *pSttTextNd, 0, *pSttTextNd, 1 ); SwPosition aSplitPos( *pSttTextNd ); - ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo()); - pDoc->getIDocumentContentOperations().SplitNode( aSplitPos, false ); + ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo()); + rDoc.getIDocumentContentOperations().SplitNode( aSplitPos, false ); rDocNds.MoveNodes( aMvRg, rDocNds, aRg.aStart ); --aRg.aStart; } @@ -406,7 +406,7 @@ SwUndoDelete::SwUndoDelete( } } if( m_nSectDiff || m_nReplaceDummy ) - lcl_MakeAutoFrames( *pDoc->GetSpzFrameFormats(), + lcl_MakeAutoFrames( *rDoc.GetSpzFrameFormats(), m_bJoinNext ? pEndTextNd->GetIndex() : pSttTextNd->GetIndex() ); } else @@ -1157,7 +1157,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext) void SwUndoDelete::RedoImpl(::sw::UndoRedoContext & rContext) { SwPaM & rPam = AddUndoRedoPaM(rContext); - SwDoc& rDoc = *rPam.GetDoc(); + SwDoc& rDoc = rPam.GetDoc(); if( m_pRedlSaveData ) { @@ -1297,7 +1297,7 @@ void SwUndoDelete::RepeatImpl(::sw::RepeatContext & rContext) return; SwPaM & rPam = rContext.GetRepeatPaM(); - SwDoc& rDoc = *rPam.GetDoc(); + SwDoc& rDoc = rPam.GetDoc(); ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); if( !rPam.HasMark() ) { diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 9e0f4cf1de76..323de872c3cf 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -139,7 +139,7 @@ void SwUndo::RemoveIdxFromRange( SwPaM& rPam, bool bMoveNext ) rPam.Exchange(); if( !rPam.Move( fnMoveBackward ) ) { - rPam.GetPoint()->nNode = rPam.GetDoc()->GetNodes().GetEndOfPostIts(); + rPam.GetPoint()->nNode = rPam.GetDoc().GetNodes().GetEndOfPostIts(); rPam.GetPoint()->nContent.Assign( nullptr, 0 ); } } @@ -728,7 +728,7 @@ void SwUndoSaveContent::dumpAsXml(xmlTextWriterPtr pWriter) const void SwUndoSaveContent::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx, sal_uLong* pEndNdIdx ) { - SwDoc& rDoc = *rPaM.GetDoc(); + SwDoc& rDoc = rPaM.GetDoc(); ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); SwNoTextNode* pCpyNd = rPaM.GetNode().GetNoTextNode(); @@ -1367,7 +1367,7 @@ SwRedlineSaveData::~SwRedlineSaveData() void SwRedlineSaveData::RedlineToDoc( SwPaM const & rPam ) { - SwDoc& rDoc = *rPam.GetDoc(); + SwDoc& rDoc = rPam.GetDoc(); SwRangeRedline* pRedl = new SwRangeRedline( *this, rPam ); if( GetMvSttIdx() ) @@ -1406,9 +1406,9 @@ bool SwUndo::FillSaveData( const SwPosition* pStt = rRange.Start(); const SwPosition* pEnd = rRange.End(); - const SwRedlineTable& rTable = rRange.GetDoc()->getIDocumentRedlineAccess().GetRedlineTable(); + const SwRedlineTable& rTable = rRange.GetDoc().getIDocumentRedlineAccess().GetRedlineTable(); SwRedlineTable::size_type n = 0; - rRange.GetDoc()->getIDocumentRedlineAccess().GetRedline( *pStt, &n ); + rRange.GetDoc().getIDocumentRedlineAccess().GetRedline( *pStt, &n ); for ( ; n < rTable.size(); ++n ) { SwRangeRedline* pRedl = rTable[n]; @@ -1426,7 +1426,7 @@ bool SwUndo::FillSaveData( } if( !rSData.empty() && bDelRange ) { - rRange.GetDoc()->getIDocumentRedlineAccess().DeleteRedline( rRange, false, RedlineType::Any ); + rRange.GetDoc().getIDocumentRedlineAccess().DeleteRedline( rRange, false, RedlineType::Any ); } return !rSData.empty(); } ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits