sd/source/ui/func/fuline.cxx | 70 +++++++++++++++++++++++------------------ sd/source/ui/view/drviews2.cxx | 2 - 2 files changed, 41 insertions(+), 31 deletions(-)
New commits: commit 63bdc9b8645803b1d9e486734cd3fdd14ac0c185 Author: Jan Holesovsky <ke...@collabora.com> Date: Wed Jan 17 19:17:30 2018 +0100 lokdialog: Convert the Format -> ... -> Line... to async exec. Change-Id: Ieaf440abf819d503d388a8b060dbf7fe6548db9e Reviewed-on: https://gerrit.libreoffice.org/48118 Reviewed-by: pranavk <pran...@collabora.co.uk> Tested-by: pranavk <pran...@collabora.co.uk> 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits