[Libreoffice-commits] core.git: sw/inc sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 5 19:28:46 UTC 2020
sw/inc/UndoParagraphSignature.hxx | 4
sw/source/core/doc/docfmt.cxx | 22 ++---
sw/source/core/doc/docnum.cxx | 8 -
sw/source/core/edit/edfcol.cxx | 32 +++----
sw/source/core/inc/SwUndoFmt.hxx | 46 +++++------
sw/source/core/inc/UndoNumbering.hxx | 2
sw/source/core/undo/SwUndoFmt.cxx | 142 +++++++++++++++++------------------
sw/source/core/undo/unnum.cxx | 4
sw/source/uibase/app/docst.cxx | 12 +-
9 files changed, 136 insertions(+), 136 deletions(-)
New commits:
commit 1b4b3db429555c48dd800f175f92040b73cece65
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Oct 5 12:21:13 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Oct 5 21:28:06 2020 +0200
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 at redhat.com>
diff --git a/sw/inc/UndoParagraphSignature.hxx b/sw/inc/UndoParagraphSignature.hxx
index 1c9c60f58546..e9561dcebf0b 100644
--- a/sw/inc/UndoParagraphSignature.hxx
+++ b/sw/inc/UndoParagraphSignature.hxx
@@ -33,7 +33,7 @@ namespace com::sun::star::text { class XTextField; }
class SwUndoParagraphSigning final : public SwUndo
{
private:
- SwDoc* m_pDoc;
+ SwDoc& m_rDoc;
css::uno::Reference<css::text::XTextField> m_xField;
css::uno::Reference<css::text::XTextContent> m_xParent;
OUString m_signature;
@@ -42,7 +42,7 @@ private:
const bool m_bRemove;
public:
- SwUndoParagraphSigning(SwDoc* pDoc,
+ SwUndoParagraphSigning(SwDoc& rDoc,
const css::uno::Reference<css::text::XTextField>& xField,
const css::uno::Reference<css::text::XTextContent>& xParent,
const bool bRemove);
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 )
{
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 666db6b0d9a9..b19c7df81ddd 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -919,7 +919,7 @@ void SwDocShell::Edit(
if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
{
GetDoc()->GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoTextFormatCollCreate>(xTmp->GetCollection(), pColl, GetDoc()));
+ std::make_unique<SwUndoTextFormatCollCreate>(xTmp->GetCollection(), pColl, *GetDoc()));
}
}
}
@@ -932,7 +932,7 @@ void SwDocShell::Edit(
if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
{
GetDoc()->GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoCharFormatCreate>(xTmp->GetCharFormat(), pCFormat, GetDoc()));
+ std::make_unique<SwUndoCharFormatCreate>(xTmp->GetCharFormat(), pCFormat, *GetDoc()));
}
}
}
@@ -945,7 +945,7 @@ void SwDocShell::Edit(
if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
{
GetDoc()->GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoFrameFormatCreate>(xTmp->GetFrameFormat(), pFFormat, GetDoc()));
+ std::make_unique<SwUndoFrameFormatCreate>(xTmp->GetFrameFormat(), pFFormat, *GetDoc()));
}
}
}
@@ -1344,7 +1344,7 @@ void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily,
if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
{
GetDoc()->GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoTextFormatCollCreate>(pColl, pDerivedFrom, GetDoc()));
+ std::make_unique<SwUndoTextFormatCollCreate>(pColl, pDerivedFrom, *GetDoc()));
}
pCurrWrtShell->SetTextFormatColl(pColl);
pCurrWrtShell->EndAllAction();
@@ -1368,7 +1368,7 @@ void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily,
if (GetDoc()->GetIDocumentUndoRedo().DoesUndo())
{
GetDoc()->GetIDocumentUndoRedo().AppendUndo(
- std::make_unique<SwUndoFrameFormatCreate>(pFrame, pFFormat, GetDoc()));
+ std::make_unique<SwUndoFrameFormatCreate>(pFrame, pFFormat, *GetDoc()));
}
// also apply template to remove hard set attributes
pCurrWrtShell->SetFrameFormat(pFrame);
@@ -1394,7 +1394,7 @@ void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily,
GetDoc()->GetIDocumentUndoRedo().AppendUndo(
std::make_unique<SwUndoCharFormatCreate>(
pChar, pDerivedFrom ? pDerivedFrom : GetDoc()->GetDfltCharFormat(),
- GetDoc()));
+ *GetDoc()));
}
pCurrWrtShell->SetAttrItem(aFormat);
pCurrWrtShell->EndAllAction();
More information about the Libreoffice-commits
mailing list