summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-29 20:50:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-30 09:46:21 +0200
commit55dfe2c12e450a90cbc05f9ec53f1ed6508d8de9 (patch)
tree1a312462989f3a521b3471225443ac229db4e7b6
parentac94aa6f7d2a8e41e7260ba740813cdbbdd6a2ae (diff)
SwNode::GetDoc can return a reference instead
and remove discovered redundant null checks Change-Id: I6b8bc9593434f38947e399a48888a8fa0d4f7e77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103640 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/inc/htmltbl.hxx2
-rw-r--r--sw/inc/node.hxx21
-rw-r--r--sw/inc/pam.hxx2
-rw-r--r--sw/source/core/SwNumberTree/SwNodeNum.cxx2
-rw-r--r--sw/source/core/access/AccessibilityCheck.cxx24
-rw-r--r--sw/source/core/access/accpara.cxx10
-rw-r--r--sw/source/core/attr/cellatr.cxx2
-rw-r--r--sw/source/core/attr/swatrset.cxx2
-rw-r--r--sw/source/core/crsr/crsrsh.cxx4
-rw-r--r--sw/source/core/crsr/crstrvl.cxx4
-rw-r--r--sw/source/core/crsr/findtxt.cxx6
-rw-r--r--sw/source/core/crsr/pam.cxx8
-rw-r--r--sw/source/core/crsr/swcrsr.cxx2
-rw-r--r--sw/source/core/crsr/trvlfnfl.cxx2
-rw-r--r--sw/source/core/crsr/trvltbl.cxx8
-rw-r--r--sw/source/core/crsr/viscrs.cxx2
-rw-r--r--sw/source/core/doc/CntntIdxStore.cxx8
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx152
-rw-r--r--sw/source/core/doc/dbgoutsw.cxx37
-rw-r--r--sw/source/core/doc/docbm.cxx10
-rw-r--r--sw/source/core/doc/doccomp.cxx8
-rw-r--r--sw/source/core/doc/doccorr.cxx16
-rw-r--r--sw/source/core/doc/docedt.cxx28
-rw-r--r--sw/source/core/doc/docfld.cxx4
-rw-r--r--sw/source/core/doc/docfmt.cxx6
-rw-r--r--sw/source/core/doc/docnew.cxx6
-rw-r--r--sw/source/core/doc/doctxm.cxx64
-rw-r--r--sw/source/core/doc/ftnidx.cxx32
-rw-r--r--sw/source/core/doc/htmltbl.cxx8
-rw-r--r--sw/source/core/doc/notxtfrm.cxx4
-rw-r--r--sw/source/core/doc/number.cxx4
-rw-r--r--sw/source/core/doc/rdfhelper.cxx16
-rw-r--r--sw/source/core/doc/tblrwcl.cxx4
-rw-r--r--sw/source/core/docnode/ndcopy.cxx6
-rw-r--r--sw/source/core/docnode/ndnotxt.cxx2
-rw-r--r--sw/source/core/docnode/ndsect.cxx4
-rw-r--r--sw/source/core/docnode/ndtbl.cxx17
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx10
-rw-r--r--sw/source/core/docnode/node.cxx86
-rw-r--r--sw/source/core/docnode/nodes.cxx36
-rw-r--r--sw/source/core/docnode/section.cxx18
-rw-r--r--sw/source/core/docnode/swbaslnk.cxx20
-rw-r--r--sw/source/core/edit/acorrect.cxx2
-rw-r--r--sw/source/core/edit/edfcol.cxx8
-rw-r--r--sw/source/core/edit/edtab.cxx2
-rw-r--r--sw/source/core/fields/authfld.cxx2
-rw-r--r--sw/source/core/fields/cellfml.cxx2
-rw-r--r--sw/source/core/fields/chpfld.cxx10
-rw-r--r--sw/source/core/fields/expfld.cxx2
-rw-r--r--sw/source/core/fields/reffld.cxx4
-rw-r--r--sw/source/core/frmedt/fefly1.cxx2
-rw-r--r--sw/source/core/frmedt/fetab.cxx2
-rw-r--r--sw/source/core/frmedt/tblsel.cxx24
-rw-r--r--sw/source/core/graphic/ndgrf.cxx12
-rw-r--r--sw/source/core/layout/calcmove.cxx4
-rw-r--r--sw/source/core/layout/frmtool.cxx10
-rw-r--r--sw/source/core/layout/ssfrm.cxx6
-rw-r--r--sw/source/core/layout/wsfrm.cxx4
-rw-r--r--sw/source/core/ole/ndole.cxx34
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx4
-rw-r--r--sw/source/core/text/itratr.cxx4
-rw-r--r--sw/source/core/text/porlay.cxx2
-rw-r--r--sw/source/core/text/redlnitr.cxx8
-rw-r--r--sw/source/core/text/txtfld.cxx8
-rw-r--r--sw/source/core/text/txtfrm.cxx10
-rw-r--r--sw/source/core/tox/txmsrt.cxx10
-rw-r--r--sw/source/core/txtnode/atrfld.cxx10
-rw-r--r--sw/source/core/txtnode/atrflyin.cxx8
-rw-r--r--sw/source/core/txtnode/atrftn.cxx16
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx4
-rw-r--r--sw/source/core/txtnode/modeltoviewhelper.cxx6
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx154
-rw-r--r--sw/source/core/txtnode/thints.cxx116
-rw-r--r--sw/source/core/txtnode/txtatr2.cxx34
-rw-r--r--sw/source/core/txtnode/txtedt.cxx45
-rw-r--r--sw/source/core/undo/rolbck.cxx8
-rw-r--r--sw/source/core/undo/undobj.cxx16
-rw-r--r--sw/source/core/undo/unins.cxx8
-rw-r--r--sw/source/core/undo/unnum.cxx4
-rw-r--r--sw/source/core/undo/unsect.cxx2
-rw-r--r--sw/source/core/undo/unsort.cxx2
-rw-r--r--sw/source/core/undo/untbl.cxx16
-rw-r--r--sw/source/core/unocore/unocrsr.cxx4
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx2
-rw-r--r--sw/source/core/unocore/unodraw.cxx2
-rw-r--r--sw/source/core/unocore/unofield.cxx4
-rw-r--r--sw/source/core/unocore/unoflatpara.cxx12
-rw-r--r--sw/source/core/unocore/unoframe.cxx2
-rw-r--r--sw/source/core/unocore/unoobj2.cxx8
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx6
-rw-r--r--sw/source/core/unocore/unorefmk.cxx14
-rw-r--r--sw/source/filter/ascii/ascatr.cxx4
-rw-r--r--sw/source/filter/html/htmlatr.cxx2
-rw-r--r--sw/source/filter/html/htmlnum.cxx2
-rw-r--r--sw/source/filter/html/htmlplug.cxx2
-rw-r--r--sw/source/filter/html/htmltab.cxx6
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx6
-rw-r--r--sw/source/filter/ww8/writerwordglue.cxx10
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx2
-rw-r--r--sw/source/filter/xml/xmltbli.cxx12
-rw-r--r--sw/source/uibase/docvw/AnnotationWin2.cxx2
-rw-r--r--sw/source/uibase/docvw/PageBreakWin.cxx6
102 files changed, 699 insertions, 741 deletions
diff --git a/sw/inc/htmltbl.hxx b/sw/inc/htmltbl.hxx
index 622557ab81e2..8f289c39d35d 100644
--- a/sw/inc/htmltbl.hxx
+++ b/sw/inc/htmltbl.hxx
@@ -233,7 +233,7 @@ class SwHTMLTableLayout
const SwStartNode *GetAnyBoxStartNode() const;
SwFrameFormat *FindFlyFrameFormat() const;
- const SwDoc *GetDoc() const { return GetAnyBoxStartNode()->GetDoc(); }
+ const SwDoc *GetDoc() const { return &GetAnyBoxStartNode()->GetDoc(); }
void Resize_( sal_uInt16 nAbsAvail, bool bRecalc );
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index d3cb879275de..c8c1c704f00f 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -207,8 +207,16 @@ public:
/// Node is in which nodes-array/doc?
inline SwNodes& GetNodes();
inline const SwNodes& GetNodes() const;
- inline SwDoc* GetDoc();
- inline const SwDoc* GetDoc() const;
+
+ SwDoc& GetDoc()
+ {
+ return GetNodes().GetDoc();
+ }
+
+ const SwDoc& GetDoc() const
+ {
+ return GetNodes().GetDoc();
+ }
/** Provides access to the document setting interface
*/
@@ -699,15 +707,6 @@ inline const SwNodes& SwNode::GetNodes() const
return static_cast<SwNodes&>(GetArray());
}
-inline SwDoc* SwNode::GetDoc()
-{
- return &GetNodes().GetDoc();
-}
-inline const SwDoc* SwNode::GetDoc() const
-{
- return &GetNodes().GetDoc();
-}
-
inline SwFormatColl* SwContentNode::GetCondFormatColl() const
{
return m_pCondColl;
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index f94c796d1bfb..6c87f3559b78 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -240,7 +240,7 @@ public:
void Normalize(bool bPointFirst = true);
/// @return the document (SwDoc) at which the PaM is registered
- SwDoc* GetDoc() const { return m_pPoint->nNode.GetNode().GetDoc(); }
+ SwDoc* GetDoc() const { return &m_pPoint->nNode.GetNode().GetDoc(); }
SwPosition& GetBound( bool bOne = true )
{ return bOne ? m_Bound1 : m_Bound2; }
diff --git a/sw/source/core/SwNumberTree/SwNodeNum.cxx b/sw/source/core/SwNumberTree/SwNodeNum.cxx
index 38c00087bd52..795d1c8b8745 100644
--- a/sw/source/core/SwNumberTree/SwNodeNum.cxx
+++ b/sw/source/core/SwNumberTree/SwNodeNum.cxx
@@ -345,7 +345,7 @@ void SwNodeNum::UnregisterMeAndChildrenDueToRootDelete( SwNodeNum& rNodeNum )
aResetAttrsArray.insert( aResetAttrsArray.end(), RES_PARATR_LIST_ISCOUNTED );
aResetAttrsArray.insert( aResetAttrsArray.end(), RES_PARATR_NUMRULE );
SwPaM aPam( *pTextNode );
- pTextNode->GetDoc()->ResetAttrs( aPam, false,
+ pTextNode->GetDoc().ResetAttrs( aPam, false,
aResetAttrsArray,
false );
}
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index 72c127ae6b8c..ea8034152ce8 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -94,7 +94,7 @@ class NoTextNodeAltTextCheck : public NodeCheck
{
auto pIssue = lclAddIssue(m_rIssueCollection, sIssueText,
sfx::AccessibilityIssueID::NO_ALT_OLE);
- pIssue->setDoc(pNoTextNode->GetDoc());
+ pIssue->setDoc(&pNoTextNode->GetDoc());
pIssue->setIssueObject(IssueObject::OLE);
pIssue->setObjectID(pNoTextNode->GetFlyFormat()->GetName());
}
@@ -102,7 +102,7 @@ class NoTextNodeAltTextCheck : public NodeCheck
{
auto pIssue = lclAddIssue(m_rIssueCollection, sIssueText,
sfx::AccessibilityIssueID::NO_ALT_GRAPHIC);
- pIssue->setDoc(pNoTextNode->GetDoc());
+ pIssue->setDoc(&pNoTextNode->GetDoc());
pIssue->setIssueObject(IssueObject::GRAPHIC);
pIssue->setObjectID(pNoTextNode->GetFlyFormat()->GetName());
}
@@ -129,14 +129,14 @@ public:
class TableNodeMergeSplitCheck : public NodeCheck
{
private:
- void addTableIssue(SwTable const& rTable, SwDoc* pDoc)
+ void addTableIssue(SwTable const& rTable, SwDoc& rDoc)
{
const SwTableFormat* pFormat = rTable.GetFrameFormat();
OUString sName = pFormat->GetName();
OUString sIssueText = SwResId(STR_TABLE_MERGE_SPLIT).replaceAll("%OBJECT_NAME%", sName);
auto pIssue = lclAddIssue(m_rIssueCollection, sIssueText,
sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT);
- pIssue->setDoc(pDoc);
+ pIssue->setDoc(&rDoc);
pIssue->setIssueObject(IssueObject::TABLE);
pIssue->setObjectID(sName);
}
@@ -147,10 +147,10 @@ private:
return;
SwTable const& rTable = pTableNode->GetTable();
- SwDoc* pDoc = pTableNode->GetDoc();
+ SwDoc& rDoc = pTableNode->GetDoc();
if (rTable.IsTableComplex())
{
- addTableIssue(rTable, pDoc);
+ addTableIssue(rTable, rDoc);
}
else
{
@@ -186,7 +186,7 @@ private:
}
if (!bAllColumnsSameSize || bCellSpansOverMoreRows)
{
- addTableIssue(rTable, pDoc);
+ addTableIssue(rTable, rDoc);
}
}
}
@@ -285,7 +285,7 @@ public:
SwTextNode* pTextNode = pCurrent->GetTextNode();
uno::Reference<text::XTextContent> xParagraph
- = SwXParagraph::CreateXParagraph(*pTextNode->GetDoc(), pTextNode);
+ = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode);
if (!xParagraph.is())
return;
@@ -422,7 +422,7 @@ public:
SwTextNode* pTextNode = pCurrent->GetTextNode();
uno::Reference<text::XTextContent> xParagraph;
- xParagraph = SwXParagraph::CreateXParagraph(*pTextNode->GetDoc(), pTextNode);
+ xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode);
if (!xParagraph.is())
return;
@@ -526,8 +526,8 @@ public:
sfx::AccessibilityIssueID::TEXT_FORMATTING);
pIssue->setIssueObject(IssueObject::TEXT);
pIssue->setNode(pTextNode);
- SwDoc* pDocument = pTextNode->GetDoc();
- pIssue->setDoc(pDocument);
+ SwDoc& rDocument = pTextNode->GetDoc();
+ pIssue->setDoc(&rDocument);
pIssue->setStart(pTextAttr->GetStart());
pIssue->setEnd(pTextAttr->GetAnyEnd());
}
@@ -583,7 +583,7 @@ public:
SwTextNode* pTextNode = pCurrent->GetTextNode();
uno::Reference<text::XTextContent> xParagraph;
- xParagraph = SwXParagraph::CreateXParagraph(*pTextNode->GetDoc(), pTextNode);
+ xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode);
if (!xParagraph.is())
return;
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 1a543581f253..7a8fb42f0c7a 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1452,14 +1452,14 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
std::unique_ptr<SfxItemSet> pSet;
if ( !bOnlyCharAttrs )
{
- pSet.reset( new SfxItemSet( const_cast<SwAttrPool&>(pTextNode->GetDoc()->GetAttrPool()),
+ pSet.reset( new SfxItemSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
RES_PARATR_BEGIN, RES_PARATR_END - 1,
RES_FRMATR_BEGIN, RES_FRMATR_END - 1>{} ) );
}
else
{
- pSet.reset( new SfxItemSet( const_cast<SwAttrPool&>(pTextNode->GetDoc()->GetAttrPool()),
+ pSet.reset( new SfxItemSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END - 1>{} ) );
}
// #i82637# - From the perspective of the a11y API the default character
@@ -1470,7 +1470,7 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
// get default paragraph attributes, if needed, and merge these into <pSet>
if ( !bOnlyCharAttrs )
{
- SfxItemSet aParaSet( const_cast<SwAttrPool&>(pTextNode->GetDoc()->GetAttrPool()),
+ SfxItemSet aParaSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
svl::Items<RES_PARATR_BEGIN, RES_PARATR_END - 1,
RES_FRMATR_BEGIN, RES_FRMATR_END - 1>{} );
pTextNode->SwContentNode::GetAttr( aParaSet );
@@ -1481,7 +1481,7 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl(
"<SwAccessibleParagraph::_getDefaultAttributesImpl(..)> - missing paragraph style. Serious defect!" );
if ( pTextNode->GetTextColl() )
{
- SfxItemSet aCharSet( const_cast<SwAttrPool&>(pTextNode->GetDoc()->GetAttrPool()),
+ SfxItemSet aCharSet( const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END - 1>{} );
SetPutRecursive( aCharSet, pTextNode->GetTextColl()->GetAttrSet() );
pSet->Put( aCharSet );
@@ -1762,7 +1762,7 @@ void SwAccessibleParagraph::_getSupplementalAttributesImpl(
std::unique_ptr<SfxItemSet> pSet;
pSet.reset(
new SfxItemSet(
- const_cast<SwAttrPool&>(pTextNode->GetDoc()->GetAttrPool()),
+ const_cast<SwAttrPool&>(pTextNode->GetDoc().GetAttrPool()),
svl::Items<
RES_PARATR_LINESPACING, RES_PARATR_ADJUST,
RES_PARATR_TABSTOP, RES_PARATR_TABSTOP,
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
index b7e4f507f0c2..9fbd1f9e77db 100644
--- a/sw/source/core/attr/cellatr.cxx
+++ b/sw/source/core/attr/cellatr.cxx
@@ -121,7 +121,7 @@ void SwTableBoxFormula::ChangeState( const SfxPoolItem* pItem )
// detect table that contains this attribute
const SwTableNode* pTableNd;
const SwNode* pNd = GetNodeOfFormula();
- if (!pNd || &pNd->GetNodes() != &pNd->GetDoc()->GetNodes())
+ if (!pNd || &pNd->GetNodes() != &pNd->GetDoc().GetNodes())
return;
pTableNd = pNd->FindTableNode();
if( pTableNd == nullptr )
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index aa6d9f1ad088..35f711297789 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -299,7 +299,7 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
const SfxPoolItem* pItem;
const SwDoc *pSrcDoc = GetDoc();
- SwDoc *pDstDoc = pCNd ? pCNd->GetDoc() : pFormat->GetDoc();
+ SwDoc *pDstDoc = pCNd ? &pCNd->GetDoc() : pFormat->GetDoc();
// Does the NumRule has to be copied?
if( pSrcDoc != pDstDoc &&
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 4398607ce0f7..7c7471b081b5 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -738,7 +738,7 @@ static SwFrame* lcl_IsInHeaderFooter( const SwNodeIndex& rIdx, Point& rPt )
{
std::pair<Point, bool> tmp(rPt, false);
SwContentFrame *pContentFrame = pCNd->getLayoutFrame(
- pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, &tmp);
pFrame = pContentFrame ? pContentFrame->GetUpper() : nullptr;
while( pFrame && !pFrame->IsHeaderFrame() && !pFrame->IsFooterFrame() )
@@ -3688,7 +3688,7 @@ static void lcl_FillTextRange( uno::Reference<text::XTextRange>& rRange,
aEndPos.nContent = nBegin + nLen;
const uno::Reference<text::XTextRange> xRange =
- SwXTextRange::CreateXTextRange(*rNode.GetDoc(), aStartPos, &aEndPos);
+ SwXTextRange::CreateXTextRange(rNode.GetDoc(), aStartPos, &aEndPos);
rRange = xRange;
}
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 38676f772659..804bdab8a05a 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -644,7 +644,7 @@ static void lcl_MakeFieldLst(
std::pair<Point, bool> const tmp(aPt, false);
const SwContentFrame* pCFrame =
rTextNode.getLayoutFrame(
- rTextNode.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ rTextNode.GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, &tmp);
if ( pCFrame != nullptr
&& ( bInReadOnly || !pCFrame->IsProtected() ) )
@@ -1900,7 +1900,7 @@ bool SwContentAtPos::IsInProtectSect() const
if( pNd->IsInProtectSect() )
return true;
- const SwContentFrame* pFrame = pNd->getLayoutFrame(pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr);
+ const SwContentFrame* pFrame = pNd->getLayoutFrame(pNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr);
return pFrame && pFrame->IsProtected() ;
}
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 1e9ecef2c2d2..047e3db0127b 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -505,7 +505,7 @@ bool FindTextImpl(SwPaM & rSearchPam,
}
- SwDocShell *const pDocShell = pNode->GetDoc()->GetDocShell();
+ SwDocShell *const pDocShell = pNode->GetDoc().GetDocShell();
SwWrtShell *const pWrtShell = pDocShell ? pDocShell->GetWrtShell() : nullptr;
SwPostItMgr *const pPostItMgr = pWrtShell ? pWrtShell->GetPostItMgr() : nullptr;
@@ -557,7 +557,7 @@ bool FindTextImpl(SwPaM & rSearchPam,
if (!bEndedTextEdit && !(pSearchItem && pSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL))
{
// If there are any shapes anchored to this node, search there.
- SwPaM aPaM(pNode->GetDoc()->GetNodes().GetEndOfContent());
+ SwPaM aPaM(pNode->GetDoc().GetNodes().GetEndOfContent());
if (pLayout)
{
*aPaM.GetPoint() = pFrame->MapViewToModelPos(nStart.GetFrameIndex());
@@ -582,7 +582,7 @@ bool FindTextImpl(SwPaM & rSearchPam,
aPaM.GetMark()->nNode = rTextNode.GetIndex() + 1;
}
aPaM.GetMark()->nContent.Assign(aPaM.GetMark()->nNode.GetNode().GetTextNode(), 0);
- if (pNode->GetDoc()->getIDocumentDrawModelAccess().Search(aPaM, *xSearchItem) && pSdrView)
+ if (pNode->GetDoc().getIDocumentDrawModelAccess().Search(aPaM, *xSearchItem) && pSdrView)
{
if (SdrObject* pObject = pSdrView->GetTextEditObject())
{
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 0473d8bacfd1..fb7aa7cd38a5 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -177,7 +177,7 @@ bool SwPosition::operator!=(const SwPosition &rPos) const
SwDoc * SwPosition::GetDoc() const
{
- return nNode.GetNode().GetDoc();
+ return &nNode.GetNode().GetDoc();
}
void SwPosition::dumpAsXml(xmlTextWriterPtr pWriter) const
@@ -560,7 +560,7 @@ sal_uInt16 SwPaM::GetPageNum( bool bAtPoint, const Point* pLayPos )
tmp.second = false;
}
if( nullptr != ( pNd = pPos->nNode.GetNode().GetContentNode() ) &&
- nullptr != (pCFrame = pNd->getLayoutFrame(pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), pPos, pLayPos ? &tmp : nullptr)) &&
+ nullptr != (pCFrame = pNd->getLayoutFrame(pNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), pPos, pLayPos ? &tmp : nullptr)) &&
nullptr != ( pPg = pCFrame->FindPageFrame() ))
return pPg->GetPhyPageNum();
return 0;
@@ -603,7 +603,7 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const
Point aTmpPt;
std::pair<Point, bool> const tmp(aTmpPt, false);
pFrame = pNd->getLayoutFrame(
- pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
GetPoint(), &tmp);
}
@@ -649,7 +649,7 @@ bool SwPaM::HasReadonlySel( bool bFormView ) const
Point aTmpPt;
std::pair<Point, bool> const tmp(aTmpPt, false);
pFrame = pNd->getLayoutFrame(
- pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
GetMark(), &tmp);
}
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index dbb60e5ea6bc..2e1a19338a52 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1527,7 +1527,7 @@ static OUString lcl_MaskDeletedRedlines( const SwTextNode* pTextNd )
{
//mask deleted redlines
OUString sNodeText(pTextNd->GetText());
- const SwDoc& rDoc = *pTextNd->GetDoc();
+ const SwDoc& rDoc = pTextNd->GetDoc();
const bool bShowChg = IDocumentRedlineAccess::IsShowChanges( rDoc.getIDocumentRedlineAccess().GetRedlineFlags() );
if ( bShowChg )
{
diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx
index ad7f956a2af3..9baa0761c06a 100644
--- a/sw/source/core/crsr/trvlfnfl.cxx
+++ b/sw/source/core/crsr/trvlfnfl.cxx
@@ -138,7 +138,7 @@ bool SwCursor::GotoFootnoteAnchor()
if( pSttNd )
{
// search in all footnotes in document for this StartIndex
- const SwFootnoteIdxs& rFootnoteArr = pSttNd->GetDoc()->GetFootnoteIdxs();
+ const SwFootnoteIdxs& rFootnoteArr = pSttNd->GetDoc().GetFootnoteIdxs();
for( size_t n = 0; n < rFootnoteArr.size(); ++n )
{
const SwTextFootnote* pTextFootnote = rFootnoteArr[ n ];
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index 9ce51c029576..533f17907b05 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -369,7 +369,7 @@ static bool lcl_FindNextCell( SwNodeIndex& rIdx, bool bInReadOnly )
if ( !pCNd )
return false;
- SwContentFrame* pFrame = pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() );
+ SwContentFrame* pFrame = pCNd->getLayoutFrame( pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() );
if ( nullptr == pFrame || pCNd->FindTableNode() != pTableNd ||
(!bInReadOnly && pFrame->IsProtected() ) )
@@ -401,7 +401,7 @@ static bool lcl_FindNextCell( SwNodeIndex& rIdx, bool bInReadOnly )
return false;
// check if we have found a suitable table cell:
- pFrame = pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() );
+ pFrame = pCNd->getLayoutFrame( pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() );
if ( nullptr != pFrame && pCNd->FindTableNode() == pTableNd &&
(bInReadOnly || !pFrame->IsProtected() ) )
@@ -441,7 +441,7 @@ static bool lcl_FindPrevCell( SwNodeIndex& rIdx, bool bInReadOnly )
if ( !pCNd )
return false;
- SwContentFrame* pFrame = pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() );
+ SwContentFrame* pFrame = pCNd->getLayoutFrame( pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() );
if( nullptr == pFrame || pCNd->FindTableNode() != pTableNd ||
(!bInReadOnly && pFrame->IsProtected() ))
@@ -462,7 +462,7 @@ static bool lcl_FindPrevCell( SwNodeIndex& rIdx, bool bInReadOnly )
if ( !pCNd )
return false;
- pFrame = pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() );
+ pFrame = pCNd->getLayoutFrame( pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() );
if( nullptr != pFrame && pCNd->FindTableNode() == pTableNd &&
(bInReadOnly || !pFrame->IsProtected() ) )
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 3479e62c2c37..9a949d6479a2 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -371,7 +371,7 @@ static SwRect lcl_getLayoutRect(const Point& rPoint, const SwPosition& rPosition
const SwContentNode* pNode = rPosition.nNode.GetNode().GetContentNode();
std::pair<Point, bool> const tmp(rPoint, true);
const SwContentFrame* pFrame = pNode->getLayoutFrame(
- pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pNode->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
&rPosition, &tmp);
SwRect aRect;
pFrame->GetCharRect(aRect, rPosition);
diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx
index bc60a0de37a6..57e700182662 100644
--- a/sw/source/core/doc/CntntIdxStore.cxx
+++ b/sw/source/core/doc/CntntIdxStore.cxx
@@ -167,18 +167,18 @@ namespace
virtual void Restore(SwNode& rNd, sal_Int32 nLen, sal_Int32 nCorrLen, RestoreMode eMode = RestoreMode::All) override
{
SwContentNode* pCNd = rNd.GetContentNode();
- SwDoc* pDoc = rNd.GetDoc();
+ SwDoc& rDoc = rNd.GetDoc();
updater_t aUpdater = LimitUpdater(pCNd, nLen, nCorrLen);
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, false);
+ RestoreFlys(&rDoc, aUpdater, false);
}
}
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 558db3827522..267a02c0a1d4 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -99,10 +99,10 @@ namespace
{
// Copy method from SwDoc
// Prevent copying into Flys that are anchored in the range
- bool lcl_ChkFlyFly( SwDoc* pDoc, sal_uLong nSttNd, sal_uLong nEndNd,
+ bool lcl_ChkFlyFly( SwDoc& rDoc, sal_uLong nSttNd, sal_uLong nEndNd,
sal_uLong nInsNd )
{
- const SwFrameFormats& rFrameFormatTable = *pDoc->GetSpzFrameFormats();
+ const SwFrameFormats& rFrameFormatTable = *rDoc.GetSpzFrameFormats();
for( size_t n = 0; n < rFrameFormatTable.size(); ++n )
{
@@ -128,7 +128,7 @@ namespace
// Do not copy !
return true;
- if( lcl_ChkFlyFly( pDoc, pSNd->GetIndex(),
+ if( lcl_ChkFlyFly( rDoc, pSNd->GetIndex(),
pSNd->EndOfSectionIndex(), nInsNd ) )
// Do not copy !
return true;
@@ -422,8 +422,8 @@ namespace
void lcl_DeleteRedlines( const SwNodeRange& rRg, SwNodeRange const & rCpyRg )
{
- SwDoc* pSrcDoc = rRg.aStart.GetNode().GetDoc();
- if( !pSrcDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() )
+ SwDoc& rSrcDoc = rRg.aStart.GetNode().GetDoc();
+ if( !rSrcDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() )
{
SwPaM aRgTmp( rRg.aStart, rRg.aEnd );
SwPaM aCpyTmp( rCpyRg.aStart, rCpyRg.aEnd );
@@ -770,24 +770,24 @@ namespace
void lcl_SaveRedlines(const SwPaM& aPam, SaveRedlines_t& rArr)
{
- SwDoc* pDoc = aPam.GetNode().GetDoc();
+ SwDoc& rDoc = aPam.GetNode().GetDoc();
const SwPosition* pStart = aPam.Start();
const SwPosition* pEnd = aPam.End();
// get first relevant redline
SwRedlineTable::size_type nCurrentRedline;
- pDoc->getIDocumentRedlineAccess().GetRedline( *pStart, &nCurrentRedline );
+ rDoc.getIDocumentRedlineAccess().GetRedline( *pStart, &nCurrentRedline );
if( nCurrentRedline > 0)
nCurrentRedline--;
// redline mode RedlineFlags::Ignore|RedlineFlags::On; save old mode
- RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags();
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( ( eOld & ~RedlineFlags::Ignore) | RedlineFlags::On );
+ RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
+ rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( ( eOld & ~RedlineFlags::Ignore) | RedlineFlags::On );
// iterate over relevant redlines and decide for each whether it should
// be saved, or split + saved
- SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
+ SwRedlineTable& rRedlineTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable();
for( ; nCurrentRedline < rRedlineTable.size(); nCurrentRedline++ )
{
SwRangeRedline* pCurrent = rRedlineTable[ nCurrentRedline ];
@@ -812,7 +812,7 @@ namespace
SwRangeRedline* pNewRedline = new SwRangeRedline( *pCurrent );
*pNewRedline->End() = *pStart;
*pCurrent->Start() = *pStart;
- pDoc->getIDocumentRedlineAccess().AppendRedline( pNewRedline, true );
+ rDoc.getIDocumentRedlineAccess().AppendRedline( pNewRedline, true );
}
// split end, if necessary
@@ -822,7 +822,7 @@ namespace
SwRangeRedline* pNewRedline = new SwRangeRedline( *pCurrent );
*pNewRedline->Start() = *pEnd;
*pCurrent->End() = *pEnd;
- pDoc->getIDocumentRedlineAccess().AppendRedline( pNewRedline, true );
+ rDoc.getIDocumentRedlineAccess().AppendRedline( pNewRedline, true );
}
// save the current redline
@@ -831,7 +831,7 @@ namespace
}
// restore old redline mode
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
+ rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
}
void lcl_RestoreRedlines(SwDoc* pDoc, const SwPosition& rPos, SaveRedlines_t& rArr)
@@ -850,18 +850,18 @@ namespace
void lcl_SaveRedlines(const SwNodeRange& rRg, SaveRedlines_t& rArr)
{
- SwDoc* pDoc = rRg.aStart.GetNode().GetDoc();
+ SwDoc& rDoc = rRg.aStart.GetNode().GetDoc();
SwRedlineTable::size_type nRedlPos;
SwPosition aSrchPos( rRg.aStart ); aSrchPos.nNode--;
aSrchPos.nContent.Assign( aSrchPos.nNode.GetNode().GetContentNode(), 0 );
- if( pDoc->getIDocumentRedlineAccess().GetRedline( aSrchPos, &nRedlPos ) && nRedlPos )
+ if( rDoc.getIDocumentRedlineAccess().GetRedline( aSrchPos, &nRedlPos ) && nRedlPos )
--nRedlPos;
- else if( nRedlPos >= pDoc->getIDocumentRedlineAccess().GetRedlineTable().size() )
+ else if( nRedlPos >= rDoc.getIDocumentRedlineAccess().GetRedlineTable().size() )
return ;
- RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags();
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( ( eOld & ~RedlineFlags::Ignore) | RedlineFlags::On );
- SwRedlineTable& rRedlTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
+ RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
+ rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( ( eOld & ~RedlineFlags::Ignore) | RedlineFlags::On );
+ SwRedlineTable& rRedlTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable();
do {
SwRangeRedline* pTmp = rRedlTable[ nRedlPos ];
@@ -921,14 +921,14 @@ namespace
pTmpPos->nNode = rRg.aEnd;
pTmpPos->nContent.Assign(
pTmpPos->nNode.GetNode().GetContentNode(), 0 );
- pDoc->getIDocumentRedlineAccess().AppendRedline( pTmp, true );
+ rDoc.getIDocumentRedlineAccess().AppendRedline( pTmp, true );
}
}
else
break;
- } while( ++nRedlPos < pDoc->getIDocumentRedlineAccess().GetRedlineTable().size() );
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
+ } while( ++nRedlPos < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size() );
+ rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
}
void lcl_RestoreRedlines(SwDoc *const pDoc, sal_uInt32 const nInsPos, SaveRedlines_t& rArr)
@@ -1895,15 +1895,15 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos,
{
const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
- SwDoc* pDoc = rPos.nNode.GetNode().GetDoc();
- bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection();
+ SwDoc& rDoc = rPos.nNode.GetNode().GetDoc();
+ bool bColumnSel = rDoc.IsClipBoard() && rDoc.IsColumnSelection();
// Catch if there's no copy to do
if (!rPam.HasMark() || (IsEmptyRange(*pStt, *pEnd, flags) && !bColumnSel))
return false;
// Prevent copying into Flys that are anchored in the source range
- if (pDoc == &m_rDoc && (flags & SwCopyFlags::CheckPosInFly))
+ if (&rDoc == &m_rDoc && (flags & SwCopyFlags::CheckPosInFly))
{
// Correct the Start-/EndNode
sal_uLong nStt = pStt->nNode.GetIndex(),
@@ -1922,22 +1922,22 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos,
--nDiff;
}
if( nDiff &&
- lcl_ChkFlyFly( pDoc, nStt, nEnd, rPos.nNode.GetIndex() ) )
+ lcl_ChkFlyFly( rDoc, nStt, nEnd, rPos.nNode.GetIndex() ) )
{
return false;
}
}
SwPaM* pRedlineRange = nullptr;
- if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() ||
- (!pDoc->getIDocumentRedlineAccess().IsIgnoreRedline() && !pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() ) )
+ if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() ||
+ (!rDoc.getIDocumentRedlineAccess().IsIgnoreRedline() && !rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() ) )
pRedlineRange = new SwPaM( rPos );
- RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags();
+ RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
bool bRet = false;
- if( pDoc != &m_rDoc )
+ if( &rDoc != &m_rDoc )
{ // ordinary copy
bRet = CopyImpl(rPam, rPos, flags & ~SwCopyFlags::CheckPosInFly, pRedlineRange);
}
@@ -1955,13 +1955,13 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos,
assert(!"mst: this is assumed to be dead code");
}
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
+ rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
if( pRedlineRange )
{
- if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
- pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( RedlineType::Insert, *pRedlineRange ), true);
+ if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
+ rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( RedlineType::Insert, *pRedlineRange ), true);
else
- pDoc->getIDocumentRedlineAccess().SplitRedline( *pRedlineRange );
+ rDoc.getIDocumentRedlineAccess().SplitRedline( *pRedlineRange );
delete pRedlineRange;
}
@@ -3472,7 +3472,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
assert(!pCopiedPaM || pCopiedPaM->first.End()->nNode == rRg.aEnd);
assert(!pCopiedPaM || pCopiedPaM->second.nNode <= rInsPos);
- SwDoc* pDest = rInsPos.GetNode().GetDoc();
+ SwDoc& rDest = rInsPos.GetNode().GetDoc();
SwNodeIndex aSavePos( rInsPos );
if (rRg.aStart != rRg.aEnd)
@@ -3536,7 +3536,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
SwNodeIndex const end(rInsPos,
(!isRecreateEndNode || isAtStartOfSection)
? 0 : +1);
- ::MakeFrames(pDest, aSavePos, end);
+ ::MakeFrames(&rDest, aSavePos, end);
}
if (bEndIsEqualEndPos)
{
@@ -3566,7 +3566,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
#endif
{
- ::sw::UndoGuard const undoGuard(pDest->GetIDocumentUndoRedo());
+ ::sw::UndoGuard const undoGuard(rDest.GetIDocumentUndoRedo());
CopyFlyInFlyImpl(rRg, pCopiedPaM ? &pCopiedPaM->first : nullptr,
// see comment below regarding use of pCopiedPaM->second
(pCopiedPaM && rRg.aStart != pCopiedPaM->first.Start()->nNode)
@@ -3599,10 +3599,10 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
sw::CopyBookmarks(pCopiedPaM ? pCopiedPaM->first : aRgTmp, *aCpyPaM.Start());
}
- if( bDelRedlines && ( RedlineFlags::DeleteRedlines & pDest->getIDocumentRedlineAccess().GetRedlineFlags() ))
+ if( bDelRedlines && ( RedlineFlags::DeleteRedlines & rDest.getIDocumentRedlineAccess().GetRedlineFlags() ))
lcl_DeleteRedlines( rRg, aCpyRange );
- pDest->GetNodes().DelDummyNodes( aCpyRange );
+ rDest.GetNodes().DelDummyNodes( aCpyRange );
}
// note: for the redline Show/Hide this must be in sync with
@@ -3619,7 +3619,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl(
// First collect all Flys, sort them according to their ordering number,
// and then only copy them. This maintains the ordering numbers (which are only
// managed in the DrawModel).
- SwDoc *const pDest = rStartIdx.GetNode().GetDoc();
+ SwDoc& rDest = rStartIdx.GetNode().GetDoc();
std::set< ZSortFly > aSet;
const size_t nArrLen = m_rDoc.GetSpzFrameFormats()->size();
@@ -3797,7 +3797,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl(
aAnchor.SetAnchor( &newPos );
// Check recursion: if copying content inside the same frame, then don't copy the format.
- if( pDest == &m_rDoc )
+ if( &rDest == &m_rDoc )
{
const SwFormatContent& rContent = (*it).GetFormat()->GetContent();
const SwStartNode* pSNd;
@@ -3820,7 +3820,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl(
}
// Copy the format and set the new anchor
- aVecSwFrameFormat.push_back( pDest->getIDocumentLayoutAccess().CopyLayoutFormat( *(*it).GetFormat(),
+ aVecSwFrameFormat.push_back( rDest.getIDocumentLayoutAccess().CopyLayoutFormat( *(*it).GetFormat(),
aAnchor, false, true ) );
++it;
}
@@ -4696,8 +4696,8 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
SwCopyFlags const flags,
SwPaM *const pCpyRange) const
{
- SwDoc* pDoc = rPos.nNode.GetNode().GetDoc();
- const bool bColumnSel = pDoc->IsClipBoard() && pDoc->IsColumnSelection();
+ SwDoc& rDoc = rPos.nNode.GetNode().GetDoc();
+ const bool bColumnSel = rDoc.IsClipBoard() && rDoc.IsColumnSelection();
SwPosition const*const pStt = rPam.Start();
SwPosition *const pEnd = rPam.End();
@@ -4706,37 +4706,37 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
if (!rPam.HasMark() || (IsEmptyRange(*pStt, *pEnd, flags) && !bColumnSel) ||
//JP 29.6.2001: 88963 - don't copy if inspos is in region of start to end
//JP 15.11.2001: don't test inclusive the end, ever exclusive
- ( pDoc == &m_rDoc && *pStt <= rPos && rPos < *pEnd ))
+ ( &rDoc == &m_rDoc && *pStt <= rPos && rPos < *pEnd ))
{
return false;
}
- const bool bEndEqualIns = pDoc == &m_rDoc && rPos == *pEnd;
+ const bool bEndEqualIns = &rDoc == &m_rDoc && rPos == *pEnd;
// If Undo is enabled, create the UndoCopy object
SwUndoCpyDoc* pUndo = nullptr;
// lcl_DeleteRedlines may delete the start or end node of the cursor when
// removing the redlines so use cursor that is corrected by PaMCorrAbs
- std::shared_ptr<SwUnoCursor> const pCopyPam(pDoc->CreateUnoCursor(rPos));
+ std::shared_ptr<SwUnoCursor> const pCopyPam(rDoc.CreateUnoCursor(rPos));
- SwTableNumFormatMerge aTNFM( m_rDoc, *pDoc );
+ SwTableNumFormatMerge aTNFM( m_rDoc, rDoc );
std::unique_ptr<std::vector<SwFrameFormat*>> pFlys;
std::vector<SwFrameFormat*> const* pFlysAtInsPos;
- if (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ if (rDoc.GetIDocumentUndoRedo().DoesUndo())
{
pUndo = new SwUndoCpyDoc(*pCopyPam);
- pDoc->GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndo) );
+ rDoc.GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndo) );
pFlysAtInsPos = pUndo->GetFlysAnchoredAt();
}
else
{
- pFlys = sw::GetFlysAnchoredAt(*pDoc, rPos.nNode.GetIndex());
+ pFlys = sw::GetFlysAnchoredAt(rDoc, rPos.nNode.GetIndex());
pFlysAtInsPos = pFlys.get();
}
- RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags();
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore);
+ RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
+ rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern(eOld | RedlineFlags::Ignore);
// Move the PaM one node back from the insert position, so that
// the position doesn't get moved
@@ -4765,7 +4765,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
SwTextNode* pSttTextNd = pStt->nNode.GetNode().GetTextNode();
SwTextNode* pEndTextNd = pEnd->nNode.GetNode().GetTextNode();
SwTextNode* pDestTextNd = aInsPos.GetNode().GetTextNode();
- bool bCopyCollFormat = !pDoc->IsInsOnlyTextGlossary() &&
+ bool bCopyCollFormat = !rDoc.IsInsOnlyTextGlossary() &&
( (pDestTextNd && !pDestTextNd->GetText().getLength()) ||
( !bOneNode && !rPos.nContent.GetIndex() ) );
bool bCopyBookmarks = true;
@@ -4773,9 +4773,9 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
int nDeleteTextNodes = 0;
// #i104585# copy outline num rule to clipboard (for ASCII filter)
- if (pDoc->IsClipBoard() && m_rDoc.GetOutlineNumRule())
+ if (rDoc.IsClipBoard() && m_rDoc.GetOutlineNumRule())
{
- pDoc->SetOutlineNumRule(*m_rDoc.GetOutlineNumRule());
+ rDoc.SetOutlineNumRule(*m_rDoc.GetOutlineNumRule());
}
// #i86492#
@@ -4785,11 +4785,11 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
// Keep also the <ListId> value for possible propagation.
OUString aListIdToPropagate;
const SwNumRule* pNumRuleToPropagate =
- pDoc->SearchNumRule( rPos, false, true, false, 0, aListIdToPropagate, nullptr, true );
+ rDoc.SearchNumRule( rPos, false, true, false, 0, aListIdToPropagate, nullptr, true );
if ( !pNumRuleToPropagate )
{
pNumRuleToPropagate =
- pDoc->SearchNumRule( rPos, false, false, false, 0, aListIdToPropagate, nullptr, true );
+ rDoc.SearchNumRule( rPos, false, false, false, 0, aListIdToPropagate, nullptr, true );
}
// #i86492#
// Do not propagate previous found list, if
@@ -4816,11 +4816,11 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
if( !pDestTextNd )
{
if( pStt->nContent.GetIndex() || bOneNode )
- pDestTextNd = pDoc->GetNodes().MakeTextNode( aInsPos,
- pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD));
+ pDestTextNd = rDoc.GetNodes().MakeTextNode( aInsPos,
+ rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD));
else
{
- pDestTextNd = pSttTextNd->MakeCopy(pDoc, aInsPos, true)->GetTextNode();
+ pDestTextNd = pSttTextNd->MakeCopy(&rDoc, aInsPos, true)->GetTextNode();
bCopyOk = true;
}
aDestIdx.Assign( pDestTextNd, 0 );
@@ -4830,8 +4830,8 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
{
const sal_Int32 nContentEnd = pEnd->nContent.GetIndex();
{
- ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
- pDoc->getIDocumentContentOperations().SplitNode( rPos, false );
+ ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
+ rDoc.getIDocumentContentOperations().SplitNode( rPos, false );
}
if (bCanMoveBack && rPos == *pCopyPam->GetPoint())
@@ -4841,7 +4841,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
pCopyPam->Move( fnMoveBackward, GoInContent );
}
- pDestTextNd = pDoc->GetNodes()[ aInsPos.GetIndex()-1 ]->GetTextNode();
+ pDestTextNd = rDoc.GetNodes()[ aInsPos.GetIndex()-1 ]->GetTextNode();
aDestIdx.Assign(
pDestTextNd, pDestTextNd->GetText().getLength());
@@ -4897,7 +4897,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
// copy at-char flys in rPam
SwNodeIndex temp(*pDestTextNd); // update to new (start) node for flys
// tdf#126626 prevent duplicate Undos
- ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
+ ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
CopyFlyInFlyImpl(aRg, &rPam, temp, false);
break;
@@ -4921,8 +4921,8 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
const sal_Int32 nContentEnd = pEnd->nContent.GetIndex();
{
- ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
- pDoc->getIDocumentContentOperations().SplitNode( rPos, false );
+ ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
+ rDoc.getIDocumentContentOperations().SplitNode( rPos, false );
}
if (bCanMoveBack && rPos == *pCopyPam->GetPoint())
@@ -4963,8 +4963,8 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
SwIndex aDestIdx( rPos.nContent );
if( !pDestTextNd )
{
- pDestTextNd = pDoc->GetNodes().MakeTextNode( aInsPos,
- pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD));
+ pDestTextNd = rDoc.GetNodes().MakeTextNode( aInsPos,
+ rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD));
aDestIdx.Assign( pDestTextNd, 0 );
aInsPos--;
@@ -4997,7 +4997,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
}
}
- SfxItemSet aBrkSet( pDoc->GetAttrPool(), aBreakSetRange );
+ SfxItemSet aBrkSet( rDoc.GetAttrPool(), aBreakSetRange );
if ((flags & SwCopyFlags::CopyAll) || aRg.aStart != aRg.aEnd)
{
if (pSttTextNd && bCopyCollFormat && pDestTextNd->HasSwAttrSet())
@@ -5077,7 +5077,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
if ((flags & SwCopyFlags::CopyAll) || aRg.aStart != aRg.aEnd)
{
// Put the breaks back into the first node
- if( aBrkSet.Count() && nullptr != ( pDestTextNd = pDoc->GetNodes()[
+ if( aBrkSet.Count() && nullptr != ( pDestTextNd = rDoc.GetNodes()[
pCopyPam->GetPoint()->nNode.GetIndex()+1 ]->GetTextNode()))
{
pDestTextNd->SetAttr( aBrkSet );
@@ -5092,7 +5092,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
// tdf#39400 and tdf#97526
// when copy from document to ClipBoard, and it is from the first page
// and not the source has the page break
- if (pDoc->IsClipBoard() && (rPam.GetPageNum(pStt == rPam.GetPoint()) == 1) && !bCopyPageSource)
+ if (rDoc.IsClipBoard() && (rPam.GetPageNum(pStt == rPam.GetPoint()) == 1) && !bCopyPageSource)
{
pDestTextNd->ResetAttr(RES_BREAK); // remove the page-break
pDestTextNd->ResetAttr(RES_PAGEDESC);
@@ -5151,7 +5151,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
}
// If Undo is enabled, store the inserted area
- if (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ if (rDoc.GetIDocumentUndoRedo().DoesUndo())
{
pUndo->SetInsertRange(*pCopyPam, true, nDeleteTextNodes);
}
@@ -5168,12 +5168,12 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
// #i86492# - use <SwDoc::SetNumRule(..)>, because it also handles the <ListId>
// Don't reset indent attributes, that would mean loss of direct
// formatting.
- pDoc->SetNumRule( *pCopyPam, *pNumRuleToPropagate, false, nullptr,
+ rDoc.SetNumRule( *pCopyPam, *pNumRuleToPropagate, false, nullptr,
aListIdToPropagate, true, /*bResetIndentAttrs=*/false );
}
- pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
- pDoc->getIDocumentState().SetModified();
+ rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
+ rDoc.getIDocumentState().SetModified();
return true;
}
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index 3fb9c460bbd3..05a8e0b2d810 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -416,29 +416,26 @@ static OUString lcl_AnchoredFrames(const SwNode & rNode)
{
OUStringBuffer aResult("[");
- const SwDoc * pDoc = rNode.GetDoc();
- if (pDoc)
- {
- const SwFrameFormats * pFrameFormats = pDoc->GetSpzFrameFormats();
+ const SwDoc& rDoc = rNode.GetDoc();
+ const SwFrameFormats * pFrameFormats = rDoc.GetSpzFrameFormats();
- if (pFrameFormats)
+ if (pFrameFormats)
+ {
+ bool bFirst = true;
+ for (SwFrameFormats::const_iterator i(pFrameFormats->begin());
+ i != pFrameFormats->end(); ++i)
{
- bool bFirst = true;
- for (SwFrameFormats::const_iterator i(pFrameFormats->begin());
- i != pFrameFormats->end(); ++i)
+ const SwFormatAnchor & rAnchor = (*i)->GetAnchor();
+ const SwPosition * pPos = rAnchor.GetContentAnchor();
+
+ if (pPos && &pPos->nNode.GetNode() == &rNode)
{
- const SwFormatAnchor & rAnchor = (*i)->GetAnchor();
- const SwPosition * pPos = rAnchor.GetContentAnchor();
-
- if (pPos && &pPos->nNode.GetNode() == &rNode)
- {
- if (! bFirst)
- aResult.append(", ");
-
- if (*i)
- aResult.append(lcl_dbg_out(**i));
- bFirst = false;
- }
+ if (! bFirst)
+ aResult.append(", ");
+
+ if (*i)
+ aResult.append(lcl_dbg_out(**i));
+ bFirst = false;
}
}
}
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 36ad4d6795ee..b9ab931ddc1b 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1799,14 +1799,14 @@ void DelBookmarks(
if(rStt.GetIndex() > rEnd.GetIndex()
|| (rStt == rEnd && (!pSttIdx || !pEndIdx || pSttIdx->GetIndex() >= pEndIdx->GetIndex())))
return;
- SwDoc* const pDoc = rStt.GetNode().GetDoc();
+ SwDoc& rDoc = rStt.GetNode().GetDoc();
- pDoc->getIDocumentMarkAccess()->deleteMarks(rStt, rEnd, pSaveBkmk, pSttIdx, pEndIdx);
+ rDoc.getIDocumentMarkAccess()->deleteMarks(rStt, rEnd, pSaveBkmk, pSttIdx, pEndIdx);
// Copy all Redlines which are in the move area into an array
// which holds all position information as offset.
// Assignment happens after moving.
- SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
+ SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable();
for(SwRangeRedline* pRedl : rTable)
{
// Is at position?
@@ -1823,7 +1823,7 @@ void DelBookmarks(
bool bStt = true;
SwContentNode* pCNd = pRStt->nNode.GetNode().GetContentNode();
if( !pCNd )
- pCNd = pDoc->GetNodes().GoNext( &pRStt->nNode );
+ pCNd = rDoc.GetNodes().GoNext( &pRStt->nNode );
if (!pCNd)
{
bStt = false;
@@ -1853,7 +1853,7 @@ void DelBookmarks(
{
bStt = true;
pREnd->nNode = rEnd;
- pCNd = pDoc->GetNodes().GoNext( &pREnd->nNode );
+ pCNd = rDoc.GetNodes().GoNext( &pREnd->nNode );
if( !pCNd )
{
pREnd->nNode = pRStt->nNode;
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 149f2e1eb518..2b820d8d0500 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1282,7 +1282,7 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine,
{
SwTextNode& rDstNd = *const_cast<SwTextNode*>(m_rNode.GetTextNode());
const SwTextNode& rSrcNd = *rLine.GetNode().GetTextNode();
- SwDoc* pDstDoc = rDstNd.GetDoc();
+ SwDoc& rDstDoc = rDstNd.GetDoc();
int nLcsLen = 0;
@@ -1376,14 +1376,14 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine,
if ( nSrcFrom < nSrcTo )
{
- bool bUndo = pDstDoc->GetIDocumentUndoRedo().DoesUndo();
- pDstDoc->GetIDocumentUndoRedo().DoUndo( false );
+ bool bUndo = rDstDoc.GetIDocumentUndoRedo().DoesUndo();
+ rDstDoc.GetIDocumentUndoRedo().DoUndo( false );
SwPaM aCpyPam( rSrcNd, nSrcFrom );
aCpyPam.SetMark();
aCpyPam.GetPoint()->nContent = nSrcTo;
aCpyPam.GetDoc()->getIDocumentContentOperations().CopyRange( aCpyPam, *aPam.GetPoint(),
SwCopyFlags::CheckPosInFly);
- pDstDoc->GetIDocumentUndoRedo().DoUndo( bUndo );
+ rDstDoc.GetIDocumentUndoRedo().DoUndo( bUndo );
SwPaM* pTmp = new SwPaM( *aPam.GetPoint(), rpDelRing.get() );
if( !rpDelRing )
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index 41f7b673d2fc..cdc0b5fe4145 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -88,8 +88,8 @@ void PaMCorrAbs( const SwPaM& rRange,
SwPosition const aStart( *rRange.Start() );
SwPosition const aEnd( *rRange.End() );
SwPosition const aNewPos( rNewPos );
- SwDoc *const pDoc = aStart.nNode.GetNode().GetDoc();
- SwCursorShell *const pShell = pDoc->GetEditShell();
+ SwDoc& rDoc = aStart.nNode.GetNode().GetDoc();
+ SwCursorShell *const pShell = rDoc.GetEditShell();
if( pShell )
{
@@ -120,8 +120,8 @@ void PaMCorrAbs( const SwPaM& rRange,
}
}
- pDoc->cleanupUnoCursorTable();
- for(const auto& pWeakUnoCursor : pDoc->mvUnoCursorTable)
+ rDoc.cleanupUnoCursorTable();
+ for(const auto& pWeakUnoCursor : rDoc.mvUnoCursorTable)
{
auto pUnoCursor(pWeakUnoCursor.lock());
if(!pUnoCursor)
@@ -243,11 +243,11 @@ void PaMCorrRel( const SwNodeIndex &rOldNode,
{
const SwNode* pOldNode = &rOldNode.GetNode();
SwPosition aNewPos( rNewPos );
- const SwDoc* pDoc = pOldNode->GetDoc();
+ const SwDoc& rDoc = pOldNode->GetDoc();
const sal_Int32 nCntIdx = rNewPos.nContent.GetIndex() + nOffset;
- SwCursorShell const* pShell = pDoc->GetEditShell();
+ SwCursorShell const* pShell = rDoc.GetEditShell();
if( pShell )
{
for(const SwViewShell& rShell : pShell->GetRingContainer())
@@ -278,8 +278,8 @@ void PaMCorrRel( const SwNodeIndex &rOldNode,
}
}
- pDoc->cleanupUnoCursorTable();
- for(const auto& pWeakUnoCursor : pDoc->mvUnoCursorTable)
+ rDoc.cleanupUnoCursorTable();
+ for(const auto& pWeakUnoCursor : rDoc.mvUnoCursorTable)
{
auto pUnoCursor(pWeakUnoCursor.lock());
if(!pUnoCursor)
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 56b4d04718a9..70b09b5be20d 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -98,12 +98,12 @@ void RestFlyInRange( SaveFlyArr & rArr, const SwPosition& rStartPos,
if (pCNd && pCNd->getLayoutFrame(pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr))
pFormat->MakeFrames();
}
- sw::CheckAnchoredFlyConsistency(*rStartPos.nNode.GetNode().GetDoc());
+ sw::CheckAnchoredFlyConsistency(rStartPos.nNode.GetNode().GetDoc());
}
void SaveFlyInRange( const SwNodeRange& rRg, SaveFlyArr& rArr )
{
- SwFrameFormats& rFormats = *rRg.aStart.GetNode().GetDoc()->GetSpzFrameFormats();
+ SwFrameFormats& rFormats = *rRg.aStart.GetNode().GetDoc().GetSpzFrameFormats();
for( SwFrameFormats::size_type n = 0; n < rFormats.size(); ++n )
{
SwFrameFormat *const pFormat = rFormats[n];
@@ -128,13 +128,13 @@ void SaveFlyInRange( const SwNodeRange& rRg, SaveFlyArr& rArr )
rFormats.erase( rFormats.begin() + n-- );
}
}
- sw::CheckAnchoredFlyConsistency(*rRg.aStart.GetNode().GetDoc());
+ sw::CheckAnchoredFlyConsistency(rRg.aStart.GetNode().GetDoc());
}
void SaveFlyInRange( const SwPaM& rPam, const SwPosition& rInsPos,
SaveFlyArr& rArr, bool bMoveAllFlys )
{
- SwFrameFormats& rFormats = *rPam.GetPoint()->nNode.GetNode().GetDoc()->GetSpzFrameFormats();
+ SwFrameFormats& rFormats = *rPam.GetPoint()->nNode.GetNode().GetDoc().GetSpzFrameFormats();
SwFrameFormat* pFormat;
const SwFormatAnchor* pAnchor;
@@ -195,7 +195,7 @@ void SaveFlyInRange( const SwPaM& rPam, const SwPosition& rInsPos,
}
}
}
- sw::CheckAnchoredFlyConsistency(*rPam.GetPoint()->nNode.GetNode().GetDoc());
+ sw::CheckAnchoredFlyConsistency(rPam.GetPoint()->nNode.GetNode().GetDoc());
}
/// Delete and move all Flys at the paragraph, that are within the selection.
@@ -214,8 +214,8 @@ void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
SwPosition const& rStart = mark <= point ? mark : point;
SwPosition const& rEnd = mark <= point ? point : mark;
- SwDoc* pDoc = rMkNdIdx.GetNode().GetDoc();
- SwFrameFormats& rTable = *pDoc->GetSpzFrameFormats();
+ SwDoc& rDoc = rMkNdIdx.GetNode().GetDoc();
+ SwFrameFormats& rTable = *rDoc.GetSpzFrameFormats();
for ( auto i = rTable.size(); i; )
{
SwFrameFormat *pFormat = rTable[--i];
@@ -246,7 +246,7 @@ void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
i = std::distance(rTable.begin(), rTable.find( pFormat ));
}
- pDoc->getIDocumentLayoutAccess().DelLayoutFormat( pFormat );
+ rDoc.getIDocumentLayoutAccess().DelLayoutFormat( pFormat );
// DelLayoutFormat can also trigger the deletion of objects.
if (i > rTable.size())
@@ -263,17 +263,17 @@ SaveRedlEndPosForRestore::SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx,
: mnSaveContent( nCnt )
{
SwNode& rNd = rInsIdx.GetNode();
- SwDoc* pDest = rNd.GetDoc();
- if( pDest->getIDocumentRedlineAccess().GetRedlineTable().empty() )
+ SwDoc& rDest = rNd.GetDoc();
+ if( rDest.getIDocumentRedlineAccess().GetRedlineTable().empty() )
return;
SwRedlineTable::size_type nFndPos;
const SwPosition* pEnd;
SwPosition aSrcPos( rInsIdx, SwIndex( rNd.GetContentNode(), nCnt ));
- pDest->getIDocumentRedlineAccess().GetRedline( aSrcPos, &nFndPos );
+ rDest.getIDocumentRedlineAccess().GetRedline( aSrcPos, &nFndPos );
const SwRangeRedline* pRedl;
while( nFndPos--
- && *( pEnd = ( pRedl = pDest->getIDocumentRedlineAccess().GetRedlineTable()[ nFndPos ] )->End() ) == aSrcPos
+ && *( pEnd = ( pRedl = rDest.getIDocumentRedlineAccess().GetRedlineTable()[ nFndPos ] )->End() ) == aSrcPos
&& *pRedl->Start() < aSrcPos )
{
if( !mpSaveIndex )
@@ -783,7 +783,7 @@ static bool lcl_HyphenateNode( const SwNodePtr& rpNd, void* pArgs )
{
// sw_redlinehide: this will be called once per node for merged nodes;
// the fully deleted ones won't have frames so are skipped.
- SwContentFrame* pContentFrame = pNode->getLayoutFrame( pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() );
+ SwContentFrame* pContentFrame = pNode->getLayoutFrame( pNode->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() );
if( pContentFrame && !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
{
sal_uInt16 *pPageSt = pHyphArgs->GetPageSt();
@@ -799,7 +799,7 @@ static bool lcl_HyphenateNode( const SwNodePtr& rpNd, void* pArgs )
}
long nStat = nPageNr >= *pPageSt ? nPageNr - *pPageSt + 1
: nPageNr + *pPageCnt - *pPageSt + 1;
- ::SetProgressState( nStat, pNode->GetDoc()->GetDocShell() );
+ ::SetProgressState( nStat, pNode->GetDoc().GetDocShell() );
}
pHyphArgs->SetRange( rpNd );
if( pNode->Hyphenate( *pHyphArgs ) )
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index 1340aa1444b8..7b9e4847da5f 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -990,7 +990,7 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode )
void SwDocUpdateField::GetBodyNode( const SwTextField& rTField, SwFieldIds nFieldWhich )
{
const SwTextNode& rTextNd = rTField.GetTextNode();
- const SwDoc& rDoc = *rTextNd.GetDoc();
+ const SwDoc& rDoc = rTextNd.GetDoc();
// always the first! (in tab headline, header-/footer)
Point aPt;
@@ -1042,7 +1042,7 @@ void SwDocUpdateField::GetBodyNode( const SwTextField& rTField, SwFieldIds nFiel
void SwDocUpdateField::GetBodyNode( const SwSectionNode& rSectNd )
{
- const SwDoc& rDoc = *rSectNd.GetDoc();
+ const SwDoc& rDoc = rSectNd.GetDoc();
std::unique_ptr<SetGetExpField> pNew;
if( rSectNd.GetIndex() < rDoc.GetNodes().GetEndOfExtras().GetIndex() )
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 90fa2ed9e289..dbafd42f1856 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -105,12 +105,12 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
const bool bLocked = pNode->IsModifyLocked();
pNode->LockModify();
- SwDoc* pDoc = pNode->GetDoc();
+ SwDoc& rDoc = pNode->GetDoc();
// remove unused attribute RES_LR_SPACE
// add list attributes
SfxItemSet aSavedAttrsSet(
- pDoc->GetAttrPool(),
+ rDoc.GetAttrPool(),
svl::Items<
RES_PARATR_NUMRULE, RES_PARATR_NUMRULE,
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
@@ -120,7 +120,7 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
std::vector<sal_uInt16> aClearWhichIds;
// restoring all paragraph list attributes
{
- SfxItemSet aListAttrSet( pDoc->GetAttrPool(), svl::Items<RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1>{} );
+ SfxItemSet aListAttrSet( rDoc.GetAttrPool(), svl::Items<RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1>{} );
aListAttrSet.Set(*pAttrSetOfNode);
if ( aListAttrSet.Count() )
{
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 45e432af4e84..38b997d6c9ca 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -799,10 +799,10 @@ void SwDoc::WriteLayoutCache( SvStream& rStream )
IGrammarContact* getGrammarContact( const SwTextNode& rTextNode )
{
- const SwDoc* pDoc = rTextNode.GetDoc();
- if( !pDoc || pDoc->IsInDtor() )
+ const SwDoc& rDoc = rTextNode.GetDoc();
+ if (rDoc.IsInDtor())
return nullptr;
- return pDoc->getGrammarContact();
+ return rDoc.getGrammarContact();
}
::sfx2::IXmlIdRegistry&
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 2b1e63c995b3..8735715e6014 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -732,7 +732,7 @@ static const SwTextNode* lcl_FindChapterNode( const SwNode& rNd,
if( pFrame )
{
SwPosition aPos( *pNd );
- pNd = GetBodyTextNode( *pNd->GetDoc(), aPos, *pFrame );
+ pNd = GetBodyTextNode( pNd->GetDoc(), aPos, *pFrame );
OSL_ENSURE( pNd, "Where's the paragraph?" );
}
}
@@ -759,7 +759,7 @@ bool SwTOXBaseSection::SetPosAtStartEnd( SwPosition& rPos ) const
if( pSectNd )
{
rPos.nNode = *pSectNd;
- SwContentNode* pCNd = pSectNd->GetDoc()->GetNodes().GoNext( &rPos.nNode );
+ SwContentNode* pCNd = pSectNd->GetDoc().GetNodes().GoNext( &rPos.nNode );
rPos.nContent.Assign( pCNd, 0 );
bRet = true;
}
@@ -787,12 +787,10 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
maMSTOCExpression.clear();
}
- SwDoc* pDoc = const_cast<SwDoc*>(pSectNd->GetDoc());
-
- assert(pDoc); //Where is the document?
+ SwDoc& rDoc = const_cast<SwDoc&>(pSectNd->GetDoc());
if (pAttr && GetFormat())
- pDoc->ChgFormat(*GetFormat(), *pAttr);
+ rDoc.ChgFormat(*GetFormat(), *pAttr);
// determine default page description, which will be used by the content nodes,
// if no appropriate one is found.
@@ -842,11 +840,11 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
if ( !pDefaultPageDesc )
{
// determine default page description
- pDefaultPageDesc = &pDoc->GetPageDesc( 0 );
+ pDefaultPageDesc = &rDoc.GetPageDesc( 0 );
}
}
- pDoc->getIDocumentState().SetModified();
+ rDoc.getIDocumentState().SetModified();
// get current Language
SwTOXInternational aIntl( GetLanguage(),
@@ -866,7 +864,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
const_cast<SwSectionNode*>(pSectNd)->DelFrames();
// This would be a good time to update the Numbering
- pDoc->UpdateNumRule();
+ rDoc.UpdateNumRule();
if( GetCreateType() & SwTOXElement::Mark )
UpdateMarks( aIntl, pOwnChapterNode, pLayout );
@@ -910,37 +908,37 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
SwUndoUpdateIndex * pUndo(nullptr);
{
- pDoc->getIDocumentRedlineAccess().DeleteRedline( *pSectNd, true, RedlineType::Any );
+ rDoc.getIDocumentRedlineAccess().DeleteRedline( *pSectNd, true, RedlineType::Any );
SwNodeIndex aSttIdx( *pSectNd, +1 );
SwNodeIndex aEndIdx( *pSectNd->EndOfSectionNode() );
- pFirstEmptyNd = pDoc->GetNodes().MakeTextNode( aEndIdx,
- pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TEXT ) );
+ pFirstEmptyNd = rDoc.GetNodes().MakeTextNode( aEndIdx,
+ rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TEXT ) );
{
// Task 70995 - save and restore PageDesc and Break Attributes
SwNodeIndex aNxtIdx( aSttIdx );
const SwContentNode* pCNd = aNxtIdx.GetNode().GetContentNode();
if( !pCNd )
- pCNd = pDoc->GetNodes().GoNext( &aNxtIdx );
+ pCNd = rDoc.GetNodes().GoNext( &aNxtIdx );
assert(pCNd != pFirstEmptyNd);
assert(pCNd->GetIndex() < pFirstEmptyNd->GetIndex());
if( pCNd->HasSwAttrSet() )
{
- SfxItemSet aBrkSet( pDoc->GetAttrPool(), aBreakSetRange );
+ SfxItemSet aBrkSet( rDoc.GetAttrPool(), aBreakSetRange );
aBrkSet.Put( *pCNd->GetpSwAttrSet() );
if( aBrkSet.Count() )
pFirstEmptyNd->SetAttr( aBrkSet );
}
}
- if (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ if (rDoc.GetIDocumentUndoRedo().DoesUndo())
{
// note: this will first append a SwUndoDelSection from the ctor...
pUndo = new SwUndoUpdateIndex(*this);
// tdf#123313 insert Undo *after* all CrossRefBookmark Undos have
// been inserted by the Update*() functions
- pDoc->GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndoUpdateIndex>(pUndo));
+ rDoc.GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndoUpdateIndex>(pUndo));
}
else
{
@@ -953,7 +951,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
// (flys must be deleted because the anchor nodes are removed)
DelFlyInRange( SwNodeIndex(aSttIdx, -1), aEndIdx );
- pDoc->GetNodes().Delete( aSttIdx, aEndIdx.GetIndex() - aSttIdx.GetIndex() );
+ rDoc.GetNodes().Delete( aSttIdx, aEndIdx.GetIndex() - aSttIdx.GetIndex() );
}
}
@@ -963,15 +961,15 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
// then insert the headline section
SwNodeIndex aIdx( *pSectNd, +1 );
- SwTextNode* pHeadNd = pDoc->GetNodes().MakeTextNode( aIdx,
+ SwTextNode* pHeadNd = rDoc.GetNodes().MakeTextNode( aIdx,
GetTextFormatColl( FORM_TITLE ) );
pHeadNd->InsertText( GetTitle(), SwIndex( pHeadNd ) );
SwSectionData headerData( SectionType::ToxHeader, GetTOXName()+"_Head" );
SwNodeIndex aStt( *pHeadNd ); --aIdx;
- SwSectionFormat* pSectFormat = pDoc->MakeSectionFormat();
- pDoc->GetNodes().InsertTextSection(
+ SwSectionFormat* pSectFormat = rDoc.MakeSectionFormat();
+ rDoc.GetNodes().InsertTextSection(
aStt, *pSectFormat, headerData, nullptr, &aIdx, true, false);
if (pUndo)
@@ -985,7 +983,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
SwNodeIndex aInsPos( *pFirstEmptyNd, 1 );
for( size_t nCnt = 0; nCnt < m_aSortArr.size(); ++nCnt )
{
- ::SetProgressState( 0, pDoc->GetDocShell() );
+ ::SetProgressState( 0, rDoc.GetDocShell() );
// Put the Text into the TOC
sal_uInt16 nLvl = m_aSortArr[ nCnt ]->GetLevel();
@@ -997,7 +995,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
}
// Generate: Set dynamic TabStops
- SwTextNode* pTOXNd = pDoc->GetNodes().MakeTextNode( aInsPos , pColl );
+ SwTextNode* pTOXNd = rDoc.GetNodes().MakeTextNode( aInsPos , pColl );
m_aSortArr[ nCnt ]->pTOXNd = pTOXNd;
// Generate: Evaluate Form and insert the place holder for the
@@ -1025,12 +1023,12 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
}
// pass node index of table-of-content section and default page description
// to method <GenerateText(..)>.
- ::SetProgressState( 0, pDoc->GetDocShell() );
+ ::SetProgressState( 0, rDoc.GetDocShell() );
std::shared_ptr<sw::ToxTabStopTokenHandler> tabStopTokenHandler =
std::make_shared<sw::DefaultToxTabStopTokenHandler>(
pSectNd->GetIndex(), *pDefaultPageDesc, GetTOXForm().IsRelTabPos(),
- pDoc->GetDocumentSettingManager().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT) ?
+ rDoc.GetDocumentSettingManager().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT) ?
sw::DefaultToxTabStopTokenHandler::TABSTOPS_RELATIVE_TO_INDENT :
sw::DefaultToxTabStopTokenHandler::TABSTOPS_RELATIVE_TO_PAGE);
sw::ToxTextGenerator ttgn(GetTOXForm(), tabStopTokenHandler);
@@ -1055,7 +1053,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
aEndIdx = *pSectNd;
else
aEndIdx = *pFirstEmptyNd;
- SwContentNode* pCNd = pDoc->GetNodes().GoNext( &aEndIdx );
+ SwContentNode* pCNd = rDoc.GetNodes().GoNext( &aEndIdx );
if( pCNd ) // Robust against defect documents, e.g. i60336
pCNd->SetAttr( *pFirstEmptyNd->GetpSwAttrSet() );
}
@@ -1065,10 +1063,10 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
sal_uLong nIdx = pSectNd->GetIndex();
// don't delete if index is empty
if(nIdx + 2 < pSectNd->EndOfSectionIndex())
- pDoc->GetNodes().Delete( aInsPos );
+ rDoc.GetNodes().Delete( aInsPos );
- aN2L.RestoreUpperFrames( pDoc->GetNodes(), nIdx, nIdx + 1 );
- o3tl::sorted_vector<SwRootFrame*> aAllLayouts = pDoc->GetAllLayouts();
+ aN2L.RestoreUpperFrames( rDoc.GetNodes(), nIdx, nIdx + 1 );
+ o3tl::sorted_vector<SwRootFrame*> aAllLayouts = rDoc.GetAllLayouts();
for ( const auto& rpLayout : aAllLayouts )
{
SwFrame::CheckPageDescs( static_cast<SwPageFrame*>(rpLayout->Lower()) );
@@ -1849,15 +1847,15 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd,
xCharStyleIdx->push_back(aNumStr.getLength());
// search by name
- SwDoc* pDoc = pNd->GetDoc();
+ SwDoc& rDoc = pNd->GetDoc();
sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( GetMainEntryCharStyle(), SwGetPoolIdFromName::ChrFmt );
SwCharFormat* pCharFormat = nullptr;
if(USHRT_MAX != nPoolId)
- pCharFormat = pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool(nPoolId);
+ pCharFormat = rDoc.getIDocumentStylePoolAccess().GetCharFormatFromPool(nPoolId);
else
- pCharFormat = pDoc->FindCharFormatByName( GetMainEntryCharStyle() );
+ pCharFormat = rDoc.FindCharFormatByName( GetMainEntryCharStyle() );
if(!pCharFormat)
- pCharFormat = pDoc->MakeCharFormat(GetMainEntryCharStyle(), nullptr);
+ pCharFormat = rDoc.MakeCharFormat(GetMainEntryCharStyle(), nullptr);
// find the page numbers in aNumStr and set the character style
sal_Int32 nOffset = pNd->GetText().getLength() - aNumStr.getLength();
@@ -2021,7 +2019,7 @@ bool SwTOXBase::IsTOXBaseInReadonly() const
if (!pSectNode)
return false;
- const SwDocShell* pDocSh = pSectNode->GetDoc()->GetDocShell();
+ const SwDocShell* pDocSh = pSectNode->GetDoc().GetDocShell();
if (!pDocSh)
return false;
diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx
index 07250b97efe2..ce09a4cba229 100644
--- a/sw/source/core/doc/ftnidx.cxx
+++ b/sw/source/core/doc/ftnidx.cxx
@@ -63,21 +63,21 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
return;
// Get the NodesArray using the first foot note's StartIndex
- SwDoc* pDoc = rStt.GetNode().GetDoc();
- if( pDoc->IsInReading() )
+ SwDoc& rDoc = rStt.GetNode().GetDoc();
+ if( rDoc.IsInReading() )
return ;
SwTextFootnote* pTextFootnote;
- const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
- const SwFootnoteInfo& rFootnoteInfo = pDoc->GetFootnoteInfo();
- IDocumentRedlineAccess const& rIDRA(pDoc->getIDocumentRedlineAccess());
+ const SwEndNoteInfo& rEndInfo = rDoc.GetEndNoteInfo();
+ const SwFootnoteInfo& rFootnoteInfo = rDoc.GetFootnoteInfo();
+ IDocumentRedlineAccess const& rIDRA(rDoc.getIDocumentRedlineAccess());
// For normal foot notes we treat per-chapter and per-document numbering
// separately. For Endnotes we only have per-document numbering.
if( FTNNUM_CHAPTER == rFootnoteInfo.m_eNum )
{
SwRootFrame const* pLayout(nullptr);
- o3tl::sorted_vector<SwRootFrame*> layouts = pDoc->GetAllLayouts();
+ o3tl::sorted_vector<SwRootFrame*> layouts = rDoc.GetAllLayouts();
// sw_redlinehide: here we need to know if there's *any* layout with
// IsHideRedlines(), because then the hidden-numbers have to be updated
for (SwRootFrame const* pTmp : layouts)
@@ -88,10 +88,10 @@ void SwFootnoteIdxs::UpdateFootnote( const SwNodeIndex& rStt )
}
}
- const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
- const SwNode *pChapterStartHidden(&pDoc->GetNodes().GetEndOfExtras());
+ const SwOutlineNodes& rOutlNds = rDoc.GetNodes().GetOutLineNds();
+ const SwNode *pChapterStartHidden(&rDoc.GetNodes().GetEndOfExtras());
sal_uLong nChapterStart(pChapterStartHidden->GetIndex());
- sal_uLong nChapterEnd(pDoc->GetNodes().GetEndOfContent().GetIndex());
+ sal_uLong nChapterEnd(rDoc.GetNodes().GetEndOfContent().GetIndex());
sal_uLong nChapterEndHidden(nChapterEnd);
if( !rOutlNds.empty() )
{
@@ -270,16 +270,16 @@ void SwFootnoteIdxs::UpdateAllFootnote()
return;
// Get the NodesArray via the StartIndex of the first Footnote
- SwDoc* pDoc = const_cast<SwDoc*>((*this)[ 0 ]->GetTextNode().GetDoc());
+ SwDoc& rDoc = const_cast<SwDoc&>((*this)[ 0 ]->GetTextNode().GetDoc());
SwTextFootnote* pTextFootnote;
- const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
- const SwFootnoteInfo& rFootnoteInfo = pDoc->GetFootnoteInfo();
- IDocumentRedlineAccess const& rIDRA(pDoc->getIDocumentRedlineAccess());
+ const SwEndNoteInfo& rEndInfo = rDoc.GetEndNoteInfo();
+ const SwFootnoteInfo& rFootnoteInfo = rDoc.GetFootnoteInfo();
+ IDocumentRedlineAccess const& rIDRA(rDoc.getIDocumentRedlineAccess());
SwUpdFootnoteEndNtAtEnd aNumArr;
- SwRootFrame const* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
- o3tl::sorted_vector<SwRootFrame*> aAllLayouts = pDoc->GetAllLayouts();
+ SwRootFrame const* pLayout = rDoc.getIDocumentLayoutAccess().GetCurrentLayout();
+ o3tl::sorted_vector<SwRootFrame*> aAllLayouts = rDoc.GetAllLayouts();
// For normal Footnotes per-chapter and per-document numbering are treated separately.
// For Endnotes we only have document-wise numbering.
if( FTNNUM_CHAPTER == rFootnoteInfo.m_eNum )
@@ -294,7 +294,7 @@ void SwFootnoteIdxs::UpdateAllFootnote()
}
}
- const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
+ const SwOutlineNodes& rOutlNds = rDoc.GetNodes().GetOutLineNds();
sal_uInt16 nNo = 1; // Number for the Footnotes
sal_uInt16 nNoNo = 1;
size_t nFootnoteIdx = 0; // Index into theFootnoteIdx array
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index 8022218db3db..3851e061a2c7 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -483,11 +483,11 @@ void SwHTMLTableLayout::AutoLayoutPass1()
const SwStartNode *pSttNd = pCnts->GetStartNode();
if( pSttNd )
{
- const SwDoc *pDoc = pSttNd->GetDoc();
+ const SwDoc& rDoc = pSttNd->GetDoc();
sal_uLong nIdx = pSttNd->GetIndex();
- while( !(pDoc->GetNodes()[nIdx])->IsEndNode() )
+ while (!rDoc.GetNodes()[nIdx]->IsEndNode())
{
- SwTextNode *pTextNd = (pDoc->GetNodes()[nIdx])->GetTextNode();
+ SwTextNode *pTextNd = (rDoc.GetNodes()[nIdx])->GetTextNode();
if( pTextNd )
{
sal_uLong nMinNoAlignCnts = 0;
@@ -509,7 +509,7 @@ void SwHTMLTableLayout::AutoLayoutPass1()
}
else
{
- SwTableNode *pTabNd = (pDoc->GetNodes()[nIdx])->GetTableNode();
+ SwTableNode *pTabNd = (rDoc.GetNodes()[nIdx])->GetTableNode();
if( pTabNd )
{
SwHTMLTableLayout *pChild = pTabNd->GetTable().GetHTMLTableLayout();
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index cebb9b25d6e2..dd6058d6622c 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -774,7 +774,7 @@ void SwNoTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
if ( GetNode()->GetNodeType() == SwNodeType::Grf )
{
SwGrfNode* pNd = static_cast<SwGrfNode*>( GetNode());
- SwViewShell *pVSh = pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+ SwViewShell *pVSh = pNd->GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell();
if(pVSh)
{
@@ -818,7 +818,7 @@ void SwNoTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
SwRect aRect( getFrameArea() );
- SwViewShell *pVSh = pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+ SwViewShell *pVSh = pNd->GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell();
if( !pVSh )
break;
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 32afd8828b7a..a565e22ce1fd 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -913,7 +913,7 @@ void SwNumRule::SetInvalidRule(bool bFlag)
for ( const SwTextNode* pTextNode : maTextNodeList )
{
// #i111681# - applying patch from cmc
- SwList* pList = pTextNode->GetDoc()->getIDocumentListsAccess().getListByName( pTextNode->GetListId() );
+ SwList* pList = pTextNode->GetDoc().getIDocumentListsAccess().getListByName( pTextNode->GetListId() );
OSL_ENSURE( pList, "<SwNumRule::SetInvalidRule(..)> - list at which the text node is registered at does not exist. This is a serious issue.");
if ( pList )
{
@@ -1024,7 +1024,7 @@ void SwNumRule::Validate()
o3tl::sorted_vector< SwList* > aLists;
for ( const SwTextNode* pTextNode : maTextNodeList )
{
- aLists.insert( pTextNode->GetDoc()->getIDocumentListsAccess().getListByName( pTextNode->GetListId() ) );
+ aLists.insert( pTextNode->GetDoc().getIDocumentListsAccess().getListByName( pTextNode->GetListId() ) );
}
for ( auto aList : aLists )
aList->ValidateListTree();
diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx
index d404b477e8af..651a899ff157 100644
--- a/sw/source/core/doc/rdfhelper.cxx
+++ b/sw/source/core/doc/rdfhelper.cxx
@@ -201,28 +201,28 @@ void SwRDFHelper::cloneStatements(const css::uno::Reference<css::frame::XModel>&
std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString& rType, SwTextNode& rTextNode)
{
- uno::Reference<rdf::XResource> xTextNode(SwXParagraph::CreateXParagraph(*rTextNode.GetDoc(), &rTextNode), uno::UNO_QUERY);
- return getStatements(rTextNode.GetDoc()->GetDocShell()->GetBaseModel(), rType, xTextNode);
+ uno::Reference<rdf::XResource> xTextNode(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode), uno::UNO_QUERY);
+ return getStatements(rTextNode.GetDoc().GetDocShell()->GetBaseModel(), rType, xTextNode);
}
void SwRDFHelper::addTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue)
{
- uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(*rTextNode.GetDoc(), &rTextNode), uno::UNO_QUERY);
- addStatement(rTextNode.GetDoc()->GetDocShell()->GetBaseModel(), rType, rPath, xSubject, rKey, rValue);
+ uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode), uno::UNO_QUERY);
+ addStatement(rTextNode.GetDoc().GetDocShell()->GetBaseModel(), rType, rPath, xSubject, rKey, rValue);
}
void SwRDFHelper::removeTextNodeStatement(const OUString& rType, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue)
{
uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType);
- uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(rTextNode.GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
+ uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(rTextNode.GetDoc().GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
const uno::Sequence< uno::Reference<rdf::XURI> > aGraphNames = getGraphNames(xDocumentMetadataAccess, xType);
if (!aGraphNames.hasElements())
return;
uno::Reference<rdf::XURI> xGraphName = aGraphNames[0];
uno::Reference<rdf::XNamedGraph> xGraph = xDocumentMetadataAccess->getRDFRepository()->getGraph(xGraphName);
- uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(*rTextNode.GetDoc(), &rTextNode), uno::UNO_QUERY);
+ uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode), uno::UNO_QUERY);
uno::Reference<rdf::XURI> xKey = rdf::URI::create(xComponentContext, rKey);
uno::Reference<rdf::XLiteral> xValue = rdf::Literal::create(xComponentContext, rValue);
xGraph->removeStatements(xSubject, xKey, xValue);
@@ -232,7 +232,7 @@ void SwRDFHelper::updateTextNodeStatement(const OUString& rType, const OUString&
{
uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, rType);
- uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(rTextNode.GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
+ uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(rTextNode.GetDoc().GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
const uno::Sequence< uno::Reference<rdf::XURI> > aGraphNames = getGraphNames(xDocumentMetadataAccess, xType);
uno::Reference<rdf::XURI> xGraphName;
if (aGraphNames.hasElements())
@@ -246,7 +246,7 @@ void SwRDFHelper::updateTextNodeStatement(const OUString& rType, const OUString&
}
uno::Reference<rdf::XNamedGraph> xGraph = xDocumentMetadataAccess->getRDFRepository()->getGraph(xGraphName);
- uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(*rTextNode.GetDoc(), &rTextNode), uno::UNO_QUERY);
+ uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode), uno::UNO_QUERY);
uno::Reference<rdf::XURI> xKey = rdf::URI::create(xComponentContext, rKey);
if (aGraphNames.hasElements())
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 04142282bebb..c62bbf5b7a35 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -215,7 +215,7 @@ struct CpyPara
bool bCpyContent;
CpyPara( SwTableNode* pNd, sal_uInt16 nCopies, CpyTabFrames& rFrameArr )
- : pDoc( pNd->GetDoc() ), pTableNd( pNd ), rTabFrameArr(rFrameArr),
+ : pDoc( &pNd->GetDoc() ), pTableNd( pNd ), rTabFrameArr(rFrameArr),
pInsLine(nullptr), pInsBox(nullptr), nOldSize(0), nNewSize(0),
nMinLeft(ULONG_MAX), nMaxRight(0),
nCpyCnt(nCopies), nInsPos(0),
@@ -733,7 +733,7 @@ void DeleteBox_( SwTable& rTable, SwTableBox* pBox, SwUndo* pUndo,
if( pUndo && pUndo->IsDelBox() )
static_cast<SwUndoTableNdsChg*>(pUndo)->SaveSection( pSttNd );
else
- pSttNd->GetDoc()->getIDocumentContentOperations().DeleteSection( pSttNd );
+ pSttNd->GetDoc().getIDocumentContentOperations().DeleteSection( pSttNd );
}
// Also delete the Line?
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index a4a907b4fc9a..152c8e20deb0 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -335,8 +335,8 @@ void SwTextNode::CopyCollFormat( SwTextNode& rDestNd )
{
// Copy the formats into the other document:
// Special case for PageBreak/PageDesc/ColBrk
- SwDoc* pDestDoc = rDestNd.GetDoc();
- SwAttrSet aPgBrkSet( pDestDoc->GetAttrPool(), aBreakSetRange );
+ SwDoc& rDestDoc = rDestNd.GetDoc();
+ SwAttrSet aPgBrkSet( rDestDoc.GetAttrPool(), aBreakSetRange );
const SwAttrSet* pSet;
pSet = rDestNd.GetpSwAttrSet();
@@ -351,7 +351,7 @@ void SwTextNode::CopyCollFormat( SwTextNode& rDestNd )
aPgBrkSet.Put( *pAttr );
}
- rDestNd.ChgFormatColl( pDestDoc->CopyTextColl( *GetTextColl() ));
+ rDestNd.ChgFormatColl( rDestDoc.CopyTextColl( *GetTextColl() ));
pSet = GetpSwAttrSet();
if( nullptr != pSet )
pSet->CopyToModify( rDestNd );
diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx
index 9029f9348827..3da7273bfc7c 100644
--- a/sw/source/core/docnode/ndnotxt.cxx
+++ b/sw/source/core/docnode/ndnotxt.cxx
@@ -66,7 +66,7 @@ void SwNoTextNode::NewAttrSet( SwAttrPool& rPool )
aNewAttrSet.Put( aFormatColl );
aNewAttrSet.SetParent( &GetFormatColl()->GetAttrSet() );
- mpAttrSet = GetDoc()->GetIStyleAccess().getAutomaticStyle( aNewAttrSet, IStyleAccess::AUTO_STYLE_NOTXT );
+ mpAttrSet = GetDoc().GetIStyleAccess().getAutomaticStyle( aNewAttrSet, IStyleAccess::AUTO_STYLE_NOTXT );
}
/// Dummies for loading/saving of persistent data
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index a2fcd8b7eae1..54ec466d6165 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -750,7 +750,7 @@ void SwDoc::UpdateSection( size_t const nPos, SwSectionData & rNewData,
void sw_DeleteFootnote( SwSectionNode *pNd, sal_uLong nStt, sal_uLong nEnd )
{
- SwFootnoteIdxs& rFootnoteArr = pNd->GetDoc()->GetFootnoteIdxs();
+ SwFootnoteIdxs& rFootnoteArr = pNd->GetDoc().GetFootnoteIdxs();
if( rFootnoteArr.empty() )
return;
@@ -1338,7 +1338,7 @@ void SwSectionNode::NodesArrChgd()
// Moving Nodes to the UndoNodes array?
if( rNds.IsDocNodes() )
{
- OSL_ENSURE( pDoc == GetDoc(),
+ OSL_ENSURE( pDoc == &GetDoc(),
"Moving to different Documents?" );
if( m_pSection->IsLinkType() ) // Remove the Link
m_pSection->CreateLink( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ? LinkCreateType::Connect : LinkCreateType::NONE );
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index fb705fc72650..c9c3e4546b8d 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1030,7 +1030,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
cCh = 0x09;
// Get the separator's position from the first Node, in order for the Boxes to be set accordingly
- SwTextFrameInfo aFInfo( static_cast<SwTextFrame*>(pTextNd->getLayoutFrame( pTextNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() )) );
+ SwTextFrameInfo aFInfo( static_cast<SwTextFrame*>(pTextNd->getLayoutFrame( pTextNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() )) );
if( aFInfo.IsOneLine() ) // only makes sense in this case
{
OUString const& rText(pTextNd->GetText());
@@ -2488,13 +2488,10 @@ void SwTableNode::SetNewTable( std::unique_ptr<SwTable> pNewTable, bool bNewFram
void SwTableNode::RemoveRedlines()
{
- SwDoc* pDoc = GetDoc();
- if (pDoc)
- {
- SwTable& rTable = GetTable();
- if ( pDoc->getIDocumentRedlineAccess().HasExtraRedlineTable() )
- pDoc->getIDocumentRedlineAccess().GetExtraRedlineTable().DeleteAllTableRedlines(*pDoc, rTable, true, RedlineType::Any);
- }
+ SwDoc& rDoc = GetDoc();
+ SwTable& rTable = GetTable();
+ if (rDoc.getIDocumentRedlineAccess().HasExtraRedlineTable())
+ rDoc.getIDocumentRedlineAccess().GetExtraRedlineTable().DeleteAllTableRedlines(rDoc, rTable, true, RedlineType::Any);
}
void SwDoc::GetTabCols( SwTabCols &rFill, const SwCellFrame* pBoxFrame )
@@ -4215,7 +4212,7 @@ void SwDoc::ClearLineNumAttrs( SwPosition const & rPos )
return;
const SfxPoolItem* pFormatItem = nullptr;
- SfxItemSet rSet( pTextNode->GetDoc()->GetAttrPool(),
+ SfxItemSet rSet( pTextNode->GetDoc().GetAttrPool(),
svl::Items<RES_PARATR_BEGIN, RES_PARATR_END - 1>{});
pTextNode->SwContentNode::GetAttr( rSet );
if ( SfxItemState::SET != rSet.GetItemState( RES_PARATR_NUMRULE , false , &pFormatItem ) )
@@ -4336,7 +4333,7 @@ bool SwDoc::InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
GetIDocumentUndoRedo().DoUndo(false);
}
- rtl::Reference<SwDoc> xCpyDoc( const_cast<SwDoc*>(pSrcTableNd->GetDoc()) );
+ rtl::Reference<SwDoc> xCpyDoc(&const_cast<SwDoc&>(pSrcTableNd->GetDoc()));
bool bDelCpyDoc = xCpyDoc == this;
if( bDelCpyDoc )
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index faeaeafac5ba..486baf643c83 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -130,9 +130,9 @@ static void lcl_GetStartEndCell( const SwCursor& rCursor,
SwContentNode* pMarkNd = rCursor.GetContentNode(false);
std::pair<Point, bool> tmp(aPtPos, true);
- SwFrame *const pPointFrame = pPointNd ? pPointNd->getLayoutFrame(pPointNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr;
+ SwFrame *const pPointFrame = pPointNd ? pPointNd->getLayoutFrame(pPointNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr;
tmp.first = aMkPos;
- SwFrame *const pMarkFrame = pMarkNd ? pMarkNd->getLayoutFrame(pMarkNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr;
+ SwFrame *const pMarkFrame = pMarkNd ? pMarkNd->getLayoutFrame(pMarkNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr;
prStart = pPointFrame ? pPointFrame->GetUpper() : nullptr;
prEnd = pMarkFrame ? pMarkFrame->GetUpper() : nullptr;
@@ -820,7 +820,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout();
if( pTableLayout )
{
- SwContentFrame* pFrame = rCursor.GetContentNode()->getLayoutFrame( rCursor.GetContentNode()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() );
+ SwContentFrame* pFrame = rCursor.GetContentNode()->getLayoutFrame( rCursor.GetContentNode()->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() );
SwTabFrame* pTabFrame = pFrame->ImplFindTabFrame();
pTableLayout->BordersChanged(
@@ -916,7 +916,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout();
if( pTableLayout )
{
- SwContentFrame* pFrame = rCursor.GetContentNode()->getLayoutFrame( rCursor.GetContentNode()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() );
+ SwContentFrame* pFrame = rCursor.GetContentNode()->getLayoutFrame( rCursor.GetContentNode()->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() );
SwTabFrame* pTabFrame = pFrame->ImplFindTabFrame();
pTableLayout->BordersChanged(
@@ -1183,7 +1183,7 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout();
if( pTableLayout )
{
- SwContentFrame* pFrame = rCursor.GetContentNode()->getLayoutFrame( rCursor.GetContentNode()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() );
+ SwContentFrame* pFrame = rCursor.GetContentNode()->getLayoutFrame( rCursor.GetContentNode()->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() );
SwTabFrame* pTabFrame = pFrame->ImplFindTabFrame();
pTableLayout->Resize(
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 2051fe72f0f4..0f352dc28e69 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -344,7 +344,7 @@ SwNode::SwNode( SwNodes& rNodes, sal_uLong nPos, const SwNodeType nNdType )
SwNode::~SwNode()
{
- assert(!m_pAnchoredFlys || GetDoc()->IsInDtor()); // must all be deleted
+ assert(!m_pAnchoredFlys || GetDoc().IsInDtor()); // must all be deleted
}
/// Find the TableNode in which it is located.
@@ -380,7 +380,7 @@ bool SwNode::IsInVisibleArea( SwViewShell const * pSh ) const
if( !pSh )
// Get the Shell from the Doc
- pSh = GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+ pSh = GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell();
if( pSh )
{
@@ -429,7 +429,7 @@ bool SwNode::IsProtect() const
if( nullptr != pSttNd )
{
SwContentFrame* pCFrame;
- if( IsContentNode() && nullptr != (pCFrame = static_cast<const SwContentNode*>(this)->getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) ))
+ if( IsContentNode() && nullptr != (pCFrame = static_cast<const SwContentNode*>(this)->getLayoutFrame( GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() ) ))
return pCFrame->IsProtected();
const SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().
@@ -455,7 +455,7 @@ bool SwNode::IsProtect() const
pSttNd = FindFootnoteStartNode();
if( nullptr != pSttNd )
{
- const SwTextFootnote* pTFootnote = GetDoc()->GetFootnoteIdxs().SeekEntry(
+ const SwTextFootnote* pTFootnote = GetDoc().GetFootnoteIdxs().SeekEntry(
SwNodeIndex( *pSttNd ) );
if( pTFootnote )
return pTFootnote->GetTextNode().IsProtect();
@@ -498,7 +498,7 @@ const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const
{
const SwFrame* pFrame;
const SwPageFrame* pPage;
- if (pNode && nullptr != (pFrame = pNode->getLayoutFrame(pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)) &&
+ if (pNode && nullptr != (pFrame = pNode->getLayoutFrame(pNode->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)) &&
nullptr != ( pPage = pFrame->FindPageFrame() ) )
{
pPgDesc = pPage->GetPageDesc();
@@ -512,7 +512,7 @@ const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const
if( !pPgDesc )
{
// Thus via the nodes array
- const SwDoc* pDoc = GetDoc();
+ const SwDoc& rDoc = GetDoc();
const SwNode* pNd = this;
const SwStartNode* pSttNd;
if( pNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() &&
@@ -520,7 +520,7 @@ const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const
{
// Find the right Anchor first
const SwFrameFormat* pFormat = nullptr;
- const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats();
+ const SwFrameFormats& rFormats = *rDoc.GetSpzFrameFormats();
for( size_t n = 0; n < rFormats.size(); ++n )
{
@@ -587,7 +587,7 @@ const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const
{
if( pNd->GetIndex() > GetNodes().GetEndOfAutotext().GetIndex() )
{
- pPgDesc = &pDoc->GetPageDesc( 0 );
+ pPgDesc = &rDoc.GetPageDesc( 0 );
pNd = nullptr;
}
else
@@ -610,9 +610,9 @@ const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const
eAskUse = UseOnPage::FooterShare;
}
- for( size_t n = pDoc->GetPageDescCnt(); n && !pPgDesc; )
+ for( size_t n = rDoc.GetPageDescCnt(); n && !pPgDesc; )
{
- const SwPageDesc& rPgDsc = pDoc->GetPageDesc( --n );
+ const SwPageDesc& rPgDsc = rDoc.GetPageDesc( --n );
const SwFrameFormat* pFormat = &rPgDsc.GetMaster();
int nStt = 0, nLast = 1;
if( !( eAskUse & rPgDsc.ReadUseOn() )) ++nLast;
@@ -639,14 +639,14 @@ const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const
}
if( !pPgDesc )
- pPgDesc = &pDoc->GetPageDesc( 0 );
+ pPgDesc = &rDoc.GetPageDesc( 0 );
pNd = nullptr;
}
else if( nullptr != ( pSttNd = pNd->FindFootnoteStartNode() ))
{
// the Anchor can only be in the Body text
const SwTextFootnote* pTextFootnote;
- const SwFootnoteIdxs& rFootnoteArr = pDoc->GetFootnoteIdxs();
+ const SwFootnoteIdxs& rFootnoteArr = rDoc.GetFootnoteIdxs();
for( size_t n = 0; n < rFootnoteArr.size(); ++n )
if( nullptr != ( pTextFootnote = rFootnoteArr[ n ])->GetStartNode() &&
static_cast<SwNode const *>(pSttNd) ==
@@ -663,7 +663,7 @@ const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const
OSL_ENSURE( pNd->FindFlyStartNode(),
"Where is this Node?" );
- pPgDesc = &pDoc->GetPageDesc( 0 );
+ pPgDesc = &rDoc.GetPageDesc( 0 );
pNd = nullptr;
}
}
@@ -673,7 +673,7 @@ const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const
{
SwFindNearestNode aInfo( *pNd );
// Over all Nodes of all PageDescs
- for (const SfxPoolItem* pItem : pDoc->GetAttrPool().GetItemSurrogates(RES_PAGEDESC))
+ for (const SfxPoolItem* pItem : rDoc.GetAttrPool().GetItemSurrogates(RES_PAGEDESC))
{
auto pPageDescItem = dynamic_cast<const SwFormatPageDesc*>(pItem);
if( pPageDescItem && pPageDescItem->GetDefinedIn() )
@@ -704,7 +704,7 @@ const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const
}
}
if( !pPgDesc )
- pPgDesc = &pDoc->GetPageDesc( 0 );
+ pPgDesc = &rDoc.GetPageDesc( 0 );
}
}
return pPgDesc;
@@ -726,7 +726,7 @@ SwFrameFormat* SwNode::GetFlyFormat() const
if( !pRet )
{
// The hard way through the Doc is our last way out
- const SwFrameFormats& rFrameFormatTable = *GetDoc()->GetSpzFrameFormats();
+ const SwFrameFormats& rFrameFormatTable = *GetDoc().GetSpzFrameFormats();
for( size_t n = 0; n < rFrameFormatTable.size(); ++n )
{
SwFrameFormat* pFormat = rFrameFormatTable[n];
@@ -807,8 +807,8 @@ const SwTextNode* SwNode::FindOutlineNodeOfLevel(sal_uInt8 const nLvl,
Point aPt( 0, 0 );
std::pair<Point, bool> const tmp(aPt, false);
- const SwFrame* pFrame = pRet->getLayoutFrame(pRet->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp),
- * pMyFrame = pCNd ? pCNd->getLayoutFrame(pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr;
+ const SwFrame* pFrame = pRet->getLayoutFrame(pRet->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp),
+ * pMyFrame = pCNd ? pCNd->getLayoutFrame(pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp) : nullptr;
const SwPageFrame* pPgFrame = pFrame ? pFrame->FindPageFrame() : nullptr;
if( pPgFrame && pMyFrame &&
pPgFrame->getFrameArea().Top() > pMyFrame->getFrameArea().Top() )
@@ -1140,7 +1140,7 @@ void SwContentNode::SwClientNotify( const SwModify&, const SfxHint& rHint)
case RES_CONDCOLL_CONDCHG:
if(pLegacyHint->m_pNew
&& static_cast<const SwCondCollCondChg*>(pLegacyHint->m_pNew)->pChangedFormat == GetRegisteredIn()
- && &GetNodes() == &GetDoc()->GetNodes() )
+ && &GetNodes() == &GetDoc().GetNodes() )
ChkCondColl();
return; // Do not pass through to the base class/Frames
@@ -1179,7 +1179,7 @@ bool SwContentNode::InvalidateNumRule()
if( GetNodes().IsDocNodes() &&
nullptr != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, true )) &&
!static_cast<const SwNumRuleItem*>(pItem)->GetValue().isEmpty() &&
- nullptr != (pRule = GetDoc()->FindNumRulePtr(
+ nullptr != (pRule = GetDoc().FindNumRulePtr(
static_cast<const SwNumRuleItem*>(pItem)->GetValue() ) ) )
{
pRule->SetInvalidRule( true );
@@ -1540,7 +1540,7 @@ bool SwContentNode::GetInfo( SfxPoolItem& rInfo ) const
bool SwContentNode::SetAttr(const SfxPoolItem& rAttr )
{
if( !GetpSwAttrSet() ) // Have the Nodes created by the corresponding AttrSets
- NewAttrSet( GetDoc()->GetAttrPool() );
+ NewAttrSet( GetDoc().GetAttrPool() );
OSL_ENSURE( GetpSwAttrSet(), "Why did't we create an AttrSet?");
@@ -1621,7 +1621,7 @@ bool SwContentNode::SetAttr( const SfxItemSet& rSet )
}
if( !GetpSwAttrSet() ) // Have the AttrsSets created by the corresponding Nodes
- NewAttrSet( GetDoc()->GetAttrPool() );
+ NewAttrSet( GetDoc().GetAttrPool() );
bool bRet = false;
// If Modify is locked, do not send any Modifys
@@ -2054,7 +2054,7 @@ SvxFrameDirection SwContentNode::GetTextDirection( const SwPosition& rPos,
// #i72024# - No format of the frame, because this can cause recursive layout actions
std::pair<Point, bool> const tmp(aPt, false);
- SwFrame* pFrame = getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPos, &tmp);
+ SwFrame* pFrame = getLayoutFrame(GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), &rPos, &tmp);
if ( pFrame )
{
@@ -2105,32 +2105,28 @@ drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwContentNode::getSdrAllF
/*
* Document Interface Access
*/
-const IDocumentSettingAccess* SwNode::getIDocumentSettingAccess() const { return &GetDoc()->GetDocumentSettingManager(); }
-const IDocumentDeviceAccess& SwNode::getIDocumentDeviceAccess() const { return GetDoc()->getIDocumentDeviceAccess(); }
-const IDocumentRedlineAccess& SwNode::getIDocumentRedlineAccess() const { return GetDoc()->getIDocumentRedlineAccess(); }
-const IDocumentStylePoolAccess& SwNode::getIDocumentStylePoolAccess() const { return GetDoc()->getIDocumentStylePoolAccess(); }
-const IDocumentDrawModelAccess& SwNode::getIDocumentDrawModelAccess() const { return GetDoc()->getIDocumentDrawModelAccess(); }
-const IDocumentLayoutAccess& SwNode::getIDocumentLayoutAccess() const { return GetDoc()->getIDocumentLayoutAccess(); }
-IDocumentLayoutAccess& SwNode::getIDocumentLayoutAccess() { return GetDoc()->getIDocumentLayoutAccess(); }
-const IDocumentLinksAdministration& SwNode::getIDocumentLinksAdministration() const { return GetDoc()->getIDocumentLinksAdministration(); }
-IDocumentLinksAdministration& SwNode::getIDocumentLinksAdministration() { return GetDoc()->getIDocumentLinksAdministration(); }
-const IDocumentFieldsAccess& SwNode::getIDocumentFieldsAccess() const { return GetDoc()->getIDocumentFieldsAccess(); }
-IDocumentFieldsAccess& SwNode::getIDocumentFieldsAccess() { return GetDoc()->getIDocumentFieldsAccess(); }
-IDocumentContentOperations& SwNode::getIDocumentContentOperations() { return GetDoc()->getIDocumentContentOperations(); }
-IDocumentListItems& SwNode::getIDocumentListItems() { return GetDoc()->getIDocumentListItems(); } // #i83479#
-
-const IDocumentMarkAccess* SwNode::getIDocumentMarkAccess() const { return GetDoc()->getIDocumentMarkAccess(); }
-IStyleAccess& SwNode::getIDocumentStyleAccess() { return GetDoc()->GetIStyleAccess(); }
+const IDocumentSettingAccess* SwNode::getIDocumentSettingAccess() const { return &GetDoc().GetDocumentSettingManager(); }
+const IDocumentDeviceAccess& SwNode::getIDocumentDeviceAccess() const { return GetDoc().getIDocumentDeviceAccess(); }
+const IDocumentRedlineAccess& SwNode::getIDocumentRedlineAccess() const { return GetDoc().getIDocumentRedlineAccess(); }
+const IDocumentStylePoolAccess& SwNode::getIDocumentStylePoolAccess() const { return GetDoc().getIDocumentStylePoolAccess(); }
+const IDocumentDrawModelAccess& SwNode::getIDocumentDrawModelAccess() const { return GetDoc().getIDocumentDrawModelAccess(); }
+const IDocumentLayoutAccess& SwNode::getIDocumentLayoutAccess() const { return GetDoc().getIDocumentLayoutAccess(); }
+IDocumentLayoutAccess& SwNode::getIDocumentLayoutAccess() { return GetDoc().getIDocumentLayoutAccess(); }
+const IDocumentLinksAdministration& SwNode::getIDocumentLinksAdministration() const { return GetDoc().getIDocumentLinksAdministration(); }
+IDocumentLinksAdministration& SwNode::getIDocumentLinksAdministration() { return GetDoc().getIDocumentLinksAdministration(); }
+const IDocumentFieldsAccess& SwNode::getIDocumentFieldsAccess() const { return GetDoc().getIDocumentFieldsAccess(); }
+IDocumentFieldsAccess& SwNode::getIDocumentFieldsAccess() { return GetDoc().getIDocumentFieldsAccess(); }
+IDocumentContentOperations& SwNode::getIDocumentContentOperations() { return GetDoc().getIDocumentContentOperations(); }
+IDocumentListItems& SwNode::getIDocumentListItems() { return GetDoc().getIDocumentListItems(); } // #i83479#
+
+const IDocumentMarkAccess* SwNode::getIDocumentMarkAccess() const { return GetDoc().getIDocumentMarkAccess(); }
+IStyleAccess& SwNode::getIDocumentStyleAccess() { return GetDoc().GetIStyleAccess(); }
bool SwNode::IsInRedlines() const
{
- const SwDoc * pDoc = GetDoc();
- bool bResult = false;
+ const SwDoc& rDoc = GetDoc();
- if (pDoc != nullptr)
- bResult = pDoc->getIDocumentRedlineAccess().IsInRedlines(*this);
-
- return bResult;
+ return rDoc.getIDocumentRedlineAccess().IsInRedlines(*this);
}
void SwNode::AddAnchoredFly(SwFrameFormat *const pFlyFormat)
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index b373101d9e44..b0cb1a5586f4 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -53,7 +53,7 @@ static sal_uInt16 HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange );
*
* creates the base sections (PostIts, Inserts, AutoText, RedLines, Content)
*
- * @param pDocument TODO: provide documentation
+ * @param rDocument TODO: provide documentation
*/
SwNodes::SwNodes( SwDoc& rDocument )
: m_vIndices(nullptr), m_rMyDoc( rDocument )
@@ -1483,9 +1483,9 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
}
if( rNodes.IsDocNodes() )
{
- SwDoc* const pInsDoc = pDestNd->GetDoc();
- ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo());
- pInsDoc->getIDocumentContentOperations().SplitNode( rPos, false );
+ SwDoc& rInsDoc = pDestNd->GetDoc();
+ ::sw::UndoGuard const ug(rInsDoc.GetIDocumentUndoRedo());
+ rInsDoc.getIDocumentContentOperations().SplitNode( rPos, false );
}
else
{
@@ -1512,8 +1512,8 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
if( bCopyCollFormat )
{
- SwDoc* const pInsDoc = pDestNd->GetDoc();
- ::sw::UndoGuard const undoGuard(pInsDoc->GetIDocumentUndoRedo());
+ SwDoc& rInsDoc = pDestNd->GetDoc();
+ ::sw::UndoGuard const undoGuard(rInsDoc.GetIDocumentUndoRedo());
pSrcNd->CopyCollFormat( *pDestNd );
bCopyCollFormat = false;
}
@@ -1548,9 +1548,9 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
// if no text is attached to the TextNode, split it
if( rNodes.IsDocNodes() )
{
- SwDoc* const pInsDoc = pDestNd->GetDoc();
- ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo());
- pInsDoc->getIDocumentContentOperations().SplitNode( rPos, false );
+ SwDoc& rInsDoc = pDestNd->GetDoc();
+ ::sw::UndoGuard const ug(rInsDoc.GetIDocumentUndoRedo());
+ rInsDoc.getIDocumentContentOperations().SplitNode( rPos, false );
}
else
{
@@ -1598,8 +1598,8 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
if (pDestNd && bCopyCollFormat)
{
- SwDoc* const pInsDoc = pDestNd->GetDoc();
- ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo());
+ SwDoc& rInsDoc = pDestNd->GetDoc();
+ ::sw::UndoGuard const ug(rInsDoc.GetIDocumentUndoRedo());
pEndSrcNd->CopyCollFormat( *pDestNd );
}
}
@@ -1652,7 +1652,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
void SwNodes::CopyNodes( const SwNodeRange& rRange,
const SwNodeIndex& rIndex, bool bNewFrames, bool bTableInsDummyNode ) const
{
- SwDoc* pDoc = rIndex.GetNode().GetDoc();
+ SwDoc& rDoc = rIndex.GetNode().GetDoc();
SwNode * pCurrentNode;
if( rIndex == 0 ||
@@ -1717,8 +1717,8 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
{
case SwNodeType::Table:
// Does it copy a table in(to) a footnote?
- if( aInsPos < pDoc->GetNodes().GetEndOfInserts().GetIndex() &&
- pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex()
+ if( aInsPos < rDoc.GetNodes().GetEndOfInserts().GetIndex() &&
+ rDoc.GetNodes().GetEndOfInserts().StartOfSectionIndex()
< aInsPos.GetIndex() )
{
const long nDistance =
@@ -1761,7 +1761,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
{
SwNodeIndex nStt( aInsPos, -1 );
SwTableNode* pTableNd = static_cast<SwTableNode*>(pCurrentNode)->
- MakeCopy( pDoc, aInsPos );
+ MakeCopy( &rDoc, aInsPos );
const long nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
if (nDistance < nNodeCnt)
nNodeCnt -= nDistance;
@@ -1788,7 +1788,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
// copy of the whole section, so create a new SectionNode
SwNodeIndex nStt( aInsPos, -1 );
SwSectionNode* pSectNd = static_cast<SwSectionNode*>(pCurrentNode)->
- MakeCopy( pDoc, aInsPos );
+ MakeCopy( &rDoc, aInsPos );
const long nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
if (nDistance < nNodeCnt)
@@ -1826,7 +1826,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
{
// create a section at the original InsertPosition
SwNodeRange aTmpRg( aOrigInsPos, 1, aInsPos );
- pDoc->GetNodes().SectionDown( &aTmpRg,
+ rDoc.GetNodes().SectionDown( &aTmpRg,
pCurrentNode->m_pStartOfSection->GetStartNodeType() );
}
break;
@@ -1836,7 +1836,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
case SwNodeType::Ole:
{
static_cast<SwContentNode*>(pCurrentNode)->MakeCopy(
- pDoc, aInsPos, bNewFrames);
+ &rDoc, aInsPos, bNewFrames);
}
break;
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 3fe5129b4215..c845e31272a7 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -523,7 +523,7 @@ void SwSection::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
{
SwSectionNode* pSectNd = GetFormat()->GetSectionNode();
if( pSectNd )
- pSectNd->GetDoc()->GetFootnoteIdxs().UpdateFootnote(SwNodeIndex( *pSectNd ));
+ pSectNd->GetDoc().GetFootnoteIdxs().UpdateFootnote(SwNodeIndex( *pSectNd ));
}
}
@@ -593,7 +593,7 @@ void SwSection::SetLinkFileName(const OUString& rNew)
void SwSection::MakeChildLinksVisible( const SwSectionNode& rSectNd )
{
const SwNode* pNd;
- const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc()->getIDocumentLinksAdministration().GetLinkManager().GetLinks();
+ const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc().getIDocumentLinksAdministration().GetLinkManager().GetLinks();
for( auto n = rLnks.size(); n; )
{
sfx2::SvBaseLink& rBLnk = *rLnks[--n];
@@ -1089,19 +1089,13 @@ void SwSectionFormats::dumpAsXml(xmlTextWriterPtr pWriter) const
// Method to break section links inside a linked section
static void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd )
{
- if ( !rSectNd.GetDoc() )
- {
- OSL_FAIL( "method <lcl_RemoveSectionLinksInSect(..)> - no Doc at SectionNode" );
- return;
- }
-
if ( !rSectNd.GetSection().IsConnected() )
{
OSL_FAIL( "method <lcl_RemoveSectionLinksInSect(..)> - no Link at Section of SectionNode" );
return;
}
const ::sfx2::SvBaseLink* pOwnLink( &(rSectNd.GetSection().GetBaseLink() ) );
- const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc()->getIDocumentLinksAdministration().GetLinkManager().GetLinks();
+ const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc().getIDocumentLinksAdministration().GetLinkManager().GetLinks();
for ( auto n = rLnks.size(); n > 0; )
{
SwIntrnlSectRefLink* pSectLnk = dynamic_cast<SwIntrnlSectRefLink*>(&(*rLnks[ --n ]));
@@ -1125,8 +1119,8 @@ static void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd )
static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
{
- SwDoc* pDoc = rSectNd.GetDoc();
- SwDocShell* pDShell = pDoc->GetDocShell();
+ SwDoc& rDoc = rSectNd.GetDoc();
+ SwDocShell* pDShell = rDoc.GetDocShell();
if( !pDShell || !pDShell->GetMedium() )
return ;
@@ -1135,7 +1129,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
uno::Any aValue;
aValue <<= sName; // Arbitrary name
- const ::sfx2::SvBaseLinks& rLnks = pDoc->getIDocumentLinksAdministration().GetLinkManager().GetLinks();
+ const ::sfx2::SvBaseLinks& rLnks = rDoc.getIDocumentLinksAdministration().GetLinkManager().GetLinks();
for( auto n = rLnks.size(); n; )
{
SwBaseLink* pBLink;
diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx
index 8b7832937ead..2d297445bd41 100644
--- a/sw/source/core/docnode/swbaslnk.cxx
+++ b/sw/source/core/docnode/swbaslnk.cxx
@@ -83,8 +83,8 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
return ERROR_GENERAL;
}
- SwDoc* pDoc = m_pContentNode->GetDoc();
- if( pDoc->IsInDtor() || ChkNoDataFlag() )
+ SwDoc& rDoc = m_pContentNode->GetDoc();
+ if( rDoc.IsInDtor() || ChkNoDataFlag() )
{
return SUCCESS;
}
@@ -112,7 +112,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
{
SwCallMouseEvent aCallEvent;
aCallEvent.Set( EVENT_OBJECT_IMAGE, pFormat );
- pDoc->CallEvent( nEvent, aCallEvent );
+ rDoc.CallEvent( nEvent, aCallEvent );
}
}
return SUCCESS; // That's it!
@@ -136,9 +136,9 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
Graphic aGrf;
// tdf#124698 if any auth dialog is needed, find what the parent window should be
- weld::Window* pDlgParent = GetFrameWeld(pDoc);
+ weld::Window* pDlgParent = GetFrameWeld(&rDoc);
- if (pDoc->getIDocumentLinksAdministration().GetLinkManager().GetGraphicFromAny(rMimeType, rValue, aGrf, pDlgParent) &&
+ if (rDoc.getIDocumentLinksAdministration().GetLinkManager().GetGraphicFromAny(rMimeType, rValue, aGrf, pDlgParent) &&
( GraphicType::Default != aGrf.GetType() ||
GraphicType::Default != rGrfObj.GetType() ) )
{
@@ -179,9 +179,9 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
static bool SetGrfFlySize( const Size& rGrfSz, SwGrfNode* pGrfNd, const Size& rOrigGrfSize )
{
bool bRet = false;
- SwViewShell *pSh = pGrfNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+ SwViewShell *pSh = pGrfNd->GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell();
std::unique_ptr<CurrShell> pCurr;
- if ( pGrfNd->GetDoc()->GetEditShell() )
+ if ( pGrfNd->GetDoc().GetEditShell() )
pCurr.reset(new CurrShell( pSh ));
Size aSz = rOrigGrfSize;
@@ -224,7 +224,7 @@ static bool SetGrfFlySize( const Size& rGrfSz, SwGrfNode* pGrfNd, const Size& rO
{
// If the graphic is anchored in a table, we need to recalculate
// the table rows
- const SwDoc *pDoc = pGrfNd->GetDoc();
+ const SwDoc& rDoc = pGrfNd->GetDoc();
const SwPosition* pAPos = pFormat->GetAnchor().GetContentAnchor();
SwTableNode *pTableNd;
if (pAPos && nullptr != (pTableNd = pAPos->nNode.GetNode().FindTableNode()))
@@ -235,7 +235,7 @@ static bool SetGrfFlySize( const Size& rGrfSz, SwGrfNode* pGrfNd, const Size& rO
if( pLayout )
{
const sal_uInt16 nBrowseWidth =
- pLayout->GetBrowseWidthByTable( *pDoc );
+ pLayout->GetBrowseWidthByTable( rDoc );
if ( nBrowseWidth )
{
pLayout->Resize( nBrowseWidth, true, true,
@@ -299,7 +299,7 @@ bool SwBaseLink::SwapIn( bool bWaitForData, bool bNativFormat )
void SwBaseLink::Closed()
{
- if( m_pContentNode && !m_pContentNode->GetDoc()->IsInDtor() )
+ if( m_pContentNode && !m_pContentNode->GetDoc().IsInDtor() )
{
// Delete the connection
if( m_pContentNode->IsGrfNode() )
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index f516b365b575..fad647eee8c0 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -633,7 +633,7 @@ void SwDontExpandItem::SaveDontExpandItems( const SwPosition& rPos )
const SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode();
if( pTextNd )
{
- m_pDontExpandItems.reset( new SfxItemSet( const_cast<SwDoc*>(pTextNd->GetDoc())->GetAttrPool(),
+ m_pDontExpandItems.reset( new SfxItemSet( const_cast<SwDoc&>(pTextNd->GetDoc()).GetAttrPool(),
aCharFormatSetRange ) );
const sal_Int32 n = rPos.nContent.GetIndex();
if (!pTextNd->GetParaAttr( *m_pDontExpandItems, n, n,
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 9a3050ca8969..825052bca2e8 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1271,7 +1271,7 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe
});
uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel();
- uno::Reference<text::XTextContent> xParent = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
+ uno::Reference<text::XTextContent> xParent = SwXParagraph::CreateXParagraph(pNode->GetDoc(), pNode);
lcl_ApplyParagraphClassification(GetDoc(), xModel, xParent, css::uno::Reference<css::rdf::XResource>(xParent, uno::UNO_QUERY), std::move(aResults));
}
@@ -1345,7 +1345,7 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectParagraphClassificati
if (pNode == nullptr)
return aResult;
- uno::Reference<text::XTextContent> xParent = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
+ uno::Reference<text::XTextContent> xParent = SwXParagraph::CreateXParagraph(pNode->GetDoc(), pNode);
uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel();
return lcl_CollectParagraphClassification(xModel, xParent);
}
@@ -1758,7 +1758,7 @@ void SwEditShell::SignParagraph()
return;
// 1. Get the text (without fields).
- const uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode);
+ const uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(pNode->GetDoc(), pNode);
const OString utf8Text = lcl_getParagraphBodyText(xParagraph);
if (utf8Text.isEmpty())
return;
@@ -2101,7 +2101,7 @@ static OUString lcl_GetHighestClassificationParagraphClass(SwPaM* pCursor)
if (pNode == nullptr)
return sHighestClass;
- SwDocShell* pDocShell = pNode->GetDoc()->GetDocShell();
+ SwDocShell* pDocShell = pNode->GetDoc().GetDocShell();
if (!pDocShell)
return sHighestClass;
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index 9196efdc6cd0..b598e4754a70 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -93,7 +93,7 @@ bool ConvertTableToText( const SwTableNode *pConstTableNode, sal_Unicode cCh )
{
SwTableNode *pTableNode = const_cast< SwTableNode* >( pConstTableNode );
ConvertNestedTablesToText( pTableNode->GetTable().GetTabLines(), cCh );
- return pTableNode->GetDoc()->TableToText( pTableNode, cCh );
+ return pTableNode->GetDoc().TableToText( pTableNode, cCh );
}
//End for bug #i119954#
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 48a58c07b61d..d922c1269584 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -202,7 +202,7 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(const SwAuthEntry* pAuthEntry,
}
const SwTextNode& rFieldTextNode = pTextField->GetTextNode();
SwPosition aFieldPos(rFieldTextNode);
- SwDoc& rDoc = *const_cast<SwDoc*>(rFieldTextNode.GetDoc());
+ SwDoc& rDoc = const_cast<SwDoc&>(rFieldTextNode.GetDoc());
SwContentFrame *pFrame = rFieldTextNode.getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() );
const SwTextNode* pTextNode = nullptr;
if(pFrame && !pFrame->IsInDocBody())
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index 47cbabe871a5..81948ff54056 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -767,7 +767,7 @@ static const SwFrame* lcl_GetBoxFrame( const SwTableBox& rBox )
OSL_ENSURE( pCNd, "Box has no TextNode" );
Point aPt; // get the first frame of the layout - table headline
std::pair<Point, bool> const tmp(aPt, false);
- return pCNd->getLayoutFrame(pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp);
+ return pCNd->getLayoutFrame(pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp);
}
static sal_Int32 lcl_GetLongBoxNum( OUString& rStr )
diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx
index e85ba804a469..e275aedf8592 100644
--- a/sw/source/core/fields/chpfld.cxx
+++ b/sw/source/core/fields/chpfld.cxx
@@ -128,13 +128,13 @@ void SwChapterField::ChangeExpansion(const SwFrame & rFrame,
const SwContentNode* pContentNode,
bool bSrchNum )
{
- SwDoc* pDoc = const_cast<SwDoc*>(pContentNode->GetDoc());
+ SwDoc& rDoc = const_cast<SwDoc&>(pContentNode->GetDoc());
const SwTextNode* pTextNode = dynamic_cast<const SwTextNode*>(pContentNode);
if (!pTextNode || !rFrame.IsInDocBody())
{
- SwPosition aDummyPos( pDoc->GetNodes().GetEndOfContent() );
- pTextNode = GetBodyTextNode( *pDoc, aDummyPos, rFrame );
+ SwPosition aDummyPos( rDoc.GetNodes().GetEndOfContent() );
+ pTextNode = GetBodyTextNode( rDoc, aDummyPos, rFrame );
}
if ( pTextNode )
@@ -152,7 +152,7 @@ void SwChapterField::ChangeExpansion(const SwTextNode &rTextNd, bool bSrchNum,
rState.sPost.clear();
rState.sPre.clear();
- SwDoc* pDoc = const_cast<SwDoc*>(rTextNd.GetDoc());
+ SwDoc& rDoc = const_cast<SwDoc&>(rTextNd.GetDoc());
const SwTextNode *pTextNd = rTextNd.FindOutlineNodeOfLevel(rState.nLevel, pLayout);
if( !pTextNd )
return;
@@ -171,7 +171,7 @@ void SwChapterField::ChangeExpansion(const SwTextNode &rTextNd, bool bSrchNum,
if (nPrevLvl < rState.nLevel)
rState.nLevel = nPrevLvl;
- else if( SVX_NUM_NUMBER_NONE != pDoc->GetOutlineNumRule()
+ else if( SVX_NUM_NUMBER_NONE != rDoc.GetOutlineNumRule()
->Get( rState.nLevel ).GetNumberingType() )
{
pTextNd = pONd;
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index ea8bd57e796f..0e486a2963e1 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -346,7 +346,7 @@ void SwGetExpField::ChangeExpansion( const SwFrame& rFrame, const SwTextField& r
// determine document (or is there an easier way?)
const SwTextNode* pTextNode = &rField.GetTextNode();
- SwDoc& rDoc = *const_cast<SwDoc*>(pTextNode->GetDoc());
+ SwDoc& rDoc = const_cast<SwDoc&>(pTextNode->GetDoc());
// create index for determination of the TextNode
SwPosition aPos( SwNodeIndex( rDoc.GetNodes() ) );
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index b12232d4f786..6fb93aa2f9d7 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -100,9 +100,9 @@ bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos,
const SwTextNode& rBehindNd, sal_Int32 nSttPos )
{
const SwTextFrame * pMyFrame = static_cast<SwTextFrame*>(rMyNd.getLayoutFrame(
- rMyNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr));
+ rMyNd.GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr));
const SwTextFrame * pFrame = static_cast<SwTextFrame*>(rBehindNd.getLayoutFrame(
- rBehindNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr));
+ rBehindNd.GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr));
if( !pFrame || !pMyFrame)
return false;
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 3a31d3a5cc75..9a83a033fb76 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -93,7 +93,7 @@ static bool lcl_SetNewFlyPos( const SwNode& rNode, SwFormatAnchor& rAnchor,
const SwContentNode *pCntNd = rNode.GetContentNode();
std::pair<Point, bool> const tmp(rPt, false);
const SwContentFrame* pCFrame = pCntNd ? pCntNd->getLayoutFrame(
- pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pCntNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, &tmp) : nullptr;
const SwPageFrame *pPg = pCFrame ? pCFrame->FindPageFrame() : nullptr;
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 217496c3854a..65512523eb15 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1019,7 +1019,7 @@ static sal_uInt16 lcl_GetRowNumber( const SwPosition& rPos )
std::pair<Point, bool> const tmp(aTmpPt, false);
pNd = rPos.nNode.GetNode().GetContentNode();
if( nullptr != pNd )
- pFrame = pNd->getLayoutFrame(pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPos, &tmp);
+ pFrame = pNd->getLayoutFrame(pNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), &rPos, &tmp);
else
pFrame = nullptr;
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 1c0d99c56f72..d0b0572e1a02 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -234,11 +234,11 @@ void GetTableSel( const SwCursor& rCursor, SwSelBoxes& rBoxes,
const SwContentNode *pCntNd = rCursor.GetContentNode();
std::pair<Point, bool> tmp(aPtPos, true);
const SwLayoutFrame *pStart = pCntNd ?
- pCntNd->getLayoutFrame(pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp)->GetUpper() : nullptr;
+ pCntNd->getLayoutFrame(pCntNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp)->GetUpper() : nullptr;
pCntNd = rCursor.GetContentNode(false);
tmp.first = aMkPos;
const SwLayoutFrame *pEnd = pCntNd ?
- pCntNd->getLayoutFrame(pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp)->GetUpper() : nullptr;
+ pCntNd->getLayoutFrame(pCntNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, &tmp)->GetUpper() : nullptr;
if( pStart && pEnd )
GetTableSel( pStart, pEnd, rBoxes, nullptr, eSearchType );
}
@@ -443,12 +443,12 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd )
// #i22135# - Also the content of the table could be
// invisible - e.g. in a hidden section
// Robust: check, if content was found (e.g. empty table cells)
- if ( !pCNd || pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) == nullptr )
+ if ( !pCNd || pCNd->getLayoutFrame( pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() ) == nullptr )
return false;
std::pair<Point, bool> tmp(aNullPos, true);
const SwLayoutFrame *const pStart = pCNd->getLayoutFrame(
- pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, &tmp)->GetUpper();
OSL_ENSURE( pStart, "without frame nothing works" );
@@ -458,13 +458,13 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd )
pCNd = aIdx.GetNodes().GoNextSection( &aIdx, false, false );
// #i22135# - Robust: check, if content was found and if it's visible
- if ( !pCNd || pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) == nullptr )
+ if ( !pCNd || pCNd->getLayoutFrame( pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() ) == nullptr )
{
return false;
}
const SwLayoutFrame *const pEnd = pCNd->getLayoutFrame(
- pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, &tmp)->GetUpper();
OSL_ENSURE( pEnd, "without frame nothing works" );
@@ -942,11 +942,11 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
const SwContentNode* pCntNd = rPam.GetContentNode();
std::pair<Point, bool> const tmp(aPt, true);
const SwLayoutFrame *const pStart = pCntNd->getLayoutFrame(
- pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pCntNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, &tmp)->GetUpper();
pCntNd = rPam.GetContentNode(false);
const SwLayoutFrame *const pEnd = pCntNd->getLayoutFrame(
- pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pCntNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, &tmp)->GetUpper();
// First, compute tables and rectangles
@@ -1460,11 +1460,11 @@ TableMergeErr CheckMergeSel( const SwPaM& rPam )
const SwContentNode* pCntNd = rPam.GetContentNode();
std::pair<Point, bool> tmp(aPt, true);
const SwLayoutFrame *const pStart = pCntNd->getLayoutFrame(
- pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pCntNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, &tmp)->GetUpper();
pCntNd = rPam.GetContentNode(false);
const SwLayoutFrame *const pEnd = pCntNd->getLayoutFrame(
- pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pCntNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, &tmp)->GetUpper();
GetTableSel( pStart, pEnd, aBoxes, nullptr );
return CheckMergeSel( aBoxes );
@@ -1989,12 +1989,12 @@ bool CheckSplitCells( const SwCursor& rCursor, sal_uInt16 nDiv,
const SwContentNode* pCntNd = rCursor.GetContentNode();
std::pair<Point, bool> tmp(aPtPos, true);
const SwLayoutFrame *const pStart = pCntNd->getLayoutFrame(
- pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pCntNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, &tmp)->GetUpper();
pCntNd = rCursor.GetContentNode(false);
tmp.first = aMkPos;
const SwLayoutFrame *const pEnd = pCntNd->getLayoutFrame(
- pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pCntNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, &tmp)->GetUpper();
SwRectFnSet aRectFnSet(pStart->GetUpper());
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 55ced4c704bc..7ba9f49d952a 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -183,7 +183,7 @@ bool SwGrfNode::ReRead(
}
else // no name anymore, so remove link
{
- GetDoc()->getIDocumentLinksAdministration().GetLinkManager().Remove( mxLink.get() );
+ GetDoc().getIDocumentLinksAdministration().GetLinkManager().Remove( mxLink.get() );
mxLink.clear();
}
@@ -202,7 +202,7 @@ bool SwGrfNode::ReRead(
if( mxLink.is() )
{
- if( getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) )
+ if( getLayoutFrame( GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() ) )
{
SwMsgPoolItem aMsgHint( RES_GRF_REREAD_AND_INCACHE );
ModifyNotification( &aMsgHint, &aMsgHint );
@@ -277,11 +277,11 @@ SwGrfNode::~SwGrfNode()
// #i73788#
mpThreadConsumer.reset();
- SwDoc* pDoc = GetDoc();
+ SwDoc& rDoc = GetDoc();
if( mxLink.is() )
{
OSL_ENSURE( !mbInSwapIn, "DTOR: I am still in SwapIn" );
- pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( mxLink.get() );
+ rDoc.getIDocumentLinksAdministration().GetLinkManager().Remove( mxLink.get() );
mxLink->Disconnect();
}
else
@@ -518,7 +518,7 @@ bool SwGrfNode::SavePersistentData()
if( mxLink.is() )
{
OSL_ENSURE( !mbInSwapIn, "SavePersistentData: I am still in SwapIn" );
- GetDoc()->getIDocumentLinksAdministration().GetLinkManager().Remove( mxLink.get() );
+ GetDoc().getIDocumentLinksAdministration().GetLinkManager().Remove( mxLink.get() );
return true;
}
@@ -810,7 +810,7 @@ void SwGrfNode::TriggerAsyncRetrieveInputStream()
OUString sGrfNm;
sfx2::LinkManager::GetDisplayNames( mxLink.get(), nullptr, &sGrfNm );
OUString sReferer;
- SfxObjectShell * sh = GetDoc()->GetPersist();
+ SfxObjectShell * sh = GetDoc().GetPersist();
if (sh != nullptr && sh->HasName())
{
sReferer = sh->GetMedium()->GetName();
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 89fdd53bd402..649068c841f3 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1040,7 +1040,7 @@ void SwLayoutFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
bool SwTextNode::IsCollapse() const
{
- if (GetDoc()->GetDocumentSettingManager().get( DocumentSettingId::COLLAPSE_EMPTY_CELL_PARA )
+ if (GetDoc().GetDocumentSettingManager().get( DocumentSettingId::COLLAPSE_EMPTY_CELL_PARA )
&& GetText().isEmpty())
{
sal_uLong nIdx=GetIndex();
@@ -1050,7 +1050,7 @@ bool SwTextNode::IsCollapse() const
// The paragraph is collapsed only if the NdAfter is the end of a cell
bool bInTable = FindTableNode( ) != nullptr;
- SwSortedObjs* pObjs = getLayoutFrame( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() )->GetDrawObjs( );
+ SwSortedObjs* pObjs = getLayoutFrame( GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() )->GetDrawObjs( );
const size_t nObjs = ( pObjs != nullptr ) ? pObjs->size( ) : 0;
return pNdBefore!=nullptr && pNdAfter!=nullptr && nObjs == 0 && bInTable;
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index c11288baefed..f983aedb69fd 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -888,11 +888,11 @@ SwContentNotify::~SwContentNotify()
{
pCnt->SetRetouche(); //fix(13870)
- SwDoc *const pDoc = pCnt->IsTextFrame()
- ? &static_cast<SwTextFrame*>(pCnt)->GetDoc()
+ SwDoc& rDoc = pCnt->IsTextFrame()
+ ? static_cast<SwTextFrame*>(pCnt)->GetDoc()
: static_cast<SwNoTextFrame*>(pCnt)->GetNode()->GetDoc();
- if ( !pDoc->GetSpzFrameFormats()->empty() &&
- pDoc->DoesContainAtPageObjWithContentAnchor() && !pDoc->getIDocumentState().IsNewDoc() )
+ if ( !rDoc.GetSpzFrameFormats()->empty() &&
+ rDoc.DoesContainAtPageObjWithContentAnchor() && !rDoc.getIDocumentState().IsNewDoc() )
{
// If certain import filters for foreign file format import
// AT_PAGE anchored objects, the corresponding page number is
@@ -903,7 +903,7 @@ SwContentNotify::~SwContentNotify()
// the page is known. Thus, this data can be corrected now.
const SwPageFrame *pPage = nullptr;
- SwFrameFormats *pTable = pDoc->GetSpzFrameFormats();
+ SwFrameFormats *pTable = rDoc.GetSpzFrameFormats();
for ( size_t i = 0; i < pTable->size(); ++i )
{
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index 76a56ed65508..602ccab141b6 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -426,8 +426,8 @@ void SwContentFrame::DestroyImpl()
pCNd = static_cast<SwTextFrame*>(this)->GetTextNodeFirst();
}
// IsInDtor shouldn't be happening with ViewShell owning layout
- assert(nullptr == pCNd || !pCNd->GetDoc()->IsInDtor());
- if (nullptr != pCNd && !pCNd->GetDoc()->IsInDtor())
+ assert(nullptr == pCNd || !pCNd->GetDoc().IsInDtor());
+ if (nullptr != pCNd && !pCNd->GetDoc().IsInDtor())
{
//Unregister from root if I'm still in turbo there.
SwRootFrame *pRoot = getRootFrame();
@@ -451,7 +451,7 @@ void SwTextFrame::RegisterToNode(SwTextNode & rNode, bool const isForceNodeAsFir
{ // nothing registered here, in particular no delete redlines (insert
// redline might end on empty node where delete rl starts, should be ok)
assert(m_pMergedPara->pFirstNode->GetIndex() + 1 == rNode.GetIndex());
- assert(rNode.GetDoc()->getIDocumentRedlineAccess().GetRedlinePos(
+ assert(rNode.GetDoc().getIDocumentRedlineAccess().GetRedlinePos(
*m_pMergedPara->pFirstNode, RedlineType::Delete) == SwRedlineTable::npos);
}
assert(&rNode != GetDep());
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 9c342a384770..70e3fdfaa92f 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4198,7 +4198,7 @@ static void AddRemoveFlysForNode(
{
// pNode's frame has been deleted by CheckParaRedlineMerge()
AppendObjsOfNode(&rTable,
- pNode->GetIndex(), &rFrame, pPage, rTextNode.GetDoc(),
+ pNode->GetIndex(), &rFrame, pPage, &rTextNode.GetDoc(),
&rIterFirst, &rIterEnd, pFirstNode, pLastNode);
if (pSkipped)
{
@@ -4237,7 +4237,7 @@ void AddRemoveFlysAnchoredToFrameStartingAtNode(
&& rTextNode.GetIndex() <= pMerged->pLastNode->GetIndex());
// add visible flys in non-first node to merged frame
// (hidden flys remain and are deleted via DelFrames())
- SwFrameFormats& rTable(*rTextNode.GetDoc()->GetSpzFrameFormats());
+ SwFrameFormats& rTable(*rTextNode.GetDoc().GetSpzFrameFormats());
SwPageFrame *const pPage(rFrame.FindPageFrame());
std::vector<sw::Extent>::const_iterator iterFirst(pMerged->extents.begin());
std::vector<sw::Extent>::const_iterator iter(iterFirst);
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 4072cbfbfc38..1152e26e8977 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -255,13 +255,13 @@ bool SwOLENode::RestorePersistentData()
if ( maOLEObj.m_xOLERef.is() )
{
// If a SvPersist instance already exists, we use it
- SfxObjectShell* p = GetDoc()->GetPersist();
+ SfxObjectShell* p = GetDoc().GetPersist();
if( !p )
{
// TODO/LATER: Isn't an EmbeddedObjectContainer sufficient here?
// What happens to this document?
OSL_ENSURE( false, "Why are we creating a DocShell here?" );
- p = new SwDocShell( GetDoc(), SfxObjectCreateMode::INTERNAL );
+ p = new SwDocShell( &GetDoc(), SfxObjectCreateMode::INTERNAL );
p->DoInitNew();
}
@@ -310,7 +310,7 @@ bool SwOLENode::SavePersistentData()
comphelper::EmbeddedObjectContainer* pCnt = maOLEObj.m_xOLERef.GetContainer();
#if OSL_DEBUG_LEVEL > 0
- SfxObjectShell* p = GetDoc()->GetPersist();
+ SfxObjectShell* p = GetDoc().GetPersist();
OSL_ENSURE( p, "No document!" );
if( p )
{
@@ -439,7 +439,7 @@ SwContentNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx, bool)
// We insert it at SvPersist level
// TODO/LATER: check if using the same naming scheme for all apps works here
OUString aNewName/*( Sw3Io::UniqueName( p->GetStorage(), "Obj" ) )*/;
- SfxObjectShell* pSrc = GetDoc()->GetPersist();
+ SfxObjectShell* pSrc = GetDoc().GetPersist();
pPersistShell->GetEmbeddedObjectContainer().CopyAndGetEmbeddedObject(
pSrc->GetEmbeddedObjectContainer(),
@@ -502,7 +502,7 @@ bool SwOLENode::IsOLEObjectDeleted() const
{
if( maOLEObj.m_xOLERef.is() )
{
- SfxObjectShell* p = GetDoc()->GetPersist();
+ SfxObjectShell* p = GetDoc().GetPersist();
if( p ) // Must be there
{
return !p->GetEmbeddedObjectContainer().HasEmbeddedObject( maOLEObj.m_aName );
@@ -570,7 +570,7 @@ bool SwOLENode::UpdateLinkURL_Impl()
void SwOLENode::BreakFileLink_Impl()
{
- SfxObjectShell* pPers = GetDoc()->GetPersist();
+ SfxObjectShell* pPers = GetDoc().GetPersist();
if ( !pPers )
return;
@@ -595,7 +595,7 @@ void SwOLENode::DisconnectFileLink_Impl()
{
if ( mpObjectLink )
{
- GetDoc()->getIDocumentLinksAdministration().GetLinkManager().Remove( mpObjectLink );
+ GetDoc().getIDocumentLinksAdministration().GetLinkManager().Remove( mpObjectLink );
mpObjectLink = nullptr;
}
}
@@ -616,7 +616,7 @@ void SwOLENode::CheckFileLink_Impl()
// this is a file link so the model link manager should handle it
mpObjectLink = new SwEmbedObjectLink( this );
maLinkURL = aLinkURL;
- GetDoc()->getIDocumentLinksAdministration().GetLinkManager().InsertFileLink( *mpObjectLink, sfx2::SvBaseLinkObjectType::ClientOle, aLinkURL );
+ GetDoc().getIDocumentLinksAdministration().GetLinkManager().InsertFileLink( *mpObjectLink, sfx2::SvBaseLinkObjectType::ClientOle, aLinkURL );
mpObjectLink->Connect();
}
}
@@ -653,7 +653,7 @@ void SwOLENode::SetChanged()
}
const SwRect aFrameArea(pFrame->getFrameArea());
- SwViewShell* pVSh(GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell());
+ SwViewShell* pVSh(GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell());
if(nullptr == pVSh)
{
@@ -812,13 +812,13 @@ SwOLEObj::~SwOLEObj() COVERITY_NOEXCEPT_FALSE
m_xListener.clear();
}
- if( m_pOLENode && !m_pOLENode->GetDoc()->IsInDtor() )
+ if( m_pOLENode && !m_pOLENode->GetDoc().IsInDtor() )
{
// if the model is not currently in destruction it means that this object should be removed from the model
comphelper::EmbeddedObjectContainer* pCnt = m_xOLERef.GetContainer();
#if OSL_DEBUG_LEVEL > 0
- SfxObjectShell* p = m_pOLENode->GetDoc()->GetPersist();
+ SfxObjectShell* p = m_pOLENode->GetDoc().GetPersist();
OSL_ENSURE( p, "No document!" );
if( p )
{
@@ -865,16 +865,16 @@ void SwOLEObj::SetNode( SwOLENode* pNode )
if ( !m_aName.isEmpty() )
return;
- SwDoc* pDoc = pNode->GetDoc();
+ SwDoc& rDoc = pNode->GetDoc();
// If there's already a SvPersist instance, we use it
- SfxObjectShell* p = pDoc->GetPersist();
+ SfxObjectShell* p = rDoc.GetPersist();
if( !p )
{
// TODO/LATER: Isn't an EmbeddedObjectContainer sufficient here?
// What happens to the document?
OSL_ENSURE( false, "Why are we creating a DocShell here??" );
- p = new SwDocShell( pDoc, SfxObjectCreateMode::INTERNAL );
+ p = new SwDocShell( &rDoc, SfxObjectCreateMode::INTERNAL );
p->DoInitNew();
}
@@ -914,7 +914,7 @@ uno::Reference < embed::XEmbeddedObject > const & SwOLEObj::GetOleRef()
{
if( !m_xOLERef.is() )
{
- SfxObjectShell* p = m_pOLENode->GetDoc()->GetPersist();
+ SfxObjectShell* p = m_pOLENode->GetDoc().GetPersist();
assert(p && "No SvPersist present");
OUString sDocumentBaseURL = p->getDocumentBaseURL();
@@ -973,8 +973,8 @@ bool SwOLEObj::UnloadObject()
bool bRet = true;
if ( m_pOLENode )
{
- const SwDoc* pDoc = m_pOLENode->GetDoc();
- bRet = UnloadObject( m_xOLERef.GetObject(), pDoc, m_xOLERef.GetViewAspect() );
+ const SwDoc& rDoc = m_pOLENode->GetDoc();
+ bRet = UnloadObject( m_xOLERef.GetObject(), &rDoc, m_xOLERef.GetViewAspect() );
}
return bRet;
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 720a11695113..d5d9621670c5 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -236,8 +236,8 @@ bool lcl_HasPreviousParaSameNumRule(SwTextFrame const& rTextFrame, const SwTextN
{
bool bRet = false;
SwNodeIndex aIdx( rNode );
- const SwDoc* pDoc = rNode.GetDoc();
- const SwNodes& rNodes = pDoc->GetNodes();
+ const SwDoc& rDoc = rNode.GetDoc();
+ const SwNodes& rNodes = rDoc.GetNodes();
const SwNode* pNode = &rNode;
const SwNumRule* pNumRule = rNode.GetNumRule();
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index e8b3b8ccda02..ce61e23db883 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -995,7 +995,7 @@ static void lcl_MinMaxNode( SwFrameFormat* pNd, SwMinMaxNodeArgs* pIn )
void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMax,
sal_uLong& rAbsMin ) const
{
- SwViewShell const * pSh = GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+ SwViewShell const * pSh = GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell();
OutputDevice* pOut = nullptr;
if( pSh )
pOut = pSh->GetWin();
@@ -1025,7 +1025,7 @@ void SwTextNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rM
aNodeArgs.nRightDiff = 0;
if( nIndex )
{
- SwFrameFormats* pTmp = const_cast<SwFrameFormats*>(GetDoc()->GetSpzFrameFormats());
+ SwFrameFormats* pTmp = const_cast<SwFrameFormats*>(GetDoc().GetSpzFrameFormats());
if( pTmp )
{
aNodeArgs.nIndx = nIndex;
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index cb619ecd4dcc..e8d77ddbbc6a 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -2536,7 +2536,7 @@ void SwScriptInfo::selectHiddenTextProperty(const SwTextNode& rNode,
// bookmark is marked as hidden with conditions
if (!pBookmark->GetHideCondition().isEmpty())
{
- SwDoc& rDoc = *const_cast<SwDoc*>(rNode.GetDoc());
+ SwDoc& rDoc = const_cast<SwDoc&>(rNode.GetDoc());
SwCalc aCalc(rDoc);
rDoc.getIDocumentFieldsAccess().FieldsToCalc(aCalc, rNode.GetIndex(), SAL_MAX_INT32);
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 2aeaef5f0831..11a2bfcee920 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -421,13 +421,13 @@ void SwAttrIter::CtorInitAttrIter(SwTextNode & rTextNode,
m_nStartIndex = m_nEndIndex = m_nPosition = m_nChgCnt = 0;
m_nPropFont = 0;
- SwDoc* pDoc = rTextNode.GetDoc();
+ SwDoc& rDoc = rTextNode.GetDoc();
const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess();
// sw_redlinehide: this is a Ring - pExtInp is the first PaM that's inside
// the node. It's not clear whether there can be more than 1 PaM in the
// Ring, and this code doesn't handle that case; neither did the old code.
- const SwExtTextInput* pExtInp = pDoc->GetExtTextInput( rTextNode );
+ const SwExtTextInput* pExtInp = rDoc.GetExtTextInput( rTextNode );
if (!pExtInp && m_pMergedPara)
{
SwTextNode const* pNode(&rTextNode);
@@ -436,7 +436,7 @@ void SwAttrIter::CtorInitAttrIter(SwTextNode & rTextNode,
if (rExtent.pNode != pNode)
{
pNode = rExtent.pNode;
- pExtInp = pDoc->GetExtTextInput(*pNode);
+ pExtInp = rDoc.GetExtTextInput(*pNode);
if (pExtInp)
break;
}
@@ -504,7 +504,7 @@ SwRedlineItr::SwRedlineItr( const SwTextNode& rTextNd, SwFont& rFnt,
Mode const mode,
const std::vector<ExtTextInputAttr> *pArr,
SwPosition const*const pExtInputStart)
- : m_rDoc( *rTextNd.GetDoc() )
+ : m_rDoc( rTextNd.GetDoc() )
, m_rAttrHandler( rAH )
, m_nNdIdx( rTextNd.GetIndex() )
, m_nFirst( nRed )
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 79944f166ed0..115b59dcb4ba 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -506,15 +506,15 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm
static const SwRangeRedline* lcl_GetRedlineAtNodeInsertionOrDeletion( const SwTextNode& rTextNode )
{
- const SwDoc* pDoc = rTextNode.GetDoc();
- SwRedlineTable::size_type nRedlPos = pDoc->getIDocumentRedlineAccess().GetRedlinePos( rTextNode, RedlineType::Any );
+ const SwDoc& rDoc = rTextNode.GetDoc();
+ SwRedlineTable::size_type nRedlPos = rDoc.getIDocumentRedlineAccess().GetRedlinePos( rTextNode, RedlineType::Any );
if( SwRedlineTable::npos != nRedlPos )
{
const sal_uLong nNdIdx = rTextNode.GetIndex();
- for( ; nRedlPos < pDoc->getIDocumentRedlineAccess().GetRedlineTable().size() ; ++nRedlPos )
+ for( ; nRedlPos < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size() ; ++nRedlPos )
{
- const SwRangeRedline* pTmp = pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nRedlPos ];
+ const SwRangeRedline* pTmp = rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nRedlPos ];
if( RedlineType::Delete == pTmp->GetType() ||
RedlineType::Insert == pTmp->GetType() )
{
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index b89360fdc789..93d9e775966b 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -807,7 +807,7 @@ void RemoveFootnotesForNode(
{
return; // nothing to do
}
- const SwFootnoteIdxs &rFootnoteIdxs = rTextNode.GetDoc()->GetFootnoteIdxs();
+ const SwFootnoteIdxs &rFootnoteIdxs = rTextNode.GetDoc().GetFootnoteIdxs();
size_t nPos = 0;
sal_uLong const nIndex = rTextNode.GetIndex();
rFootnoteIdxs.SeekEntry( rTextNode, &nPos );
@@ -1327,7 +1327,7 @@ SwTextNode const* SwTextFrame::GetTextNodeFirst() const
SwDoc const& SwTextFrame::GetDoc() const
{
- return *GetTextNodeFirst()->GetDoc();
+ return GetTextNodeFirst()->GetDoc();
}
LanguageType SwTextFrame::GetLangOfChar(TextFrameIndex const nIndex,
@@ -1389,18 +1389,18 @@ bool SwTextFrame::IsHiddenNow() const
{
// see also SwpHints::CalcHiddenParaField()
const SwFormatField& rField = pHint->GetFormatField();
- int nCurWeight = pNode->GetDoc()->FieldCanHideParaWeight(rField.GetField()->GetTyp()->Which());
+ int nCurWeight = pNode->GetDoc().FieldCanHideParaWeight(rField.GetField()->GetTyp()->Which());
if (nCurWeight > nNewResultWeight)
{
nNewResultWeight = nCurWeight;
- bHiddenParaField = pNode->GetDoc()->FieldHidesPara(*rField.GetField());
+ bHiddenParaField = pNode->GetDoc().FieldHidesPara(*rField.GetField());
}
else if (nCurWeight == nNewResultWeight && bHiddenParaField)
{
// Currently, for both supported hiding types (HiddenPara, Database), "Don't hide"
// takes precedence - i.e., if there's a "Don't hide" field of that weight, we only
// care about fields of higher weight.
- bHiddenParaField = pNode->GetDoc()->FieldHidesPara(*rField.GetField());
+ bHiddenParaField = pNode->GetDoc().FieldHidesPara(*rField.GetField());
}
}
}
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index a0a14f307035..7afb7fcd08c9 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -159,12 +159,12 @@ SwTOXSortTabBase::SwTOXSortTabBase( TOXSortType nTyp, const SwContentNode* pNd,
Point aPt;
std::pair<Point, bool> tmp(aPt, false);
const SwContentFrame *const pFrame = pNd->getLayoutFrame(
- pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ pNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, &tmp);
if( pFrame )
{
SwPosition aPos( *pNd );
- const SwDoc& rDoc = *pNd->GetDoc();
+ const SwDoc& rDoc = pNd->GetDoc();
bool const bResult = GetBodyTextNode( rDoc, aPos, *pFrame );
OSL_ENSURE(bResult, "where is the text node");
nPos = aPos.nNode.GetIndex();
@@ -515,7 +515,7 @@ SwTOXPara::SwTOXPara(SwContentNode& rNd, SwTOXElement eT, sal_uInt16 nLevel, con
case SwTOXElement::Template:
case SwTOXElement::OutlineLevel:
assert(rNd.IsTextNode());
- rNd.GetDoc()->getIDocumentMarkAccess()->getMarkForTextNode(
+ rNd.GetDoc().getIDocumentMarkAccess()->getMarkForTextNode(
*rNd.GetTextNode(), IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK);
break;
default:
@@ -655,10 +655,10 @@ OUString SwTOXPara::GetURL() const
{
const SwTextNode * pTextNd = pNd->GetTextNode();
- SwDoc* pDoc = const_cast<SwDoc*>( pTextNd->GetDoc() );
+ SwDoc& rDoc = const_cast<SwDoc&>( pTextNd->GetDoc() );
// tdf#123313: this *must not* create a bookmark, its Undo would
// be screwed! create it as preparatory step, in ctor!
- ::sw::mark::IMark const * const pMark = pDoc->getIDocumentMarkAccess()->getMarkForTextNode(
+ ::sw::mark::IMark const * const pMark = rDoc.getIDocumentMarkAccess()->getMarkForTextNode(
*pTextNd,
IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK);
aText = "#" + pMark->GetName();
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 59b1f48e5d68..6cf067288341 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -361,7 +361,7 @@ void SwFormatField::UpdateTextNode(const SfxPoolItem* pOld, const SfxPoolItem* p
SwUserFieldType* pType = static_cast<SwUserFieldType*>(mpField->GetTyp());
if(!pType->IsValid())
{
- SwCalc aCalc( *pTextNd->GetDoc() );
+ SwCalc aCalc( pTextNd->GetDoc() );
pType->GetValue( aCalc );
}
bExpand = true;
@@ -452,9 +452,9 @@ void SwTextField::ExpandTextField(const bool bForceNotify) const
OSL_ENSURE( m_pTextNode, "SwTextField: where is my TextNode?" );
const SwField* pField = GetFormatField().GetField();
- const OUString aNewExpand( pField->ExpandField(m_pTextNode->GetDoc()->IsClipBoard(),
+ const OUString aNewExpand( pField->ExpandField(m_pTextNode->GetDoc().IsClipBoard(),
// can't do any better than this here...
- m_pTextNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()) );
+ m_pTextNode->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout()) );
const SwFieldIds nWhich = pField->GetTyp()->Which();
const bool bSameExpandSimpleNotification
@@ -593,7 +593,7 @@ void SwTextField::DeleteTextField( const SwTextField& rTextField )
GetPamForTextField(rTextField, pPamForTextField);
if (pPamForTextField != nullptr)
{
- rTextField.GetTextNode().GetDoc()->getIDocumentContentOperations().DeleteAndJoin(*pPamForTextField);
+ rTextField.GetTextNode().GetDoc().getIDocumentContentOperations().DeleteAndJoin(*pPamForTextField);
}
}
}
@@ -681,7 +681,7 @@ void SwTextInputField::UpdateFieldContent()
assert(pInputField || pExpField);
// trigger update of fields for scenarios in which the Input Field's content is part of e.g. a table formula
- GetTextNode().GetDoc()->getIDocumentFieldsAccess().GetUpdateFields().SetFieldsDirty(true);
+ GetTextNode().GetDoc().getIDocumentFieldsAccess().GetUpdateFields().SetFieldsDirty(true);
}
void SwTextInputField::UpdateTextNodeContent( const OUString& rNewContent )
diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx
index c7af2d70e400..d04da840d8e4 100644
--- a/sw/source/core/txtnode/atrflyin.cxx
+++ b/sw/source/core/txtnode/atrflyin.cxx
@@ -136,7 +136,7 @@ void SwTextFlyCnt::SetAnchor( const SwTextNode *pNode )
{
// for Undo, the new anchor must be known already!
- SwDoc* pDoc = const_cast<SwDoc*>(pNode->GetDoc());
+ SwDoc& rDoc = const_cast<SwDoc&>(pNode->GetDoc());
SwIndex aIdx( const_cast<SwTextNode*>(pNode), GetStart() );
SwPosition aPos( *pNode->StartOfSectionNode(), aIdx );
@@ -167,11 +167,11 @@ void SwTextFlyCnt::SetAnchor( const SwTextNode *pNode )
pFormat->DelFrames();
// copy into a different document?
- if( pDoc != pFormat->GetDoc() )
+ if( &rDoc != pFormat->GetDoc() )
{
// disable undo while copying attribute
- ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
- SwFrameFormat* pNew = pDoc->getIDocumentLayoutAccess().CopyLayoutFormat( *pFormat, aAnchor, false, false );
+ ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
+ SwFrameFormat* pNew = rDoc.getIDocumentLayoutAccess().CopyLayoutFormat( *pFormat, aAnchor, false, false );
::sw::UndoGuard const undoGuardFormat(
pFormat->GetDoc()->GetIDocumentUndoRedo());
diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx
index e301d2c12f54..ff4b9e683286 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -309,7 +309,7 @@ void SwTextFootnote::SetStartNode( const SwNodeIndex *pNewNode, bool bDelNode )
SwDoc* pDoc;
if ( m_pTextNode )
{
- pDoc = m_pTextNode->GetDoc();
+ pDoc = &m_pTextNode->GetDoc();
}
else
{
@@ -372,7 +372,7 @@ void SwTextFootnote::InvalidateNumberInLayout()
{
assert(m_pTextNode);
SwFormatFootnote const& rFootnote(GetFootnote());
- SwNodes &rNodes = m_pTextNode->GetDoc()->GetNodes();
+ SwNodes &rNodes = m_pTextNode->GetDoc().GetNodes();
m_pTextNode->ModifyNotification( nullptr, &rFootnote );
if ( m_pStartNode )
{
@@ -401,8 +401,8 @@ void SwTextFootnote::CopyFootnote(
if (m_pStartNode && rDest.GetStartNode())
{
// footnotes not necessarily in same document!
- SwDoc *const pDstDoc = rDestNode.GetDoc();
- SwNodes &rDstNodes = pDstDoc->GetNodes();
+ SwDoc& rDstDoc = rDestNode.GetDoc();
+ SwNodes &rDstNodes = rDstDoc.GetNodes();
// copy only the content of the section
SwNodeRange aRg( *m_pStartNode, 1,
@@ -414,7 +414,7 @@ void SwTextFootnote::CopyFootnote(
SwNodeIndex aEnd( *aStart.GetNode().EndOfSectionNode() );
sal_uLong nDestLen = aEnd.GetIndex() - aStart.GetIndex() - 1;
- m_pTextNode->GetDoc()->GetDocumentContentOperationsManager().CopyWithFlyInFly(aRg, aEnd);
+ m_pTextNode->GetDoc().GetDocumentContentOperationsManager().CopyWithFlyInFly(aRg, aEnd);
// in case the destination section was not empty, delete the old nodes
// before: Src: SxxxE, Dst: SnE
@@ -536,13 +536,13 @@ void SwTextFootnote::SetSeqRefNo()
if( !m_pTextNode )
return;
- SwDoc* pDoc = m_pTextNode->GetDoc();
- if( pDoc->IsInReading() )
+ SwDoc& rDoc = m_pTextNode->GetDoc();
+ if( rDoc.IsInReading() )
return;
std::set<sal_uInt16> aUsedNums;
std::vector<SwTextFootnote*> badRefNums;
- ::lcl_FillUsedFootnoteRefNumbers(*pDoc, this, aUsedNums, badRefNums);
+ ::lcl_FillUsedFootnoteRefNumbers(rDoc, this, aUsedNums, badRefNums);
if ( ::lcl_IsRefNumAvailable(aUsedNums, m_nSeqNo) )
return;
std::vector<sal_uInt16> unused;
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index 5911474b5d3d..3a3694f3cd84 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -735,7 +735,7 @@ void MetaField::GetPrefixAndSuffix(
if (xMetaField.is())
{
SwTextNode * const pTextNode( GetTextNode() );
- SwDocShell const * const pShell(pTextNode->GetDoc()->GetDocShell());
+ SwDocShell const * const pShell(pTextNode->GetDoc().GetDocShell());
const uno::Reference<frame::XModel> xModel(
pShell ? pShell->GetModel() : nullptr, uno::UNO_SET_THROW);
getPrefixAndSuffix(xModel, xMetaField, o_pPrefix, o_pSuffix);
@@ -755,7 +755,7 @@ sal_uInt32 MetaField::GetNumberFormat(OUString const & rContent) const
if (pTextNode)
{
double number;
- (void) pTextNode->GetDoc()->IsNumberFormat( rContent, nNumberFormat, number );
+ (void) pTextNode->GetDoc().IsNumberFormat( rContent, nNumberFormat, number );
}
return nNumberFormat;
}
diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx
index 7a6d936b31d5..cf4983192b23 100644
--- a/sw/source/core/txtnode/modeltoviewhelper.cxx
+++ b/sw/source/core/txtnode/modeltoviewhelper.cxx
@@ -166,10 +166,10 @@ ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode,
if (eMode & ExpandMode::ExpandFootnote)
{
const SwFormatFootnote& rFootnote = static_cast<SwTextFootnote const*>(pAttr)->GetFootnote();
- const SwDoc *pDoc = rNode.GetDoc();
+ const SwDoc& rDoc = rNode.GetDoc();
aFieldResult.m_sExpand = (eMode & ExpandMode::ReplaceMode)
? OUString(CHAR_ZWSP)
- : rFootnote.GetViewNumStr(*pDoc, pLayout);
+ : rFootnote.GetViewNumStr(rDoc, pLayout);
aFieldResult.m_eType = FieldResult::FOOTNOTE;
}
break;
@@ -187,7 +187,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode,
//to is
SwPaM aPaM(rNode, 0, rNode, rNode.Len());
std::vector<sw::mark::IFieldmark*> aDropDowns =
- rNode.GetDoc()->getIDocumentMarkAccess()->getDropDownsFor(aPaM);
+ rNode.GetDoc().getIDocumentMarkAccess()->getDropDownsFor(aPaM);
for (sw::mark::IFieldmark *pMark : aDropDowns)
{
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 7c7b48be962b..1d85f8db8370 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -92,10 +92,10 @@ typedef std::vector<SwTextAttr*> SwpHts;
// unfortunately everyone can change Hints without ensuring order or the linking between them
#ifdef DBG_UTIL
#define CHECK_SWPHINTS(pNd) { if( pNd->GetpSwpHints() && \
- !pNd->GetDoc()->IsInReading() ) \
+ !pNd->GetDoc().IsInReading() ) \
pNd->GetpSwpHints()->Check(true); }
#define CHECK_SWPHINTS_IF_FRM(pNd) { if( pNd->GetpSwpHints() && \
- !pNd->GetDoc()->IsInReading() ) \
+ !pNd->GetDoc().IsInReading() ) \
pNd->GetpSwpHints()->Check(getLayoutFrame(nullptr, nullptr, nullptr) != nullptr); }
#else
#define CHECK_SWPHINTS(pNd)
@@ -281,7 +281,7 @@ sal_Int32 SwTextNode::Len() const
static void lcl_ChangeFootnoteRef( SwTextNode &rNode )
{
SwpHints *pSwpHints = rNode.GetpSwpHints();
- if( !(pSwpHints && rNode.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()) )
+ if( !(pSwpHints && rNode.GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell()) )
return;
SwContentFrame* pFrame = nullptr;
@@ -564,7 +564,7 @@ SwTextNode *SwTextNode::SplitContentNode(const SwPosition & rPos,
// text node.
const SwRootFrame *pRootFrame;
if ( (nTextLen != nSplitPos) ||
- ( (pRootFrame = pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()) != nullptr &&
+ ( (pRootFrame = pNode->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout()) != nullptr &&
pRootFrame->IsAnyShellAccessible() ) )
{
// tell the frames that something was "deleted" at the end
@@ -1159,7 +1159,7 @@ void SwTextNode::NewAttrSet( SwAttrPool& rPool )
aNewAttrSet.Put( aFormatColl );
aNewAttrSet.SetParent( &pAnyFormatColl->GetAttrSet() );
- mpAttrSet = GetDoc()->GetIStyleAccess().getAutomaticStyle( aNewAttrSet, IStyleAccess::AUTO_STYLE_PARA, &sVal );
+ mpAttrSet = GetDoc().GetIStyleAccess().getAutomaticStyle( aNewAttrSet, IStyleAccess::AUTO_STYLE_PARA, &sVal );
}
// override SwIndexReg::Update => text hints do not need SwIndex for start/end!
@@ -1304,10 +1304,10 @@ void SwTextNode::Update(
{
SwTextAttr *pTmp = *it;
pCollector->erase( it );
- SwTextAttr::Destroy( pTmp, GetDoc()->GetAttrPool() );
+ SwTextAttr::Destroy( pTmp, GetDoc().GetAttrPool() );
}
SwTextAttr * const pTmp =
- MakeTextAttr( *GetDoc(),
+ MakeTextAttr( GetDoc(),
pHint->GetAttr(), nChangePos, nChangePos + nChangeLen);
pCollector->push_back( pTmp );
}
@@ -1350,7 +1350,7 @@ void SwTextNode::Update(
SwIndexReg aTmpIdxReg;
if ( !bNegative && !bDelete )
{
- const SwRedlineTable& rTable = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
+ const SwRedlineTable& rTable = GetDoc().getIDocumentRedlineAccess().GetRedlineTable();
for (SwRangeRedline* pRedl : rTable)
{
if ( pRedl->HasMark() )
@@ -1432,7 +1432,7 @@ void SwTextNode::Update(
// at-char anchored flys shouldn't be moved, either.
#if OSL_DEBUG_LEVEL > 0
std::vector<SwFrameFormat*> checkFormats;
- const SwFrameFormats& rFormats = *GetDoc()->GetSpzFrameFormats();
+ const SwFrameFormats& rFormats = *GetDoc().GetSpzFrameFormats();
for (auto& rpFormat : rFormats)
{
const SwFormatAnchor& rAnchor = rpFormat->GetAnchor();
@@ -1479,7 +1479,7 @@ void SwTextNode::Update(
#endif
// The cursors of other shells shouldn't be moved, either.
- if (SwDocShell* pDocShell = GetDoc()->GetDocShell())
+ if (SwDocShell* pDocShell = GetDoc().GetDocShell())
{
if (pDocShell->GetWrtShell())
{
@@ -1524,13 +1524,13 @@ void SwTextNode::Update(
//Any drawing objects anchored into this text node may be sorted by their
//anchor position which may have changed here, so resort them
- SwContentFrame* pContentFrame = getLayoutFrame(GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout());
+ SwContentFrame* pContentFrame = getLayoutFrame(GetDoc().getIDocumentLayoutAccess().GetCurrentLayout());
SwSortedObjs* pSortedObjs = pContentFrame ? pContentFrame->GetDrawObjs() : nullptr;
if (pSortedObjs)
pSortedObjs->UpdateAll();
// Update the paragraph signatures.
- if (SwEditShell* pEditShell = GetDoc()->GetEditShell())
+ if (SwEditShell* pEditShell = GetDoc().GetEditShell())
{
pEditShell->ValidateParagraphSignatures(this, true);
}
@@ -1538,10 +1538,10 @@ void SwTextNode::Update(
// Inform LOK clients about change in position of redlines (if any)
// Don't emit notifications during save: redline flags are temporarily changed during save, but
// it's not useful to let clients know about such changes.
- if (!comphelper::LibreOfficeKit::isActive() || GetDoc()->IsInWriting())
+ if (!comphelper::LibreOfficeKit::isActive() || GetDoc().IsInWriting())
return;
- const SwRedlineTable& rTable = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
+ const SwRedlineTable& rTable = GetDoc().getIDocumentRedlineAccess().GetRedlineTable();
for (SwRedlineTable::size_type nRedlnPos = 0; nRedlnPos < rTable.size(); ++nRedlnPos)
{
SwRangeRedline* pRedln = rTable[nRedlnPos];
@@ -1564,8 +1564,7 @@ void SwTextNode::Update(
void SwTextNode::ChgTextCollUpdateNum( const SwTextFormatColl *pOldColl,
const SwTextFormatColl *pNewColl)
{
- SwDoc* pDoc = GetDoc();
- OSL_ENSURE( pDoc, "No Doc?" );
+ SwDoc& rDoc = GetDoc();
// query the OutlineLevel and if it changed, notify the Nodes-Array!
const int nOldLevel = pOldColl && pOldColl->IsAssignedToListLevelOfOutlineStyle() ?
pOldColl->GetAssignedOutlineStyleLevel() : MAXLEVEL;
@@ -1576,20 +1575,17 @@ void SwTextNode::ChgTextCollUpdateNum( const SwTextFormatColl *pOldColl,
{
SetAttrListLevel(nNewLevel);
}
- if (pDoc)
- {
- pDoc->GetNodes().UpdateOutlineNode(*this);
- }
+ rDoc.GetNodes().UpdateOutlineNode(*this);
SwNodes& rNds = GetNodes();
// If Level 0 (Chapter), update the footnotes!
- if( ( !nNewLevel || !nOldLevel) && pDoc && !pDoc->GetFootnoteIdxs().empty() &&
- FTNNUM_CHAPTER == pDoc->GetFootnoteInfo().m_eNum &&
+ if( ( !nNewLevel || !nOldLevel) && !rDoc.GetFootnoteIdxs().empty() &&
+ FTNNUM_CHAPTER == rDoc.GetFootnoteInfo().m_eNum &&
rNds.IsDocNodes() )
{
SwNodeIndex aTmpIndex( rNds, GetIndex());
- pDoc->GetFootnoteIdxs().UpdateFootnote( aTmpIndex);
+ rDoc.GetFootnoteIdxs().UpdateFootnote( aTmpIndex);
}
if( pNewColl && RES_CONDTXTFMTCOLL == pNewColl->Which() )
@@ -1888,20 +1884,17 @@ static void lcl_CopyHint(
if( pOtherDoc && pDest && pDest->GetpSwpHints()
&& pDest->GetpSwpHints()->Contains( pNewHt ) )
{
- const SwDoc* const pDoc = static_txtattr_cast<
+ const SwDoc& rDoc = static_txtattr_cast<
const SwTextINetFormat*>(pHt)->GetTextNode().GetDoc();
- if ( pDoc )
- {
- const SwCharFormats* pCharFormats = pDoc->GetCharFormats();
- const SwFormatINetFormat& rFormat = pHt->GetINetFormat();
- SwCharFormat* pFormat;
- pFormat = lcl_FindCharFormat( pCharFormats, rFormat.GetINetFormat() );
- if( pFormat )
- pOtherDoc->CopyCharFormat( *pFormat );
- pFormat = lcl_FindCharFormat( pCharFormats, rFormat.GetVisitedFormat() );
- if( pFormat )
- pOtherDoc->CopyCharFormat( *pFormat );
- }
+ const SwCharFormats* pCharFormats = rDoc.GetCharFormats();
+ const SwFormatINetFormat& rFormat = pHt->GetINetFormat();
+ SwCharFormat* pFormat;
+ pFormat = lcl_FindCharFormat( pCharFormats, rFormat.GetINetFormat() );
+ if( pFormat )
+ pOtherDoc->CopyCharFormat( *pFormat );
+ pFormat = lcl_FindCharFormat( pCharFormats, rFormat.GetVisitedFormat() );
+ if( pFormat )
+ pOtherDoc->CopyCharFormat( *pFormat );
}
//JP 24.04.98: The attribute must point to a text node, so that
// the styles can be created.
@@ -1934,8 +1927,8 @@ void SwTextNode::CopyAttr( SwTextNode *pDest, const sal_Int32 nTextStartIdx,
{
if ( HasHints() )
{
- SwDoc* const pOtherDoc = (pDest->GetDoc() != GetDoc()) ?
- pDest->GetDoc() : nullptr;
+ SwDoc* const pOtherDoc = (&pDest->GetDoc() != &GetDoc()) ?
+ &pDest->GetDoc() : nullptr;
for ( size_t i = 0; i < m_pSwpHints->Count(); ++i )
{
@@ -1965,7 +1958,7 @@ void SwTextNode::CopyAttr( SwTextNode *pDest, const sal_Int32 nTextStartIdx,
}
}
else if( !pOtherDoc
- ? GetDoc()->IsCopyIsMove()
+ ? GetDoc().IsCopyIsMove()
: nullptr == pOtherDoc->GetRefMark( pHt->GetRefMark().GetRefName() ) )
{
pDest->InsertItem(
@@ -2009,7 +2002,7 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
sal_Int32 nTextStartIdx = rStart.GetIndex();
sal_Int32 nDestStart = rDestStart.GetIndex(); // remember old Pos
- if (pDest->GetDoc()->IsClipBoard() && GetNum())
+ if (pDest->GetDoc().IsClipBoard() && GetNum())
{
// #i111677# cache expansion of source (for clipboard)
pDest->m_pNumStringCache.reset( (nTextStartIdx != 0)
@@ -2032,7 +2025,7 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
nLen != pDest->GetText().getLength()))
{
SfxItemSet aCharSet(
- pDest->GetDoc()->GetAttrPool(),
+ pDest->GetDoc().GetAttrPool(),
svl::Items<
RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
RES_TXTATR_INETFMT, RES_TXTATR_CHARFMT,
@@ -2063,7 +2056,7 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
if ( !nLen ) // string not longer?
return;
- SwDoc* const pOtherDoc = (pDest->GetDoc() != GetDoc()) ? pDest->GetDoc() : nullptr;
+ SwDoc* const pOtherDoc = (&pDest->GetDoc() != &GetDoc()) ? &pDest->GetDoc() : nullptr;
// copy hard attributes on whole paragraph
if( HasSwAttrSet() )
@@ -2075,7 +2068,7 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
nLen != pDest->GetText().getLength()))
{
SfxItemSet aCharSet(
- pDest->GetDoc()->GetAttrPool(),
+ pDest->GetDoc().GetAttrPool(),
svl::Items<
RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
RES_TXTATR_INETFMT, RES_TXTATR_CHARFMT,
@@ -2093,7 +2086,7 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
}
bool const bUndoNodes = !pOtherDoc
- && GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(GetNodes());
+ && GetDoc().GetIDocumentUndoRedo().IsUndoNodes(GetNodes());
// Fetch end only now, because copying into self updates the start index
// and all attributes
@@ -2134,7 +2127,7 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
const bool bCopyRefMark = RES_TXTATR_REFMARK == nWhich
&& ( bUndoNodes
|| ( !pOtherDoc
- ? GetDoc()->IsCopyIsMove()
+ ? GetDoc().IsCopyIsMove()
: nullptr == pOtherDoc->GetRefMark( pHt->GetRefMark().GetRefName() ) ) );
if ( pEndIdx
@@ -2205,7 +2198,7 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
if( pDest == this )
{
// copy the hint here, but insert it later
- pNewHt = MakeTextAttr( *GetDoc(), pHt->GetAttr(),
+ pNewHt = MakeTextAttr( GetDoc(), pHt->GetAttr(),
nAttrStt, nAttrEnd, CopyOrNewType::Copy, pDest );
lcl_CopyHint(nWhich, pHt, pNewHt, nullptr, pDest);
@@ -2410,7 +2403,7 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
{
assert(pDest); // Cut requires a destination
- assert(GetDoc() == pDest->GetDoc()); // must be same document
+ assert(&GetDoc() == &pDest->GetDoc()); // must be same document
assert(pDest != this); // destination must be different node
@@ -2447,7 +2440,7 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
const sal_Int32 nEnd = rStart.GetIndex() + nLen;
bool const bUndoNodes =
- GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(GetNodes());
+ GetDoc().GetIDocumentUndoRedo().IsUndoNodes(GetNodes());
// copy hard attributes on whole paragraph
if (HasSwAttrSet())
@@ -2496,7 +2489,7 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
nLen != pDest->GetText().getLength())
{
SfxItemSet aCharSet(
- pDest->GetDoc()->GetAttrPool(),
+ pDest->GetDoc().GetAttrPool(),
svl::Items<
RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
RES_TXTATR_INETFMT, RES_TXTATR_CHARFMT,
@@ -2543,7 +2536,7 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
|| bUndoNodes ) && pEndIdx && *pEndIdx > nTextStartIdx)
{
// attribute with extent and end of attribute is in the range
- pNewHt = MakeTextAttr( *pDest->GetDoc(), pHt->GetAttr(),
+ pNewHt = MakeTextAttr( pDest->GetDoc(), pHt->GetAttr(),
nDestStart,
nDestStart + (
*pEndIdx > nEnd
@@ -2559,9 +2552,9 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
|| pHt->HasDummyChar() )
{
// do not delete note and later add it -> sidebar flickering
- if (GetDoc()->GetDocShell())
+ if (GetDoc().GetDocShell())
{
- GetDoc()->GetDocShell()->Broadcast( SfxHint(SfxHintId::SwSplitNodeOperation));
+ GetDoc().GetDocShell()->Broadcast( SfxHint(SfxHintId::SwSplitNodeOperation));
}
// move attribute
m_pSwpHints->Delete( pHt );
@@ -2581,16 +2574,16 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
pDest->InsertHint( pHt,
SetAttrMode::NOTXTATRCHR
| SetAttrMode::DONTREPLACE );
- if (GetDoc()->GetDocShell())
+ if (GetDoc().GetDocShell())
{
- GetDoc()->GetDocShell()->Broadcast( SfxHint(SfxHintId::SwSplitNodeOperation));
+ GetDoc().GetDocShell()->Broadcast( SfxHint(SfxHintId::SwSplitNodeOperation));
}
continue; // iterate while loop, no ++ !
}
// the end is behind the range
else if (RES_TXTATR_REFMARK != nWhich || bUndoNodes)
{
- pNewHt = MakeTextAttr( *GetDoc(), pHt->GetAttr(),
+ pNewHt = MakeTextAttr( GetDoc(), pHt->GetAttr(),
nDestStart + (nAttrStartIdx - nTextStartIdx),
nDestStart + (*pEndIdx > nEnd
? nLen
@@ -2817,7 +2810,7 @@ SwNumRule* SwTextNode::GetNumRule(bool bInParent) const
static_cast<const SwNumRuleItem *>(pItem)->GetValue();
if (!sNumRuleName.isEmpty())
{
- pRet = GetDoc()->FindNumRulePtr( sNumRuleName );
+ pRet = GetDoc().FindNumRulePtr( sNumRuleName );
}
else // numbering is turned off
bNoNumRule = true;
@@ -2825,7 +2818,7 @@ SwNumRule* SwTextNode::GetNumRule(bool bInParent) const
if ( !bNoNumRule )
{
- if ( pRet && pRet == GetDoc()->GetOutlineNumRule() &&
+ if ( pRet && pRet == GetDoc().GetOutlineNumRule() &&
( !HasSwAttrSet() ||
SfxItemState::SET !=
GetpSwAttrSet()->GetItemState( RES_PARATR_NUMRULE, false ) ) )
@@ -2893,7 +2886,7 @@ bool SwTextNode::HasMarkedLabel() const
if ( IsInList() )
{
bResult =
- GetDoc()->getIDocumentListsAccess().getListByName( GetListId() )->IsListLevelMarked( GetActualListLevel() );
+ GetDoc().getIDocumentListsAccess().getListByName( GetListId() )->IsListLevelMarked( GetActualListLevel() );
}
return bResult;
@@ -3126,7 +3119,7 @@ OUString SwTextNode::GetNumString( const bool _bInclPrefixAndSuffixStrings,
const unsigned int _nRestrictToThisLevel,
SwRootFrame const*const pLayout) const
{
- if (GetDoc()->IsClipBoard() && m_pNumStringCache)
+ if (GetDoc().IsClipBoard() && m_pNumStringCache)
{
// #i111677# do not expand number strings in clipboard documents
return *m_pNumStringCache;
@@ -3526,10 +3519,10 @@ bool SwTextNode::CopyExpandText(SwTextNode& rDestNd, const SwIndex* pDestIdx,
if( !rFootnote.GetNumStr().isEmpty() )
sExpand = rFootnote.GetNumStr();
else if( rFootnote.IsEndNote() )
- sExpand = GetDoc()->GetEndNoteInfo().m_aFormat.
+ sExpand = GetDoc().GetEndNoteInfo().m_aFormat.
GetNumStr(number);
else
- sExpand = GetDoc()->GetFootnoteInfo().m_aFormat.
+ sExpand = GetDoc().GetFootnoteInfo().m_aFormat.
GetNumStr(number);
if( !sExpand.isEmpty() )
{
@@ -3608,15 +3601,15 @@ bool SwTextNode::CopyExpandText(SwTextNode& rDestNd, const SwIndex* pDestIdx,
OUString SwTextNode::GetRedlineText() const
{
std::vector<sal_Int32> aRedlArr;
- const SwDoc* pDoc = GetDoc();
- SwRedlineTable::size_type nRedlPos = pDoc->getIDocumentRedlineAccess().GetRedlinePos( *this, RedlineType::Delete );
+ const SwDoc& rDoc = GetDoc();
+ SwRedlineTable::size_type nRedlPos = rDoc.getIDocumentRedlineAccess().GetRedlinePos( *this, RedlineType::Delete );
if( SwRedlineTable::npos != nRedlPos )
{
// some redline-delete object exists for the node
const sal_uLong nNdIdx = GetIndex();
- for( ; nRedlPos < pDoc->getIDocumentRedlineAccess().GetRedlineTable().size() ; ++nRedlPos )
+ for( ; nRedlPos < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size() ; ++nRedlPos )
{
- const SwRangeRedline* pTmp = pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nRedlPos ];
+ const SwRangeRedline* pTmp = rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nRedlPos ];
if( RedlineType::Delete == pTmp->GetType() )
{
const SwPosition *pRStt = pTmp->Start(), *pREnd = pTmp->End();
@@ -3760,7 +3753,7 @@ namespace {
SwPaM aPam( rTextNode );
// #i96644#
// suppress side effect "send data changed events"
- rTextNode.GetDoc()->ResetAttrs( aPam, false, aAttrs, false );
+ rTextNode.GetDoc().ResetAttrs( aPam, false, aAttrs, false );
}
// Helper method for special handling of modified attributes at text node.
@@ -4227,13 +4220,8 @@ bool SwTextNode::IsNotifiable() const
bool SwTextNode::IsNotificationEnabled() const
{
- bool bResult = false;
- const SwDoc * pDoc = GetDoc();
- if( pDoc )
- {
- bResult = !(pDoc->IsInReading() || pDoc->IsInDtor());
- }
- return bResult;
+ const SwDoc& rDoc = GetDoc();
+ return !(rDoc.IsInReading() || rDoc.IsInDtor());
}
void SwTextNode::SetCountedInList( bool bCounted )
@@ -4264,7 +4252,7 @@ static SwList * FindList(SwTextNode *const pNode)
const OUString sListId = pNode->GetListId();
if (!sListId.isEmpty())
{
- auto & rIDLA(pNode->GetDoc()->getIDocumentListsAccess());
+ auto & rIDLA(pNode->GetDoc().getIDocumentListsAccess());
SwList* pList = rIDLA.getListByName( sListId );
if ( pList == nullptr )
{
@@ -5219,7 +5207,7 @@ void SwTextNode::dumpAsXml(xmlTextWriterPtr pWriter) const
sal_uInt32 SwTextNode::GetRsid( sal_Int32 nStt, sal_Int32 nEnd ) const
{
- SfxItemSet aSet( const_cast<SfxItemPool&>(static_cast<SfxItemPool const &>(GetDoc()->GetAttrPool())), svl::Items<RES_CHRATR_RSID, RES_CHRATR_RSID>{} );
+ SfxItemSet aSet( const_cast<SfxItemPool&>(static_cast<SfxItemPool const &>(GetDoc().GetAttrPool())), svl::Items<RES_CHRATR_RSID, RES_CHRATR_RSID>{} );
if (GetParaAttr(aSet, nStt, nEnd))
{
const SvxRsidItem* pRsid = aSet.GetItem<SvxRsidItem>(RES_CHRATR_RSID);
@@ -5254,22 +5242,22 @@ bool SwTextNode::CompareRsid( const SwTextNode &rTextNode, sal_Int32 nStt1, sal_
// sw::Metadatable
::sfx2::IXmlIdRegistry& SwTextNode::GetRegistry()
{
- return GetDoc()->GetXmlIdRegistry();
+ return GetDoc().GetXmlIdRegistry();
}
bool SwTextNode::IsInClipboard() const
{
- return GetDoc()->IsClipBoard();
+ return GetDoc().IsClipBoard();
}
bool SwTextNode::IsInUndo() const
{
- return GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(GetNodes());
+ return GetDoc().GetIDocumentUndoRedo().IsUndoNodes(GetNodes());
}
bool SwTextNode::IsInContent() const
{
- return !GetDoc()->IsInHeaderFooter( SwNodeIndex(*this) );
+ return !GetDoc().IsInHeaderFooter( SwNodeIndex(*this) );
}
void SwTextNode::SwClientNotify( const SwModify& rModify, const SfxHint& rHint )
@@ -5324,11 +5312,11 @@ void SwTextNode::SwClientNotify( const SwModify& rModify, const SfxHint& rHint )
SwContentNode::SwClientNotify(rModify, rHint);
- SwDoc* pDoc = GetDoc();
+ SwDoc& rDoc = GetDoc();
// #125329# - assure that text node is in document nodes array
- if ( pDoc && !pDoc->IsInDtor() && &pDoc->GetNodes() == &GetNodes() )
+ if ( !rDoc.IsInDtor() && &rDoc.GetNodes() == &GetNodes() )
{
- pDoc->GetNodes().UpdateOutlineNode(*this);
+ rDoc.GetNodes().UpdateOutlineNode(*this);
}
m_bNotifiable = bWasNotifiable;
@@ -5349,7 +5337,7 @@ uno::Reference< rdf::XMetadatable >
SwTextNode::MakeUnoObject()
{
const uno::Reference<rdf::XMetadatable> xMeta(
- SwXParagraph::CreateXParagraph(*GetDoc(), this), uno::UNO_QUERY);
+ SwXParagraph::CreateXParagraph(GetDoc(), this), uno::UNO_QUERY);
return xMeta;
}
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 832bbdbb8631..714214c2d360 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -211,7 +211,7 @@ void SwTextINetFormat::InitINetFormat(SwTextNode & rNode)
{
ChgTextNode(&rNode);
SwCharFormat * const pFormat(
- rNode.GetDoc()->getIDocumentStylePoolAccess().GetCharFormatFromPool(RES_POOLCHR_INET_NORMAL) );
+ rNode.GetDoc().getIDocumentStylePoolAccess().GetCharFormatFromPool(RES_POOLCHR_INET_NORMAL) );
pFormat->Add( this );
}
@@ -219,7 +219,7 @@ void SwTextRuby::InitRuby(SwTextNode & rNode)
{
ChgTextNode(&rNode);
SwCharFormat * const pFormat(
- rNode.GetDoc()->getIDocumentStylePoolAccess().GetCharFormatFromPool(RES_POOLCHR_RUBYTEXT) );
+ rNode.GetDoc().getIDocumentStylePoolAccess().GetCharFormatFromPool(RES_POOLCHR_RUBYTEXT) );
pFormat->Add( this );
}
@@ -231,7 +231,7 @@ MakeTextAttrNesting(SwTextNode & rNode, SwTextAttrNesting & rNesting,
const sal_Int32 nStart, const sal_Int32 nEnd)
{
SwTextAttr * const pNew( MakeTextAttr(
- *rNode.GetDoc(), rNesting.GetAttr(), nStart, nEnd ) );
+ rNode.GetDoc(), rNesting.GetAttr(), nStart, nEnd ) );
switch (pNew->Which())
{
case RES_TXTATR_INETFMT:
@@ -400,7 +400,7 @@ SwpHints::TryInsertNesting( SwTextNode & rNode, SwTextAttrNesting & rNewHint )
case FAIL:
SAL_INFO("sw.core", "cannot insert hint: overlap");
for (const auto& aSplit : SplitNew)
- TextAttrDelete(*rNode.GetDoc(), aSplit);
+ TextAttrDelete(rNode.GetDoc(), aSplit);
return false;
case SPLIT_NEW:
lcl_DoSplitNew(SplitNew, rNode, nNewStart,
@@ -455,7 +455,7 @@ SwpHints::TryInsertNesting( SwTextNode & rNode, SwTextAttrNesting & rNewHint )
{
SAL_INFO("sw.core", "cannot insert hint: fieldmark overlap");
assert(SplitNew.size() == 1);
- TextAttrDelete(*rNode.GetDoc(), &rNewHint);
+ TextAttrDelete(rNode.GetDoc(), &rNewHint);
return false;
}
else
@@ -655,7 +655,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
// Split pOther if necessary:
if ( nOtherStart < nThisStart && nThisStart < nOtherEnd )
{
- SwTextAttr* pNewAttr = MakeTextAttr( *rNode.GetDoc(),
+ SwTextAttr* pNewAttr = MakeTextAttr( rNode.GetDoc(),
pOther->GetAttr(), nOtherStart, nThisStart );
if ( RES_TXTATR_CHARFMT == pOther->Which() )
{
@@ -675,7 +675,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
// Split pOther if necessary:
if ( nOtherStart < nThisEnd && nThisEnd < nOtherEnd )
{
- SwTextAttr* pNewAttr = MakeTextAttr( *rNode.GetDoc(),
+ SwTextAttr* pNewAttr = MakeTextAttr( rNode.GetDoc(),
pOther->GetAttr(), nOtherStart, nThisEnd );
if ( RES_TXTATR_CHARFMT == pOther->Which() )
{
@@ -699,7 +699,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
}
#ifdef DBG_UTIL
- if( !rNode.GetDoc()->IsInReading() )
+ if( !rNode.GetDoc().IsInReading() )
CHECK_NOTMERGED; // ignore flags not set properly yet, don't check them
#endif
@@ -782,7 +782,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
// #i90311#
// Do not remove existing character format hint during XML import
- if ( !rNode.GetDoc()->IsInXMLImport() &&
+ if ( !rNode.GetDoc().IsInXMLImport() &&
( !( SetAttrMode::DONTREPLACE & nMode ) ||
bNoLengthAttribute ||
bSameCharFormat ) )
@@ -825,7 +825,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
// Create new AutoStyle
if ( aNewSet.Count() )
{
- pNewAttr = MakeTextAttr( *rNode.GetDoc(),
+ pNewAttr = MakeTextAttr( rNode.GetDoc(),
aNewSet, nPorStart, nPorEnd );
Insert( pNewAttr );
NoteInHistory( pNewAttr, true );
@@ -844,7 +844,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
}
else
{
- pNewAttr = MakeTextAttr( *rNode.GetDoc(), rNewHint.GetAttr(),
+ pNewAttr = MakeTextAttr( rNode.GetDoc(), rNewHint.GetAttr(),
nPorStart, nPorEnd );
static_txtattr_cast<SwTextCharFormat*>(pNewAttr)->SetSortNumber(nCharStyleCount);
}
@@ -899,7 +899,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
// Create new AutoStyle
if ( aNewSet.Count() )
- pNewAttr = MakeTextAttr( *rNode.GetDoc(), aNewSet,
+ pNewAttr = MakeTextAttr( rNode.GetDoc(), aNewSet,
nPorStart, nPorEnd );
}
else
@@ -956,7 +956,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
}
else if ( pNewStyle )
{
- pNewAttr = MakeTextAttr( *rNode.GetDoc(), *pNewStyle,
+ pNewAttr = MakeTextAttr( rNode.GetDoc(), *pNewStyle,
nPorStart, nPorEnd );
}
}
@@ -1150,14 +1150,14 @@ void SwTextNode::DestroyAttr( SwTextAttr* pAttr )
return;
// some things need to be done before deleting the formatting attribute
- SwDoc* pDoc = GetDoc();
+ SwDoc& rDoc = GetDoc();
switch( pAttr->Which() )
{
case RES_TXTATR_FLYCNT:
{
SwFrameFormat* pFormat = pAttr->GetFlyCnt().GetFrameFormat();
if( pFormat ) // set to 0 by Undo?
- pDoc->getIDocumentLayoutAccess().DelLayoutFormat( pFormat );
+ rDoc.getIDocumentLayoutAccess().DelLayoutFormat( pFormat );
}
break;
@@ -1173,7 +1173,7 @@ void SwTextNode::DestroyAttr( SwTextAttr* pAttr )
case RES_TXTATR_FIELD:
case RES_TXTATR_ANNOTATION:
case RES_TXTATR_INPUTFIELD:
- if( !pDoc->IsInDtor() )
+ if( !rDoc.IsInDtor() )
{
SwTextField *const pTextField(static_txtattr_cast<SwTextField*>(pAttr));
SwFieldType* pFieldType = pAttr->GetFormatField().GetField()->GetTyp();
@@ -1185,7 +1185,7 @@ void SwTextNode::DestroyAttr( SwTextAttr* pAttr )
// certain fields must update the SwDoc's calculation flags
// Certain fields (like HiddenParaField) must trigger recalculation of visible flag
- if (GetDoc()->FieldCanHideParaWeight(pFieldType->Which()))
+ if (GetDoc().FieldCanHideParaWeight(pFieldType->Which()))
SetCalcHiddenParaField();
switch( pFieldType->Which() )
@@ -1198,8 +1198,8 @@ void SwTextNode::DestroyAttr( SwTextAttr* pAttr )
case SwFieldIds::HiddenText:
case SwFieldIds::DbNumSet:
case SwFieldIds::DbNextSet:
- if( !pDoc->getIDocumentFieldsAccess().IsNewFieldLst() && GetNodes().IsDocNodes() )
- pDoc->getIDocumentFieldsAccess().InsDelFieldInFieldLst(false, *pTextField);
+ if( !rDoc.getIDocumentFieldsAccess().IsNewFieldLst() && GetNodes().IsDocNodes() )
+ rDoc.getIDocumentFieldsAccess().InsDelFieldInFieldLst(false, *pTextField);
break;
case SwFieldIds::Dde:
if (GetNodes().IsDocNodes() && pTextField->GetpTextNode())
@@ -1232,7 +1232,7 @@ void SwTextNode::DestroyAttr( SwTextAttr* pAttr )
SwFormatMeta & rFormatMeta( static_cast<SwFormatMeta &>(pTextMeta->GetAttr()) );
if (::sw::Meta* pMeta = rFormatMeta.GetMeta())
{
- if (SwDocShell* pDocSh = pDoc->GetDocShell())
+ if (SwDocShell* pDocSh = rDoc.GetDocShell())
{
static constexpr OUStringLiteral metaNS(u"urn:bails");
const css::uno::Reference<css::rdf::XResource> xSubject = pMeta->MakeUnoObject();
@@ -1249,7 +1249,7 @@ void SwTextNode::DestroyAttr( SwTextAttr* pAttr )
break;
}
- SwTextAttr::Destroy( pAttr, pDoc->GetAttrPool() );
+ SwTextAttr::Destroy( pAttr, rDoc.GetAttrPool() );
}
SwTextAttr* SwTextNode::InsertItem(
@@ -1264,7 +1264,7 @@ SwTextAttr* SwTextNode::InsertItem(
SwTextAttr *const pNew =
MakeTextAttr(
- *GetDoc(),
+ GetDoc(),
rAttr,
nStart,
nEnd,
@@ -1389,8 +1389,8 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, const SetAttrMode nMode )
case RES_TXTATR_FTN :
{
// Footnotes: create text node and put it into Inserts-section
- SwDoc *pDoc = GetDoc();
- SwNodes &rNodes = pDoc->GetNodes();
+ SwDoc& rDoc = GetDoc();
+ SwNodes &rNodes = rDoc.GetNodes();
// check that footnote is inserted into body or redline section
if( StartOfSectionIndex() < rNodes.GetEndOfAutotext().GetIndex() )
@@ -1462,12 +1462,12 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, const SetAttrMode nMode )
if( !bNewFootnote )
{
// moving an existing footnote (e.g. SplitNode)
- for( size_t n = 0; n < pDoc->GetFootnoteIdxs().size(); ++n )
- if( pAttr == pDoc->GetFootnoteIdxs()[n] )
+ for( size_t n = 0; n < rDoc.GetFootnoteIdxs().size(); ++n )
+ if( pAttr == rDoc.GetFootnoteIdxs()[n] )
{
// assign new index by removing and re-inserting
- pTextFootnote = pDoc->GetFootnoteIdxs()[n];
- pDoc->GetFootnoteIdxs().erase( pDoc->GetFootnoteIdxs().begin() + n );
+ pTextFootnote = rDoc.GetFootnoteIdxs()[n];
+ rDoc.GetFootnoteIdxs().erase( rDoc.GetFootnoteIdxs().begin() + n );
break;
}
// if the Undo set the StartNode, the Index isn't
@@ -1482,11 +1482,11 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, const SetAttrMode nMode )
// do not insert footnote in redline section into footnote array
if( StartOfSectionIndex() > rNodes.GetEndOfRedlines().GetIndex() )
{
- const bool bSuccess = pDoc->GetFootnoteIdxs().insert(pTextFootnote).second;
+ const bool bSuccess = rDoc.GetFootnoteIdxs().insert(pTextFootnote).second;
OSL_ENSURE( bSuccess, "FootnoteIdx not inserted." );
}
SwNodeIndex aTmpIndex( *this );
- pDoc->GetFootnoteIdxs().UpdateFootnote( aTmpIndex);
+ rDoc.GetFootnoteIdxs().UpdateFootnote( aTmpIndex);
static_cast<SwTextFootnote*>(pAttr)->SetSeqRefNo();
}
break;
@@ -1494,7 +1494,7 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, const SetAttrMode nMode )
case RES_TXTATR_FIELD:
{
// trigger notification for relevant fields, like HiddenParaFields
- if (GetDoc()->FieldCanHideParaWeight(
+ if (GetDoc().FieldCanHideParaWeight(
pAttr->GetFormatField().GetField()->GetTyp()->Which()))
{
bHiddenPara = true;
@@ -1693,7 +1693,7 @@ void SwTextNode::DeleteAttribute( SwTextAttr * const pAttr )
pAttr->Which());
m_pSwpHints->Delete( pAttr );
- SwTextAttr::Destroy( pAttr, GetDoc()->GetAttrPool() );
+ SwTextAttr::Destroy( pAttr, GetDoc().GetAttrPool() );
NotifyClients( nullptr, &aHint );
TryDeleteSwpHints();
@@ -1769,7 +1769,7 @@ void SwTextNode::DeleteAttributes(
nWhich);
m_pSwpHints->DeleteAtPos( nPos );
- SwTextAttr::Destroy( pTextHt, GetDoc()->GetAttrPool() );
+ SwTextAttr::Destroy( pTextHt, GetDoc().GetAttrPool() );
NotifyClients( nullptr, &aHint );
}
}
@@ -1942,7 +1942,7 @@ bool SwTextNode::SetAttr(
if ( isCHRATR(nWhich) || isTXTATR(nWhich) )
{
if ((RES_TXTATR_CHARFMT == nWhich) &&
- (GetDoc()->GetDfltCharFormat() ==
+ (GetDoc().GetDfltCharFormat() ==
static_cast<const SwFormatCharFormat*>(pItem)->GetCharFormat()))
{
SwIndex aIndex( this, nStt );
@@ -1959,7 +1959,7 @@ bool SwTextNode::SetAttr(
else
{
- SwTextAttr *const pNew = MakeTextAttr( *GetDoc(),
+ SwTextAttr *const pNew = MakeTextAttr( GetDoc(),
const_cast<SfxPoolItem&>(*pItem), nStt, nEnd );
if ( pNew )
{
@@ -1985,7 +1985,7 @@ bool SwTextNode::SetAttr(
if ( aCharSet.Count() )
{
- SwTextAttr* pTmpNew = MakeTextAttr( *GetDoc(), aCharSet, nStt, nEnd );
+ SwTextAttr* pTmpNew = MakeTextAttr( GetDoc(), aCharSet, nStt, nEnd );
if ( InsertHint( pTmpNew, nMode ) )
{
++nCount;
@@ -2476,7 +2476,7 @@ SwTextNode::impl_FormatToTextAttr(const SfxItemSet& i_rAttrSet)
DestroyAttr(pAutoStyle);
}
m_pSwpHints->Insert(
- MakeTextAttr(*GetDoc(), aCurSet,
+ MakeTextAttr(GetDoc(), aCurSet,
aCurRange->first.first, aCurRange->first.second));
}
@@ -2494,7 +2494,7 @@ SwTextNode::impl_FormatToTextAttr(const SfxItemSet& i_rAttrSet)
void SwTextNode::FormatToTextAttr( SwTextNode* pNd )
{
- SfxItemSet aThisSet( GetDoc()->GetAttrPool(), aCharFormatSetRange );
+ SfxItemSet aThisSet( GetDoc().GetAttrPool(), aCharFormatSetRange );
if( HasSwAttrSet() && GetpSwAttrSet()->Count() )
aThisSet.Put( *GetpSwAttrSet() );
@@ -2517,7 +2517,7 @@ void SwTextNode::FormatToTextAttr( SwTextNode* pNd )
// 4 a a clear item in this
// 5 a b convert item to attr of this
- SfxItemSet aNdSet( pNd->GetDoc()->GetAttrPool(), aCharFormatSetRange );
+ SfxItemSet aNdSet( pNd->GetDoc().GetAttrPool(), aCharFormatSetRange );
if( pNd->HasSwAttrSet() && pNd->GetpSwAttrSet()->Count() )
aNdSet.Put( *pNd->GetpSwAttrSet() );
@@ -2529,7 +2529,7 @@ void SwTextNode::FormatToTextAttr( SwTextNode* pNd )
{
SfxItemIter aIter( aThisSet );
const SfxPoolItem* pItem = aIter.GetCurItem(), *pNdItem = nullptr;
- SfxItemSet aConvertSet( GetDoc()->GetAttrPool(), aCharFormatSetRange );
+ SfxItemSet aConvertSet( GetDoc().GetAttrPool(), aCharFormatSetRange );
std::vector<sal_uInt16> aClearWhichIds;
do
@@ -2628,18 +2628,18 @@ bool SwpHints::CalcHiddenParaField() const
{
// see also SwTextFrame::IsHiddenNow()
const SwFormatField& rField = pTextHt->GetFormatField();
- int nCurWeight = m_rParent.GetDoc()->FieldCanHideParaWeight(rField.GetField()->GetTyp()->Which());
+ int nCurWeight = m_rParent.GetDoc().FieldCanHideParaWeight(rField.GetField()->GetTyp()->Which());
if (nCurWeight > nNewResultWeight)
{
nNewResultWeight = nCurWeight;
- bNewHiddenByParaField = m_rParent.GetDoc()->FieldHidesPara(*rField.GetField());
+ bNewHiddenByParaField = m_rParent.GetDoc().FieldHidesPara(*rField.GetField());
}
else if (nCurWeight == nNewResultWeight && bNewHiddenByParaField)
{
// Currently, for both supported hiding types (HiddenPara, Database), "Don't hide"
// takes precedence - i.e., if there's a "Don't hide" field of that weight, we only
// care about fields of higher weight.
- bNewHiddenByParaField = m_rParent.GetDoc()->FieldHidesPara(*rField.GetField());
+ bNewHiddenByParaField = m_rParent.GetDoc().FieldHidesPara(*rField.GetField());
}
}
}
@@ -2690,7 +2690,7 @@ bool SwpHints::MergePortions( SwTextNode& rNode )
if (pHt->GetStart() == *pHt->GetEnd())
{
DeleteAtPos(i); // kill it without History!
- SwTextAttr::Destroy(pHt, rNode.GetDoc()->GetAttrPool());
+ SwTextAttr::Destroy(pHt, rNode.GetDoc().GetAttrPool());
--i;
continue;
}
@@ -3034,10 +3034,10 @@ bool SwpHints::TryInsertHint(
SwTextField *const pTextField(static_txtattr_cast<SwTextField*>(pHint));
bool bDelFirst = nullptr != pTextField->GetpTextNode();
pTextField->ChgTextNode( &rNode );
- SwDoc* pDoc = rNode.GetDoc();
+ SwDoc& rDoc = rNode.GetDoc();
const SwField* pField = pTextField->GetFormatField().GetField();
- if( !pDoc->getIDocumentFieldsAccess().IsNewFieldLst() )
+ if( !rDoc.getIDocumentFieldsAccess().IsNewFieldLst() )
{
// certain fields must update the SwDoc's calculation flags
switch( pField->GetTyp()->Which() )
@@ -3050,9 +3050,9 @@ bool SwpHints::TryInsertHint(
case SwFieldIds::DbNextSet:
{
if( bDelFirst )
- pDoc->getIDocumentFieldsAccess().InsDelFieldInFieldLst(false, *pTextField);
+ rDoc.getIDocumentFieldsAccess().InsDelFieldInFieldLst(false, *pTextField);
if( rNode.GetNodes().IsDocNodes() )
- pDoc->getIDocumentFieldsAccess().InsDelFieldInFieldLst(true, *pTextField);
+ rDoc.getIDocumentFieldsAccess().InsDelFieldInFieldLst(true, *pTextField);
}
break;
case SwFieldIds::Dde:
@@ -3076,7 +3076,7 @@ bool SwpHints::TryInsertHint(
// register the field at its FieldType before setting
// the sequence reference number!
SwSetExpFieldType* pFieldType = static_cast<SwSetExpFieldType*>(
- pDoc->getIDocumentFieldsAccess().InsertFieldType( *pField->GetTyp() ) );
+ rDoc.getIDocumentFieldsAccess().InsertFieldType( *pField->GetTyp() ) );
if( pFieldType != pField->GetTyp() )
{
SwFormatField* pFormatField = const_cast<SwFormatField*>(&pTextField->GetFormatField());
@@ -3091,22 +3091,22 @@ bool SwpHints::TryInsertHint(
break;
case SwFieldIds::Dde:
- if( pDoc->getIDocumentFieldsAccess().IsNewFieldLst() )
+ if( rDoc.getIDocumentFieldsAccess().IsNewFieldLst() )
static_cast<SwDDEFieldType*>(pField->GetTyp())->IncRefCnt();
bInsFieldType = static_cast<SwDDEFieldType*>(pField->GetTyp())->IsDeleted();
break;
case SwFieldIds::Postit:
- if ( pDoc->GetDocShell() )
+ if ( rDoc.GetDocShell() )
{
- pDoc->GetDocShell()->Broadcast( SwFormatFieldHint(
+ rDoc.GetDocShell()->Broadcast( SwFormatFieldHint(
&pTextField->GetFormatField(), SwFormatFieldHintWhich::INSERTED));
}
break;
default: break;
}
if( bInsFieldType )
- pDoc->getIDocumentFieldsAccess().InsDeletedFieldType( *pField->GetTyp() );
+ rDoc.getIDocumentFieldsAccess().InsDeletedFieldType( *pField->GetTyp() );
}
}
break;
@@ -3195,7 +3195,7 @@ bool SwpHints::TryInsertHint(
NoteInHistory(pHint, true);
CalcFlags();
#ifdef DBG_UTIL
- if( !rNode.GetDoc()->IsInReading() )
+ if( !rNode.GetDoc().IsInReading() )
CHECK;
#endif
// ... and notify listeners
@@ -3242,13 +3242,13 @@ bool SwpHints::TryInsertHint(
// Portion building in not necessary during XML import.
else if ( !bNoHintAdjustMode &&
!pHint->IsOverlapAllowedAttr() &&
- !rNode.GetDoc()->IsInXMLImport() &&
+ !rNode.GetDoc().IsInXMLImport() &&
( RES_TXTATR_AUTOFMT == nWhich ||
RES_TXTATR_CHARFMT == nWhich ) )
{
assert( nWhich != RES_TXTATR_AUTOFMT ||
static_cast<const SwFormatAutoFormat&>(pHint->GetAttr()).GetStyleHandle()->GetPool() ==
- &rNode.GetDoc()->GetAttrPool());
+ &rNode.GetDoc().GetAttrPool());
BuildPortions( rNode, *pHint, nMode );
@@ -3289,7 +3289,7 @@ bool SwpHints::TryInsertHint(
}
#ifdef DBG_UTIL
- if( !bNoHintAdjustMode && !rNode.GetDoc()->IsInReading() )
+ if( !bNoHintAdjustMode && !rNode.GetDoc().IsInReading() )
CHECK;
#endif
@@ -3338,7 +3338,7 @@ void SwpHints::DeleteAtPos( const size_t nPos )
pTextField->ChgTextNode(nullptr);
}
else if (m_bHiddenByParaField
- && m_rParent.GetDoc()->FieldCanHideParaWeight(pFieldTyp->Which()))
+ && m_rParent.GetDoc().FieldCanHideParaWeight(pFieldTyp->Which()))
{
m_bCalcHiddenParaField = true;
}
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index dd036d07e6ac..2f4d75b3d713 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -114,10 +114,10 @@ SwCharFormat* SwTextINetFormat::GetCharFormat()
if (!rFormat.GetValue().isEmpty())
{
- SwDoc* pDoc = GetTextNode().GetDoc();
+ SwDoc& rDoc = GetTextNode().GetDoc();
if( !IsVisitedValid() )
{
- SetVisited( pDoc->IsVisitedURL( rFormat.GetValue() ) );
+ SetVisited( rDoc.IsVisitedURL( rFormat.GetValue() ) );
SetVisitedValid( true );
}
@@ -130,22 +130,22 @@ SwCharFormat* SwTextINetFormat::GetCharFormat()
// JP 10.02.2000, Bug 72806: don't modify the doc for getting the
// correct charstyle.
- bool bResetMod = !pDoc->getIDocumentState().IsModified();
+ bool bResetMod = !rDoc.getIDocumentState().IsModified();
Link<bool,void> aOle2Lnk;
if ( bResetMod )
{
- aOle2Lnk = pDoc->GetOle2Link();
- pDoc->SetOle2Link( Link<bool,void>() );
+ aOle2Lnk = rDoc.GetOle2Link();
+ rDoc.SetOle2Link( Link<bool,void>() );
}
pRet = IsPoolUserFormat( nId )
- ? pDoc->FindCharFormatByName( rStr )
- : pDoc->getIDocumentStylePoolAccess().GetCharFormatFromPool( nId );
+ ? rDoc.FindCharFormatByName( rStr )
+ : rDoc.getIDocumentStylePoolAccess().GetCharFormatFromPool( nId );
if ( bResetMod )
{
- pDoc->getIDocumentState().ResetModified();
- pDoc->SetOle2Link( aOle2Lnk );
+ rDoc.getIDocumentState().ResetModified();
+ rDoc.SetOle2Link( aOle2Lnk );
}
}
@@ -231,7 +231,7 @@ SwCharFormat* SwTextRuby::GetCharFormat()
if( !rFormat.GetText().isEmpty() )
{
- const SwDoc* pDoc = GetTextNode().GetDoc();
+ const SwDoc& rDoc = GetTextNode().GetDoc();
const OUString& rStr = rFormat.GetCharFormatName();
const sal_uInt16 nId = rStr.isEmpty()
? static_cast<sal_uInt16>(RES_POOLCHR_RUBYTEXT)
@@ -239,22 +239,22 @@ SwCharFormat* SwTextRuby::GetCharFormat()
// JP 10.02.2000, Bug 72806: don't modify the doc for getting the
// correct charstyle.
- const bool bResetMod = !pDoc->getIDocumentState().IsModified();
+ const bool bResetMod = !rDoc.getIDocumentState().IsModified();
Link<bool,void> aOle2Lnk;
if( bResetMod )
{
- aOle2Lnk = pDoc->GetOle2Link();
- const_cast<SwDoc*>(pDoc)->SetOle2Link( Link<bool,void>() );
+ aOle2Lnk = rDoc.GetOle2Link();
+ const_cast<SwDoc&>(rDoc).SetOle2Link( Link<bool,void>() );
}
pRet = IsPoolUserFormat( nId )
- ? pDoc->FindCharFormatByName( rStr )
- : const_cast<SwDoc*>(pDoc)->getIDocumentStylePoolAccess().GetCharFormatFromPool( nId );
+ ? rDoc.FindCharFormatByName( rStr )
+ : const_cast<SwDoc&>(rDoc).getIDocumentStylePoolAccess().GetCharFormatFromPool( nId );
if( bResetMod )
{
- const_cast<SwDoc*>(pDoc)->getIDocumentState().ResetModified();
- const_cast<SwDoc*>(pDoc)->SetOle2Link( aOle2Lnk );
+ const_cast<SwDoc&>(rDoc).getIDocumentState().ResetModified();
+ const_cast<SwDoc&>(rDoc).SetOle2Link( aOle2Lnk );
}
}
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index f67324fd2ea1..243683581d67 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -85,17 +85,14 @@ using namespace ::com::sun::star::smarttags;
namespace
{
- void DetectAndMarkMissingDictionaries( SwDoc* pDoc,
+ void DetectAndMarkMissingDictionaries( SwDoc& rDoc,
const uno::Reference< XSpellChecker1 >& xSpell,
const LanguageType eActLang )
{
- if( !pDoc )
- return;
-
if( xSpell.is() && !xSpell->hasLanguage( eActLang.get() ) )
- pDoc->SetMissingDictionaries( true );
+ rDoc.SetMissingDictionaries( true );
else
- pDoc->SetMissingDictionaries( false );
+ rDoc.SetMissingDictionaries( false );
}
}
@@ -141,7 +138,7 @@ lcl_MaskRedlines( const SwTextNode& rNode, OUStringBuffer& rText,
{
sal_Int32 nNumOfMaskedRedlines = 0;
- const SwDoc& rDoc = *rNode.GetDoc();
+ const SwDoc& rDoc = rNode.GetDoc();
for ( SwRedlineTable::size_type nAct = rDoc.getIDocumentRedlineAccess().GetRedlinePos( rNode, RedlineType::Any ); nAct < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); ++nAct )
{
@@ -186,7 +183,7 @@ lcl_MaskRedlinesAndHiddenText( const SwTextNode& rNode, OUStringBuffer& rText,
sal_Int32 nRedlinesMasked = 0;
sal_Int32 nHiddenCharsMasked = 0;
- const SwDoc& rDoc = *rNode.GetDoc();
+ const SwDoc& rDoc = rNode.GetDoc();
const bool bShowChg = IDocumentRedlineAccess::IsShowChanges( rDoc.getIDocumentRedlineAccess().GetRedlineFlags() );
// If called from word count or from spell checking, deleted redlines
@@ -495,7 +492,7 @@ void SwTextNode::RstTextAttr(
if ( pStyleHandle )
{
- SwTextAttr* pNew = MakeTextAttr( *GetDoc(),
+ SwTextAttr* pNew = MakeTextAttr( GetDoc(),
*pStyleHandle, nAttrStart, nAttrEnd );
newAttributes.push_back(pNew);
}
@@ -510,7 +507,7 @@ void SwTextNode::RstTextAttr(
if ( pStyleHandle && nAttrStart < nEnd )
{
- SwTextAttr* pNew = MakeTextAttr( *GetDoc(),
+ SwTextAttr* pNew = MakeTextAttr( GetDoc(),
*pStyleHandle, nAttrStart, nEnd );
newAttributes.push_back(pNew);
}
@@ -538,7 +535,7 @@ void SwTextNode::RstTextAttr(
if ( pStyleHandle )
{
- SwTextAttr* pNew = MakeTextAttr( *GetDoc(),
+ SwTextAttr* pNew = MakeTextAttr( GetDoc(),
*pStyleHandle, nStt, nAttrEnd );
newAttributes.push_back(pNew);
}
@@ -560,14 +557,14 @@ void SwTextNode::RstTextAttr(
if ( pStyleHandle && nStt < nEnd )
{
- SwTextAttr* pNew = MakeTextAttr( *GetDoc(),
+ SwTextAttr* pNew = MakeTextAttr( GetDoc(),
*pStyleHandle, nStt, nEnd );
newAttributes.push_back(pNew);
}
if( nEnd < nTmpEnd )
{
- SwTextAttr* pNew = MakeTextAttr( *GetDoc(),
+ SwTextAttr* pNew = MakeTextAttr( GetDoc(),
pHt->GetAttr(), nEnd, nTmpEnd );
if ( pNew )
{
@@ -1075,7 +1072,7 @@ void SwTextNode::SetLanguageAndFont( const SwPaM &rPaM,
if (!pFont)
aRanges[2] = aRanges[3] = 0; // clear entries with font WhichId
- SwEditShell *pEditShell = GetDoc()->GetEditShell();
+ SwEditShell *pEditShell = GetDoc().GetEditShell();
SfxItemSet aSet( pEditShell->GetAttrPool(), aRanges );
aSet.Put( SvxLanguageItem( nLang, nLangWhichId ) );
@@ -1091,7 +1088,7 @@ void SwTextNode::SetLanguageAndFont( const SwPaM &rPaM,
aSet.Put( aFontItem );
}
- GetDoc()->getIDocumentContentOperations().InsertItemSet( rPaM, aSet );
+ GetDoc().getIDocumentContentOperations().InsertItemSet( rPaM, aSet );
// SetAttr( aSet ); <- Does not set language attribute of empty paragraphs correctly,
// <- because since there is no selection the flag to garbage
// <- collect all attributes is set, and therefore attributes spanned
@@ -1178,7 +1175,7 @@ bool SwTextNode::Convert( SwConversionArgs &rArgs )
aCurPaM.GetPoint()->nContent = nBegin + nLen;
// check script type of selected text
- SwEditShell *pEditShell = GetDoc()->GetEditShell();
+ SwEditShell *pEditShell = GetDoc().GetEditShell();
pEditShell->Push(); // save current cursor on stack
pEditShell->SetSelection( aCurPaM );
bool bIsAsianScript = (SvtScriptType::ASIAN == pEditShell->GetScriptType());
@@ -1306,7 +1303,7 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, sal_Int32 nActPos)
if( bFresh )
{
uno::Reference< XSpellChecker1 > xSpell( ::GetSpellChecker() );
- SwDoc* pDoc = pNode->GetDoc();
+ SwDoc& rDoc = pNode->GetDoc();
SwScanner aScanner( *pNode, pNode->GetText(), nullptr, ModelToViewHelper(),
WordType::DICTIONARY_WORD, nBegin, nEnd);
@@ -1320,7 +1317,7 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, sal_Int32 nActPos)
// get next language for next word, consider language attributes
// within the word
LanguageType eActLang = aScanner.GetCurrentLanguage();
- DetectAndMarkMissingDictionaries( pDoc, xSpell, eActLang );
+ DetectAndMarkMissingDictionaries( rDoc, xSpell, eActLang );
bool bSpell = xSpell.is() && xSpell->hasLanguage( static_cast<sal_uInt16>(eActLang) );
if( bSpell && !rWord.isEmpty() )
@@ -1358,7 +1355,7 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, sal_Int32 nActPos)
}
else if( bAddAutoCmpl && rACW.GetMinWordLen() <= rWord.getLength() )
{
- rACW.InsertWord( rWord, *pDoc );
+ rACW.InsertWord( rWord, rDoc );
}
}
}
@@ -1475,11 +1472,11 @@ SwRect SwTextFrame::SmartTagScan(SwTextNode & rNode)
uno::Reference<text::XTextMarkup> const xTextMarkup =
new SwXTextMarkup(pNode, aConversionMap);
- css::uno::Reference< css::frame::XController > xController = pNode->GetDoc()->GetDocShell()->GetController();
+ css::uno::Reference< css::frame::XController > xController = pNode->GetDoc().GetDocShell()->GetController();
SwPosition start(*pNode, nBegin);
SwPosition end (*pNode, nEnd);
- Reference< css::text::XTextRange > xRange = SwXTextRange::CreateXTextRange(*pNode->GetDoc(), start, &end);
+ Reference< css::text::XTextRange > xRange = SwXTextRange::CreateXTextRange(pNode->GetDoc(), start, &end);
rSmartTagMgr.RecognizeTextRange(xRange, xTextMarkup, xController);
@@ -1539,7 +1536,7 @@ void SwTextFrame::CollectAutoCmplWrds(SwTextNode & rNode, sal_Int32 nActPos)
if (!nActPos)
nActPos = COMPLETE_STRING;
- SwDoc* pDoc = pNode->GetDoc();
+ SwDoc& rDoc = pNode->GetDoc();
SwAutoCompleteWord& rACW = SwDoc::GetAutoCompleteWords();
sal_Int32 nBegin = 0;
@@ -1563,7 +1560,7 @@ void SwTextFrame::CollectAutoCmplWrds(SwTextNode & rNode, sal_Int32 nActPos)
if( nActPos < nBegin || ( nBegin + nLen ) < nActPos )
{
if( rACW.GetMinWordLen() <= rWord.getLength() )
- rACW.InsertWord( rWord, *pDoc );
+ rACW.InsertWord( rWord, rDoc );
}
else
bACWDirty = true;
@@ -1627,7 +1624,7 @@ bool SwTextNode::Hyphenate( SwInterHyphInfo &rHyphInf )
tmp.second = true;
}
return static_cast<SwTextFrame*>(this->getLayoutFrame(
- this->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(),
+ this->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(),
nullptr, pPoint ? &tmp : nullptr));
});
if (!pFrame)
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index f26980f752f6..f8732386da21 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -284,14 +284,14 @@ SwHistorySetTextField::SwHistorySetTextField( const SwTextField* pTextField, sal
, m_pField( new SwFormatField( *pTextField->GetFormatField().GetField() ) )
{
// only copy if not Sys-FieldType
- SwDoc* pDoc = pTextField->GetTextNode().GetDoc();
+ SwDoc& rDoc = pTextField->GetTextNode().GetDoc();
m_nFieldWhich = m_pField->GetField()->GetTyp()->Which();
if (m_nFieldWhich == SwFieldIds::Database ||
m_nFieldWhich == SwFieldIds::User ||
m_nFieldWhich == SwFieldIds::SetExp ||
m_nFieldWhich == SwFieldIds::Dde ||
- !pDoc->getIDocumentFieldsAccess().GetSysFieldType( m_nFieldWhich ))
+ !rDoc.getIDocumentFieldsAccess().GetSysFieldType( m_nFieldWhich ))
{
m_pFieldType = m_pField->GetField()->GetTyp()->Copy();
m_pField->GetField()->ChgTyp( m_pFieldType.get() ); // change field type
@@ -450,8 +450,8 @@ SwHistorySetFootnote::SwHistorySetFootnote( SwTextFootnote* pTextFootnote, sal_u
// keep the old NodePos (because who knows what later will be saved/deleted
// in SaveSection)
- SwDoc* pDoc = const_cast<SwDoc*>(pTextFootnote->GetTextNode().GetDoc());
- SwNode* pSaveNd = pDoc->GetNodes()[ m_nNodeIndex ];
+ SwDoc& rDoc = const_cast<SwDoc&>(pTextFootnote->GetTextNode().GetDoc());
+ SwNode* pSaveNd = rDoc.GetNodes()[ m_nNodeIndex ];
// keep pointer to StartNode of FootnoteSection and reset its attribute for now
// (as a result, its/all Frames will be deleted automatically)
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 18df69ee728c..9e0f4cf1de76 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -866,18 +866,18 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark,
const SwPosition *pStt = rMark < rPoint ? &rMark : &rPoint,
*pEnd = &rMark == pStt ? &rPoint : &rMark;
- SwDoc* pDoc = rMark.nNode.GetNode().GetDoc();
+ SwDoc& rDoc = rMark.nNode.GetNode().GetDoc();
// if it's not in the doc array, probably missing some invalidation somewhere
- assert(&rPoint.nNode.GetNodes() == &pDoc->GetNodes());
- assert(&rMark.nNode.GetNodes() == &pDoc->GetNodes());
+ assert(&rPoint.nNode.GetNodes() == &rDoc.GetNodes());
+ assert(&rMark.nNode.GetNodes() == &rDoc.GetNodes());
- ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+ ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
// 1. Footnotes
if( DelContentType::Ftn & nDelContentType )
{
- SwFootnoteIdxs& rFootnoteArr = pDoc->GetFootnoteIdxs();
+ SwFootnoteIdxs& rFootnoteArr = rDoc.GetFootnoteIdxs();
if( !rFootnoteArr.empty() )
{
const SwNode* pFootnoteNd;
@@ -948,7 +948,7 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark,
if( DelContentType::Fly & nDelContentType )
{
sal_uInt16 nChainInsPos = m_pHistory ? m_pHistory->Count() : 0;
- const SwFrameFormats& rSpzArr = *pDoc->GetSpzFrameFormats();
+ const SwFrameFormats& rSpzArr = *rDoc.GetSpzFrameFormats();
if( !rSpzArr.empty() )
{
SwFrameFormat* pFormat;
@@ -1073,7 +1073,7 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark,
if( !(DelContentType::Bkm & nDelContentType) )
return;
- IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
+ IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess();
if( !pMarkAccess->getAllMarksCount() )
return;
@@ -1357,7 +1357,7 @@ SwRedlineSaveData::SwRedlineSaveData(
}
#if OSL_DEBUG_LEVEL > 0
- m_nRedlineCount = rSttPos.nNode.GetNode().GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().size();
+ m_nRedlineCount = rSttPos.nNode.GetNode().GetDoc().getIDocumentRedlineAccess().GetRedlineTable().size();
#endif
}
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index dc5303c16808..636680d105e0 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -85,7 +85,7 @@ std::optional<OUString> SwUndoInsert::GetTextFromDoc() const
void SwUndoInsert::Init(const SwNodeIndex & rNd)
{
// consider Redline
- m_pDoc = rNd.GetNode().GetDoc();
+ m_pDoc = &rNd.GetNode().GetDoc();
if( m_pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
m_pRedlData.reset( new SwRedlineData( RedlineType::Insert,
@@ -102,7 +102,7 @@ SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd, sal_Int32 nCnt,
sal_Int32 nL,
const SwInsertFlags nInsertFlags,
bool bWDelim )
- : SwUndo(SwUndoId::TYPING, rNd.GetNode().GetDoc()),
+ : SwUndo(SwUndoId::TYPING, &rNd.GetNode().GetDoc()),
m_nNode( rNd.GetIndex() ), m_nContent(nCnt), m_nLen(nL),
m_bIsWordDelim( bWDelim ), m_bIsAppend( false )
, m_bWithRsid(false)
@@ -112,7 +112,7 @@ SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd, sal_Int32 nCnt,
}
SwUndoInsert::SwUndoInsert( const SwNodeIndex& rNd )
- : SwUndo(SwUndoId::SPLITNODE, rNd.GetNode().GetDoc()),
+ : SwUndo(SwUndoId::SPLITNODE, &rNd.GetNode().GetDoc()),
m_nNode( rNd.GetIndex() ), m_nContent(0), m_nLen(1),
m_bIsWordDelim( false ), m_bIsAppend( true )
, m_bWithRsid(false)
@@ -148,7 +148,7 @@ bool SwUndoInsert::CanGrouping( const SwPosition& rPos )
m_nContent == rPos.nContent.GetIndex() )
{
// consider Redline
- SwDoc& rDoc = *rPos.nNode.GetNode().GetDoc();
+ SwDoc& rDoc = rPos.nNode.GetNode().GetDoc();
if( ( ~RedlineFlags::ShowMask & rDoc.getIDocumentRedlineAccess().GetRedlineFlags() ) ==
( ~RedlineFlags::ShowMask & GetRedlineFlags() ) )
{
diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx
index b3cc01c56476..2a1f917f7a2a 100644
--- a/sw/source/core/undo/unnum.cxx
+++ b/sw/source/core/undo/unnum.cxx
@@ -45,7 +45,7 @@ SwUndoInsNum::SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule )
SwUndoInsNum::SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule,
const OUString& rReplaceRule )
- : SwUndo( SwUndoId::INSNUM, rPos.nNode.GetNode().GetDoc() ),
+ : SwUndo( SwUndoId::INSNUM, &rPos.nNode.GetNode().GetDoc() ),
m_aNumRule( rRule ),
m_sReplaceRule( rReplaceRule ), m_nLRSavePos( 0 )
{
@@ -279,7 +279,7 @@ void SwUndoNumUpDown::RepeatImpl(::sw::RepeatContext & rContext)
SwUndoNumOrNoNum::SwUndoNumOrNoNum( const SwNodeIndex& rIdx, bool bOldNum,
bool bNewNum)
- : SwUndo( SwUndoId::NUMORNONUM, rIdx.GetNode().GetDoc() ),
+ : SwUndo( SwUndoId::NUMORNONUM, &rIdx.GetNode().GetDoc() ),
m_nIndex( rIdx.GetIndex() ), mbNewNum(bNewNum),
mbOldNum(bOldNum)
{
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index 4d40d20fbc05..cbb09c136387 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -445,7 +445,7 @@ MakeUndoUpdateSection(SwSectionFormat const& rFormat, bool const bOnlyAttr)
SwUndoUpdateSection::SwUndoUpdateSection(
SwSection const& rSection, SwNodeIndex const*const pIndex,
bool const bOnlyAttr)
- : SwUndo( SwUndoId::CHGSECTION, pIndex->GetNode().GetDoc() )
+ : SwUndo( SwUndoId::CHGSECTION, &pIndex->GetNode().GetDoc() )
, m_pSectionData( new SwSectionData(rSection) )
, m_pAttrSet( ::lcl_GetAttrSet(rSection) )
, m_nStartNode( pIndex->GetIndex() )
diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx
index 682ede12c95f..0ae3bd9e7493 100644
--- a/sw/source/core/undo/unsort.cxx
+++ b/sw/source/core/undo/unsort.cxx
@@ -51,7 +51,7 @@ SwUndoSort::SwUndoSort(const SwPaM& rRg, const SwSortOptions& rOpt)
SwUndoSort::SwUndoSort( sal_uLong nStt, sal_uLong nEnd, const SwTableNode& rTableNd,
const SwSortOptions& rOpt, bool bSaveTable )
- : SwUndo(SwUndoId::SORT_TBL, rTableNd.GetDoc())
+ : SwUndo(SwUndoId::SORT_TBL, &rTableNd.GetDoc())
{
m_nSttNode = nStt;
m_nEndNode = nEnd;
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 2706e7ce243c..2e8031631cef 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -235,7 +235,7 @@ SwUndoInsTable::SwUndoInsTable( const SwPosition& rPos, sal_uInt16 nCl, sal_uInt
m_pAutoFormat.reset( new SwTableAutoFormat( *pTAFormat ) );
// consider redline
- SwDoc& rDoc = *rPos.nNode.GetNode().GetDoc();
+ SwDoc& rDoc = rPos.nNode.GetNode().GetDoc();
if( rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
{
m_pRedlineData.reset( new SwRedlineData( RedlineType::Insert, rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() ) );
@@ -415,7 +415,7 @@ SwUndoTableToText::SwUndoTableToText( const SwTable& rTable, sal_Unicode cCh )
const SwTableNode* pTableNd = rTable.GetTableNode();
sal_uLong nTableStt = pTableNd->GetIndex(), nTableEnd = pTableNd->EndOfSectionIndex();
- const SwFrameFormats& rFrameFormatTable = *pTableNd->GetDoc()->GetSpzFrameFormats();
+ const SwFrameFormats& rFrameFormatTable = *pTableNd->GetDoc().GetSpzFrameFormats();
for( size_t n = 0; n < rFrameFormatTable.size(); ++n )
{
SwFrameFormat* pFormat = rFrameFormatTable[ n ];
@@ -1359,7 +1359,7 @@ void SaveBox::CreateNew( SwTable& rTable, SwTableLine& rParent, SaveTable& rSTab
// UndoObject for attribute changes on table
SwUndoAttrTable::SwUndoAttrTable( const SwTableNode& rTableNd, bool bClearTabCols )
- : SwUndo( SwUndoId::TABLE_ATTR, rTableNd.GetDoc() ),
+ : SwUndo( SwUndoId::TABLE_ATTR, &rTableNd.GetDoc() ),
m_nStartNode( rTableNd.GetIndex() )
{
m_bClearTableCol = bClearTabCols;
@@ -1397,7 +1397,7 @@ void SwUndoAttrTable::RedoImpl(::sw::UndoRedoContext & rContext)
// UndoObject for AutoFormat on Table
SwUndoTableAutoFormat::SwUndoTableAutoFormat( const SwTableNode& rTableNd,
const SwTableAutoFormat& rAFormat )
- : SwUndo( SwUndoId::TABLE_AUTOFMT, rTableNd.GetDoc() )
+ : SwUndo( SwUndoId::TABLE_AUTOFMT, &rTableNd.GetDoc() )
, m_TableStyleName(rTableNd.GetTable().GetTableStyleName())
, m_nStartNode( rTableNd.GetIndex() )
, m_bSaveContentAttr( false )
@@ -1409,7 +1409,7 @@ SwUndoTableAutoFormat::SwUndoTableAutoFormat( const SwTableNode& rTableNd,
{
// then also go over the ContentNodes of the EndBoxes and collect
// all paragraph attributes
- m_pSaveTable->SaveContentAttrs( const_cast<SwDoc*>(rTableNd.GetDoc()) );
+ m_pSaveTable->SaveContentAttrs( &const_cast<SwDoc&>(rTableNd.GetDoc()) );
m_bSaveContentAttr = true;
}
}
@@ -1472,7 +1472,7 @@ SwUndoTableNdsChg::SwUndoTableNdsChg( SwUndoId nAction,
const SwTableNode& rTableNd,
long nMn, long nMx,
sal_uInt16 nCnt, bool bFlg, bool bSmHght )
- : SwUndo( nAction, rTableNd.GetDoc() ),
+ : SwUndo( nAction, &rTableNd.GetDoc() ),
m_nMin( nMn ), m_nMax( nMx ),
m_nSttNode( rTableNd.GetIndex() ),
m_nCount( nCnt ),
@@ -2771,7 +2771,7 @@ void SwUndoCpyTable::RedoImpl(::sw::UndoRedoContext & rContext)
SwUndoSplitTable::SwUndoSplitTable( const SwTableNode& rTableNd,
std::unique_ptr<SwSaveRowSpan> pRowSp, SplitTable_HeadlineOption eMode, bool bNewSize )
- : SwUndo( SwUndoId::SPLIT_TABLE, rTableNd.GetDoc() ),
+ : SwUndo( SwUndoId::SPLIT_TABLE, &rTableNd.GetDoc() ),
m_nTableNode( rTableNd.GetIndex() ), m_nOffset( 0 ), mpSaveRowSpan( std::move(pRowSp) ),
m_nMode( eMode ), m_nFormulaEnd( 0 ), m_bCalcNewSize( bNewSize )
{
@@ -2904,7 +2904,7 @@ void SwUndoSplitTable::SaveFormula( SwHistory& rHistory )
SwUndoMergeTable::SwUndoMergeTable( const SwTableNode& rTableNd,
const SwTableNode& rDelTableNd,
bool bWithPrv, sal_uInt16 nMd )
- : SwUndo( SwUndoId::MERGE_TABLE, rTableNd.GetDoc() ),
+ : SwUndo( SwUndoId::MERGE_TABLE, &rTableNd.GetDoc() ),
m_nMode( nMd ), m_bWithPrev( bWithPrv )
{
// memorize end node of the last table cell that'll stay in position
diff --git a/sw/source/core/unocore/unocrsr.cxx b/sw/source/core/unocore/unocrsr.cxx
index 76bdb939b7a8..115326eabbf7 100644
--- a/sw/source/core/unocore/unocrsr.cxx
+++ b/sw/source/core/unocore/unocrsr.cxx
@@ -184,8 +184,8 @@ void SwUnoTableCursor::MakeBoxSels()
const SwContentNode* pCNd;
bool bMakeTableCursors = true;
if( GetPoint()->nNode.GetIndex() && GetMark()->nNode.GetIndex() &&
- nullptr != ( pCNd = GetContentNode() ) && pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) &&
- nullptr != ( pCNd = GetContentNode(false) ) && pCNd->getLayoutFrame( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ) )
+ nullptr != ( pCNd = GetContentNode() ) && pCNd->getLayoutFrame( pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() ) &&
+ nullptr != ( pCNd = GetContentNode(false) ) && pCNd->getLayoutFrame( pCNd->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout() ) )
bMakeTableCursors = GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->MakeTableCursors( *this );
if ( !bMakeTableCursors )
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 451c9cce7fa4..6727693d0bcf 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -664,7 +664,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry
{
if (pAny)
{
- uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(*pTextNode->GetDoc(), pTextNode);
+ uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode);
*pAny <<= xParagraph;
}
}
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 5a3fdbb38736..5242276dfdd3 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -2048,7 +2048,7 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
else if (pPortion)
pDoc = pPortion->GetCursor().GetDoc();
else if (pParagraph && pParagraph->GetTextNode())
- pDoc = pParagraph->GetTextNode()->GetDoc();
+ pDoc = &pParagraph->GetTextNode()->GetDoc();
}
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 87c8e7b1a876..cd1504545971 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1290,7 +1290,7 @@ void SwXTextField::TransmuteLeadToInputField(SwSetExpField & rField)
assert(tempFormat.Which() == (static_cast<SwSetExpField const*>(tempFormat.GetField())->GetInputFlag() ? RES_TXTATR_INPUTFIELD : RES_TXTATR_FIELD));
SwTextNode & rNode(pOldAttr->GetTextNode());
std::shared_ptr<SwPaM> pPamForTextField;
- IDocumentContentOperations & rIDCO(rNode.GetDoc()->getIDocumentContentOperations());
+ IDocumentContentOperations & rIDCO(rNode.GetDoc().getIDocumentContentOperations());
SwTextField::GetPamForTextField(*pOldAttr, pPamForTextField);
assert(pPamForTextField);
sal_Int32 const nStart(pPamForTextField->Start()->nContent.GetIndex());
@@ -1306,7 +1306,7 @@ void SwXTextField::TransmuteLeadToInputField(SwSetExpField & rField)
assert(static_cast<SwSetExpField const*>(rNewFormat.GetField())->GetInputFlag() == (dynamic_cast<SwTextInputField const*>(pNewAttr) != nullptr));
if (xField.is())
{
- pXField->m_pImpl->SetFormatField(const_cast<SwFormatField*>(&rNewFormat), rNode.GetDoc());
+ pXField->m_pImpl->SetFormatField(const_cast<SwFormatField*>(&rNewFormat), &rNode.GetDoc());
const_cast<SwFormatField&>(rNewFormat).SetXTextField(xField);
}
}
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
index ea3ae869c62d..5e405e9ec75c 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -258,11 +258,11 @@ void SAL_CALL SwXFlatParagraph::changeText(::sal_Int32 nPos, ::sal_Int32 nLen, c
SwPaM aPaM( *GetTextNode(), nPos, *GetTextNode(), nPos+nLen );
- UnoActionContext aAction( GetTextNode()->GetDoc() );
+ UnoActionContext aAction( &GetTextNode()->GetDoc() );
const uno::Reference< text::XTextRange > xRange =
SwXTextRange::CreateXTextRange(
- *GetTextNode()->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
+ GetTextNode()->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
if ( xPropSet.is() )
{
@@ -291,11 +291,11 @@ void SAL_CALL SwXFlatParagraph::changeAttributes(::sal_Int32 nPos, ::sal_Int32 n
SwPaM aPaM( *GetTextNode(), nPos, *GetTextNode(), nPos+nLen );
- UnoActionContext aAction( GetTextNode()->GetDoc() );
+ UnoActionContext aAction( &GetTextNode()->GetDoc() );
const uno::Reference< text::XTextRange > xRange =
SwXTextRange::CreateXTextRange(
- *GetTextNode()->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
+ GetTextNode()->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
if ( xPropSet.is() )
{
@@ -520,7 +520,7 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaAfter(co
return xRet;
SwTextNode* pNextTextNode = nullptr;
- const SwNodes& rNodes = pCurrentNode->GetDoc()->GetNodes();
+ const SwNodes& rNodes = pCurrentNode->GetDoc().GetNodes();
for( sal_uLong nCurrentNode = pCurrentNode->GetIndex() + 1; nCurrentNode < rNodes.Count(); ++nCurrentNode )
{
@@ -566,7 +566,7 @@ uno::Reference< text::XFlatParagraph > SwXFlatParagraphIterator::getParaBefore(c
return xRet;
SwTextNode* pPrevTextNode = nullptr;
- const SwNodes& rNodes = pCurrentNode->GetDoc()->GetNodes();
+ const SwNodes& rNodes = pCurrentNode->GetDoc().GetNodes();
for( sal_uLong nCurrentNode = pCurrentNode->GetIndex() - 1; nCurrentNode > 0; --nCurrentNode )
{
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 5d7b86fc37e0..5c7bffdc8663 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -3627,7 +3627,7 @@ void SwXOLEListener::modified( const lang::EventObject& /*rEvent*/ )
return;
}
pNd->SetOLESizeInvalid(true);
- pNd->GetDoc()->SetOLEObjModified();
+ pNd->GetDoc().SetOLEObjModified();
}
void SwXOLEListener::disposing( const lang::EventObject& rEvent )
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 58cf18b9cea0..b6b96608e6fb 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -144,20 +144,20 @@ void CollectFrameAtNode( const SwNodeIndex& rIdx,
// <false>: at-paragraph anchored objects are collected
// search all borders, images, and OLEs that are connected to the paragraph
- SwDoc* pDoc = rIdx.GetNode().GetDoc();
+ SwDoc& rDoc = rIdx.GetNode().GetDoc();
const auto nChkType = bAtCharAnchoredObjs ? RndStdIds::FLY_AT_CHAR : RndStdIds::FLY_AT_PARA;
const SwContentFrame* pCFrame;
const SwContentNode* pCNd;
- if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() &&
+ if( rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() &&
nullptr != (pCNd = rIdx.GetNode().GetContentNode()) &&
- nullptr != (pCFrame = pCNd->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout())) )
+ nullptr != (pCFrame = pCNd->getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout())) )
{
lcl_CollectFrameAtNodeWithLayout(pCFrame, rFrames, nChkType);
}
else
{
- const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats();
+ const SwFrameFormats& rFormats = *rDoc.GetSpzFrameFormats();
const size_t nSize = rFormats.size();
for ( size_t i = 0; i < nSize; i++)
{
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index d62ed4ab5710..2cf496283482 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -1186,7 +1186,7 @@ SwXParagraph::getPropertyDefault(const OUString& rPropertyName)
if(bBelowFrameAtrEnd || bDrawingLayerRange)
{
- const SfxPoolItem& rDefItem = rTextNode.GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID);
+ const SfxPoolItem& rDefItem = rTextNode.GetDoc().GetAttrPool().GetDefaultItem(pEntry->nWID);
rDefItem.QueryValue(aRet, pEntry->nMemberId);
}
@@ -1228,7 +1228,7 @@ void SAL_CALL SwXParagraph::dispose()
if (pTextNode)
{
SwCursor aCursor( SwPosition( *pTextNode ), nullptr );
- pTextNode->GetDoc()->getIDocumentContentOperations().DelFullPara(aCursor);
+ pTextNode->GetDoc().getIDocumentContentOperations().DelFullPara(aCursor);
lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
m_pImpl->m_EventListeners.disposeAndClear(ev);
}
@@ -1408,7 +1408,7 @@ uno::Reference<frame::XModel> SwXParagraph::GetModel()
SwTextNode *const pTextNode( m_pImpl->GetTextNode() );
if (pTextNode)
{
- SwDocShell const*const pShell( pTextNode->GetDoc()->GetDocShell() );
+ SwDocShell const*const pShell( pTextNode->GetDoc().GetDocShell() );
return pShell ? pShell->GetModel() : nullptr;
}
return nullptr;
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 581e8c7656c1..3d6cd98f3551 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -744,13 +744,13 @@ SwXMeta::CreateXMeta(::sw::Meta & rMeta,
SAL_WARN_IF(!pTextAttr, "sw.uno", "CreateXMeta: no text attr?");
if (!pTextAttr) { return nullptr; }
const SwPosition aPos(*pTextNode, pTextAttr->GetStart());
- xParentText.set( ::sw::CreateParentXText(*pTextNode->GetDoc(), aPos) );
+ xParentText.set( ::sw::CreateParentXText(pTextNode->GetDoc(), aPos) );
}
if (!xParentText.is()) { return nullptr; }
SwXMeta *const pXMeta( (RES_TXTATR_META == rMeta.GetFormatMeta()->Which())
- ? new SwXMeta (pTextNode->GetDoc(), &rMeta, xParentText,
+ ? new SwXMeta (&pTextNode->GetDoc(), &rMeta, xParentText,
std::move(pPortions))
- : new SwXMetaField(pTextNode->GetDoc(), &rMeta, xParentText,
+ : new SwXMetaField(&pTextNode->GetDoc(), &rMeta, xParentText,
std::move(pPortions)));
// this is why the constructor is private: need to acquire pXMeta here
xMeta.set(pXMeta);
@@ -924,8 +924,8 @@ SwXMeta::dispose()
{
// -1 because of CH_TXTATR
SwPaM aPam( *pTextNode, nMetaStart - 1, *pTextNode, nMetaEnd );
- SwDoc * const pDoc( pTextNode->GetDoc() );
- pDoc->getIDocumentContentOperations().DeleteAndJoin( aPam );
+ SwDoc& rDoc( pTextNode->GetDoc() );
+ rDoc.getIDocumentContentOperations().DeleteAndJoin( aPam );
// removal should call Modify and do the dispose
assert(m_pImpl->m_bIsDisposed);
@@ -1058,7 +1058,7 @@ SwXMeta::getAnchor()
const SwPosition start(*pTextNode, nMetaStart - 1); // -1 due to CH_TXTATR
const SwPosition end(*pTextNode, nMetaEnd);
- return SwXTextRange::CreateXTextRange(*pTextNode->GetDoc(), start, &end);
+ return SwXTextRange::CreateXTextRange(pTextNode->GetDoc(), start, &end);
}
// XTextRange
@@ -1237,7 +1237,7 @@ uno::Reference<frame::XModel> SwXMeta::GetModel()
SwTextNode const * const pTextNode( pMeta->GetTextNode() );
if (pTextNode)
{
- SwDocShell const * const pShell(pTextNode->GetDoc()->GetDocShell());
+ SwDocShell const * const pShell(pTextNode->GetDoc().GetDocShell());
return pShell ? pShell->GetModel() : nullptr;
}
}
diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx
index ec8129eab961..da433d4272e0 100644
--- a/sw/source/filter/ascii/ascatr.cxx
+++ b/sw/source/filter/ascii/ascatr.cxx
@@ -180,7 +180,7 @@ private:
public:
SwASC_RedlineIter(SwASCWriter const& rWriter, SwTextNode const& rNode)
: m_rNode(rNode)
- , m_rIDRA(rNode.GetDoc()->getIDocumentRedlineAccess())
+ , m_rIDRA(rNode.GetDoc().getIDocumentRedlineAccess())
, m_nextRedline(rWriter.m_bHideDeleteRedlines
? m_rIDRA.GetRedlinePos(m_rNode, RedlineType::Delete)
: SwRedlineTable::npos)
@@ -266,7 +266,7 @@ static Writer& OutASC_SwTextNode( Writer& rWrt, SwContentNode& rNode )
const SwNumRule* pNumRule = rNd.GetNumRule();
if (pNumRule && !nStrPos && rWrt.m_bExportParagraphNumbering && !bIsOneParagraph)
{
- bool bIsOutlineNumRule = pNumRule == rNd.GetDoc()->GetOutlineNumRule();
+ bool bIsOutlineNumRule = pNumRule == rNd.GetDoc().GetOutlineNumRule();
// indent each numbering level by 4 spaces
OUString level;
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index dd55897b2d8d..9a96233407b4 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -2240,7 +2240,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode )
// export numbering string as plain text only for the outline numbering,
// because the outline numbering isn't exported as a numbering - see <SwHTMLNumRuleInfo::Set(..)>
if ( pNd->IsOutline() &&
- pNd->GetNumRule() == pNd->GetDoc()->GetOutlineNumRule() )
+ pNd->GetNumRule() == pNd->GetDoc().GetOutlineNumRule() )
{
aOutlineText = pNd->GetNumString();
nOffset = nOffset + aOutlineText.getLength();
diff --git a/sw/source/filter/html/htmlnum.cxx b/sw/source/filter/html/htmlnum.cxx
index 840fd61e88bd..9d5ed50d57e7 100644
--- a/sw/source/filter/html/htmlnum.cxx
+++ b/sw/source/filter/html/htmlnum.cxx
@@ -25,7 +25,7 @@ void SwHTMLNumRuleInfo::Set( const SwTextNode& rTextNd )
{
const SwNumRule* pTextNdNumRule( rTextNd.GetNumRule() );
if ( pTextNdNumRule &&
- pTextNdNumRule != rTextNd.GetDoc()->GetOutlineNumRule() )
+ pTextNdNumRule != rTextNd.GetDoc().GetOutlineNumRule() )
{
pNumRule = const_cast<SwNumRule*>(pTextNdNumRule);
nDeep = static_cast< sal_uInt16 >(pNumRule ? rTextNd.GetActualListLevel() + 1 : 0);
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 265deafe963f..645ecbd1b358 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -514,7 +514,7 @@ bool SwHTMLParser::InsertEmbed()
Size aTwipSize(pDevice->PixelToLogic(aSize, MapMode(MapUnit::MapTwip)));
SwFormatFrameSize aFrameSize(SwFrameSize::Fixed, aTwipSize.Width(), aTwipSize.Height());
aAttrSet.Put(aFrameSize);
- pOLENode->GetDoc()->SetFlyFrameAttr(*pFormat, aAttrSet);
+ pOLENode->GetDoc().SetFlyFrameAttr(*pFormat, aAttrSet);
return true;
}
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 65cdc272d118..6207967f3677 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -4945,13 +4945,13 @@ void SwHTMLParser::ClearFootnotesMarksInRange(const SwNodeIndex& rMkNdIdx, const
//follow DelFlyInRange pattern here
assert(rMkNdIdx.GetIndex() <= rPtNdIdx.GetIndex());
- SwDoc* pDoc = rMkNdIdx.GetNode().GetDoc();
+ SwDoc& rDoc = rMkNdIdx.GetNode().GetDoc();
//ofz#9733 drop bookmarks in this range
- IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
+ IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess();
pMarkAccess->deleteMarks(rMkNdIdx, SwNodeIndex(rPtNdIdx, 1), nullptr, nullptr, nullptr);
- SwFrameFormats& rTable = *pDoc->GetSpzFrameFormats();
+ SwFrameFormats& rTable = *rDoc.GetSpzFrameFormats();
for ( auto i = rTable.size(); i; )
{
SwFrameFormat *pFormat = rTable[--i];
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index f999656c440e..af79be052618 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -542,13 +542,9 @@ namespace sw
rTextNode.GetActualListLevel());
}
- OSL_ENSURE(rTextNode.GetDoc(), "No document for node?, suspicious");
- if (!rTextNode.GetDoc())
- return nullptr;
-
if (
rTextNode.IsNumbered() && rTextNode.IsCountedInList() &&
- nullptr != (pRule = rTextNode.GetDoc()->GetOutlineNumRule())
+ nullptr != (pRule = rTextNode.GetDoc().GetOutlineNumRule())
)
{
return GetNumFormatFromSwNumRuleLevel(*pRule,
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index b6a22c593969..988890f66fd7 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -519,14 +519,10 @@ namespace sw
const OUString &rText = rTextNd.GetText();
bool bParaIsRTL = false;
- OSL_ENSURE(rTextNd.GetDoc(), "No document for node?, suspicious");
- if (rTextNd.GetDoc())
+ if (SvxFrameDirection::Horizontal_RL_TB ==
+ rTextNd.GetDoc().GetTextDirection(SwPosition(rTextNd)))
{
- if (SvxFrameDirection::Horizontal_RL_TB ==
- rTextNd.GetDoc()->GetTextDirection(SwPosition(rTextNd)))
- {
- bParaIsRTL = true;
- }
+ bParaIsRTL = true;
}
using namespace ::com::sun::star::i18n;
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 3e9b52d40516..2b5b66fab0cf 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2149,7 +2149,7 @@ bool MSWordExportBase::NeedTextNodeSplit( const SwTextNode& rNd, SwSoftPageBreak
rNd.fillSoftPageBreakList(tmp);
// hack: move the break behind any field marks; currently we can't hide the
// field mark instruction so the layout position is quite meaningless
- IDocumentMarkAccess const& rIDMA(*rNd.GetDoc()->getIDocumentMarkAccess());
+ IDocumentMarkAccess const& rIDMA(*rNd.GetDoc().getIDocumentMarkAccess());
sal_Int32 pos(-1);
for (auto const& it : tmp)
{
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 67cf9cc61ca7..87e0eb9c712f 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1119,7 +1119,7 @@ static OUString lcl_GenerateFieldTypeName(const OUString& sPrefix, SwTableNode*
++nCount;
sName = sPrefixStr + OUString::number(nCount);
}
- while (nullptr != pTableNode->GetDoc()->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Dde, sName, false));
+ while (nullptr != pTableNode->GetDoc().getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Dde, sName, false));
return sName;
}
@@ -1153,7 +1153,7 @@ static SwDDEFieldType* lcl_GetDDEFieldType(SwXMLDDETableContext_Impl* pContext,
else
{
// check for existing DDE field type with the same name
- SwDDEFieldType* pOldType = static_cast<SwDDEFieldType*>(pTableNode->GetDoc()->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Dde, sName, false));
+ SwDDEFieldType* pOldType = static_cast<SwDDEFieldType*>(pTableNode->GetDoc().getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Dde, sName, false));
if (nullptr != pOldType)
{
// same values -> return old type
@@ -1179,7 +1179,7 @@ static SwDDEFieldType* lcl_GetDDEFieldType(SwXMLDDETableContext_Impl* pContext,
// create new field type and return
SwDDEFieldType aDDEFieldType(sName, sCommand, nType);
pType = static_cast<SwDDEFieldType*>(pTableNode->
- GetDoc()->getIDocumentFieldsAccess().InsertFieldType(aDDEFieldType));
+ GetDoc().getIDocumentFieldsAccess().InsertFieldType(aDDEFieldType));
}
OSL_ENSURE(nullptr != pType, "We really want a SwDDEFieldType here!");
@@ -2598,7 +2598,7 @@ void SwXMLTableContext::MakeTable()
if (!m_pRows || m_pRows->empty() || !GetColumnCount())
{
OSL_FAIL("invalid table: no cells; deleting...");
- m_pTableNode->GetDoc()->getIDocumentContentOperations().DeleteSection( m_pTableNode );
+ m_pTableNode->GetDoc().getIDocumentContentOperations().DeleteSection( m_pTableNode );
m_pTableNode = nullptr;
m_pBox1 = nullptr;
m_bOwnsBox1 = false;
@@ -2766,7 +2766,7 @@ void SwXMLTableContext::MakeTable()
}
// ??? this is always false: root frame is only created in SwViewShell::Init
- if( m_pTableNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() )
+ if( m_pTableNode->GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell() )
{
m_pTableNode->DelFrames();
SwNodeIndex aIdx( *m_pTableNode->EndOfSectionNode(), 1 );
@@ -2826,7 +2826,7 @@ const SwStartNode *SwXMLTableContext::InsertTableSection(
OSL_ENSURE( pDoc, "<SwXMLTableContext::InsertTableSection(..)> - no <pDoc> at <SwXTextCursor> instance - <SwXTextCurosr> doesn't seem to be registered at a <SwUnoCursor> instance." );
if ( !pDoc )
{
- pDoc = const_cast<SwDoc*>(pEndNd->GetDoc());
+ pDoc = &const_cast<SwDoc&>(pEndNd->GetDoc());
}
sal_uInt32 nOffset = pPrevSttNd ? 1UL : 0UL;
SwNodeIndex aIdx( *pEndNd, nOffset );
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index be1da018506a..e36b8c598c5a 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -807,7 +807,7 @@ void SwAnnotationWin::SetPosAndSize()
SwContentNode* pContentNd = nullptr;
if (pTextNode)
{
- SwNodes& rNds = pTextNode->GetDoc()->GetNodes();
+ SwNodes& rNds = pTextNode->GetDoc().GetNodes();
pContentNd = rNds[mrSidebarItem.maLayoutInfo.mnStartNodeIdx]->GetContentNode();
}
if (pContentNd)
diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx
index dedf167e7ed2..9360ea3b7ea1 100644
--- a/sw/source/uibase/docvw/PageBreakWin.cxx
+++ b/sw/source/uibase/docvw/PageBreakWin.cxx
@@ -286,7 +286,7 @@ void SwPageBreakWin::Select()
? static_cast<SwTextFrame*>(pCnt)->GetTextNodeFirst()
: static_cast<SwNoTextFrame*>(pCnt)->GetNode();
- pNd->GetDoc()->GetIDocumentUndoRedo( ).StartUndo( SwUndoId::UI_DELETE_PAGE_BREAK, nullptr );
+ pNd->GetDoc().GetIDocumentUndoRedo( ).StartUndo( SwUndoId::UI_DELETE_PAGE_BREAK, nullptr );
SfxItemSet aSet(
GetEditWin()->GetView().GetWrtShell().GetAttrPool(),
@@ -295,10 +295,10 @@ void SwPageBreakWin::Select()
aSet.Put( SwFormatPageDesc( nullptr ) );
SwPaM aPaM( *pNd );
- pNd->GetDoc()->getIDocumentContentOperations().InsertItemSet(
+ pNd->GetDoc().getIDocumentContentOperations().InsertItemSet(
aPaM, aSet, SetAttrMode::DEFAULT, GetPageFrame()->getRootFrame());
- pNd->GetDoc()->GetIDocumentUndoRedo( ).EndUndo( SwUndoId::UI_DELETE_PAGE_BREAK, nullptr );
+ pNd->GetDoc().GetIDocumentUndoRedo( ).EndUndo( SwUndoId::UI_DELETE_PAGE_BREAK, nullptr );
}
}