summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-01-13 12:10:43 +0000
committerJan Holesovsky <kendy@collabora.com>2018-01-15 17:40:11 +0100
commitd0f4f27465da113748ca63103692c45da64af6f5 (patch)
tree7f0d3c2038b080dd98127e298402ae0144b21758 /sc
parentaceaaaa85fd824611349e637f37b9644b6fe62cb (diff)
lokdialog: Allow closing the Format Cell dialogs in any order.
Includes also lots of infrastructural changes, making the conversion of the rest of the dialogs much easier. StartExecuteAsync should be used in-place of StartExecuteModal and the latter removed from the code-base incrementally. More common code from Dialog::Execute should be moved to ImplStartExecuteModal in a next step, as this is used more widely. Change-Id: Idb2c1ec790e38f582438471a0419a56cdcf1439d Reviewed-on: https://gerrit.libreoffice.org/47817 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx5
-rw-r--r--sc/source/ui/view/tabvwsha.cxx34
2 files changed, 23 insertions, 16 deletions
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index b069c779efb2..ef6e0a6a1057 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -65,6 +65,7 @@ public: \
{} \
virtual ~Class() override; \
virtual short Execute() override ; \
+ virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override; \
std::vector<OString> getAllPageUIXMLDescriptions() const override; \
bool selectPageByUIXMLDescription(const OString& rUIXMLDescription) override; \
virtual Bitmap createScreenshot() const override; \
@@ -88,6 +89,10 @@ short Class::Execute() \
{ \
return pDlg->Execute(); \
} \
+bool Class::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)\
+{ \
+ return pDlg->StartExecuteAsync( rCtx ); \
+} \
std::vector<OString> Class::getAllPageUIXMLDescriptions() const \
{ \
return pDlg->getAllPageUIXMLDescriptions(); \
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 5946a6054b8f..4753de415735 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -481,8 +481,8 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName
const ScPatternAttr* pOldAttrs = GetSelectionPattern();
- std::unique_ptr<SfxItemSet> pOldSet(new SfxItemSet(pOldAttrs->GetItemSet()));
- std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem;
+ std::shared_ptr<SfxItemSet> pOldSet(new SfxItemSet(pOldAttrs->GetItemSet()));
+ std::shared_ptr<SvxNumberInfoItem> pNumberInfoItem;
pOldSet->MergeRange(SID_ATTR_BORDER_STYLES, SID_ATTR_BORDER_DEFAULT_WIDTH);
@@ -540,28 +540,30 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
- ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScAttrDlg(GetDialogParent(), pOldSet.get()));
+ VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateScAttrDlg(GetDialogParent(), pOldSet.get()));
if (!rName.isEmpty())
pDlg->SetCurPageId(rName);
- short nResult = pDlg->Execute();
- bInFormatDialog = false;
- if ( nResult == RET_OK )
- {
- const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq));
+ pDlg->StartExecuteAsync([=](sal_Int32 nResult){
+ bInFormatDialog = false;
- const SfxPoolItem* pItem=nullptr;
- if(pOutSet->GetItemState(SID_ATTR_NUMBERFORMAT_INFO,true,&pItem)==SfxItemState::SET)
- {
+ if ( nResult == RET_OK )
+ {
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
- UpdateNumberFormatter(static_cast<const SvxNumberInfoItem&>(*pItem));
- }
+ const SfxPoolItem* pItem=nullptr;
+ if(pOutSet->GetItemState(SID_ATTR_NUMBERFORMAT_INFO,true,&pItem)==SfxItemState::SET)
+ {
+ UpdateNumberFormatter(static_cast<const SvxNumberInfoItem&>(*pItem));
+ }
- ApplyAttributes(pOutSet, pOldSet.get());
+ ApplyAttributes(pOutSet, pOldSet.get());
- rReq.Done( *pOutSet );
- }
+ pRequest->Done(pOutSet);
+ }
+ }, pDlg);
}
bool ScTabViewShell::IsRefInputMode() const