summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-01-17 09:58:10 +0100
committerpranavk <pranavk@collabora.co.uk>2018-01-18 13:52:24 +0100
commitfc0e881e3102ffc12cb7e91a20a3ccfb59ab1d53 (patch)
treeefd2d8a0a7f75aa1c10e2d7fc971f7d630c8b77f /sw
parentbd9b2acd76ad518f3f211eb448c8ade2e29a767d (diff)
lokdialog: Convert the Format -> Bullets and Numbering... dialog to async exec
Change-Id: I01886ca1f0d7942450838e5f2de4700bdf81150f Reviewed-on: https://gerrit.libreoffice.org/48029 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/48113 Reviewed-by: pranavk <pranavk@collabora.co.uk> Tested-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/shells/txtnum.cxx85
1 files changed, 45 insertions, 40 deletions
diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx
index ff8f60ba4c25..e9f87e30b950 100644
--- a/sw/source/uibase/shells/txtnum.cxx
+++ b/sw/source/uibase/shells/txtnum.cxx
@@ -183,54 +183,59 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialog creation failed!");
- ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTabDialog( DLG_SVXTEST_NUM_BULLET,
+ VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTabDialog( DLG_SVXTEST_NUM_BULLET,
GetView().GetWindow(), &aSet, GetShell()));
OSL_ENSURE(pDlg, "Dialog creation failed!");
const SfxStringItem* pPageItem = rReq.GetArg<SfxStringItem>(FN_PARAM_1);
if ( pPageItem )
pDlg->SetCurPageId( OUStringToOString( pPageItem->GetValue(), RTL_TEXTENCODING_UTF8 ) );
- const short nRet = pDlg->Execute();
- const SfxPoolItem* pItem;
- if ( RET_OK == nRet )
- {
- if( SfxItemState::SET == pDlg->GetOutputItemSet()->GetItemState( SID_ATTR_NUMBERING_RULE, false, &pItem ))
- {
- rReq.AppendItem( *pItem );
- rReq.Done();
- SvxNumRule* pSetRule = static_cast<const SvxNumBulletItem*>( pItem )->GetNumRule();
- pSetRule->UnLinkGraphics();
- SwNumRule aSetRule( pNumRuleAtCurrentSelection != nullptr
- ? pNumRuleAtCurrentSelection->GetName()
- : GetShell().GetUniqueNumRuleName(),
- numfunc::GetDefaultPositionAndSpaceMode() );
- aSetRule.SetSvxRule( *pSetRule, GetShell().GetDoc() );
- aSetRule.SetAutoRule( true );
- // No start of new list, if an existing list style is edited.
- // Otherwise start a new list.
- const bool bCreateList = ( pNumRuleAtCurrentSelection == nullptr );
- GetShell().SetCurNumRule( aSetRule, bCreateList );
- }
- // If the Dialog was leaved with OK but nothing was chosen then the
- // numbering must be at least activated, if it is not already.
- else if ( pNumRuleAtCurrentSelection == nullptr
- && SfxItemState::SET == aSet.GetItemState( SID_ATTR_NUMBERING_RULE, false, &pItem ) )
+
+ std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq));
+ rReq.Ignore(); // the 'old' request is not relevant any more
+
+ pDlg->StartExecuteAsync([=](sal_Int32 nResult){
+ if (RET_OK == nResult)
{
- rReq.AppendItem( *pItem );
- rReq.Done();
- SvxNumRule* pSetRule = static_cast<const SvxNumBulletItem*>( pItem )->GetNumRule();
- SwNumRule aSetRule(
- GetShell().GetUniqueNumRuleName(),
- numfunc::GetDefaultPositionAndSpaceMode() );
- aSetRule.SetSvxRule( *pSetRule, GetShell().GetDoc() );
- aSetRule.SetAutoRule( true );
- // start new list
- GetShell().SetCurNumRule( aSetRule, true );
+ const SfxPoolItem* pItem;
+ if (SfxItemState::SET == pDlg->GetOutputItemSet()->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem))
+ {
+ pRequest->AppendItem(*pItem);
+ pRequest->Done();
+ SvxNumRule* pSetRule = static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule();
+ pSetRule->UnLinkGraphics();
+ SwNumRule aSetRule(pNumRuleAtCurrentSelection != nullptr
+ ? pNumRuleAtCurrentSelection->GetName()
+ : GetShell().GetUniqueNumRuleName(),
+ numfunc::GetDefaultPositionAndSpaceMode());
+ aSetRule.SetSvxRule(*pSetRule, GetShell().GetDoc());
+ aSetRule.SetAutoRule(true);
+ // No start of new list, if an existing list style is edited.
+ // Otherwise start a new list.
+ const bool bCreateList = (pNumRuleAtCurrentSelection == nullptr);
+ GetShell().SetCurNumRule(aSetRule, bCreateList);
+ }
+ // If the Dialog was leaved with OK but nothing was chosen then the
+ // numbering must be at least activated, if it is not already.
+ else if (pNumRuleAtCurrentSelection == nullptr
+ && SfxItemState::SET == aSet.GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem))
+ {
+ pRequest->AppendItem(*pItem);
+ pRequest->Done();
+ SvxNumRule* pSetRule = static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule();
+ SwNumRule aSetRule(
+ GetShell().GetUniqueNumRuleName(),
+ numfunc::GetDefaultPositionAndSpaceMode());
+ aSetRule.SetSvxRule(*pSetRule, GetShell().GetDoc());
+ aSetRule.SetAutoRule(true);
+ // start new list
+ GetShell().SetCurNumRule(aSetRule, true);
+ }
}
- }
- else if ( RET_USER == nRet )
- GetShell().DelNumRules();
+ else if (RET_USER == nResult)
+ GetShell().DelNumRules();
+ }, pDlg);
}
- break;
+ break;
default:
OSL_FAIL("wrong dispatcher");