[Libreoffice-commits] core.git: sw/inc sw/qa sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 29 18:23:02 UTC 2020
sw/inc/docary.hxx | 2
sw/inc/ndarr.hxx | 8 +-
sw/inc/txtflcnt.hxx | 2
sw/inc/txttxmrk.hxx | 2
sw/inc/viewsh.hxx | 2
sw/qa/extras/uiwriter/uiwriter.cxx | 2
sw/source/core/crsr/annotationmark.cxx | 8 +-
sw/source/core/crsr/bookmrk.cxx | 120 ++++++++++++++++-----------------
sw/source/core/doc/docbm.cxx | 56 +++++++--------
sw/source/core/doc/doclay.cxx | 20 ++---
sw/source/core/doc/docnew.cxx | 4 -
sw/source/core/doc/docredln.cxx | 6 -
sw/source/core/doc/visiturl.cxx | 16 ++--
sw/source/core/docnode/ndtbl.cxx | 2
sw/source/core/docnode/nodes.cxx | 8 --
sw/source/core/inc/MarkManager.hxx | 2
sw/source/core/inc/annotationmark.hxx | 2
sw/source/core/inc/bookmrk.hxx | 22 +++---
sw/source/core/inc/visiturl.hxx | 4 -
sw/source/core/txtnode/atrflyin.cxx | 12 +--
sw/source/core/txtnode/atrtox.cxx | 10 +-
sw/source/core/txtnode/ndtxt.cxx | 2
sw/source/core/txtnode/thints.cxx | 2
sw/source/core/view/vprint.cxx | 24 +++---
sw/source/uibase/uno/unotxvw.cxx | 2
25 files changed, 169 insertions(+), 171 deletions(-)
New commits:
commit 89f0a8be6742e23331819324f80f679f8e6cc601
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Sep 29 15:34:11 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 29 20:22:22 2020 +0200
SwNodes never passed a null SwDoc*
and some more like that
Change-Id: I02dae666d8935a90afd9c43cfb32a048c69a1d4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103628
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index d07819c40d50..9b4a6e80ea26 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -292,7 +292,7 @@ public:
sal_uInt16 GetSize() const { return m_aExtraRedlines.size(); }
SwExtraRedline* GetRedline( sal_uInt16 uIndex ) const { return m_aExtraRedlines.operator[]( uIndex ); }
- SW_DLLPUBLIC bool DeleteAllTableRedlines( SwDoc* pDoc, const SwTable& rTable, bool bSaveInUndo, RedlineType nRedlineTypeToDelete );
+ 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 );
};
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index bb21e7903adc..1492df35be6e 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -101,7 +101,7 @@ class SW_DLLPUBLIC SwNodes final
void InsertNode( const SwNodePtr pNode,
sal_uLong nPos );
- SwDoc* m_pMyDoc; ///< This Doc contains the nodes-array.
+ SwDoc& m_rMyDoc; ///< This Doc contains the nodes-array.
SwNode *m_pEndOfPostIts, *m_pEndOfInserts, ///< These are the fixed ranges.
*m_pEndOfAutotext, *m_pEndOfRedlines;
@@ -129,7 +129,7 @@ class SW_DLLPUBLIC SwNodes final
SwNodes(SwNodes const&) = delete;
SwNodes& operator=(SwNodes const&) = delete;
- SwNodes( SwDoc* pDoc );
+ SwNodes(SwDoc& rDoc);
public:
~SwNodes();
@@ -299,8 +299,8 @@ public:
bool const bCreateFrames = true);
/// Which Doc contains the nodes-array?
- SwDoc* GetDoc() { return m_pMyDoc; }
- const SwDoc* GetDoc() const { return m_pMyDoc; }
+ SwDoc* GetDoc() { return &m_rMyDoc; }
+ const SwDoc* GetDoc() const { return &m_rMyDoc; }
/** Search previous / next content node or table node with frames.
If no end is given begin with the FrameIndex, else start search
diff --git a/sw/inc/txtflcnt.hxx b/sw/inc/txtflcnt.hxx
index c9baa25ff21c..b580039446ab 100644
--- a/sw/inc/txtflcnt.hxx
+++ b/sw/inc/txtflcnt.hxx
@@ -40,7 +40,7 @@ public:
inline const SwFlyInContentFrame *GetFlyFrame( const SwFrame *pCurrFrame ) const;
// creates for itself a new FlyFrameFormat.
- void CopyFlyFormat( SwDoc* pDoc );
+ void CopyFlyFormat( SwDoc& rDoc );
};
inline SwFlyInContentFrame *SwTextFlyCnt::GetFlyFrame( const SwFrame *pCurrFrame )
diff --git a/sw/inc/txttxmrk.hxx b/sw/inc/txttxmrk.hxx
index bcb0a5b06acf..4606fd597a99 100644
--- a/sw/inc/txttxmrk.hxx
+++ b/sw/inc/txttxmrk.hxx
@@ -38,7 +38,7 @@ public:
virtual const sal_Int32 *GetEnd() const override; // SwTextAttr
virtual void SetEnd(sal_Int32) override; // SwTextAttr
- void CopyTOXMark( SwDoc* pDestDoc );
+ void CopyTOXMark( SwDoc& rDestDoc );
// get and set TextNode pointer
const SwTextNode* GetpTextNd() const { return m_pTextNode; }
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 23409190bdf8..57fae99e99ba 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -361,7 +361,7 @@ public:
vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect );
// Fill temporary doc with selected text for Print or PDF export.
- void FillPrtDoc( SwDoc* pPrtDoc, const SfxPrinter* pPrt );
+ void FillPrtDoc( SwDoc& rPrtDoc, const SfxPrinter* pPrt );
// Called internally for Shell. Formats pages.
void CalcPagesForPrint( sal_uInt16 nMax );
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index fd95bddfb94d..9cef3b791324 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -2178,7 +2178,7 @@ void SwUiWriterTest::testDeleteTableRedlines()
SwUnoCursorHelper::makeTableCellRedline((*const_cast<SwTableBox*>(rTable.GetTableBox("C1"))), "TableCellInsert", aDescriptor);
IDocumentRedlineAccess& rIDRA = pDoc->getIDocumentRedlineAccess();
SwExtraRedlineTable& rExtras = rIDRA.GetExtraRedlineTable();
- rExtras.DeleteAllTableRedlines(pDoc, rTable, false, RedlineType::Any);
+ rExtras.DeleteAllTableRedlines(*pDoc, rTable, false, RedlineType::Any);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(0), rExtras.GetSize());
}
diff --git a/sw/source/core/crsr/annotationmark.cxx b/sw/source/core/crsr/annotationmark.cxx
index 0fc6d16daedf..887333525390 100644
--- a/sw/source/core/crsr/annotationmark.cxx
+++ b/sw/source/core/crsr/annotationmark.cxx
@@ -49,7 +49,7 @@ namespace sw::mark
{
}
- void AnnotationMark::InitDoc(SwDoc* const io_pDoc,
+ void AnnotationMark::InitDoc(SwDoc& io_rDoc,
sw::mark::InsertMode const, SwPosition const*const)
{
SwTextNode *pTextNode = GetMarkEnd().nNode.GetNode().GetTextNode();
@@ -69,11 +69,11 @@ namespace sw::mark
const_cast<SwPostItField*>(pPostItField)->SetName( GetName() );
}
- if (io_pDoc->GetIDocumentUndoRedo().DoesUndo())
+ if (io_rDoc.GetIDocumentUndoRedo().DoesUndo())
{
- io_pDoc->GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoInsBookmark>(*this) );
+ io_rDoc.GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoInsBookmark>(*this) );
}
- io_pDoc->getIDocumentState().SetModified();
+ io_rDoc.getIDocumentState().SetModified();
}
const SwFormatField* AnnotationMark::GetAnnotationFormatField() const
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 1dbcddd1db8d..4e43a49bf007 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -143,53 +143,53 @@ namespace
}
}
- void lcl_AssertFieldMarksSet(Fieldmark const * const pField,
+ void lcl_AssertFieldMarksSet(const Fieldmark& rField,
const sal_Unicode aStartMark,
const sal_Unicode aEndMark)
{
if (aEndMark != CH_TXT_ATR_FORMELEMENT)
{
- SwPosition const& rStart(pField->GetMarkStart());
+ SwPosition const& rStart(rField.GetMarkStart());
assert(rStart.nNode.GetNode().GetTextNode()->GetText()[rStart.nContent.GetIndex()] == aStartMark); (void) rStart; (void) aStartMark;
- SwPosition const sepPos(sw::mark::FindFieldSep(*pField));
+ SwPosition const sepPos(sw::mark::FindFieldSep(rField));
assert(sepPos.nNode.GetNode().GetTextNode()->GetText()[sepPos.nContent.GetIndex()] == CH_TXT_ATR_FIELDSEP); (void) sepPos;
}
- SwPosition const& rEnd(pField->GetMarkEnd());
+ SwPosition const& rEnd(rField.GetMarkEnd());
assert(rEnd.nNode.GetNode().GetTextNode()->GetText()[rEnd.nContent.GetIndex() - 1] == aEndMark); (void) rEnd;
}
- void lcl_SetFieldMarks(Fieldmark* const pField,
- SwDoc* const io_pDoc,
+ void lcl_SetFieldMarks(Fieldmark& rField,
+ SwDoc& io_rDoc,
const sal_Unicode aStartMark,
const sal_Unicode aEndMark,
SwPosition const*const pSepPos)
{
- io_pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::UI_REPLACE, nullptr);
+ io_rDoc.GetIDocumentUndoRedo().StartUndo(SwUndoId::UI_REPLACE, nullptr);
OUString startChar(aStartMark);
if (aEndMark != CH_TXT_ATR_FORMELEMENT
- && pField->GetMarkStart() == pField->GetMarkEnd())
+ && rField.GetMarkStart() == rField.GetMarkEnd())
{
// do only 1 InsertString call - to expand existing bookmarks at the
// position over the whole field instead of just aStartMark
startChar += OUStringChar(CH_TXT_ATR_FIELDSEP) + OUStringChar(aEndMark);
}
- SwPosition start = pField->GetMarkStart();
+ SwPosition start = rField.GetMarkStart();
if (aEndMark != CH_TXT_ATR_FORMELEMENT)
{
SwPaM aStartPaM(start);
- io_pDoc->getIDocumentContentOperations().InsertString(aStartPaM, startChar);
+ io_rDoc.getIDocumentContentOperations().InsertString(aStartPaM, startChar);
start.nContent -= startChar.getLength(); // restore, it was moved by InsertString
// do not manipulate via reference directly but call SetMarkStartPos
// which works even if start and end pos were the same
- pField->SetMarkStartPos( start );
- SwPosition& rEnd = pField->GetMarkEnd(); // note: retrieve after
+ rField.SetMarkStartPos( start );
+ SwPosition& rEnd = rField.GetMarkEnd(); // note: retrieve after
// setting start, because if start==end it can go stale, see SetMarkPos()
assert(pSepPos == nullptr || (start < *pSepPos && *pSepPos <= rEnd));
if (startChar.getLength() == 1)
{
*aStartPaM.GetPoint() = pSepPos ? *pSepPos : rEnd;
- io_pDoc->getIDocumentContentOperations().InsertString(aStartPaM, OUString(CH_TXT_ATR_FIELDSEP));
+ io_rDoc.getIDocumentContentOperations().InsertString(aStartPaM, OUString(CH_TXT_ATR_FIELDSEP));
if (!pSepPos || rEnd < *pSepPos)
{ // rEnd is not moved automatically if it's same as insert pos
++rEnd.nContent;
@@ -202,38 +202,38 @@ namespace
assert(pSepPos == nullptr);
}
- SwPosition& rEnd = pField->GetMarkEnd();
+ SwPosition& rEnd = rField.GetMarkEnd();
if (aEndMark && startChar.getLength() == 1)
{
SwPaM aEndPaM(rEnd);
- io_pDoc->getIDocumentContentOperations().InsertString(aEndPaM, OUString(aEndMark));
+ io_rDoc.getIDocumentContentOperations().InsertString(aEndPaM, OUString(aEndMark));
++rEnd.nContent;
}
- lcl_AssertFieldMarksSet(pField, aStartMark, aEndMark);
+ lcl_AssertFieldMarksSet(rField, aStartMark, aEndMark);
- io_pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::UI_REPLACE, nullptr);
- };
+ io_rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::UI_REPLACE, nullptr);
+ }
- void lcl_RemoveFieldMarks(Fieldmark const * const pField,
- SwDoc* const io_pDoc,
+ void lcl_RemoveFieldMarks(const Fieldmark& rField,
+ SwDoc& io_rDoc,
const sal_Unicode aStartMark,
const sal_Unicode aEndMark)
{
- io_pDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::UI_REPLACE, nullptr);
+ io_rDoc.GetIDocumentUndoRedo().StartUndo(SwUndoId::UI_REPLACE, nullptr);
- const SwPosition& rStart = pField->GetMarkStart();
+ const SwPosition& rStart = rField.GetMarkStart();
SwTextNode const*const pStartTextNode = rStart.nNode.GetNode().GetTextNode();
assert(pStartTextNode);
if (aEndMark != CH_TXT_ATR_FORMELEMENT)
{
(void) pStartTextNode;
// check this before start / end because of the +1 / -1 ...
- SwPosition const sepPos(sw::mark::FindFieldSep(*pField));
- io_pDoc->GetDocumentContentOperationsManager().DeleteDummyChar(rStart, aStartMark);
- io_pDoc->GetDocumentContentOperationsManager().DeleteDummyChar(sepPos, CH_TXT_ATR_FIELDSEP);
+ SwPosition const sepPos(sw::mark::FindFieldSep(rField));
+ io_rDoc.GetDocumentContentOperationsManager().DeleteDummyChar(rStart, aStartMark);
+ io_rDoc.GetDocumentContentOperationsManager().DeleteDummyChar(sepPos, CH_TXT_ATR_FIELDSEP);
}
- const SwPosition& rEnd = pField->GetMarkEnd();
+ const SwPosition& rEnd = rField.GetMarkEnd();
SwTextNode *const pEndTextNode = rEnd.nNode.GetNode().GetTextNode();
assert(pEndTextNode);
const sal_Int32 nEndPos = (rEnd == rStart)
@@ -241,10 +241,10 @@ namespace
: rEnd.nContent.GetIndex() - 1;
assert(pEndTextNode->GetText()[nEndPos] == aEndMark);
SwPosition const aEnd(*pEndTextNode, nEndPos);
- io_pDoc->GetDocumentContentOperationsManager().DeleteDummyChar(aEnd, aEndMark);
+ io_rDoc.GetDocumentContentOperationsManager().DeleteDummyChar(aEnd, aEndMark);
- io_pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::UI_REPLACE, nullptr);
- };
+ io_rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::UI_REPLACE, nullptr);
+ }
auto InvalidatePosition(SwPosition const& rPos) -> void
{
@@ -370,10 +370,10 @@ namespace sw::mark
m_aRefObj = pObj;
}
- void DdeBookmark::DeregisterFromDoc(SwDoc* const pDoc)
+ void DdeBookmark::DeregisterFromDoc(SwDoc& rDoc)
{
if(m_aRefObj.is())
- pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer(m_aRefObj.get());
+ rDoc.getIDocumentLinksAdministration().GetLinkManager().RemoveServer(m_aRefObj.get());
}
DdeBookmark::~DdeBookmark()
@@ -400,28 +400,28 @@ namespace sw::mark
m_aName = rName;
}
- void Bookmark::InitDoc(SwDoc* const io_pDoc,
+ void Bookmark::InitDoc(SwDoc& io_rDoc,
sw::mark::InsertMode const, SwPosition const*const)
{
- if (io_pDoc->GetIDocumentUndoRedo().DoesUndo())
+ if (io_rDoc.GetIDocumentUndoRedo().DoesUndo())
{
- io_pDoc->GetIDocumentUndoRedo().AppendUndo(
+ io_rDoc.GetIDocumentUndoRedo().AppendUndo(
std::make_unique<SwUndoInsBookmark>(*this));
}
- io_pDoc->getIDocumentState().SetModified();
+ io_rDoc.getIDocumentState().SetModified();
InvalidateFrames();
}
- void Bookmark::DeregisterFromDoc(SwDoc* const io_pDoc)
+ void Bookmark::DeregisterFromDoc(SwDoc& io_rDoc)
{
- DdeBookmark::DeregisterFromDoc(io_pDoc);
+ DdeBookmark::DeregisterFromDoc(io_rDoc);
- if (io_pDoc->GetIDocumentUndoRedo().DoesUndo())
+ if (io_rDoc.GetIDocumentUndoRedo().DoesUndo())
{
- io_pDoc->GetIDocumentUndoRedo().AppendUndo(
+ io_rDoc.GetIDocumentUndoRedo().AppendUndo(
std::make_unique<SwUndoDeleteBookmark>(*this));
}
- io_pDoc->getIDocumentState().SetModified();
+ io_rDoc.getIDocumentState().SetModified();
InvalidateFrames();
}
@@ -553,43 +553,43 @@ namespace sw::mark
m_aName = rName;
}
- void TextFieldmark::InitDoc(SwDoc* const io_pDoc,
+ void TextFieldmark::InitDoc(SwDoc& io_rDoc,
sw::mark::InsertMode const eMode, SwPosition const*const pSepPos)
{
if (eMode == sw::mark::InsertMode::New)
{
- lcl_SetFieldMarks(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND, pSepPos);
+ lcl_SetFieldMarks(*this, io_rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND, pSepPos);
// no need to invalidate text frames here, the insertion of the
// CH_TXT_ATR already invalidates
}
else
{
- lcl_AssertFieldMarksSet(this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
+ lcl_AssertFieldMarksSet(*this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
}
}
- void TextFieldmark::ReleaseDoc(SwDoc* const pDoc)
+ void TextFieldmark::ReleaseDoc(SwDoc& rDoc)
{
- IDocumentUndoRedo & rIDUR(pDoc->GetIDocumentUndoRedo());
+ IDocumentUndoRedo & rIDUR(rDoc.GetIDocumentUndoRedo());
if (rIDUR.DoesUndo())
{
rIDUR.AppendUndo(std::make_unique<SwUndoDelTextFieldmark>(*this));
}
::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
- lcl_RemoveFieldMarks(this, pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
+ lcl_RemoveFieldMarks(*this, rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
}
NonTextFieldmark::NonTextFieldmark(const SwPaM& rPaM)
: Fieldmark(rPaM)
{ }
- void NonTextFieldmark::InitDoc(SwDoc* const io_pDoc,
+ void NonTextFieldmark::InitDoc(SwDoc& io_rDoc,
sw::mark::InsertMode const eMode, SwPosition const*const pSepPos)
{
assert(pSepPos == nullptr);
if (eMode == sw::mark::InsertMode::New)
{
- lcl_SetFieldMarks(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT, pSepPos);
+ lcl_SetFieldMarks(*this, io_rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT, pSepPos);
// For some reason the end mark is moved from 1 by the Insert:
// we don't want this for checkboxes
@@ -599,19 +599,19 @@ namespace sw::mark
}
else
{
- lcl_AssertFieldMarksSet(this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT);
+ lcl_AssertFieldMarksSet(*this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT);
}
}
- void NonTextFieldmark::ReleaseDoc(SwDoc* const pDoc)
+ void NonTextFieldmark::ReleaseDoc(SwDoc& rDoc)
{
- IDocumentUndoRedo & rIDUR(pDoc->GetIDocumentUndoRedo());
+ IDocumentUndoRedo & rIDUR(rDoc.GetIDocumentUndoRedo());
if (rIDUR.DoesUndo())
{
rIDUR.AppendUndo(std::make_unique<SwUndoDelNoTextFieldmark>(*this));
}
::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
- lcl_RemoveFieldMarks(this, pDoc,
+ lcl_RemoveFieldMarks(*this, rDoc,
CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FORMELEMENT);
}
@@ -785,31 +785,31 @@ namespace sw::mark
{
}
- void DateFieldmark::InitDoc(SwDoc* const io_pDoc,
+ void DateFieldmark::InitDoc(SwDoc& io_rDoc,
sw::mark::InsertMode eMode, SwPosition const*const pSepPos)
{
- m_pNumberFormatter = io_pDoc->GetNumberFormatter();
- m_pDocumentContentOperationsManager = &io_pDoc->GetDocumentContentOperationsManager();
+ m_pNumberFormatter = io_rDoc.GetNumberFormatter();
+ m_pDocumentContentOperationsManager = &io_rDoc.GetDocumentContentOperationsManager();
if (eMode == sw::mark::InsertMode::New)
{
- lcl_SetFieldMarks(this, io_pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND, pSepPos);
+ lcl_SetFieldMarks(*this, io_rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND, pSepPos);
}
else
{
- lcl_AssertFieldMarksSet(this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
+ lcl_AssertFieldMarksSet(*this, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
}
}
- void DateFieldmark::ReleaseDoc(SwDoc* const pDoc)
+ void DateFieldmark::ReleaseDoc(SwDoc& rDoc)
{
- IDocumentUndoRedo & rIDUR(pDoc->GetIDocumentUndoRedo());
+ IDocumentUndoRedo & rIDUR(rDoc.GetIDocumentUndoRedo());
if (rIDUR.DoesUndo())
{
// TODO does this need a 3rd Undo class?
rIDUR.AppendUndo(std::make_unique<SwUndoDelTextFieldmark>(*this));
}
::sw::UndoGuard const ug(rIDUR); // prevent SwUndoDeletes
- lcl_RemoveFieldMarks(this, pDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
+ lcl_RemoveFieldMarks(*this, rDoc, CH_TXT_ATR_FIELDSTART, CH_TXT_ATR_FIELDEND);
}
void DateFieldmark::ShowButton(SwEditWin* pEditWin)
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 385afa6846ea..36ad4d6795ee 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -537,7 +537,7 @@ namespace sw::mark
, m_vBookmarks()
, m_vFieldmarks()
, m_vAnnotationMarks()
- , m_pDoc(&rDoc)
+ , m_rDoc(rDoc)
, m_pLastActiveFieldmark(nullptr)
{ }
@@ -661,7 +661,7 @@ namespace sw::mark
pMark->SetName( getUniqueMarkName( pMark->GetName() ) );
// insert any dummy chars before inserting into sorted vectors
- pMark->InitDoc(m_pDoc, eMode, pSepPos);
+ pMark->InitDoc(m_rDoc, eMode, pSepPos);
// register mark
lcl_InsertMarkSorted(m_vAllMarks, pMark.get());
@@ -706,8 +706,8 @@ namespace sw::mark
{
// Disable undo, because we handle it using SwUndoInsTextFieldmark
- bool bUndoIsEnabled = m_pDoc->GetIDocumentUndoRedo().DoesUndo();
- m_pDoc->GetIDocumentUndoRedo().DoUndo(false);
+ bool bUndoIsEnabled = m_rDoc.GetIDocumentUndoRedo().DoesUndo();
+ m_rDoc.GetIDocumentUndoRedo().DoUndo(false);
sw::mark::IMark* pMark = nullptr;
if(rType == ODF_FORMDATE)
@@ -730,9 +730,9 @@ namespace sw::mark
if (bUndoIsEnabled)
{
- m_pDoc->GetIDocumentUndoRedo().DoUndo(bUndoIsEnabled);
+ m_rDoc.GetIDocumentUndoRedo().DoUndo(bUndoIsEnabled);
if (pFieldMark)
- m_pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsTextFieldmark>(*pFieldMark));
+ m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsTextFieldmark>(*pFieldMark));
}
return pFieldMark;
@@ -744,11 +744,11 @@ namespace sw::mark
const OUString& rType)
{
// Disable undo, because we handle it using SwUndoInsNoTextFieldmark
- bool bUndoIsEnabled = m_pDoc->GetIDocumentUndoRedo().DoesUndo();
- m_pDoc->GetIDocumentUndoRedo().DoUndo(false);
+ bool bUndoIsEnabled = m_rDoc.GetIDocumentUndoRedo().DoesUndo();
+ m_rDoc.GetIDocumentUndoRedo().DoUndo(false);
- bool bEnableSetModified = m_pDoc->getIDocumentState().IsEnableSetModified();
- m_pDoc->getIDocumentState().SetEnableSetModified(false);
+ bool bEnableSetModified = m_rDoc.getIDocumentState().IsEnableSetModified();
+ m_rDoc.getIDocumentState().SetEnableSetModified(false);
sw::mark::IMark* pMark = nullptr;
if(rType == ODF_FORMCHECKBOX)
@@ -776,13 +776,13 @@ namespace sw::mark
if (bUndoIsEnabled)
{
- m_pDoc->GetIDocumentUndoRedo().DoUndo(bUndoIsEnabled);
+ m_rDoc.GetIDocumentUndoRedo().DoUndo(bUndoIsEnabled);
if (pFieldMark)
- m_pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsNoTextFieldmark>(*pFieldMark));
+ m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsNoTextFieldmark>(*pFieldMark));
}
- m_pDoc->getIDocumentState().SetEnableSetModified(bEnableSetModified);
- m_pDoc->getIDocumentState().SetModified();
+ m_rDoc.getIDocumentState().SetEnableSetModified(bEnableSetModified);
+ m_rDoc.getIDocumentState().SetModified();
return pFieldMark;
}
@@ -812,7 +812,7 @@ namespace sw::mark
::sw::mark::IMark* const io_pMark,
const SwPaM& rPaM)
{
- assert(io_pMark->GetMarkPos().GetDoc() == m_pDoc &&
+ assert(io_pMark->GetMarkPos().GetDoc() == &m_rDoc &&
"<MarkManager::repositionMark(..)>"
" - Mark is not in my doc.");
MarkBase* const pMarkBase = dynamic_cast< MarkBase* >(io_pMark);
@@ -839,7 +839,7 @@ namespace sw::mark
::sw::mark::IMark* io_pMark,
const OUString& rNewName )
{
- assert(io_pMark->GetMarkPos().GetDoc() == m_pDoc &&
+ assert(io_pMark->GetMarkPos().GetDoc() == &m_rDoc &&
"<MarkManager::renameMark(..)>"
" - Mark is not in my doc.");
if ( io_pMark->GetName() == rNewName )
@@ -853,12 +853,12 @@ namespace sw::mark
if (dynamic_cast< ::sw::mark::Bookmark* >(io_pMark))
{
- if (m_pDoc->GetIDocumentUndoRedo().DoesUndo())
+ if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
{
- m_pDoc->GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoRenameBookmark>(sOldName, rNewName, m_pDoc));
+ m_rDoc.GetIDocumentUndoRedo().AppendUndo(
+ std::make_unique<SwUndoRenameBookmark>(sOldName, rNewName, &m_rDoc));
}
- m_pDoc->getIDocumentState().SetModified();
+ m_rDoc.getIDocumentState().SetModified();
}
}
return true;
@@ -1187,9 +1187,9 @@ namespace sw::mark
struct LazyFieldmarkDeleter : public IDocumentMarkAccess::ILazyDeleter
{
std::unique_ptr<Fieldmark> m_pFieldmark;
- SwDoc * m_pDoc;
- LazyFieldmarkDeleter(Fieldmark* pMark, SwDoc *const pDoc)
- : m_pFieldmark(pMark), m_pDoc(pDoc)
+ SwDoc& m_rDoc;
+ LazyFieldmarkDeleter(Fieldmark* pMark, SwDoc& rDoc)
+ : m_pFieldmark(pMark), m_rDoc(rDoc)
{
assert(m_pFieldmark);
}
@@ -1199,7 +1199,7 @@ namespace sw::mark
// command *cannot* be deleted here as it would create a separate
// SwUndoDelete that's interleaved with the SwHistory of the outer
// one - only delete the CH_TXT_ATR_FIELD*!
- m_pFieldmark->ReleaseDoc(m_pDoc);
+ m_pFieldmark->ReleaseDoc(m_rDoc);
}
};
@@ -1244,7 +1244,7 @@ namespace sw::mark
ClearFieldActivation();
m_vFieldmarks.erase(ppFieldmark);
- ret.reset(new LazyFieldmarkDeleter(dynamic_cast<Fieldmark*>(pMark), m_pDoc));
+ ret.reset(new LazyFieldmarkDeleter(dynamic_cast<Fieldmark*>(pMark), m_rDoc));
}
else
{
@@ -1271,7 +1271,7 @@ namespace sw::mark
}
DdeBookmark* const pDdeBookmark = dynamic_cast<DdeBookmark*>(pMark);
if (pDdeBookmark)
- pDdeBookmark->DeregisterFromDoc(m_pDoc);
+ pDdeBookmark->DeregisterFromDoc(m_rDoc);
//Effective STL Item 27, get a non-const iterator aI at the same
//position as const iterator ppMark was
auto aI = m_vAllMarks.begin();
@@ -1288,7 +1288,7 @@ namespace sw::mark
void MarkManager::deleteMark(const IMark* const pMark)
{
- assert(pMark->GetMarkPos().GetDoc() == m_pDoc &&
+ assert(pMark->GetMarkPos().GetDoc() == &m_rDoc &&
"<MarkManager::deleteMark(..)>"
" - Mark is not in my doc.");
// finds the last Mark that is starting before pMark
@@ -1586,7 +1586,7 @@ namespace sw::mark
{
OSL_ENSURE(rName.getLength(),
"<MarkManager::getUniqueMarkName(..)> - a name should be proposed");
- if( m_pDoc->IsInMailMerge())
+ if( m_rDoc.IsInMailMerge())
{
OUString newName = rName + "MailMergeMark"
+ OStringToOUString( DateTimeToOString( DateTime( DateTime::SYSTEM )), RTL_TEXTENCODING_ASCII_US )
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 7e598d8e4638..81d4e86c5724 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -1323,21 +1323,21 @@ namespace
}
}
-static OUString lcl_GetUniqueFlyName(const SwDoc* pDoc, const char* pDefStrId, sal_uInt16 eType)
+static OUString lcl_GetUniqueFlyName(const SwDoc& rDoc, const char* pDefStrId, sal_uInt16 eType)
{
assert(eType >= RES_FMT_BEGIN && eType < RES_FMT_END);
- if( pDoc->IsInMailMerge())
+ if (rDoc.IsInMailMerge())
{
OUString newName = "MailMergeFly"
+ OStringToOUString( DateTimeToOString( DateTime( DateTime::SYSTEM )), RTL_TEXTENCODING_ASCII_US )
- + OUString::number( pDoc->GetSpzFrameFormats()->size() + 1 );
+ + OUString::number( rDoc.GetSpzFrameFormats()->size() + 1 );
return newName;
}
OUString aName(SwResId(pDefStrId));
sal_Int32 nNmLen = aName.getLength();
- const SwFrameFormats& rFormats = *pDoc->GetSpzFrameFormats();
+ const SwFrameFormats& rFormats = *rDoc.GetSpzFrameFormats();
std::vector<unsigned int> aUsedNums;
aUsedNums.reserve(rFormats.size());
@@ -1365,27 +1365,27 @@ static OUString lcl_GetUniqueFlyName(const SwDoc* pDoc, const char* pDefStrId, s
OUString SwDoc::GetUniqueGrfName() const
{
- return lcl_GetUniqueFlyName(this, STR_GRAPHIC_DEFNAME, RES_FLYFRMFMT);
+ return lcl_GetUniqueFlyName(*this, STR_GRAPHIC_DEFNAME, RES_FLYFRMFMT);
}
OUString SwDoc::GetUniqueOLEName() const
{
- return lcl_GetUniqueFlyName(this, STR_OBJECT_DEFNAME, RES_FLYFRMFMT);
+ return lcl_GetUniqueFlyName(*this, STR_OBJECT_DEFNAME, RES_FLYFRMFMT);
}
OUString SwDoc::GetUniqueFrameName() const
{
- return lcl_GetUniqueFlyName(this, STR_FRAME_DEFNAME, RES_FLYFRMFMT);
+ return lcl_GetUniqueFlyName(*this, STR_FRAME_DEFNAME, RES_FLYFRMFMT);
}
OUString SwDoc::GetUniqueShapeName() const
{
- return lcl_GetUniqueFlyName(this, STR_SHAPE_DEFNAME, RES_DRAWFRMFMT);
+ return lcl_GetUniqueFlyName(*this, STR_SHAPE_DEFNAME, RES_DRAWFRMFMT);
}
OUString SwDoc::GetUniqueDrawObjectName() const
{
- return lcl_GetUniqueFlyName(this, "DrawObject", RES_DRAWFRMFMT);
+ return lcl_GetUniqueFlyName(*this, "DrawObject", RES_DRAWFRMFMT);
}
const SwFlyFrameFormat* SwDoc::FindFlyByName( const OUString& rName, SwNodeType nNdTyp ) const
@@ -1435,7 +1435,7 @@ void SwDoc::SetFlyName( SwFlyFrameFormat& rFormat, const OUString& rName )
default: break;
}
}
- sName = lcl_GetUniqueFlyName(this, pTyp, RES_FLYFRMFMT);
+ sName = lcl_GetUniqueFlyName(*this, pTyp, RES_FLYFRMFMT);
}
rFormat.SetName( sName, true );
getIDocumentState().SetModified();
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 8d61f215e602..45e432af4e84 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -192,7 +192,7 @@ static void lcl_DelFormatIndices( SwFormat const * pFormat )
* exported methods
*/
SwDoc::SwDoc()
- : m_pNodes( new SwNodes(this) ),
+ : m_pNodes(new SwNodes(*this)),
mpAttrPool(new SwAttrPool(this)),
mpMarkManager(new ::sw::mark::MarkManager(*this)),
m_pMetaFieldManager(new ::sw::MetaFieldManager()),
@@ -200,7 +200,7 @@ SwDoc::SwDoc()
m_pDocumentRedlineManager( new ::sw::DocumentRedlineManager( *this ) ),
m_pDocumentStateManager( new ::sw::DocumentStateManager( *this ) ),
m_pUndoManager(new ::sw::UndoManager(
- std::shared_ptr<SwNodes>(new SwNodes(this)), *m_pDocumentDrawModelManager, *m_pDocumentRedlineManager, *m_pDocumentStateManager)),
+ std::shared_ptr<SwNodes>(new SwNodes(*this)), *m_pDocumentDrawModelManager, *m_pDocumentRedlineManager, *m_pDocumentStateManager)),
m_pDocumentSettingManager(new ::sw::DocumentSettingManager(*this)),
m_pDocumentChartDataProviderManager( new sw::DocumentChartDataProviderManager( *this ) ),
m_pDeviceAccess( new ::sw::DocumentDeviceManager( *this ) ),
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 6cbffb7b56d5..5162c68db6f7 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -127,11 +127,11 @@ static bool CheckPosition( const SwPosition* pStt, const SwPosition* pEnd )
}
#endif
-bool SwExtraRedlineTable::DeleteAllTableRedlines( SwDoc* pDoc, const SwTable& rTable, bool bSaveInUndo, RedlineType nRedlineTypeToDelete )
+bool SwExtraRedlineTable::DeleteAllTableRedlines( SwDoc& rDoc, const SwTable& rTable, 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
/*
@@ -198,7 +198,7 @@ bool SwExtraRedlineTable::DeleteAllTableRedlines( SwDoc* pDoc, const SwTable& rT
}
if( bChg )
- pDoc->getIDocumentState().SetModified();
+ rDoc.getIDocumentState().SetModified();
return bChg;
}
diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx
index a2dc5df93a2d..31c7c9ef64cd 100644
--- a/sw/source/core/doc/visiturl.cxx
+++ b/sw/source/core/doc/visiturl.cxx
@@ -29,8 +29,8 @@
#include <editsh.hxx>
#include <docsh.hxx>
-SwURLStateChanged::SwURLStateChanged( SwDoc* pD )
- : m_pDoc( pD )
+SwURLStateChanged::SwURLStateChanged( SwDoc& rD )
+ : m_rDoc( rD )
{
StartListening( *INetURLHistory::GetOrCreate() );
}
@@ -42,22 +42,22 @@ SwURLStateChanged::~SwURLStateChanged()
void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint )
{
- if( !(dynamic_cast<const INetURLHistoryHint*>(&rHint) && m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()) )
+ if( !(dynamic_cast<const INetURLHistoryHint*>(&rHint) && m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell()) )
return;
// This URL has been changed:
const INetURLObject* pIURL = static_cast<const INetURLHistoryHint&>(rHint).GetObject();
OUString sURL( pIURL->GetMainURL( INetURLObject::DecodeMechanism::NONE ) ), sBkmk;
- SwEditShell* pESh = m_pDoc->GetEditShell();
+ SwEditShell* pESh = m_rDoc.GetEditShell();
- if( m_pDoc->GetDocShell() && m_pDoc->GetDocShell()->GetMedium() &&
+ if( m_rDoc.GetDocShell() && m_rDoc.GetDocShell()->GetMedium() &&
// If this is our Doc, we can also have local jumps!
- m_pDoc->GetDocShell()->GetMedium()->GetName() == sURL )
+ m_rDoc.GetDocShell()->GetMedium()->GetName() == sURL )
sBkmk = "#" + pIURL->GetMark();
bool bAction = false, bUnLockView = false;
- for (const SfxPoolItem* pItem : m_pDoc->GetAttrPool().GetItemSurrogates(RES_TXTATR_INETFMT))
+ for (const SfxPoolItem* pItem : m_rDoc.GetAttrPool().GetItemSurrogates(RES_TXTATR_INETFMT))
{
const SwFormatINetFormat* pFormatItem = dynamic_cast<const SwFormatINetFormat*>(pItem);
if( pFormatItem != nullptr &&
@@ -116,7 +116,7 @@ bool SwDoc::IsVisitedURL( const OUString& rURL )
if( !mpURLStateChgd )
{
SwDoc* pD = this;
- pD->mpURLStateChgd.reset( new SwURLStateChanged( this ) );
+ pD->mpURLStateChgd.reset( new SwURLStateChanged(*this) );
}
}
return bRet;
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 7ab1c5de313d..c91a8d7cc192 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2493,7 +2493,7 @@ void SwTableNode::RemoveRedlines()
{
SwTable& rTable = GetTable();
if ( pDoc->getIDocumentRedlineAccess().HasExtraRedlineTable() )
- pDoc->getIDocumentRedlineAccess().GetExtraRedlineTable().DeleteAllTableRedlines( pDoc, rTable, true, RedlineType::Any );
+ pDoc->getIDocumentRedlineAccess().GetExtraRedlineTable().DeleteAllTableRedlines(*pDoc, rTable, true, RedlineType::Any);
}
}
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 5be7ba5cf9cf..44428c38e8f9 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -55,13 +55,11 @@ static sal_uInt16 HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange );
*
* @param pDocument TODO: provide documentation
*/
-SwNodes::SwNodes( SwDoc* pDocument )
- : m_vIndices(nullptr), m_pMyDoc( pDocument )
+SwNodes::SwNodes( SwDoc& rDocument )
+ : m_vIndices(nullptr), m_rMyDoc( rDocument )
{
m_bInNodesDel = m_bInDelUpdOutline = false;
- assert(m_pMyDoc);
-
sal_uLong nPos = 0;
SwStartNode* pSttNd = new SwStartNode( *this, nPos++ );
m_pEndOfPostIts = new SwEndNode( *this, nPos++, *pSttNd );
@@ -2323,7 +2321,7 @@ SwNode * SwNodes::DocumentSectionEndNode(SwNode * pNode) const
bool SwNodes::IsDocNodes() const
{
- return this == &m_pMyDoc->GetNodes();
+ return this == &m_rMyDoc.GetNodes();
}
void SwNodes::dumpAsXml(xmlTextWriterPtr pWriter) const
diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx
index a1f98062a167..8266198a521d 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -137,7 +137,7 @@ namespace sw::mark {
// container for annotation marks
container_t m_vAnnotationMarks;
- SwDoc * const m_pDoc;
+ SwDoc& m_rDoc;
sw::mark::FieldmarkWithDropDownButton* m_pLastActiveFieldmark;
};
diff --git a/sw/source/core/inc/annotationmark.hxx b/sw/source/core/inc/annotationmark.hxx
index 9fe8478e22cc..9e650c0ecda9 100644
--- a/sw/source/core/inc/annotationmark.hxx
+++ b/sw/source/core/inc/annotationmark.hxx
@@ -36,7 +36,7 @@ namespace sw::mark
virtual ~AnnotationMark() override;
- virtual void InitDoc(SwDoc* const io_Doc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override;
+ virtual void InitDoc(SwDoc& io_Doc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override;
const SwFormatField* GetAnnotationFormatField() const;
};
diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx
index 36a673d86499..c9dce3e0a328 100644
--- a/sw/source/core/inc/bookmrk.hxx
+++ b/sw/source/core/inc/bookmrk.hxx
@@ -92,7 +92,7 @@ namespace sw::mark {
m_pPos1.swap(m_pPos2);
}
- virtual void InitDoc(SwDoc* const, sw::mark::InsertMode, SwPosition const*)
+ virtual void InitDoc(SwDoc&, sw::mark::InsertMode, SwPosition const*)
{
}
@@ -143,7 +143,7 @@ namespace sw::mark {
void SetRefObject( SwServerObject* pObj );
- virtual void DeregisterFromDoc(SwDoc* const pDoc);
+ virtual void DeregisterFromDoc(SwDoc& rDoc);
virtual ~DdeBookmark() override;
private:
@@ -159,9 +159,9 @@ namespace sw::mark {
Bookmark(const SwPaM& rPaM,
const vcl::KeyCode& rCode,
const OUString& rName);
- virtual void InitDoc(SwDoc* const io_Doc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override;
+ virtual void InitDoc(SwDoc& io_Doc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override;
- virtual void DeregisterFromDoc(SwDoc* const io_pDoc) override;
+ virtual void DeregisterFromDoc(SwDoc& io_rDoc) override;
virtual auto InvalidateFrames() -> void override;
@@ -217,7 +217,7 @@ namespace sw::mark {
virtual void SetFieldHelptext(const OUString& aFieldHelptext) override
{ m_aFieldHelptext = aFieldHelptext; }
- virtual void ReleaseDoc(SwDoc* const) = 0;
+ virtual void ReleaseDoc(SwDoc&) = 0;
void SetMarkStartPos( const SwPosition& rNewStartPos );
void SetMarkEndPos( const SwPosition& rNewEndPos );
@@ -237,8 +237,8 @@ namespace sw::mark {
{
public:
TextFieldmark(const SwPaM& rPaM, const OUString& rName);
- virtual void InitDoc(SwDoc* const io_pDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override;
- virtual void ReleaseDoc(SwDoc* const pDoc) override;
+ virtual void InitDoc(SwDoc& io_rDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override;
+ virtual void ReleaseDoc(SwDoc& rDoc) override;
};
// Non text fieldmarks have no content between the start and end marks.
@@ -247,8 +247,8 @@ namespace sw::mark {
{
public:
NonTextFieldmark(const SwPaM& rPaM);
- virtual void InitDoc(SwDoc* const io_pDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override;
- virtual void ReleaseDoc(SwDoc* const pDoc) override;
+ virtual void InitDoc(SwDoc& io_rDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override;
+ virtual void ReleaseDoc(SwDoc& rDoc) override;
};
/// Fieldmark representing a checkbox form field.
@@ -309,8 +309,8 @@ namespace sw::mark {
DateFieldmark(const SwPaM& rPaM);
virtual ~DateFieldmark() override;
- virtual void InitDoc(SwDoc* const io_pDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override;
- virtual void ReleaseDoc(SwDoc* const pDoc) override;
+ virtual void InitDoc(SwDoc& io_rDoc, sw::mark::InsertMode eMode, SwPosition const* pSepPos) override;
+ virtual void ReleaseDoc(SwDoc& rDoc) override;
virtual void ShowButton(SwEditWin* pEditWin) override;
diff --git a/sw/source/core/inc/visiturl.hxx b/sw/source/core/inc/visiturl.hxx
index c16486d690f8..ccc5b9be7769 100644
--- a/sw/source/core/inc/visiturl.hxx
+++ b/sw/source/core/inc/visiturl.hxx
@@ -26,9 +26,9 @@ class SwDoc;
class SwURLStateChanged : public SfxListener
{
- SwDoc* m_pDoc;
+ SwDoc& m_rDoc;
public:
- SwURLStateChanged( SwDoc* pD );
+ SwURLStateChanged( SwDoc& rD );
virtual ~SwURLStateChanged() override;
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx
index 4e61e568e702..c7af2d70e400 100644
--- a/sw/source/core/txtnode/atrflyin.cxx
+++ b/sw/source/core/txtnode/atrflyin.cxx
@@ -88,7 +88,7 @@ SwTextFlyCnt::SwTextFlyCnt( SwFormatFlyCnt& rAttr, sal_Int32 nStartPos )
* SwFlyInContentFrame - this is done automatically already.
*/
-void SwTextFlyCnt::CopyFlyFormat( SwDoc* pDoc )
+void SwTextFlyCnt::CopyFlyFormat( SwDoc& rDoc )
{
SwFrameFormat* pFormat = GetFlyCnt().GetFrameFormat();
assert(pFormat);
@@ -97,17 +97,17 @@ void SwTextFlyCnt::CopyFlyFormat( SwDoc* pDoc )
// content.
// disable undo while copying attribute
- ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+ ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
SwFormatAnchor aAnchor( pFormat->GetAnchor() );
if ((RndStdIds::FLY_AT_PAGE != aAnchor.GetAnchorId()) &&
- (pDoc != pFormat->GetDoc())) // different documents?
+ (&rDoc != pFormat->GetDoc())) // different documents?
{
// JP 03.06.96: ensure that the copied anchor points to valid content!
// setting it to the correct position is done later.
- SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), +2 );
+ SwNodeIndex aIdx( rDoc.GetNodes().GetEndOfExtras(), +2 );
SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
if( !pCNd )
- pCNd = pDoc->GetNodes().GoNext( &aIdx );
+ pCNd = rDoc.GetNodes().GoNext( &aIdx );
SwPosition pos = *aAnchor.GetContentAnchor();
pos.nNode = aIdx;
@@ -123,7 +123,7 @@ void SwTextFlyCnt::CopyFlyFormat( SwDoc* pDoc )
aAnchor.SetAnchor( &pos );
}
- SwFrameFormat* pNew = pDoc->getIDocumentLayoutAccess().CopyLayoutFormat( *pFormat, aAnchor, false, false );
+ SwFrameFormat* pNew = rDoc.getIDocumentLayoutAccess().CopyLayoutFormat( *pFormat, aAnchor, false, false );
const_cast<SwFormatFlyCnt&>(GetFlyCnt()).SetFlyFormat( pNew );
}
diff --git a/sw/source/core/txtnode/atrtox.cxx b/sw/source/core/txtnode/atrtox.cxx
index 613956be9979..d5c862b38d1e 100644
--- a/sw/source/core/txtnode/atrtox.cxx
+++ b/sw/source/core/txtnode/atrtox.cxx
@@ -58,17 +58,17 @@ void SwTextTOXMark::SetEnd(sal_Int32 n)
m_pHints->EndPosChanged();
}
-void SwTextTOXMark::CopyTOXMark( SwDoc* pDoc )
+void SwTextTOXMark::CopyTOXMark( SwDoc& rDoc )
{
SwTOXMark& rTOX = const_cast<SwTOXMark&>(GetTOXMark());
TOXTypes eType = rTOX.GetTOXType()->GetType();
- const sal_uInt16 nCount = pDoc->GetTOXTypeCount( eType );
+ const sal_uInt16 nCount = rDoc.GetTOXTypeCount( eType );
const SwTOXType* pType = nullptr;
const OUString rNm = rTOX.GetTOXType()->GetTypeName();
for(sal_uInt16 i=0; i < nCount; ++i)
{
- const SwTOXType* pSrcType = pDoc->GetTOXType(eType, i);
+ const SwTOXType* pSrcType = rDoc.GetTOXType(eType, i);
if(pSrcType->GetTypeName() == rNm )
{
pType = pSrcType;
@@ -79,8 +79,8 @@ void SwTextTOXMark::CopyTOXMark( SwDoc* pDoc )
// if the requested tox type does not exist, create it
if(!pType)
{
- pDoc->InsertTOXType( SwTOXType( eType, rNm ) );
- pType = pDoc->GetTOXType(eType, 0);
+ rDoc.InsertTOXType( SwTOXType( eType, rNm ) );
+ pType = rDoc.GetTOXType(eType, 0);
}
// register at target tox type
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 57a605f41098..42fe18e904ed 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1863,7 +1863,7 @@ static void lcl_CopyHint(
{
// ToXMarks that are copied to different SwDocs must register
// at their new ToX (SwModify).
- static_txtattr_cast<SwTextTOXMark*>(pNewHt)->CopyTOXMark(pOtherDoc);
+ static_txtattr_cast<SwTextTOXMark*>(pNewHt)->CopyTOXMark(*pOtherDoc);
}
break;
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index c771a862bee4..832bbdbb8631 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1097,7 +1097,7 @@ SwTextAttr* MakeTextAttr(
if ( static_cast<const SwFormatFlyCnt &>(rAttr).GetTextFlyCnt() )
{
// if it has an existing attr then the format must be copied
- static_cast<SwTextFlyCnt *>(pNew)->CopyFlyFormat( &rDoc );
+ static_cast<SwTextFlyCnt *>(pNew)->CopyFlyFormat( rDoc );
}
}
break;
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index dab2c305dfb9..08897174b970 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -301,29 +301,29 @@ void SwViewShell::CalcPagesForPrint( sal_uInt16 nMax )
pMyLayout->EndAllAction();
}
-void SwViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt)
+void SwViewShell::FillPrtDoc( SwDoc& rPrtDoc, const SfxPrinter* pPrt)
{
OSL_ENSURE( dynamic_cast<const SwFEShell*>( this) != nullptr,"SwViewShell::Prt for FEShell only");
SwFEShell* pFESh = static_cast<SwFEShell*>(this);
- pPrtDoc->getIDocumentFieldsAccess().LockExpFields();
+ rPrtDoc.getIDocumentFieldsAccess().LockExpFields();
// use given printer
//! Make a copy of it since it gets destroyed with the temporary document
//! used for PDF export
if (pPrt)
- pPrtDoc->getIDocumentDeviceAccess().setPrinter( VclPtr<SfxPrinter>::Create(*pPrt), true, true );
+ rPrtDoc.getIDocumentDeviceAccess().setPrinter( VclPtr<SfxPrinter>::Create(*pPrt), true, true );
const SfxItemPool& rPool = GetAttrPool();
for( sal_uInt16 nWh = POOLATTR_BEGIN; nWh < POOLATTR_END; ++nWh )
{
const SfxPoolItem* pCpyItem = rPool.GetPoolDefaultItem( nWh );
if( nullptr != pCpyItem )
- pPrtDoc->GetAttrPool().SetPoolDefaultItem( *pCpyItem );
+ rPrtDoc.GetAttrPool().SetPoolDefaultItem( *pCpyItem );
}
// JP 29.07.99 - Bug 67951 - set all Styles from the SourceDoc into
// the PrintDoc - will be replaced!
- pPrtDoc->ReplaceStyles( *GetDoc() );
+ rPrtDoc.ReplaceStyles( *GetDoc() );
SwShellCursor *pActCursor = pFESh->GetCursor_();
SwShellCursor *pFirstCursor = pActCursor->GetNext();
@@ -358,13 +358,13 @@ void SwViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt)
OSL_ENSURE( pPage, "no page found!" );
// get page descriptor - fall back to the first one if pPage could not be found
- const SwPageDesc* pPageDesc = pPage ? pPrtDoc->FindPageDesc(
- pPage->GetPageDesc()->GetName() ) : &pPrtDoc->GetPageDesc( 0 );
+ const SwPageDesc* pPageDesc = pPage ? rPrtDoc.FindPageDesc(
+ pPage->GetPageDesc()->GetName() ) : &rPrtDoc.GetPageDesc( 0 );
if( !pFESh->IsTableMode() && pActCursor && pActCursor->HasMark() )
{ // Tweak paragraph attributes of last paragraph
- SwNodeIndex aNodeIdx( *pPrtDoc->GetNodes().GetEndOfContent().StartOfSectionNode() );
- SwTextNode* pTextNd = pPrtDoc->GetNodes().GoNext( &aNodeIdx )->GetTextNode();
+ SwNodeIndex aNodeIdx( *rPrtDoc.GetNodes().GetEndOfContent().StartOfSectionNode() );
+ SwTextNode* pTextNd = rPrtDoc.GetNodes().GoNext( &aNodeIdx )->GetTextNode();
SwContentNode *pLastNd =
pActCursor->GetContentNode( (*pActCursor->GetMark()) <= (*pActCursor->GetPoint()) );
// copy the paragraph attributes of the first paragraph
@@ -373,12 +373,12 @@ void SwViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt)
}
// fill it with the selected content
- pFESh->Copy( pPrtDoc );
+ pFESh->Copy( &rPrtDoc );
// set the page style at the first paragraph
{
- SwNodeIndex aNodeIdx( *pPrtDoc->GetNodes().GetEndOfContent().StartOfSectionNode() );
- SwContentNode* pCNd = pPrtDoc->GetNodes().GoNext( &aNodeIdx ); // go to 1st ContentNode
+ SwNodeIndex aNodeIdx( *rPrtDoc.GetNodes().GetEndOfContent().StartOfSectionNode() );
+ SwContentNode* pCNd = rPrtDoc.GetNodes().GoNext( &aNodeIdx ); // go to 1st ContentNode
if( pFESh->IsTableMode() )
{
SwTableNode* pTNd = pCNd->FindTableNode();
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 017a2390aeb4..9412e103dbf6 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -650,7 +650,7 @@ SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc()
SwDoc *const pTempDoc( pDocSh->GetDoc() );
// #i103634#, #i112425#: do not expand numbering and fields on PDF export
pTempDoc->SetClipBoard(true);
- rOldSh.FillPrtDoc(pTempDoc, pPrt);
+ rOldSh.FillPrtDoc(*pTempDoc, pPrt);
SfxViewFrame* pDocFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, SFX_INTERFACE_NONE );
SwView* pDocView = static_cast<SwView*>( pDocFrame->GetViewShell() );
pDocView->AttrChangedNotify(nullptr);//So that SelectShell is called.
More information about the Libreoffice-commits
mailing list