summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@collabora.com>2019-06-27 02:27:53 +0300
committerMuhammet Kara <muhammet.kara@collabora.com>2019-06-29 16:16:07 +0200
commit4302db58a09c730e25573d7a532207f876ba7d95 (patch)
tree4ad192085760765fe771d7e62867c0716025f612
parent1ec2cf271b98191d6c6e390357f81ad13cca1473 (diff)
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.kara@collabora.com> Tested-by: Muhammet Kara <muhammet.kara@collabora.com>
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx116
1 files changed, 65 insertions, 51 deletions
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;
}