[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Jan 12 06:36:09 UTC 2019


 sc/source/ui/condformat/condformatmgr.cxx |    4 +
 sc/source/ui/view/cellsh1.cxx             |   65 +++++++++++++++---------------
 2 files changed, 36 insertions(+), 33 deletions(-)

New commits:
commit f548dfa29239913fd71be67eadc2905010cabd95
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jan 10 14:42:36 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jan 12 07:35:46 2019 +0100

    make Format->Conditional Formatting->Manage dialog async
    
    Change-Id: I13a40c13340ea34cbcbde11289d3420855a7264f
    Reviewed-on: https://gerrit.libreoffice.org/66097
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index 58b2439db60d..e5be9c7435ca 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -171,7 +171,9 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnClickHdl, Button*, void)
 {
     mbModified = true;
     EditBtnHdl(nullptr);
-    UpdateButtonSensitivity();
+    // EditBtnHdl() might call EndDialog which will blow us away
+    if (!IsDisposed())
+        UpdateButtonSensitivity();
 }
 IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl, SvTreeListBox*, bool)
 {
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 5ad819c34da8..38a67388b70e 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2543,44 +2543,45 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 if (!pList)
                     pList = pDoc->GetCondFormList( aPos.Tab() );
 
-                ScopedVclPtr<AbstractScCondFormatManagerDlg> pDlg(pFact->CreateScCondFormatMgrDlg(
+                VclPtr<AbstractScCondFormatManagerDlg> pDlg(pFact->CreateScCondFormatMgrDlg(
                     pTabViewShell->GetDialogParent(), pDoc, pList));
 
                 if (pDlgItem)
                     pDlg->SetModified();
 
-                short nRet = pDlg->Execute();
-                std::unique_ptr<ScConditionalFormatList> pCondFormatList = pDlg->GetConditionalFormatList();
-                if(nRet == RET_OK && pDlg->CondFormatsChanged())
-                {
-                    pData->GetDocShell()->GetDocFunc().SetConditionalFormatList(pCondFormatList.release(), aPos.Tab());
-                }
-                else if(nRet == DLG_RET_ADD)
-                {
-                    // Put the xml string parameter to initialize the
-                    // Conditional Format Dialog. ( add new )
-                    pTabViewShell->GetPool().Put(ScCondFormatDlgItem(
-                                std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), -1, true));
-                    // Queue message to open Conditional Format Dialog
-                    GetViewData()->GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON );
-                }
-                else if (nRet == DLG_RET_EDIT)
-                {
-                    ScConditionalFormat* pFormat = pDlg->GetCondFormatSelected();
-                    sal_Int32 nIndex = pFormat ? pFormat->GetKey() : -1;
-                    // Put the xml string parameter to initialize the
-                    // Conditional Format Dialog. ( edit selected conditional format )
-                    pTabViewShell->GetPool().Put(ScCondFormatDlgItem(
-                                std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), nIndex, true));
-
-                    // Queue message to open Conditional Format Dialog
-                    GetViewData()->GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON );
-                }
-                else
-                    pCondFormatList.reset();
+                pDlg->StartExecuteAsync([this, pDlg, pData, pTabViewShell, pDlgItem, aPos](sal_Int32 nRet){
+                    std::unique_ptr<ScConditionalFormatList> pCondFormatList = pDlg->GetConditionalFormatList();
+                    if(nRet == RET_OK && pDlg->CondFormatsChanged())
+                    {
+                        pData->GetDocShell()->GetDocFunc().SetConditionalFormatList(pCondFormatList.release(), aPos.Tab());
+                    }
+                    else if(nRet == DLG_RET_ADD)
+                    {
+                        // Put the xml string parameter to initialize the
+                        // Conditional Format Dialog. ( add new )
+                        pTabViewShell->GetPool().Put(ScCondFormatDlgItem(
+                                    std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), -1, true));
+                        // Queue message to open Conditional Format Dialog
+                        GetViewData()->GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON );
+                    }
+                    else if (nRet == DLG_RET_EDIT)
+                    {
+                        ScConditionalFormat* pFormat = pDlg->GetCondFormatSelected();
+                        sal_Int32 nIndex = pFormat ? pFormat->GetKey() : -1;
+                        // Put the xml string parameter to initialize the
+                        // Conditional Format Dialog. ( edit selected conditional format )
+                        pTabViewShell->GetPool().Put(ScCondFormatDlgItem(
+                                    std::shared_ptr<ScConditionalFormatList>(pCondFormatList.release()), nIndex, true));
+
+                        // Queue message to open Conditional Format Dialog
+                        GetViewData()->GetDispatcher().Execute( SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON );
+                    }
+                    else
+                        pCondFormatList.reset();
 
-                if (pDlgItem)
-                    pTabViewShell->GetPool().Remove(*pDlgItem);
+                    if (pDlgItem)
+                        pTabViewShell->GetPool().Remove(*pDlgItem);
+                });
             }
             break;
 


More information about the Libreoffice-commits mailing list