summaryrefslogtreecommitdiff
path: root/sd/source/ui
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-01-24 13:19:41 +0100
committerJan Holesovsky <kendy@collabora.com>2018-01-25 10:05:13 +0100
commit9f05a323d50c6750e25f2ca69f758ec7fc4313bc (patch)
tree0e3c6a8a7a1273406ce3bdf4ab8bd8679d963d55 /sd/source/ui
parent3a9c80c4cdcd4387ff07ddd4347973aaa7df9860 (diff)
sd: Kill an own scope guard impl. and use comphelper::ScopeGuard instead.
Change-Id: I769c1c6c9d10081b706d0e1e0fbd7ad373a6e04f Reviewed-on: https://gerrit.libreoffice.org/48499 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sd/source/ui')
-rw-r--r--sd/source/ui/func/futransf.cxx32
1 files changed, 7 insertions, 25 deletions
diff --git a/sd/source/ui/func/futransf.cxx b/sd/source/ui/func/futransf.cxx
index f62c9788da8a..9dddef1dde4b 100644
--- a/sd/source/ui/func/futransf.cxx
+++ b/sd/source/ui/func/futransf.cxx
@@ -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)