sw/inc/ToxTextGenerator.hxx | 2 sw/inc/docary.hxx | 4 sw/inc/format.hxx | 4 sw/inc/section.hxx | 2 sw/inc/swatrset.hxx | 12 sw/inc/swtable.hxx | 16 sw/inc/undobj.hxx | 6 sw/qa/core/header_footer/HeaderFooterTest.cxx | 4 sw/qa/extras/layout/layout.cxx | 2 sw/qa/extras/layout/layout4.cxx | 2 sw/qa/filter/html/html.cxx | 2 sw/source/core/attr/format.cxx | 26 - sw/source/core/attr/swatrset.cxx | 52 +-- sw/source/core/doc/DocumentContentOperationsManager.cxx | 2 sw/source/core/doc/DocumentLayoutManager.cxx | 12 sw/source/core/doc/DocumentLinksAdministrationManager.cxx | 4 sw/source/core/doc/DocumentRedlineManager.cxx | 4 sw/source/core/doc/docchart.cxx | 2 sw/source/core/doc/docedt.cxx | 4 sw/source/core/doc/docfmt.cxx | 10 sw/source/core/doc/docftn.cxx | 14 sw/source/core/doc/docnew.cxx | 2 sw/source/core/doc/docredln.cxx | 16 sw/source/core/doc/doctxm.cxx | 64 +-- sw/source/core/doc/fmtcol.cxx | 14 sw/source/core/doc/lineinfo.cxx | 6 sw/source/core/doc/number.cxx | 10 sw/source/core/doc/tblafmt.cxx | 16 sw/source/core/doc/tblcpy.cxx | 48 +- sw/source/core/doc/tblrwcl.cxx | 55 +-- sw/source/core/doc/textboxhelper.cxx | 36 +- sw/source/core/docnode/ndsect.cxx | 20 - sw/source/core/docnode/ndtbl.cxx | 30 - sw/source/core/docnode/ndtbl1.cxx | 8 sw/source/core/docnode/node.cxx | 2 sw/source/core/docnode/node2lay.cxx | 2 sw/source/core/docnode/section.cxx | 144 ++++---- sw/source/core/draw/dcontact.cxx | 42 +- sw/source/core/draw/dflyobj.cxx | 14 sw/source/core/edit/edredln.cxx | 4 sw/source/core/fields/cellfml.cxx | 16 sw/source/core/fields/ddetbl.cxx | 12 sw/source/core/frmedt/fecopy.cxx | 2 sw/source/core/frmedt/fefly1.cxx | 10 sw/source/core/frmedt/feshview.cxx | 6 sw/source/core/frmedt/tblsel.cxx | 40 +- sw/source/core/inc/UndoBookmark.hxx | 2 sw/source/core/inc/UndoTable.hxx | 2 sw/source/core/inc/docredln.hxx | 2 sw/source/core/inc/flowfrm.hxx | 2 sw/source/core/inc/frmtool.hxx | 10 sw/source/core/inc/layouter.hxx | 6 sw/source/core/inc/rolbck.hxx | 40 +- sw/source/core/layout/anchoreddrawobject.cxx | 22 - sw/source/core/layout/anchoredobject.cxx | 6 sw/source/core/layout/atrfrm.cxx | 32 - sw/source/core/layout/calcmove.cxx | 2 sw/source/core/layout/colfrm.cxx | 31 - sw/source/core/layout/flowfrm.cxx | 12 sw/source/core/layout/fly.cxx | 16 sw/source/core/layout/flycnt.cxx | 8 sw/source/core/layout/flyincnt.cxx | 4 sw/source/core/layout/flylay.cxx | 4 sw/source/core/layout/flypos.cxx | 4 sw/source/core/layout/frmtool.cxx | 74 ++-- sw/source/core/layout/ftnfrm.cxx | 94 ++--- sw/source/core/layout/layact.cxx | 6 sw/source/core/layout/laycache.cxx | 34 +- sw/source/core/layout/layhelp.hxx | 4 sw/source/core/layout/layouter.cxx | 28 - sw/source/core/layout/newfrm.cxx | 20 - sw/source/core/layout/objectformattertxtfrm.cxx | 12 sw/source/core/layout/pagechg.cxx | 61 +-- sw/source/core/layout/pagedesc.cxx | 6 sw/source/core/layout/paintfrm.cxx | 18 - sw/source/core/layout/sectfrm.cxx | 2 sw/source/core/layout/ssfrm.cxx | 8 sw/source/core/layout/tabfrm.cxx | 26 - sw/source/core/layout/trvlfrm.cxx | 4 sw/source/core/layout/wsfrm.cxx | 18 - sw/source/core/table/swnewtable.cxx | 60 +-- sw/source/core/table/swtable.cxx | 90 ++--- sw/source/core/text/EnhancedPDFExportHelper.cxx | 2 sw/source/core/text/itratr.cxx | 2 sw/source/core/text/porfly.cxx | 6 sw/source/core/text/txtftn.cxx | 12 sw/source/core/tox/ToxTextGenerator.cxx | 10 sw/source/core/txtnode/atrflyin.cxx | 8 sw/source/core/txtnode/chrfmt.cxx | 4 sw/source/core/txtnode/thints.cxx | 8 sw/source/core/undo/rolbck.cxx | 122 +++---- sw/source/core/undo/unattr.cxx | 38 +- sw/source/core/undo/unbkmk.cxx | 16 sw/source/core/undo/undel.cxx | 10 sw/source/core/undo/undobj.cxx | 16 sw/source/core/undo/undobj1.cxx | 57 +-- sw/source/core/undo/undoflystrattr.cxx | 4 sw/source/core/undo/undraw.cxx | 28 - sw/source/core/undo/unfmco.cxx | 2 sw/source/core/undo/unins.cxx | 24 - sw/source/core/undo/unmove.cxx | 18 - sw/source/core/undo/unnum.cxx | 6 sw/source/core/undo/unovwr.cxx | 4 sw/source/core/undo/unredln.cxx | 2 sw/source/core/undo/unsect.cxx | 14 sw/source/core/undo/unspnd.cxx | 18 - sw/source/core/undo/untbl.cxx | 194 +++++------ sw/source/core/undo/untblk.cxx | 4 sw/source/core/unocore/unochart.cxx | 10 sw/source/core/unocore/unocoll.cxx | 6 sw/source/core/unocore/unocrsrhelper.cxx | 24 - sw/source/core/unocore/unodraw.cxx | 74 ++-- sw/source/core/unocore/unoframe.cxx | 235 ++++++-------- sw/source/core/unocore/unoidx.cxx | 10 sw/source/core/unocore/unoobj2.cxx | 10 sw/source/core/unocore/unosect.cxx | 38 +- sw/source/core/unocore/unosett.cxx | 2 sw/source/core/unocore/unostyle.cxx | 5 sw/source/core/unocore/unotbl.cxx | 128 +++---- sw/source/core/unocore/unotext.cxx | 18 - sw/source/core/view/viewsh.cxx | 2 sw/source/filter/html/htmlflywriter.cxx | 2 sw/source/filter/html/htmlform.cxx | 4 sw/source/filter/html/htmltab.cxx | 4 sw/source/filter/ww8/docxattributeoutput.cxx | 6 sw/source/filter/ww8/docxsdrexport.cxx | 6 sw/source/filter/ww8/wrtw8esh.cxx | 2 sw/source/filter/ww8/ww8par.cxx | 2 sw/source/filter/xml/xmltble.cxx | 2 sw/source/filter/xml/xmltbli.cxx | 5 sw/source/uibase/dochdl/swdtflvr.cxx | 2 sw/source/uibase/uiview/viewstat.cxx | 2 sw/source/uibase/uno/unotxvw.cxx | 6 sw/source/uibase/utlui/uitool.cxx | 8 sw/source/uibase/wrtsh/wrtsh1.cxx | 4 135 files changed, 1394 insertions(+), 1427 deletions(-)
New commits: commit 3e86a879508e55673b4f6d24ce84eb98b332da63 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Wed Jun 4 16:19:28 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Jun 5 14:10:51 2025 +0200 SwAttrPool: pass SwDoc by ref After commit ca6b1677cc3d923f0c13b2253b48a0ea90485b41 Author: Xisco Fauli <xiscofa...@libreoffice.org> Date: Tue Jun 3 11:59:57 2025 +0200 sw: no need to create a dummy attr pool Change-Id: Iadc9df6ffab9f479355cd3e2c649a2d3f9c1dbfb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186203 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/inc/ToxTextGenerator.hxx b/sw/inc/ToxTextGenerator.hxx index e233aa463f3f..e4d36e7ac15e 100644 --- a/sw/inc/ToxTextGenerator.hxx +++ b/sw/inc/ToxTextGenerator.hxx @@ -67,7 +67,7 @@ public: * process @p numberOfEntriesToProcess entries. */ std::optional<std::pair<SwTextNode *, SvxTabStopItem>> - GenerateText(SwDoc *doc, + GenerateText(SwDoc& rDoc, std::unordered_map<OUString, int> & rMarkURLs, const std::vector<std::unique_ptr<SwTOXSortTabBase>>& entries, sal_uInt16 indexOfEntryToProcess, sal_uInt16 numberOfEntriesToProcess, diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx index a05a8cba2fe3..eea0cb60ee10 100644 --- a/sw/inc/docary.hxx +++ b/sw/inc/docary.hxx @@ -306,8 +306,8 @@ public: SwExtraRedline* GetRedline( sal_uInt16 uIndex ) const { return m_aExtraRedlines.operator[]( uIndex ); } SW_DLLPUBLIC bool DeleteAllTableRedlines( SwDoc& rDoc, const SwTable& rTable, bool bSaveInUndo, RedlineType nRedlineTypeToDelete ); - bool DeleteTableRowRedline ( SwDoc* pDoc, const SwTableLine& rTableLine, bool bSaveInUndo, RedlineType nRedlineTypeToDelete ); - bool DeleteTableCellRedline( SwDoc* pDoc, const SwTableBox& rTableBox, bool bSaveInUndo, RedlineType nRedlineTypeToDelete ); + bool DeleteTableRowRedline ( SwDoc& rDoc, const SwTableLine& rTableLine, bool bSaveInUndo, RedlineType nRedlineTypeToDelete ); + bool DeleteTableCellRedline( SwDoc& rDoc, const SwTableBox& rTableBox, bool bSaveInUndo, RedlineType nRedlineTypeToDelete ); }; typedef std::vector<SwOLENode*> SwOLENodes; diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index b30a7647d143..43fb9f6b4217 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -137,8 +137,8 @@ public: const SwAttrSet& GetAttrSet() const { return m_aSet; } /** The document is set in SwAttrPool now, therefore you always can access it. */ - const SwDoc *GetDoc() const { return m_aSet.GetDoc(); } - SwDoc *GetDoc() { return m_aSet.GetDoc(); } + const SwDoc &GetDoc() const { return m_aSet.GetDoc(); } + SwDoc &GetDoc() { return m_aSet.GetDoc(); } /// Provides access to the document settings interface. const IDocumentSettingAccess& getIDocumentSettingAccess() const; diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index e7f98c2408f7..5ab32304e467 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -293,7 +293,7 @@ class SW_DLLPUBLIC SwSectionFormat final SAL_DLLPRIVATE void UpdateParent(); // Parent has been changed. - SwSectionFormat( SwFrameFormat* pDrvdFrame, SwDoc *pDoc ); + SwSectionFormat( SwFrameFormat* pDrvdFrame, SwDoc& rDoc ); virtual void SwClientNotify(const SwModify&, const SfxHint&) override; public: diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx index 7dd47bf27d01..96bae5e9645c 100644 --- a/sw/inc/swatrset.hxx +++ b/sw/inc/swatrset.hxx @@ -145,16 +145,16 @@ private: friend void InitCore(); // For creating/deleting of version maps. friend void FinitCore(); - SwDoc* m_pDoc; + SwDoc& m_rDoc; public: - SwAttrPool( SwDoc* pDoc ); + SwAttrPool( SwDoc& rDoc ); private: virtual ~SwAttrPool() override; public: - SwDoc* GetDoc() { return m_pDoc; } - const SwDoc* GetDoc() const { return m_pDoc; } + SwDoc& GetDoc() { return m_rDoc; } + const SwDoc& GetDoc() const { return m_rDoc; } }; @@ -202,8 +202,8 @@ public: bool SetModifyAtAttr( const sw::BroadcastingModify* pModify ); // Document is set at SwAttrPool. Therefore it is always accessible. - const SwDoc *GetDoc() const { return GetPool()->GetDoc(); } - SwDoc *GetDoc() { return GetPool()->GetDoc(); } + const SwDoc &GetDoc() const { return GetPool()->GetDoc(); } + SwDoc &GetDoc() { return GetPool()->GetDoc(); } // Get methods: bool indicates whether to search only in Set (when false) // or also in parents. If nothing is found then default attribute is returned. diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index 9e9687005a9f..9401e43e42f5 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -159,14 +159,14 @@ public: private: // @@@ public copy ctor, but no copy assignment? SwTable & operator= (const SwTable &) = delete; - bool OldMerge( SwDoc*, const SwSelBoxes&, SwTableBox*, SwUndoTableMerge* ); + bool OldMerge( SwDoc&, const SwSelBoxes&, SwTableBox*, SwUndoTableMerge* ); bool OldSplitRow( SwDoc&, const SwSelBoxes&, sal_uInt16, bool ); - bool NewMerge( SwDoc*, const SwSelBoxes&, const SwSelBoxes& rMerged, + bool NewMerge( SwDoc&, const SwSelBoxes&, const SwSelBoxes& rMerged, SwUndoTableMerge* ); bool NewSplitRow( SwDoc&, const SwSelBoxes&, sal_uInt16, bool ); std::optional<SwBoxSelection> CollectBoxSelection( const SwPaM& rPam ) const; void InsertSpannedRow( SwDoc& rDoc, sal_uInt16 nIdx, sal_uInt16 nCnt ); - bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind, bool bInsertDummy ); + bool InsertRow_( SwDoc&, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind, bool bInsertDummy ); bool NewInsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool, bool bInsertDummy ); void FindSuperfluousRows_( SwSelBoxes& rBoxes, SwTableLine*, SwTableLine* ); void AdjustWidths( const tools::Long nOld, const tools::Long nNew ); @@ -233,11 +233,11 @@ public: // The following functions are "pseudo-virtual", i.e. they are different for old and new table model // It's not allowed to change the table model after the first call of one of these functions. - bool Merge( SwDoc* pDoc, const SwSelBoxes& rBoxes, const SwSelBoxes& rMerged, + bool Merge( SwDoc& rDoc, const SwSelBoxes& rBoxes, const SwSelBoxes& rMerged, SwTableBox* pMergeBox, SwUndoTableMerge* pUndo ) { - return m_bNewModel ? NewMerge( pDoc, rBoxes, rMerged, pUndo ) : - OldMerge( pDoc, rBoxes, pMergeBox, pUndo ); + return m_bNewModel ? NewMerge( rDoc, rBoxes, rMerged, pUndo ) : + OldMerge( rDoc, rBoxes, pMergeBox, pUndo ); } bool SplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bSameHeight ) @@ -252,10 +252,10 @@ public: bool InsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind, bool bInsertDummy ); - bool InsertRow( SwDoc*, const SwSelBoxes& rBoxes, + bool InsertRow( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind, bool bInsertDummy = true ); void PrepareDelBoxes( const SwSelBoxes& rBoxes ); - bool DeleteSel( SwDoc*, const SwSelBoxes& rBoxes, const SwSelBoxes* pMerged, + bool DeleteSel( SwDoc&, const SwSelBoxes& rBoxes, const SwSelBoxes* pMerged, SwUndo* pUndo, const bool bDelMakeFrames, const bool bCorrBorder ); bool SplitCol( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt ); diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx index 976eb1e1facb..e73bc5b5b5c1 100644 --- a/sw/inc/undobj.hxx +++ b/sw/inc/undobj.hxx @@ -213,8 +213,8 @@ public: void SaveSection( const SwNodeIndex& rSttIdx ); void SaveSection(const SwNodeRange& rRange, bool bExpandNodes = true); - void RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx, sal_uInt16 nSectType ); - void RestoreSection(SwDoc* pDoc, const SwNode& rInsPos, bool bForceCreateFrames = false); + void RestoreSection( SwDoc& rDoc, SwNodeIndex* pIdx, sal_uInt16 nSectType ); + void RestoreSection(SwDoc& rDoc, const SwNode& rInsPos, bool bForceCreateFrames = false); const SwHistory* GetHistory() const { return m_pHistory.get(); } SwHistory* GetHistory() { return m_pHistory.get(); } @@ -305,7 +305,7 @@ protected: bool m_bDelFormat; // Delete saved format. void InsFly(::sw::UndoRedoContext & rContext, bool bShowSel = true); - void DelFly( SwDoc* ); + void DelFly( SwDoc& ); SwUndoFlyBase( SwFrameFormat* pFormat, SwUndoId nUndoId ); diff --git a/sw/qa/core/header_footer/HeaderFooterTest.cxx b/sw/qa/core/header_footer/HeaderFooterTest.cxx index 61d0eaa2717e..fcf7d1a0aac6 100644 --- a/sw/qa/core/header_footer/HeaderFooterTest.cxx +++ b/sw/qa/core/header_footer/HeaderFooterTest.cxx @@ -79,10 +79,10 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testStashedHeaderFooter) // Check document instance auto pSourceStashedFormat = pSourcePageDesc->GetStashedFrameFormat(true, false, true); - CPPUNIT_ASSERT_EQUAL(true, pSourceStashedFormat->GetDoc() == pSourceDocument); + CPPUNIT_ASSERT_EQUAL(true, &pSourceStashedFormat->GetDoc() == pSourceDocument); auto pTargetStashedFormat = pTargetPageDesc->GetStashedFrameFormat(true, false, true); - CPPUNIT_ASSERT_EQUAL(true, pTargetStashedFormat->GetDoc() == pTargetDocument); + CPPUNIT_ASSERT_EQUAL(true, &pTargetStashedFormat->GetDoc() == pTargetDocument); xSourceDocument->dispose(); xTargetDocument->dispose(); diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 781830a1ef06..1ebaed27941d 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -1510,7 +1510,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025) // TODO: modify shape distance via UNO with text frame synchronization // Check the textbox as well: - auto xTxFrm = SwXTextFrame::CreateXTextFrame(*pFrameFormat->GetDoc(), pFrameFormat); + auto xTxFrm = SwXTextFrame::CreateXTextFrame(pFrameFormat->GetDoc(), pFrameFormat); CPPUNIT_ASSERT(xTxFrm); const tools::Long nFrameLeftPaddng diff --git a/sw/qa/extras/layout/layout4.cxx b/sw/qa/extras/layout/layout4.cxx index a0556b1dce94..7c7abeb4abea 100644 --- a/sw/qa/extras/layout/layout4.cxx +++ b/sw/qa/extras/layout/layout4.cxx @@ -690,7 +690,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, testTdf137185) // Check if the text moved from the shape to the frame auto pFormat = SwTextBoxHelper::getOtherTextBoxFormat(getShape(1)); - auto xTextFrame = SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat); + auto xTextFrame = SwXTextFrame::CreateXTextFrame(pFormat->GetDoc(), pFormat); CPPUNIT_ASSERT_EQUAL(u"Align me!"_ustr, xTextFrame->getText()->getString()); SdrTextObj* pTextObj = DynCastSdrTextObj(pObj); diff --git a/sw/qa/filter/html/html.cxx b/sw/qa/filter/html/html.cxx index f3a499a452fe..4968c613dc61 100644 --- a/sw/qa/filter/html/html.cxx +++ b/sw/qa/filter/html/html.cxx @@ -145,7 +145,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTableCellFloatValueType) SwAttrSet aSet(pBoxFormat->GetAttrSet()); SwTableBoxValue aBoxValue(42.0); aSet.Put(aBoxValue); - pBoxFormat->GetDoc()->SetAttr(aSet, *pBoxFormat); + pBoxFormat->GetDoc().SetAttr(aSet, *pBoxFormat); // When exporting to XHTML: setFilterOptions(u"xhtmlns=reqif-xhtml"_ustr); diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 8c2a9933d93e..4b350b6f75c6 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -538,10 +538,7 @@ bool SwFormat::SetFormatAttr( const SfxItemSet& rSet ) // Need to check for unique item for DrawingLayer items of type NameOrIndex // and evtl. correct that item to ensure unique names for that type. This call may // modify/correct entries inside of the given SfxItemSet - if(GetDoc()) - { - GetDoc()->CheckForUniqueItemForLineFillNameOrIndex(aTempSet); - } + GetDoc().CheckForUniqueItemForLineFillNameOrIndex(aTempSet); if (supportsFullDrawingLayerFillAttributeSet()) { @@ -707,14 +704,14 @@ bool SwFormat::IsBackgroundTransparent() const /* * Document Interface Access */ -const IDocumentSettingAccess& SwFormat::getIDocumentSettingAccess() const { return GetDoc()->GetDocumentSettingManager(); } -const IDocumentDrawModelAccess& SwFormat::getIDocumentDrawModelAccess() const { return GetDoc()->getIDocumentDrawModelAccess(); } -IDocumentDrawModelAccess& SwFormat::getIDocumentDrawModelAccess() { return GetDoc()->getIDocumentDrawModelAccess(); } -const IDocumentLayoutAccess& SwFormat::getIDocumentLayoutAccess() const { return GetDoc()->getIDocumentLayoutAccess(); } -IDocumentLayoutAccess& SwFormat::getIDocumentLayoutAccess() { return GetDoc()->getIDocumentLayoutAccess(); } -IDocumentTimerAccess& SwFormat::getIDocumentTimerAccess() { return GetDoc()->getIDocumentTimerAccess(); } -IDocumentFieldsAccess& SwFormat::getIDocumentFieldsAccess() { return GetDoc()->getIDocumentFieldsAccess(); } -IDocumentChartDataProviderAccess& SwFormat::getIDocumentChartDataProviderAccess() { return GetDoc()->getIDocumentChartDataProviderAccess(); } +const IDocumentSettingAccess& SwFormat::getIDocumentSettingAccess() const { return GetDoc().GetDocumentSettingManager(); } +const IDocumentDrawModelAccess& SwFormat::getIDocumentDrawModelAccess() const { return GetDoc().getIDocumentDrawModelAccess(); } +IDocumentDrawModelAccess& SwFormat::getIDocumentDrawModelAccess() { return GetDoc().getIDocumentDrawModelAccess(); } +const IDocumentLayoutAccess& SwFormat::getIDocumentLayoutAccess() const { return GetDoc().getIDocumentLayoutAccess(); } +IDocumentLayoutAccess& SwFormat::getIDocumentLayoutAccess() { return GetDoc().getIDocumentLayoutAccess(); } +IDocumentTimerAccess& SwFormat::getIDocumentTimerAccess() { return GetDoc().getIDocumentTimerAccess(); } +IDocumentFieldsAccess& SwFormat::getIDocumentFieldsAccess() { return GetDoc().getIDocumentFieldsAccess(); } +IDocumentChartDataProviderAccess& SwFormat::getIDocumentChartDataProviderAccess() { return GetDoc().getIDocumentChartDataProviderAccess(); } void SwFormat::GetGrabBagItem(uno::Any& rVal) const { @@ -761,11 +758,8 @@ void SwFormat::RemoveAllUnos() bool SwFormat::IsUsed() const { - auto pDoc = GetDoc(); - if(!pDoc) - return false; bool isUsed = false; - sw::AutoFormatUsedHint aHint(isUsed, pDoc->GetNodes()); + sw::AutoFormatUsedHint aHint(isUsed, GetDoc().GetNodes()); CallSwClientNotify(aHint); return isUsed; } diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx index dc74749b0b35..76865e745aac 100644 --- a/sw/source/core/attr/swatrset.cxx +++ b/sw/source/core/attr/swatrset.cxx @@ -45,9 +45,9 @@ -SwAttrPool::SwAttrPool(SwDoc* pD) +SwAttrPool::SwAttrPool(SwDoc& rDoc) : SfxItemPool(u"SWG"_ustr) -, m_pDoc(pD) +, m_rDoc(rDoc) { registerItemInfoPackage(getItemInfoPackageSwAttributes()); @@ -308,7 +308,7 @@ bool SwAttrSet::SetModifyAtAttr( const sw::BroadcastingModify* pModify ) SwCharFormat* pCharFormat = pFormatDrop->GetCharFormat(); if(pCharFormat && GetPool() != pCharFormat->GetAttrSet().GetPool()) { - pCharFormat = GetDoc()->CopyCharFormat(*pCharFormat); + pCharFormat = GetDoc().CopyCharFormat(*pCharFormat); pFormatDrop->SetCharFormat(pCharFormat); } pFormatDrop->ChgDefinedIn(pDropDefiner); @@ -338,52 +338,52 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod ) const // #i92811# std::unique_ptr<SfxStringItem> pNewListIdItem; - const SwDoc *pSrcDoc = GetDoc(); - SwDoc *pDstDoc = pCNd ? &pCNd->GetDoc() : pFormat->GetDoc(); + const SwDoc& rSrcDoc = GetDoc(); + SwDoc& rDstDoc = pCNd ? pCNd->GetDoc() : pFormat->GetDoc(); // Does the NumRule has to be copied? const SwNumRuleItem* pNumRuleItem; - if( pSrcDoc != pDstDoc && + if( &rSrcDoc != &rDstDoc && (pNumRuleItem = GetItemIfSet( RES_PARATR_NUMRULE, false )) ) { UIName aNm(pNumRuleItem->GetValue()); if( !aNm.isEmpty() ) { - SwNumRule* pDestRule = pDstDoc->FindNumRulePtr( aNm ); + SwNumRule* pDestRule = rDstDoc.FindNumRulePtr( aNm ); if( pDestRule ) pDestRule->Invalidate(); else - pDstDoc->MakeNumRule( aNm, pSrcDoc->FindNumRulePtr( aNm ) ); + rDstDoc.MakeNumRule( aNm, rSrcDoc.FindNumRulePtr( aNm ) ); } } // copy list and if needed also the corresponding list style // for text nodes const SfxStringItem* pStrItem; - if ( pSrcDoc != pDstDoc && + if ( &rSrcDoc != &rDstDoc && pCNd && pCNd->IsTextNode() && (pStrItem = GetItemIfSet( RES_PARATR_LIST_ID, false )) ) { const OUString& sListId = pStrItem->GetValue(); if ( !sListId.isEmpty() && - !pDstDoc->getIDocumentListsAccess().getListByName( sListId ) ) + !rDstDoc.getIDocumentListsAccess().getListByName( sListId ) ) { - const SwList* pList = pSrcDoc->getIDocumentListsAccess().getListByName( sListId ); + const SwList* pList = rSrcDoc.getIDocumentListsAccess().getListByName( sListId ); // copy list style, if needed const UIName& sDefaultListStyleName = pList->GetDefaultListStyleName(); // #i92811# const SwNumRule* pDstDocNumRule = - pDstDoc->FindNumRulePtr( sDefaultListStyleName ); + rDstDoc.FindNumRulePtr( sDefaultListStyleName ); if ( !pDstDocNumRule ) { - pDstDoc->MakeNumRule( sDefaultListStyleName, - pSrcDoc->FindNumRulePtr( sDefaultListStyleName ) ); + rDstDoc.MakeNumRule( sDefaultListStyleName, + rSrcDoc.FindNumRulePtr( sDefaultListStyleName ) ); } else { const SwNumRule* pSrcDocNumRule = - pSrcDoc->FindNumRulePtr( sDefaultListStyleName ); + rSrcDoc.FindNumRulePtr( sDefaultListStyleName ); // If list id of text node equals the list style's // default list id in the source document, the same // should be hold in the destination document. @@ -398,17 +398,17 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod ) const // check again, if list exist, because <SwDoc::MakeNumRule(..)> // could have also created it. if ( pNewListIdItem == nullptr && - !pDstDoc->getIDocumentListsAccess().getListByName( sListId ) ) + !rDstDoc.getIDocumentListsAccess().getListByName( sListId ) ) { // copy list - pDstDoc->getIDocumentListsAccess().createList( sListId, sDefaultListStyleName ); + rDstDoc.getIDocumentListsAccess().createList( sListId, sDefaultListStyleName ); } } } std::optional< SfxItemSet > tmpSet; const SwFormatPageDesc* pPageDescItem; - if( pSrcDoc != pDstDoc && (pPageDescItem = GetItemIfSet( + if( &rSrcDoc != &rDstDoc && (pPageDescItem = GetItemIfSet( RES_PAGEDESC, false ))) { const SwPageDesc* pPgDesc = pPageDescItem->GetPageDesc(); @@ -416,11 +416,11 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod ) const { tmpSet.emplace(*this); - SwPageDesc* pDstPgDesc = pDstDoc->FindPageDesc(pPgDesc->GetName()); + SwPageDesc* pDstPgDesc = rDstDoc.FindPageDesc(pPgDesc->GetName()); if( !pDstPgDesc ) { - pDstPgDesc = pDstDoc->MakePageDesc(pPgDesc->GetName()); - pDstDoc->CopyPageDesc( *pPgDesc, *pDstPgDesc ); + pDstPgDesc = rDstDoc.MakePageDesc(pPgDesc->GetName()); + rDstDoc.CopyPageDesc( *pPgDesc, *pDstPgDesc ); } SwFormatPageDesc aDesc( pDstPgDesc ); aDesc.SetNumOffset( pPageDescItem->GetNumOffset() ); @@ -429,7 +429,7 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod ) const } const SwFormatAnchor* pAnchorItem; - if( pSrcDoc != pDstDoc && (pAnchorItem = GetItemIfSet( RES_ANCHOR, false )) + if( &rSrcDoc != &rDstDoc && (pAnchorItem = GetItemIfSet( RES_ANCHOR, false )) && pAnchorItem->GetAnchorNode() != nullptr ) { if( !tmpSet ) @@ -440,18 +440,18 @@ void SwAttrSet::CopyToModify( sw::BroadcastingModify& rMod ) const } const SwFormatAutoFormat* pAutoFormatItem; - if (pSrcDoc != pDstDoc && + if (&rSrcDoc != &rDstDoc && (pAutoFormatItem = GetItemIfSet(RES_PARATR_LIST_AUTOFMT, false)) && pAutoFormatItem->GetStyleHandle()) { SfxItemSet const& rAutoStyle(*pAutoFormatItem->GetStyleHandle()); std::shared_ptr<SfxItemSet> const pNewSet( - rAutoStyle.SfxItemSet::Clone(true, &pDstDoc->GetAttrPool())); + rAutoStyle.SfxItemSet::Clone(true, &rDstDoc.GetAttrPool())); - // fix up character style, it contains pointers to pSrcDoc + // fix up character style, it contains pointers to rSrcDoc if (const SwFormatCharFormat* pCharFormatItem = pNewSet->GetItemIfSet(RES_TXTATR_CHARFMT, false)) { - SwCharFormat *const pCopy(pDstDoc->CopyCharFormat(*pCharFormatItem->GetCharFormat())); + SwCharFormat *const pCopy(rDstDoc.CopyCharFormat(*pCharFormatItem->GetCharFormat())); const_cast<SwFormatCharFormat&>(*pCharFormatItem).SetCharFormat(pCopy); } diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index ade87b32b466..b6ebdc0fee7f 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -3987,7 +3987,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly( SwNodeIndex const end(rInsPos, SwNodeOffset((!isRecreateEndNode || isAtStartOfSection) ? 0 : +1)); - ::MakeFrames(&rDest, aSavePos.GetNode(), end.GetNode()); + ::MakeFrames(rDest, aSavePos.GetNode(), end.GetNode()); } } } diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx index 4b23406ce3e5..0c89f480bece 100644 --- a/sw/source/core/doc/DocumentLayoutManager.cxx +++ b/sw/source/core/doc/DocumentLayoutManager.cxx @@ -252,7 +252,7 @@ void DocumentLayoutManager::DelLayoutFormat( SwFrameFormat *pFormat ) pContentIdx = pFormat->GetContent().GetContentIdx(); if (pContentIdx) { - sw::SpzFrameFormats* pSpzs = pFormat->GetDoc()->GetSpzFrameFormats(); + sw::SpzFrameFormats* pSpzs = pFormat->GetDoc().GetSpzFrameFormats(); if ( pSpzs ) { std::vector<SwFrameFormat*> aToDeleteFrameFormats; @@ -272,7 +272,7 @@ void DocumentLayoutManager::DelLayoutFormat( SwFrameFormat *pFormat ) while ( !aToDeleteFrameFormats.empty() ) { SwFrameFormat* pTmpFormat = aToDeleteFrameFormats.back(); - pFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat( pTmpFormat ); + pFormat->GetDoc().getIDocumentLayoutAccess().DelLayoutFormat( pTmpFormat ); aToDeleteFrameFormats.pop_back(); } @@ -330,7 +330,7 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat( const bool bDraw = RES_DRAWFRMFMT == rSource.Which(); OSL_ENSURE( bFly || bDraw, "this method only works for fly or draw" ); - SwDoc* pSrcDoc = const_cast<SwDoc*>(rSource.GetDoc()); + SwDoc& rSrcDoc = const_cast<SwDoc&>(rSource.GetDoc()); // May we copy this object? // We may, unless it's 1) it's a control (and therefore a draw) @@ -354,7 +354,7 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat( return nullptr; SwFrameFormat* pDest = m_rDoc.GetDfltFrameFormat(); - if( rSource.GetRegisteredIn() != pSrcDoc->GetDfltFrameFormat() ) + if( rSource.GetRegisteredIn() != rSrcDoc.GetDfltFrameFormat() ) pDest = m_rDoc.CopyFrameFormat( *static_cast<const SwFrameFormat*>(rSource.GetRegisteredIn()) ); if( bFly ) { @@ -394,7 +394,7 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat( pDest->SetFormatAttr( aAttr ); pDest->SetFormatAttr( rNewAnchor ); - if( !m_rDoc.IsCopyIsMove() || &m_rDoc != pSrcDoc ) + if( !m_rDoc.IsCopyIsMove() || &m_rDoc != &rSrcDoc ) { if( (m_rDoc.IsInReading() && !bInHeaderFooter) || m_rDoc.IsInMailMerge() ) pDest->SetFormatName( UIName() ); @@ -429,7 +429,7 @@ SwFrameFormat *DocumentLayoutManager::CopyLayoutFormat( //contact object itself. They should be managed by SwUndoInsLayFormat. const ::sw::DrawUndoGuard drawUndoGuard(m_rDoc.GetIDocumentUndoRedo()); - pSrcDoc->GetDocumentContentOperationsManager().CopyWithFlyInFly(aRg, aIdx.GetNode(), nullptr, false, true, true); + rSrcDoc.GetDocumentContentOperationsManager().CopyWithFlyInFly(aRg, aIdx.GetNode(), nullptr, false, true, true); } else { diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index 6492c9bf5b9b..cbd0897433d5 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -112,7 +112,7 @@ namespace { // found, so get the data const SwNodeIndex* pIdx = pSectFormat->GetContent().GetContentIdx(); - if (pIdx && &pSectFormat->GetDoc()->GetNodes() == &pIdx->GetNodes()) + if (pIdx && &pSectFormat->GetDoc().GetNodes() == &pIdx->GetNodes()) { // a table in the normal NodesArr return pIdx->GetNode().GetSectionNode(); @@ -138,7 +138,7 @@ namespace { SwTableBox* pFBox = pTmpTable->GetTabSortBoxes()[0]; if (pFBox && pFBox->GetSttNd() - && &pTableFormat->GetDoc()->GetNodes() == &pFBox->GetSttNd()->GetNodes()) + && &pTableFormat->GetDoc().GetNodes() == &pFBox->GetSttNd()->GetNodes()) { // a table in the normal NodesArr return const_cast<SwTableNode*>(pFBox->GetSttNd()->FindTableNode()); diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 22547274d414..1658504e1fd0 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -280,7 +280,7 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam) { // note: this will also create frames for all currently hidden flys // because it calls AppendAllObjs - ::MakeFrames(&rDoc, currentStart.GetNode(), *pTableOrSectionNode->EndOfSectionNode()); + ::MakeFrames(rDoc, currentStart.GetNode(), *pTableOrSectionNode->EndOfSectionNode()); isAppendObjsCalled = true; } currentStart.Assign( pTableOrSectionNode->EndOfSectionIndex() + 1 ); @@ -358,7 +358,7 @@ void UpdateFramesForRemoveDeleteRedline(SwDoc & rDoc, SwPaM const& rPam) SwNodeIndex const end(*pLast, +1); // end is exclusive // note: this will also create frames for all currently hidden flys // both on first and non-first nodes because it calls AppendAllObjs - ::MakeFrames(&rDoc, start.GetNode(), end.GetNode()); + ::MakeFrames(rDoc, start.GetNode(), end.GetNode()); isAppendObjsCalled = true; // re-use this to move flys that are now on the wrong frame, with end // of redline as "second" node; the nodes between start and end should diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx index 0ae2e2c1acf4..cc867129f8b8 100644 --- a/sw/source/core/doc/docchart.cxx +++ b/sw/source/core/doc/docchart.cxx @@ -33,7 +33,7 @@ void SwTable::UpdateCharts() const { - GetFrameFormat()->GetDoc()->UpdateCharts( GetFrameFormat()->GetName() ); + GetFrameFormat()->GetDoc().UpdateCharts( GetFrameFormat()->GetName() ); } bool SwTable::IsTableComplexForChart( std::u16string_view aSelection ) const diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 7f7cb232c6cc..43449dee0543 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -93,11 +93,11 @@ void RestFlyInRange( SaveFlyArr & rArr, const SwPosition& rStartPos, } aAnchor.SetAnchor( &aPos ); - pFormat->GetDoc()->GetSpzFrameFormats()->push_back(static_cast<sw::SpzFrameFormat*>(pFormat)); + pFormat->GetDoc().GetSpzFrameFormats()->push_back(static_cast<sw::SpzFrameFormat*>(pFormat)); // SetFormatAttr should call Modify() and add it to the node pFormat->SetFormatAttr( aAnchor ); SwContentNode* pCNd = aPos.GetNode().GetContentNode(); - if (pCNd && pCNd->getLayoutFrame(pFormat->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)) + if (pCNd && pCNd->getLayoutFrame(pFormat->GetDoc().getIDocumentLayoutAccess().GetCurrentLayout(), nullptr, nullptr)) pFormat->MakeFrames(); } sw::CheckAnchoredFlyConsistency(rStartPos.GetNode().GetDoc()); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 7c0aa1f5c4cd..959c2bf901b9 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1216,7 +1216,7 @@ SwTextFormatColl* SwDoc::CopyTextColl( const SwTextFormatColl& rColl ) pNewColl->SetNextTextFormatColl( *CopyTextColl( rColl.GetNextTextFormatColl() )); // create the NumRule if necessary - if( this != rColl.GetDoc() ) + if( this != &rColl.GetDoc() ) { const SwNumRuleItem* pItem = pNewColl->GetItemIfSet( RES_PARATR_NUMRULE, false ); @@ -1225,7 +1225,7 @@ SwTextFormatColl* SwDoc::CopyTextColl( const SwTextFormatColl& rColl ) UIName aName( pItem->GetValue() ); if( !aName.isEmpty() ) { - const SwNumRule* pRule = rColl.GetDoc()->FindNumRulePtr( aName ); + const SwNumRule* pRule = rColl.GetDoc().FindNumRulePtr( aName ); if( pRule && !pRule->IsAutoRule() ) { SwNumRule* pDestRule = FindNumRulePtr( aName ); @@ -1394,7 +1394,7 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, { if( pContent->GetContentIdx() ) { - const SwNodes& rSrcNds = rSrcFormat.GetDoc()->GetNodes(); + const SwNodes& rSrcNds = rSrcFormat.GetDoc().GetNodes(); SwStartNode* pSttNd = SwNodes::MakeEmptySection( GetNodes().GetEndOfAutotext(), bCpyHeader ? SwHeaderStartNode @@ -1402,7 +1402,7 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, const SwNode& rCSttNd = pContent->GetContentIdx()->GetNode(); SwNodeRange aRg( rCSttNd, SwNodeOffset(0), *rCSttNd.EndOfSectionNode() ); rSrcNds.Copy_( aRg, *pSttNd->EndOfSectionNode() ); - rSrcFormat.GetDoc()->GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRg, nullptr, *pSttNd); + rSrcFormat.GetDoc().GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRg, nullptr, *pSttNd); // TODO: investigate calling CopyWithFlyInFly? SwPaM const source(aRg.aStart, aRg.aEnd); SwPosition dest(*pSttNd); @@ -1552,7 +1552,7 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, // Copy format only if it exists if (auto pStashedFormatSrc = rSrcDesc.GetStashedFrameFormat(bHeader, bLeft, bFirst)) { - if (pStashedFormatSrc->GetDoc() != this) + if (&pStashedFormatSrc->GetDoc() != this) { SwFrameFormat newFormat(GetAttrPool(), UIName(u"CopyDesc"_ustr), GetDfltFrameFormat()); diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index b57d8e62411a..232dd420ae46 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -173,18 +173,16 @@ namespace { void lcl_ResetPoolIdForDocAndSync(const sal_uInt16 nId, SwCharFormat* pFormat, const SwEndNoteInfo& rInfo) { - auto pDoc = pFormat->GetDoc(); - if(!pDoc) - return; - for(auto pDocFormat : *pDoc->GetCharFormats()) + SwDoc& rDoc = pFormat->GetDoc(); + for(auto pDocFormat : *rDoc.GetCharFormats()) { if(pDocFormat == pFormat) pDocFormat->SetPoolFormatId(nId); else if(pDocFormat->GetPoolFormatId() == nId) pDocFormat->SetPoolFormatId(0); } - rInfo.GetCharFormat(*pDoc); - rInfo.GetAnchorCharFormat(*pDoc); + rInfo.GetCharFormat(rDoc); + rInfo.GetAnchorCharFormat(rDoc); } } @@ -233,8 +231,8 @@ void SwEndNoteInfo::UpdateFormatOrAttr() auto pFormat = GetCurrentCharFormat(m_pCharFormat == nullptr); if (!pFormat || !m_aDepends.IsListeningTo(pFormat) || pFormat->IsFormatInDTOR()) return; - SwDoc* pDoc = pFormat->GetDoc(); - SwFootnoteIdxs& rFootnoteIdxs = pDoc->GetFootnoteIdxs(); + SwDoc& rDoc = pFormat->GetDoc(); + SwFootnoteIdxs& rFootnoteIdxs = rDoc.GetFootnoteIdxs(); for(auto pTextFootnote : rFootnoteIdxs) { const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote(); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 20966e6e7cde..2f1d99478f3f 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -206,7 +206,7 @@ static void lcl_DelFormatIndices( SwFormat const * pFormat ) */ SwDoc::SwDoc() : m_pNodes(new SwNodes(*this)), - mpAttrPool(new SwAttrPool(this)), + mpAttrPool(new SwAttrPool(*this)), maOLEModifiedIdle( "sw::SwDoc maOLEModifiedIdle" ), mpMarkManager(new ::sw::mark::MarkManager(*this)), m_pMetaFieldManager(new ::sw::MetaFieldManager()), diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 22d07d027f66..295728c8f1d6 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -70,10 +70,10 @@ using namespace com::sun::star; #ifdef DBG_UTIL - void sw_DebugRedline( const SwDoc* pDoc ) + void sw_DebugRedline( const SwDoc& rDoc ) { static SwRedlineTable::size_type nWatch = 0; // loplugin:constvars:ignore - const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + const SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); for( SwRedlineTable::size_type n = 0; n < rTable.size(); ++n ) { volatile SwRedlineTable::size_type nDummy = 0; @@ -189,11 +189,11 @@ bool SwExtraRedlineTable::DeleteAllTableRedlines( SwDoc& rDoc, const SwTable& rT return bChg; } -bool SwExtraRedlineTable::DeleteTableRowRedline( SwDoc* pDoc, const SwTableLine& rTableLine, bool bSaveInUndo, RedlineType nRedlineTypeToDelete ) +bool SwExtraRedlineTable::DeleteTableRowRedline( SwDoc& rDoc, const SwTableLine& rTableLine, bool bSaveInUndo, RedlineType nRedlineTypeToDelete ) { bool bChg = false; - if (bSaveInUndo && pDoc->GetIDocumentUndoRedo().DoesUndo()) + if (bSaveInUndo && rDoc.GetIDocumentUndoRedo().DoesUndo()) { // #TODO - Add 'Undo' support for deleting 'Table Cell' redlines /* @@ -230,16 +230,16 @@ bool SwExtraRedlineTable::DeleteTableRowRedline( SwDoc* pDoc, const SwTableLine& } if( bChg ) - pDoc->getIDocumentState().SetModified(); + rDoc.getIDocumentState().SetModified(); return bChg; } -bool SwExtraRedlineTable::DeleteTableCellRedline( SwDoc* pDoc, const SwTableBox& rTableBox, bool bSaveInUndo, RedlineType nRedlineTypeToDelete ) +bool SwExtraRedlineTable::DeleteTableCellRedline( SwDoc& rDoc, const SwTableBox& rTableBox, bool bSaveInUndo, RedlineType nRedlineTypeToDelete ) { bool bChg = false; - if (bSaveInUndo && pDoc->GetIDocumentUndoRedo().DoesUndo()) + if (bSaveInUndo && rDoc.GetIDocumentUndoRedo().DoesUndo()) { // #TODO - Add 'Undo' support for deleting 'Table Cell' redlines /* @@ -276,7 +276,7 @@ bool SwExtraRedlineTable::DeleteTableCellRedline( SwDoc* pDoc, const SwTableBox& } if( bChg ) - pDoc->getIDocumentState().SetModified(); + rDoc.getIDocumentState().SetModified(); return bChg; } diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index a391ffc416f3..5c094cad11ef 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1217,12 +1217,12 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, void SwTOXBaseSection::InsertAlphaDelimiter( const SwTOXInternational& rIntl ) { - SwDoc* pDoc = GetFormat()->GetDoc(); + SwDoc& rDoc = GetFormat()->GetDoc(); OUString sLastDeli; size_t i = 0; while( i < m_aSortArr.size() ) { - ::SetProgressState( 0, pDoc->GetDocShell() ); + ::SetProgressState( 0, rDoc.GetDocShell() ); sal_uInt16 nLevel = m_aSortArr[i]->GetLevel(); @@ -1260,9 +1260,9 @@ void SwTOXBaseSection::InsertAlphaDelimiter( const SwTOXInternational& rIntl ) /// Evaluate Template SwTextFormatColl* SwTOXBaseSection::GetTextFormatColl( sal_uInt16 nLevel ) { - SwDoc* pDoc = GetFormat()->GetDoc(); + SwDoc& rDoc = GetFormat()->GetDoc(); const UIName& rName = GetTOXForm().GetTemplate( nLevel ); - SwTextFormatColl* pColl = !rName.isEmpty() ? pDoc->FindTextFormatCollByName(rName) :nullptr; + SwTextFormatColl* pColl = !rName.isEmpty() ? rDoc.FindTextFormatCollByName(rName) :nullptr; if( !pColl ) { sal_uInt16 nPoolFormat = 0; @@ -1302,7 +1302,7 @@ SwTextFormatColl* SwTOXBaseSection::GetTextFormatColl( sal_uInt16 nLevel ) } else nPoolFormat = nPoolFormat + nLevel; - pColl = pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( nPoolFormat ); + pColl = rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool( nPoolFormat ); } return pColl; } @@ -1339,7 +1339,7 @@ void SwTOXBaseSection::UpdateMarks(const SwTOXInternational& rIntl, SwRootFrame const*const pLayout) { const auto pType = static_cast<SwTOXType*>(SwTOXBase::GetRegisteredIn()); - auto pShell = GetFormat()->GetDoc()->GetDocShell(); + auto pShell = GetFormat()->GetDoc().GetDocShell(); const TOXTypes eTOXTyp = GetTOXType()->GetType(); std::vector<std::reference_wrapper<SwTextTOXMark>> vMarks; pType->CollectTextTOXMarksForLayout(vMarks, pLayout); @@ -1418,13 +1418,13 @@ static bool useTextNodeForIndex(const SwTextNode* node, int maxLevel, bool fromC void SwTOXBaseSection::UpdateOutline( const SwTextNode* pOwnChapterNode, SwRootFrame const*const pLayout) { - SwDoc* pDoc = GetFormat()->GetDoc(); - SwNodes& rNds = pDoc->GetNodes(); + SwDoc& rDoc = GetFormat()->GetDoc(); + SwNodes& rNds = rDoc.GetNodes(); const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds(); for( auto pOutlineNode : rOutlNds ) { - ::SetProgressState( 0, pDoc->GetDocShell() ); + ::SetProgressState( 0, rDoc.GetDocShell() ); SwTextNode* pTextNd = pOutlineNode->GetTextNode(); if (useTextNodeForIndex(pTextNd, GetLevel(), IsFromChapter(), pOwnChapterNode, pLayout)) { @@ -1438,7 +1438,7 @@ void SwTOXBaseSection::UpdateTemplate(const SwTextNode* pOwnChapterNode, SwRootFrame const*const pLayout) { int nMaxLevel = SwTOXBase::GetType() == TOX_CONTENT ? GetLevel() : -1; - SwDoc* pDoc = GetFormat()->GetDoc(); + SwDoc& rDoc = GetFormat()->GetDoc(); for(sal_uInt16 i = 0; i < MAXLEVEL; i++) { const UIName sTmpStyleNames = GetStyleNames(i); @@ -1448,7 +1448,7 @@ void SwTOXBaseSection::UpdateTemplate(const SwTextNode* pOwnChapterNode, sal_Int32 nIndex = 0; while (nIndex >= 0) { - SwTextFormatColl* pColl = pDoc->FindTextFormatCollByName( + SwTextFormatColl* pColl = rDoc.FindTextFormatCollByName( UIName(sTmpStyleNames.toString().getToken( 0, TOX_STYLE_DELIMITER, nIndex ))); //TODO: no outline Collections in content indexes if OutlineLevels are already included if( !pColl || @@ -1460,7 +1460,7 @@ void SwTOXBaseSection::UpdateTemplate(const SwTextNode* pOwnChapterNode, SwIterator<SwTextNode,SwFormatColl> aIter( *pColl ); for( SwTextNode* pTextNd = aIter.First(); pTextNd; pTextNd = aIter.Next() ) { - ::SetProgressState( 0, pDoc->GetDocShell() ); + ::SetProgressState( 0, rDoc.GetDocShell() ); if (useTextNodeForIndex(pTextNd, nMaxLevel, IsFromChapter(), pOwnChapterNode, pLayout)) { @@ -1475,8 +1475,8 @@ void SwTOXBaseSection::UpdateTemplate(const SwTextNode* pOwnChapterNode, void SwTOXBaseSection::UpdateSequence(const SwTextNode* pOwnChapterNode, SwRootFrame const*const pLayout) { - SwDoc* pDoc = GetFormat()->GetDoc(); - SwFieldType* pSeqField = pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::SetExp, GetSequenceName(), false); + SwDoc& rDoc = GetFormat()->GetDoc(); + SwFieldType* pSeqField = rDoc.getIDocumentFieldsAccess().GetFieldType(SwFieldIds::SetExp, GetSequenceName(), false); if(!pSeqField) return; @@ -1486,11 +1486,11 @@ void SwTOXBaseSection::UpdateSequence(const SwTextNode* pOwnChapterNode, { const SwTextField* pTextField = pFormatField->GetTextField(); SwTextNode& rTextNode = pTextField->GetTextNode(); - ::SetProgressState( 0, pDoc->GetDocShell() ); + ::SetProgressState( 0, rDoc.GetDocShell() ); if (useTextNodeForIndex(&rTextNode, -1, IsFromChapter(), pOwnChapterNode, pLayout) && (!pLayout || !pLayout->IsHideRedlines() - || !sw::IsFieldDeletedInModel(pDoc->getIDocumentRedlineAccess(), *pTextField))) + || !sw::IsFieldDeletedInModel(rDoc.getIDocumentRedlineAccess(), *pTextField))) { const SwSetExpField& rSeqField = dynamic_cast<const SwSetExpField&>(*(pFormatField->GetField())); const OUString sName = GetSequenceName().toString() @@ -1501,7 +1501,7 @@ void SwTOXBaseSection::UpdateSequence(const SwTextNode* pOwnChapterNode, if( GetCaptionDisplay() == CAPTION_TEXT ) { pNew->SetStartIndex( - SwGetExpField::GetReferenceTextPos( *pFormatField, *pDoc )); + SwGetExpField::GetReferenceTextPos( *pFormatField, rDoc )); } else if(GetCaptionDisplay() == CAPTION_NUMBER) { @@ -1516,8 +1516,8 @@ void SwTOXBaseSection::UpdateSequence(const SwTextNode* pOwnChapterNode, void SwTOXBaseSection::UpdateAuthorities(const SwTOXInternational& rIntl, SwRootFrame const*const pLayout) { - SwDoc* pDoc = GetFormat()->GetDoc(); - SwFieldType* pAuthField = pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::TableOfAuthorities, OUString(), false); + SwDoc& rDoc = GetFormat()->GetDoc(); + SwFieldType* pAuthField = rDoc.getIDocumentFieldsAccess().GetFieldType(SwFieldIds::TableOfAuthorities, OUString(), false); if(!pAuthField) return; @@ -1527,18 +1527,18 @@ void SwTOXBaseSection::UpdateAuthorities(const SwTOXInternational& rIntl, { const auto pTextField = pFormatField->GetTextField(); const SwTextNode& rTextNode = pFormatField->GetTextField()->GetTextNode(); - ::SetProgressState( 0, pDoc->GetDocShell() ); + ::SetProgressState( 0, rDoc.GetDocShell() ); if (useTextNodeForIndex(&rTextNode, -1, false, nullptr, pLayout) && (!pLayout || !pLayout->IsHideRedlines() - || !sw::IsFieldDeletedInModel(pDoc->getIDocumentRedlineAccess(), *pTextField))) + || !sw::IsFieldDeletedInModel(rDoc.getIDocumentRedlineAccess(), *pTextField))) { //#106485# the body node has to be used! SwContentFrame *const pFrame = rTextNode.getLayoutFrame(pLayout); SwPosition aFieldPos(rTextNode); const SwTextNode* pTextNode = nullptr; if(pFrame && !pFrame->IsInDocBody()) - pTextNode = GetBodyTextNode( *pDoc, aFieldPos, *pFrame ); + pTextNode = GetBodyTextNode( rDoc, aFieldPos, *pFrame ); if(!pTextNode) pTextNode = &rTextNode; @@ -1595,15 +1595,15 @@ void SwTOXBaseSection::UpdateContent( SwTOXElement eMyType, const SwTextNode* pOwnChapterNode, SwRootFrame const*const pLayout) { - SwDoc* pDoc = GetFormat()->GetDoc(); - SwNodes& rNds = pDoc->GetNodes(); + SwDoc& rDoc = GetFormat()->GetDoc(); + SwNodes& rNds = rDoc.GetNodes(); // on the 1st Node of the 1st Section SwNodeOffset nIdx = rNds.GetEndOfAutotext().StartOfSectionIndex() + SwNodeOffset(2), nEndIdx = rNds.GetEndOfAutotext().GetIndex(); while( nIdx < nEndIdx ) { - ::SetProgressState( 0, pDoc->GetDocShell() ); + ::SetProgressState( 0, rDoc.GetDocShell() ); SwNode* pNd = rNds[ nIdx ]; SwContentNode* pCNd = nullptr; @@ -1696,11 +1696,11 @@ void SwTOXBaseSection::UpdateContent( SwTOXElement eMyType, void SwTOXBaseSection::UpdateTable(const SwTextNode* pOwnChapterNode, SwRootFrame const*const pLayout) { - SwDoc* pDoc = GetFormat()->GetDoc(); + SwDoc& rDoc = GetFormat()->GetDoc(); - for(SwTableFormat* pFrameFormat: *pDoc->GetTableFrameFormats()) + for(SwTableFormat* pFrameFormat: *rDoc.GetTableFrameFormats()) { - ::SetProgressState( 0, pDoc->GetDocShell() ); + ::SetProgressState( 0, rDoc.GetDocShell() ); SwTable* pTmpTable = SwTable::FindTable( pFrameFormat ); SwTableBox* pFBox; @@ -1748,7 +1748,7 @@ void SwTOXBaseSection::UpdatePageNum() // Insert the current PageNumber into the TOC SwPageFrame* pCurrentPage = nullptr; sal_uInt16 nPage = 0; - SwDoc* pDoc = GetFormat()->GetDoc(); + SwDoc& rDoc = GetFormat()->GetDoc(); SwTOXInternational aIntl( GetLanguage(), TOX_INDEX == GetTOXType()->GetType() ? @@ -1787,13 +1787,13 @@ void SwTOXBaseSection::UpdatePageNum() size_t nSize = pSortBase->aTOXSources.size(); for (size_t j = 0; j < nSize; ++j) { - ::SetProgressState( 0, pDoc->GetDocShell() ); + ::SetProgressState( 0, rDoc.GetDocShell() ); SwTOXSource& rTOXSource = pSortBase->aTOXSources[j]; if( rTOXSource.pNd ) { - SwContentFrame* pFrame = rTOXSource.pNd->getLayoutFrame( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ); - OSL_ENSURE( pFrame || pDoc->IsUpdateTOX(), "TOX, no Frame found"); + SwContentFrame* pFrame = rTOXSource.pNd->getLayoutFrame( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() ); + OSL_ENSURE( pFrame || rDoc.IsUpdateTOX(), "TOX, no Frame found"); if( !pFrame ) continue; if( pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->HasFollow() ) diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index 055a3d438d2d..32d76a11cae3 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -64,7 +64,7 @@ namespace TextFormatCollFunc { const UIName sNumRuleName = pNewNumRuleItem->GetValue(); if ( sNumRuleName.isEmpty() || - sNumRuleName != pTextFormatColl->GetDoc()->GetOutlineNumRule()->GetName() ) + sNumRuleName != pTextFormatColl->GetDoc().GetOutlineNumRule()->GetName() ) { // delete assignment of paragraph style to list level of outline style. pTextFormatColl->DeleteAssignmentToListLevelOfOutlineStyle(); @@ -82,7 +82,7 @@ namespace TextFormatCollFunc const UIName sNumRuleName = pNumRuleItem->GetValue(); if ( !sNumRuleName.isEmpty() ) { - pNumRule = rTextFormatColl.GetDoc()->FindNumRulePtr( sNumRuleName ); + pNumRule = rTextFormatColl.GetDoc().FindNumRulePtr( sNumRuleName ); } } @@ -113,12 +113,12 @@ SwTextFormatColl::~SwTextFormatColl() if(m_bInSwFntCache) pSwFontCache->Delete( this ); - if (GetDoc()->IsInDtor()) + if (GetDoc().IsInDtor()) { return; } - for (const auto& pCharFormat : *GetDoc()->GetCharFormats()) + for (const auto& pCharFormat : *GetDoc().GetCharFormats()) { if (pCharFormat->GetLinkedParaFormat() == this) { @@ -144,7 +144,7 @@ void SwTextFormatColl::SwClientNotify(const SwModify& rModify, const SfxHint& rH && rHint.GetId() != SfxHintId::SwObjectDying && rHint.GetId() != SfxHintId::SwUpdateAttr) return; - if(GetDoc()->IsInDtor()) + if(GetDoc().IsInDtor()) { SwFormatColl::SwClientNotify(rModify, rHint); return; @@ -393,7 +393,7 @@ const SwCharFormat* SwTextFormatColl::GetLinkedCharFormat() const { return mpLin bool SwTextFormatColl::IsAtDocNodeSet() const { SwIterator<SwContentNode,SwFormatColl> aIter( *this ); - const SwNodes& rNds = GetDoc()->GetNodes(); + const SwNodes& rNds = GetDoc().GetNodes(); for( SwContentNode* pNode = aIter.First(); pNode; pNode = aIter.Next() ) if( &(pNode->GetNodes()) == &rNds ) return true; @@ -658,7 +658,7 @@ void SwConditionTextFormatColl::SetConditions( const SwFormatCollConditions& rCn { // Copy the Conditions, but first delete the old ones m_CondColls.clear(); - SwDoc& rDoc = *GetDoc(); + SwDoc& rDoc = GetDoc(); for (const auto &rpFnd : rCndClls) { SwTextFormatColl *const pTmpColl = rpFnd->GetTextFormatColl() diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx index 0330e4007da9..a315c315ece5 100644 --- a/sw/source/core/doc/lineinfo.cxx +++ b/sw/source/core/doc/lineinfo.cxx @@ -124,12 +124,12 @@ void SwLineNumberInfo::SwClientNotify(const SwModify&, const SfxHint& rHint) auto pDyingHint = static_cast<const sw::ObjectDyingHint*>(&rHint); CheckRegistration( *pDyingHint ); } - SwDoc *pDoc = static_cast<SwCharFormat*>(GetRegisteredIn())->GetDoc(); - SwRootFrame* pRoot = pDoc->getIDocumentLayoutAccess().GetCurrentLayout(); + SwDoc& rDoc = static_cast<SwCharFormat*>(GetRegisteredIn())->GetDoc(); + SwRootFrame* pRoot = rDoc.getIDocumentLayoutAccess().GetCurrentLayout(); if( pRoot ) { pRoot->StartAllAction(); - for( auto aLayout : pDoc->GetAllLayouts() ) + for( auto aLayout : rDoc.GetAllLayouts() ) aLayout->AllAddPaintRect(); pRoot->EndAllAction(); } diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index bf78ee7b6ab1..4eec424907a4 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -319,8 +319,8 @@ void SwNumFormat::SwClientNotify(const SwModify&, const SfxHint& rHint) // Look for the NumRules object in the Doc where this NumFormat is set. // The format does not need to exist! const SwCharFormat* pFormat = GetCharFormat(); - if(pFormat && !pFormat->GetDoc()->IsInDtor()) - UpdateNumNodes(*const_cast<SwDoc*>(pFormat->GetDoc())); + if(pFormat && !pFormat->GetDoc().IsInDtor()) + UpdateNumNodes(const_cast<SwDoc&>(pFormat->GetDoc())); } else if (rHint.GetId() == SfxHintId::SwAttrSetChange) { @@ -328,8 +328,8 @@ void SwNumFormat::SwClientNotify(const SwModify&, const SfxHint& rHint) // The format does not need to exist! const SwCharFormat* pFormat = GetCharFormat(); - if(pFormat && !pFormat->GetDoc()->IsInDtor()) - UpdateNumNodes(*const_cast<SwDoc*>(pFormat->GetDoc())); + if(pFormat && !pFormat->GetDoc().IsInDtor()) + UpdateNumNodes(const_cast<SwDoc&>(pFormat->GetDoc())); } else if (rHint.GetId() == SfxHintId::SwObjectDying) { @@ -561,7 +561,7 @@ void SwNumRule::CheckCharFormats( SwDoc& rDoc ) if( rpNumFormat ) { SwCharFormat* pFormat = rpNumFormat->GetCharFormat(); - if( pFormat && pFormat->GetDoc() != &rDoc ) + if( pFormat && &pFormat->GetDoc() != &rDoc ) { // copy SwNumFormat* pNew = new SwNumFormat( *rpNumFormat ); diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 0529a04d5356..73f811491d63 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -674,11 +674,9 @@ void SwTableAutoFormat::RestoreTableProperties(SwTable &table) const if (!pFormat) return; - SwDoc *pDoc = pFormat->GetDoc(); - if (!pDoc) - return; + SwDoc& rDoc = pFormat->GetDoc(); - SfxItemSet rSet(pDoc->GetAttrPool(), aTableSetRange); + SfxItemSet rSet(rDoc.GetAttrPool(), aTableSetRange); rSet.Put(SwFormatLayoutSplit(m_bLayoutSplit)); rSet.Put(SfxBoolItem(RES_COLLAPSING_BORDERS, m_bCollapsingBorders)); @@ -688,8 +686,8 @@ void SwTableAutoFormat::RestoreTableProperties(SwTable &table) const pFormat->SetFormatAttr(rSet); - if (SwEditShell *pShell = pDoc->GetEditShell()) - pDoc->SetRowSplit(*pShell->getShellCursor(false), SwFormatRowSplit(m_bRowSplit)); + if (SwEditShell *pShell = rDoc.GetEditShell()) + rDoc.SetRowSplit(*pShell->getShellCursor(false), SwFormatRowSplit(m_bRowSplit)); table.SetRowsToRepeat(m_aRepeatHeading); } @@ -700,11 +698,9 @@ void SwTableAutoFormat::StoreTableProperties(const SwTable &table) if (!pFormat) return; - SwDoc *pDoc = pFormat->GetDoc(); - if (!pDoc) - return; + SwDoc& rDoc = pFormat->GetDoc(); - SwEditShell *pShell = pDoc->GetEditShell(); + SwEditShell *pShell = rDoc.GetEditShell(); std::unique_ptr<SwFormatRowSplit> pRowSplit(pShell ? SwDoc::GetRowSplit(*pShell->getShellCursor(false)) : nullptr); m_bRowSplit = pRowSplit && pRowSplit->GetValue(); pRowSplit.reset(); diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index 903488787ec2..e7cdb8d92b8e 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -495,8 +495,8 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, OSL_ENSURE( ( !pCpyBox || pCpyBox->GetSttNd() ) && pDstBox->GetSttNd(), "No content in this Box" ); - SwDoc* pCpyDoc = rCpyTable.GetFrameFormat()->GetDoc(); - SwDoc* pDoc = rDstTable.GetFrameFormat()->GetDoc(); + SwDoc& rCpyDoc = rCpyTable.GetFrameFormat()->GetDoc(); + SwDoc& rDoc = rDstTable.GetFrameFormat()->GetDoc(); // First copy the new content and then delete the old one. // Do not create empty Sections, otherwise they will be deleted! @@ -511,14 +511,14 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, if( pUndo ) pUndo->AddBoxBefore( *pDstBox, bDelContent ); - bool bUndoRedline = pUndo && pDoc->getIDocumentRedlineAccess().IsRedlineOn(); - ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); + bool bUndoRedline = pUndo && rDoc.getIDocumentRedlineAccess().IsRedlineOn(); + ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); SwNodeIndex aSavePos( aInsIdx, -1 ); if (pRg) - pCpyDoc->GetDocumentContentOperationsManager().CopyWithFlyInFly(*pRg, aInsIdx.GetNode(), nullptr, false); + rCpyDoc.GetDocumentContentOperationsManager().CopyWithFlyInFly(*pRg, aInsIdx.GetNode(), nullptr, false); else - pDoc->GetNodes().MakeTextNode( aInsIdx.GetNode(), pDoc->GetDfltTextFormatColl() ); + rDoc.GetNodes().MakeTextNode( aInsIdx.GetNode(), rDoc.GetDfltTextFormatColl() ); ++aSavePos; SwTableLine* pLine = pDstBox->GetUpper(); @@ -541,7 +541,7 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, } // If we still have FlyFrames hanging around, delete them too - for(sw::SpzFrameFormat* pFly: *pDoc->GetSpzFrameFormats()) + for(sw::SpzFrameFormat* pFly: *rDoc.GetSpzFrameFormats()) { SwFormatAnchor const*const pAnchor = &pFly->GetAnchor(); SwNode const*const pAnchorNode = pAnchor->GetAnchorNode(); @@ -550,7 +550,7 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, (RndStdIds::FLY_AT_CHAR == pAnchor->GetAnchorId())) && aInsIdx <= *pAnchorNode && *pAnchorNode <= aEndNdIdx.GetNode() ) { - pDoc->getIDocumentLayoutAccess().DelLayoutFormat( pFly ); + rDoc.getIDocumentLayoutAccess().DelLayoutFormat( pFly ); } } @@ -572,7 +572,7 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, bReplaceColl = false; } - pDoc->GetNodes().Delete( aInsIdx, aEndNdIdx.GetIndex() - aInsIdx.GetIndex() ); + rDoc.GetNodes().Delete( aInsIdx, aEndNdIdx.GetIndex() - aInsIdx.GetIndex() ); } //b6341295: Table copy redlining will be managed by AddBoxAfter() @@ -592,7 +592,7 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, ? RES_POOLCOLL_TABLE == nPoolId : RES_POOLCOLL_TABLE_HDLN == nPoolId ) ) { - SwTextFormatColl* pColl = pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( + SwTextFormatColl* pColl = rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool( o3tl::narrowing<sal_uInt16>( RES_POOLCOLL_TABLE == nPoolId ? RES_POOLCOLL_TABLE_HDLN @@ -602,7 +602,7 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, SwPaM aPam( aSavePos ); aPam.SetMark(); aPam.Move( fnMoveForward, GoInSection ); - pDoc->SetTextFormatColl( aPam, pColl ); + rDoc.SetTextFormatColl( aPam, pColl ); } } @@ -619,13 +619,13 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, if( !pCpyBox ) return; - SfxItemSetFixed<RES_BOXATR_FORMAT, RES_BOXATR_VALUE> aBoxAttrSet( pCpyDoc->GetAttrPool() ); + SfxItemSetFixed<RES_BOXATR_FORMAT, RES_BOXATR_VALUE> aBoxAttrSet( rCpyDoc.GetAttrPool() ); aBoxAttrSet.Put( pCpyBox->GetFrameFormat()->GetAttrSet() ); if( !aBoxAttrSet.Count() ) return; const SwTableBoxNumFormat* pItem; - SvNumberFormatter* pN = pDoc->GetNumberFormatter( false ); + SvNumberFormatter* pN = rDoc.GetNumberFormatter( false ); if( pN && pN->HasMergeFormatTable() && (pItem = aBoxAttrSet.GetItemIfSet( RES_BOXATR_FORMAT, false )) ) { @@ -640,10 +640,10 @@ static void lcl_CpyBox( const SwTable& rCpyTable, const SwTableBox* pCpyBox, bool SwTable::InsNewTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, SwUndoTableCpyTable* pUndo ) { - SwDoc* pDoc = GetFrameFormat()->GetDoc(); - SwDoc* pCpyDoc = rCpyTable.GetFrameFormat()->GetDoc(); + SwDoc& rDoc = GetFrameFormat()->GetDoc(); + SwDoc& rCpyDoc = rCpyTable.GetFrameFormat()->GetDoc(); - SwTableNumFormatMerge aTNFM( *pCpyDoc, *pDoc ); + SwTableNumFormatMerge aTNFM( rCpyDoc, rDoc ); // Analyze source structure TableStructure aCopyStruct( rCpyTable ); @@ -664,7 +664,7 @@ bool SwTable::InsNewTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes if( pUndo ) pUndo->InsertRow( *this, aBoxes, aTarget.mnAddLine ); else - InsertRow( pDoc, aBoxes, aTarget.mnAddLine, /*bBehind*/true ); + InsertRow( rDoc, aBoxes, aTarget.mnAddLine, /*bBehind*/true ); aTarget.moreLines( *this ); bClear = true; @@ -704,7 +704,7 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwNodeIndex& rSttBox, { SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>()); // Delete HTML Layout - SwDoc* pDoc = GetFrameFormat()->GetDoc(); + SwDoc& rDoc = GetFrameFormat()->GetDoc(); SwTableNode* pTableNd = SwDoc::IsIdxInTable( rSttBox ); @@ -718,11 +718,11 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwNodeIndex& rSttBox, FndBox_ aFndBox( nullptr, nullptr ); aFndBox.DelFrames( pTableNd->GetTable() ); - SwDoc* pCpyDoc = rCpyTable.GetFrameFormat()->GetDoc(); + SwDoc& rCpyDoc = rCpyTable.GetFrameFormat()->GetDoc(); const_cast<SwTable*>(&rCpyTable)->SwitchFormulasToRelativeRepresentation(); - SwTableNumFormatMerge aTNFM( *pCpyDoc, *pDoc ); + SwTableNumFormatMerge aTNFM( rCpyDoc, rDoc ); bool bDelContent = true; const SwTableBox* pTmp; @@ -787,10 +787,10 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, OSL_ENSURE( !rCpyTable.IsTableComplex(), "Table too complex" ); - SwDoc* pDoc = GetFrameFormat()->GetDoc(); - SwDoc* pCpyDoc = rCpyTable.GetFrameFormat()->GetDoc(); + SwDoc& rDoc = GetFrameFormat()->GetDoc(); + SwDoc& rCpyDoc = rCpyTable.GetFrameFormat()->GetDoc(); - SwTableNumFormatMerge aTNFM( *pCpyDoc, *pDoc ); + SwTableNumFormatMerge aTNFM( rCpyDoc, rDoc ); FndLine_ *pFLine; FndBox_ aFndBox( nullptr, nullptr ); @@ -860,7 +860,7 @@ bool SwTable::InsTable( const SwTable& rCpyTable, const SwSelBoxes& rSelBoxes, if( pUndo ? !pUndo->InsertRow( *this, SelLineFromBox( pInsBox, aBoxes ), nNewLns ) - : !InsertRow( pDoc, SelLineFromBox( pInsBox, + : !InsertRow( rDoc, SelLineFromBox( pInsBox, aBoxes ), nNewLns, /*bBehind*/true ) ) return false; } diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 5e321bfe2a9b..71061ab46378 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -257,7 +257,7 @@ static void lcl_CopyCol( FndBox_ & rFndBox, CpyPara *const pCpyPara) aFrameSz.SetWidth( nSz / ( pCpyPara->nCpyCnt + 1 ) ); // Create a new Format for the new Box, specifying its size. - aFindFrame.pNewFrameFormat = reinterpret_cast<SwTableBoxFormat*>(pNewFormat->GetDoc()-> + aFindFrame.pNewFrameFormat = reinterpret_cast<SwTableBoxFormat*>(pNewFormat->GetDoc(). MakeTableLineFormat()); *aFindFrame.pNewFrameFormat = *pNewFormat; aFindFrame.pNewFrameFormat->SetFormatAttr( aFrameSz ); @@ -488,10 +488,10 @@ bool SwTable::InsertCol( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, return bRes; } -bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& rBoxes, +bool SwTable::InsertRow_( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind, bool bInsertDummy ) { - OSL_ENSURE( pDoc && !rBoxes.empty() && nCnt, "No valid Box List" ); + OSL_ENSURE( !rBoxes.empty() && nCnt, "No valid Box List" ); SwTableNode* pTableNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode()); if( !pTableNd ) return false; @@ -558,8 +558,6 @@ bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& rBoxes, else aCpyPara.nDelBorderFlag = 2; - assert(pDoc); - for( sal_uInt16 nCpyCnt = 0; nCpyCnt < nCnt; ++nCpyCnt ) { if( bBehind ) @@ -569,7 +567,7 @@ bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& rBoxes, SwTableLine* pNewTableLine = lcl_CopyRow( *rpFndLine, &aCpyPara ); // tracked insertion of empty table line - if ( pDoc->getIDocumentRedlineAccess().IsRedlineOn() ) + if ( rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) { SvxPrintItem aSetTracking(RES_PRINT, false); SwPosition aPos(*pNewTableLine->GetTabBoxes()[0]->GetSttNd()); @@ -577,16 +575,16 @@ bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& rBoxes, if ( bInsertDummy ) { SwPaM aPaM(*pNewTableLine->GetTabBoxes()[0]->GetSttNd(), SwNodeOffset(1)); - pDoc->getIDocumentContentOperations().InsertString( aPaM, + rDoc.getIDocumentContentOperations().InsertString( aPaM, OUStringChar(CH_TXT_TRACKED_DUMMY_CHAR) ); } - pDoc->SetRowNotTracked( aCursor, aSetTracking, /*bAll=*/false, /*bIns=*/true ); + rDoc.SetRowNotTracked( aCursor, aSetTracking, /*bAll=*/false, /*bIns=*/true ); } } } // clean up this Line's structure once again, generally all of them - if( !pDoc->IsInReading() ) + if( !rDoc.IsInReading() ) GCLines(); // Update Layout @@ -603,12 +601,12 @@ bool SwTable::InsertRow_( SwDoc* pDoc, const SwSelBoxes& rBoxes, CheckTableLayout(GetTabLines()); #endif - SwChartDataProvider *pPCD = pDoc->getIDocumentChartDataProviderAccess().GetChartDataProvider(); + SwChartDataProvider *pPCD = rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider(); if (pPCD && nCnt) pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind ); - pDoc->UpdateCharts( GetFrameFormat()->GetName() ); + rDoc.UpdateCharts( GetFrameFormat()->GetName() ); - if (SwFEShell* pFEShell = pDoc->GetDocShell()->GetFEShell()) + if (SwFEShell* pFEShell = rDoc.GetDocShell()->GetFEShell()) { if (officecfg::Office::Writer::Table::Change::ApplyTableAutoFormat::get()) { @@ -730,7 +728,7 @@ void DeleteBox_( SwTable& rTable, SwTableBox* pBox, SwUndo* pUndo, pShareFormats->RemoveFormat( *rTableBoxes[ nDelPos ]->GetFrameFormat() ); // Before deleting the 'Table Box' from memory - delete any redlines attached to it - rTable.GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess().GetExtraRedlineTable().DeleteTableCellRedline( rTable.GetFrameFormat()->GetDoc(), *(rTableBoxes[nDelPos]), true, RedlineType::Any ); + rTable.GetFrameFormat()->GetDoc().getIDocumentRedlineAccess().GetExtraRedlineTable().DeleteTableCellRedline( rTable.GetFrameFormat()->GetDoc(), *(rTableBoxes[nDelPos]), true, RedlineType::Any ); delete rTableBoxes[nDelPos]; rTableBoxes.erase( rTableBoxes.begin() + nDelPos ); @@ -782,7 +780,7 @@ void DeleteBox_( SwTable& rTable, SwTableBox* pBox, SwUndo* pUndo, SwTableLine* pTabLineToDelete = rTable.GetTabLines()[ nDelPos ]; // Before deleting the 'Table Line' from memory - delete any redlines attached to it - rTable.GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess().GetExtraRedlineTable().DeleteTableRowRedline( rTable.GetFrameFormat()->GetDoc(), *pTabLineToDelete, true, RedlineType::Any ); + rTable.GetFrameFormat()->GetDoc().getIDocumentRedlineAccess().GetExtraRedlineTable().DeleteTableRowRedline( rTable.GetFrameFormat()->GetDoc(), *pTabLineToDelete, true, RedlineType::Any ); delete pTabLineToDelete; rTable.GetTabLines().erase( rTable.GetTabLines().begin() + nDelPos ); break; // we cannot delete more @@ -796,7 +794,7 @@ void DeleteBox_( SwTable& rTable, SwTableBox* pBox, SwUndo* pUndo, SwTableLine* pTabLineToDelete = pBox->GetTabLines()[ nDelPos ]; // Before deleting the 'Table Line' from memory - delete any redlines attached to it - rTable.GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess().GetExtraRedlineTable().DeleteTableRowRedline( rTable.GetFrameFormat()->GetDoc(), *pTabLineToDelete, true, RedlineType::Any ); + rTable.GetFrameFormat()->GetDoc().getIDocumentRedlineAccess().GetExtraRedlineTable().DeleteTableRowRedline( rTable.GetFrameFormat()->GetDoc(), *pTabLineToDelete, true, RedlineType::Any ); delete pTabLineToDelete; pBox->GetTabLines().erase( pBox->GetTabLines().begin() + nDelPos ); } while( pBox->GetTabLines().empty() ); @@ -936,13 +934,12 @@ lcl_SaveUpperLowerBorder( SwTable& rTable, const SwTableBox& rBox, } bool SwTable::DeleteSel( - SwDoc* pDoc + SwDoc& rDoc , const SwSelBoxes& rBoxes, const SwSelBoxes* pMerged, SwUndo* pUndo, const bool bDelMakeFrames, const bool bCorrBorder ) { - OSL_ENSURE( pDoc, "No doc?" ); SwTableNode* pTableNd = nullptr; if( !rBoxes.empty() ) { @@ -979,7 +976,7 @@ bool SwTable::DeleteSel( PrepareDelBoxes( rBoxes ); - SwChartDataProvider *pPCD = pDoc->getIDocumentChartDataProviderAccess().GetChartDataProvider(); + SwChartDataProvider *pPCD = rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider(); // Delete boxes from last to first for (size_t n = 0; n < rBoxes.size(); ++n) { @@ -1002,7 +999,7 @@ bool SwTable::DeleteSel( aFndBox.MakeFrames( *this ); // TL_CHART2: now inform chart that sth has changed - pDoc->UpdateCharts( GetFrameFormat()->GetName() ); + rDoc.UpdateCharts( GetFrameFormat()->GetName() ); #if defined DBG_UTIL CheckTableLayout(GetTabLines()); @@ -1527,7 +1524,7 @@ static void lcl_Merge_MoveLine(FndLine_& rFndLine, InsULPara *const pULPara) static void lcl_BoxSetHeadCondColl( const SwTableBox* pBox ); -bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, +bool SwTable::OldMerge( SwDoc& rDoc, const SwSelBoxes& rBoxes, SwTableBox* pMergeBox, SwUndoTableMerge* pUndo ) { OSL_ENSURE( !rBoxes.empty() && pMergeBox, "no valid values" ); @@ -1547,7 +1544,7 @@ bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, // TL_CHART2: splitting/merging of a number of cells or rows will usually make // the table too complex to be handled with chart. // Thus we tell the charts to use their own data provider and forget about this table - pDoc->getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( this ); + rDoc.getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( this ); SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>()); // Delete HTML Layout @@ -1633,7 +1630,7 @@ bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, pUndo->AddNewBox( pRightBox->GetSttIdx() ); } - DeleteSel( pDoc, rBoxes, nullptr, nullptr, false, false ); + DeleteSel( rDoc, rBoxes, nullptr, nullptr, false, false ); // Clean up this Line's structure once again, generally all of them GCLines(); @@ -1918,12 +1915,12 @@ static void lcl_CopyBoxToDoc(FndBox_ const& rFndBox, CpyPara *const pCpyPara) pBox->ClaimFrameFormat()->SetFormatAttr( aBoxAttrSet ); } } - SwDoc* pFromDoc = rFndBox.GetBox()->GetFrameFormat()->GetDoc(); + SwDoc& rFromDoc = rFndBox.GetBox()->GetFrameFormat()->GetDoc(); SwNodeRange aCpyRg( *rFndBox.GetBox()->GetSttNd(), SwNodeOffset(1), *rFndBox.GetBox()->GetSttNd()->EndOfSectionNode() ); SwNodeIndex aInsIdx( *pBox->GetSttNd(), 1 ); - pFromDoc->GetDocumentContentOperationsManager().CopyWithFlyInFly(aCpyRg, aInsIdx.GetNode(), nullptr, false); + rFromDoc.GetDocumentContentOperationsManager().CopyWithFlyInFly(aCpyRg, aInsIdx.GetNode(), nullptr, false); // Delete the initial TextNode pCpyPara->rDoc.GetNodes().Delete( aInsIdx ); } @@ -2064,11 +2061,11 @@ bool SwTable::MakeCopy( SwDoc& rInsDoc, const SwPosition& rPos, // First copy the PoolTemplates for the Table, so that the Tables are // actually copied and have valid values. - SwDoc* pSrcDoc = GetFrameFormat()->GetDoc(); - if( pSrcDoc != &rInsDoc ) + SwDoc& rSrcDoc = GetFrameFormat()->GetDoc(); + if( &rSrcDoc != &rInsDoc ) { - rInsDoc.CopyTextColl( *pSrcDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TABLE ) ); - rInsDoc.CopyTextColl( *pSrcDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TABLE_HDLN ) ); + rInsDoc.CopyTextColl( *rSrcDoc.getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TABLE ) ); + rInsDoc.CopyTextColl( *rSrcDoc.getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TABLE_HDLN ) ); } SwTable* pNewTable = const_cast<SwTable*>(rInsDoc.InsertTable( @@ -2110,7 +2107,7 @@ bool SwTable::MakeCopy( SwDoc& rInsDoc, const SwPosition& rPos, const_cast<SwTable*>(this)->SwitchFormulasToRelativeRepresentation(); - SwTableNumFormatMerge aTNFM(*pSrcDoc, rInsDoc); + SwTableNumFormatMerge aTNFM(rSrcDoc, rInsDoc); // Also copy Names or enforce a new unique one if( bCpyName ) diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index 0d45170fd621..8eac0878c589 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -91,7 +91,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, SdrObject* pObject, bool bCo // Create the associated TextFrame and insert it into the document. rtl::Reference<SwXTextFrame> xTextFrame - = SwXTextFrame::CreateXTextFrame(*pShape->GetDoc(), nullptr); + = SwXTextFrame::CreateXTextFrame(pShape->GetDoc(), nullptr); uno::Reference<text::XTextRange> xAnchor; uno::Reference<text::XTextContent> xAnchorProvider(pObject->getWeakUnoShape().get(), @@ -106,7 +106,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, SdrObject* pObject, bool bCo if (!xTextContentAppend) { - if (SwDocShell* pShell = pShape->GetDoc()->GetDocShell()) + if (SwDocShell* pShell = pShape->GetDoc().GetDocShell()) { rtl::Reference<SwXTextDocument> xTextDocument(pShell->GetBaseModel()); xTextContentAppend = xTextDocument->getBodyText(); @@ -163,7 +163,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, SdrObject* pObject, bool bCo assert(!xTextFrame->getName().isEmpty()); // Link its text range to the original shape. - SwUnoInternalPaM aInternalPaM(*pShape->GetDoc()); + SwUnoInternalPaM aInternalPaM(pShape->GetDoc()); if (sw::XTextRangeToSwPaM(aInternalPaM, xTextFrame)) { SwAttrSet aSet(pShape->GetAttrSet()); @@ -223,7 +223,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, SdrObject* pObject, bool bCo if (pSourceText) pSourceText->SetText(OUString()); - pShape->GetDoc()->getIDocumentState().SetModified(); + pShape->GetDoc().getIDocumentState().SetModified(); } } @@ -491,7 +491,7 @@ static void lcl_queryInterface(const SwFrameFormat* pShape, uno::Any& rAny, SdrO = SwTextBoxHelper::getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj)) { uno::Reference<T> const xInterface( - getXWeak(SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat).get()), + getXWeak(SwXTextFrame::CreateXTextFrame(pFormat->GetDoc(), pFormat).get()), uno::UNO_QUERY); rAny <<= xInterface; } @@ -570,7 +570,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, std::u16string_view rP if (!pFormat) return; - auto xTextFrame = SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat); + auto xTextFrame = SwXTextFrame::CreateXTextFrame(pFormat->GetDoc(), pFormat); uno::Reference<text::XTextCursor> xCursor = xTextFrame->getText()->createTextCursor(); // Select all paragraphs in the textframe @@ -751,7 +751,7 @@ css::uno::Any SwTextBoxHelper::getProperty(SwFrameFormat const* pShape, const OU return {}; rtl::Reference<SwXTextFrame> xPropertySet - = SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat); + = SwXTextFrame::CreateXTextFrame(pFormat->GetDoc(), pFormat); return xPropertySet->getPropertyValue(rPropName); } @@ -881,7 +881,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u { uno::Reference<text::XTextRange> xRange; rValue >>= xRange; - SwUnoInternalPaM aInternalPaM(*pFormat->GetDoc()); + SwUnoInternalPaM aInternalPaM(pFormat->GetDoc()); if (sw::XTextRangeToSwPaM(aInternalPaM, xRange)) { SwFormatAnchor aAnchor(pFormat->GetAnchor()); @@ -987,7 +987,7 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, sal_uInt16 nWID, sal_u } auto aGuard = SwTextBoxLockGuard(*pShape->GetOtherTextBoxFormats()); rtl::Reference<SwXTextFrame> const xPropertySet - = SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat); + = SwXTextFrame::CreateXTextFrame(pFormat->GetDoc(), pFormat); xPropertySet->setPropertyValue(aPropertyName, aValue); } @@ -1061,7 +1061,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& rShape, SfxItemSet const& const bool bLayoutInCell = rShape.GetFollowTextFlow().GetValue() && rShape.GetAnchor().GetAnchorNode() && rShape.GetAnchor().GetAnchorNode()->FindTableNode(); - SfxItemSet aTextBoxSet(pFormat->GetDoc()->GetAttrPool(), aFrameFormatSetRange); + SfxItemSet aTextBoxSet(pFormat->GetDoc().GetAttrPool(), aFrameFormatSetRange); SfxItemIter aIter(rSet); const SfxPoolItem* pItem = aIter.GetCurItem(); @@ -1264,9 +1264,9 @@ bool SwTextBoxHelper::changeAnchor(SwFrameFormat* pShape, SdrObject* pObj) try { auto aGuard = SwTextBoxLockGuard(*pShape->GetOtherTextBoxFormats()); - ::sw::UndoGuard const UndoGuard(pShape->GetDoc()->GetIDocumentUndoRedo()); + ::sw::UndoGuard const UndoGuard(pShape->GetDoc().GetIDocumentUndoRedo()); rtl::Reference<SwXTextFrame> const xPropertySet - = SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat); + = SwXTextFrame::CreateXTextFrame(pFormat->GetDoc(), pFormat); if (pOldCnt && rNewAnch.GetAnchorId() == RndStdIds::FLY_AT_PAGE && rNewAnch.GetPageNum()) { @@ -1349,7 +1349,7 @@ bool SwTextBoxHelper::doTextBoxPositioning(SwFrameFormat* pShape, SdrObject* pOb if (auto pFormat = getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj)) { // Do not create undo entry for the positioning - ::sw::UndoGuard const UndoGuard(pShape->GetDoc()->GetIDocumentUndoRedo()); + ::sw::UndoGuard const UndoGuard(pShape->GetDoc().GetIDocumentUndoRedo()); auto aGuard = SwTextBoxLockGuard(*pShape->GetOtherTextBoxFormats()); // Special treatment for AS_CHAR textboxes: if (pShape->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR) @@ -1614,7 +1614,7 @@ bool SwTextBoxHelper::DoTextBoxZOrderCorrection(SwFrameFormat* pShape, const Sdr return false; } // Get the draw model from the doc - SwDrawModel* pDrawModel = pShape->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); + SwDrawModel* pDrawModel = pShape->GetDoc().getIDocumentDrawModelAccess().GetDrawModel(); if (!pDrawModel) { SAL_WARN("sw.core", "SwTextBoxHelper::DoTextBoxZOrderCorrection(): " @@ -1824,7 +1824,7 @@ void SwTextBoxNode::DelTextBox(const SdrObject* pDrawObject, bool bDelFromDoc) { if (bDelFromDoc) { - it->m_pTextBoxFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat( + it->m_pTextBoxFormat->GetDoc().getIDocumentLayoutAccess().DelLayoutFormat( it->m_pTextBoxFormat); // What about m_pTextBoxes? So, when the DelLayoutFormat() removes the format // then the ~SwFrameFormat() will call this method again to remove the entry. @@ -1853,7 +1853,7 @@ void SwTextBoxNode::DelTextBox(const SwFrameFormat* pTextBox, bool bDelFromDoc) { if (bDelFromDoc) { - it->m_pTextBoxFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat( + it->m_pTextBoxFormat->GetDoc().getIDocumentLayoutAccess().DelLayoutFormat( it->m_pTextBoxFormat); // What about m_pTextBoxes? So, when the DelLayoutFormat() removes the format // then the ~SwFrameFormat() will call this method again to remove the entry. @@ -1907,7 +1907,7 @@ void SwTextBoxNode::ClearAll() // If this called from ~SwDoc(), then only the address entries // have to be removed, the format will be deleted by the // the mpSpzFrameFormatTable->DeleteAndDestroyAll() in ~SwDoc()! - if (m_pOwnerShapeFormat->GetDoc()->IsInDtor()) + if (m_pOwnerShapeFormat->GetDoc().IsInDtor()) { m_pTextBoxes.clear(); return; @@ -1925,7 +1925,7 @@ void SwTextBoxNode::ClearAll() { // Delete the last textbox of the vector from the doc // (what will call deregister in ~SwFrameFormat() - m_pOwnerShapeFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat( + m_pOwnerShapeFormat->GetDoc().getIDocumentLayoutAccess().DelLayoutFormat( m_pTextBoxes.back().m_pTextBoxFormat); // Check if we are looping diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 448892ae3920..0f3e2e680860 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -496,7 +496,7 @@ SwSection* SwDoc::GetCurrSection( const SwPosition& rPos ) SwSectionFormat* SwDoc::MakeSectionFormat() { - SwSectionFormat* pNew = new SwSectionFormat( mpDfltFrameFormat.get(), this ); + SwSectionFormat* pNew = new SwSectionFormat( mpDfltFrameFormat.get(), *this ); mpSectionFormatTable->push_back( pNew ); return pNew; } @@ -1164,9 +1164,9 @@ void SwSectionNode::MakeOwnFrames(SwNodeIndex* pIdxBehind, const SwNodeIndex* pE if( rNds.IsDocNodes() ) { if( pEndIdx ) - ::MakeFrames( &rDoc, pIdxBehind->GetNode(), pEndIdx->GetNode() ); + ::MakeFrames( rDoc, pIdxBehind->GetNode(), pEndIdx->GetNode() ); else - ::MakeFrames( &rDoc, pIdxBehind->GetNode(), SwNodeIndex( *EndOfSectionNode(), 1 ).GetNode() ); + ::MakeFrames( rDoc, pIdxBehind->GetNode(), SwNodeIndex( *EndOfSectionNode(), 1 ).GetNode() ); } } @@ -1334,7 +1334,7 @@ void SwSectionNode::NodesArrChgd() return; SwNodes& rNds = GetNodes(); - SwDoc* pDoc = pFormat->GetDoc(); + SwDoc& rDoc = pFormat->GetDoc(); if( !rNds.IsDocNodes() ) { @@ -1348,7 +1348,7 @@ void SwSectionNode::NodesArrChgd() SwSectionNode* pSectNd = StartOfSectionNode()->FindSectionNode(); // set the correct parent from the new section pFormat->SetDerivedFrom( pSectNd ? pSectNd->GetSection().GetFormat() - : pDoc->GetDfltFrameFormat() ); + : rDoc.GetDfltFrameFormat() ); // Set the right StartNode for all in this Area SwNodeOffset nStart = GetIndex()+1, nEnd = EndOfSectionIndex(); @@ -1366,23 +1366,23 @@ void SwSectionNode::NodesArrChgd() // Moving Nodes to the UndoNodes array? if( rNds.IsDocNodes() ) { - OSL_ENSURE( pDoc == &GetDoc(), + OSL_ENSURE( &rDoc == &GetDoc(), "Moving to different Documents?" ); if( m_pSection->IsLinkType() ) // Remove the Link - m_pSection->CreateLink( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ? LinkCreateType::Connect : LinkCreateType::NONE ); + m_pSection->CreateLink( rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() ? LinkCreateType::Connect : LinkCreateType::NONE ); if (m_pSection->IsServer()) - pDoc->getIDocumentLinksAdministration().GetLinkManager().InsertServer( m_pSection->GetObject() ); + rDoc.getIDocumentLinksAdministration().GetLinkManager().InsertServer( m_pSection->GetObject() ); } else { if (SectionType::Content != m_pSection->GetType() && m_pSection->IsConnected()) { - pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( &m_pSection->GetBaseLink() ); + rDoc.getIDocumentLinksAdministration().GetLinkManager().Remove( &m_pSection->GetBaseLink() ); } if (m_pSection->IsServer()) - pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer( m_pSection->GetObject() ); + rDoc.getIDocumentLinksAdministration().GetLinkManager().RemoveServer( m_pSection->GetObject() ); } } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 4f561b7fc076..d2711baa67b8 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -164,16 +164,16 @@ lcl_SetDfltBoxAttr(SwTableBox& rBox, DfltBoxAttrList_t & rBoxFormatArr, } else { - SwDoc* pDoc = pBoxFrameFormat->GetDoc(); + SwDoc& rDoc = pBoxFrameFormat->GetDoc(); // format does not exist, so create it - pNewTableBoxFormat = pDoc->MakeTableBoxFormat(); + pNewTableBoxFormat = rDoc.MakeTableBoxFormat(); pNewTableBoxFormat->SetFormatAttr( pBoxFrameFormat->GetAttrSet().Get( RES_FRM_SIZE ) ); if( pAutoFormat ) pAutoFormat->UpdateToSet( nId, false, false, const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pNewTableBoxFormat->GetAttrSet())), SwTableAutoFormatUpdateFlags::Box, - pDoc->GetNumberFormatter() ); + rDoc.GetNumberFormatter() ); else ::lcl_SetDfltBoxAttr( *pNewTableBoxFormat, nId ); @@ -1831,7 +1831,7 @@ bool SwDoc::InsertRow( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind, ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); rTable.SwitchFormulasToInternalRepresentation(); - bRet = rTable.InsertRow( this, rBoxes, nCnt, bBehind, bInsertDummy ); + bRet = rTable.InsertRow( *this, rBoxes, nCnt, bBehind, bInsertDummy ); if (bRet) { getIDocumentState().SetModified(); @@ -2199,7 +2199,7 @@ bool SwDoc::DeleteRowCol(const SwSelBoxes& rBoxes, RowColMode const eMode) if (pUndo) pUndo->ReNewBoxes( aSelBoxes ); } - bRet = rTable.DeleteSel( this, aSelBoxes, nullptr, pUndo.get(), true, true ); + bRet = rTable.DeleteSel( *this, aSelBoxes, nullptr, pUndo.get(), true, true ); if (bRet) { if (SwFEShell* pFEShell = GetDocShell()->GetFEShell()) @@ -2383,7 +2383,7 @@ TableMergeErr SwDoc::MergeTable( SwPaM& rPam ) // Merge them pTableNd->GetTable().SwitchFormulasToInternalRepresentation(); - if( pTableNd->GetTable().Merge( this, aBoxes, aMerged, pMergeBox, pUndo.get() )) + if( pTableNd->GetTable().Merge( *this, aBoxes, aMerged, pMergeBox, pUndo.get() )) { nRet = TableMergeErr::Ok; @@ -3143,7 +3143,7 @@ void sw_BoxSetSplitBoxFormats( SwTableBox* pBox, SwCollectTableLineBoxes* pSplPa SfxItemSet aTmpSet(SfxItemSet::makeFixedSfxItemSet< RES_LR_SPACE, RES_UL_SPACE, RES_PROTECT, RES_PROTECT, RES_VERT_ORIENT, RES_VERT_ORIENT, RES_BACKGROUND, - RES_SHADOW>(pFormat->GetDoc()->GetAttrPool())); + RES_SHADOW>(pFormat->GetDoc().GetAttrPool())); aTmpSet.Put( pFormat->GetAttrSet() ); if( aTmpSet.Count() ) pBox->ClaimFrameFormat()->SetFormatAttr( aTmpSet ); @@ -3507,9 +3507,9 @@ SwTableNode* SwNodes::SplitTable( SwNode& rPos, bool bAfter, { // Copy the Table FrameFormat SwFrameFormat* pOldTableFormat = rTable.GetFrameFormat(); - SwFrameFormat* pNewTableFormat = pOldTableFormat->GetDoc()->MakeTableFrameFormat( - pOldTableFormat->GetDoc()->GetUniqueTableName(), - pOldTableFormat->GetDoc()->GetDfltFrameFormat() ); + SwFrameFormat* pNewTableFormat = pOldTableFormat->GetDoc().MakeTableFrameFormat( + pOldTableFormat->GetDoc().GetUniqueTableName(), + pOldTableFormat->GetDoc().GetDfltFrameFormat() ); *pNewTableFormat = *pOldTableFormat; pNewTableNd->GetTable().RegisterToFormat( *pNewTableFormat ); @@ -3745,14 +3745,14 @@ static bool lcl_SetAFormatBox(FndBox_ & rBox, SetAFormatTabPara *pSetPara, bool if (bResetDirect) pSetBox->SetDirectFormatting(false); - SwDoc* pDoc = pSetBox->GetFrameFormat()->GetDoc(); - SfxItemSet aCharSet(SfxItemSet::makeFixedSfxItemSet<RES_CHRATR_BEGIN, RES_PARATR_LIST_END-1>(pDoc->GetAttrPool())); - SfxItemSet aBoxSet(pDoc->GetAttrPool(), aTableBoxSetRange); + SwDoc& rDoc = pSetBox->GetFrameFormat()->GetDoc(); + SfxItemSet aCharSet(SfxItemSet::makeFixedSfxItemSet<RES_CHRATR_BEGIN, RES_PARATR_LIST_END-1>(rDoc.GetAttrPool())); + SfxItemSet aBoxSet(rDoc.GetAttrPool(), aTableBoxSetRange); sal_uInt8 nPos = pSetPara->nAFormatLine * 4 + pSetPara->nAFormatBox; const bool bSingleRowTable = pSetPara->bSingleRowTable; const bool bSingleColTable = pSetPara->nEndBox == 0; pSetPara->rTableFormat.UpdateToSet(nPos, bSingleRowTable, bSingleColTable, aCharSet, SwTableAutoFormatUpdateFlags::Char, nullptr); - pSetPara->rTableFormat.UpdateToSet(nPos, bSingleRowTable, bSingleColTable, aBoxSet, SwTableAutoFormatUpdateFlags::Box, pDoc->GetNumberFormatter()); + pSetPara->rTableFormat.UpdateToSet(nPos, bSingleRowTable, bSingleColTable, aBoxSet, SwTableAutoFormatUpdateFlags::Box, rDoc.GetNumberFormatter()); if (aCharSet.Count()) { @@ -3760,7 +3760,7 @@ static bool lcl_SetAFormatBox(FndBox_ & rBox, SetAFormatTabPara *pSetPara, bool SwNodeOffset nEndNd = pSetBox->GetSttNd()->EndOfSectionIndex(); for (; nSttNd < nEndNd; ++nSttNd) { - SwContentNode* pNd = pDoc->GetNodes()[ nSttNd ]->GetContentNode(); + SwContentNode* pNd = rDoc.GetNodes()[ nSttNd ]->GetContentNode(); if (pNd) pNd->SetAttr(aCharSet); } diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index c94d40fb8e5b..3d08d1f61f4f 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -555,8 +555,8 @@ bool SwDoc::HasRowNotTracked( const SwCursor& rCursor ) return false; SwRedlineTable::size_type nRedlinePos = 0; - SwDoc* pDoc = aRowArr[0]->GetFrameFormat()->GetDoc(); - const IDocumentRedlineAccess& rIDRA = pDoc->getIDocumentRedlineAccess(); + SwDoc& rDoc = aRowArr[0]->GetFrameFormat()->GetDoc(); + const IDocumentRedlineAccess& rIDRA = rDoc.getIDocumentRedlineAccess(); for( auto pLn : aRowArr ) { @@ -620,8 +620,8 @@ void SwDoc::SetRowNotTracked( const SwCursor& rCursor, SwRedlineTable::size_type nPos = pLn->UpdateTextChangesOnly(nRedlinePos); if ( nPos != SwRedlineTable::npos ) { - SwDoc* pDoc = pLn->GetFrameFormat()->GetDoc(); - IDocumentRedlineAccess& rIDRA = pDoc->getIDocumentRedlineAccess(); + SwDoc& rDoc = pLn->GetFrameFormat()->GetDoc(); + IDocumentRedlineAccess& rIDRA = rDoc.getIDocumentRedlineAccess(); const SwRedlineTable& aRedlineTable = rIDRA.GetRedlineTable(); SwRangeRedline* pTmp = aRedlineTable[ nPos ]; if ( RedlineType::Insert == pTmp->GetType() && diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 9edc42244009..7c8f16bc751a 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -103,7 +103,7 @@ static void GetNewAutoStyle( std::shared_ptr<const SwAttrSet>& rpAttrSet, { if( rNode.GetModifyAtAttr() ) const_cast<SwAttrSet*>(rpAttrSet.get())->SetModifyAtAttr( nullptr ); - IStyleAccess& rSA = rpAttrSet->GetPool()->GetDoc()->GetIStyleAccess(); + IStyleAccess& rSA = rpAttrSet->GetPool()->GetDoc().GetIStyleAccess(); rpAttrSet = rSA.getAutomaticStyle( rNewAttrSet, rNode.IsTextNode() ? IStyleAccess::AUTO_STYLE_PARA : IStyleAccess::AUTO_STYLE_NOTXT ); diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx index 73d64a72ec44..b4dd0b0ce323 100644 --- a/sw/source/core/docnode/node2lay.cxx +++ b/sw/source/core/docnode/node2lay.cxx @@ -444,7 +444,7 @@ void SwNode2LayImpl::RestoreUpperFrames( SwNodes& rNds, SwNodeOffset nStt, SwNod static_cast<SwSectionFrame*>(pNxt)->UnlockJoin(); pUp = static_cast<SwLayoutFrame*>(mvUpperFrames[x++]); OSL_ENSURE( pUp->GetUpper() || pUp->IsFlyFrame(), "Lost Upper" ); - ::InsertCnt_( pUp, &rDoc, pNd->GetIndex(), false, nStt+1, pNxt ); + ::InsertCnt_( pUp, rDoc, pNd->GetIndex(), false, nStt+1, pNxt ); pNxt = pUp->GetLastLower(); mvUpperFrames[x-2] = pNxt; } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 7c848ca6181d..a53eaff1fecd 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -221,13 +221,13 @@ SwSection::~SwSection() if( !pFormat ) return; - SwDoc* pDoc = pFormat->GetDoc(); - if( pDoc->IsInDtor() ) + SwDoc& rDoc = pFormat->GetDoc(); + if( rDoc.IsInDtor() ) { // We reattach our Format to the default FrameFormat // to not get any dependencies - if( pFormat->DerivedFrom() != pDoc->GetDfltFrameFormat() ) - pFormat->RegisterToFormat( *pDoc->GetDfltFrameFormat() ); + if( pFormat->DerivedFrom() != rDoc.GetDfltFrameFormat() ) + pFormat->RegisterToFormat( *rDoc.GetDfltFrameFormat() ); } else { @@ -236,12 +236,12 @@ SwSection::~SwSection() if (SectionType::Content != m_Data.GetType()) { - pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( m_RefLink.get() ); + rDoc.getIDocumentLinksAdministration().GetLinkManager().Remove( m_RefLink.get() ); } if (m_RefObj.is()) { - pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer( m_RefObj.get() ); + rDoc.getIDocumentLinksAdministration().GetLinkManager().RemoveServer( m_RefObj.get() ); } // If the Section is the last Client in the Format we can delete it @@ -249,8 +249,8 @@ SwSection::~SwSection() if( !pFormat->HasWriterListeners() ) { // Do not add to the Undo. This should've happened earlier. - ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); - pDoc->DelSectionFormat( pFormat ); + ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); + rDoc.DelSectionFormat( pFormat ); } } if (m_RefObj.is()) @@ -605,8 +605,8 @@ const SwTOXBase* SwSection::GetTOXBase() const return pRet; } -SwSectionFormat::SwSectionFormat( SwFrameFormat* pDrvdFrame, SwDoc *pDoc ) - : SwFrameFormat( pDoc->GetAttrPool(), UIName(), pDrvdFrame ) +SwSectionFormat::SwSectionFormat( SwFrameFormat* pDrvdFrame, SwDoc& rDoc ) + : SwFrameFormat( rDoc.GetAttrPool(), UIName(), pDrvdFrame ) { LockModify(); SetFormatAttr( *GetDfltAttr( RES_COL ) ); @@ -615,12 +615,12 @@ SwSectionFormat::SwSectionFormat( SwFrameFormat* pDrvdFrame, SwDoc *pDoc ) SwSectionFormat::~SwSectionFormat() { - if( GetDoc()->IsInDtor() ) + if( GetDoc().IsInDtor() ) return; SwSectionNode* pSectNd; const SwNodeIndex* pIdx = GetContent( false ).GetContentIdx(); - if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() && + if( pIdx && &GetDoc().GetNodes() == &pIdx->GetNodes() && nullptr != (pSectNd = pIdx->GetNode().GetSectionNode() )) { SwSection& rSect = pSectNd->GetSection(); @@ -645,7 +645,7 @@ SwSectionFormat::~SwSectionFormat() // Raise the Section up SwNodeRange aRg( *pSectNd, SwNodeOffset(0), *pSectNd->EndOfSectionNode() ); - GetDoc()->GetNodes().SectionUp( &aRg ); + GetDoc().GetNodes().SectionUp( &aRg ); } LockModify(); ResetFormatAttr( RES_CNTNT ); @@ -662,7 +662,7 @@ void SwSectionFormat::DelFrames() { SwSectionNode* pSectNd; const SwNodeIndex* pIdx = GetContent(false).GetContentIdx(); - if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() && -e ... etc. - the rest is truncated