[Libreoffice-commits] core.git: sw/inc sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Sep 30 07:46:39 UTC 2020
sw/inc/ndarr.hxx | 4 -
sw/inc/node.hxx | 4 -
sw/source/core/doc/CntntIdxStore.cxx | 22 +++----
sw/source/core/doc/DocumentContentOperationsManager.cxx | 8 +-
sw/source/core/doc/docedt.cxx | 4 -
sw/source/core/doc/docfld.cxx | 2
sw/source/core/doc/swserv.cxx | 2
sw/source/core/docnode/ndnum.cxx | 4 -
sw/source/core/docnode/ndsect.cxx | 12 ++--
sw/source/core/docnode/ndtbl.cxx | 28 ++++-----
sw/source/core/docnode/node.cxx | 2
sw/source/core/docnode/node2lay.cxx | 4 -
sw/source/core/docnode/nodes.cxx | 47 +++++++---------
sw/source/core/inc/mvsave.hxx | 4 -
sw/source/core/ole/ndole.cxx | 4 -
sw/source/core/txtnode/atrftn.cxx | 8 +-
sw/source/core/txtnode/ndtxt.cxx | 18 +++---
sw/source/core/undo/docundo.cxx | 2
sw/source/core/undo/untbl.cxx | 6 +-
sw/source/filter/xml/XMLRedlineImportHelper.cxx | 2
20 files changed, 93 insertions(+), 94 deletions(-)
New commits:
commit ac94aa6f7d2a8e41e7260ba740813cdbbdd6a2ae
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 29 16:49:22 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Sep 30 09:45:56 2020 +0200
SwNodes::GetDoc can return a reference instead
Change-Id: I6c3b2e5b95fb9fac8faa36fc6ae378b92e08fd89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103639
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 1492df35be6e..7e095c8fb0a6 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -299,8 +299,8 @@ public:
bool const bCreateFrames = true);
/// Which Doc contains the nodes-array?
- SwDoc* GetDoc() { return &m_rMyDoc; }
- const SwDoc* GetDoc() const { return &m_rMyDoc; }
+ SwDoc& GetDoc() { return m_rMyDoc; }
+ const SwDoc& GetDoc() const { return m_rMyDoc; }
/** Search previous / next content node or table node with frames.
If no end is given begin with the FrameIndex, else start search
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 6f1fa1bae68f..d3cb879275de 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -701,11 +701,11 @@ inline const SwNodes& SwNode::GetNodes() const
inline SwDoc* SwNode::GetDoc()
{
- return GetNodes().GetDoc();
+ return &GetNodes().GetDoc();
}
inline const SwDoc* SwNode::GetDoc() const
{
- return GetNodes().GetDoc();
+ return &GetNodes().GetDoc();
}
inline SwFormatColl* SwContentNode::GetCondFormatColl() const
diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx
index 614678fa7dca..bc60a0de37a6 100644
--- a/sw/source/core/doc/CntntIdxStore.cxx
+++ b/sw/source/core/doc/CntntIdxStore.cxx
@@ -140,28 +140,28 @@ namespace
{
return m_aBkmkEntries.empty() && m_aRedlineEntries.empty() && m_aFlyEntries.empty() && m_aUnoCursorEntries.empty() && m_aShellCursorEntries.empty();
}
- virtual void Save(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit=false) override
+ virtual void Save(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit=false) override
{
- SaveBkmks(pDoc, nNode, nContent);
- SaveRedlines(pDoc, nNode, nContent);
- SaveFlys(pDoc, nNode, nContent, bSaveFlySplit);
- SaveUnoCursors(pDoc, nNode, nContent);
- SaveShellCursors(pDoc, 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* pDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false, RestoreMode eMode = RestoreMode::All) override
+ virtual void Restore(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false, RestoreMode eMode = RestoreMode::All) override
{
- SwContentNode* pCNd = pDoc->GetNodes()[ nNode ]->GetContentNode();
+ SwContentNode* pCNd = rDoc.GetNodes()[ nNode ]->GetContentNode();
updater_t aUpdater = OffsetUpdater(pCNd, nOffset);
if (eMode & RestoreMode::NonFlys)
{
- RestoreBkmks(pDoc, aUpdater);
- RestoreRedlines(pDoc, aUpdater);
+ RestoreBkmks(&rDoc, aUpdater);
+ RestoreRedlines(&rDoc, aUpdater);
RestoreUnoCursors(aUpdater);
RestoreShellCursors(aUpdater);
}
if (eMode & RestoreMode::Flys)
{
- RestoreFlys(pDoc, aUpdater, bAuto);
+ RestoreFlys(&rDoc, aUpdater, bAuto);
}
}
virtual void Restore(SwNode& rNd, sal_Int32 nLen, sal_Int32 nCorrLen, RestoreMode eMode = RestoreMode::All) override
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d02b87ee0276..558db3827522 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2276,7 +2276,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos,
const sal_Int32 nMkContent = rPaM.GetMark()->nContent.GetIndex();
const std::shared_ptr<sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
- pContentStore->Save( &m_rDoc, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(), true );
+ pContentStore->Save( m_rDoc, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(), true );
SwTextNode * pOrigNode = pTNd;
assert(*aSavePam.GetPoint() == *aSavePam.GetMark() &&
@@ -2290,7 +2290,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos,
{
if (!pContentStore->Empty())
{
- pContentStore->Restore(&m_rDoc, pOrigNode->GetIndex()-1, 0, true, eMode);
+ pContentStore->Restore(m_rDoc, pOrigNode->GetIndex()-1, 0, true, eMode);
}
});
pTNd = pTNd->SplitContentNode(rPos, &restoreFunc)->GetTextNode();
@@ -3216,14 +3216,14 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b
}
const std::shared_ptr<sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
- pContentStore->Save( &m_rDoc, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(), true );
+ pContentStore->Save( m_rDoc, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(), true );
assert(pNode->IsTextNode());
std::function<void (SwTextNode *, sw::mark::RestoreMode)> restoreFunc(
[&](SwTextNode *const, sw::mark::RestoreMode const eMode)
{
if (!pContentStore->Empty())
{ // move all bookmarks, TOXMarks, FlyAtCnt
- pContentStore->Restore(&m_rDoc, rPos.nNode.GetIndex()-1, 0, true, eMode);
+ pContentStore->Restore(m_rDoc, rPos.nNode.GetIndex()-1, 0, true, eMode);
}
if (eMode & sw::mark::RestoreMode::NonFlys)
{
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 5eadf937b53e..56b4d04718a9 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -412,7 +412,7 @@ 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(*pDoc, aOldIdx.GetIndex(), SAL_MAX_INT32);
SwIndex aAlphaIdx(pTextNd);
pOldTextNd->CutText( pTextNd, aAlphaIdx, SwIndex(pOldTextNd),
@@ -422,7 +422,7 @@ bool sw_JoinText( SwPaM& rPam, bool bJoinPrev )
// move all Bookmarks/TOXMarks
if( !pContentStore->Empty() )
- pContentStore->Restore( pDoc, aIdx.GetIndex() );
+ pContentStore->Restore( *pDoc, aIdx.GetIndex() );
// If the passed PaM is not in the Cursor ring,
// treat it separately (e.g. when it's being called from AutoFormat)
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 57f976d27e5b..1340aa1444b8 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -179,7 +179,7 @@ void SetGetExpField::SetBodyPos( const SwContentFrame& rFrame )
SwNodeIndex aIdx( rFrame.IsTextFrame()
? *static_cast<SwTextFrame const&>(rFrame).GetTextNodeFirst()
: *static_cast<SwNoTextFrame const&>(rFrame).GetNode() );
- SwDoc& rDoc = *aIdx.GetNodes().GetDoc();
+ SwDoc& rDoc = aIdx.GetNodes().GetDoc();
SwPosition aPos( aIdx );
bool const bResult = ::GetBodyTextNode( rDoc, aPos, rFrame );
OSL_ENSURE(bResult, "Where is the field?");
diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx
index 54e070dc2ade..3eb3840a1c03 100644
--- a/sw/source/core/doc/swserv.cxx
+++ b/sw/source/core/doc/swserv.cxx
@@ -215,7 +215,7 @@ bool SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const
if( nSttNd && nEndNd )
{
// Get LinkManager
- const ::sfx2::SvBaseLinks& rLnks = pNds->GetDoc()->getIDocumentLinksAdministration().GetLinkManager().GetLinks();
+ const ::sfx2::SvBaseLinks& rLnks = pNds->GetDoc().getIDocumentLinksAdministration().GetLinkManager().GetLinks();
// To avoid recursions: convert ServerType!
SwServerObject::ServerModes eSave = m_eType;
diff --git a/sw/source/core/docnode/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx
index d5fbe435d6bd..b3d66affa66e 100644
--- a/sw/source/core/docnode/ndnum.cxx
+++ b/sw/source/core/docnode/ndnum.cxx
@@ -69,7 +69,7 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd)
pTextNd->UpdateOutlineState();
// update the structure fields
- GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Chapter )->UpdateFields();
+ GetDoc().getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Chapter )->UpdateFields();
}
void SwNodes::UpdateOutlineIdx( const SwNode& rNd )
@@ -88,7 +88,7 @@ void SwNodes::UpdateOutlineIdx( const SwNode& rNd )
if( nPos )
--nPos;
- if( !GetDoc()->IsInDtor() && IsDocNodes() )
+ if( !GetDoc().IsInDtor() && IsDocNodes() )
UpdateOutlineNode( *(*m_pOutlineNodes)[ nPos ]);
}
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 524aef0d3d1e..a2fcd8b7eae1 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -885,7 +885,7 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx,
pCpyTNd->MakeFramesForAdjacentContentNode(*pTNd);
}
else
- new SwTextNode( aInsPos, GetDoc()->GetDfltTextFormatColl() );
+ new SwTextNode( aInsPos, GetDoc().GetDfltTextFormatColl() );
}
new SwEndNode( aInsPos, *pSectNd );
@@ -895,7 +895,7 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx,
// We could optimize this, by not removing already contained Frames and recreating them,
// but by simply rewiring them
bool bInsFrame = bCreateFrames && !pSectNd->GetSection().IsHidden() &&
- GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+ GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell();
SwNode2LayoutSaveUpperFrames *pNode2Layout = nullptr;
if( bInsFrame )
{
@@ -1028,7 +1028,7 @@ void SwSectionNode::MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx)
{
// Take my successive or preceding ContentFrame
SwNodes& rNds = GetNodes();
- if( !(rNds.IsDocNodes() && rNds.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()) )
+ if( !(rNds.IsDocNodes() && rNds.GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell()) )
return;
if( GetSection().IsHidden() || IsContentHidden() )
@@ -1143,7 +1143,7 @@ void SwSectionNode::MakeOwnFrames(SwNodeIndex* pIdxBehind, SwNodeIndex* pEndIdx)
{
OSL_ENSURE( pIdxBehind, "no Index" );
SwNodes& rNds = GetNodes();
- SwDoc* pDoc = rNds.GetDoc();
+ SwDoc& rDoc = rNds.GetDoc();
*pIdxBehind = *this;
@@ -1153,7 +1153,7 @@ void SwSectionNode::MakeOwnFrames(SwNodeIndex* pIdxBehind, SwNodeIndex* pEndIdx)
{
SwNodeIndex *pEnd = pEndIdx ? pEndIdx :
new SwNodeIndex( *EndOfSectionNode(), 1 );
- ::MakeFrames( pDoc, *pIdxBehind, *pEnd );
+ ::MakeFrames( &rDoc, *pIdxBehind, *pEnd );
if( !pEndIdx )
delete pEnd;
}
@@ -1225,7 +1225,7 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c
if (SectionType::ToxContent != GetSection().GetType())
{
// Keep the Name for Move
- if( rNds.GetDoc() == pDoc && pDoc->IsCopyIsMove() )
+ if( &rNds.GetDoc() == pDoc && pDoc->IsCopyIsMove() )
{
pNewSect->SetSectionName( GetSection().GetSectionName() );
}
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index c91a8d7cc192..fb705fc72650 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -322,7 +322,7 @@ bool SwNodes::InsBoxen( SwTableNode* pTableNd,
// Handle Outline numbering correctly!
SwTextNode* pTNd = new SwTextNode(
SwNodeIndex( *pSttNd->EndOfSectionNode() ),
- GetDoc()->GetDfltTextFormatColl(),
+ GetDoc().GetDfltTextFormatColl(),
pAutoAttr );
pTNd->ChgFormatColl( pTextColl );
}
@@ -1010,7 +1010,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
SwTableNode * pTableNd = new SwTableNode( rRange.aStart );
new SwEndNode( rRange.aEnd, *pTableNd );
- SwDoc* pDoc = GetDoc();
+ SwDoc& rDoc = GetDoc();
std::vector<sal_uInt16> aPosArr;
SwTable& rTable = pTableNd->GetTable();
SwTableBox* pBox;
@@ -1065,7 +1065,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
SwPosition aCntPos( aSttIdx, SwIndex( pTextNd ));
const std::shared_ptr< sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
- pContentStore->Save(pDoc, aSttIdx.GetIndex(), SAL_MAX_INT32);
+ pContentStore->Save(rDoc, aSttIdx.GetIndex(), SAL_MAX_INT32);
if( T2T_PARA != cCh )
{
@@ -1124,7 +1124,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
lcl_BalanceTable(rTable, nMaxBoxes, *pTableNd, *pBoxFormat, *pTextColl,
pUndo, &aPosArr);
- lcl_SetTableBoxWidths(rTable, nMaxBoxes, *pBoxFormat, *pDoc, &aPosArr);
+ lcl_SetTableBoxWidths(rTable, nMaxBoxes, *pBoxFormat, rDoc, &aPosArr);
return pTableNd;
}
@@ -1385,7 +1385,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes,
//!! Thus no real problem here...
new SwEndNode( aInsertIndex, *pTableNd );
- SwDoc* pDoc = GetDoc();
+ SwDoc& rDoc = GetDoc();
SwTable& rTable = pTableNd->GetTable();
SwTableBox* pBox;
sal_uInt16 nLines, nMaxBoxes = 0;
@@ -1443,7 +1443,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes,
nLines++;
}
- lcl_SetTableBoxWidths2(rTable, nMaxBoxes, *pBoxFormat, *pDoc);
+ lcl_SetTableBoxWidths2(rTable, nMaxBoxes, *pBoxFormat, rDoc);
return pTableNd;
}
@@ -1538,7 +1538,7 @@ static void lcl_DelBox( SwTableBox* pBox, DelTabPara* pDelPara )
}
else
{
- SwDoc* pDoc = pDelPara->rNds.GetDoc();
+ SwDoc& rDoc = pDelPara->rNds.GetDoc();
SwNodeRange aDelRg( *pBox->GetSttNd(), 0,
*pBox->GetSttNd()->EndOfSectionNode() );
// Delete the Section
@@ -1559,26 +1559,26 @@ static void lcl_DelBox( SwTableBox* pBox, DelTabPara* pDelPara )
pDelPara->pLastNd->InsertText( OUString(pDelPara->cCh), aCntIdx,
SwInsertFlags::EMPTYEXPAND );
if( pDelPara->pUndo )
- pDelPara->pUndo->AddBoxPos( *pDoc, nNdIdx, aDelRg.aEnd.GetIndex(),
+ pDelPara->pUndo->AddBoxPos( rDoc, nNdIdx, aDelRg.aEnd.GetIndex(),
aCntIdx.GetIndex() );
const std::shared_ptr<sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
const sal_Int32 nOldTextLen = aCntIdx.GetIndex();
- pContentStore->Save(pDoc, nNdIdx, SAL_MAX_INT32);
+ pContentStore->Save(rDoc, nNdIdx, SAL_MAX_INT32);
pDelPara->pLastNd->JoinNext();
if( !pContentStore->Empty() )
- pContentStore->Restore( pDoc, pDelPara->pLastNd->GetIndex(), nOldTextLen );
+ pContentStore->Restore( rDoc, pDelPara->pLastNd->GetIndex(), nOldTextLen );
}
else if( pDelPara->pUndo )
{
++aDelRg.aStart;
- pDelPara->pUndo->AddBoxPos( *pDoc, nNdIdx, aDelRg.aEnd.GetIndex() );
+ pDelPara->pUndo->AddBoxPos( rDoc, nNdIdx, aDelRg.aEnd.GetIndex() );
}
}
else if( pDelPara->pUndo )
- pDelPara->pUndo->AddBoxPos( *pDoc, aDelRg.aStart.GetIndex(), aDelRg.aEnd.GetIndex() );
+ pDelPara->pUndo->AddBoxPos( rDoc, aDelRg.aStart.GetIndex(), aDelRg.aEnd.GetIndex() );
--aDelRg.aEnd;
pDelPara->pLastNd = aDelRg.aEnd.GetNode().GetTextNode();
@@ -1687,7 +1687,7 @@ bool SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh,
// #i28006# Fly frames have to be restored even if the table was
// #alone in the section
- const SwFrameFormats& rFlyArr = *GetDoc()->GetSpzFrameFormats();
+ const SwFrameFormats& rFlyArr = *GetDoc().GetSpzFrameFormats();
for( auto pFly : rFlyArr )
{
SwFrameFormat *const pFormat = pFly;
@@ -3541,7 +3541,7 @@ bool SwNodes::MergeTable( const SwNodeIndex& rPos, bool bWithPrev,
// TL_CHART2:
// tell the charts about the table to be deleted and have them use their own data
- GetDoc()->getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( &rDelTable );
+ GetDoc().getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( &rDelTable );
// Sync the TableFormat's Width
{
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 1c35410c49d5..2051fe72f0f4 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1944,7 +1944,7 @@ bool SwContentNode::IsAnyCondition( SwCollCondition& rTmp ) const
case SwFootnoteStartNode:
{
nCond = Master_CollCondition::PARA_IN_FOOTNOTE;
- const SwFootnoteIdxs& rFootnoteArr = rNds.GetDoc()->GetFootnoteIdxs();
+ const SwFootnoteIdxs& rFootnoteArr = rNds.GetDoc().GetFootnoteIdxs();
const SwTextFootnote* pTextFootnote;
const SwNode* pSrchNd = pSttNd;
diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx
index 76d3638c2285..16e8ff328db6 100644
--- a/sw/source/core/docnode/node2lay.cxx
+++ b/sw/source/core/docnode/node2lay.cxx
@@ -339,7 +339,7 @@ SwLayoutFrame* SwNode2LayImpl::UpperFrame( SwFrame* &rpFrame, const SwNode &rNod
void SwNode2LayImpl::RestoreUpperFrames( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd )
{
SwNode* pNd;
- SwDoc *pDoc = rNds.GetDoc();
+ SwDoc& rDoc = rNds.GetDoc();
bool bFirst = true;
for( ; nStt < nEnd; ++nStt )
{
@@ -388,7 +388,7 @@ void SwNode2LayImpl::RestoreUpperFrames( SwNodes& rNds, sal_uLong nStt, sal_uLon
static_cast<SwSectionFrame*>(pNxt)->UnlockJoin();
pUp = static_cast<SwLayoutFrame*>(mvUpperFrames[x++]);
OSL_ENSURE( pUp->GetUpper() || pUp->IsFlyFrame(), "Lost Upper" );
- ::InsertCnt_( pUp, pDoc, pNd->GetIndex(), false, nStt+1, pNxt );
+ ::InsertCnt_( pUp, &rDoc, pNd->GetIndex(), false, nStt+1, pNxt );
pNxt = pUp->GetLastLower();
mvUpperFrames[x-2] = pNxt;
}
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 44428c38e8f9..b373101d9e44 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -118,9 +118,9 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz,
// declare all fields as invalid, updating will happen
// in the idle-handler of the doc
- if( GetDoc()->getIDocumentFieldsAccess().SetFieldsDirty( true, &rDelPos.GetNode(), nSz ) &&
- rNds.GetDoc() != GetDoc() )
- rNds.GetDoc()->getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 );
+ if( GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, &rDelPos.GetNode(), nSz ) &&
+ &rNds.GetDoc() != &GetDoc() )
+ rNds.GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 );
// NEVER include nodes from the RedLineArea
sal_uLong nNd = rInsPos.GetIndex();
@@ -182,9 +182,9 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz,
}
else
{
- bool bSavePersData(GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds));
- bool bRestPersData(GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this));
- SwDoc* pDestDoc = rNds.GetDoc() != GetDoc() ? rNds.GetDoc() : nullptr;
+ bool bSavePersData(GetDoc().GetIDocumentUndoRedo().IsUndoNodes(rNds));
+ bool bRestPersData(GetDoc().GetIDocumentUndoRedo().IsUndoNodes(*this));
+ SwDoc* pDestDoc = &rNds.GetDoc() != &GetDoc() ? &rNds.GetDoc() : nullptr;
OSL_ENSURE(!pDestDoc, "SwNodes::ChgNode(): "
"the code to handle text fields here looks broken\n"
"if the target is in a different document.");
@@ -255,7 +255,7 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz,
if( pHts && pHts->Count() )
{
bool const bToUndo = !pDestDoc &&
- GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds);
+ GetDoc().GetIDocumentUndoRedo().IsUndoNodes(rNds);
for( size_t i = pHts->Count(); i; )
{
SwTextAttr * const pAttr = pHts->Get( --i );
@@ -266,12 +266,12 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz,
case RES_TXTATR_INPUTFIELD:
{
SwTextField* pTextField = static_txtattr_cast<SwTextField*>(pAttr);
- rNds.GetDoc()->getIDocumentFieldsAccess().InsDelFieldInFieldLst( !bToUndo, *pTextField );
+ rNds.GetDoc().getIDocumentFieldsAccess().InsDelFieldInFieldLst( !bToUndo, *pTextField );
const SwFieldType* pTyp = pTextField->GetFormatField().GetField()->GetTyp();
if ( SwFieldIds::Postit == pTyp->Which() )
{
- rNds.GetDoc()->GetDocShell()->Broadcast(
+ rNds.GetDoc().GetDocShell()->Broadcast(
SwFormatFieldHint(
&pTextField->GetFormatField(),
( pTextField->GetFormatField().IsFieldInDoc()
@@ -338,13 +338,13 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, sal_uLong nSz,
// declare all fields as invalid, updating will happen
// in the idle-handler of the doc
- GetDoc()->getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 );
- if( rNds.GetDoc() != GetDoc() )
- rNds.GetDoc()->getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 );
+ GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 );
+ if( &rNds.GetDoc() != &GetDoc() )
+ rNds.GetDoc().getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 );
if( bNewFrames )
- bNewFrames = &GetDoc()->GetNodes() == &rNds &&
- GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+ bNewFrames = &GetDoc().GetNodes() == &rNds &&
+ GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell();
if( !bNewFrames )
return;
@@ -571,8 +571,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
}
}
- if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(
- rNodes))
+ if (GetDoc().GetIDocumentUndoRedo().IsUndoNodes(rNodes))
{
SwFrameFormat* pTableFormat = pTableNd->GetTable().GetFrameFormat();
pTableFormat->GetNotifier().Broadcast(SfxHint(SfxHintId::Dying));
@@ -605,7 +604,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
// create EndNode
new SwEndNode( aIdx, *pTmp );
}
- else if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(
+ else if (GetDoc().GetIDocumentUndoRedo().IsUndoNodes(
rNodes))
{
// use placeholder in UndoNodes array
@@ -667,7 +666,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
pSctNd->NodesArrChgd();
++nSectNdCnt;
// tdf#132326 do not let frames survive in undo nodes
- if (!GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNodes))
+ if (!GetDoc().GetIDocumentUndoRedo().IsUndoNodes(rNodes))
{
bNewFrames = false;
}
@@ -678,7 +677,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
case SwNodeType::Section:
if( !nLevel &&
- GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNodes))
+ GetDoc().GetIDocumentUndoRedo().IsUndoNodes(rNodes))
{
// here, a SectionDummyNode needs to be inserted at the current position
if( nInsPos ) // move everything until here
@@ -811,7 +810,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
break;
case SwNodeType::PlaceHolder:
- if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this))
+ if (GetDoc().GetIDocumentUndoRedo().IsUndoNodes(*this))
{
if( &rNodes == this ) // inside UndoNodesArray
{
@@ -1526,7 +1525,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
// Also, a selection is invalidated.
pEnd->nContent = pStt->nContent;
rPam.DeleteMark();
- GetDoc()->GetDocShell()->Broadcast( SwFormatFieldHint( nullptr,
+ GetDoc().GetDocShell()->Broadcast( SwFormatFieldHint( nullptr,
rNodes.IsDocNodes() ? SwFormatFieldHintWhich::INSERTED : SwFormatFieldHintWhich::REMOVED ) );
return;
}
@@ -1645,7 +1644,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
// Also, a selection is invalidated.
*pEnd = *pStt;
rPam.DeleteMark();
- GetDoc()->GetDocShell()->Broadcast( SwFormatFieldHint( nullptr,
+ GetDoc().GetDocShell()->Broadcast( SwFormatFieldHint( nullptr,
rNodes.IsDocNodes() ? SwFormatFieldHintWhich::INSERTED : SwFormatFieldHintWhich::REMOVED ) );
}
@@ -1842,7 +1841,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
break;
case SwNodeType::PlaceHolder:
- if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this))
+ if (GetDoc().GetIDocumentUndoRedo().IsUndoNodes(*this))
{
// than a SectionNode (start/end) is needed at the current
// InsPos; if so skip it, otherwise ignore current node
@@ -2031,7 +2030,7 @@ SwNode* SwNodes::FindPrvNxtFrameNode( SwNodeIndex& rFrameIdx,
SwNode* pFrameNd = nullptr;
// no layout -> skip
- if( GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() )
+ if( GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell() )
{
SwNode* pSttNd = &rFrameIdx.GetNode();
diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx
index b0b0c4fc3e34..0b962383bdb5 100644
--- a/sw/source/core/inc/mvsave.hxx
+++ b/sw/source/core/inc/mvsave.hxx
@@ -78,8 +78,8 @@ namespace sw::mark
virtual void Clear() =0;
virtual bool Empty() =0;
- virtual void Save(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit=false) =0;
- virtual void Restore(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false, RestoreMode = RestoreMode::All) =0;
+ virtual void Save(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nContent, bool bSaveFlySplit=false) =0;
+ virtual void Restore(SwDoc& rDoc, sal_uLong nNode, sal_Int32 nOffset=0, bool bAuto = false, RestoreMode = RestoreMode::All) =0;
virtual void Restore(SwNode& rNd, sal_Int32 nLen, sal_Int32 nCorrLen, RestoreMode = RestoreMode::All) =0;
virtual ~ContentIdxStore() {};
static std::shared_ptr<ContentIdxStore> Create();
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index e7840331969c..4072cbfbfc38 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -388,7 +388,7 @@ SwOLENode * SwNodes::MakeOLENode( const SwNodeIndex & rWhere,
uno::Reference< container::XChild > xChild( pNode->GetOLEObj().GetObject().GetObject(), UNO_QUERY );
if (xChild.is())
{
- SwDocShell *pDocSh = GetDoc()->GetDocShell();
+ SwDocShell *pDocSh = GetDoc().GetDocShell();
if (pDocSh)
xChild->setParent( pDocSh->GetModel() );
}
@@ -409,7 +409,7 @@ SwOLENode * SwNodes::MakeOLENode( const SwNodeIndex & rWhere,
uno::Reference< container::XChild > xChild( pNode->GetOLEObj().GetObject().GetObject(), UNO_QUERY );
if (xChild.is())
{
- SwDocShell *pDocSh= GetDoc()->GetDocShell();
+ SwDocShell *pDocSh = GetDoc().GetDocShell();
if (pDocSh)
xChild->setParent( pDocSh->GetModel() );
}
diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx
index 2d515cb98ca3..e301d2c12f54 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -317,7 +317,7 @@ void SwTextFootnote::SetStartNode( const SwNodeIndex *pNewNode, bool bDelNode )
// attribute isn't anchored in the TextNode yet.
// If it is deleted (e.g. Insert File with footnote
// inside fly frame), the content must also be deleted.
- pDoc = m_pStartNode->GetNodes().GetDoc();
+ pDoc = &m_pStartNode->GetNodes().GetDoc();
}
// If called from ~SwDoc(), must not delete the footnote nodes,
@@ -444,18 +444,18 @@ void SwTextFootnote::MakeNewTextSection( SwNodes& rNodes )
if( GetFootnote().IsEndNote() )
{
- pInfo = &rNodes.GetDoc()->GetEndNoteInfo();
+ pInfo = &rNodes.GetDoc().GetEndNoteInfo();
nPoolId = RES_POOLCOLL_ENDNOTE;
}
else
{
- pInfo = &rNodes.GetDoc()->GetFootnoteInfo();
+ pInfo = &rNodes.GetDoc().GetFootnoteInfo();
nPoolId = RES_POOLCOLL_FOOTNOTE;
}
pFormatColl = pInfo->GetFootnoteTextColl();
if( nullptr == pFormatColl )
- pFormatColl = rNodes.GetDoc()->getIDocumentStylePoolAccess().GetTextCollFromPool( nPoolId );
+ pFormatColl = rNodes.GetDoc().getIDocumentStylePoolAccess().GetTextCollFromPool( nPoolId );
SwStartNode* pSttNd = rNodes.MakeTextSection( SwNodeIndex( rNodes.GetEndOfInserts() ),
SwFootnoteStartNode, pFormatColl );
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 42fe18e904ed..7c7b48be962b 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -118,7 +118,7 @@ SwTextNode *SwNodes::MakeTextNode( const SwNodeIndex & rWhere,
// if there is no layout or it is in a hidden section, MakeFrames is not needed
const SwSectionNode* pSectNd;
if (!bNewFrames ||
- !GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ||
+ !GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell() ||
( nullptr != (pSectNd = pNode->FindSectionNode()) &&
pSectNd->GetSection().IsHiddenFlag() ))
return pNode;
@@ -946,9 +946,9 @@ SwContentNode *SwTextNode::JoinNext()
SwNodeIndex aIdx( *this );
if( SwContentNode::CanJoinNext( &aIdx ) )
{
- SwDoc* pDoc = rNds.GetDoc();
+ SwDoc& rDoc = rNds.GetDoc();
const std::shared_ptr<sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
- pContentStore->Save(pDoc, aIdx.GetIndex(), SAL_MAX_INT32);
+ pContentStore->Save(rDoc, aIdx.GetIndex(), SAL_MAX_INT32);
SwTextNode *pTextNode = aIdx.GetNode().GetTextNode();
sal_Int32 nOldLen = m_Text.getLength();
@@ -1014,12 +1014,12 @@ SwContentNode *SwTextNode::JoinNext()
}
// move all Bookmarks/TOXMarks
if( !pContentStore->Empty())
- pContentStore->Restore( pDoc, GetIndex(), nOldLen );
+ pContentStore->Restore( rDoc, GetIndex(), nOldLen );
if( pTextNode->HasAnyIndex() )
{
// move all ShellCursor/StackCursor/UnoCursor out of delete range
- pDoc->CorrAbs( aIdx, SwPosition( *this ), nOldLen, true );
+ rDoc.CorrAbs( aIdx, SwPosition( *this ), nOldLen, true );
}
SwNode::Merge const eOldMergeFlag(pTextNode->GetRedlineMergeFlag());
rNds.Delete(aIdx);
@@ -1044,9 +1044,9 @@ void SwTextNode::JoinPrev()
SwNodeIndex aIdx( *this );
if( SwContentNode::CanJoinPrev( &aIdx ) )
{
- SwDoc* pDoc = rNds.GetDoc();
+ SwDoc& rDoc = rNds.GetDoc();
const std::shared_ptr<sw::mark::ContentIdxStore> pContentStore(sw::mark::ContentIdxStore::Create());
- pContentStore->Save( pDoc, aIdx.GetIndex(), SAL_MAX_INT32);
+ pContentStore->Save( rDoc, aIdx.GetIndex(), SAL_MAX_INT32);
SwTextNode *pTextNode = aIdx.GetNode().GetTextNode();
const sal_Int32 nLen = pTextNode->Len();
@@ -1112,12 +1112,12 @@ void SwTextNode::JoinPrev()
}
// move all Bookmarks/TOXMarks
if( !pContentStore->Empty() )
- pContentStore->Restore( pDoc, GetIndex() );
+ pContentStore->Restore( rDoc, GetIndex() );
if( pTextNode->HasAnyIndex() )
{
// move all ShellCursor/StackCursor/UnoCursor out of delete range
- pDoc->CorrAbs( aIdx, SwPosition( *this ), nLen, true );
+ rDoc.CorrAbs( aIdx, SwPosition( *this ), nLen, true );
}
SwNode::Merge const eOldMergeFlag(pTextNode->GetRedlineMergeFlag());
if (eOldMergeFlag == SwNode::Merge::First
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index 73a6b8bbe6da..8f870f347d6c 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -571,7 +571,7 @@ private:
bool UndoManager::impl_DoUndoRedo(UndoOrRedoType undoOrRedo)
{
- SwDoc & rDoc(*GetUndoNodes().GetDoc());
+ SwDoc & rDoc(GetUndoNodes().GetDoc());
UnoActionContext c(& rDoc); // exception-safe StartAllAction/EndAllAction
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 521284915384..2706e7ce243c 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -539,8 +539,8 @@ SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd,
// than create table structure partially. First a single line that contains
// all boxes. The correct structure is then taken from SaveStruct.
- SwTableBoxFormat* pBoxFormat = GetDoc()->MakeTableBoxFormat();
- SwTableLineFormat* pLineFormat = GetDoc()->MakeTableLineFormat();
+ SwTableBoxFormat* pBoxFormat = GetDoc().MakeTableBoxFormat();
+ SwTableLineFormat* pLineFormat = GetDoc().MakeTableLineFormat();
SwTableLine* pLine = new SwTableLine( pLineFormat, rSavedData.size(), nullptr );
pTableNd->GetTable().GetTabLines().insert( pTableNd->GetTable().GetTabLines().begin(), pLine );
@@ -595,7 +595,7 @@ SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd,
if( pSave->m_pHstry )
{
sal_uInt16 nTmpEnd = pSave->m_pHstry->GetTmpEnd();
- pSave->m_pHstry->TmpRollback( GetDoc(), 0 );
+ pSave->m_pHstry->TmpRollback( &GetDoc(), 0 );
pSave->m_pHstry->SetTmpEnd( nTmpEnd );
}
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index 2dc47282f00c..99ff2933ad97 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -169,7 +169,7 @@ SwDoc* XTextRangeOrNodeIndexPosition::GetDoc()
{
OSL_ENSURE(IsValid(), "Can't get Doc");
- return (nullptr != pIndex) ? pIndex->GetNodes().GetDoc() : lcl_GetDocViaTunnel(xRange);
+ return (nullptr != pIndex) ? &pIndex->GetNodes().GetDoc() : lcl_GetDocViaTunnel(xRange);
}
bool XTextRangeOrNodeIndexPosition::IsValid() const
More information about the Libreoffice-commits
mailing list