sc/source/ui/drawfunc/drawsh.cxx | 116 +++++++++++++++++++++------------------ 1 file changed, 65 insertions(+), 51 deletions(-)
New commits: commit 4302db58a09c730e25573d7a532207f876ba7d95 Author: Muhammet Kara <muhammet.k...@collabora.com> AuthorDate: Thu Jun 27 02:27:53 2019 +0300 Commit: Muhammet Kara <muhammet.k...@collabora.com> CommitDate: Sat Jun 29 16:16:07 2019 +0200 lokdialog: Convert the Format -> Position and Size... to async exec for sc Change-Id: I715ed025d97de8eb69b6e9ba227b955b49add855 Reviewed-on: https://gerrit.libreoffice.org/74883 Reviewed-by: Muhammet Kara <muhammet.k...@collabora.com> Tested-by: Muhammet Kara <muhammet.k...@collabora.com> diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index 07216e1747b4..dda6f9351a6d 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -99,6 +99,20 @@ static void lcl_setModified( const SfxObjectShell* pShell ) } } +static void lcl_invalidateTransformAttr(const ScTabViewShell* pViewShell) +{ + SfxBindings& rBindings=pViewShell->GetViewFrame()->GetBindings(); + rBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH); + rBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT); + rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X); + rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y); + rBindings.Invalidate(SID_ATTR_TRANSFORM_ANGLE); + rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_X); + rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_Y); + rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOWIDTH); + rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOHEIGHT); +} + void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) { sal_uInt16 nSlot = rReq.GetSlot(); @@ -243,77 +257,77 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) case SID_ATTR_TRANSFORM: { + if ( pView->AreObjectsMarked() ) { - if ( pView->AreObjectsMarked() ) - { - const SfxItemSet* pArgs = rReq.GetArgs(); + const SfxItemSet* pArgs = rReq.GetArgs(); - if( !pArgs ) + if( !pArgs ) + { + if( rMarkList.GetMark(0) != nullptr ) { - if( rMarkList.GetMark(0) != nullptr ) + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + std::shared_ptr<SfxRequest> pRequest; + pRequest.reset(new SfxRequest(rReq)); + + if( pObj->GetObjIdentifier() == OBJ_CAPTION ) { - SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); - if( pObj->GetObjIdentifier() == OBJ_CAPTION ) + // Caption Itemset + SfxItemSet aNewAttr(pDoc->GetItemPool()); + pView->GetAttributes(aNewAttr); + // Size and Position Itemset + SfxItemSet aNewGeoAttr(pView->GetGeoAttrFromMarked()); + + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + if ( pFact ) { - // Caption Itemset - SfxItemSet aNewAttr(pDoc->GetItemPool()); - pView->GetAttributes(aNewAttr); - // Size and Position Itemset - SfxItemSet aNewGeoAttr(pView->GetGeoAttrFromMarked()); - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - { - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCaptionDialog( pWin, pView )); - - const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() ); - SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange ); - aCombSet.Put( aNewAttr ); - aCombSet.Put( aNewGeoAttr ); - pDlg->SetInputSet( &aCombSet ); - - if (pDlg->Execute() == RET_OK) + VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateCaptionDialog( pWin, pView )); + + const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() ); + SfxItemSet aCombSet( *aNewAttr.GetPool(), pRange ); + aCombSet.Put( aNewAttr ); + aCombSet.Put( aNewGeoAttr ); + pDlg->SetInputSet( &aCombSet ); + + pDlg->StartExecuteAsync([=](sal_Int32 nResult){ + if (nResult == RET_OK) { - rReq.Done(*(pDlg->GetOutputItemSet())); + pRequest->Done(*(pDlg->GetOutputItemSet())); pView->SetAttributes(*pDlg->GetOutputItemSet()); pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet()); } - } + + lcl_invalidateTransformAttr(pViewData->GetViewShell()); + }); } - else + } + else + { + SfxItemSet aNewAttr(pView->GetGeoAttrFromMarked()); + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + if(pFact) { - SfxItemSet aNewAttr(pView->GetGeoAttrFromMarked()); - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if(pFact) - { - ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxTransformTabDialog( pWin, &aNewAttr,pView )); - OSL_ENSURE(pDlg, "Dialog creation failed!"); - if (pDlg->Execute() == RET_OK) + VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxTransformTabDialog( pWin, &aNewAttr,pView )); + OSL_ENSURE(pDlg, "Dialog creation failed!"); + + pDlg->StartExecuteAsync([=](sal_Int32 nResult){ + if (nResult == RET_OK) { - rReq.Done(*(pDlg->GetOutputItemSet())); + pRequest->Done(*(pDlg->GetOutputItemSet())); pView->SetGeoAttrToMarked(*pDlg->GetOutputItemSet()); } - } + + lcl_invalidateTransformAttr(pViewData->GetViewShell()); + }); } } - } - else - pView->SetGeoAttrToMarked( *pArgs ); + } + else + pView->SetGeoAttrToMarked( *pArgs ); } - ScTabViewShell* pViewShell = pViewData->GetViewShell(); - SfxBindings& rBindings=pViewShell->GetViewFrame()->GetBindings(); - rBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH); - rBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT); - rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X); - rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y); - rBindings.Invalidate(SID_ATTR_TRANSFORM_ANGLE); - rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_X); - rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_Y); - rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOWIDTH); - rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOHEIGHT); + lcl_invalidateTransformAttr(pViewData->GetViewShell()); break; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits