[Libreoffice-commits] core.git: sw/source
Bjoern Michaelsen (via logerrit)
logerrit at kemper.freedesktop.org
Sun Mar 22 21:59:26 UTC 2020
sw/source/uibase/wrtsh/wrtsh2.cxx | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
New commits:
commit d3a93e772a8a0ffb63874aa32add5a302845089f
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Sat Mar 21 22:22:43 2020 +0100
Commit: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Sun Mar 22 22:58:48 2020 +0100
FieldDeletionModify: no more Modify
Change-Id: Iec2c7d6178358a4145c10f1c22ab526f03670806
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90862
Tested-by: Jenkins
Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index f36a668dc83a..951989e4f108 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -21,6 +21,7 @@
#include <svl/macitem.hxx>
#include <sfx2/frame.hxx>
#include <svl/eitem.hxx>
+#include <svl/listener.hxx>
#include <svl/stritem.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/dispatch.hxx>
@@ -209,10 +210,10 @@ namespace {
// Otherwise, the for loop in SwWrtShell::UpdateInputFields will crash when doing:
// 'pTmp->GetField( i )->GetTyp()->UpdateFields();'
// on a deleted field.
-class FieldDeletionModify : public SwModify
+class FieldDeletionListener : public SvtListener
{
public:
- FieldDeletionModify(AbstractFieldInputDlg* pInputFieldDlg, SwField* pField)
+ FieldDeletionListener(AbstractFieldInputDlg* pInputFieldDlg, SwField* pField)
: mpInputFieldDlg(pInputFieldDlg)
, mpFormatField(nullptr)
{
@@ -230,28 +231,22 @@ class FieldDeletionModify : public SwModify
// Register for possible field deletion while dialog is open
if (mpFormatField)
- mpFormatField->Add(this);
+ StartListening(mpFormatField->GetNotifier());
}
- virtual ~FieldDeletionModify() override
+ virtual ~FieldDeletionListener() override
{
// Dialog closed, remove modification listener
EndListeningAll();
}
- void Modify( const SfxPoolItem* pOld, const SfxPoolItem *) override
+ virtual void Notify(const SfxHint& rHint) override
{
// Input field has been deleted: better to close the dialog
- if (pOld)
+ if(rHint.GetId() == SfxHintId::Dying)
{
- switch (pOld->Which())
- {
- case RES_REMOVE_UNO_OBJECT:
- case RES_OBJECTDYING:
- mpFormatField = nullptr;
- mpInputFieldDlg->EndDialog(RET_CANCEL);
- break;
- }
+ mpFormatField = nullptr;
+ mpInputFieldDlg->EndDialog(RET_CANCEL);
}
}
private:
@@ -272,7 +267,7 @@ bool SwWrtShell::StartInputFieldDlg(SwField* pField, bool bPrevButton, bool bNex
bool bRet;
{
- FieldDeletionModify aModify(pDlg.get(), pField);
+ FieldDeletionListener aModify(pDlg.get(), pField);
bRet = RET_CANCEL == pDlg->Execute();
}
More information about the Libreoffice-commits
mailing list