summaryrefslogtreecommitdiff
path: root/sw/source/core/undo
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/undo
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/undo')
-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
15 files changed, 97 insertions, 97 deletions
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 )