summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-01-17 19:17:30 +0100
committerpranavk <pranavk@collabora.co.uk>2018-01-18 14:05:08 +0100
commit63bdc9b8645803b1d9e486734cd3fdd14ac0c185 (patch)
tree76ce72e89276b88858b902cddb57bf57e4316ec5 /sd
parent56b4207526968098b50fe23d21e1c0f57c9c04bb (diff)
lokdialog: Convert the Format -> ... -> Line... to async exec.
Change-Id: Ieaf440abf819d503d388a8b060dbf7fe6548db9e Reviewed-on: https://gerrit.libreoffice.org/48118 Reviewed-by: pranavk <pranavk@collabora.co.uk> Tested-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/func/fuline.cxx70
-rw-r--r--sd/source/ui/view/drviews2.cxx2
2 files changed, 41 insertions, 31 deletions
diff --git a/sd/source/ui/func/fuline.cxx b/sd/source/ui/func/fuline.cxx
index 5f643ef7b774..7e94d51dc806 100644
--- a/sd/source/ui/func/fuline.cxx
+++ b/sd/source/ui/func/fuline.cxx
@@ -60,44 +60,54 @@ rtl::Reference<FuPoor> FuLine::Create( ViewShell* pViewSh, ::sd::Window* pWin, :
void FuLine::DoExecute( SfxRequest& rReq )
{
- bool bHasMarked = mpView->AreObjectsMarked();
+ rReq.Ignore();
const SfxItemSet* pArgs = rReq.GetArgs();
-
- if( !pArgs )
+ if (pArgs)
{
- const SdrObject* pObj = nullptr;
- const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
- if( rMarkList.GetMarkCount() == 1 )
- pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ mpViewShell->Cancel();
+ return;
+ }
- std::unique_ptr<SfxItemSet> pNewAttr(new SfxItemSet( mpDoc->GetPool() ));
- mpView->GetAttributes( *pNewAttr );
+ const SdrObject* pObj = nullptr;
+ const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSvxLineTabDialog(nullptr,pNewAttr.get(),mpDoc,pObj,bHasMarked) : nullptr);
- if( pDlg && (pDlg->Execute() == RET_OK) )
- {
- mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
- }
+ std::unique_ptr<SfxItemSet> pNewAttr(new SfxItemSet( mpDoc->GetPool() ));
+ mpView->GetAttributes( *pNewAttr );
- // some attributes are changed, we have to update the listboxes in the objectbars
- static sal_uInt16 SidArray[] = {
- SID_ATTR_LINE_STYLE, // ( SID_SVX_START + 169 )
- SID_ATTR_LINE_DASH, // ( SID_SVX_START + 170 )
- SID_ATTR_LINE_WIDTH, // ( SID_SVX_START + 171 )
- SID_ATTR_LINE_COLOR, // ( SID_SVX_START + 172 )
- SID_ATTR_LINE_START, // ( SID_SVX_START + 173 )
- SID_ATTR_LINE_END, // ( SID_SVX_START + 174 )
- SID_ATTR_LINE_TRANSPARENCE, // (SID_SVX_START+1107)
- SID_ATTR_LINE_JOINT, // (SID_SVX_START+1110)
- SID_ATTR_LINE_CAP, // (SID_SVX_START+1111)
- 0 };
-
- mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+ bool bHasMarked = mpView->AreObjectsMarked();
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ VclPtr<SfxAbstractTabDialog> pDlg(pFact ? pFact->CreateSvxLineTabDialog(nullptr,pNewAttr.get(),mpDoc,pObj,bHasMarked) : nullptr);
+ if (!pDlg)
+ {
+ mpViewShell->Cancel();
+ return;
}
- rReq.Ignore ();
+ pDlg->StartExecuteAsync([=](sal_Int32 nResult){
+ if (nResult == RET_OK)
+ {
+ mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
+
+ // some attributes are changed, we have to update the listboxes in the objectbars
+ static const sal_uInt16 SidArray[] = {
+ SID_ATTR_LINE_STYLE, // ( SID_SVX_START + 169 )
+ SID_ATTR_LINE_DASH, // ( SID_SVX_START + 170 )
+ SID_ATTR_LINE_WIDTH, // ( SID_SVX_START + 171 )
+ SID_ATTR_LINE_COLOR, // ( SID_SVX_START + 172 )
+ SID_ATTR_LINE_START, // ( SID_SVX_START + 173 )
+ SID_ATTR_LINE_END, // ( SID_SVX_START + 174 )
+ SID_ATTR_LINE_TRANSPARENCE, // (SID_SVX_START+1107)
+ SID_ATTR_LINE_JOINT, // (SID_SVX_START+1110)
+ SID_ATTR_LINE_CAP, // (SID_SVX_START+1111)
+ 0 };
+
+ mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
+ }
+ mpViewShell->Cancel();
+ }, pDlg);
}
void FuLine::Activate()
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 46d0f6eb9c11..22a07f8c960a 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1011,7 +1011,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
case SID_ATTRIBUTES_LINE: // BASIC
{
SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
- Cancel();
+ // Cancel() called directly in FuTransform::Create()
}
break;