summaryrefslogtreecommitdiff
path: root/sw/source/core/doc
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 /sw/source/core/doc
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>
Diffstat (limited to 'sw/source/core/doc')
-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
11 files changed, 177 insertions, 178 deletions
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();
}