diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-12-15 15:31:49 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-12-16 09:30:51 +0100 |
commit | 4e7a56415090b39e7a34eec68189797319459c9d (patch) | |
tree | c69cfecb36f0d0501f7e6b3da5c454929250c101 /sc | |
parent | cd53ae78850a4b612588e144c3f90ca73cddf498 (diff) |
pivot table: make subdialogs of pivot table dialog async
Change-Id: I2c1b26ebe661a2f66bc7bf94e4f3ede2fc5e18b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107775
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeList.cxx | 26 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeListData.cxx | 33 | ||||
-rw-r--r-- | sc/source/ui/dbgui/pvfundlg.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/inc/PivotLayoutTreeList.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/inc/pvfundlg.hxx | 4 |
7 files changed, 59 insertions, 30 deletions
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index b5629728d356..b3171514f191 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -225,11 +225,21 @@ short AbstractScDPFunctionDlg_Impl::Execute() return m_xDlg->run(); } +bool AbstractScDPFunctionDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) +{ + return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + short AbstractScDPSubtotalDlg_Impl::Execute() { return m_xDlg->run(); } +bool AbstractScDPSubtotalDlg_Impl::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) +{ + return weld::DialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + short AbstractScDPNumGroupDlg_Impl::Execute() { return m_xDlg->run(); diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 91f6040b7842..5665bb6f5b22 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -465,26 +465,28 @@ public: class AbstractScDPFunctionDlg_Impl : public AbstractScDPFunctionDlg { - std::unique_ptr<ScDPFunctionDlg> m_xDlg; + std::shared_ptr<ScDPFunctionDlg> m_xDlg; public: explicit AbstractScDPFunctionDlg_Impl(std::unique_ptr<ScDPFunctionDlg> p) : m_xDlg(std::move(p)) { } virtual short Execute() override; + virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override; virtual PivotFunc GetFuncMask() const override; virtual css::sheet::DataPilotFieldReference GetFieldRef() const override; }; class AbstractScDPSubtotalDlg_Impl : public AbstractScDPSubtotalDlg { - std::unique_ptr<ScDPSubtotalDlg> m_xDlg; + std::shared_ptr<ScDPSubtotalDlg> m_xDlg; public: explicit AbstractScDPSubtotalDlg_Impl(std::unique_ptr<ScDPSubtotalDlg> p) : m_xDlg(std::move(p)) { } virtual short Execute() override; + virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override; virtual PivotFunc GetFuncMask() const override; virtual void FillLabelData( ScDPLabelData& rLabelData ) const override; }; diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx index e9a16a33b729..a5279bc14c57 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx @@ -42,26 +42,30 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeList, DoubleClickHdl, weld::TreeView&, bool) ScItemValue* pCurrentItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(nEntry).toInt64()); ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData; + SCCOL nCurrentColumn = rCurrentFunctionData.mnCol; - if (mpParent->IsDataElement(rCurrentFunctionData.mnCol)) + if (mpParent->IsDataElement(nCurrentColumn)) return true; - SCCOL nCurrentColumn = rCurrentFunctionData.mnCol; ScDPLabelData& rCurrentLabelData = mpParent->GetLabelData(nCurrentColumn); ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create(); - std::vector<ScDPName> aDataFieldNames; - mpParent->PushDataFieldNames(aDataFieldNames); + maDataFieldNames.clear(); + mpParent->PushDataFieldNames(maDataFieldNames); - ScopedVclPtr<AbstractScDPSubtotalDlg> pDialog( - pFactory->CreateScDPSubtotalDlg(mxControl.get(), mpParent->maPivotTableObject, rCurrentLabelData, rCurrentFunctionData, aDataFieldNames)); + VclPtr<AbstractScDPSubtotalDlg> pDialog( + pFactory->CreateScDPSubtotalDlg(mxControl.get(), mpParent->maPivotTableObject, rCurrentLabelData, rCurrentFunctionData, maDataFieldNames)); - if (pDialog->Execute() == RET_OK) - { - pDialog->FillLabelData(rCurrentLabelData); - rCurrentFunctionData.mnFuncMask = pDialog->GetFuncMask(); - } + pDialog->StartExecuteAsync([this, pDialog, pCurrentItemValue, nCurrentColumn](int nResult) { + if (nResult == RET_OK) + { + pDialog->FillLabelData(mpParent->GetLabelData(nCurrentColumn)); + pCurrentItemValue->maFunctionData.mnFuncMask = pDialog->GetFuncMask(); + } + + pDialog->disposeOnce(); + }); return true; } diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx index cde29f02034a..905a56857fa7 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx @@ -85,27 +85,32 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView&, bool ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractScDPFunctionDlg> pDialog( + VclPtr<AbstractScDPFunctionDlg> pDialog( pFactory->CreateScDPFunctionDlg(mxControl.get(), mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData)); - if (pDialog->Execute() == RET_OK) - { - rCurrentFunctionData.mnFuncMask = pDialog->GetFuncMask(); - rCurrentLabelData.mnFuncMask = pDialog->GetFuncMask(); + pDialog->StartExecuteAsync([this, pDialog, pCurrentItemValue, rCurrentFunctionData, + rCurrentLabelData, nEntry](int nResult) mutable { + if (nResult == RET_OK) + { + rCurrentFunctionData.mnFuncMask = pDialog->GetFuncMask(); + rCurrentLabelData.mnFuncMask = pDialog->GetFuncMask(); - rCurrentFunctionData.maFieldRef = pDialog->GetFieldRef(); + rCurrentFunctionData.maFieldRef = pDialog->GetFieldRef(); - ScDPLabelData& rDFData = mpParent->GetLabelData(rCurrentFunctionData.mnCol); + ScDPLabelData& rDFData = mpParent->GetLabelData(rCurrentFunctionData.mnCol); - AdjustDuplicateCount(pCurrentItemValue); + AdjustDuplicateCount(pCurrentItemValue); - OUString sDataItemName = lclCreateDataItemName( - rCurrentFunctionData.mnFuncMask, - rDFData.maName, - rCurrentFunctionData.mnDupCount); + OUString sDataItemName = lclCreateDataItemName( + rCurrentFunctionData.mnFuncMask, + rDFData.maName, + rCurrentFunctionData.mnDupCount); - mxControl->set_text(nEntry, sDataItemName); - } + mxControl->set_text(nEntry, sDataItemName); + } + + pDialog->disposeOnce(); + }); return true; } diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx index 0f53cc0c37c6..19fd26559da2 100644 --- a/sc/source/ui/dbgui/pvfundlg.cxx +++ b/sc/source/ui/dbgui/pvfundlg.cxx @@ -540,9 +540,12 @@ IMPL_LINK(ScDPSubtotalDlg, ClickHdl, weld::Button&, rBtn, void) { if (&rBtn == mxBtnOptions.get()) { - ScDPSubtotalOptDlg aDlg(m_xDialog.get(), mrDPObj, maLabelData, mrDataFields, mbEnableLayout); - if (aDlg.run() == RET_OK) - aDlg.FillLabelData(maLabelData); + mxOptionsDlg = std::make_shared<ScDPSubtotalOptDlg>(m_xDialog.get(), mrDPObj, maLabelData, mrDataFields, mbEnableLayout); + + weld::DialogController::runAsync(mxOptionsDlg, [this](int nResult) { + if (nResult == RET_OK) + mxOptionsDlg->FillLabelData(maLabelData); + }); } } diff --git a/sc/source/ui/inc/PivotLayoutTreeList.hxx b/sc/source/ui/inc/PivotLayoutTreeList.hxx index 42f090faa5d9..9ae1695e2e8f 100644 --- a/sc/source/ui/inc/PivotLayoutTreeList.hxx +++ b/sc/source/ui/inc/PivotLayoutTreeList.hxx @@ -19,6 +19,7 @@ class ScPivotLayoutTreeList : public ScPivotLayoutTreeListBase { private: std::vector<std::unique_ptr<ScItemValue> > maItemValues; + std::vector<ScDPName> maDataFieldNames; DECL_LINK(KeyInputHdl, const KeyEvent&, bool); DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); diff --git a/sc/source/ui/inc/pvfundlg.hxx b/sc/source/ui/inc/pvfundlg.hxx index 47891ece7a8d..14bce8af57ab 100644 --- a/sc/source/ui/inc/pvfundlg.hxx +++ b/sc/source/ui/inc/pvfundlg.hxx @@ -89,6 +89,8 @@ private: bool mbEmptyItem; /// true = Empty base item in listbox. }; +class ScDPSubtotalOptDlg; + class ScDPSubtotalDlg : public weld::GenericDialogController { public: @@ -122,6 +124,8 @@ private: std::unique_ptr<weld::CheckButton> mxCbShowAll; std::unique_ptr<weld::Button> mxBtnOk; std::unique_ptr<weld::Button> mxBtnOptions; + + std::shared_ptr<ScDPSubtotalOptDlg> mxOptionsDlg; }; class ScDPSubtotalOptDlg : public weld::GenericDialogController |