summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-30 10:10:08 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-30 14:27:41 +0200
commit93099409f3e9894b7a40182f775d76757fa2fb5b (patch)
tree0ef85877beba2acc6a0764258f9719e3142858eb
parentdaa058c714804ffbd2aa1ff20096b4c79bebea0c (diff)
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 <caolanm@redhat.com>
-rw-r--r--sw/inc/pam.hxx2
-rw-r--r--sw/inc/redline.hxx2
-rw-r--r--sw/source/core/access/accpara.cxx6
-rw-r--r--sw/source/core/crsr/findattr.cxx24
-rw-r--r--sw/source/core/crsr/findcoll.cxx18
-rw-r--r--sw/source/core/crsr/findtxt.cxx18
-rw-r--r--sw/source/core/crsr/pam.cxx20
-rw-r--r--sw/source/core/crsr/swcrsr.cxx66
-rw-r--r--sw/source/core/crsr/trvlfnfl.cxx6
-rw-r--r--sw/source/core/crsr/trvlreg.cxx4
-rw-r--r--sw/source/core/crsr/trvltbl.cxx4
-rw-r--r--sw/source/core/crsr/viscrs.cxx4
-rw-r--r--sw/source/core/doc/CntntIdxStore.cxx76
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx26
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx22
-rw-r--r--sw/source/core/doc/docbm.cxx2
-rw-r--r--sw/source/core/doc/doccomp.cxx30
-rw-r--r--sw/source/core/doc/docedt.cxx20
-rw-r--r--sw/source/core/doc/docnew.cxx2
-rw-r--r--sw/source/core/doc/docnum.cxx2
-rw-r--r--sw/source/core/doc/docredln.cxx149
-rw-r--r--sw/source/core/doc/extinput.cxx24
-rw-r--r--sw/source/core/doc/swserv.cxx2
-rw-r--r--sw/source/core/frmedt/fecopy.cxx4
-rw-r--r--sw/source/core/frmedt/tblsel.cxx4
-rw-r--r--sw/source/core/txtnode/atrfld.cxx8
-rw-r--r--sw/source/core/undo/unattr.cxx20
-rw-r--r--sw/source/core/undo/undel.cxx32
-rw-r--r--sw/source/core/undo/undobj.cxx16
-rw-r--r--sw/source/core/undo/unfmco.cxx2
-rw-r--r--sw/source/core/undo/unins.cxx4
-rw-r--r--sw/source/core/undo/unmove.cxx12
-rw-r--r--sw/source/core/undo/unnum.cxx8
-rw-r--r--sw/source/core/undo/unoutl.cxx2
-rw-r--r--sw/source/core/undo/unovwr.cxx2
-rw-r--r--sw/source/core/undo/unredln.cxx22
-rw-r--r--sw/source/core/undo/unsect.cxx4
-rw-r--r--sw/source/core/undo/unsort.cxx4
-rw-r--r--sw/source/core/undo/unspnd.cxx16
-rw-r--r--sw/source/core/undo/untbl.cxx6
-rw-r--r--sw/source/core/undo/untblk.cxx44
-rw-r--r--sw/source/core/unocore/unocrsr.cxx14
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx92
-rw-r--r--sw/source/core/unocore/unodraw.cxx2
-rw-r--r--sw/source/core/unocore/unofield.cxx2
-rw-r--r--sw/source/core/unocore/unoidx.cxx8
-rw-r--r--sw/source/core/unocore/unoobj.cxx108
-rw-r--r--sw/source/core/unocore/unoobj2.cxx52
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx6
-rw-r--r--sw/source/core/unocore/unoport.cxx4
-rw-r--r--sw/source/core/unocore/unoportenum.cxx67
-rw-r--r--sw/source/core/unocore/unoredline.cxx10
-rw-r--r--sw/source/core/unocore/unorefmk.cxx8
-rw-r--r--sw/source/core/unocore/unotbl.cxx48
-rw-r--r--sw/source/filter/basflt/shellio.cxx8
-rw-r--r--sw/source/filter/writer/writer.cxx6
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx2
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx2
-rw-r--r--sw/source/filter/xml/swxml.cxx2
-rw-r--r--sw/source/filter/xml/xmlimp.cxx2
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx2
-rw-r--r--sw/source/uibase/shells/textfld.cxx2
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx6
-rw-r--r--sw/source/uibase/uno/unotxvw.cxx4
65 files changed, 594 insertions, 604 deletions
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();
}
@@ -1438,9 +1438,9 @@ bool SwUndo::FillSaveDataForFormat(
rSData.clear();
const SwPosition *pStt = rRange.Start(), *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];
diff --git a/sw/source/core/undo/unfmco.cxx b/sw/source/core/undo/unfmco.cxx
index 118cf98f399e..7ea43d0d5fef 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 636680d105e0..dcd3c4c689f0 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -502,7 +502,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))
{
}
@@ -769,7 +769,7 @@ void SwUndoReplace::Impl::SetEnd(SwPaM const& rPam)
}
SwUndoReRead::SwUndoReRead( const SwPaM& rPam, const SwGrfNode& rGrfNd )
- : SwUndo( SwUndoId::REREAD, rPam.GetDoc() ), mnPosition( rPam.GetPoint()->nNode.GetIndex() )
+ : SwUndo( SwUndoId::REREAD, &rPam.GetDoc() ), mnPosition( rPam.GetPoint()->nNode.GetIndex() )
{
SaveGraphicData( rGrfNd );
}
diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx
index 9c4f5ce8f84e..abe14f49bb31 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)
@@ -42,9 +42,9 @@ SwUndoMove::SwUndoMove( const SwPaM& rRange, const SwPosition& rMvPos )
, m_bMoveRedlines(false)
{
// get StartNode from footnotes before delete!
- SwDoc* pDoc = rRange.GetDoc();
- SwTextNode* pTextNd = pDoc->GetNodes()[ m_nSttNode ]->GetTextNode();
- SwTextNode* pEndTextNd = pDoc->GetNodes()[ m_nEndNode ]->GetTextNode();
+ SwDoc& rDoc = rRange.GetDoc();
+ SwTextNode* pTextNd = rDoc.GetNodes()[ m_nSttNode ]->GetTextNode();
+ SwTextNode* pEndTextNd = rDoc.GetNodes()[ m_nEndNode ]->GetTextNode();
m_pHistory.reset( new SwHistory );
@@ -290,8 +290,8 @@ void SwUndoMove::RedoImpl(::sw::UndoRedoContext & rContext)
void SwUndoMove::DelFootnote( const SwPaM& rRange )
{
// is the current move from ContentArea into the special section?
- SwDoc* pDoc = rRange.GetDoc();
- sal_uLong nContentStt = pDoc->GetNodes().GetEndOfAutotext().GetIndex();
+ SwDoc& rDoc = rRange.GetDoc();
+ sal_uLong nContentStt = rDoc.GetNodes().GetEndOfAutotext().GetIndex();
if( m_nMoveDestNode < nContentStt &&
rRange.GetPoint()->nNode.GetIndex() >= nContentStt )
{
diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx
index 2a1f917f7a2a..603567544bff 100644
--- a/sw/source/core/undo/unnum.cxx
+++ b/sw/source/core/undo/unnum.cxx
@@ -37,7 +37,7 @@ SwUndoInsNum::SwUndoInsNum( const SwNumRule& rOldRule,
}
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 )
{
@@ -153,7 +153,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 )
{
m_aNodes.reserve( std::min<sal_uLong>(m_nEndNode - m_nSttNode, 255) );
m_pHistory.reset( new SwHistory );
@@ -203,7 +203,7 @@ void SwUndoDelNum::AddNode( const SwTextNode& rNd )
}
SwUndoMoveNum::SwUndoMoveNum( const SwPaM& rPam, long 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 )
{
@@ -252,7 +252,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 )
{
diff --git a/sw/source/core/undo/unoutl.cxx b/sw/source/core/undo/unoutl.cxx
index 04341d61aa71..fc2e437a7459 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 )
{
}
diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx
index c3ac1ee27921..b2c1454b1995 100644
--- a/sw/source/core/undo/unovwr.cxx
+++ b/sw/source/core/undo/unovwr.cxx
@@ -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 4b98043a6669..92da377eb1bc 100644
--- a/sw/source/core/undo/unredln.cxx
+++ b/sw/source/core/undo/unredln.cxx
@@ -35,12 +35,12 @@
#include <docedt.hxx>
SwUndoRedline::SwUndoRedline( SwUndoId nUsrId, const SwPaM& rRange )
- : SwUndo( SwUndoId::REDLINE, rRange.GetDoc() ), SwUndRng( rRange ),
+ : SwUndo( SwUndoId::REDLINE, &rRange.GetDoc() ), SwUndRng( rRange ),
mnUserId( nUsrId ),
mbHiddenRedlines( false )
{
// consider Redline
- SwDoc& rDoc = *rRange.GetDoc();
+ SwDoc& rDoc = rRange.GetDoc();
if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
{
switch( mnUserId )
@@ -380,28 +380,28 @@ 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* pDoc = rRg.GetDoc();
- if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
+ SwDoc& rDoc = rRg.GetDoc();
+ if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
{
RedlineType eTyp = m_bInsert ? RedlineType::Insert : RedlineType::Delete;
- m_pRedlineData.reset( new SwRedlineData( eTyp, pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() ) );
- SetRedlineFlags( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() );
+ m_pRedlineData.reset( new SwRedlineData( eTyp, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() ) );
+ SetRedlineFlags( rDoc.getIDocumentRedlineAccess().GetRedlineFlags() );
}
}
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() )
{
- SwDoc* pDoc = rRedl.GetDoc();
- if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
+ SwDoc& rDoc = rRedl.GetDoc();
+ if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
{
m_pRedlineData.reset( new SwRedlineData( rRedl.GetRedlineData() ) );
- SetRedlineFlags( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() );
+ SetRedlineFlags( rDoc.getIDocumentRedlineAccess().GetRedlineFlags() );
}
m_pRedlineSaveDatas.reset( new SwRedlineSaveDatas );
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index cbb09c136387..473033599310 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -77,7 +77,7 @@ SwUndoInsSection::SwUndoInsSection(
SwPaM const& rPam, SwSectionData const& rNewData,
SfxItemSet const*const pSet,
std::pair<SwTOXBase const*, sw::RedlineMode> const*const pTOXBase)
- : SwUndo( SwUndoId::INSSECTION, rPam.GetDoc() ), SwUndRng( rPam )
+ : SwUndo( SwUndoId::INSSECTION, &rPam.GetDoc() ), SwUndRng( rPam )
, m_pSectionData(new SwSectionData(rNewData))
, m_pTOXBase( pTOXBase
? std::make_unique<std::pair<SwTOXBase *, sw::RedlineMode>>(
@@ -89,7 +89,7 @@ SwUndoInsSection::SwUndoInsSection(
, m_bSplitAtEnd(false)
, m_bUpdateFootnote(false)
{
- SwDoc& rDoc = *rPam.GetDoc();
+ SwDoc& rDoc = rPam.GetDoc();
if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
{
m_pRedlData.reset(new SwRedlineData( RedlineType::Insert,
diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx
index 0ae3bd9e7493..0ba092994685 100644
--- a/sw/source/core/undo/unsort.cxx
+++ b/sw/source/core/undo/unsort.cxx
@@ -42,7 +42,7 @@ SwSortUndoElement::~SwSortUndoElement()
}
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)
{
@@ -233,7 +233,7 @@ void SwUndoSort::RepeatImpl(::sw::RepeatContext & rContext)
if(!m_pSortOptions->bTable)
{
SwPaM *const pPam = & rContext.GetRepeatPaM();
- SwDoc& rDoc = *pPam->GetDoc();
+ SwDoc& rDoc = pPam->GetDoc();
if( !rDoc.IsIdxInTable( pPam->Start()->nNode ) )
rDoc.SortText(*pPam, *m_pSortOptions);
diff --git a/sw/source/core/undo/unspnd.cxx b/sw/source/core/undo/unspnd.cxx
index be2d009ad7a1..089883803e4d 100644
--- a/sw/source/core/undo/unspnd.cxx
+++ b/sw/source/core/undo/unspnd.cxx
@@ -158,8 +158,8 @@ void SwUndoSplitNode::RedoImpl(::sw::UndoRedoContext & rContext)
rPam.GetPoint()->nContent.Assign( pTNd, m_nContent );
- SwDoc* pDoc = rPam.GetDoc();
- pDoc->getIDocumentContentOperations().SplitNode( *rPam.GetPoint(), m_bCheckTableStart );
+ SwDoc& rDoc = rPam.GetDoc();
+ rDoc.getIDocumentContentOperations().SplitNode( *rPam.GetPoint(), m_bCheckTableStart );
if (m_pHistory)
{
@@ -168,7 +168,7 @@ void SwUndoSplitNode::RedoImpl(::sw::UndoRedoContext & rContext)
if( !(( m_pRedlineData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() )) ||
( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
- !pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() )))
+ !rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() )))
return;
rPam.SetMark();
@@ -176,13 +176,13 @@ void SwUndoSplitNode::RedoImpl(::sw::UndoRedoContext & rContext)
{
if( m_pRedlineData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ))
{
- RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags();
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld & ~RedlineFlags::Ignore);
- pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *m_pRedlineData, rPam ), true);
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
+ RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
+ rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld & ~RedlineFlags::Ignore);
+ rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *m_pRedlineData, rPam ), true);
+ rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
}
else
- pDoc->getIDocumentRedlineAccess().SplitRedline( rPam );
+ rDoc.getIDocumentRedlineAccess().SplitRedline( rPam );
rPam.Exchange();
}
rPam.DeleteMark();
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 2e8031631cef..f5f853503174 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -696,14 +696,14 @@ 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 )
m_pAutoFormat.reset( new SwTableAutoFormat( *pAFormat ) );
const SwPosition* pEnd = rRg.End();
- SwNodes& rNds = rRg.GetDoc()->GetNodes();
+ SwNodes& rNds = rRg.GetDoc().GetNodes();
m_bSplitEnd = pEnd->nContent.GetIndex() && ( pEnd->nContent.GetIndex()
!= pEnd->nNode.GetNode().GetContentNode()->Len() ||
pEnd->nNode.GetIndex() >= rNds.GetEndOfContent().GetIndex()-1 );
@@ -1838,7 +1838,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.GetNode().FindTableNode();
OSL_ENSURE( pTableNd, "Where is the TableNode?" );
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 8c706cd22836..c625dad74495 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -63,7 +63,7 @@ GetFlysAnchoredAt(SwDoc & rDoc, sal_uLong const nSttNode)
//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)
@@ -72,7 +72,7 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
, m_nSetPos(0)
{
m_pHistory.reset( new SwHistory );
- SwDoc* pDoc = rPam.GetDoc();
+ SwDoc& rDoc = rPam.GetDoc();
SwTextNode* pTextNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
if( pTextNd )
@@ -88,13 +88,13 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
// These flys will be saved in pFrameFormats array (only flys which exist BEFORE insertion!)
// Then in SwUndoInserts::SetInsertRange the flys saved in pFrameFormats will NOT create Undos.
// m_FlyUndos will only be filled with newly inserted flys.
- m_pFrameFormats = sw::GetFlysAnchoredAt(*pDoc, m_nSttNode);
+ m_pFrameFormats = sw::GetFlysAnchoredAt(rDoc, m_nSttNode);
}
// consider Redline
- if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
+ if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
{
- m_pRedlineData.reset( new SwRedlineData( RedlineType::Insert, pDoc->getIDocumentRedlineAccess().GetRedlineAuthor() ) );
- SetRedlineFlags( pDoc->getIDocumentRedlineAccess().GetRedlineFlags() );
+ m_pRedlineData.reset( new SwRedlineData( RedlineType::Insert, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() ) );
+ SetRedlineFlags( rDoc.getIDocumentRedlineAccess().GetRedlineFlags() );
}
}
@@ -139,11 +139,11 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, bool bScanFlys,
return;
// than collect all new Flys
- SwDoc* pDoc = rPam.GetDoc();
- const size_t nArrLen = pDoc->GetSpzFrameFormats()->size();
+ SwDoc& rDoc = rPam.GetDoc();
+ const size_t nArrLen = rDoc.GetSpzFrameFormats()->size();
for( size_t n = 0; n < nArrLen; ++n )
{
- SwFrameFormat* pFormat = (*pDoc->GetSpzFrameFormats())[n];
+ SwFrameFormat* pFormat = (*rDoc.GetSpzFrameFormats())[n];
SwFormatAnchor const*const pAnchor = &pFormat->GetAnchor();
if (IsCreateUndoForNewFly(*pAnchor, m_nSttNode, m_nEndNode))
{
@@ -373,7 +373,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
{
// position cursor onto REDO section
SwPaM& rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
- SwDoc* pDoc = rPam.GetDoc();
+ SwDoc& rDoc = rPam.GetDoc();
rPam.DeleteMark();
rPam.GetPoint()->nNode = m_nSttNode - m_nNodeDiff;
SwContentNode* pCNd = rPam.GetContentNode();
@@ -388,7 +388,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
// retrieve start position for rollback
if( ( m_nSttNode != m_nEndNode || m_nSttContent != m_nEndContent ) && m_pUndoNodeIndex)
{
- auto const pFlysAtInsPos(sw::GetFlysAnchoredAt(*pDoc,
+ auto const pFlysAtInsPos(sw::GetFlysAnchoredAt(rDoc,
rPam.GetPoint()->nNode.GetIndex()));
const bool bMvBkwrd = MovePtBackward(rPam);
@@ -396,7 +396,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
// re-insert content again (first detach m_pUndoNodeIndex!)
sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex();
m_pUndoNodeIndex.reset();
- MoveFromUndoNds(*pDoc, nMvNd, *rPam.GetMark());
+ MoveFromUndoNds(rDoc, nMvNd, *rPam.GetMark());
if (m_nDeleteTextNodes != 0)
{
MovePtForward(rPam, bMvBkwrd);
@@ -420,7 +420,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
}
}
- if (pDoc->GetTextFormatColls()->IsAlive(m_pTextFormatColl))
+ if (rDoc.GetTextFormatColls()->IsAlive(m_pTextFormatColl))
{
SwTextNode* pTextNd = rPam.GetMark()->nNode.GetNode().GetTextNode();
if( pTextNd )
@@ -428,7 +428,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
}
m_pTextFormatColl = pSavTextFormatColl;
- if (m_pLastNodeColl && pDoc->GetTextFormatColls()->IsAlive(m_pLastNodeColl)
+ if (m_pLastNodeColl && rDoc.GetTextFormatColls()->IsAlive(m_pLastNodeColl)
&& rPam.GetPoint()->nNode != rPam.GetMark()->nNode)
{
SwTextNode* pTextNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
@@ -438,7 +438,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
// tdf#108124 the SwHistoryChangeFlyAnchor/SwHistoryFlyCnt must run before
// m_FlyUndos as they were created by DelContentIndex()
- m_pHistory->Rollback( pDoc, m_nSetPos );
+ m_pHistory->Rollback( &rDoc, m_nSetPos );
// tdf#108124 (10/25/2017)
// During UNDO we call SwUndoInsLayFormat::UndoImpl in reverse order,
@@ -455,14 +455,14 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
if( m_pRedlineData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ))
{
- RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags();
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld & ~RedlineFlags::Ignore );
- pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *m_pRedlineData, rPam ), true);
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
+ RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
+ rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld & ~RedlineFlags::Ignore );
+ rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *m_pRedlineData, rPam ), true);
+ rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
}
else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) &&
- !pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() )
- pDoc->getIDocumentRedlineAccess().SplitRedline(rPam);
+ !rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() )
+ rDoc.getIDocumentRedlineAccess().SplitRedline(rPam);
}
void SwUndoInserts::RepeatImpl(::sw::RepeatContext & rContext)
@@ -470,7 +470,7 @@ void SwUndoInserts::RepeatImpl(::sw::RepeatContext & rContext)
SwPaM aPam( rContext.GetDoc().GetNodes().GetEndOfContent() );
SetPaM( aPam );
SwPaM & rRepeatPaM( rContext.GetRepeatPaM() );
- aPam.GetDoc()->getIDocumentContentOperations().CopyRange( aPam, *rRepeatPaM.GetPoint(), SwCopyFlags::CheckPosInFly);
+ aPam.GetDoc().getIDocumentContentOperations().CopyRange( aPam, *rRepeatPaM.GetPoint(), SwCopyFlags::CheckPosInFly);
}
SwUndoInsDoc::SwUndoInsDoc( const SwPaM& rPam )
diff --git a/sw/source/core/unocore/unocrsr.cxx b/sw/source/core/unocore/unocrsr.cxx
index 115326eabbf7..bbb70f15313c 100644
--- a/sw/source/core/unocore/unocrsr.cxx
+++ b/sw/source/core/unocore/unocrsr.cxx
@@ -34,8 +34,8 @@ SwUnoCursor::SwUnoCursor( const SwPosition &rPos )
SwUnoCursor::~SwUnoCursor()
{
- SwDoc* pDoc = GetDoc();
- if( !pDoc->IsInDtor() )
+ SwDoc& rDoc = GetDoc();
+ if( !rDoc.IsInDtor() )
{
assert(!m_aNotifier.HasListeners());
}
@@ -69,8 +69,8 @@ bool SwUnoCursor::IsSelOvr( SwCursorSelOverFlags eFlags )
{
if (m_bRemainInSection)
{
- SwDoc* pDoc = GetDoc();
- SwNodeIndex aOldIdx( *pDoc->GetNodes()[ GetSavePos()->nNode ] );
+ SwDoc& rDoc = GetDoc();
+ SwNodeIndex aOldIdx( *rDoc.GetNodes()[ GetSavePos()->nNode ] );
SwNodeIndex& rPtIdx = GetPoint()->nNode;
SwStartNode *pOldSttNd = aOldIdx.GetNode().StartOfSectionNode(),
*pNewSttNd = rPtIdx.GetNode().StartOfSectionNode();
@@ -116,7 +116,7 @@ bool SwUnoCursor::IsSelOvr( SwCursorSelOverFlags eFlags )
rPtIdx.Assign( *pInvalidNode->EndOfSectionNode(), 1 );
if( !rPtIdx.GetNode().IsContentNode() &&
- ( !pDoc->GetNodes().GoNextSection( &rPtIdx ) ||
+ ( !rDoc.GetNodes().GoNextSection( &rPtIdx ) ||
rPtIdx > pOldSttNd->EndOfSectionIndex() ) )
break;
}
@@ -172,7 +172,7 @@ bool SwUnoTableCursor::IsSelOvr( SwCursorSelOverFlags eFlags )
if( !bRet )
{
const SwTableNode* pTNd = GetPoint()->nNode.GetNode().FindTableNode();
- bRet = !(pTNd == GetDoc()->GetNodes()[ GetSavePos()->nNode ]->
+ bRet = !(pTNd == GetDoc().GetNodes()[ GetSavePos()->nNode ]->
FindTableNode() && (!HasMark() ||
pTNd == GetMark()->nNode.GetNode().FindTableNode() ));
}
@@ -186,7 +186,7 @@ void SwUnoTableCursor::MakeBoxSels()
if( GetPoint()->nNode.GetIndex() && GetMark()->nNode.GetIndex() &&
nullptr != ( pCNd = GetContentNode() ) && pCNd->getLayoutFrame( pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() ) &&
nullptr != ( pCNd = GetContentNode(false) ) && pCNd->getLayoutFrame( pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() ) )
- bMakeTableCursors = GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->MakeTableCursors( *this );
+ bMakeTableCursors = GetDoc().getIDocumentLayoutAccess().GetCurrentLayout()->MakeTableCursors( *this );
if ( !bMakeTableCursors )
{
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 6727693d0bcf..8e51f25a51b8 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -185,7 +185,7 @@ void GetSelectableFromAny(uno::Reference<uno::XInterface> const& xIfc,
if (pRanges)
{
SwUnoCursor const* pUnoCursor = pRanges->GetCursor();
- if (pUnoCursor && pUnoCursor->GetDoc() == &rTargetDoc)
+ if (pUnoCursor && &pUnoCursor->GetDoc() == &rTargetDoc)
{
o_rpPaM = lcl_createPamCopy(*pUnoCursor);
}
@@ -256,7 +256,7 @@ void GetSelectableFromAny(uno::Reference<uno::XInterface> const& xIfc,
if (pCellRange)
{
SwUnoCursor const*const pUnoCursor(pCellRange->GetTableCursor());
- if (pUnoCursor && pUnoCursor->GetDoc() == &rTargetDoc)
+ if (pUnoCursor && &pUnoCursor->GetDoc() == &rTargetDoc)
{
// probably can't copy it to o_rpPaM for this since it's
// a SwTableCursor
@@ -545,7 +545,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry
static_cast<SwTOXMark &>((*marks.begin())->GetAttr());
const uno::Reference< text::XDocumentIndexMark > xRef =
SwXDocumentIndexMark::CreateXDocumentIndexMark(
- *rPam.GetDoc(), &rMark);
+ rPam.GetDoc(), &rMark);
(*pAny) <<= xRef;
}
}
@@ -563,7 +563,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry
if( pAny )
{
const uno::Reference< text::XDocumentIndex > xRef =
- SwXDocumentIndex::CreateXDocumentIndex(*rPam.GetDoc(),
+ SwXDocumentIndex::CreateXDocumentIndex(rPam.GetDoc(),
static_cast<SwTOXBaseSection *>(pBase));
(*pAny) <<= xRef;
}
@@ -576,7 +576,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry
{
const SwPosition *pPos = rPam.Start();
const SwTextNode *pTextNd =
- rPam.GetDoc()->GetNodes()[pPos->nNode.GetIndex()]->GetTextNode();
+ rPam.GetDoc().GetNodes()[pPos->nNode.GetIndex()]->GetTextNode();
const SwTextAttr* pTextAttr = pTextNd
? pTextNd->GetFieldTextAttrAt( pPos->nContent.GetIndex(), true )
: nullptr;
@@ -585,7 +585,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry
if( pAny )
{
uno::Reference<text::XTextField> const xField(
- SwXTextField::CreateXTextField(rPam.GetDoc(),
+ SwXTextField::CreateXTextField(&rPam.GetDoc(),
&pTextAttr->GetFormatField()));
*pAny <<= xField;
}
@@ -686,7 +686,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry
if( pAny )
{
const uno::Reference< text::XFootnote > xFootnote =
- SwXFootnote::CreateXFootnote(*rPam.GetDoc(),
+ SwXFootnote::CreateXFootnote(rPam.GetDoc(),
&const_cast<SwFormatFootnote&>(rFootnote));
*pAny <<= xFootnote;
}
@@ -712,7 +712,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry
{ // hmm... can only return 1 here
const SwFormatRefMark& rRef = (*marks.begin())->GetRefMark();
uno::Reference<XTextContent> const xRef =
- SwXReferenceMark::CreateXReferenceMark(*rPam.GetDoc(),
+ SwXReferenceMark::CreateXReferenceMark(rPam.GetDoc(),
const_cast<SwFormatRefMark*>(&rRef));
*pAny <<= xRef;
}
@@ -832,7 +832,7 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
auto pSwNum = comphelper::getUnoTunnelImplementation<SwXNumberingRules>(xIndexReplace);
if(pSwNum)
{
- SwDoc* pDoc = rPam.GetDoc();
+ SwDoc& rDoc = rPam.GetDoc();
if(pSwNum->GetNumRule())
{
SwNumRule aRule(*pSwNum->GetNumRule());
@@ -856,11 +856,11 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
{
// get CharStyle and set the rule
- const size_t nChCount = pDoc->GetCharFormats()->size();
+ const size_t nChCount = rDoc.GetCharFormats()->size();
SwCharFormat* pCharFormat = nullptr;
for(size_t nCharFormat = 0; nCharFormat < nChCount; ++nCharFormat)
{
- SwCharFormat& rChFormat = *((*(pDoc->GetCharFormats()))[nCharFormat]);
+ SwCharFormat& rChFormat = *((*(rDoc.GetCharFormats()))[nCharFormat]);
if(rChFormat.GetName() == pNewCharStyles[i])
{
pCharFormat = &rChFormat;
@@ -870,7 +870,7 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
if(!pCharFormat)
{
- SfxStyleSheetBasePool* pPool = pDoc->GetDocShell()->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pPool = rDoc.GetDocShell()->GetStyleSheetPool();
SfxStyleSheetBase* pBase;
pBase = pPool->Find(pNewCharStyles[i], SfxStyleFamily::Char);
// shall it really be created?
@@ -890,7 +890,7 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
)
{
const SvxFontListItem* pFontListItem =
- static_cast<const SvxFontListItem* >(pDoc->GetDocShell()
+ static_cast<const SvxFontListItem* >(rDoc.GetDocShell()
->GetItem( SID_ATTR_CHAR_FONTLIST ));
const FontList* pList = pFontListItem->GetFontList();
@@ -901,51 +901,51 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
}
aRule.Set( i, aFormat );
}
- UnoActionContext aAction(pDoc);
+ UnoActionContext aAction(&rDoc);
if( rPam.GetNext() != &rPam ) // Multiple selection?
{
- pDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
+ rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
SwPamRanges aRangeArr( rPam );
SwPaM aPam( *rPam.GetPoint() );
for ( size_t n = 0; n < aRangeArr.Count(); ++n )
{
// no start of a new list
- pDoc->SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
+ rDoc.SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
}
- pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
+ rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
}
else
{
// no start of a new list
- pDoc->SetNumRule( rPam, aRule, false );
+ rDoc.SetNumRule( rPam, aRule, false );
}
}
else if(!pSwNum->GetCreatedNumRuleName().isEmpty())
{
- UnoActionContext aAction( pDoc );
- SwNumRule* pRule = pDoc->FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
+ UnoActionContext aAction( &rDoc );
+ SwNumRule* pRule = rDoc.FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
if ( !pRule )
throw RuntimeException();
// no start of a new list
- pDoc->SetNumRule( rPam, *pRule, false );
+ rDoc.SetNumRule( rPam, *pRule, false );
}
else
{
// #i103817#
// outline numbering
- UnoActionContext aAction(pDoc);
- SwNumRule* pRule = pDoc->GetOutlineNumRule();
+ UnoActionContext aAction(&rDoc);
+ SwNumRule* pRule = rDoc.GetOutlineNumRule();
if(!pRule)
throw RuntimeException();
- pDoc->SetNumRule( rPam, *pRule, false );
+ rDoc.SetNumRule( rPam, *pRule, false );
}
}
}
else if ( rValue.getValueType() == cppu::UnoType<void>::get() )
{
- rPam.GetDoc()->DelNumRules(rPam);
+ rPam.GetDoc().DelNumRules(rPam);
}
}
@@ -967,7 +967,7 @@ void GetCurPageStyle(SwPaM const & rPaM, OUString &rString)
{
if (!rPaM.GetContentNode())
return; // TODO: is there an easy way to get it for tables/sections?
- SwRootFrame* pLayout = rPaM.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout();
+ SwRootFrame* pLayout = rPaM.GetDoc().getIDocumentLayoutAccess().GetCurrentLayout();
// Consider the position inside the content node, since the node may span over multiple pages
// with different page styles.
SwContentFrame* pFrame = rPaM.GetContentNode()->getLayoutFrame(pLayout, rPaM.GetPoint());
@@ -985,7 +985,7 @@ void GetCurPageStyle(SwPaM const & rPaM, OUString &rString)
// reset special properties of the cursor
void resetCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPam)
{
- SwDoc* pDoc = rPam.GetDoc();
+ SwDoc& rDoc = rPam.GetDoc();
switch(rEntry.nWID)
{
case FN_UNO_PARA_STYLE :
@@ -994,19 +994,19 @@ void resetCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& r
break;
case FN_UNO_NUM_START_VALUE :
{
- UnoActionContext aAction(pDoc);
+ UnoActionContext aAction(&rDoc);
if( rPam.GetNext() != &rPam ) // Multiple selection?
{
- pDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
+ rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
SwPamRanges aRangeArr( rPam );
SwPaM aPam( *rPam.GetPoint() );
for( size_t n = 0; n < aRangeArr.Count(); ++n )
- pDoc->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
- pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
+ rDoc.SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
+ rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
}
else
- pDoc->SetNodeNumStart( *rPam.GetPoint(), 0 );
+ rDoc.SetNodeNumStart( *rPam.GetPoint(), 0 );
}
break;
@@ -1018,7 +1018,7 @@ void resetCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& r
{
std::set<sal_uInt16> aWhichIds;
aWhichIds.insert( RES_TXTATR_CHARFMT);
- pDoc->ResetAttrs(rPam, true, aWhichIds);
+ rDoc.ResetAttrs(rPam, true, aWhichIds);
}
break;
}
@@ -1028,8 +1028,8 @@ void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL,
const uno::Sequence< beans::PropertyValue >& rOptions)
{
std::unique_ptr<SfxMedium> pMed;
- SwDoc* pDoc = pUnoCursor->GetDoc();
- SwDocShell* pDocSh = pDoc->GetDocShell();
+ SwDoc& rDoc = pUnoCursor->GetDoc();
+ SwDocShell* pDocSh = rDoc.GetDocShell();
utl::MediaDescriptor aMediaDescriptor( rOptions );
OUString sFileName = rURL;
OUString sFilterName, sFilterOptions, sPassword, sBaseURL;
@@ -1128,10 +1128,10 @@ void InsertFile(SwUnoCursor* pUnoCursor, const OUString& rURL,
if( !pRead )
return;
- UnoActionContext aContext(pDoc);
+ UnoActionContext aContext(&rDoc);
if(pUnoCursor->HasMark())
- pDoc->getIDocumentContentOperations().DeleteAndJoin(*pUnoCursor);
+ rDoc.getIDocumentContentOperations().DeleteAndJoin(*pUnoCursor);
SwNodeIndex aSave( pUnoCursor->GetPoint()->nNode, -1 );
sal_Int32 nContent = pUnoCursor->GetPoint()->nContent.GetIndex();
@@ -1229,7 +1229,7 @@ void makeRedline( SwPaM const & rPaM,
const OUString& rRedlineType,
const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
{
- IDocumentRedlineAccess* pRedlineAccess = &rPaM.GetDoc()->getIDocumentRedlineAccess();
+ IDocumentRedlineAccess& rRedlineAccess = rPaM.GetDoc().getIDocumentRedlineAccess();
RedlineType eType;
if ( rRedlineType == "Insert" )
@@ -1250,7 +1250,7 @@ void makeRedline( SwPaM const & rPaM,
std::size_t nAuthor = 0;
OUString sAuthor;
if( aPropMap.getValue("RedlineAuthor") >>= sAuthor )
- nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
+ nAuthor = rRedlineAccess.InsertRedlineAuthor(sAuthor);
OUString sComment;
SwRedlineData aRedlineData( eType, nAuthor );
@@ -1288,7 +1288,7 @@ void makeRedline( SwPaM const & rPaM,
// Check if there are any properties
if (aRevertProperties.hasElements())
{
- SwDoc *const pDoc = rPaM.GetDoc();
+ SwDoc& rDoc = rPaM.GetDoc();
// Build set of attributes we want to fetch
std::vector<sal_uInt16> aWhichPairs;
@@ -1334,7 +1334,7 @@ void makeRedline( SwPaM const & rPaM,
sal_uInt16 nStylePoolId = USHRT_MAX;
OUString sParaStyleName;
aWhichPairs.push_back(0); // terminate
- SfxItemSet aItemSet(pDoc->GetAttrPool(), aWhichPairs.data());
+ SfxItemSet aItemSet(rDoc.GetAttrPool(), aWhichPairs.data());
for (size_t i = 0; i < aEntries.size(); ++i)
{
@@ -1348,7 +1348,7 @@ void makeRedline( SwPaM const & rPaM,
{
aItemSet.Put( SwNumRuleItem( xNumberingRules->getName() ));
// keep it during export
- SwNumRule* pRule = pDoc->FindNumRulePtr(
+ SwNumRule* pRule = rDoc.FindNumRulePtr(
xNumberingRules->getName());
if (pRule)
pRule->SetUsedByRedline(true);
@@ -1373,13 +1373,13 @@ void makeRedline( SwPaM const & rPaM,
}
SwRangeRedline* pRedline = new SwRangeRedline( aRedlineData, rPaM );
- RedlineFlags nPrevMode = pRedlineAccess->GetRedlineFlags( );
+ RedlineFlags nPrevMode = rRedlineAccess.GetRedlineFlags( );
// xRedlineExtraData is copied here
pRedline->SetExtraData( xRedlineExtraData.get() );
- pRedlineAccess->SetRedlineFlags_intern(RedlineFlags::On);
- auto const result(pRedlineAccess->AppendRedline(pRedline, false));
- pRedlineAccess->SetRedlineFlags_intern( nPrevMode );
+ rRedlineAccess.SetRedlineFlags_intern(RedlineFlags::On);
+ auto const result(rRedlineAccess.AppendRedline(pRedline, false));
+ rRedlineAccess.SetRedlineFlags_intern( nPrevMode );
if (IDocumentRedlineAccess::AppendResult::IGNORED == result)
throw lang::IllegalArgumentException();
}
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 5242276dfdd3..fa2fdfb24944 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -2046,7 +2046,7 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
else if (pCursor)
pDoc = pCursor->GetDoc();
else if (pPortion)
- pDoc = pPortion->GetCursor().GetDoc();
+ pDoc = &pPortion->GetCursor().GetDoc();
else if (pParagraph && pParagraph->GetTextNode())
pDoc = &pParagraph->GetTextNode()->GetDoc();
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index cd1504545971..4fdd9544a402 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2059,7 +2059,7 @@ void SAL_CALL SwXTextField::attach(
OSL_ENSURE( pField != nullptr, "<SwXTextField::attach(..)> - annotation field missing!" );
if ( pField != nullptr )
{
- IDocumentMarkAccess* pMarksAccess = aIntPam.GetDoc()->getIDocumentMarkAccess();
+ IDocumentMarkAccess* pMarksAccess = aIntPam.GetDoc().getIDocumentMarkAccess();
pMarksAccess->makeAnnotationMark( aIntPam, pField->GetName() );
}
}
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index d74cf65358f1..9cfe87f04901 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -1902,8 +1902,8 @@ void SwXDocumentIndexMark::Impl::InsertTOXMark(
SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam,
SwXTextCursor const*const pTextCursor)
{
- SwDoc *const pDoc( rPam.GetDoc() );
- UnoActionContext aAction(pDoc);
+ SwDoc& rDoc(rPam.GetDoc());
+ UnoActionContext aAction(&rDoc);
bool bMark = *rPam.GetPoint() != *rPam.GetMark();
// n.b.: toxmarks must have either alternative text or an extent
if (bMark && !rMark.GetAlternativeText().isEmpty())
@@ -1928,7 +1928,7 @@ void SwXDocumentIndexMark::Impl::InsertTOXMark(
// rMark gets copied into the document pool;
// pNewTextAttr comes back with the real format
SwTextAttr *pNewTextAttr = nullptr;
- pDoc->getIDocumentContentOperations().InsertPoolItem(rPam, rMark, nInsertFlags,
+ rDoc.getIDocumentContentOperations().InsertPoolItem(rPam, rMark, nInsertFlags,
/*pLayout*/nullptr, /*bExpandCharToPara*/false, &pNewTextAttr);
if (bMark && *rPam.GetPoint() > *rPam.GetMark())
{
@@ -1942,7 +1942,7 @@ void SwXDocumentIndexMark::Impl::InsertTOXMark(
nullptr);
}
- m_pDoc = pDoc;
+ m_pDoc = &rDoc;
m_pTOXMark = &pNewTextAttr->GetTOXMark();
m_pTOXType = &rTOXType;
EndListeningAll();
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 01d777dccd4b..ef08aeb38e89 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -176,9 +176,9 @@ void SwUnoCursorHelper::GetTextFromPam(SwPaM & rPam, OUString & rBuffer,
/// @throws lang::IllegalArgumentException
/// @throws uno::RuntimeException
static void
-lcl_setCharStyle(SwDoc *const pDoc, const uno::Any & rValue, SfxItemSet & rSet)
+lcl_setCharStyle(SwDoc& rDoc, const uno::Any & rValue, SfxItemSet & rSet)
{
- SwDocShell *const pDocSh = pDoc->GetDocShell();
+ SwDocShell *const pDocSh = rDoc.GetDocShell();
if(!pDocSh)
return;
@@ -228,8 +228,8 @@ lcl_setAutoStyle(IStyleAccess & rStyleAccess, const uno::Any & rValue,
void
SwUnoCursorHelper::SetTextFormatColl(const uno::Any & rAny, SwPaM & rPaM)
{
- SwDoc *const pDoc = rPaM.GetDoc();
- SwDocShell *const pDocSh = pDoc->GetDocShell();
+ SwDoc& rDoc = rPaM.GetDoc();
+ SwDocShell *const pDocSh = rDoc.GetDocShell();
if(!pDocSh)
return;
OUString uStyle;
@@ -245,14 +245,14 @@ SwUnoCursorHelper::SetTextFormatColl(const uno::Any & rAny, SwPaM & rPaM)
}
SwTextFormatColl *const pLocal = pStyle->GetCollection();
- UnoActionContext aAction(pDoc);
- pDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
+ UnoActionContext aAction(&rDoc);
+ rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
SwPaM *pTmpCursor = &rPaM;
do {
- pDoc->SetTextFormatColl(*pTmpCursor, pLocal);
+ rDoc.SetTextFormatColl(*pTmpCursor, pLocal);
pTmpCursor = pTmpCursor->GetNext();
} while ( pTmpCursor != &rPaM );
- pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
+ rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
}
bool
@@ -311,26 +311,26 @@ lcl_SetNodeNumStart(SwPaM & rCursor, uno::Any const& rValue)
sal_Int16 nTmp = 1;
rValue >>= nTmp;
sal_uInt16 nStt = (nTmp < 0 ? USHRT_MAX : static_cast<sal_uInt16>(nTmp));
- SwDoc* pDoc = rCursor.GetDoc();
- UnoActionContext aAction(pDoc);
+ SwDoc& rDoc = rCursor.GetDoc();
+ UnoActionContext aAction(&rDoc);
if( rCursor.GetNext() != &rCursor ) // MultiSelection?
{
- pDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
+ rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );
SwPamRanges aRangeArr( rCursor );
SwPaM aPam( *rCursor.GetPoint() );
for( size_t n = 0; n < aRangeArr.Count(); ++n )
{
- pDoc->SetNumRuleStart(*aRangeArr.SetPam( n, aPam ).GetPoint());
- pDoc->SetNodeNumStart(*aRangeArr.SetPam( n, aPam ).GetPoint(),
+ rDoc.SetNumRuleStart(*aRangeArr.SetPam( n, aPam ).GetPoint());
+ rDoc.SetNodeNumStart(*aRangeArr.SetPam( n, aPam ).GetPoint(),
nStt );
}
- pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
+ rDoc.GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
}
else
{
- pDoc->SetNumRuleStart( *rCursor.GetPoint());
- pDoc->SetNodeNumStart( *rCursor.GetPoint(), nStt );
+ rDoc.SetNumRuleStart( *rCursor.GetPoint());
+ rDoc.SetNodeNumStart( *rCursor.GetPoint(), nStt );
}
}
@@ -346,10 +346,10 @@ lcl_setCharFormatSequence(SwPaM & rPam, uno::Any const& rValue)
for (sal_Int32 nStyle = 0; nStyle < aCharStyles.getLength(); nStyle++)
{
uno::Any aStyle;
- rPam.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::START, nullptr);
+ rPam.GetDoc().GetIDocumentUndoRedo().StartUndo(SwUndoId::START, nullptr);
aStyle <<= aCharStyles.getConstArray()[nStyle];
// create a local set and apply each format directly
- SfxItemSet aSet(rPam.GetDoc()->GetAttrPool(),
+ SfxItemSet aSet(rPam.GetDoc().GetAttrPool(),
svl::Items<RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT>{});
lcl_setCharStyle(rPam.GetDoc(), aStyle, aSet);
// the first style should replace the current attributes,
@@ -357,7 +357,7 @@ lcl_setCharFormatSequence(SwPaM & rPam, uno::Any const& rValue)
SwUnoCursorHelper::SetCursorAttr(rPam, aSet, nStyle
? SetAttrMode::DONTREPLACE
: SetAttrMode::DEFAULT);
- rPam.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::START, nullptr);
+ rPam.GetDoc().GetIDocumentUndoRedo().EndUndo(SwUndoId::START, nullptr);
}
return true;
}
@@ -374,12 +374,12 @@ lcl_setDropcapCharStyle(SwPaM const & rPam, SfxItemSet & rItemSet,
OUString sStyle;
SwStyleNameMapper::FillUIName(uStyle, sStyle,
SwGetPoolIdFromName::ChrFmt);
- SwDoc *const pDoc = rPam.GetDoc();
+ SwDoc& rDoc = rPam.GetDoc();
//default character style must not be set as default format
SwDocStyleSheet *const pStyle = static_cast<SwDocStyleSheet*>(
- pDoc->GetDocShell()
+ rDoc.GetDocShell()
->GetStyleSheetPool()->Find(sStyle, SfxStyleFamily::Char));
- if (!pStyle || pStyle->GetCharFormat() == pDoc->GetDfltCharFormat())
+ if (!pStyle || pStyle->GetCharFormat() == rDoc.GetDfltCharFormat())
{
throw lang::IllegalArgumentException();
}
@@ -450,7 +450,7 @@ SwUnoCursorHelper::SetCursorPropertyValue(
lcl_setCharStyle(rPam.GetDoc(), rValue, rItemSet);
break;
case RES_TXTATR_AUTOFMT:
- lcl_setAutoStyle(rPam.GetDoc()->GetIStyleAccess(),
+ lcl_setAutoStyle(rPam.GetDoc().GetIStyleAccess(),
rValue, rItemSet, false);
break;
case FN_UNO_CHARFMT_SEQUENCE:
@@ -460,7 +460,7 @@ SwUnoCursorHelper::SetCursorPropertyValue(
SwUnoCursorHelper::SetTextFormatColl(rValue, rPam);
break;
case RES_AUTO_STYLE:
- lcl_setAutoStyle(rPam.GetDoc()->GetIStyleAccess(),
+ lcl_setAutoStyle(rPam.GetDoc().GetIStyleAccess(),
rValue, rItemSet, true);
break;
case FN_UNO_PAGE_STYLE:
@@ -519,7 +519,7 @@ SwUnoCursorHelper::SetCursorPropertyValue(
// TODO create own map for this, it contains UNO_NAME_DISPLAY_NAME? or make property readable so ODF export can map it to a automatic style?
SfxItemPropertySet const& rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE));
SfxItemPropertyMap const& rMap(rPropSet.getPropertyMap());
- SfxItemSet items( rPam.GetDoc()->GetAttrPool(),
+ SfxItemSet items( rPam.GetDoc().GetAttrPool(),
svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END-1,
RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1>{} );
@@ -563,7 +563,7 @@ SwUnoCursorHelper::SetCursorPropertyValue(
{
throw lang::IllegalArgumentException();
}
- rPam.GetDoc()->SetNumRuleStart(*rPam.GetPoint(), bVal);
+ rPam.GetDoc().SetNumRuleStart(*rPam.GetPoint(), bVal);
}
break;
case FN_UNO_NUM_RULES:
@@ -598,7 +598,7 @@ SwUnoCursorHelper::SetCursorPropertyValue(
if (MID_PAGEDESC_PAGEDESCNAME == rEntry.nMemberId)
{
SwUnoCursorHelper::SetPageDesc(
- rValue, *rPam.GetDoc(), rItemSet);
+ rValue, rPam.GetDoc(), rItemSet);
}
else
{
@@ -630,7 +630,7 @@ SwUnoCursorHelper::GetCurTextFormatColl(SwPaM & rPaM, const bool bConditional)
break;
}
- const SwNodes& rNds = rPaM.GetDoc()->GetNodes();
+ const SwNodes& rNds = rPaM.GetDoc().GetNodes();
for( sal_uLong n = nSttNd; n <= nEndNd; ++n )
{
SwTextNode const*const pNd = rNds[ n ]->GetTextNode();
@@ -697,10 +697,10 @@ SwPaM* SwXTextCursor::GetPaM()
{ return m_pImpl->m_pUnoCursor.get(); }
SwDoc const* SwXTextCursor::GetDoc() const
- { return m_pImpl->m_pUnoCursor ? m_pImpl->m_pUnoCursor->GetDoc() : nullptr; }
+ { return m_pImpl->m_pUnoCursor ? &m_pImpl->m_pUnoCursor->GetDoc() : nullptr; }
SwDoc* SwXTextCursor::GetDoc()
- { return m_pImpl->m_pUnoCursor ? m_pImpl->m_pUnoCursor->GetDoc() : nullptr; }
+ { return m_pImpl->m_pUnoCursor ? &m_pImpl->m_pUnoCursor->GetDoc() : nullptr; }
SwXTextCursor::SwXTextCursor(
SwDoc & rDoc,
@@ -714,7 +714,7 @@ SwXTextCursor::SwXTextCursor(
SwXTextCursor::SwXTextCursor(uno::Reference< text::XText > const& xParent,
SwPaM const& rSourceCursor, const CursorType eType)
- : m_pImpl( new Impl(*rSourceCursor.GetDoc(), eType,
+ : m_pImpl( new Impl(rSourceCursor.GetDoc(), eType,
xParent, *rSourceCursor.GetPoint(),
rSourceCursor.HasMark() ? rSourceCursor.GetMark() : nullptr) )
{
@@ -732,22 +732,22 @@ void SwXTextCursor::DeleteAndInsert(const OUString& rText,
return;
// Start/EndAction
- SwDoc* pDoc = pUnoCursor->GetDoc();
- UnoActionContext aAction(pDoc);
+ SwDoc& rDoc = pUnoCursor->GetDoc();
+ UnoActionContext aAction(&rDoc);
const sal_Int32 nTextLen = rText.getLength();
- pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, nullptr);
+ rDoc.GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, nullptr);
auto pCurrent = pUnoCursor;
do
{
if (pCurrent->HasMark())
{
- pDoc->getIDocumentContentOperations().DeleteAndJoin(*pCurrent);
+ rDoc.getIDocumentContentOperations().DeleteAndJoin(*pCurrent);
}
if(nTextLen)
{
const bool bSuccess(
SwUnoCursorHelper::DocInsertStringSplitCR(
- *pDoc, *pCurrent, rText, bForceExpandHints ) );
+ rDoc, *pCurrent, rText, bForceExpandHints ) );
OSL_ENSURE( bSuccess, "Doc->Insert(Str) failed." );
SwUnoCursorHelper::SelectPam(*pUnoCursor, true);
@@ -755,7 +755,7 @@ void SwXTextCursor::DeleteAndInsert(const OUString& rText,
}
pCurrent = pCurrent->GetNext();
} while (pCurrent != pUnoCursor);
- pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
+ rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
}
namespace {
@@ -1659,7 +1659,7 @@ SwXTextCursor::getStart()
{
// return cursor to prevent modifying SwXTextRange for META
SwXTextCursor * const pXCursor(
- new SwXTextCursor(*rUnoCursor.GetDoc(), xParent, CursorType::Meta,
+ new SwXTextCursor(rUnoCursor.GetDoc(), xParent, CursorType::Meta,
*rUnoCursor.GetPoint()) );
pXCursor->gotoStart(false);
xRet = static_cast<text::XWordCursor*>(pXCursor);
@@ -1685,7 +1685,7 @@ SwXTextCursor::getEnd()
{
// return cursor to prevent modifying SwXTextRange for META
SwXTextCursor * const pXCursor(
- new SwXTextCursor(*rUnoCursor.GetDoc(), xParent, CursorType::Meta,
+ new SwXTextCursor(rUnoCursor.GetDoc(), xParent, CursorType::Meta,
*rUnoCursor.GetPoint()) );
pXCursor->gotoEnd(false);
xRet = static_cast<text::XWordCursor*>(pXCursor);
@@ -1743,7 +1743,7 @@ uno::Any SwUnoCursorHelper::GetPropertyValue(
if (!bDone)
{
SfxItemSet aSet(
- rPaM.GetDoc()->GetAttrPool(),
+ rPaM.GetDoc().GetAttrPool(),
svl::Items<
RES_CHRATR_BEGIN, RES_FRMATR_END - 1,
RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER>{});
@@ -1787,12 +1787,12 @@ void SwUnoCursorHelper::SetPropertyValues(
if (!rPropertyValues.hasElements())
return;
- SwDoc *const pDoc = rPaM.GetDoc();
+ SwDoc& rDoc = rPaM.GetDoc();
OUString aUnknownExMsg, aPropertyVetoExMsg;
// Build set of attributes we want to fetch
const sal_uInt16 zero = 0;
- SfxItemSet aItemSet(pDoc->GetAttrPool(), &zero);
+ SfxItemSet aItemSet(rDoc.GetAttrPool(), &zero);
std::vector<std::pair<const SfxItemPropertySimpleEntry*, const uno::Any&>> aEntries;
aEntries.reserve(rPropertyValues.getLength());
for (const auto& rPropVal : rPropertyValues)
@@ -1924,17 +1924,17 @@ SwUnoCursorHelper::GetPropertyStates(
case SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT:
case SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION:
pSet.reset(
- new SfxItemSet( rPaM.GetDoc()->GetAttrPool(),
+ new SfxItemSet( rPaM.GetDoc().GetAttrPool(),
svl::Items<RES_CHRATR_BEGIN, RES_TXTATR_END>{} ));
break;
case SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY:
pSet.reset(
- new SfxItemSet( rPaM.GetDoc()->GetAttrPool(),
+ new SfxItemSet( rPaM.GetDoc().GetAttrPool(),
{{pEntry->nWID, pEntry->nWID}} ));
break;
default:
pSet.reset( new SfxItemSet(
- rPaM.GetDoc()->GetAttrPool(),
+ rPaM.GetDoc().GetAttrPool(),
svl::Items<
RES_CHRATR_BEGIN, RES_FRMATR_END - 1,
RES_UNKNOWNATR_CONTAINER,
@@ -2006,7 +2006,7 @@ void SwUnoCursorHelper::SetPropertyToDefault(
SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
const OUString& rPropertyName)
{
- SwDoc & rDoc = *rPaM.GetDoc();
+ SwDoc& rDoc = rPaM.GetDoc();
SfxItemPropertySimpleEntry const*const pEntry =
rPropSet.getPropertyMap().getByName(rPropertyName);
if (!pEntry)
@@ -2057,7 +2057,7 @@ uno::Any SwUnoCursorHelper::GetPropertyDefault(
uno::Any aRet;
if (pEntry->nWID < RES_FRMATR_END)
{
- SwDoc & rDoc = *rPaM.GetDoc();
+ SwDoc& rDoc = rPaM.GetDoc();
const SfxPoolItem& rDefItem =
rDoc.GetAttrPool().GetDefaultItem(pEntry->nWID);
rDefItem.QueryValue(aRet, pEntry->nMemberId);
@@ -2336,12 +2336,12 @@ SwXTextCursor::setAllPropertiesToDefault()
lcl_EnumerateIds(g_ResetableSetRange, aWhichIds);
if (!aParaWhichIds.empty())
{
- lcl_SelectParaAndReset(rUnoCursor, *rUnoCursor.GetDoc(),
+ lcl_SelectParaAndReset(rUnoCursor, rUnoCursor.GetDoc(),
aParaWhichIds);
}
if (!aWhichIds.empty())
{
- rUnoCursor.GetDoc()->ResetAttrs(rUnoCursor, true, aWhichIds);
+ rUnoCursor.GetDoc().ResetAttrs(rUnoCursor, true, aWhichIds);
}
}
@@ -2356,7 +2356,7 @@ SwXTextCursor::setPropertiesToDefault(
if ( !rPropertyNames.hasElements() )
return;
- SwDoc & rDoc = *rUnoCursor.GetDoc();
+ SwDoc& rDoc = rUnoCursor.GetDoc();
std::set<sal_uInt16> aWhichIds;
std::set<sal_uInt16> aParaWhichIds;
for (const OUString& rName : rPropertyNames)
@@ -2420,7 +2420,7 @@ SwXTextCursor::getPropertyDefaults(
uno::Sequence< uno::Any > aRet(nCount);
if ( nCount )
{
- SwDoc & rDoc = *rUnoCursor.GetDoc();
+ SwDoc& rDoc = rUnoCursor.GetDoc();
const OUString *pNames = rPropertyNames.getConstArray();
uno::Any *pAny = aRet.getArray();
for (sal_Int32 i = 0; i < nCount; i++)
@@ -2848,7 +2848,7 @@ SwXTextCursor::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor)
{
throw uno::RuntimeException("Bad sort properties");
}
- UnoActionContext aContext( rUnoCursor.GetDoc() );
+ UnoActionContext aContext( &rUnoCursor.GetDoc() );
SwPosition & rStart = *rUnoCursor.Start();
SwPosition & rEnd = *rUnoCursor.End();
@@ -2857,7 +2857,7 @@ SwXTextCursor::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor)
const sal_uLong nOffset = rEnd.nNode.GetIndex() - rStart.nNode.GetIndex();
const sal_Int32 nCntStt = rStart.nContent.GetIndex();
- rUnoCursor.GetDoc()->SortText(rUnoCursor, aSortOpt);
+ rUnoCursor.GetDoc().SortText(rUnoCursor, aSortOpt);
// update selection
rUnoCursor.DeleteMark();
@@ -2901,7 +2901,7 @@ SwXTextCursor::createEnumeration()
throw uno::RuntimeException();
}
- auto pNewCursor(rUnoCursor.GetDoc()->CreateUnoCursor(*rUnoCursor.GetPoint()) );
+ auto pNewCursor(rUnoCursor.GetDoc().CreateUnoCursor(*rUnoCursor.GetPoint()) );
if (rUnoCursor.HasMark())
{
pNewCursor->SetMark();
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index b6b96608e6fb..bfba1dd85a36 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -225,7 +225,7 @@ static SwDoc * lcl_IsNewStyleTable(SwUnoTableCursor const& rCursor)
{
SwTableNode *const pTableNode = rCursor.GetNode().FindTableNode();
return (pTableNode && !pTableNode->GetTable().IsNewModel())
- ? rCursor.GetDoc()
+ ? &rCursor.GetDoc()
: nullptr;
}
@@ -257,12 +257,12 @@ void SwUnoCursorHelper::SetCursorAttr(SwPaM & rPam,
const SetAttrMode nAttrMode, const bool bTableMode)
{
const SetAttrMode nFlags = nAttrMode | SetAttrMode::APICALL;
- SwDoc* pDoc = rPam.GetDoc();
+ SwDoc& rDoc = rPam.GetDoc();
//StartEndAction
- UnoActionContext aAction(pDoc);
+ UnoActionContext aAction(&rDoc);
if (rPam.GetNext() != &rPam) // Ring of Cursors
{
- pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSATTR, nullptr);
+ rDoc.GetIDocumentUndoRedo().StartUndo(SwUndoId::INSATTR, nullptr);
for(SwPaM& rCurrent : rPam.GetRingContainer())
{
@@ -270,15 +270,15 @@ void SwUnoCursorHelper::SetCursorAttr(SwPaM & rPam,
( bTableMode ||
(*rCurrent.GetPoint() != *rCurrent.GetMark()) ))
{
- pDoc->getIDocumentContentOperations().InsertItemSet(rCurrent, rSet, nFlags);
+ rDoc.getIDocumentContentOperations().InsertItemSet(rCurrent, rSet, nFlags);
}
}
- pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSATTR, nullptr);
+ rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::INSATTR, nullptr);
}
else
{
- pDoc->getIDocumentContentOperations().InsertItemSet( rPam, rSet, nFlags );
+ rDoc.getIDocumentContentOperations().InsertItemSet( rPam, rSet, nFlags );
}
if( rSet.GetItemState( RES_PARATR_OUTLINELEVEL, false ) >= SfxItemState::DEFAULT )
@@ -286,7 +286,7 @@ void SwUnoCursorHelper::SetCursorAttr(SwPaM & rPam,
SwTextNode * pTmpNode = rPam.GetNode().GetTextNode();
if ( pTmpNode )
{
- rPam.GetDoc()->GetNodes().UpdateOutlineNode( *pTmpNode );
+ rPam.GetDoc().GetNodes().UpdateOutlineNode( *pTmpNode );
}
}
}
@@ -318,7 +318,7 @@ void SwUnoCursorHelper::GetCursorAttr(SwPaM & rPam,
// all other nodes merge their values into the get set
for (sal_uLong n = nSttNd; n <= nEndNd; ++n)
{
- SwNode *const pNd = rPam.GetDoc()->GetNodes()[ n ];
+ SwNode *const pNd = rPam.GetDoc().GetNodes()[ n ];
switch (pNd->GetNodeType())
{
case SwNodeType::Text:
@@ -527,7 +527,7 @@ SwXParagraphEnumerationImpl::NextElement_Impl()
(CursorType::SelectionInTable == m_eCursorType)))
{
SwPosition* pStart = rUnoCursor.Start();
- auto aNewCursor(rUnoCursor.GetDoc()->CreateUnoCursor(*pStart));
+ auto aNewCursor(rUnoCursor.GetDoc().CreateUnoCursor(*pStart));
// one may also go into tables here
if (CursorType::SelectionInTable != m_eCursorType)
{
@@ -613,7 +613,7 @@ SwXParagraphEnumerationImpl::NextElement_Impl()
else
{
text::XText *const pText = m_xParentText.get();
- xRef = SwXParagraph::CreateXParagraph(*rUnoCursor.GetDoc(),
+ xRef = SwXParagraph::CreateXParagraph(rUnoCursor.GetDoc(),
pStart->nNode.GetNode().GetTextNode(),
static_cast<SwXText*>(pText), nFirstContent, nLastContent);
}
@@ -709,7 +709,7 @@ void SwXTextRange::Impl::Notify(const SfxHint& rHint)
SwXTextRange::SwXTextRange(SwPaM const & rPam,
const uno::Reference< text::XText > & xParent,
const enum RangePosition eRange)
- : m_pImpl( new SwXTextRange::Impl(*rPam.GetDoc(), eRange, nullptr, xParent) )
+ : m_pImpl( new SwXTextRange::Impl(rPam.GetDoc(), eRange, nullptr, xParent) )
{
SetPositions(rPam);
}
@@ -982,7 +982,7 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill,
pCursor =
comphelper::getUnoTunnelImplementation<OTextCursorHelper>(xTextCursor);
}
- if(pRange && &pRange->GetDoc() == rToFill.GetDoc())
+ if(pRange && &pRange->GetDoc() == &rToFill.GetDoc())
{
bRet = pRange->GetPositions(rToFill);
}
@@ -995,10 +995,10 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill,
else
{
SwDoc* const pDoc = pCursor ? pCursor->GetDoc()
- : (pPortion ? pPortion->GetCursor().GetDoc() : nullptr);
+ : (pPortion ? &pPortion->GetCursor().GetDoc() : nullptr);
const SwPaM* const pUnoCursor = pCursor ? pCursor->GetPaM()
: (pPortion ? &pPortion->GetCursor() : nullptr);
- if (pUnoCursor && pDoc == rToFill.GetDoc())
+ if (pUnoCursor && pDoc == &rToFill.GetDoc())
{
OSL_ENSURE(!pUnoCursor->IsMultiSelection(),
"what to do about rings?");
@@ -1420,7 +1420,7 @@ struct SwXTextRangesImpl final : public SwXTextRanges
{
if (pPaM)
{
- m_pUnoCursor.reset(pPaM->GetDoc()->CreateUnoCursor(*pPaM->GetPoint()));
+ m_pUnoCursor.reset(pPaM->GetDoc().CreateUnoCursor(*pPaM->GetPoint()));
::sw::DeepCopyPaM(*pPaM, *GetCursor());
}
MakeRanges();
@@ -1448,7 +1448,7 @@ void SwXTextRangesImpl::MakeRanges()
{
const uno::Reference< text::XTextRange > xRange(
SwXTextRange::CreateXTextRange(
- *rTmpCursor.GetDoc(),
+ rTmpCursor.GetDoc(),
*rTmpCursor.GetPoint(), rTmpCursor.GetMark()));
if (xRange.is())
{
@@ -1499,22 +1499,22 @@ uno::Any SAL_CALL SwXTextRangesImpl::getByIndex(sal_Int32 nIndex)
void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString)
{
// Start/EndAction
- SwDoc *const pDoc = rCursor.GetDoc();
- UnoActionContext aAction(pDoc);
- pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, nullptr);
+ SwDoc& rDoc = rCursor.GetDoc();
+ UnoActionContext aAction(&rDoc);
+ rDoc.GetIDocumentUndoRedo().StartUndo(SwUndoId::INSERT, nullptr);
if (rCursor.HasMark())
{
- pDoc->getIDocumentContentOperations().DeleteAndJoin(rCursor);
+ rDoc.getIDocumentContentOperations().DeleteAndJoin(rCursor);
}
if (!rString.isEmpty())
{
const bool bSuccess( SwUnoCursorHelper::DocInsertStringSplitCR(
- *pDoc, rCursor, rString, false ) );
+ rDoc, rCursor, rString, false ) );
OSL_ENSURE( bSuccess, "DocInsertStringSplitCR" );
SwUnoCursorHelper::SelectPam(rCursor, true);
rCursor.Left(rString.getLength());
}
- pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
+ rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
}
namespace {
@@ -1571,7 +1571,7 @@ SwXParaFrameEnumeration* SwXParaFrameEnumeration::Create(const SwPaM& rPaM, cons
SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl(
const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode,
SwFrameFormat* const pFormat)
- : m_pUnoCursor(rPaM.GetDoc()->CreateUnoCursor(*rPaM.GetPoint()))
+ : m_pUnoCursor(rPaM.GetDoc().CreateUnoCursor(*rPaM.GetPoint()))
{
if (rPaM.HasMark())
{
@@ -1596,7 +1596,7 @@ SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl(
if (PARAFRAME_PORTION_TEXTRANGE == eParaFrameMode)
{
//get all frames that are bound at paragraph or at character
- for(const auto& pFlyFrame : rPaM.GetDoc()->GetAllFlyFormats(&GetCursor(), false, true))
+ for(const auto& pFlyFrame : rPaM.GetDoc().GetAllFlyFormats(&GetCursor(), false, true))
{
const auto pFrameFormat = const_cast<SwFrameFormat*>(&pFlyFrame->GetFormat());
m_vFrames.push_back(std::make_shared<sw::FrameClient>(pFrameFormat));
@@ -1645,7 +1645,7 @@ bool SwXParaFrameEnumerationImpl::CreateNextObject()
const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
OSL_ENSURE(pIdx, "where is the index?");
SwNode const*const pNd =
- m_pUnoCursor->GetDoc()->GetNodes()[ pIdx->GetIndex() + 1 ];
+ m_pUnoCursor->GetDoc().GetNodes()[ pIdx->GetIndex() + 1 ];
if (!pNd->IsNoTextNode())
{
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 2cf496283482..2494aba60516 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -1125,7 +1125,7 @@ SwXParagraph::setPropertyToDefault(const OUString& rPropertyName)
if (pEntry->nWID < RES_PARATR_BEGIN)
{
- aCursor.GetDoc()->ResetAttrs(aCursor, true, aWhichIds);
+ aCursor.GetDoc().ResetAttrs(aCursor, true, aWhichIds);
}
else
{
@@ -1133,7 +1133,7 @@ SwXParagraph::setPropertyToDefault(const OUString& rPropertyName)
// to paragraph boundaries
SwPosition aStart( *aCursor.Start() );
SwPosition aEnd ( *aCursor.End() );
- auto pTemp( aCursor.GetDoc()->CreateUnoCursor(aStart) );
+ auto pTemp( aCursor.GetDoc().CreateUnoCursor(aStart) );
if(!SwUnoCursorHelper::IsStartOfPara(*pTemp))
{
pTemp->MovePara(GoCurrPara, fnParaStart);
@@ -1150,7 +1150,7 @@ SwXParagraph::setPropertyToDefault(const OUString& rPropertyName)
}
- pTemp->GetDoc()->ResetAttrs(*pTemp, true, aWhichIds);
+ pTemp->GetDoc().ResetAttrs(*pTemp, true, aWhichIds);
}
}
else
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 07af7a238484..ea0bca136e13 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -50,7 +50,7 @@ using namespace ::com::sun::star;
void SwXTextPortion::init(const SwUnoCursor* pPortionCursor)
{
- m_pUnoCursor = pPortionCursor->GetDoc()->CreateUnoCursor(*pPortionCursor->GetPoint());
+ m_pUnoCursor = pPortionCursor->GetDoc().CreateUnoCursor(*pPortionCursor->GetPoint());
if (pPortionCursor->HasMark())
{
m_pUnoCursor->SetMark();
@@ -356,7 +356,7 @@ void SwXTextPortion::GetPropertyValue(
if(!pSet)
{
pSet = std::make_unique<SfxItemSet>(
- pUnoCursor->GetDoc()->GetAttrPool(),
+ pUnoCursor->GetDoc().GetAttrPool(),
svl::Items<
RES_CHRATR_BEGIN, RES_FRMATR_END - 1,
RES_UNKNOWNATR_CONTAINER,
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 17f0ac08431b..6be9774ee015 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -317,7 +317,7 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration(
const sal_Int32 nEnd )
: m_Portions()
{
- m_pUnoCursor = rParaCursor.GetDoc()->CreateUnoCursor(*rParaCursor.GetPoint());
+ m_pUnoCursor = rParaCursor.GetDoc().CreateUnoCursor(*rParaCursor.GetPoint());
OSL_ENSURE(nEnd == -1 || (nStart <= nEnd &&
nEnd <= m_pUnoCursor->Start()->nNode.GetNode().GetTextNode()->GetText().getLength()),
@@ -334,7 +334,7 @@ SwXTextPortionEnumeration::SwXTextPortionEnumeration(
TextRangeList_t const & rPortions )
: m_Portions( rPortions )
{
- m_pUnoCursor = rParaCursor.GetDoc()->CreateUnoCursor(*rParaCursor.GetPoint());
+ m_pUnoCursor = rParaCursor.GetDoc().CreateUnoCursor(*rParaCursor.GetPoint());
}
SwXTextPortionEnumeration::~SwXTextPortionEnumeration()
@@ -388,7 +388,7 @@ lcl_ExportFieldMark(
const SwTextNode * const pTextNode )
{
uno::Reference<text::XTextRange> xRef;
- SwDoc* pDoc = pUnoCursor->GetDoc();
+ SwDoc& rDoc = pUnoCursor->GetDoc();
// maybe it's a good idea to add a special hint to the hints array and rely on the hint segmentation...
const sal_Int32 start = pUnoCursor->Start()->nContent.GetIndex();
OSL_ENSURE(pUnoCursor->End()->nContent.GetIndex() == start,
@@ -405,18 +405,15 @@ lcl_ExportFieldMark(
if (CH_TXT_ATR_FIELDSTART == Char)
{
::sw::mark::IFieldmark* pFieldmark = nullptr;
- if (pDoc)
- {
- pFieldmark = pDoc->getIDocumentMarkAccess()->
- getFieldmarkAt(*pUnoCursor->GetMark());
- }
+ pFieldmark = rDoc.getIDocumentMarkAccess()->
+ getFieldmarkAt(*pUnoCursor->GetMark());
SwXTextPortion* pPortion = new SwXTextPortion(
pUnoCursor, i_xParentText, PORTION_FIELD_START);
xRef = pPortion;
- if (pFieldmark && pDoc)
+ if (pFieldmark)
{
pPortion->SetBookmark(
- SwXFieldmark::CreateXFieldmark(*pDoc, pFieldmark));
+ SwXFieldmark::CreateXFieldmark(rDoc, pFieldmark));
}
}
else if (CH_TXT_ATR_FIELDSEP == Char)
@@ -429,34 +426,28 @@ lcl_ExportFieldMark(
else if (CH_TXT_ATR_FIELDEND == Char)
{
::sw::mark::IFieldmark* pFieldmark = nullptr;
- if (pDoc)
- {
- pFieldmark = pDoc->getIDocumentMarkAccess()->
- getFieldmarkAt(*pUnoCursor->GetMark());
- }
+ pFieldmark = rDoc.getIDocumentMarkAccess()->
+ getFieldmarkAt(*pUnoCursor->GetMark());
SwXTextPortion* pPortion = new SwXTextPortion(
pUnoCursor, i_xParentText, PORTION_FIELD_END);
xRef = pPortion;
- if (pFieldmark && pDoc)
+ if (pFieldmark)
{
pPortion->SetBookmark(
- SwXFieldmark::CreateXFieldmark(*pDoc, pFieldmark));
+ SwXFieldmark::CreateXFieldmark(rDoc, pFieldmark));
}
}
else if (CH_TXT_ATR_FORMELEMENT == Char)
{
- ::sw::mark::IFieldmark* pFieldmark = nullptr;
- if (pDoc)
- {
- pFieldmark = pDoc->getIDocumentMarkAccess()->getFieldmarkAt(*pUnoCursor->GetMark());
- }
+ ::sw::mark::IFieldmark* pFieldmark =
+ rDoc.getIDocumentMarkAccess()->getFieldmarkAt(*pUnoCursor->GetMark());
SwXTextPortion* pPortion = new SwXTextPortion(
pUnoCursor, i_xParentText, PORTION_FIELD_START_END);
xRef = pPortion;
- if (pFieldmark && pDoc)
+ if (pFieldmark)
{
pPortion->SetBookmark(
- SwXFieldmark::CreateXFieldmark(*pDoc, pFieldmark));
+ SwXFieldmark::CreateXFieldmark(rDoc, pFieldmark));
}
}
else
@@ -472,13 +463,13 @@ lcl_CreateRefMarkPortion(
const SwUnoCursor * const pUnoCursor,
const SwTextAttr & rAttr, const bool bEnd)
{
- SwDoc* pDoc = pUnoCursor->GetDoc();
+ SwDoc& rDoc = pUnoCursor->GetDoc();
SwFormatRefMark& rRefMark = const_cast<SwFormatRefMark&>(
static_cast<const SwFormatRefMark&>(rAttr.GetAttr()));
Reference<XTextContent> xContent;
if (!xContent.is())
{
- xContent = SwXReferenceMark::CreateXReferenceMark(*pDoc, &rRefMark);
+ xContent = SwXReferenceMark::CreateXReferenceMark(rDoc, &rRefMark);
}
SwXTextPortion* pPortion = nullptr;
@@ -515,11 +506,11 @@ lcl_CreateTOXMarkPortion(
const SwUnoCursor * const pUnoCursor,
SwTextAttr & rAttr, const bool bEnd)
{
- SwDoc* pDoc = pUnoCursor->GetDoc();
+ SwDoc& rDoc = pUnoCursor->GetDoc();
SwTOXMark & rTOXMark = static_cast<SwTOXMark&>(rAttr.GetAttr());
const Reference<XTextContent> xContent =
- SwXDocumentIndexMark::CreateXDocumentIndexMark(*pDoc, & rTOXMark);
+ SwXDocumentIndexMark::CreateXDocumentIndexMark(rDoc, & rTOXMark);
SwXTextPortion* pPortion = nullptr;
if (!bEnd)
@@ -723,7 +714,7 @@ lcl_ExportHints(
// if the attribute has a dummy character, then xRef is set (except META)
// otherwise, the portion for the attribute is inserted into rPortions!
Reference<XTextRange> xRef;
- SwDoc* pDoc = pUnoCursor->GetDoc();
+ SwDoc& rDoc = pUnoCursor->GetDoc();
//search for special text attributes - first some ends
size_t nEndIndex = 0;
sal_Int32 nNextEnd = 0;
@@ -828,7 +819,7 @@ lcl_ExportHints(
new SwXTextPortion(
pUnoCursor, xParent, PORTION_FIELD);
Reference<XTextField> const xField =
- SwXTextField::CreateXTextField(pDoc,
+ SwXTextField::CreateXTextField(&rDoc,
&pAttr->GetFormatField());
pPortion->SetTextField(xField);
}
@@ -847,14 +838,14 @@ lcl_ExportHints(
{
SwXTextPortion* pPortion = new SwXTextPortion( pUnoCursor, xParent, PORTION_ANNOTATION_END );
pPortion->SetBookmark(SwXBookmark::CreateXBookmark(
- *pDoc, pAnnotationMark));
+ rDoc, pAnnotationMark));
xRef = pPortion;
}
else
{
SwXTextPortion* pPortion = new SwXTextPortion( pUnoCursor, xParent, PORTION_ANNOTATION );
Reference<XTextField> xField =
- SwXTextField::CreateXTextField(pDoc,
+ SwXTextField::CreateXTextField(&rDoc,
&pAttr->GetFormatField());
pPortion->SetTextField(xField);
xRef = pPortion;
@@ -874,7 +865,7 @@ lcl_ExportHints(
new SwXTextPortion( pUnoCursor, xParent, PORTION_FIELD);
xRef = pPortion;
Reference<XTextField> xField =
- SwXTextField::CreateXTextField(pDoc,
+ SwXTextField::CreateXTextField(&rDoc,
&pAttr->GetFormatField());
pPortion->SetTextField(xField);
}
@@ -907,7 +898,7 @@ lcl_ExportHints(
xRef = pPortion = new SwXTextPortion(
pUnoCursor, xParent, PORTION_FOOTNOTE);
Reference<XFootnote> xContent =
- SwXFootnotes::GetObject(*pDoc, pAttr->GetFootnote());
+ SwXFootnotes::GetObject(rDoc, pAttr->GetFootnote());
pPortion->SetFootnote(xContent);
}
}
@@ -1309,22 +1300,22 @@ static void lcl_CreatePortions(
pUnoCursor->Right(i_nStartPos);
}
- SwDoc * const pDoc = pUnoCursor->GetDoc();
+ SwDoc& rDoc = pUnoCursor->GetDoc();
std::deque<sal_Int32> FieldMarks;
lcl_FillFieldMarkArray(FieldMarks, *pUnoCursor, i_nStartPos);
SwXBookmarkPortion_ImplList Bookmarks;
- lcl_FillBookmarkArray(*pDoc, *pUnoCursor, Bookmarks);
+ lcl_FillBookmarkArray(rDoc, *pUnoCursor, Bookmarks);
SwXRedlinePortion_ImplList Redlines;
- lcl_FillRedlineArray(*pDoc, *pUnoCursor, Redlines);
+ lcl_FillRedlineArray(rDoc, *pUnoCursor, Redlines);
SwSoftPageBreakList SoftPageBreaks;
lcl_FillSoftPageBreakArray(*pUnoCursor, SoftPageBreaks);
SwAnnotationStartPortion_ImplList AnnotationStarts;
- lcl_FillAnnotationStartArray( *pDoc, *pUnoCursor, AnnotationStarts );
+ lcl_FillAnnotationStartArray( rDoc, *pUnoCursor, AnnotationStarts );
PortionStack_t PortionStack;
PortionStack.push( PortionList_t(&i_rPortions, nullptr) );
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index 4ba69d93b553..4a25cd38cd61 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -210,7 +210,7 @@ uno::Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName )
if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
{
SwUnoCursor& rUnoCursor = GetCursor();
- uno::Reference<text::XText> xRet = new SwXRedlineText(rUnoCursor.GetDoc(), *pNodeIdx);
+ uno::Reference<text::XText> xRet = new SwXRedlineText(&rUnoCursor.GetDoc(), *pNodeIdx);
aRet <<= xRet;
}
else {
@@ -232,8 +232,8 @@ bool SwXRedlinePortion::Validate()
{
SwUnoCursor& rUnoCursor = GetCursor();
//search for the redline
- SwDoc* pDoc = rUnoCursor.GetDoc();
- const SwRedlineTable& rRedTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
+ SwDoc& rDoc = rUnoCursor.GetDoc();
+ const SwRedlineTable& rRedTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable();
bool bFound = false;
for(size_t nRed = 0; nRed < rRedTable.size() && !bFound; nRed++)
{
@@ -277,7 +277,7 @@ uno::Any SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, co
}
else if (rPropertyName == UNO_NAME_IS_IN_HEADER_FOOTER)
{
- aRet <<= rRedline.GetDoc()->IsInHeaderFooter( rRedline.GetPoint()->nNode );
+ aRet <<= rRedline.GetDoc().IsInHeaderFooter( rRedline.GetPoint()->nNode );
}
else if (rPropertyName == UNO_NAME_MERGE_LAST_PARA)
{
@@ -321,7 +321,7 @@ uno::Sequence< beans::PropertyValue > SwXRedlinePortion::CreateRedlineProperties
{
if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
{
- uno::Reference<text::XText> xRet = new SwXRedlineText(rRedline.GetDoc(), *pNodeIdx);
+ uno::Reference<text::XText> xRet = new SwXRedlineText(&rRedline.GetDoc(), *pNodeIdx);
pRet[nPropIdx].Name = UNO_NAME_REDLINE_TEXT;
pRet[nPropIdx++].Value <<= xRet;
}
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 3d6cd98f3551..aa94abd1a229 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -206,9 +206,9 @@ void SwXReferenceMark::Impl::InsertRefMark(SwPaM& rPam,
//! in some cases when this function is called the pDoc pointer member may have become
//! invalid/deleted thus we obtain the document pointer from rPaM where it should always
//! be valid.
- SwDoc *pDoc2 = rPam.GetDoc();
+ SwDoc& rDoc2 = rPam.GetDoc();
- UnoActionContext aCont(pDoc2);
+ UnoActionContext aCont(&rDoc2);
SwFormatRefMark aRefMark(m_sMarkName);
bool bMark = *rPam.GetPoint() != *rPam.GetMark();
@@ -225,7 +225,7 @@ void SwXReferenceMark::Impl::InsertRefMark(SwPaM& rPam,
rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_REFMARK);
}
- pDoc2->getIDocumentContentOperations().InsertPoolItem( rPam, aRefMark, nInsertFlags );
+ rDoc2.getIDocumentContentOperations().InsertPoolItem( rPam, aRefMark, nInsertFlags );
if( bMark && *rPam.GetPoint() > *rPam.GetMark())
{
@@ -431,7 +431,7 @@ void SAL_CALL SwXReferenceMark::setName(const OUString& rName)
m_pImpl->m_sMarkName = rName;
//create a new one
m_pImpl->InsertRefMark( aPam, nullptr );
- m_pImpl->m_pDoc = aPam.GetDoc();
+ m_pImpl->m_pDoc = &aPam.GetDoc();
}
}
}
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index fe79c13a4482..86b0b7ca5446 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1487,7 +1487,7 @@ SwXTextTableCursor::SwXTextTableCursor(SwFrameFormat& rTableFormat, const SwTabl
, m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_CURSOR))
{
StartListening(m_pFrameFormat->GetNotifier());
- m_pUnoCursor = pTableSelection->GetDoc()->CreateUnoCursor(*pTableSelection->GetPoint(), true);
+ m_pUnoCursor = pTableSelection->GetDoc().CreateUnoCursor(*pTableSelection->GetPoint(), true);
if(pTableSelection->HasMark())
{
m_pUnoCursor->SetMark();
@@ -1561,7 +1561,7 @@ sal_Bool SwXTextTableCursor::goUp(sal_Int16 Count, sal_Bool bExpand)
SwUnoTableCursor& rTableCursor = dynamic_cast<SwUnoTableCursor&>(rUnoCursor);
lcl_CursorSelect(rTableCursor, bExpand);
return rTableCursor.UpDown(true, Count, nullptr, 0,
- *rUnoCursor.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout());
+ *rUnoCursor.GetDoc().getIDocumentLayoutAccess().GetCurrentLayout());
}
sal_Bool SwXTextTableCursor::goDown(sal_Int16 Count, sal_Bool bExpand)
@@ -1571,7 +1571,7 @@ sal_Bool SwXTextTableCursor::goDown(sal_Int16 Count, sal_Bool bExpand)
SwUnoTableCursor& rTableCursor = dynamic_cast<SwUnoTableCursor&>(rUnoCursor);
lcl_CursorSelect(rTableCursor, bExpand);
return rTableCursor.UpDown(false, Count, nullptr, 0,
- *rUnoCursor.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout());
+ *rUnoCursor.GetDoc().getIDocumentLayoutAccess().GetCurrentLayout());
}
void SwXTextTableCursor::gotoStart(sal_Bool bExpand)
@@ -1605,8 +1605,8 @@ sal_Bool SwXTextTableCursor::mergeRange()
rTableCursor.MakeBoxSels();
bool bResult;
{
- UnoActionContext aContext(rUnoCursor.GetDoc());
- bResult = TableMergeErr::Ok == rTableCursor.GetDoc()->MergeTable(rTableCursor);
+ UnoActionContext aContext(&rUnoCursor.GetDoc());
+ bResult = TableMergeErr::Ok == rTableCursor.GetDoc().MergeTable(rTableCursor);
}
if(bResult)
{
@@ -1632,8 +1632,8 @@ sal_Bool SwXTextTableCursor::splitRange(sal_Int16 Count, sal_Bool Horizontal)
rTableCursor.MakeBoxSels();
bool bResult;
{
- UnoActionContext aContext(rUnoCursor.GetDoc());
- bResult = rTableCursor.GetDoc()->SplitTable(rTableCursor.GetSelectedBoxes(), !Horizontal, Count);
+ UnoActionContext aContext(&rUnoCursor.GetDoc());
+ bResult = rTableCursor.GetDoc().SplitTable(rTableCursor.GetSelectedBoxes(), !Horizontal, Count);
}
rTableCursor.MakeBoxSels();
return bResult;
@@ -1661,7 +1661,7 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u
}
auto& rTableCursor = dynamic_cast<SwUnoTableCursor&>(rUnoCursor);
rTableCursor.MakeBoxSels();
- SwDoc* pDoc = rUnoCursor.GetDoc();
+ SwDoc& rDoc = rUnoCursor.GetDoc();
switch(pEntry->nWID)
{
case FN_UNO_TABLE_CELL_BACKGROUND:
@@ -1669,7 +1669,7 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u
std::unique_ptr<SfxPoolItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
SwDoc::GetBoxAttr(rUnoCursor, aBrush);
aBrush->PutValue(aValue, pEntry->nMemberId);
- pDoc->SetBoxAttr(rUnoCursor, *aBrush);
+ rDoc.SetBoxAttr(rUnoCursor, *aBrush);
}
break;
@@ -1677,7 +1677,7 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u
{
SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT);
aNumberFormat.PutValue(aValue, 0);
- pDoc->SetBoxAttr(rUnoCursor, aNumberFormat);
+ rDoc.SetBoxAttr(rUnoCursor, aNumberFormat);
}
break;
case FN_UNO_PARA_STYLE:
@@ -1685,7 +1685,7 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u
break;
default:
{
- SfxItemSet aItemSet(pDoc->GetAttrPool(), {{pEntry->nWID, pEntry->nWID}});
+ SfxItemSet aItemSet(rDoc.GetAttrPool(), {{pEntry->nWID, pEntry->nWID}});
SwUnoCursorHelper::GetCursorAttr(rTableCursor.GetSelRing(),
aItemSet);
@@ -1737,7 +1737,7 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
break;
default:
{
- SfxItemSet aSet(rTableCursor.GetDoc()->GetAttrPool(),
+ SfxItemSet aSet(rTableCursor.GetDoc().GetAttrPool(),
svl::Items<RES_CHRATR_BEGIN, RES_FRMATR_END-1,
RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER>{});
SwUnoCursorHelper::GetCursorAttr(rTableCursor.GetSelRing(), aSet);
@@ -3383,7 +3383,7 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
- SwDoc *const pDoc = m_pImpl->m_pTableCursor->GetDoc();
+ SwDoc& rDoc = m_pImpl->m_pTableCursor->GetDoc();
SwUnoTableCursor& rCursor(dynamic_cast<SwUnoTableCursor&>(*m_pImpl->m_pTableCursor));
{
// HACK: remove pending actions for selecting old style tables
@@ -3397,13 +3397,13 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
std::unique_ptr<SfxPoolItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aBrush);
aBrush->PutValue(aValue, pEntry->nMemberId);
- pDoc->SetBoxAttr(*m_pImpl->m_pTableCursor, *aBrush);
+ rDoc.SetBoxAttr(*m_pImpl->m_pTableCursor, *aBrush);
}
break;
case RES_BOX :
{
- SfxItemSet aSet(pDoc->GetAttrPool(),
+ SfxItemSet aSet(rDoc.GetAttrPool(),
svl::Items<RES_BOX, RES_BOX,
SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>{});
SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
@@ -3431,14 +3431,14 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
SvxBoxItem aBoxItem(aSet.Get(RES_BOX));
static_cast<SfxPoolItem&>(aBoxItem).PutValue(aValue, pEntry->nMemberId);
aSet.Put(aBoxItem);
- pDoc->SetTabBorders(*m_pImpl->m_pTableCursor, aSet);
+ rDoc.SetTabBorders(*m_pImpl->m_pTableCursor, aSet);
}
break;
case RES_BOXATR_FORMAT:
{
SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT);
static_cast<SfxPoolItem&>(aNumberFormat).PutValue(aValue, 0);
- pDoc->SetBoxAttr(rCursor, aNumberFormat);
+ rDoc.SetBoxAttr(rCursor, aNumberFormat);
}
break;
case FN_UNO_RANGE_ROW_LABEL:
@@ -3466,12 +3466,12 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
sal_Int16 nAlign = -1;
aValue >>= nAlign;
if( nAlign >= text::VertOrientation::NONE && nAlign <= text::VertOrientation::BOTTOM)
- pDoc->SetBoxAlign( rCursor, nAlign );
+ rDoc.SetBoxAlign( rCursor, nAlign );
}
break;
default:
{
- SfxItemSet aItemSet( pDoc->GetAttrPool(), {{pEntry->nWID, pEntry->nWID}} );
+ SfxItemSet aItemSet( rDoc.GetAttrPool(), {{pEntry->nWID, pEntry->nWID}} );
SwUnoCursorHelper::GetCursorAttr(rCursor.GetSelRing(),
aItemSet);
@@ -3510,8 +3510,8 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName)
break;
case RES_BOX :
{
- SwDoc *const pDoc = m_pImpl->m_pTableCursor->GetDoc();
- SfxItemSet aSet(pDoc->GetAttrPool(),
+ SwDoc& rDoc = m_pImpl->m_pTableCursor->GetDoc();
+ SfxItemSet aSet(rDoc.GetAttrPool(),
svl::Items<RES_BOX, RES_BOX,
SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER>{});
aSet.Put(SvxBoxInfoItem( SID_ATTR_BORDER_INNER ));
@@ -3552,7 +3552,7 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName)
default:
{
SfxItemSet aSet(
- m_pImpl->m_pTableCursor->GetDoc()->GetAttrPool(),
+ m_pImpl->m_pTableCursor->GetDoc().GetAttrPool(),
svl::Items<
RES_CHRATR_BEGIN, RES_FRMATR_END - 1,
RES_UNKNOWNATR_CONTAINER,
@@ -3979,7 +3979,7 @@ void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
pUnoCursor->Move( fnMoveForward, GoInNode );
{
// remove actions - TODO: why?
- UnoActionRemoveContext aRemoveContext(pUnoCursor->GetDoc());
+ UnoActionRemoveContext aRemoveContext(&pUnoCursor->GetDoc());
}
pFrameFormat->GetDoc()->InsertRow(*pUnoCursor, static_cast<sal_uInt16>(nCount), bAppend);
}
@@ -4134,7 +4134,7 @@ void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
{
// remove actions - TODO: why?
- UnoActionRemoveContext aRemoveContext(pUnoCursor->GetDoc());
+ UnoActionRemoveContext aRemoveContext(&pUnoCursor->GetDoc());
}
pFrameFormat->GetDoc()->InsertCol(*pUnoCursor, static_cast<sal_uInt16>(nCount), bAppend);
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 5721392cc340..373d552f374a 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -411,21 +411,21 @@ SwReader::SwReader(SfxMedium& rMedium, const OUString& rFileName, SwDoc *pDocume
// Read into an existing document
SwReader::SwReader(SvStream& rStrm, const OUString& rFileName, const OUString& rBaseURL, SwPaM& rPam)
- : SwDocFac(rPam.GetDoc()), mpStrm(&rStrm), mpMedium(nullptr), mpCursor(&rPam),
+ : SwDocFac(&rPam.GetDoc()), mpStrm(&rStrm), mpMedium(nullptr), mpCursor(&rPam),
maFileName(rFileName), mbSkipImages(false)
{
SetBaseURL( rBaseURL );
}
SwReader::SwReader(SfxMedium& rMedium, const OUString& rFileName, SwPaM& rPam)
- : SwDocFac(rPam.GetDoc()), mpStrm(nullptr), mpMedium(&rMedium),
+ : SwDocFac(&rPam.GetDoc()), mpStrm(nullptr), mpMedium(&rMedium),
mpCursor(&rPam), maFileName(rFileName), mbSkipImages(false)
{
SetBaseURL( rMedium.GetBaseURL() );
}
SwReader::SwReader( const uno::Reference < embed::XStorage > &rStg, const OUString& rFilename, SwPaM &rPam )
- : SwDocFac(rPam.GetDoc()), mpStrm(nullptr), mxStg( rStg ), mpMedium(nullptr), mpCursor(&rPam), maFileName(rFilename), mbSkipImages(false)
+ : SwDocFac(&rPam.GetDoc()), mpStrm(nullptr), mxStg( rStg ), mpMedium(nullptr), mpCursor(&rPam), maFileName(rFilename), mbSkipImages(false)
{
}
@@ -706,7 +706,7 @@ SwWriter::SwWriter(SvStream& rStrm,SwDoc &rDocument)
SwWriter::SwWriter(SvStream& rStrm, SwPaM& rPam, bool bInWriteAll)
: m_pStrm(&rStrm), m_pMedium(nullptr), m_pOutPam(&rPam), m_pShell(nullptr),
- m_rDoc(*rPam.GetDoc()), m_bWriteAll(bInWriteAll)
+ m_rDoc(rPam.GetDoc()), m_bWriteAll(bInWriteAll)
{
}
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index 743ce8bd1ebb..8319f5181024 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -256,7 +256,7 @@ ErrCode Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName )
return nResult;
}
- m_pDoc = rPaM.GetDoc();
+ m_pDoc = &rPaM.GetDoc();
m_pOrigFileName = pFName;
m_pImpl->m_pStream = &rStrm;
@@ -495,7 +495,7 @@ ErrCode StgWriter::Write( SwPaM& rPaM, SotStorage& rStg, const OUString* pFName
{
SetStream(nullptr);
m_pStg = &rStg;
- m_pDoc = rPaM.GetDoc();
+ m_pDoc = &rPaM.GetDoc();
m_pOrigFileName = pFName;
// Copy PaM, so that it can be modified
@@ -518,7 +518,7 @@ ErrCode StgWriter::Write( SwPaM& rPaM, const uno::Reference < embed::XStorage >&
SetStream(nullptr);
m_pStg = nullptr;
m_xStg = rStg;
- m_pDoc = rPaM.GetDoc();
+ m_pDoc = &rPaM.GetDoc();
m_pOrigFileName = pFName;
// Copy PaM, so that it can be modified
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 85b87aa0cfab..8c2ac92789e9 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2911,7 +2911,7 @@ void MSWordExportBase::WriteText()
++m_pCurPam->GetPoint()->nNode;
sal_uLong nPos = m_pCurPam->GetPoint()->nNode.GetIndex();
- ::SetProgressState( nPos, m_pCurPam->GetDoc()->GetDocShell() );
+ ::SetProgressState( nPos, m_pCurPam->GetDoc().GetDocShell() );
}
SAL_INFO( "sw.ww8.level2", "</WriteText>" );
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 2f6b02c52bd4..3af3d1f0e6bd 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -5123,7 +5123,7 @@ static void ParaTabStopDelAdd( WW8Export& rWrt,
void WW8AttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStops )
{
- const bool bTabsRelativeToIndex = m_rWW8Export.m_pCurPam->GetDoc()->getIDocumentSettingAccess().get( DocumentSettingId::TABS_RELATIVE_TO_INDENT );
+ const bool bTabsRelativeToIndex = m_rWW8Export.m_pCurPam->GetDoc().getIDocumentSettingAccess().get( DocumentSettingId::TABS_RELATIVE_TO_INDENT );
long nCurrentLeft = 0;
if ( bTabsRelativeToIndex )
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 2e7546527b73..42827b1bbadc 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2357,7 +2357,7 @@ WW8PostProcessAttrsInfo::WW8PostProcessAttrsInfo(WW8_CP nCpStart, WW8_CP nCpEnd,
, mnCpStart(nCpStart)
, mnCpEnd(nCpEnd)
, mPaM(*rPaM.GetMark(), *rPaM.GetPoint())
- , mItemSet(rPaM.GetDoc()->GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_PARATR_END - 1>{})
+ , mItemSet(rPaM.GetDoc().GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_PARATR_END - 1>{})
{
}
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 24c8e8c7c749..4683b6ecb1c7 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -110,7 +110,7 @@ static void lcl_EnsureValidPam( SwPaM& rPam )
// point is not valid, so move it into the first content
rPam.DeleteMark();
rPam.GetPoint()->nNode =
- *rPam.GetDoc()->GetNodes().GetEndOfContent().StartOfSectionNode();
+ *rPam.GetDoc().GetNodes().GetEndOfContent().StartOfSectionNode();
++ rPam.GetPoint()->nNode;
rPam.Move( fnMoveForward, GoInContent ); // go into content
}
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index c5a9bc5b7b18..00c141332a15 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -797,7 +797,7 @@ void SwXMLImport::endDocument()
{
SwTextNode* pCurrNd;
sal_uLong nNodeIdx = pPos->nNode.GetIndex();
- pDoc = pPaM->GetDoc();
+ pDoc = &pPaM->GetDoc();
OSL_ENSURE( pPos->nNode.GetNode().IsContentNode(),
"insert position is not a content node" );
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index c530bca6d61f..fee2723e13de 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1284,7 +1284,7 @@ SwPasteContext::~SwPasteContext()
aPropertyValue.Name = "TextRange";
const uno::Reference<text::XTextRange> xTextRange = SwXTextRange::CreateXTextRange(
- *m_pPaM->GetDoc(), *m_pPaM->GetPoint(), m_pPaM->GetMark());
+ m_pPaM->GetDoc(), *m_pPaM->GetPoint(), m_pPaM->GetMark());
aPropertyValue.Value <<= xTextRange;
break;
}
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 3068fdadb57c..fd9c5a457565 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -486,7 +486,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
{
rSh.SetRedlineComment(sCommentText);
GetView().AttrChangedNotify(nullptr);
- MaybeNotifyRedlineModification(const_cast<SwRangeRedline*>(pRedline), pRedline->GetDoc());
+ MaybeNotifyRedlineModification(const_cast<SwRangeRedline&>(*pRedline), pRedline->GetDoc());
break;
}
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index f1220b01564b..05bfe95dbc20 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -226,15 +226,15 @@ static std::unique_ptr<SwPrintUIOptions> lcl_GetPrintUIOptions(
return std::make_unique<SwPrintUIOptions>( nCurrentPage, bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, rPrintData );
}
-static SwTextFormatColl *lcl_GetParaStyle(const OUString& rCollName, SwDoc* pDoc)
+static SwTextFormatColl *lcl_GetParaStyle(const OUString& rCollName, SwDoc& rDoc)
{
- SwTextFormatColl* pColl = pDoc->FindTextFormatCollByName( rCollName );
+ SwTextFormatColl* pColl = rDoc.FindTextFormatCollByName( rCollName );
if( !pColl )
{
const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(
rCollName, SwGetPoolIdFromName::TxtColl );
if( USHRT_MAX != nId )
- pColl = pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( nId );
+ pColl = rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool( nId );
}
return pColl;
}
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 9412e103dbf6..6d7a1976a57a 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -1683,13 +1683,13 @@ IMPLEMENT_FORWARD_XINTERFACE2(SwXTextViewCursor,SwXTextViewCursor_Base,OTextCurs
const SwDoc* SwXTextViewCursor::GetDoc() const
{
SwWrtShell& rSh = m_pView->GetWrtShell();
- return rSh.GetCursor() ? rSh.GetCursor()->GetDoc() : nullptr;
+ return rSh.GetCursor() ? &rSh.GetCursor()->GetDoc() : nullptr;
}
SwDoc* SwXTextViewCursor::GetDoc()
{
SwWrtShell& rSh = m_pView->GetWrtShell();
- return rSh.GetCursor() ? rSh.GetCursor()->GetDoc() : nullptr;
+ return rSh.GetCursor() ? &rSh.GetCursor()->GetDoc() : nullptr;
}
const SwPaM* SwXTextViewCursor::GetPaM() const