Kaydet (Commit) 9f05a323 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

sd: Kill an own scope guard impl. and use comphelper::ScopeGuard instead.

Change-Id: I769c1c6c9d10081b706d0e1e0fbd7ad373a6e04f
Reviewed-on: https://gerrit.libreoffice.org/48499Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
Tested-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst 3a9c80c4
......@@ -19,6 +19,7 @@
#include <futransf.hxx>
#include <comphelper/scopeguard.hxx>
#include <svx/dialogs.hrc>
#include <vcl/msgbox.hxx>
#include <sfx2/request.hxx>
......@@ -61,34 +62,15 @@ void setUndo(::sd::View* pView, const SfxItemSet* pArgs)
pView->EndUndo();
}
class ScopeCleanup
{
ViewShell* mpViewShell;
public:
ScopeCleanup(ViewShell* pViewShell) : mpViewShell(pViewShell)
{
}
~ScopeCleanup()
{
if (mpViewShell)
{
mpViewShell->Invalidate(SID_RULER_OBJECT);
mpViewShell->Cancel();
}
}
void ignore()
{
mpViewShell = nullptr;
}
};
}
void FuTransform::DoExecute( SfxRequest& rReq )
{
ScopeCleanup aCleanup(mpViewShell);
comphelper::ScopeGuard guard([&]() {
// cleanup when leaving
mpViewShell->Invalidate(SID_RULER_OBJECT);
mpViewShell->Cancel();
});
if (!mpView->AreObjectsMarked())
return;
......@@ -141,7 +123,7 @@ void FuTransform::DoExecute( SfxRequest& rReq )
std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq));
rReq.Ignore(); // the 'old' request is not relevant any more
aCleanup.ignore(); // the lambda does it
guard.dismiss(); // we'll invalidate explicitly after the dialog ends
pDlg->StartExecuteAsync([=](sal_Int32 nResult){
if (nResult == RET_OK)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment