[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 2 commits - sc/source vcl/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 16 08:31:18 UTC 2020


 sc/source/ui/attrdlg/scdlgfact.cxx             |   10 +++++++
 sc/source/ui/attrdlg/scdlgfact.hxx             |    6 +++-
 sc/source/ui/dbgui/PivotLayoutTreeList.cxx     |   26 +++++++++++--------
 sc/source/ui/dbgui/PivotLayoutTreeListData.cxx |   33 ++++++++++++++-----------
 sc/source/ui/dbgui/pvfundlg.cxx                |    9 ++++--
 sc/source/ui/inc/PivotLayoutTreeList.hxx       |    1 
 sc/source/ui/inc/pvfundlg.hxx                  |    4 +++
 vcl/source/window/builder.cxx                  |    5 +++
 8 files changed, 63 insertions(+), 31 deletions(-)

New commits:
commit 4e7a56415090b39e7a34eec68189797319459c9d
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Dec 15 15:31:49 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Dec 16 09:30:51 2020 +0100

    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 at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

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
commit cd53ae78850a4b612588e144c3f90ca73cddf498
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Dec 15 15:32:18 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed Dec 16 09:30:40 2020 +0100

    jsdialog: enable Data field dialogs
    
    Change-Id: I87a1446737f7d73b4d8b5b03590a0fcd3236c97c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107776
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index bc1e9d36c10a..97f48ddf545d 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -186,7 +186,10 @@ weld::Builder* Application::CreateBuilder(weld::Widget* pParent, const OUString
             || rUIFile == "modules/scalc/ui/ttestdialog.ui"
             || rUIFile == "modules/scalc/ui/ztestdialog.ui"
             || rUIFile == "modules/scalc/ui/chisquaretestdialog.ui"
-            || rUIFile == "modules/scalc/ui/fourieranalysisdialog.ui")
+            || rUIFile == "modules/scalc/ui/fourieranalysisdialog.ui"
+            || rUIFile == "modules/scalc/ui/datafielddialog.ui"
+            || rUIFile == "modules/scalc/ui/pivotfielddialog.ui"
+            || rUIFile == "modules/scalc/ui/datafieldoptionsdialog.ui")
         {
             bUseJSBuilder = true;
         }


More information about the Libreoffice-commits mailing list