summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-01-12 11:57:22 +0000
committerJan Holesovsky <kendy@collabora.com>2018-01-15 17:44:42 +0100
commitc40dfabd56ade10fe35690dc9810955c2e99e2c0 (patch)
tree0ae297ec41e2a1a5e4e078180c18320a83823a89 /sc
parent5942140c5149065ffb5adf9d33b21aeceeabf957 (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/47722 Tested-by: Jenkins <ci@libreoffice.org> 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 5684f1245825..a1a3806f059c 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; \
@@ -78,6 +79,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 8b04b067818e..649e4cde46c3 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -478,8 +478,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);
@@ -536,28 +536,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