summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-10-05 12:21:13 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-10-05 21:28:06 +0200
commit1b4b3db429555c48dd800f175f92040b73cece65 (patch)
tree79428d0fb525ee623a500f5f8a0eef198cdd1f09 /sw/source/core
parentbe44b86998b2681d0de231bd9f5364a968e7c6b8 (diff)
SwUndoParagraphSigning never passed null SwDoc*
ditto: SwUndoFrameFormatCreate ctor SwUndoCharFormatCreate ctor SwUndoCondTextFormatCollCreate ctor SwUndoTextFormatCollCreate ctor SwUndoFormatCreate ctor SwUndoFrameFormatDelete ctor SwUndoCharFormatDelete ctor SwUndoTextFormatCollDelete ctor SwUndoCondTextFormatCollDelete ctor SwUndoFormatDelete ctor SwUndoRenameCharFormat ctor SwUndoRenameFormatColl ctor SwUndoRenameFrameFormat ctor SwUndoNumruleRename ctor SwUndoNumruleDelete ctor SwUndoNumruleCreate ctor SwUndoInsNum ctor Change-Id: I71805bf3f13235c91e9d4746e2ca0a4e4804824c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103964 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/doc/docfmt.cxx22
-rw-r--r--sw/source/core/doc/docnum.cxx8
-rw-r--r--sw/source/core/edit/edfcol.cxx32
-rw-r--r--sw/source/core/inc/SwUndoFmt.hxx46
-rw-r--r--sw/source/core/inc/UndoNumbering.hxx2
-rw-r--r--sw/source/core/undo/SwUndoFmt.cxx142
-rw-r--r--sw/source/core/undo/unnum.cxx4
7 files changed, 128 insertions, 128 deletions
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 1e030f1a0639..8dd9c6e84a3a 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -667,7 +667,7 @@ void SwDoc::DelCharFormat(size_t nFormat, bool bBroadcast)
if (GetIDocumentUndoRedo().DoesUndo())
{
GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoCharFormatDelete>(pDel, this));
+ std::make_unique<SwUndoCharFormatDelete>(pDel, *this));
}
delete (*mpCharFormatTable)[nFormat];
@@ -704,7 +704,7 @@ void SwDoc::DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast )
if (GetIDocumentUndoRedo().DoesUndo())
{
GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoFrameFormatDelete>(pFormat, this));
+ std::make_unique<SwUndoFrameFormatDelete>(pFormat, *this));
}
mpFrameFormatTable->erase( pFormat );
@@ -819,7 +819,7 @@ SwFrameFormat *SwDoc::MakeFrameFormat(const OUString &rFormatName,
if (GetIDocumentUndoRedo().DoesUndo())
{
GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoFrameFormatCreate>(pFormat, pDerivedFrom, this));
+ std::make_unique<SwUndoFrameFormatCreate>(pFormat, pDerivedFrom, *this));
}
if (bBroadcast)
@@ -852,7 +852,7 @@ SwCharFormat *SwDoc::MakeCharFormat( const OUString &rFormatName,
if (GetIDocumentUndoRedo().DoesUndo())
{
GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoCharFormatCreate>(pFormat, pDerivedFrom, this));
+ std::make_unique<SwUndoCharFormatCreate>(pFormat, pDerivedFrom, *this));
}
if (bBroadcast)
@@ -888,7 +888,7 @@ SwTextFormatColl* SwDoc::MakeTextFormatColl( const OUString &rFormatName,
{
GetIDocumentUndoRedo().AppendUndo(
std::make_unique<SwUndoTextFormatCollCreate>(pFormatColl, pDerivedFrom,
- this));
+ *this));
}
if (bBroadcast)
@@ -922,7 +922,7 @@ SwConditionTextFormatColl* SwDoc::MakeCondTextFormatColl( const OUString &rForma
{
GetIDocumentUndoRedo().AppendUndo(
std::make_unique<SwUndoCondTextFormatCollCreate>(pFormatColl, pDerivedFrom,
- this));
+ *this));
}
if (bBroadcast)
@@ -963,11 +963,11 @@ void SwDoc::DelTextFormatColl(size_t nFormatColl, bool bBroadcast)
std::unique_ptr<SwUndoTextFormatCollDelete> pUndo;
if (RES_CONDTXTFMTCOLL == pDel->Which())
{
- pUndo.reset(new SwUndoCondTextFormatCollDelete(pDel, this));
+ pUndo.reset(new SwUndoCondTextFormatCollDelete(pDel, *this));
}
else
{
- pUndo.reset(new SwUndoTextFormatCollDelete(pDel, this));
+ pUndo.reset(new SwUndoTextFormatCollDelete(pDel, *this));
}
GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
@@ -1901,15 +1901,15 @@ void SwDoc::RenameFormat(SwFormat & rFormat, const OUString & sNewName,
switch (rFormat.Which())
{
case RES_CHRFMT:
- pUndo.reset(new SwUndoRenameCharFormat(rFormat.GetName(), sNewName, this));
+ pUndo.reset(new SwUndoRenameCharFormat(rFormat.GetName(), sNewName, *this));
eFamily = SfxStyleFamily::Char;
break;
case RES_TXTFMTCOLL:
- pUndo.reset(new SwUndoRenameFormatColl(rFormat.GetName(), sNewName, this));
+ pUndo.reset(new SwUndoRenameFormatColl(rFormat.GetName(), sNewName, *this));
eFamily = SfxStyleFamily::Para;
break;
case RES_FRMFMT:
- pUndo.reset(new SwUndoRenameFrameFormat(rFormat.GetName(), sNewName, this));
+ pUndo.reset(new SwUndoRenameFrameFormat(rFormat.GetName(), sNewName, *this));
eFamily = SfxStyleFamily::Frame;
break;
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 5d466edbd942..0e32692173c8 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1061,7 +1061,7 @@ bool SwDoc::DelNumRule( const OUString& rName, bool bBroadcast )
if (GetIDocumentUndoRedo().DoesUndo())
{
GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoNumruleDelete>(*(*mpNumRuleTable)[nPos], this));
+ std::make_unique<SwUndoNumruleDelete>(*(*mpNumRuleTable)[nPos], *this));
}
if (bBroadcast)
@@ -1092,7 +1092,7 @@ void SwDoc::ChgNumRuleFormats( const SwNumRule& rRule )
SwUndoInsNum* pUndo = nullptr;
if (GetIDocumentUndoRedo().DoesUndo())
{
- pUndo = new SwUndoInsNum( *pRule, rRule, this );
+ pUndo = new SwUndoInsNum( *pRule, rRule, *this );
pUndo->GetHistory();
GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndo) );
}
@@ -1118,7 +1118,7 @@ bool SwDoc::RenameNumRule(const OUString & rOldName, const OUString & rNewName,
if (GetIDocumentUndoRedo().DoesUndo())
{
GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoNumruleRename>(rOldName, rNewName, this));
+ std::make_unique<SwUndoNumruleRename>(rOldName, rNewName, *this));
}
SwNumRule::tTextNodeList aTextNodeList;
@@ -2479,7 +2479,7 @@ sal_uInt16 SwDoc::MakeNumRule( const OUString &rName,
if (GetIDocumentUndoRedo().DoesUndo())
{
GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoNumruleCreate>(pNew, this));
+ std::make_unique<SwUndoNumruleCreate>(pNew, *this));
}
if (bBroadcast)
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 6fd50e7536d8..0812f3bebc8b 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -670,7 +670,7 @@ void lcl_ValidateParagraphSignatures(SwDoc& rDoc, const uno::Reference<text::XTe
{
rDoc.GetIDocumentUndoRedo().StartUndo(SwUndoId::PARA_SIGN_ADD, nullptr);
rDoc.GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoParagraphSigning>(&rDoc, xField, xParagraph, false));
+ std::make_unique<SwUndoParagraphSigning>(rDoc, xField, xParagraph, false));
lcl_RemoveParagraphMetadataField(xField);
rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::PARA_SIGN_ADD, nullptr);
}
@@ -1659,18 +1659,18 @@ void SwEditShell::SetWatermark(const SfxWatermarkItem& rWatermark)
}
}
-SwUndoParagraphSigning::SwUndoParagraphSigning(SwDoc* pDoc,
+SwUndoParagraphSigning::SwUndoParagraphSigning(SwDoc& rDoc,
const uno::Reference<text::XTextField>& xField,
const uno::Reference<text::XTextContent>& xParent,
const bool bRemove)
- : SwUndo(SwUndoId::PARA_SIGN_ADD, pDoc),
- m_pDoc(pDoc),
+ : SwUndo(SwUndoId::PARA_SIGN_ADD, &rDoc),
+ m_rDoc(rDoc),
m_xField(xField),
m_xParent(xParent),
m_bRemove(bRemove)
{
// Save the metadata and field content to undo/redo.
- uno::Reference<frame::XModel> xModel = m_pDoc->GetDocShell()->GetBaseModel();
+ uno::Reference<frame::XModel> xModel = m_rDoc.GetDocShell()->GetBaseModel();
const std::map<OUString, OUString> aStatements = lcl_getRDFStatements(xModel, m_xField);
const auto it = aStatements.find(ParagraphSignatureIdRDFName);
if (it != aStatements.end())
@@ -1707,35 +1707,35 @@ void SwUndoParagraphSigning::RepeatImpl(::sw::RepeatContext&)
void SwUndoParagraphSigning::Insert()
{
// Disable undo to avoid introducing noise when we edit the metadata field.
- const bool isUndoEnabled = m_pDoc->GetIDocumentUndoRedo().DoesUndo();
- m_pDoc->GetIDocumentUndoRedo().DoUndo(false);
+ const bool isUndoEnabled = m_rDoc.GetIDocumentUndoRedo().DoesUndo();
+ m_rDoc.GetIDocumentUndoRedo().DoUndo(false);
// Prevent validation since this will trigger a premature validation
// upon inserting, but before setting the metadata.
- SwEditShell* pEditSh = m_pDoc->GetEditShell();
+ SwEditShell* pEditSh = m_rDoc.GetEditShell();
const bool bOldValidationFlag = pEditSh->SetParagraphSignatureValidation(false);
comphelper::ScopeGuard const g([&] () {
pEditSh->SetParagraphSignatureValidation(bOldValidationFlag);
- m_pDoc->GetIDocumentUndoRedo().DoUndo(isUndoEnabled);
+ m_rDoc.GetIDocumentUndoRedo().DoUndo(isUndoEnabled);
});
- m_xField = lcl_InsertParagraphSignature(m_pDoc->GetDocShell()->GetBaseModel(), m_xParent, m_signature, m_usage);
- lcl_DoUpdateParagraphSignatureField(*m_pDoc, m_xField, m_display);
+ m_xField = lcl_InsertParagraphSignature(m_rDoc.GetDocShell()->GetBaseModel(), m_xParent, m_signature, m_usage);
+ lcl_DoUpdateParagraphSignatureField(m_rDoc, m_xField, m_display);
}
void SwUndoParagraphSigning::Remove()
{
// Disable undo to avoid introducing noise when we edit the metadata field.
- const bool isUndoEnabled = m_pDoc->GetIDocumentUndoRedo().DoesUndo();
- m_pDoc->GetIDocumentUndoRedo().DoUndo(false);
+ const bool isUndoEnabled = m_rDoc.GetIDocumentUndoRedo().DoesUndo();
+ m_rDoc.GetIDocumentUndoRedo().DoUndo(false);
// Prevent validation since this will trigger a premature validation
// upon removing.
- SwEditShell* pEditSh = m_pDoc->GetEditShell();
+ SwEditShell* pEditSh = m_rDoc.GetEditShell();
const bool bOldValidationFlag = pEditSh->SetParagraphSignatureValidation(false);
comphelper::ScopeGuard const g([&] () {
pEditSh->SetParagraphSignatureValidation(bOldValidationFlag);
- m_pDoc->GetIDocumentUndoRedo().DoUndo(isUndoEnabled);
+ m_rDoc.GetIDocumentUndoRedo().DoUndo(isUndoEnabled);
});
lcl_RemoveParagraphMetadataField(m_xField);
@@ -1810,7 +1810,7 @@ void SwEditShell::SignParagraph()
lcl_UpdateParagraphSignatureField(*GetDoc(), xModel, xParagraph, xField, utf8Text);
rDoc.GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoParagraphSigning>(GetDoc(), xField, xParagraph, true));
+ std::make_unique<SwUndoParagraphSigning>(rDoc, xField, xParagraph, true));
rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::PARA_SIGN_ADD, nullptr);
}
diff --git a/sw/source/core/inc/SwUndoFmt.hxx b/sw/source/core/inc/SwUndoFmt.hxx
index 7ba6b1c348d1..b91eec91d539 100644
--- a/sw/source/core/inc/SwUndoFmt.hxx
+++ b/sw/source/core/inc/SwUndoFmt.hxx
@@ -34,7 +34,7 @@ class SwUndoFormatCreate : public SwUndo
protected:
SwFormat * m_pNew;
OUString m_sDerivedFrom;
- SwDoc * m_pDoc;
+ SwDoc& m_rDoc;
mutable OUString m_sNewName;
SfxItemSet * m_pNewSet;
sal_uInt16 m_nId; // FormatId related
@@ -42,7 +42,7 @@ protected:
public:
SwUndoFormatCreate(SwUndoId nUndoId, SwFormat * pNew, SwFormat const * pDerivedFrom,
- SwDoc * pDoc);
+ SwDoc& rDoc);
virtual ~SwUndoFormatCreate() override;
virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
@@ -59,14 +59,14 @@ class SwUndoFormatDelete : public SwUndo
{
protected:
OUString m_sDerivedFrom;
- SwDoc * m_pDoc;
+ SwDoc& m_rDoc;
OUString m_sOldName;
SfxItemSet m_aOldSet;
sal_uInt16 m_nId; // FormatId related
bool m_bAuto;
public:
- SwUndoFormatDelete(SwUndoId nUndoId, SwFormat const * pOld, SwDoc * pDoc);
+ SwUndoFormatDelete(SwUndoId nUndoId, SwFormat const * pOld, SwDoc& rDoc);
virtual ~SwUndoFormatDelete() override;
virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
@@ -83,12 +83,12 @@ class SwUndoRenameFormat : public SwUndo
{
protected:
OUString m_sOldName, m_sNewName;
- SwDoc * m_pDoc;
+ SwDoc& m_rDoc;
public:
SwUndoRenameFormat(SwUndoId nUndoId, const OUString & sOldName,
const OUString & sNewName,
- SwDoc * pDoc);
+ SwDoc& rDoc);
virtual ~SwUndoRenameFormat() override;
virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
@@ -103,7 +103,7 @@ class SwUndoTextFormatCollCreate : public SwUndoFormatCreate
{
public:
SwUndoTextFormatCollCreate(SwTextFormatColl * pNew, SwTextFormatColl const * pDerivedFrom,
- SwDoc * pDoc);
+ SwDoc& rDoc);
virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
virtual void Delete() override;
@@ -113,7 +113,7 @@ public:
class SwUndoTextFormatCollDelete : public SwUndoFormatDelete
{
public:
- SwUndoTextFormatCollDelete(SwTextFormatColl const * pOld, SwDoc * pDoc);
+ SwUndoTextFormatCollDelete(SwTextFormatColl const * pOld, SwDoc& rDoc);
virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
virtual void Delete(SwFormat * pFormat) override;
@@ -123,14 +123,14 @@ public:
class SwUndoCondTextFormatCollCreate : public SwUndoTextFormatCollCreate
{
public:
- SwUndoCondTextFormatCollCreate(SwConditionTextFormatColl * pNew, SwTextFormatColl const * pDerivedFrom, SwDoc * pDoc);
+ SwUndoCondTextFormatCollCreate(SwConditionTextFormatColl * pNew, SwTextFormatColl const * pDerivedFrom, SwDoc& rDoc);
virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
};
class SwUndoCondTextFormatCollDelete : public SwUndoTextFormatCollDelete
{
public:
- SwUndoCondTextFormatCollDelete(SwTextFormatColl const * pOld, SwDoc * pDoc);
+ SwUndoCondTextFormatCollDelete(SwTextFormatColl const * pOld, SwDoc& rDoc);
virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
};
@@ -139,7 +139,7 @@ class SwUndoRenameFormatColl : public SwUndoRenameFormat
public:
SwUndoRenameFormatColl(const OUString & sOldName,
const OUString & sNewName,
- SwDoc * pDoc);
+ SwDoc& rDoc);
virtual SwFormat * Find(const OUString & rName) const override;
};
@@ -148,7 +148,7 @@ class SwUndoCharFormatCreate : public SwUndoFormatCreate
{
public:
SwUndoCharFormatCreate(SwCharFormat * pNew, SwCharFormat const * pDerivedFrom,
- SwDoc * pDoc);
+ SwDoc& rDoc);
virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
virtual void Delete() override;
@@ -158,7 +158,7 @@ public:
class SwUndoCharFormatDelete : public SwUndoFormatDelete
{
public:
- SwUndoCharFormatDelete(SwCharFormat const * pOld, SwDoc * pDoc);
+ SwUndoCharFormatDelete(SwCharFormat const * pOld, SwDoc& rDoc);
virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
virtual void Delete(SwFormat * pFormat) override;
@@ -170,7 +170,7 @@ class SwUndoRenameCharFormat : public SwUndoRenameFormat
public:
SwUndoRenameCharFormat(const OUString & sOldName,
const OUString & sNewName,
- SwDoc * pDoc);
+ SwDoc& rDoc);
virtual SwFormat * Find(const OUString & rName) const override;
};
@@ -179,7 +179,7 @@ class SwUndoFrameFormatCreate : public SwUndoFormatCreate
{
public:
SwUndoFrameFormatCreate(SwFrameFormat * pNew, SwFrameFormat const * pDerivedFrom,
- SwDoc * pDoc);
+ SwDoc& rDoc);
virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
virtual void Delete() override;
@@ -189,7 +189,7 @@ public:
class SwUndoFrameFormatDelete : public SwUndoFormatDelete
{
public:
- SwUndoFrameFormatDelete(SwFrameFormat const * pOld, SwDoc * pDoc);
+ SwUndoFrameFormatDelete(SwFrameFormat const * pOld, SwDoc& rDoc);
virtual SwFormat * Create(SwFormat * pDerivedFrom) override;
virtual void Delete(SwFormat * pFormat) override;
@@ -201,7 +201,7 @@ class SwUndoRenameFrameFormat : public SwUndoRenameFormat
public:
SwUndoRenameFrameFormat(const OUString & sOldName,
const OUString & sNewName,
- SwDoc * pDoc);
+ SwDoc& rDoc);
virtual SwFormat * Find(const OUString & rName) const override;
};
@@ -210,11 +210,11 @@ class SwUndoNumruleCreate : public SwUndo
{
const SwNumRule * m_pNew;
mutable SwNumRule m_aNew;
- SwDoc * m_pDoc;
+ SwDoc& m_rDoc;
mutable bool m_bInitialized;
public:
- SwUndoNumruleCreate(const SwNumRule * pNew, SwDoc * pDoc);
+ SwUndoNumruleCreate(const SwNumRule * pNew, SwDoc& rDoc);
virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
@@ -225,10 +225,10 @@ public:
class SwUndoNumruleDelete : public SwUndo
{
SwNumRule m_aOld;
- SwDoc * m_pDoc;
+ SwDoc& m_rDoc;
public:
- SwUndoNumruleDelete(const SwNumRule & aRule, SwDoc * pDoc);
+ SwUndoNumruleDelete(const SwNumRule& rRule, SwDoc& rDoc);
virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
@@ -239,11 +239,11 @@ public:
class SwUndoNumruleRename : public SwUndo
{
OUString m_aOldName, m_aNewName;
- SwDoc * m_pDoc;
+ SwDoc& m_rDoc;
public:
SwUndoNumruleRename(const OUString & aOldName, const OUString & aNewName,
- SwDoc * pDoc);
+ SwDoc& rDoc);
virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
diff --git a/sw/source/core/inc/UndoNumbering.hxx b/sw/source/core/inc/UndoNumbering.hxx
index c363c3edca9a..57a833b86760 100644
--- a/sw/source/core/inc/UndoNumbering.hxx
+++ b/sw/source/core/inc/UndoNumbering.hxx
@@ -37,7 +37,7 @@ class SwUndoInsNum : public SwUndo, private SwUndRng
public:
SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule );
SwUndoInsNum( const SwNumRule& rOldRule, const SwNumRule& rNewRule,
- const SwDoc* pDoc, SwUndoId nUndoId = SwUndoId::INSFMTATTR );
+ const SwDoc& rDoc, SwUndoId nUndoId = SwUndoId::INSFMTATTR );
SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule,
const OUString& rReplaceRule );
diff --git a/sw/source/core/undo/SwUndoFmt.cxx b/sw/source/core/undo/SwUndoFmt.cxx
index bb9ffa75df98..818cf7e751e1 100644
--- a/sw/source/core/undo/SwUndoFmt.cxx
+++ b/sw/source/core/undo/SwUndoFmt.cxx
@@ -29,9 +29,9 @@
#include <strings.hrc>
SwUndoFormatCreate::SwUndoFormatCreate
-(SwUndoId nUndoId, SwFormat * _pNew, SwFormat const * _pDerivedFrom, SwDoc * _pDoc)
- : SwUndo(nUndoId, _pDoc), m_pNew(_pNew),
- m_pDoc(_pDoc), m_pNewSet(nullptr), m_nId(0), m_bAuto(false)
+(SwUndoId nUndoId, SwFormat * _pNew, SwFormat const * _pDerivedFrom, SwDoc& rDoc)
+ : SwUndo(nUndoId, &rDoc), m_pNew(_pNew),
+ m_rDoc(rDoc), m_pNewSet(nullptr), m_nId(0), m_bAuto(false)
{
if (_pDerivedFrom)
m_sDerivedFrom = _pDerivedFrom->GetName();
@@ -70,7 +70,7 @@ void SwUndoFormatCreate::RedoImpl(::sw::UndoRedoContext &)
if (pFormat && m_pNewSet)
{
pFormat->SetAuto(m_bAuto);
- m_pDoc->ChgFormat(*pFormat, *m_pNewSet);
+ m_rDoc.ChgFormat(*pFormat, *m_pNewSet);
pFormat->SetPoolFormatId((pFormat->GetPoolFormatId()
& ~COLL_GET_RANGE_BITS)
| m_nId);
@@ -94,9 +94,9 @@ SwRewriter SwUndoFormatCreate::GetRewriter() const
}
SwUndoFormatDelete::SwUndoFormatDelete
-(SwUndoId nUndoId, SwFormat const * _pOld, SwDoc * _pDoc)
- : SwUndo(nUndoId, _pDoc),
- m_pDoc(_pDoc), m_sOldName(_pOld->GetName()),
+(SwUndoId nUndoId, SwFormat const * _pOld, SwDoc& rDoc)
+ : SwUndo(nUndoId, &rDoc),
+ m_rDoc(rDoc), m_sOldName(_pOld->GetName()),
m_aOldSet(_pOld->GetAttrSet())
{
m_sDerivedFrom = _pOld->DerivedFrom()->GetName();
@@ -116,7 +116,7 @@ void SwUndoFormatDelete::UndoImpl(::sw::UndoRedoContext &)
if (pFormat)
{
- m_pDoc->ChgFormat(*pFormat, m_aOldSet);
+ m_rDoc.ChgFormat(*pFormat, m_aOldSet);
pFormat->SetAuto(m_bAuto);
pFormat->SetPoolFormatId((pFormat->GetPoolFormatId() &
~COLL_GET_RANGE_BITS)
@@ -146,9 +146,9 @@ SwRewriter SwUndoFormatDelete::GetRewriter() const
SwUndoRenameFormat::SwUndoRenameFormat(SwUndoId nUndoId,
const OUString & _sOldName,
const OUString & _sNewName,
- SwDoc * _pDoc)
- : SwUndo(nUndoId, _pDoc), m_sOldName(_sOldName),
- m_sNewName(_sNewName), m_pDoc(_pDoc)
+ SwDoc& rDoc)
+ : SwUndo(nUndoId, &rDoc), m_sOldName(_sOldName),
+ m_sNewName(_sNewName), m_rDoc(rDoc)
{
}
@@ -162,7 +162,7 @@ void SwUndoRenameFormat::UndoImpl(::sw::UndoRedoContext &)
if (pFormat)
{
- m_pDoc->RenameFormat(*pFormat, m_sOldName, true);
+ m_rDoc.RenameFormat(*pFormat, m_sOldName, true);
}
}
@@ -172,7 +172,7 @@ void SwUndoRenameFormat::RedoImpl(::sw::UndoRedoContext &)
if (pFormat)
{
- m_pDoc->RenameFormat(*pFormat, m_sNewName, true);
+ m_rDoc.RenameFormat(*pFormat, m_sNewName, true);
}
}
@@ -188,192 +188,192 @@ SwRewriter SwUndoRenameFormat::GetRewriter() const
}
SwUndoTextFormatCollCreate::SwUndoTextFormatCollCreate
-(SwTextFormatColl * _pNew, SwTextFormatColl const * _pDerivedFrom, SwDoc * _pDoc)
- : SwUndoFormatCreate(SwUndoId::TXTFMTCOL_CREATE, _pNew, _pDerivedFrom, _pDoc)
+(SwTextFormatColl * _pNew, SwTextFormatColl const * _pDerivedFrom, SwDoc& rDoc)
+ : SwUndoFormatCreate(SwUndoId::TXTFMTCOL_CREATE, _pNew, _pDerivedFrom, rDoc)
{
}
SwFormat * SwUndoTextFormatCollCreate::Create(SwFormat * pDerivedFrom)
{
- return m_pDoc->MakeTextFormatColl(m_sNewName, static_cast<SwTextFormatColl *>(pDerivedFrom), true);
+ return m_rDoc.MakeTextFormatColl(m_sNewName, static_cast<SwTextFormatColl *>(pDerivedFrom), true);
}
void SwUndoTextFormatCollCreate::Delete()
{
- m_pDoc->DelTextFormatColl(static_cast<SwTextFormatColl *>(m_pNew), true);
+ m_rDoc.DelTextFormatColl(static_cast<SwTextFormatColl *>(m_pNew), true);
}
SwFormat * SwUndoTextFormatCollCreate::Find(const OUString & rName) const
{
- return m_pDoc->FindTextFormatCollByName(rName);
+ return m_rDoc.FindTextFormatCollByName(rName);
}
SwUndoTextFormatCollDelete::SwUndoTextFormatCollDelete(SwTextFormatColl const * _pOld,
- SwDoc * _pDoc)
- : SwUndoFormatDelete(SwUndoId::TXTFMTCOL_DELETE, _pOld, _pDoc)
+ SwDoc& rDoc)
+ : SwUndoFormatDelete(SwUndoId::TXTFMTCOL_DELETE, _pOld, rDoc)
{
}
SwFormat * SwUndoTextFormatCollDelete::Create(SwFormat * pDerivedFrom)
{
- return m_pDoc->MakeTextFormatColl(m_sOldName, static_cast<SwTextFormatColl *>(pDerivedFrom), true);
+ return m_rDoc.MakeTextFormatColl(m_sOldName, static_cast<SwTextFormatColl *>(pDerivedFrom), true);
}
void SwUndoTextFormatCollDelete::Delete(SwFormat * pOld)
{
- m_pDoc->DelTextFormatColl(static_cast<SwTextFormatColl *>(pOld), true);
+ m_rDoc.DelTextFormatColl(static_cast<SwTextFormatColl *>(pOld), true);
}
SwFormat * SwUndoTextFormatCollDelete::Find(const OUString & rName) const
{
- return m_pDoc->FindTextFormatCollByName(rName);
+ return m_rDoc.FindTextFormatCollByName(rName);
}
SwUndoCondTextFormatCollCreate::SwUndoCondTextFormatCollCreate(SwConditionTextFormatColl *_pNew,
- SwTextFormatColl const *_pDerivedFrom, SwDoc *_pDoc)
- : SwUndoTextFormatCollCreate(_pNew, _pDerivedFrom, _pDoc)
+ SwTextFormatColl const *_pDerivedFrom, SwDoc& rDoc)
+ : SwUndoTextFormatCollCreate(_pNew, _pDerivedFrom, rDoc)
{
}
SwFormat * SwUndoCondTextFormatCollCreate::Create(SwFormat * pDerivedFrom)
{
- return m_pDoc->MakeCondTextFormatColl(m_sNewName, static_cast<SwTextFormatColl *>(pDerivedFrom), true);
+ return m_rDoc.MakeCondTextFormatColl(m_sNewName, static_cast<SwTextFormatColl *>(pDerivedFrom), true);
}
SwUndoCondTextFormatCollDelete::SwUndoCondTextFormatCollDelete(SwTextFormatColl const * _pOld,
- SwDoc * _pDoc)
- : SwUndoTextFormatCollDelete(_pOld, _pDoc)
+ SwDoc& rDoc)
+ : SwUndoTextFormatCollDelete(_pOld, rDoc)
{
}
SwFormat * SwUndoCondTextFormatCollDelete::Create(SwFormat * pDerivedFrom)
{
- return m_pDoc->MakeCondTextFormatColl(m_sOldName, static_cast<SwTextFormatColl *>(pDerivedFrom), true);
+ return m_rDoc.MakeCondTextFormatColl(m_sOldName, static_cast<SwTextFormatColl *>(pDerivedFrom), true);
}
SwUndoRenameFormatColl::SwUndoRenameFormatColl(const OUString & sInitOldName,
const OUString & sInitNewName,
- SwDoc * _pDoc)
- : SwUndoRenameFormat(SwUndoId::TXTFMTCOL_RENAME, sInitOldName, sInitNewName, _pDoc)
+ SwDoc& rDoc)
+ : SwUndoRenameFormat(SwUndoId::TXTFMTCOL_RENAME, sInitOldName, sInitNewName, rDoc)
{
}
SwFormat * SwUndoRenameFormatColl::Find(const OUString & rName) const
{
- return m_pDoc->FindTextFormatCollByName(rName);
+ return m_rDoc.FindTextFormatCollByName(rName);
}
SwUndoCharFormatCreate::SwUndoCharFormatCreate(SwCharFormat * pNewFormat,
SwCharFormat const * pDerivedFrom,
- SwDoc * pDocument)
- : SwUndoFormatCreate(SwUndoId::CHARFMT_CREATE, pNewFormat, pDerivedFrom, pDocument)
+ SwDoc& rDocument)
+ : SwUndoFormatCreate(SwUndoId::CHARFMT_CREATE, pNewFormat, pDerivedFrom, rDocument)
{
}
SwFormat * SwUndoCharFormatCreate::Create(SwFormat * pDerivedFrom)
{
- return m_pDoc->MakeCharFormat(m_sNewName, static_cast<SwCharFormat *>(pDerivedFrom), true);
+ return m_rDoc.MakeCharFormat(m_sNewName, static_cast<SwCharFormat *>(pDerivedFrom), true);
}
void SwUndoCharFormatCreate::Delete()
{
- m_pDoc->DelCharFormat(static_cast<SwCharFormat *>(m_pNew), true);
+ m_rDoc.DelCharFormat(static_cast<SwCharFormat *>(m_pNew), true);
}
SwFormat * SwUndoCharFormatCreate::Find(const OUString & rName) const
{
- return m_pDoc->FindCharFormatByName(rName);
+ return m_rDoc.FindCharFormatByName(rName);
}
-SwUndoCharFormatDelete::SwUndoCharFormatDelete(SwCharFormat const * pOld, SwDoc * pDocument)
- : SwUndoFormatDelete(SwUndoId::CHARFMT_DELETE, pOld, pDocument)
+SwUndoCharFormatDelete::SwUndoCharFormatDelete(SwCharFormat const * pOld, SwDoc& rDocument)
+ : SwUndoFormatDelete(SwUndoId::CHARFMT_DELETE, pOld, rDocument)
{
}
SwFormat * SwUndoCharFormatDelete::Create(SwFormat * pDerivedFrom)
{
- return m_pDoc->MakeCharFormat(m_sOldName, static_cast<SwCharFormat *>(pDerivedFrom), true);
+ return m_rDoc.MakeCharFormat(m_sOldName, static_cast<SwCharFormat *>(pDerivedFrom), true);
}
void SwUndoCharFormatDelete::Delete(SwFormat * pFormat)
{
- m_pDoc->DelCharFormat(static_cast<SwCharFormat *>(pFormat), true);
+ m_rDoc.DelCharFormat(static_cast<SwCharFormat *>(pFormat), true);
}
SwFormat * SwUndoCharFormatDelete::Find(const OUString & rName) const
{
- return m_pDoc->FindCharFormatByName(rName);
+ return m_rDoc.FindCharFormatByName(rName);
}
SwUndoRenameCharFormat::SwUndoRenameCharFormat(const OUString & sInitOldName,
const OUString & sInitNewName,
- SwDoc * pDocument)
- : SwUndoRenameFormat(SwUndoId::CHARFMT_RENAME, sInitOldName, sInitNewName, pDocument)
+ SwDoc& rDocument)
+ : SwUndoRenameFormat(SwUndoId::CHARFMT_RENAME, sInitOldName, sInitNewName, rDocument)
{
}
SwFormat * SwUndoRenameCharFormat::Find(const OUString & rName) const
{
- return m_pDoc->FindCharFormatByName(rName);
+ return m_rDoc.FindCharFormatByName(rName);
}
SwUndoFrameFormatCreate::SwUndoFrameFormatCreate(SwFrameFormat * pNewFormat,
SwFrameFormat const * pDerivedFrom,
- SwDoc * pDocument)
- : SwUndoFormatCreate(SwUndoId::FRMFMT_CREATE, pNewFormat, pDerivedFrom, pDocument)
+ SwDoc& rDocument)
+ : SwUndoFormatCreate(SwUndoId::FRMFMT_CREATE, pNewFormat, pDerivedFrom, rDocument)
{
}
SwFormat * SwUndoFrameFormatCreate::Create(SwFormat * pDerivedFrom)
{
- return m_pDoc->MakeFrameFormat(m_sNewName, static_cast<SwFrameFormat *>(pDerivedFrom), true, m_pNew->IsAuto());
+ return m_rDoc.MakeFrameFormat(m_sNewName, static_cast<SwFrameFormat *>(pDerivedFrom), true, m_pNew->IsAuto());
}
void SwUndoFrameFormatCreate::Delete()
{
- m_pDoc->DelFrameFormat(static_cast<SwFrameFormat *>(m_pNew), true);
+ m_rDoc.DelFrameFormat(static_cast<SwFrameFormat *>(m_pNew), true);
}
SwFormat * SwUndoFrameFormatCreate::Find(const OUString & rName) const
{
- return m_pDoc->FindFrameFormatByName(rName);
+ return m_rDoc.FindFrameFormatByName(rName);
}
-SwUndoFrameFormatDelete::SwUndoFrameFormatDelete(SwFrameFormat const * pOld, SwDoc * pDocument)
- : SwUndoFormatDelete(SwUndoId::FRMFMT_DELETE, pOld, pDocument)
+SwUndoFrameFormatDelete::SwUndoFrameFormatDelete(SwFrameFormat const * pOld, SwDoc& rDocument)
+ : SwUndoFormatDelete(SwUndoId::FRMFMT_DELETE, pOld, rDocument)
{
}
SwFormat * SwUndoFrameFormatDelete::Create(SwFormat * pDerivedFrom)
{
- return m_pDoc->MakeFrameFormat(m_sOldName, static_cast<SwFrameFormat *>(pDerivedFrom), true);
+ return m_rDoc.MakeFrameFormat(m_sOldName, static_cast<SwFrameFormat *>(pDerivedFrom), true);
}
void SwUndoFrameFormatDelete::Delete(SwFormat * pFormat)
{
- m_pDoc->DelFrameFormat(static_cast<SwFrameFormat *>(pFormat), true);
+ m_rDoc.DelFrameFormat(static_cast<SwFrameFormat *>(pFormat), true);
}
SwFormat * SwUndoFrameFormatDelete::Find(const OUString & rName) const
{
- return m_pDoc->FindFrameFormatByName(rName);
+ return m_rDoc.FindFrameFormatByName(rName);
}
SwUndoRenameFrameFormat::SwUndoRenameFrameFormat(const OUString & sInitOldName,
const OUString & sInitNewName,
- SwDoc * pDocument)
- : SwUndoRenameFormat(SwUndoId::FRMFMT_RENAME, sInitOldName, sInitNewName, pDocument)
+ SwDoc& rDocument)
+ : SwUndoRenameFormat(SwUndoId::FRMFMT_RENAME, sInitOldName, sInitNewName, rDocument)
{
}
SwFormat * SwUndoRenameFrameFormat::Find(const OUString & rName) const
{
- return m_pDoc->FindFrameFormatByName(rName);
+ return m_rDoc.FindFrameFormatByName(rName);
}
SwUndoNumruleCreate::SwUndoNumruleCreate(const SwNumRule * _pNew,
- SwDoc * _pDoc)
- : SwUndo(SwUndoId::NUMRULE_CREATE, _pDoc), m_pNew(_pNew), m_aNew(*_pNew), m_pDoc(_pDoc),
+ SwDoc& rDoc)
+ : SwUndo(SwUndoId::NUMRULE_CREATE, &rDoc), m_pNew(_pNew), m_aNew(*_pNew), m_rDoc(rDoc),
m_bInitialized(false)
{
}
@@ -386,12 +386,12 @@ void SwUndoNumruleCreate::UndoImpl(::sw::UndoRedoContext &)
m_bInitialized = true;
}
- m_pDoc->DelNumRule(m_aNew.GetName(), true);
+ m_rDoc.DelNumRule(m_aNew.GetName(), true);
}
void SwUndoNumruleCreate::RedoImpl(::sw::UndoRedoContext &)
{
- m_pDoc->MakeNumRule(m_aNew.GetName(), &m_aNew, true);
+ m_rDoc.MakeNumRule(m_aNew.GetName(), &m_aNew, true);
}
SwRewriter SwUndoNumruleCreate::GetRewriter() const
@@ -410,19 +410,19 @@ SwRewriter SwUndoNumruleCreate::GetRewriter() const
}
SwUndoNumruleDelete::SwUndoNumruleDelete(const SwNumRule & rRule,
- SwDoc * _pDoc)
- : SwUndo(SwUndoId::NUMRULE_DELETE, _pDoc), m_aOld(rRule), m_pDoc(_pDoc)
+ SwDoc& rDoc)
+ : SwUndo(SwUndoId::NUMRULE_DELETE, &rDoc), m_aOld(rRule), m_rDoc(rDoc)
{
}
void SwUndoNumruleDelete::UndoImpl(::sw::UndoRedoContext &)
{
- m_pDoc->MakeNumRule(m_aOld.GetName(), &m_aOld, true);
+ m_rDoc.MakeNumRule(m_aOld.GetName(), &m_aOld, true);
}
void SwUndoNumruleDelete::RedoImpl(::sw::UndoRedoContext &)
{
- m_pDoc->DelNumRule(m_aOld.GetName(), true);
+ m_rDoc.DelNumRule(m_aOld.GetName(), true);
}
SwRewriter SwUndoNumruleDelete::GetRewriter() const
@@ -436,20 +436,20 @@ SwRewriter SwUndoNumruleDelete::GetRewriter() const
SwUndoNumruleRename::SwUndoNumruleRename(const OUString & _aOldName,
const OUString & _aNewName,
- SwDoc * _pDoc)
- : SwUndo(SwUndoId::NUMRULE_RENAME, _pDoc), m_aOldName(_aOldName), m_aNewName(_aNewName),
- m_pDoc(_pDoc)
+ SwDoc& rDoc)
+ : SwUndo(SwUndoId::NUMRULE_RENAME, &rDoc), m_aOldName(_aOldName), m_aNewName(_aNewName),
+ m_rDoc(rDoc)
{
}
void SwUndoNumruleRename::UndoImpl(::sw::UndoRedoContext &)
{
- m_pDoc->RenameNumRule(m_aNewName, m_aOldName, true);
+ m_rDoc.RenameNumRule(m_aNewName, m_aOldName, true);
}
void SwUndoNumruleRename::RedoImpl(::sw::UndoRedoContext &)
{
- m_pDoc->RenameNumRule(m_aOldName, m_aNewName, true);
+ m_rDoc.RenameNumRule(m_aOldName, m_aNewName, true);
}
SwRewriter SwUndoNumruleRename::GetRewriter() const
diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx
index d7d517a5f37f..95f3182b6ab3 100644
--- a/sw/source/core/undo/unnum.cxx
+++ b/sw/source/core/undo/unnum.cxx
@@ -28,9 +28,9 @@
SwUndoInsNum::SwUndoInsNum( const SwNumRule& rOldRule,
const SwNumRule& rNewRule,
- const SwDoc* pDoc,
+ const SwDoc& rDoc,
SwUndoId nUndoId)
- : SwUndo( nUndoId, pDoc ),
+ : SwUndo( nUndoId, &rDoc ),
m_aNumRule( rNewRule ),
m_pOldNumRule( new SwNumRule( rOldRule )), m_nLRSavePos( 0 )
{