diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/scabstdlg.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeList.cxx | 24 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeListData.cxx | 22 | ||||
-rw-r--r-- | sc/source/ui/dbgui/pvfundlg.cxx | 13 | ||||
-rw-r--r-- | sc/source/ui/inc/PivotLayoutTreeList.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/inc/PivotLayoutTreeListData.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/inc/pvfundlg.hxx | 1 |
9 files changed, 62 insertions, 18 deletions
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index dd43683099fb..88ef7ca06017 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -294,6 +294,7 @@ protected: public: virtual PivotFunc GetFuncMask() const = 0; virtual css::sheet::DataPilotFieldReference GetFieldRef() const = 0; + virtual void Response(int nResponse) = 0; }; class AbstractScDPSubtotalDlg : public VclAbstractDialog @@ -303,6 +304,7 @@ protected: public: virtual PivotFunc GetFuncMask() const = 0; virtual void FillLabelData( ScDPLabelData& rLabelData ) const = 0; + virtual void Response(int nResponse) = 0; }; class AbstractScDPNumGroupDlg : public VclAbstractDialog diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index bfa48eeefb3f..5a82f4e7371a 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -760,6 +760,11 @@ PivotFunc AbstractScDPFunctionDlg_Impl::GetFuncMask() const return m_xDlg->GetFuncMask(); } +void AbstractScDPFunctionDlg_Impl::Response(int nResponse) +{ + m_xDlg->response(nResponse); +} + css::sheet::DataPilotFieldReference AbstractScDPFunctionDlg_Impl::GetFieldRef() const { return m_xDlg->GetFieldRef(); @@ -775,6 +780,11 @@ void AbstractScDPSubtotalDlg_Impl::FillLabelData( ScDPLabelData& rLabelData ) co m_xDlg->FillLabelData( rLabelData ); } +void AbstractScDPSubtotalDlg_Impl::Response(int nResponse) +{ + m_xDlg->response(nResponse); +} + ScDPNumGroupInfo AbstractScDPNumGroupDlg_Impl::GetGroupInfo() const { return m_xDlg->GetGroupInfo(); diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index efdaff975f47..c2a376428074 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -474,6 +474,7 @@ public: virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override; virtual PivotFunc GetFuncMask() const override; virtual css::sheet::DataPilotFieldReference GetFieldRef() const override; + virtual void Response(int nResponse) override; }; class AbstractScDPSubtotalDlg_Impl : public AbstractScDPSubtotalDlg @@ -488,6 +489,7 @@ public: virtual bool StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override; virtual PivotFunc GetFuncMask() const override; virtual void FillLabelData( ScDPLabelData& rLabelData ) const override; + virtual void Response(int nResponse) override; }; class AbstractScDPNumGroupDlg_Impl : public AbstractScDPNumGroupDlg diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx index 65e055477276..083dd509438d 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx @@ -15,7 +15,6 @@ #include <vcl/event.hxx> #include <pivot.hxx> -#include <scabstdlg.hxx> ScPivotLayoutTreeList::ScPivotLayoutTreeList(std::unique_ptr<weld::TreeView> xControl) : ScPivotLayoutTreeListBase(std::move(xControl)) @@ -24,7 +23,14 @@ ScPivotLayoutTreeList::ScPivotLayoutTreeList(std::unique_ptr<weld::TreeView> xCo mxControl->connect_row_activated(LINK(this, ScPivotLayoutTreeList, DoubleClickHdl)); } -ScPivotLayoutTreeList::~ScPivotLayoutTreeList() {} +ScPivotLayoutTreeList::~ScPivotLayoutTreeList() +{ + if (mpSubtotalDlg) + { + mpSubtotalDlg->Response(RET_CANCEL); + mpSubtotalDlg.clear(); + } +} void ScPivotLayoutTreeList::Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListType eType) { @@ -53,18 +59,18 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeList, DoubleClickHdl, weld::TreeView&, bool) maDataFieldNames.clear(); mpParent->PushDataFieldNames(maDataFieldNames); - VclPtr<AbstractScDPSubtotalDlg> pDialog( - pFactory->CreateScDPSubtotalDlg(mxControl.get(), mpParent->maPivotTableObject, - rCurrentLabelData, rCurrentFunctionData, maDataFieldNames)); + mpSubtotalDlg = pFactory->CreateScDPSubtotalDlg(mxControl.get(), mpParent->maPivotTableObject, + rCurrentLabelData, rCurrentFunctionData, + maDataFieldNames); - pDialog->StartExecuteAsync([this, pDialog, pCurrentItemValue, nCurrentColumn](int nResult) { + mpSubtotalDlg->StartExecuteAsync([this, pCurrentItemValue, nCurrentColumn](int nResult) { if (nResult == RET_OK) { - pDialog->FillLabelData(mpParent->GetLabelData(nCurrentColumn)); - pCurrentItemValue->maFunctionData.mnFuncMask = pDialog->GetFuncMask(); + mpSubtotalDlg->FillLabelData(mpParent->GetLabelData(nCurrentColumn)); + pCurrentItemValue->maFunctionData.mnFuncMask = mpSubtotalDlg->GetFuncMask(); } - pDialog->disposeOnce(); + mpSubtotalDlg.disposeAndClear(); }); return true; diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx index 6924a72a6773..59949883ff91 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx @@ -17,7 +17,6 @@ #include <vcl/event.hxx> #include <pivot.hxx> -#include <scabstdlg.hxx> #include <globstr.hrc> #include <scresid.hxx> @@ -71,7 +70,13 @@ ScPivotLayoutTreeListData::ScPivotLayoutTreeListData(std::unique_ptr<weld::TreeV } ScPivotLayoutTreeListData::~ScPivotLayoutTreeListData() -{} +{ + if (mpFunctionDlg) + { + mpFunctionDlg->Response(RET_CANCEL); + mpFunctionDlg.clear(); + } +} IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView&, bool) { @@ -87,18 +92,17 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView&, bool ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create(); - VclPtr<AbstractScDPFunctionDlg> pDialog( - pFactory->CreateScDPFunctionDlg(mxControl.get(), mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData)); + mpFunctionDlg = pFactory->CreateScDPFunctionDlg(mxControl.get(), mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData); - pDialog->StartExecuteAsync([this, pDialog, pCurrentItemValue, + mpFunctionDlg->StartExecuteAsync([this, pCurrentItemValue, rCurrentFunctionData, rCurrentLabelData, nEntry](int nResult) mutable { if (nResult == RET_OK) { ScPivotFuncData& rFunctionData = pCurrentItemValue->maFunctionData; - rFunctionData.mnFuncMask = pDialog->GetFuncMask(); - rCurrentLabelData.mnFuncMask = pDialog->GetFuncMask(); + rCurrentFunctionData.mnFuncMask = mpFunctionDlg->GetFuncMask(); + rCurrentLabelData.mnFuncMask = mpFunctionDlg->GetFuncMask(); - rFunctionData.maFieldRef = pDialog->GetFieldRef(); + rCurrentFunctionData.maFieldRef = mpFunctionDlg->GetFieldRef(); ScDPLabelData& rDFData = mpParent->GetLabelData(rFunctionData.mnCol); @@ -112,7 +116,7 @@ IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView&, bool mxControl->set_text(nEntry, sDataItemName); } - pDialog->disposeOnce(); + mpFunctionDlg->disposeOnce(); }); return true; diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx index 481c1b738f92..935bfe82e13b 100644 --- a/sc/source/ui/dbgui/pvfundlg.cxx +++ b/sc/source/ui/dbgui/pvfundlg.cxx @@ -482,6 +482,16 @@ ScDPSubtotalDlg::ScDPSubtotalDlg(weld::Widget* pParent, ScDPObject& rDPObj, ScDPSubtotalDlg::~ScDPSubtotalDlg() { + CloseSubdialog(); +} + +void ScDPSubtotalDlg::CloseSubdialog() +{ + if (mxOptionsDlg && mxOptionsDlg->getDialog()) + { + mxOptionsDlg->getDialog()->response(RET_CANCEL); + mxOptionsDlg = nullptr; + } } PivotFunc ScDPSubtotalDlg::GetFuncMask() const @@ -544,6 +554,8 @@ void ScDPSubtotalDlg::Init( const ScDPLabelData& rLabelData, const ScPivotFuncDa IMPL_LINK(ScDPSubtotalDlg, ButtonClicked, weld::Button&, rButton, void) { + CloseSubdialog(); + if (&rButton == mxBtnOk.get()) response(RET_OK); else @@ -570,6 +582,7 @@ IMPL_LINK(ScDPSubtotalDlg, ClickHdl, weld::Button&, rBtn, void) weld::DialogController::runAsync(mxOptionsDlg, [this](int nResult) { if (nResult == RET_OK) mxOptionsDlg->FillLabelData(maLabelData); + mxOptionsDlg = nullptr; }); } } diff --git a/sc/source/ui/inc/PivotLayoutTreeList.hxx b/sc/source/ui/inc/PivotLayoutTreeList.hxx index cc12f9c8cb2b..14faa13d04ef 100644 --- a/sc/source/ui/inc/PivotLayoutTreeList.hxx +++ b/sc/source/ui/inc/PivotLayoutTreeList.hxx @@ -12,6 +12,7 @@ #include <memory> #include "PivotLayoutTreeListBase.hxx" +#include <scabstdlg.hxx> class ScPivotLayoutTreeList : public ScPivotLayoutTreeListBase { @@ -19,6 +20,8 @@ private: std::vector<std::unique_ptr<ScItemValue>> maItemValues; std::vector<ScDPName> maDataFieldNames; + VclPtr<AbstractScDPSubtotalDlg> mpSubtotalDlg; + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); DECL_LINK(DoubleClickHdl, weld::TreeView&, bool); diff --git a/sc/source/ui/inc/PivotLayoutTreeListData.hxx b/sc/source/ui/inc/PivotLayoutTreeListData.hxx index 54a98365636f..89e83abad515 100644 --- a/sc/source/ui/inc/PivotLayoutTreeListData.hxx +++ b/sc/source/ui/inc/PivotLayoutTreeListData.hxx @@ -13,6 +13,7 @@ #include "PivotLayoutTreeListBase.hxx" #include <vector> #include <memory> +#include <scabstdlg.hxx> class ScPivotLayoutTreeListData final : public ScPivotLayoutTreeListBase { @@ -34,6 +35,8 @@ private: void AdjustDuplicateCount(ScItemValue* pInputItemValue); std::vector<std::unique_ptr<ScItemValue>> maDataItemValues; + + VclPtr<AbstractScDPFunctionDlg> mpFunctionDlg; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/pvfundlg.hxx b/sc/source/ui/inc/pvfundlg.hxx index 1215adc89b36..6c75ee1a6f87 100644 --- a/sc/source/ui/inc/pvfundlg.hxx +++ b/sc/source/ui/inc/pvfundlg.hxx @@ -106,6 +106,7 @@ public: private: void Init( const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ); + void CloseSubdialog(); DECL_LINK( DblClickHdl, weld::TreeView&, bool ); DECL_LINK( RadioClickHdl, weld::Button&, void ); |